@skmtc/core 0.0.381 → 0.0.382
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 +2 -2
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.d.ts +46 -14
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +187 -76
- package/esm/context/RenderContext.d.ts +3 -3
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/types.d.ts +2 -2
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/model/ModelBase.d.ts.map +1 -1
- package/esm/dsl/model/ModelBase.js +1 -1
- package/esm/dsl/model/ModelInsertable.d.ts +13 -5
- package/esm/dsl/model/ModelInsertable.d.ts.map +1 -1
- package/esm/dsl/model/toModelGateway.d.ts +26 -0
- package/esm/dsl/model/toModelGateway.d.ts.map +1 -0
- package/esm/dsl/model/toModelGateway.js +70 -0
- package/esm/dsl/model/toModelInsertable.d.ts +36 -0
- package/esm/dsl/model/toModelInsertable.d.ts.map +1 -0
- package/esm/dsl/model/{toModelBase.js → toModelInsertable.js} +3 -41
- package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/OperationBase.js +1 -1
- package/esm/dsl/operation/OperationInsertable.d.ts +17 -5
- package/esm/dsl/operation/OperationInsertable.d.ts.map +1 -1
- package/esm/dsl/operation/toOperationGateway.d.ts +28 -0
- package/esm/dsl/operation/toOperationGateway.d.ts.map +1 -0
- package/esm/dsl/operation/toOperationGateway.js +70 -0
- package/esm/dsl/operation/toOperationInsertable.d.ts +43 -0
- package/esm/dsl/operation/toOperationInsertable.d.ts.map +1 -0
- package/esm/dsl/operation/{toOperationBase.js → toOperationInsertable.js} +3 -41
- package/esm/helpers/ResultsLog.d.ts +2 -2
- package/esm/helpers/ResultsLog.d.ts.map +1 -1
- package/esm/helpers/ResultsLog.js +11 -3
- package/esm/mod.d.ts +4 -2
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +4 -2
- package/esm/types/Results.d.ts +3 -3
- package/esm/types/Results.d.ts.map +1 -1
- package/esm/types/Results.js +2 -2
- package/esm/types/Settings.d.ts +24 -12
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +4 -3
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +2 -2
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/GenerateContext.d.ts +46 -14
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +187 -76
- package/script/context/RenderContext.d.ts +3 -3
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/types.d.ts +2 -2
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/model/ModelBase.d.ts.map +1 -1
- package/script/dsl/model/ModelBase.js +1 -1
- package/script/dsl/model/ModelInsertable.d.ts +13 -5
- package/script/dsl/model/ModelInsertable.d.ts.map +1 -1
- package/script/dsl/model/toModelGateway.d.ts +26 -0
- package/script/dsl/model/toModelGateway.d.ts.map +1 -0
- package/script/dsl/model/toModelGateway.js +74 -0
- package/script/dsl/model/toModelInsertable.d.ts +36 -0
- package/script/dsl/model/toModelInsertable.d.ts.map +1 -0
- package/script/dsl/model/{toModelBase.js → toModelInsertable.js} +5 -43
- package/script/dsl/operation/OperationBase.d.ts.map +1 -1
- package/script/dsl/operation/OperationBase.js +1 -1
- package/script/dsl/operation/OperationInsertable.d.ts +17 -5
- package/script/dsl/operation/OperationInsertable.d.ts.map +1 -1
- package/script/dsl/operation/toOperationGateway.d.ts +28 -0
- package/script/dsl/operation/toOperationGateway.d.ts.map +1 -0
- package/script/dsl/operation/toOperationGateway.js +74 -0
- package/script/dsl/operation/toOperationInsertable.d.ts +43 -0
- package/script/dsl/operation/toOperationInsertable.d.ts.map +1 -0
- package/script/dsl/operation/{toOperationBase.js → toOperationInsertable.js} +5 -43
- package/script/helpers/ResultsLog.d.ts +2 -2
- package/script/helpers/ResultsLog.d.ts.map +1 -1
- package/script/helpers/ResultsLog.js +11 -3
- package/script/mod.d.ts +4 -2
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +4 -2
- package/script/types/Results.d.ts +3 -3
- package/script/types/Results.d.ts.map +1 -1
- package/script/types/Results.js +3 -3
- package/script/types/Settings.d.ts +24 -12
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +4 -3
- package/esm/dsl/model/toModelBase.d.ts +0 -48
- package/esm/dsl/model/toModelBase.d.ts.map +0 -1
- package/esm/dsl/operation/toOperationBase.d.ts +0 -55
- package/esm/dsl/operation/toOperationBase.d.ts.map +0 -1
- package/script/dsl/model/toModelBase.d.ts +0 -48
- package/script/dsl/model/toModelBase.d.ts.map +0 -1
- package/script/dsl/operation/toOperationBase.d.ts +0 -55
- package/script/dsl/operation/toOperationBase.d.ts.map +0 -1
|
@@ -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, _GenerateContext_toModelBaseSettings, _GenerateContext_addFile;
|
|
36
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_toOperationBaseSettings, _GenerateContext_toGatewayBaseSettings, _GenerateContext_toModelBaseSettings, _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.0/mod.js");
|
|
@@ -45,7 +45,6 @@ const ContentSettings_js_1 = require("../dsl/ContentSettings.js");
|
|
|
45
45
|
const Sentry = __importStar(require("@sentry/deno"));
|
|
46
46
|
const tracer_js_1 = require("../helpers/tracer.js");
|
|
47
47
|
const Inserted_js_1 = require("../dsl/Inserted.js");
|
|
48
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
49
48
|
class GenerateContext {
|
|
50
49
|
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail }) {
|
|
51
50
|
_GenerateContext_instances.add(this);
|
|
@@ -125,6 +124,8 @@ class GenerateContext {
|
|
|
125
124
|
* If a definition with the same name already exists, it will be returned
|
|
126
125
|
* instead of creating a new one.
|
|
127
126
|
*
|
|
127
|
+
* @experimental
|
|
128
|
+
*
|
|
128
129
|
* @param schema - The schema to create the definition for.
|
|
129
130
|
* @param identifier - The identifier for the definition.
|
|
130
131
|
* @param destinationPath - The path to the file where the definition will be registered.
|
|
@@ -147,16 +148,40 @@ class GenerateContext {
|
|
|
147
148
|
destinationPath,
|
|
148
149
|
required: true
|
|
149
150
|
});
|
|
150
|
-
|
|
151
|
+
return this.defineAndRegister({
|
|
152
|
+
identifier,
|
|
153
|
+
value,
|
|
154
|
+
destinationPath
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create and register a definition with the given `identifier` at `destinationPath`.
|
|
159
|
+
*
|
|
160
|
+
* @experimental
|
|
161
|
+
*/
|
|
162
|
+
defineAndRegister({ identifier, value, destinationPath }) {
|
|
163
|
+
// @TODO cache check is duplicatd if call comes from
|
|
164
|
+
// createAndRegisterDefinition. Look for a way to share code between
|
|
165
|
+
// these two functions
|
|
166
|
+
const cachedDefinition = this.findDefinition({
|
|
167
|
+
name: identifier.name,
|
|
168
|
+
exportPath: destinationPath
|
|
169
|
+
});
|
|
170
|
+
// @TODO add check to make sure retrieved definition
|
|
171
|
+
// used same generator and same schema #SKM-47
|
|
172
|
+
if (cachedDefinition) {
|
|
173
|
+
return cachedDefinition;
|
|
174
|
+
}
|
|
175
|
+
const definition = new Definition_js_1.Definition({
|
|
151
176
|
context: this,
|
|
152
177
|
identifier,
|
|
153
178
|
value
|
|
154
179
|
});
|
|
155
180
|
this.register({
|
|
156
|
-
definitions: [
|
|
181
|
+
definitions: [definition],
|
|
157
182
|
destinationPath
|
|
158
183
|
});
|
|
159
|
-
return
|
|
184
|
+
return definition;
|
|
160
185
|
}
|
|
161
186
|
/**
|
|
162
187
|
* Insert supplied `imports` and `definitions` into file at `destinationPath`.
|
|
@@ -193,40 +218,51 @@ class GenerateContext {
|
|
|
193
218
|
});
|
|
194
219
|
}
|
|
195
220
|
/**
|
|
196
|
-
* Insert operation
|
|
221
|
+
* Insert operation into the output file with path `destinationPath`.
|
|
197
222
|
*
|
|
198
223
|
* Insert will perform the following steps:
|
|
199
|
-
* 1. Generate content settings for the supplied operation
|
|
224
|
+
* 1. Generate content settings for the supplied operation
|
|
200
225
|
* 2. Look up definition in file with path `destinationPath`
|
|
201
226
|
* 3. If definition is not found, it will create a new one and register it
|
|
202
227
|
* 4. If the definition is defined at a location that is different from
|
|
203
228
|
* the current file, it will add an import to the current file from
|
|
204
229
|
* that location
|
|
205
|
-
* 5. Use the content settings to generate the operation
|
|
230
|
+
* 5. Use the content settings to generate the operation using the
|
|
206
231
|
* insertable's driver
|
|
207
232
|
* @mutates this.files
|
|
208
233
|
*/
|
|
209
|
-
|
|
210
|
-
const { settings, definition } =
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
234
|
+
insertOperation({ insertable, operation, generation, destinationPath }) {
|
|
235
|
+
const { settings, definition } = new OperationDriver_js_1.OperationDriver({
|
|
236
|
+
context: this,
|
|
237
|
+
insertable,
|
|
238
|
+
operation,
|
|
239
|
+
generation,
|
|
240
|
+
destinationPath
|
|
241
|
+
});
|
|
242
|
+
return new Inserted_js_1.Inserted({ settings, definition });
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Insert model into the output file with path `destinationPath`.
|
|
246
|
+
*
|
|
247
|
+
* Insert will perform the following steps:
|
|
248
|
+
* 1. Generate content settings for the supplied model
|
|
249
|
+
* 2. Look up definition in file with path `destinationPath`
|
|
250
|
+
* 3. If definition is not found, it will create a new one and register it
|
|
251
|
+
* 4. If the definition is defined at a location that is different from
|
|
252
|
+
* the current file, it will add an import to the current file from
|
|
253
|
+
* that location
|
|
254
|
+
* 5. Use the content settings to generate the model using the
|
|
255
|
+
* insertable's driver
|
|
256
|
+
* @mutates this.files
|
|
257
|
+
*/
|
|
258
|
+
insertModel({ insertable, refName, generation, destinationPath }) {
|
|
259
|
+
const { settings, definition } = new ModelDriver_js_1.ModelDriver({
|
|
260
|
+
context: this,
|
|
261
|
+
insertable,
|
|
262
|
+
refName,
|
|
263
|
+
generation,
|
|
264
|
+
destinationPath
|
|
265
|
+
});
|
|
230
266
|
return new Inserted_js_1.Inserted({ settings, definition });
|
|
231
267
|
}
|
|
232
268
|
/**
|
|
@@ -240,17 +276,17 @@ class GenerateContext {
|
|
|
240
276
|
* @returns
|
|
241
277
|
*/
|
|
242
278
|
toOperationContentSettings({ operation, insertable }) {
|
|
243
|
-
const baseSettings = this.
|
|
279
|
+
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toOperationBaseSettings).call(this, {
|
|
244
280
|
generatorId: insertable.id,
|
|
245
281
|
path: operation.path,
|
|
246
282
|
method: operation.method
|
|
247
283
|
});
|
|
248
|
-
const
|
|
284
|
+
const exportPath = insertable.toExportPath({ operation, baseSettings });
|
|
249
285
|
return new ContentSettings_js_1.ContentSettings({
|
|
250
286
|
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
251
287
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
252
|
-
exportPath
|
|
253
|
-
importFrom: baseSettings.importFrom ??
|
|
288
|
+
exportPath,
|
|
289
|
+
importFrom: baseSettings.importFrom ?? exportPath
|
|
254
290
|
});
|
|
255
291
|
}
|
|
256
292
|
/**
|
|
@@ -267,34 +303,31 @@ class GenerateContext {
|
|
|
267
303
|
generatorId: insertable.id,
|
|
268
304
|
refName
|
|
269
305
|
});
|
|
270
|
-
const
|
|
306
|
+
const exportPath = insertable.toExportPath({ refName, baseSettings });
|
|
271
307
|
return new ContentSettings_js_1.ContentSettings({
|
|
272
308
|
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
273
309
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
274
|
-
exportPath
|
|
275
|
-
importFrom: baseSettings.importFrom ??
|
|
310
|
+
exportPath,
|
|
311
|
+
importFrom: baseSettings.importFrom ?? exportPath
|
|
276
312
|
});
|
|
277
313
|
}
|
|
278
314
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
315
|
+
* Generate and return content settings for a gateway
|
|
316
|
+
*
|
|
317
|
+
* Content settings are produced by passing base settings
|
|
318
|
+
* through toIdentifier, toExportPath methods on the gateway
|
|
319
|
+
* @param gateway
|
|
320
|
+
* @returns Content settings for model
|
|
282
321
|
*/
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
:
|
|
288
|
-
|
|
289
|
-
? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
|
|
290
|
-
: undefined;
|
|
291
|
-
const baseSettings = {
|
|
322
|
+
toGatewayContentSetting(gateway) {
|
|
323
|
+
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGatewayBaseSettings).call(this, gateway.id);
|
|
324
|
+
const exportPath = gateway.toExportPath(baseSettings);
|
|
325
|
+
return new ContentSettings_js_1.ContentSettings({
|
|
326
|
+
identifier: gateway.toIdentifier(baseSettings),
|
|
327
|
+
selected: gateway.isGeneratorSelected(baseSettings),
|
|
292
328
|
exportPath,
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
importFrom: operationSettings?.importFrom
|
|
296
|
-
};
|
|
297
|
-
return baseSettings;
|
|
329
|
+
importFrom: baseSettings.importFrom ?? exportPath
|
|
330
|
+
});
|
|
298
331
|
}
|
|
299
332
|
/**
|
|
300
333
|
* Perform one lookup of schema by `refName`.
|
|
@@ -323,8 +356,12 @@ class GenerateContext {
|
|
|
323
356
|
exports.GenerateContext = GenerateContext;
|
|
324
357
|
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generator }) {
|
|
325
358
|
if (generator._class === 'OperationGateway') {
|
|
326
|
-
const
|
|
327
|
-
|
|
359
|
+
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
360
|
+
const gatewayInstance = new generator({
|
|
361
|
+
context: this,
|
|
362
|
+
settings: gatewaySettings
|
|
363
|
+
});
|
|
364
|
+
oasDocument.operations.forEach(operation => {
|
|
328
365
|
// TODO If we make OasOperation generic, for example by
|
|
329
366
|
// adding a `method` type, we could make isSupported
|
|
330
367
|
// a type guard which could help us narrow down the
|
|
@@ -333,12 +370,26 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
333
370
|
// in the generator implementations
|
|
334
371
|
// https://linear.app/skmtc/issue/SKM-32/generic-models-operations
|
|
335
372
|
const { path, method } = operation;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
373
|
+
this.trace([path, method], () => {
|
|
374
|
+
if (!generator.isSupported(operation)) {
|
|
375
|
+
return this.captureCurrentResult('notSupported');
|
|
376
|
+
}
|
|
377
|
+
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toOperationBaseSettings).call(this, {
|
|
378
|
+
generatorId: generator.id,
|
|
379
|
+
path,
|
|
380
|
+
method
|
|
340
381
|
});
|
|
341
|
-
|
|
382
|
+
if (!generator.isOperationSelected({ operation, baseSettings })) {
|
|
383
|
+
return this.captureCurrentResult('notSelected');
|
|
384
|
+
}
|
|
385
|
+
gatewayInstance.transformOperation(operation);
|
|
386
|
+
this.captureCurrentResult('success');
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
return this.defineAndRegister({
|
|
390
|
+
identifier: gatewaySettings.identifier,
|
|
391
|
+
value: gatewayInstance,
|
|
392
|
+
destinationPath: gatewaySettings.exportPath
|
|
342
393
|
});
|
|
343
394
|
}
|
|
344
395
|
if (generator._class === 'OperationInsertable') {
|
|
@@ -351,31 +402,72 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
351
402
|
// in the generator implementations
|
|
352
403
|
// https://linear.app/skmtc/issue/SKM-32/generic-models-operations
|
|
353
404
|
const { path, method } = operation;
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this.
|
|
357
|
-
|
|
405
|
+
this.trace([path, method], () => {
|
|
406
|
+
if (!generator.isSupported(operation)) {
|
|
407
|
+
return this.captureCurrentResult('notSupported');
|
|
408
|
+
}
|
|
409
|
+
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toOperationBaseSettings).call(this, {
|
|
410
|
+
generatorId: generator.id,
|
|
411
|
+
path,
|
|
412
|
+
method
|
|
358
413
|
});
|
|
359
|
-
|
|
414
|
+
if (!generator.isSelected({ operation, baseSettings })) {
|
|
415
|
+
return this.captureCurrentResult('notSelected');
|
|
416
|
+
}
|
|
417
|
+
this.insertOperation({ insertable: generator, operation });
|
|
418
|
+
this.captureCurrentResult('success');
|
|
419
|
+
});
|
|
360
420
|
});
|
|
361
421
|
}
|
|
362
422
|
throw new Error(`Unknown generator type`);
|
|
363
423
|
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator({ oasDocument, generator }) {
|
|
364
424
|
if (generator._class === 'ModelGateway') {
|
|
365
|
-
const
|
|
425
|
+
const gatewaySettings = this.toGatewayContentSetting(generator);
|
|
426
|
+
if (!gatewaySettings.selected) {
|
|
427
|
+
return this.captureCurrentResult('notSelected');
|
|
428
|
+
}
|
|
429
|
+
const gatewayInstance = new generator({
|
|
430
|
+
context: this,
|
|
431
|
+
settings: gatewaySettings
|
|
432
|
+
});
|
|
366
433
|
const refNames = oasDocument.components?.toSchemasRefNames() ?? [];
|
|
367
|
-
|
|
434
|
+
refNames.forEach(refName => {
|
|
368
435
|
this.trace(refName, () => {
|
|
369
|
-
|
|
436
|
+
if (!generator.isSupported()) {
|
|
437
|
+
return this.captureCurrentResult('notSupported');
|
|
438
|
+
}
|
|
439
|
+
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toModelBaseSettings).call(this, {
|
|
440
|
+
generatorId: generator.id,
|
|
441
|
+
refName
|
|
442
|
+
});
|
|
443
|
+
if (!generator.isModelSelected({ refName, baseSettings })) {
|
|
444
|
+
return this.captureCurrentResult('notSelected');
|
|
445
|
+
}
|
|
446
|
+
gatewayInstance.transformModel(refName);
|
|
370
447
|
this.captureCurrentResult('success');
|
|
371
448
|
});
|
|
372
449
|
});
|
|
450
|
+
return this.defineAndRegister({
|
|
451
|
+
identifier: gatewaySettings.identifier,
|
|
452
|
+
value: gatewayInstance,
|
|
453
|
+
destinationPath: gatewaySettings.exportPath
|
|
454
|
+
});
|
|
373
455
|
}
|
|
374
456
|
if (generator._class === 'ModelInsertable') {
|
|
375
457
|
const refNames = oasDocument.components?.toSchemasRefNames() ?? [];
|
|
376
458
|
return refNames.forEach(refName => {
|
|
377
459
|
this.trace(refName, () => {
|
|
378
|
-
|
|
460
|
+
if (!generator.isSupported()) {
|
|
461
|
+
return this.captureCurrentResult('notSupported');
|
|
462
|
+
}
|
|
463
|
+
const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toModelBaseSettings).call(this, {
|
|
464
|
+
generatorId: generator.id,
|
|
465
|
+
refName
|
|
466
|
+
});
|
|
467
|
+
if (!generator.isSelected({ refName, baseSettings })) {
|
|
468
|
+
return this.captureCurrentResult('notSelected');
|
|
469
|
+
}
|
|
470
|
+
this.insertModel({ insertable: generator, refName });
|
|
379
471
|
this.captureCurrentResult('success');
|
|
380
472
|
});
|
|
381
473
|
});
|
|
@@ -392,21 +484,40 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
392
484
|
}
|
|
393
485
|
}
|
|
394
486
|
return currentFile;
|
|
487
|
+
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
488
|
+
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
489
|
+
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
490
|
+
? generatorSettings.operations?.[path]?.[method]
|
|
491
|
+
: undefined;
|
|
492
|
+
const exportPath = operationSettings?.exportPath
|
|
493
|
+
? (0, mod_js_1.join)(generatorSettings?.baseSettings.exportPath ?? '', operationSettings?.exportPath)
|
|
494
|
+
: undefined;
|
|
495
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
496
|
+
...operationSettings,
|
|
497
|
+
exportPath
|
|
498
|
+
});
|
|
499
|
+
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
500
|
+
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
501
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
395
502
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
396
503
|
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
397
504
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
398
505
|
? generatorSettings?.models?.[refName]
|
|
399
506
|
: undefined;
|
|
400
507
|
const exportPath = modelSettings?.exportPath
|
|
401
|
-
? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', modelSettings?.exportPath)
|
|
508
|
+
? (0, mod_js_1.join)(generatorSettings?.baseSettings.exportPath ?? '', modelSettings?.exportPath)
|
|
402
509
|
: undefined;
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
510
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
511
|
+
...modelSettings,
|
|
512
|
+
exportPath
|
|
513
|
+
});
|
|
514
|
+
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
515
|
+
return {
|
|
516
|
+
exportPath: baseSettings?.exportPath,
|
|
517
|
+
selected: Boolean(baseSettings?.selected),
|
|
518
|
+
name: baseSettings?.name,
|
|
519
|
+
importFrom: baseSettings?.importFrom
|
|
408
520
|
};
|
|
409
|
-
return baseSettings;
|
|
410
521
|
}, _GenerateContext_addFile = function _GenerateContext_addFile(normalisedPath) {
|
|
411
522
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
412
523
|
throw new Error(`File already exists: ${normalisedPath}`);
|
|
@@ -2,7 +2,7 @@ import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
|
2
2
|
import type { AddGeneratorKeyArgs, FileContents, RenderResult } from './types.js';
|
|
3
3
|
import type { Definition } from '../dsl/Definition.js';
|
|
4
4
|
import type { PickArgs } from './GenerateContext.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ResultType } from '../types/Results.js';
|
|
6
6
|
import type { StackTrail } from './StackTrail.js';
|
|
7
7
|
import type * as log from '../deps/jsr.io/@std/log/0.224.7/mod.js';
|
|
8
8
|
type ConstructorArgs = {
|
|
@@ -12,7 +12,7 @@ type ConstructorArgs = {
|
|
|
12
12
|
pinnableGenerators: string[];
|
|
13
13
|
stackTrail: StackTrail;
|
|
14
14
|
logger: log.Logger;
|
|
15
|
-
captureCurrentResult: (result:
|
|
15
|
+
captureCurrentResult: (result: ResultType) => void;
|
|
16
16
|
};
|
|
17
17
|
export declare class RenderContext {
|
|
18
18
|
#private;
|
|
@@ -22,7 +22,7 @@ export declare class RenderContext {
|
|
|
22
22
|
currentDestinationPath: string | 'PRE_RENDER' | 'POST_RENDER';
|
|
23
23
|
pinnableGenerators: string[];
|
|
24
24
|
logger: log.Logger;
|
|
25
|
-
captureCurrentResult: (result:
|
|
25
|
+
captureCurrentResult: (result: ResultType) => void;
|
|
26
26
|
constructor({ files, prettier, basePath, pinnableGenerators, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
27
27
|
render(): Omit<RenderResult, 'results'>;
|
|
28
28
|
private collate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAqB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEpG,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;AAElE,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,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,EAAE,YAAY,CAAC,CAAA;IAChC,OAAO,CAAC,QAAQ,CAAC,CAAoB;IACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,sBAAsB,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,CAAA;IAC7D,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAElB,oBAAoB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;gBACtC,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,UAAU,EACV,oBAAoB,EACrB,EAAE,eAAe;IAWlB,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAuBvC,OAAO,CAAC,OAAO;IAmDf,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAIlD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY;IAUvC,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,mBAAmB;IAarD,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Definition } from '../dsl/Definition.js';
|
|
2
2
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
3
3
|
import type { ManifestEntry } from '../types/Manifest.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ResultType } from '../types/Results.js';
|
|
5
5
|
export type PhaseType = 'parse' | 'generate' | 'render';
|
|
6
6
|
export type FileContents = {
|
|
7
7
|
imports: Map<string, Set<string>>;
|
|
@@ -23,6 +23,6 @@ export type RenderResult = {
|
|
|
23
23
|
artifacts: Record<string, string>;
|
|
24
24
|
files: Record<string, ManifestEntry>;
|
|
25
25
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
26
|
-
results: Record<string,
|
|
26
|
+
results: Record<string, ResultType>;
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,aAAa,EAAE,GAAG,CAAC,YAAY,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;CAChD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IACpC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CACpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,qBAAa,SAAU,SAAQ,SAAS;IACtC,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;gBACd,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,aAAa;IAQvE,SAAS,CAAC,CAAC,SAAS,cAAc,EAChC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,EAC9B,OAAO,EAAE,OAAO,GACf,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;IASvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI;CAM5C"}
|
|
@@ -9,7 +9,7 @@ type ModelInsertableConstructorArgs = {
|
|
|
9
9
|
settings: ContentSettings;
|
|
10
10
|
destinationPath: string;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type ToModelIdentifierArgs = {
|
|
13
13
|
refName: RefName;
|
|
14
14
|
baseSettings: BaseSettings;
|
|
15
15
|
};
|
|
@@ -24,13 +24,21 @@ export type IsModelSelectedArgs = {
|
|
|
24
24
|
export type WithTransformModel = {
|
|
25
25
|
transformModel: (refName: RefName) => void;
|
|
26
26
|
};
|
|
27
|
+
export type ModelGatewayConstructorArgs = {
|
|
28
|
+
context: GenerateContext;
|
|
29
|
+
settings: ContentSettings;
|
|
30
|
+
};
|
|
27
31
|
export type ModelGateway = {
|
|
28
|
-
new (context:
|
|
32
|
+
new ({ context, settings }: ModelGatewayConstructorArgs): WithTransformModel;
|
|
29
33
|
id: string;
|
|
30
34
|
type: 'model';
|
|
31
35
|
_class: 'ModelGateway';
|
|
32
|
-
|
|
36
|
+
toIdentifier: (baseSettings: BaseSettings) => Identifier;
|
|
37
|
+
toExportPath: (baseSettings: BaseSettings) => string;
|
|
38
|
+
isGeneratorSelected: (baseSettings: BaseSettings) => boolean;
|
|
39
|
+
isModelSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
33
40
|
isSupported: () => boolean;
|
|
41
|
+
pinnable: boolean;
|
|
34
42
|
};
|
|
35
43
|
export type ModelInsertable<V> = {
|
|
36
44
|
prototype: V;
|
|
@@ -39,11 +47,11 @@ export type ModelInsertable<V> = {
|
|
|
39
47
|
id: string;
|
|
40
48
|
type: 'model';
|
|
41
49
|
_class: 'ModelInsertable';
|
|
42
|
-
toIdentifier: ({ refName, baseSettings }:
|
|
50
|
+
toIdentifier: ({ refName, baseSettings }: ToModelIdentifierArgs) => Identifier;
|
|
43
51
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
44
52
|
isSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
45
|
-
pinnable: boolean;
|
|
46
53
|
isSupported: () => boolean;
|
|
54
|
+
pinnable: boolean;
|
|
47
55
|
} & Function;
|
|
48
56
|
export {};
|
|
49
57
|
//# sourceMappingURL=ModelInsertable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,KAAK,8BAA8B,GAAG;IACpC,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,eAAe,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,KAAK,8BAA8B,GAAG;IACpC,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,eAAe,CAAA;IACzB,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,2BAA2B,GAAG,kBAAkB,CAAA;IAC5E,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,cAAc,CAAA;IAEtB,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,UAAU,CAAA;IACxD,YAAY,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,MAAM,CAAA;IAEpD,mBAAmB,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,OAAO,CAAA;IAC5D,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;IAC5E,WAAW,EAAE,MAAM,OAAO,CAAA;IAE1B,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,GAAG;IAClD,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,8BAA8B,GAAG,CAAC,CAAA;IACxF,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,MAAM,EAAE,iBAAiB,CAAA;IAEzB,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,UAAU,CAAA;IAC9E,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAE1E,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;IACvE,WAAW,EAAE,MAAM,OAAO,CAAA;IAE1B,QAAQ,EAAE,OAAO,CAAA;CAGlB,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
|
+
import type { Identifier } from '../Identifier.js';
|
|
3
|
+
import type { BaseSettings } from '../../types/Settings.js';
|
|
4
|
+
import type { IsModelSelectedArgs } from './ModelInsertable.js';
|
|
5
|
+
export type ToModelGatewayArgs = {
|
|
6
|
+
id: string;
|
|
7
|
+
toIdentifier: (baseSettings: BaseSettings) => Identifier;
|
|
8
|
+
toExportPath: (baseSettings: BaseSettings) => string;
|
|
9
|
+
isGeneratorSelected?: (baseSettings: BaseSettings) => boolean;
|
|
10
|
+
isModelSelected?: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const toModelGateway: (config: ToModelGatewayArgs) => {
|
|
13
|
+
new (context: GenerateContext): {
|
|
14
|
+
context: GenerateContext;
|
|
15
|
+
};
|
|
16
|
+
id: string;
|
|
17
|
+
type: "model";
|
|
18
|
+
_class: "ModelGateway";
|
|
19
|
+
toIdentifier: (baseSettings: BaseSettings) => Identifier;
|
|
20
|
+
toExportPath: (baseSettings: BaseSettings) => string;
|
|
21
|
+
isGeneratorSelected: (baseSettings: BaseSettings) => boolean;
|
|
22
|
+
isModelSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
23
|
+
isSupported: () => boolean;
|
|
24
|
+
pinnable: boolean;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=toModelGateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toModelGateway.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,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;IAEpD,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;kBAehC,eAAe;;;;;;iCAtBT,YAAY,KAAK,UAAU;iCAC3B,YAAY,KAAK,MAAM;wCAEf,YAAY,KAAK,OAAO;iDACf,mBAAmB,KAAK,OAAO;;;CAwB9E,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
3
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
4
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.toModelGateway = void 0;
|
|
8
|
+
const GeneratorBase_js_1 = require("../GeneratorBase.js");
|
|
9
|
+
const toModelGateway = (config) => {
|
|
10
|
+
var _a;
|
|
11
|
+
const ModelGateway = (_a = class extends GeneratorBase_js_1.GatewayBase {
|
|
12
|
+
constructor(context) {
|
|
13
|
+
super(context);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
__setFunctionName(_a, "ModelGateway"),
|
|
17
|
+
Object.defineProperty(_a, "id", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: config.id
|
|
22
|
+
}),
|
|
23
|
+
Object.defineProperty(_a, "type", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value: 'model'
|
|
28
|
+
}),
|
|
29
|
+
Object.defineProperty(_a, "_class", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
configurable: true,
|
|
32
|
+
writable: true,
|
|
33
|
+
value: 'ModelGateway'
|
|
34
|
+
}),
|
|
35
|
+
Object.defineProperty(_a, "toIdentifier", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: config.toIdentifier.bind(config)
|
|
40
|
+
}),
|
|
41
|
+
Object.defineProperty(_a, "toExportPath", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: config.toExportPath.bind(config)
|
|
46
|
+
}),
|
|
47
|
+
Object.defineProperty(_a, "isGeneratorSelected", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
value: config.isGeneratorSelected ?? (() => true)
|
|
52
|
+
}),
|
|
53
|
+
Object.defineProperty(_a, "isModelSelected", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: config.isModelSelected ?? (() => true)
|
|
58
|
+
}),
|
|
59
|
+
Object.defineProperty(_a, "isSupported", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
value: () => true
|
|
64
|
+
}),
|
|
65
|
+
Object.defineProperty(_a, "pinnable", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
configurable: true,
|
|
68
|
+
writable: true,
|
|
69
|
+
value: false
|
|
70
|
+
}),
|
|
71
|
+
_a);
|
|
72
|
+
return ModelGateway;
|
|
73
|
+
};
|
|
74
|
+
exports.toModelGateway = toModelGateway;
|