@skmtc/core 0.0.380 → 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.
Files changed (93) hide show
  1. package/esm/context/CoreContext.d.ts +2 -2
  2. package/esm/context/CoreContext.d.ts.map +1 -1
  3. package/esm/context/CoreContext.js +0 -1
  4. package/esm/context/GenerateContext.d.ts +46 -14
  5. package/esm/context/GenerateContext.d.ts.map +1 -1
  6. package/esm/context/GenerateContext.js +187 -76
  7. package/esm/context/RenderContext.d.ts +3 -3
  8. package/esm/context/RenderContext.d.ts.map +1 -1
  9. package/esm/context/types.d.ts +2 -2
  10. package/esm/context/types.d.ts.map +1 -1
  11. package/esm/dsl/model/ModelBase.d.ts.map +1 -1
  12. package/esm/dsl/model/ModelBase.js +1 -1
  13. package/esm/dsl/model/ModelInsertable.d.ts +13 -5
  14. package/esm/dsl/model/ModelInsertable.d.ts.map +1 -1
  15. package/esm/dsl/model/toModelGateway.d.ts +26 -0
  16. package/esm/dsl/model/toModelGateway.d.ts.map +1 -0
  17. package/esm/dsl/model/toModelGateway.js +70 -0
  18. package/esm/dsl/model/toModelInsertable.d.ts +36 -0
  19. package/esm/dsl/model/toModelInsertable.d.ts.map +1 -0
  20. package/esm/dsl/model/{toModelBase.js → toModelInsertable.js} +3 -41
  21. package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
  22. package/esm/dsl/operation/OperationBase.js +1 -1
  23. package/esm/dsl/operation/OperationInsertable.d.ts +17 -5
  24. package/esm/dsl/operation/OperationInsertable.d.ts.map +1 -1
  25. package/esm/dsl/operation/toOperationGateway.d.ts +28 -0
  26. package/esm/dsl/operation/toOperationGateway.d.ts.map +1 -0
  27. package/esm/dsl/operation/toOperationGateway.js +70 -0
  28. package/esm/dsl/operation/toOperationInsertable.d.ts +43 -0
  29. package/esm/dsl/operation/toOperationInsertable.d.ts.map +1 -0
  30. package/esm/dsl/operation/{toOperationBase.js → toOperationInsertable.js} +3 -41
  31. package/esm/helpers/ResultsLog.d.ts +2 -2
  32. package/esm/helpers/ResultsLog.d.ts.map +1 -1
  33. package/esm/helpers/ResultsLog.js +11 -3
  34. package/esm/mod.d.ts +4 -2
  35. package/esm/mod.d.ts.map +1 -1
  36. package/esm/mod.js +4 -2
  37. package/esm/types/Results.d.ts +3 -3
  38. package/esm/types/Results.d.ts.map +1 -1
  39. package/esm/types/Results.js +2 -2
  40. package/esm/types/Settings.d.ts +24 -12
  41. package/esm/types/Settings.d.ts.map +1 -1
  42. package/esm/types/Settings.js +4 -3
  43. package/package.json +1 -1
  44. package/script/context/CoreContext.d.ts +2 -2
  45. package/script/context/CoreContext.d.ts.map +1 -1
  46. package/script/context/CoreContext.js +0 -1
  47. package/script/context/GenerateContext.d.ts +46 -14
  48. package/script/context/GenerateContext.d.ts.map +1 -1
  49. package/script/context/GenerateContext.js +187 -76
  50. package/script/context/RenderContext.d.ts +3 -3
  51. package/script/context/RenderContext.d.ts.map +1 -1
  52. package/script/context/types.d.ts +2 -2
  53. package/script/context/types.d.ts.map +1 -1
  54. package/script/dsl/model/ModelBase.d.ts.map +1 -1
  55. package/script/dsl/model/ModelBase.js +1 -1
  56. package/script/dsl/model/ModelInsertable.d.ts +13 -5
  57. package/script/dsl/model/ModelInsertable.d.ts.map +1 -1
  58. package/script/dsl/model/toModelGateway.d.ts +26 -0
  59. package/script/dsl/model/toModelGateway.d.ts.map +1 -0
  60. package/script/dsl/model/toModelGateway.js +74 -0
  61. package/script/dsl/model/toModelInsertable.d.ts +36 -0
  62. package/script/dsl/model/toModelInsertable.d.ts.map +1 -0
  63. package/script/dsl/model/{toModelBase.js → toModelInsertable.js} +5 -43
  64. package/script/dsl/operation/OperationBase.d.ts.map +1 -1
  65. package/script/dsl/operation/OperationBase.js +1 -1
  66. package/script/dsl/operation/OperationInsertable.d.ts +17 -5
  67. package/script/dsl/operation/OperationInsertable.d.ts.map +1 -1
  68. package/script/dsl/operation/toOperationGateway.d.ts +28 -0
  69. package/script/dsl/operation/toOperationGateway.d.ts.map +1 -0
  70. package/script/dsl/operation/toOperationGateway.js +74 -0
  71. package/script/dsl/operation/toOperationInsertable.d.ts +43 -0
  72. package/script/dsl/operation/toOperationInsertable.d.ts.map +1 -0
  73. package/script/dsl/operation/{toOperationBase.js → toOperationInsertable.js} +5 -43
  74. package/script/helpers/ResultsLog.d.ts +2 -2
  75. package/script/helpers/ResultsLog.d.ts.map +1 -1
  76. package/script/helpers/ResultsLog.js +11 -3
  77. package/script/mod.d.ts +4 -2
  78. package/script/mod.d.ts.map +1 -1
  79. package/script/mod.js +4 -2
  80. package/script/types/Results.d.ts +3 -3
  81. package/script/types/Results.d.ts.map +1 -1
  82. package/script/types/Results.js +3 -3
  83. package/script/types/Settings.d.ts +24 -12
  84. package/script/types/Settings.d.ts.map +1 -1
  85. package/script/types/Settings.js +4 -3
  86. package/esm/dsl/model/toModelBase.d.ts +0 -48
  87. package/esm/dsl/model/toModelBase.d.ts.map +0 -1
  88. package/esm/dsl/operation/toOperationBase.d.ts +0 -55
  89. package/esm/dsl/operation/toOperationBase.d.ts.map +0 -1
  90. package/script/dsl/model/toModelBase.d.ts +0 -48
  91. package/script/dsl/model/toModelBase.d.ts.map +0 -1
  92. package/script/dsl/operation/toOperationBase.d.ts +0 -55
  93. 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
- const responseDefinition = new Definition_js_1.Definition({
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: [responseDefinition],
181
+ definitions: [definition],
157
182
  destinationPath
158
183
  });
159
- return responseDefinition;
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 or model into the output file with path `destinationPath`.
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 or model
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/model using the
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
- insert({ generation, destinationPath, ...rest }) {
210
- const { settings, definition } = (0, ts_pattern_1.match)(rest)
211
- .with({ operation: ts_pattern_1.P.nonNullable }, ({ insertable, operation }) => {
212
- return new OperationDriver_js_1.OperationDriver({
213
- context: this,
214
- insertable,
215
- operation,
216
- generation,
217
- destinationPath
218
- });
219
- })
220
- .with({ refName: ts_pattern_1.P.nonNullable }, ({ insertable, refName }) => {
221
- return new ModelDriver_js_1.ModelDriver({
222
- context: this,
223
- insertable,
224
- refName,
225
- generation,
226
- destinationPath
227
- });
228
- })
229
- .exhaustive();
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.toOperationBaseSettings({
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 e = insertable.toExportPath({ operation, baseSettings });
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: e,
253
- importFrom: baseSettings.importFrom ?? e
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 e = insertable.toExportPath({ refName, baseSettings });
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: e,
275
- importFrom: baseSettings.importFrom ?? e
310
+ exportPath,
311
+ importFrom: baseSettings.importFrom ?? exportPath
276
312
  });
277
313
  }
278
314
  /**
279
- * Look up operation settings for a given generatorId, path and method.
280
- * @param { generatorId, path, method }
281
- * @returns Base settings for operation
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
- toOperationBaseSettings({ generatorId, path, method }) {
284
- const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
285
- const operationSettings = generatorSettings && 'operations' in generatorSettings
286
- ? generatorSettings.operations?.[path]?.[method]
287
- : undefined;
288
- const exportPath = operationSettings?.exportPath
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
- selected: Boolean(operationSettings?.selected),
294
- name: operationSettings?.name,
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 generatorInstance = new generator(this);
327
- return oasDocument.operations.forEach(operation => {
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
- if (generator.isSupported(operation)) {
337
- this.trace([path, method], () => {
338
- generatorInstance.transformOperation(operation);
339
- this.captureCurrentResult('success');
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
- if (generator.isSupported(operation)) {
355
- this.trace([path, method], () => {
356
- this.insert({ insertable: generator, operation });
357
- this.captureCurrentResult('success');
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 generatorInstance = new generator(this);
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
- return refNames.forEach(refName => {
434
+ refNames.forEach(refName => {
368
435
  this.trace(refName, () => {
369
- generatorInstance.transformModel(refName);
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
- this.insert({ insertable: generator, refName });
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
- const baseSettings = {
404
- exportPath,
405
- selected: Boolean(modelSettings?.selected),
406
- name: modelSettings?.name,
407
- importFrom: modelSettings?.importFrom
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 { SuccessWarningError } from '../types/Results.js';
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: SuccessWarningError) => void;
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: SuccessWarningError) => void;
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,EACV,mBAAmB,EACnB,YAAY,EAEZ,YAAY,EACb,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAGpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAG9D,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,mBAAmB,KAAK,IAAI,CAAA;CAC5D,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,s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';
2
2
  import type { GeneratorKey } from '../types/GeneratorKeys.js';
3
3
  import type { ManifestEntry } from '../types/Manifest.js';
4
- import type { SuccessWarningError } from '../types/Results.js';
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, SuccessWarningError>;
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,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,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,M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Q,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"}
@@ -28,7 +28,7 @@ class ModelBase extends ValueBase_js_1.ValueBase {
28
28
  this.settings = settings;
29
29
  }
30
30
  transform(insertable, refName) {
31
- return this.context.insert({
31
+ return this.context.insertModel({
32
32
  insertable,
33
33
  refName,
34
34
  generation: 'force',
@@ -9,7 +9,7 @@ type ModelInsertableConstructorArgs = {
9
9
  settings: ContentSettings;
10
10
  destinationPath: string;
11
11
  };
12
- export type ToModelInsertableArgs = {
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: GenerateContext): WithTransformModel;
32
+ new ({ context, settings }: ModelGatewayConstructorArgs): WithTransformModel;
29
33
  id: string;
30
34
  type: 'model';
31
35
  _class: 'ModelGateway';
32
- pinnable: boolean;
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 }: ToModelInsertableArgs) => Identifier;
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,M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B,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;