@skmtc/core 0.0.333 → 0.0.334

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 (37) hide show
  1. package/esm/context/GenerateContext.d.ts +12 -4
  2. package/esm/context/GenerateContext.d.ts.map +1 -1
  3. package/esm/context/GenerateContext.js +57 -31
  4. package/esm/dsl/ModelDriver.d.ts +1 -2
  5. package/esm/dsl/ModelDriver.d.ts.map +1 -1
  6. package/esm/dsl/ModelDriver.js +2 -19
  7. package/esm/dsl/OperationDriver.d.ts +1 -2
  8. package/esm/dsl/OperationDriver.d.ts.map +1 -1
  9. package/esm/dsl/OperationDriver.js +2 -20
  10. package/esm/dsl/ValueBase.d.ts +2 -2
  11. package/esm/dsl/ValueBase.d.ts.map +1 -1
  12. package/esm/dsl/ValueBase.js +2 -3
  13. package/esm/dsl/withConfig.d.ts +2 -2
  14. package/esm/types/GeneratedValue.d.ts +1 -1
  15. package/esm/types/GeneratedValue.d.ts.map +1 -1
  16. package/esm/typescript/List.d.ts +70 -3
  17. package/esm/typescript/List.d.ts.map +1 -1
  18. package/esm/typescript/List.js +94 -6
  19. package/package.json +1 -1
  20. package/script/context/GenerateContext.d.ts +12 -4
  21. package/script/context/GenerateContext.d.ts.map +1 -1
  22. package/script/context/GenerateContext.js +57 -31
  23. package/script/dsl/ModelDriver.d.ts +1 -2
  24. package/script/dsl/ModelDriver.d.ts.map +1 -1
  25. package/script/dsl/ModelDriver.js +2 -19
  26. package/script/dsl/OperationDriver.d.ts +1 -2
  27. package/script/dsl/OperationDriver.d.ts.map +1 -1
  28. package/script/dsl/OperationDriver.js +2 -20
  29. package/script/dsl/ValueBase.d.ts +2 -2
  30. package/script/dsl/ValueBase.d.ts.map +1 -1
  31. package/script/dsl/ValueBase.js +2 -3
  32. package/script/dsl/withConfig.d.ts +2 -2
  33. package/script/types/GeneratedValue.d.ts +1 -1
  34. package/script/types/GeneratedValue.d.ts.map +1 -1
  35. package/script/typescript/List.d.ts +70 -3
  36. package/script/typescript/List.d.ts.map +1 -1
  37. package/script/typescript/List.js +94 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.333",
3
+ "version": "0.0.334",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -4,13 +4,13 @@ import type { OasDocument } from '../oas/document/Document.js';
4
4
  import type { OasSchema } from '../oas/schema/Schema.js';
5
5
  import type { OasRef } from '../oas/ref/Ref.js';
6
6
  import type { FileContents, GetFileOptions } from './types.js';
7
- import type { BaseSettings, ClientSettings } from '../types/Settings.js';
7
+ import type { ClientSettings } from '../types/Settings.js';
8
8
  import type { Method } from '../types/Method.js';
9
9
  import type { OperationInsertable, OperationGenerator } from '../dsl/OperationInsertable.js';
10
10
  import type { OasOperation } from '../oas/operation/Operation.js';
11
11
  import type { ModelInsertable, ModelGenerator } from '../dsl/ModelInsertable.js';
12
12
  import type { GenerationType, GeneratedDefintion, GeneratedValue } from '../types/GeneratedValue.js';
13
- import type { ContentSettings } from '../dsl/ContentSettings.js';
13
+ import { ContentSettings } from '../dsl/ContentSettings.js';
14
14
  import type { RefName } from '../types/RefName.js';
15
15
  import type * as log from '../deps/jsr.io/@std/log/0.224.7/mod.js';
16
16
  import type { GeneratorKey } from '../types/GeneratorKeys.js';
@@ -71,6 +71,14 @@ export type InsertReturn<V extends GeneratedValue, T extends GenerationType> = {
71
71
  settings: ContentSettings;
72
72
  definition: GeneratedDefintion<V, T>;
73
73
  };
74
+ type ToOperationSettingsArgs<V> = {
75
+ operation: OasOperation;
76
+ insertable: OperationInsertable<V>;
77
+ };
78
+ type BuildModelSettingsArgs<V> = {
79
+ refName: RefName;
80
+ insertable: ModelInsertable<V>;
81
+ };
74
82
  export declare class GenerateContext {
75
83
  #private;
76
84
  schemaModel: OasDocument;
@@ -85,8 +93,8 @@ export declare class GenerateContext {
85
93
  defineValue<Schema extends SchemaType>({ schema, identifier, destinationPath, schemaToValueFn }: DefineArgs<Schema>): Definition<TypeSystemOutput<Schema['type']>>;
86
94
  register({ imports, definitions, destinationPath }: RegisterArgs): void;
87
95
  insert<V extends GeneratedValue, T extends GenerationType>({ generation, destinationPath, ...rest }: InsertArgs<V, T>): InsertReturn<V, T>;
88
- getOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
89
- getModelBaseSettings({ generatorId, refName }: GetModelSettingsArgs): BaseSettings;
96
+ toOperationContentSettings<V>({ operation, insertable }: ToOperationSettingsArgs<V>): ContentSettings;
97
+ toModelContentSettings<V>({ refName, insertable }: BuildModelSettingsArgs<V>): ContentSettings;
90
98
  addFile(normalisedPath: string): FileContents;
91
99
  resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
92
100
  /** Produce external instance and return its name */
@@ -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;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAA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AC,GAAG,eAAe;IAiB/C,sBAAsB,CAAC,CAAC,EAAE,EACxB,OAAO,EACP,UAAU,EACX,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,eAAe;IAoE9C,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY;IAgB7C,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE,oDAAoD;IACpD,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;
36
+ var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_toOperationBaseSettings, _GenerateContext_toModelBaseSettings;
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");
@@ -41,6 +41,7 @@ const Import_js_1 = require("../dsl/Import.js");
41
41
  const Definition_js_1 = require("../dsl/Definition.js");
42
42
  const OperationDriver_js_1 = require("../dsl/OperationDriver.js");
43
43
  const ModelDriver_js_1 = require("../dsl/ModelDriver.js");
44
+ const ContentSettings_js_1 = require("../dsl/ContentSettings.js");
44
45
  const Sentry = __importStar(require("@sentry/deno"));
45
46
  const tracer_js_1 = require("../helpers/tracer.js");
46
47
  class GenerateContext {
@@ -194,37 +195,32 @@ class GenerateContext {
194
195
  return { settings, definition };
195
196
  }
196
197
  }
197
- getOperationBaseSettings({ generatorId, path, method }) {
198
- const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
199
- const operationSettings = generatorSettings && 'operations' in generatorSettings
200
- ? generatorSettings.operations?.[path]?.[method]
201
- : undefined;
202
- const exportPath = operationSettings?.exportPath
203
- ? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
204
- : undefined;
205
- const baseSettings = {
206
- exportPath,
207
- selected: Boolean(operationSettings?.selected),
208
- name: operationSettings?.name,
209
- importFrom: operationSettings?.importFrom
210
- };
211
- return baseSettings;
198
+ toOperationContentSettings({ operation, insertable }) {
199
+ const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toOperationBaseSettings).call(this, {
200
+ generatorId: insertable.id,
201
+ path: operation.path,
202
+ method: operation.method
203
+ });
204
+ const e = insertable.toExportPath({ operation, baseSettings });
205
+ return new ContentSettings_js_1.ContentSettings({
206
+ name: insertable.toName({ operation, baseSettings }),
207
+ selected: insertable.isSelected({ operation, baseSettings }),
208
+ exportPath: e,
209
+ importFrom: baseSettings.importFrom ?? e
210
+ });
212
211
  }
213
- getModelBaseSettings({ generatorId, refName }) {
214
- const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
215
- const modelSettings = generatorSettings && 'models' in generatorSettings
216
- ? generatorSettings?.models?.[refName]
217
- : undefined;
218
- const exportPath = modelSettings?.exportPath
219
- ? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', modelSettings?.exportPath)
220
- : undefined;
221
- const baseSettings = {
222
- exportPath,
223
- selected: Boolean(modelSettings?.selected),
224
- name: modelSettings?.name,
225
- importFrom: modelSettings?.importFrom
226
- };
227
- return baseSettings;
212
+ toModelContentSettings({ refName, insertable }) {
213
+ const baseSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toModelBaseSettings).call(this, {
214
+ generatorId: insertable.id,
215
+ refName
216
+ });
217
+ const e = insertable.toExportPath({ refName, baseSettings });
218
+ return new ContentSettings_js_1.ContentSettings({
219
+ name: insertable.toName({ refName, baseSettings }),
220
+ selected: insertable.isSelected({ refName, baseSettings }),
221
+ exportPath: e,
222
+ importFrom: baseSettings.importFrom ?? e
223
+ });
228
224
  }
229
225
  addFile(normalisedPath) {
230
226
  if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
@@ -278,4 +274,34 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
278
274
  this.captureCurrentResult('success');
279
275
  });
280
276
  });
277
+ }, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
278
+ const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
279
+ const operationSettings = generatorSettings && 'operations' in generatorSettings
280
+ ? generatorSettings.operations?.[path]?.[method]
281
+ : undefined;
282
+ const exportPath = operationSettings?.exportPath
283
+ ? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
284
+ : undefined;
285
+ const baseSettings = {
286
+ exportPath,
287
+ selected: Boolean(operationSettings?.selected),
288
+ name: operationSettings?.name,
289
+ importFrom: operationSettings?.importFrom
290
+ };
291
+ return baseSettings;
292
+ }, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
293
+ const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
294
+ const modelSettings = generatorSettings && 'models' in generatorSettings
295
+ ? generatorSettings?.models?.[refName]
296
+ : undefined;
297
+ const exportPath = modelSettings?.exportPath
298
+ ? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', modelSettings?.exportPath)
299
+ : undefined;
300
+ const baseSettings = {
301
+ exportPath,
302
+ selected: Boolean(modelSettings?.selected),
303
+ name: modelSettings?.name,
304
+ importFrom: modelSettings?.importFrom
305
+ };
306
+ return baseSettings;
281
307
  };
@@ -1,6 +1,6 @@
1
1
  import type { ModelInsertable } from './ModelInsertable.js';
2
2
  import type { GenerateContext } from '../context/GenerateContext.js';
3
- import { ContentSettings } from './ContentSettings.js';
3
+ import type { ContentSettings } from './ContentSettings.js';
4
4
  import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
5
5
  import type { GeneratedValue } from '../types/GeneratedValue.js';
6
6
  import type { RefName } from '../types/RefName.js';
@@ -24,7 +24,6 @@ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationT
24
24
  get exportPath(): string;
25
25
  private apply;
26
26
  private getDefinition;
27
- private buildModelSettings;
28
27
  private affirmDefinition;
29
28
  }
30
29
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAKtD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,IAAI;IACzE,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,CAAC,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAgBD,qBAAa,WAAW,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc;IACzE,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,eAAe,CAAC,CAAC,CA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C,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc;IACzE,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,eAAe,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBACxB,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EAChB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAUxB,IAAI,KAAK,IAAI,CAAC,CAQb;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,aAAa;IA6CrB,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModelDriver = void 0;
4
- const ContentSettings_js_1 = require("./ContentSettings.js");
5
4
  const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
6
5
  const Definition_js_1 = require("./Definition.js");
7
6
  const Identifier_js_1 = require("./Identifier.js");
@@ -49,11 +48,8 @@ class ModelDriver {
49
48
  this.insertable = insertable;
50
49
  this.refName = refName;
51
50
  this.destinationPath = destinationPath;
52
- this.settings = this.buildModelSettings({ refName, insertable });
53
- this.definition = this.apply({
54
- generation,
55
- destinationPath
56
- });
51
+ this.settings = this.context.toModelContentSettings({ refName, insertable });
52
+ this.definition = this.apply({ generation, destinationPath });
57
53
  }
58
54
  get value() {
59
55
  if (!this.definition) {
@@ -115,19 +111,6 @@ class ModelDriver {
115
111
  });
116
112
  return definition;
117
113
  }
118
- buildModelSettings({ refName, insertable }) {
119
- const baseSettings = this.context.getModelBaseSettings({
120
- generatorId: insertable.id,
121
- refName
122
- });
123
- const e = insertable.toExportPath({ refName, baseSettings });
124
- return new ContentSettings_js_1.ContentSettings({
125
- name: insertable.toName({ refName, baseSettings }),
126
- selected: insertable.isSelected({ refName, baseSettings }),
127
- exportPath: e,
128
- importFrom: baseSettings.importFrom ?? e
129
- });
130
- }
131
114
  affirmDefinition(definition) {
132
115
  if (!definition) {
133
116
  return false;
@@ -1,6 +1,6 @@
1
1
  import type { OperationInsertable } from './OperationInsertable.js';
2
2
  import type { OasOperation } from '../oas/operation/Operation.js';
3
- import { ContentSettings } from './ContentSettings.js';
3
+ import type { ContentSettings } from './ContentSettings.js';
4
4
  import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
5
5
  import type { GeneratedValue } from '../types/GeneratedValue.js';
6
6
  import type { GenerateContext } from '../context/GenerateContext.js';
@@ -24,7 +24,6 @@ export declare class OperationDriver<V extends GeneratedValue, T extends Generat
24
24
  get exportPath(): string;
25
25
  private apply;
26
26
  private getDefinition;
27
- private buildOperationSettings;
28
27
  private affirmDefinition;
29
28
  }
30
29
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAItD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,IAAI;IAC7E,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,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B,CAAA;AAEpE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,IAAI;IAC7E,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAClC,SAAS,EAAE,YAAY,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAYD,qBAAa,eAAe,CAC1B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,cAAc;IAExB,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAClC,SAAS,EAAE,YAAY,CAAA;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBAExB,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EAChB,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC;IAc5B,IAAI,KAAK,IAAI,CAAC,CAQb;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,aAAa;IAyCrB,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OperationDriver = void 0;
4
- const ContentSettings_js_1 = require("./ContentSettings.js");
5
4
  const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
6
5
  const Definition_js_1 = require("./Definition.js");
7
6
  const Identifier_js_1 = require("./Identifier.js");
@@ -49,14 +48,11 @@ class OperationDriver {
49
48
  this.insertable = insertable;
50
49
  this.operation = operation;
51
50
  this.destinationPath = destinationPath;
52
- this.settings = this.buildOperationSettings({
51
+ this.settings = this.context.toOperationContentSettings({
53
52
  operation,
54
53
  insertable
55
54
  });
56
- this.definition = this.apply({
57
- generation,
58
- destinationPath
59
- });
55
+ this.definition = this.apply({ generation, destinationPath });
60
56
  }
61
57
  get value() {
62
58
  if (!this.definition) {
@@ -114,20 +110,6 @@ class OperationDriver {
114
110
  });
115
111
  return definition;
116
112
  }
117
- buildOperationSettings({ operation, insertable }) {
118
- const baseSettings = this.context.getOperationBaseSettings({
119
- generatorId: insertable.id,
120
- path: operation.path,
121
- method: operation.method
122
- });
123
- const e = insertable.toExportPath({ operation, baseSettings });
124
- return new ContentSettings_js_1.ContentSettings({
125
- name: insertable.toName({ operation, baseSettings }),
126
- selected: insertable.isSelected({ operation, baseSettings }),
127
- exportPath: e,
128
- importFrom: baseSettings.importFrom ?? e
129
- });
130
- }
131
113
  affirmDefinition(definition) {
132
114
  if (!definition) {
133
115
  return false;
@@ -3,12 +3,12 @@ import type { RegisterArgs } from '../context/GenerateContext.js';
3
3
  import type { GeneratorKey } from '../types/GeneratorKeys.js';
4
4
  type ValueBaseArgs = {
5
5
  context: GenerateContext;
6
- generatorKey: GeneratorKey;
6
+ generatorKey?: GeneratorKey;
7
7
  };
8
8
  export declare class ValueBase {
9
9
  context: GenerateContext;
10
10
  skipped: boolean;
11
- generatorKey: GeneratorKey;
11
+ generatorKey: GeneratorKey | undefined;
12
12
  constructor({ context, generatorKey }: ValueBaseArgs);
13
13
  register(args: RegisterArgs): void;
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ValueBase.d.ts","sourceRoot":"","sources":["../../src/dsl/ValueBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,OAAO,CAAQ;IACxB,YAAY,EAAE,YAAY,CAAA;gBAEd,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,aAAa;IAOpD,QAAQ,CAAC,IAAI,EAAE,YAAY;CAG5B"}
1
+ {"version":3,"file":"ValueBase.d.ts","sourceRoot":"","sources":["../../src/dsl/ValueBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,OAAO,CAAQ;IACxB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAA;gBAE1B,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,aAAa;IAOpD,QAAQ,CAAC,IAAI,EAAE,YAAY;CAG5B"}
@@ -35,10 +35,9 @@ const proxyHandler = {
35
35
  return propertyName === 'toString'
36
36
  ? new Proxy(target[propertyName], {
37
37
  apply: (toString, thisArg) => {
38
- if (!target.generatorKey) {
39
- throw new Error('generatorKey is required');
38
+ if (target.generatorKey) {
39
+ target.context.callback(target.generatorKey);
40
40
  }
41
- target.context.callback(target.generatorKey);
42
41
  return toString.apply(thisArg);
43
42
  }
44
43
  })
@@ -49,7 +49,7 @@ export declare const toOperationInsertable: (config: OperationConfig) => {
49
49
  register(args: Partial<import("../context/GenerateContext.js").RegisterArgs>): void;
50
50
  context: GenerateContext;
51
51
  skipped: boolean;
52
- generatorKey: import("../types/GeneratorKeys.js").GeneratorKey;
52
+ generatorKey: import("../types/GeneratorKeys.js").GeneratorKey | undefined;
53
53
  };
54
54
  id: string;
55
55
  entityType: EntityType;
@@ -84,7 +84,7 @@ export declare const toModelInsertable: (config: ModelConfig) => {
84
84
  register(args: Partial<import("../context/GenerateContext.js").RegisterArgs>): void;
85
85
  context: GenerateContext;
86
86
  skipped: boolean;
87
- generatorKey: import("../types/GeneratorKeys.js").GeneratorKey;
87
+ generatorKey: import("../types/GeneratorKeys.js").GeneratorKey | undefined;
88
88
  };
89
89
  id: string;
90
90
  type: "model";
@@ -13,7 +13,7 @@ import type { GeneratorKey } from './GeneratorKeys.js';
13
13
  */
14
14
  export type GenerationType = 'force' | 'regular';
15
15
  export type GeneratedValue = Stringable & {
16
- generatorKey: GeneratorKey;
16
+ generatorKey?: GeneratorKey;
17
17
  };
18
18
  export type GeneratedDefintion<V extends GeneratedValue, T extends GenerationType> = T extends 'force' ? Definition<V> : Definition<V> | undefined;
19
19
  //# sourceMappingURL=GeneratedValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GeneratedValue.d.ts","sourceRoot":"","sources":["../../src/types/GeneratedValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;;;GASG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAA;AAEhD,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,cAAc,IACtB,CAAC,SAAS,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA"}
1
+ {"version":3,"file":"GeneratedValue.d.ts","sourceRoot":"","sources":["../../src/types/GeneratedValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;;;GASG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAA;AAEhD,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,kBAAkB,CAC5B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,cAAc,IACtB,CAAC,SAAS,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA"}
@@ -1,23 +1,90 @@
1
1
  import type { Stringable } from '../dsl/Stringable.js';
2
2
  type ConstructorOptions = {
3
3
  separator?: string;
4
- bookends?: 'square' | 'curly' | 'round' | 'none';
4
+ bookends?: 'square' | 'curly' | 'round' | 'angle' | 'none';
5
5
  };
6
6
  export declare class List {
7
7
  values: Stringable[];
8
8
  separator: string;
9
- bookends: 'square' | 'curly' | 'round' | 'none';
9
+ bookends: 'square' | 'curly' | 'round' | 'angle' | 'none';
10
10
  constructor(values: (Stringable | undefined)[], { separator, bookends }?: ConstructorOptions);
11
11
  toString(): string;
12
+ /**
13
+ * Create an empty List that will render as an empty string ''
14
+ * @returns List
15
+ */
12
16
  static toEmpty: () => List;
17
+ /**
18
+ * Create a List with a single value that will render as `value`
19
+ * @param value
20
+ * @returns List
21
+ */
13
22
  static toSingle: (value: Stringable) => List;
14
- static toOptional: (value: Stringable, condition: boolean) => List;
23
+ /**
24
+ * If condition is true, return a List with a single value that will render as `value`.
25
+ * Otherwise, return an empty List that will render as an empty string ''.
26
+ *
27
+ * Useful for conditional rendering. For example, rendering a function arg object when
28
+ * it has at least one property.
29
+ * @param value
30
+ * @param condition
31
+ * @returns List
32
+ */
33
+ static toConditional: (value: Stringable, condition: boolean) => List;
34
+ /**
35
+ * Create a record with Stringable values. KeyValue pairs will be joined with `: ` as separator
36
+ * and the resulting List will be wrapped with `{}`
37
+ * @param record
38
+ * @returns `record` with `Stringable` values
39
+ */
40
+ static toRecord: (record: Record<string, Stringable | Stringable[] | List>) => List;
41
+ /**
42
+ * Create a record with `undefined` or empty array or List values filtered out.
43
+ * @param record
44
+ * @returns `record` with `undefined` values filtered out
45
+ */
15
46
  static toFilteredRecord: (record: Record<string, undefined | Stringable | Stringable[] | List>) => List;
47
+ /**
48
+ * Join `key` and `value` using `: ` as separator
49
+ * @param key
50
+ * @param value
51
+ * @returns `key` and `value` joined with `: ` as separator
52
+ */
16
53
  static toKeyValue: (key: string, value: Stringable) => List;
54
+ /**
55
+ * Join `key` and `value` using `.` as separator
56
+ * @param key
57
+ * @param value
58
+ * @returns `key` and `value` joined with `.` as separator
59
+ */
17
60
  static toObjectKey: (key: string, value: Stringable) => List;
61
+ /**
62
+ * Join `values` using `, ` as separator and wrap in `{` and `}`
63
+ * @param values
64
+ * @returns `values` joined with `, ` as separator and wrapped in `{` and `}`
65
+ */
18
66
  static toObject: (values: (Stringable | undefined)[]) => List;
67
+ /**
68
+ * Create a List using the keys of a record
69
+ * @param record
70
+ * @returns List of record keys
71
+ */
19
72
  static fromRecord: (record: Record<string, Stringable> | undefined) => List;
73
+ /**
74
+ * Create a keyValue pair if `value` is not undefined and is not an empty array or List.
75
+ * Return `undefined` otherwise.
76
+ *
77
+ * Useful for filtering out `undefined values from a record.
78
+ * @param key
79
+ * @param value
80
+ * @returns `key` and `value` joined with `: ` as separator if `value` is not undefined and is not an empty array or List. `undefined` otherwise.
81
+ */
20
82
  static toFilteredKeyValue: (key: string, value: undefined | Stringable | Stringable[] | List) => List | undefined;
83
+ /**
84
+ * Check if `value` is not undefined and is not an empty array or List.
85
+ * @param value
86
+ * @returns `true` if `value` is not undefined and is not an empty array or List. `false` otherwise.
87
+ */
21
88
  static hasValue: (value: undefined | Stringable | Stringable[] | List) => value is Stringable | Stringable[] | List;
22
89
  }
23
90
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../src/typescript/List.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAGtD,KAAK,kBAAkB,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;CACjD,CAAA;AAED,qBAAa,IAAI;IACf,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;gBAE7C,MAAM,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,EAClC,EAAE,SAAgB,EAAE,QAAiB,EAAE,GAAE,kBAAuB;IAQlE,QAAQ,IAAI,MAAM;IAWlB,MAAM,CAAC,OAAO,aAA2C;IAEzD,MAAM,CAAC,QAAQ,UAAW,UAAU,UACK;IAEzC,MAAM,CAAC,UAAU,UAAW,UAAU,aAAa,OAAO,UACf;IAE3C,MAAM,CAAC,gBAAgB,WACb,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,EAAE,GAAG,IAAI,CAAC,UAOrE;IAED,MAAM,CAAC,UAAU,QAAS,MAAM,SAAS,UAAU,UACN;IAE7C,MAAM,CAAC,WAAW,QAAS,MAAM,SAAS,UAAU,UACR;IAE5C,MAAM,CAAC,QAAQ,WAAY,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,UACZ;IAEzC,MAA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