@skmtc/core 0.0.799 → 0.0.800
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/esm/context/GenerateContext.d.ts +21 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +21 -1
- package/esm/context/ParseContext.d.ts +64 -3
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +61 -0
- package/esm/context/ResultsHandler.d.ts +10 -3
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/dsl/model/types.d.ts +51 -4
- package/esm/dsl/model/types.d.ts.map +1 -1
- package/esm/dsl/operation/types.d.ts +61 -3
- package/esm/dsl/operation/types.d.ts.map +1 -1
- package/esm/oas/operation/Operation.d.ts +47 -2
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +43 -0
- package/esm/oas/ref/Ref.d.ts +49 -2
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +28 -0
- package/esm/typescript/List.d.ts +64 -3
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +43 -0
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +21 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +21 -1
- package/script/context/ParseContext.d.ts +64 -3
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +61 -0
- package/script/context/ResultsHandler.d.ts +10 -3
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/dsl/model/types.d.ts +51 -4
- package/script/dsl/model/types.d.ts.map +1 -1
- package/script/dsl/operation/types.d.ts +61 -3
- package/script/dsl/operation/types.d.ts.map +1 -1
- package/script/oas/operation/Operation.d.ts +47 -2
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +43 -0
- package/script/oas/ref/Ref.d.ts +49 -2
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +28 -0
- package/script/typescript/List.d.ts +64 -3
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +43 -0
|
@@ -390,6 +390,13 @@ export declare class GenerateContext {
|
|
|
390
390
|
* @internal
|
|
391
391
|
*/
|
|
392
392
|
toArtifacts(): GenerateResult;
|
|
393
|
+
/**
|
|
394
|
+
* Executes a function within a traced context for debugging and monitoring.
|
|
395
|
+
*
|
|
396
|
+
* @param token - Trace identifier or path segments
|
|
397
|
+
* @param fn - Function to execute within the trace context
|
|
398
|
+
* @returns The result of the traced function execution
|
|
399
|
+
*/
|
|
393
400
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
394
401
|
/**
|
|
395
402
|
* Create and register a definition with the given `identifier` at `destinationPath`.
|
|
@@ -397,7 +404,12 @@ export declare class GenerateContext {
|
|
|
397
404
|
* @experimental
|
|
398
405
|
*/
|
|
399
406
|
defineAndRegister<V extends GeneratedValue>({ identifier, value, destinationPath, noExport }: DefineAndRegisterArgs<V>): Definition<V>;
|
|
400
|
-
/**
|
|
407
|
+
/**
|
|
408
|
+
* Registers JSON content for output to a file.
|
|
409
|
+
*
|
|
410
|
+
* @experimental This method is experimental and may change in future versions
|
|
411
|
+
* @param args - Registration arguments with destination path and JSON content
|
|
412
|
+
*/
|
|
401
413
|
registerJson({ destinationPath, json }: RegisterJsonArgs): void;
|
|
402
414
|
/**
|
|
403
415
|
* Insert supplied `imports` and `definitions` into file at `destinationPath`.
|
|
@@ -426,6 +438,14 @@ export declare class GenerateContext {
|
|
|
426
438
|
* @mutates this.files
|
|
427
439
|
*/
|
|
428
440
|
insertOperation<V extends GeneratedValue, T extends GenerationType, EnrichmentType = undefined>(insertable: OperationInsertable<V, EnrichmentType>, operation: OasOperation, { generation, destinationPath, noExport }?: InsertOperationOptions<T>): Inserted<V, T, EnrichmentType>;
|
|
441
|
+
/**
|
|
442
|
+
* Inserts a normalized model definition into the generation context.
|
|
443
|
+
*
|
|
444
|
+
* @param insertable - Model insertable configuration with prototype and transform functions
|
|
445
|
+
* @param schema - OAS schema, reference, or void type to generate model from
|
|
446
|
+
* @param options - Insertion options including generation type and destination
|
|
447
|
+
* @returns Inserted model instance with settings and definition
|
|
448
|
+
*/
|
|
429
449
|
insertNormalisedModel<V extends GeneratedValue, Schema extends OasSchema | OasRef<'schema'> | OasVoid, EnrichmentType>(insertable: ModelInsertable<V, EnrichmentType>, { schema, fallbackName, destinationPath }: InsertNormalisedModelArgs<Schema>, { noExport }?: InsertNormalisedModelOptions): InsertNormalisedModelReturn<V, Schema>;
|
|
430
450
|
/**
|
|
431
451
|
* Insert model into the output file with path `destinationPath`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAmB,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGzE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,K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AC5C,SAAS,EACT,UAAU,EACX,EAAE,uBAAuB,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,eAAe,CAAC,cAAc,CAAC;IAQ/E;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,EAAE,cAAc,EAAE,EACxC,OAAO,EACP,UAAU,EACX,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,eAAe,CAAC,cAAc,CAAC;IAuB9E;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAYzF;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAOvE;AAED,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,YAAY,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,4BAG/B,qBAAqB,KAAG,eAKzB,CAAA;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,GAAI,0BAA0B,iBAAiB,KAAG,WAI1E,CAAA"}
|
|
@@ -216,6 +216,13 @@ export class GenerateContext {
|
|
|
216
216
|
mappings: __classPrivateFieldGet(this, _GenerateContext_mappings, "f")
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Executes a function within a traced context for debugging and monitoring.
|
|
221
|
+
*
|
|
222
|
+
* @param token - Trace identifier or path segments
|
|
223
|
+
* @param fn - Function to execute within the trace context
|
|
224
|
+
* @returns The result of the traced function execution
|
|
225
|
+
*/
|
|
219
226
|
trace(token, fn) {
|
|
220
227
|
return tracer(this.stackTrail, token, fn, this.logger);
|
|
221
228
|
}
|
|
@@ -244,7 +251,12 @@ export class GenerateContext {
|
|
|
244
251
|
noExport
|
|
245
252
|
});
|
|
246
253
|
}
|
|
247
|
-
/**
|
|
254
|
+
/**
|
|
255
|
+
* Registers JSON content for output to a file.
|
|
256
|
+
*
|
|
257
|
+
* @experimental This method is experimental and may change in future versions
|
|
258
|
+
* @param args - Registration arguments with destination path and JSON content
|
|
259
|
+
*/
|
|
248
260
|
registerJson({ destinationPath, json }) {
|
|
249
261
|
const currentFile = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_getFile).call(this, destinationPath);
|
|
250
262
|
invariant(currentFile instanceof JsonFile, `File at "${destinationPath}" is not a "JsonFile" type`);
|
|
@@ -324,6 +336,14 @@ export class GenerateContext {
|
|
|
324
336
|
});
|
|
325
337
|
return new Inserted({ settings, definition });
|
|
326
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* Inserts a normalized model definition into the generation context.
|
|
341
|
+
*
|
|
342
|
+
* @param insertable - Model insertable configuration with prototype and transform functions
|
|
343
|
+
* @param schema - OAS schema, reference, or void type to generate model from
|
|
344
|
+
* @param options - Insertion options including generation type and destination
|
|
345
|
+
* @returns Inserted model instance with settings and definition
|
|
346
|
+
*/
|
|
327
347
|
insertNormalisedModel(insertable, { schema, fallbackName, destinationPath }, { noExport = false } = {}) {
|
|
328
348
|
if (schema.isRef()) {
|
|
329
349
|
const { definition } = this.insertModel(insertable, schema.toRefName(), {
|
|
@@ -30,7 +30,7 @@ export type ParseReturn = {
|
|
|
30
30
|
/**
|
|
31
31
|
* Base type for parse warning messages.
|
|
32
32
|
*/
|
|
33
|
-
type ParseWarningBase = {
|
|
33
|
+
export type ParseWarningBase = {
|
|
34
34
|
/** Issue severity level */
|
|
35
35
|
level: 'warning';
|
|
36
36
|
/** Warning message */
|
|
@@ -39,7 +39,7 @@ type ParseWarningBase = {
|
|
|
39
39
|
/**
|
|
40
40
|
* Base type for parse error messages.
|
|
41
41
|
*/
|
|
42
|
-
type ParseErrorBase = {
|
|
42
|
+
export type ParseErrorBase = {
|
|
43
43
|
/** Issue severity level */
|
|
44
44
|
level: 'error';
|
|
45
45
|
/** The error that occurred */
|
|
@@ -48,7 +48,7 @@ type ParseErrorBase = {
|
|
|
48
48
|
/**
|
|
49
49
|
* Base union type for parse issues.
|
|
50
50
|
*/
|
|
51
|
-
type ParseIssueBase = ParseErrorBase | ParseWarningBase;
|
|
51
|
+
export type ParseIssueBase = ParseErrorBase | ParseWarningBase;
|
|
52
52
|
/**
|
|
53
53
|
* Arguments for logging issues with a specific key.
|
|
54
54
|
*/
|
|
@@ -253,17 +253,78 @@ export declare class ParseContext {
|
|
|
253
253
|
issues: ParseIssue[];
|
|
254
254
|
/** Whether to suppress console output during parsing */
|
|
255
255
|
silent: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* Creates a new ParseContext instance for the parsing phase.
|
|
258
|
+
*
|
|
259
|
+
* @param args - Constructor arguments including document object, logger, and options
|
|
260
|
+
*/
|
|
256
261
|
constructor({ documentObject, logger, stackTrail, silent }: ConstructorArgs);
|
|
262
|
+
/**
|
|
263
|
+
* Parses the OpenAPI v3 document and returns the internal OAS document representation.
|
|
264
|
+
*
|
|
265
|
+
* @returns Parsed OAS document with all components and operations
|
|
266
|
+
*/
|
|
257
267
|
parse(): OasDocument;
|
|
268
|
+
/**
|
|
269
|
+
* Removes items from the parsed document that encountered errors during parsing.
|
|
270
|
+
*/
|
|
258
271
|
removeErroredItems(): void;
|
|
272
|
+
/**
|
|
273
|
+
* Registers a reference ($ref) with its associated stack trail for error tracking.
|
|
274
|
+
*
|
|
275
|
+
* @param stackTrail - Current processing context stack trail
|
|
276
|
+
* @param $ref - OpenAPI reference string to register
|
|
277
|
+
*/
|
|
259
278
|
registerRef(stackTrail: StackTrail, $ref: string): void;
|
|
279
|
+
/**
|
|
280
|
+
* Registers an error that occurred while processing a reference.
|
|
281
|
+
*
|
|
282
|
+
* @param error - Error that occurred during reference processing
|
|
283
|
+
* @param $ref - Reference string that caused the error (if available)
|
|
284
|
+
*/
|
|
260
285
|
registerRefError(error: Error, $ref: string | undefined): void;
|
|
286
|
+
/**
|
|
287
|
+
* Executes a function within a traced context for debugging and monitoring.
|
|
288
|
+
*
|
|
289
|
+
* @param token - Trace identifier or path segments
|
|
290
|
+
* @param fn - Function to execute within the trace context
|
|
291
|
+
* @returns The result of the traced function execution
|
|
292
|
+
*/
|
|
261
293
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
294
|
+
/**
|
|
295
|
+
* Logs warnings for fields that were skipped during parsing.
|
|
296
|
+
*
|
|
297
|
+
* @param args - Arguments containing skipped fields and parent context
|
|
298
|
+
*/
|
|
262
299
|
logSkippedFields({ skipped, parent, parentType }: LogSkippedValuesArgs): void;
|
|
300
|
+
/**
|
|
301
|
+
* Attempts to parse a value with optional error handling and logging.
|
|
302
|
+
*
|
|
303
|
+
* @param args - Parsing arguments including schema and error handling
|
|
304
|
+
* @returns Parsed value or undefined if parsing fails
|
|
305
|
+
*/
|
|
263
306
|
provisionalParse<T>({ key, value, parent, schema, toMessage, type }: ProvisionalParseArgs<T>): T | undefined;
|
|
307
|
+
/**
|
|
308
|
+
* Logs a parsing issue with associated key context.
|
|
309
|
+
*
|
|
310
|
+
* @param args - Issue arguments including key, parent object, and issue details
|
|
311
|
+
*/
|
|
264
312
|
logIssue({ key, parent, type, ...issue }: LogIssueArgs): void;
|
|
313
|
+
/**
|
|
314
|
+
* Logs a parsing issue without specific key context.
|
|
315
|
+
*
|
|
316
|
+
* @param args - Issue arguments including parent object and issue details
|
|
317
|
+
*/
|
|
265
318
|
logIssueNoKey({ parent, type, ...issue }: LogIssueNoKeyArgs): void;
|
|
266
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* Parses an OpenAPI v3 schema from string format (JSON or YAML).
|
|
322
|
+
*
|
|
323
|
+
* Automatically detects the format based on content and parses accordingly.
|
|
324
|
+
*
|
|
325
|
+
* @param schema - Schema string in JSON or YAML format
|
|
326
|
+
* @returns Parsed OpenAPI v3 document object
|
|
327
|
+
*/
|
|
267
328
|
export declare const parseSchema: (schema: string) => OpenAPIV3.Document;
|
|
268
329
|
export {};
|
|
269
330
|
//# sourceMappingURL=ParseContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,KAAK,GAAG,MAAM,yCAAyC,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C;;GAEG;AACH,KAAK,eAAe,GAAG;IACrB,uCAAuC;IACvC,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,4CAA4C;IAC5C,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAA;IACtB,yCAAyC;IACzC,MAAM,EAAE,OAAO,CAAA;CAChB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,8BAA8B;IAC9B,WAAW,EAAE,WAAW,CAAA;IACxB,0CAA0C;IAC1C,MAAM,EAAE,UAAU,EAAE,CAAA;CACrB,CAAA;AAED;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6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L,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAgB1C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY;IAItD;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB;CAqB5D;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,KAAG,SAAS,CAAC,QAMtD,CAAA"}
|
|
@@ -125,6 +125,11 @@ import * as v from 'valibot';
|
|
|
125
125
|
* ```
|
|
126
126
|
*/
|
|
127
127
|
export class ParseContext {
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new ParseContext instance for the parsing phase.
|
|
130
|
+
*
|
|
131
|
+
* @param args - Constructor arguments including document object, logger, and options
|
|
132
|
+
*/
|
|
128
133
|
constructor({ documentObject, logger, stackTrail, silent = true }) {
|
|
129
134
|
/** The original OpenAPI v3 document being parsed */
|
|
130
135
|
Object.defineProperty(this, "documentObject", {
|
|
@@ -179,6 +184,11 @@ export class ParseContext {
|
|
|
179
184
|
__classPrivateFieldSet(this, _ParseContext_refStackTrails, {}, "f");
|
|
180
185
|
__classPrivateFieldSet(this, _ParseContext_refErrors, {}, "f");
|
|
181
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Parses the OpenAPI v3 document and returns the internal OAS document representation.
|
|
189
|
+
*
|
|
190
|
+
* @returns Parsed OAS document with all components and operations
|
|
191
|
+
*/
|
|
182
192
|
parse() {
|
|
183
193
|
this.oasDocument.fields = toDocumentFieldsV3({
|
|
184
194
|
documentObject: this.documentObject,
|
|
@@ -187,6 +197,9 @@ export class ParseContext {
|
|
|
187
197
|
this.removeErroredItems();
|
|
188
198
|
return this.oasDocument;
|
|
189
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Removes items from the parsed document that encountered errors during parsing.
|
|
202
|
+
*/
|
|
190
203
|
removeErroredItems() {
|
|
191
204
|
Object.entries(__classPrivateFieldGet(this, _ParseContext_refErrors, "f")).forEach(([$ref, errors]) => {
|
|
192
205
|
errors.forEach(error => {
|
|
@@ -205,19 +218,43 @@ export class ParseContext {
|
|
|
205
218
|
});
|
|
206
219
|
});
|
|
207
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Registers a reference ($ref) with its associated stack trail for error tracking.
|
|
223
|
+
*
|
|
224
|
+
* @param stackTrail - Current processing context stack trail
|
|
225
|
+
* @param $ref - OpenAPI reference string to register
|
|
226
|
+
*/
|
|
208
227
|
registerRef(stackTrail, $ref) {
|
|
209
228
|
const refStackTrails = __classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref];
|
|
210
229
|
refStackTrails ? refStackTrails.push(stackTrail) : (__classPrivateFieldGet(this, _ParseContext_refStackTrails, "f")[$ref] = [stackTrail]);
|
|
211
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Registers an error that occurred while processing a reference.
|
|
233
|
+
*
|
|
234
|
+
* @param error - Error that occurred during reference processing
|
|
235
|
+
* @param $ref - Reference string that caused the error (if available)
|
|
236
|
+
*/
|
|
212
237
|
registerRefError(error, $ref) {
|
|
213
238
|
if ($ref) {
|
|
214
239
|
const refErrors = __classPrivateFieldGet(this, _ParseContext_refErrors, "f")[$ref];
|
|
215
240
|
refErrors ? refErrors.push(error) : (__classPrivateFieldGet(this, _ParseContext_refErrors, "f")[$ref] = [error]);
|
|
216
241
|
}
|
|
217
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Executes a function within a traced context for debugging and monitoring.
|
|
245
|
+
*
|
|
246
|
+
* @param token - Trace identifier or path segments
|
|
247
|
+
* @param fn - Function to execute within the trace context
|
|
248
|
+
* @returns The result of the traced function execution
|
|
249
|
+
*/
|
|
218
250
|
trace(token, fn) {
|
|
219
251
|
return tracer(this.stackTrail, token, fn, this.logger);
|
|
220
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Logs warnings for fields that were skipped during parsing.
|
|
255
|
+
*
|
|
256
|
+
* @param args - Arguments containing skipped fields and parent context
|
|
257
|
+
*/
|
|
221
258
|
logSkippedFields({ skipped, parent, parentType }) {
|
|
222
259
|
Object.keys(skipped).forEach(key => {
|
|
223
260
|
this.logIssue({
|
|
@@ -229,6 +266,12 @@ export class ParseContext {
|
|
|
229
266
|
});
|
|
230
267
|
});
|
|
231
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Attempts to parse a value with optional error handling and logging.
|
|
271
|
+
*
|
|
272
|
+
* @param args - Parsing arguments including schema and error handling
|
|
273
|
+
* @returns Parsed value or undefined if parsing fails
|
|
274
|
+
*/
|
|
232
275
|
provisionalParse({ key, value, parent, schema, toMessage, type }) {
|
|
233
276
|
const parsed = v.safeParse(v.optional(schema), value);
|
|
234
277
|
if (parsed.success) {
|
|
@@ -242,9 +285,19 @@ export class ParseContext {
|
|
|
242
285
|
type
|
|
243
286
|
});
|
|
244
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Logs a parsing issue with associated key context.
|
|
290
|
+
*
|
|
291
|
+
* @param args - Issue arguments including key, parent object, and issue details
|
|
292
|
+
*/
|
|
245
293
|
logIssue({ key, parent, type, ...issue }) {
|
|
246
294
|
this.trace(key, () => this.logIssueNoKey({ parent, type, ...issue }));
|
|
247
295
|
}
|
|
296
|
+
/**
|
|
297
|
+
* Logs a parsing issue without specific key context.
|
|
298
|
+
*
|
|
299
|
+
* @param args - Issue arguments including parent object and issue details
|
|
300
|
+
*/
|
|
248
301
|
logIssueNoKey({ parent, type, ...issue }) {
|
|
249
302
|
if (issue.level === 'error') {
|
|
250
303
|
this.registerRefError(issue.error, this.stackTrail.toStackRef());
|
|
@@ -266,6 +319,14 @@ export class ParseContext {
|
|
|
266
319
|
}
|
|
267
320
|
}
|
|
268
321
|
_ParseContext_refStackTrails = new WeakMap(), _ParseContext_refErrors = new WeakMap();
|
|
322
|
+
/**
|
|
323
|
+
* Parses an OpenAPI v3 schema from string format (JSON or YAML).
|
|
324
|
+
*
|
|
325
|
+
* Automatically detects the format based on content and parses accordingly.
|
|
326
|
+
*
|
|
327
|
+
* @param schema - Schema string in JSON or YAML format
|
|
328
|
+
* @returns Parsed OpenAPI v3 document object
|
|
329
|
+
*/
|
|
269
330
|
export const parseSchema = (schema) => {
|
|
270
331
|
if (schema.trimStart().startsWith('{')) {
|
|
271
332
|
return JSON.parse(schema);
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { type LevelName } from '../deps/jsr.io/@std/log/0.224.14/levels.js';
|
|
2
2
|
import type { LogRecord } from '../deps/jsr.io/@std/log/0.224.14/logger.js';
|
|
3
3
|
import { BaseHandler } from '../deps/jsr.io/@std/log/0.224.14/base_handler.js';
|
|
4
|
-
import type { BaseHandlerOptions } from '../deps/jsr.io/@std/log/0.224.14/base_handler.js';
|
|
5
4
|
import type { CoreContext } from './CoreContext.js';
|
|
5
|
+
/**
|
|
6
|
+
* Base log handler interface for extending Deno standard library handlers.
|
|
7
|
+
*/
|
|
8
|
+
export interface LogHandlerBase {
|
|
9
|
+
handle(logRecord: LogRecord): void;
|
|
10
|
+
}
|
|
6
11
|
/**
|
|
7
12
|
* Configuration options for the {@link ResultsHandler}.
|
|
8
13
|
*/
|
|
9
|
-
export interface ResultsHandlerOptions
|
|
14
|
+
export interface ResultsHandlerOptions {
|
|
10
15
|
/** The CoreContext instance to capture results to */
|
|
11
16
|
context: CoreContext;
|
|
17
|
+
/** Formatter function for log messages */
|
|
18
|
+
formatter?: (logRecord: LogRecord) => string;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* Custom log handler that captures warning and error results for SKMTC processing.
|
|
@@ -77,7 +84,7 @@ export interface ResultsHandlerOptions extends BaseHandlerOptions {
|
|
|
77
84
|
* }
|
|
78
85
|
* ```
|
|
79
86
|
*/
|
|
80
|
-
export declare class ResultsHandler extends BaseHandler {
|
|
87
|
+
export declare class ResultsHandler extends BaseHandler implements LogHandlerBase {
|
|
81
88
|
#private;
|
|
82
89
|
/** The CoreContext instance for capturing results */
|
|
83
90
|
context: CoreContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultsHandler.d.ts","sourceRoot":"","sources":["../../src/context/ResultsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,4CAA4C,CAAA;AACtF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAC9E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ResultsHandler.d.ts","sourceRoot":"","sources":["../../src/context/ResultsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,4CAA4C,CAAA;AACtF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,OAAO,EAAE,WAAW,CAAA;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAA;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,qBAAa,cAAe,SAAQ,WAAY,YAAW,cAAc;;IACvE,qDAAqD;IACrD,OAAO,EAAE,WAAW,CAAA;IAOpB;;;;;;;;;;;;;;OAcG;gBACS,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB;IAMhE;;;;;;;OAOG;IACM,KAAK;IAMd;;;;;;;;;OASG;IACM,MAAM,CAAC,SAAS,EAAE,SAAS;IASpC;;;;;;;;;;;;;;;;OAgBG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM;IAWrB;;;;;;;OAOG;IACH,KAAK;IAWL;;;;;;;;;;;;;;;;;;;;;OAqBG;IACM,OAAO;CAKjB"}
|
package/esm/dsl/model/types.d.ts
CHANGED
|
@@ -6,33 +6,73 @@ import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
|
|
|
6
6
|
import type * as v from 'valibot';
|
|
7
7
|
import type { MappingModule, PreviewModule } from '../../types/Preview.js';
|
|
8
8
|
import type { SchemaToValueFn } from '../../types/TypeSystem.js';
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Constructor arguments for model insertable instances.
|
|
11
|
+
*
|
|
12
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
13
|
+
*/
|
|
14
|
+
export type ModelInsertableConstructorArgs<EnrichmentType = undefined> = {
|
|
10
15
|
context: GenerateContext;
|
|
11
16
|
refName: RefName;
|
|
12
17
|
settings: ContentSettings<EnrichmentType>;
|
|
13
18
|
destinationPath: string;
|
|
14
19
|
rootRef?: RefName;
|
|
15
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Interface for objects that provide model transformation capabilities.
|
|
23
|
+
*
|
|
24
|
+
* Used by generator configurations to transform model definitions
|
|
25
|
+
* during the code generation process.
|
|
26
|
+
*/
|
|
16
27
|
export type WithTransformModel = {
|
|
17
28
|
transformModel: (refName: RefName) => void;
|
|
18
29
|
};
|
|
19
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Arguments for generating enrichment data for models.
|
|
32
|
+
*/
|
|
33
|
+
export type ModelToEnrichmentsArgs = {
|
|
20
34
|
refName: RefName;
|
|
21
35
|
context: GenerateContext;
|
|
22
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Arguments passed to model transformation functions.
|
|
39
|
+
*
|
|
40
|
+
* @template Acc - Accumulator type for collecting transformation results
|
|
41
|
+
*/
|
|
23
42
|
export type TransformModelArgs<Acc> = {
|
|
24
43
|
context: GenerateContext;
|
|
25
44
|
refName: RefName;
|
|
26
45
|
acc: Acc | undefined;
|
|
27
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Arguments for generating model preview modules.
|
|
49
|
+
*
|
|
50
|
+
* Preview modules provide quick insights into generated models
|
|
51
|
+
* without full code generation.
|
|
52
|
+
*/
|
|
28
53
|
export type ToModelPreviewModuleArgs = {
|
|
29
54
|
context: GenerateContext;
|
|
30
55
|
refName: RefName;
|
|
31
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Arguments for generating model mapping information.
|
|
59
|
+
*
|
|
60
|
+
* Mappings track relationships between OAS schemas and generated models,
|
|
61
|
+
* enabling cross-references and dependency analysis.
|
|
62
|
+
*/
|
|
32
63
|
export type ToModelMappingArgs = {
|
|
33
64
|
context: GenerateContext;
|
|
34
65
|
refName: RefName;
|
|
35
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Configuration object for insertable model generators.
|
|
69
|
+
*
|
|
70
|
+
* Defines the contract for model generator classes that can be inserted
|
|
71
|
+
* into the generation context to produce type-safe model definitions.
|
|
72
|
+
*
|
|
73
|
+
* @template V - Generated value type produced by the model generator
|
|
74
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
75
|
+
*/
|
|
36
76
|
export type ModelInsertable<V, EnrichmentType = undefined> = {
|
|
37
77
|
prototype: V;
|
|
38
78
|
} & {
|
|
@@ -41,10 +81,18 @@ export type ModelInsertable<V, EnrichmentType = undefined> = {
|
|
|
41
81
|
type: 'model';
|
|
42
82
|
toIdentifier: (refName: RefName) => Identifier;
|
|
43
83
|
toExportPath: (refName: RefName) => string;
|
|
44
|
-
toEnrichments: ({ refName, context }:
|
|
84
|
+
toEnrichments: ({ refName, context }: ModelToEnrichmentsArgs) => EnrichmentType;
|
|
45
85
|
schemaToValueFn: SchemaToValueFn;
|
|
46
86
|
createIdentifier: (name: string) => Identifier;
|
|
47
87
|
} & Function;
|
|
88
|
+
/**
|
|
89
|
+
* Configuration object for model generators.
|
|
90
|
+
*
|
|
91
|
+
* Defines the behavior and capabilities of model generators including
|
|
92
|
+
* transformation logic, preview generation, and enrichment handling.
|
|
93
|
+
*
|
|
94
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
95
|
+
*/
|
|
48
96
|
export type ModelConfig<EnrichmentType = undefined> = {
|
|
49
97
|
id: string;
|
|
50
98
|
type: 'model';
|
|
@@ -54,5 +102,4 @@ export type ModelConfig<EnrichmentType = undefined> = {
|
|
|
54
102
|
toEnrichmentSchema?: () => v.BaseSchema<EnrichmentType, EnrichmentType, v.BaseIssue<unknown>>;
|
|
55
103
|
toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(refName: RefName) => EnrichmentRequest<RequestedEnrichment> | undefined;
|
|
56
104
|
};
|
|
57
|
-
export {};
|
|
58
105
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,
|
|
1
|
+
{"version":3,"file":"types.d.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,EAAE,OAAO,EAAE,EAAE,kBAAkB,KAAK,aAAa,CAAA;IAC7E,kBAAkB,CAAC,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7F,mBAAmB,CAAC,EAAE,CAAC,mBAAmB,SAAS,cAAc,EAC/D,OAAO,EAAE,OAAO,KACb,iBAAiB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAA;CACxD,CAAA"}
|
|
@@ -5,40 +5,88 @@ import type { Identifier } from '../Identifier.js';
|
|
|
5
5
|
import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
|
|
6
6
|
import type * as v from 'valibot';
|
|
7
7
|
import type { MappingModule, PreviewModule } from '../../types/Preview.js';
|
|
8
|
+
/**
|
|
9
|
+
* Arguments passed to operation insertable constructors.
|
|
10
|
+
*
|
|
11
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
12
|
+
*/
|
|
8
13
|
export type OperationInsertableArgs<EnrichmentType = undefined> = {
|
|
9
14
|
context: GenerateContext;
|
|
10
15
|
settings: ContentSettings<EnrichmentType>;
|
|
11
16
|
operation: OasOperation;
|
|
12
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Arguments passed to operation transformation functions.
|
|
20
|
+
*
|
|
21
|
+
* @template Acc - Accumulator type for collecting transformation results
|
|
22
|
+
*/
|
|
13
23
|
export type TransformOperationArgs<Acc> = {
|
|
14
24
|
context: GenerateContext;
|
|
15
25
|
operation: OasOperation;
|
|
16
26
|
acc: Acc | undefined;
|
|
17
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Interface for objects that provide operation transformation capabilities.
|
|
30
|
+
*
|
|
31
|
+
* Used by generator configurations to transform operation definitions
|
|
32
|
+
* during the code generation process.
|
|
33
|
+
*/
|
|
18
34
|
export type WithTransformOperation = {
|
|
19
35
|
transformOperation: (operation: OasOperation) => void;
|
|
20
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Arguments for checking if an operation is supported with enrichment configuration.
|
|
39
|
+
*
|
|
40
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
41
|
+
*/
|
|
21
42
|
export type IsSupportedOperationConfigArgs<EnrichmentType = undefined> = {
|
|
22
43
|
context: GenerateContext;
|
|
23
44
|
operation: OasOperation;
|
|
24
45
|
enrichments: EnrichmentType;
|
|
25
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Arguments for checking if an operation is supported for code generation.
|
|
49
|
+
*/
|
|
26
50
|
export type IsSupportedOperationArgs = {
|
|
27
51
|
context: GenerateContext;
|
|
28
52
|
operation: OasOperation;
|
|
29
53
|
};
|
|
30
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Arguments for generating enrichment data for operations.
|
|
56
|
+
*/
|
|
57
|
+
export type OperationToEnrichmentsArgs = {
|
|
31
58
|
operation: OasOperation;
|
|
32
59
|
context: GenerateContext;
|
|
33
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Arguments for generating operation preview modules.
|
|
63
|
+
*
|
|
64
|
+
* Preview modules provide quick insights into generated operations
|
|
65
|
+
* without full code generation.
|
|
66
|
+
*/
|
|
34
67
|
export type ToOperationPreviewModuleArgs = {
|
|
35
68
|
context: GenerateContext;
|
|
36
69
|
operation: OasOperation;
|
|
37
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Arguments for generating operation mapping information.
|
|
73
|
+
*
|
|
74
|
+
* Mappings track relationships between OAS operations and generated code,
|
|
75
|
+
* enabling cross-references and dependency analysis.
|
|
76
|
+
*/
|
|
38
77
|
export type ToOperationMappingArgs = {
|
|
39
78
|
context: GenerateContext;
|
|
40
79
|
operation: OasOperation;
|
|
41
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Configuration object for insertable operation generators.
|
|
83
|
+
*
|
|
84
|
+
* Defines the contract for operation generator classes that can be inserted
|
|
85
|
+
* into the generation context to produce type-safe operation definitions.
|
|
86
|
+
*
|
|
87
|
+
* @template V - Generated value type produced by the operation generator
|
|
88
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
89
|
+
*/
|
|
42
90
|
export type OperationInsertable<V, EnrichmentType = undefined> = {
|
|
43
91
|
prototype: V;
|
|
44
92
|
} & {
|
|
@@ -47,12 +95,23 @@ export type OperationInsertable<V, EnrichmentType = undefined> = {
|
|
|
47
95
|
type: 'operation';
|
|
48
96
|
toIdentifier: (operation: OasOperation) => Identifier;
|
|
49
97
|
toExportPath: (operation: OasOperation) => string;
|
|
50
|
-
toEnrichments: ({ operation, context }:
|
|
98
|
+
toEnrichments: ({ operation, context }: OperationToEnrichmentsArgs) => EnrichmentType;
|
|
51
99
|
} & Function;
|
|
100
|
+
/**
|
|
101
|
+
* Arguments for checking if an operation is supported for generation.
|
|
102
|
+
*/
|
|
52
103
|
export type IsSupportedArgs = {
|
|
53
104
|
context: GenerateContext;
|
|
54
105
|
operation: OasOperation;
|
|
55
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Configuration object for operation generators.
|
|
109
|
+
*
|
|
110
|
+
* Defines the behavior and capabilities of operation generators including
|
|
111
|
+
* support detection, transformation logic, and enrichment handling.
|
|
112
|
+
*
|
|
113
|
+
* @template EnrichmentType - Optional enrichment data type for additional metadata
|
|
114
|
+
*/
|
|
56
115
|
export type OperationConfig<EnrichmentType = undefined> = {
|
|
57
116
|
id: string;
|
|
58
117
|
type: 'operation';
|
|
@@ -63,5 +122,4 @@ export type OperationConfig<EnrichmentType = undefined> = {
|
|
|
63
122
|
toMappingModule?: ({ context, operation }: ToOperationMappingArgs) => MappingModule;
|
|
64
123
|
toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined;
|
|
65
124
|
};
|
|
66
|
-
export {};
|
|
67
125
|
//# sourceMappingURL=types.d.ts.map
|