@skmtc/core 0.0.264 → 0.0.266

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.
@@ -1,32 +1,20 @@
1
- import type { ParseContext } from './ParseContext.js';
2
1
  import { GenerateContext } from './GenerateContext.js';
3
- import type { AddRenderDependencyArgs, GetModelSettingsArgs, GetOperationSettingsArgs, PickArgs, RegisterArgs, TransformReturn } from './GenerateContext.js';
4
- import type { PrettierConfigType } from '../types/prettierConfig.js';
5
- import type { OasDocument } from '../oas/document/Document.js';
2
+ import type { AddRenderDependencyArgs, GetModelSettingsArgs, GetOperationSettingsArgs, PickArgs, RegisterArgs, InsertReturn, InsertArgs } from './GenerateContext.js';
6
3
  import { RenderContext, type FilesRenderResult } from './RenderContext.js';
7
4
  import type { AddGeneratorKeyArgs, FileContents, RenderDependencies, RenderOptions } from './types.js';
5
+ import type { ParseContext } from './ParseContext.js';
6
+ import type { PrettierConfigType } from '../types/prettierConfig.js';
7
+ import type { OasDocument } from '../oas/document/Document.js';
8
8
  import type { OpenAPIV3 } from 'openapi-types';
9
9
  import type { BaseSettings, ClientSettings } from '../types/Settings.js';
10
10
  import type { Definition } from '../dsl/Definition.js';
11
- import type { OperationInsertable, OperationGenerator } from '../dsl/OperationInsertable.js';
12
- import type { ModelInsertable, ModelGenerator } from '../dsl/ModelInsertable.js';
11
+ import type { OperationGenerator } from '../dsl/OperationInsertable.js';
12
+ import type { ModelGenerator } from '../dsl/ModelInsertable.js';
13
13
  import type { GeneratedValue } from '../types/GeneratedValue.js';
14
14
  import type { OasSchema } from '../oas/schema/Schema.js';
15
15
  import type { OasRef } from '../oas/ref/Ref.js';
16
- import type { OasOperation } from '../oas/operation/Operation.js';
17
- import type { GenerationType } from '../types/GenerationType.js';
16
+ import type { GenerationType } from '../types/GeneratedValue.js';
18
17
  import type { RefName } from '../types/RefName.js';
19
- type TransformArgs<V extends GeneratedValue> = {
20
- insertable: OperationInsertable<V>;
21
- operation: OasOperation;
22
- generation?: GenerationType;
23
- destinationPath?: string;
24
- } | {
25
- insertable: ModelInsertable<V>;
26
- refName: RefName;
27
- generation?: GenerationType;
28
- destinationPath?: string;
29
- };
30
18
  type SharedContext = {
31
19
  type: 'parse';
32
20
  context: ParseContext;
@@ -67,7 +55,7 @@ export declare class CoreContext {
67
55
  render(options: RenderOptions): FilesRenderResult;
68
56
  addFile(normalisedPath: string): FileContents;
69
57
  getOperationBaseSettings(args: GetOperationSettingsArgs): BaseSettings;
70
- insert<V extends GeneratedValue>(args: TransformArgs<V>): TransformReturn<V>;
58
+ insert<V extends GeneratedValue, T extends GenerationType>(args: InsertArgs<V, T>): InsertReturn<V, T>;
71
59
  getModelBaseSettings(args: GetModelSettingsArgs): BaseSettings;
72
60
  get files(): Map<string, FileContents>;
73
61
  get renderDependencies(): RenderDependencies;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MA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B,GAAG,YAAY;IAc9D,IAAI,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAQrC;IAED,IAAI,kBAAkB,IAAI,kBAAkB,CAQ3C;IAED,IAAI,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ7C;IAED,IAAI,WAAW,IAAI,WAAW,CAU7B;IAED,IAAI,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAUvE;IAED,IAAI,cAAc,IAAI,SAAS,CAAC,QAAQ,CAUvC;IAED,IAAI,QAAQ,IAAI,cAAc,GAAG,SAAS,CAUzC;CACF"}
@@ -10,8 +10,7 @@ import type { OperationInsertable, OperationGenerator } from '../dsl/OperationIn
10
10
  import type { OasOperation } from '../oas/operation/Operation.js';
11
11
  import type { CoreContext } from './CoreContext.js';
12
12
  import type { ModelInsertable, ModelGenerator } from '../dsl/ModelInsertable.js';
13
- import type { GenerationType } from '../types/GenerationType.js';
14
- import type { GeneratedValue } from '../types/GeneratedValue.js';
13
+ import type { GenerationType, GeneratedDefintion, GeneratedValue } from '../types/GeneratedValue.js';
15
14
  import type { ContentSettings } from '../dsl/ContentSettings.js';
16
15
  import type { RefName } from '../types/RefName.js';
17
16
  type ConstructorArgs = {
@@ -43,22 +42,20 @@ export type GetModelSettingsArgs = {
43
42
  generatorId: string;
44
43
  refName: RefName;
45
44
  };
46
- export type TransformArgs<V extends GeneratedValue> = {
47
- coreContext: CoreContext;
45
+ export type InsertArgs<V extends GeneratedValue, T extends GenerationType> = {
48
46
  insertable: OperationInsertable<V>;
49
47
  operation: OasOperation;
50
- generation?: GenerationType;
48
+ generation?: T;
51
49
  destinationPath?: string;
52
50
  } | {
53
- coreContext: CoreContext;
54
51
  insertable: ModelInsertable<V>;
55
52
  refName: RefName;
56
- generation?: GenerationType;
53
+ generation?: T;
57
54
  destinationPath?: string;
58
55
  };
59
- export type TransformReturn<V extends GeneratedValue> = {
56
+ export type InsertReturn<V extends GeneratedValue, T extends GenerationType> = {
60
57
  settings: ContentSettings;
61
- definition: Definition<V> | undefined;
58
+ definition: GeneratedDefintion<V, T>;
62
59
  };
63
60
  export declare class GenerateContext {
64
61
  files: Map<string, FileContents>;
@@ -70,10 +67,9 @@ export declare class GenerateContext {
70
67
  constructor({ schemaModel, generatorsMap, settings }: ConstructorArgs);
71
68
  getFile(filePath: string, { throwIfNotFound }?: GetFileOptions): FileContents;
72
69
  register({ imports, packageDependencies, definitions, destinationPath }: RegisterArgs): void;
73
- insert<V extends GeneratedValue>({ coreContext, generation, destinationPath, ...rest }: TransformArgs<V>): {
74
- settings: ContentSettings;
75
- definition: Definition<V> | undefined;
76
- };
70
+ insert<V extends GeneratedValue, T extends GenerationType>({ coreContext, generation, destinationPath, ...rest }: InsertArgs<V, T> & {
71
+ coreContext: CoreContext;
72
+ }): InsertReturn<V, T>;
77
73
  getOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
78
74
  getModelBaseSettings({ generatorId, refName }: GetModelSettingsArgs): BaseSettings;
79
75
  addFile(normalisedPath: string): FileContents;
@@ -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,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,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,EACV,YAAY,EACZ,cAAc,EACd,kBAAkB,EACnB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,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;IASrE,OAAO,CACL,QAAQ,EAAE,MAAM,EAChB,EAAE,eAAuB,EAAE,GAAE,cAAmB,GAC/C,YAAY;IAgBf,QAAQ,CAAC,EACP,OAAY,EACZ,mBAAwB,EACxB,WAAW,EACX,eAAe,EAChB,EAAE,YAAY;IA6Bf,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,EACzD,WAAW,EACX,UAAU,EACV,eAAe,EACf,GAAG,IAAI,EACR,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IA4BvE,wBAAwB,CAAC,EACvB,WAAW,EACX,IAAI,EACJ,MAAM,EACP,EAAE,wBAAwB;IAwB3B,oBAAoB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,oBAAoB;IAwBnE,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY;IAgB7C,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE,mBAAmB,CAAC,EAClB,WAAW,EACX,YAAY,EACZ,SAAS,EACV,EAAE,uBAAuB;IAc1B,oDAAoD;IACpD,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
@@ -1,25 +1,24 @@
1
1
  import type { ModelInsertable } from './ModelInsertable.js';
2
2
  import type { CoreContext } from '../context/CoreContext.js';
3
3
  import { ContentSettings } from './ContentSettings.js';
4
- import { Definition } from './Definition.js';
5
- import type { GenerationType } from '../types/GenerationType.js';
4
+ import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
6
5
  import type { GeneratedValue } from '../types/GeneratedValue.js';
7
6
  import type { RefName } from '../types/RefName.js';
8
- type CreateModelArgs<V extends GeneratedValue> = {
7
+ type CreateModelArgs<V extends GeneratedValue, T extends GenerationType> = {
9
8
  context: CoreContext;
10
9
  insertable: ModelInsertable<V>;
11
10
  refName: RefName;
12
- generation?: GenerationType;
11
+ generation?: T;
13
12
  destinationPath?: string;
14
13
  };
15
- export declare class ModelDriver<V extends GeneratedValue> {
14
+ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationType> {
16
15
  context: CoreContext;
17
16
  insertable: ModelInsertable<V>;
18
17
  refName: RefName;
19
18
  settings: ContentSettings;
20
19
  destinationPath?: string;
21
- definition: Definition<V> | undefined;
22
- constructor({ context, insertable, refName, generation, destinationPath }: CreateModelArgs<V>);
20
+ definition: GeneratedDefintion<V, T>;
21
+ constructor({ context, insertable, refName, generation, destinationPath }: CreateModelArgs<V, T>);
23
22
  get value(): V;
24
23
  get name(): string;
25
24
  get exportPath(): string;
@@ -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,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,WAAW,CAAA;IACpB,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CA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AU,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,WAAW,CAAA;IACpB,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;IAaxB,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,kBAAkB;IAkB1B,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -48,7 +48,7 @@ export class ModelDriver {
48
48
  this.destinationPath = destinationPath;
49
49
  this.settings = this.buildModelSettings({ refName, insertable });
50
50
  this.definition = this.apply({
51
- force: generation === 'force',
51
+ generation,
52
52
  destinationPath
53
53
  });
54
54
  }
@@ -64,10 +64,10 @@ export class ModelDriver {
64
64
  get exportPath() {
65
65
  return this.settings.exportPath;
66
66
  }
67
- apply({ force, destinationPath } = {}) {
67
+ apply({ generation, destinationPath } = {}) {
68
68
  const { name, exportPath, selected, importFrom } = this.settings;
69
- if (!selected && !force) {
70
- return;
69
+ if (!selected && generation !== 'force') {
70
+ return undefined;
71
71
  }
72
72
  const definition = this.getDefinition({ name, exportPath });
73
73
  if (destinationPath &&
@@ -133,7 +133,7 @@ export class ModelDriver {
133
133
  generatorId: this.insertable.id,
134
134
  refName: this.refName
135
135
  });
136
- if (currentKey === definition.generatorKey) {
136
+ if (currentKey !== definition.generatorKey) {
137
137
  throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
138
138
  }
139
139
  return definition.value instanceof this.insertable;
@@ -2,24 +2,23 @@ import type { OperationInsertable } from './OperationInsertable.js';
2
2
  import type { CoreContext } from '../context/CoreContext.js';
3
3
  import type { OasOperation } from '../oas/operation/Operation.js';
4
4
  import { ContentSettings } from './ContentSettings.js';
5
- import { Definition } from './Definition.js';
6
- import type { GenerationType } from '../types/GenerationType.js';
5
+ import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
7
6
  import type { GeneratedValue } from '../types/GeneratedValue.js';
8
- type CreateOperationArgs<V extends GeneratedValue> = {
7
+ type CreateOperationArgs<V extends GeneratedValue, T extends GenerationType> = {
9
8
  context: CoreContext;
10
9
  insertable: OperationInsertable<V>;
11
10
  operation: OasOperation;
12
- generation?: GenerationType;
11
+ generation?: T;
13
12
  destinationPath?: string;
14
13
  };
15
- export declare class OperationDriver<V extends GeneratedValue> {
14
+ export declare class OperationDriver<V extends GeneratedValue, T extends GenerationType> {
16
15
  context: CoreContext;
17
16
  insertable: OperationInsertable<V>;
18
17
  operation: OasOperation;
19
18
  settings: ContentSettings;
20
19
  destinationPath?: string;
21
- definition: Definition<V> | undefined;
22
- constructor({ context, insertable, operation, generation, destinationPath }: CreateOperationArgs<V>);
20
+ definition: GeneratedDefintion<V, T>;
21
+ constructor({ context, insertable, operation, generation, destinationPath }: CreateOperationArgs<V, T>);
23
22
  get value(): V;
24
23
  get name(): string;
25
24
  get exportPath(): string;
@@ -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,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC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BAAgB;CAoBzB"}
@@ -51,7 +51,7 @@ export class OperationDriver {
51
51
  insertable
52
52
  });
53
53
  this.definition = this.apply({
54
- force: generation === 'force',
54
+ generation,
55
55
  destinationPath
56
56
  });
57
57
  }
@@ -67,10 +67,10 @@ export class OperationDriver {
67
67
  get exportPath() {
68
68
  return this.settings.exportPath;
69
69
  }
70
- apply({ force, destinationPath } = {}) {
70
+ apply({ generation, destinationPath } = {}) {
71
71
  const { name, exportPath, selected, importFrom } = this.settings;
72
- if (!selected && !force) {
73
- return;
72
+ if (!selected && generation !== 'force') {
73
+ return undefined;
74
74
  }
75
75
  const definition = this.getDefinition({ name, exportPath });
76
76
  if (destinationPath &&
@@ -133,7 +133,7 @@ export class OperationDriver {
133
133
  generatorId: this.insertable.id,
134
134
  operation: this.operation
135
135
  });
136
- if (currentKey === definition.generatorKey) {
136
+ if (currentKey !== definition.generatorKey) {
137
137
  throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
138
138
  }
139
139
  return definition.value instanceof this.insertable;
@@ -1,6 +1,19 @@
1
+ import type { Definition } from '../dsl/Definition.js';
1
2
  import type { Stringable } from '../dsl/Stringable.js';
2
3
  import type { GeneratorKey } from './GeneratorKeys.js';
4
+ /**
5
+ * 'force' - will generate content even it is not selected.
6
+ * Use this option when generating code via a dependency.
7
+ * For example, when you are generating a form and it needs
8
+ * an accompanying API client as well. You should use 'force'
9
+ * when generating the API client to ensure it is generated
10
+ * event the API client itself is not selected.
11
+ *
12
+ * 'regular' - will generate content only if it is selected.
13
+ */
14
+ export type GenerationType = 'force' | 'regular';
3
15
  export type GeneratedValue = Stringable & {
4
16
  generatorKey: GeneratorKey;
5
17
  };
18
+ export type GeneratedDefintion<V extends GeneratedValue, T extends GenerationType> = T extends 'force' ? Definition<V> : Definition<V> | undefined;
6
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,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC,YAAY,EAAE,YAAY,CAAA;CAC3B,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,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.264",
3
+ "version": "0.0.266",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -1,32 +1,20 @@
1
- import type { ParseContext } from './ParseContext.js';
2
1
  import { GenerateContext } from './GenerateContext.js';
3
- import type { AddRenderDependencyArgs, GetModelSettingsArgs, GetOperationSettingsArgs, PickArgs, RegisterArgs, TransformReturn } from './GenerateContext.js';
4
- import type { PrettierConfigType } from '../types/prettierConfig.js';
5
- import type { OasDocument } from '../oas/document/Document.js';
2
+ import type { AddRenderDependencyArgs, GetModelSettingsArgs, GetOperationSettingsArgs, PickArgs, RegisterArgs, InsertReturn, InsertArgs } from './GenerateContext.js';
6
3
  import { RenderContext, type FilesRenderResult } from './RenderContext.js';
7
4
  import type { AddGeneratorKeyArgs, FileContents, RenderDependencies, RenderOptions } from './types.js';
5
+ import type { ParseContext } from './ParseContext.js';
6
+ import type { PrettierConfigType } from '../types/prettierConfig.js';
7
+ import type { OasDocument } from '../oas/document/Document.js';
8
8
  import type { OpenAPIV3 } from 'openapi-types';
9
9
  import type { BaseSettings, ClientSettings } from '../types/Settings.js';
10
10
  import type { Definition } from '../dsl/Definition.js';
11
- import type { OperationInsertable, OperationGenerator } from '../dsl/OperationInsertable.js';
12
- import type { ModelInsertable, ModelGenerator } from '../dsl/ModelInsertable.js';
11
+ import type { OperationGenerator } from '../dsl/OperationInsertable.js';
12
+ import type { ModelGenerator } from '../dsl/ModelInsertable.js';
13
13
  import type { GeneratedValue } from '../types/GeneratedValue.js';
14
14
  import type { OasSchema } from '../oas/schema/Schema.js';
15
15
  import type { OasRef } from '../oas/ref/Ref.js';
16
- import type { OasOperation } from '../oas/operation/Operation.js';
17
- import type { GenerationType } from '../types/GenerationType.js';
16
+ import type { GenerationType } from '../types/GeneratedValue.js';
18
17
  import type { RefName } from '../types/RefName.js';
19
- type TransformArgs<V extends GeneratedValue> = {
20
- insertable: OperationInsertable<V>;
21
- operation: OasOperation;
22
- generation?: GenerationType;
23
- destinationPath?: string;
24
- } | {
25
- insertable: ModelInsertable<V>;
26
- refName: RefName;
27
- generation?: GenerationType;
28
- destinationPath?: string;
29
- };
30
18
  type SharedContext = {
31
19
  type: 'parse';
32
20
  context: ParseContext;
@@ -67,7 +55,7 @@ export declare class CoreContext {
67
55
  render(options: RenderOptions): FilesRenderResult;
68
56
  addFile(normalisedPath: string): FileContents;
69
57
  getOperationBaseSettings(args: GetOperationSettingsArgs): BaseSettings;
70
- insert<V extends GeneratedValue>(args: TransformArgs<V>): TransformReturn<V>;
58
+ insert<V extends GeneratedValue, T extends GenerationType>(args: InsertArgs<V, T>): InsertReturn<V, T>;
71
59
  getModelBaseSettings(args: GetModelSettingsArgs): BaseSettings;
72
60
  get files(): Map<string, FileContents>;
73
61
  get renderDependencies(): RenderDependencies;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MA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AUvC;IAED,IAAI,QAAQ,IAAI,cAAc,GAAG,SAAS,CAUzC;CACF"}
@@ -10,8 +10,7 @@ import type { OperationInsertable, OperationGenerator } from '../dsl/OperationIn
10
10
  import type { OasOperation } from '../oas/operation/Operation.js';
11
11
  import type { CoreContext } from './CoreContext.js';
12
12
  import type { ModelInsertable, ModelGenerator } from '../dsl/ModelInsertable.js';
13
- import type { GenerationType } from '../types/GenerationType.js';
14
- import type { GeneratedValue } from '../types/GeneratedValue.js';
13
+ import type { GenerationType, GeneratedDefintion, GeneratedValue } from '../types/GeneratedValue.js';
15
14
  import type { ContentSettings } from '../dsl/ContentSettings.js';
16
15
  import type { RefName } from '../types/RefName.js';
17
16
  type ConstructorArgs = {
@@ -43,22 +42,20 @@ export type GetModelSettingsArgs = {
43
42
  generatorId: string;
44
43
  refName: RefName;
45
44
  };
46
- export type TransformArgs<V extends GeneratedValue> = {
47
- coreContext: CoreContext;
45
+ export type InsertArgs<V extends GeneratedValue, T extends GenerationType> = {
48
46
  insertable: OperationInsertable<V>;
49
47
  operation: OasOperation;
50
- generation?: GenerationType;
48
+ generation?: T;
51
49
  destinationPath?: string;
52
50
  } | {
53
- coreContext: CoreContext;
54
51
  insertable: ModelInsertable<V>;
55
52
  refName: RefName;
56
- generation?: GenerationType;
53
+ generation?: T;
57
54
  destinationPath?: string;
58
55
  };
59
- export type TransformReturn<V extends GeneratedValue> = {
56
+ export type InsertReturn<V extends GeneratedValue, T extends GenerationType> = {
60
57
  settings: ContentSettings;
61
- definition: Definition<V> | undefined;
58
+ definition: GeneratedDefintion<V, T>;
62
59
  };
63
60
  export declare class GenerateContext {
64
61
  files: Map<string, FileContents>;
@@ -70,10 +67,9 @@ export declare class GenerateContext {
70
67
  constructor({ schemaModel, generatorsMap, settings }: ConstructorArgs);
71
68
  getFile(filePath: string, { throwIfNotFound }?: GetFileOptions): FileContents;
72
69
  register({ imports, packageDependencies, definitions, destinationPath }: RegisterArgs): void;
73
- insert<V extends GeneratedValue>({ coreContext, generation, destinationPath, ...rest }: TransformArgs<V>): {
74
- settings: ContentSettings;
75
- definition: Definition<V> | undefined;
76
- };
70
+ insert<V extends GeneratedValue, T extends GenerationType>({ coreContext, generation, destinationPath, ...rest }: InsertArgs<V, T> & {
71
+ coreContext: CoreContext;
72
+ }): InsertReturn<V, T>;
77
73
  getOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
78
74
  getModelBaseSettings({ generatorId, refName }: GetModelSettingsArgs): BaseSettings;
79
75
  addFile(normalisedPath: string): FileContents;
@@ -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,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,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,EACV,YAAY,EACZ,cAAc,EACd,kBAAkB,EACnB,MAAM,YAAY,CAAA;AACnB,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;AAKjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAA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AAW,EAAE,WAAW,CAAA;KAAE,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IA4BvE,wBAAwB,CAAC,EACvB,WAAW,EACX,IAAI,EACJ,MAAM,EACP,EAAE,wBAAwB;IAwB3B,oBAAoB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,oBAAoB;IAwBnE,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY;IAgB7C,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE,mBAAmB,CAAC,EAClB,WAAW,EACX,YAAY,EACZ,SAAS,EACV,EAAE,uBAAuB;IAc1B,oDAAoD;IACpD,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
@@ -1,25 +1,24 @@
1
1
  import type { ModelInsertable } from './ModelInsertable.js';
2
2
  import type { CoreContext } from '../context/CoreContext.js';
3
3
  import { ContentSettings } from './ContentSettings.js';
4
- import { Definition } from './Definition.js';
5
- import type { GenerationType } from '../types/GenerationType.js';
4
+ import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
6
5
  import type { GeneratedValue } from '../types/GeneratedValue.js';
7
6
  import type { RefName } from '../types/RefName.js';
8
- type CreateModelArgs<V extends GeneratedValue> = {
7
+ type CreateModelArgs<V extends GeneratedValue, T extends GenerationType> = {
9
8
  context: CoreContext;
10
9
  insertable: ModelInsertable<V>;
11
10
  refName: RefName;
12
- generation?: GenerationType;
11
+ generation?: T;
13
12
  destinationPath?: string;
14
13
  };
15
- export declare class ModelDriver<V extends GeneratedValue> {
14
+ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationType> {
16
15
  context: CoreContext;
17
16
  insertable: ModelInsertable<V>;
18
17
  refName: RefName;
19
18
  settings: ContentSettings;
20
19
  destinationPath?: string;
21
- definition: Definition<V> | undefined;
22
- constructor({ context, insertable, refName, generation, destinationPath }: CreateModelArgs<V>);
20
+ definition: GeneratedDefintion<V, T>;
21
+ constructor({ context, insertable, refName, generation, destinationPath }: CreateModelArgs<V, T>);
23
22
  get value(): V;
24
23
  get name(): string;
25
24
  get exportPath(): string;
@@ -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,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,WAAW,CAAA;IACpB,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAgBD,qBAAa,WAAW,CAAC,CAAC,SAAS,cAAc;IAC/C,OAAO,EAAE,WAAW,CAAA;IACpB,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,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;gBACzB,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EAChB,E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AC,EAAE,CAAC,CAAC,CAAA;gBACxB,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EAChB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAaxB,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,kBAAkB;IAkB1B,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -51,7 +51,7 @@ class ModelDriver {
51
51
  this.destinationPath = destinationPath;
52
52
  this.settings = this.buildModelSettings({ refName, insertable });
53
53
  this.definition = this.apply({
54
- force: generation === 'force',
54
+ generation,
55
55
  destinationPath
56
56
  });
57
57
  }
@@ -67,10 +67,10 @@ class ModelDriver {
67
67
  get exportPath() {
68
68
  return this.settings.exportPath;
69
69
  }
70
- apply({ force, destinationPath } = {}) {
70
+ apply({ generation, destinationPath } = {}) {
71
71
  const { name, exportPath, selected, importFrom } = this.settings;
72
- if (!selected && !force) {
73
- return;
72
+ if (!selected && generation !== 'force') {
73
+ return undefined;
74
74
  }
75
75
  const definition = this.getDefinition({ name, exportPath });
76
76
  if (destinationPath &&
@@ -136,7 +136,7 @@ class ModelDriver {
136
136
  generatorId: this.insertable.id,
137
137
  refName: this.refName
138
138
  });
139
- if (currentKey === definition.generatorKey) {
139
+ if (currentKey !== definition.generatorKey) {
140
140
  throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
141
141
  }
142
142
  return definition.value instanceof this.insertable;
@@ -2,24 +2,23 @@ import type { OperationInsertable } from './OperationInsertable.js';
2
2
  import type { CoreContext } from '../context/CoreContext.js';
3
3
  import type { OasOperation } from '../oas/operation/Operation.js';
4
4
  import { ContentSettings } from './ContentSettings.js';
5
- import { Definition } from './Definition.js';
6
- import type { GenerationType } from '../types/GenerationType.js';
5
+ import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
7
6
  import type { GeneratedValue } from '../types/GeneratedValue.js';
8
- type CreateOperationArgs<V extends GeneratedValue> = {
7
+ type CreateOperationArgs<V extends GeneratedValue, T extends GenerationType> = {
9
8
  context: CoreContext;
10
9
  insertable: OperationInsertable<V>;
11
10
  operation: OasOperation;
12
- generation?: GenerationType;
11
+ generation?: T;
13
12
  destinationPath?: string;
14
13
  };
15
- export declare class OperationDriver<V extends GeneratedValue> {
14
+ export declare class OperationDriver<V extends GeneratedValue, T extends GenerationType> {
16
15
  context: CoreContext;
17
16
  insertable: OperationInsertable<V>;
18
17
  operation: OasOperation;
19
18
  settings: ContentSettings;
20
19
  destinationPath?: string;
21
- definition: Definition<V> | undefined;
22
- constructor({ context, insertable, operation, generation, destinationPath }: CreateOperationArgs<V>);
20
+ definition: GeneratedDefintion<V, T>;
21
+ constructor({ context, insertable, operation, generation, destinationPath }: CreateOperationArgs<V, T>);
23
22
  get value(): V;
24
23
  get name(): string;
25
24
  get exportPath(): string;
@@ -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,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAIhE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAAI;IACnD,OAAO,EAAE,WAAW,CAAA;IACpB,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AAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,IAAI;IAC7E,OAAO,EAAE,WAAW,CAAA;IACpB,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;AAiBD,qBAAa,eAAe,CAC1B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,cAAc;IAExB,OAAO,EAAE,WAAW,CAAA;IACpB,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;IAiB5B,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,sBAAsB;IAoB9B,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -54,7 +54,7 @@ class OperationDriver {
54
54
  insertable
55
55
  });
56
56
  this.definition = this.apply({
57
- force: generation === 'force',
57
+ generation,
58
58
  destinationPath
59
59
  });
60
60
  }
@@ -70,10 +70,10 @@ class OperationDriver {
70
70
  get exportPath() {
71
71
  return this.settings.exportPath;
72
72
  }
73
- apply({ force, destinationPath } = {}) {
73
+ apply({ generation, destinationPath } = {}) {
74
74
  const { name, exportPath, selected, importFrom } = this.settings;
75
- if (!selected && !force) {
76
- return;
75
+ if (!selected && generation !== 'force') {
76
+ return undefined;
77
77
  }
78
78
  const definition = this.getDefinition({ name, exportPath });
79
79
  if (destinationPath &&
@@ -136,7 +136,7 @@ class OperationDriver {
136
136
  generatorId: this.insertable.id,
137
137
  operation: this.operation
138
138
  });
139
- if (currentKey === definition.generatorKey) {
139
+ if (currentKey !== definition.generatorKey) {
140
140
  throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
141
141
  }
142
142
  return definition.value instanceof this.insertable;
@@ -1,6 +1,19 @@
1
+ import type { Definition } from '../dsl/Definition.js';
1
2
  import type { Stringable } from '../dsl/Stringable.js';
2
3
  import type { GeneratorKey } from './GeneratorKeys.js';
4
+ /**
5
+ * 'force' - will generate content even it is not selected.
6
+ * Use this option when generating code via a dependency.
7
+ * For example, when you are generating a form and it needs
8
+ * an accompanying API client as well. You should use 'force'
9
+ * when generating the API client to ensure it is generated
10
+ * event the API client itself is not selected.
11
+ *
12
+ * 'regular' - will generate content only if it is selected.
13
+ */
14
+ export type GenerationType = 'force' | 'regular';
3
15
  export type GeneratedValue = Stringable & {
4
16
  generatorKey: GeneratorKey;
5
17
  };
18
+ export type GeneratedDefintion<V extends GeneratedValue, T extends GenerationType> = T extends 'force' ? Definition<V> : Definition<V> | undefined;
6
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,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG;IACxC,YAAY,EAAE,YAAY,CAAA;CAC3B,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,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,16 +0,0 @@
1
- /**
2
- * 'force' - will generate content even it is not selected.
3
- * Use this option when generating code via a dependency.
4
- * For example, when you are generating a form and it needs
5
- * an accompanying API client as well. You should use 'force'
6
- * when generating the API client to ensure it is generated
7
- * event the API client itself is not selected.
8
- *
9
- * 'regular' - will generate content only if it is selected.
10
- *
11
- * 'lazy' - will create a Driver instance but not apply it, until
12
- * the value is accessed. This is useful when you want a quick way
13
- * to access settings for a creator without generating the content.
14
- */
15
- export type GenerationType = 'force' | 'regular' | 'lazy';
16
- //# sourceMappingURL=GenerationType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenerationType.d.ts","sourceRoot":"","sources":["../../src/types/GenerationType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA"}
@@ -1,15 +0,0 @@
1
- /**
2
- * 'force' - will generate content even it is not selected.
3
- * Use this option when generating code via a dependency.
4
- * For example, when you are generating a form and it needs
5
- * an accompanying API client as well. You should use 'force'
6
- * when generating the API client to ensure it is generated
7
- * event the API client itself is not selected.
8
- *
9
- * 'regular' - will generate content only if it is selected.
10
- *
11
- * 'lazy' - will create a Driver instance but not apply it, until
12
- * the value is accessed. This is useful when you want a quick way
13
- * to access settings for a creator without generating the content.
14
- */
15
- export {};
@@ -1,16 +0,0 @@
1
- /**
2
- * 'force' - will generate content even it is not selected.
3
- * Use this option when generating code via a dependency.
4
- * For example, when you are generating a form and it needs
5
- * an accompanying API client as well. You should use 'force'
6
- * when generating the API client to ensure it is generated
7
- * event the API client itself is not selected.
8
- *
9
- * 'regular' - will generate content only if it is selected.
10
- *
11
- * 'lazy' - will create a Driver instance but not apply it, until
12
- * the value is accessed. This is useful when you want a quick way
13
- * to access settings for a creator without generating the content.
14
- */
15
- export type GenerationType = 'force' | 'regular' | 'lazy';
16
- //# sourceMappingURL=GenerationType.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenerationType.d.ts","sourceRoot":"","sources":["../../src/types/GenerationType.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * 'force' - will generate content even it is not selected.
4
- * Use this option when generating code via a dependency.
5
- * For example, when you are generating a form and it needs
6
- * an accompanying API client as well. You should use 'force'
7
- * when generating the API client to ensure it is generated
8
- * event the API client itself is not selected.
9
- *
10
- * 'regular' - will generate content only if it is selected.
11
- *
12
- * 'lazy' - will create a Driver instance but not apply it, until
13
- * the value is accessed. This is useful when you want a quick way
14
- * to access settings for a creator without generating the content.
15
- */
16
- Object.defineProperty(exports, "__esModule", { value: true });