@skmtc/core 0.0.392 → 0.0.394
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 +59 -28
- 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 +59 -28
- 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;IAuC9F;;;;;;;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_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);
|
|
@@ -253,7 +273,7 @@ export class GenerateContext {
|
|
|
253
273
|
method: operation.method
|
|
254
274
|
});
|
|
255
275
|
const generatedExportPath = insertable.toExportPath({ operation, baseSettings });
|
|
256
|
-
const exportPath =
|
|
276
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
257
277
|
return new ContentSettings({
|
|
258
278
|
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
259
279
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
@@ -276,7 +296,7 @@ export class GenerateContext {
|
|
|
276
296
|
refName
|
|
277
297
|
});
|
|
278
298
|
const generatedExportPath = insertable.toExportPath({ refName, baseSettings });
|
|
279
|
-
const exportPath =
|
|
299
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
280
300
|
return new ContentSettings({
|
|
281
301
|
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
282
302
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
@@ -326,7 +346,7 @@ export class GenerateContext {
|
|
|
326
346
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_getFile).call(this, exportPath).definitions.get(name);
|
|
327
347
|
}
|
|
328
348
|
}
|
|
329
|
-
_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 }) {
|
|
330
350
|
if (generator._class === 'OperationGateway') {
|
|
331
351
|
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
332
352
|
const gatewayInstance = new generator({
|
|
@@ -456,34 +476,54 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
456
476
|
}
|
|
457
477
|
}
|
|
458
478
|
return currentFile;
|
|
479
|
+
}, _GenerateContext_setExportPath = function _GenerateContext_setExportPath({ generatedExportPath, baseSettings }) {
|
|
480
|
+
const { parentExportPath, exportPath } = baseSettings;
|
|
481
|
+
if (exportPath) {
|
|
482
|
+
this.logger.info('PATH exportPath', exportPath);
|
|
483
|
+
return join(parentExportPath ?? '', exportPath);
|
|
484
|
+
}
|
|
485
|
+
if (generatedExportPath.startsWith('@/')) {
|
|
486
|
+
this.logger.info('PATH generatedExportPath', generatedExportPath);
|
|
487
|
+
return generatedExportPath;
|
|
488
|
+
}
|
|
489
|
+
const combinedExportPath = join(parentExportPath ?? '', generatedExportPath);
|
|
490
|
+
this.logger.info('PATH join', combinedExportPath);
|
|
491
|
+
return combinedExportPath;
|
|
459
492
|
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
460
|
-
const generatorSettings = this
|
|
493
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
461
494
|
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
462
|
-
? generatorSettings.operations
|
|
495
|
+
? generatorSettings.operations[path]?.[method]
|
|
463
496
|
: undefined;
|
|
497
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
464
498
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
465
499
|
...operationSettings,
|
|
466
|
-
parentExportPath
|
|
500
|
+
parentExportPath,
|
|
501
|
+
moduleName
|
|
467
502
|
});
|
|
468
|
-
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
469
|
-
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
470
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
471
503
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
472
|
-
const generatorSettings = this
|
|
504
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
473
505
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
474
|
-
? generatorSettings
|
|
506
|
+
? generatorSettings.models[refName]
|
|
475
507
|
: undefined;
|
|
508
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
476
509
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
477
510
|
...modelSettings,
|
|
478
|
-
parentExportPath
|
|
511
|
+
parentExportPath,
|
|
512
|
+
moduleName
|
|
479
513
|
});
|
|
514
|
+
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
515
|
+
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
516
|
+
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
517
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
518
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
480
519
|
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
481
520
|
return {
|
|
482
521
|
exportPath: baseSettings?.exportPath,
|
|
483
522
|
selected: Boolean(baseSettings?.selected),
|
|
484
523
|
name: baseSettings?.name,
|
|
485
524
|
importFrom: baseSettings?.importFrom,
|
|
486
|
-
parentExportPath: baseSettings?.parentExportPath
|
|
525
|
+
parentExportPath: baseSettings?.parentExportPath,
|
|
526
|
+
moduleName: baseSettings?.moduleName
|
|
487
527
|
};
|
|
488
528
|
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
489
529
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
@@ -493,12 +533,3 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
493
533
|
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
494
534
|
return newFile;
|
|
495
535
|
};
|
|
496
|
-
const toExportPath = ({ generatedExportPath, baseSettings }) => {
|
|
497
|
-
if (baseSettings.exportPath) {
|
|
498
|
-
return join(baseSettings.parentExportPath ?? '', baseSettings.exportPath);
|
|
499
|
-
}
|
|
500
|
-
if (generatedExportPath.startsWith('@/')) {
|
|
501
|
-
return generatedExportPath;
|
|
502
|
-
}
|
|
503
|
-
return join(baseSettings.parentExportPath ?? '', generatedExportPath);
|
|
504
|
-
};
|
|
@@ -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,EAAE,MAAM,gBAAgB,CAAA;AAE1C,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACxB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAClB,oBAAoB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;CACnD,CAAA;AAYD,qBAAa,aAAa;;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EA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AM,EAAE,UAAU,KAAK,IAAI,CAAA;CACnD,CAAA;AAYD,qBAAa,aAAa;;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAoB;IACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,sBAAsB,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,CAAA;IAC7D,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAElB,oBAAoB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;IAClD,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;gBACxB,EACV,KAAK,EACL,QAAQ,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"],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AAEF,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,GAAG,uBAAuB,CAAA;AAE3F,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGzB,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,uBAAuB,EAAE,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,cAAc,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iBAAiB,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,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAI7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,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,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,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAI7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAiChE,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAUD,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,cAAc,GAAG,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"}
|
|
@@ -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":"GenerateCont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,CAAC;IA6B3C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,OAAY,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,YAAY;IA6BrE;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,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;IAuC9F;;;;;;;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_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);
|
|
@@ -279,7 +299,7 @@ class GenerateContext {
|
|
|
279
299
|
method: operation.method
|
|
280
300
|
});
|
|
281
301
|
const generatedExportPath = insertable.toExportPath({ operation, baseSettings });
|
|
282
|
-
const exportPath =
|
|
302
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
283
303
|
return new ContentSettings_js_1.ContentSettings({
|
|
284
304
|
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
285
305
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
@@ -302,7 +322,7 @@ class GenerateContext {
|
|
|
302
322
|
refName
|
|
303
323
|
});
|
|
304
324
|
const generatedExportPath = insertable.toExportPath({ refName, baseSettings });
|
|
305
|
-
const exportPath =
|
|
325
|
+
const exportPath = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_setExportPath).call(this, { generatedExportPath, baseSettings });
|
|
306
326
|
return new ContentSettings_js_1.ContentSettings({
|
|
307
327
|
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
308
328
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
@@ -353,7 +373,7 @@ class GenerateContext {
|
|
|
353
373
|
}
|
|
354
374
|
}
|
|
355
375
|
exports.GenerateContext = GenerateContext;
|
|
356
|
-
_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 }) {
|
|
357
377
|
if (generator._class === 'OperationGateway') {
|
|
358
378
|
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
359
379
|
const gatewayInstance = new generator({
|
|
@@ -483,34 +503,54 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
483
503
|
}
|
|
484
504
|
}
|
|
485
505
|
return currentFile;
|
|
506
|
+
}, _GenerateContext_setExportPath = function _GenerateContext_setExportPath({ generatedExportPath, baseSettings }) {
|
|
507
|
+
const { parentExportPath, exportPath } = baseSettings;
|
|
508
|
+
if (exportPath) {
|
|
509
|
+
this.logger.info('PATH exportPath', exportPath);
|
|
510
|
+
return (0, mod_js_1.join)(parentExportPath ?? '', exportPath);
|
|
511
|
+
}
|
|
512
|
+
if (generatedExportPath.startsWith('@/')) {
|
|
513
|
+
this.logger.info('PATH generatedExportPath', generatedExportPath);
|
|
514
|
+
return generatedExportPath;
|
|
515
|
+
}
|
|
516
|
+
const combinedExportPath = (0, mod_js_1.join)(parentExportPath ?? '', generatedExportPath);
|
|
517
|
+
this.logger.info('PATH join', combinedExportPath);
|
|
518
|
+
return combinedExportPath;
|
|
486
519
|
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
487
|
-
const generatorSettings = this
|
|
520
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
488
521
|
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
489
|
-
? generatorSettings.operations
|
|
522
|
+
? generatorSettings.operations[path]?.[method]
|
|
490
523
|
: undefined;
|
|
524
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
491
525
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
492
526
|
...operationSettings,
|
|
493
|
-
parentExportPath
|
|
527
|
+
parentExportPath,
|
|
528
|
+
moduleName
|
|
494
529
|
});
|
|
495
|
-
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
496
|
-
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
497
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
498
530
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
499
|
-
const generatorSettings = this
|
|
531
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
500
532
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
501
|
-
? generatorSettings
|
|
533
|
+
? generatorSettings.models[refName]
|
|
502
534
|
: undefined;
|
|
535
|
+
const { parentExportPath, moduleName } = generatorSettings?.baseSettings ?? {};
|
|
503
536
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
504
537
|
...modelSettings,
|
|
505
|
-
parentExportPath
|
|
538
|
+
parentExportPath,
|
|
539
|
+
moduleName
|
|
506
540
|
});
|
|
541
|
+
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
542
|
+
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
543
|
+
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
544
|
+
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
545
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
507
546
|
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
508
547
|
return {
|
|
509
548
|
exportPath: baseSettings?.exportPath,
|
|
510
549
|
selected: Boolean(baseSettings?.selected),
|
|
511
550
|
name: baseSettings?.name,
|
|
512
551
|
importFrom: baseSettings?.importFrom,
|
|
513
|
-
parentExportPath: baseSettings?.parentExportPath
|
|
552
|
+
parentExportPath: baseSettings?.parentExportPath,
|
|
553
|
+
moduleName: baseSettings?.moduleName
|
|
514
554
|
};
|
|
515
555
|
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
516
556
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
@@ -520,12 +560,3 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
520
560
|
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
521
561
|
return newFile;
|
|
522
562
|
};
|
|
523
|
-
const toExportPath = ({ generatedExportPath, baseSettings }) => {
|
|
524
|
-
if (baseSettings.exportPath) {
|
|
525
|
-
return (0, mod_js_1.join)(baseSettings.parentExportPath ?? '', baseSettings.exportPath);
|
|
526
|
-
}
|
|
527
|
-
if (generatedExportPath.startsWith('@/')) {
|
|
528
|
-
return generatedExportPath;
|
|
529
|
-
}
|
|
530
|
-
return (0, mod_js_1.join)(baseSettings.parentExportPath ?? '', generatedExportPath);
|
|
531
|
-
};
|
|
@@ -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,EAAE,MAAM,gBAAgB,CAAA;AAE1C,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACxB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,kB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 +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,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../../src/types/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9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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(),
|