@skmtc/core 0.0.354 → 0.0.356
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/GenerateContext.js +2 -2
- package/esm/dsl/ContentSettings.d.ts +6 -5
- package/esm/dsl/ContentSettings.d.ts.map +1 -1
- package/esm/dsl/ContentSettings.js +5 -5
- package/esm/dsl/model/ModelDriver.d.ts +2 -1
- package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.js +10 -20
- package/esm/dsl/model/ModelInsertable.d.ts +2 -3
- package/esm/dsl/model/ModelInsertable.d.ts.map +1 -1
- package/esm/dsl/model/{toModelConfig.d.ts → toModelBase.d.ts} +5 -7
- package/esm/dsl/model/toModelBase.d.ts.map +1 -0
- package/esm/dsl/model/{toModelConfig.js → toModelBase.js} +3 -10
- package/esm/dsl/operation/OperationDriver.d.ts +2 -1
- package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.js +10 -17
- package/esm/dsl/operation/OperationInsertable.d.ts +2 -3
- package/esm/dsl/operation/OperationInsertable.d.ts.map +1 -1
- package/{script/dsl/operation/toOperationConfig.d.ts → esm/dsl/operation/toOperationBase.d.ts} +5 -7
- package/esm/dsl/operation/toOperationBase.d.ts.map +1 -0
- package/esm/dsl/operation/{toOperationConfig.js → toOperationBase.js} +2 -9
- package/esm/mod.d.ts +2 -2
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -2
- package/package.json +1 -1
- package/script/context/GenerateContext.js +2 -2
- package/script/dsl/ContentSettings.d.ts +6 -5
- package/script/dsl/ContentSettings.d.ts.map +1 -1
- package/script/dsl/ContentSettings.js +5 -5
- package/script/dsl/model/ModelDriver.d.ts +2 -1
- package/script/dsl/model/ModelDriver.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.js +10 -20
- package/script/dsl/model/ModelInsertable.d.ts +2 -3
- package/script/dsl/model/ModelInsertable.d.ts.map +1 -1
- package/script/dsl/model/{toModelConfig.d.ts → toModelBase.d.ts} +5 -7
- package/script/dsl/model/toModelBase.d.ts.map +1 -0
- package/script/dsl/model/{toModelConfig.js → toModelBase.js} +5 -12
- package/script/dsl/operation/OperationDriver.d.ts +2 -1
- package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.js +10 -17
- package/script/dsl/operation/OperationInsertable.d.ts +2 -3
- package/script/dsl/operation/OperationInsertable.d.ts.map +1 -1
- package/{esm/dsl/operation/toOperationConfig.d.ts → script/dsl/operation/toOperationBase.d.ts} +5 -7
- package/script/dsl/operation/toOperationBase.d.ts.map +1 -0
- package/script/dsl/operation/{toOperationConfig.js → toOperationBase.js} +2 -9
- package/script/mod.d.ts +2 -2
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +2 -2
- package/esm/dsl/model/toModelConfig.d.ts.map +0 -1
- package/esm/dsl/operation/toOperationConfig.d.ts.map +0 -1
- package/script/dsl/model/toModelConfig.d.ts.map +0 -1
- package/script/dsl/operation/toOperationConfig.d.ts.map +0 -1
|
@@ -177,7 +177,7 @@ export class GenerateContext {
|
|
|
177
177
|
});
|
|
178
178
|
const e = insertable.toExportPath({ operation, baseSettings });
|
|
179
179
|
return new ContentSettings({
|
|
180
|
-
|
|
180
|
+
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
181
181
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
182
182
|
exportPath: e,
|
|
183
183
|
importFrom: baseSettings.importFrom ?? e
|
|
@@ -190,7 +190,7 @@ export class GenerateContext {
|
|
|
190
190
|
});
|
|
191
191
|
const e = insertable.toExportPath({ refName, baseSettings });
|
|
192
192
|
return new ContentSettings({
|
|
193
|
-
|
|
193
|
+
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
194
194
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
195
195
|
exportPath: e,
|
|
196
196
|
importFrom: baseSettings.importFrom ?? e
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import type { Identifier } from './Identifier.js';
|
|
1
2
|
type EmptyArgs = {
|
|
2
3
|
exportPath: string;
|
|
3
|
-
|
|
4
|
+
identifier: Identifier;
|
|
4
5
|
};
|
|
5
6
|
type CreateArgs = {
|
|
6
|
-
|
|
7
|
+
identifier: Identifier;
|
|
7
8
|
selected: boolean;
|
|
8
9
|
exportPath: string;
|
|
9
10
|
importFrom: string;
|
|
10
11
|
};
|
|
11
12
|
export declare class ContentSettings {
|
|
12
|
-
|
|
13
|
+
identifier: Identifier;
|
|
13
14
|
selected: boolean;
|
|
14
15
|
exportPath: string;
|
|
15
16
|
importFrom: string;
|
|
16
|
-
constructor({
|
|
17
|
-
static empty({
|
|
17
|
+
constructor({ identifier, selected, exportPath, importFrom }: CreateArgs);
|
|
18
|
+
static empty({ identifier, exportPath }: EmptyArgs): ContentSettings;
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
20
21
|
//# sourceMappingURL=ContentSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSettings.d.ts","sourceRoot":"","sources":["../../src/dsl/ContentSettings.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,
|
|
1
|
+
{"version":3,"file":"ContentSettings.d.ts","sourceRoot":"","sources":["../../src/dsl/ContentSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qBAAa,eAAe;IAC1B,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;gBAEN,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,UAAU;IAOxE,MAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,GAAG,eAAe;CAQrE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export class ContentSettings {
|
|
2
|
-
constructor({
|
|
3
|
-
Object.defineProperty(this, "
|
|
2
|
+
constructor({ identifier, selected, exportPath, importFrom }) {
|
|
3
|
+
Object.defineProperty(this, "identifier", {
|
|
4
4
|
enumerable: true,
|
|
5
5
|
configurable: true,
|
|
6
6
|
writable: true,
|
|
@@ -24,15 +24,15 @@ export class ContentSettings {
|
|
|
24
24
|
writable: true,
|
|
25
25
|
value: void 0
|
|
26
26
|
});
|
|
27
|
-
this.
|
|
27
|
+
this.identifier = identifier;
|
|
28
28
|
this.selected = selected;
|
|
29
29
|
this.exportPath = exportPath;
|
|
30
30
|
this.importFrom = importFrom;
|
|
31
31
|
}
|
|
32
|
-
static empty({
|
|
32
|
+
static empty({ identifier, exportPath }) {
|
|
33
33
|
return new ContentSettings({
|
|
34
34
|
selected: true,
|
|
35
|
-
|
|
35
|
+
identifier,
|
|
36
36
|
exportPath,
|
|
37
37
|
importFrom: exportPath
|
|
38
38
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModelInsertable } from './ModelInsertable.js';
|
|
2
2
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
+
import type { Identifier } from '../Identifier.js';
|
|
4
5
|
import type { GeneratedDefintion, GenerationType } from '../../types/GeneratedValue.js';
|
|
5
6
|
import type { GeneratedValue } from '../../types/GeneratedValue.js';
|
|
6
7
|
import type { RefName } from '../../types/RefName.js';
|
|
@@ -20,7 +21,7 @@ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationT
|
|
|
20
21
|
definition: GeneratedDefintion<V, T>;
|
|
21
22
|
constructor({ context, insertable, refName, generation, destinationPath }: CreateModelArgs<V, T>);
|
|
22
23
|
get value(): V;
|
|
23
|
-
get
|
|
24
|
+
get identifier(): Identifier;
|
|
24
25
|
get exportPath(): string;
|
|
25
26
|
private apply;
|
|
26
27
|
private getDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGrD,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;AAWD,qBAAa,WAAW,CAAC,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,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { normalize } from '../../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
2
2
|
import { Definition } from '../Definition.js';
|
|
3
|
-
import { Identifier } from '../Identifier.js';
|
|
4
|
-
import { match } from 'ts-pattern';
|
|
5
3
|
import { toModelGeneratorKey } from '../../types/GeneratorKeys.js';
|
|
6
4
|
export class ModelDriver {
|
|
7
5
|
constructor({ context, insertable, refName, generation, destinationPath }) {
|
|
@@ -54,29 +52,32 @@ export class ModelDriver {
|
|
|
54
52
|
}
|
|
55
53
|
return this.definition.value;
|
|
56
54
|
}
|
|
57
|
-
get
|
|
58
|
-
return this.settings.
|
|
55
|
+
get identifier() {
|
|
56
|
+
return this.settings.identifier;
|
|
59
57
|
}
|
|
60
58
|
get exportPath() {
|
|
61
59
|
return this.settings.exportPath;
|
|
62
60
|
}
|
|
63
61
|
apply({ generation, destinationPath } = {}) {
|
|
64
|
-
const {
|
|
62
|
+
const { identifier, exportPath, selected, importFrom } = this.settings;
|
|
65
63
|
if (!selected && generation !== 'force') {
|
|
66
64
|
return undefined;
|
|
67
65
|
}
|
|
68
|
-
const definition = this.getDefinition({
|
|
66
|
+
const definition = this.getDefinition({ identifier, exportPath });
|
|
69
67
|
if (destinationPath &&
|
|
70
68
|
normalize(exportPath) !== normalize(destinationPath)) {
|
|
71
69
|
this.context.register({
|
|
72
|
-
imports: { [importFrom]: [name] },
|
|
70
|
+
imports: { [importFrom]: [identifier.name] },
|
|
73
71
|
destinationPath
|
|
74
72
|
});
|
|
75
73
|
}
|
|
76
74
|
return definition;
|
|
77
75
|
}
|
|
78
|
-
getDefinition({
|
|
79
|
-
const cachedDefinition = this.context.findDefinition({
|
|
76
|
+
getDefinition({ identifier, exportPath }) {
|
|
77
|
+
const cachedDefinition = this.context.findDefinition({
|
|
78
|
+
name: identifier.name,
|
|
79
|
+
exportPath
|
|
80
|
+
});
|
|
80
81
|
if (this.affirmDefinition(cachedDefinition, exportPath)) {
|
|
81
82
|
return cachedDefinition;
|
|
82
83
|
}
|
|
@@ -86,17 +87,6 @@ export class ModelDriver {
|
|
|
86
87
|
settings: this.settings,
|
|
87
88
|
destinationPath: this.settings.exportPath
|
|
88
89
|
});
|
|
89
|
-
// @TODO This feels hacky and there is probably a better way to do this
|
|
90
|
-
const tsType = value &&
|
|
91
|
-
typeof value === 'object' &&
|
|
92
|
-
'tsType' in value &&
|
|
93
|
-
typeof value.tsType === 'string'
|
|
94
|
-
? value.tsType
|
|
95
|
-
: undefined;
|
|
96
|
-
const identifier = match(this.insertable.entityType.type)
|
|
97
|
-
.with('variable', () => Identifier.createValue({ name, tsType }))
|
|
98
|
-
.with('type', () => Identifier.createType(name))
|
|
99
|
-
.exhaustive();
|
|
100
90
|
const definition = new Definition({
|
|
101
91
|
context: this.context,
|
|
102
92
|
value,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
|
-
import type { EntityType } from '../EntityType.js';
|
|
3
2
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
3
|
import type { BaseSettings } from '../../types/Settings.js';
|
|
5
4
|
import type { RefName } from '../../types/RefName.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
type ModelInsertableConstructorArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
refName: RefName;
|
|
@@ -39,8 +39,7 @@ export type ModelInsertable<V> = {
|
|
|
39
39
|
id: string;
|
|
40
40
|
type: 'model';
|
|
41
41
|
_class: 'ModelInsertable';
|
|
42
|
-
|
|
43
|
-
toName: ({ refName, baseSettings }: ToModelNameArgs) => string;
|
|
42
|
+
toIdentifier: ({ refName, baseSettings }: ToModelNameArgs) => Identifier;
|
|
44
43
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
45
44
|
isSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
46
45
|
pinnable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,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AU,CAAA;IACxE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAC1E,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;IACvE,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,OAAO,CAAA;CAE3B,GAAG,QAAQ,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
2
|
import type { RefName } from '../../types/RefName.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
-
import { EntityType } from '../EntityType.js';
|
|
5
4
|
import type { IsModelSelectedArgs, ToModelExportPathArgs, ToModelNameArgs } from './ModelInsertable.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
export type ModelInsertableArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
@@ -10,12 +10,11 @@ export type ModelInsertableArgs = {
|
|
|
10
10
|
};
|
|
11
11
|
export type ModelConfig = {
|
|
12
12
|
id: string;
|
|
13
|
-
|
|
14
|
-
toName: ({ refName, baseSettings }: ToModelNameArgs) => string;
|
|
13
|
+
toIdentifier: ({ refName, baseSettings }: ToModelNameArgs) => Identifier;
|
|
15
14
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
16
15
|
isSelected?: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
17
16
|
};
|
|
18
|
-
export declare const
|
|
17
|
+
export declare const toModelBase: (config: ModelConfig) => {
|
|
19
18
|
ModelInsertable: {
|
|
20
19
|
new (args: ModelInsertableArgs): {
|
|
21
20
|
settings: ContentSettings;
|
|
@@ -29,8 +28,7 @@ export declare const toModelConfig: (config: ModelConfig) => {
|
|
|
29
28
|
id: string;
|
|
30
29
|
type: "model";
|
|
31
30
|
_class: "ModelInsertable";
|
|
32
|
-
|
|
33
|
-
toName: ({ refName, baseSettings }: ToModelNameArgs) => string;
|
|
31
|
+
toIdentifier: ({ refName, baseSettings }: ToModelNameArgs) => Identifier;
|
|
34
32
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
35
33
|
isSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
36
34
|
isSupported: () => boolean;
|
|
@@ -47,4 +45,4 @@ export declare const toModelConfig: (config: ModelConfig) => {
|
|
|
47
45
|
pinnable: boolean;
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
|
-
//# sourceMappingURL=
|
|
48
|
+
//# sourceMappingURL=toModelBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,eAAe,KAAK,UAAU,CAAA;IACxE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAC1E,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;CACzE,CAAA;AAED,eAAO,MAAM,WAAW,WAAY,WAAW;;mBAWzB,mBAAmB;;;;;;;;;;;;kDAhBG,eAAe,KAAK,UAAU;kDAC9B,qBAAqB,KAAK,MAAM;gDACjC,mBAAmB,KAAK,OAAO;;;;;sBAgCjD,eAAe;;;;;;;;;CAMvC,CAAA"}
|
|
@@ -3,10 +3,9 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
3
3
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
4
4
|
};
|
|
5
5
|
import { toModelGeneratorKey } from '../../types/GeneratorKeys.js';
|
|
6
|
-
import { EntityType } from '../EntityType.js';
|
|
7
6
|
import { GatewayBase } from '../GeneratorBase.js';
|
|
8
7
|
import { ModelBase } from './ModelBase.js';
|
|
9
|
-
export const
|
|
8
|
+
export const toModelBase = (config) => {
|
|
10
9
|
var _a, _b;
|
|
11
10
|
const ModelInsertable = (_a = class extends ModelBase {
|
|
12
11
|
constructor(args) {
|
|
@@ -38,17 +37,11 @@ export const toModelConfig = (config) => {
|
|
|
38
37
|
writable: true,
|
|
39
38
|
value: 'ModelInsertable'
|
|
40
39
|
}),
|
|
41
|
-
Object.defineProperty(_a, "
|
|
40
|
+
Object.defineProperty(_a, "toIdentifier", {
|
|
42
41
|
enumerable: true,
|
|
43
42
|
configurable: true,
|
|
44
43
|
writable: true,
|
|
45
|
-
value: config.
|
|
46
|
-
}),
|
|
47
|
-
Object.defineProperty(_a, "toName", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
value: config.toName.bind(config)
|
|
44
|
+
value: config.toIdentifier.bind(config)
|
|
52
45
|
}),
|
|
53
46
|
Object.defineProperty(_a, "toExportPath", {
|
|
54
47
|
enumerable: true,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OperationInsertable } from './OperationInsertable.js';
|
|
2
2
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
+
import type { Identifier } from '../Identifier.js';
|
|
4
5
|
import type { GeneratedDefintion, GenerationType } from '../../types/GeneratedValue.js';
|
|
5
6
|
import type { GeneratedValue } from '../../types/GeneratedValue.js';
|
|
6
7
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
@@ -20,7 +21,7 @@ export declare class OperationDriver<V extends GeneratedValue, T extends Generat
|
|
|
20
21
|
definition: GeneratedDefintion<V, T>;
|
|
21
22
|
constructor({ context, insertable, operation, generation, destinationPath }: CreateOperationArgs<V, T>);
|
|
22
23
|
get value(): V;
|
|
23
|
-
get
|
|
24
|
+
get identifier(): Identifier;
|
|
24
25
|
get exportPath(): string;
|
|
25
26
|
private apply;
|
|
26
27
|
private getDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,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,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { normalize } from '../../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
2
2
|
import { Definition } from '../Definition.js';
|
|
3
|
-
import { Identifier } from '../Identifier.js';
|
|
4
|
-
import { match } from 'ts-pattern';
|
|
5
3
|
import { toOperationGeneratorKey } from '../../types/GeneratorKeys.js';
|
|
6
4
|
export class OperationDriver {
|
|
7
5
|
constructor({ context, insertable, operation, generation, destinationPath }) {
|
|
@@ -57,29 +55,32 @@ export class OperationDriver {
|
|
|
57
55
|
}
|
|
58
56
|
return this.definition.value;
|
|
59
57
|
}
|
|
60
|
-
get
|
|
61
|
-
return this.settings.
|
|
58
|
+
get identifier() {
|
|
59
|
+
return this.settings.identifier;
|
|
62
60
|
}
|
|
63
61
|
get exportPath() {
|
|
64
62
|
return this.settings.exportPath;
|
|
65
63
|
}
|
|
66
64
|
apply({ generation, destinationPath } = {}) {
|
|
67
|
-
const {
|
|
65
|
+
const { identifier, exportPath, selected, importFrom } = this.settings;
|
|
68
66
|
if (!selected && generation !== 'force') {
|
|
69
67
|
return undefined;
|
|
70
68
|
}
|
|
71
|
-
const definition = this.getDefinition({
|
|
69
|
+
const definition = this.getDefinition({ identifier, exportPath });
|
|
72
70
|
if (destinationPath &&
|
|
73
71
|
normalize(exportPath) !== normalize(destinationPath)) {
|
|
74
72
|
this.context.register({
|
|
75
|
-
imports: { [importFrom]: [name] },
|
|
73
|
+
imports: { [importFrom]: [identifier.name] },
|
|
76
74
|
destinationPath
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
77
|
return definition;
|
|
80
78
|
}
|
|
81
|
-
getDefinition({
|
|
82
|
-
const cachedDefinition = this.context.findDefinition({
|
|
79
|
+
getDefinition({ identifier, exportPath }) {
|
|
80
|
+
const cachedDefinition = this.context.findDefinition({
|
|
81
|
+
name: identifier.name,
|
|
82
|
+
exportPath
|
|
83
|
+
});
|
|
83
84
|
if (this.affirmDefinition(cachedDefinition, exportPath)) {
|
|
84
85
|
return cachedDefinition;
|
|
85
86
|
}
|
|
@@ -88,14 +89,6 @@ export class OperationDriver {
|
|
|
88
89
|
operation: this.operation,
|
|
89
90
|
settings: this.settings
|
|
90
91
|
});
|
|
91
|
-
// @TODO This feels hacky and there is probably a better way to do this
|
|
92
|
-
const tsType = 'tsType' in value && typeof value.tsType === 'string'
|
|
93
|
-
? value.tsType
|
|
94
|
-
: undefined;
|
|
95
|
-
const identifier = match(this.insertable.entityType.type)
|
|
96
|
-
.with('variable', () => Identifier.createValue({ name, tsType }))
|
|
97
|
-
.with('type', () => Identifier.createType(name))
|
|
98
|
-
.exhaustive();
|
|
99
92
|
const definition = new Definition({
|
|
100
93
|
context: this.context,
|
|
101
94
|
value,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
2
2
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
3
3
|
import type { BaseSettings } from '../../types/Settings.js';
|
|
4
|
-
import type { EntityType } from '../EntityType.js';
|
|
5
4
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
type OperationInsertableConstructorArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
@@ -38,8 +38,7 @@ export type OperationInsertable<V> = {
|
|
|
38
38
|
id: string;
|
|
39
39
|
type: 'operation';
|
|
40
40
|
_class: 'OperationInsertable';
|
|
41
|
-
|
|
42
|
-
toName: ({ operation, baseSettings }: ToOperationNameArgs) => string;
|
|
41
|
+
toIdentifier: ({ operation, baseSettings }: ToOperationNameArgs) => Identifier;
|
|
43
42
|
toExportPath: ({ operation, baseSettings }: ToOperationExportPathArgs) => string;
|
|
44
43
|
isSelected: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
45
44
|
pinnable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBA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A;IACjB,WAAW,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CAClD,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,GAAG;IACtD,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kCAAkC,GAAG,CAAC,CAAA;IAC7E,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,qBAAqB,CAAA;IAC7B,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,UAAU,CAAA;IAC9E,YAAY,EAAE,CAAC,EACb,SAAS,EACT,YAAY,EACb,EAAE,yBAAyB,KAAK,MAAM,CAAA;IACvC,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,uBAAuB,KAAK,OAAO,CAAA;IAC7E,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CAElD,GAAG,QAAQ,CAAA"}
|
package/{script/dsl/operation/toOperationConfig.d.ts → esm/dsl/operation/toOperationBase.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EntityType } from '../EntityType.js';
|
|
2
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
3
2
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
4
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
5
4
|
import type { ToOperationNameArgs, ToOperationExportPathArgs, IsOperationSelectedArgs } from './OperationInsertable.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
export type OperationInsertableArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
@@ -10,8 +10,7 @@ export type OperationInsertableArgs = {
|
|
|
10
10
|
};
|
|
11
11
|
export type OperationConfig = {
|
|
12
12
|
id: string;
|
|
13
|
-
|
|
14
|
-
toName: ({ operation, baseSettings }: ToOperationNameArgs) => string;
|
|
13
|
+
toIdentifier: ({ operation, baseSettings }: ToOperationNameArgs) => Identifier;
|
|
15
14
|
toExportPath: ({ operation, baseSettings }: ToOperationExportPathArgs) => string;
|
|
16
15
|
isSelected?: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
17
16
|
isSupported?: (operation: OasOperation) => boolean;
|
|
@@ -29,7 +28,7 @@ export declare const toOperationBase: (config: OperationConfig) => {
|
|
|
29
28
|
};
|
|
30
29
|
createAndRegisterDefinition<Schema extends import("../../mod.js").SchemaType>({ schema, identifier, schemaToValueFn }: {
|
|
31
30
|
schema: Schema;
|
|
32
|
-
identifier:
|
|
31
|
+
identifier: Identifier;
|
|
33
32
|
schemaToValueFn: import("../../mod.js").SchemaToValueFn;
|
|
34
33
|
}): import("../Definition.js").Definition<import("../../mod.js").TypeSystemOutput<Schema["type"]>>;
|
|
35
34
|
register(args: Partial<import("../../context/GenerateContext.js").RegisterArgs>): void;
|
|
@@ -39,8 +38,7 @@ export declare const toOperationBase: (config: OperationConfig) => {
|
|
|
39
38
|
id: string;
|
|
40
39
|
type: "operation";
|
|
41
40
|
_class: "OperationInsertable";
|
|
42
|
-
|
|
43
|
-
toName: ({ operation, baseSettings }: ToOperationNameArgs) => string;
|
|
41
|
+
toIdentifier: ({ operation, baseSettings }: ToOperationNameArgs) => Identifier;
|
|
44
42
|
toExportPath: ({ operation, baseSettings }: ToOperationExportPathArgs) => string;
|
|
45
43
|
isSelected: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
46
44
|
isSupported: (operation: OasOperation) => boolean;
|
|
@@ -57,4 +55,4 @@ export declare const toOperationBase: (config: OperationConfig) => {
|
|
|
57
55
|
pinnable: boolean;
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=toOperationBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,YAAY,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,UAAU,CAAA;IAC9E,YAAY,EAAE,CAAC,EACb,SAAS,EACT,YAAY,EACb,EAAE,yBAAyB,KAAK,MAAM,CAAA;IACvC,UAAU,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,uBAAuB,KAAK,OAAO,CAAA;IAC9E,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,eAAe;;mBAWjC,uBAAuB;;;;;;;;;;;;;;;;;;;;oDArBC,mBAAmB,KAAK,UAAU;oDAI3E,yBAAyB,KAAK,MAAM;kDACI,uBAAuB,KAAK,OAAO;iCACpD,YAAY,KAAK,OAAO;;;;sBAiC3B,eAAe;;;;;;iCAjCZ,YAAY,KAAK,OAAO;;;CAuCnD,CAAA"}
|
|
@@ -2,7 +2,6 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
2
2
|
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
3
3
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
4
4
|
};
|
|
5
|
-
import { EntityType } from '../EntityType.js';
|
|
6
5
|
import { toOperationGeneratorKey } from '../../types/GeneratorKeys.js';
|
|
7
6
|
import { OperationBase } from './OperationBase.js';
|
|
8
7
|
import { GatewayBase } from '../GeneratorBase.js';
|
|
@@ -38,17 +37,11 @@ export const toOperationBase = (config) => {
|
|
|
38
37
|
writable: true,
|
|
39
38
|
value: 'OperationInsertable'
|
|
40
39
|
}),
|
|
41
|
-
Object.defineProperty(_a, "
|
|
40
|
+
Object.defineProperty(_a, "toIdentifier", {
|
|
42
41
|
enumerable: true,
|
|
43
42
|
configurable: true,
|
|
44
43
|
writable: true,
|
|
45
|
-
value: config.
|
|
46
|
-
}),
|
|
47
|
-
Object.defineProperty(_a, "toName", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
configurable: true,
|
|
50
|
-
writable: true,
|
|
51
|
-
value: config.toName.bind(config)
|
|
44
|
+
value: config.toIdentifier.bind(config)
|
|
52
45
|
}),
|
|
53
46
|
Object.defineProperty(_a, "toExportPath", {
|
|
54
47
|
enumerable: true,
|
package/esm/mod.d.ts
CHANGED
|
@@ -13,12 +13,12 @@ export * from './dsl/Import.js';
|
|
|
13
13
|
export * from './dsl/model/ModelBase.js';
|
|
14
14
|
export * from './dsl/model/ModelDriver.js';
|
|
15
15
|
export * from './dsl/model/ModelInsertable.js';
|
|
16
|
-
export * from './dsl/model/
|
|
16
|
+
export * from './dsl/model/toModelBase.js';
|
|
17
17
|
export * from './dsl/operation/OperationBase.js';
|
|
18
18
|
export * from './dsl/operation/OperationBase.js';
|
|
19
19
|
export * from './dsl/operation/OperationDriver.js';
|
|
20
20
|
export * from './dsl/operation/OperationInsertable.js';
|
|
21
|
-
export * from './dsl/operation/
|
|
21
|
+
export * from './dsl/operation/toOperationBase.js';
|
|
22
22
|
export * from './dsl/Stringable.js';
|
|
23
23
|
export * from './dsl/ValueBase.js';
|
|
24
24
|
export * from './helpers/isImported.js';
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;A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,12 +13,12 @@ export * from './dsl/Import.js';
|
|
|
13
13
|
export * from './dsl/model/ModelBase.js';
|
|
14
14
|
export * from './dsl/model/ModelDriver.js';
|
|
15
15
|
export * from './dsl/model/ModelInsertable.js';
|
|
16
|
-
export * from './dsl/model/
|
|
16
|
+
export * from './dsl/model/toModelBase.js';
|
|
17
17
|
export * from './dsl/operation/OperationBase.js';
|
|
18
18
|
export * from './dsl/operation/OperationBase.js';
|
|
19
19
|
export * from './dsl/operation/OperationDriver.js';
|
|
20
20
|
export * from './dsl/operation/OperationInsertable.js';
|
|
21
|
-
export * from './dsl/operation/
|
|
21
|
+
export * from './dsl/operation/toOperationBase.js';
|
|
22
22
|
export * from './dsl/Stringable.js';
|
|
23
23
|
export * from './dsl/ValueBase.js';
|
|
24
24
|
export * from './helpers/isImported.js';
|
package/package.json
CHANGED
|
@@ -203,7 +203,7 @@ class GenerateContext {
|
|
|
203
203
|
});
|
|
204
204
|
const e = insertable.toExportPath({ operation, baseSettings });
|
|
205
205
|
return new ContentSettings_js_1.ContentSettings({
|
|
206
|
-
|
|
206
|
+
identifier: insertable.toIdentifier({ operation, baseSettings }),
|
|
207
207
|
selected: insertable.isSelected({ operation, baseSettings }),
|
|
208
208
|
exportPath: e,
|
|
209
209
|
importFrom: baseSettings.importFrom ?? e
|
|
@@ -216,7 +216,7 @@ class GenerateContext {
|
|
|
216
216
|
});
|
|
217
217
|
const e = insertable.toExportPath({ refName, baseSettings });
|
|
218
218
|
return new ContentSettings_js_1.ContentSettings({
|
|
219
|
-
|
|
219
|
+
identifier: insertable.toIdentifier({ refName, baseSettings }),
|
|
220
220
|
selected: insertable.isSelected({ refName, baseSettings }),
|
|
221
221
|
exportPath: e,
|
|
222
222
|
importFrom: baseSettings.importFrom ?? e
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import type { Identifier } from './Identifier.js';
|
|
1
2
|
type EmptyArgs = {
|
|
2
3
|
exportPath: string;
|
|
3
|
-
|
|
4
|
+
identifier: Identifier;
|
|
4
5
|
};
|
|
5
6
|
type CreateArgs = {
|
|
6
|
-
|
|
7
|
+
identifier: Identifier;
|
|
7
8
|
selected: boolean;
|
|
8
9
|
exportPath: string;
|
|
9
10
|
importFrom: string;
|
|
10
11
|
};
|
|
11
12
|
export declare class ContentSettings {
|
|
12
|
-
|
|
13
|
+
identifier: Identifier;
|
|
13
14
|
selected: boolean;
|
|
14
15
|
exportPath: string;
|
|
15
16
|
importFrom: string;
|
|
16
|
-
constructor({
|
|
17
|
-
static empty({
|
|
17
|
+
constructor({ identifier, selected, exportPath, importFrom }: CreateArgs);
|
|
18
|
+
static empty({ identifier, exportPath }: EmptyArgs): ContentSettings;
|
|
18
19
|
}
|
|
19
20
|
export {};
|
|
20
21
|
//# sourceMappingURL=ContentSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentSettings.d.ts","sourceRoot":"","sources":["../../src/dsl/ContentSettings.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,
|
|
1
|
+
{"version":3,"file":"ContentSettings.d.ts","sourceRoot":"","sources":["../../src/dsl/ContentSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,KAAK,SAAS,GAAG;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qBAAa,eAAe;IAC1B,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;gBAEN,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,UAAU;IAOxE,MAAM,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,SAAS,GAAG,eAAe;CAQrE"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContentSettings = void 0;
|
|
4
4
|
class ContentSettings {
|
|
5
|
-
constructor({
|
|
6
|
-
Object.defineProperty(this, "
|
|
5
|
+
constructor({ identifier, selected, exportPath, importFrom }) {
|
|
6
|
+
Object.defineProperty(this, "identifier", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
configurable: true,
|
|
9
9
|
writable: true,
|
|
@@ -27,15 +27,15 @@ class ContentSettings {
|
|
|
27
27
|
writable: true,
|
|
28
28
|
value: void 0
|
|
29
29
|
});
|
|
30
|
-
this.
|
|
30
|
+
this.identifier = identifier;
|
|
31
31
|
this.selected = selected;
|
|
32
32
|
this.exportPath = exportPath;
|
|
33
33
|
this.importFrom = importFrom;
|
|
34
34
|
}
|
|
35
|
-
static empty({
|
|
35
|
+
static empty({ identifier, exportPath }) {
|
|
36
36
|
return new ContentSettings({
|
|
37
37
|
selected: true,
|
|
38
|
-
|
|
38
|
+
identifier,
|
|
39
39
|
exportPath,
|
|
40
40
|
importFrom: exportPath
|
|
41
41
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ModelInsertable } from './ModelInsertable.js';
|
|
2
2
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
+
import type { Identifier } from '../Identifier.js';
|
|
4
5
|
import type { GeneratedDefintion, GenerationType } from '../../types/GeneratedValue.js';
|
|
5
6
|
import type { GeneratedValue } from '../../types/GeneratedValue.js';
|
|
6
7
|
import type { RefName } from '../../types/RefName.js';
|
|
@@ -20,7 +21,7 @@ export declare class ModelDriver<V extends GeneratedValue, T extends GenerationT
|
|
|
20
21
|
definition: GeneratedDefintion<V, T>;
|
|
21
22
|
constructor({ context, insertable, refName, generation, destinationPath }: CreateModelArgs<V, T>);
|
|
22
23
|
get value(): V;
|
|
23
|
-
get
|
|
24
|
+
get identifier(): Identifier;
|
|
24
25
|
get exportPath(): string;
|
|
25
26
|
private apply;
|
|
26
27
|
private getDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGrD,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;AAWD,qBAAa,WAAW,CAAC,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,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ModelDriver = void 0;
|
|
4
4
|
const mod_js_1 = require("../../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
5
5
|
const Definition_js_1 = require("../Definition.js");
|
|
6
|
-
const Identifier_js_1 = require("../Identifier.js");
|
|
7
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
8
6
|
const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
|
|
9
7
|
class ModelDriver {
|
|
10
8
|
constructor({ context, insertable, refName, generation, destinationPath }) {
|
|
@@ -57,29 +55,32 @@ class ModelDriver {
|
|
|
57
55
|
}
|
|
58
56
|
return this.definition.value;
|
|
59
57
|
}
|
|
60
|
-
get
|
|
61
|
-
return this.settings.
|
|
58
|
+
get identifier() {
|
|
59
|
+
return this.settings.identifier;
|
|
62
60
|
}
|
|
63
61
|
get exportPath() {
|
|
64
62
|
return this.settings.exportPath;
|
|
65
63
|
}
|
|
66
64
|
apply({ generation, destinationPath } = {}) {
|
|
67
|
-
const {
|
|
65
|
+
const { identifier, exportPath, selected, importFrom } = this.settings;
|
|
68
66
|
if (!selected && generation !== 'force') {
|
|
69
67
|
return undefined;
|
|
70
68
|
}
|
|
71
|
-
const definition = this.getDefinition({
|
|
69
|
+
const definition = this.getDefinition({ identifier, exportPath });
|
|
72
70
|
if (destinationPath &&
|
|
73
71
|
(0, mod_js_1.normalize)(exportPath) !== (0, mod_js_1.normalize)(destinationPath)) {
|
|
74
72
|
this.context.register({
|
|
75
|
-
imports: { [importFrom]: [name] },
|
|
73
|
+
imports: { [importFrom]: [identifier.name] },
|
|
76
74
|
destinationPath
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
77
|
return definition;
|
|
80
78
|
}
|
|
81
|
-
getDefinition({
|
|
82
|
-
const cachedDefinition = this.context.findDefinition({
|
|
79
|
+
getDefinition({ identifier, exportPath }) {
|
|
80
|
+
const cachedDefinition = this.context.findDefinition({
|
|
81
|
+
name: identifier.name,
|
|
82
|
+
exportPath
|
|
83
|
+
});
|
|
83
84
|
if (this.affirmDefinition(cachedDefinition, exportPath)) {
|
|
84
85
|
return cachedDefinition;
|
|
85
86
|
}
|
|
@@ -89,17 +90,6 @@ class ModelDriver {
|
|
|
89
90
|
settings: this.settings,
|
|
90
91
|
destinationPath: this.settings.exportPath
|
|
91
92
|
});
|
|
92
|
-
// @TODO This feels hacky and there is probably a better way to do this
|
|
93
|
-
const tsType = value &&
|
|
94
|
-
typeof value === 'object' &&
|
|
95
|
-
'tsType' in value &&
|
|
96
|
-
typeof value.tsType === 'string'
|
|
97
|
-
? value.tsType
|
|
98
|
-
: undefined;
|
|
99
|
-
const identifier = (0, ts_pattern_1.match)(this.insertable.entityType.type)
|
|
100
|
-
.with('variable', () => Identifier_js_1.Identifier.createValue({ name, tsType }))
|
|
101
|
-
.with('type', () => Identifier_js_1.Identifier.createType(name))
|
|
102
|
-
.exhaustive();
|
|
103
93
|
const definition = new Definition_js_1.Definition({
|
|
104
94
|
context: this.context,
|
|
105
95
|
value,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
|
-
import type { EntityType } from '../EntityType.js';
|
|
3
2
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
3
|
import type { BaseSettings } from '../../types/Settings.js';
|
|
5
4
|
import type { RefName } from '../../types/RefName.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
type ModelInsertableConstructorArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
refName: RefName;
|
|
@@ -39,8 +39,7 @@ export type ModelInsertable<V> = {
|
|
|
39
39
|
id: string;
|
|
40
40
|
type: 'model';
|
|
41
41
|
_class: 'ModelInsertable';
|
|
42
|
-
|
|
43
|
-
toName: ({ refName, baseSettings }: ToModelNameArgs) => string;
|
|
42
|
+
toIdentifier: ({ refName, baseSettings }: ToModelNameArgs) => Identifier;
|
|
44
43
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
45
44
|
isSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
46
45
|
pinnable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE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AiB,CAAA;IACzB,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,eAAe,KAAK,UAAU,CAAA;IACxE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAC1E,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;IACvE,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,MAAM,OAAO,CAAA;CAE3B,GAAG,QAAQ,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
2
2
|
import type { RefName } from '../../types/RefName.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
-
import { EntityType } from '../EntityType.js';
|
|
5
4
|
import type { IsModelSelectedArgs, ToModelExportPathArgs, ToModelNameArgs } from './ModelInsertable.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
export type ModelInsertableArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
@@ -10,12 +10,11 @@ export type ModelInsertableArgs = {
|
|
|
10
10
|
};
|
|
11
11
|
export type ModelConfig = {
|
|
12
12
|
id: string;
|
|
13
|
-
|
|
14
|
-
toName: ({ refName, baseSettings }: ToModelNameArgs) => string;
|
|
13
|
+
toIdentifier: ({ refName, baseSettings }: ToModelNameArgs) => Identifier;
|
|
15
14
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
16
15
|
isSelected?: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
17
16
|
};
|
|
18
|
-
export declare const
|
|
17
|
+
export declare const toModelBase: (config: ModelConfig) => {
|
|
19
18
|
ModelInsertable: {
|
|
20
19
|
new (args: ModelInsertableArgs): {
|
|
21
20
|
settings: ContentSettings;
|
|
@@ -29,8 +28,7 @@ export declare const toModelConfig: (config: ModelConfig) => {
|
|
|
29
28
|
id: string;
|
|
30
29
|
type: "model";
|
|
31
30
|
_class: "ModelInsertable";
|
|
32
|
-
|
|
33
|
-
toName: ({ refName, baseSettings }: ToModelNameArgs) => string;
|
|
31
|
+
toIdentifier: ({ refName, baseSettings }: ToModelNameArgs) => Identifier;
|
|
34
32
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
35
33
|
isSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
36
34
|
isSupported: () => boolean;
|
|
@@ -47,4 +45,4 @@ export declare const toModelConfig: (config: ModelConfig) => {
|
|
|
47
45
|
pinnable: boolean;
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
|
-
//# sourceMappingURL=
|
|
48
|
+
//# sourceMappingURL=toModelBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,eAAe,KAAK,UAAU,CAAA;IACxE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAC1E,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;CACzE,CAAA;AAED,eAAO,MAAM,WAAW,WAAY,WAAW;;mBAWzB,mBAAmB;;;;;;;;;;;;kDAhBG,eAAe,KAAK,UAAU;kDAC9B,qBAAqB,KAAK,MAAM;gDACjC,mBAAmB,KAAK,OAAO;;;;;sBAgCjD,eAAe;;;;;;;;;CAMvC,CAAA"}
|
|
@@ -4,12 +4,11 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
4
4
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.toModelBase = void 0;
|
|
8
8
|
const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
|
|
9
|
-
const EntityType_js_1 = require("../EntityType.js");
|
|
10
9
|
const GeneratorBase_js_1 = require("../GeneratorBase.js");
|
|
11
10
|
const ModelBase_js_1 = require("./ModelBase.js");
|
|
12
|
-
const
|
|
11
|
+
const toModelBase = (config) => {
|
|
13
12
|
var _a, _b;
|
|
14
13
|
const ModelInsertable = (_a = class extends ModelBase_js_1.ModelBase {
|
|
15
14
|
constructor(args) {
|
|
@@ -41,17 +40,11 @@ const toModelConfig = (config) => {
|
|
|
41
40
|
writable: true,
|
|
42
41
|
value: 'ModelInsertable'
|
|
43
42
|
}),
|
|
44
|
-
Object.defineProperty(_a, "
|
|
43
|
+
Object.defineProperty(_a, "toIdentifier", {
|
|
45
44
|
enumerable: true,
|
|
46
45
|
configurable: true,
|
|
47
46
|
writable: true,
|
|
48
|
-
value: config.
|
|
49
|
-
}),
|
|
50
|
-
Object.defineProperty(_a, "toName", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: config.toName.bind(config)
|
|
47
|
+
value: config.toIdentifier.bind(config)
|
|
55
48
|
}),
|
|
56
49
|
Object.defineProperty(_a, "toExportPath", {
|
|
57
50
|
enumerable: true,
|
|
@@ -117,4 +110,4 @@ const toModelConfig = (config) => {
|
|
|
117
110
|
_b);
|
|
118
111
|
return { ModelInsertable, ModelGateway };
|
|
119
112
|
};
|
|
120
|
-
exports.
|
|
113
|
+
exports.toModelBase = toModelBase;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OperationInsertable } from './OperationInsertable.js';
|
|
2
2
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
|
+
import type { Identifier } from '../Identifier.js';
|
|
4
5
|
import type { GeneratedDefintion, GenerationType } from '../../types/GeneratedValue.js';
|
|
5
6
|
import type { GeneratedValue } from '../../types/GeneratedValue.js';
|
|
6
7
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
@@ -20,7 +21,7 @@ export declare class OperationDriver<V extends GeneratedValue, T extends Generat
|
|
|
20
21
|
definition: GeneratedDefintion<V, T>;
|
|
21
22
|
constructor({ context, insertable, operation, generation, destinationPath }: CreateOperationArgs<V, T>);
|
|
22
23
|
get value(): V;
|
|
23
|
-
get
|
|
24
|
+
get identifier(): Identifier;
|
|
24
25
|
get exportPath(): string;
|
|
25
26
|
private apply;
|
|
26
27
|
private getDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,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;IAc5B,IAAI,KAAK,IAAI,CAAC,CAQb;IAED,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,OAAO,CAAC,KAAK;IAyBb,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OperationDriver = void 0;
|
|
4
4
|
const mod_js_1 = require("../../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
5
5
|
const Definition_js_1 = require("../Definition.js");
|
|
6
|
-
const Identifier_js_1 = require("../Identifier.js");
|
|
7
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
8
6
|
const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
|
|
9
7
|
class OperationDriver {
|
|
10
8
|
constructor({ context, insertable, operation, generation, destinationPath }) {
|
|
@@ -60,29 +58,32 @@ class OperationDriver {
|
|
|
60
58
|
}
|
|
61
59
|
return this.definition.value;
|
|
62
60
|
}
|
|
63
|
-
get
|
|
64
|
-
return this.settings.
|
|
61
|
+
get identifier() {
|
|
62
|
+
return this.settings.identifier;
|
|
65
63
|
}
|
|
66
64
|
get exportPath() {
|
|
67
65
|
return this.settings.exportPath;
|
|
68
66
|
}
|
|
69
67
|
apply({ generation, destinationPath } = {}) {
|
|
70
|
-
const {
|
|
68
|
+
const { identifier, exportPath, selected, importFrom } = this.settings;
|
|
71
69
|
if (!selected && generation !== 'force') {
|
|
72
70
|
return undefined;
|
|
73
71
|
}
|
|
74
|
-
const definition = this.getDefinition({
|
|
72
|
+
const definition = this.getDefinition({ identifier, exportPath });
|
|
75
73
|
if (destinationPath &&
|
|
76
74
|
(0, mod_js_1.normalize)(exportPath) !== (0, mod_js_1.normalize)(destinationPath)) {
|
|
77
75
|
this.context.register({
|
|
78
|
-
imports: { [importFrom]: [name] },
|
|
76
|
+
imports: { [importFrom]: [identifier.name] },
|
|
79
77
|
destinationPath
|
|
80
78
|
});
|
|
81
79
|
}
|
|
82
80
|
return definition;
|
|
83
81
|
}
|
|
84
|
-
getDefinition({
|
|
85
|
-
const cachedDefinition = this.context.findDefinition({
|
|
82
|
+
getDefinition({ identifier, exportPath }) {
|
|
83
|
+
const cachedDefinition = this.context.findDefinition({
|
|
84
|
+
name: identifier.name,
|
|
85
|
+
exportPath
|
|
86
|
+
});
|
|
86
87
|
if (this.affirmDefinition(cachedDefinition, exportPath)) {
|
|
87
88
|
return cachedDefinition;
|
|
88
89
|
}
|
|
@@ -91,14 +92,6 @@ class OperationDriver {
|
|
|
91
92
|
operation: this.operation,
|
|
92
93
|
settings: this.settings
|
|
93
94
|
});
|
|
94
|
-
// @TODO This feels hacky and there is probably a better way to do this
|
|
95
|
-
const tsType = 'tsType' in value && typeof value.tsType === 'string'
|
|
96
|
-
? value.tsType
|
|
97
|
-
: undefined;
|
|
98
|
-
const identifier = (0, ts_pattern_1.match)(this.insertable.entityType.type)
|
|
99
|
-
.with('variable', () => Identifier_js_1.Identifier.createValue({ name, tsType }))
|
|
100
|
-
.with('type', () => Identifier_js_1.Identifier.createType(name))
|
|
101
|
-
.exhaustive();
|
|
102
95
|
const definition = new Definition_js_1.Definition({
|
|
103
96
|
context: this.context,
|
|
104
97
|
value,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
2
2
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
3
3
|
import type { BaseSettings } from '../../types/Settings.js';
|
|
4
|
-
import type { EntityType } from '../EntityType.js';
|
|
5
4
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
type OperationInsertableConstructorArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
@@ -38,8 +38,7 @@ export type OperationInsertable<V> = {
|
|
|
38
38
|
id: string;
|
|
39
39
|
type: 'operation';
|
|
40
40
|
_class: 'OperationInsertable';
|
|
41
|
-
|
|
42
|
-
toName: ({ operation, baseSettings }: ToOperationNameArgs) => string;
|
|
41
|
+
toIdentifier: ({ operation, baseSettings }: ToOperationNameArgs) => Identifier;
|
|
43
42
|
toExportPath: ({ operation, baseSettings }: ToOperationExportPathArgs) => string;
|
|
44
43
|
isSelected: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
45
44
|
pinnable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"OperationInsertable.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/OperationInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,KAAK,kCAAkC,GAAG;IACxC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,YAAY,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,YAAY,CAAA;IACvB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MA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esm/dsl/operation/toOperationConfig.d.ts → script/dsl/operation/toOperationBase.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EntityType } from '../EntityType.js';
|
|
2
1
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
3
2
|
import type { OasOperation } from '../../oas/operation/Operation.js';
|
|
4
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
5
4
|
import type { ToOperationNameArgs, ToOperationExportPathArgs, IsOperationSelectedArgs } from './OperationInsertable.js';
|
|
5
|
+
import type { Identifier } from '../Identifier.js';
|
|
6
6
|
export type OperationInsertableArgs = {
|
|
7
7
|
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
@@ -10,8 +10,7 @@ export type OperationInsertableArgs = {
|
|
|
10
10
|
};
|
|
11
11
|
export type OperationConfig = {
|
|
12
12
|
id: string;
|
|
13
|
-
|
|
14
|
-
toName: ({ operation, baseSettings }: ToOperationNameArgs) => string;
|
|
13
|
+
toIdentifier: ({ operation, baseSettings }: ToOperationNameArgs) => Identifier;
|
|
15
14
|
toExportPath: ({ operation, baseSettings }: ToOperationExportPathArgs) => string;
|
|
16
15
|
isSelected?: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
17
16
|
isSupported?: (operation: OasOperation) => boolean;
|
|
@@ -29,7 +28,7 @@ export declare const toOperationBase: (config: OperationConfig) => {
|
|
|
29
28
|
};
|
|
30
29
|
createAndRegisterDefinition<Schema extends import("../../mod.js").SchemaType>({ schema, identifier, schemaToValueFn }: {
|
|
31
30
|
schema: Schema;
|
|
32
|
-
identifier:
|
|
31
|
+
identifier: Identifier;
|
|
33
32
|
schemaToValueFn: import("../../mod.js").SchemaToValueFn;
|
|
34
33
|
}): import("../Definition.js").Definition<import("../../mod.js").TypeSystemOutput<Schema["type"]>>;
|
|
35
34
|
register(args: Partial<import("../../context/GenerateContext.js").RegisterArgs>): void;
|
|
@@ -39,8 +38,7 @@ export declare const toOperationBase: (config: OperationConfig) => {
|
|
|
39
38
|
id: string;
|
|
40
39
|
type: "operation";
|
|
41
40
|
_class: "OperationInsertable";
|
|
42
|
-
|
|
43
|
-
toName: ({ operation, baseSettings }: ToOperationNameArgs) => string;
|
|
41
|
+
toIdentifier: ({ operation, baseSettings }: ToOperationNameArgs) => Identifier;
|
|
44
42
|
toExportPath: ({ operation, baseSettings }: ToOperationExportPathArgs) => string;
|
|
45
43
|
isSelected: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
46
44
|
isSupported: (operation: OasOperation) => boolean;
|
|
@@ -57,4 +55,4 @@ export declare const toOperationBase: (config: OperationConfig) => {
|
|
|
57
55
|
pinnable: boolean;
|
|
58
56
|
};
|
|
59
57
|
};
|
|
60
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=toOperationBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toOperationBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationBase.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,YAAY,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,UAAU,CAAA;IAC9E,YAAY,EAAE,CAAC,EACb,SAAS,EACT,YAAY,EACb,EAAE,yBAAyB,KAAK,MAAM,CAAA;IACvC,UAAU,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,uBAAuB,KAAK,OAAO,CAAA;IAC9E,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,eAAe,WAAY,eAAe;;mBAWjC,uBAAuB;;;;;;;;;;;;;;;;;;;;oDArBC,mBAAmB,KAAK,UAAU;oDAI3E,yBAAyB,KAAK,MAAM;kDACI,uBAAuB,KAAK,OAAO;iCACpD,YAAY,KAAK,OAAO;;;;sBAiC3B,eAAe;;;;;;iCAjCZ,YAAY,KAAK,OAAO;;;CAuCnD,CAAA"}
|
|
@@ -5,7 +5,6 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.toOperationBase = void 0;
|
|
8
|
-
const EntityType_js_1 = require("../EntityType.js");
|
|
9
8
|
const GeneratorKeys_js_1 = require("../../types/GeneratorKeys.js");
|
|
10
9
|
const OperationBase_js_1 = require("./OperationBase.js");
|
|
11
10
|
const GeneratorBase_js_1 = require("../GeneratorBase.js");
|
|
@@ -41,17 +40,11 @@ const toOperationBase = (config) => {
|
|
|
41
40
|
writable: true,
|
|
42
41
|
value: 'OperationInsertable'
|
|
43
42
|
}),
|
|
44
|
-
Object.defineProperty(_a, "
|
|
43
|
+
Object.defineProperty(_a, "toIdentifier", {
|
|
45
44
|
enumerable: true,
|
|
46
45
|
configurable: true,
|
|
47
46
|
writable: true,
|
|
48
|
-
value: config.
|
|
49
|
-
}),
|
|
50
|
-
Object.defineProperty(_a, "toName", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: config.toName.bind(config)
|
|
47
|
+
value: config.toIdentifier.bind(config)
|
|
55
48
|
}),
|
|
56
49
|
Object.defineProperty(_a, "toExportPath", {
|
|
57
50
|
enumerable: true,
|
package/script/mod.d.ts
CHANGED
|
@@ -13,12 +13,12 @@ export * from './dsl/Import.js';
|
|
|
13
13
|
export * from './dsl/model/ModelBase.js';
|
|
14
14
|
export * from './dsl/model/ModelDriver.js';
|
|
15
15
|
export * from './dsl/model/ModelInsertable.js';
|
|
16
|
-
export * from './dsl/model/
|
|
16
|
+
export * from './dsl/model/toModelBase.js';
|
|
17
17
|
export * from './dsl/operation/OperationBase.js';
|
|
18
18
|
export * from './dsl/operation/OperationBase.js';
|
|
19
19
|
export * from './dsl/operation/OperationDriver.js';
|
|
20
20
|
export * from './dsl/operation/OperationInsertable.js';
|
|
21
|
-
export * from './dsl/operation/
|
|
21
|
+
export * from './dsl/operation/toOperationBase.js';
|
|
22
22
|
export * from './dsl/Stringable.js';
|
|
23
23
|
export * from './dsl/ValueBase.js';
|
|
24
24
|
export * from './helpers/isImported.js';
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,
|
|
1
|
+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B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uCAAuC,CAAA;AACrD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
|
package/script/mod.js
CHANGED
|
@@ -29,12 +29,12 @@ __exportStar(require("./dsl/Import.js"), exports);
|
|
|
29
29
|
__exportStar(require("./dsl/model/ModelBase.js"), exports);
|
|
30
30
|
__exportStar(require("./dsl/model/ModelDriver.js"), exports);
|
|
31
31
|
__exportStar(require("./dsl/model/ModelInsertable.js"), exports);
|
|
32
|
-
__exportStar(require("./dsl/model/
|
|
32
|
+
__exportStar(require("./dsl/model/toModelBase.js"), exports);
|
|
33
33
|
__exportStar(require("./dsl/operation/OperationBase.js"), exports);
|
|
34
34
|
__exportStar(require("./dsl/operation/OperationBase.js"), exports);
|
|
35
35
|
__exportStar(require("./dsl/operation/OperationDriver.js"), exports);
|
|
36
36
|
__exportStar(require("./dsl/operation/OperationInsertable.js"), exports);
|
|
37
|
-
__exportStar(require("./dsl/operation/
|
|
37
|
+
__exportStar(require("./dsl/operation/toOperationBase.js"), exports);
|
|
38
38
|
__exportStar(require("./dsl/Stringable.js"), exports);
|
|
39
39
|
__exportStar(require("./dsl/ValueBase.js"), exports);
|
|
40
40
|
__exportStar(require("./helpers/isImported.js"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toModelConfig.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/toModelConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAG7B,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,eAAe,KAAK,MAAM,CAAA;IAC9D,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAC1E,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;CACzE,CAAA;AAED,eAAO,MAAM,aAAa,WAAY,WAAW;;mBAY3B,mBAAmB;;;;;;;;;;;;;4CAjBH,eAAe,KAAK,MAAM;kDACpB,qBAAqB,KAAK,MAAM;gDACjC,mBAAmB,KAAK,OAAO;;;;;sBAiCjD,eAAe;;;;;;;;;CAMvC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationConfig.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE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