@skmtc/core 0.0.263 → 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 +9 -21
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +4 -4
- package/esm/context/GenerateContext.d.ts +14 -18
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +6 -6
- package/esm/dsl/ModelDriver.d.ts +10 -10
- package/esm/dsl/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/ModelDriver.js +33 -21
- package/esm/dsl/{ModelCreator.d.ts → ModelInsertable.d.ts} +2 -14
- package/esm/dsl/ModelInsertable.d.ts.map +1 -0
- package/esm/dsl/OperationDriver.d.ts +10 -10
- package/esm/dsl/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/OperationDriver.js +33 -22
- package/{script/dsl/OperationCreator.d.ts → esm/dsl/OperationInsertable.d.ts} +2 -2
- package/esm/dsl/OperationInsertable.d.ts.map +1 -0
- package/esm/dsl/base.d.ts +5 -5
- package/esm/dsl/base.d.ts.map +1 -1
- package/esm/dsl/base.js +3 -3
- package/esm/dsl/withConfig.d.ts +13 -13
- package/esm/dsl/withConfig.d.ts.map +1 -1
- package/esm/dsl/withConfig.js +2 -2
- package/esm/generate/generate.d.ts +2 -2
- package/esm/generate/generate.d.ts.map +1 -1
- package/esm/mod.d.ts +2 -4
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +2 -4
- package/esm/server/createServer.d.ts +2 -2
- package/esm/server/createServer.d.ts.map +1 -1
- package/esm/types/GeneratedValue.d.ts +13 -0
- package/esm/types/GeneratedValue.d.ts.map +1 -1
- package/esm/types/GeneratorKeys.d.ts +1 -1
- package/esm/types/GeneratorKeys.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +9 -21
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +4 -4
- package/script/context/GenerateContext.d.ts +14 -18
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +6 -6
- package/script/dsl/ModelDriver.d.ts +10 -10
- package/script/dsl/ModelDriver.d.ts.map +1 -1
- package/script/dsl/ModelDriver.js +33 -21
- package/script/dsl/{ModelCreator.d.ts → ModelInsertable.d.ts} +2 -14
- package/script/dsl/ModelInsertable.d.ts.map +1 -0
- package/script/dsl/OperationDriver.d.ts +10 -10
- package/script/dsl/OperationDriver.d.ts.map +1 -1
- package/script/dsl/OperationDriver.js +33 -22
- package/{esm/dsl/OperationCreator.d.ts → script/dsl/OperationInsertable.d.ts} +2 -2
- package/script/dsl/OperationInsertable.d.ts.map +1 -0
- package/script/dsl/base.d.ts +5 -5
- package/script/dsl/base.d.ts.map +1 -1
- package/script/dsl/base.js +3 -3
- package/script/dsl/withConfig.d.ts +13 -13
- package/script/dsl/withConfig.d.ts.map +1 -1
- package/script/dsl/withConfig.js +5 -5
- package/script/generate/generate.d.ts +2 -2
- package/script/generate/generate.d.ts.map +1 -1
- package/script/mod.d.ts +2 -4
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +2 -4
- package/script/server/createServer.d.ts +2 -2
- package/script/server/createServer.d.ts.map +1 -1
- package/script/types/GeneratedValue.d.ts +13 -0
- package/script/types/GeneratedValue.d.ts.map +1 -1
- package/script/types/GeneratorKeys.d.ts +1 -1
- package/script/types/GeneratorKeys.d.ts.map +1 -1
- package/esm/dsl/ModelCreator.d.ts.map +0 -1
- package/esm/dsl/OperationCreator.d.ts.map +0 -1
- package/esm/helpers/verifyType.d.ts +0 -4
- package/esm/helpers/verifyType.d.ts.map +0 -1
- package/esm/helpers/verifyType.js +0 -12
- 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/esm/typescript/toOperationResponse.d.ts +0 -16
- package/esm/typescript/toOperationResponse.d.ts.map +0 -1
- package/esm/typescript/toOperationResponse.js +0 -17
- package/script/dsl/ModelCreator.d.ts.map +0 -1
- package/script/dsl/OperationCreator.d.ts.map +0 -1
- package/script/helpers/verifyType.d.ts +0 -4
- package/script/helpers/verifyType.d.ts.map +0 -1
- package/script/helpers/verifyType.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
- package/script/typescript/toOperationResponse.d.ts +0 -16
- package/script/typescript/toOperationResponse.d.ts.map +0 -1
- package/script/typescript/toOperationResponse.js +0 -21
- /package/esm/dsl/{ModelCreator.js → ModelInsertable.js} +0 -0
- /package/esm/dsl/{OperationCreator.js → OperationInsertable.js} +0 -0
- /package/script/dsl/{ModelCreator.js → ModelInsertable.js} +0 -0
- /package/script/dsl/{OperationCreator.js → OperationInsertable.js} +0 -0
|
@@ -6,16 +6,16 @@ const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
|
6
6
|
const Definition_js_1 = require("./Definition.js");
|
|
7
7
|
const Identifier_js_1 = require("./Identifier.js");
|
|
8
8
|
const ts_pattern_1 = require("ts-pattern");
|
|
9
|
-
const
|
|
9
|
+
const GeneratorKeys_js_1 = require("../types/GeneratorKeys.js");
|
|
10
10
|
class ModelDriver {
|
|
11
|
-
constructor({ context,
|
|
11
|
+
constructor({ context, insertable, refName, generation, destinationPath }) {
|
|
12
12
|
Object.defineProperty(this, "context", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
15
15
|
writable: true,
|
|
16
16
|
value: void 0
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(this, "
|
|
18
|
+
Object.defineProperty(this, "insertable", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
configurable: true,
|
|
21
21
|
writable: true,
|
|
@@ -46,18 +46,18 @@ class ModelDriver {
|
|
|
46
46
|
value: void 0
|
|
47
47
|
});
|
|
48
48
|
this.context = context;
|
|
49
|
-
this.
|
|
49
|
+
this.insertable = insertable;
|
|
50
50
|
this.refName = refName;
|
|
51
51
|
this.destinationPath = destinationPath;
|
|
52
|
-
this.settings = this.buildModelSettings({ refName,
|
|
52
|
+
this.settings = this.buildModelSettings({ refName, insertable });
|
|
53
53
|
this.definition = this.apply({
|
|
54
|
-
|
|
54
|
+
generation,
|
|
55
55
|
destinationPath
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
get value() {
|
|
59
59
|
if (!this.definition) {
|
|
60
|
-
throw new Error(`${this.
|
|
60
|
+
throw new Error(`${this.insertable.id} ${this.refName}: definition is undefined`);
|
|
61
61
|
}
|
|
62
62
|
return this.definition.value;
|
|
63
63
|
}
|
|
@@ -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 &&
|
|
@@ -83,12 +83,11 @@ class ModelDriver {
|
|
|
83
83
|
return definition;
|
|
84
84
|
}
|
|
85
85
|
getDefinition({ name, exportPath }) {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
return existing;
|
|
86
|
+
const cachedDefinition = this.context.findDefinition({ name, exportPath });
|
|
87
|
+
if (this.affirmDefinition(cachedDefinition)) {
|
|
88
|
+
return cachedDefinition;
|
|
90
89
|
}
|
|
91
|
-
const value = new this.
|
|
90
|
+
const value = new this.insertable({
|
|
92
91
|
refName: this.refName,
|
|
93
92
|
context: this.context,
|
|
94
93
|
settings: this.settings,
|
|
@@ -101,7 +100,7 @@ class ModelDriver {
|
|
|
101
100
|
typeof value.tsType === 'string'
|
|
102
101
|
? value.tsType
|
|
103
102
|
: undefined;
|
|
104
|
-
const identifier = (0, ts_pattern_1.match)(this.
|
|
103
|
+
const identifier = (0, ts_pattern_1.match)(this.insertable.entityType.type)
|
|
105
104
|
.with('value', () => Identifier_js_1.Identifier.createValue({ name, tsType }))
|
|
106
105
|
.with('type', () => Identifier_js_1.Identifier.createType(name))
|
|
107
106
|
.exhaustive();
|
|
@@ -116,18 +115,31 @@ class ModelDriver {
|
|
|
116
115
|
});
|
|
117
116
|
return definition;
|
|
118
117
|
}
|
|
119
|
-
buildModelSettings({ refName,
|
|
118
|
+
buildModelSettings({ refName, insertable }) {
|
|
120
119
|
const baseSettings = this.context.getModelBaseSettings({
|
|
121
|
-
generatorId:
|
|
120
|
+
generatorId: insertable.id,
|
|
122
121
|
refName
|
|
123
122
|
});
|
|
124
|
-
const e =
|
|
123
|
+
const e = insertable.toExportPath({ refName, baseSettings });
|
|
125
124
|
return new ContentSettings_js_1.ContentSettings({
|
|
126
|
-
name:
|
|
127
|
-
selected:
|
|
125
|
+
name: insertable.toName({ refName, baseSettings }),
|
|
126
|
+
selected: insertable.isSelected({ refName, baseSettings }),
|
|
128
127
|
exportPath: e,
|
|
129
128
|
importFrom: baseSettings.importFrom ?? e
|
|
130
129
|
});
|
|
131
130
|
}
|
|
131
|
+
affirmDefinition(definition) {
|
|
132
|
+
if (!definition) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
const currentKey = (0, GeneratorKeys_js_1.toModelGeneratorKey)({
|
|
136
|
+
generatorId: this.insertable.id,
|
|
137
|
+
refName: this.refName
|
|
138
|
+
});
|
|
139
|
+
if (currentKey === definition.generatorKey) {
|
|
140
|
+
throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
141
|
+
}
|
|
142
|
+
return definition.value instanceof this.insertable;
|
|
143
|
+
}
|
|
132
144
|
}
|
|
133
145
|
exports.ModelDriver = ModelDriver;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { CoreContext } from '../context/CoreContext.js';
|
|
2
|
-
import type { OasSchema } from '../oas/schema/Schema.js';
|
|
3
2
|
import type { EntityType } from './EntityType.js';
|
|
4
|
-
import type { OasRef } from '../oas/ref/Ref.js';
|
|
5
|
-
import type { CustomValue } from '../types/CustomValue.js';
|
|
6
|
-
import type { OasVoid } from '../oas/void/Void.js';
|
|
7
3
|
import type { ContentSettings } from './ContentSettings.js';
|
|
8
4
|
import type { BaseSettings } from '../types/Settings.js';
|
|
9
5
|
import type { RefName } from '../types/RefName.js';
|
|
@@ -28,7 +24,7 @@ export type ModelGenerator = {
|
|
|
28
24
|
type: 'model';
|
|
29
25
|
pinnable?: boolean;
|
|
30
26
|
};
|
|
31
|
-
export type
|
|
27
|
+
export type ModelInsertable<V> = {
|
|
32
28
|
prototype: V;
|
|
33
29
|
} & {
|
|
34
30
|
new (args: {
|
|
@@ -43,12 +39,4 @@ export type ModelCreator<V> = {
|
|
|
43
39
|
toExportPath: ({ refName, baseSettings }: ToModelExportPathArgs) => string;
|
|
44
40
|
isSelected: ({ refName, baseSettings }: IsModelSelectedArgs) => boolean;
|
|
45
41
|
} & Function;
|
|
46
|
-
|
|
47
|
-
context: CoreContext;
|
|
48
|
-
destinationPath: string;
|
|
49
|
-
schema: OasSchema | OasRef<'schema'> | OasVoid | CustomValue;
|
|
50
|
-
};
|
|
51
|
-
export type TypeSystemCreator<V> = {
|
|
52
|
-
create: (args: TypeSystemCreatorFnArgs) => V;
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=ModelCreator.d.ts.map
|
|
42
|
+
//# sourceMappingURL=ModelInsertable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../src/dsl/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,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AAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,KAAK,MAAM,CAAA;IAC1E,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;CAExE,GAAG,QAAQ,CAAA"}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
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,
|
|
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;
|
|
26
25
|
private apply;
|
|
27
26
|
private getDefinition;
|
|
28
27
|
private buildOperationSettings;
|
|
28
|
+
private affirmDefinition;
|
|
29
29
|
}
|
|
30
30
|
export {};
|
|
31
31
|
//# sourceMappingURL=OperationDriver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
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"}
|
|
@@ -5,17 +5,17 @@ const ContentSettings_js_1 = require("./ContentSettings.js");
|
|
|
5
5
|
const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
6
6
|
const Definition_js_1 = require("./Definition.js");
|
|
7
7
|
const Identifier_js_1 = require("./Identifier.js");
|
|
8
|
-
const verifyType_js_1 = require("../helpers/verifyType.js");
|
|
9
8
|
const ts_pattern_1 = require("ts-pattern");
|
|
9
|
+
const GeneratorKeys_js_1 = require("../types/GeneratorKeys.js");
|
|
10
10
|
class OperationDriver {
|
|
11
|
-
constructor({ context,
|
|
11
|
+
constructor({ context, insertable, operation, generation, destinationPath }) {
|
|
12
12
|
Object.defineProperty(this, "context", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
15
15
|
writable: true,
|
|
16
16
|
value: void 0
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(this, "
|
|
18
|
+
Object.defineProperty(this, "insertable", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
configurable: true,
|
|
21
21
|
writable: true,
|
|
@@ -46,21 +46,21 @@ class OperationDriver {
|
|
|
46
46
|
value: void 0
|
|
47
47
|
});
|
|
48
48
|
this.context = context;
|
|
49
|
-
this.
|
|
49
|
+
this.insertable = insertable;
|
|
50
50
|
this.operation = operation;
|
|
51
51
|
this.destinationPath = destinationPath;
|
|
52
52
|
this.settings = this.buildOperationSettings({
|
|
53
53
|
operation,
|
|
54
|
-
|
|
54
|
+
insertable
|
|
55
55
|
});
|
|
56
56
|
this.definition = this.apply({
|
|
57
|
-
|
|
57
|
+
generation,
|
|
58
58
|
destinationPath
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
get value() {
|
|
62
62
|
if (!this.definition) {
|
|
63
|
-
throw new Error(`${this.
|
|
63
|
+
throw new Error(`${this.insertable.id} ${this.operation.path} ${this.operation.method}: definition is undefined`);
|
|
64
64
|
}
|
|
65
65
|
return this.definition.value;
|
|
66
66
|
}
|
|
@@ -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 &&
|
|
@@ -86,13 +86,11 @@ class OperationDriver {
|
|
|
86
86
|
return definition;
|
|
87
87
|
}
|
|
88
88
|
getDefinition({ name, exportPath }) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
(0, verifyType_js_1.verifyType)(existing.value, this.creator);
|
|
93
|
-
return existing;
|
|
89
|
+
const cachedDefinition = this.context.findDefinition({ name, exportPath });
|
|
90
|
+
if (this.affirmDefinition(cachedDefinition)) {
|
|
91
|
+
return cachedDefinition;
|
|
94
92
|
}
|
|
95
|
-
const value = new this.
|
|
93
|
+
const value = new this.insertable({
|
|
96
94
|
context: this.context,
|
|
97
95
|
operation: this.operation,
|
|
98
96
|
settings: this.settings
|
|
@@ -101,7 +99,7 @@ class OperationDriver {
|
|
|
101
99
|
const tsType = 'tsType' in value && typeof value.tsType === 'string'
|
|
102
100
|
? value.tsType
|
|
103
101
|
: undefined;
|
|
104
|
-
const identifier = (0, ts_pattern_1.match)(this.
|
|
102
|
+
const identifier = (0, ts_pattern_1.match)(this.insertable.entityType.type)
|
|
105
103
|
.with('value', () => Identifier_js_1.Identifier.createValue({ name, tsType }))
|
|
106
104
|
.with('type', () => Identifier_js_1.Identifier.createType(name))
|
|
107
105
|
.exhaustive();
|
|
@@ -116,19 +114,32 @@ class OperationDriver {
|
|
|
116
114
|
});
|
|
117
115
|
return definition;
|
|
118
116
|
}
|
|
119
|
-
buildOperationSettings({ operation,
|
|
117
|
+
buildOperationSettings({ operation, insertable }) {
|
|
120
118
|
const baseSettings = this.context.getOperationBaseSettings({
|
|
121
|
-
generatorId:
|
|
119
|
+
generatorId: insertable.id,
|
|
122
120
|
path: operation.path,
|
|
123
121
|
method: operation.method
|
|
124
122
|
});
|
|
125
|
-
const e =
|
|
123
|
+
const e = insertable.toExportPath({ operation, baseSettings });
|
|
126
124
|
return new ContentSettings_js_1.ContentSettings({
|
|
127
|
-
name:
|
|
128
|
-
selected:
|
|
125
|
+
name: insertable.toName({ operation, baseSettings }),
|
|
126
|
+
selected: insertable.isSelected({ operation, baseSettings }),
|
|
129
127
|
exportPath: e,
|
|
130
128
|
importFrom: baseSettings.importFrom ?? e
|
|
131
129
|
});
|
|
132
130
|
}
|
|
131
|
+
affirmDefinition(definition) {
|
|
132
|
+
if (!definition) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
const currentKey = (0, GeneratorKeys_js_1.toOperationGeneratorKey)({
|
|
136
|
+
generatorId: this.insertable.id,
|
|
137
|
+
operation: this.operation
|
|
138
|
+
});
|
|
139
|
+
if (currentKey === definition.generatorKey) {
|
|
140
|
+
throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
141
|
+
}
|
|
142
|
+
return definition.value instanceof this.insertable;
|
|
143
|
+
}
|
|
133
144
|
}
|
|
134
145
|
exports.OperationDriver = OperationDriver;
|
|
@@ -30,7 +30,7 @@ export type OperationGenerator = {
|
|
|
30
30
|
pinnable?: boolean;
|
|
31
31
|
isSupported?: (operation: OasOperation) => boolean;
|
|
32
32
|
};
|
|
33
|
-
export type
|
|
33
|
+
export type OperationInsertable<V> = {
|
|
34
34
|
prototype: V;
|
|
35
35
|
} & {
|
|
36
36
|
id: string;
|
|
@@ -41,4 +41,4 @@ export type OperationCreator<V> = {
|
|
|
41
41
|
isSelected: ({ operation, baseSettings }: IsOperationSelectedArgs) => boolean;
|
|
42
42
|
} & Function;
|
|
43
43
|
export {};
|
|
44
|
-
//# sourceMappingURL=
|
|
44
|
+
//# sourceMappingURL=OperationInsertable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationInsertable.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,WAAW,CAAA;IACpB,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,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,YAAY,CAAA;IACvB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,YAAY,CAAA;IACvB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,IAAI,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,OAAO,EAAE,WAAW,GAAG,sBAAsB,CAAA;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CACnD,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,GAAG;IACtD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,IAAI,EAAE,qBAAqB,GAAG,CAAC,CAAA;IACpC,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,MAAM,CAAA;IACpE,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;CAE9E,GAAG,QAAQ,CAAA"}
|
package/script/dsl/base.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CoreContext } from '../context/CoreContext.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OperationInsertable } from './OperationInsertable.js';
|
|
3
3
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
4
4
|
import type { ContentSettings } from './ContentSettings.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ModelInsertable } from './ModelInsertable.js';
|
|
6
6
|
import type { RegisterArgs } from '../context/GenerateContext.js';
|
|
7
7
|
import type { GeneratedValue } from '../types/GeneratedValue.js';
|
|
8
8
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
@@ -16,17 +16,17 @@ export type OperationBaseArgs = {
|
|
|
16
16
|
operation: OasOperation;
|
|
17
17
|
};
|
|
18
18
|
type TransformArgs<V extends GeneratedValue> = {
|
|
19
|
-
|
|
19
|
+
insertable: OperationInsertable<V>;
|
|
20
20
|
operation: OasOperation;
|
|
21
21
|
} | {
|
|
22
|
-
|
|
22
|
+
insertable: ModelInsertable<V>;
|
|
23
23
|
refName: RefName;
|
|
24
24
|
};
|
|
25
25
|
export declare class OperationBase extends ValueBase {
|
|
26
26
|
settings: ContentSettings;
|
|
27
27
|
operation: OasOperation;
|
|
28
28
|
constructor({ context, generatorKey, settings, operation }: OperationBaseArgs);
|
|
29
|
-
|
|
29
|
+
insert<V extends GeneratedValue>(args: TransformArgs<V>): {
|
|
30
30
|
settings: ContentSettings;
|
|
31
31
|
definition: Definition<V>;
|
|
32
32
|
};
|
package/script/dsl/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/dsl/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/dsl/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EA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,EAAE,eAAe,CAAA;IACzB,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,qBAAa,SAAU,SAAQ,SAAS;IACtC,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;gBACJ,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,aAAa;IAOvE,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC;IAQ1D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC;CAMrC"}
|
package/script/dsl/base.js
CHANGED
|
@@ -24,8 +24,8 @@ class OperationBase extends ValueBase_js_1.ValueBase {
|
|
|
24
24
|
this.operation = operation;
|
|
25
25
|
this.settings = settings;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
const { settings, definition } = this.context.
|
|
27
|
+
insert(args) {
|
|
28
|
+
const { settings, definition } = this.context.insert({
|
|
29
29
|
...args,
|
|
30
30
|
generation: 'force',
|
|
31
31
|
destinationPath: this.settings.exportPath
|
|
@@ -60,7 +60,7 @@ class ModelBase extends ValueBase_js_1.ValueBase {
|
|
|
60
60
|
this.settings = settings;
|
|
61
61
|
}
|
|
62
62
|
transform(args) {
|
|
63
|
-
this.context.
|
|
63
|
+
this.context.insert({
|
|
64
64
|
...args,
|
|
65
65
|
generation: 'force',
|
|
66
66
|
destinationPath: this.settings.exportPath
|
|
@@ -3,8 +3,8 @@ import type { OasOperation } from '../oas/operation/Operation.js';
|
|
|
3
3
|
import type { ContentSettings } from './ContentSettings.js';
|
|
4
4
|
import type { RefName } from '../types/RefName.js';
|
|
5
5
|
import { EntityType } from './EntityType.js';
|
|
6
|
-
import type { IsModelSelectedArgs, ToModelExportPathArgs, ToModelNameArgs } from './
|
|
7
|
-
import type { IsOperationSelectedArgs, ToOperationExportPathArgs, ToOperationNameArgs } from './
|
|
6
|
+
import type { IsModelSelectedArgs, ToModelExportPathArgs, ToModelNameArgs } from './ModelInsertable.js';
|
|
7
|
+
import type { IsOperationSelectedArgs, ToOperationExportPathArgs, ToOperationNameArgs } from './OperationInsertable.js';
|
|
8
8
|
export type GeneratorConfigConstructor = {
|
|
9
9
|
context: CoreContext;
|
|
10
10
|
};
|
|
@@ -18,20 +18,20 @@ export type OperationConfig = {
|
|
|
18
18
|
toExportPath({ operation, baseSettings }: ToOperationExportPathArgs): string;
|
|
19
19
|
isSelected({ operation, baseSettings }: IsOperationSelectedArgs): boolean;
|
|
20
20
|
};
|
|
21
|
-
export type
|
|
21
|
+
export type OperationInsertableArgs = {
|
|
22
22
|
context: CoreContext;
|
|
23
23
|
settings: ContentSettings;
|
|
24
24
|
operation: OasOperation;
|
|
25
25
|
};
|
|
26
|
-
export declare const
|
|
27
|
-
new (args:
|
|
26
|
+
export declare const toOperationInsertable: (config: OperationConfig) => {
|
|
27
|
+
new (args: OperationInsertableArgs): {
|
|
28
28
|
settings: ContentSettings;
|
|
29
29
|
operation: OasOperation;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
insert<V extends import("../mod.js").GeneratedValue>(args: {
|
|
31
|
+
insertable: import("./OperationInsertable.js").OperationInsertable<V>;
|
|
32
32
|
operation: OasOperation;
|
|
33
33
|
} | {
|
|
34
|
-
|
|
34
|
+
insertable: import("./ModelInsertable.js").ModelInsertable<V>;
|
|
35
35
|
refName: RefName;
|
|
36
36
|
}): {
|
|
37
37
|
settings: ContentSettings;
|
|
@@ -56,20 +56,20 @@ type ModelConfig = {
|
|
|
56
56
|
toExportPath({ refName, baseSettings }: ToModelExportPathArgs): string;
|
|
57
57
|
isSelected({ refName, baseSettings }: IsModelSelectedArgs): boolean;
|
|
58
58
|
};
|
|
59
|
-
export type
|
|
59
|
+
export type ModelInsertableArgs = {
|
|
60
60
|
context: CoreContext;
|
|
61
61
|
settings: ContentSettings;
|
|
62
62
|
refName: RefName;
|
|
63
63
|
};
|
|
64
|
-
export declare const
|
|
65
|
-
new (args:
|
|
64
|
+
export declare const toModelInsertable: (config: ModelConfig) => {
|
|
65
|
+
new (args: ModelInsertableArgs): {
|
|
66
66
|
settings: ContentSettings;
|
|
67
67
|
refName: RefName;
|
|
68
68
|
transform<V extends import("../mod.js").GeneratedValue>(args: {
|
|
69
|
-
|
|
69
|
+
insertable: import("./OperationInsertable.js").OperationInsertable<V>;
|
|
70
70
|
operation: OasOperation;
|
|
71
71
|
} | {
|
|
72
|
-
|
|
72
|
+
insertable: import("./ModelInsertable.js").ModelInsertable<V>;
|
|
73
73
|
refName: RefName;
|
|
74
74
|
}): void;
|
|
75
75
|
register(args: Partial<import("../context/GenerateContext.js").RegisterArgs>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAK3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAK3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAA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AAE,YAAY,EAAE,EAAE,eAAe,GAAG,MAAM,CAAA;IAC1D,YAAY,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,GAAG,MAAM,CAAA;IACtE,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAA;CACpE,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,iBAAiB,WAAY,WAAW;eAU/B,mBAAmB;;;;;;;;;;;;;;;;;;wCArBL,eAAe,KAAG,MAAM;8CAClB,qBAAqB,KAAG,MAAM;4CAChC,mBAAmB,KAAG,OAAO;CA6BpE,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,eAAe,WAClB,eAAe,GAAG;IAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAA;CAAE;sBAQ9B,0BAA0B;iBAD1C,WAAW;;;;8BAXI,YAAY,KAAK,OAAO;;CAgBnD,CAAA"}
|
package/script/dsl/withConfig.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toGeneratorBase = exports.
|
|
3
|
+
exports.toGeneratorBase = exports.toModelInsertable = exports.toOperationInsertable = void 0;
|
|
4
4
|
const GeneratorKeys_js_1 = require("../types/GeneratorKeys.js");
|
|
5
5
|
const EntityType_js_1 = require("./EntityType.js");
|
|
6
6
|
const base_js_1 = require("./base.js");
|
|
7
|
-
const
|
|
7
|
+
const toOperationInsertable = (config) => {
|
|
8
8
|
var _a;
|
|
9
9
|
return _a = class extends base_js_1.OperationBase {
|
|
10
10
|
constructor(args) {
|
|
@@ -49,8 +49,8 @@ const toOperationCreatorBase = (config) => {
|
|
|
49
49
|
}),
|
|
50
50
|
_a;
|
|
51
51
|
};
|
|
52
|
-
exports.
|
|
53
|
-
const
|
|
52
|
+
exports.toOperationInsertable = toOperationInsertable;
|
|
53
|
+
const toModelInsertable = (config) => {
|
|
54
54
|
var _a;
|
|
55
55
|
return _a = class extends base_js_1.ModelBase {
|
|
56
56
|
constructor(args) {
|
|
@@ -101,7 +101,7 @@ const toModelCreatorBase = (config) => {
|
|
|
101
101
|
}),
|
|
102
102
|
_a;
|
|
103
103
|
};
|
|
104
|
-
exports.
|
|
104
|
+
exports.toModelInsertable = toModelInsertable;
|
|
105
105
|
const toGeneratorBase = (config) => {
|
|
106
106
|
var _a;
|
|
107
107
|
return _a = class {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ClientSettings } from '../types/Settings.js';
|
|
2
2
|
import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
|
-
import type { OperationGenerator } from '../dsl/
|
|
5
|
-
import type { ModelGenerator } from '../dsl/
|
|
4
|
+
import type { OperationGenerator } from '../dsl/OperationInsertable.js';
|
|
5
|
+
import type { ModelGenerator } from '../dsl/ModelInsertable.js';
|
|
6
6
|
type GenerateArgs = {
|
|
7
7
|
schema: string;
|
|
8
8
|
settings?: ClientSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAK/D,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,CAAC,CAAA;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,QAAQ,6DAMlB,YAAY,4DAmDd,CAAA;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,2BAMzC,CAAA"}
|
package/script/mod.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export * from './dsl/EntityType.js';
|
|
|
12
12
|
export * from './dsl/GeneratedValueList.js';
|
|
13
13
|
export * from './dsl/Identifier.js';
|
|
14
14
|
export * from './dsl/Import.js';
|
|
15
|
-
export * from './dsl/
|
|
15
|
+
export * from './dsl/ModelInsertable.js';
|
|
16
16
|
export * from './dsl/ModelDriver.js';
|
|
17
|
-
export * from './dsl/
|
|
17
|
+
export * from './dsl/OperationInsertable.js';
|
|
18
18
|
export * from './dsl/OperationDriver.js';
|
|
19
19
|
export * from './dsl/Stringable.js';
|
|
20
20
|
export * from './dsl/ValueBase.js';
|
|
@@ -24,7 +24,6 @@ export * from './helpers/logStatus.js';
|
|
|
24
24
|
export * from './helpers/naming.js';
|
|
25
25
|
export * from './helpers/refFns.js';
|
|
26
26
|
export * from './helpers/strings.js';
|
|
27
|
-
export * from './helpers/verifyType.js';
|
|
28
27
|
export * from './oas/discriminator/Discriminator.js';
|
|
29
28
|
export * from './oas/document/Document.js';
|
|
30
29
|
export * from './oas/integer/Integer.js';
|
|
@@ -55,7 +54,6 @@ export * from './typescript/identifiers.js';
|
|
|
55
54
|
export * from './typescript/keyValues.js';
|
|
56
55
|
export * from './typescript/PathParams.js';
|
|
57
56
|
export * from './typescript/ReactRouterPathParams.js';
|
|
58
|
-
export * from './typescript/toOperationResponse.js';
|
|
59
57
|
export * from './typescript/toPathTemplate.js';
|
|
60
58
|
export * from './typescript/withDescription.js';
|
|
61
59
|
//# sourceMappingURL=mod.d.ts.map
|
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,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,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,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7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,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uCAAuC,CAAA;AACrD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
|
package/script/mod.js
CHANGED
|
@@ -28,9 +28,9 @@ __exportStar(require("./dsl/EntityType.js"), exports);
|
|
|
28
28
|
__exportStar(require("./dsl/GeneratedValueList.js"), exports);
|
|
29
29
|
__exportStar(require("./dsl/Identifier.js"), exports);
|
|
30
30
|
__exportStar(require("./dsl/Import.js"), exports);
|
|
31
|
-
__exportStar(require("./dsl/
|
|
31
|
+
__exportStar(require("./dsl/ModelInsertable.js"), exports);
|
|
32
32
|
__exportStar(require("./dsl/ModelDriver.js"), exports);
|
|
33
|
-
__exportStar(require("./dsl/
|
|
33
|
+
__exportStar(require("./dsl/OperationInsertable.js"), exports);
|
|
34
34
|
__exportStar(require("./dsl/OperationDriver.js"), exports);
|
|
35
35
|
__exportStar(require("./dsl/Stringable.js"), exports);
|
|
36
36
|
__exportStar(require("./dsl/ValueBase.js"), exports);
|
|
@@ -40,7 +40,6 @@ __exportStar(require("./helpers/logStatus.js"), exports);
|
|
|
40
40
|
__exportStar(require("./helpers/naming.js"), exports);
|
|
41
41
|
__exportStar(require("./helpers/refFns.js"), exports);
|
|
42
42
|
__exportStar(require("./helpers/strings.js"), exports);
|
|
43
|
-
__exportStar(require("./helpers/verifyType.js"), exports);
|
|
44
43
|
__exportStar(require("./oas/discriminator/Discriminator.js"), exports);
|
|
45
44
|
__exportStar(require("./oas/document/Document.js"), exports);
|
|
46
45
|
__exportStar(require("./oas/integer/Integer.js"), exports);
|
|
@@ -71,6 +70,5 @@ __exportStar(require("./typescript/identifiers.js"), exports);
|
|
|
71
70
|
__exportStar(require("./typescript/keyValues.js"), exports);
|
|
72
71
|
__exportStar(require("./typescript/PathParams.js"), exports);
|
|
73
72
|
__exportStar(require("./typescript/ReactRouterPathParams.js"), exports);
|
|
74
|
-
__exportStar(require("./typescript/toOperationResponse.js"), exports);
|
|
75
73
|
__exportStar(require("./typescript/toPathTemplate.js"), exports);
|
|
76
74
|
__exportStar(require("./typescript/withDescription.js"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import type { OperationGenerator } from '../dsl/
|
|
3
|
-
import type { ModelGenerator } from '../dsl/
|
|
2
|
+
import type { OperationGenerator } from '../dsl/OperationInsertable.js';
|
|
3
|
+
import type { ModelGenerator } from '../dsl/ModelInsertable.js';
|
|
4
4
|
export declare const createServer: (generators: (OperationGenerator | ModelGenerator)[]) => Hono;
|
|
5
5
|
//# sourceMappingURL=createServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../../src/server/createServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAK3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../../src/server/createServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAK3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAmB/D,eAAO,MAAM,YAAY,eACX,CAAC,kBAAkB,GAAG,cAAc,CAAC,EAAE,KAClD,IA8FF,CAAA"}
|