@skmtc/core 0.0.264 → 0.0.265
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/context/CoreContext.d.ts +8 -20
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.d.ts +9 -13
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/dsl/ModelDriver.d.ts +6 -7
- package/esm/dsl/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/ModelDriver.js +4 -4
- package/esm/dsl/OperationDriver.d.ts +6 -7
- package/esm/dsl/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/OperationDriver.js +4 -4
- package/esm/types/GeneratedValue.d.ts +13 -0
- package/esm/types/GeneratedValue.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +8 -20
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/GenerateContext.d.ts +9 -13
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/dsl/ModelDriver.d.ts +6 -7
- package/script/dsl/ModelDriver.d.ts.map +1 -1
- package/script/dsl/ModelDriver.js +4 -4
- package/script/dsl/OperationDriver.d.ts +6 -7
- package/script/dsl/OperationDriver.d.ts.map +1 -1
- package/script/dsl/OperationDriver.js +4 -4
- package/script/types/GeneratedValue.d.ts +13 -0
- package/script/types/GeneratedValue.d.ts.map +1 -1
- package/esm/types/GenerationType.d.ts +0 -16
- package/esm/types/GenerationType.d.ts.map +0 -1
- package/esm/types/GenerationType.js +0 -15
- package/script/types/GenerationType.d.ts +0 -16
- package/script/types/GenerationType.d.ts.map +0 -1
- package/script/types/GenerationType.js +0 -16
|
@@ -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,
|
|
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 {
|
|
12
|
-
import type {
|
|
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 {
|
|
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:
|
|
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,
|
|
1
|
+
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACX,MAAM,sBAAsB,CAAA;AAE7B,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,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAA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ED,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/
|
|
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
|
|
47
|
-
coreContext: CoreContext;
|
|
45
|
+
export type InsertArgs<V extends GeneratedValue, T extends GenerationType> = {
|
|
48
46
|
insertable: OperationInsertable<V>;
|
|
49
47
|
operation: OasOperation;
|
|
50
|
-
generation?:
|
|
48
|
+
generation?: T;
|
|
51
49
|
destinationPath?: string;
|
|
52
50
|
} | {
|
|
53
|
-
coreContext: CoreContext;
|
|
54
51
|
insertable: ModelInsertable<V>;
|
|
55
52
|
refName: RefName;
|
|
56
|
-
generation?:
|
|
53
|
+
generation?: T;
|
|
57
54
|
destinationPath?: string;
|
|
58
55
|
};
|
|
59
|
-
export type
|
|
56
|
+
export type InsertReturn<V extends GeneratedValue, T extends GenerationType> = {
|
|
60
57
|
settings: ContentSettings;
|
|
61
|
-
definition:
|
|
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 }:
|
|
74
|
-
|
|
75
|
-
|
|
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,E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,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"}
|
package/esm/dsl/ModelDriver.d.ts
CHANGED
|
@@ -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 {
|
|
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?:
|
|
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:
|
|
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;
|
|
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;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,WAAW,CAAA;IACpB,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,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"}
|
package/esm/dsl/ModelDriver.js
CHANGED
|
@@ -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
|
-
|
|
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({
|
|
67
|
+
apply({ generation, destinationPath } = {}) {
|
|
68
68
|
const { name, exportPath, selected, importFrom } = this.settings;
|
|
69
|
-
if (!selected &&
|
|
70
|
-
return;
|
|
69
|
+
if (!selected && generation !== 'force') {
|
|
70
|
+
return undefined;
|
|
71
71
|
}
|
|
72
72
|
const definition = this.getDefinition({ name, exportPath });
|
|
73
73
|
if (destinationPath &&
|
|
@@ -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 {
|
|
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?:
|
|
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:
|
|
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;
|
|
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;AAItD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAIhE,KAAK,mBAAmB,CAAC,CAAC,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"}
|
|
@@ -51,7 +51,7 @@ export class OperationDriver {
|
|
|
51
51
|
insertable
|
|
52
52
|
});
|
|
53
53
|
this.definition = this.apply({
|
|
54
|
-
|
|
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({
|
|
70
|
+
apply({ generation, destinationPath } = {}) {
|
|
71
71
|
const { name, exportPath, selected, importFrom } = this.settings;
|
|
72
|
-
if (!selected &&
|
|
73
|
-
return;
|
|
72
|
+
if (!selected && generation !== 'force') {
|
|
73
|
+
return undefined;
|
|
74
74
|
}
|
|
75
75
|
const definition = this.getDefinition({ name, exportPath });
|
|
76
76
|
if (destinationPath &&
|
|
@@ -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,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,
|
|
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 {
|
|
12
|
-
import type {
|
|
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 {
|
|
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:
|
|
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,
|
|
1
|
+
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,UAAU,EACX,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd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SAAS,cAAc,EACvD,IAAI,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACrB,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IAcrB,oBAAoB,CAAC,IAAI,EAAE,oBAAoB,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/
|
|
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
|
|
47
|
-
coreContext: CoreContext;
|
|
45
|
+
export type InsertArgs<V extends GeneratedValue, T extends GenerationType> = {
|
|
48
46
|
insertable: OperationInsertable<V>;
|
|
49
47
|
operation: OasOperation;
|
|
50
|
-
generation?:
|
|
48
|
+
generation?: T;
|
|
51
49
|
destinationPath?: string;
|
|
52
50
|
} | {
|
|
53
|
-
coreContext: CoreContext;
|
|
54
51
|
insertable: ModelInsertable<V>;
|
|
55
52
|
refName: RefName;
|
|
56
|
-
generation?:
|
|
53
|
+
generation?: T;
|
|
57
54
|
destinationPath?: string;
|
|
58
55
|
};
|
|
59
|
-
export type
|
|
56
|
+
export type InsertReturn<V extends GeneratedValue, T extends GenerationType> = {
|
|
60
57
|
settings: ContentSettings;
|
|
61
|
-
definition:
|
|
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 }:
|
|
74
|
-
|
|
75
|
-
|
|
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,C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E,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 {
|
|
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?:
|
|
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:
|
|
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;
|
|
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;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,WAAW,CAAA;IACpB,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,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"}
|
|
@@ -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
|
-
|
|
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({
|
|
70
|
+
apply({ generation, destinationPath } = {}) {
|
|
71
71
|
const { name, exportPath, selected, importFrom } = this.settings;
|
|
72
|
-
if (!selected &&
|
|
73
|
-
return;
|
|
72
|
+
if (!selected && generation !== 'force') {
|
|
73
|
+
return undefined;
|
|
74
74
|
}
|
|
75
75
|
const definition = this.getDefinition({ name, exportPath });
|
|
76
76
|
if (destinationPath &&
|
|
@@ -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 {
|
|
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?:
|
|
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:
|
|
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;
|
|
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;AAItD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAIhE,KAAK,mBAAmB,CAAC,CAAC,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
|
-
|
|
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({
|
|
73
|
+
apply({ generation, destinationPath } = {}) {
|
|
74
74
|
const { name, exportPath, selected, importFrom } = this.settings;
|
|
75
|
-
if (!selected &&
|
|
76
|
-
return;
|
|
75
|
+
if (!selected && generation !== 'force') {
|
|
76
|
+
return undefined;
|
|
77
77
|
}
|
|
78
78
|
const definition = this.getDefinition({ name, exportPath });
|
|
79
79
|
if (destinationPath &&
|
|
@@ -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 });
|