@objectstack/metadata 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.turbo/turbo-build.log +22 -0
  2. package/CHANGELOG.md +31 -0
  3. package/dist/index.d.mts +306 -0
  4. package/dist/index.d.ts +305 -16
  5. package/dist/index.js +1078 -15
  6. package/dist/index.js.map +1 -0
  7. package/dist/index.mjs +1040 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +7 -7
  10. package/tsconfig.json +1 -3
  11. package/dist/index.d.ts.map +0 -1
  12. package/dist/loaders/filesystem-loader.d.ts +0 -42
  13. package/dist/loaders/filesystem-loader.d.ts.map +0 -1
  14. package/dist/loaders/filesystem-loader.js +0 -342
  15. package/dist/loaders/loader-interface.d.ts +0 -60
  16. package/dist/loaders/loader-interface.d.ts.map +0 -1
  17. package/dist/loaders/loader-interface.js +0 -6
  18. package/dist/loaders/memory-loader.d.ts +0 -19
  19. package/dist/loaders/memory-loader.d.ts.map +0 -1
  20. package/dist/loaders/memory-loader.js +0 -71
  21. package/dist/loaders/remote-loader.d.ts +0 -22
  22. package/dist/loaders/remote-loader.d.ts.map +0 -1
  23. package/dist/loaders/remote-loader.js +0 -103
  24. package/dist/metadata-manager.d.ts +0 -71
  25. package/dist/metadata-manager.d.ts.map +0 -1
  26. package/dist/metadata-manager.js +0 -211
  27. package/dist/migration/executor.d.ts +0 -9
  28. package/dist/migration/executor.d.ts.map +0 -1
  29. package/dist/migration/executor.js +0 -49
  30. package/dist/migration/index.d.ts +0 -2
  31. package/dist/migration/index.d.ts.map +0 -1
  32. package/dist/migration/index.js +0 -1
  33. package/dist/node-metadata-manager.d.ts +0 -26
  34. package/dist/node-metadata-manager.d.ts.map +0 -1
  35. package/dist/node-metadata-manager.js +0 -98
  36. package/dist/node.d.ts +0 -8
  37. package/dist/node.d.ts.map +0 -1
  38. package/dist/node.js +0 -7
  39. package/dist/plugin.d.ts +0 -15
  40. package/dist/plugin.d.ts.map +0 -1
  41. package/dist/plugin.js +0 -71
  42. package/dist/serializers/json-serializer.d.ts +0 -20
  43. package/dist/serializers/json-serializer.d.ts.map +0 -1
  44. package/dist/serializers/json-serializer.js +0 -53
  45. package/dist/serializers/serializer-interface.d.ts +0 -57
  46. package/dist/serializers/serializer-interface.d.ts.map +0 -1
  47. package/dist/serializers/serializer-interface.js +0 -6
  48. package/dist/serializers/serializers.test.d.ts +0 -2
  49. package/dist/serializers/serializers.test.d.ts.map +0 -1
  50. package/dist/serializers/serializers.test.js +0 -62
  51. package/dist/serializers/typescript-serializer.d.ts +0 -18
  52. package/dist/serializers/typescript-serializer.d.ts.map +0 -1
  53. package/dist/serializers/typescript-serializer.js +0 -103
  54. package/dist/serializers/yaml-serializer.d.ts +0 -16
  55. package/dist/serializers/yaml-serializer.d.ts.map +0 -1
  56. package/dist/serializers/yaml-serializer.js +0 -35
@@ -0,0 +1,22 @@
1
+
2
+ > @objectstack/metadata@1.0.5 build /home/runner/work/spec/spec/packages/metadata
3
+ > tsup --config ../../tsup.config.ts
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Using tsup config: /home/runner/work/spec/spec/tsup.config.ts
9
+ CLI Target: es2020
10
+ CLI Cleaning output folder
11
+ ESM Build start
12
+ CJS Build start
13
+ CJS dist/index.js 30.34 KB
14
+ CJS dist/index.js.map 61.88 KB
15
+ CJS ⚡️ Build success in 86ms
16
+ ESM dist/index.mjs 28.54 KB
17
+ ESM dist/index.mjs.map 60.57 KB
18
+ ESM ⚡️ Build success in 89ms
19
+ DTS Build start
20
+ DTS ⚡️ Build success in 10337ms
21
+ DTS dist/index.d.mts 9.91 KB
22
+ DTS dist/index.d.ts 9.91 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @objectstack/metadata
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - b1d24bd: refactor: migrate build system from tsc to tsup for faster builds
8
+ - Replaced `tsc` with `tsup` (using esbuild) across all packages
9
+ - Added shared `tsup.config.ts` in workspace root
10
+ - Added `tsup` as workspace dev dependency
11
+ - significantly improved build performance
12
+ - Updated dependencies [b1d24bd]
13
+ - @objectstack/core@1.0.5
14
+ - @objectstack/types@1.0.5
15
+ - @objectstack/spec@1.0.5
16
+
17
+ ## 1.0.4
18
+
19
+ ### Patch Changes
20
+
21
+ - @objectstack/spec@1.0.4
22
+ - @objectstack/core@1.0.4
23
+ - @objectstack/types@1.0.4
24
+
25
+ ## 1.0.3
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [fb2eabd]
30
+ - @objectstack/core@1.0.3
31
+ - @objectstack/spec@1.0.3
32
+ - @objectstack/types@1.0.3
33
+
3
34
  ## 1.0.2
4
35
 
5
36
  ### Patch Changes
@@ -0,0 +1,306 @@
1
+ import { MetadataFormat, MetadataLoaderContract, MetadataLoadOptions, MetadataLoadResult, MetadataStats, MetadataSaveOptions, MetadataSaveResult, MetadataWatchEvent, MetadataManagerConfig } from '@objectstack/spec/system';
2
+ export { MetadataCollectionInfo, MetadataExportOptions, MetadataFormat, MetadataImportOptions, MetadataLoadOptions, MetadataLoadResult, MetadataLoaderContract, MetadataManagerConfig, MetadataSaveOptions, MetadataSaveResult, MetadataStats, MetadataWatchEvent } from '@objectstack/spec/system';
3
+ import { Logger, Plugin, PluginContext } from '@objectstack/core';
4
+ import { z } from 'zod';
5
+ import { System } from '@objectstack/spec';
6
+ import { ISchemaDriver } from '@objectstack/spec/contracts';
7
+
8
+ /**
9
+ * Metadata Serializer Interface
10
+ *
11
+ * Defines the contract for serializing/deserializing metadata
12
+ */
13
+
14
+ /**
15
+ * Serialization options
16
+ */
17
+ interface SerializeOptions {
18
+ /** Prettify output (formatted with indentation) */
19
+ prettify?: boolean;
20
+ /** Indentation size (spaces) */
21
+ indent?: number;
22
+ /** Sort object keys alphabetically */
23
+ sortKeys?: boolean;
24
+ /** Include default values in output */
25
+ includeDefaults?: boolean;
26
+ }
27
+ /**
28
+ * Abstract interface for metadata serializers
29
+ * Implementations handle different formats (JSON, YAML, TypeScript, etc.)
30
+ */
31
+ interface MetadataSerializer {
32
+ /**
33
+ * Serialize object to string
34
+ * @param item The item to serialize
35
+ * @param options Serialization options
36
+ * @returns Serialized string
37
+ */
38
+ serialize<T>(item: T, options?: SerializeOptions): string;
39
+ /**
40
+ * Deserialize string to object
41
+ * @param content The content to deserialize
42
+ * @param schema Optional Zod schema for validation
43
+ * @returns Deserialized object
44
+ */
45
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
46
+ /**
47
+ * Get file extension for this format
48
+ * @returns File extension (e.g., '.json', '.yaml')
49
+ */
50
+ getExtension(): string;
51
+ /**
52
+ * Check if this serializer can handle the format
53
+ * @param format The format to check
54
+ * @returns True if can handle
55
+ */
56
+ canHandle(format: MetadataFormat): boolean;
57
+ /**
58
+ * Get the format this serializer handles
59
+ * @returns The metadata format
60
+ */
61
+ getFormat(): MetadataFormat;
62
+ }
63
+
64
+ /**
65
+ * Metadata Loader Interface
66
+ *
67
+ * Defines the contract for loading metadata from various sources
68
+ */
69
+
70
+ /**
71
+ * Abstract interface for metadata loaders
72
+ * Implementations can load from filesystem, HTTP, S3, databases, etc.
73
+ */
74
+ interface MetadataLoader {
75
+ /**
76
+ * Loader contract information
77
+ */
78
+ readonly contract: MetadataLoaderContract;
79
+ /**
80
+ * Load a single metadata item
81
+ * @param type The metadata type (e.g., 'object', 'view', 'app')
82
+ * @param name The item name/identifier
83
+ * @param options Load options
84
+ * @returns Load result with data or null if not found
85
+ */
86
+ load(type: string, name: string, options?: MetadataLoadOptions): Promise<MetadataLoadResult>;
87
+ /**
88
+ * Load multiple items matching patterns
89
+ * @param type The metadata type
90
+ * @param options Load options with patterns
91
+ * @returns Array of loaded items
92
+ */
93
+ loadMany<T = any>(type: string, options?: MetadataLoadOptions): Promise<T[]>;
94
+ /**
95
+ * Check if item exists
96
+ * @param type The metadata type
97
+ * @param name The item name
98
+ * @returns True if exists
99
+ */
100
+ exists(type: string, name: string): Promise<boolean>;
101
+ /**
102
+ * Get item metadata (without loading full content)
103
+ * @param type The metadata type
104
+ * @param name The item name
105
+ * @returns Metadata statistics
106
+ */
107
+ stat(type: string, name: string): Promise<MetadataStats | null>;
108
+ /**
109
+ * List all items of a type
110
+ * @param type The metadata type
111
+ * @returns Array of item names
112
+ */
113
+ list(type: string): Promise<string[]>;
114
+ /**
115
+ * Save metadata item
116
+ * @param type The metadata type
117
+ * @param name The item name
118
+ * @param data The data to save
119
+ * @param options Save options
120
+ */
121
+ save?(type: string, name: string, data: any, options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
122
+ }
123
+
124
+ /**
125
+ * Metadata Manager
126
+ *
127
+ * Main orchestrator for metadata loading, saving, and persistence.
128
+ * Browser-compatible (Pure).
129
+ */
130
+
131
+ /**
132
+ * Watch callback function
133
+ */
134
+ type WatchCallback = (event: MetadataWatchEvent) => void | Promise<void>;
135
+ interface MetadataManagerOptions extends MetadataManagerConfig {
136
+ loaders?: MetadataLoader[];
137
+ }
138
+ /**
139
+ * Main metadata manager class
140
+ */
141
+ declare class MetadataManager {
142
+ private loaders;
143
+ protected serializers: Map<MetadataFormat, MetadataSerializer>;
144
+ protected logger: Logger;
145
+ protected watchCallbacks: Map<string, Set<WatchCallback>>;
146
+ protected config: MetadataManagerOptions;
147
+ constructor(config: MetadataManagerOptions);
148
+ /**
149
+ * Register a new metadata loader (data source)
150
+ */
151
+ registerLoader(loader: MetadataLoader): void;
152
+ /**
153
+ * Load a single metadata item
154
+ * Iterates through registered loaders until found
155
+ */
156
+ load<T = any>(type: string, name: string, options?: MetadataLoadOptions): Promise<T | null>;
157
+ /**
158
+ * Load multiple metadata items
159
+ * Aggregates results from all loaders
160
+ */
161
+ loadMany<T = any>(type: string, options?: MetadataLoadOptions): Promise<T[]>;
162
+ /**
163
+ * Save metadata to disk
164
+ */
165
+ /**
166
+ * Save metadata item
167
+ */
168
+ save<T = any>(type: string, name: string, data: T, options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
169
+ /**
170
+ * Check if metadata item exists
171
+ */
172
+ exists(type: string, name: string): Promise<boolean>;
173
+ /**
174
+ * List all items of a type
175
+ */
176
+ list(type: string): Promise<string[]>;
177
+ /**
178
+ * Watch for metadata changes
179
+ */
180
+ watch(type: string, callback: WatchCallback): void;
181
+ /**
182
+ * Unwatch metadata changes
183
+ */
184
+ unwatch(type: string, callback: WatchCallback): void;
185
+ /**
186
+ * Stop all watching
187
+ */
188
+ stopWatching(): Promise<void>;
189
+ protected notifyWatchers(type: string, event: MetadataWatchEvent): void;
190
+ }
191
+
192
+ interface MetadataPluginOptions {
193
+ rootDir?: string;
194
+ watch?: boolean;
195
+ }
196
+ declare class MetadataPlugin implements Plugin {
197
+ name: string;
198
+ version: string;
199
+ private manager;
200
+ private options;
201
+ constructor(options?: MetadataPluginOptions);
202
+ init: (ctx: PluginContext) => Promise<void>;
203
+ start: (ctx: PluginContext) => Promise<void>;
204
+ }
205
+
206
+ /**
207
+ * Memory Metadata Loader
208
+ *
209
+ * Stores metadata in memory only. Changes are lost when process restarts.
210
+ * Useful for testing, temporary overrides, or "dirty" edits.
211
+ */
212
+
213
+ declare class MemoryLoader implements MetadataLoader {
214
+ readonly contract: MetadataLoaderContract;
215
+ private storage;
216
+ load(type: string, name: string, _options?: MetadataLoadOptions): Promise<MetadataLoadResult>;
217
+ loadMany<T = any>(type: string, _options?: MetadataLoadOptions): Promise<T[]>;
218
+ exists(type: string, name: string): Promise<boolean>;
219
+ stat(type: string, name: string): Promise<MetadataStats | null>;
220
+ list(type: string): Promise<string[]>;
221
+ save(type: string, name: string, data: any, _options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
222
+ }
223
+
224
+ /**
225
+ * Remote Metadata Loader
226
+ *
227
+ * Loads metadata from an HTTP API.
228
+ * This loader is stateless and delegates storage to the remote server.
229
+ */
230
+
231
+ declare class RemoteLoader implements MetadataLoader {
232
+ private baseUrl;
233
+ private authToken?;
234
+ readonly contract: MetadataLoaderContract;
235
+ constructor(baseUrl: string, authToken?: string | undefined);
236
+ private get headers();
237
+ load(type: string, name: string, _options?: MetadataLoadOptions): Promise<MetadataLoadResult>;
238
+ loadMany<T = any>(type: string, _options?: MetadataLoadOptions): Promise<T[]>;
239
+ exists(type: string, name: string): Promise<boolean>;
240
+ stat(type: string, name: string): Promise<MetadataStats | null>;
241
+ list(type: string): Promise<string[]>;
242
+ save(type: string, name: string, data: any, _options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
243
+ }
244
+
245
+ /**
246
+ * JSON Metadata Serializer
247
+ *
248
+ * Handles JSON format serialization and deserialization
249
+ */
250
+
251
+ declare class JSONSerializer implements MetadataSerializer {
252
+ serialize<T>(item: T, options?: SerializeOptions): string;
253
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
254
+ getExtension(): string;
255
+ canHandle(format: MetadataFormat): boolean;
256
+ getFormat(): MetadataFormat;
257
+ /**
258
+ * Recursively sort object keys
259
+ */
260
+ private sortObjectKeys;
261
+ }
262
+
263
+ /**
264
+ * YAML Metadata Serializer
265
+ *
266
+ * Handles YAML format serialization and deserialization
267
+ */
268
+
269
+ declare class YAMLSerializer implements MetadataSerializer {
270
+ serialize<T>(item: T, options?: SerializeOptions): string;
271
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
272
+ getExtension(): string;
273
+ canHandle(format: MetadataFormat): boolean;
274
+ getFormat(): MetadataFormat;
275
+ }
276
+
277
+ declare class MigrationExecutor {
278
+ private driver;
279
+ constructor(driver: ISchemaDriver);
280
+ executeChangeSet(changeSet: System.ChangeSet): Promise<void>;
281
+ private executeOperation;
282
+ }
283
+
284
+ type index_MigrationExecutor = MigrationExecutor;
285
+ declare const index_MigrationExecutor: typeof MigrationExecutor;
286
+ declare namespace index {
287
+ export { index_MigrationExecutor as MigrationExecutor };
288
+ }
289
+
290
+ /**
291
+ * TypeScript/JavaScript Metadata Serializer
292
+ *
293
+ * Handles TypeScript/JavaScript module format serialization and deserialization
294
+ */
295
+
296
+ declare class TypeScriptSerializer implements MetadataSerializer {
297
+ private format;
298
+ constructor(format?: 'typescript' | 'javascript');
299
+ serialize<T>(item: T, options?: SerializeOptions): string;
300
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
301
+ getExtension(): string;
302
+ canHandle(format: MetadataFormat): boolean;
303
+ getFormat(): MetadataFormat;
304
+ }
305
+
306
+ export { JSONSerializer, MemoryLoader, type MetadataLoader, MetadataManager, type MetadataManagerOptions, MetadataPlugin, type MetadataSerializer, index as Migration, RemoteLoader, type SerializeOptions, TypeScriptSerializer, type WatchCallback, YAMLSerializer };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,306 @@
1
+ import { MetadataFormat, MetadataLoaderContract, MetadataLoadOptions, MetadataLoadResult, MetadataStats, MetadataSaveOptions, MetadataSaveResult, MetadataWatchEvent, MetadataManagerConfig } from '@objectstack/spec/system';
2
+ export { MetadataCollectionInfo, MetadataExportOptions, MetadataFormat, MetadataImportOptions, MetadataLoadOptions, MetadataLoadResult, MetadataLoaderContract, MetadataManagerConfig, MetadataSaveOptions, MetadataSaveResult, MetadataStats, MetadataWatchEvent } from '@objectstack/spec/system';
3
+ import { Logger, Plugin, PluginContext } from '@objectstack/core';
4
+ import { z } from 'zod';
5
+ import { System } from '@objectstack/spec';
6
+ import { ISchemaDriver } from '@objectstack/spec/contracts';
7
+
1
8
  /**
2
- * @objectstack/metadata
3
- *
4
- * Metadata loading, saving, and persistence for ObjectStack
5
- */
6
- export { MetadataManager, type WatchCallback, type MetadataManagerOptions } from './metadata-manager.js';
7
- export { MetadataPlugin } from './plugin.js';
8
- export { type MetadataLoader } from './loaders/loader-interface.js';
9
- export { MemoryLoader } from './loaders/memory-loader.js';
10
- export { RemoteLoader } from './loaders/remote-loader.js';
11
- export { type MetadataSerializer, type SerializeOptions } from './serializers/serializer-interface.js';
12
- export { JSONSerializer } from './serializers/json-serializer.js';
13
- export { YAMLSerializer } from './serializers/yaml-serializer.js';
14
- export * as Migration from './migration/index.js';
15
- export { TypeScriptSerializer } from './serializers/typescript-serializer.js';
16
- export type { MetadataFormat, MetadataStats, MetadataLoadOptions, MetadataSaveOptions, MetadataExportOptions, MetadataImportOptions, MetadataLoadResult, MetadataSaveResult, MetadataWatchEvent, MetadataCollectionInfo, MetadataLoaderContract, MetadataManagerConfig, } from '@objectstack/spec/system';
17
- //# sourceMappingURL=index.d.ts.map
9
+ * Metadata Serializer Interface
10
+ *
11
+ * Defines the contract for serializing/deserializing metadata
12
+ */
13
+
14
+ /**
15
+ * Serialization options
16
+ */
17
+ interface SerializeOptions {
18
+ /** Prettify output (formatted with indentation) */
19
+ prettify?: boolean;
20
+ /** Indentation size (spaces) */
21
+ indent?: number;
22
+ /** Sort object keys alphabetically */
23
+ sortKeys?: boolean;
24
+ /** Include default values in output */
25
+ includeDefaults?: boolean;
26
+ }
27
+ /**
28
+ * Abstract interface for metadata serializers
29
+ * Implementations handle different formats (JSON, YAML, TypeScript, etc.)
30
+ */
31
+ interface MetadataSerializer {
32
+ /**
33
+ * Serialize object to string
34
+ * @param item The item to serialize
35
+ * @param options Serialization options
36
+ * @returns Serialized string
37
+ */
38
+ serialize<T>(item: T, options?: SerializeOptions): string;
39
+ /**
40
+ * Deserialize string to object
41
+ * @param content The content to deserialize
42
+ * @param schema Optional Zod schema for validation
43
+ * @returns Deserialized object
44
+ */
45
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
46
+ /**
47
+ * Get file extension for this format
48
+ * @returns File extension (e.g., '.json', '.yaml')
49
+ */
50
+ getExtension(): string;
51
+ /**
52
+ * Check if this serializer can handle the format
53
+ * @param format The format to check
54
+ * @returns True if can handle
55
+ */
56
+ canHandle(format: MetadataFormat): boolean;
57
+ /**
58
+ * Get the format this serializer handles
59
+ * @returns The metadata format
60
+ */
61
+ getFormat(): MetadataFormat;
62
+ }
63
+
64
+ /**
65
+ * Metadata Loader Interface
66
+ *
67
+ * Defines the contract for loading metadata from various sources
68
+ */
69
+
70
+ /**
71
+ * Abstract interface for metadata loaders
72
+ * Implementations can load from filesystem, HTTP, S3, databases, etc.
73
+ */
74
+ interface MetadataLoader {
75
+ /**
76
+ * Loader contract information
77
+ */
78
+ readonly contract: MetadataLoaderContract;
79
+ /**
80
+ * Load a single metadata item
81
+ * @param type The metadata type (e.g., 'object', 'view', 'app')
82
+ * @param name The item name/identifier
83
+ * @param options Load options
84
+ * @returns Load result with data or null if not found
85
+ */
86
+ load(type: string, name: string, options?: MetadataLoadOptions): Promise<MetadataLoadResult>;
87
+ /**
88
+ * Load multiple items matching patterns
89
+ * @param type The metadata type
90
+ * @param options Load options with patterns
91
+ * @returns Array of loaded items
92
+ */
93
+ loadMany<T = any>(type: string, options?: MetadataLoadOptions): Promise<T[]>;
94
+ /**
95
+ * Check if item exists
96
+ * @param type The metadata type
97
+ * @param name The item name
98
+ * @returns True if exists
99
+ */
100
+ exists(type: string, name: string): Promise<boolean>;
101
+ /**
102
+ * Get item metadata (without loading full content)
103
+ * @param type The metadata type
104
+ * @param name The item name
105
+ * @returns Metadata statistics
106
+ */
107
+ stat(type: string, name: string): Promise<MetadataStats | null>;
108
+ /**
109
+ * List all items of a type
110
+ * @param type The metadata type
111
+ * @returns Array of item names
112
+ */
113
+ list(type: string): Promise<string[]>;
114
+ /**
115
+ * Save metadata item
116
+ * @param type The metadata type
117
+ * @param name The item name
118
+ * @param data The data to save
119
+ * @param options Save options
120
+ */
121
+ save?(type: string, name: string, data: any, options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
122
+ }
123
+
124
+ /**
125
+ * Metadata Manager
126
+ *
127
+ * Main orchestrator for metadata loading, saving, and persistence.
128
+ * Browser-compatible (Pure).
129
+ */
130
+
131
+ /**
132
+ * Watch callback function
133
+ */
134
+ type WatchCallback = (event: MetadataWatchEvent) => void | Promise<void>;
135
+ interface MetadataManagerOptions extends MetadataManagerConfig {
136
+ loaders?: MetadataLoader[];
137
+ }
138
+ /**
139
+ * Main metadata manager class
140
+ */
141
+ declare class MetadataManager {
142
+ private loaders;
143
+ protected serializers: Map<MetadataFormat, MetadataSerializer>;
144
+ protected logger: Logger;
145
+ protected watchCallbacks: Map<string, Set<WatchCallback>>;
146
+ protected config: MetadataManagerOptions;
147
+ constructor(config: MetadataManagerOptions);
148
+ /**
149
+ * Register a new metadata loader (data source)
150
+ */
151
+ registerLoader(loader: MetadataLoader): void;
152
+ /**
153
+ * Load a single metadata item
154
+ * Iterates through registered loaders until found
155
+ */
156
+ load<T = any>(type: string, name: string, options?: MetadataLoadOptions): Promise<T | null>;
157
+ /**
158
+ * Load multiple metadata items
159
+ * Aggregates results from all loaders
160
+ */
161
+ loadMany<T = any>(type: string, options?: MetadataLoadOptions): Promise<T[]>;
162
+ /**
163
+ * Save metadata to disk
164
+ */
165
+ /**
166
+ * Save metadata item
167
+ */
168
+ save<T = any>(type: string, name: string, data: T, options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
169
+ /**
170
+ * Check if metadata item exists
171
+ */
172
+ exists(type: string, name: string): Promise<boolean>;
173
+ /**
174
+ * List all items of a type
175
+ */
176
+ list(type: string): Promise<string[]>;
177
+ /**
178
+ * Watch for metadata changes
179
+ */
180
+ watch(type: string, callback: WatchCallback): void;
181
+ /**
182
+ * Unwatch metadata changes
183
+ */
184
+ unwatch(type: string, callback: WatchCallback): void;
185
+ /**
186
+ * Stop all watching
187
+ */
188
+ stopWatching(): Promise<void>;
189
+ protected notifyWatchers(type: string, event: MetadataWatchEvent): void;
190
+ }
191
+
192
+ interface MetadataPluginOptions {
193
+ rootDir?: string;
194
+ watch?: boolean;
195
+ }
196
+ declare class MetadataPlugin implements Plugin {
197
+ name: string;
198
+ version: string;
199
+ private manager;
200
+ private options;
201
+ constructor(options?: MetadataPluginOptions);
202
+ init: (ctx: PluginContext) => Promise<void>;
203
+ start: (ctx: PluginContext) => Promise<void>;
204
+ }
205
+
206
+ /**
207
+ * Memory Metadata Loader
208
+ *
209
+ * Stores metadata in memory only. Changes are lost when process restarts.
210
+ * Useful for testing, temporary overrides, or "dirty" edits.
211
+ */
212
+
213
+ declare class MemoryLoader implements MetadataLoader {
214
+ readonly contract: MetadataLoaderContract;
215
+ private storage;
216
+ load(type: string, name: string, _options?: MetadataLoadOptions): Promise<MetadataLoadResult>;
217
+ loadMany<T = any>(type: string, _options?: MetadataLoadOptions): Promise<T[]>;
218
+ exists(type: string, name: string): Promise<boolean>;
219
+ stat(type: string, name: string): Promise<MetadataStats | null>;
220
+ list(type: string): Promise<string[]>;
221
+ save(type: string, name: string, data: any, _options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
222
+ }
223
+
224
+ /**
225
+ * Remote Metadata Loader
226
+ *
227
+ * Loads metadata from an HTTP API.
228
+ * This loader is stateless and delegates storage to the remote server.
229
+ */
230
+
231
+ declare class RemoteLoader implements MetadataLoader {
232
+ private baseUrl;
233
+ private authToken?;
234
+ readonly contract: MetadataLoaderContract;
235
+ constructor(baseUrl: string, authToken?: string | undefined);
236
+ private get headers();
237
+ load(type: string, name: string, _options?: MetadataLoadOptions): Promise<MetadataLoadResult>;
238
+ loadMany<T = any>(type: string, _options?: MetadataLoadOptions): Promise<T[]>;
239
+ exists(type: string, name: string): Promise<boolean>;
240
+ stat(type: string, name: string): Promise<MetadataStats | null>;
241
+ list(type: string): Promise<string[]>;
242
+ save(type: string, name: string, data: any, _options?: MetadataSaveOptions): Promise<MetadataSaveResult>;
243
+ }
244
+
245
+ /**
246
+ * JSON Metadata Serializer
247
+ *
248
+ * Handles JSON format serialization and deserialization
249
+ */
250
+
251
+ declare class JSONSerializer implements MetadataSerializer {
252
+ serialize<T>(item: T, options?: SerializeOptions): string;
253
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
254
+ getExtension(): string;
255
+ canHandle(format: MetadataFormat): boolean;
256
+ getFormat(): MetadataFormat;
257
+ /**
258
+ * Recursively sort object keys
259
+ */
260
+ private sortObjectKeys;
261
+ }
262
+
263
+ /**
264
+ * YAML Metadata Serializer
265
+ *
266
+ * Handles YAML format serialization and deserialization
267
+ */
268
+
269
+ declare class YAMLSerializer implements MetadataSerializer {
270
+ serialize<T>(item: T, options?: SerializeOptions): string;
271
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
272
+ getExtension(): string;
273
+ canHandle(format: MetadataFormat): boolean;
274
+ getFormat(): MetadataFormat;
275
+ }
276
+
277
+ declare class MigrationExecutor {
278
+ private driver;
279
+ constructor(driver: ISchemaDriver);
280
+ executeChangeSet(changeSet: System.ChangeSet): Promise<void>;
281
+ private executeOperation;
282
+ }
283
+
284
+ type index_MigrationExecutor = MigrationExecutor;
285
+ declare const index_MigrationExecutor: typeof MigrationExecutor;
286
+ declare namespace index {
287
+ export { index_MigrationExecutor as MigrationExecutor };
288
+ }
289
+
290
+ /**
291
+ * TypeScript/JavaScript Metadata Serializer
292
+ *
293
+ * Handles TypeScript/JavaScript module format serialization and deserialization
294
+ */
295
+
296
+ declare class TypeScriptSerializer implements MetadataSerializer {
297
+ private format;
298
+ constructor(format?: 'typescript' | 'javascript');
299
+ serialize<T>(item: T, options?: SerializeOptions): string;
300
+ deserialize<T>(content: string, schema?: z.ZodSchema): T;
301
+ getExtension(): string;
302
+ canHandle(format: MetadataFormat): boolean;
303
+ getFormat(): MetadataFormat;
304
+ }
305
+
306
+ export { JSONSerializer, MemoryLoader, type MetadataLoader, MetadataManager, type MetadataManagerOptions, MetadataPlugin, type MetadataSerializer, index as Migration, RemoteLoader, type SerializeOptions, TypeScriptSerializer, type WatchCallback, YAMLSerializer };