@skmtc/core 0.0.314 → 0.0.317
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 +0 -2
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +9 -16
- package/esm/context/GenerateContext.d.ts +3 -5
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +22 -32
- package/esm/context/ParseContext.d.ts +4 -5
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +15 -17
- package/esm/context/RenderContext.d.ts +10 -5
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +46 -30
- package/esm/helpers/tracer.d.ts +2 -6
- package/esm/helpers/tracer.d.ts.map +1 -1
- package/esm/helpers/tracer.js +3 -3
- package/esm/oas/array/toArray.d.ts.map +1 -1
- package/esm/oas/array/toArray.js +1 -2
- package/esm/oas/components/toComponentsV3.d.ts.map +1 -1
- package/esm/oas/components/toComponentsV3.js +5 -6
- package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/esm/oas/document/toDocumentFieldsV3.js +4 -5
- package/esm/oas/example/toExamplesV3.d.ts.map +1 -1
- package/esm/oas/example/toExamplesV3.js +3 -4
- package/esm/oas/header/toHeadersV3.d.ts.map +1 -1
- package/esm/oas/header/toHeadersV3.js +3 -4
- package/esm/oas/intersection/toIntersection.d.ts.map +1 -1
- package/esm/oas/intersection/toIntersection.js +2 -3
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.js +3 -4
- package/esm/oas/object/toObject.d.ts.map +1 -1
- package/esm/oas/object/toObject.js +2 -3
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +5 -6
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +7 -8
- package/esm/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/esm/oas/pathItem/toPathItemV3.js +1 -2
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/esm/oas/requestBody/toRequestBodiesV3.js +2 -3
- package/esm/oas/response/toResponseV3.d.ts.map +1 -1
- package/esm/oas/response/toResponseV3.js +3 -4
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +3 -4
- package/esm/oas/union/toUnion.d.ts.map +1 -1
- package/esm/oas/union/toUnion.js +2 -3
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +0 -2
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +9 -16
- package/script/context/GenerateContext.d.ts +3 -5
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +22 -32
- package/script/context/ParseContext.d.ts +4 -5
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +15 -17
- package/script/context/RenderContext.d.ts +10 -5
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +46 -30
- package/script/helpers/tracer.d.ts +2 -6
- package/script/helpers/tracer.d.ts.map +1 -1
- package/script/helpers/tracer.js +3 -3
- package/script/oas/array/toArray.d.ts.map +1 -1
- package/script/oas/array/toArray.js +1 -2
- package/script/oas/components/toComponentsV3.d.ts.map +1 -1
- package/script/oas/components/toComponentsV3.js +5 -6
- package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -1
- package/script/oas/document/toDocumentFieldsV3.js +4 -5
- package/script/oas/example/toExamplesV3.d.ts.map +1 -1
- package/script/oas/example/toExamplesV3.js +3 -4
- package/script/oas/header/toHeadersV3.d.ts.map +1 -1
- package/script/oas/header/toHeadersV3.js +3 -4
- package/script/oas/intersection/toIntersection.d.ts.map +1 -1
- package/script/oas/intersection/toIntersection.js +2 -3
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/script/oas/mediaType/toMediaTypeItemV3.js +3 -4
- package/script/oas/object/toObject.d.ts.map +1 -1
- package/script/oas/object/toObject.js +2 -3
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +5 -6
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +7 -8
- package/script/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/script/oas/pathItem/toPathItemV3.js +1 -2
- package/script/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/script/oas/requestBody/toRequestBodiesV3.js +2 -3
- package/script/oas/response/toResponseV3.d.ts.map +1 -1
- package/script/oas/response/toResponseV3.js +3 -4
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +3 -4
- package/script/oas/union/toUnion.d.ts.map +1 -1
- package/script/oas/union/toUnion.js +2 -3
|
@@ -20,8 +20,6 @@ export declare class CoreContext {
|
|
|
20
20
|
logger: log.Logger;
|
|
21
21
|
constructor({ spanId }: CoreContextArgs);
|
|
22
22
|
parse(schema: string): OasDocument;
|
|
23
|
-
appendToStackTrail(token: string | string[]): void;
|
|
24
|
-
removeFromStackTrail(token: string | string[]): void;
|
|
25
23
|
transform({ schema, settings, generatorsMap, prettier }: TransformArgs): {
|
|
26
24
|
results: Record<string, SuccessWarningError>;
|
|
27
25
|
files: Record<string, import("../types/Manifest.js").ManifestEntry>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAA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KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AASD,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B,CAAA;AAED,qBAAa,WAAW;;IACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;gBAKN,EAAE,MAAM,EAAE,EAAE,eAAe;IAmCvC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAMlC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,aAAa;;;;;;IA0EtE,oBAAoB,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;CA+BxD;AAkBD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,UAAU,EACX,EAAE,iBAAiB,GAAG,MAAM,CAQ5B"}
|
|
@@ -37,23 +37,17 @@ export class CoreContext {
|
|
|
37
37
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, schema), "f");
|
|
38
38
|
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
39
39
|
}
|
|
40
|
-
appendToStackTrail(token) {
|
|
41
|
-
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").append(token);
|
|
42
|
-
}
|
|
43
|
-
removeFromStackTrail(token) {
|
|
44
|
-
__classPrivateFieldGet(this, _CoreContext_stackTrail, "f").remove(token);
|
|
45
|
-
}
|
|
46
40
|
transform({ schema, settings, generatorsMap, prettier }) {
|
|
47
41
|
const callback = (generatorKey) => {
|
|
48
42
|
if (__classPrivateFieldGet(this, _CoreContext_phase, "f")?.type === 'render') {
|
|
49
43
|
__classPrivateFieldGet(this, _CoreContext_phase, "f").context.addGeneratorKey({ generatorKey });
|
|
50
44
|
}
|
|
51
45
|
};
|
|
52
|
-
const schemaModel = tracer(this, 'parse', () => {
|
|
46
|
+
const schemaModel = tracer(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f"), 'parse', () => {
|
|
53
47
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, schema), "f");
|
|
54
48
|
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
55
49
|
});
|
|
56
|
-
const files = tracer(this, 'generate', () => {
|
|
50
|
+
const files = tracer(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f"), 'generate', () => {
|
|
57
51
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
58
52
|
schemaModel,
|
|
59
53
|
settings,
|
|
@@ -63,7 +57,7 @@ export class CoreContext {
|
|
|
63
57
|
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate(generatorsMap);
|
|
64
58
|
});
|
|
65
59
|
this.logger.debug(`${files.size} files generated`);
|
|
66
|
-
const renderOutput = tracer(this, 'render', () => {
|
|
60
|
+
const renderOutput = tracer(__classPrivateFieldGet(this, _CoreContext_stackTrail, "f"), 'render', () => {
|
|
67
61
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
68
62
|
files,
|
|
69
63
|
pinnableGenerators: Object.values(generatorsMap)
|
|
@@ -116,8 +110,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
116
110
|
const parseContext = new ParseContext({
|
|
117
111
|
schema,
|
|
118
112
|
logger: this.logger,
|
|
119
|
-
|
|
120
|
-
removeFromStackTrail: this.appendToStackTrail.bind(this)
|
|
113
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f")
|
|
121
114
|
});
|
|
122
115
|
return { type: 'parse', context: parseContext };
|
|
123
116
|
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ schemaModel, settings, generatorsMap, callback }) {
|
|
@@ -127,9 +120,8 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
127
120
|
generatorsMap,
|
|
128
121
|
logger: this.logger,
|
|
129
122
|
callback,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
removeFromStackTrail: this.removeFromStackTrail.bind(this)
|
|
123
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
124
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
133
125
|
});
|
|
134
126
|
return { type: 'generate', context: generateContext };
|
|
135
127
|
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
@@ -138,8 +130,9 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
138
130
|
prettier,
|
|
139
131
|
basePath,
|
|
140
132
|
pinnableGenerators,
|
|
141
|
-
|
|
142
|
-
|
|
133
|
+
logger: this.logger,
|
|
134
|
+
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
135
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
143
136
|
});
|
|
144
137
|
return { type: 'render', context: renderContext };
|
|
145
138
|
};
|
|
@@ -15,15 +15,15 @@ import type { RefName } from '../types/RefName.js';
|
|
|
15
15
|
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
16
16
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
17
17
|
import type { SuccessWarningError } from '../types/Manifest.js';
|
|
18
|
+
import type { StackTrail } from './StackTrail.js';
|
|
18
19
|
type ConstructorArgs = {
|
|
19
20
|
schemaModel: OasDocument;
|
|
20
21
|
settings: ClientSettings | undefined;
|
|
21
22
|
generatorsMap: Record<string, OperationGenerator | ModelGenerator>;
|
|
22
23
|
logger: log.Logger;
|
|
23
24
|
callback: (generatorKey: GeneratorKey) => void;
|
|
25
|
+
stackTrail: StackTrail;
|
|
24
26
|
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
25
|
-
appendToStackTrail: (token: string | string[]) => void;
|
|
26
|
-
removeFromStackTrail: (token: string | string[]) => void;
|
|
27
27
|
};
|
|
28
28
|
export type PickArgs = {
|
|
29
29
|
name: string;
|
|
@@ -70,9 +70,7 @@ export declare class GenerateContext {
|
|
|
70
70
|
logger: log.Logger;
|
|
71
71
|
callback: (generatorKey: GeneratorKey) => void;
|
|
72
72
|
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
73
|
-
|
|
74
|
-
removeFromStackTrail: (token: string | string[]) => void;
|
|
75
|
-
constructor({ schemaModel, settings, logger, callback, captureCurrentResult, appendToStackTrail, removeFromStackTrail }: ConstructorArgs);
|
|
73
|
+
constructor({ schemaModel, settings, logger, callback, captureCurrentResult, stackTrail }: ConstructorArgs);
|
|
76
74
|
generate(generatorsMap: Record<string, OperationGenerator | ModelGenerator>): Map<string, FileContents>;
|
|
77
75
|
getFile(filePath: string, { throwIfNotFound }?: GetFileOptions): FileContents;
|
|
78
76
|
register({ imports, definitions, destinationPath }: RegisterArgs): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EA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Q,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -9,14 +9,15 @@ 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 _GenerateContext_instances, _GenerateContext_files, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_generateModel, _GenerateContext_generateOperation;
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_generateModel, _GenerateContext_generateOperation;
|
|
13
13
|
import { join, normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
14
14
|
import { Import } from '../dsl/Import.js';
|
|
15
15
|
import { OperationDriver } from '../dsl/OperationDriver.js';
|
|
16
16
|
import { ModelDriver } from '../dsl/ModelDriver.js';
|
|
17
17
|
import * as Sentry from '@sentry/deno';
|
|
18
|
+
import { tracer } from '../helpers/tracer.js';
|
|
18
19
|
export class GenerateContext {
|
|
19
|
-
constructor({ schemaModel, settings, logger, callback, captureCurrentResult,
|
|
20
|
+
constructor({ schemaModel, settings, logger, callback, captureCurrentResult, stackTrail }) {
|
|
20
21
|
_GenerateContext_instances.add(this);
|
|
21
22
|
_GenerateContext_files.set(this, void 0);
|
|
22
23
|
Object.defineProperty(this, "schemaModel", {
|
|
@@ -49,45 +50,34 @@ export class GenerateContext {
|
|
|
49
50
|
writable: true,
|
|
50
51
|
value: void 0
|
|
51
52
|
});
|
|
52
|
-
|
|
53
|
-
enumerable: true,
|
|
54
|
-
configurable: true,
|
|
55
|
-
writable: true,
|
|
56
|
-
value: void 0
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(this, "removeFromStackTrail", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
configurable: true,
|
|
61
|
-
writable: true,
|
|
62
|
-
value: void 0
|
|
63
|
-
});
|
|
53
|
+
_GenerateContext_stackTrail.set(this, void 0);
|
|
64
54
|
this.logger = logger;
|
|
65
55
|
__classPrivateFieldSet(this, _GenerateContext_files, new Map(), "f");
|
|
66
56
|
this.schemaModel = schemaModel;
|
|
67
57
|
this.settings = settings;
|
|
68
58
|
this.callback = callback;
|
|
59
|
+
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
69
60
|
this.captureCurrentResult = captureCurrentResult;
|
|
70
|
-
this.appendToStackTrail = appendToStackTrail;
|
|
71
|
-
this.removeFromStackTrail = removeFromStackTrail;
|
|
72
61
|
}
|
|
73
62
|
generate(generatorsMap) {
|
|
74
63
|
Sentry.startSpan({ name: 'Generate operations' }, () => Object.values(generatorsMap)
|
|
75
64
|
.filter(generator => generator.type === 'operation')
|
|
76
65
|
.forEach(generator => {
|
|
77
|
-
this
|
|
78
|
-
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, {
|
|
66
|
+
tracer(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), generator.id, () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, {
|
|
79
67
|
schemaModel: this.schemaModel,
|
|
80
68
|
generator
|
|
81
|
-
});
|
|
82
|
-
this.removeFromStackTrail(generator.id);
|
|
69
|
+
}));
|
|
83
70
|
}));
|
|
84
71
|
Sentry.startSpan({ name: 'Generate models' }, () => {
|
|
85
72
|
Object.values(generatorsMap)
|
|
86
73
|
.filter(generator => generator.type === 'model')
|
|
87
74
|
.forEach(generator => {
|
|
88
|
-
this
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
tracer(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), generator.id, () => {
|
|
76
|
+
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, {
|
|
77
|
+
schemaModel: this.schemaModel,
|
|
78
|
+
generator
|
|
79
|
+
});
|
|
80
|
+
});
|
|
91
81
|
});
|
|
92
82
|
});
|
|
93
83
|
return __classPrivateFieldGet(this, _GenerateContext_files, "f");
|
|
@@ -203,7 +193,7 @@ export class GenerateContext {
|
|
|
203
193
|
return this.getFile(exportPath).definitions.get(name);
|
|
204
194
|
}
|
|
205
195
|
}
|
|
206
|
-
_GenerateContext_files = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ schemaModel, generator }) {
|
|
196
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ schemaModel, generator }) {
|
|
207
197
|
const generatorInstance = new generator(this);
|
|
208
198
|
schemaModel.operations.forEach(operation => {
|
|
209
199
|
// TODO If we make OasOperation generic, for example by
|
|
@@ -215,21 +205,21 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_instances = new WeakSet
|
|
|
215
205
|
// https://linear.app/skmtc/issue/SKM-32/generic-models-operations
|
|
216
206
|
const { path, method } = operation;
|
|
217
207
|
if (generator.isSupported(operation)) {
|
|
218
|
-
this
|
|
219
|
-
|
|
220
|
-
|
|
208
|
+
tracer(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), [path, method], () => {
|
|
209
|
+
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_generateOperation).call(this, { operation, generatorInstance });
|
|
210
|
+
});
|
|
221
211
|
}
|
|
222
212
|
});
|
|
223
213
|
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator({ schemaModel, generator }) {
|
|
224
214
|
const generatorInstance = new generator(this);
|
|
225
215
|
const refNames = Object.keys(schemaModel.components?.schemas ?? {});
|
|
226
216
|
refNames.forEach(rn => {
|
|
227
|
-
this
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
217
|
+
tracer(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), rn, () => {
|
|
218
|
+
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_generateModel).call(this, {
|
|
219
|
+
refName: rn,
|
|
220
|
+
generatorInstance
|
|
221
|
+
});
|
|
231
222
|
});
|
|
232
|
-
this.removeFromStackTrail(rn);
|
|
233
223
|
});
|
|
234
224
|
}, _GenerateContext_generateModel = function _GenerateContext_generateModel({ refName, generatorInstance }) {
|
|
235
225
|
try {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import { OasDocument } from '../oas/document/Document.js';
|
|
3
3
|
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
4
|
+
import type { StackTrail } from './StackTrail.js';
|
|
4
5
|
type ConstructorArgs = {
|
|
5
6
|
schema: string;
|
|
6
7
|
logger: log.Logger;
|
|
7
|
-
|
|
8
|
-
removeFromStackTrail: (token: string | string[]) => void;
|
|
8
|
+
stackTrail: StackTrail;
|
|
9
9
|
};
|
|
10
10
|
export declare class ParseContext {
|
|
11
11
|
#private;
|
|
12
12
|
schema: string;
|
|
13
13
|
logger: log.Logger;
|
|
14
14
|
documentRoot: OasDocument;
|
|
15
|
-
|
|
16
|
-
removeFromStackTrail: (token: string | string[]) => void;
|
|
17
|
-
constructor({ schema, logger, appendToStackTrail, removeFromStackTrail }: ConstructorArgs);
|
|
15
|
+
constructor({ schema, logger, stackTrail }: ConstructorArgs);
|
|
18
16
|
parse(): OasDocument;
|
|
17
|
+
trace<T>(token: string | string[], fn: () => T): T;
|
|
19
18
|
logSkippedFields(skipped: Record<string, unknown>): void;
|
|
20
19
|
}
|
|
21
20
|
export declare const parseSchema: (schema: string) => OpenAPIV3.Document<{}>;
|
|
@@ -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;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,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;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACzD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGjD,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,qBAAa,YAAY;;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,YAAY,EAAE,WAAW,CAAA;gBAGb,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,eAAe;IAQ3D,KAAK;IAeL,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAiBlD,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAWlD;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,2BAMzC,CAAA"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
1
7
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
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");
|
|
4
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
11
|
};
|
|
6
|
-
var _ParseContext_instances, _ParseContext_parseSchema, _ParseContext_parseDocument;
|
|
12
|
+
var _ParseContext_instances, _ParseContext_stackTrail, _ParseContext_parseSchema, _ParseContext_parseDocument;
|
|
7
13
|
import * as Sentry from '@sentry/deno';
|
|
8
14
|
import { parse as parseYaml } from '../deps/jsr.io/@std/yaml/0.215.0/mod.js';
|
|
9
15
|
import { toDocumentFieldsV3 } from '../oas/document/toDocumentFieldsV3.js';
|
|
10
16
|
import { OasDocument } from '../oas/document/Document.js';
|
|
17
|
+
import { tracer } from '../helpers/tracer.js';
|
|
11
18
|
export class ParseContext {
|
|
12
|
-
constructor({ schema, logger,
|
|
19
|
+
constructor({ schema, logger, stackTrail }) {
|
|
13
20
|
_ParseContext_instances.add(this);
|
|
14
21
|
Object.defineProperty(this, "schema", {
|
|
15
22
|
enumerable: true,
|
|
@@ -29,28 +36,19 @@ export class ParseContext {
|
|
|
29
36
|
writable: true,
|
|
30
37
|
value: void 0
|
|
31
38
|
});
|
|
32
|
-
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: void 0
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(this, "removeFromStackTrail", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: void 0
|
|
43
|
-
});
|
|
39
|
+
_ParseContext_stackTrail.set(this, void 0);
|
|
44
40
|
this.schema = schema;
|
|
45
41
|
this.logger = logger;
|
|
42
|
+
__classPrivateFieldSet(this, _ParseContext_stackTrail, stackTrail, "f");
|
|
46
43
|
this.documentRoot = new OasDocument();
|
|
47
|
-
this.appendToStackTrail = appendToStackTrail;
|
|
48
|
-
this.removeFromStackTrail = removeFromStackTrail;
|
|
49
44
|
}
|
|
50
45
|
parse() {
|
|
51
46
|
const parsedDocument = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_parseSchema).call(this);
|
|
52
47
|
return __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_parseDocument).call(this, parsedDocument);
|
|
53
48
|
}
|
|
49
|
+
trace(token, fn) {
|
|
50
|
+
return tracer(__classPrivateFieldGet(this, _ParseContext_stackTrail, "f"), token, fn);
|
|
51
|
+
}
|
|
54
52
|
logSkippedFields(skipped) {
|
|
55
53
|
Object.entries(skipped).forEach(([key, value]) => {
|
|
56
54
|
this.logger.warn(`Property not yet implemented. Please request from support if needed - ${JSON.stringify({
|
|
@@ -59,7 +57,7 @@ export class ParseContext {
|
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
59
|
}
|
|
62
|
-
_ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
|
|
60
|
+
_ParseContext_stackTrail = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
|
|
63
61
|
const parsedDocument = Sentry.startSpan({ name: 'Parse schema to document' }, () => parseSchema(this.schema));
|
|
64
62
|
return parsedDocument;
|
|
65
63
|
}, _ParseContext_parseDocument = function _ParseContext_parseDocument(parsedDocument) {
|
|
@@ -2,23 +2,28 @@ import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
|
2
2
|
import type { AddGeneratorKeyArgs, FileContents, RenderResult } from './types.js';
|
|
3
3
|
import type { Definition } from '../dsl/Definition.js';
|
|
4
4
|
import type { PickArgs } from './GenerateContext.js';
|
|
5
|
+
import type { SuccessWarningError } from '../types/Manifest.js';
|
|
6
|
+
import type { StackTrail } from './StackTrail.js';
|
|
7
|
+
import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
5
8
|
type ConstructorArgs = {
|
|
6
9
|
files: Map<string, FileContents>;
|
|
7
10
|
prettier?: PrettierConfigType;
|
|
8
11
|
basePath: string | undefined;
|
|
9
12
|
pinnableGenerators: string[];
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
stackTrail: StackTrail;
|
|
14
|
+
logger: log.Logger;
|
|
15
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
12
16
|
};
|
|
13
17
|
export declare class RenderContext {
|
|
18
|
+
#private;
|
|
14
19
|
files: Map<string, FileContents>;
|
|
15
20
|
private prettier?;
|
|
16
21
|
basePath: string | undefined;
|
|
17
22
|
currentDestinationPath: string | 'PRE_RENDER' | 'POST_RENDER';
|
|
18
23
|
pinnableGenerators: string[];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
constructor({ files, prettier, basePath, pinnableGenerators,
|
|
24
|
+
logger: log.Logger;
|
|
25
|
+
captureCurrentResult: (result: SuccessWarningError) => void;
|
|
26
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
22
27
|
render(): Omit<RenderResult, 'results'>;
|
|
23
28
|
private collate;
|
|
24
29
|
getFile(filePath: string): FileContents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,YA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IAC7D,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAElB,oBAAoB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;gBAC/C,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,oBAAoB,EACrB,EAAE,eAAe;IAWlB,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAuBvC,OAAO,CAAC,OAAO;IA0Df,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IAavC,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;IAarD,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _RenderContext_stackTrail;
|
|
1
13
|
import * as Sentry from '@sentry/deno';
|
|
2
14
|
import { Import } from '../dsl/Import.js';
|
|
3
15
|
import invariant from 'tiny-invariant';
|
|
@@ -5,7 +17,7 @@ import { normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
|
5
17
|
import { toResolvedArtifactPath } from '../helpers/toResolvedArtifactPath.js';
|
|
6
18
|
import { tracer } from '../helpers/tracer.js';
|
|
7
19
|
export class RenderContext {
|
|
8
|
-
constructor({ files, prettier, basePath, pinnableGenerators,
|
|
20
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }) {
|
|
9
21
|
Object.defineProperty(this, "files", {
|
|
10
22
|
enumerable: true,
|
|
11
23
|
configurable: true,
|
|
@@ -36,13 +48,14 @@ export class RenderContext {
|
|
|
36
48
|
writable: true,
|
|
37
49
|
value: void 0
|
|
38
50
|
});
|
|
39
|
-
Object.defineProperty(this, "
|
|
51
|
+
Object.defineProperty(this, "logger", {
|
|
40
52
|
enumerable: true,
|
|
41
53
|
configurable: true,
|
|
42
54
|
writable: true,
|
|
43
55
|
value: void 0
|
|
44
56
|
});
|
|
45
|
-
|
|
57
|
+
_RenderContext_stackTrail.set(this, void 0);
|
|
58
|
+
Object.defineProperty(this, "captureCurrentResult", {
|
|
46
59
|
enumerable: true,
|
|
47
60
|
configurable: true,
|
|
48
61
|
writable: true,
|
|
@@ -53,8 +66,9 @@ export class RenderContext {
|
|
|
53
66
|
this.prettier = prettier;
|
|
54
67
|
this.basePath = basePath;
|
|
55
68
|
this.pinnableGenerators = pinnableGenerators;
|
|
56
|
-
this.
|
|
57
|
-
this
|
|
69
|
+
this.logger = logger;
|
|
70
|
+
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
71
|
+
this.captureCurrentResult = captureCurrentResult;
|
|
58
72
|
}
|
|
59
73
|
render() {
|
|
60
74
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -77,43 +91,43 @@ export class RenderContext {
|
|
|
77
91
|
}
|
|
78
92
|
collate() {
|
|
79
93
|
const fileEntries = Array.from(this.files.entries());
|
|
80
|
-
const fileObjects = fileEntries
|
|
81
|
-
|
|
94
|
+
const fileObjects = fileEntries
|
|
95
|
+
.map(([destinationPath, file]) => {
|
|
96
|
+
return tracer(__classPrivateFieldGet(this, _RenderContext_stackTrail, "f"), destinationPath, () => {
|
|
82
97
|
// Set the current destination path to be used by
|
|
83
98
|
// addGeneratorKey method to apply generator keys
|
|
84
99
|
// to Correct file
|
|
85
100
|
// @TODO: Could this be combined with the tracer call above?
|
|
86
101
|
this.currentDestinationPath = destinationPath;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
try {
|
|
103
|
+
const renderedFile = renderFile({
|
|
104
|
+
file,
|
|
105
|
+
destinationPath,
|
|
106
|
+
basePath: this.basePath,
|
|
107
|
+
prettier: this.prettier
|
|
108
|
+
});
|
|
109
|
+
this.captureCurrentResult('success');
|
|
110
|
+
return renderedFile;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.logger.error(error);
|
|
114
|
+
this.captureCurrentResult('error');
|
|
115
|
+
Sentry.captureException(error);
|
|
116
|
+
}
|
|
93
117
|
});
|
|
94
|
-
})
|
|
118
|
+
})
|
|
119
|
+
.filter(fileObject => fileObject !== undefined);
|
|
95
120
|
this.currentDestinationPath = 'POST_RENDER';
|
|
96
|
-
|
|
97
|
-
for (const fileObject of fileObjects) {
|
|
98
|
-
resolvedFileObjects.push({
|
|
99
|
-
...fileObject,
|
|
100
|
-
hash: 'ADD LATER'
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return resolvedFileObjects.reduce((acc, fileObject) => ({
|
|
121
|
+
return fileObjects.reduce((acc, { content, path, ...fileMeta }) => ({
|
|
104
122
|
...acc,
|
|
105
123
|
artifacts: {
|
|
106
124
|
...acc.artifacts,
|
|
107
|
-
[
|
|
125
|
+
[path]: content
|
|
108
126
|
},
|
|
109
127
|
files: {
|
|
110
128
|
...acc.files,
|
|
111
|
-
[
|
|
112
|
-
|
|
113
|
-
numberOfLines: fileObject.numberOfLines,
|
|
114
|
-
numberOfCharacters: fileObject.numberOfCharacters,
|
|
115
|
-
hash: fileObject.hash,
|
|
116
|
-
generatorKeys: fileObject.generatorKeys
|
|
129
|
+
[path]: {
|
|
130
|
+
...fileMeta
|
|
117
131
|
}
|
|
118
132
|
}
|
|
119
133
|
}), {
|
|
@@ -138,6 +152,7 @@ export class RenderContext {
|
|
|
138
152
|
return this.getFile(exportPath).definitions.get(name);
|
|
139
153
|
}
|
|
140
154
|
}
|
|
155
|
+
_RenderContext_stackTrail = new WeakMap();
|
|
141
156
|
const renderFile = ({ file, destinationPath, basePath }) => {
|
|
142
157
|
const imports = Array.from(file.imports.entries()).map(([module, importItems]) => new Import({ module, importNames: Array.from(importItems) }));
|
|
143
158
|
const definitions = Array.from(file.definitions.values());
|
|
@@ -151,7 +166,8 @@ const renderFile = ({ file, destinationPath, basePath }) => {
|
|
|
151
166
|
destinationPath,
|
|
152
167
|
numberOfLines: content.split('\n').length,
|
|
153
168
|
numberOfCharacters: content.length,
|
|
154
|
-
generatorKeys: Array.from(file.generatorKeys).filter(Boolean)
|
|
169
|
+
generatorKeys: Array.from(file.generatorKeys).filter(Boolean),
|
|
170
|
+
hash: 'PLACEHOLDER'
|
|
155
171
|
};
|
|
156
172
|
};
|
|
157
173
|
const generatePinnable = ({ pinnableGenerators, files }) => {
|
package/esm/helpers/tracer.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
removeFromStackTrail: (token: string | string[]) => void;
|
|
4
|
-
};
|
|
5
|
-
export declare const tracer: <T>(context: StackTrailHandler, token: string | string[], fn: () => T) => T;
|
|
6
|
-
export {};
|
|
1
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
2
|
+
export declare const tracer: <T>(stackTrail: StackTrail, token: string | string[], fn: () => T) => T;
|
|
7
3
|
//# sourceMappingURL=tracer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/helpers/tracer.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/helpers/tracer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,eAAO,MAAM,MAAM,GAAI,CAAC,cACV,UAAU,SACf,MAAM,GAAG,MAAM,EAAE,MACpB,MAAM,CAAC,MASZ,CAAA"}
|
package/esm/helpers/tracer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const tracer = (
|
|
2
|
-
|
|
1
|
+
export const tracer = (stackTrail, token, fn) => {
|
|
2
|
+
stackTrail.append(token);
|
|
3
3
|
const result = fn();
|
|
4
|
-
|
|
4
|
+
stackTrail.remove(token);
|
|
5
5
|
return result;
|
|
6
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../../src/oas/array/toArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAoB,MAAM,YAAY,CAAA;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"toArray.d.ts","sourceRoot":"","sources":["../../../src/oas/array/toArray.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAoB,MAAM,YAAY,CAAA;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,SAAS,CAAC,iBAAiB,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,OAAO,uBAAwB,WAAW,KAAG,QA0BzD,CAAA"}
|
package/esm/oas/array/toArray.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OasArray } from './Array.js';
|
|
2
2
|
import { toSchemaV3 } from '../schema/toSchemasV3.js';
|
|
3
|
-
import { tracer } from '../../helpers/tracer.js';
|
|
4
3
|
export const toArray = ({ value, context }) => {
|
|
5
4
|
const { type: _type, items, title, description, nullable, uniqueItems, ...skipped } = value;
|
|
6
5
|
context.logSkippedFields(skipped);
|
|
@@ -12,7 +11,7 @@ export const toArray = ({ value, context }) => {
|
|
|
12
11
|
description,
|
|
13
12
|
nullable,
|
|
14
13
|
uniqueItems,
|
|
15
|
-
items:
|
|
14
|
+
items: context.trace('items', () => toSchemaV3({ schema: items, context }))
|
|
16
15
|
};
|
|
17
16
|
return new OasArray(fields);
|
|
18
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toComponentsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/components/toComponentsV3.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"toComponentsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/components/toComponentsV3.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,SAAS,CAAC,gBAAgB,GAAG,SAAS,CAAA;IAClD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,aAAa,GAAG,SA0CvC,CAAA"}
|
|
@@ -5,7 +5,6 @@ import { toOptionalParametersV3 } from '../parameter/toParameterV3.js';
|
|
|
5
5
|
import { toExamplesV3 } from '../example/toExamplesV3.js';
|
|
6
6
|
import { toRequestBodiesV3 } from '../requestBody/toRequestBodiesV3.js';
|
|
7
7
|
import { OasComponents } from './Components.js';
|
|
8
|
-
import { tracer } from '../../helpers/tracer.js';
|
|
9
8
|
export const toComponentsV3 = ({ components, context }) => {
|
|
10
9
|
if (!components) {
|
|
11
10
|
return undefined;
|
|
@@ -13,9 +12,9 @@ export const toComponentsV3 = ({ components, context }) => {
|
|
|
13
12
|
const { schemas, responses, parameters, examples, requestBodies, headers, ...skipped } = components;
|
|
14
13
|
context.logSkippedFields(skipped);
|
|
15
14
|
const fields = {
|
|
16
|
-
schemas:
|
|
17
|
-
responses:
|
|
18
|
-
parameters:
|
|
15
|
+
schemas: context.trace('schemas', () => toOptionalSchemasV3({ schemas, context })),
|
|
16
|
+
responses: context.trace('responses', () => toOptionalResponsesV3({ responses, context })),
|
|
17
|
+
parameters: context.trace('parameters', () => toOptionalParametersV3({
|
|
19
18
|
parameters,
|
|
20
19
|
context
|
|
21
20
|
})),
|
|
@@ -25,8 +24,8 @@ export const toComponentsV3 = ({ components, context }) => {
|
|
|
25
24
|
exampleKey: 'TEMP',
|
|
26
25
|
context
|
|
27
26
|
}),
|
|
28
|
-
requestBodies:
|
|
29
|
-
headers:
|
|
27
|
+
requestBodies: context.trace('requestBodies', () => toRequestBodiesV3({ requestBodies, context })),
|
|
28
|
+
headers: context.trace('headers', () => toHeadersV3({ headers, context }))
|
|
30
29
|
};
|
|
31
30
|
return new OasComponents(fields);
|
|
32
31
|
};
|