@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.
Files changed (57) hide show
  1. package/esm/context/CoreContext.d.ts +8 -1
  2. package/esm/context/CoreContext.d.ts.map +1 -1
  3. package/esm/context/CoreContext.js +24 -2
  4. package/esm/context/GenerateContext.d.ts +6 -2
  5. package/esm/context/GenerateContext.d.ts.map +1 -1
  6. package/esm/context/GenerateContext.js +64 -2
  7. package/esm/dsl/operation/types.d.ts +1 -1
  8. package/esm/dsl/operation/types.d.ts.map +1 -1
  9. package/esm/mod.d.ts +1 -1
  10. package/esm/mod.d.ts.map +1 -1
  11. package/esm/mod.js +1 -1
  12. package/esm/oas/server/Server.d.ts +3 -0
  13. package/esm/oas/server/Server.d.ts.map +1 -1
  14. package/esm/oas/server/Server.js +9 -1
  15. package/esm/oas/server/toServerV3.d.ts.map +1 -1
  16. package/esm/oas/server/toServerV3.js +5 -4
  17. package/esm/oas/serverVariable/ServerVariable.d.ts +21 -0
  18. package/esm/oas/serverVariable/ServerVariable.d.ts.map +1 -0
  19. package/esm/oas/serverVariable/ServerVariable.js +54 -0
  20. package/esm/oas/serverVariable/toServerVariableV3.d.ts +20 -0
  21. package/esm/oas/serverVariable/toServerVariableV3.d.ts.map +1 -0
  22. package/esm/oas/serverVariable/toServerVariableV3.js +29 -0
  23. package/esm/run/toGeneratorSettings.d.ts +10 -0
  24. package/esm/run/toGeneratorSettings.d.ts.map +1 -0
  25. package/esm/run/toGeneratorSettings.js +16 -0
  26. package/package.json +1 -1
  27. package/script/context/CoreContext.d.ts +8 -1
  28. package/script/context/CoreContext.d.ts.map +1 -1
  29. package/script/context/CoreContext.js +24 -2
  30. package/script/context/GenerateContext.d.ts +6 -2
  31. package/script/context/GenerateContext.d.ts.map +1 -1
  32. package/script/context/GenerateContext.js +64 -2
  33. package/script/dsl/operation/types.d.ts +1 -1
  34. package/script/dsl/operation/types.d.ts.map +1 -1
  35. package/script/mod.d.ts +1 -1
  36. package/script/mod.d.ts.map +1 -1
  37. package/script/mod.js +1 -1
  38. package/script/oas/server/Server.d.ts +3 -0
  39. package/script/oas/server/Server.d.ts.map +1 -1
  40. package/script/oas/server/Server.js +9 -1
  41. package/script/oas/server/toServerV3.d.ts.map +1 -1
  42. package/script/oas/server/toServerV3.js +5 -4
  43. package/script/oas/serverVariable/ServerVariable.d.ts +21 -0
  44. package/script/oas/serverVariable/ServerVariable.d.ts.map +1 -0
  45. package/script/oas/serverVariable/ServerVariable.js +58 -0
  46. package/script/oas/serverVariable/toServerVariableV3.d.ts +20 -0
  47. package/script/oas/serverVariable/toServerVariableV3.d.ts.map +1 -0
  48. package/script/oas/serverVariable/toServerVariableV3.js +35 -0
  49. package/script/run/toGeneratorSettings.d.ts +10 -0
  50. package/script/run/toGeneratorSettings.d.ts.map +1 -0
  51. package/script/run/toGeneratorSettings.js +20 -0
  52. package/esm/run/toSettings.d.ts +0 -12
  53. package/esm/run/toSettings.d.ts.map +0 -1
  54. package/esm/run/toSettings.js +0 -54
  55. package/script/run/toSettings.d.ts +0 -12
  56. package/script/run/toSettings.d.ts.map +0 -1
  57. package/script/run/toSettings.js +0 -58
@@ -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
- };