@skmtc/core 0.0.939 → 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
|
@@ -43,7 +43,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
43
43
|
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");
|
|
44
44
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
45
45
|
};
|
|
46
|
-
var _CoreContext_instances, _CoreContext_phase, _CoreContext_results,
|
|
46
|
+
var _CoreContext_instances, _CoreContext_phase, _CoreContext_results, _CoreContext_setupLogger, _CoreContext_setupParsePhase, _CoreContext_setupGeneratePhase, _CoreContext_setupRenderPhase;
|
|
47
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
48
|
exports.CoreContext = void 0;
|
|
49
49
|
exports.skmtcFormatter = skmtcFormatter;
|
|
@@ -52,8 +52,6 @@ const RenderContext_js_1 = require("./RenderContext.js");
|
|
|
52
52
|
const ParseContext_js_1 = require("./ParseContext.js");
|
|
53
53
|
const log = __importStar(require("../deps/jsr.io/@std/log/0.224.14/mod.js"));
|
|
54
54
|
const ResultsHandler_js_1 = require("./ResultsHandler.js");
|
|
55
|
-
const StackTrail_js_1 = require("./StackTrail.js");
|
|
56
|
-
const tracer_js_1 = require("../helpers/tracer.js");
|
|
57
55
|
const ResultsLog_js_1 = require("../helpers/ResultsLog.js");
|
|
58
56
|
const join_js_1 = require("../deps/jsr.io/@std/path/1.1.2/join.js");
|
|
59
57
|
/**
|
|
@@ -140,8 +138,6 @@ class CoreContext {
|
|
|
140
138
|
_CoreContext_phase.set(this, void 0);
|
|
141
139
|
/** Results log for tracking generation outcomes */
|
|
142
140
|
_CoreContext_results.set(this, void 0);
|
|
143
|
-
/** Stack trail for distributed tracing */
|
|
144
|
-
_CoreContext_stackTrail.set(this, void 0);
|
|
145
141
|
/** Whether to suppress console output */
|
|
146
142
|
Object.defineProperty(this, "silent", {
|
|
147
143
|
enumerable: true,
|
|
@@ -149,7 +145,6 @@ class CoreContext {
|
|
|
149
145
|
writable: true,
|
|
150
146
|
value: void 0
|
|
151
147
|
});
|
|
152
|
-
__classPrivateFieldSet(this, _CoreContext_stackTrail, new StackTrail_js_1.StackTrail([spanId]), "f");
|
|
153
148
|
__classPrivateFieldSet(this, _CoreContext_results, new ResultsLog_js_1.ResultsLog(), "f");
|
|
154
149
|
this.logger = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupLogger).call(this, { spanId, logsPath });
|
|
155
150
|
this.silent = silent;
|
|
@@ -186,9 +181,9 @@ class CoreContext {
|
|
|
186
181
|
* }
|
|
187
182
|
* ```
|
|
188
183
|
*/
|
|
189
|
-
parse(documentObject) {
|
|
184
|
+
parse(documentObject, stackTrail) {
|
|
190
185
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, documentObject), "f");
|
|
191
|
-
const oasDocument = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
186
|
+
const oasDocument = __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse(stackTrail);
|
|
192
187
|
return {
|
|
193
188
|
oasDocument
|
|
194
189
|
};
|
|
@@ -264,26 +259,21 @@ class CoreContext {
|
|
|
264
259
|
*
|
|
265
260
|
* @throws Will throw an error if any phase of the pipeline fails
|
|
266
261
|
*/
|
|
267
|
-
toArtifacts({ documentObject, settings, toGeneratorConfigMap, prettier }) {
|
|
262
|
+
toArtifacts({ documentObject, settings, toGeneratorConfigMap, stackTrail, prettier }) {
|
|
268
263
|
try {
|
|
269
|
-
|
|
270
|
-
const oasDocument = this.trace('parse', () => {
|
|
264
|
+
const oasDocument = stackTrail.trace('parse', st => {
|
|
271
265
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, documentObject), "f");
|
|
272
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
266
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse(st);
|
|
273
267
|
});
|
|
274
|
-
|
|
275
|
-
console.time('GENERATE');
|
|
276
|
-
const { files, previews, mappings } = this.trace('generate', () => {
|
|
268
|
+
const { files, previews, mappings } = stackTrail.trace('generate', st => {
|
|
277
269
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
278
270
|
toGeneratorConfigMap,
|
|
279
271
|
oasDocument,
|
|
280
272
|
settings
|
|
281
273
|
}), "f");
|
|
282
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.toArtifacts();
|
|
274
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.toArtifacts(st);
|
|
283
275
|
});
|
|
284
|
-
|
|
285
|
-
console.time('RENDER');
|
|
286
|
-
const renderOutput = this.trace('render', () => {
|
|
276
|
+
const renderOutput = stackTrail.trace('render', st => {
|
|
287
277
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
288
278
|
files,
|
|
289
279
|
previews,
|
|
@@ -291,9 +281,8 @@ class CoreContext {
|
|
|
291
281
|
prettier,
|
|
292
282
|
basePath: settings?.basePath
|
|
293
283
|
}), "f");
|
|
294
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.render();
|
|
284
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.render(st);
|
|
295
285
|
});
|
|
296
|
-
console.timeEnd('RENDER');
|
|
297
286
|
return {
|
|
298
287
|
...renderOutput,
|
|
299
288
|
results: __classPrivateFieldGet(this, _CoreContext_results, "f").toTree()
|
|
@@ -318,37 +307,6 @@ class CoreContext {
|
|
|
318
307
|
});
|
|
319
308
|
}
|
|
320
309
|
}
|
|
321
|
-
/**
|
|
322
|
-
* Executes a function with distributed tracing and logging.
|
|
323
|
-
*
|
|
324
|
-
* This method wraps function execution with tracing capabilities, updating the
|
|
325
|
-
* stack trail for context tracking and logging execution details. It's used
|
|
326
|
-
* throughout the SKMTC pipeline to maintain execution context and debugging information.
|
|
327
|
-
*
|
|
328
|
-
* @template T - The return type of the traced function
|
|
329
|
-
* @param token - Single token or array of tokens to add to the trace stack
|
|
330
|
-
* @param fn - The function to execute within the trace context
|
|
331
|
-
* @returns The result of executing the traced function
|
|
332
|
-
*
|
|
333
|
-
* @example Single token tracing
|
|
334
|
-
* ```typescript
|
|
335
|
-
* const result = context.trace('parse-schema', () => {
|
|
336
|
-
* // Schema parsing logic here
|
|
337
|
-
* return parsedSchema;
|
|
338
|
-
* });
|
|
339
|
-
* ```
|
|
340
|
-
*
|
|
341
|
-
* @example Multiple token tracing (nested context)
|
|
342
|
-
* ```typescript
|
|
343
|
-
* const result = context.trace(['components', 'schemas', 'User'], () => {
|
|
344
|
-
* // Process User schema
|
|
345
|
-
* return processedUserSchema;
|
|
346
|
-
* });
|
|
347
|
-
* ```
|
|
348
|
-
*/
|
|
349
|
-
trace(token, fn) {
|
|
350
|
-
return (0, tracer_js_1.tracer)(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f"), token, fn);
|
|
351
|
-
}
|
|
352
310
|
/**
|
|
353
311
|
* Captures a result at the current execution position in the stack trail.
|
|
354
312
|
*
|
|
@@ -377,19 +335,19 @@ class CoreContext {
|
|
|
377
335
|
* });
|
|
378
336
|
* ```
|
|
379
337
|
*/
|
|
380
|
-
captureCurrentResult(result) {
|
|
381
|
-
__classPrivateFieldGet(this, _CoreContext_results, "f").capture(
|
|
338
|
+
captureCurrentResult(result, stackTrail) {
|
|
339
|
+
__classPrivateFieldGet(this, _CoreContext_results, "f").capture(stackTrail.toString(), result);
|
|
382
340
|
}
|
|
383
341
|
}
|
|
384
342
|
exports.CoreContext = CoreContext;
|
|
385
|
-
_CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(),
|
|
343
|
+
_CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreContext_instances = new WeakSet(), _CoreContext_setupLogger = function _CoreContext_setupLogger({ spanId, logsPath }) {
|
|
386
344
|
const filename = (0, join_js_1.join)(logsPath ?? '', `${spanId}.txt`);
|
|
387
345
|
log.setup({
|
|
388
346
|
handlers: {
|
|
389
347
|
[`${spanId}-logs`]: new log.ConsoleHandler('DEBUG', {
|
|
390
348
|
formatter: logRecord => skmtcFormatter({
|
|
391
349
|
logRecord,
|
|
392
|
-
stackTrail:
|
|
350
|
+
stackTrail: 'SKIPPED'
|
|
393
351
|
}),
|
|
394
352
|
useColors: false
|
|
395
353
|
}),
|
|
@@ -400,7 +358,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
400
358
|
formatter: logRecord => {
|
|
401
359
|
return skmtcFormatter({
|
|
402
360
|
logRecord,
|
|
403
|
-
stackTrail:
|
|
361
|
+
stackTrail: 'SKIPPED'
|
|
404
362
|
});
|
|
405
363
|
}
|
|
406
364
|
})
|
|
@@ -422,7 +380,6 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
422
380
|
const parseContext = new ParseContext_js_1.ParseContext({
|
|
423
381
|
documentObject,
|
|
424
382
|
logger: this.logger,
|
|
425
|
-
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
426
383
|
silent: this.silent
|
|
427
384
|
});
|
|
428
385
|
return { type: 'parse', context: parseContext };
|
|
@@ -431,7 +388,6 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
431
388
|
oasDocument,
|
|
432
389
|
settings,
|
|
433
390
|
logger: this.logger,
|
|
434
|
-
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
435
391
|
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
436
392
|
toGeneratorConfigMap
|
|
437
393
|
});
|
|
@@ -444,7 +400,6 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
444
400
|
prettierConfig: prettier,
|
|
445
401
|
basePath,
|
|
446
402
|
logger: this.logger,
|
|
447
|
-
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
448
403
|
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
449
404
|
});
|
|
450
405
|
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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G,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"}
|
|
@@ -22,7 +22,6 @@ const Definition_js_1 = require("../dsl/Definition.js");
|
|
|
22
22
|
const OperationDriver_js_1 = require("../dsl/operation/OperationDriver.js");
|
|
23
23
|
const ModelDriver_js_1 = require("../dsl/model/ModelDriver.js");
|
|
24
24
|
const ContentSettings_js_1 = require("../dsl/ContentSettings.js");
|
|
25
|
-
const tracer_js_1 = require("../helpers/tracer.js");
|
|
26
25
|
const Inserted_js_1 = require("../dsl/Inserted.js");
|
|
27
26
|
const File_js_1 = require("../dsl/File.js");
|
|
28
27
|
const JsonFile_js_1 = require("../dsl/JsonFile.js");
|
|
@@ -77,7 +76,7 @@ class GenerateContext {
|
|
|
77
76
|
*
|
|
78
77
|
* @param args - Constructor arguments including document, settings, and handlers
|
|
79
78
|
*/
|
|
80
|
-
constructor({ oasDocument, settings, logger, captureCurrentResult,
|
|
79
|
+
constructor({ oasDocument, settings, logger, captureCurrentResult, toGeneratorConfigMap }) {
|
|
81
80
|
_GenerateContext_instances.add(this);
|
|
82
81
|
_GenerateContext_files.set(this, void 0);
|
|
83
82
|
_GenerateContext_previews.set(this, void 0);
|
|
@@ -117,13 +116,6 @@ class GenerateContext {
|
|
|
117
116
|
writable: true,
|
|
118
117
|
value: void 0
|
|
119
118
|
});
|
|
120
|
-
/** Stack trail for tracking current processing context */
|
|
121
|
-
Object.defineProperty(this, "stackTrail", {
|
|
122
|
-
enumerable: true,
|
|
123
|
-
configurable: true,
|
|
124
|
-
writable: true,
|
|
125
|
-
value: void 0
|
|
126
|
-
});
|
|
127
119
|
/** Tracking model nesting depth to prevent infinite recursion */
|
|
128
120
|
Object.defineProperty(this, "modelDepth", {
|
|
129
121
|
enumerable: true,
|
|
@@ -137,7 +129,6 @@ class GenerateContext {
|
|
|
137
129
|
__classPrivateFieldSet(this, _GenerateContext_mappings, {}, "f");
|
|
138
130
|
this.oasDocument = oasDocument;
|
|
139
131
|
this.settings = settings;
|
|
140
|
-
this.stackTrail = stackTrail;
|
|
141
132
|
this.captureCurrentResult = captureCurrentResult;
|
|
142
133
|
this.toGeneratorConfigMap = toGeneratorConfigMap;
|
|
143
134
|
this.modelDepth = {};
|
|
@@ -145,10 +136,10 @@ class GenerateContext {
|
|
|
145
136
|
/**
|
|
146
137
|
* @internal
|
|
147
138
|
*/
|
|
148
|
-
toArtifacts() {
|
|
139
|
+
toArtifacts(stackTrail) {
|
|
149
140
|
const generators = Object.values(this.toGeneratorConfigMap());
|
|
150
141
|
generators.forEach(generatorConfig => {
|
|
151
|
-
|
|
142
|
+
stackTrail.trace(generatorConfig.id, st => {
|
|
152
143
|
if (this.settings?.skip?.includes(generatorConfig.id)) {
|
|
153
144
|
return;
|
|
154
145
|
}
|
|
@@ -156,8 +147,8 @@ class GenerateContext {
|
|
|
156
147
|
return typeof skip === 'object' && Boolean(skip[generatorConfig.id]);
|
|
157
148
|
});
|
|
158
149
|
(0, ts_pattern_1.match)(generatorConfig.type)
|
|
159
|
-
.with('operation', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, this.oasDocument, generatorConfig, toSkipPaths(skip, generatorConfig.id)))
|
|
160
|
-
.with('model', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, this.oasDocument, generatorConfig, toSkipModels(skip, generatorConfig.id)))
|
|
150
|
+
.with('operation', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, this.oasDocument, generatorConfig, toSkipPaths(skip, generatorConfig.id), st))
|
|
151
|
+
.with('model', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, this.oasDocument, generatorConfig, toSkipModels(skip, generatorConfig.id), st))
|
|
161
152
|
.otherwise(matched => {
|
|
162
153
|
throw new Error(`Invalid generator type: '${matched}' on ${generatorConfig.id}`);
|
|
163
154
|
});
|
|
@@ -169,16 +160,6 @@ class GenerateContext {
|
|
|
169
160
|
mappings: __classPrivateFieldGet(this, _GenerateContext_mappings, "f")
|
|
170
161
|
};
|
|
171
162
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Executes a function within a traced context for debugging and monitoring.
|
|
174
|
-
*
|
|
175
|
-
* @param token - Trace identifier or path segments
|
|
176
|
-
* @param fn - Function to execute within the trace context
|
|
177
|
-
* @returns The result of the traced function execution
|
|
178
|
-
*/
|
|
179
|
-
trace(token, fn) {
|
|
180
|
-
return (0, tracer_js_1.tracer)(this.stackTrail, token, fn);
|
|
181
|
-
}
|
|
182
163
|
/**
|
|
183
164
|
* Create and register a definition with the given `identifier` at `destinationPath`.
|
|
184
165
|
*
|
|
@@ -418,51 +399,51 @@ class GenerateContext {
|
|
|
418
399
|
}
|
|
419
400
|
}
|
|
420
401
|
exports.GenerateContext = GenerateContext;
|
|
421
|
-
_GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_mappings = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator(oasDocument, generatorConfig, skip) {
|
|
402
|
+
_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) {
|
|
422
403
|
oasDocument.operations.reduce((acc, operation) => {
|
|
423
|
-
return
|
|
404
|
+
return stackTrail.trace(`${operation.path}:${operation.method}`, st => {
|
|
424
405
|
try {
|
|
425
406
|
if (typeof generatorConfig?.isSupported === 'function' &&
|
|
426
407
|
!generatorConfig.isSupported({ operation, context: this })) {
|
|
427
|
-
this.captureCurrentResult('notSupported');
|
|
408
|
+
this.captureCurrentResult('notSupported', st);
|
|
428
409
|
return acc;
|
|
429
410
|
}
|
|
430
411
|
if (skip?.[operation.path]?.includes(operation.method)) {
|
|
431
|
-
this.captureCurrentResult('skipped');
|
|
412
|
+
this.captureCurrentResult('skipped', st);
|
|
432
413
|
return acc;
|
|
433
414
|
}
|
|
434
415
|
const result = generatorConfig.transform({ context: this, operation, acc });
|
|
435
416
|
const source = (0, exports.toOperationSource)({ operation, generatorId: generatorConfig.id });
|
|
436
417
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addPreview).call(this, source, generatorConfig.toPreviewModule?.({ context: this, operation }));
|
|
437
418
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addMapping).call(this, source, generatorConfig.toMappingModule?.({ context: this, operation }));
|
|
438
|
-
this.captureCurrentResult('success');
|
|
419
|
+
this.captureCurrentResult('success', st);
|
|
439
420
|
return result;
|
|
440
421
|
}
|
|
441
422
|
catch (error) {
|
|
442
423
|
this.logger.error(error);
|
|
443
|
-
this.captureCurrentResult('error');
|
|
424
|
+
this.captureCurrentResult('error', st);
|
|
444
425
|
}
|
|
445
426
|
});
|
|
446
427
|
}, undefined);
|
|
447
|
-
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator(oasDocument, generatorConfig, skip) {
|
|
428
|
+
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator(oasDocument, generatorConfig, skip, stackTrail) {
|
|
448
429
|
const refNames = oasDocument.components?.toSchemasRefNames() ?? [];
|
|
449
430
|
return refNames.reduce((acc, refName) => {
|
|
450
|
-
return
|
|
431
|
+
return stackTrail.trace(refName, st => {
|
|
451
432
|
try {
|
|
452
433
|
if (skip?.includes(refName)) {
|
|
453
|
-
this.captureCurrentResult('skipped');
|
|
434
|
+
this.captureCurrentResult('skipped', st);
|
|
454
435
|
return acc;
|
|
455
436
|
}
|
|
456
437
|
const result = generatorConfig.transform({ context: this, refName, acc });
|
|
457
438
|
const source = (0, exports.toModelSource)({ refName, generatorId: generatorConfig.id });
|
|
458
439
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addPreview).call(this, source, generatorConfig.toPreviewModule?.({ context: this, refName }));
|
|
459
440
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_addMapping).call(this, source, generatorConfig.toMappingModule?.({ context: this, refName }));
|
|
460
|
-
this.captureCurrentResult('success');
|
|
441
|
+
this.captureCurrentResult('success', st);
|
|
461
442
|
return result;
|
|
462
443
|
}
|
|
463
444
|
catch (error) {
|
|
464
445
|
this.logger.error(error);
|
|
465
|
-
this.captureCurrentResult('error');
|
|
446
|
+
this.captureCurrentResult('error', st);
|
|
466
447
|
}
|
|
467
448
|
});
|
|
468
449
|
}, 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,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;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAA;AACjC,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,iBAAiB,CAAA;AAExB;;GAEG;AACH,KAAK,eAAe,GAAG;IACrB,uCAAuC;IACvC,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;IACd,yCAAyC;IACzC,MA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gB;;IACnD,oDAAoD;IACpD,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,qCAAqC;IACrC,WAAW,EAAE,WAAW,CAAA;IAExB,iEAAiE;IACjE,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,wDAAwD;IACxD,MAAM,EAAE,OAAO,CAAA;IAGf;;;;OAIG;gBACS,EAAE,cAAc,EAAE,MAAM,EAAE,MAAa,EAAE,EAAE,eAAe;IAUtE;;;;OAIG;IACH,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW;IAY1C;;OAEG;IACH,kBAAkB;IAoBlB;;;;;OAKG;IACH,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM;IAMhD;;;;;OAKG;IACH,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS;IAQvD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,oBAAoB;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"}
|
|
@@ -15,14 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.ParseContext = void 0;
|
|
16
16
|
const toDocumentFieldsV3_js_1 = require("../oas/document/toDocumentFieldsV3.js");
|
|
17
17
|
const Document_js_1 = require("../oas/document/Document.js");
|
|
18
|
-
const tracer_js_1 = require("../helpers/tracer.js");
|
|
19
18
|
class ParseContext {
|
|
20
19
|
/**
|
|
21
20
|
* Creates a new ParseContext instance for the parsing phase.
|
|
22
21
|
*
|
|
23
22
|
* @param args - Constructor arguments including document object, logger, and options
|
|
24
23
|
*/
|
|
25
|
-
constructor({ documentObject, logger,
|
|
24
|
+
constructor({ documentObject, logger, silent = true }) {
|
|
26
25
|
/** The original OpenAPI v3 document being parsed */
|
|
27
26
|
Object.defineProperty(this, "documentObject", {
|
|
28
27
|
enumerable: true,
|
|
@@ -44,13 +43,6 @@ class ParseContext {
|
|
|
44
43
|
writable: true,
|
|
45
44
|
value: void 0
|
|
46
45
|
});
|
|
47
|
-
/** Stack trail for tracking current parsing context */
|
|
48
|
-
Object.defineProperty(this, "stackTrail", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: void 0
|
|
53
|
-
});
|
|
54
46
|
/** Collection of parsing issues encountered during processing */
|
|
55
47
|
Object.defineProperty(this, "issues", {
|
|
56
48
|
enumerable: true,
|
|
@@ -69,7 +61,6 @@ class ParseContext {
|
|
|
69
61
|
_ParseContext_refErrors.set(this, void 0);
|
|
70
62
|
this.documentObject = documentObject;
|
|
71
63
|
this.logger = logger;
|
|
72
|
-
this.stackTrail = stackTrail;
|
|
73
64
|
this.oasDocument = new Document_js_1.OasDocument();
|
|
74
65
|
this.silent = silent;
|
|
75
66
|
this.issues = [];
|
|
@@ -81,9 +72,10 @@ class ParseContext {
|
|
|
81
72
|
*
|
|
82
73
|
* @returns Parsed OAS document with all components and operations
|
|
83
74
|
*/
|
|
84
|
-
parse() {
|
|
75
|
+
parse(stackTrail) {
|
|
85
76
|
this.oasDocument.fields = (0, toDocumentFieldsV3_js_1.toDocumentFieldsV3)({
|
|
86
77
|
documentObject: this.documentObject,
|
|
78
|
+
stackTrail: stackTrail,
|
|
87
79
|
context: this
|
|
88
80
|
});
|
|
89
81
|
this.removeErroredItems();
|
|
@@ -137,10 +129,11 @@ class ParseContext {
|
|
|
137
129
|
*
|
|
138
130
|
* @param args - Arguments containing skipped fields and parent context
|
|
139
131
|
*/
|
|
140
|
-
logSkippedFields({ skipped, parent, parentType }) {
|
|
132
|
+
logSkippedFields({ skipped, stackTrail, parent, parentType }) {
|
|
141
133
|
Object.keys(skipped).forEach(key => {
|
|
142
134
|
this.logIssue({
|
|
143
135
|
key,
|
|
136
|
+
stackTrail,
|
|
144
137
|
parent,
|
|
145
138
|
level: 'warning',
|
|
146
139
|
message: `Unexpected property '${key}' in '${parentType}'`,
|
|
@@ -163,28 +156,28 @@ class ParseContext {
|
|
|
163
156
|
*
|
|
164
157
|
* @param args - Issue arguments including key, parent object, and issue details
|
|
165
158
|
*/
|
|
166
|
-
logIssue({ key, parent, type, ...issue }) {
|
|
167
|
-
|
|
159
|
+
logIssue({ key, parent, type, stackTrail, ...issue }) {
|
|
160
|
+
stackTrail.trace(key, st => this.logIssueNoKey({ parent, type, stackTrail: st, ...issue }));
|
|
168
161
|
}
|
|
169
162
|
/**
|
|
170
163
|
* Logs a parsing issue without specific key context.
|
|
171
164
|
*
|
|
172
165
|
* @param args - Issue arguments including parent object and issue details
|
|
173
166
|
*/
|
|
174
|
-
logIssueNoKey({ parent, type, ...issue }) {
|
|
167
|
+
logIssueNoKey({ parent, type, stackTrail, ...issue }) {
|
|
175
168
|
if (issue.level === 'error') {
|
|
176
|
-
this.registerRefError(issue.error,
|
|
169
|
+
this.registerRefError(issue.error, stackTrail.toStackRef());
|
|
177
170
|
}
|
|
178
171
|
this.issues.push({
|
|
179
172
|
...issue,
|
|
180
|
-
location:
|
|
173
|
+
location: stackTrail.toString(),
|
|
181
174
|
parent,
|
|
182
175
|
type
|
|
183
176
|
});
|
|
184
177
|
if (!this.silent) {
|
|
185
178
|
this.logger.warn({
|
|
186
179
|
...issue,
|
|
187
|
-
location:
|
|
180
|
+
location: stackTrail.toString(),
|
|
188
181
|
parent: JSON.stringify(parent),
|
|
189
182
|
type
|
|
190
183
|
});
|