@prismatic-io/spectral 9.0.0-rc.1 → 9.0.0-rc.10
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/cli.js +34 -32
- package/dist/generators/componentManifest/createActions.d.ts +1 -1
- package/dist/generators/componentManifest/createActions.js +14 -6
- package/dist/generators/componentManifest/createConnections.d.ts +1 -1
- package/dist/generators/componentManifest/createConnections.js +26 -6
- package/dist/generators/componentManifest/createDataSources.d.ts +1 -1
- package/dist/generators/componentManifest/createDataSources.js +14 -6
- package/dist/generators/componentManifest/createStaticFiles.d.ts +1 -1
- package/dist/generators/componentManifest/createTriggers.d.ts +1 -1
- package/dist/generators/componentManifest/createTriggers.js +14 -6
- package/dist/generators/componentManifest/getImports.d.ts +1 -1
- package/dist/generators/componentManifest/getImports.js +6 -6
- package/dist/generators/componentManifest/getInputs.d.ts +18 -7
- package/dist/generators/componentManifest/getInputs.js +62 -28
- package/dist/generators/componentManifest/index.d.ts +4 -4
- package/dist/generators/componentManifest/index.js +4 -4
- package/dist/generators/componentManifest/removeComponentManifest.js +4 -2
- package/dist/generators/componentManifest/templates/actions/action.ts.ejs +9 -4
- package/dist/generators/componentManifest/templates/connections/connection.ts.ejs +12 -4
- package/dist/generators/componentManifest/templates/dataSources/dataSource.ts.ejs +9 -4
- package/dist/generators/componentManifest/templates/package.json.ejs +2 -1
- package/dist/generators/componentManifest/templates/partials/inputs.ejs +19 -0
- package/dist/generators/componentManifest/templates/partials/{inputTypes.ejs → performArgs.ejs} +1 -1
- package/dist/generators/componentManifest/templates/triggers/trigger.ts.ejs +9 -4
- package/dist/generators/utils/createDependencyImports.d.ts +1 -1
- package/dist/generators/utils/getComponentSignatureWithPrism.d.ts +5 -1
- package/dist/generators/utils/getComponentSignatureWithPrism.js +12 -9
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/serverTypes/convertIntegration.js +176 -46
- package/dist/serverTypes/index.d.ts +5 -1
- package/dist/types/ActionPerformFunction.d.ts +5 -1
- package/dist/types/ComponentManifest.d.ts +27 -4
- package/dist/types/ComponentRegistry.d.ts +83 -0
- package/dist/types/ComponentRegistry.js +5 -0
- package/dist/types/ConfigPages.d.ts +46 -0
- package/dist/types/ConfigPages.js +2 -0
- package/dist/types/ConfigVars.d.ts +138 -0
- package/dist/types/ConfigVars.js +18 -0
- package/dist/types/Inputs.d.ts +1 -1
- package/dist/types/IntegrationDefinition.d.ts +3 -184
- package/dist/types/IntegrationDefinition.js +0 -17
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/package.json +1 -1
- /package/dist/serverTypes/{convert.d.ts → convertComponent.d.ts} +0 -0
- /package/dist/serverTypes/{convert.js → convertComponent.js} +0 -0
|
@@ -17,6 +17,7 @@ exports.runMain = void 0;
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
19
|
const fs_extra_1 = require("fs-extra");
|
|
20
|
+
const lodash_1 = require("lodash");
|
|
20
21
|
const index_1 = require("./index");
|
|
21
22
|
const createFlagHelpText_1 = require("../utils/createFlagHelpText");
|
|
22
23
|
const getFlagStringValue_1 = require("../utils/getFlagStringValue");
|
|
@@ -26,30 +27,12 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
26
27
|
var _a, _b;
|
|
27
28
|
const componentDir = process.cwd();
|
|
28
29
|
const componentDistDir = path_1.default.join(componentDir, "dist", "index.js");
|
|
29
|
-
|
|
30
|
-
console.error("Please run this script using npm or yarn.");
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
if (!(0, fs_extra_1.existsSync)(componentDistDir)) {
|
|
34
|
-
console.error("Component build directory `dist` does not exist. Please verify that the component has been built.");
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
const component = require(componentDistDir).default;
|
|
38
|
-
if (!component ||
|
|
39
|
-
!(0, util_1.isObjectWithTruthyKeys)(component, ["key", "display"]) ||
|
|
40
|
-
!(0, util_1.isObjectWithOneTruthyKey)(component, [
|
|
41
|
-
"actions",
|
|
42
|
-
"connections",
|
|
43
|
-
"dataSources",
|
|
44
|
-
])) {
|
|
45
|
-
console.error("Component is invalid.");
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
30
|
+
const args = process.argv.slice(2);
|
|
48
31
|
const flags = {
|
|
49
32
|
name: {
|
|
50
33
|
flag: ["--name", "-n"],
|
|
51
34
|
value: (0, getFlagStringValue_1.getFlagsStringValue)({
|
|
52
|
-
args
|
|
35
|
+
args,
|
|
53
36
|
flags: ["--name", "-n"],
|
|
54
37
|
}),
|
|
55
38
|
description: "The name of the component manifest. Defaults to the name of the current component being generated.",
|
|
@@ -57,7 +40,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
57
40
|
verbose: {
|
|
58
41
|
flag: ["--verbose", "-v"],
|
|
59
42
|
value: (0, getFlagBooleanValue_1.getFlagsBooleanValue)({
|
|
60
|
-
args
|
|
43
|
+
args,
|
|
61
44
|
flags: ["--verbose", "-v"],
|
|
62
45
|
}),
|
|
63
46
|
description: "Provides more detailed or extensive information about the files being generated during the process.",
|
|
@@ -65,7 +48,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
65
48
|
output_dir: {
|
|
66
49
|
flag: ["--output-dir", "-o"],
|
|
67
50
|
value: (0, getFlagStringValue_1.getFlagsStringValue)({
|
|
68
|
-
args
|
|
51
|
+
args,
|
|
69
52
|
flags: ["--output-dir", "-o"],
|
|
70
53
|
}),
|
|
71
54
|
description: "The output directory for the component manifest. Defaults to the sibling of the current component directory.",
|
|
@@ -73,7 +56,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
73
56
|
registry: {
|
|
74
57
|
flag: ["--registry", "-r"],
|
|
75
58
|
value: (0, getFlagStringValue_1.getFlagsStringValue)({
|
|
76
|
-
args
|
|
59
|
+
args,
|
|
77
60
|
flags: ["--registry", "-r"],
|
|
78
61
|
}),
|
|
79
62
|
description: "The registry to publish the component manifest to (as a URI). This is where your package will be published. If not specified, it defaults to your system's default registry.",
|
|
@@ -81,23 +64,23 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
81
64
|
dry_run: {
|
|
82
65
|
flag: ["--dry-run", "-d"],
|
|
83
66
|
value: (0, getFlagBooleanValue_1.getFlagsBooleanValue)({
|
|
84
|
-
args
|
|
67
|
+
args,
|
|
85
68
|
flags: ["--dry-run", "-d"],
|
|
86
69
|
}),
|
|
87
70
|
description: "Perform a dry run without generating the component manifest. This provides a preview of what you could expect to happen when running the command without this flag.",
|
|
88
71
|
},
|
|
89
|
-
|
|
90
|
-
flag: ["--
|
|
72
|
+
skip_signature_verify: {
|
|
73
|
+
flag: ["--skip-signature-verify"],
|
|
91
74
|
value: (0, getFlagBooleanValue_1.getFlagsBooleanValue)({
|
|
92
|
-
args
|
|
93
|
-
flags: ["--
|
|
75
|
+
args,
|
|
76
|
+
flags: ["--skip-signature-verify"],
|
|
94
77
|
}),
|
|
95
|
-
description: "This
|
|
78
|
+
description: "This skips the signature verification process, always returning a component signature in the component manifest.",
|
|
96
79
|
},
|
|
97
80
|
help: {
|
|
98
81
|
flag: ["--help", "-h"],
|
|
99
82
|
value: (0, getFlagBooleanValue_1.getFlagsBooleanValue)({
|
|
100
|
-
args
|
|
83
|
+
args,
|
|
101
84
|
flags: ["--help", "-h"],
|
|
102
85
|
}),
|
|
103
86
|
description: "Show this help message.",
|
|
@@ -110,12 +93,31 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
110
93
|
});
|
|
111
94
|
process.exit(0);
|
|
112
95
|
}
|
|
96
|
+
if (!componentDir) {
|
|
97
|
+
console.error("Please run this script using npm or yarn.");
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
if (!(0, fs_extra_1.existsSync)(componentDistDir)) {
|
|
101
|
+
console.error("Component build directory `dist` does not exist. Please verify that the component has been built.");
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
const component = require(componentDistDir).default;
|
|
105
|
+
if (!component ||
|
|
106
|
+
!(0, util_1.isObjectWithTruthyKeys)(component, ["key", "display"]) ||
|
|
107
|
+
!(0, util_1.isObjectWithOneTruthyKey)(component, [
|
|
108
|
+
"actions",
|
|
109
|
+
"connections",
|
|
110
|
+
"dataSources",
|
|
111
|
+
])) {
|
|
112
|
+
console.error("Component is invalid.");
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
113
115
|
const packageJson = (0, fs_extra_1.readJsonSync)(path_1.default.join(__dirname, "../../../package.json"));
|
|
114
116
|
yield (0, index_1.createComponentManifest)({
|
|
115
117
|
component,
|
|
116
118
|
dryRun: flags.dry_run.value,
|
|
117
|
-
|
|
118
|
-
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@
|
|
119
|
+
skipSignatureVerify: flags.skip_signature_verify.value,
|
|
120
|
+
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@component-manifests/${(0, lodash_1.kebabCase)(component.key)}`,
|
|
119
121
|
dependencies: {
|
|
120
122
|
spectral: packageJson.version,
|
|
121
123
|
dependencies: packageJson.dependencies,
|
|
@@ -18,11 +18,19 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const DOC_BLOCK = [
|
|
22
|
+
{
|
|
23
|
+
propertyKey: "comments",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
propertyKey: "default",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
propertyKey: "example",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
propertyKey: "placeholder",
|
|
33
|
+
},
|
|
26
34
|
];
|
|
27
35
|
const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
36
|
var _a, _b;
|
|
@@ -43,7 +51,7 @@ const createActions = ({ component, dryRun, verbose, sourceDir, destinationDir,
|
|
|
43
51
|
const actions = yield Promise.all(Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
52
|
const inputs = (0, getInputs_1.getInputs)({
|
|
45
53
|
inputs: action.inputs,
|
|
46
|
-
|
|
54
|
+
docBlock: DOC_BLOCK,
|
|
47
55
|
});
|
|
48
56
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
49
57
|
return yield renderAction({
|
|
@@ -18,11 +18,29 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const DOC_BLOCK = [
|
|
22
|
+
{
|
|
23
|
+
propertyKey: "comments",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
propertyKey: "default",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
propertyKey: "example",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
propertyKey: "placeholder",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
propertyKey: "onPremControlled",
|
|
36
|
+
propertyValue: true,
|
|
37
|
+
output: "This input will be supplied when using an on prem resource.",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
propertyKey: "onPremiseControlled",
|
|
41
|
+
propertyValue: true,
|
|
42
|
+
output: "This input will be supplied when using an on prem resource.",
|
|
43
|
+
},
|
|
26
44
|
];
|
|
27
45
|
const createConnections = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
46
|
var _a, _b;
|
|
@@ -43,15 +61,17 @@ const createConnections = ({ component, dryRun, verbose, sourceDir, destinationD
|
|
|
43
61
|
const connections = yield Promise.all(((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
62
|
const inputs = (0, getInputs_1.getInputs)({
|
|
45
63
|
inputs: connection.inputs,
|
|
46
|
-
|
|
64
|
+
docBlock: DOC_BLOCK,
|
|
47
65
|
});
|
|
48
66
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
67
|
+
const onPremAvailable = connection.inputs.some((input) => input.onPremControlled || input.onPremiseControlled);
|
|
49
68
|
return yield renderConnection({
|
|
50
69
|
connection: {
|
|
51
70
|
key: connection.key,
|
|
52
71
|
label: connection.label,
|
|
53
72
|
comments: connection.comments,
|
|
54
73
|
inputs,
|
|
74
|
+
onPremAvailable,
|
|
55
75
|
},
|
|
56
76
|
imports,
|
|
57
77
|
dryRun,
|
|
@@ -18,11 +18,19 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const DOC_BLOCK = [
|
|
22
|
+
{
|
|
23
|
+
propertyKey: "comments",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
propertyKey: "default",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
propertyKey: "example",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
propertyKey: "placeholder",
|
|
33
|
+
},
|
|
26
34
|
];
|
|
27
35
|
const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
36
|
var _a, _b;
|
|
@@ -43,7 +51,7 @@ const createDataSources = ({ component, dryRun, verbose, sourceDir, destinationD
|
|
|
43
51
|
const dataSources = yield Promise.all(Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
52
|
const inputs = (0, getInputs_1.getInputs)({
|
|
45
53
|
inputs: dataSource.inputs,
|
|
46
|
-
|
|
54
|
+
docBlock: DOC_BLOCK,
|
|
47
55
|
});
|
|
48
56
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
49
57
|
return yield renderDataSource({
|
|
@@ -18,11 +18,19 @@ const getInputs_1 = require("./getInputs");
|
|
|
18
18
|
const getImports_1 = require("./getImports");
|
|
19
19
|
const helpers_1 = require("./helpers");
|
|
20
20
|
const createTemplate_1 = require("../utils/createTemplate");
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const DOC_BLOCK = [
|
|
22
|
+
{
|
|
23
|
+
propertyKey: "comments",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
propertyKey: "default",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
propertyKey: "example",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
propertyKey: "placeholder",
|
|
33
|
+
},
|
|
26
34
|
];
|
|
27
35
|
const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
36
|
var _a, _b;
|
|
@@ -43,7 +51,7 @@ const createTriggers = ({ component, dryRun, verbose, sourceDir, destinationDir,
|
|
|
43
51
|
const triggers = yield Promise.all(Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
52
|
const inputs = (0, getInputs_1.getInputs)({
|
|
45
53
|
inputs: trigger.inputs,
|
|
46
|
-
|
|
54
|
+
docBlock: DOC_BLOCK,
|
|
47
55
|
});
|
|
48
56
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
49
57
|
return yield renderTrigger({
|
|
@@ -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;
|
|
@@ -1,23 +1,34 @@
|
|
|
1
|
-
import { Input as
|
|
2
|
-
import { InputFieldDefinition } from "../../types/Inputs";
|
|
1
|
+
import type { Input as InputBase } from "../../serverTypes";
|
|
2
|
+
import type { InputFieldDefinition } from "../../types/Inputs";
|
|
3
|
+
declare type ServerTypeInput = InputBase & {
|
|
4
|
+
onPremControlled?: boolean;
|
|
5
|
+
shown?: boolean;
|
|
6
|
+
};
|
|
3
7
|
export interface Input {
|
|
4
8
|
key: string;
|
|
5
9
|
label: string;
|
|
6
|
-
|
|
10
|
+
inputType: string;
|
|
11
|
+
valueType: ValueType;
|
|
7
12
|
required: boolean | undefined;
|
|
8
13
|
properties: {
|
|
9
14
|
key: keyof ServerTypeInput;
|
|
10
15
|
value: string;
|
|
11
16
|
}[];
|
|
12
17
|
}
|
|
13
|
-
export declare type
|
|
18
|
+
export declare type ValueType = string | {
|
|
14
19
|
type: string;
|
|
15
20
|
module: string;
|
|
16
21
|
};
|
|
22
|
+
export declare type DocBlock = {
|
|
23
|
+
inputKey?: string;
|
|
24
|
+
propertyKey: keyof ServerTypeInput;
|
|
25
|
+
propertyValue?: unknown;
|
|
26
|
+
output?: string;
|
|
27
|
+
}[];
|
|
17
28
|
interface GetInputsProps {
|
|
18
29
|
inputs: ServerTypeInput[];
|
|
19
|
-
|
|
30
|
+
docBlock: DocBlock;
|
|
20
31
|
}
|
|
21
|
-
export declare const getInputs: ({ inputs,
|
|
22
|
-
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"],
|
|
32
|
+
export declare const getInputs: ({ inputs, docBlock }: GetInputsProps) => Input[];
|
|
33
|
+
export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], ValueType>;
|
|
23
34
|
export {};
|
|
@@ -1,32 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.INPUT_TYPE_MAP = exports.getInputs = void 0;
|
|
4
|
-
const getInputs = ({ inputs,
|
|
5
|
-
return inputs.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
const getInputs = ({ inputs, docBlock }) => {
|
|
5
|
+
return inputs.reduce((acc, input) => {
|
|
6
|
+
if ((typeof input.shown === "boolean" && input.shown === false) ||
|
|
7
|
+
input.type === "dynamicObjectSelection" ||
|
|
8
|
+
input.type === "dynamicFieldSelection") {
|
|
9
|
+
return acc;
|
|
10
|
+
}
|
|
11
|
+
return [
|
|
12
|
+
...acc,
|
|
13
|
+
{
|
|
14
|
+
key: input.key,
|
|
15
|
+
label: input.label,
|
|
16
|
+
inputType: input.type,
|
|
17
|
+
valueType: getInputValueType(input),
|
|
18
|
+
required: input.required &&
|
|
19
|
+
(input.default === undefined || input.default === ""),
|
|
20
|
+
collection: input.collection,
|
|
21
|
+
onPremControlled: input.onPremiseControlled || input.onPremControlled,
|
|
22
|
+
properties: docBlock.reduce((acc, { propertyKey, inputKey, propertyValue, output }) => {
|
|
23
|
+
if (inputKey && inputKey !== input.key) {
|
|
24
|
+
return acc;
|
|
25
|
+
}
|
|
26
|
+
if (output &&
|
|
27
|
+
(input[propertyKey] === propertyValue ||
|
|
28
|
+
typeof propertyValue === "undefined")) {
|
|
29
|
+
return [
|
|
30
|
+
...acc,
|
|
31
|
+
{
|
|
32
|
+
key: propertyKey,
|
|
33
|
+
value: output,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
if (typeof input[propertyKey] === "undefined" ||
|
|
38
|
+
input[propertyKey] === null ||
|
|
39
|
+
input[propertyKey] === "" ||
|
|
40
|
+
(typeof propertyValue !== "undefined" &&
|
|
41
|
+
input[propertyKey] !== propertyValue)) {
|
|
42
|
+
return acc;
|
|
43
|
+
}
|
|
44
|
+
return [
|
|
45
|
+
...acc,
|
|
46
|
+
{
|
|
47
|
+
key: propertyKey,
|
|
48
|
+
value: JSON.stringify(input[propertyKey])
|
|
49
|
+
.replace(/(^"|"$)|(^'|'$)/g, "")
|
|
50
|
+
.trim(),
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
}, []),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}, []);
|
|
30
57
|
};
|
|
31
58
|
exports.getInputs = getInputs;
|
|
32
59
|
exports.INPUT_TYPE_MAP = {
|
|
@@ -59,8 +86,15 @@ exports.INPUT_TYPE_MAP = {
|
|
|
59
86
|
dynamicObjectSelection: "string",
|
|
60
87
|
dynamicFieldSelection: "string",
|
|
61
88
|
};
|
|
62
|
-
const
|
|
63
|
-
|
|
89
|
+
const getInputValueType = (input) => {
|
|
90
|
+
const valueType = input.model
|
|
64
91
|
? input.model.map((choice) => `"${choice.value}"`).join(" | ")
|
|
65
92
|
: exports.INPUT_TYPE_MAP[input.type] || "never";
|
|
93
|
+
if (input.collection === "keyvaluelist") {
|
|
94
|
+
return `Record<string, ${valueType}> | Array<{key: string, value: ${valueType}}>`;
|
|
95
|
+
}
|
|
96
|
+
if (input.collection === "valuelist") {
|
|
97
|
+
return `${valueType}[]`;
|
|
98
|
+
}
|
|
99
|
+
return valueType;
|
|
66
100
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { PackageDependencies } from "./createStaticFiles";
|
|
2
|
-
import { Component } from "../../serverTypes";
|
|
1
|
+
import { type PackageDependencies } from "./createStaticFiles";
|
|
2
|
+
import type { Component } from "../../serverTypes";
|
|
3
3
|
interface CreateComponentManifestProps {
|
|
4
4
|
component: Component;
|
|
5
5
|
dryRun: boolean;
|
|
6
|
-
|
|
6
|
+
skipSignatureVerify: boolean;
|
|
7
7
|
packageName: string;
|
|
8
8
|
dependencies: PackageDependencies;
|
|
9
9
|
verbose: boolean;
|
|
@@ -11,5 +11,5 @@ interface CreateComponentManifestProps {
|
|
|
11
11
|
destinationDir: string;
|
|
12
12
|
registry: string | null;
|
|
13
13
|
}
|
|
14
|
-
export declare const createComponentManifest: ({ component, dryRun,
|
|
14
|
+
export declare const createComponentManifest: ({ component, dryRun, skipSignatureVerify, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }: CreateComponentManifestProps) => Promise<void>;
|
|
15
15
|
export {};
|
|
@@ -21,10 +21,10 @@ const createStaticFiles_1 = require("./createStaticFiles");
|
|
|
21
21
|
const createTriggers_1 = require("./createTriggers");
|
|
22
22
|
const removeComponentManifest_1 = require("./removeComponentManifest");
|
|
23
23
|
const getComponentSignatureWithPrism_1 = require("../utils/getComponentSignatureWithPrism");
|
|
24
|
-
const createComponentManifest = ({ component, dryRun,
|
|
25
|
-
const signature =
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const createComponentManifest = ({ component, dryRun, skipSignatureVerify, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
const signature = yield (0, getComponentSignatureWithPrism_1.getComponentSignatureWithPrism)({
|
|
26
|
+
skipSignatureVerify,
|
|
27
|
+
});
|
|
28
28
|
if (verbose) {
|
|
29
29
|
console.info(`Creating a component manifest for ${component.display.label}...`);
|
|
30
30
|
console.log("");
|
|
@@ -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,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) -%>
|
|
2
2
|
|
|
3
3
|
export interface <%= helpers.capitalizeFirstLetter(action.key) %>Values {
|
|
4
|
-
<%- include('../partials/
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: action.inputs }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,6 +9,11 @@ export interface <%= helpers.capitalizeFirstLetter(action.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @description <%= action.description %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= action.key %> =
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export const <%= action.key %> = {
|
|
13
|
+
perform: <TReturn>(
|
|
14
|
+
_values: <%= helpers.capitalizeFirstLetter(action.key) %>Values
|
|
15
|
+
): Promise<TReturn> => Promise.resolve<TReturn>({} as TReturn),
|
|
16
|
+
inputs: {
|
|
17
|
+
<%- include('../partials/inputs.ejs', { inputs: action.inputs }) -%>
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) -%>
|
|
2
2
|
|
|
3
3
|
export interface <%= helpers.capitalizeFirstLetter(connection.key) %>Values {
|
|
4
|
-
<%- include('../partials/
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: connection.inputs }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,6 +9,14 @@ export interface <%= helpers.capitalizeFirstLetter(connection.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @comments <%= connection.comments %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= connection.key %> =
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export const <%= connection.key %> = {
|
|
13
|
+
perform: (
|
|
14
|
+
_values: <%= helpers.capitalizeFirstLetter(connection.key) %>Values
|
|
15
|
+
): Promise<void> => Promise.resolve(),
|
|
16
|
+
<%_ if (connection.onPremAvailable) { -%>
|
|
17
|
+
onPremAvailable: true,
|
|
18
|
+
<%_ } -%>
|
|
19
|
+
inputs: {
|
|
20
|
+
<%- include('../partials/inputs.ejs', { inputs: connection.inputs }) -%>
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) -%>
|
|
2
2
|
|
|
3
3
|
export interface <%= helpers.capitalizeFirstLetter(dataSource.key) %>Values {
|
|
4
|
-
<%- include('../partials/
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: dataSource.inputs }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,6 +9,11 @@ export interface <%= helpers.capitalizeFirstLetter(dataSource.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @description <%= dataSource.description %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= dataSource.key %> =
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export const <%= dataSource.key %> = {
|
|
13
|
+
perform: (
|
|
14
|
+
_values: <%= helpers.capitalizeFirstLetter(dataSource.key) %>Values
|
|
15
|
+
): Promise<void> => Promise.resolve(),
|
|
16
|
+
inputs: {
|
|
17
|
+
<%- include('../partials/inputs.ejs', { inputs: dataSource.inputs }) -%>
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"version": "<%= helpers.generatePackageJsonVersion() %>",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"clean": "
|
|
6
|
+
"clean": "rimraf dist",
|
|
7
7
|
"build": "npm run clean && tsc",
|
|
8
8
|
"prepare": "npm run build"
|
|
9
9
|
},
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@prismatic-io/spectral": "<%= spectralVersion %>",
|
|
15
|
+
"rimraf": "5.0.7",
|
|
15
16
|
"typescript": "<%= typescriptVersion %>"
|
|
16
17
|
},
|
|
17
18
|
"peerDependencies": {
|