@skmtc/core 0.0.423 → 0.0.425
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 +9 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +37 -29
- package/esm/types/CustomValue.d.ts +4 -0
- package/esm/types/CustomValue.d.ts.map +1 -1
- package/esm/types/CustomValue.js +10 -4
- package/package.json +1 -1
- package/script/context/GenerateContext.d.ts +9 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +37 -29
- package/script/types/CustomValue.d.ts +4 -0
- package/script/types/CustomValue.d.ts.map +1 -1
- package/script/types/CustomValue.js +10 -4
|
@@ -3,7 +3,7 @@ import { Definition } from '../dsl/Definition.js';
|
|
|
3
3
|
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
|
-
import type { ClientSettings } from '../types/Settings.js';
|
|
6
|
+
import type { BaseSettings, ClientGeneratorSettings, ClientSettings } from '../types/Settings.js';
|
|
7
7
|
import type { Method } from '../types/Method.js';
|
|
8
8
|
import type { OperationInsertable, OperationGateway } from '../dsl/operation/OperationInsertable.js';
|
|
9
9
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
@@ -199,6 +199,14 @@ export declare class GenerateContext {
|
|
|
199
199
|
* @returns Content settings for model
|
|
200
200
|
*/
|
|
201
201
|
toGatewayContentSetting(gateway: OperationGateway): ContentSettings;
|
|
202
|
+
/**
|
|
203
|
+
* Look up operation settings for a given generatorId, path and method.
|
|
204
|
+
* @param { generatorId, path, method }
|
|
205
|
+
* @returns Base settings for operation
|
|
206
|
+
*/
|
|
207
|
+
toOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
|
|
208
|
+
toModelBaseSettings({ generatorId, refName }: GetModelSettingsArgs): BaseSettings;
|
|
209
|
+
toGeneratorSettings(generatorId: string): ClientGeneratorSettings | undefined;
|
|
202
210
|
/**
|
|
203
211
|
* Perform one lookup of schema by `refName`.
|
|
204
212
|
* @param refName
|
|
@@ -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;AAE/C,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;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CA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ACX,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG,eAAe;IAoB/C;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,sBAAsB,CAAC,CAAC,CAAC,GAAG,eAAe;IAmC9F;;;;;;;OAOG;IACH,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe;IAcnE;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,wBAAwB,GAAG,YAAY;IAgB9F,mBAAmB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,oBAAoB,GAAG,YAAY;IAgBjF,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IA+B7E;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAUpE;;;;;;OAMG;IACH,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, _GenerateContext_getFile, _GenerateContext_setExportPath,
|
|
12
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_setExportPath, _GenerateContext_toGatewayBaseSettings, _GenerateContext_cleanBaseSettings, _GenerateContext_addFile;
|
|
13
13
|
import { join, normalize } from '../deps/jsr.io/@std/path/1.0.6/mod.js';
|
|
14
14
|
import { Import } from '../dsl/Import.js';
|
|
15
15
|
import { Definition } from '../dsl/Definition.js';
|
|
@@ -272,7 +272,7 @@ export class GenerateContext {
|
|
|
272
272
|
* @returns
|
|
273
273
|
*/
|
|
274
274
|
toOperationContentSettings({ operation, insertable }) {
|
|
275
|
-
const baseSettings =
|
|
275
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
276
276
|
generatorId: insertable.id,
|
|
277
277
|
path: operation.path,
|
|
278
278
|
method: operation.method
|
|
@@ -297,7 +297,7 @@ export class GenerateContext {
|
|
|
297
297
|
* @returns Content settings for model
|
|
298
298
|
*/
|
|
299
299
|
toModelContentSettings({ refName, insertable }) {
|
|
300
|
-
const baseSettings =
|
|
300
|
+
const baseSettings = this.toModelBaseSettings({
|
|
301
301
|
generatorId: insertable.id,
|
|
302
302
|
refName
|
|
303
303
|
});
|
|
@@ -330,6 +330,36 @@ export class GenerateContext {
|
|
|
330
330
|
parentExportPath: baseSettings.parentExportPath
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Look up operation settings for a given generatorId, path and method.
|
|
335
|
+
* @param { generatorId, path, method }
|
|
336
|
+
* @returns Base settings for operation
|
|
337
|
+
*/
|
|
338
|
+
toOperationBaseSettings({ generatorId, path, method }) {
|
|
339
|
+
const generatorSettings = this.toGeneratorSettings(generatorId);
|
|
340
|
+
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
341
|
+
? generatorSettings.operations[path]?.[method]
|
|
342
|
+
: undefined;
|
|
343
|
+
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
344
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
345
|
+
...operationSettings,
|
|
346
|
+
parentExportPath: exportPath
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
toModelBaseSettings({ generatorId, refName }) {
|
|
350
|
+
const generatorSettings = this.toGeneratorSettings(generatorId);
|
|
351
|
+
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
352
|
+
? generatorSettings.models[refName]
|
|
353
|
+
: undefined;
|
|
354
|
+
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
355
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
356
|
+
...modelSettings,
|
|
357
|
+
parentExportPath: exportPath
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
toGeneratorSettings(generatorId) {
|
|
361
|
+
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
362
|
+
}
|
|
333
363
|
/**
|
|
334
364
|
* Perform one lookup of schema by `refName`.
|
|
335
365
|
* @param refName
|
|
@@ -374,7 +404,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
374
404
|
if (!generator.isSupported(operation)) {
|
|
375
405
|
return this.captureCurrentResult('notSupported');
|
|
376
406
|
}
|
|
377
|
-
const baseSettings =
|
|
407
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
378
408
|
generatorId: generator.id,
|
|
379
409
|
path,
|
|
380
410
|
method
|
|
@@ -406,7 +436,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
406
436
|
if (!generator.isSupported(operation)) {
|
|
407
437
|
return this.captureCurrentResult('notSupported');
|
|
408
438
|
}
|
|
409
|
-
const baseSettings =
|
|
439
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
410
440
|
generatorId: generator.id,
|
|
411
441
|
path,
|
|
412
442
|
method
|
|
@@ -427,7 +457,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
427
457
|
if (!generator.isSupported()) {
|
|
428
458
|
return this.captureCurrentResult('notSupported');
|
|
429
459
|
}
|
|
430
|
-
const baseSettings =
|
|
460
|
+
const baseSettings = this.toModelBaseSettings({
|
|
431
461
|
generatorId: generator.id,
|
|
432
462
|
refName
|
|
433
463
|
});
|
|
@@ -460,30 +490,8 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
460
490
|
}
|
|
461
491
|
const combinedExportPath = join(parentExportPath ?? '', generatedExportPath);
|
|
462
492
|
return combinedExportPath;
|
|
463
|
-
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
464
|
-
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
465
|
-
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
466
|
-
? generatorSettings.operations[path]?.[method]
|
|
467
|
-
: undefined;
|
|
468
|
-
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
469
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
470
|
-
...operationSettings,
|
|
471
|
-
parentExportPath: exportPath
|
|
472
|
-
});
|
|
473
|
-
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
474
|
-
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
475
|
-
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
476
|
-
? generatorSettings.models[refName]
|
|
477
|
-
: undefined;
|
|
478
|
-
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
479
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
480
|
-
...modelSettings,
|
|
481
|
-
parentExportPath: exportPath
|
|
482
|
-
});
|
|
483
|
-
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
484
|
-
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
485
493
|
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
486
|
-
const generatorSettings =
|
|
494
|
+
const generatorSettings = this.toGeneratorSettings(generatorId);
|
|
487
495
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
488
496
|
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
489
497
|
return {
|
|
@@ -2,6 +2,7 @@ import type { GenerateContext } from '../context/GenerateContext.js';
|
|
|
2
2
|
import { ValueBase } from '../dsl/ValueBase.js';
|
|
3
3
|
import type { Stringable } from '../dsl/Stringable.js';
|
|
4
4
|
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
5
|
+
import type { OasRef } from '../oas/ref/Ref.js';
|
|
5
6
|
type CreateArgs = {
|
|
6
7
|
context: GenerateContext;
|
|
7
8
|
value: Stringable;
|
|
@@ -11,6 +12,9 @@ export declare class CustomValue extends ValueBase {
|
|
|
11
12
|
type: "custom";
|
|
12
13
|
value: Stringable;
|
|
13
14
|
constructor({ context, value, generatorKey }: CreateArgs);
|
|
15
|
+
isRef(): this is OasRef<'schema'>;
|
|
16
|
+
resolve(): CustomValue;
|
|
17
|
+
resolveOnce(): CustomValue;
|
|
14
18
|
toString(): string;
|
|
15
19
|
}
|
|
16
20
|
export declare const isCustomValue: (value: unknown) => value is CustomValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IACxC,IAAI,WAAoB;IACxB,KAAK,EAAE,UAAU,CAAA;gBAEL,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,UAAU;IAMxD,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,WAAW;IAItB,WAAW,IAAI,WAAW;IAI1B,QAAQ,IAAI,MAAM;CAGnB;AAED,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,WAEvD,CAAA"}
|
package/esm/types/CustomValue.js
CHANGED
|
@@ -16,13 +16,19 @@ export class CustomValue extends ValueBase {
|
|
|
16
16
|
});
|
|
17
17
|
this.value = value;
|
|
18
18
|
}
|
|
19
|
+
isRef() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
resolve() {
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
resolveOnce() {
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
19
28
|
toString() {
|
|
20
29
|
return `${this.value}`;
|
|
21
30
|
}
|
|
22
31
|
}
|
|
23
32
|
export const isCustomValue = (value) => {
|
|
24
|
-
return Boolean(value &&
|
|
25
|
-
typeof value === 'object' &&
|
|
26
|
-
'type' in value &&
|
|
27
|
-
value.type === 'custom');
|
|
33
|
+
return Boolean(value && typeof value === 'object' && 'type' in value && value.type === 'custom');
|
|
28
34
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { Definition } from '../dsl/Definition.js';
|
|
|
3
3
|
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
|
-
import type { ClientSettings } from '../types/Settings.js';
|
|
6
|
+
import type { BaseSettings, ClientGeneratorSettings, ClientSettings } from '../types/Settings.js';
|
|
7
7
|
import type { Method } from '../types/Method.js';
|
|
8
8
|
import type { OperationInsertable, OperationGateway } from '../dsl/operation/OperationInsertable.js';
|
|
9
9
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
@@ -199,6 +199,14 @@ export declare class GenerateContext {
|
|
|
199
199
|
* @returns Content settings for model
|
|
200
200
|
*/
|
|
201
201
|
toGatewayContentSetting(gateway: OperationGateway): ContentSettings;
|
|
202
|
+
/**
|
|
203
|
+
* Look up operation settings for a given generatorId, path and method.
|
|
204
|
+
* @param { generatorId, path, method }
|
|
205
|
+
* @returns Base settings for operation
|
|
206
|
+
*/
|
|
207
|
+
toOperationBaseSettings({ generatorId, path, method }: GetOperationSettingsArgs): BaseSettings;
|
|
208
|
+
toModelBaseSettings({ generatorId, refName }: GetModelSettingsArgs): BaseSettings;
|
|
209
|
+
toGeneratorSettings(generatorId: string): ClientGeneratorSettings | undefined;
|
|
202
210
|
/**
|
|
203
211
|
* Perform one lookup of schema by `refName`.
|
|
204
212
|
* @param refName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateContext.d.ts","sourceRoot":"","sources":["../../src/context/GenerateContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,E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G;IACH,uBAAuB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,wBAAwB,GAAG,YAAY;IAgB9F,mBAAmB,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,oBAAoB,GAAG,YAAY;IAgBjF,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IA+B7E;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAUpE;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAGvE"}
|
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_setExportPath,
|
|
39
|
+
var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_stackTrail, _GenerateContext_runOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_getFile, _GenerateContext_setExportPath, _GenerateContext_toGatewayBaseSettings, _GenerateContext_cleanBaseSettings, _GenerateContext_addFile;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.GenerateContext = void 0;
|
|
42
42
|
const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.6/mod.js");
|
|
@@ -301,7 +301,7 @@ class GenerateContext {
|
|
|
301
301
|
* @returns
|
|
302
302
|
*/
|
|
303
303
|
toOperationContentSettings({ operation, insertable }) {
|
|
304
|
-
const baseSettings =
|
|
304
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
305
305
|
generatorId: insertable.id,
|
|
306
306
|
path: operation.path,
|
|
307
307
|
method: operation.method
|
|
@@ -326,7 +326,7 @@ class GenerateContext {
|
|
|
326
326
|
* @returns Content settings for model
|
|
327
327
|
*/
|
|
328
328
|
toModelContentSettings({ refName, insertable }) {
|
|
329
|
-
const baseSettings =
|
|
329
|
+
const baseSettings = this.toModelBaseSettings({
|
|
330
330
|
generatorId: insertable.id,
|
|
331
331
|
refName
|
|
332
332
|
});
|
|
@@ -359,6 +359,36 @@ class GenerateContext {
|
|
|
359
359
|
parentExportPath: baseSettings.parentExportPath
|
|
360
360
|
});
|
|
361
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Look up operation settings for a given generatorId, path and method.
|
|
364
|
+
* @param { generatorId, path, method }
|
|
365
|
+
* @returns Base settings for operation
|
|
366
|
+
*/
|
|
367
|
+
toOperationBaseSettings({ generatorId, path, method }) {
|
|
368
|
+
const generatorSettings = this.toGeneratorSettings(generatorId);
|
|
369
|
+
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
370
|
+
? generatorSettings.operations[path]?.[method]
|
|
371
|
+
: undefined;
|
|
372
|
+
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
373
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
374
|
+
...operationSettings,
|
|
375
|
+
parentExportPath: exportPath
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
toModelBaseSettings({ generatorId, refName }) {
|
|
379
|
+
const generatorSettings = this.toGeneratorSettings(generatorId);
|
|
380
|
+
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
381
|
+
? generatorSettings.models[refName]
|
|
382
|
+
: undefined;
|
|
383
|
+
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
384
|
+
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
385
|
+
...modelSettings,
|
|
386
|
+
parentExportPath: exportPath
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
toGeneratorSettings(generatorId) {
|
|
390
|
+
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
391
|
+
}
|
|
362
392
|
/**
|
|
363
393
|
* Perform one lookup of schema by `refName`.
|
|
364
394
|
* @param refName
|
|
@@ -404,7 +434,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
404
434
|
if (!generator.isSupported(operation)) {
|
|
405
435
|
return this.captureCurrentResult('notSupported');
|
|
406
436
|
}
|
|
407
|
-
const baseSettings =
|
|
437
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
408
438
|
generatorId: generator.id,
|
|
409
439
|
path,
|
|
410
440
|
method
|
|
@@ -436,7 +466,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
436
466
|
if (!generator.isSupported(operation)) {
|
|
437
467
|
return this.captureCurrentResult('notSupported');
|
|
438
468
|
}
|
|
439
|
-
const baseSettings =
|
|
469
|
+
const baseSettings = this.toOperationBaseSettings({
|
|
440
470
|
generatorId: generator.id,
|
|
441
471
|
path,
|
|
442
472
|
method
|
|
@@ -457,7 +487,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
457
487
|
if (!generator.isSupported()) {
|
|
458
488
|
return this.captureCurrentResult('notSupported');
|
|
459
489
|
}
|
|
460
|
-
const baseSettings =
|
|
490
|
+
const baseSettings = this.toModelBaseSettings({
|
|
461
491
|
generatorId: generator.id,
|
|
462
492
|
refName
|
|
463
493
|
});
|
|
@@ -490,30 +520,8 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_stackTrail = new WeakMa
|
|
|
490
520
|
}
|
|
491
521
|
const combinedExportPath = (0, mod_js_1.join)(parentExportPath ?? '', generatedExportPath);
|
|
492
522
|
return combinedExportPath;
|
|
493
|
-
}, _GenerateContext_toOperationBaseSettings = function _GenerateContext_toOperationBaseSettings({ generatorId, path, method }) {
|
|
494
|
-
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
495
|
-
const operationSettings = generatorSettings && 'operations' in generatorSettings
|
|
496
|
-
? generatorSettings.operations[path]?.[method]
|
|
497
|
-
: undefined;
|
|
498
|
-
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
499
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
500
|
-
...operationSettings,
|
|
501
|
-
parentExportPath: exportPath
|
|
502
|
-
});
|
|
503
|
-
}, _GenerateContext_toModelBaseSettings = function _GenerateContext_toModelBaseSettings({ generatorId, refName }) {
|
|
504
|
-
const generatorSettings = __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_toGeneratorSettings).call(this, generatorId);
|
|
505
|
-
const modelSettings = generatorSettings && 'models' in generatorSettings
|
|
506
|
-
? generatorSettings.models[refName]
|
|
507
|
-
: undefined;
|
|
508
|
-
const { exportPath } = generatorSettings?.baseSettings ?? {};
|
|
509
|
-
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, {
|
|
510
|
-
...modelSettings,
|
|
511
|
-
parentExportPath: exportPath
|
|
512
|
-
});
|
|
513
|
-
}, _GenerateContext_toGeneratorSettings = function _GenerateContext_toGeneratorSettings(generatorId) {
|
|
514
|
-
return this.settings?.generators?.find(({ id }) => id === generatorId);
|
|
515
523
|
}, _GenerateContext_toGatewayBaseSettings = function _GenerateContext_toGatewayBaseSettings(generatorId) {
|
|
516
|
-
const generatorSettings =
|
|
524
|
+
const generatorSettings = this.toGeneratorSettings(generatorId);
|
|
517
525
|
return __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_cleanBaseSettings).call(this, generatorSettings?.baseSettings);
|
|
518
526
|
}, _GenerateContext_cleanBaseSettings = function _GenerateContext_cleanBaseSettings(baseSettings) {
|
|
519
527
|
return {
|
|
@@ -2,6 +2,7 @@ import type { GenerateContext } from '../context/GenerateContext.js';
|
|
|
2
2
|
import { ValueBase } from '../dsl/ValueBase.js';
|
|
3
3
|
import type { Stringable } from '../dsl/Stringable.js';
|
|
4
4
|
import type { GeneratorKey } from './GeneratorKeys.js';
|
|
5
|
+
import type { OasRef } from '../oas/ref/Ref.js';
|
|
5
6
|
type CreateArgs = {
|
|
6
7
|
context: GenerateContext;
|
|
7
8
|
value: Stringable;
|
|
@@ -11,6 +12,9 @@ export declare class CustomValue extends ValueBase {
|
|
|
11
12
|
type: "custom";
|
|
12
13
|
value: Stringable;
|
|
13
14
|
constructor({ context, value, generatorKey }: CreateArgs);
|
|
15
|
+
isRef(): this is OasRef<'schema'>;
|
|
16
|
+
resolve(): CustomValue;
|
|
17
|
+
resolveOnce(): CustomValue;
|
|
14
18
|
toString(): string;
|
|
15
19
|
}
|
|
16
20
|
export declare const isCustomValue: (value: unknown) => value is CustomValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IACxC,IAAI,WAAoB;IACxB,KAAK,EAAE,UAAU,CAAA;gBAEL,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,UAAU;IAMxD,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC,OAAO,IAAI,WAAW;IAItB,WAAW,IAAI,WAAW;IAI1B,QAAQ,IAAI,MAAM;CAGnB;AAED,eAAO,MAAM,aAAa,UAAW,OAAO,KAAG,KAAK,IAAI,WAEvD,CAAA"}
|
|
@@ -19,15 +19,21 @@ class CustomValue extends ValueBase_js_1.ValueBase {
|
|
|
19
19
|
});
|
|
20
20
|
this.value = value;
|
|
21
21
|
}
|
|
22
|
+
isRef() {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
resolve() {
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
resolveOnce() {
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
22
31
|
toString() {
|
|
23
32
|
return `${this.value}`;
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
exports.CustomValue = CustomValue;
|
|
27
36
|
const isCustomValue = (value) => {
|
|
28
|
-
return Boolean(value &&
|
|
29
|
-
typeof value === 'object' &&
|
|
30
|
-
'type' in value &&
|
|
31
|
-
value.type === 'custom');
|
|
37
|
+
return Boolean(value && typeof value === 'object' && 'type' in value && value.type === 'custom');
|
|
32
38
|
};
|
|
33
39
|
exports.isCustomValue = isCustomValue;
|