@famgia/omnify-core 0.0.1
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.
- package/dist/index.cjs +2018 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +987 -0
- package/dist/index.d.ts +987 -0
- package/dist/index.js +1915 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,987 @@
|
|
|
1
|
+
import { ErrorCode, ErrorLocation, OmnifyErrorInfo, LoadedSchema, SchemaCollection, SchemaDefinition, PropertyDefinition, PluginLogger, CustomTypeDefinition, OmnifyPlugin, OmnifyConfig, AssociationDefinition } from '@famgia/omnify-types';
|
|
2
|
+
export { AssociationRelation, CustomTypeDefinition, DatabaseConfig, ErrorCode, ErrorLocation, LoadedSchema, OmnifyConfig, OmnifyErrorInfo, OmnifyPlugin, OutputConfig, PropertyDefinition, PropertyType, Result, SchemaCollection, SchemaDefinition, SchemaOptions, err, ok } from '@famgia/omnify-types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @famgia/omnify-core - OmnifyError Class
|
|
6
|
+
*
|
|
7
|
+
* Base error class for all omnify errors with file:line:message:suggestion format.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Base error class for omnify-schema.
|
|
12
|
+
* Provides consistent error formatting with source location and suggestions.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* throw new OmnifyError(
|
|
17
|
+
* "Invalid property type 'Stringg'",
|
|
18
|
+
* 'E201',
|
|
19
|
+
* { file: 'schemas/User.yaml', line: 15, column: 10 },
|
|
20
|
+
* "Did you mean 'String'?"
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare class OmnifyError extends Error {
|
|
25
|
+
/** Error code (e.g., 'E201') */
|
|
26
|
+
readonly code: ErrorCode;
|
|
27
|
+
/** Source location where the error occurred */
|
|
28
|
+
readonly location?: ErrorLocation;
|
|
29
|
+
/** Suggested fix for the error */
|
|
30
|
+
readonly suggestion?: string;
|
|
31
|
+
/** Additional context or details */
|
|
32
|
+
readonly details?: Record<string, unknown>;
|
|
33
|
+
/** Original error if this wraps another error */
|
|
34
|
+
readonly cause?: Error;
|
|
35
|
+
constructor(message: string, code: ErrorCode, location?: ErrorLocation, suggestion?: string, options?: {
|
|
36
|
+
details?: Record<string, unknown>;
|
|
37
|
+
cause?: Error;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Creates an OmnifyError from an OmnifyErrorInfo object.
|
|
41
|
+
*/
|
|
42
|
+
static fromInfo(info: OmnifyErrorInfo): OmnifyError;
|
|
43
|
+
/**
|
|
44
|
+
* Wraps an unknown error as an OmnifyError.
|
|
45
|
+
* Useful for catching and re-throwing with context.
|
|
46
|
+
*/
|
|
47
|
+
static wrap(error: unknown, code?: ErrorCode, location?: ErrorLocation): OmnifyError;
|
|
48
|
+
/**
|
|
49
|
+
* Converts to OmnifyErrorInfo for serialization.
|
|
50
|
+
*/
|
|
51
|
+
toInfo(): OmnifyErrorInfo;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a formatted string representation.
|
|
54
|
+
* Format: "Error [CODE]: message\n --> file:line:column"
|
|
55
|
+
*/
|
|
56
|
+
toString(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the file path from location, if available.
|
|
59
|
+
*/
|
|
60
|
+
get file(): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the line number from location, if available.
|
|
63
|
+
*/
|
|
64
|
+
get line(): number | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the column number from location, if available.
|
|
67
|
+
*/
|
|
68
|
+
get column(): number | undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @famgia/omnify-core - Error Formatter
|
|
73
|
+
*
|
|
74
|
+
* Formats errors for CLI output with optional ANSI colors.
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Options for error formatting.
|
|
79
|
+
*/
|
|
80
|
+
interface FormatOptions {
|
|
81
|
+
/** Enable ANSI color codes */
|
|
82
|
+
readonly color?: boolean;
|
|
83
|
+
/** Show source context lines */
|
|
84
|
+
readonly showContext?: boolean;
|
|
85
|
+
/** Number of context lines to show */
|
|
86
|
+
readonly contextLines?: number;
|
|
87
|
+
/** Source file content (for showing context) */
|
|
88
|
+
readonly sourceContent?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Formats an OmnifyError for CLI output.
|
|
92
|
+
*
|
|
93
|
+
* @example Output:
|
|
94
|
+
* ```
|
|
95
|
+
* error[E201]: Invalid property type 'Stringg'
|
|
96
|
+
* --> schemas/User.yaml:15:10
|
|
97
|
+
* |
|
|
98
|
+
* 15 | type: Stringg
|
|
99
|
+
* | ^^^^^^^ Did you mean 'String'?
|
|
100
|
+
* |
|
|
101
|
+
* = suggestion: Use one of: String, Int, Boolean, Text, ...
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
declare function formatError(error: OmnifyError, options?: FormatOptions): string;
|
|
105
|
+
/**
|
|
106
|
+
* Formats multiple errors as a summary.
|
|
107
|
+
*/
|
|
108
|
+
declare function formatErrorSummary(errors: readonly OmnifyError[], options?: FormatOptions): string;
|
|
109
|
+
/**
|
|
110
|
+
* Formats an error for plain text output (no colors).
|
|
111
|
+
*/
|
|
112
|
+
declare function formatErrorPlain(error: OmnifyError): string;
|
|
113
|
+
/**
|
|
114
|
+
* Gets the exit code for an error based on its code category.
|
|
115
|
+
*/
|
|
116
|
+
declare function getExitCode(error: OmnifyError): number;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @famgia/omnify-core - Error Factory Functions
|
|
120
|
+
*
|
|
121
|
+
* Convenient factory functions for creating common error types.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Creates a configuration error.
|
|
126
|
+
*/
|
|
127
|
+
declare function configError(message: string, code?: ErrorCode, suggestion?: string): OmnifyError;
|
|
128
|
+
/**
|
|
129
|
+
* Config file not found error.
|
|
130
|
+
*/
|
|
131
|
+
declare function configNotFoundError(configPath: string): OmnifyError;
|
|
132
|
+
/**
|
|
133
|
+
* Invalid config format error.
|
|
134
|
+
*/
|
|
135
|
+
declare function invalidConfigError(message: string, configPath: string): OmnifyError;
|
|
136
|
+
/**
|
|
137
|
+
* Missing required config field error.
|
|
138
|
+
*/
|
|
139
|
+
declare function missingConfigFieldError(field: string, configPath: string): OmnifyError;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a schema parsing error.
|
|
142
|
+
*/
|
|
143
|
+
declare function schemaParseError(message: string, location: ErrorLocation, suggestion?: string): OmnifyError;
|
|
144
|
+
/**
|
|
145
|
+
* Schema file not found error.
|
|
146
|
+
*/
|
|
147
|
+
declare function schemaNotFoundError(schemaPath: string): OmnifyError;
|
|
148
|
+
/**
|
|
149
|
+
* Invalid YAML syntax error.
|
|
150
|
+
*/
|
|
151
|
+
declare function yamlSyntaxError(message: string, file: string, line?: number, column?: number): OmnifyError;
|
|
152
|
+
/**
|
|
153
|
+
* Invalid JSON syntax error.
|
|
154
|
+
*/
|
|
155
|
+
declare function jsonSyntaxError(message: string, file: string, line?: number, column?: number): OmnifyError;
|
|
156
|
+
/**
|
|
157
|
+
* Creates a schema validation error.
|
|
158
|
+
*/
|
|
159
|
+
declare function validationError(message: string, location: ErrorLocation, suggestion?: string): OmnifyError;
|
|
160
|
+
/**
|
|
161
|
+
* Invalid property type error.
|
|
162
|
+
*/
|
|
163
|
+
declare function invalidPropertyTypeError(typeName: string, location: ErrorLocation, validTypes?: readonly string[]): OmnifyError;
|
|
164
|
+
/**
|
|
165
|
+
* Missing required field error.
|
|
166
|
+
*/
|
|
167
|
+
declare function missingFieldError(field: string, location: ErrorLocation): OmnifyError;
|
|
168
|
+
/**
|
|
169
|
+
* Invalid association target error.
|
|
170
|
+
*/
|
|
171
|
+
declare function invalidAssociationTargetError(target: string, location: ErrorLocation, availableSchemas?: readonly string[]): OmnifyError;
|
|
172
|
+
/**
|
|
173
|
+
* Circular reference error.
|
|
174
|
+
*/
|
|
175
|
+
declare function circularReferenceError(path: readonly string[], location: ErrorLocation): OmnifyError;
|
|
176
|
+
/**
|
|
177
|
+
* Duplicate schema name error.
|
|
178
|
+
*/
|
|
179
|
+
declare function duplicateSchemaError(name: string, location: ErrorLocation, existingLocation?: ErrorLocation): OmnifyError;
|
|
180
|
+
/**
|
|
181
|
+
* Creates a plugin error.
|
|
182
|
+
*/
|
|
183
|
+
declare function pluginError(message: string, pluginName: string, cause?: Error): OmnifyError;
|
|
184
|
+
/**
|
|
185
|
+
* Plugin not found error.
|
|
186
|
+
*/
|
|
187
|
+
declare function pluginNotFoundError(pluginName: string): OmnifyError;
|
|
188
|
+
/**
|
|
189
|
+
* Plugin type conflict error.
|
|
190
|
+
*/
|
|
191
|
+
declare function pluginTypeConflictError(typeName: string, pluginA: string, pluginB: string): OmnifyError;
|
|
192
|
+
/**
|
|
193
|
+
* Creates an Atlas error.
|
|
194
|
+
*/
|
|
195
|
+
declare function atlasError(message: string, cause?: Error): OmnifyError;
|
|
196
|
+
/**
|
|
197
|
+
* Atlas CLI not found error.
|
|
198
|
+
*/
|
|
199
|
+
declare function atlasNotFoundError(): OmnifyError;
|
|
200
|
+
/**
|
|
201
|
+
* Creates a generation error.
|
|
202
|
+
*/
|
|
203
|
+
declare function generationError(message: string, outputPath?: string, cause?: Error): OmnifyError;
|
|
204
|
+
/**
|
|
205
|
+
* Output write error.
|
|
206
|
+
*/
|
|
207
|
+
declare function outputWriteError(outputPath: string, cause?: Error): OmnifyError;
|
|
208
|
+
/**
|
|
209
|
+
* Creates an internal/unexpected error.
|
|
210
|
+
*/
|
|
211
|
+
declare function internalError(message: string, cause?: Error): OmnifyError;
|
|
212
|
+
/**
|
|
213
|
+
* Not implemented error.
|
|
214
|
+
*/
|
|
215
|
+
declare function notImplementedError(feature: string): OmnifyError;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @famgia/omnify-core - Schema Loader
|
|
219
|
+
*
|
|
220
|
+
* Load and parse YAML/JSON schema files into internal representation.
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Options for loading schemas.
|
|
225
|
+
*/
|
|
226
|
+
interface LoadSchemaOptions {
|
|
227
|
+
/** Base directory for calculating relative paths */
|
|
228
|
+
readonly baseDir?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Options for loading a directory of schemas.
|
|
232
|
+
*/
|
|
233
|
+
interface LoadSchemasOptions {
|
|
234
|
+
/** File extensions to include (default: ['.yaml', '.yml']) */
|
|
235
|
+
readonly extensions?: readonly string[];
|
|
236
|
+
/** Whether to load recursively from subdirectories (default: true) */
|
|
237
|
+
readonly recursive?: boolean;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Converts a file name to a schema name (PascalCase).
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* fileNameToSchemaName('user-profile.yaml') // 'UserProfile'
|
|
244
|
+
* fileNameToSchemaName('User.yaml') // 'User'
|
|
245
|
+
* fileNameToSchemaName('order_item.yml') // 'OrderItem'
|
|
246
|
+
*/
|
|
247
|
+
declare function fileNameToSchemaName(fileName: string): string;
|
|
248
|
+
/**
|
|
249
|
+
* Parses YAML content into a SchemaDefinition.
|
|
250
|
+
*
|
|
251
|
+
* @param content - Raw YAML content
|
|
252
|
+
* @param filePath - File path for error reporting
|
|
253
|
+
* @returns Parsed schema definition
|
|
254
|
+
* @throws OmnifyError if YAML is invalid
|
|
255
|
+
*/
|
|
256
|
+
declare function parseYamlSchema(content: string, filePath: string): SchemaDefinition;
|
|
257
|
+
/**
|
|
258
|
+
* Parses JSON content into a SchemaDefinition.
|
|
259
|
+
*
|
|
260
|
+
* @param content - Raw JSON content
|
|
261
|
+
* @param filePath - File path for error reporting
|
|
262
|
+
* @returns Parsed schema definition
|
|
263
|
+
* @throws OmnifyError if JSON is invalid
|
|
264
|
+
*/
|
|
265
|
+
declare function parseJsonSchema(content: string, filePath: string): SchemaDefinition;
|
|
266
|
+
/**
|
|
267
|
+
* Loads a single schema file.
|
|
268
|
+
* Supports both YAML (.yaml, .yml) and JSON (.json) formats.
|
|
269
|
+
*
|
|
270
|
+
* @param filePath - Path to the schema file
|
|
271
|
+
* @param options - Loading options
|
|
272
|
+
* @returns Loaded schema with metadata
|
|
273
|
+
* @throws OmnifyError if file not found or invalid syntax
|
|
274
|
+
*/
|
|
275
|
+
declare function loadSchema(filePath: string, options?: LoadSchemaOptions): Promise<LoadedSchema>;
|
|
276
|
+
/**
|
|
277
|
+
* Loads all schemas from a directory.
|
|
278
|
+
*
|
|
279
|
+
* @param directoryPath - Path to the schemas directory
|
|
280
|
+
* @param options - Loading options
|
|
281
|
+
* @returns Collection of loaded schemas indexed by name
|
|
282
|
+
* @throws OmnifyError if duplicate schema names or invalid files
|
|
283
|
+
*/
|
|
284
|
+
declare function loadSchemas(directoryPath: string, options?: LoadSchemasOptions): Promise<SchemaCollection>;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @famgia/omnify-core - Validation Types
|
|
288
|
+
*
|
|
289
|
+
* Types for schema validation results.
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Validation result for a single schema.
|
|
294
|
+
*/
|
|
295
|
+
interface SchemaValidationResult {
|
|
296
|
+
/** Schema name */
|
|
297
|
+
readonly schemaName: string;
|
|
298
|
+
/** Whether validation passed */
|
|
299
|
+
readonly valid: boolean;
|
|
300
|
+
/** Validation errors (if any) */
|
|
301
|
+
readonly errors: readonly OmnifyError[];
|
|
302
|
+
/** Validation warnings (if any) */
|
|
303
|
+
readonly warnings: readonly OmnifyError[];
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Validation result for a collection of schemas.
|
|
307
|
+
*/
|
|
308
|
+
interface ValidationResult {
|
|
309
|
+
/** Whether all schemas are valid */
|
|
310
|
+
readonly valid: boolean;
|
|
311
|
+
/** Total error count */
|
|
312
|
+
readonly errorCount: number;
|
|
313
|
+
/** Total warning count */
|
|
314
|
+
readonly warningCount: number;
|
|
315
|
+
/** Results per schema */
|
|
316
|
+
readonly schemas: readonly SchemaValidationResult[];
|
|
317
|
+
/** All errors across all schemas */
|
|
318
|
+
readonly errors: readonly OmnifyError[];
|
|
319
|
+
/** All warnings across all schemas */
|
|
320
|
+
readonly warnings: readonly OmnifyError[];
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Options for schema validation.
|
|
324
|
+
*/
|
|
325
|
+
interface ValidationOptions {
|
|
326
|
+
/** Whether to treat warnings as errors */
|
|
327
|
+
readonly strict?: boolean;
|
|
328
|
+
/** Custom types registered by plugins */
|
|
329
|
+
readonly customTypes?: readonly string[];
|
|
330
|
+
/** Whether to validate associations (requires all schemas) */
|
|
331
|
+
readonly validateAssociations?: boolean;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @famgia/omnify-core - Schema Validator
|
|
336
|
+
*
|
|
337
|
+
* Validates schema definitions for correctness and consistency.
|
|
338
|
+
*/
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Validates a property type.
|
|
342
|
+
*/
|
|
343
|
+
declare function validatePropertyType(propertyName: string, property: PropertyDefinition, filePath: string, customTypes?: readonly string[]): OmnifyError[];
|
|
344
|
+
/**
|
|
345
|
+
* Validates all properties in a schema.
|
|
346
|
+
*/
|
|
347
|
+
declare function validateProperties(schema: SchemaDefinition, filePath: string, customTypes?: readonly string[]): OmnifyError[];
|
|
348
|
+
/**
|
|
349
|
+
* Validates associations in a schema against available schemas.
|
|
350
|
+
*/
|
|
351
|
+
declare function validateAssociations(schema: LoadedSchema, allSchemas: SchemaCollection): OmnifyError[];
|
|
352
|
+
/**
|
|
353
|
+
* Validates schema options.
|
|
354
|
+
*/
|
|
355
|
+
declare function validateOptions(schema: SchemaDefinition, filePath: string): OmnifyError[];
|
|
356
|
+
/**
|
|
357
|
+
* Validates an enum schema.
|
|
358
|
+
*/
|
|
359
|
+
declare function validateEnumSchema(schema: SchemaDefinition, filePath: string): OmnifyError[];
|
|
360
|
+
/**
|
|
361
|
+
* Validates a single schema.
|
|
362
|
+
*/
|
|
363
|
+
declare function validateSchema(schema: LoadedSchema, options?: ValidationOptions): SchemaValidationResult;
|
|
364
|
+
/**
|
|
365
|
+
* Validates a collection of schemas.
|
|
366
|
+
*/
|
|
367
|
+
declare function validateSchemas(schemas: SchemaCollection, options?: ValidationOptions): ValidationResult;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* @famgia/omnify-core - Plugin Types
|
|
371
|
+
*
|
|
372
|
+
* Internal types for plugin management.
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Registered type with source plugin information.
|
|
377
|
+
*/
|
|
378
|
+
interface RegisteredType extends CustomTypeDefinition {
|
|
379
|
+
/** Plugin that provided this type */
|
|
380
|
+
readonly pluginName: string;
|
|
381
|
+
/** Plugin version */
|
|
382
|
+
readonly pluginVersion: string;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Plugin registry state.
|
|
386
|
+
*/
|
|
387
|
+
interface PluginRegistry {
|
|
388
|
+
/** Registered plugins */
|
|
389
|
+
readonly plugins: ReadonlyMap<string, OmnifyPlugin>;
|
|
390
|
+
/** Registered custom types */
|
|
391
|
+
readonly types: ReadonlyMap<string, RegisteredType>;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Plugin manager options.
|
|
395
|
+
*/
|
|
396
|
+
interface PluginManagerOptions {
|
|
397
|
+
/** Current working directory */
|
|
398
|
+
cwd?: string;
|
|
399
|
+
/** Enable verbose logging */
|
|
400
|
+
verbose?: boolean;
|
|
401
|
+
/** Custom logger */
|
|
402
|
+
logger?: PluginLogger;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Result of plugin registration.
|
|
406
|
+
*/
|
|
407
|
+
interface PluginRegistrationResult {
|
|
408
|
+
/** Whether registration was successful */
|
|
409
|
+
success: boolean;
|
|
410
|
+
/** Registered types */
|
|
411
|
+
types: readonly RegisteredType[];
|
|
412
|
+
/** Any warnings during registration */
|
|
413
|
+
warnings: readonly string[];
|
|
414
|
+
/** Error if registration failed */
|
|
415
|
+
error?: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @famgia/omnify-core - Plugin Manager
|
|
420
|
+
*
|
|
421
|
+
* Manages plugin registration and type resolution.
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Plugin Manager class for managing plugin lifecycle.
|
|
426
|
+
*/
|
|
427
|
+
declare class PluginManager {
|
|
428
|
+
private readonly _plugins;
|
|
429
|
+
private readonly _types;
|
|
430
|
+
private readonly _cwd;
|
|
431
|
+
private readonly _verbose;
|
|
432
|
+
private readonly _logger;
|
|
433
|
+
constructor(options?: PluginManagerOptions);
|
|
434
|
+
/**
|
|
435
|
+
* Creates a plugin context for plugin setup.
|
|
436
|
+
*/
|
|
437
|
+
private createContext;
|
|
438
|
+
/**
|
|
439
|
+
* Registers a single plugin.
|
|
440
|
+
*/
|
|
441
|
+
register(plugin: OmnifyPlugin): Promise<PluginRegistrationResult>;
|
|
442
|
+
/**
|
|
443
|
+
* Registers multiple plugins.
|
|
444
|
+
*/
|
|
445
|
+
registerAll(plugins: readonly OmnifyPlugin[]): Promise<void>;
|
|
446
|
+
/**
|
|
447
|
+
* Validates a type definition.
|
|
448
|
+
*/
|
|
449
|
+
private validateTypeDefinition;
|
|
450
|
+
/**
|
|
451
|
+
* Unregisters a plugin and its types.
|
|
452
|
+
*/
|
|
453
|
+
unregister(pluginName: string): Promise<void>;
|
|
454
|
+
/**
|
|
455
|
+
* Gets a registered type by name.
|
|
456
|
+
*/
|
|
457
|
+
getType(typeName: string): RegisteredType | undefined;
|
|
458
|
+
/**
|
|
459
|
+
* Checks if a type is registered.
|
|
460
|
+
*/
|
|
461
|
+
hasType(typeName: string): boolean;
|
|
462
|
+
/**
|
|
463
|
+
* Gets all registered types.
|
|
464
|
+
*/
|
|
465
|
+
getAllTypes(): ReadonlyMap<string, RegisteredType>;
|
|
466
|
+
/**
|
|
467
|
+
* Gets all registered type names.
|
|
468
|
+
*/
|
|
469
|
+
getTypeNames(): readonly string[];
|
|
470
|
+
/**
|
|
471
|
+
* Gets a registered plugin by name.
|
|
472
|
+
*/
|
|
473
|
+
getPlugin(pluginName: string): OmnifyPlugin | undefined;
|
|
474
|
+
/**
|
|
475
|
+
* Gets all registered plugins.
|
|
476
|
+
*/
|
|
477
|
+
getAllPlugins(): ReadonlyMap<string, OmnifyPlugin>;
|
|
478
|
+
/**
|
|
479
|
+
* Gets the current registry state.
|
|
480
|
+
*/
|
|
481
|
+
getRegistry(): PluginRegistry;
|
|
482
|
+
/**
|
|
483
|
+
* Clears all registered plugins and types.
|
|
484
|
+
*/
|
|
485
|
+
clear(): Promise<void>;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Creates a new plugin manager instance.
|
|
489
|
+
*/
|
|
490
|
+
declare function createPluginManager(options?: PluginManagerOptions): PluginManager;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* @famgia/omnify-core - Compound Type Expander
|
|
494
|
+
*
|
|
495
|
+
* Expands compound types into multiple fields.
|
|
496
|
+
*/
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Expanded property with original property name.
|
|
500
|
+
*/
|
|
501
|
+
interface ExpandedProperty {
|
|
502
|
+
/** Original property name */
|
|
503
|
+
originalName: string;
|
|
504
|
+
/** Expanded column name (originalName + suffix) */
|
|
505
|
+
expandedName: string;
|
|
506
|
+
/** The expanded field definition */
|
|
507
|
+
property: PropertyDefinition;
|
|
508
|
+
/** Whether this is from a compound type */
|
|
509
|
+
isCompound: boolean;
|
|
510
|
+
/** Source type name if from plugin */
|
|
511
|
+
sourceType?: string;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Expands a single property if it's a compound type.
|
|
515
|
+
*/
|
|
516
|
+
declare function expandProperty(propertyName: string, property: PropertyDefinition, registry: PluginRegistry): ExpandedProperty[];
|
|
517
|
+
/**
|
|
518
|
+
* Expands all compound types in a schema's properties.
|
|
519
|
+
*/
|
|
520
|
+
declare function expandSchemaProperties(schema: LoadedSchema, registry: PluginRegistry): Map<string, ExpandedProperty[]>;
|
|
521
|
+
/**
|
|
522
|
+
* Creates a new schema with compound types expanded.
|
|
523
|
+
*/
|
|
524
|
+
declare function expandSchema(schema: LoadedSchema, registry: PluginRegistry): LoadedSchema;
|
|
525
|
+
/**
|
|
526
|
+
* Expands compound types in all schemas.
|
|
527
|
+
*/
|
|
528
|
+
declare function expandSchemas(schemas: SchemaCollection, registry: PluginRegistry): SchemaCollection;
|
|
529
|
+
/**
|
|
530
|
+
* Gets the registered type info for a property type.
|
|
531
|
+
*/
|
|
532
|
+
declare function getTypeInfo(typeName: string, registry: PluginRegistry): RegisteredType | undefined;
|
|
533
|
+
/**
|
|
534
|
+
* Checks if a type is a compound type.
|
|
535
|
+
*/
|
|
536
|
+
declare function isCompoundType(typeName: string, registry: PluginRegistry): boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Gets all custom type names from the registry.
|
|
539
|
+
*/
|
|
540
|
+
declare function getCustomTypeNames(registry: PluginRegistry): string[];
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* @famgia/omnify-core - Programmatic API Types
|
|
544
|
+
*/
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Migration file definition (matches @famgia/omnify-laravel).
|
|
548
|
+
*/
|
|
549
|
+
interface MigrationFile {
|
|
550
|
+
/** File path */
|
|
551
|
+
path: string;
|
|
552
|
+
/** Migration class name */
|
|
553
|
+
className: string;
|
|
554
|
+
/** Table name */
|
|
555
|
+
tableName: string;
|
|
556
|
+
/** File content */
|
|
557
|
+
content: string;
|
|
558
|
+
/** Operation type */
|
|
559
|
+
operation: 'create' | 'alter' | 'drop';
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* TypeScript file definition (matches @famgia/omnify-laravel).
|
|
563
|
+
*/
|
|
564
|
+
interface TypeScriptFile {
|
|
565
|
+
/** File path */
|
|
566
|
+
path: string;
|
|
567
|
+
/** File content */
|
|
568
|
+
content: string;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Lock file definition (matches @famgia/omnify-atlas).
|
|
572
|
+
*/
|
|
573
|
+
interface LockFileInfo {
|
|
574
|
+
/** Lock file version */
|
|
575
|
+
version: number;
|
|
576
|
+
/** Last updated timestamp */
|
|
577
|
+
updatedAt: string;
|
|
578
|
+
/** Schema hashes */
|
|
579
|
+
schemas: Record<string, string>;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Diff result definition (matches @famgia/omnify-atlas).
|
|
583
|
+
*/
|
|
584
|
+
interface DiffResultInfo {
|
|
585
|
+
/** Whether there are changes */
|
|
586
|
+
hasChanges: boolean;
|
|
587
|
+
/** SQL statements */
|
|
588
|
+
statements: string[];
|
|
589
|
+
/** Summary text */
|
|
590
|
+
summary: string;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Options for the Omnify programmatic API.
|
|
594
|
+
*/
|
|
595
|
+
interface OmnifyOptions {
|
|
596
|
+
/** Schema directory path */
|
|
597
|
+
schemaDir: string;
|
|
598
|
+
/** Configuration object or path to config file */
|
|
599
|
+
config?: Partial<OmnifyConfig> | string;
|
|
600
|
+
/** Plugins to register */
|
|
601
|
+
plugins?: OmnifyPlugin[];
|
|
602
|
+
/** Development database URL for Atlas */
|
|
603
|
+
devUrl?: string;
|
|
604
|
+
/** Enable verbose logging */
|
|
605
|
+
verbose?: boolean;
|
|
606
|
+
/** Custom logger */
|
|
607
|
+
logger?: OmnifyLogger;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Logger interface for programmatic API.
|
|
611
|
+
*/
|
|
612
|
+
interface OmnifyLogger {
|
|
613
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
614
|
+
info: (message: string, ...args: unknown[]) => void;
|
|
615
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
616
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Result of loading schemas.
|
|
620
|
+
*/
|
|
621
|
+
interface LoadResult {
|
|
622
|
+
/** Whether loading was successful */
|
|
623
|
+
success: boolean;
|
|
624
|
+
/** Loaded schemas */
|
|
625
|
+
schemas: SchemaCollection;
|
|
626
|
+
/** Validation errors if any */
|
|
627
|
+
errors: SchemaError[];
|
|
628
|
+
/** Validation warnings */
|
|
629
|
+
warnings: SchemaWarning[];
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Schema error with location info.
|
|
633
|
+
*/
|
|
634
|
+
interface SchemaError {
|
|
635
|
+
/** File path */
|
|
636
|
+
file: string;
|
|
637
|
+
/** Line number if available */
|
|
638
|
+
line?: number;
|
|
639
|
+
/** Error message */
|
|
640
|
+
message: string;
|
|
641
|
+
/** Suggested fix */
|
|
642
|
+
suggestion?: string;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Schema warning.
|
|
646
|
+
*/
|
|
647
|
+
interface SchemaWarning {
|
|
648
|
+
/** File path */
|
|
649
|
+
file: string;
|
|
650
|
+
/** Warning message */
|
|
651
|
+
message: string;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Result of diff operation.
|
|
655
|
+
*/
|
|
656
|
+
interface DiffOperationResult {
|
|
657
|
+
/** Whether diff was successful */
|
|
658
|
+
success: boolean;
|
|
659
|
+
/** Whether there are changes */
|
|
660
|
+
hasChanges: boolean;
|
|
661
|
+
/** Parsed diff result */
|
|
662
|
+
diff: DiffResultInfo | null;
|
|
663
|
+
/** SQL statements */
|
|
664
|
+
sql: string[];
|
|
665
|
+
/** Human-readable summary */
|
|
666
|
+
summary: string;
|
|
667
|
+
/** Errors if any */
|
|
668
|
+
errors: SchemaError[];
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Options for generation.
|
|
672
|
+
*/
|
|
673
|
+
interface GenerateOptions {
|
|
674
|
+
/** Output directory for Laravel migrations */
|
|
675
|
+
laravelOutput?: string;
|
|
676
|
+
/** Output directory for TypeScript types */
|
|
677
|
+
typescriptOutput?: string;
|
|
678
|
+
/** Whether to update the lock file */
|
|
679
|
+
updateLockFile?: boolean;
|
|
680
|
+
/** Whether to skip TypeScript generation */
|
|
681
|
+
skipTypeScript?: boolean;
|
|
682
|
+
/** Whether to skip Laravel generation */
|
|
683
|
+
skipLaravel?: boolean;
|
|
684
|
+
/** Dry run - don't write files */
|
|
685
|
+
dryRun?: boolean;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Result of generation operation.
|
|
689
|
+
*/
|
|
690
|
+
interface GenerateResult {
|
|
691
|
+
/** Whether generation was successful */
|
|
692
|
+
success: boolean;
|
|
693
|
+
/** Generated Laravel migration files */
|
|
694
|
+
migrations: MigrationFile[];
|
|
695
|
+
/** Generated TypeScript files */
|
|
696
|
+
typescript: TypeScriptFile[];
|
|
697
|
+
/** Updated lock file */
|
|
698
|
+
lockFile: LockFileInfo | null;
|
|
699
|
+
/** Errors if any */
|
|
700
|
+
errors: SchemaError[];
|
|
701
|
+
/** Files that would be written (in dry run) or were written */
|
|
702
|
+
files: GeneratedFile[];
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Generated file info.
|
|
706
|
+
*/
|
|
707
|
+
interface GeneratedFile {
|
|
708
|
+
/** File path */
|
|
709
|
+
path: string;
|
|
710
|
+
/** File content */
|
|
711
|
+
content: string;
|
|
712
|
+
/** File type */
|
|
713
|
+
type: 'migration' | 'typescript' | 'lock';
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Schema metadata for introspection.
|
|
717
|
+
*/
|
|
718
|
+
interface SchemaMetadata {
|
|
719
|
+
/** Schema name */
|
|
720
|
+
name: string;
|
|
721
|
+
/** Display name */
|
|
722
|
+
displayName?: string;
|
|
723
|
+
/** Group name */
|
|
724
|
+
group?: string;
|
|
725
|
+
/** Schema kind */
|
|
726
|
+
kind: 'entity' | 'enum';
|
|
727
|
+
/** File path */
|
|
728
|
+
filePath: string;
|
|
729
|
+
/** Property names */
|
|
730
|
+
propertyNames: string[];
|
|
731
|
+
/** Association names */
|
|
732
|
+
associationNames: string[];
|
|
733
|
+
/** Has timestamps */
|
|
734
|
+
hasTimestamps: boolean;
|
|
735
|
+
/** Has soft delete */
|
|
736
|
+
hasSoftDelete: boolean;
|
|
737
|
+
/** Primary key type */
|
|
738
|
+
primaryKeyType: string;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Property metadata.
|
|
742
|
+
*/
|
|
743
|
+
interface PropertyMetadata {
|
|
744
|
+
/** Property name */
|
|
745
|
+
name: string;
|
|
746
|
+
/** Property type */
|
|
747
|
+
type: string;
|
|
748
|
+
/** Is nullable */
|
|
749
|
+
nullable: boolean;
|
|
750
|
+
/** Is unique */
|
|
751
|
+
unique: boolean;
|
|
752
|
+
/** Has default value */
|
|
753
|
+
hasDefault: boolean;
|
|
754
|
+
/** Default value */
|
|
755
|
+
defaultValue?: unknown;
|
|
756
|
+
/** Is from plugin */
|
|
757
|
+
isPluginType: boolean;
|
|
758
|
+
/** Plugin name if from plugin */
|
|
759
|
+
pluginName?: string;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Association metadata.
|
|
763
|
+
*/
|
|
764
|
+
interface AssociationMetadata {
|
|
765
|
+
/** Association name */
|
|
766
|
+
name: string;
|
|
767
|
+
/** Relation type */
|
|
768
|
+
relation: 'OneToOne' | 'OneToMany' | 'ManyToOne' | 'ManyToMany';
|
|
769
|
+
/** Target schema */
|
|
770
|
+
target: string;
|
|
771
|
+
/** Inverse side */
|
|
772
|
+
inversedBy?: string;
|
|
773
|
+
/** Owning side */
|
|
774
|
+
mappedBy?: string;
|
|
775
|
+
/** On delete action */
|
|
776
|
+
onDelete?: string;
|
|
777
|
+
/** On update action */
|
|
778
|
+
onUpdate?: string;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Full schema introspection result.
|
|
782
|
+
*/
|
|
783
|
+
interface SchemaIntrospection {
|
|
784
|
+
/** Schema metadata */
|
|
785
|
+
metadata: SchemaMetadata;
|
|
786
|
+
/** Properties */
|
|
787
|
+
properties: PropertyMetadata[];
|
|
788
|
+
/** Associations */
|
|
789
|
+
associations: AssociationMetadata[];
|
|
790
|
+
/** Raw schema */
|
|
791
|
+
schema: LoadedSchema;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* @famgia/omnify-core - Omnify Programmatic API
|
|
796
|
+
*
|
|
797
|
+
* Main entry point for using omnify-schema programmatically.
|
|
798
|
+
*/
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Main Omnify API class for programmatic usage.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* ```typescript
|
|
805
|
+
* import { Omnify } from '@famgia/omnify-core';
|
|
806
|
+
*
|
|
807
|
+
* const omnify = new Omnify({
|
|
808
|
+
* schemaDir: './schemas',
|
|
809
|
+
* plugins: [japanTypesPlugin],
|
|
810
|
+
* });
|
|
811
|
+
*
|
|
812
|
+
* // Load and validate schemas
|
|
813
|
+
* const { schemas, errors } = await omnify.load();
|
|
814
|
+
*
|
|
815
|
+
* // Get schema metadata
|
|
816
|
+
* const users = omnify.getSchema('User');
|
|
817
|
+
*
|
|
818
|
+
* // Introspect schema
|
|
819
|
+
* const introspection = omnify.introspect('User');
|
|
820
|
+
* ```
|
|
821
|
+
*/
|
|
822
|
+
declare class Omnify {
|
|
823
|
+
private readonly options;
|
|
824
|
+
private readonly logger;
|
|
825
|
+
private readonly pluginManager;
|
|
826
|
+
private schemas;
|
|
827
|
+
private loaded;
|
|
828
|
+
constructor(options: OmnifyOptions);
|
|
829
|
+
/**
|
|
830
|
+
* Registers plugins with the plugin manager.
|
|
831
|
+
*/
|
|
832
|
+
registerPlugins(plugins: OmnifyPlugin[]): Promise<void>;
|
|
833
|
+
/**
|
|
834
|
+
* Loads and validates schemas from the configured directory.
|
|
835
|
+
*/
|
|
836
|
+
load(): Promise<LoadResult>;
|
|
837
|
+
/**
|
|
838
|
+
* Gets loaded schemas. Throws if not loaded.
|
|
839
|
+
*/
|
|
840
|
+
getSchemas(): SchemaCollection;
|
|
841
|
+
/**
|
|
842
|
+
* Gets a single schema by name.
|
|
843
|
+
*/
|
|
844
|
+
getSchema(name: string): SchemaIntrospection | undefined;
|
|
845
|
+
/**
|
|
846
|
+
* Gets all schema names.
|
|
847
|
+
*/
|
|
848
|
+
getSchemaNames(): string[];
|
|
849
|
+
/**
|
|
850
|
+
* Gets entity schemas (non-enum).
|
|
851
|
+
*/
|
|
852
|
+
getEntitySchemas(): SchemaIntrospection[];
|
|
853
|
+
/**
|
|
854
|
+
* Gets enum schemas.
|
|
855
|
+
*/
|
|
856
|
+
getEnumSchemas(): SchemaIntrospection[];
|
|
857
|
+
/**
|
|
858
|
+
* Gets schemas by group.
|
|
859
|
+
*/
|
|
860
|
+
getSchemasByGroup(group: string): SchemaIntrospection[];
|
|
861
|
+
/**
|
|
862
|
+
* Gets all unique group names.
|
|
863
|
+
*/
|
|
864
|
+
getGroups(): string[];
|
|
865
|
+
/**
|
|
866
|
+
* Introspects a specific schema.
|
|
867
|
+
*/
|
|
868
|
+
introspect(name: string): SchemaIntrospection | undefined;
|
|
869
|
+
/**
|
|
870
|
+
* Introspects all schemas.
|
|
871
|
+
*/
|
|
872
|
+
introspectAll(): Map<string, SchemaIntrospection>;
|
|
873
|
+
/**
|
|
874
|
+
* Finds schemas that reference a target schema.
|
|
875
|
+
*/
|
|
876
|
+
findReferencingSchemas(targetName: string): SchemaIntrospection[];
|
|
877
|
+
/**
|
|
878
|
+
* Finds schemas referenced by a source schema.
|
|
879
|
+
*/
|
|
880
|
+
findReferencedSchemas(sourceName: string): SchemaIntrospection[];
|
|
881
|
+
/**
|
|
882
|
+
* Checks if schemas have circular references.
|
|
883
|
+
*/
|
|
884
|
+
hasCircularReferences(): boolean;
|
|
885
|
+
/**
|
|
886
|
+
* Gets topological order of schemas (dependencies first).
|
|
887
|
+
*/
|
|
888
|
+
getTopologicalOrder(): string[];
|
|
889
|
+
/**
|
|
890
|
+
* Gets the plugin registry.
|
|
891
|
+
*/
|
|
892
|
+
getPluginRegistry(): PluginRegistry;
|
|
893
|
+
/**
|
|
894
|
+
* Checks if a type is registered (from plugin).
|
|
895
|
+
*/
|
|
896
|
+
hasType(typeName: string): boolean;
|
|
897
|
+
/**
|
|
898
|
+
* Gets custom type names from all registered plugins.
|
|
899
|
+
*/
|
|
900
|
+
getCustomTypeNames(): string[];
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Creates an Omnify instance.
|
|
904
|
+
*
|
|
905
|
+
* @example
|
|
906
|
+
* ```typescript
|
|
907
|
+
* const omnify = createOmnify({
|
|
908
|
+
* schemaDir: './schemas',
|
|
909
|
+
* });
|
|
910
|
+
*
|
|
911
|
+
* const { schemas } = await omnify.load();
|
|
912
|
+
* ```
|
|
913
|
+
*/
|
|
914
|
+
declare function createOmnify(options: OmnifyOptions): Omnify;
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* @famgia/omnify-core - Schema Metadata Access
|
|
918
|
+
*
|
|
919
|
+
* Utilities for accessing schema metadata programmatically.
|
|
920
|
+
*/
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Extracts metadata from a loaded schema.
|
|
924
|
+
*/
|
|
925
|
+
declare function getSchemaMetadata(schema: LoadedSchema): SchemaMetadata;
|
|
926
|
+
/**
|
|
927
|
+
* Extracts property metadata.
|
|
928
|
+
*/
|
|
929
|
+
declare function getPropertyMetadata(name: string, property: PropertyDefinition, registry?: PluginRegistry): PropertyMetadata;
|
|
930
|
+
/**
|
|
931
|
+
* Extracts association metadata.
|
|
932
|
+
*/
|
|
933
|
+
declare function getAssociationMetadata(name: string, association: AssociationDefinition): AssociationMetadata;
|
|
934
|
+
/**
|
|
935
|
+
* Full schema introspection.
|
|
936
|
+
*/
|
|
937
|
+
declare function introspectSchema(schema: LoadedSchema, registry?: PluginRegistry): SchemaIntrospection;
|
|
938
|
+
/**
|
|
939
|
+
* Introspects all schemas in a collection.
|
|
940
|
+
*/
|
|
941
|
+
declare function introspectSchemas(schemas: SchemaCollection, registry?: PluginRegistry): Map<string, SchemaIntrospection>;
|
|
942
|
+
/**
|
|
943
|
+
* Gets all schema names from a collection.
|
|
944
|
+
*/
|
|
945
|
+
declare function getSchemaNames(schemas: SchemaCollection): string[];
|
|
946
|
+
/**
|
|
947
|
+
* Gets schemas by kind.
|
|
948
|
+
*/
|
|
949
|
+
declare function getSchemasByKind(schemas: SchemaCollection, kind: 'entity' | 'enum'): LoadedSchema[];
|
|
950
|
+
/**
|
|
951
|
+
* Gets entity schemas (non-enum).
|
|
952
|
+
*/
|
|
953
|
+
declare function getEntitySchemas(schemas: SchemaCollection): LoadedSchema[];
|
|
954
|
+
/**
|
|
955
|
+
* Gets enum schemas.
|
|
956
|
+
*/
|
|
957
|
+
declare function getEnumSchemas(schemas: SchemaCollection): LoadedSchema[];
|
|
958
|
+
/**
|
|
959
|
+
* Gets schemas by group.
|
|
960
|
+
*/
|
|
961
|
+
declare function getSchemasByGroup(schemas: SchemaCollection, group: string): LoadedSchema[];
|
|
962
|
+
/**
|
|
963
|
+
* Gets all unique group names.
|
|
964
|
+
*/
|
|
965
|
+
declare function getGroups(schemas: SchemaCollection): string[];
|
|
966
|
+
/**
|
|
967
|
+
* Finds schemas that reference a target schema.
|
|
968
|
+
*/
|
|
969
|
+
declare function findReferencingSchemas(schemas: SchemaCollection, targetName: string): LoadedSchema[];
|
|
970
|
+
/**
|
|
971
|
+
* Finds schemas referenced by a source schema.
|
|
972
|
+
*/
|
|
973
|
+
declare function findReferencedSchemas(schemas: SchemaCollection, sourceName: string): LoadedSchema[];
|
|
974
|
+
/**
|
|
975
|
+
* Gets the relationship graph as adjacency list.
|
|
976
|
+
*/
|
|
977
|
+
declare function getRelationshipGraph(schemas: SchemaCollection): Map<string, string[]>;
|
|
978
|
+
/**
|
|
979
|
+
* Checks if schemas form a valid DAG (no circular references).
|
|
980
|
+
*/
|
|
981
|
+
declare function hasCircularReferences(schemas: SchemaCollection): boolean;
|
|
982
|
+
/**
|
|
983
|
+
* Gets topological sort order for schemas (dependencies first).
|
|
984
|
+
*/
|
|
985
|
+
declare function getTopologicalOrder(schemas: SchemaCollection): string[];
|
|
986
|
+
|
|
987
|
+
export { type AssociationMetadata, type DiffOperationResult, type ExpandedProperty, type FormatOptions, type GenerateOptions, type GenerateResult, type GeneratedFile, type LoadResult, type LoadSchemaOptions, type LoadSchemasOptions, Omnify, OmnifyError, type OmnifyLogger, type OmnifyOptions, PluginManager, type PluginManagerOptions, type PluginRegistrationResult, type PluginRegistry, type PropertyMetadata, type RegisteredType, type SchemaError, type SchemaIntrospection, type SchemaMetadata, type SchemaValidationResult, type SchemaWarning, type ValidationOptions, type ValidationResult, atlasError, atlasNotFoundError, circularReferenceError, configError, configNotFoundError, createOmnify, createPluginManager, duplicateSchemaError, expandProperty, expandSchema, expandSchemaProperties, expandSchemas, fileNameToSchemaName, findReferencedSchemas, findReferencingSchemas, formatError, formatErrorPlain, formatErrorSummary, generationError, getAssociationMetadata, getCustomTypeNames, getEntitySchemas, getEnumSchemas, getExitCode, getGroups, getPropertyMetadata, getRelationshipGraph, getSchemaMetadata, getSchemaNames, getSchemasByGroup, getSchemasByKind, getTopologicalOrder, getTypeInfo, hasCircularReferences, internalError, introspectSchema, introspectSchemas, invalidAssociationTargetError, invalidConfigError, invalidPropertyTypeError, isCompoundType, jsonSyntaxError, loadSchema, loadSchemas, missingConfigFieldError, missingFieldError, notImplementedError, outputWriteError, parseJsonSchema, parseYamlSchema, pluginError, pluginNotFoundError, pluginTypeConflictError, schemaNotFoundError, schemaParseError, validateAssociations, validateEnumSchema, validateOptions, validateProperties, validatePropertyType, validateSchema, validateSchemas, validationError, yamlSyntaxError };
|