@skmtc/core 0.0.267 → 0.0.269
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/dsl/withConfig.d.ts +12 -6
- package/esm/dsl/withConfig.d.ts.map +1 -1
- package/esm/dsl/withConfig.js +1 -1
- package/esm/generate/generateModels.js +2 -1
- package/esm/generate/generateOperations.d.ts.map +1 -1
- package/esm/generate/generateOperations.js +6 -0
- package/esm/server/createServer.js +1 -1
- package/package.json +1 -1
- package/script/dsl/withConfig.d.ts +12 -6
- package/script/dsl/withConfig.d.ts.map +1 -1
- package/script/dsl/withConfig.js +1 -1
- package/script/generate/generateModels.js +2 -1
- package/script/generate/generateOperations.d.ts.map +1 -1
- package/script/generate/generateOperations.js +6 -0
- package/script/server/createServer.js +1 -1
package/esm/dsl/withConfig.d.ts
CHANGED
|
@@ -8,8 +8,12 @@ import type { IsOperationSelectedArgs, ToOperationExportPathArgs, ToOperationNam
|
|
|
8
8
|
export type GeneratorConfigConstructor = {
|
|
9
9
|
context: CoreContext;
|
|
10
10
|
};
|
|
11
|
-
export type OperationGeneratorConfig = GeneratorConfig & OperationConfig
|
|
12
|
-
|
|
11
|
+
export type OperationGeneratorConfig = GeneratorConfig & OperationConfig & {
|
|
12
|
+
isSupported: (operation: OasOperation) => boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ModelGeneratorConfig = GeneratorConfig & ModelConfig & {
|
|
15
|
+
isSupported: () => true;
|
|
16
|
+
};
|
|
13
17
|
export type OperationConfig = {
|
|
14
18
|
id: string;
|
|
15
19
|
type: 'operation';
|
|
@@ -87,11 +91,13 @@ export declare const toModelInsertable: (config: ModelConfig) => {
|
|
|
87
91
|
type GeneratorConfig = {
|
|
88
92
|
id: string;
|
|
89
93
|
pinnable?: boolean;
|
|
90
|
-
isSupported: (operation: OasOperation) => boolean;
|
|
91
94
|
};
|
|
92
|
-
export declare const toGeneratorBase: (config: GeneratorConfig & {
|
|
93
|
-
type: "operation"
|
|
94
|
-
|
|
95
|
+
export declare const toGeneratorBase: (config: GeneratorConfig & ({
|
|
96
|
+
type: "operation";
|
|
97
|
+
isSupported: (operation: OasOperation) => boolean;
|
|
98
|
+
} | {
|
|
99
|
+
type: "model";
|
|
100
|
+
})) => {
|
|
95
101
|
new ({ context }: GeneratorConfigConstructor): {
|
|
96
102
|
context: CoreContext;
|
|
97
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAK3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,0BAA0B,CAAA;AAGjC,MAAM,MAAM,0BAA0B,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAA;AACjE,MAAM,MAAM,wBAAwB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAK3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,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AAED,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,eAAe,GAAG,MAAM,CAAA;IAC1D,YAAY,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,qBAAqB,GAAG,MAAM,CAAA;IACtE,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAA;CACpE,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,iBAAiB,WAAY,WAAW;eAU/B,mBAAmB;;;;;;;;;;;;;;;;;;wCArBL,eAAe,KAAG,MAAM;8CAClB,qBAAqB,KAAG,MAAM;4CAChC,mBAAmB,KAAG,OAAO;CA6BpE,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,eAAe,WAClB,eAAe,GACrB,CACI;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,WAAW,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CAClD,GACD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CACpB;sBASwB,0BAA0B;iBAD1C,WAAW;;;;6BAXW,YAAY,KAAK,OAAO;;CAgB1D,CAAA"}
|
package/esm/dsl/withConfig.js
CHANGED
|
@@ -126,7 +126,7 @@ export const toGeneratorBase = (config) => {
|
|
|
126
126
|
enumerable: true,
|
|
127
127
|
configurable: true,
|
|
128
128
|
writable: true,
|
|
129
|
-
value: config.isSupported
|
|
129
|
+
value: config.type === 'operation' ? config.isSupported : () => true
|
|
130
130
|
}),
|
|
131
131
|
Object.defineProperty(_a, "pinnable", {
|
|
132
132
|
enumerable: true,
|
|
@@ -6,7 +6,8 @@ export const generateModels = (context) => {
|
|
|
6
6
|
.filter(generator => generator.type === 'model')
|
|
7
7
|
.forEach(generator => {
|
|
8
8
|
const generatorInstance = new generator(context);
|
|
9
|
-
Object.keys(schemaModel.components?.schemas ?? {})
|
|
9
|
+
const refNames = Object.keys(schemaModel.components?.schemas ?? {});
|
|
10
|
+
refNames.forEach((rn, index) => {
|
|
10
11
|
const refName = rn;
|
|
11
12
|
Sentry.addBreadcrumb({
|
|
12
13
|
level: 'info',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateOperations.d.ts","sourceRoot":"","sources":["../../src/generate/generateOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAG5D,eAAO,MAAM,kBAAkB,YAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"generateOperations.d.ts","sourceRoot":"","sources":["../../src/generate/generateOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAG5D,eAAO,MAAM,kBAAkB,YAAa,WAAW,SAqCtD,CAAA"}
|
|
@@ -7,6 +7,12 @@ export const generateOperations = (context) => {
|
|
|
7
7
|
.forEach(generator => {
|
|
8
8
|
const generatorInstance = new generator(context);
|
|
9
9
|
schemaModel.operations.forEach((operation, index) => {
|
|
10
|
+
// TODO If we make OasOperation generic, for example by
|
|
11
|
+
// adding a `method` type, we could make isSupported
|
|
12
|
+
// a type guard which could help us narrow down the
|
|
13
|
+
// exact operation type that a generator receives.
|
|
14
|
+
// This would allow us to remove some type checks
|
|
15
|
+
// in the generator implementations.
|
|
10
16
|
if (!generator.isSupported(operation)) {
|
|
11
17
|
return;
|
|
12
18
|
}
|
|
@@ -89,7 +89,7 @@ const toModels = ({ oasDocument, modelsSettings }) => {
|
|
|
89
89
|
};
|
|
90
90
|
const toOperations = ({ generator, oasDocument, operationsSettings }) => {
|
|
91
91
|
return Object.values(oasDocument.operations)
|
|
92
|
-
.filter(operation => generator.isSupported(operation)
|
|
92
|
+
.filter(operation => generator.isSupported(operation))
|
|
93
93
|
.reduce((acc, operation) => {
|
|
94
94
|
const { path, method } = operation;
|
|
95
95
|
acc[path] = acc[path] ?? {};
|
package/package.json
CHANGED
|
@@ -8,8 +8,12 @@ import type { IsOperationSelectedArgs, ToOperationExportPathArgs, ToOperationNam
|
|
|
8
8
|
export type GeneratorConfigConstructor = {
|
|
9
9
|
context: CoreContext;
|
|
10
10
|
};
|
|
11
|
-
export type OperationGeneratorConfig = GeneratorConfig & OperationConfig
|
|
12
|
-
|
|
11
|
+
export type OperationGeneratorConfig = GeneratorConfig & OperationConfig & {
|
|
12
|
+
isSupported: (operation: OasOperation) => boolean;
|
|
13
|
+
};
|
|
14
|
+
export type ModelGeneratorConfig = GeneratorConfig & ModelConfig & {
|
|
15
|
+
isSupported: () => true;
|
|
16
|
+
};
|
|
13
17
|
export type OperationConfig = {
|
|
14
18
|
id: string;
|
|
15
19
|
type: 'operation';
|
|
@@ -87,11 +91,13 @@ export declare const toModelInsertable: (config: ModelConfig) => {
|
|
|
87
91
|
type GeneratorConfig = {
|
|
88
92
|
id: string;
|
|
89
93
|
pinnable?: boolean;
|
|
90
|
-
isSupported: (operation: OasOperation) => boolean;
|
|
91
94
|
};
|
|
92
|
-
export declare const toGeneratorBase: (config: GeneratorConfig & {
|
|
93
|
-
type: "operation"
|
|
94
|
-
|
|
95
|
+
export declare const toGeneratorBase: (config: GeneratorConfig & ({
|
|
96
|
+
type: "operation";
|
|
97
|
+
isSupported: (operation: OasOperation) => boolean;
|
|
98
|
+
} | {
|
|
99
|
+
type: "model";
|
|
100
|
+
})) => {
|
|
95
101
|
new ({ context }: GeneratorConfigConstructor): {
|
|
96
102
|
context: CoreContext;
|
|
97
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAK3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,0BAA0B,CAAA;AAGjC,MAAM,MAAM,0BAA0B,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAA;AACjE,MAAM,MAAM,wBAAwB,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"withConfig.d.ts","sourceRoot":"","sources":["../../src/dsl/withConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAK3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,0BAA0B,CAAA;AAGjC,MAAM,MAAM,0BAA0B,GAAG;IAAE,OAAO,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,UAAU,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAA;CACpE,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,iBAAiB,WAAY,WAAW;eAU/B,mBAAmB;;;;;;;;;;;;;;;;;;wCArBL,eAAe,KAAG,MAAM;8CAClB,qBAAqB,KAAG,MAAM;4CAChC,mBAAmB,KAAG,OAAO;CA6BpE,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,eAAe,WAClB,eAAe,GACrB,CACI;IACE,IAAI,EAAE,WAAW,CAAA;IACjB,WAAW,EAAE,CAAC,SAAS,EAAE,YAAY,KAAK,OAAO,CAAA;CAClD,GACD;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CACpB;sBASwB,0BAA0B;iBAD1C,WAAW;;;;6BAXW,YAAY,KAAK,OAAO;;CAgB1D,CAAA"}
|
package/script/dsl/withConfig.js
CHANGED
|
@@ -131,7 +131,7 @@ const toGeneratorBase = (config) => {
|
|
|
131
131
|
enumerable: true,
|
|
132
132
|
configurable: true,
|
|
133
133
|
writable: true,
|
|
134
|
-
value: config.isSupported
|
|
134
|
+
value: config.type === 'operation' ? config.isSupported : () => true
|
|
135
135
|
}),
|
|
136
136
|
Object.defineProperty(_a, "pinnable", {
|
|
137
137
|
enumerable: true,
|
|
@@ -32,7 +32,8 @@ const generateModels = (context) => {
|
|
|
32
32
|
.filter(generator => generator.type === 'model')
|
|
33
33
|
.forEach(generator => {
|
|
34
34
|
const generatorInstance = new generator(context);
|
|
35
|
-
Object.keys(schemaModel.components?.schemas ?? {})
|
|
35
|
+
const refNames = Object.keys(schemaModel.components?.schemas ?? {});
|
|
36
|
+
refNames.forEach((rn, index) => {
|
|
36
37
|
const refName = rn;
|
|
37
38
|
Sentry.addBreadcrumb({
|
|
38
39
|
level: 'info',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateOperations.d.ts","sourceRoot":"","sources":["../../src/generate/generateOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAG5D,eAAO,MAAM,kBAAkB,YAAa,WAAW,
|
|
1
|
+
{"version":3,"file":"generateOperations.d.ts","sourceRoot":"","sources":["../../src/generate/generateOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAG5D,eAAO,MAAM,kBAAkB,YAAa,WAAW,SAqCtD,CAAA"}
|
|
@@ -33,6 +33,12 @@ const generateOperations = (context) => {
|
|
|
33
33
|
.forEach(generator => {
|
|
34
34
|
const generatorInstance = new generator(context);
|
|
35
35
|
schemaModel.operations.forEach((operation, index) => {
|
|
36
|
+
// TODO If we make OasOperation generic, for example by
|
|
37
|
+
// adding a `method` type, we could make isSupported
|
|
38
|
+
// a type guard which could help us narrow down the
|
|
39
|
+
// exact operation type that a generator receives.
|
|
40
|
+
// This would allow us to remove some type checks
|
|
41
|
+
// in the generator implementations.
|
|
36
42
|
if (!generator.isSupported(operation)) {
|
|
37
43
|
return;
|
|
38
44
|
}
|
|
@@ -116,7 +116,7 @@ const toModels = ({ oasDocument, modelsSettings }) => {
|
|
|
116
116
|
};
|
|
117
117
|
const toOperations = ({ generator, oasDocument, operationsSettings }) => {
|
|
118
118
|
return Object.values(oasDocument.operations)
|
|
119
|
-
.filter(operation => generator.isSupported(operation)
|
|
119
|
+
.filter(operation => generator.isSupported(operation))
|
|
120
120
|
.reduce((acc, operation) => {
|
|
121
121
|
const { path, method } = operation;
|
|
122
122
|
acc[path] = acc[path] ?? {};
|