@skmtc/core 0.0.556 → 0.0.558

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 (63) hide show
  1. package/esm/context/GenerateContext.d.ts +2 -12
  2. package/esm/context/GenerateContext.d.ts.map +1 -1
  3. package/esm/context/GenerateContext.js +19 -109
  4. package/esm/dsl/model/ModelInsertable.d.ts +5 -1
  5. package/esm/dsl/model/ModelInsertable.d.ts.map +1 -1
  6. package/esm/dsl/model/toModelInsertable.d.ts +3 -1
  7. package/esm/dsl/model/toModelInsertable.d.ts.map +1 -1
  8. package/esm/dsl/model/toModelInsertable.js +6 -6
  9. package/esm/dsl/operation/OperationInsertable.d.ts +5 -17
  10. package/esm/dsl/operation/OperationInsertable.d.ts.map +1 -1
  11. package/esm/dsl/operation/toOperationInsertable.d.ts +3 -2
  12. package/esm/dsl/operation/toOperationInsertable.d.ts.map +1 -1
  13. package/esm/dsl/operation/toOperationInsertable.js +8 -8
  14. package/esm/mod.d.ts +0 -2
  15. package/esm/mod.d.ts.map +1 -1
  16. package/esm/mod.js +0 -2
  17. package/esm/run/handleEnrichment.d.ts +1 -1
  18. package/esm/run/handleEnrichment.d.ts.map +1 -1
  19. package/esm/run/handleEnrichment.js +3 -3
  20. package/esm/run/toSettings.d.ts.map +1 -1
  21. package/esm/run/toSettings.js +7 -27
  22. package/esm/types/EnrichmentRequest.d.ts +1 -1
  23. package/esm/types/EnrichmentRequest.d.ts.map +1 -1
  24. package/esm/types/GeneratorType.d.ts +1 -2
  25. package/esm/types/GeneratorType.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/script/context/GenerateContext.d.ts +2 -12
  28. package/script/context/GenerateContext.d.ts.map +1 -1
  29. package/script/context/GenerateContext.js +19 -109
  30. package/script/dsl/model/ModelInsertable.d.ts +5 -1
  31. package/script/dsl/model/ModelInsertable.d.ts.map +1 -1
  32. package/script/dsl/model/toModelInsertable.d.ts +3 -1
  33. package/script/dsl/model/toModelInsertable.d.ts.map +1 -1
  34. package/script/dsl/model/toModelInsertable.js +6 -6
  35. package/script/dsl/operation/OperationInsertable.d.ts +5 -17
  36. package/script/dsl/operation/OperationInsertable.d.ts.map +1 -1
  37. package/script/dsl/operation/toOperationInsertable.d.ts +3 -2
  38. package/script/dsl/operation/toOperationInsertable.d.ts.map +1 -1
  39. package/script/dsl/operation/toOperationInsertable.js +8 -8
  40. package/script/mod.d.ts +0 -2
  41. package/script/mod.d.ts.map +1 -1
  42. package/script/mod.js +0 -2
  43. package/script/run/handleEnrichment.d.ts +1 -1
  44. package/script/run/handleEnrichment.d.ts.map +1 -1
  45. package/script/run/handleEnrichment.js +3 -3
  46. package/script/run/toSettings.d.ts.map +1 -1
  47. package/script/run/toSettings.js +7 -27
  48. package/script/types/EnrichmentRequest.d.ts +1 -1
  49. package/script/types/EnrichmentRequest.d.ts.map +1 -1
  50. package/script/types/GeneratorType.d.ts +1 -2
  51. package/script/types/GeneratorType.d.ts.map +1 -1
  52. package/esm/dsl/GatewayBase.d.ts +0 -13
  53. package/esm/dsl/GatewayBase.d.ts.map +0 -1
  54. package/esm/dsl/GatewayBase.js +0 -19
  55. package/esm/dsl/operation/toOperationGateway.d.ts +0 -39
  56. package/esm/dsl/operation/toOperationGateway.d.ts.map +0 -1
  57. package/esm/dsl/operation/toOperationGateway.js +0 -84
  58. package/script/dsl/GatewayBase.d.ts +0 -13
  59. package/script/dsl/GatewayBase.d.ts.map +0 -1
  60. package/script/dsl/GatewayBase.js +0 -23
  61. package/script/dsl/operation/toOperationGateway.d.ts +0 -39
  62. package/script/dsl/operation/toOperationGateway.d.ts.map +0 -1
  63. package/script/dsl/operation/toOperationGateway.js +0 -88
@@ -8,52 +8,32 @@ const toSettings = ({ generators, clientSettings, defaultSelected, oasDocument }
8
8
  const generatorType = generator.type;
9
9
  return (0, ts_pattern_1.match)(generatorType)
10
10
  .with('operation', () => {
11
- if (!generatorSettings) {
12
- return {
13
- id: generator.id,
14
- operations: toOperations({
15
- generator: generator,
16
- oasDocument,
17
- defaultSelected,
18
- operationsSettings: undefined
19
- })
20
- };
21
- }
22
11
  return {
23
12
  ...generatorSettings,
24
13
  id: generator.id,
25
14
  operations: toOperations({
26
- generator: generator,
27
15
  oasDocument,
28
16
  defaultSelected,
29
- operationsSettings: 'operations' in generatorSettings ? generatorSettings.operations : undefined
17
+ operationsSettings: generatorSettings && 'operations' in generatorSettings
18
+ ? generatorSettings.operations
19
+ : undefined
30
20
  })
31
21
  };
32
22
  })
33
23
  .with('model', () => {
34
- if (!generatorSettings) {
35
- return {
36
- id: generator.id,
37
- models: toModels({
38
- oasDocument,
39
- defaultSelected,
40
- modelsSettings: undefined
41
- })
42
- };
43
- }
44
24
  return {
45
25
  ...generatorSettings,
46
26
  id: generator.id,
47
27
  models: toModels({
48
28
  oasDocument,
49
29
  defaultSelected,
50
- modelsSettings: 'models' in generatorSettings ? generatorSettings.models : undefined
30
+ modelsSettings: generatorSettings && 'models' in generatorSettings
31
+ ? generatorSettings.models
32
+ : undefined
51
33
  })
52
34
  };
53
35
  })
54
- .otherwise(matched => {
55
- throw new Error(`Invalid generator type: '${matched}' for ${generator.id}`);
56
- });
36
+ .exhaustive();
57
37
  });
58
38
  return generatorsSettings;
59
39
  };
@@ -2,7 +2,7 @@ import "../_dnt.polyfills.js";
2
2
  import type { z } from 'zod';
3
3
  export type EnrichmentRequest<EnrichmentType> = {
4
4
  prompt: string;
5
- responseSchema: z.ZodType<EnrichmentType>;
5
+ enrichmentSchema: z.ZodType<EnrichmentType>;
6
6
  content: string;
7
7
  };
8
8
  //# sourceMappingURL=EnrichmentRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnrichmentRequest.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentRequest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,iBAAiB,CAAC,cAAc,IAAI;IAC9C,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACzC,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
1
+ {"version":3,"file":"EnrichmentRequest.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentRequest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,iBAAiB,CAAC,cAAc,IAAI;IAC9C,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAC3C,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
@@ -1,8 +1,7 @@
1
- import type { OperationGateway } from '../dsl/operation/OperationInsertable.js';
2
1
  import type { OperationInsertable } from '../dsl/operation/OperationInsertable.js';
3
2
  import type { ModelInsertable } from '../dsl/model/ModelInsertable.js';
4
3
  import type { GeneratedValue } from './GeneratedValue.js';
5
- export type GeneratorType<EnrichmentType> = OperationGateway<EnrichmentType> | OperationInsertable<GeneratedValue, EnrichmentType> | ModelInsertable<GeneratedValue, EnrichmentType>;
4
+ export type GeneratorType<EnrichmentType> = OperationInsertable<GeneratedValue, EnrichmentType> | ModelInsertable<GeneratedValue, EnrichmentType>;
6
5
  export type GeneratorsMap<G extends GeneratorType<EnrichmentType>, EnrichmentType> = {
7
6
  [K in keyof G]: G[K];
8
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"GeneratorType.d.ts","sourceRoot":"","sources":["../../src/types/GeneratorType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,MAAM,aAAa,CAAC,cAAc,IACpC,gBAAgB,CAAC,cAAc,CAAC,GAChC,mBAAmB,CAAC,cAAc,EAAE,cAAc,CAAC,GACnD,eAAe,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAEnD,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,aAAa,CAAC,cAAc,CAAC,EAAE,cAAc,IAAI;KAClF,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,CAAA"}
1
+ {"version":3,"file":"GeneratorType.d.ts","sourceRoot":"","sources":["../../src/types/GeneratorType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,MAAM,aAAa,CAAC,cAAc,IACpC,mBAAmB,CAAC,cAAc,EAAE,cAAc,CAAC,GACnD,eAAe,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;AAEnD,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,aAAa,CAAC,cAAc,CAAC,EAAE,cAAc,IAAI;KAClF,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,CAAA"}
@@ -1,13 +0,0 @@
1
- import type { GenerateContext, RegisterArgs } from '../context/GenerateContext.js';
2
- import type { ContentSettings } from './ContentSettings.js';
3
- import { ValueBase } from './ValueBase.js';
4
- export type OperationGatewayArgs = {
5
- context: GenerateContext;
6
- settings: ContentSettings<undefined>;
7
- };
8
- export declare class GatewayBase extends ValueBase {
9
- settings: ContentSettings<undefined>;
10
- constructor({ context, settings }: OperationGatewayArgs);
11
- register(args: Omit<RegisterArgs, 'destinationPath'>): void;
12
- }
13
- //# sourceMappingURL=GatewayBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GatewayBase.d.ts","sourceRoot":"","sources":["../../src/dsl/GatewayBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACrC,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IACxC,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;gBAExB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,oBAAoB;IAM9C,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC;CAM9D"}
@@ -1,19 +0,0 @@
1
- import { ValueBase } from './ValueBase.js';
2
- export class GatewayBase extends ValueBase {
3
- constructor({ context, settings }) {
4
- super({ context });
5
- Object.defineProperty(this, "settings", {
6
- enumerable: true,
7
- configurable: true,
8
- writable: true,
9
- value: void 0
10
- });
11
- this.settings = settings;
12
- }
13
- register(args) {
14
- this.context.register({
15
- ...args,
16
- destinationPath: this.settings.exportPath
17
- });
18
- }
19
- }
@@ -1,39 +0,0 @@
1
- import type { OasOperation } from '../../oas/operation/Operation.js';
2
- import { type OperationGatewayArgs } from '../GatewayBase.js';
3
- import type { Identifier } from '../Identifier.js';
4
- import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
5
- import type { IsSupportedOperationConfigArgs, IsSupportedOperationArgs } from './OperationInsertable.js';
6
- import type { GenerateContext } from '../../context/GenerateContext.js';
7
- import type { z } from 'zod';
8
- export type ToOperationGatewayArgs<EnrichmentType> = {
9
- id: string;
10
- toIdentifier: () => Identifier;
11
- toExportPath: () => string;
12
- isSupported?: ({ context, operation, enrichments }: IsSupportedOperationConfigArgs<EnrichmentType>) => boolean;
13
- toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined;
14
- toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
15
- };
16
- type ToEnrichmentsArgs = {
17
- operation: OasOperation;
18
- context: GenerateContext;
19
- };
20
- export declare const toOperationGateway: <EnrichmentType>(config: ToOperationGatewayArgs<EnrichmentType>) => {
21
- new ({ context, settings }: OperationGatewayArgs): {
22
- settings: import("../ContentSettings.js").ContentSettings<undefined>;
23
- register(args: Omit<import("../../context/GenerateContext.js").RegisterArgs, "destinationPath">): void;
24
- context: GenerateContext;
25
- skipped: boolean;
26
- generatorKey: import("../../mod.js").GeneratorKey | undefined;
27
- };
28
- id: string;
29
- type: "operation";
30
- _class: "OperationGateway";
31
- toIdentifier: () => Identifier;
32
- toExportPath: () => string;
33
- toEnrichmentRequest: (<RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined) | undefined;
34
- toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
35
- toEnrichments: ({ operation, context }: ToEnrichmentsArgs) => EnrichmentType;
36
- isSupported: ({ context, operation }: IsSupportedOperationArgs) => boolean;
37
- };
38
- export {};
39
- //# sourceMappingURL=toOperationGateway.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toOperationGateway.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAe,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,EACV,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,sBAAsB,CAAC,cAAc,IAAI;IACnD,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,UAAU,CAAA;IAC9B,YAAY,EAAE,MAAM,MAAM,CAAA;IAC1B,WAAW,CAAC,EAAE,CAAC,EACb,OAAO,EACP,SAAS,EACT,WAAW,EACZ,EAAE,8BAA8B,CAAC,cAAc,CAAC,KAAK,OAAO,CAAA;IAC7D,mBAAmB,CAAC,EAAE,CAAC,mBAAmB,SAAS,cAAc,EAC/D,SAAS,EAAE,YAAY,KACpB,iBAAiB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAA;IACvD,kBAAkB,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;CACpD,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,cAAc,UACvC,sBAAsB,CAAC,cAAc,CAAC;gCAkCT,oBAAoB;;;;;;;;;;wBArDrC,UAAU;wBACV,MAAM;2BAMH,mBAAmB,oCAC7B,YAAY,KACpB,iBAAiB,qBAAqB,GAAG,SAAS;8BAC7B,CAAC,CAAC,OAAO,gBAAgB;4CAqBD,iBAAiB,KAAG,cAAc;0CAYpC,wBAAwB;CAgBzE,CAAA"}
@@ -1,84 +0,0 @@
1
- var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
2
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
3
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
4
- };
5
- import { GatewayBase } from '../GatewayBase.js';
6
- export const toOperationGateway = (config) => {
7
- var _a;
8
- const OperationGateway = (_a = class extends GatewayBase {
9
- constructor({ context, settings }) {
10
- super({ context, settings });
11
- }
12
- },
13
- __setFunctionName(_a, "OperationGateway"),
14
- Object.defineProperty(_a, "id", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: config.id
19
- }),
20
- Object.defineProperty(_a, "type", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: 'operation'
25
- }),
26
- Object.defineProperty(_a, "_class", {
27
- enumerable: true,
28
- configurable: true,
29
- writable: true,
30
- value: 'OperationGateway'
31
- }),
32
- Object.defineProperty(_a, "toIdentifier", {
33
- enumerable: true,
34
- configurable: true,
35
- writable: true,
36
- value: config.toIdentifier.bind(config)
37
- }),
38
- Object.defineProperty(_a, "toExportPath", {
39
- enumerable: true,
40
- configurable: true,
41
- writable: true,
42
- value: config.toExportPath.bind(config)
43
- }),
44
- Object.defineProperty(_a, "toEnrichmentRequest", {
45
- enumerable: true,
46
- configurable: true,
47
- writable: true,
48
- value: config.toEnrichmentRequest?.bind(config)
49
- }),
50
- Object.defineProperty(_a, "toEnrichmentSchema", {
51
- enumerable: true,
52
- configurable: true,
53
- writable: true,
54
- value: config.toEnrichmentSchema.bind(config)
55
- }),
56
- Object.defineProperty(_a, "toEnrichments", {
57
- enumerable: true,
58
- configurable: true,
59
- writable: true,
60
- value: ({ operation, context }) => {
61
- const generatorSettings = context.toOperationSettings({
62
- generatorId: config.id,
63
- path: operation.path,
64
- method: operation.method
65
- });
66
- const responseSchema = config.toEnrichmentSchema?.();
67
- return responseSchema?.parse(generatorSettings.enrichments);
68
- }
69
- }),
70
- Object.defineProperty(_a, "isSupported", {
71
- enumerable: true,
72
- configurable: true,
73
- writable: true,
74
- value: ({ context, operation }) => {
75
- if (typeof config.isSupported !== 'function') {
76
- return true;
77
- }
78
- const enrichments = OperationGateway.toEnrichments({ operation, context });
79
- return config.isSupported({ context, operation, enrichments });
80
- }
81
- }),
82
- _a);
83
- return OperationGateway;
84
- };
@@ -1,13 +0,0 @@
1
- import type { GenerateContext, RegisterArgs } from '../context/GenerateContext.js';
2
- import type { ContentSettings } from './ContentSettings.js';
3
- import { ValueBase } from './ValueBase.js';
4
- export type OperationGatewayArgs = {
5
- context: GenerateContext;
6
- settings: ContentSettings<undefined>;
7
- };
8
- export declare class GatewayBase extends ValueBase {
9
- settings: ContentSettings<undefined>;
10
- constructor({ context, settings }: OperationGatewayArgs);
11
- register(args: Omit<RegisterArgs, 'destinationPath'>): void;
12
- }
13
- //# sourceMappingURL=GatewayBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GatewayBase.d.ts","sourceRoot":"","sources":["../../src/dsl/GatewayBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,eAAe,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;CACrC,CAAA;AAED,qBAAa,WAAY,SAAQ,SAAS;IACxC,QAAQ,EAAE,eAAe,CAAC,SAAS,CAAC,CAAA;gBAExB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,oBAAoB;IAM9C,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,iBAAiB,CAAC;CAM9D"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GatewayBase = void 0;
4
- const ValueBase_js_1 = require("./ValueBase.js");
5
- class GatewayBase extends ValueBase_js_1.ValueBase {
6
- constructor({ context, settings }) {
7
- super({ context });
8
- Object.defineProperty(this, "settings", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: void 0
13
- });
14
- this.settings = settings;
15
- }
16
- register(args) {
17
- this.context.register({
18
- ...args,
19
- destinationPath: this.settings.exportPath
20
- });
21
- }
22
- }
23
- exports.GatewayBase = GatewayBase;
@@ -1,39 +0,0 @@
1
- import type { OasOperation } from '../../oas/operation/Operation.js';
2
- import { type OperationGatewayArgs } from '../GatewayBase.js';
3
- import type { Identifier } from '../Identifier.js';
4
- import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
5
- import type { IsSupportedOperationConfigArgs, IsSupportedOperationArgs } from './OperationInsertable.js';
6
- import type { GenerateContext } from '../../context/GenerateContext.js';
7
- import type { z } from 'zod';
8
- export type ToOperationGatewayArgs<EnrichmentType> = {
9
- id: string;
10
- toIdentifier: () => Identifier;
11
- toExportPath: () => string;
12
- isSupported?: ({ context, operation, enrichments }: IsSupportedOperationConfigArgs<EnrichmentType>) => boolean;
13
- toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined;
14
- toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
15
- };
16
- type ToEnrichmentsArgs = {
17
- operation: OasOperation;
18
- context: GenerateContext;
19
- };
20
- export declare const toOperationGateway: <EnrichmentType>(config: ToOperationGatewayArgs<EnrichmentType>) => {
21
- new ({ context, settings }: OperationGatewayArgs): {
22
- settings: import("../ContentSettings.js").ContentSettings<undefined>;
23
- register(args: Omit<import("../../context/GenerateContext.js").RegisterArgs, "destinationPath">): void;
24
- context: GenerateContext;
25
- skipped: boolean;
26
- generatorKey: import("../../mod.js").GeneratorKey | undefined;
27
- };
28
- id: string;
29
- type: "operation";
30
- _class: "OperationGateway";
31
- toIdentifier: () => Identifier;
32
- toExportPath: () => string;
33
- toEnrichmentRequest: (<RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined) | undefined;
34
- toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
35
- toEnrichments: ({ operation, context }: ToEnrichmentsArgs) => EnrichmentType;
36
- isSupported: ({ context, operation }: IsSupportedOperationArgs) => boolean;
37
- };
38
- export {};
39
- //# sourceMappingURL=toOperationGateway.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toOperationGateway.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/toOperationGateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAe,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,EACV,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,sBAAsB,CAAC,cAAc,IAAI;IACnD,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,UAAU,CAAA;IAC9B,YAAY,EAAE,MAAM,MAAM,CAAA;IAC1B,WAAW,CAAC,EAAE,CAAC,EACb,OAAO,EACP,SAAS,EACT,WAAW,EACZ,EAAE,8BAA8B,CAAC,cAAc,CAAC,KAAK,OAAO,CAAA;IAC7D,mBAAmB,CAAC,EAAE,CAAC,mBAAmB,SAAS,cAAc,EAC/D,SAAS,EAAE,YAAY,KACpB,iBAAiB,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAA;IACvD,kBAAkB,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;CACpD,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,eAAe,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,cAAc,UACvC,sBAAsB,CAAC,cAAc,CAAC;gCAkCT,oBAAoB;;;;;;;;;;wBArDrC,UAAU;wBACV,MAAM;2BAMH,mBAAmB,oCAC7B,YAAY,KACpB,iBAAiB,qBAAqB,GAAG,SAAS;8BAC7B,CAAC,CAAC,OAAO,gBAAgB;4CAqBD,iBAAiB,KAAG,cAAc;0CAYpC,wBAAwB;CAgBzE,CAAA"}
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
3
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
4
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.toOperationGateway = void 0;
8
- const GatewayBase_js_1 = require("../GatewayBase.js");
9
- const toOperationGateway = (config) => {
10
- var _a;
11
- const OperationGateway = (_a = class extends GatewayBase_js_1.GatewayBase {
12
- constructor({ context, settings }) {
13
- super({ context, settings });
14
- }
15
- },
16
- __setFunctionName(_a, "OperationGateway"),
17
- Object.defineProperty(_a, "id", {
18
- enumerable: true,
19
- configurable: true,
20
- writable: true,
21
- value: config.id
22
- }),
23
- Object.defineProperty(_a, "type", {
24
- enumerable: true,
25
- configurable: true,
26
- writable: true,
27
- value: 'operation'
28
- }),
29
- Object.defineProperty(_a, "_class", {
30
- enumerable: true,
31
- configurable: true,
32
- writable: true,
33
- value: 'OperationGateway'
34
- }),
35
- Object.defineProperty(_a, "toIdentifier", {
36
- enumerable: true,
37
- configurable: true,
38
- writable: true,
39
- value: config.toIdentifier.bind(config)
40
- }),
41
- Object.defineProperty(_a, "toExportPath", {
42
- enumerable: true,
43
- configurable: true,
44
- writable: true,
45
- value: config.toExportPath.bind(config)
46
- }),
47
- Object.defineProperty(_a, "toEnrichmentRequest", {
48
- enumerable: true,
49
- configurable: true,
50
- writable: true,
51
- value: config.toEnrichmentRequest?.bind(config)
52
- }),
53
- Object.defineProperty(_a, "toEnrichmentSchema", {
54
- enumerable: true,
55
- configurable: true,
56
- writable: true,
57
- value: config.toEnrichmentSchema.bind(config)
58
- }),
59
- Object.defineProperty(_a, "toEnrichments", {
60
- enumerable: true,
61
- configurable: true,
62
- writable: true,
63
- value: ({ operation, context }) => {
64
- const generatorSettings = context.toOperationSettings({
65
- generatorId: config.id,
66
- path: operation.path,
67
- method: operation.method
68
- });
69
- const responseSchema = config.toEnrichmentSchema?.();
70
- return responseSchema?.parse(generatorSettings.enrichments);
71
- }
72
- }),
73
- Object.defineProperty(_a, "isSupported", {
74
- enumerable: true,
75
- configurable: true,
76
- writable: true,
77
- value: ({ context, operation }) => {
78
- if (typeof config.isSupported !== 'function') {
79
- return true;
80
- }
81
- const enrichments = OperationGateway.toEnrichments({ operation, context });
82
- return config.isSupported({ context, operation, enrichments });
83
- }
84
- }),
85
- _a);
86
- return OperationGateway;
87
- };
88
- exports.toOperationGateway = toOperationGateway;