@skmtc/core 0.0.940 → 0.0.941
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/CoreContext.d.ts +6 -32
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +15 -60
- package/esm/context/GenerateContext.d.ts +4 -15
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +16 -35
- package/esm/context/ParseContext.d.ts +5 -9
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +11 -18
- package/esm/context/RenderContext.d.ts +6 -209
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +8 -215
- package/esm/context/ResultsHandler.d.ts +0 -67
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/ResultsHandler.js +2 -68
- package/esm/context/StackTrail.d.ts +2 -0
- package/esm/context/StackTrail.d.ts.map +1 -1
- package/esm/context/StackTrail.js +26 -0
- package/esm/context/generateTypes.d.ts +2 -2
- package/esm/context/generateTypes.d.ts.map +1 -1
- package/esm/context/parseTypes.d.ts +7 -2
- package/esm/context/parseTypes.d.ts.map +1 -1
- package/esm/oas/_helpers/parseEnum.d.ts +3 -1
- package/esm/oas/_helpers/parseEnum.d.ts.map +1 -1
- package/esm/oas/_helpers/parseEnum.js +2 -1
- package/esm/oas/_helpers/parseNullable.d.ts +4 -1
- package/esm/oas/_helpers/parseNullable.d.ts.map +1 -1
- package/esm/oas/_helpers/parseNullable.js +2 -1
- package/esm/oas/array/toArray.d.ts +5 -2
- package/esm/oas/array/toArray.d.ts.map +1 -1
- package/esm/oas/array/toArray.js +16 -9
- package/esm/oas/boolean/toBoolean.d.ts +5 -2
- package/esm/oas/boolean/toBoolean.d.ts.map +1 -1
- package/esm/oas/boolean/toBoolean.js +16 -8
- package/esm/oas/components/toComponentsV3.d.ts +3 -1
- package/esm/oas/components/toComponentsV3.d.ts.map +1 -1
- package/esm/oas/components/toComponentsV3.js +9 -8
- package/esm/oas/contact/toContactV3.d.ts +2 -1
- package/esm/oas/contact/toContactV3.d.ts.map +1 -1
- package/esm/oas/contact/toContactV3.js +2 -1
- package/esm/oas/discriminator/toDiscriminatorV3.d.ts +3 -1
- package/esm/oas/discriminator/toDiscriminatorV3.d.ts.map +1 -1
- package/esm/oas/discriminator/toDiscriminatorV3.js +7 -2
- package/esm/oas/document/toDocumentFieldsV3.d.ts +3 -1
- package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/esm/oas/document/toDocumentFieldsV3.js +10 -9
- package/esm/oas/example/toExamplesV3.d.ts +10 -2
- package/esm/oas/example/toExamplesV3.d.ts.map +1 -1
- package/esm/oas/example/toExamplesV3.js +8 -7
- package/esm/oas/externalDocs/toExternalDocs.d.ts +3 -1
- package/esm/oas/externalDocs/toExternalDocs.d.ts.map +1 -1
- package/esm/oas/externalDocs/toExternalDocs.js +1 -1
- package/esm/oas/header/toHeadersV3.d.ts +3 -1
- package/esm/oas/header/toHeadersV3.d.ts.map +1 -1
- package/esm/oas/header/toHeadersV3.js +8 -7
- package/esm/oas/info/toInfoV3.d.ts +3 -1
- package/esm/oas/info/toInfoV3.d.ts.map +1 -1
- package/esm/oas/info/toInfoV3.js +4 -3
- package/esm/oas/integer/toInteger.d.ts +5 -2
- package/esm/oas/integer/toInteger.d.ts.map +1 -1
- package/esm/oas/integer/toInteger.js +17 -9
- package/esm/oas/license/toLicenseV3.d.ts +2 -1
- package/esm/oas/license/toLicenseV3.d.ts.map +1 -1
- package/esm/oas/license/toLicenseV3.js +2 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts +10 -3
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.js +9 -8
- package/esm/oas/number/toNumber.d.ts +3 -1
- package/esm/oas/number/toNumber.d.ts.map +1 -1
- package/esm/oas/number/toNumber.js +15 -7
- package/esm/oas/object/toAdditionalPropertiesV3.d.ts +3 -1
- package/esm/oas/object/toAdditionalPropertiesV3.d.ts.map +1 -1
- package/esm/oas/object/toAdditionalPropertiesV3.js +2 -2
- package/esm/oas/object/toObject.d.ts +3 -1
- package/esm/oas/object/toObject.d.ts.map +1 -1
- package/esm/oas/object/toObject.js +15 -9
- package/esm/oas/operation/toOperationsV3.d.ts +5 -2
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +14 -12
- package/esm/oas/parameter/toParameterV3.d.ts +7 -3
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +18 -16
- package/esm/oas/pathItem/toPathItemV3.d.ts +3 -1
- package/esm/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/esm/oas/pathItem/toPathItemV3.js +3 -3
- package/esm/oas/ref/toRefV31.d.ts +3 -1
- package/esm/oas/ref/toRefV31.d.ts.map +1 -1
- package/esm/oas/ref/toRefV31.js +3 -3
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts +5 -2
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/esm/oas/requestBody/toRequestBodiesV3.js +7 -7
- package/esm/oas/response/toResponseV3.d.ts +7 -3
- package/esm/oas/response/toResponseV3.d.ts.map +1 -1
- package/esm/oas/response/toResponseV3.js +10 -9
- package/esm/oas/schema/toSchemasV3.d.ts +9 -4
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +33 -25
- package/esm/oas/securityRequirement/toSecurityRequirement.d.ts +3 -1
- package/esm/oas/securityRequirement/toSecurityRequirement.d.ts.map +1 -1
- package/esm/oas/securityRequirement/toSecurityRequirement.js +1 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.d.ts +3 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/esm/oas/securitySchemes/toSecuritySchemes.js +23 -8
- package/esm/oas/server/toServerV3.d.ts +7 -3
- package/esm/oas/server/toServerV3.d.ts.map +1 -1
- package/esm/oas/server/toServerV3.js +7 -7
- package/esm/oas/serverVariable/toServerVariableV3.d.ts +7 -3
- package/esm/oas/serverVariable/toServerVariableV3.d.ts.map +1 -1
- package/esm/oas/serverVariable/toServerVariableV3.js +6 -5
- package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts +3 -1
- package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts.map +1 -1
- package/esm/oas/specificationExtensions/toSpecificationExtensionsV3.js +2 -2
- package/esm/oas/string/toString.d.ts +6 -2
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +18 -9
- package/esm/oas/tag/toTagsV3.d.ts +5 -2
- package/esm/oas/tag/toTagsV3.d.ts.map +1 -1
- package/esm/oas/tag/toTagsV3.js +4 -3
- package/esm/oas/union/toUnion.d.ts +3 -1
- package/esm/oas/union/toUnion.d.ts.map +1 -1
- package/esm/oas/union/toUnion.js +4 -4
- package/esm/oas/unknown/toUnknown.d.ts +3 -1
- package/esm/oas/unknown/toUnknown.d.ts.map +1 -1
- package/esm/oas/unknown/toUnknown.js +2 -1
- package/esm/run/toArtifacts.d.ts +4 -1
- package/esm/run/toArtifacts.d.ts.map +1 -1
- package/esm/run/toArtifacts.js +2 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +6 -32
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +15 -60
- package/script/context/GenerateContext.d.ts +4 -15
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +16 -35
- package/script/context/ParseContext.d.ts +5 -9
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +11 -18
- package/script/context/RenderContext.d.ts +6 -209
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +8 -215
- package/script/context/ResultsHandler.d.ts +0 -67
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/ResultsHandler.js +2 -68
- package/script/context/StackTrail.d.ts +2 -0
- package/script/context/StackTrail.d.ts.map +1 -1
- package/script/context/StackTrail.js +26 -0
- package/script/context/generateTypes.d.ts +2 -2
- package/script/context/generateTypes.d.ts.map +1 -1
- package/script/context/parseTypes.d.ts +7 -2
- package/script/context/parseTypes.d.ts.map +1 -1
- package/script/oas/_helpers/parseEnum.d.ts +3 -1
- package/script/oas/_helpers/parseEnum.d.ts.map +1 -1
- package/script/oas/_helpers/parseEnum.js +2 -1
- package/script/oas/_helpers/parseNullable.d.ts +4 -1
- package/script/oas/_helpers/parseNullable.d.ts.map +1 -1
- package/script/oas/_helpers/parseNullable.js +2 -1
- package/script/oas/array/toArray.d.ts +5 -2
- package/script/oas/array/toArray.d.ts.map +1 -1
- package/script/oas/array/toArray.js +16 -9
- package/script/oas/boolean/toBoolean.d.ts +5 -2
- package/script/oas/boolean/toBoolean.d.ts.map +1 -1
- package/script/oas/boolean/toBoolean.js +16 -8
- package/script/oas/components/toComponentsV3.d.ts +3 -1
- package/script/oas/components/toComponentsV3.d.ts.map +1 -1
- package/script/oas/components/toComponentsV3.js +9 -8
- package/script/oas/contact/toContactV3.d.ts +2 -1
- package/script/oas/contact/toContactV3.d.ts.map +1 -1
- package/script/oas/contact/toContactV3.js +2 -1
- package/script/oas/discriminator/toDiscriminatorV3.d.ts +3 -1
- package/script/oas/discriminator/toDiscriminatorV3.d.ts.map +1 -1
- package/script/oas/discriminator/toDiscriminatorV3.js +7 -2
- package/script/oas/document/toDocumentFieldsV3.d.ts +3 -1
- package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/script/oas/document/toDocumentFieldsV3.js +10 -9
- package/script/oas/example/toExamplesV3.d.ts +10 -2
- package/script/oas/example/toExamplesV3.d.ts.map +1 -1
- package/script/oas/example/toExamplesV3.js +8 -7
- package/script/oas/externalDocs/toExternalDocs.d.ts +3 -1
- package/script/oas/externalDocs/toExternalDocs.d.ts.map +1 -1
- package/script/oas/externalDocs/toExternalDocs.js +1 -1
- package/script/oas/header/toHeadersV3.d.ts +3 -1
- package/script/oas/header/toHeadersV3.d.ts.map +1 -1
- package/script/oas/header/toHeadersV3.js +8 -7
- package/script/oas/info/toInfoV3.d.ts +3 -1
- package/script/oas/info/toInfoV3.d.ts.map +1 -1
- package/script/oas/info/toInfoV3.js +4 -3
- package/script/oas/integer/toInteger.d.ts +5 -2
- package/script/oas/integer/toInteger.d.ts.map +1 -1
- package/script/oas/integer/toInteger.js +17 -9
- package/script/oas/license/toLicenseV3.d.ts +2 -1
- package/script/oas/license/toLicenseV3.d.ts.map +1 -1
- package/script/oas/license/toLicenseV3.js +2 -1
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts +10 -3
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/script/oas/mediaType/toMediaTypeItemV3.js +9 -8
- package/script/oas/number/toNumber.d.ts +3 -1
- package/script/oas/number/toNumber.d.ts.map +1 -1
- package/script/oas/number/toNumber.js +15 -7
- package/script/oas/object/toAdditionalPropertiesV3.d.ts +3 -1
- package/script/oas/object/toAdditionalPropertiesV3.d.ts.map +1 -1
- package/script/oas/object/toAdditionalPropertiesV3.js +2 -2
- package/script/oas/object/toObject.d.ts +3 -1
- package/script/oas/object/toObject.d.ts.map +1 -1
- package/script/oas/object/toObject.js +15 -9
- package/script/oas/operation/toOperationsV3.d.ts +5 -2
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +14 -12
- package/script/oas/parameter/toParameterV3.d.ts +7 -3
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +18 -16
- package/script/oas/pathItem/toPathItemV3.d.ts +3 -1
- package/script/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/script/oas/pathItem/toPathItemV3.js +3 -3
- package/script/oas/ref/toRefV31.d.ts +3 -1
- package/script/oas/ref/toRefV31.d.ts.map +1 -1
- package/script/oas/ref/toRefV31.js +3 -3
- package/script/oas/requestBody/toRequestBodiesV3.d.ts +5 -2
- package/script/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/script/oas/requestBody/toRequestBodiesV3.js +7 -7
- package/script/oas/response/toResponseV3.d.ts +7 -3
- package/script/oas/response/toResponseV3.d.ts.map +1 -1
- package/script/oas/response/toResponseV3.js +10 -9
- package/script/oas/schema/toSchemasV3.d.ts +9 -4
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +33 -25
- package/script/oas/securityRequirement/toSecurityRequirement.d.ts +3 -1
- package/script/oas/securityRequirement/toSecurityRequirement.d.ts.map +1 -1
- package/script/oas/securityRequirement/toSecurityRequirement.js +1 -1
- package/script/oas/securitySchemes/toSecuritySchemes.d.ts +3 -1
- package/script/oas/securitySchemes/toSecuritySchemes.d.ts.map +1 -1
- package/script/oas/securitySchemes/toSecuritySchemes.js +23 -8
- package/script/oas/server/toServerV3.d.ts +7 -3
- package/script/oas/server/toServerV3.d.ts.map +1 -1
- package/script/oas/server/toServerV3.js +7 -7
- package/script/oas/serverVariable/toServerVariableV3.d.ts +7 -3
- package/script/oas/serverVariable/toServerVariableV3.d.ts.map +1 -1
- package/script/oas/serverVariable/toServerVariableV3.js +6 -5
- package/script/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts +3 -1
- package/script/oas/specificationExtensions/toSpecificationExtensionsV3.d.ts.map +1 -1
- package/script/oas/specificationExtensions/toSpecificationExtensionsV3.js +2 -2
- package/script/oas/string/toString.d.ts +6 -2
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +18 -9
- package/script/oas/tag/toTagsV3.d.ts +5 -2
- package/script/oas/tag/toTagsV3.d.ts.map +1 -1
- package/script/oas/tag/toTagsV3.js +4 -3
- package/script/oas/union/toUnion.d.ts +3 -1
- package/script/oas/union/toUnion.d.ts.map +1 -1
- package/script/oas/union/toUnion.js +4 -4
- package/script/oas/unknown/toUnknown.d.ts +3 -1
- package/script/oas/unknown/toUnknown.d.ts.map +1 -1
- package/script/oas/unknown/toUnknown.js +2 -1
- package/script/run/toArtifacts.d.ts +4 -1
- package/script/run/toArtifacts.d.ts.map +1 -1
- package/script/run/toArtifacts.js +2 -1
|
@@ -6,6 +6,7 @@ import type { OasDocument } from '../oas/document/Document.js';
|
|
|
6
6
|
import type { ClientSettings } from '../types/Settings.js';
|
|
7
7
|
import type { ResultType } from '../types/Results.js';
|
|
8
8
|
import type { Logger } from '../types/Logger.js';
|
|
9
|
+
import type { StackTrail } from './StackTrail.js';
|
|
9
10
|
import type { GeneratorsMapContainer } from '../types/GeneratorType.js';
|
|
10
11
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
11
12
|
import type { RenderResult } from './generateTypes.js';
|
|
@@ -64,6 +65,8 @@ type CoreContextArgs = {
|
|
|
64
65
|
* into code artifacts through the SKMTC pipeline.
|
|
65
66
|
*/
|
|
66
67
|
export type ToArtifactsArgs = {
|
|
68
|
+
/** Stack trail for distributed tracing */
|
|
69
|
+
stackTrail: StackTrail;
|
|
67
70
|
/** The OpenAPI v3 document to process */
|
|
68
71
|
documentObject: OpenAPIV3.Document;
|
|
69
72
|
/** Client settings for customization (optional) */
|
|
@@ -184,7 +187,7 @@ export declare class CoreContext {
|
|
|
184
187
|
* }
|
|
185
188
|
* ```
|
|
186
189
|
*/
|
|
187
|
-
parse(documentObject: OpenAPIV3.Document): {
|
|
190
|
+
parse(documentObject: OpenAPIV3.Document, stackTrail: StackTrail): {
|
|
188
191
|
oasDocument: OasDocument;
|
|
189
192
|
};
|
|
190
193
|
/**
|
|
@@ -258,36 +261,7 @@ export declare class CoreContext {
|
|
|
258
261
|
*
|
|
259
262
|
* @throws Will throw an error if any phase of the pipeline fails
|
|
260
263
|
*/
|
|
261
|
-
toArtifacts({ documentObject, settings, toGeneratorConfigMap, prettier }: ToArtifactsArgs): RenderResult;
|
|
262
|
-
/**
|
|
263
|
-
* Executes a function with distributed tracing and logging.
|
|
264
|
-
*
|
|
265
|
-
* This method wraps function execution with tracing capabilities, updating the
|
|
266
|
-
* stack trail for context tracking and logging execution details. It's used
|
|
267
|
-
* throughout the SKMTC pipeline to maintain execution context and debugging information.
|
|
268
|
-
*
|
|
269
|
-
* @template T - The return type of the traced function
|
|
270
|
-
* @param token - Single token or array of tokens to add to the trace stack
|
|
271
|
-
* @param fn - The function to execute within the trace context
|
|
272
|
-
* @returns The result of executing the traced function
|
|
273
|
-
*
|
|
274
|
-
* @example Single token tracing
|
|
275
|
-
* ```typescript
|
|
276
|
-
* const result = context.trace('parse-schema', () => {
|
|
277
|
-
* // Schema parsing logic here
|
|
278
|
-
* return parsedSchema;
|
|
279
|
-
* });
|
|
280
|
-
* ```
|
|
281
|
-
*
|
|
282
|
-
* @example Multiple token tracing (nested context)
|
|
283
|
-
* ```typescript
|
|
284
|
-
* const result = context.trace(['components', 'schemas', 'User'], () => {
|
|
285
|
-
* // Process User schema
|
|
286
|
-
* return processedUserSchema;
|
|
287
|
-
* });
|
|
288
|
-
* ```
|
|
289
|
-
*/
|
|
290
|
-
trace<T>(token: string, fn: () => T): T;
|
|
264
|
+
toArtifacts({ documentObject, settings, toGeneratorConfigMap, stackTrail, prettier }: ToArtifactsArgs): RenderResult;
|
|
291
265
|
/**
|
|
292
266
|
* Captures a result at the current execution position in the stack trail.
|
|
293
267
|
*
|
|
@@ -316,7 +290,7 @@ export declare class CoreContext {
|
|
|
316
290
|
* });
|
|
317
291
|
* ```
|
|
318
292
|
*/
|
|
319
|
-
captureCurrentResult(result: ResultType): void;
|
|
293
|
+
captureCurrentResult(result: ResultType, stackTrail: StackTrail): void;
|
|
320
294
|
}
|
|
321
295
|
/**
|
|
322
296
|
* Arguments for the SKMTC JSON log formatter.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,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AAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,eAAe;IAiDzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,KAAK,CAAC,cAAc,EAAE,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE;IAU/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsEG;IACH,WAAW,CAAC,EACV,cAAc,EACd,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,QAAQ,EACT,EAAE,eAAe,GAAG,YAAY;IAiFjC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,oBAAoB,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;CAiBvE;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sEAAsE;IACtE,SAAS,EAAE;QACT,yBAAyB;QACzB,SAAS,EAAE,MAAM,CAAA;QACjB,6CAA6C;QAC7C,QAAQ,EAAE,IAAI,CAAA;QACd,sBAAsB;QACtB,GAAG,EAAE,MAAM,CAAA;QACX,+BAA+B;QAC/B,IAAI,EAAE,OAAO,EAAE,CAAA;KAChB,CAAA;IACD,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAQnF"}
|
|
@@ -9,14 +9,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _CoreContext_instances, _CoreContext_phase, _CoreContext_results,
|
|
12
|
+
var _CoreContext_instances, _CoreContext_phase, _CoreContext_results, _CoreContext_setupLogger, _CoreContext_setupParsePhase, _CoreContext_setupGeneratePhase, _CoreContext_setupRenderPhase;
|
|
13
13
|
import { GenerateContext } from './GenerateContext.js';
|
|
14
14
|
import { RenderContext } from './RenderContext.js';
|
|
15
15
|
import { ParseContext } from './ParseContext.js';
|
|
16
16
|
import * as log from '../deps/jsr.io/@std/log/0.224.14/mod.js';
|
|
17
17
|
import { ResultsHandler } from './ResultsHandler.js';
|
|
18
|
-
import { StackTrail } from './StackTrail.js';
|
|
19
|
-
import { tracer } from '../helpers/tracer.js';
|
|
20
18
|
import { ResultsLog } from '../helpers/ResultsLog.js';
|
|
21
19
|
import { join } from '../deps/jsr.io/@std/path/1.1.2/join.js';
|
|
22
20
|
/**
|
|
@@ -103,8 +101,6 @@ export class CoreContext {
|
|
|
103
101
|
_CoreContext_phase.set(this, void 0);
|
|
104
102
|
/** Results log for tracking generation outcomes */
|
|
105
103
|
_CoreContext_results.set(this, void 0);
|
|
106
|
-
/** Stack trail for distributed tracing */
|
|
107
|
-
_CoreContext_stackTrail.set(this, void 0);
|
|
108
104
|
/** Whether to suppress console output */
|
|
109
105
|
Object.defineProperty(this, "silent", {
|
|
110
106
|
enumerable: true,
|
|
@@ -112,7 +108,6 @@ export class CoreContext {
|
|
|
112
108
|
writable: true,
|
|
113
109
|
value: void 0
|
|
114
110
|
});
|
|
115
|
-
__classPrivateFieldSet(this, _CoreContext_stackTrail, new StackTrail([spanId]), "f");
|
|
116
111
|
__classPrivateFieldSet(this, _CoreContext_results, new ResultsLog(), "f");
|
|
117
112
|
this.logger = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupLogger).call(this, { spanId, logsPath });
|
|
118
113
|
this.silent = silent;
|
|
@@ -149,9 +144,9 @@ export class CoreContext {
|
|
|
149
144
|
* }
|
|
150
145
|
* ```
|
|
151
146
|
*/
|
|
152
|
-
parse(documentObject) {
|
|
147
|
+
parse(documentObject, stackTrail) {
|
|
153
148
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, documentObject), "f");
|
|
154
|
-
const oasDocument = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
149
|
+
const oasDocument = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse(stackTrail);
|
|
155
150
|
return {
|
|
156
151
|
oasDocument
|
|
157
152
|
};
|
|
@@ -227,26 +222,21 @@ export class CoreContext {
|
|
|
227
222
|
*
|
|
228
223
|
* @throws Will throw an error if any phase of the pipeline fails
|
|
229
224
|
*/
|
|
230
|
-
toArtifacts({ documentObject, settings, toGeneratorConfigMap, prettier }) {
|
|
225
|
+
toArtifacts({ documentObject, settings, toGeneratorConfigMap, stackTrail, prettier }) {
|
|
231
226
|
try {
|
|
232
|
-
|
|
233
|
-
const oasDocument = this.trace('parse', () => {
|
|
227
|
+
const oasDocument = stackTrail.trace('parse', st => {
|
|
234
228
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, documentObject), "f");
|
|
235
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
229
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse(st);
|
|
236
230
|
});
|
|
237
|
-
|
|
238
|
-
console.time('GENERATE');
|
|
239
|
-
const { files, previews, mappings } = this.trace('generate', () => {
|
|
231
|
+
const { files, previews, mappings } = stackTrail.trace('generate', st => {
|
|
240
232
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
241
233
|
toGeneratorConfigMap,
|
|
242
234
|
oasDocument,
|
|
243
235
|
settings
|
|
244
236
|
}), "f");
|
|
245
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.toArtifacts();
|
|
237
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.toArtifacts(st);
|
|
246
238
|
});
|
|
247
|
-
|
|
248
|
-
console.time('RENDER');
|
|
249
|
-
const renderOutput = this.trace('render', () => {
|
|
239
|
+
const renderOutput = stackTrail.trace('render', st => {
|
|
250
240
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
251
241
|
files,
|
|
252
242
|
previews,
|
|
@@ -254,9 +244,8 @@ export class CoreContext {
|
|
|
254
244
|
prettier,
|
|
255
245
|
basePath: settings?.basePath
|
|
256
246
|
}), "f");
|
|
257
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.render();
|
|
247
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.render(st);
|
|
258
248
|
});
|
|
259
|
-
console.timeEnd('RENDER');
|
|
260
249
|
return {
|
|
261
250
|
...renderOutput,
|
|
262
251
|
results: __classPrivateFieldGet(this, _CoreContext_results, "f").toTree()
|
|
@@ -281,37 +270,6 @@ export class CoreContext {
|
|
|
281
270
|
});
|
|
282
271
|
}
|
|
283
272
|
}
|
|
284
|
-
/**
|
|
285
|
-
* Executes a function with distributed tracing and logging.
|
|
286
|
-
*
|
|
287
|
-
* This method wraps function execution with tracing capabilities, updating the
|
|
288
|
-
* stack trail for context tracking and logging execution details. It's used
|
|
289
|
-
* throughout the SKMTC pipeline to maintain execution context and debugging information.
|
|
290
|
-
*
|
|
291
|
-
* @template T - The return type of the traced function
|
|
292
|
-
* @param token - Single token or array of tokens to add to the trace stack
|
|
293
|
-
* @param fn - The function to execute within the trace context
|
|
294
|
-
* @returns The result of executing the traced function
|
|
295
|
-
*
|
|
296
|
-
* @example Single token tracing
|
|
297
|
-
* ```typescript
|
|
298
|
-
* const result = context.trace('parse-schema', () => {
|
|
299
|
-
* // Schema parsing logic here
|
|
300
|
-
* return parsedSchema;
|
|
301
|
-
* });
|
|
302
|
-
* ```
|
|
303
|
-
*
|
|
304
|
-
* @example Multiple token tracing (nested context)
|
|
305
|
-
* ```typescript
|
|
306
|
-
* const result = context.trace(['components', 'schemas', 'User'], () => {
|
|
307
|
-
* // Process User schema
|
|
308
|
-
* return processedUserSchema;
|
|
309
|
-
* });
|
|
310
|
-
* ```
|
|
311
|
-
*/
|
|
312
|
-
trace(token, fn) {
|
|
313
|
-
return tracer(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f"), token, fn);
|
|
314
|
-
}
|
|
315
273
|
/**
|
|
316
274
|
* Captures a result at the current execution position in the stack trail.
|
|
317
275
|
*
|
|
@@ -340,18 +298,18 @@ export class CoreContext {
|
|
|
340
298
|
* });
|
|
341
299
|
* ```
|
|
342
300
|
*/
|
|
343
|
-
captureCurrentResult(result) {
|
|
344
|
-
__classPrivateFieldGet(this, _CoreContext_results, "f").capture(
|
|
301
|
+
captureCurrentResult(result, stackTrail) {
|
|
302
|
+
__classPrivateFieldGet(this, _CoreContext_results, "f").capture(stackTrail.toString(), result);
|
|
345
303
|
}
|
|
346
304
|
}
|
|
347
|
-
_CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(),
|
|
305
|
+
_CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreContext_instances = new WeakSet(), _CoreContext_setupLogger = function _CoreContext_setupLogger({ spanId, logsPath }) {
|
|
348
306
|
const filename = join(logsPath ?? '', `${spanId}.txt`);
|
|
349
307
|
log.setup({
|
|
350
308
|
handlers: {
|
|
351
309
|
[`${spanId}-logs`]: new log.ConsoleHandler('DEBUG', {
|
|
352
310
|
formatter: logRecord => skmtcFormatter({
|
|
353
311
|
logRecord,
|
|
354
|
-
stackTrail:
|
|
312
|
+
stackTrail: 'SKIPPED'
|
|
355
313
|
}),
|
|
356
314
|
useColors: false
|
|
357
315
|
}),
|
|
@@ -362,7 +320,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
362
320
|
formatter: logRecord => {
|
|
363
321
|
return skmtcFormatter({
|
|
364
322
|
logRecord,
|
|
365
|
-
stackTrail:
|
|
323
|
+
stackTrail: 'SKIPPED'
|
|
366
324
|
});
|
|
367
325
|
}
|
|
368
326
|
})
|
|
@@ -384,7 +342,6 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
384
342
|
const parseContext = new ParseContext({
|
|
385
343
|
documentObject,
|
|
386
344
|
logger: this.logger,
|
|
387
|
-
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
388
345
|
silent: this.silent
|
|
389
346
|
});
|
|
390
347
|
return { type: 'parse', context: parseContext };
|
|
@@ -393,7 +350,6 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
393
350
|
oasDocument,
|
|
394
351
|
settings,
|
|
395
352
|
logger: this.logger,
|
|
396
|
-
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
397
353
|
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
398
354
|
toGeneratorConfigMap
|
|
399
355
|
});
|
|
@@ -406,7 +362,6 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
406
362
|
prettierConfig: prettier,
|
|
407
363
|
basePath,
|
|
408
364
|
logger: this.logger,
|
|
409
|
-
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
410
365
|
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
411
366
|
});
|
|
412
367
|
return { type: 'render', context: renderContext };
|
|
@@ -25,8 +25,7 @@ type ConstructorArgs = {
|
|
|
25
25
|
oasDocument: OasDocument;
|
|
26
26
|
settings: ClientSettings | undefined;
|
|
27
27
|
logger: log.Logger;
|
|
28
|
-
stackTrail: StackTrail;
|
|
29
|
-
captureCurrentResult: (result: ResultType) => void;
|
|
28
|
+
captureCurrentResult: (result: ResultType, stackTrail: StackTrail) => void;
|
|
30
29
|
toGeneratorConfigMap: <EnrichmentType = undefined>() => GeneratorsMapContainer<EnrichmentType>;
|
|
31
30
|
};
|
|
32
31
|
/**
|
|
@@ -166,11 +165,9 @@ export declare class GenerateContext implements GenerateContextType {
|
|
|
166
165
|
/** Logger instance for tracking generation progress */
|
|
167
166
|
logger: Logger;
|
|
168
167
|
/** Function to capture processing results at current stack position */
|
|
169
|
-
captureCurrentResult: (result: ResultType) => void;
|
|
168
|
+
captureCurrentResult: (result: ResultType, stackTrail: StackTrail) => void;
|
|
170
169
|
/** Function that returns the generator configuration map */
|
|
171
170
|
toGeneratorConfigMap: <EnrichmentType = undefined>() => GeneratorsMapContainer<EnrichmentType>;
|
|
172
|
-
/** Stack trail for tracking current processing context */
|
|
173
|
-
stackTrail: StackTrail;
|
|
174
171
|
/** Tracking model nesting depth to prevent infinite recursion */
|
|
175
172
|
modelDepth: Record<string, number>;
|
|
176
173
|
/**
|
|
@@ -178,19 +175,11 @@ export declare class GenerateContext implements GenerateContextType {
|
|
|
178
175
|
*
|
|
179
176
|
* @param args - Constructor arguments including document, settings, and handlers
|
|
180
177
|
*/
|
|
181
|
-
constructor({ oasDocument, settings, logger, captureCurrentResult,
|
|
178
|
+
constructor({ oasDocument, settings, logger, captureCurrentResult, toGeneratorConfigMap }: ConstructorArgs);
|
|
182
179
|
/**
|
|
183
180
|
* @internal
|
|
184
181
|
*/
|
|
185
|
-
toArtifacts(): GenerateResult;
|
|
186
|
-
/**
|
|
187
|
-
* Executes a function within a traced context for debugging and monitoring.
|
|
188
|
-
*
|
|
189
|
-
* @param token - Trace identifier or path segments
|
|
190
|
-
* @param fn - Function to execute within the trace context
|
|
191
|
-
* @returns The result of the traced function execution
|
|
192
|
-
*/
|
|
193
|
-
trace<T>(token: string, fn: () => T): T;
|
|
182
|
+
toArtifacts(stackTrail: StackTrail): GenerateResult;
|
|
194
183
|
/**
|
|
195
184
|
* Create and register a definition with the given `identifier` at `destinationPath`.
|
|
196
185
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AAEA,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;AAC/C,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EAEd,kBAAkB,EAClB,yBAAyB,EACzB,4BAA4B,EAC5B,2BAA2B,EAC3B,sBAAsB,EACtB,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,oBAAoB,CAAA;AAC3B,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,0BAA0B,CAAA;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,KAAK,GAAG,MAAM,yCAAyC,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBA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A0B,iBAAiB,KAAG,WAI1E,CAAA"}
|
|
@@ -16,7 +16,6 @@ import { Definition } from '../dsl/Definition.js';
|
|
|
16
16
|
import { OperationDriver } from '../dsl/operation/OperationDriver.js';
|
|
17
17
|
import { ModelDriver } from '../dsl/model/ModelDriver.js';
|
|
18
18
|
import { ContentSettings } from '../dsl/ContentSettings.js';
|
|
19
|
-
import { tracer } from '../helpers/tracer.js';
|
|
20
19
|
import { Inserted } from '../dsl/Inserted.js';
|
|
21
20
|
import { File } from '../dsl/File.js';
|
|
22
21
|
import { JsonFile } from '../dsl/JsonFile.js';
|
|
@@ -71,7 +70,7 @@ export class GenerateContext {
|
|
|
71
70
|
*
|
|
72
71
|
* @param args - Constructor arguments including document, settings, and handlers
|
|
73
72
|
*/
|
|
74
|
-
constructor({ oasDocument, settings, logger, captureCurrentResult,
|
|
73
|
+
constructor({ oasDocument, settings, logger, captureCurrentResult, toGeneratorConfigMap }) {
|
|
75
74
|
_GenerateContext_instances.add(this);
|
|
76
75
|
_GenerateContext_files.set(this, void 0);
|
|
77
76
|
_GenerateContext_previews.set(this, void 0);
|
|
@@ -111,13 +110,6 @@ export class GenerateContext {
|
|
|
111
110
|
writable: true,
|
|
112
111
|
value: void 0
|
|
113
112
|
});
|
|
114
|
-
/** Stack trail for tracking current processing context */
|
|
115
|
-
Object.defineProperty(this, "stackTrail", {
|
|
116
|
-
enumerable: true,
|
|
117
|
-
configurable: true,
|
|
118
|
-
writable: true,
|
|
119
|
-
value: void 0
|
|
120
|
-
});
|
|
121
113
|
/** Tracking model nesting depth to prevent infinite recursion */
|
|
122
114
|
Object.defineProperty(this, "modelDepth", {
|
|
123
115
|
enumerable: true,
|
|
@@ -131,7 +123,6 @@ export class GenerateContext {
|
|
|
131
123
|
__classPrivateFieldSet(this, _GenerateContext_mappings, {}, "f");
|
|
132
124
|
this.oasDocument = oasDocument;
|
|
133
125
|
this.settings = settings;
|
|
134
|
-
this.stackTrail = stackTrail;
|
|
135
126
|
this.captureCurrentResult = captureCurrentResult;
|
|
136
127
|
this.toGeneratorConfigMap = toGeneratorConfigMap;
|
|
137
128
|
this.modelDepth = {};
|
|
@@ -139,10 +130,10 @@ export class GenerateContext {
|
|
|
139
130
|
/**
|
|
140
131
|
* @internal
|
|
141
132
|
*/
|
|
142
|
-
toArtifacts() {
|
|
133
|
+
toArtifacts(stackTrail) {
|
|
143
134
|
const generators = Object.values(this.toGeneratorConfigMap());
|
|
144
135
|
generators.forEach(generatorConfig => {
|
|
145
|
-
|
|
136
|
+
stackTrail.trace(generatorConfig.id, st => {
|
|
146
137
|
if (this.settings?.skip?.includes(generatorConfig.id)) {
|
|
147
138
|
return;
|
|
148
139
|
}
|
|
@@ -150,8 +141,8 @@ export class GenerateContext {
|
|
|
150
141
|
return typeof skip === 'object' && Boolean(skip[generatorConfig.id]);
|
|
151
142
|
});
|
|
152
143
|
match(generatorConfig.type)
|
|
153
|
-
.with('operation', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, this.oasDocument, generatorConfig, toSkipPaths(skip, generatorConfig.id)))
|
|
154
|
-
.with('model', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, this.oasDocument, generatorConfig, toSkipModels(skip, generatorConfig.id)))
|
|
144
|
+
.with('operation', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, this.oasDocument, generatorConfig, toSkipPaths(skip, generatorConfig.id), st))
|
|
145
|
+
.with('model', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, this.oasDocument, generatorConfig, toSkipModels(skip, generatorConfig.id), st))
|
|
155
146
|
.otherwise(matched => {
|
|
156
147
|
throw new Error(`Invalid generator type: '${matched}' on ${generatorConfig.id}`);
|
|
157
148
|
});
|
|
@@ -163,16 +154,6 @@ export class GenerateContext {
|
|
|
163
154
|
mappings: __classPrivateFieldGet(this, _GenerateContext_mappings, "f")
|
|
164
155
|
};
|
|
165
156
|
}
|
|
166
|
-
/**
|
|
167
|
-
* Executes a function within a traced context for debugging and monitoring.
|
|
168
|
-
*
|
|
169
|
-
* @param token - Trace identifier or path segments
|
|
170
|
-
* @param fn - Function to execute within the trace context
|
|
171
|
-
* @returns The result of the traced function execution
|
|
172
|
-
*/
|
|
173
|
-
trace(token, fn) {
|
|
174
|
-
return tracer(this.stackTrail, token, fn);
|
|
175
|
-
}
|
|
176
157
|
/**
|
|
177
158
|
* Create and register a definition with the given `identifier` at `destinationPath`.
|
|
178
159
|
*
|
|
@@ -411,51 +392,51 @@ export class GenerateContext {
|
|
|
411
392
|
return file.definitions.get(name);
|
|
412
393
|
}
|
|
413
394
|
}
|
|
414
|
-
_GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_mappings = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator(oasDocument, generatorConfig, skip) {
|
|
395
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_mappings = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator(oasDocument, generatorConfig, skip, stackTrail) {
|
|
415
396
|
oasDocument.operations.reduce((acc, operation) => {
|
|
416
|
-
return
|
|
397
|
+
return stackTrail.trace(`${operation.path}:${operation.method}`, st => {
|
|
417
398
|
try {
|
|
418
399
|
if (typeof generatorConfig?.isSupported === 'function' &&
|
|
419
400
|
!generatorConfig.isSupported({ operation, context: this })) {
|
|
420
|
-
this.captureCurrentResult('notSupported');
|
|
401
|
+
this.captureCurrentResult('notSupported', st);
|
|
421
402
|
return acc;
|
|
422
403
|
}
|
|
423
404
|
if (skip?.[operation.path]?.includes(operation.method)) {
|
|
424
|
-
this.captureCurrentResult('skipped');
|
|
405
|
+
this.captureCurrentResult('skipped', st);
|
|
425
406
|
return acc;
|
|
426
407
|
}
|
|
427
408
|
const result = generatorConfig.transform({ context: this, operation, acc });
|
|
428
409
|
const source = toOperationSource({ operation, generatorId: generatorConfig.id });
|
|
429
410
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addPreview).call(this, source, generatorConfig.toPreviewModule?.({ context: this, operation }));
|
|
430
411
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addMapping).call(this, source, generatorConfig.toMappingModule?.({ context: this, operation }));
|
|
431
|
-
this.captureCurrentResult('success');
|
|
412
|
+
this.captureCurrentResult('success', st);
|
|
432
413
|
return result;
|
|
433
414
|
}
|
|
434
415
|
catch (error) {
|
|
435
416
|
this.logger.error(error);
|
|
436
|
-
this.captureCurrentResult('error');
|
|
417
|
+
this.captureCurrentResult('error', st);
|
|
437
418
|
}
|
|
438
419
|
});
|
|
439
420
|
}, undefined);
|
|
440
|
-
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator(oasDocument, generatorConfig, skip) {
|
|
421
|
+
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator(oasDocument, generatorConfig, skip, stackTrail) {
|
|
441
422
|
const refNames = oasDocument.components?.toSchemasRefNames() ?? [];
|
|
442
423
|
return refNames.reduce((acc, refName) => {
|
|
443
|
-
return
|
|
424
|
+
return stackTrail.trace(refName, st => {
|
|
444
425
|
try {
|
|
445
426
|
if (skip?.includes(refName)) {
|
|
446
|
-
this.captureCurrentResult('skipped');
|
|
427
|
+
this.captureCurrentResult('skipped', st);
|
|
447
428
|
return acc;
|
|
448
429
|
}
|
|
449
430
|
const result = generatorConfig.transform({ context: this, refName, acc });
|
|
450
431
|
const source = toModelSource({ refName, generatorId: generatorConfig.id });
|
|
451
432
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addPreview).call(this, source, generatorConfig.toPreviewModule?.({ context: this, refName }));
|
|
452
433
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addMapping).call(this, source, generatorConfig.toMappingModule?.({ context: this, refName }));
|
|
453
|
-
this.captureCurrentResult('success');
|
|
434
|
+
this.captureCurrentResult('success', st);
|
|
454
435
|
return result;
|
|
455
436
|
}
|
|
456
437
|
catch (error) {
|
|
457
438
|
this.logger.error(error);
|
|
458
|
-
this.captureCurrentResult('error');
|
|
439
|
+
this.captureCurrentResult('error', st);
|
|
459
440
|
}
|
|
460
441
|
});
|
|
461
442
|
}, undefined);
|
|
@@ -13,8 +13,6 @@ type ConstructorArgs = {
|
|
|
13
13
|
documentObject: OpenAPIV3.Document;
|
|
14
14
|
/** Logger instance for debug information */
|
|
15
15
|
logger: Logger;
|
|
16
|
-
/** Stack trail for distributed tracing */
|
|
17
|
-
stackTrail: StackTrail;
|
|
18
16
|
/** Whether to suppress console output */
|
|
19
17
|
silent: boolean;
|
|
20
18
|
};
|
|
@@ -86,8 +84,6 @@ export declare class ParseContext implements ParseContextType {
|
|
|
86
84
|
logger: Logger;
|
|
87
85
|
/** The parsed OAS document result */
|
|
88
86
|
oasDocument: OasDocument;
|
|
89
|
-
/** Stack trail for tracking current parsing context */
|
|
90
|
-
stackTrail: StackTrail;
|
|
91
87
|
/** Collection of parsing issues encountered during processing */
|
|
92
88
|
issues: ParseIssue[];
|
|
93
89
|
/** Whether to suppress console output during parsing */
|
|
@@ -97,13 +93,13 @@ export declare class ParseContext implements ParseContextType {
|
|
|
97
93
|
*
|
|
98
94
|
* @param args - Constructor arguments including document object, logger, and options
|
|
99
95
|
*/
|
|
100
|
-
constructor({ documentObject, logger,
|
|
96
|
+
constructor({ documentObject, logger, silent }: ConstructorArgs);
|
|
101
97
|
/**
|
|
102
98
|
* Parses the OpenAPI v3 document and returns the internal OAS document representation.
|
|
103
99
|
*
|
|
104
100
|
* @returns Parsed OAS document with all components and operations
|
|
105
101
|
*/
|
|
106
|
-
parse(): OasDocument;
|
|
102
|
+
parse(stackTrail: StackTrail): OasDocument;
|
|
107
103
|
/**
|
|
108
104
|
* Removes items from the parsed document that encountered errors during parsing.
|
|
109
105
|
*/
|
|
@@ -127,19 +123,19 @@ export declare class ParseContext implements ParseContextType {
|
|
|
127
123
|
*
|
|
128
124
|
* @param args - Arguments containing skipped fields and parent context
|
|
129
125
|
*/
|
|
130
|
-
logSkippedFields({ skipped, parent, parentType }: LogSkippedValuesArgs): void;
|
|
126
|
+
logSkippedFields({ skipped, stackTrail, parent, parentType }: LogSkippedValuesArgs): void;
|
|
131
127
|
/**
|
|
132
128
|
* Logs a parsing issue with associated key context.
|
|
133
129
|
*
|
|
134
130
|
* @param args - Issue arguments including key, parent object, and issue details
|
|
135
131
|
*/
|
|
136
|
-
logIssue({ key, parent, type, ...issue }: LogIssueArgs): void;
|
|
132
|
+
logIssue({ key, parent, type, stackTrail, ...issue }: LogIssueArgs): void;
|
|
137
133
|
/**
|
|
138
134
|
* Logs a parsing issue without specific key context.
|
|
139
135
|
*
|
|
140
136
|
* @param args - Issue arguments including parent object and issue details
|
|
141
137
|
*/
|
|
142
|
-
logIssueNoKey({ parent, type, ...issue }: LogIssueNoKeyArgs): void;
|
|
138
|
+
logIssueNoKey({ parent, type, stackTrail, ...issue }: LogIssueNoKeyArgs): void;
|
|
143
139
|
}
|
|
144
140
|
export {};
|
|
145
141
|
//# sourceMappingURL=ParseContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"ParseContext.d.ts","sourceRoot":"","sources":["../../src/context/ParseContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EA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BAAoB;IAwBlF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY;IAIlE;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB;CAqBxE"}
|
|
@@ -12,14 +12,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _ParseContext_refStackTrails, _ParseContext_refErrors;
|
|
13
13
|
import { toDocumentFieldsV3 } from '../oas/document/toDocumentFieldsV3.js';
|
|
14
14
|
import { OasDocument } from '../oas/document/Document.js';
|
|
15
|
-
import { tracer } from '../helpers/tracer.js';
|
|
16
15
|
export class ParseContext {
|
|
17
16
|
/**
|
|
18
17
|
* Creates a new ParseContext instance for the parsing phase.
|
|
19
18
|
*
|
|
20
19
|
* @param args - Constructor arguments including document object, logger, and options
|
|
21
20
|
*/
|
|
22
|
-
constructor({ documentObject, logger,
|
|
21
|
+
constructor({ documentObject, logger, silent = true }) {
|
|
23
22
|
/** The original OpenAPI v3 document being parsed */
|
|
24
23
|
Object.defineProperty(this, "documentObject", {
|
|
25
24
|
enumerable: true,
|
|
@@ -41,13 +40,6 @@ export class ParseContext {
|
|
|
41
40
|
writable: true,
|
|
42
41
|
value: void 0
|
|
43
42
|
});
|
|
44
|
-
/** Stack trail for tracking current parsing context */
|
|
45
|
-
Object.defineProperty(this, "stackTrail", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: void 0
|
|
50
|
-
});
|
|
51
43
|
/** Collection of parsing issues encountered during processing */
|
|
52
44
|
Object.defineProperty(this, "issues", {
|
|
53
45
|
enumerable: true,
|
|
@@ -66,7 +58,6 @@ export class ParseContext {
|
|
|
66
58
|
_ParseContext_refErrors.set(this, void 0);
|
|
67
59
|
this.documentObject = documentObject;
|
|
68
60
|
this.logger = logger;
|
|
69
|
-
this.stackTrail = stackTrail;
|
|
70
61
|
this.oasDocument = new OasDocument();
|
|
71
62
|
this.silent = silent;
|
|
72
63
|
this.issues = [];
|
|
@@ -78,9 +69,10 @@ export class ParseContext {
|
|
|
78
69
|
*
|
|
79
70
|
* @returns Parsed OAS document with all components and operations
|
|
80
71
|
*/
|
|
81
|
-
parse() {
|
|
72
|
+
parse(stackTrail) {
|
|
82
73
|
this.oasDocument.fields = toDocumentFieldsV3({
|
|
83
74
|
documentObject: this.documentObject,
|
|
75
|
+
stackTrail: stackTrail,
|
|
84
76
|
context: this
|
|
85
77
|
});
|
|
86
78
|
this.removeErroredItems();
|
|
@@ -134,10 +126,11 @@ export class ParseContext {
|
|
|
134
126
|
*
|
|
135
127
|
* @param args - Arguments containing skipped fields and parent context
|
|
136
128
|
*/
|
|
137
|
-
logSkippedFields({ skipped, parent, parentType }) {
|
|
129
|
+
logSkippedFields({ skipped, stackTrail, parent, parentType }) {
|
|
138
130
|
Object.keys(skipped).forEach(key => {
|
|
139
131
|
this.logIssue({
|
|
140
132
|
key,
|
|
133
|
+
stackTrail,
|
|
141
134
|
parent,
|
|
142
135
|
level: 'warning',
|
|
143
136
|
message: `Unexpected property '${key}' in '${parentType}'`,
|
|
@@ -160,28 +153,28 @@ export class ParseContext {
|
|
|
160
153
|
*
|
|
161
154
|
* @param args - Issue arguments including key, parent object, and issue details
|
|
162
155
|
*/
|
|
163
|
-
logIssue({ key, parent, type, ...issue }) {
|
|
164
|
-
|
|
156
|
+
logIssue({ key, parent, type, stackTrail, ...issue }) {
|
|
157
|
+
stackTrail.trace(key, st => this.logIssueNoKey({ parent, type, stackTrail: st, ...issue }));
|
|
165
158
|
}
|
|
166
159
|
/**
|
|
167
160
|
* Logs a parsing issue without specific key context.
|
|
168
161
|
*
|
|
169
162
|
* @param args - Issue arguments including parent object and issue details
|
|
170
163
|
*/
|
|
171
|
-
logIssueNoKey({ parent, type, ...issue }) {
|
|
164
|
+
logIssueNoKey({ parent, type, stackTrail, ...issue }) {
|
|
172
165
|
if (issue.level === 'error') {
|
|
173
|
-
this.registerRefError(issue.error,
|
|
166
|
+
this.registerRefError(issue.error, stackTrail.toStackRef());
|
|
174
167
|
}
|
|
175
168
|
this.issues.push({
|
|
176
169
|
...issue,
|
|
177
|
-
location:
|
|
170
|
+
location: stackTrail.toString(),
|
|
178
171
|
parent,
|
|
179
172
|
type
|
|
180
173
|
});
|
|
181
174
|
if (!this.silent) {
|
|
182
175
|
this.logger.warn({
|
|
183
176
|
...issue,
|
|
184
|
-
location:
|
|
177
|
+
location: stackTrail.toString(),
|
|
185
178
|
parent: JSON.stringify(parent),
|
|
186
179
|
type
|
|
187
180
|
});
|