@skmtc/core 0.0.391 → 0.0.393
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 +10 -6
- package/esm/context/GenerateContext.d.ts +12 -2
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +57 -19
- package/esm/context/RenderContext.d.ts +3 -1
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +9 -1
- package/esm/dsl/File.d.ts +1 -0
- package/esm/dsl/File.d.ts.map +1 -1
- package/esm/dsl/File.js +26 -1
- package/esm/dsl/model/toModelGateway.d.ts +6 -0
- package/esm/dsl/model/toModelGateway.d.ts.map +1 -1
- package/esm/types/Settings.d.ts +1 -0
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +2 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +10 -6
- package/script/context/GenerateContext.d.ts +12 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +57 -19
- package/script/context/RenderContext.d.ts +3 -1
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +9 -1
- package/script/dsl/File.d.ts +1 -0
- package/script/dsl/File.d.ts.map +1 -1
- package/script/dsl/File.js +26 -1
- package/script/dsl/model/toModelGateway.d.ts +6 -0
- package/script/dsl/model/toModelGateway.d.ts.map +1 -1
- package/script/types/Settings.d.ts +1 -0
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +2 -1
|
@@ -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,6B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AAG,SAAS,CAAA;IACpC,aAAa,EAAE,MAAM,CACnB,MAAM,EACJ,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,CAAC,cAAc,CAAC,GACnC,eAAe,CAAC,cAAc,CAAC,CAClC,CAAA;IACD,QAAQ,CAAC,EAAE,kBAAkB,CAAA;CAC9B,CAAA;AAOD,qBAAa,WAAW;;IACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;gBAKN,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,eAAe;IAiDjD,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW;IAMlC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,aAAa;;;;;;IAqEtE,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAiClD,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;CAwB/C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAQnF"}
|
|
@@ -53,18 +53,20 @@ 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 = this.trace('generate', () => {
|
|
56
|
+
const { files, moduleImportMap } = this.trace('generate', () => {
|
|
57
57
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
58
|
+
generatorsMap,
|
|
58
59
|
oasDocument,
|
|
59
60
|
settings,
|
|
60
61
|
callback
|
|
61
62
|
}), "f");
|
|
62
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate(
|
|
63
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate();
|
|
63
64
|
});
|
|
64
65
|
this.logger.debug(`${files.size} files generated`);
|
|
65
66
|
const renderOutput = this.trace('render', () => {
|
|
66
67
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
67
68
|
files,
|
|
69
|
+
moduleImportMap,
|
|
68
70
|
pinnableGenerators: Object.values(generatorsMap)
|
|
69
71
|
.map(({ id, pinnable }) => (pinnable ? id : null))
|
|
70
72
|
.filter(generatorId => generatorId !== null),
|
|
@@ -147,17 +149,18 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
147
149
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f")
|
|
148
150
|
});
|
|
149
151
|
return { type: 'parse', context: parseContext };
|
|
150
|
-
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ oasDocument, settings, callback }) {
|
|
152
|
+
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ oasDocument, settings, callback, generatorsMap }) {
|
|
151
153
|
const generateContext = new GenerateContext({
|
|
152
154
|
oasDocument,
|
|
153
155
|
settings,
|
|
154
156
|
logger: this.logger,
|
|
155
157
|
callback,
|
|
156
158
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
157
|
-
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
159
|
+
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
160
|
+
generatorsMap
|
|
158
161
|
});
|
|
159
162
|
return { type: 'generate', context: generateContext };
|
|
160
|
-
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
163
|
+
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators, moduleImportMap }) {
|
|
161
164
|
const renderContext = new RenderContext({
|
|
162
165
|
files,
|
|
163
166
|
prettier,
|
|
@@ -165,7 +168,8 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
165
168
|
pinnableGenerators,
|
|
166
169
|
logger: this.logger,
|
|
167
170
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
168
|
-
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
171
|
+
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
172
|
+
moduleImportMap
|
|
169
173
|
});
|
|
170
174
|
return { type: 'render', context: renderContext };
|
|
171
175
|
};
|
|
@@ -26,11 +26,16 @@ type ConstructorArgs = {
|
|
|
26
26
|
callback: (generatorKey: GeneratorKey) => void;
|
|
27
27
|
stackTrail: StackTrail;
|
|
28
28
|
captureCurrentResult: (result: ResultType) => void;
|
|
29
|
+
generatorsMap: Record<string, OperationGateway | ModelGateway | OperationInsertable<GeneratedValue> | ModelInsertable<GeneratedValue>>;
|
|
29
30
|
};
|
|
30
31
|
export type PickArgs = {
|
|
31
32
|
name: string;
|
|
32
33
|
exportPath: string;
|
|
33
34
|
};
|
|
35
|
+
export type ApplyPackageImportsArgs = {
|
|
36
|
+
destinationPath: string;
|
|
37
|
+
exportPath: string;
|
|
38
|
+
};
|
|
34
39
|
export type RegisterArgs = {
|
|
35
40
|
imports?: Record<string, ImportNameArg[]>;
|
|
36
41
|
definitions?: (Definition | undefined)[];
|
|
@@ -82,6 +87,10 @@ type BuildModelSettingsArgs<V> = {
|
|
|
82
87
|
refName: RefName;
|
|
83
88
|
insertable: ModelInsertable<V>;
|
|
84
89
|
};
|
|
90
|
+
type GenerateResult = {
|
|
91
|
+
files: Map<string, File>;
|
|
92
|
+
moduleImportMap: Map<string, string>;
|
|
93
|
+
};
|
|
85
94
|
export declare class GenerateContext {
|
|
86
95
|
#private;
|
|
87
96
|
oasDocument: OasDocument;
|
|
@@ -89,11 +98,12 @@ export declare class GenerateContext {
|
|
|
89
98
|
logger: log.Logger;
|
|
90
99
|
callback: (generatorKey: GeneratorKey) => void;
|
|
91
100
|
captureCurrentResult: (result: ResultType) => void;
|
|
92
|
-
|
|
101
|
+
generatorsMap: Record<string, OperationGateway | ModelGateway | OperationInsertable<GeneratedValue> | ModelInsertable<GeneratedValue>>;
|
|
102
|
+
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail, generatorsMap }: ConstructorArgs);
|
|
93
103
|
/**
|
|
94
104
|
* @internal
|
|
95
105
|
*/
|
|
96
|
-
generate(
|
|
106
|
+
generate(): GenerateResult;
|
|
97
107
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
98
108
|
/**
|
|
99
109
|
* Converts schema to value using `schemaToValueFn` and creates definition
|
|
@@ -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,
|
|
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,EA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S,cAAc,EAAE,EAClE,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EAChB,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAY7C;;;;;;;;;;;;;OAaG;IAEH,WAAW,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,EAC9D,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EAChB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAYzC;;;;;;;;;OASG;IACH,0BAA0B,CAAC,CAAC,EAAE,EAC5B,SAAS,EACT,UAAU,EACX,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,eAAe;IAmB/C;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,eAAe;IAgC9F;;;;;;;OAOG;IACH,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,GAAG,eAAe;IAoFlF;;;;;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, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile,
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_moduleImportMap, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_applyPackageImports, _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';
|
|
@@ -21,7 +21,7 @@ import { tracer } from '../helpers/tracer.js';
|
|
|
21
21
|
import { Inserted } from '../dsl/Inserted.js';
|
|
22
22
|
import { File } from '../dsl/File.js';
|
|
23
23
|
export class GenerateContext {
|
|
24
|
-
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail }) {
|
|
24
|
+
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail, generatorsMap }) {
|
|
25
25
|
_GenerateContext_instances.add(this);
|
|
26
26
|
_GenerateContext_files.set(this, void 0);
|
|
27
27
|
Object.defineProperty(this, "oasDocument", {
|
|
@@ -54,20 +54,37 @@ export class GenerateContext {
|
|
|
54
54
|
writable: true,
|
|
55
55
|
value: void 0
|
|
56
56
|
});
|
|
57
|
+
Object.defineProperty(this, "generatorsMap", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: void 0
|
|
62
|
+
});
|
|
63
|
+
_GenerateContext_moduleImportMap.set(this, void 0);
|
|
57
64
|
_GenerateContext_stackTrail.set(this, void 0);
|
|
58
65
|
this.logger = logger;
|
|
59
66
|
__classPrivateFieldSet(this, _GenerateContext_files, new Map(), "f");
|
|
67
|
+
__classPrivateFieldSet(this, _GenerateContext_moduleImportMap, new Map(), "f");
|
|
60
68
|
this.oasDocument = oasDocument;
|
|
61
69
|
this.settings = settings;
|
|
62
70
|
this.callback = callback;
|
|
63
71
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
64
72
|
this.captureCurrentResult = captureCurrentResult;
|
|
73
|
+
this.generatorsMap = generatorsMap;
|
|
65
74
|
}
|
|
66
75
|
/**
|
|
67
76
|
* @internal
|
|
68
77
|
*/
|
|
69
|
-
generate(
|
|
70
|
-
|
|
78
|
+
generate() {
|
|
79
|
+
const generators = Object.values(this.generatorsMap);
|
|
80
|
+
generators.forEach(generator => {
|
|
81
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generator.id);
|
|
82
|
+
const { moduleName, exportPath } = generatorSettings?.baseSettings ?? {};
|
|
83
|
+
if (exportPath && moduleName && !__classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f").has(exportPath)) {
|
|
84
|
+
__classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f").set(exportPath, moduleName);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Sentry.startSpan({ name: 'Generate operations' }, () => generators
|
|
71
88
|
.filter(generator => generator.type === 'operation')
|
|
72
89
|
.forEach(generator => {
|
|
73
90
|
this.trace(generator.id, () => {
|
|
@@ -75,7 +92,7 @@ export class GenerateContext {
|
|
|
75
92
|
});
|
|
76
93
|
}));
|
|
77
94
|
Sentry.startSpan({ name: 'Generate models' }, () => {
|
|
78
|
-
|
|
95
|
+
generators
|
|
79
96
|
.filter(generator => generator.type === 'model')
|
|
80
97
|
.forEach(generator => {
|
|
81
98
|
this.trace(generator.id, () => {
|
|
@@ -83,7 +100,10 @@ export class GenerateContext {
|
|
|
83
100
|
});
|
|
84
101
|
});
|
|
85
102
|
});
|
|
86
|
-
return
|
|
103
|
+
return {
|
|
104
|
+
files: __classPrivateFieldGet(this, _GenerateContext_files, "f"),
|
|
105
|
+
moduleImportMap: __classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f")
|
|
106
|
+
};
|
|
87
107
|
}
|
|
88
108
|
trace(token, fn) {
|
|
89
109
|
return tracer(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), token, fn);
|
|
@@ -252,7 +272,8 @@ export class GenerateContext {
|
|
|
252
272
|
path: operation.path,
|
|
253
273
|
method: operation.method
|
|
254
274
|
});
|
|
255
|
-
const
|
|
275
|
+
const generatedExportPath = insertable.toExportPath({ operation, baseSettings });
|
|
276
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
256
277
|
return new ContentSettings({
|
|
257
278
|
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
258
279
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
@@ -274,7 +295,8 @@ export class GenerateContext {
|
|
|
274
295
|
generatorId: insertable.id,
|
|
275
296
|
refName
|
|
276
297
|
});
|
|
277
|
-
const
|
|
298
|
+
const generatedExportPath = insertable.toExportPath({ refName, baseSettings });
|
|
299
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
278
300
|
return new ContentSettings({
|
|
279
301
|
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
280
302
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
@@ -324,7 +346,7 @@ export class GenerateContext {
|
|
|
324
346
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_getFile).call(this, exportPath).definitions.get(name);
|
|
325
347
|
}
|
|
326
348
|
}
|
|
327
|
-
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
349
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_moduleImportMap = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
328
350
|
if (generator._class === 'OperationGateway') {
|
|
329
351
|
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
330
352
|
const gatewayInstance = new generator({
|
|
@@ -454,34 +476,50 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
454
476
|
}
|
|
455
477
|
}
|
|
456
478
|
return currentFile;
|
|
479
|
+
}, _GenerateContext_applyPackageImports = function _GenerateContext_applyPackageImports() { }, _GenerateContext_setExportPath = function _GenerateContext_setExportPath({ generatedExportPath, baseSettings }) {
|
|
480
|
+
const { parentExportPath, exportPath } = baseSettings;
|
|
481
|
+
if (exportPath) {
|
|
482
|
+
return join(parentExportPath ?? '', exportPath);
|
|
483
|
+
}
|
|
484
|
+
if (generatedExportPath.startsWith('@/')) {
|
|
485
|
+
return generatedExportPath;
|
|
486
|
+
}
|
|
487
|
+
return join(parentExportPath ?? '', generatedExportPath);
|
|
457
488
|
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
458
|
-
const generatorSettings = this
|
|
489
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
459
490
|
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
460
|
-
? generatorSettings.operations
|
|
491
|
+
? generatorSettings.operations[path]?.[method]
|
|
461
492
|
: undefined;
|
|
493
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
462
494
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
463
495
|
...operationSettings,
|
|
464
|
-
parentExportPath
|
|
496
|
+
parentExportPath,
|
|
497
|
+
moduleName
|
|
465
498
|
});
|
|
466
|
-
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
467
|
-
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
468
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
469
499
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
470
|
-
const generatorSettings = this
|
|
500
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
471
501
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
472
|
-
? generatorSettings
|
|
502
|
+
? generatorSettings.models[refName]
|
|
473
503
|
: undefined;
|
|
504
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
474
505
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
475
506
|
...modelSettings,
|
|
476
|
-
parentExportPath
|
|
507
|
+
parentExportPath,
|
|
508
|
+
moduleName
|
|
477
509
|
});
|
|
510
|
+
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
511
|
+
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
512
|
+
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
513
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
514
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
478
515
|
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
479
516
|
return {
|
|
480
517
|
exportPath: baseSettings?.exportPath,
|
|
481
518
|
selected: Boolean(baseSettings?.selected),
|
|
482
519
|
name: baseSettings?.name,
|
|
483
520
|
importFrom: baseSettings?.importFrom,
|
|
484
|
-
parentExportPath: baseSettings?.parentExportPath
|
|
521
|
+
parentExportPath: baseSettings?.parentExportPath,
|
|
522
|
+
moduleName: baseSettings?.moduleName
|
|
485
523
|
};
|
|
486
524
|
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
487
525
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
@@ -8,6 +8,7 @@ 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>;
|
|
11
12
|
prettier?: PrettierConfigType;
|
|
12
13
|
basePath: string | undefined;
|
|
13
14
|
pinnableGenerators: string[];
|
|
@@ -24,7 +25,8 @@ export declare class RenderContext {
|
|
|
24
25
|
pinnableGenerators: string[];
|
|
25
26
|
logger: log.Logger;
|
|
26
27
|
captureCurrentResult: (result: ResultType) => void;
|
|
27
|
-
|
|
28
|
+
moduleImportMap: Map<string, string>;
|
|
29
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult, moduleImportMap }: ConstructorArgs);
|
|
28
30
|
render(): Omit<RenderResult, 'results'>;
|
|
29
31
|
private collate;
|
|
30
32
|
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,EAA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,EACR,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,oBAAoB,EACpB,eAAe,EAChB,EAAE,eAAe;IAYlB,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAuBvC,OAAO,CAAC,OAAO;IAsDf,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAIlD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU/B,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;IAarD,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -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, moduleImportMap }) {
|
|
20
20
|
Object.defineProperty(this, "files", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
configurable: true,
|
|
@@ -60,6 +60,12 @@ 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
|
+
});
|
|
63
69
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
64
70
|
this.files = files;
|
|
65
71
|
this.prettier = prettier;
|
|
@@ -68,6 +74,7 @@ export class RenderContext {
|
|
|
68
74
|
this.logger = logger;
|
|
69
75
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
70
76
|
this.captureCurrentResult = captureCurrentResult;
|
|
77
|
+
this.moduleImportMap = moduleImportMap;
|
|
71
78
|
}
|
|
72
79
|
render() {
|
|
73
80
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -98,6 +105,7 @@ export class RenderContext {
|
|
|
98
105
|
// to Correct file
|
|
99
106
|
// @TODO: Could this be combined with the tracer call above?
|
|
100
107
|
this.currentDestinationPath = destinationPath;
|
|
108
|
+
file.moduleImportMap = this.moduleImportMap;
|
|
101
109
|
const renderedFile = renderFile({
|
|
102
110
|
content: file.toString(),
|
|
103
111
|
generatorKeys: Array.from(file.generatorKeys).filter(Boolean),
|
package/esm/dsl/File.d.ts
CHANGED
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;AAE7D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;gBAGxB,IAAI,EAAE,MAAM;
|
|
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;AAE7D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAGxB,IAAI,EAAE,MAAM;IAQxB,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAkBT"}
|
package/esm/dsl/File.js
CHANGED
|
@@ -31,17 +31,31 @@ export class File {
|
|
|
31
31
|
writable: true,
|
|
32
32
|
value: void 0
|
|
33
33
|
});
|
|
34
|
+
Object.defineProperty(this, "moduleImportMap", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
34
40
|
_File_generatorKeys.set(this, void 0);
|
|
35
41
|
this.path = path;
|
|
36
42
|
this.imports = new Map();
|
|
37
43
|
this.definitions = new Map();
|
|
38
44
|
__classPrivateFieldSet(this, _File_generatorKeys, new Set(), "f");
|
|
45
|
+
this.moduleImportMap = new Map();
|
|
39
46
|
}
|
|
40
47
|
get generatorKeys() {
|
|
41
48
|
return __classPrivateFieldGet(this, _File_generatorKeys, "f");
|
|
42
49
|
}
|
|
43
50
|
toString() {
|
|
44
|
-
const imports = Array.from(this.imports.entries()).map(([module, importItems]) =>
|
|
51
|
+
const imports = Array.from(this.imports.entries()).map(([module, importItems]) => {
|
|
52
|
+
const updatedModuleName = updateModuleName({
|
|
53
|
+
destinationPath: this.path,
|
|
54
|
+
moduleImportMap: this.moduleImportMap,
|
|
55
|
+
exportPath: module
|
|
56
|
+
});
|
|
57
|
+
return new Import({ module: updatedModuleName, importNames: Array.from(importItems) });
|
|
58
|
+
});
|
|
45
59
|
const definitions = Array.from(this.definitions.values());
|
|
46
60
|
return [imports, definitions]
|
|
47
61
|
.filter(section => Boolean(section.length))
|
|
@@ -50,3 +64,14 @@ export class File {
|
|
|
50
64
|
}
|
|
51
65
|
}
|
|
52
66
|
_File_generatorKeys = new WeakMap();
|
|
67
|
+
const updateModuleName = ({ destinationPath, moduleImportMap, exportPath }) => {
|
|
68
|
+
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
69
|
+
if (!matchedModuleImport) {
|
|
70
|
+
return exportPath;
|
|
71
|
+
}
|
|
72
|
+
const [matchedPath, moduleName] = matchedModuleImport;
|
|
73
|
+
if (destinationPath.startsWith(matchedPath)) {
|
|
74
|
+
return exportPath.replace(matchedPath, moduleName);
|
|
75
|
+
}
|
|
76
|
+
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
77
|
+
};
|
|
@@ -2,10 +2,15 @@ import { type GatewayConstructorArgs } from '../GatewayBase.js';
|
|
|
2
2
|
import type { Identifier } from '../Identifier.js';
|
|
3
3
|
import type { BaseSettings } from '../../types/Settings.js';
|
|
4
4
|
import type { IsModelSelectedArgs } from './ModelInsertable.js';
|
|
5
|
+
type ToPackageImportArgs = {
|
|
6
|
+
destinationPath: string;
|
|
7
|
+
exportPath: string;
|
|
8
|
+
};
|
|
5
9
|
export type ToModelGatewayArgs = {
|
|
6
10
|
id: string;
|
|
7
11
|
toIdentifier: (baseSettings: BaseSettings) => Identifier;
|
|
8
12
|
toExportPath: (baseSettings: BaseSettings) => string;
|
|
13
|
+
toPackageImport?: ({ destinationPath, exportPath }: ToPackageImportArgs) => string;
|
|
9
14
|
isGeneratorSelected?: (baseSettings: BaseSettings) => boolean;
|
|
10
15
|
isModelSelected?: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
11
16
|
};
|
|
@@ -27,4 +32,5 @@ export declare const toModelGateway: (config: ToModelGatewayArgs) => {
|
|
|
27
32
|
isSupported: () => boolean;
|
|
28
33
|
pinnable: boolean;
|
|
29
34
|
};
|
|
35
|
+
export {};
|
|
30
36
|
//# sourceMappingURL=toModelGateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toModelGateway.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelGateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAe,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,UAAU,CAAA;IACxD,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"toModelGateway.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelGateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAe,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,UAAU,CAAA;IACxD,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,MAAM,CAAA;IACpD,eAAe,CAAC,EAAE,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,mBAAmB,KAAK,MAAM,CAAA;IAElF,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAA;IAC7D,eAAe,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;CAC9E,CAAA;AAED,eAAO,MAAM,cAAc,WAAY,kBAAkB;gCAelB,sBAAsB;;;;;;;;;;iCAvB9B,YAAY,KAAK,UAAU;iCAC3B,YAAY,KAAK,MAAM;wCAGf,YAAY,KAAK,OAAO;iDACf,mBAAmB,KAAK,OAAO;;;CAwB9E,CAAA"}
|
package/esm/types/Settings.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAO/C,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,mBAAmB,GA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iB,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAKzD,CAAA;AAEF,eAAO,MAAM,aAAa,mCAAiC,CAAA;AAE3D,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,OAAO,CAAA;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA"}
|
package/esm/types/Settings.js
CHANGED
|
@@ -6,7 +6,8 @@ export const baseSettings = z.object({
|
|
|
6
6
|
name: z.string().optional(),
|
|
7
7
|
importFrom: z.string().optional(),
|
|
8
8
|
exportPath: z.string().optional(),
|
|
9
|
-
parentExportPath: z.string().optional()
|
|
9
|
+
parentExportPath: z.string().optional(),
|
|
10
|
+
moduleName: z.string().optional()
|
|
10
11
|
});
|
|
11
12
|
export const operationsGeneratorSettings = z.object({
|
|
12
13
|
id: z.string(),
|
package/package.json
CHANGED
|
@@ -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,YAAY,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACpF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAG7D,OAAO,KAAK,EAAE,Y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AAM,EAAE,MAAM,GAAG,WAAW;IAMlC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,aAAa;;;;;;IAqEtE,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAiClD,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;CAwB/C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,GAAG,CAAC,SAAS,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAQnF"}
|
|
@@ -80,18 +80,20 @@ class CoreContext {
|
|
|
80
80
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, schema), "f");
|
|
81
81
|
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.parse();
|
|
82
82
|
});
|
|
83
|
-
const files = this.trace('generate', () => {
|
|
83
|
+
const { files, moduleImportMap } = this.trace('generate', () => {
|
|
84
84
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
85
|
+
generatorsMap,
|
|
85
86
|
oasDocument,
|
|
86
87
|
settings,
|
|
87
88
|
callback
|
|
88
89
|
}), "f");
|
|
89
|
-
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate(
|
|
90
|
+
return __classPrivateFieldGet(this, _CoreContext_phase, "f").context.generate();
|
|
90
91
|
});
|
|
91
92
|
this.logger.debug(`${files.size} files generated`);
|
|
92
93
|
const renderOutput = this.trace('render', () => {
|
|
93
94
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupRenderPhase).call(this, {
|
|
94
95
|
files,
|
|
96
|
+
moduleImportMap,
|
|
95
97
|
pinnableGenerators: Object.values(generatorsMap)
|
|
96
98
|
.map(({ id, pinnable }) => (pinnable ? id : null))
|
|
97
99
|
.filter(generatorId => generatorId !== null),
|
|
@@ -175,17 +177,18 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
175
177
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f")
|
|
176
178
|
});
|
|
177
179
|
return { type: 'parse', context: parseContext };
|
|
178
|
-
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ oasDocument, settings, callback }) {
|
|
180
|
+
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ oasDocument, settings, callback, generatorsMap }) {
|
|
179
181
|
const generateContext = new GenerateContext_js_1.GenerateContext({
|
|
180
182
|
oasDocument,
|
|
181
183
|
settings,
|
|
182
184
|
logger: this.logger,
|
|
183
185
|
callback,
|
|
184
186
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
185
|
-
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
187
|
+
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
188
|
+
generatorsMap
|
|
186
189
|
});
|
|
187
190
|
return { type: 'generate', context: generateContext };
|
|
188
|
-
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators }) {
|
|
191
|
+
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, prettier, basePath, pinnableGenerators, moduleImportMap }) {
|
|
189
192
|
const renderContext = new RenderContext_js_1.RenderContext({
|
|
190
193
|
files,
|
|
191
194
|
prettier,
|
|
@@ -193,7 +196,8 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
193
196
|
pinnableGenerators,
|
|
194
197
|
logger: this.logger,
|
|
195
198
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
196
|
-
captureCurrentResult: this.captureCurrentResult.bind(this)
|
|
199
|
+
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
200
|
+
moduleImportMap
|
|
197
201
|
});
|
|
198
202
|
return { type: 'render', context: renderContext };
|
|
199
203
|
};
|
|
@@ -26,11 +26,16 @@ type ConstructorArgs = {
|
|
|
26
26
|
callback: (generatorKey: GeneratorKey) => void;
|
|
27
27
|
stackTrail: StackTrail;
|
|
28
28
|
captureCurrentResult: (result: ResultType) => void;
|
|
29
|
+
generatorsMap: Record<string, OperationGateway | ModelGateway | OperationInsertable<GeneratedValue> | ModelInsertable<GeneratedValue>>;
|
|
29
30
|
};
|
|
30
31
|
export type PickArgs = {
|
|
31
32
|
name: string;
|
|
32
33
|
exportPath: string;
|
|
33
34
|
};
|
|
35
|
+
export type ApplyPackageImportsArgs = {
|
|
36
|
+
destinationPath: string;
|
|
37
|
+
exportPath: string;
|
|
38
|
+
};
|
|
34
39
|
export type RegisterArgs = {
|
|
35
40
|
imports?: Record<string, ImportNameArg[]>;
|
|
36
41
|
definitions?: (Definition | undefined)[];
|
|
@@ -82,6 +87,10 @@ type BuildModelSettingsArgs<V> = {
|
|
|
82
87
|
refName: RefName;
|
|
83
88
|
insertable: ModelInsertable<V>;
|
|
84
89
|
};
|
|
90
|
+
type GenerateResult = {
|
|
91
|
+
files: Map<string, File>;
|
|
92
|
+
moduleImportMap: Map<string, string>;
|
|
93
|
+
};
|
|
85
94
|
export declare class GenerateContext {
|
|
86
95
|
#private;
|
|
87
96
|
oasDocument: OasDocument;
|
|
@@ -89,11 +98,12 @@ export declare class GenerateContext {
|
|
|
89
98
|
logger: log.Logger;
|
|
90
99
|
callback: (generatorKey: GeneratorKey) => void;
|
|
91
100
|
captureCurrentResult: (result: ResultType) => void;
|
|
92
|
-
|
|
101
|
+
generatorsMap: Record<string, OperationGateway | ModelGateway | OperationInsertable<GeneratedValue> | ModelInsertable<GeneratedValue>>;
|
|
102
|
+
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail, generatorsMap }: ConstructorArgs);
|
|
93
103
|
/**
|
|
94
104
|
* @internal
|
|
95
105
|
*/
|
|
96
|
-
generate(
|
|
106
|
+
generate(): GenerateResult;
|
|
97
107
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
98
108
|
/**
|
|
99
109
|
* Converts schema to value using `schemaToValueFn` and creates definition
|
|
@@ -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,
|
|
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,EAA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CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IAYzC;;;;;;;;;OASG;IACH,0BAA0B,CAAC,CAAC,EAAE,EAC5B,SAAS,EACT,UAAU,EACX,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,eAAe;IAmB/C;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,eAAe;IAgC9F;;;;;;;OAOG;IACH,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,YAAY,GAAG,eAAe;IAoFlF;;;;;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"}
|
|
@@ -33,7 +33,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
33
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
34
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
35
|
};
|
|
36
|
-
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile,
|
|
36
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_moduleImportMap, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_applyPackageImports, _GenerateContext_setExportPath, _GenerateContext_toOperationBaseSettings, _GenerateContext_toModelBaseSettings, _GenerateContext_toGeneratorSettings, _GenerateContext_toGatewayBaseSettings, _GenerateContext_cleanBaseSettings, _GenerateContext_addFile;
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.GenerateContext = void 0;
|
|
39
39
|
const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.6/mod.js");
|
|
@@ -47,7 +47,7 @@ const tracer_js_1 = require("../helpers/tracer.js");
|
|
|
47
47
|
const Inserted_js_1 = require("../dsl/Inserted.js");
|
|
48
48
|
const File_js_1 = require("../dsl/File.js");
|
|
49
49
|
class GenerateContext {
|
|
50
|
-
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail }) {
|
|
50
|
+
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail, generatorsMap }) {
|
|
51
51
|
_GenerateContext_instances.add(this);
|
|
52
52
|
_GenerateContext_files.set(this, void 0);
|
|
53
53
|
Object.defineProperty(this, "oasDocument", {
|
|
@@ -80,20 +80,37 @@ class GenerateContext {
|
|
|
80
80
|
writable: true,
|
|
81
81
|
value: void 0
|
|
82
82
|
});
|
|
83
|
+
Object.defineProperty(this, "generatorsMap", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: void 0
|
|
88
|
+
});
|
|
89
|
+
_GenerateContext_moduleImportMap.set(this, void 0);
|
|
83
90
|
_GenerateContext_stackTrail.set(this, void 0);
|
|
84
91
|
this.logger = logger;
|
|
85
92
|
__classPrivateFieldSet(this, _GenerateContext_files, new Map(), "f");
|
|
93
|
+
__classPrivateFieldSet(this, _GenerateContext_moduleImportMap, new Map(), "f");
|
|
86
94
|
this.oasDocument = oasDocument;
|
|
87
95
|
this.settings = settings;
|
|
88
96
|
this.callback = callback;
|
|
89
97
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
90
98
|
this.captureCurrentResult = captureCurrentResult;
|
|
99
|
+
this.generatorsMap = generatorsMap;
|
|
91
100
|
}
|
|
92
101
|
/**
|
|
93
102
|
* @internal
|
|
94
103
|
*/
|
|
95
|
-
generate(
|
|
96
|
-
|
|
104
|
+
generate() {
|
|
105
|
+
const generators = Object.values(this.generatorsMap);
|
|
106
|
+
generators.forEach(generator => {
|
|
107
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generator.id);
|
|
108
|
+
const { moduleName, exportPath } = generatorSettings?.baseSettings ?? {};
|
|
109
|
+
if (exportPath && moduleName && !__classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f").has(exportPath)) {
|
|
110
|
+
__classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f").set(exportPath, moduleName);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
Sentry.startSpan({ name: 'Generate operations' }, () => generators
|
|
97
114
|
.filter(generator => generator.type === 'operation')
|
|
98
115
|
.forEach(generator => {
|
|
99
116
|
this.trace(generator.id, () => {
|
|
@@ -101,7 +118,7 @@ class GenerateContext {
|
|
|
101
118
|
});
|
|
102
119
|
}));
|
|
103
120
|
Sentry.startSpan({ name: 'Generate models' }, () => {
|
|
104
|
-
|
|
121
|
+
generators
|
|
105
122
|
.filter(generator => generator.type === 'model')
|
|
106
123
|
.forEach(generator => {
|
|
107
124
|
this.trace(generator.id, () => {
|
|
@@ -109,7 +126,10 @@ class GenerateContext {
|
|
|
109
126
|
});
|
|
110
127
|
});
|
|
111
128
|
});
|
|
112
|
-
return
|
|
129
|
+
return {
|
|
130
|
+
files: __classPrivateFieldGet(this, _GenerateContext_files, "f"),
|
|
131
|
+
moduleImportMap: __classPrivateFieldGet(this, _GenerateContext_moduleImportMap, "f")
|
|
132
|
+
};
|
|
113
133
|
}
|
|
114
134
|
trace(token, fn) {
|
|
115
135
|
return (0, tracer_js_1.tracer)(__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f"), token, fn);
|
|
@@ -278,7 +298,8 @@ class GenerateContext {
|
|
|
278
298
|
path: operation.path,
|
|
279
299
|
method: operation.method
|
|
280
300
|
});
|
|
281
|
-
const
|
|
301
|
+
const generatedExportPath = insertable.toExportPath({ operation, baseSettings });
|
|
302
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
282
303
|
return new ContentSettings_js_1.ContentSettings({
|
|
283
304
|
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
284
305
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
@@ -300,7 +321,8 @@ class GenerateContext {
|
|
|
300
321
|
generatorId: insertable.id,
|
|
301
322
|
refName
|
|
302
323
|
});
|
|
303
|
-
const
|
|
324
|
+
const generatedExportPath = insertable.toExportPath({ refName, baseSettings });
|
|
325
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
304
326
|
return new ContentSettings_js_1.ContentSettings({
|
|
305
327
|
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
306
328
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
@@ -351,7 +373,7 @@ class GenerateContext {
|
|
|
351
373
|
}
|
|
352
374
|
}
|
|
353
375
|
exports.GenerateContext = GenerateContext;
|
|
354
|
-
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
376
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_moduleImportMap = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
355
377
|
if (generator._class === 'OperationGateway') {
|
|
356
378
|
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
357
379
|
const gatewayInstance = new generator({
|
|
@@ -481,34 +503,50 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
481
503
|
}
|
|
482
504
|
}
|
|
483
505
|
return currentFile;
|
|
506
|
+
}, _GenerateContext_applyPackageImports = function _GenerateContext_applyPackageImports() { }, _GenerateContext_setExportPath = function _GenerateContext_setExportPath({ generatedExportPath, baseSettings }) {
|
|
507
|
+
const { parentExportPath, exportPath } = baseSettings;
|
|
508
|
+
if (exportPath) {
|
|
509
|
+
return (0, mod_js_1.join)(parentExportPath ?? '', exportPath);
|
|
510
|
+
}
|
|
511
|
+
if (generatedExportPath.startsWith('@/')) {
|
|
512
|
+
return generatedExportPath;
|
|
513
|
+
}
|
|
514
|
+
return (0, mod_js_1.join)(parentExportPath ?? '', generatedExportPath);
|
|
484
515
|
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
485
|
-
const generatorSettings = this
|
|
516
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
486
517
|
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
487
|
-
? generatorSettings.operations
|
|
518
|
+
? generatorSettings.operations[path]?.[method]
|
|
488
519
|
: undefined;
|
|
520
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
489
521
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
490
522
|
...operationSettings,
|
|
491
|
-
parentExportPath
|
|
523
|
+
parentExportPath,
|
|
524
|
+
moduleName
|
|
492
525
|
});
|
|
493
|
-
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
494
|
-
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
495
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
496
526
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
497
|
-
const generatorSettings = this
|
|
527
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
498
528
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
499
|
-
? generatorSettings
|
|
529
|
+
? generatorSettings.models[refName]
|
|
500
530
|
: undefined;
|
|
531
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
501
532
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
502
533
|
...modelSettings,
|
|
503
|
-
parentExportPath
|
|
534
|
+
parentExportPath,
|
|
535
|
+
moduleName
|
|
504
536
|
});
|
|
537
|
+
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
538
|
+
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
539
|
+
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
540
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
541
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
505
542
|
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
506
543
|
return {
|
|
507
544
|
exportPath: baseSettings?.exportPath,
|
|
508
545
|
selected: Boolean(baseSettings?.selected),
|
|
509
546
|
name: baseSettings?.name,
|
|
510
547
|
importFrom: baseSettings?.importFrom,
|
|
511
|
-
parentExportPath: baseSettings?.parentExportPath
|
|
548
|
+
parentExportPath: baseSettings?.parentExportPath,
|
|
549
|
+
moduleName: baseSettings?.moduleName
|
|
512
550
|
};
|
|
513
551
|
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
514
552
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
@@ -8,6 +8,7 @@ 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>;
|
|
11
12
|
prettier?: PrettierConfigType;
|
|
12
13
|
basePath: string | undefined;
|
|
13
14
|
pinnableGenerators: string[];
|
|
@@ -24,7 +25,8 @@ export declare class RenderContext {
|
|
|
24
25
|
pinnableGenerators: string[];
|
|
25
26
|
logger: log.Logger;
|
|
26
27
|
captureCurrentResult: (result: ResultType) => void;
|
|
27
|
-
|
|
28
|
+
moduleImportMap: Map<string, string>;
|
|
29
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult, moduleImportMap }: ConstructorArgs);
|
|
28
30
|
render(): Omit<RenderResult, 'results'>;
|
|
29
31
|
private collate;
|
|
30
32
|
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,E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,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU/B,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;IAarD,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -45,7 +45,7 @@ const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.6/mod.js");
|
|
|
45
45
|
const toResolvedArtifactPath_js_1 = require("../helpers/toResolvedArtifactPath.js");
|
|
46
46
|
const tracer_js_1 = require("../helpers/tracer.js");
|
|
47
47
|
class RenderContext {
|
|
48
|
-
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }) {
|
|
48
|
+
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult, moduleImportMap }) {
|
|
49
49
|
Object.defineProperty(this, "files", {
|
|
50
50
|
enumerable: true,
|
|
51
51
|
configurable: true,
|
|
@@ -89,6 +89,12 @@ class RenderContext {
|
|
|
89
89
|
writable: true,
|
|
90
90
|
value: void 0
|
|
91
91
|
});
|
|
92
|
+
Object.defineProperty(this, "moduleImportMap", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
configurable: true,
|
|
95
|
+
writable: true,
|
|
96
|
+
value: void 0
|
|
97
|
+
});
|
|
92
98
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
93
99
|
this.files = files;
|
|
94
100
|
this.prettier = prettier;
|
|
@@ -97,6 +103,7 @@ class RenderContext {
|
|
|
97
103
|
this.logger = logger;
|
|
98
104
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
99
105
|
this.captureCurrentResult = captureCurrentResult;
|
|
106
|
+
this.moduleImportMap = moduleImportMap;
|
|
100
107
|
}
|
|
101
108
|
render() {
|
|
102
109
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
@@ -127,6 +134,7 @@ class RenderContext {
|
|
|
127
134
|
// to Correct file
|
|
128
135
|
// @TODO: Could this be combined with the tracer call above?
|
|
129
136
|
this.currentDestinationPath = destinationPath;
|
|
137
|
+
file.moduleImportMap = this.moduleImportMap;
|
|
130
138
|
const renderedFile = renderFile({
|
|
131
139
|
content: file.toString(),
|
|
132
140
|
generatorKeys: Array.from(file.generatorKeys).filter(Boolean),
|
package/script/dsl/File.d.ts
CHANGED
package/script/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;AAE7D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;gBAGxB,IAAI,EAAE,MAAM;
|
|
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;AAE7D,qBAAa,IAAI;;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBAGxB,IAAI,EAAE,MAAM;IAQxB,IAAI,aAAa,sBAEhB;IAED,QAAQ;CAkBT"}
|
package/script/dsl/File.js
CHANGED
|
@@ -34,17 +34,31 @@ class File {
|
|
|
34
34
|
writable: true,
|
|
35
35
|
value: void 0
|
|
36
36
|
});
|
|
37
|
+
Object.defineProperty(this, "moduleImportMap", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: void 0
|
|
42
|
+
});
|
|
37
43
|
_File_generatorKeys.set(this, void 0);
|
|
38
44
|
this.path = path;
|
|
39
45
|
this.imports = new Map();
|
|
40
46
|
this.definitions = new Map();
|
|
41
47
|
__classPrivateFieldSet(this, _File_generatorKeys, new Set(), "f");
|
|
48
|
+
this.moduleImportMap = new Map();
|
|
42
49
|
}
|
|
43
50
|
get generatorKeys() {
|
|
44
51
|
return __classPrivateFieldGet(this, _File_generatorKeys, "f");
|
|
45
52
|
}
|
|
46
53
|
toString() {
|
|
47
|
-
const imports = Array.from(this.imports.entries()).map(([module, importItems]) =>
|
|
54
|
+
const imports = Array.from(this.imports.entries()).map(([module, importItems]) => {
|
|
55
|
+
const updatedModuleName = updateModuleName({
|
|
56
|
+
destinationPath: this.path,
|
|
57
|
+
moduleImportMap: this.moduleImportMap,
|
|
58
|
+
exportPath: module
|
|
59
|
+
});
|
|
60
|
+
return new Import_js_1.Import({ module: updatedModuleName, importNames: Array.from(importItems) });
|
|
61
|
+
});
|
|
48
62
|
const definitions = Array.from(this.definitions.values());
|
|
49
63
|
return [imports, definitions]
|
|
50
64
|
.filter(section => Boolean(section.length))
|
|
@@ -54,3 +68,14 @@ class File {
|
|
|
54
68
|
}
|
|
55
69
|
exports.File = File;
|
|
56
70
|
_File_generatorKeys = new WeakMap();
|
|
71
|
+
const updateModuleName = ({ destinationPath, moduleImportMap, exportPath }) => {
|
|
72
|
+
const matchedModuleImport = [...moduleImportMap.entries()].find(([key]) => exportPath.startsWith(key));
|
|
73
|
+
if (!matchedModuleImport) {
|
|
74
|
+
return exportPath;
|
|
75
|
+
}
|
|
76
|
+
const [matchedPath, moduleName] = matchedModuleImport;
|
|
77
|
+
if (destinationPath.startsWith(matchedPath)) {
|
|
78
|
+
return exportPath.replace(matchedPath, moduleName);
|
|
79
|
+
}
|
|
80
|
+
return destinationPath.startsWith(matchedPath) ? exportPath.replace(matchedPath, '@') : moduleName;
|
|
81
|
+
};
|
|
@@ -2,10 +2,15 @@ import { type GatewayConstructorArgs } from '../GatewayBase.js';
|
|
|
2
2
|
import type { Identifier } from '../Identifier.js';
|
|
3
3
|
import type { BaseSettings } from '../../types/Settings.js';
|
|
4
4
|
import type { IsModelSelectedArgs } from './ModelInsertable.js';
|
|
5
|
+
type ToPackageImportArgs = {
|
|
6
|
+
destinationPath: string;
|
|
7
|
+
exportPath: string;
|
|
8
|
+
};
|
|
5
9
|
export type ToModelGatewayArgs = {
|
|
6
10
|
id: string;
|
|
7
11
|
toIdentifier: (baseSettings: BaseSettings) => Identifier;
|
|
8
12
|
toExportPath: (baseSettings: BaseSettings) => string;
|
|
13
|
+
toPackageImport?: ({ destinationPath, exportPath }: ToPackageImportArgs) => string;
|
|
9
14
|
isGeneratorSelected?: (baseSettings: BaseSettings) => boolean;
|
|
10
15
|
isModelSelected?: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
11
16
|
};
|
|
@@ -27,4 +32,5 @@ export declare const toModelGateway: (config: ToModelGatewayArgs) => {
|
|
|
27
32
|
isSupported: () => boolean;
|
|
28
33
|
pinnable: boolean;
|
|
29
34
|
};
|
|
35
|
+
export {};
|
|
30
36
|
//# sourceMappingURL=toModelGateway.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toModelGateway.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelGateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAe,MAAM,mBAAmB,CAAA;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,O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wCAGf,YAAY,KAAK,OAAO;iDACf,mBAAmB,KAAK,OAAO;;;CAwB9E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,MAAM,EAAU,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAO/C,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAA;AAEnF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;EAKtC,CAAA;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,C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AM,CAAA;IAChB,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA"}
|
package/script/types/Settings.js
CHANGED
|
@@ -9,7 +9,8 @@ exports.baseSettings = zod_1.z.object({
|
|
|
9
9
|
name: zod_1.z.string().optional(),
|
|
10
10
|
importFrom: zod_1.z.string().optional(),
|
|
11
11
|
exportPath: zod_1.z.string().optional(),
|
|
12
|
-
parentExportPath: zod_1.z.string().optional()
|
|
12
|
+
parentExportPath: zod_1.z.string().optional(),
|
|
13
|
+
moduleName: zod_1.z.string().optional()
|
|
13
14
|
});
|
|
14
15
|
exports.operationsGeneratorSettings = zod_1.z.object({
|
|
15
16
|
id: zod_1.z.string(),
|