@skmtc/core 0.0.312 → 0.0.313
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 -5
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +51 -51
- package/esm/context/GenerateContext.d.ts +5 -4
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +25 -23
- package/esm/context/ParseContext.d.ts +5 -4
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +22 -30
- package/esm/context/RenderContext.d.ts +5 -5
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +28 -35
- package/esm/context/StackTrail.js +1 -1
- package/esm/generate/generate.d.ts.map +1 -1
- package/esm/generate/generate.js +3 -2
- package/esm/helpers/tracer.d.ts +3 -3
- package/esm/helpers/tracer.d.ts.map +1 -1
- package/esm/helpers/tracer.js +3 -3
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +0 -1
- package/esm/server/createServer.js +2 -2
- package/esm/types/GeneratorKeys.js +6 -6
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +6 -5
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +51 -51
- package/script/context/GenerateContext.d.ts +5 -4
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +25 -23
- package/script/context/ParseContext.d.ts +5 -4
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +22 -30
- package/script/context/RenderContext.d.ts +5 -5
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +28 -35
- package/script/context/StackTrail.js +1 -1
- package/script/generate/generate.d.ts.map +1 -1
- package/script/generate/generate.js +3 -2
- package/script/helpers/tracer.d.ts +3 -3
- package/script/helpers/tracer.d.ts.map +1 -1
- package/script/helpers/tracer.js +3 -3
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +0 -1
- package/script/server/createServer.js +2 -2
- package/script/types/GeneratorKeys.js +6 -6
|
@@ -4,18 +4,19 @@ import type * as log from '../deps/jsr.io/@std/log/0.224.6/mod.js';
|
|
|
4
4
|
type ConstructorArgs = {
|
|
5
5
|
schema: string;
|
|
6
6
|
logger: log.Logger;
|
|
7
|
+
appendToStackTrail: (token: string | string[]) => void;
|
|
8
|
+
removeFromStackTrail: (token: string | string[]) => void;
|
|
7
9
|
};
|
|
8
10
|
export declare class ParseContext {
|
|
9
11
|
#private;
|
|
10
12
|
schema: string;
|
|
11
13
|
logger: log.Logger;
|
|
12
14
|
documentRoot: OasDocument;
|
|
13
|
-
|
|
15
|
+
appendToStackTrail: (token: string | string[]) => void;
|
|
16
|
+
removeFromStackTrail: (token: string | string[]) => void;
|
|
17
|
+
constructor({ schema, logger, appendToStackTrail, removeFromStackTrail }: ConstructorArgs);
|
|
14
18
|
parse(): OasDocument;
|
|
15
19
|
logSkippedFields(skipped: Record<string, unknown>): void;
|
|
16
|
-
get stackTrail(): string;
|
|
17
|
-
appendStackTrailChunk(chunk: string | string[]): void;
|
|
18
|
-
removeStackTrailChunk(chunk: string | string[]): void;
|
|
19
20
|
}
|
|
20
21
|
export declare const parseSchema: (schema: string) => OpenAPIV3.Document<{}>;
|
|
21
22
|
export {};
|
|
@@ -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;
|
|
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;AAElE,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;IACtD,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;CACzD,CAAA;AAED,qBAAa,YAAY;;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,YAAY,EAAE,WAAW,CAAA;IACzB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;IACtD,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;gBAE5C,EACV,MAAM,EACN,MAAM,EACN,kBAAkB,EAClB,oBAAoB,EACrB,EAAE,eAAe;IAUlB,KAAK;IA4BL,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAWlD;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,2BAMzC,CAAA"}
|
|
@@ -22,27 +22,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
-
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");
|
|
29
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
-
};
|
|
31
25
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
26
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
27
|
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");
|
|
34
28
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
29
|
};
|
|
36
|
-
var _ParseContext_instances,
|
|
30
|
+
var _ParseContext_instances, _ParseContext_parseSchema, _ParseContext_parseDocument;
|
|
37
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
32
|
exports.parseSchema = exports.ParseContext = void 0;
|
|
39
|
-
const StackTrail_js_1 = require("./StackTrail.js");
|
|
40
33
|
const Sentry = __importStar(require("@sentry/deno"));
|
|
41
34
|
const mod_js_1 = require("../deps/jsr.io/@std/yaml/0.215.0/mod.js");
|
|
42
35
|
const toDocumentFieldsV3_js_1 = require("../oas/document/toDocumentFieldsV3.js");
|
|
43
36
|
const Document_js_1 = require("../oas/document/Document.js");
|
|
44
37
|
class ParseContext {
|
|
45
|
-
constructor({ schema, logger }) {
|
|
38
|
+
constructor({ schema, logger, appendToStackTrail, removeFromStackTrail }) {
|
|
46
39
|
_ParseContext_instances.add(this);
|
|
47
40
|
Object.defineProperty(this, "schema", {
|
|
48
41
|
enumerable: true,
|
|
@@ -50,7 +43,6 @@ class ParseContext {
|
|
|
50
43
|
writable: true,
|
|
51
44
|
value: void 0
|
|
52
45
|
});
|
|
53
|
-
_ParseContext_stackTrail.set(this, void 0);
|
|
54
46
|
Object.defineProperty(this, "logger", {
|
|
55
47
|
enumerable: true,
|
|
56
48
|
configurable: true,
|
|
@@ -63,38 +55,38 @@ class ParseContext {
|
|
|
63
55
|
writable: true,
|
|
64
56
|
value: void 0
|
|
65
57
|
});
|
|
58
|
+
Object.defineProperty(this, "appendToStackTrail", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true,
|
|
61
|
+
writable: true,
|
|
62
|
+
value: void 0
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(this, "removeFromStackTrail", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
66
70
|
this.schema = schema;
|
|
67
71
|
this.logger = logger;
|
|
68
|
-
__classPrivateFieldSet(this, _ParseContext_stackTrail, new StackTrail_js_1.StackTrail(), "f");
|
|
69
72
|
this.documentRoot = new Document_js_1.OasDocument();
|
|
73
|
+
this.appendToStackTrail = appendToStackTrail;
|
|
74
|
+
this.removeFromStackTrail = removeFromStackTrail;
|
|
70
75
|
}
|
|
71
76
|
parse() {
|
|
72
77
|
const parsedDocument = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_parseSchema).call(this);
|
|
73
78
|
return __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_parseDocument).call(this, parsedDocument);
|
|
74
79
|
}
|
|
75
80
|
logSkippedFields(skipped) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// }
|
|
82
|
-
// ).slice(0, 45)}`
|
|
83
|
-
// )
|
|
84
|
-
// })
|
|
85
|
-
}
|
|
86
|
-
get stackTrail() {
|
|
87
|
-
return __classPrivateFieldGet(this, _ParseContext_stackTrail, "f").toString();
|
|
88
|
-
}
|
|
89
|
-
appendStackTrailChunk(chunk) {
|
|
90
|
-
__classPrivateFieldGet(this, _ParseContext_stackTrail, "f").append(chunk);
|
|
91
|
-
}
|
|
92
|
-
removeStackTrailChunk(chunk) {
|
|
93
|
-
__classPrivateFieldGet(this, _ParseContext_stackTrail, "f").remove(chunk);
|
|
81
|
+
Object.entries(skipped).forEach(([key, value]) => {
|
|
82
|
+
this.logger.warn(`Property not yet implemented. Please request from support if needed - ${JSON.stringify({
|
|
83
|
+
[key]: value
|
|
84
|
+
}).slice(0, 45)}`);
|
|
85
|
+
});
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
exports.ParseContext = ParseContext;
|
|
97
|
-
|
|
89
|
+
_ParseContext_instances = new WeakSet(), _ParseContext_parseSchema = function _ParseContext_parseSchema() {
|
|
98
90
|
const parsedDocument = Sentry.startSpan({ name: 'Parse schema to document' }, () => (0, exports.parseSchema)(this.schema));
|
|
99
91
|
return parsedDocument;
|
|
100
92
|
}, _ParseContext_parseDocument = function _ParseContext_parseDocument(parsedDocument) {
|
|
@@ -7,18 +7,18 @@ type ConstructorArgs = {
|
|
|
7
7
|
prettier?: PrettierConfigType;
|
|
8
8
|
basePath: string | undefined;
|
|
9
9
|
pinnableGenerators: string[];
|
|
10
|
+
appendToStackTrail: (token: string | string[]) => void;
|
|
11
|
+
removeFromStackTrail: (token: string | string[]) => void;
|
|
10
12
|
};
|
|
11
13
|
export declare class RenderContext {
|
|
12
|
-
#private;
|
|
13
14
|
files: Map<string, FileContents>;
|
|
14
15
|
private prettier?;
|
|
15
16
|
basePath: string | undefined;
|
|
16
17
|
currentDestinationPath: string | 'PRE_RENDER' | 'POST_RENDER';
|
|
17
18
|
pinnableGenerators: string[];
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
get stackTrail(): string;
|
|
19
|
+
appendToStackTrail: (token: string | string[]) => void;
|
|
20
|
+
removeFromStackTrail: (token: string | string[]) => void;
|
|
21
|
+
constructor({ files, prettier, basePath, pinnableGenerators, appendToStackTrail, removeFromStackTrail }: ConstructorArgs);
|
|
22
22
|
render(): Omit<RenderResult, 'results'>;
|
|
23
23
|
private collate;
|
|
24
24
|
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,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAMpD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAA;
|
|
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,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAMpD,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;IACtD,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;CACzD,CAAA;AAED,qBAAa,aAAa;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,OAAO,CAAC,QAAQ,CAAC,CAAoB;IACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,sBAAsB,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,CAAA;IAC7D,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;IACtD,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;gBAE5C,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,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"}
|
|
@@ -22,21 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
-
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");
|
|
29
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
-
};
|
|
31
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
-
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");
|
|
34
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
-
};
|
|
36
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
27
|
};
|
|
39
|
-
var _RenderContext_stackTrail;
|
|
40
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
29
|
exports.RenderContext = void 0;
|
|
42
30
|
const Sentry = __importStar(require("@sentry/deno"));
|
|
@@ -44,9 +32,9 @@ const Import_js_1 = require("../dsl/Import.js");
|
|
|
44
32
|
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
45
33
|
const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
46
34
|
const toResolvedArtifactPath_js_1 = require("../helpers/toResolvedArtifactPath.js");
|
|
47
|
-
const
|
|
35
|
+
const tracer_js_1 = require("../helpers/tracer.js");
|
|
48
36
|
class RenderContext {
|
|
49
|
-
constructor({ files, prettier, basePath, pinnableGenerators }) {
|
|
37
|
+
constructor({ files, prettier, basePath, pinnableGenerators, appendToStackTrail, removeFromStackTrail }) {
|
|
50
38
|
Object.defineProperty(this, "files", {
|
|
51
39
|
enumerable: true,
|
|
52
40
|
configurable: true,
|
|
@@ -77,22 +65,25 @@ class RenderContext {
|
|
|
77
65
|
writable: true,
|
|
78
66
|
value: void 0
|
|
79
67
|
});
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
Object.defineProperty(this, "appendToStackTrail", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
writable: true,
|
|
72
|
+
value: void 0
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(this, "removeFromStackTrail", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
configurable: true,
|
|
77
|
+
writable: true,
|
|
78
|
+
value: void 0
|
|
79
|
+
});
|
|
82
80
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
83
81
|
this.files = files;
|
|
84
82
|
this.prettier = prettier;
|
|
85
83
|
this.basePath = basePath;
|
|
86
84
|
this.pinnableGenerators = pinnableGenerators;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
__classPrivateFieldGet(this, _RenderContext_stackTrail, "f").append(chunk);
|
|
90
|
-
}
|
|
91
|
-
removeStackTrailChunk(chunk) {
|
|
92
|
-
__classPrivateFieldGet(this, _RenderContext_stackTrail, "f").remove(chunk);
|
|
93
|
-
}
|
|
94
|
-
get stackTrail() {
|
|
95
|
-
return __classPrivateFieldGet(this, _RenderContext_stackTrail, "f").toString();
|
|
85
|
+
this.appendToStackTrail = appendToStackTrail;
|
|
86
|
+
this.removeFromStackTrail = removeFromStackTrail;
|
|
96
87
|
}
|
|
97
88
|
render() {
|
|
98
89
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -116,15 +107,18 @@ class RenderContext {
|
|
|
116
107
|
collate() {
|
|
117
108
|
const fileEntries = Array.from(this.files.entries());
|
|
118
109
|
const fileObjects = fileEntries.map(([destinationPath, file]) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
110
|
+
return (0, tracer_js_1.tracer)(this, destinationPath, () => {
|
|
111
|
+
// Set the current destination path to be used by
|
|
112
|
+
// addGeneratorKey method to apply generator keys
|
|
113
|
+
// to Correct file
|
|
114
|
+
// @TODO: Could this be combined with the tracer call above?
|
|
115
|
+
this.currentDestinationPath = destinationPath;
|
|
116
|
+
return renderFile({
|
|
117
|
+
file,
|
|
118
|
+
destinationPath,
|
|
119
|
+
basePath: this.basePath,
|
|
120
|
+
prettier: this.prettier
|
|
121
|
+
});
|
|
128
122
|
});
|
|
129
123
|
});
|
|
130
124
|
this.currentDestinationPath = 'POST_RENDER';
|
|
@@ -174,7 +168,6 @@ class RenderContext {
|
|
|
174
168
|
}
|
|
175
169
|
}
|
|
176
170
|
exports.RenderContext = RenderContext;
|
|
177
|
-
_RenderContext_stackTrail = new WeakMap();
|
|
178
171
|
const renderFile = ({ file, destinationPath, basePath }) => {
|
|
179
172
|
const imports = Array.from(file.imports.entries()).map(([module, importItems]) => new Import_js_1.Import({ module, importNames: Array.from(importItems) }));
|
|
180
173
|
const definitions = Array.from(file.definitions.values());
|
|
@@ -53,7 +53,7 @@ class StackTrail {
|
|
|
53
53
|
static parse(value) {
|
|
54
54
|
const stack = value.split(':').map(item => {
|
|
55
55
|
if (!item) {
|
|
56
|
-
throw new Error(`Empty stack trail
|
|
56
|
+
throw new Error(`Empty stack trail token in: ${value}`);
|
|
57
57
|
}
|
|
58
58
|
return item.replaceAll('%3A', ':');
|
|
59
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,QAAQ,4EAQlB,YAAY;;;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,KAAK,YAAY,GAAG;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,QAAQ,4EAQlB,YAAY;;;CAuBd,CAAA"}
|
|
@@ -27,11 +27,12 @@ exports.generate = void 0;
|
|
|
27
27
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
28
|
const CoreContext_js_1 = require("../context/CoreContext.js");
|
|
29
29
|
const generate = ({ traceId, spanId, schema, settings, prettier, generatorsMap, startAt }) => {
|
|
30
|
-
const context = new CoreContext_js_1.CoreContext({ spanId
|
|
30
|
+
const context = new CoreContext_js_1.CoreContext({ spanId });
|
|
31
31
|
const { artifacts, files, pinnable, results } = context.transform({
|
|
32
32
|
settings,
|
|
33
33
|
generatorsMap,
|
|
34
|
-
prettier
|
|
34
|
+
prettier,
|
|
35
|
+
schema
|
|
35
36
|
});
|
|
36
37
|
const manifest = {
|
|
37
38
|
files,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type StackTrailHandler = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
appendToStackTrail: (token: string | string[]) => void;
|
|
3
|
+
removeFromStackTrail: (token: string | string[]) => void;
|
|
4
4
|
};
|
|
5
|
-
export declare const tracer: <T>(context: StackTrailHandler,
|
|
5
|
+
export declare const tracer: <T>(context: StackTrailHandler, token: string | string[], fn: () => T) => T;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=tracer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/helpers/tracer.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,
|
|
1
|
+
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/helpers/tracer.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;IACtD,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;CACzD,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,CAAC,WACb,iBAAiB,SACnB,MAAM,GAAG,MAAM,EAAE,MACpB,MAAM,CAAC,MASZ,CAAA"}
|
package/script/helpers/tracer.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tracer = void 0;
|
|
4
|
-
const tracer = (context,
|
|
5
|
-
context.
|
|
4
|
+
const tracer = (context, token, fn) => {
|
|
5
|
+
context.appendToStackTrail(token);
|
|
6
6
|
const result = fn();
|
|
7
|
-
context.
|
|
7
|
+
context.removeFromStackTrail(token);
|
|
8
8
|
return result;
|
|
9
9
|
};
|
|
10
10
|
exports.tracer = tracer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EACN,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GACzD,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,4BAG3B,qBAAqB,KACpB,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GACtC,
|
|
1
|
+
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EACN,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GACzD,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,4BAG3B,qBAAqB,KACpB,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GACtC,SAUH,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAChB,MAAM,EACN,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CACtD,CAAA;IACD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CASxE,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,UAAU,EACN,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,GACrE,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,sBAAsB,4BAGhC,0BAA0B,KACzB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAClD,SAMH,CAAA"}
|
|
@@ -15,7 +15,6 @@ const toParameterListV3 = ({ parameters, context }) => {
|
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
17
17
|
return parameters.map((parameter, index) => {
|
|
18
|
-
console.log('parameter index', index);
|
|
19
18
|
return (0, tracer_js_1.tracer)(context, `${index}`, () => toParameterV3({ parameter, context }));
|
|
20
19
|
});
|
|
21
20
|
};
|
|
@@ -131,6 +131,6 @@ const toOperations = ({ generator, oasDocument, operationsSettings }) => {
|
|
|
131
131
|
}, {});
|
|
132
132
|
};
|
|
133
133
|
const toOasDocument = ({ schema, spanId }) => {
|
|
134
|
-
const context = new CoreContext_js_1.CoreContext({ spanId
|
|
135
|
-
return context.parse();
|
|
134
|
+
const context = new CoreContext_js_1.CoreContext({ spanId });
|
|
135
|
+
return context.parse(schema);
|
|
136
136
|
};
|
|
@@ -29,11 +29,11 @@ const isOperationGeneratorKey = (arg) => {
|
|
|
29
29
|
if (typeof arg !== 'string') {
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
32
|
+
const keyTokens = arg.split('|');
|
|
33
|
+
if (keyTokens.length !== 3) {
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
|
-
const [generatorId, path, method] =
|
|
36
|
+
const [generatorId, path, method] = keyTokens;
|
|
37
37
|
if (typeof generatorId !== 'string' || !generatorId.length) {
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
@@ -50,11 +50,11 @@ const isModelGeneratorKey = (arg) => {
|
|
|
50
50
|
if (typeof arg !== 'string') {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
53
|
+
const keyTokens = arg.split('|');
|
|
54
|
+
if (keyTokens.length !== 2) {
|
|
55
55
|
return false;
|
|
56
56
|
}
|
|
57
|
-
const [generatorId, refName] =
|
|
57
|
+
const [generatorId, refName] = keyTokens;
|
|
58
58
|
if (typeof generatorId !== 'string' || !generatorId.length) {
|
|
59
59
|
return false;
|
|
60
60
|
}
|