Skip to content

Commit a333105

Browse files
authored
Merge pull request #430 from objectstack-ai/copilot/update-job-status-checks
2 parents 1f0c19f + 35cd6ef commit a333105

21 files changed

Lines changed: 775 additions & 24 deletions

content/docs/references/meta.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
{
22
"title": "Protocol Reference",
33
"pages": [
4-
"packages",
54
"data",
65
"ui",
76
"automation",
87
"system",
98
"permission",
109
"ai",
1110
"api",
12-
"driver",
13-
"hub",
14-
"integration",
15-
"auth",
16-
"shared"
11+
"driver"
1712
]
1813
}

content/docs/references/system/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This section contains all protocol schemas for the system layer of ObjectStack.
2424
<Card href="./manifest" title="Manifest" description="Source: packages/spec/src/system/manifest.zod.ts" />
2525
<Card href="./masking" title="Masking" description="Source: packages/spec/src/system/masking.zod.ts" />
2626
<Card href="./message-queue" title="Message Queue" description="Source: packages/spec/src/system/message-queue.zod.ts" />
27+
<Card href="./metadata-loader" title="Metadata Loader" description="Source: packages/spec/src/system/metadata-loader.zod.ts" />
2728
<Card href="./metrics" title="Metrics" description="Source: packages/spec/src/system/metrics.zod.ts" />
2829
<Card href="./notification" title="Notification" description="Source: packages/spec/src/system/notification.zod.ts" />
2930
<Card href="./object-storage" title="Object Storage" description="Source: packages/spec/src/system/object-storage.zod.ts" />

content/docs/references/system/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"manifest",
1818
"masking",
1919
"message-queue",
20+
"metadata-loader",
2021
"metrics",
2122
"notification",
2223
"object-storage",

packages/metadata/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"@objectstack/types": "workspace:*",
2626
"glob": "^10.3.10",
2727
"js-yaml": "^4.1.0",
28-
"chokidar": "^3.5.3"
28+
"chokidar": "^3.5.3",
29+
"zod": "^3.22.4"
2930
},
3031
"devDependencies": {
3132
"@types/js-yaml": "^4.0.9",

packages/metadata/src/loaders/filesystem-loader.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ export class FilesystemLoader implements MetadataLoader {
3636
private logger?: Logger
3737
) {}
3838

39-
async load<T = any>(
39+
async load(
4040
type: string,
4141
name: string,
4242
options?: MetadataLoadOptions
43-
): Promise<MetadataLoadResult<T>> {
43+
): Promise<MetadataLoadResult> {
4444
const startTime = Date.now();
45-
const { validate = true, useCache = true, ifNoneMatch } = options || {};
45+
const { validate: _validate = true, useCache = true, ifNoneMatch } = options || {};
4646

4747
try {
4848
// Find the file
@@ -87,7 +87,7 @@ export class FilesystemLoader implements MetadataLoader {
8787
const cached = this.cache.get(cacheKey)!;
8888
if (cached.etag === stats.etag) {
8989
return {
90-
data: cached.data as T,
90+
data: cached.data,
9191
fromCache: true,
9292
notModified: false,
9393
etag: stats.etag,
@@ -105,7 +105,7 @@ export class FilesystemLoader implements MetadataLoader {
105105
throw new Error(`No serializer found for format: ${stats.format}`);
106106
}
107107

108-
const data = serializer.deserialize<T>(content);
108+
const data = serializer.deserialize(content);
109109

110110
// Update cache
111111
if (useCache) {
@@ -125,7 +125,7 @@ export class FilesystemLoader implements MetadataLoader {
125125
loadTime: Date.now() - startTime,
126126
};
127127
} catch (error) {
128-
this.logger?.error('Failed to load metadata', {
128+
this.logger?.error('Failed to load metadata', undefined, {
129129
type,
130130
name,
131131
error: error instanceof Error ? error.message : String(error),
@@ -138,7 +138,7 @@ export class FilesystemLoader implements MetadataLoader {
138138
type: string,
139139
options?: MetadataLoadOptions
140140
): Promise<T[]> {
141-
const { patterns = ['**/*'], recursive = true, limit } = options || {};
141+
const { patterns = ['**/*'], recursive: _recursive = true, limit } = options || {};
142142

143143
const typeDir = path.join(this.rootDir, type);
144144
const items: T[] = [];
@@ -184,7 +184,7 @@ export class FilesystemLoader implements MetadataLoader {
184184

185185
return items;
186186
} catch (error) {
187-
this.logger?.error('Failed to load many', {
187+
this.logger?.error('Failed to load many', undefined, {
188188
type,
189189
patterns,
190190
error: error instanceof Error ? error.message : String(error),
@@ -219,7 +219,7 @@ export class FilesystemLoader implements MetadataLoader {
219219
path: filePath,
220220
};
221221
} catch (error) {
222-
this.logger?.error('Failed to stat file', {
222+
this.logger?.error('Failed to stat file', undefined, {
223223
type,
224224
name,
225225
filePath,
@@ -245,7 +245,7 @@ export class FilesystemLoader implements MetadataLoader {
245245
return basename;
246246
});
247247
} catch (error) {
248-
this.logger?.error('Failed to list', {
248+
this.logger?.error('Failed to list', undefined, {
249249
type,
250250
error: error instanceof Error ? error.message : String(error),
251251
});

packages/metadata/src/loaders/loader-interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export interface MetadataLoader {
2828
* @param options Load options
2929
* @returns Load result with data or null if not found
3030
*/
31-
load<T = any>(
31+
load(
3232
type: string,
3333
name: string,
3434
options?: MetadataLoadOptions
35-
): Promise<MetadataLoadResult<T>>;
35+
): Promise<MetadataLoadResult>;
3636

3737
/**
3838
* Load multiple items matching patterns

packages/metadata/src/metadata-manager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class MetadataManager {
7777
name: string,
7878
options?: MetadataLoadOptions
7979
): Promise<T | null> {
80-
const result = await this.loader.load<T>(type, name, options);
80+
const result = await this.loader.load(type, name, options);
8181
return result.data;
8282
}
8383

@@ -181,7 +181,7 @@ export class MetadataManager {
181181
backupPath,
182182
};
183183
} catch (error) {
184-
this.logger.error('Failed to save metadata', {
184+
this.logger.error('Failed to save metadata', undefined, {
185185
type,
186186
name,
187187
error: error instanceof Error ? error.message : String(error),
@@ -296,7 +296,7 @@ export class MetadataManager {
296296
try {
297297
data = await this.load(type, name, { useCache: false });
298298
} catch (error) {
299-
this.logger.error('Failed to load changed file', {
299+
this.logger.error('Failed to load changed file', undefined, {
300300
filePath,
301301
error: error instanceof Error ? error.message : String(error),
302302
});
@@ -317,7 +317,7 @@ export class MetadataManager {
317317
try {
318318
await callback(event);
319319
} catch (error) {
320-
this.logger.error('Watch callback error', {
320+
this.logger.error('Watch callback error', undefined, {
321321
type,
322322
name,
323323
error: error instanceof Error ? error.message : String(error),
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"$ref": "#/definitions/MetadataCollectionInfo",
3+
"definitions": {
4+
"MetadataCollectionInfo": {
5+
"type": "object",
6+
"properties": {
7+
"type": {
8+
"type": "string",
9+
"description": "Collection type"
10+
},
11+
"count": {
12+
"type": "integer",
13+
"minimum": 0,
14+
"description": "Number of items"
15+
},
16+
"formats": {
17+
"type": "array",
18+
"items": {
19+
"type": "string",
20+
"enum": [
21+
"json",
22+
"yaml",
23+
"typescript",
24+
"javascript"
25+
]
26+
},
27+
"description": "Formats in collection"
28+
},
29+
"totalSize": {
30+
"type": "integer",
31+
"minimum": 0,
32+
"description": "Total size in bytes"
33+
},
34+
"lastModified": {
35+
"type": "string",
36+
"format": "date-time",
37+
"description": "Last modification date"
38+
},
39+
"location": {
40+
"type": "string",
41+
"description": "Collection location"
42+
}
43+
},
44+
"required": [
45+
"type",
46+
"count",
47+
"formats"
48+
],
49+
"additionalProperties": false
50+
}
51+
},
52+
"$schema": "http://json-schema.org/draft-07/schema#"
53+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$ref": "#/definitions/MetadataExportOptions",
3+
"definitions": {
4+
"MetadataExportOptions": {
5+
"type": "object",
6+
"properties": {
7+
"output": {
8+
"type": "string",
9+
"description": "Output file path"
10+
},
11+
"format": {
12+
"type": "string",
13+
"enum": [
14+
"json",
15+
"yaml",
16+
"typescript",
17+
"javascript"
18+
],
19+
"default": "json",
20+
"description": "Export format"
21+
},
22+
"filter": {
23+
"type": "string",
24+
"description": "Filter items to export"
25+
},
26+
"includeStats": {
27+
"type": "boolean",
28+
"default": false,
29+
"description": "Include metadata statistics"
30+
},
31+
"compress": {
32+
"type": "boolean",
33+
"default": false,
34+
"description": "Compress output (gzip)"
35+
},
36+
"prettify": {
37+
"type": "boolean",
38+
"default": true,
39+
"description": "Pretty print output"
40+
}
41+
},
42+
"required": [
43+
"output"
44+
],
45+
"additionalProperties": false
46+
}
47+
},
48+
"$schema": "http://json-schema.org/draft-07/schema#"
49+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$ref": "#/definitions/MetadataFormat",
3+
"definitions": {
4+
"MetadataFormat": {
5+
"type": "string",
6+
"enum": [
7+
"json",
8+
"yaml",
9+
"typescript",
10+
"javascript"
11+
]
12+
}
13+
},
14+
"$schema": "http://json-schema.org/draft-07/schema#"
15+
}

0 commit comments

Comments
 (0)