@skmtc/core 0.0.604 → 0.0.606
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 +8 -1
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +24 -2
- package/esm/context/GenerateContext.d.ts +6 -2
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +64 -2
- package/esm/dsl/operation/types.d.ts +1 -1
- package/esm/dsl/operation/types.d.ts.map +1 -1
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/oas/server/Server.d.ts +3 -0
- package/esm/oas/server/Server.d.ts.map +1 -1
- package/esm/oas/server/Server.js +9 -1
- package/esm/oas/server/toServerV3.d.ts.map +1 -1
- package/esm/oas/server/toServerV3.js +5 -4
- package/esm/oas/serverVariable/ServerVariable.d.ts +21 -0
- package/esm/oas/serverVariable/ServerVariable.d.ts.map +1 -0
- package/esm/oas/serverVariable/ServerVariable.js +54 -0
- package/esm/oas/serverVariable/toServerVariableV3.d.ts +20 -0
- package/esm/oas/serverVariable/toServerVariableV3.d.ts.map +1 -0
- package/esm/oas/serverVariable/toServerVariableV3.js +29 -0
- package/esm/run/toGeneratorSettings.d.ts +10 -0
- package/esm/run/toGeneratorSettings.d.ts.map +1 -0
- package/esm/run/toGeneratorSettings.js +16 -0
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +8 -1
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +24 -2
- package/script/context/GenerateContext.d.ts +6 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +64 -2
- package/script/dsl/operation/types.d.ts +1 -1
- package/script/dsl/operation/types.d.ts.map +1 -1
- package/script/mod.d.ts +1 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +1 -1
- package/script/oas/server/Server.d.ts +3 -0
- package/script/oas/server/Server.d.ts.map +1 -1
- package/script/oas/server/Server.js +9 -1
- package/script/oas/server/toServerV3.d.ts.map +1 -1
- package/script/oas/server/toServerV3.js +5 -4
- package/script/oas/serverVariable/ServerVariable.d.ts +21 -0
- package/script/oas/serverVariable/ServerVariable.d.ts.map +1 -0
- package/script/oas/serverVariable/ServerVariable.js +58 -0
- package/script/oas/serverVariable/toServerVariableV3.d.ts +20 -0
- package/script/oas/serverVariable/toServerVariableV3.d.ts.map +1 -0
- package/script/oas/serverVariable/toServerVariableV3.js +35 -0
- package/script/run/toGeneratorSettings.d.ts +10 -0
- package/script/run/toGeneratorSettings.d.ts.map +1 -0
- package/script/run/toGeneratorSettings.js +20 -0
- package/esm/run/toSettings.d.ts +0 -12
- package/esm/run/toSettings.d.ts.map +0 -1
- package/esm/run/toSettings.js +0 -54
- package/script/run/toSettings.d.ts +0 -12
- package/script/run/toSettings.d.ts.map +0 -1
- package/script/run/toSettings.js +0 -58
package/script/run/toSettings.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toSettings = void 0;
|
|
4
|
-
const ts_pattern_1 = require("ts-pattern");
|
|
5
|
-
const toSettings = ({ generators, clientSettings, defaultSelected, oasDocument }) => {
|
|
6
|
-
const generatorsSettings = generators.map(generator => {
|
|
7
|
-
const generatorSettings = clientSettings?.generators.find(({ id }) => id === generator.id);
|
|
8
|
-
const generatorType = generator.type;
|
|
9
|
-
return (0, ts_pattern_1.match)(generatorType)
|
|
10
|
-
.with('operation', () => {
|
|
11
|
-
return {
|
|
12
|
-
...generatorSettings,
|
|
13
|
-
id: generator.id,
|
|
14
|
-
operations: toOperations({
|
|
15
|
-
oasDocument,
|
|
16
|
-
defaultSelected,
|
|
17
|
-
operationsSettings: generatorSettings && 'operations' in generatorSettings
|
|
18
|
-
? generatorSettings.operations
|
|
19
|
-
: undefined
|
|
20
|
-
})
|
|
21
|
-
};
|
|
22
|
-
})
|
|
23
|
-
.with('model', () => {
|
|
24
|
-
return {
|
|
25
|
-
...generatorSettings,
|
|
26
|
-
id: generator.id,
|
|
27
|
-
models: toModels({
|
|
28
|
-
oasDocument,
|
|
29
|
-
defaultSelected,
|
|
30
|
-
modelsSettings: generatorSettings && 'models' in generatorSettings
|
|
31
|
-
? generatorSettings.models
|
|
32
|
-
: undefined
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
})
|
|
36
|
-
.exhaustive();
|
|
37
|
-
});
|
|
38
|
-
return generatorsSettings;
|
|
39
|
-
};
|
|
40
|
-
exports.toSettings = toSettings;
|
|
41
|
-
const toModels = ({ defaultSelected, oasDocument, modelsSettings }) => {
|
|
42
|
-
return Object.fromEntries(Object.keys(oasDocument.components?.schemas ?? {}).map(refName => [
|
|
43
|
-
refName,
|
|
44
|
-
modelsSettings?.[refName]
|
|
45
|
-
? modelsSettings?.[refName]
|
|
46
|
-
: { selected: defaultSelected, enrichments: undefined }
|
|
47
|
-
]));
|
|
48
|
-
};
|
|
49
|
-
const toOperations = ({ oasDocument, operationsSettings, defaultSelected }) => {
|
|
50
|
-
return Object.values(oasDocument.operations).reduce((acc, operation) => {
|
|
51
|
-
const { path, method } = operation;
|
|
52
|
-
acc[path] = acc[path] ?? {};
|
|
53
|
-
acc[path][method] = operationsSettings?.[path]?.[method]
|
|
54
|
-
? operationsSettings?.[path]?.[method]
|
|
55
|
-
: { selected: defaultSelected, enrichments: undefined };
|
|
56
|
-
return acc;
|
|
57
|
-
}, {});
|
|
58
|
-
};
|