@skmtc/core 0.0.560 → 0.0.562
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 +3 -3
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +4 -4
- package/esm/context/GenerateContext.d.ts +6 -6
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +34 -19
- package/esm/dsl/model/ModelBase.d.ts +1 -1
- package/esm/dsl/model/ModelBase.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.d.ts +1 -1
- package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/model/toModelConfig.d.ts +22 -0
- package/esm/dsl/model/toModelConfig.d.ts.map +1 -0
- package/esm/dsl/model/toModelConfig.js +10 -0
- package/esm/dsl/model/toModelInsertable.d.ts +3 -10
- package/esm/dsl/model/toModelInsertable.d.ts.map +1 -1
- package/esm/dsl/model/toModelInsertable.js +0 -18
- package/esm/dsl/model/{ModelInsertable.d.ts → types.d.ts} +11 -4
- package/esm/dsl/model/types.d.ts.map +1 -0
- package/esm/dsl/operation/OperationBase.d.ts +2 -2
- package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.d.ts +1 -1
- package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/toOperationConfig.d.ts +25 -0
- package/esm/dsl/operation/toOperationConfig.d.ts.map +1 -0
- package/esm/dsl/operation/toOperationConfig.js +11 -0
- package/esm/dsl/operation/toOperationInsertable.d.ts +5 -13
- package/esm/dsl/operation/toOperationInsertable.d.ts.map +1 -1
- package/esm/dsl/operation/toOperationInsertable.js +1 -32
- package/{script/dsl/operation/OperationInsertable.d.ts → esm/dsl/operation/types.d.ts} +11 -5
- package/esm/dsl/operation/types.d.ts.map +1 -0
- package/esm/mod.d.ts +5 -2
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +5 -2
- package/esm/run/toEnrichments.d.ts +2 -2
- package/esm/run/toEnrichments.d.ts.map +1 -1
- package/esm/run/toEnrichments.js +1 -1
- package/esm/run/toSettings.d.ts +2 -2
- package/esm/run/toSettings.d.ts.map +1 -1
- package/esm/run/transform.d.ts +3 -3
- package/esm/run/transform.d.ts.map +1 -1
- package/esm/run/transform.js +2 -2
- package/esm/types/GeneratorType.d.ts +5 -5
- package/esm/types/GeneratorType.d.ts.map +1 -1
- package/esm/types/SchemaItem.d.ts +8 -0
- package/esm/types/SchemaItem.d.ts.map +1 -0
- package/esm/types/SchemaItem.js +1 -0
- package/package.json +5 -1
- package/script/context/CoreContext.d.ts +3 -3
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +4 -4
- package/script/context/GenerateContext.d.ts +6 -6
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +34 -19
- package/script/dsl/model/ModelBase.d.ts +1 -1
- package/script/dsl/model/ModelBase.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.d.ts +1 -1
- package/script/dsl/model/ModelDriver.d.ts.map +1 -1
- package/script/dsl/model/toModelConfig.d.ts +22 -0
- package/script/dsl/model/toModelConfig.d.ts.map +1 -0
- package/script/dsl/model/toModelConfig.js +14 -0
- package/script/dsl/model/toModelInsertable.d.ts +3 -10
- package/script/dsl/model/toModelInsertable.d.ts.map +1 -1
- package/script/dsl/model/toModelInsertable.js +0 -18
- package/script/dsl/model/{ModelInsertable.d.ts → types.d.ts} +11 -4
- package/script/dsl/model/types.d.ts.map +1 -0
- package/script/dsl/operation/OperationBase.d.ts +2 -2
- package/script/dsl/operation/OperationBase.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.d.ts +1 -1
- package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/toOperationConfig.d.ts +25 -0
- package/script/dsl/operation/toOperationConfig.d.ts.map +1 -0
- package/script/dsl/operation/toOperationConfig.js +15 -0
- package/script/dsl/operation/toOperationInsertable.d.ts +5 -13
- package/script/dsl/operation/toOperationInsertable.d.ts.map +1 -1
- package/script/dsl/operation/toOperationInsertable.js +1 -32
- package/{esm/dsl/operation/OperationInsertable.d.ts → script/dsl/operation/types.d.ts} +11 -5
- package/script/dsl/operation/types.d.ts.map +1 -0
- package/script/mod.d.ts +5 -2
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +5 -2
- package/script/run/toEnrichments.d.ts +2 -2
- package/script/run/toEnrichments.d.ts.map +1 -1
- package/script/run/toEnrichments.js +1 -1
- package/script/run/toSettings.d.ts +2 -2
- package/script/run/toSettings.d.ts.map +1 -1
- package/script/run/transform.d.ts +3 -3
- package/script/run/transform.d.ts.map +1 -1
- package/script/run/transform.js +2 -2
- package/script/types/GeneratorType.d.ts +5 -5
- package/script/types/GeneratorType.d.ts.map +1 -1
- package/script/types/SchemaItem.d.ts +8 -0
- package/script/types/SchemaItem.d.ts.map +1 -0
- package/script/types/SchemaItem.js +3 -0
- package/esm/dsl/model/ModelInsertable.d.ts.map +0 -1
- package/esm/dsl/operation/OperationInsertable.d.ts.map +0 -1
- package/script/dsl/model/ModelInsertable.d.ts.map +0 -1
- package/script/dsl/operation/OperationInsertable.d.ts.map +0 -1
- /package/esm/dsl/model/{ModelInsertable.js → types.js} +0 -0
- /package/esm/dsl/operation/{OperationInsertable.js → types.js} +0 -0
- /package/script/dsl/model/{ModelInsertable.js → types.js} +0 -0
- /package/script/dsl/operation/{OperationInsertable.js → types.js} +0 -0
|
@@ -42,24 +42,6 @@ export const toOperationInsertable = (config) => {
|
|
|
42
42
|
writable: true,
|
|
43
43
|
value: config.toExportPath.bind(config)
|
|
44
44
|
}),
|
|
45
|
-
Object.defineProperty(_a, "transform", {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
configurable: true,
|
|
48
|
-
writable: true,
|
|
49
|
-
value: config.transform.bind(config)
|
|
50
|
-
}),
|
|
51
|
-
Object.defineProperty(_a, "toEnrichmentRequest", {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
configurable: true,
|
|
54
|
-
writable: true,
|
|
55
|
-
value: config.toEnrichmentRequest?.bind(config)
|
|
56
|
-
}),
|
|
57
|
-
Object.defineProperty(_a, "toEnrichmentSchema", {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
configurable: true,
|
|
60
|
-
writable: true,
|
|
61
|
-
value: config.toEnrichmentSchema.bind(config)
|
|
62
|
-
}),
|
|
63
45
|
Object.defineProperty(_a, "toEnrichments", {
|
|
64
46
|
enumerable: true,
|
|
65
47
|
configurable: true,
|
|
@@ -70,20 +52,7 @@ export const toOperationInsertable = (config) => {
|
|
|
70
52
|
path: operation.path,
|
|
71
53
|
method: operation.method
|
|
72
54
|
});
|
|
73
|
-
|
|
74
|
-
return enrichmentSchema?.parse(generatorSettings.enrichments);
|
|
75
|
-
}
|
|
76
|
-
}),
|
|
77
|
-
Object.defineProperty(_a, "isSupported", {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
configurable: true,
|
|
80
|
-
writable: true,
|
|
81
|
-
value: ({ context, operation }) => {
|
|
82
|
-
if (typeof config.isSupported !== 'function') {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
const enrichments = OperationInsertable.toEnrichments({ operation, context });
|
|
86
|
-
return config.isSupported({ context, operation, enrichments });
|
|
55
|
+
return config.toEnrichmentSchema().parse(generatorSettings.enrichments);
|
|
87
56
|
}
|
|
88
57
|
}),
|
|
89
58
|
_a);
|
|
@@ -4,6 +4,7 @@ import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
|
4
4
|
import type { Identifier } from '../Identifier.js';
|
|
5
5
|
import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
|
|
6
6
|
import type { z } from 'zod';
|
|
7
|
+
import type { SchemaItem } from '../../types/SchemaItem.js';
|
|
7
8
|
export type OperationInsertableArgs<EnrichmentType> = {
|
|
8
9
|
context: GenerateContext;
|
|
9
10
|
settings: ContentSettings<EnrichmentType>;
|
|
@@ -38,11 +39,16 @@ export type OperationInsertable<V, EnrichmentType> = {
|
|
|
38
39
|
type: 'operation';
|
|
39
40
|
toIdentifier: (operation: OasOperation) => Identifier;
|
|
40
41
|
toExportPath: (operation: OasOperation) => string;
|
|
41
|
-
transform: <Acc>({ context, operation, acc }: TransformOperationArgs<Acc>) => Acc;
|
|
42
|
-
toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined;
|
|
43
|
-
toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
|
|
44
42
|
toEnrichments: ({ operation, context }: ToEnrichmentsArgs) => EnrichmentType;
|
|
45
|
-
isSupported: ({ operation, context }: IsSupportedOperationArgs) => boolean;
|
|
46
43
|
} & Function;
|
|
44
|
+
export type OperationConfig<EnrichmentType> = {
|
|
45
|
+
id: string;
|
|
46
|
+
type: 'operation';
|
|
47
|
+
transform: <Acc = void>({ context, operation, acc }: TransformOperationArgs<Acc>) => Acc;
|
|
48
|
+
toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
|
|
49
|
+
isSupported?: ({ context, operation, enrichments }: IsSupportedOperationConfigArgs<EnrichmentType>) => boolean;
|
|
50
|
+
toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(operation: OasOperation) => EnrichmentRequest<RequestedEnrichment> | undefined;
|
|
51
|
+
toSchemaItem?: (operation: OasOperation) => SchemaItem;
|
|
52
|
+
};
|
|
47
53
|
export {};
|
|
48
|
-
//# sourceMappingURL=
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/dsl/operation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAA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;IAClF,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAA;IACrD,YAAY,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,MAAM,CAAA;IACjD,aAAa,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,iBAAiB,KAAK,cAAc,CAAA;CAE7E,GAAG,QAAQ,CAAA;AAEZ,MAAM,MAAM,eAAe,CAAC,cAAc,IAAI;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,sBAAsB,CAAC,GAAG,CAAC,KAAK,GAAG,CAAA;IACxF,kBAAkB,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IACnD,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,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,UAAU,CAAA;CACvD,CAAA"}
|
package/esm/mod.d.ts
CHANGED
|
@@ -12,12 +12,14 @@ export * from './dsl/Import.js';
|
|
|
12
12
|
export * from './dsl/Inserted.js';
|
|
13
13
|
export * from './dsl/model/ModelBase.js';
|
|
14
14
|
export * from './dsl/model/ModelDriver.js';
|
|
15
|
-
export * from './dsl/model/
|
|
15
|
+
export * from './dsl/model/types.js';
|
|
16
16
|
export * from './dsl/model/toModelInsertable.js';
|
|
17
|
+
export * from './dsl/model/toModelConfig.js';
|
|
17
18
|
export * from './dsl/operation/OperationBase.js';
|
|
18
19
|
export * from './dsl/operation/OperationDriver.js';
|
|
19
|
-
export * from './dsl/operation/
|
|
20
|
+
export * from './dsl/operation/types.js';
|
|
20
21
|
export * from './dsl/operation/toOperationInsertable.js';
|
|
22
|
+
export * from './dsl/operation/toOperationConfig.js';
|
|
21
23
|
export * from './dsl/Stringable.js';
|
|
22
24
|
export * from './dsl/ValueBase.js';
|
|
23
25
|
export * from './helpers/isImported.js';
|
|
@@ -63,6 +65,7 @@ export * from './types/Preview.js';
|
|
|
63
65
|
export * from './types/RefName.js';
|
|
64
66
|
export * from './types/Settings.js';
|
|
65
67
|
export * from './types/TypeSystem.js';
|
|
68
|
+
export * from './types/SchemaItem.js';
|
|
66
69
|
export * from './typescript/FunctionParameter.js';
|
|
67
70
|
export * from './typescript/identifiers.js';
|
|
68
71
|
export * from './typescript/keyValues.js';
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;A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,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,mCAAmC,CAAA;AACjD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uCAAuC,CAAA;AACrD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iCAAiC,CAAA"}
|
package/esm/mod.js
CHANGED
|
@@ -12,12 +12,14 @@ export * from './dsl/Import.js';
|
|
|
12
12
|
export * from './dsl/Inserted.js';
|
|
13
13
|
export * from './dsl/model/ModelBase.js';
|
|
14
14
|
export * from './dsl/model/ModelDriver.js';
|
|
15
|
-
export * from './dsl/model/
|
|
15
|
+
export * from './dsl/model/types.js';
|
|
16
16
|
export * from './dsl/model/toModelInsertable.js';
|
|
17
|
+
export * from './dsl/model/toModelConfig.js';
|
|
17
18
|
export * from './dsl/operation/OperationBase.js';
|
|
18
19
|
export * from './dsl/operation/OperationDriver.js';
|
|
19
|
-
export * from './dsl/operation/
|
|
20
|
+
export * from './dsl/operation/types.js';
|
|
20
21
|
export * from './dsl/operation/toOperationInsertable.js';
|
|
22
|
+
export * from './dsl/operation/toOperationConfig.js';
|
|
21
23
|
export * from './dsl/Stringable.js';
|
|
22
24
|
export * from './dsl/ValueBase.js';
|
|
23
25
|
export * from './helpers/isImported.js';
|
|
@@ -63,6 +65,7 @@ export * from './types/Preview.js';
|
|
|
63
65
|
export * from './types/RefName.js';
|
|
64
66
|
export * from './types/Settings.js';
|
|
65
67
|
export * from './types/TypeSystem.js';
|
|
68
|
+
export * from './types/SchemaItem.js';
|
|
66
69
|
export * from './typescript/FunctionParameter.js';
|
|
67
70
|
export * from './typescript/identifiers.js';
|
|
68
71
|
export * from './typescript/keyValues.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { OasDocument } from '../oas/document/Document.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GeneratorConfig } from '../types/GeneratorType.js';
|
|
3
3
|
type ToEnrichmentsArgs<EnrichmentType> = {
|
|
4
|
-
generators:
|
|
4
|
+
generators: GeneratorConfig<EnrichmentType>[];
|
|
5
5
|
oasDocument: OasDocument;
|
|
6
6
|
};
|
|
7
7
|
export type EnrichmentItem = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toEnrichments.d.ts","sourceRoot":"","sources":["../../src/run/toEnrichments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"toEnrichments.d.ts","sourceRoot":"","sources":["../../src/run/toEnrichments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAIhE,KAAK,iBAAiB,CAAC,cAAc,IAAI;IACvC,UAAU,EAAE,eAAe,CAAC,cAAc,CAAC,EAAE,CAAA;IAC7C,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAQD,eAAO,MAAM,aAAa,GAAU,cAAc,+BAG/C,iBAAiB,CAAC,cAAc,CAAC,8CA0DnC,CAAA"}
|
package/esm/run/toEnrichments.js
CHANGED
|
@@ -16,7 +16,7 @@ export const toEnrichments = async ({ generators, oasDocument }) => {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
else if (generator.type === 'model') {
|
|
19
|
-
for (const [refName
|
|
19
|
+
for (const [refName] of Object.entries(oasDocument.components?.schemas ?? {})) {
|
|
20
20
|
const enrichmentRequest = generator.toEnrichmentRequest?.(refName);
|
|
21
21
|
if (enrichmentRequest) {
|
|
22
22
|
const enrichmentResponse = handleEnrichment(enrichmentRequest);
|
package/esm/run/toSettings.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { OasDocument } from '../oas/document/Document.js';
|
|
2
2
|
import type { ClientSettings, ClientGeneratorSettings } from '../types/Settings.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { GeneratorConfig } from '../types/GeneratorType.js';
|
|
4
4
|
type ToSettingsArgs<EnrichmentType> = {
|
|
5
|
-
generators:
|
|
5
|
+
generators: GeneratorConfig<EnrichmentType>[];
|
|
6
6
|
clientSettings: ClientSettings | undefined;
|
|
7
7
|
defaultSelected: boolean;
|
|
8
8
|
oasDocument: OasDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toSettings.d.ts","sourceRoot":"","sources":["../../src/run/toSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAmB,MAAM,sBAAsB,CAAA;AACpG,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"toSettings.d.ts","sourceRoot":"","sources":["../../src/run/toSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAmB,MAAM,sBAAsB,CAAA;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,KAAK,cAAc,CAAC,cAAc,IAAI;IACpC,UAAU,EAAE,eAAe,CAAC,cAAc,CAAC,EAAE,CAAA;IAC7C,cAAc,EAAE,cAAc,GAAG,SAAS,CAAA;IAC1C,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,cAAc,gEAKtC,cAAc,CAAC,cAAc,CAAC,8BAuChC,CAAA"}
|
package/esm/run/transform.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClientSettings } from '../types/Settings.js';
|
|
2
2
|
import type { PrettierConfigType } from '../types/prettierConfig.js';
|
|
3
3
|
import type { ManifestContent } from '../types/Manifest.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { GeneratorsMapContainer } from '../types/GeneratorType.js';
|
|
5
5
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
6
6
|
type TransformArgs = {
|
|
7
7
|
traceId: string;
|
|
@@ -10,10 +10,10 @@ type TransformArgs = {
|
|
|
10
10
|
settings: ClientSettings | undefined;
|
|
11
11
|
prettier?: PrettierConfigType;
|
|
12
12
|
logsPath?: string;
|
|
13
|
-
|
|
13
|
+
toGeneratorConfigMap: <EnrichmentType>() => GeneratorsMapContainer<EnrichmentType>;
|
|
14
14
|
startAt: number;
|
|
15
15
|
};
|
|
16
|
-
export declare const transform: ({ traceId, spanId, documentObject, settings, prettier,
|
|
16
|
+
export declare const transform: ({ traceId, spanId, documentObject, settings, prettier, toGeneratorConfigMap, logsPath, startAt }: TransformArgs) => {
|
|
17
17
|
artifacts: Record<string, string>;
|
|
18
18
|
manifest: ManifestContent;
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/run/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/run/transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,SAAS,CAAC,QAAQ,CAAA;IAClC,QAAQ,EAAE,cAAc,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,EAAE,kBAAkB,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oBAAoB,EAAE,CAAC,cAAc,OAAO,sBAAsB,CAAC,cAAc,CAAC,CAAA;IAClF,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,SAAS,qGASnB,aAAa;;;CAuBf,CAAA"}
|
package/esm/run/transform.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { CoreContext } from '../context/CoreContext.js';
|
|
3
|
-
export const transform = ({ traceId, spanId, documentObject, settings, prettier,
|
|
3
|
+
export const transform = ({ traceId, spanId, documentObject, settings, prettier, toGeneratorConfigMap, logsPath, startAt }) => {
|
|
4
4
|
const context = new CoreContext({ spanId, logsPath });
|
|
5
5
|
const { artifacts, files, previews, results } = context.transform({
|
|
6
6
|
settings,
|
|
7
|
-
|
|
7
|
+
toGeneratorConfigMap,
|
|
8
8
|
prettier,
|
|
9
9
|
documentObject
|
|
10
10
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
export type GeneratorsMap<G extends GeneratorType<EnrichmentType>, EnrichmentType> = {
|
|
1
|
+
import type { OperationConfig } from '../dsl/operation/types.js';
|
|
2
|
+
import type { ModelConfig } from '../dsl/model/types.js';
|
|
3
|
+
export type GeneratorConfig<EnrichmentType> = OperationConfig<EnrichmentType> | ModelConfig<EnrichmentType>;
|
|
4
|
+
export type GeneratorsMap<G extends GeneratorConfig<EnrichmentType>, EnrichmentType> = {
|
|
6
5
|
[K in keyof G]: G[K];
|
|
7
6
|
};
|
|
7
|
+
export type GeneratorsMapContainer<EnrichmentType> = GeneratorsMap<GeneratorConfig<EnrichmentType>, EnrichmentType>;
|
|
8
8
|
//# sourceMappingURL=GeneratorType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GeneratorType.d.ts","sourceRoot":"","sources":["../../src/types/GeneratorType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"GeneratorType.d.ts","sourceRoot":"","sources":["../../src/types/GeneratorType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,MAAM,eAAe,CAAC,cAAc,IACtC,eAAe,CAAC,cAAc,CAAC,GAC/B,WAAW,CAAC,cAAc,CAAC,CAAA;AAE/B,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,eAAe,CAAC,cAAc,CAAC,EAAE,cAAc,IAAI;KACpF,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,CAAA;AAED,MAAM,MAAM,sBAAsB,CAAC,cAAc,IAAI,aAAa,CAChE,eAAe,CAAC,cAAc,CAAC,EAC/B,cAAc,CACf,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../_dnt.polyfills.js";
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
export type SchemaItem = {
|
|
4
|
+
schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject;
|
|
5
|
+
name: string;
|
|
6
|
+
type: 'list-item' | 'form-item';
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=SchemaItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaItem.d.ts","sourceRoot":"","sources":["../../src/types/SchemaItem.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,eAAe,CAAA;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,GAAG,WAAW,CAAA;CAChC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../_dnt.polyfills.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skmtc/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.562",
|
|
4
4
|
"main": "./script/mod.js",
|
|
5
5
|
"module": "./esm/mod.js",
|
|
6
6
|
"exports": {
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"./EnrichmentRequest": {
|
|
52
52
|
"import": "./esm/types/EnrichmentRequest.js",
|
|
53
53
|
"require": "./script/types/EnrichmentRequest.js"
|
|
54
|
+
},
|
|
55
|
+
"./SchemaItem": {
|
|
56
|
+
"import": "./esm/types/SchemaItem.js",
|
|
57
|
+
"require": "./script/types/SchemaItem.js"
|
|
54
58
|
}
|
|
55
59
|
},
|
|
56
60
|
"scripts": {
|
|
@@ -6,7 +6,7 @@ import type { OasDocument } from '../oas/document/Document.js';
|
|
|
6
6
|
import type { ClientSettings } from '../types/Settings.js';
|
|
7
7
|
import type { ResultType } from '../types/Results.js';
|
|
8
8
|
import * as log from '../deps/jsr.io/@std/log/0.224.8/mod.js';
|
|
9
|
-
import type {
|
|
9
|
+
import type { GeneratorsMapContainer } from '../types/GeneratorType.js';
|
|
10
10
|
import type { Preview } from '../types/Preview.js';
|
|
11
11
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
12
12
|
export type ParsePhase = {
|
|
@@ -29,7 +29,7 @@ type CoreContextArgs = {
|
|
|
29
29
|
type TransformArgs = {
|
|
30
30
|
documentObject: OpenAPIV3.Document;
|
|
31
31
|
settings: ClientSettings | undefined;
|
|
32
|
-
|
|
32
|
+
toGeneratorConfigMap: <EnrichmentType>() => GeneratorsMapContainer<EnrichmentType>;
|
|
33
33
|
prettier?: PrettierConfigType;
|
|
34
34
|
};
|
|
35
35
|
export declare class CoreContext {
|
|
@@ -40,7 +40,7 @@ export declare class CoreContext {
|
|
|
40
40
|
oasDocument: OasDocument;
|
|
41
41
|
extensions: Record<string, unknown>;
|
|
42
42
|
};
|
|
43
|
-
transform({ documentObject, settings,
|
|
43
|
+
transform({ documentObject, settings, toGeneratorConfigMap, prettier }: TransformArgs): {
|
|
44
44
|
results: import("../types/Results.js").ResultsItem;
|
|
45
45
|
files: Record<string, import("../types/Manifest.js").ManifestEntry>;
|
|
46
46
|
previews: Record<string, Record<string, Preview>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAS7D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"CoreContext.d.ts","sourceRoot":"","sources":["../../src/context/CoreContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAS7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,UAAU,G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AED,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAQnF"}
|
|
@@ -72,7 +72,7 @@ class CoreContext {
|
|
|
72
72
|
extensions
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
transform({ documentObject, settings,
|
|
75
|
+
transform({ documentObject, settings, toGeneratorConfigMap, prettier }) {
|
|
76
76
|
// Temp workaround to extract generator keys during
|
|
77
77
|
// 'render' by invoking a callback passed during 'generate'
|
|
78
78
|
try {
|
|
@@ -87,7 +87,7 @@ class CoreContext {
|
|
|
87
87
|
});
|
|
88
88
|
const { files, previews } = this.trace('generate', () => {
|
|
89
89
|
__classPrivateFieldSet(this, _CoreContext_phase, __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupGeneratePhase).call(this, {
|
|
90
|
-
|
|
90
|
+
toGeneratorConfigMap,
|
|
91
91
|
oasDocument,
|
|
92
92
|
settings,
|
|
93
93
|
callback
|
|
@@ -179,7 +179,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
179
179
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f")
|
|
180
180
|
});
|
|
181
181
|
return { type: 'parse', context: parseContext };
|
|
182
|
-
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ oasDocument, settings, callback,
|
|
182
|
+
}, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ oasDocument, settings, callback, toGeneratorConfigMap }) {
|
|
183
183
|
const generateContext = new GenerateContext_js_1.GenerateContext({
|
|
184
184
|
oasDocument,
|
|
185
185
|
settings,
|
|
@@ -187,7 +187,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
187
187
|
callback,
|
|
188
188
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
189
189
|
captureCurrentResult: this.captureCurrentResult.bind(this),
|
|
190
|
-
|
|
190
|
+
toGeneratorConfigMap
|
|
191
191
|
});
|
|
192
192
|
return { type: 'generate', context: generateContext };
|
|
193
193
|
}, _CoreContext_setupRenderPhase = function _CoreContext_setupRenderPhase({ files, previews, prettier, basePath }) {
|
|
@@ -5,9 +5,9 @@ import type { OasSchema } from '../oas/schema/Schema.js';
|
|
|
5
5
|
import type { OasRef } from '../oas/ref/Ref.js';
|
|
6
6
|
import type { ClientSettings, EnrichedSetting } from '../types/Settings.js';
|
|
7
7
|
import type { Method } from '../types/Method.js';
|
|
8
|
-
import type { OperationInsertable } from '../dsl/operation/
|
|
8
|
+
import type { OperationInsertable } from '../dsl/operation/types.js';
|
|
9
9
|
import type { OasOperation } from '../oas/operation/Operation.js';
|
|
10
|
-
import type { ModelInsertable } from '../dsl/model/
|
|
10
|
+
import type { ModelInsertable } from '../dsl/model/types.js';
|
|
11
11
|
import type { GenerationType, GeneratedValue } from '../types/GeneratedValue.js';
|
|
12
12
|
import { ContentSettings } from '../dsl/ContentSettings.js';
|
|
13
13
|
import type { RefName } from '../types/RefName.js';
|
|
@@ -19,7 +19,7 @@ import type { Identifier } from '../dsl/Identifier.js';
|
|
|
19
19
|
import type { SchemaToValueFn, SchemaType, TypeSystemOutput } from '../types/TypeSystem.js';
|
|
20
20
|
import { Inserted } from '../dsl/Inserted.js';
|
|
21
21
|
import { File } from '../dsl/File.js';
|
|
22
|
-
import type {
|
|
22
|
+
import type { GeneratorsMapContainer } from '../types/GeneratorType.js';
|
|
23
23
|
import type { Preview } from '../types/Preview.js';
|
|
24
24
|
type ConstructorArgs = {
|
|
25
25
|
oasDocument: OasDocument;
|
|
@@ -28,7 +28,7 @@ type ConstructorArgs = {
|
|
|
28
28
|
callback: (generatorKey: GeneratorKey) => void;
|
|
29
29
|
stackTrail: StackTrail;
|
|
30
30
|
captureCurrentResult: (result: ResultType) => void;
|
|
31
|
-
|
|
31
|
+
toGeneratorConfigMap: <EnrichmentType>() => GeneratorsMapContainer<EnrichmentType>;
|
|
32
32
|
};
|
|
33
33
|
export type PickArgs = {
|
|
34
34
|
name: string;
|
|
@@ -112,8 +112,8 @@ export declare class GenerateContext {
|
|
|
112
112
|
logger: log.Logger;
|
|
113
113
|
callback: (generatorKey: GeneratorKey) => void;
|
|
114
114
|
captureCurrentResult: (result: ResultType) => void;
|
|
115
|
-
|
|
116
|
-
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail,
|
|
115
|
+
toGeneratorConfigMap: <EnrichmentType>() => GeneratorsMapContainer<EnrichmentType>;
|
|
116
|
+
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail, toGeneratorConfigMap }: ConstructorArgs);
|
|
117
117
|
/**
|
|
118
118
|
* @internal
|
|
119
119
|
*/
|
|
@@ -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,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,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,MA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Ac,EAAE,EAC5C,SAAS,EACT,UAAU,EACX,EAAE,uBAAuB,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,eAAe,CAAC,cAAc,CAAC;IAe/E;;;;;;;;OAQG;IACH,sBAAsB,CAAC,CAAC,EAAE,cAAc,EAAE,EACxC,OAAO,EACP,UAAU,EACX,EAAE,sBAAsB,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,eAAe,CAAC,cAAc,CAAC;IAc9E;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,wBAAwB,GAAG,eAAe;IAW7F,eAAe,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,eAAe;IAsB/E;;;;;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"}
|
|
@@ -52,7 +52,7 @@ const File_js_1 = require("../dsl/File.js");
|
|
|
52
52
|
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
53
53
|
const ts_pattern_1 = require("ts-pattern");
|
|
54
54
|
class GenerateContext {
|
|
55
|
-
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail,
|
|
55
|
+
constructor({ oasDocument, settings, logger, callback, captureCurrentResult, stackTrail, toGeneratorConfigMap }) {
|
|
56
56
|
_GenerateContext_instances.add(this);
|
|
57
57
|
_GenerateContext_files.set(this, void 0);
|
|
58
58
|
_GenerateContext_previews.set(this, void 0);
|
|
@@ -86,7 +86,7 @@ class GenerateContext {
|
|
|
86
86
|
writable: true,
|
|
87
87
|
value: void 0
|
|
88
88
|
});
|
|
89
|
-
Object.defineProperty(this, "
|
|
89
|
+
Object.defineProperty(this, "toGeneratorConfigMap", {
|
|
90
90
|
enumerable: true,
|
|
91
91
|
configurable: true,
|
|
92
92
|
writable: true,
|
|
@@ -101,20 +101,20 @@ class GenerateContext {
|
|
|
101
101
|
this.callback = callback;
|
|
102
102
|
__classPrivateFieldSet(this, _GenerateContext_stackTrail, stackTrail, "f");
|
|
103
103
|
this.captureCurrentResult = captureCurrentResult;
|
|
104
|
-
this.
|
|
104
|
+
this.toGeneratorConfigMap = toGeneratorConfigMap;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* @internal
|
|
108
108
|
*/
|
|
109
109
|
generate() {
|
|
110
|
-
const generators = Object.values(this.
|
|
111
|
-
Sentry.startSpan({ name: 'Generate' }, () => generators.forEach(
|
|
112
|
-
this.trace(
|
|
113
|
-
(0, ts_pattern_1.match)(
|
|
114
|
-
.with('operation', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, { oasDocument: this.oasDocument,
|
|
115
|
-
.with('model', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, { oasDocument: this.oasDocument,
|
|
110
|
+
const generators = Object.values(this.toGeneratorConfigMap());
|
|
111
|
+
Sentry.startSpan({ name: 'Generate' }, () => generators.forEach(generatorConfig => {
|
|
112
|
+
this.trace(generatorConfig.id, () => {
|
|
113
|
+
(0, ts_pattern_1.match)(generatorConfig.type)
|
|
114
|
+
.with('operation', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runOperationGenerator).call(this, { oasDocument: this.oasDocument, generatorConfig }))
|
|
115
|
+
.with('model', () => __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_runModelGenerator).call(this, { oasDocument: this.oasDocument, generatorConfig }))
|
|
116
116
|
.otherwise(matched => {
|
|
117
|
-
throw new Error(`Invalid generator type: '${matched}' on ${
|
|
117
|
+
throw new Error(`Invalid generator type: '${matched}' on ${generatorConfig.id}`);
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
}));
|
|
@@ -390,27 +390,27 @@ class GenerateContext {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
exports.GenerateContext = GenerateContext;
|
|
393
|
-
_GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument,
|
|
393
|
+
_GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_stackTrail = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_runOperationGenerator = function _GenerateContext_runOperationGenerator({ oasDocument, generatorConfig }) {
|
|
394
394
|
return oasDocument.operations.reduce((acc, operation) => {
|
|
395
395
|
return this.trace([operation.path, operation.method], () => {
|
|
396
|
-
if (!
|
|
396
|
+
if (!isOperationSupported({ generatorConfig, operation, context: this })) {
|
|
397
397
|
this.captureCurrentResult('notSupported');
|
|
398
398
|
return acc;
|
|
399
399
|
}
|
|
400
|
-
const result =
|
|
400
|
+
const result = generatorConfig.transform({ context: this, operation, acc });
|
|
401
401
|
this.captureCurrentResult('success');
|
|
402
402
|
return result;
|
|
403
403
|
});
|
|
404
404
|
}, undefined);
|
|
405
|
-
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator({ oasDocument,
|
|
405
|
+
}, _GenerateContext_runModelGenerator = function _GenerateContext_runModelGenerator({ oasDocument, generatorConfig }) {
|
|
406
406
|
const refNames = oasDocument.components?.toSchemasRefNames() ?? [];
|
|
407
407
|
return refNames.reduce((acc, refName) => {
|
|
408
408
|
return this.trace(refName, () => {
|
|
409
|
-
if (!
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
413
|
-
const result =
|
|
409
|
+
// if (!generatorConfig.isSupported()) {
|
|
410
|
+
// this.captureCurrentResult('notSupported')
|
|
411
|
+
// return acc
|
|
412
|
+
// }
|
|
413
|
+
const result = generatorConfig.transform({ context: this, refName, acc });
|
|
414
414
|
this.captureCurrentResult('success');
|
|
415
415
|
return result;
|
|
416
416
|
});
|
|
@@ -435,3 +435,18 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
|
|
|
435
435
|
__classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalisedPath, newFile);
|
|
436
436
|
return newFile;
|
|
437
437
|
};
|
|
438
|
+
const isOperationSupported = ({ generatorConfig, operation, context }) => {
|
|
439
|
+
if (!generatorConfig.isSupported) {
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
const { enrichments } = context.toOperationSettings({
|
|
443
|
+
generatorId: generatorConfig.id,
|
|
444
|
+
path: operation.path,
|
|
445
|
+
method: operation.method
|
|
446
|
+
});
|
|
447
|
+
return generatorConfig.isSupported({
|
|
448
|
+
operation,
|
|
449
|
+
context,
|
|
450
|
+
enrichments: generatorConfig.toEnrichmentSchema().parse(enrichments)
|
|
451
|
+
});
|
|
452
|
+
};
|
|
@@ -3,7 +3,7 @@ import type { GeneratedValue } from '../../types/GeneratedValue.js';
|
|
|
3
3
|
import type { GeneratorKey } from '../../types/GeneratorKeys.js';
|
|
4
4
|
import type { RefName } from '../../types/RefName.js';
|
|
5
5
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
6
|
-
import type { ModelInsertable } from './
|
|
6
|
+
import type { ModelInsertable } from './types.js';
|
|
7
7
|
import { ValueBase } from '../ValueBase.js';
|
|
8
8
|
import type { Inserted } from '../Inserted.js';
|
|
9
9
|
export type ModelBaseArgs<EnrichmentType> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelBase.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAA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EACtC,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,EAAE,CAAC,EAClC,OAAO,EAAE,OAAO,GACf,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;IASlB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;CAwBhD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ModelInsertable } from './
|
|
1
|
+
import type { ModelInsertable } from './types.js';
|
|
2
2
|
import type { GenerateContext } from '../../context/GenerateContext.js';
|
|
3
3
|
import type { ContentSettings } from '../ContentSettings.js';
|
|
4
4
|
import type { GeneratedDefinition, GenerationType } from '../../types/GeneratedValue.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ModelDriver.d.ts","sourceRoot":"","sources":["../../../src/dsl/model/ModelDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAGrD,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,cAAc,IAAI;IACzF,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IAC9C,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,CAAC,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,CAAA;AAWD,qBAAa,WAAW,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,cAAc,EAAE,cAAc;IACzF,OAAO,EAAE,eAAe,CAAA;IACxB,UAAU,EAAE,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IAC9C,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,eAAe,CAAC,cAAc,CAAC,CAAA;IACzC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBACzB,EACV,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACV,eAAe,EAChB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC;IAWxC,OAAO,CAAC,KAAK;IAsBb,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RefName } from '../../types/RefName.js';
|
|
2
|
+
import type { SchemaItem } from '../../types/SchemaItem.js';
|
|
3
|
+
import type { EnrichmentRequest } from '../../types/EnrichmentRequest.js';
|
|
4
|
+
import type { TransformModelArgs } from './types.js';
|
|
5
|
+
import type { z } from 'zod';
|
|
6
|
+
type ToModelConfigArgs<EnrichmentType> = {
|
|
7
|
+
id: string;
|
|
8
|
+
transform: <Acc = void>({ context, refName, acc }: TransformModelArgs<Acc>) => Acc;
|
|
9
|
+
toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
|
|
10
|
+
toEnrichmentRequest?: <RequestedEnrichment extends EnrichmentType>(refName: RefName) => EnrichmentRequest<RequestedEnrichment> | undefined;
|
|
11
|
+
toSchemaItem?: (refName: RefName) => SchemaItem;
|
|
12
|
+
};
|
|
13
|
+
export declare const toModelConfig: <EnrichmentType>({ id, transform, toEnrichmentSchema, toEnrichmentRequest, toSchemaItem }: ToModelConfigArgs<EnrichmentType>) => {
|
|
14
|
+
id: string;
|
|
15
|
+
type: string;
|
|
16
|
+
transform: <Acc = void>({ context, refName, acc }: TransformModelArgs<Acc>) => Acc;
|
|
17
|
+
toEnrichmentSchema: () => z.ZodType<EnrichmentType>;
|
|
18
|
+
toEnrichmentRequest: (<RequestedEnrichment extends EnrichmentType>(refName: RefName) => EnrichmentRequest<RequestedEnrichment> | undefined) | undefined;
|
|
19
|
+
toSchemaItem: ((refName: RefName) => SchemaItem) | undefined;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=toModelConfig.d.ts.map
|