@skmtc/core 0.0.486 → 0.0.488
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ClientGeneratorSettings } from '../types/Settings.js';
|
|
2
|
+
import type { EnrichmentItem } from './toEnrichments.js';
|
|
2
3
|
type EnrichSettingsArgs = {
|
|
3
4
|
generatorSettings: ClientGeneratorSettings[];
|
|
4
|
-
enrichments: Record<string,
|
|
5
|
+
enrichments: Record<string, EnrichmentItem[]>;
|
|
5
6
|
};
|
|
6
7
|
export declare const enrichSettings: ({ generatorSettings, enrichments }: EnrichSettingsArgs) => ClientGeneratorSettings[];
|
|
7
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrichSettings.d.ts","sourceRoot":"","sources":["../../src/run/enrichSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"enrichSettings.d.ts","sourceRoot":"","sources":["../../src/run/enrichSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,KAAK,kBAAkB,GAAG;IACxB,iBAAiB,EAAE,uBAAuB,EAAE,CAAA;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,cAAc,uCAAwC,kBAAkB,8BAQpF,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { set } from 'lodash-es';
|
|
2
2
|
export const enrichSettings = ({ generatorSettings, enrichments }) => {
|
|
3
3
|
Object.values(generatorSettings).forEach(setting => {
|
|
4
|
-
Object.
|
|
5
|
-
console.log('KEY', key);
|
|
4
|
+
Object.values(enrichments[setting.id] ?? {}).forEach(({ key, value }) => {
|
|
6
5
|
set(setting, key, value);
|
|
7
6
|
});
|
|
8
7
|
});
|
|
@@ -7,6 +7,10 @@ type ToEnrichmentsArgs = {
|
|
|
7
7
|
generators: GeneratorsType[];
|
|
8
8
|
oasDocument: OasDocument;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type EnrichmentItem = {
|
|
11
|
+
key: string[];
|
|
12
|
+
value: unknown;
|
|
13
|
+
};
|
|
14
|
+
export declare const toEnrichments: ({ generators, oasDocument }: ToEnrichmentsArgs) => Promise<Record<string, EnrichmentItem[]>>;
|
|
11
15
|
export {};
|
|
12
16
|
//# sourceMappingURL=toEnrichments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toEnrichments.d.ts","sourceRoot":"","sources":["../../src/run/toEnrichments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D,KAAK,cAAc,GACf,gBAAgB,GAChB,mBAAmB,CAAC,cAAc,CAAC,GACnC,eAAe,CAAC,cAAc,CAAC,CAAA;AAEnC,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,aAAa,gCAAuC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"toEnrichments.d.ts","sourceRoot":"","sources":["../../src/run/toEnrichments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D,KAAK,cAAc,GACf,gBAAgB,GAChB,mBAAmB,CAAC,cAAc,CAAC,GACnC,eAAe,CAAC,cAAc,CAAC,CAAA;AAEnC,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,eAAO,MAAM,aAAa,gCAAuC,iBAAiB,8CA4CjF,CAAA"}
|
package/esm/run/toEnrichments.js
CHANGED
|
@@ -7,8 +7,13 @@ export const toEnrichments = async ({ generators, oasDocument }) => {
|
|
|
7
7
|
const enrichmentRequest = generator.toEnrichmentRequest?.(operation);
|
|
8
8
|
if (enrichmentRequest) {
|
|
9
9
|
const enrichmentResponse = await handleEnrichment(enrichmentRequest);
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if (!output[generator.id]) {
|
|
11
|
+
output[generator.id] = [];
|
|
12
|
+
}
|
|
13
|
+
output[generator.id].push({
|
|
14
|
+
key: ['operations', operation.path, operation.method, 'enrichments'],
|
|
15
|
+
value: JSON.parse(enrichmentResponse)
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
}
|
|
@@ -17,11 +22,17 @@ export const toEnrichments = async ({ generators, oasDocument }) => {
|
|
|
17
22
|
const enrichmentRequest = generator.toEnrichmentRequest?.(refName);
|
|
18
23
|
if (enrichmentRequest) {
|
|
19
24
|
const enrichmentResponse = await handleEnrichment(enrichmentRequest);
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
if (!output[generator.id]) {
|
|
26
|
+
output[generator.id] = [];
|
|
27
|
+
}
|
|
28
|
+
output[generator.id].push({
|
|
29
|
+
key: ['models', refName, 'enrichments'],
|
|
30
|
+
value: JSON.parse(enrichmentResponse)
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
}
|
|
25
35
|
}
|
|
36
|
+
console.log('OUTPUT', output);
|
|
26
37
|
return output;
|
|
27
38
|
};
|