@prismatic-io/spectral 9.1.0 → 9.1.1
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.
|
@@ -7,10 +7,10 @@ const getImports = ({ inputs }) => {
|
|
|
7
7
|
return acc;
|
|
8
8
|
}
|
|
9
9
|
return Object.assign(Object.assign({}, acc), { [input.valueType.module]: acc[input.valueType.module]
|
|
10
|
-
? !acc[input.valueType.module].includes(input.valueType.
|
|
11
|
-
? [...acc[input.valueType.module], input.valueType.
|
|
10
|
+
? !acc[input.valueType.module].includes(input.valueType.import)
|
|
11
|
+
? [...acc[input.valueType.module], input.valueType.import]
|
|
12
12
|
: acc[input.valueType.module]
|
|
13
|
-
: [input.valueType.
|
|
13
|
+
: [input.valueType.import] });
|
|
14
14
|
}, {});
|
|
15
15
|
};
|
|
16
16
|
exports.getImports = getImports;
|
|
@@ -4,6 +4,11 @@ export type ServerTypeInput = InputBase & {
|
|
|
4
4
|
onPremControlled?: boolean;
|
|
5
5
|
shown?: boolean;
|
|
6
6
|
};
|
|
7
|
+
type ValueType = string | {
|
|
8
|
+
type: string;
|
|
9
|
+
import: string;
|
|
10
|
+
module: string;
|
|
11
|
+
};
|
|
7
12
|
export interface Input {
|
|
8
13
|
key: string;
|
|
9
14
|
label: string;
|
|
@@ -13,20 +18,14 @@ export interface Input {
|
|
|
13
18
|
required: boolean | undefined;
|
|
14
19
|
default: ServerTypeInput["default"];
|
|
15
20
|
}
|
|
16
|
-
export type ValueType = string | {
|
|
17
|
-
type: string;
|
|
18
|
-
module: string;
|
|
19
|
-
};
|
|
20
|
-
export type DocBlock = {
|
|
21
|
-
inputKey?: string;
|
|
22
|
-
propertyKey: keyof ServerTypeInput;
|
|
23
|
-
propertyValue?: unknown;
|
|
24
|
-
output?: string;
|
|
25
|
-
}[];
|
|
26
21
|
interface GetInputsProps {
|
|
27
22
|
inputs: ServerTypeInput[];
|
|
28
23
|
docBlock?: (input: ServerTypeInput) => string;
|
|
29
24
|
}
|
|
30
25
|
export declare const getInputs: ({ inputs, docBlock }: GetInputsProps) => Input[];
|
|
31
|
-
|
|
26
|
+
type InputType = string | {
|
|
27
|
+
type: string;
|
|
28
|
+
module: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], InputType>;
|
|
32
31
|
export {};
|
|
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.INPUT_TYPE_MAP = exports.getInputs = void 0;
|
|
4
4
|
const docBlock_1 = require("./docBlock");
|
|
5
5
|
const getDefaultValue = (value) => {
|
|
6
|
-
if (value === undefined || value === "") {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
if (typeof value === "string") {
|
|
6
|
+
if (value === undefined || value === "" || typeof value === "string") {
|
|
10
7
|
return value;
|
|
11
8
|
}
|
|
12
9
|
return JSON.stringify(value);
|
|
@@ -43,41 +40,50 @@ exports.INPUT_TYPE_MAP = {
|
|
|
43
40
|
boolean: "boolean",
|
|
44
41
|
code: "string",
|
|
45
42
|
conditional: {
|
|
46
|
-
type: "ConditionalExpression",
|
|
47
43
|
module: "@prismatic-io/spectral",
|
|
44
|
+
type: "ConditionalExpression",
|
|
48
45
|
},
|
|
49
46
|
connection: {
|
|
50
|
-
type: "Connection",
|
|
51
47
|
module: "@prismatic-io/spectral",
|
|
48
|
+
type: "Connection",
|
|
52
49
|
},
|
|
53
50
|
objectSelection: {
|
|
54
|
-
type: "ObjectSelection",
|
|
55
51
|
module: "@prismatic-io/spectral",
|
|
52
|
+
type: "ObjectSelection",
|
|
56
53
|
},
|
|
57
54
|
objectFieldMap: {
|
|
58
|
-
type: "ObjectFieldMap",
|
|
59
55
|
module: "@prismatic-io/spectral",
|
|
56
|
+
type: "ObjectFieldMap",
|
|
60
57
|
},
|
|
61
58
|
jsonForm: {
|
|
62
|
-
type: "JSONForm",
|
|
63
59
|
module: "@prismatic-io/spectral",
|
|
60
|
+
type: "JSONForm",
|
|
64
61
|
},
|
|
65
62
|
dynamicObjectSelection: "string",
|
|
66
63
|
dynamicFieldSelection: "string",
|
|
67
64
|
};
|
|
68
65
|
const getInputValueType = (input) => {
|
|
66
|
+
const inputType = exports.INPUT_TYPE_MAP[input.type];
|
|
69
67
|
const valueType = input.model
|
|
70
68
|
? input.model
|
|
71
69
|
.map((choice) => {
|
|
72
70
|
return `\`${choice.value.replaceAll("\r", "\\r").replaceAll("\n", "\\n")}\``;
|
|
73
71
|
})
|
|
74
72
|
.join(" | ")
|
|
75
|
-
:
|
|
73
|
+
: inputType
|
|
74
|
+
? typeof inputType === "string"
|
|
75
|
+
? inputType
|
|
76
|
+
: Object.assign(Object.assign({}, inputType), { import: inputType.type })
|
|
77
|
+
: "never";
|
|
76
78
|
if (input.collection === "keyvaluelist") {
|
|
77
|
-
return
|
|
79
|
+
return typeof valueType === "string"
|
|
80
|
+
? `Record<string, ${valueType}> | Array<{key: string, value: ${valueType}}>`
|
|
81
|
+
: Object.assign(Object.assign({}, valueType), { type: `Record<string, ${valueType.type}> | Array<{key: string, value: ${valueType.type}}>` });
|
|
78
82
|
}
|
|
79
83
|
if (input.collection === "valuelist") {
|
|
80
|
-
return
|
|
84
|
+
return typeof valueType === "string"
|
|
85
|
+
? `${valueType}[]`
|
|
86
|
+
: Object.assign(Object.assign({}, valueType), { type: `${valueType.type}[]` });
|
|
81
87
|
}
|
|
82
88
|
return valueType;
|
|
83
89
|
};
|
|
@@ -410,7 +410,7 @@ const convertOnExecution = (onExecution, componentRegistry) => (context, params)
|
|
|
410
410
|
// Construct the component methods from the component registry
|
|
411
411
|
const componentMethods = Object.entries(componentRegistry).reduce((accumulator, [registryComponentKey, { key: componentKey, actions, public: isPublic, signature }]) => {
|
|
412
412
|
const componentActions = Object.entries(actions).reduce((actionsAccumulator, [registryActionKey, action]) => {
|
|
413
|
-
const manifestActions = componentRegistry[
|
|
413
|
+
const manifestActions = componentRegistry[registryComponentKey].actions[registryActionKey];
|
|
414
414
|
// Define the method to be called for the action
|
|
415
415
|
const invokeAction = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
416
416
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismatic-io/spectral",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.1",
|
|
4
4
|
"description": "Utility library for building Prismatic components",
|
|
5
5
|
"keywords": ["prismatic"],
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"files": ["dist/"],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@jsonforms/core": "3.0.0",
|
|
42
|
-
"axios": "1.
|
|
42
|
+
"axios": "1.7.4",
|
|
43
43
|
"axios-retry": "3.9.1",
|
|
44
44
|
"date-fns": "2.30.0",
|
|
45
45
|
"ejs": "^3.1.10",
|