@skmtc/core 0.0.348 → 0.0.350
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.d.ts +2 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +18 -17
- package/esm/dsl/model/ModelDriver.js +1 -1
- package/esm/dsl/operation/OperationDriver.js +1 -1
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +2 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +18 -17
- package/script/dsl/model/ModelDriver.js +1 -1
- package/script/dsl/operation/OperationDriver.js +1 -1
|
@@ -4,7 +4,7 @@ import type { OasDocument } from '../oas/document/Document.js';
|
|
|
4
4
|
import type { OasSchema } from '../oas/schema/Schema.js';
|
|
5
5
|
import type { OasRef } from '../oas/ref/Ref.js';
|
|
6
6
|
import type { FileContents, GetFileOptions } from './types.js';
|
|
7
|
-
import type { ClientSettings } from '../types/Settings.js';
|
|
7
|
+
import type { BaseSettings, ClientSettings } from '../types/Settings.js';
|
|
8
8
|
import type { Method } from '../types/Method.js';
|
|
9
9
|
import type { OperationInsertable, OperationGateway } from '../dsl/operation/OperationInsertable.js';
|
|
10
10
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
@@ -95,6 +95,7 @@ export declare class GenerateContext {
|
|
|
95
95
|
insert<V extends GeneratedValue, T extends GenerationType>({ generation, destinationPath, ...rest }: InsertArgs<V, T>): InsertReturn<V, T>;
|
|
96
96
|
toOperationContentSettings<V>({ operation, insertable }: ToOperationSettingsArgs<V>): ContentSettings;
|
|
97
97
|
toModelContentSettings<V>({ refName, insertable }: BuildModelSettingsArgs<V>): ContentSettings;
|
|
98
|
+
toOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
|
|
98
99
|
addFile(normalisedPath: string): FileContents;
|
|
99
100
|
resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
|
|
100
101
|
/** Produce external instance and return its name */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EACV,eAAe,EACf,YA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AS,cAAc,EAAE,EACzD,UAAU,EACV,eAAe,EACf,GAAG,IAAI,EACR,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IA4BxC,0BAA0B,CAAC,CAAC,EAAE,EAC5B,SAAS,EACT,UAAU,EACX,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,eAAe;IAiB/C,sBAAsB,CAAC,CAAC,EAAE,EACxB,OAAO,EACP,UAAU,EACX,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,eAAe;IAgB9C,uBAAuB,CAAC,EACtB,WAAW,EACX,IAAI,EACJ,MAAM,EACP,EAAE,wBAAwB;IAgD3B,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY;IAgB7C,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE,oDAAoD;IACpD,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -9,7 +9,7 @@ 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_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator,
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_toModelBaseSettings;
|
|
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
15
|
import { Definition } from '../dsl/Definition.js';
|
|
@@ -170,7 +170,7 @@ export class GenerateContext {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
toOperationContentSettings({ operation, insertable }) {
|
|
173
|
-
const baseSettings =
|
|
173
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
174
174
|
generatorId: insertable.id,
|
|
175
175
|
path: operation.path,
|
|
176
176
|
method: operation.method
|
|
@@ -196,6 +196,22 @@ export class GenerateContext {
|
|
|
196
196
|
importFrom: baseSettings.importFrom ?? e
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
+
toOperationBaseSettings({ generatorId, path, method }) {
|
|
200
|
+
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
201
|
+
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
202
|
+
? generatorSettings.operations?.[path]?.[method]
|
|
203
|
+
: undefined;
|
|
204
|
+
const exportPath = operationSettings?.exportPath
|
|
205
|
+
? join(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
|
|
206
|
+
: undefined;
|
|
207
|
+
const baseSettings = {
|
|
208
|
+
exportPath,
|
|
209
|
+
selected: Boolean(operationSettings?.selected),
|
|
210
|
+
name: operationSettings?.name,
|
|
211
|
+
importFrom: operationSettings?.importFrom
|
|
212
|
+
};
|
|
213
|
+
return baseSettings;
|
|
214
|
+
}
|
|
199
215
|
addFile(normalisedPath) {
|
|
200
216
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
201
217
|
throw new Error(`File already exists: ${normalisedPath}`);
|
|
@@ -279,21 +295,6 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
279
295
|
});
|
|
280
296
|
});
|
|
281
297
|
}
|
|
282
|
-
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
283
|
-
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
284
|
-
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
285
|
-
? generatorSettings.operations?.[path]?.[method]
|
|
286
|
-
: undefined;
|
|
287
|
-
const exportPath = operationSettings?.exportPath
|
|
288
|
-
? join(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
|
|
289
|
-
: undefined;
|
|
290
|
-
const baseSettings = {
|
|
291
|
-
exportPath,
|
|
292
|
-
selected: Boolean(operationSettings?.selected),
|
|
293
|
-
name: operationSettings?.name,
|
|
294
|
-
importFrom: operationSettings?.importFrom
|
|
295
|
-
};
|
|
296
|
-
return baseSettings;
|
|
297
298
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
298
299
|
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
299
300
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
@@ -117,7 +117,7 @@ export class ModelDriver {
|
|
|
117
117
|
refName: this.refName
|
|
118
118
|
});
|
|
119
119
|
if (currentKey !== definition.generatorKey) {
|
|
120
|
-
throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
120
|
+
throw new Error(`Registered definition mismatch. '${definition.identifier.name}': cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
121
121
|
}
|
|
122
122
|
return definition.value instanceof this.insertable;
|
|
123
123
|
}
|
|
@@ -116,7 +116,7 @@ export class OperationDriver {
|
|
|
116
116
|
operation: this.operation
|
|
117
117
|
});
|
|
118
118
|
if (currentKey !== definition.generatorKey) {
|
|
119
|
-
throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
119
|
+
throw new Error(`Registered definition mismatch. '${definition.identifier.name}': cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
120
120
|
}
|
|
121
121
|
return definition.value instanceof this.insertable;
|
|
122
122
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import type { OasDocument } from '../oas/document/Document.js';
|
|
|
4
4
|
import type { OasSchema } from '../oas/schema/Schema.js';
|
|
5
5
|
import type { OasRef } from '../oas/ref/Ref.js';
|
|
6
6
|
import type { FileContents, GetFileOptions } from './types.js';
|
|
7
|
-
import type { ClientSettings } from '../types/Settings.js';
|
|
7
|
+
import type { BaseSettings, ClientSettings } from '../types/Settings.js';
|
|
8
8
|
import type { Method } from '../types/Method.js';
|
|
9
9
|
import type { OperationInsertable, OperationGateway } from '../dsl/operation/OperationInsertable.js';
|
|
10
10
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
@@ -95,6 +95,7 @@ export declare class GenerateContext {
|
|
|
95
95
|
insert<V extends GeneratedValue, T extends GenerationType>({ generation, destinationPath, ...rest }: InsertArgs<V, T>): InsertReturn<V, T>;
|
|
96
96
|
toOperationContentSettings<V>({ operation, insertable }: ToOperationSettingsArgs<V>): ContentSettings;
|
|
97
97
|
toModelContentSettings<V>({ refName, insertable }: BuildModelSettingsArgs<V>): ContentSettings;
|
|
98
|
+
toOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
|
|
98
99
|
addFile(normalisedPath: string): FileContents;
|
|
99
100
|
resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
|
|
100
101
|
/** Produce external instance and return its name */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cA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c,EAAE,MAAM,GAAG,YAAY;IAgB7C,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAWpE,oDAAoD;IACpD,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -33,7 +33,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
33
33
|
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");
|
|
34
34
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
35
|
};
|
|
36
|
-
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator,
|
|
36
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_toModelBaseSettings;
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.GenerateContext = void 0;
|
|
39
39
|
const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.0/mod.js");
|
|
@@ -196,7 +196,7 @@ class GenerateContext {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
toOperationContentSettings({ operation, insertable }) {
|
|
199
|
-
const baseSettings =
|
|
199
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
200
200
|
generatorId: insertable.id,
|
|
201
201
|
path: operation.path,
|
|
202
202
|
method: operation.method
|
|
@@ -222,6 +222,22 @@ class GenerateContext {
|
|
|
222
222
|
importFrom: baseSettings.importFrom ?? e
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
+
toOperationBaseSettings({ generatorId, path, method }) {
|
|
226
|
+
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
227
|
+
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
228
|
+
? generatorSettings.operations?.[path]?.[method]
|
|
229
|
+
: undefined;
|
|
230
|
+
const exportPath = operationSettings?.exportPath
|
|
231
|
+
? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
|
|
232
|
+
: undefined;
|
|
233
|
+
const baseSettings = {
|
|
234
|
+
exportPath,
|
|
235
|
+
selected: Boolean(operationSettings?.selected),
|
|
236
|
+
name: operationSettings?.name,
|
|
237
|
+
importFrom: operationSettings?.importFrom
|
|
238
|
+
};
|
|
239
|
+
return baseSettings;
|
|
240
|
+
}
|
|
225
241
|
addFile(normalisedPath) {
|
|
226
242
|
if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalisedPath)) {
|
|
227
243
|
throw new Error(`File already exists: ${normalisedPath}`);
|
|
@@ -306,21 +322,6 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
306
322
|
});
|
|
307
323
|
});
|
|
308
324
|
}
|
|
309
|
-
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
310
|
-
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
311
|
-
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
312
|
-
? generatorSettings.operations?.[path]?.[method]
|
|
313
|
-
: undefined;
|
|
314
|
-
const exportPath = operationSettings?.exportPath
|
|
315
|
-
? (0, mod_js_1.join)(generatorSettings?.exportPath ?? '', operationSettings?.exportPath)
|
|
316
|
-
: undefined;
|
|
317
|
-
const baseSettings = {
|
|
318
|
-
exportPath,
|
|
319
|
-
selected: Boolean(operationSettings?.selected),
|
|
320
|
-
name: operationSettings?.name,
|
|
321
|
-
importFrom: operationSettings?.importFrom
|
|
322
|
-
};
|
|
323
|
-
return baseSettings;
|
|
324
325
|
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
325
326
|
const generatorSettings = this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
326
327
|
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
@@ -120,7 +120,7 @@ class ModelDriver {
|
|
|
120
120
|
refName: this.refName
|
|
121
121
|
});
|
|
122
122
|
if (currentKey !== definition.generatorKey) {
|
|
123
|
-
throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
123
|
+
throw new Error(`Registered definition mismatch. '${definition.identifier.name}': cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
124
124
|
}
|
|
125
125
|
return definition.value instanceof this.insertable;
|
|
126
126
|
}
|
|
@@ -119,7 +119,7 @@ class OperationDriver {
|
|
|
119
119
|
operation: this.operation
|
|
120
120
|
});
|
|
121
121
|
if (currentKey !== definition.generatorKey) {
|
|
122
|
-
throw new Error(`Registered definition mismatch: cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
122
|
+
throw new Error(`Registered definition mismatch. '${definition.identifier.name}': cached key '${definition.generatorKey}' does not match new key ${currentKey}`);
|
|
123
123
|
}
|
|
124
124
|
return definition.value instanceof this.insertable;
|
|
125
125
|
}
|