@skmtc/core 0.0.307 → 0.0.309
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 +3 -27
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +20 -201
- package/esm/context/GenerateContext.d.ts +11 -14
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +48 -64
- package/esm/context/RenderContext.d.ts +5 -11
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +7 -38
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/ResultsHandler.js +0 -1
- package/esm/context/types.d.ts +0 -5
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/Definition.d.ts +2 -2
- package/esm/dsl/Definition.d.ts.map +1 -1
- package/esm/dsl/ModelDriver.d.ts +3 -3
- package/esm/dsl/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/ModelInsertable.d.ts +3 -3
- package/esm/dsl/ModelInsertable.d.ts.map +1 -1
- package/esm/dsl/OperationDriver.d.ts +3 -3
- package/esm/dsl/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/OperationInsertable.d.ts +3 -3
- package/esm/dsl/OperationInsertable.d.ts.map +1 -1
- package/esm/dsl/ValueBase.d.ts +3 -3
- package/esm/dsl/ValueBase.d.ts.map +1 -1
- package/esm/dsl/ValueBase.js +1 -3
- package/esm/dsl/base.d.ts +3 -4
- package/esm/dsl/base.d.ts.map +1 -1
- package/esm/dsl/withConfig.d.ts +7 -7
- package/esm/dsl/withConfig.d.ts.map +1 -1
- package/esm/generate/generate.d.ts +0 -1
- package/esm/generate/generate.d.ts.map +1 -1
- package/esm/generate/generate.js +6 -6
- package/esm/mod.d.ts +1 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -0
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +1 -0
- package/esm/server/createServer.d.ts.map +1 -1
- package/esm/server/createServer.js +3 -7
- package/esm/types/CustomValue.d.ts +2 -2
- package/esm/types/CustomValue.d.ts.map +1 -1
- package/esm/typescript/PathParams.d.ts +3 -3
- package/esm/typescript/PathParams.d.ts.map +1 -1
- package/esm/typescript/ReactRouterPathParams.d.ts +2 -2
- package/esm/typescript/ReactRouterPathParams.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +3 -27
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +20 -201
- package/script/context/GenerateContext.d.ts +11 -14
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +48 -64
- package/script/context/RenderContext.d.ts +5 -11
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +7 -38
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/ResultsHandler.js +0 -1
- package/script/context/types.d.ts +0 -5
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/Definition.d.ts +2 -2
- package/script/dsl/Definition.d.ts.map +1 -1
- package/script/dsl/ModelDriver.d.ts +3 -3
- package/script/dsl/ModelDriver.d.ts.map +1 -1
- package/script/dsl/ModelInsertable.d.ts +3 -3
- package/script/dsl/ModelInsertable.d.ts.map +1 -1
- package/script/dsl/OperationDriver.d.ts +3 -3
- package/script/dsl/OperationDriver.d.ts.map +1 -1
- package/script/dsl/OperationInsertable.d.ts +3 -3
- package/script/dsl/OperationInsertable.d.ts.map +1 -1
- package/script/dsl/ValueBase.d.ts +3 -3
- package/script/dsl/ValueBase.d.ts.map +1 -1
- package/script/dsl/ValueBase.js +1 -3
- package/script/dsl/base.d.ts +3 -4
- package/script/dsl/base.d.ts.map +1 -1
- package/script/dsl/withConfig.d.ts +7 -7
- package/script/dsl/withConfig.d.ts.map +1 -1
- package/script/generate/generate.d.ts +0 -1
- package/script/generate/generate.d.ts.map +1 -1
- package/script/generate/generate.js +6 -6
- package/script/mod.d.ts +1 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +1 -0
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +1 -0
- package/script/server/createServer.d.ts.map +1 -1
- package/script/server/createServer.js +3 -7
- package/script/types/CustomValue.d.ts +2 -2
- package/script/types/CustomValue.d.ts.map +1 -1
- package/script/typescript/PathParams.d.ts +3 -3
- package/script/typescript/PathParams.d.ts.map +1 -1
- package/script/typescript/ReactRouterPathParams.d.ts +2 -2
- package/script/typescript/ReactRouterPathParams.d.ts.map +1 -1
|
@@ -9,79 +9,70 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _GenerateContext_instances, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_generateModel, _GenerateContext_generateOperation;
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_generateModel, _GenerateContext_generateOperation;
|
|
13
13
|
import { join, normalize } from '../deps/jsr.io/@std/path/1.0.0/mod.js';
|
|
14
14
|
import { Import } from '../dsl/Import.js';
|
|
15
|
-
import { toOperationGeneratorKey } from '../types/GeneratorKeys.js';
|
|
16
15
|
import { OperationDriver } from '../dsl/OperationDriver.js';
|
|
17
16
|
import { ModelDriver } from '../dsl/ModelDriver.js';
|
|
18
17
|
import { StackTrail } from './StackTrail.js';
|
|
19
18
|
import * as Sentry from '@sentry/deno';
|
|
20
19
|
export class GenerateContext {
|
|
21
|
-
constructor({ schemaModel,
|
|
20
|
+
constructor({ schemaModel, settings, logger, callback }) {
|
|
22
21
|
_GenerateContext_instances.add(this);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true,
|
|
27
|
-
value: void 0
|
|
28
|
-
});
|
|
29
|
-
Object.defineProperty(this, "renderDependencies", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
configurable: true,
|
|
32
|
-
writable: true,
|
|
33
|
-
value: void 0
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "packageDependencies", {
|
|
22
|
+
_GenerateContext_files.set(this, void 0);
|
|
23
|
+
Object.defineProperty(this, "schemaModel", {
|
|
36
24
|
enumerable: true,
|
|
37
25
|
configurable: true,
|
|
38
26
|
writable: true,
|
|
39
27
|
value: void 0
|
|
40
28
|
});
|
|
41
|
-
Object.defineProperty(this, "
|
|
29
|
+
Object.defineProperty(this, "settings", {
|
|
42
30
|
enumerable: true,
|
|
43
31
|
configurable: true,
|
|
44
32
|
writable: true,
|
|
45
33
|
value: void 0
|
|
46
34
|
});
|
|
47
|
-
|
|
35
|
+
_GenerateContext_stackTrail.set(this, void 0);
|
|
36
|
+
Object.defineProperty(this, "logger", {
|
|
48
37
|
enumerable: true,
|
|
49
38
|
configurable: true,
|
|
50
39
|
writable: true,
|
|
51
40
|
value: void 0
|
|
52
41
|
});
|
|
53
|
-
Object.defineProperty(this, "
|
|
42
|
+
Object.defineProperty(this, "callback", {
|
|
54
43
|
enumerable: true,
|
|
55
44
|
configurable: true,
|
|
56
45
|
writable: true,
|
|
57
46
|
value: void 0
|
|
58
47
|
});
|
|
59
|
-
|
|
48
|
+
this.logger = logger;
|
|
60
49
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, new StackTrail(), "f");
|
|
61
|
-
this
|
|
62
|
-
this.files = new Map();
|
|
63
|
-
this.renderDependencies = new Map();
|
|
64
|
-
this.packageDependencies = new Map();
|
|
50
|
+
__classPrivateFieldSet(this, _GenerateContext_files, new Map(), "f");
|
|
65
51
|
this.schemaModel = schemaModel;
|
|
66
52
|
this.settings = settings;
|
|
53
|
+
this.callback = callback;
|
|
67
54
|
}
|
|
68
|
-
generate(
|
|
69
|
-
Sentry.startSpan({ name: 'Generate operations' }, () => Object.values(
|
|
55
|
+
generate(generatorsMap) {
|
|
56
|
+
Sentry.startSpan({ name: 'Generate operations' }, () => Object.values(generatorsMap)
|
|
70
57
|
.filter(generator => generator.type === 'operation')
|
|
71
58
|
.forEach(generator => {
|
|
72
59
|
this.appendStackTrailChunk(generator.id);
|
|
73
|
-
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, {
|
|
60
|
+
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, {
|
|
61
|
+
schemaModel: this.schemaModel,
|
|
62
|
+
generator
|
|
63
|
+
});
|
|
74
64
|
this.removeStackTrailChunk(generator.id);
|
|
75
65
|
}));
|
|
76
66
|
Sentry.startSpan({ name: 'Generate models' }, () => {
|
|
77
|
-
Object.values(
|
|
67
|
+
Object.values(generatorsMap)
|
|
78
68
|
.filter(generator => generator.type === 'model')
|
|
79
69
|
.forEach(generator => {
|
|
80
70
|
this.appendStackTrailChunk(generator.id);
|
|
81
|
-
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, {
|
|
71
|
+
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, { schemaModel: this.schemaModel, generator });
|
|
82
72
|
this.removeStackTrailChunk(generator.id);
|
|
83
73
|
});
|
|
84
74
|
});
|
|
75
|
+
return __classPrivateFieldGet(this, _GenerateContext_files, "f");
|
|
85
76
|
}
|
|
86
77
|
appendStackTrailChunk(chunk) {
|
|
87
78
|
__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f").append(chunk);
|
|
@@ -89,12 +80,18 @@ export class GenerateContext {
|
|
|
89
80
|
removeStackTrailChunk(chunk) {
|
|
90
81
|
__classPrivateFieldGet(this, _GenerateContext_stackTrail, "f").remove(chunk);
|
|
91
82
|
}
|
|
83
|
+
// captureCurrentResult(result: SuccessWarningError): void {
|
|
84
|
+
// const stackTrail = this.#stackTrail.toString()
|
|
85
|
+
// if (applyResult({ current: this.#results[stackTrail], incoming: result })) {
|
|
86
|
+
// this.#results[stackTrail] = result
|
|
87
|
+
// }
|
|
88
|
+
// }
|
|
92
89
|
get stackTrail() {
|
|
93
90
|
return __classPrivateFieldGet(this, _GenerateContext_stackTrail, "f").toString();
|
|
94
91
|
}
|
|
95
92
|
getFile(filePath, { throwIfNotFound = false } = {}) {
|
|
96
93
|
const normalisedPath = normalize(filePath);
|
|
97
|
-
const currentFile = this.
|
|
94
|
+
const currentFile = __classPrivateFieldGet(this, _GenerateContext_files, "f").get(normalisedPath);
|
|
98
95
|
if (!currentFile) {
|
|
99
96
|
if (throwIfNotFound) {
|
|
100
97
|
throw new Error(`File not found: '${normalisedPath}'`);
|
|
@@ -105,7 +102,7 @@ export class GenerateContext {
|
|
|
105
102
|
}
|
|
106
103
|
return currentFile;
|
|
107
104
|
}
|
|
108
|
-
register({ imports = {},
|
|
105
|
+
register({ imports = {}, definitions, destinationPath }) {
|
|
109
106
|
const currentFile = this.getFile(destinationPath);
|
|
110
107
|
Object.entries(imports).forEach(([importModule, importNames]) => {
|
|
111
108
|
const module = currentFile.imports.get(importModule);
|
|
@@ -117,20 +114,17 @@ export class GenerateContext {
|
|
|
117
114
|
currentFile.imports.set(importModule, new Set(importItem.importNames.map(n => `${n}`)));
|
|
118
115
|
}
|
|
119
116
|
});
|
|
120
|
-
Object.entries(packageDependencies).forEach(([module, version]) => {
|
|
121
|
-
this.packageDependencies.set(module, version);
|
|
122
|
-
});
|
|
123
117
|
definitions
|
|
124
118
|
?.filter((definition) => Boolean(definition))
|
|
125
119
|
.forEach(definition => {
|
|
126
120
|
currentFile.definitions.set(`${definition.identifier}`, definition);
|
|
127
121
|
});
|
|
128
122
|
}
|
|
129
|
-
insert({
|
|
123
|
+
insert({ generation, destinationPath, ...rest }) {
|
|
130
124
|
if ('operation' in rest) {
|
|
131
125
|
const { insertable, operation } = rest;
|
|
132
126
|
const { settings, definition } = new OperationDriver({
|
|
133
|
-
context:
|
|
127
|
+
context: this,
|
|
134
128
|
insertable,
|
|
135
129
|
operation,
|
|
136
130
|
generation,
|
|
@@ -141,7 +135,7 @@ export class GenerateContext {
|
|
|
141
135
|
else {
|
|
142
136
|
const { insertable, refName } = rest;
|
|
143
137
|
const { settings, definition } = new ModelDriver({
|
|
144
|
-
context:
|
|
138
|
+
context: this,
|
|
145
139
|
insertable,
|
|
146
140
|
refName,
|
|
147
141
|
generation,
|
|
@@ -183,7 +177,7 @@ export class GenerateContext {
|
|
|
183
177
|
return baseSettings;
|
|
184
178
|
}
|
|
185
179
|
addFile(normalisedPath) {
|
|
186
|
-
if (this.
|
|
180
|
+
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
187
181
|
throw new Error(`File already exists: ${normalisedPath}`);
|
|
188
182
|
}
|
|
189
183
|
const newFile = {
|
|
@@ -191,7 +185,7 @@ export class GenerateContext {
|
|
|
191
185
|
definitions: new Map(),
|
|
192
186
|
generatorKeys: new Set()
|
|
193
187
|
};
|
|
194
|
-
this.
|
|
188
|
+
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
195
189
|
return newFile;
|
|
196
190
|
}
|
|
197
191
|
resolveSchemaRefOnce(refName) {
|
|
@@ -201,23 +195,14 @@ export class GenerateContext {
|
|
|
201
195
|
}
|
|
202
196
|
return schema;
|
|
203
197
|
}
|
|
204
|
-
addRenderDependency({ generatorId, dependencies, operation }) {
|
|
205
|
-
if (!this.renderDependencies.has(generatorId)) {
|
|
206
|
-
this.renderDependencies.set(generatorId, new Set());
|
|
207
|
-
}
|
|
208
|
-
const generatorDependencies = this.renderDependencies.get(generatorId);
|
|
209
|
-
dependencies.forEach(dependencyId => {
|
|
210
|
-
generatorDependencies?.add(toOperationGeneratorKey({ generatorId: dependencyId, operation }));
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
198
|
/** Produce external instance and return its name */
|
|
214
199
|
findDefinition({ name, exportPath }) {
|
|
215
200
|
return this.getFile(exportPath).definitions.get(name);
|
|
216
201
|
}
|
|
217
202
|
}
|
|
218
|
-
_GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({
|
|
219
|
-
const generatorInstance = new generator(
|
|
220
|
-
|
|
203
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ schemaModel, generator }) {
|
|
204
|
+
const generatorInstance = new generator(this);
|
|
205
|
+
schemaModel.operations.forEach(operation => {
|
|
221
206
|
// TODO If we make OasOperation generic, for example by
|
|
222
207
|
// adding a `method` type, we could make isSupported
|
|
223
208
|
// a type guard which could help us narrow down the
|
|
@@ -228,40 +213,39 @@ _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new We
|
|
|
228
213
|
const { path, method } = operation;
|
|
229
214
|
if (generator.isSupported(operation)) {
|
|
230
215
|
this.appendStackTrailChunk([path, method]);
|
|
231
|
-
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_generateOperation).call(this, {
|
|
216
|
+
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_generateOperation).call(this, { operation, generatorInstance });
|
|
232
217
|
this.removeStackTrailChunk([path, method]);
|
|
233
218
|
}
|
|
234
219
|
});
|
|
235
|
-
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator({
|
|
236
|
-
const generatorInstance = new generator(
|
|
237
|
-
const refNames = Object.keys(
|
|
220
|
+
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator({ schemaModel, generator }) {
|
|
221
|
+
const generatorInstance = new generator(this);
|
|
222
|
+
const refNames = Object.keys(schemaModel.components?.schemas ?? {});
|
|
238
223
|
refNames.forEach(rn => {
|
|
239
224
|
this.appendStackTrailChunk(rn);
|
|
240
225
|
__classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_generateModel).call(this, {
|
|
241
|
-
context,
|
|
242
226
|
refName: rn,
|
|
243
227
|
generatorInstance
|
|
244
228
|
});
|
|
245
229
|
this.removeStackTrailChunk(rn);
|
|
246
230
|
});
|
|
247
|
-
}, _GenerateContext_generateModel = function _GenerateContext_generateModel({
|
|
231
|
+
}, _GenerateContext_generateModel = function _GenerateContext_generateModel({ refName, generatorInstance }) {
|
|
248
232
|
try {
|
|
249
233
|
generatorInstance.transformModel(refName);
|
|
250
|
-
|
|
234
|
+
// this.captureCurrentResult('success')
|
|
251
235
|
}
|
|
252
236
|
catch (error) {
|
|
253
|
-
|
|
254
|
-
|
|
237
|
+
this.logger.error(error);
|
|
238
|
+
// this.captureCurrentResult('error')
|
|
255
239
|
Sentry.captureException(error);
|
|
256
240
|
}
|
|
257
|
-
}, _GenerateContext_generateOperation = function _GenerateContext_generateOperation({
|
|
241
|
+
}, _GenerateContext_generateOperation = function _GenerateContext_generateOperation({ operation, generatorInstance }) {
|
|
258
242
|
try {
|
|
259
243
|
generatorInstance.transformOperation(operation);
|
|
260
|
-
|
|
244
|
+
// this.captureCurrentResult('success')
|
|
261
245
|
}
|
|
262
246
|
catch (error) {
|
|
263
|
-
|
|
264
|
-
|
|
247
|
+
this.logger.error(error);
|
|
248
|
+
// this.captureCurrentResult('error')
|
|
265
249
|
Sentry.captureException(error);
|
|
266
250
|
}
|
|
267
251
|
};
|
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
2
|
-
import type { AddGeneratorKeyArgs, FileContents,
|
|
3
|
-
import type { ClientSettings } from '../types/Settings.js';
|
|
2
|
+
import type { AddGeneratorKeyArgs, FileContents, RenderResult } from './types.js';
|
|
4
3
|
import type { Definition } from '../dsl/Definition.js';
|
|
5
4
|
import type { PickArgs } from './GenerateContext.js';
|
|
6
5
|
type ConstructorArgs = {
|
|
7
6
|
files: Map<string, FileContents>;
|
|
8
|
-
packageDependencies: Map<string, string>;
|
|
9
7
|
prettier?: PrettierConfigType;
|
|
10
|
-
|
|
11
|
-
renderDependencies: RenderDependencies;
|
|
8
|
+
basePath: string | undefined;
|
|
12
9
|
pinnableGenerators: string[];
|
|
13
10
|
};
|
|
14
11
|
export declare class RenderContext {
|
|
15
12
|
#private;
|
|
16
13
|
files: Map<string, FileContents>;
|
|
17
|
-
renderDependencies: RenderDependencies;
|
|
18
|
-
packageDependencies: Map<string, string>;
|
|
19
14
|
private prettier?;
|
|
20
|
-
|
|
15
|
+
basePath: string | undefined;
|
|
21
16
|
currentDestinationPath: string | 'PRE_RENDER' | 'POST_RENDER';
|
|
22
17
|
pinnableGenerators: string[];
|
|
23
|
-
constructor({ files,
|
|
18
|
+
constructor({ files, prettier, basePath, pinnableGenerators }: ConstructorArgs);
|
|
24
19
|
appendStackTrailChunk(chunk: string): void;
|
|
25
20
|
removeStackTrailChunk(chunk: string): void;
|
|
26
21
|
get stackTrail(): string;
|
|
27
|
-
|
|
28
|
-
render({ packageJson }: RenderOptions): Omit<RenderResult, 'results'>;
|
|
22
|
+
render(): Omit<RenderResult, 'results'>;
|
|
29
23
|
private collate;
|
|
30
24
|
getFile(filePath: string): FileContents;
|
|
31
25
|
addGeneratorKey({ generatorKey }: AddGeneratorKeyArgs): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAEZ,
|
|
1
|
+
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KA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/@std/path/1.0.0/mod.js';
|
|
|
17
17
|
import { toResolvedArtifactPath } from '../helpers/toResolvedArtifactPath.js';
|
|
18
18
|
import { StackTrail } from './StackTrail.js';
|
|
19
19
|
export class RenderContext {
|
|
20
|
-
constructor({ files,
|
|
20
|
+
constructor({ files, prettier, basePath, pinnableGenerators }) {
|
|
21
21
|
Object.defineProperty(this, "files", {
|
|
22
22
|
enumerable: true,
|
|
23
23
|
configurable: true,
|
|
24
24
|
writable: true,
|
|
25
25
|
value: void 0
|
|
26
26
|
});
|
|
27
|
-
Object.defineProperty(this, "renderDependencies", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: void 0
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(this, "packageDependencies", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: void 0
|
|
38
|
-
});
|
|
39
27
|
Object.defineProperty(this, "prettier", {
|
|
40
28
|
enumerable: true,
|
|
41
29
|
configurable: true,
|
|
42
30
|
writable: true,
|
|
43
31
|
value: void 0
|
|
44
32
|
});
|
|
45
|
-
Object.defineProperty(this, "
|
|
33
|
+
Object.defineProperty(this, "basePath", {
|
|
46
34
|
enumerable: true,
|
|
47
35
|
configurable: true,
|
|
48
36
|
writable: true,
|
|
@@ -63,11 +51,9 @@ export class RenderContext {
|
|
|
63
51
|
_RenderContext_stackTrail.set(this, void 0);
|
|
64
52
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, new StackTrail(), "f");
|
|
65
53
|
this.currentDestinationPath = 'PRE_RENDER';
|
|
66
|
-
this.renderDependencies = renderDependencies;
|
|
67
54
|
this.files = files;
|
|
68
|
-
this.packageDependencies = packageDependencies;
|
|
69
55
|
this.prettier = prettier;
|
|
70
|
-
this.
|
|
56
|
+
this.basePath = basePath;
|
|
71
57
|
this.pinnableGenerators = pinnableGenerators;
|
|
72
58
|
}
|
|
73
59
|
appendStackTrailChunk(chunk) {
|
|
@@ -79,22 +65,11 @@ export class RenderContext {
|
|
|
79
65
|
get stackTrail() {
|
|
80
66
|
return __classPrivateFieldGet(this, _RenderContext_stackTrail, "f").toString();
|
|
81
67
|
}
|
|
82
|
-
|
|
83
|
-
const dependencies = Object.fromEntries(this.packageDependencies.entries());
|
|
84
|
-
const packageJson = JSON.stringify({ dependencies }, null, 2);
|
|
85
|
-
return packageJson;
|
|
86
|
-
}
|
|
87
|
-
render({ packageJson }) {
|
|
68
|
+
render() {
|
|
88
69
|
return Sentry.startSpan({ name: 'Render artifacts' }, () => {
|
|
89
70
|
const result = Sentry.startSpan({ name: 'Collate content' }, () => {
|
|
90
71
|
return this.collate();
|
|
91
72
|
});
|
|
92
|
-
const renderDependenciesEntries = [
|
|
93
|
-
...this.renderDependencies.entries()
|
|
94
|
-
].map(([generatorId, dependencyGeneratorKeys]) => {
|
|
95
|
-
return [generatorId, Array.from(dependencyGeneratorKeys)];
|
|
96
|
-
});
|
|
97
|
-
const renderDependencies = Object.fromEntries(renderDependenciesEntries);
|
|
98
73
|
const pinnable = Sentry.startSpan({ name: 'Generate pinnable' }, () => {
|
|
99
74
|
return generatePinnable({
|
|
100
75
|
pinnableGenerators: this.pinnableGenerators,
|
|
@@ -102,15 +77,9 @@ export class RenderContext {
|
|
|
102
77
|
});
|
|
103
78
|
});
|
|
104
79
|
const rendered = {
|
|
105
|
-
artifacts:
|
|
106
|
-
? {
|
|
107
|
-
...result.artifacts,
|
|
108
|
-
'package.json': this.toPackageJson()
|
|
109
|
-
}
|
|
110
|
-
: result.artifacts,
|
|
80
|
+
artifacts: result.artifacts,
|
|
111
81
|
files: result.files,
|
|
112
|
-
pinnable
|
|
113
|
-
renderDependencies
|
|
82
|
+
pinnable
|
|
114
83
|
};
|
|
115
84
|
return rendered;
|
|
116
85
|
});
|
|
@@ -125,7 +94,7 @@ export class RenderContext {
|
|
|
125
94
|
return renderFile({
|
|
126
95
|
file,
|
|
127
96
|
destinationPath,
|
|
128
|
-
basePath: this.
|
|
97
|
+
basePath: this.basePath,
|
|
129
98
|
prettier: this.prettier
|
|
130
99
|
});
|
|
131
100
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultsHandler.d.ts","sourceRoot":"","sources":["../../src/context/ResultsHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResultsHandler.d.ts","sourceRoot":"","sources":["../../src/context/ResultsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,2CAA2C,CAAA;AACrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAA;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAA;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAA;AACzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAGnD,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D,OAAO,EAAE,WAAW,CAAA;CACrB;AAED,qBAAa,cAAe,SAAQ,WAAW;;IAC7C,OAAO,EAAE,WAAW,CAAA;gBAMR,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB;IAMvD,KAAK;IAML,MAAM,CAAC,SAAS,EAAE,SAAS;IASpC,GAAG,CAAC,GAAG,EAAE,MAAM;IAcf,KAAK;IAMI,OAAO;CAKjB"}
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _ResultsHandler_instances, _ResultsHandler_unloadCallback, _ResultsHandler_resetBuffer;
|
|
7
|
-
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
8
7
|
import { LogLevels } from '../deps/jsr.io/@std/log/0.224.6/levels.js';
|
|
9
8
|
import { BaseHandler } from '../deps/jsr.io/@std/log/0.224.6/base_handler.js';
|
|
10
9
|
import { match } from 'ts-pattern';
|
package/esm/context/types.d.ts
CHANGED
|
@@ -7,10 +7,6 @@ export type FileContents = {
|
|
|
7
7
|
definitions: Map<string, Definition>;
|
|
8
8
|
generatorKeys: Set<GeneratorKey>;
|
|
9
9
|
};
|
|
10
|
-
export type RenderOptions = {
|
|
11
|
-
packageJson?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export type RenderDependencies = Map<string, Set<GeneratorKey>>;
|
|
14
10
|
export type GetFileOptions = {
|
|
15
11
|
throwIfNotFound?: boolean;
|
|
16
12
|
};
|
|
@@ -26,7 +22,6 @@ export type RenderResult = {
|
|
|
26
22
|
artifacts: Record<string, string>;
|
|
27
23
|
files: Record<string, ManifestEntry>;
|
|
28
24
|
pinnable: Partial<Record<GeneratorKey, string>>;
|
|
29
|
-
renderDependencies: Record<string, string[]>;
|
|
30
25
|
results: Record<string, SuccessWarningError>;
|
|
31
26
|
};
|
|
32
27
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/context/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE9E,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IACpC,aAAa,EAAE,GAAG,CAAC,YAAY,CAAC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AAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAC7C,CAAA"}
|
package/esm/dsl/Definition.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
2
2
|
import type { Identifier } from './Identifier.js';
|
|
3
3
|
import { ValueBase } from './ValueBase.js';
|
|
4
4
|
import type { GeneratedValue } from '../types/GeneratedValue.js';
|
|
5
5
|
type ConstructorArgs<V extends GeneratedValue> = {
|
|
6
|
-
context:
|
|
6
|
+
context: GenerateContext;
|
|
7
7
|
value: V;
|
|
8
8
|
identifier: Identifier;
|
|
9
9
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Definition.d.ts","sourceRoot":"","sources":["../../src/dsl/Definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Definition.d.ts","sourceRoot":"","sources":["../../src/dsl/Definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAEhE,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,CAAC,CAAA;IACR,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,UAAU,CACrB,CAAC,SAAS,cAAc,GAAG,cAAc,CACzC,SAAQ,SAAS;IACjB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,KAAK,EAAE,CAAC,CAAA;gBAEI,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;IAQ3E,QAAQ,IAAI,MAAM;CAanB"}
|
package/esm/dsl/ModelDriver.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { ModelInsertable } from './ModelInsertable.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
3
3
|
import { ContentSettings } from './ContentSettings.js';
|
|
4
4
|
import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
|
|
5
5
|
import type { GeneratedValue } from '../types/GeneratedValue.js';
|
|
6
6
|
import type { RefName } from '../types/RefName.js';
|
|
7
7
|
type CreateModelArgs<V extends GeneratedValue, T extends GenerationType> = {
|
|
8
|
-
context:
|
|
8
|
+
context: GenerateContext;
|
|
9
9
|
insertable: ModelInsertable<V>;
|
|
10
10
|
refName: RefName;
|
|
11
11
|
generation?: T;
|
|
12
12
|
destinationPath?: string;
|
|
13
13
|
};
|
|
14
14
|
export declare class ModelDriver<V extends GeneratedValue, T extends GenerationType> {
|
|
15
|
-
context:
|
|
15
|
+
context: GenerateContext;
|
|
16
16
|
insertable: ModelInsertable<V>;
|
|
17
17
|
refName: RefName;
|
|
18
18
|
settings: ContentSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,C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
|
|
2
2
|
import type { EntityType } from './EntityType.js';
|
|
3
3
|
import type { ContentSettings } from './ContentSettings.js';
|
|
4
4
|
import type { BaseSettings } from '../types/Settings.js';
|
|
@@ -19,7 +19,7 @@ export type WithTransformModel = {
|
|
|
19
19
|
transformModel: (refName: RefName) => void;
|
|
20
20
|
};
|
|
21
21
|
export type ModelGenerator = {
|
|
22
|
-
new (context:
|
|
22
|
+
new (context: GenerateContext): WithTransformModel;
|
|
23
23
|
id: string;
|
|
24
24
|
type: 'model';
|
|
25
25
|
pinnable?: boolean;
|
|
@@ -28,7 +28,7 @@ export type ModelInsertable<V> = {
|
|
|
28
28
|
prototype: V;
|
|
29
29
|
} & {
|
|
30
30
|
new (args: {
|
|
31
|
-
context:
|
|
31
|
+
context: GenerateContext;
|
|
32
32
|
refName: RefName;
|
|
33
33
|
settings: ContentSettings;
|
|
34
34
|
destinationPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../src/dsl/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ModelInsertable.d.ts","sourceRoot":"","sources":["../../src/dsl/ModelInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,cAAc,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAAA;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,GAAG;IAClD,KAAK,IAAI,EAAE;QACT,OAAO,EAAE,eAAe,CAAA;QACxB,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,eAAe,CAAA;QACzB,eAAe,EAAE,MAAM,CAAA;KACxB,GAAG,CAAC,CAAA;IACL,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,UAAU,CAAA;IACtB,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,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAA;CAExE,GAAG,QAAQ,CAAA"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { OperationInsertable } from './OperationInsertable.js';
|
|
2
|
-
import type { CoreContext } from '../context/CoreContext.js';
|
|
3
2
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
4
3
|
import { ContentSettings } from './ContentSettings.js';
|
|
5
4
|
import type { GeneratedDefintion, GenerationType } from '../types/GeneratedValue.js';
|
|
6
5
|
import type { GeneratedValue } from '../types/GeneratedValue.js';
|
|
6
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
7
7
|
type CreateOperationArgs<V extends GeneratedValue, T extends GenerationType> = {
|
|
8
|
-
context:
|
|
8
|
+
context: GenerateContext;
|
|
9
9
|
insertable: OperationInsertable<V>;
|
|
10
10
|
operation: OasOperation;
|
|
11
11
|
generation?: T;
|
|
12
12
|
destinationPath?: string;
|
|
13
13
|
};
|
|
14
14
|
export declare class OperationDriver<V extends GeneratedValue, T extends GenerationType> {
|
|
15
|
-
context:
|
|
15
|
+
context: GenerateContext;
|
|
16
16
|
insertable: OperationInsertable<V>;
|
|
17
17
|
operation: OasOperation;
|
|
18
18
|
settings: ContentSettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"OperationDriver.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAItD,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,IAAI;IAC7E,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,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,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;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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { CoreContext } from '../context/CoreContext.js';
|
|
2
1
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
3
2
|
import type { ContentSettings } from './ContentSettings.js';
|
|
4
3
|
import type { BaseSettings } from '../types/Settings.js';
|
|
5
4
|
import type { EntityType } from './EntityType.js';
|
|
5
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
6
6
|
type CreateOperationFnArgs = {
|
|
7
|
-
context:
|
|
7
|
+
context: GenerateContext;
|
|
8
8
|
settings: ContentSettings;
|
|
9
9
|
operation: OasOperation;
|
|
10
10
|
};
|
|
@@ -24,7 +24,7 @@ export type WithTransformOperation = {
|
|
|
24
24
|
transformOperation: (operation: OasOperation) => void;
|
|
25
25
|
};
|
|
26
26
|
export type OperationGenerator = {
|
|
27
|
-
new (context:
|
|
27
|
+
new (context: GenerateContext): WithTransformOperation;
|
|
28
28
|
id: string;
|
|
29
29
|
type: 'operation';
|
|
30
30
|
pinnable?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationInsertable.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationInsertable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"OperationInsertable.d.ts","sourceRoot":"","sources":["../../src/dsl/OperationInsertable.ts"],"names":[],"mappings":"AAAA,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;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,KAAK,qBAAqB,GAAG;IAC3B,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,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,eAAe,GAAG,sBAAsB,CAAA;IACtD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,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,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/esm/dsl/ValueBase.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GenerateContext } from '../context/GenerateContext.js';
|
|
2
2
|
import type { RegisterArgs } from '../context/GenerateContext.js';
|
|
3
3
|
import type { GeneratorKey } from '../types/GeneratorKeys.js';
|
|
4
4
|
type ValueBaseArgs = {
|
|
5
|
-
context:
|
|
5
|
+
context: GenerateContext;
|
|
6
6
|
generatorKey: GeneratorKey;
|
|
7
7
|
};
|
|
8
8
|
export declare class ValueBase {
|
|
9
|
-
context:
|
|
9
|
+
context: GenerateContext;
|
|
10
10
|
skipped: boolean;
|
|
11
11
|
generatorKey: GeneratorKey;
|
|
12
12
|
constructor({ context, generatorKey }: ValueBaseArgs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueBase.d.ts","sourceRoot":"","sources":["../../src/dsl/ValueBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ValueBase.d.ts","sourceRoot":"","sources":["../../src/dsl/ValueBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,eAAe,CAAA;IACxB,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,eAAe,CAAA;IACxB,OAAO,EAAE,OAAO,CAAQ;IACxB,YAAY,EAAE,YAAY,CAAA;gBAEd,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,aAAa;IAOpD,QAAQ,CAAC,IAAI,EAAE,YAAY;CAG5B"}
|
package/esm/dsl/ValueBase.js
CHANGED
|
@@ -34,9 +34,7 @@ const proxyHandler = {
|
|
|
34
34
|
if (!target.generatorKey) {
|
|
35
35
|
throw new Error('generatorKey is required');
|
|
36
36
|
}
|
|
37
|
-
target.context.
|
|
38
|
-
generatorKey: target.generatorKey
|
|
39
|
-
});
|
|
37
|
+
target.context.callback(target.generatorKey);
|
|
40
38
|
return toString.apply(thisArg);
|
|
41
39
|
}
|
|
42
40
|
})
|