@prismatic-io/spectral 9.0.0-rc.8 → 9.0.0-rc.9
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/dist/generators/componentManifest/getImports.js +6 -6
- package/dist/generators/componentManifest/getInputs.d.ts +4 -3
- package/dist/generators/componentManifest/getInputs.js +5 -5
- package/dist/generators/componentManifest/removeComponentManifest.js +4 -2
- package/dist/generators/componentManifest/templates/partials/inputs.ejs +2 -1
- package/dist/generators/componentManifest/templates/partials/performArgs.ejs +1 -1
- package/dist/serverTypes/convertIntegration.js +7 -0
- package/package.json +1 -1
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getImports = void 0;
|
|
4
4
|
const getImports = ({ inputs }) => {
|
|
5
5
|
return inputs.reduce((acc, input) => {
|
|
6
|
-
if (typeof input.
|
|
6
|
+
if (typeof input.valueType === "string") {
|
|
7
7
|
return acc;
|
|
8
8
|
}
|
|
9
|
-
return Object.assign(Object.assign({}, acc), { [input.
|
|
10
|
-
? !acc[input.
|
|
11
|
-
? [...acc[input.
|
|
12
|
-
: acc[input.
|
|
13
|
-
: [input.
|
|
9
|
+
return Object.assign(Object.assign({}, acc), { [input.valueType.module]: acc[input.valueType.module]
|
|
10
|
+
? !acc[input.valueType.module].includes(input.valueType.type)
|
|
11
|
+
? [...acc[input.valueType.module], input.valueType.type]
|
|
12
|
+
: acc[input.valueType.module]
|
|
13
|
+
: [input.valueType.type] });
|
|
14
14
|
}, {});
|
|
15
15
|
};
|
|
16
16
|
exports.getImports = getImports;
|
|
@@ -6,14 +6,15 @@ declare type ServerTypeInput = InputBase & {
|
|
|
6
6
|
export interface Input {
|
|
7
7
|
key: string;
|
|
8
8
|
label: string;
|
|
9
|
-
|
|
9
|
+
inputType: string;
|
|
10
|
+
valueType: ValueType;
|
|
10
11
|
required: boolean | undefined;
|
|
11
12
|
properties: {
|
|
12
13
|
key: keyof ServerTypeInput;
|
|
13
14
|
value: string;
|
|
14
15
|
}[];
|
|
15
16
|
}
|
|
16
|
-
export declare type
|
|
17
|
+
export declare type ValueType = string | {
|
|
17
18
|
type: string;
|
|
18
19
|
module: string;
|
|
19
20
|
};
|
|
@@ -28,5 +29,5 @@ interface GetInputsProps {
|
|
|
28
29
|
docBlock: DocBlock;
|
|
29
30
|
}
|
|
30
31
|
export declare const getInputs: ({ inputs, docBlock }: GetInputsProps) => Input[];
|
|
31
|
-
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"],
|
|
32
|
+
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], ValueType>;
|
|
32
33
|
export {};
|
|
@@ -6,11 +6,11 @@ const getInputs = ({ inputs, docBlock }) => {
|
|
|
6
6
|
return {
|
|
7
7
|
key: input.key,
|
|
8
8
|
label: input.label,
|
|
9
|
-
|
|
9
|
+
inputType: input.type,
|
|
10
|
+
valueType: getInputValueType(input),
|
|
10
11
|
required: input.required,
|
|
11
12
|
collection: input.collection,
|
|
12
|
-
|
|
13
|
-
onPremiseControlled: input.onPremiseControlled || input.onPremControlled,
|
|
13
|
+
onPremControlled: input.onPremiseControlled || input.onPremControlled,
|
|
14
14
|
properties: docBlock.reduce((acc, { propertyKey, inputKey, propertyValue, output }) => {
|
|
15
15
|
if (inputKey && inputKey !== input.key) {
|
|
16
16
|
return acc;
|
|
@@ -77,12 +77,12 @@ exports.INPUT_TYPE_MAP = {
|
|
|
77
77
|
dynamicObjectSelection: "string",
|
|
78
78
|
dynamicFieldSelection: "string",
|
|
79
79
|
};
|
|
80
|
-
const
|
|
80
|
+
const getInputValueType = (input) => {
|
|
81
81
|
const valueType = input.model
|
|
82
82
|
? input.model.map((choice) => `"${choice.value}"`).join(" | ")
|
|
83
83
|
: exports.INPUT_TYPE_MAP[input.type] || "never";
|
|
84
84
|
if (input.collection === "keyvaluelist") {
|
|
85
|
-
return `Record<string, ${valueType}>`;
|
|
85
|
+
return `Record<string, ${valueType}> | Array<{key: string, value: ${valueType}}>`;
|
|
86
86
|
}
|
|
87
87
|
if (input.collection === "valuelist") {
|
|
88
88
|
return `${valueType}[]`;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeComponentManifest = void 0;
|
|
4
|
-
const
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
5
|
const removeComponentManifest = ({ destinationDir, verbose, }) => {
|
|
6
6
|
if (verbose) {
|
|
7
7
|
console.info("Removing existing component manifest files...");
|
|
8
8
|
}
|
|
9
9
|
try {
|
|
10
|
-
(0,
|
|
10
|
+
if ((0, fs_1.existsSync)(destinationDir)) {
|
|
11
|
+
(0, fs_1.rmSync)(destinationDir, { recursive: true, force: true });
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
catch (err) {
|
|
13
15
|
console.error(err);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<% inputs.forEach((input) => { -%>
|
|
2
2
|
<%= input.key %>: {
|
|
3
|
-
|
|
3
|
+
valueType: "<%- input.valueType.type ? input.valueType.type : input.valueType %>",
|
|
4
|
+
inputType: "<%= input.inputType %>",
|
|
4
5
|
<%_ if (input.collection) { -%>
|
|
5
6
|
collection: "<%= input.collection %>" as const,
|
|
6
7
|
<%_ } else { -%>
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* @<%= property.key %> <%- property.value %>
|
|
7
7
|
<%_ }); -%>
|
|
8
8
|
*/
|
|
9
|
-
<%= input.key %><%= input.required ? "" : "?" %>: <%- input.
|
|
9
|
+
<%= input.key %><%= input.required ? "" : "?" %>: <%- input.valueType.type ? input.valueType.type : input.valueType %>;
|
|
10
10
|
<% }); -%>
|
|
@@ -388,6 +388,13 @@ const convertOnExecution = (onExecution, componentRegistry) => (context, params)
|
|
|
388
388
|
// Transform the input values based on the action's inputs
|
|
389
389
|
const transformedValues = Object.entries(values).reduce((transformedAccumulator, [inputKey, inputValue]) => {
|
|
390
390
|
const { collection } = action.inputs[inputKey];
|
|
391
|
+
if (collection === "keyvaluelist" &&
|
|
392
|
+
Array.isArray(inputValue)) {
|
|
393
|
+
transformedAccumulator[inputKey] = inputValue.reduce((acc, { key, value }) => {
|
|
394
|
+
return [...acc, { key, value }];
|
|
395
|
+
}, []);
|
|
396
|
+
return transformedAccumulator;
|
|
397
|
+
}
|
|
391
398
|
// Transform key-value list inputs
|
|
392
399
|
if (collection === "keyvaluelist" &&
|
|
393
400
|
Object.keys(inputValue).length) {
|