@skmtc/core 0.0.418 → 0.0.420
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.map +1 -1
- package/esm/context/CoreContext.js +3 -5
- package/esm/context/GenerateContext.d.ts +0 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +9 -22
- package/esm/context/RenderContext.d.ts +1 -3
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +1 -9
- package/esm/dsl/File.d.ts +10 -7
- package/esm/dsl/File.d.ts.map +1 -1
- package/esm/dsl/File.js +18 -32
- package/esm/oas/string/String.d.ts +13 -2
- package/esm/oas/string/String.d.ts.map +1 -1
- package/esm/oas/string/String.js +20 -0
- package/esm/oas/string/string-types.d.ts +7 -2
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/string-types.js +27 -23
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +5 -1
- package/esm/types/Settings.d.ts +33 -5
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +6 -3
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +3 -5
- package/script/context/GenerateContext.d.ts +0 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +9 -22
- package/script/context/RenderContext.d.ts +1 -3
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +1 -9
- package/script/dsl/File.d.ts +10 -7
- package/script/dsl/File.d.ts.map +1 -1
- package/script/dsl/File.js +18 -32
- package/script/oas/string/String.d.ts +13 -2
- package/script/oas/string/String.d.ts.map +1 -1
- package/script/oas/string/String.js +20 -0
- package/script/oas/string/string-types.d.ts +7 -2
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/string-types.js +27 -23
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +5 -1
- package/script/types/Settings.d.ts +33 -5
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAGA,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,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAI7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AA8BhE,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;
|
|
1
|
+
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAGA,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,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAA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 @@ export class CoreContext {
|
|
|
53
53
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, schema), "f");
|
|
54
54
|
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
55
55
|
});
|
|
56
|
-
const { files
|
|
56
|
+
const { files } = this.trace('generate', () => {
|
|
57
57
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
58
58
|
generatorsMap,
|
|
59
59
|
oasDocument,
|
|
@@ -66,7 +66,6 @@ export class CoreContext {
|
|
|
66
66
|
const renderOutput = this.trace('render', () => {
|
|
67
67
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
68
68
|
files,
|
|
69
|
-
moduleImportMap,
|
|
70
69
|
pinnableGenerators: Object.values(generatorsMap)
|
|
71
70
|
.map(({ id, pinnable }) => (pinnable ? id : null))
|
|
72
71
|
.filter(generatorId => generatorId !== null),
|
|
@@ -160,7 +159,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
160
159
|
generatorsMap
|
|
161
160
|
});
|
|
162
161
|
return { type: 'generate', context: generateContext };
|
|
163
|
-
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators
|
|
162
|
+
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
164
163
|
const renderContext = new RenderContext({
|
|
165
164
|
files,
|
|
166
165
|
prettier,
|
|
@@ -168,8 +167,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
168
167
|
pinnableGenerators,
|
|
169
168
|
logger: this.logger,
|
|
170
169
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
171
|
-
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
172
|
-
moduleImportMap
|
|
170
|
+
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
173
171
|
});
|
|
174
172
|
return { type: 'render', context: renderContext };
|
|
175
173
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,KAAK,EAAyC,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAGtE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO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AAC,CAAC,GAAG,eAAe;IAmC9F;;;;;;;OAOG;IACH,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe;IAkFnE;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAUpE;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -9,7 +9,7 @@ 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,
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_setExportPath, _GenerateContext_toOperationBaseSettings, _GenerateContext_toModelBaseSettings, _GenerateContext_toGeneratorSettings, _GenerateContext_toGatewayBaseSettings, _GenerateContext_cleanBaseSettings, _GenerateContext_addFile;
|
|
13
13
|
import { join, normalize } from '../deps/jsr.io/@std/path/1.0.6/mod.js';
|
|
14
14
|
import { Import } from '../dsl/Import.js';
|
|
15
15
|
import { Definition } from '../dsl/Definition.js';
|
|
@@ -61,11 +61,9 @@ export class GenerateContext {
|
|
|
61
61
|
writable: true,
|
|
62
62
|
value: void 0
|
|
63
63
|
});
|
|
64
|
-
_GenerateContext_moduleImportMap.set(this, void 0);
|
|
65
64
|
_GenerateContext_stackTrail.set(this, void 0);
|
|
66
65
|
this.logger = logger;
|
|
67
66
|
__classPrivateFieldSet(this, _GenerateContext_files, new Map(), "f");
|
|
68
|
-
__classPrivateFieldSet(this, _GenerateContext_moduleImportMap, new Map(), "f");
|
|
69
67
|
this.oasDocument = oasDocument;
|
|
70
68
|
this.settings = settings;
|
|
71
69
|
this.callback = callback;
|
|
@@ -78,13 +76,6 @@ export class GenerateContext {
|
|
|
78
76
|
*/
|
|
79
77
|
generate() {
|
|
80
78
|
const generators = Object.values(this.generatorsMap);
|
|
81
|
-
generators.forEach(generator => {
|
|
82
|
-
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generator.id);
|
|
83
|
-
const { moduleName, exportPath } = generatorSettings?.baseSettings ?? {};
|
|
84
|
-
if (exportPath && moduleName && !__classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f").has(exportPath)) {
|
|
85
|
-
__classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f").set(exportPath, moduleName);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
79
|
Sentry.startSpan({ name: 'Generate operations' }, () => generators
|
|
89
80
|
.filter(generator => generator.type === 'operation')
|
|
90
81
|
.forEach(generator => {
|
|
@@ -102,8 +93,7 @@ export class GenerateContext {
|
|
|
102
93
|
});
|
|
103
94
|
});
|
|
104
95
|
return {
|
|
105
|
-
files: __classPrivateFieldGet(this, _GenerateContext_files, "f")
|
|
106
|
-
moduleImportMap: __classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f")
|
|
96
|
+
files: __classPrivateFieldGet(this, _GenerateContext_files, "f")
|
|
107
97
|
};
|
|
108
98
|
}
|
|
109
99
|
trace(token, fn) {
|
|
@@ -364,7 +354,7 @@ export class GenerateContext {
|
|
|
364
354
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_getFile).call(this, exportPath).definitions.get(name);
|
|
365
355
|
}
|
|
366
356
|
}
|
|
367
|
-
_GenerateContext_files = new WeakMap(),
|
|
357
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
368
358
|
if (generator._class === 'OperationGateway') {
|
|
369
359
|
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
370
360
|
const gatewayInstance = new generator({
|
|
@@ -475,22 +465,20 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_moduleImportMap = new W
|
|
|
475
465
|
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
476
466
|
? generatorSettings.operations[path]?.[method]
|
|
477
467
|
: undefined;
|
|
478
|
-
const { exportPath
|
|
468
|
+
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
479
469
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
480
470
|
...operationSettings,
|
|
481
|
-
parentExportPath: exportPath
|
|
482
|
-
moduleName
|
|
471
|
+
parentExportPath: exportPath
|
|
483
472
|
});
|
|
484
473
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
485
474
|
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
486
475
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
487
476
|
? generatorSettings.models[refName]
|
|
488
477
|
: undefined;
|
|
489
|
-
const { exportPath
|
|
478
|
+
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
490
479
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
491
480
|
...modelSettings,
|
|
492
|
-
parentExportPath: exportPath
|
|
493
|
-
moduleName
|
|
481
|
+
parentExportPath: exportPath
|
|
494
482
|
});
|
|
495
483
|
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
496
484
|
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
@@ -503,14 +491,13 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_moduleImportMap = new W
|
|
|
503
491
|
selected: Boolean(baseSettings?.selected),
|
|
504
492
|
name: baseSettings?.name,
|
|
505
493
|
importFrom: baseSettings?.importFrom,
|
|
506
|
-
parentExportPath: baseSettings?.parentExportPath
|
|
507
|
-
moduleName: baseSettings?.moduleName
|
|
494
|
+
parentExportPath: baseSettings?.parentExportPath
|
|
508
495
|
};
|
|
509
496
|
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
510
497
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
511
498
|
throw new Error(`File already exists: ${normalisedPath}`);
|
|
512
499
|
}
|
|
513
|
-
const newFile = new File(normalisedPath, this.settings);
|
|
500
|
+
const newFile = new File({ path: normalisedPath, settings: this.settings });
|
|
514
501
|
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
515
502
|
return newFile;
|
|
516
503
|
};
|
|
@@ -8,7 +8,6 @@ import type * as log from '../deps/jsr.io/@std/log/0.224.8/mod.js';
|
|
|
8
8
|
import type { File } from '../dsl/File.js';
|
|
9
9
|
type ConstructorArgs = {
|
|
10
10
|
files: Map<string, File>;
|
|
11
|
-
moduleImportMap: Map<string, string>;
|
|
12
11
|
prettier?: PrettierConfigType;
|
|
13
12
|
basePath: string | undefined;
|
|
14
13
|
pinnableGenerators: string[];
|
|
@@ -25,8 +24,7 @@ export declare class RenderContext {
|
|
|
25
24
|
pinnableGenerators: string[];
|
|
26
25
|
logger: log.Logger;
|
|
27
26
|
captureCurrentResult: (result: ResultType) => void;
|
|
28
|
-
|
|
29
|
-
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult, moduleImportMap }: ConstructorArgs);
|
|
27
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
30
28
|
render(): Omit<RenderResult, 'results'>;
|
|
31
29
|
private collate;
|
|
32
30
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
@@ -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;AAEpE,OAAO,KAAK,EAAE,mBAAmB,EAAqB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACxB,
|
|
1
|
+
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,mBAAmB,EAAqB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBA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|
|
@@ -16,7 +16,7 @@ import { normalize } from '../deps/jsr.io/@std/path/1.0.6/mod.js';
|
|
|
16
16
|
import { toResolvedArtifactPath } from '../helpers/toResolvedArtifactPath.js';
|
|
17
17
|
import { tracer } from '../helpers/tracer.js';
|
|
18
18
|
export class RenderContext {
|
|
19
|
-
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult
|
|
19
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }) {
|
|
20
20
|
Object.defineProperty(this, "files", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
configurable: true,
|
|
@@ -60,12 +60,6 @@ export class RenderContext {
|
|
|
60
60
|
writable: true,
|
|
61
61
|
value: void 0
|
|
62
62
|
});
|
|
63
|
-
Object.defineProperty(this, "moduleImportMap", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
configurable: true,
|
|
66
|
-
writable: true,
|
|
67
|
-
value: void 0
|
|
68
|
-
});
|
|
69
63
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
70
64
|
this.files = files;
|
|
71
65
|
this.prettier = prettier;
|
|
@@ -74,7 +68,6 @@ export class RenderContext {
|
|
|
74
68
|
this.logger = logger;
|
|
75
69
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
76
70
|
this.captureCurrentResult = captureCurrentResult;
|
|
77
|
-
this.moduleImportMap = moduleImportMap;
|
|
78
71
|
}
|
|
79
72
|
render() {
|
|
80
73
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -105,7 +98,6 @@ export class RenderContext {
|
|
|
105
98
|
// to Correct file
|
|
106
99
|
// @TODO: Could this be combined with the tracer call above?
|
|
107
100
|
this.currentDestinationPath = destinationPath;
|
|
108
|
-
file.moduleImportMap = this.moduleImportMap;
|
|
109
101
|
const renderedFile = renderFile({
|
|
110
102
|
content: file.toString(),
|
|
111
103
|
generatorKeys: Array.from(file.generatorKeys).filter(Boolean),
|
package/esm/dsl/File.d.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import type { Definition } from './Definition.js';
|
|
2
2
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
3
|
-
import type { ClientSettings } from '../types/Settings.js';
|
|
3
|
+
import type { ClientSettings, ModulePackage } from '../types/Settings.js';
|
|
4
|
+
type FileArgs = {
|
|
5
|
+
path: string;
|
|
6
|
+
settings: ClientSettings | undefined;
|
|
7
|
+
};
|
|
4
8
|
export declare class File {
|
|
5
9
|
#private;
|
|
6
10
|
path: string;
|
|
7
11
|
reExports: Map<string, Record<string, Set<string>>>;
|
|
8
12
|
imports: Map<string, Set<string>>;
|
|
9
13
|
definitions: Map<string, Definition>;
|
|
10
|
-
|
|
11
|
-
settings:
|
|
12
|
-
constructor(path: string, settings: ClientSettings | undefined);
|
|
14
|
+
packages: ModulePackage[] | undefined;
|
|
15
|
+
constructor({ path, settings }: FileArgs);
|
|
13
16
|
get generatorKeys(): Set<GeneratorKey>;
|
|
14
17
|
toString(): string;
|
|
15
18
|
}
|
|
16
19
|
export type NormaliseModuleNameArgs = {
|
|
17
20
|
destinationPath: string;
|
|
18
|
-
moduleImportMap: Map<string, string>;
|
|
19
21
|
exportPath: string;
|
|
20
|
-
|
|
22
|
+
packages: ModulePackage[] | undefined;
|
|
21
23
|
};
|
|
22
|
-
export declare const normaliseModuleName: ({ destinationPath,
|
|
24
|
+
export declare const normaliseModuleName: ({ destinationPath, exportPath, packages }: NormaliseModuleNameArgs) => string;
|
|
25
|
+
export {};
|
|
23
26
|
//# sourceMappingURL=File.d.ts.map
|
package/esm/dsl/File.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../../src/dsl/File.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzE,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;CACrC,CAAA;AAED,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAEpC,QAAQ,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;gBAEzB,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ;IASxC,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAkCT;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,aAAa,EAAE,GAAG,SAAS,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,mBAAmB,8CAI7B,uBAAuB,WAYzB,CAAA"}
|
package/esm/dsl/File.js
CHANGED
|
@@ -12,7 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _File_generatorKeys;
|
|
13
13
|
import { Import } from './Import.js';
|
|
14
14
|
export class File {
|
|
15
|
-
constructor(path, settings) {
|
|
15
|
+
constructor({ path, settings }) {
|
|
16
16
|
Object.defineProperty(this, "path", {
|
|
17
17
|
enumerable: true,
|
|
18
18
|
configurable: true,
|
|
@@ -37,14 +37,8 @@ export class File {
|
|
|
37
37
|
writable: true,
|
|
38
38
|
value: void 0
|
|
39
39
|
});
|
|
40
|
-
Object.defineProperty(this, "moduleImportMap", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
configurable: true,
|
|
43
|
-
writable: true,
|
|
44
|
-
value: void 0
|
|
45
|
-
});
|
|
46
40
|
_File_generatorKeys.set(this, void 0);
|
|
47
|
-
Object.defineProperty(this, "
|
|
41
|
+
Object.defineProperty(this, "packages", {
|
|
48
42
|
enumerable: true,
|
|
49
43
|
configurable: true,
|
|
50
44
|
writable: true,
|
|
@@ -55,8 +49,7 @@ export class File {
|
|
|
55
49
|
this.imports = new Map();
|
|
56
50
|
this.definitions = new Map();
|
|
57
51
|
__classPrivateFieldSet(this, _File_generatorKeys, new Set(), "f");
|
|
58
|
-
this.
|
|
59
|
-
this.settings = settings;
|
|
52
|
+
this.packages = settings?.packages;
|
|
60
53
|
}
|
|
61
54
|
get generatorKeys() {
|
|
62
55
|
return __classPrivateFieldGet(this, _File_generatorKeys, "f");
|
|
@@ -65,9 +58,8 @@ export class File {
|
|
|
65
58
|
const reExports = Array.from(this.reExports.entries()).flatMap(([module, entityTypes]) => {
|
|
66
59
|
const updatedModuleName = normaliseModuleName({
|
|
67
60
|
destinationPath: this.path,
|
|
68
|
-
moduleImportMap: this.moduleImportMap,
|
|
69
61
|
exportPath: module,
|
|
70
|
-
|
|
62
|
+
packages: this.packages
|
|
71
63
|
});
|
|
72
64
|
return Object.entries(entityTypes).map(([entityType, names]) => {
|
|
73
65
|
const prefix = entityType === 'type' ? 'type' : '';
|
|
@@ -75,12 +67,13 @@ export class File {
|
|
|
75
67
|
});
|
|
76
68
|
});
|
|
77
69
|
const imports = Array.from(this.imports.entries()).map(([module, importItems]) => {
|
|
78
|
-
const updatedModuleName =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
const updatedModuleName = this.packages
|
|
71
|
+
? normaliseModuleName({
|
|
72
|
+
destinationPath: this.path,
|
|
73
|
+
exportPath: module,
|
|
74
|
+
packages: this.packages
|
|
75
|
+
})
|
|
76
|
+
: module;
|
|
84
77
|
return new Import({ module: updatedModuleName, importNames: Array.from(importItems) });
|
|
85
78
|
});
|
|
86
79
|
const definitions = Array.from(this.definitions.values());
|
|
@@ -91,20 +84,13 @@ export class File {
|
|
|
91
84
|
}
|
|
92
85
|
}
|
|
93
86
|
_File_generatorKeys = new WeakMap();
|
|
94
|
-
export const normaliseModuleName = ({ destinationPath,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
102
|
-
// If exportPath does not match any module imports, return the original exportPath
|
|
103
|
-
if (!matchedModuleImport) {
|
|
87
|
+
export const normaliseModuleName = ({ destinationPath, exportPath, packages = [] }) => {
|
|
88
|
+
const matchingModule = packages.find(packageModule => {
|
|
89
|
+
return exportPath.startsWith(packageModule.rootPath);
|
|
90
|
+
});
|
|
91
|
+
if (!matchingModule) {
|
|
104
92
|
return exportPath;
|
|
105
93
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
// Otherwise, if module import is imported from outside module, use module name
|
|
109
|
-
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
94
|
+
const { rootPath, moduleName } = matchingModule;
|
|
95
|
+
return destinationPath.startsWith(rootPath) ? exportPath.replace(rootPath, '@') : moduleName;
|
|
110
96
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { OasRef } from '../ref/Ref.js';
|
|
2
|
+
import type { StringFormat } from './string-types.js';
|
|
2
3
|
export type StringFields = {
|
|
3
4
|
title?: string;
|
|
4
5
|
description?: string;
|
|
5
|
-
format?:
|
|
6
|
+
format?: StringFormat;
|
|
6
7
|
enums?: string[];
|
|
8
|
+
maxLength?: number;
|
|
9
|
+
minLength?: number;
|
|
7
10
|
nullable?: boolean;
|
|
8
11
|
extensionFields?: Record<string, unknown>;
|
|
9
12
|
example?: string;
|
|
@@ -32,11 +35,19 @@ export declare class OasString {
|
|
|
32
35
|
/**
|
|
33
36
|
* The format of the string.
|
|
34
37
|
*/
|
|
35
|
-
format:
|
|
38
|
+
format: StringFormat | undefined;
|
|
36
39
|
/**
|
|
37
40
|
* An array of allowed values for the string.
|
|
38
41
|
*/
|
|
39
42
|
enums: string[] | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The maximum length of the string.
|
|
45
|
+
*/
|
|
46
|
+
maxLength: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* The minimum length of the string.
|
|
49
|
+
*/
|
|
50
|
+
minLength: number | undefined;
|
|
40
51
|
/**
|
|
41
52
|
* Indicates whether value can be null.
|
|
42
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../../../src/oas/string/String.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,YAAY,CAAA;IAErB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB;;;OAGG;IACH,OAAO,WAAoB;IAC3B;;OAEG;IACH,IAAI,WAAoB;IACxB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;OAEG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,gCAAgC;IAChC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;gBAEf,MAAM,EAAE,YAAY;IAgBhC,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;CAGzB"}
|
package/esm/oas/string/String.js
CHANGED
|
@@ -58,6 +58,24 @@ export class OasString {
|
|
|
58
58
|
writable: true,
|
|
59
59
|
value: void 0
|
|
60
60
|
});
|
|
61
|
+
/**
|
|
62
|
+
* The maximum length of the string.
|
|
63
|
+
*/
|
|
64
|
+
Object.defineProperty(this, "maxLength", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* The minimum length of the string.
|
|
72
|
+
*/
|
|
73
|
+
Object.defineProperty(this, "minLength", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
writable: true,
|
|
77
|
+
value: void 0
|
|
78
|
+
});
|
|
61
79
|
/**
|
|
62
80
|
* Indicates whether value can be null.
|
|
63
81
|
*/
|
|
@@ -88,6 +106,8 @@ export class OasString {
|
|
|
88
106
|
this.nullable = fields.nullable;
|
|
89
107
|
this.extensionFields = fields.extensionFields;
|
|
90
108
|
this.example = fields.example;
|
|
109
|
+
this.maxLength = fields.maxLength;
|
|
110
|
+
this.minLength = fields.minLength;
|
|
91
111
|
}
|
|
92
112
|
// get pattern() {
|
|
93
113
|
// return this.fields.pattern
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const oasStringData: z.ZodType<OasStringData>;
|
|
3
|
+
export type StringFormat = 'date-time' | 'time' | 'date' | 'duration' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uuid' | 'uri' | 'regex' | 'password';
|
|
3
4
|
export type OasStringData = {
|
|
4
5
|
oasType: 'schema';
|
|
5
6
|
title?: string;
|
|
6
7
|
description?: string;
|
|
7
8
|
default?: string;
|
|
8
9
|
type: 'string';
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
minLength?: number;
|
|
9
12
|
pattern?: string;
|
|
10
|
-
|
|
11
|
-
format?:
|
|
13
|
+
enum?: string[];
|
|
14
|
+
format?: StringFormat;
|
|
15
|
+
nullable?: boolean;
|
|
16
|
+
example?: string;
|
|
12
17
|
};
|
|
13
18
|
//# sourceMappingURL=string-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"string-types.d.ts","sourceRoot":"","sources":["../../../src/oas/string/string-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmBvB,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAenC,CAAA;AAEhB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,KAAK,GACL,OAAO,GACP,UAAU,CAAA;AAId,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,QAAQ,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
2
|
+
const stringFormat = z.enum([
|
|
3
|
+
'date-time',
|
|
4
|
+
'time',
|
|
5
|
+
'date',
|
|
6
|
+
'duration',
|
|
7
|
+
'email',
|
|
8
|
+
'hostname',
|
|
9
|
+
'ipv4',
|
|
10
|
+
'ipv6',
|
|
11
|
+
'uuid',
|
|
12
|
+
'uri',
|
|
13
|
+
'regex',
|
|
14
|
+
'password'
|
|
15
|
+
// 'byte',
|
|
16
|
+
// 'binary'
|
|
17
|
+
]);
|
|
18
|
+
export const oasStringData = z
|
|
19
|
+
.object({
|
|
3
20
|
oasType: z.literal('schema'),
|
|
21
|
+
type: z.literal('string'),
|
|
4
22
|
title: z.string().optional(),
|
|
5
23
|
description: z.string().optional(),
|
|
6
24
|
default: z.string().optional(),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// maxLength: z.number().optional(),
|
|
10
|
-
// minLength: z.number().optional(),
|
|
25
|
+
maxLength: z.number().optional(),
|
|
26
|
+
minLength: z.number().optional(),
|
|
11
27
|
pattern: z.string().optional(),
|
|
12
|
-
|
|
13
|
-
format:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'duration',
|
|
19
|
-
'email',
|
|
20
|
-
'hostname',
|
|
21
|
-
'ipv4',
|
|
22
|
-
'ipv6',
|
|
23
|
-
'uuid',
|
|
24
|
-
'uri',
|
|
25
|
-
'regex',
|
|
26
|
-
'binary'
|
|
27
|
-
])
|
|
28
|
-
.optional()
|
|
29
|
-
});
|
|
28
|
+
enum: z.array(z.string()).optional(),
|
|
29
|
+
format: stringFormat.optional(),
|
|
30
|
+
nullable: z.boolean().optional(),
|
|
31
|
+
example: z.string().optional()
|
|
32
|
+
})
|
|
33
|
+
.passthrough();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"toString.d.ts","sourceRoot":"","sources":["../../../src/oas/string/toString.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,oBAAoB,CAAA;IACrC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,uBAAwB,YAAY,KAAG,SA2B3D,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OasString } from './String.js';
|
|
2
2
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
import { oasStringData } from './string-types.js';
|
|
3
4
|
export const toString = ({ value, context }) => {
|
|
4
|
-
const { type: _type, title, description, enum: enums, nullable, example, ...skipped } = value;
|
|
5
|
+
const { type: _type, title, description, enum: enums, nullable, example, format, maxLength, minLength, ...skipped } = oasStringData.parse(value);
|
|
5
6
|
const extensionFields = toSpecificationExtensionsV3({ skipped, context });
|
|
6
7
|
return new OasString({
|
|
7
8
|
title,
|
|
@@ -9,6 +10,9 @@ export const toString = ({ value, context }) => {
|
|
|
9
10
|
enums,
|
|
10
11
|
nullable,
|
|
11
12
|
example,
|
|
13
|
+
format,
|
|
14
|
+
maxLength,
|
|
15
|
+
minLength,
|
|
12
16
|
extensionFields
|
|
13
17
|
});
|
|
14
18
|
};
|