@prismatic-io/spectral 9.0.5 → 9.0.6
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 +1 -2
- package/dist/generators/componentManifest/createActions.js +11 -5
- package/dist/generators/componentManifest/createConnections.js +9 -5
- package/dist/generators/componentManifest/createDataSources.js +9 -5
- package/dist/generators/componentManifest/createTriggers.js +9 -5
- package/dist/generators/componentManifest/helpers.d.ts +1 -0
- package/dist/generators/componentManifest/helpers.js +2 -0
- package/dist/generators/componentManifest/templates/actions/action.ts.ejs +6 -5
- package/dist/generators/componentManifest/templates/actions/index.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/connections/connection.ts.ejs +6 -5
- package/dist/generators/componentManifest/templates/connections/index.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/dataSources/dataSource.ts.ejs +6 -5
- package/dist/generators/componentManifest/templates/dataSources/index.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/partials/importBarrel.ejs +2 -2
- package/dist/generators/componentManifest/templates/partials/inputs.ejs +1 -1
- package/dist/generators/componentManifest/templates/partials/performArgs.ejs +1 -1
- package/dist/generators/componentManifest/templates/triggers/index.ts.ejs +1 -1
- package/dist/generators/componentManifest/templates/triggers/trigger.ts.ejs +6 -5
- package/dist/generators/utils/createImport.d.ts +1 -0
- package/dist/generators/utils/createImport.js +6 -0
- package/dist/generators/utils/createTypeInterface.d.ts +1 -0
- package/dist/generators/utils/createTypeInterface.js +7 -0
- package/dist/generators/utils/formatType.d.ts +1 -0
- package/dist/generators/utils/formatType.js +5 -0
- package/dist/serverTypes/convertIntegration.js +13 -7
- package/dist/types/ComponentManifest.d.ts +4 -0
- package/package.json +1 -1
|
@@ -17,7 +17,6 @@ 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");
|
|
21
20
|
const index_1 = require("./index");
|
|
22
21
|
const createFlagHelpText_1 = require("../utils/createFlagHelpText");
|
|
23
22
|
const getFlagStringValue_1 = require("../utils/getFlagStringValue");
|
|
@@ -113,7 +112,7 @@ const runMain = (process) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
113
112
|
component,
|
|
114
113
|
dryRun: flags.dry_run.value,
|
|
115
114
|
skipSignatureVerify: flags.skip_signature_verify.value,
|
|
116
|
-
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@component-manifests/${
|
|
115
|
+
packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@component-manifests/${component.key}`,
|
|
117
116
|
dependencies: {
|
|
118
117
|
spectral: packageJson.version,
|
|
119
118
|
dependencies: packageJson.dependencies,
|
|
@@ -18,15 +18,18 @@ 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 createTypeInterface_1 = require("../utils/createTypeInterface");
|
|
22
|
+
const createImport_1 = require("../utils/createImport");
|
|
21
23
|
const createActions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
24
|
var _b, _c;
|
|
23
25
|
if (verbose) {
|
|
24
26
|
console.info("Creating actions...");
|
|
25
27
|
}
|
|
26
28
|
const actionIndex = yield renderActionsIndex({
|
|
27
|
-
|
|
29
|
+
imports: Object.entries((_b = component.actions) !== null && _b !== void 0 ? _b : {}).map(([actionKey, action]) => {
|
|
30
|
+
var _a;
|
|
28
31
|
return {
|
|
29
|
-
|
|
32
|
+
import: (0, createImport_1.createImport)((_a = action.key) !== null && _a !== void 0 ? _a : actionKey),
|
|
30
33
|
};
|
|
31
34
|
}),
|
|
32
35
|
dryRun,
|
|
@@ -35,12 +38,15 @@ const createActions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ compo
|
|
|
35
38
|
destinationDir,
|
|
36
39
|
});
|
|
37
40
|
const actions = yield Promise.all(Object.entries((_c = component.actions) !== null && _c !== void 0 ? _c : {}).map((_a) => __awaiter(void 0, [_a], void 0, function* ([actionKey, action]) {
|
|
41
|
+
var _b, _c;
|
|
38
42
|
const inputs = (0, getInputs_1.getInputs)({
|
|
39
43
|
inputs: action.inputs,
|
|
40
44
|
});
|
|
41
45
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
42
46
|
return yield renderAction({
|
|
43
47
|
action: {
|
|
48
|
+
typeInterface: (0, createTypeInterface_1.createTypeInterface)((_b = action.key) !== null && _b !== void 0 ? _b : actionKey),
|
|
49
|
+
import: (0, createImport_1.createImport)((_c = action.key) !== null && _c !== void 0 ? _c : actionKey),
|
|
44
50
|
key: action.key || actionKey,
|
|
45
51
|
label: action.display.description,
|
|
46
52
|
description: action.display.description,
|
|
@@ -62,12 +68,12 @@ const createActions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ compo
|
|
|
62
68
|
});
|
|
63
69
|
});
|
|
64
70
|
exports.createActions = createActions;
|
|
65
|
-
const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
71
|
+
const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
66
72
|
return yield (0, createTemplate_1.createTemplate)({
|
|
67
73
|
source: path_1.default.join(sourceDir, "actions", "index.ts.ejs"),
|
|
68
74
|
destination: path_1.default.join(destinationDir, "actions", "index.ts"),
|
|
69
75
|
data: {
|
|
70
|
-
|
|
76
|
+
imports,
|
|
71
77
|
},
|
|
72
78
|
dryRun,
|
|
73
79
|
verbose,
|
|
@@ -76,7 +82,7 @@ const renderActionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
76
82
|
const renderAction = (_a) => __awaiter(void 0, [_a], void 0, function* ({ action, dryRun, imports, verbose, sourceDir, destinationDir, }) {
|
|
77
83
|
return yield (0, createTemplate_1.createTemplate)({
|
|
78
84
|
source: path_1.default.join(sourceDir, "actions", "action.ts.ejs"),
|
|
79
|
-
destination: path_1.default.join(destinationDir, "actions", `${action.
|
|
85
|
+
destination: path_1.default.join(destinationDir, "actions", `${action.import}.ts`),
|
|
80
86
|
data: {
|
|
81
87
|
action,
|
|
82
88
|
helpers: helpers_1.helpers,
|
|
@@ -18,15 +18,17 @@ 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 createTypeInterface_1 = require("../utils/createTypeInterface");
|
|
22
|
+
const createImport_1 = require("../utils/createImport");
|
|
21
23
|
const createConnections = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
24
|
var _b, _c;
|
|
23
25
|
if (verbose) {
|
|
24
26
|
console.info("Creating connections...");
|
|
25
27
|
}
|
|
26
28
|
const connectionIndex = yield renderConnectionsIndex({
|
|
27
|
-
|
|
29
|
+
imports: ((_b = component.connections) !== null && _b !== void 0 ? _b : []).map((connection) => {
|
|
28
30
|
return {
|
|
29
|
-
|
|
31
|
+
import: (0, createImport_1.createImport)(connection.key),
|
|
30
32
|
};
|
|
31
33
|
}),
|
|
32
34
|
dryRun,
|
|
@@ -42,6 +44,8 @@ const createConnections = (_a) => __awaiter(void 0, [_a], void 0, function* ({ c
|
|
|
42
44
|
const onPremAvailable = connection.inputs.some((input) => input.onPremControlled || input.onPremiseControlled);
|
|
43
45
|
return yield renderConnection({
|
|
44
46
|
connection: {
|
|
47
|
+
typeInterface: (0, createTypeInterface_1.createTypeInterface)(connection.key),
|
|
48
|
+
import: (0, createImport_1.createImport)(connection.key),
|
|
45
49
|
key: connection.key,
|
|
46
50
|
label: connection.label,
|
|
47
51
|
comments: connection.comments,
|
|
@@ -64,12 +68,12 @@ const createConnections = (_a) => __awaiter(void 0, [_a], void 0, function* ({ c
|
|
|
64
68
|
});
|
|
65
69
|
});
|
|
66
70
|
exports.createConnections = createConnections;
|
|
67
|
-
const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
71
|
+
const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
68
72
|
return yield (0, createTemplate_1.createTemplate)({
|
|
69
73
|
source: path_1.default.join(sourceDir, "connections", "index.ts.ejs"),
|
|
70
74
|
destination: path_1.default.join(destinationDir, "connections", "index.ts"),
|
|
71
75
|
data: {
|
|
72
|
-
|
|
76
|
+
imports,
|
|
73
77
|
},
|
|
74
78
|
dryRun,
|
|
75
79
|
verbose,
|
|
@@ -78,7 +82,7 @@ const renderConnectionsIndex = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
78
82
|
const renderConnection = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connection, dryRun, imports, verbose, sourceDir, destinationDir, }) {
|
|
79
83
|
return yield (0, createTemplate_1.createTemplate)({
|
|
80
84
|
source: path_1.default.join(sourceDir, "connections", "connection.ts.ejs"),
|
|
81
|
-
destination: path_1.default.join(destinationDir, "connections", `${connection.
|
|
85
|
+
destination: path_1.default.join(destinationDir, "connections", `${connection.import}.ts`),
|
|
82
86
|
data: {
|
|
83
87
|
connection,
|
|
84
88
|
helpers: helpers_1.helpers,
|
|
@@ -18,15 +18,17 @@ 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 createTypeInterface_1 = require("../utils/createTypeInterface");
|
|
22
|
+
const createImport_1 = require("../utils/createImport");
|
|
21
23
|
const createDataSources = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
24
|
var _b, _c;
|
|
23
25
|
if (verbose) {
|
|
24
26
|
console.info("Creating data sources...");
|
|
25
27
|
}
|
|
26
28
|
const dataSourceIndex = yield renderDataSourcesIndex({
|
|
27
|
-
|
|
29
|
+
imports: Object.entries((_b = component.dataSources) !== null && _b !== void 0 ? _b : {}).map(([dataSourceKey, dataSource]) => {
|
|
28
30
|
return {
|
|
29
|
-
|
|
31
|
+
import: (0, createImport_1.createImport)(dataSource.key || dataSourceKey),
|
|
30
32
|
};
|
|
31
33
|
}),
|
|
32
34
|
dryRun,
|
|
@@ -41,6 +43,8 @@ const createDataSources = (_a) => __awaiter(void 0, [_a], void 0, function* ({ c
|
|
|
41
43
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
42
44
|
return yield renderDataSource({
|
|
43
45
|
dataSource: {
|
|
46
|
+
type: (0, createTypeInterface_1.createTypeInterface)(dataSource.key || dataSourceKey),
|
|
47
|
+
import: (0, createImport_1.createImport)(dataSource.key || dataSourceKey),
|
|
44
48
|
key: dataSource.key || dataSourceKey,
|
|
45
49
|
label: dataSource.display.label,
|
|
46
50
|
description: dataSource.display.description,
|
|
@@ -63,12 +67,12 @@ const createDataSources = (_a) => __awaiter(void 0, [_a], void 0, function* ({ c
|
|
|
63
67
|
});
|
|
64
68
|
});
|
|
65
69
|
exports.createDataSources = createDataSources;
|
|
66
|
-
const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
70
|
+
const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
67
71
|
return yield (0, createTemplate_1.createTemplate)({
|
|
68
72
|
source: path_1.default.join(sourceDir, "dataSources", "index.ts.ejs"),
|
|
69
73
|
destination: path_1.default.join(destinationDir, "dataSources", "index.ts"),
|
|
70
74
|
data: {
|
|
71
|
-
|
|
75
|
+
imports,
|
|
72
76
|
},
|
|
73
77
|
dryRun,
|
|
74
78
|
verbose,
|
|
@@ -77,7 +81,7 @@ const renderDataSourcesIndex = (_a) => __awaiter(void 0, [_a], void 0, function*
|
|
|
77
81
|
const renderDataSource = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dataSource, dryRun, imports, verbose, sourceDir, destinationDir, }) {
|
|
78
82
|
return yield (0, createTemplate_1.createTemplate)({
|
|
79
83
|
source: path_1.default.join(sourceDir, "dataSources", "dataSource.ts.ejs"),
|
|
80
|
-
destination: path_1.default.join(destinationDir, "dataSources", `${dataSource.
|
|
84
|
+
destination: path_1.default.join(destinationDir, "dataSources", `${dataSource.import}.ts`),
|
|
81
85
|
data: {
|
|
82
86
|
dataSource,
|
|
83
87
|
helpers: helpers_1.helpers,
|
|
@@ -18,15 +18,17 @@ 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 createTypeInterface_1 = require("../utils/createTypeInterface");
|
|
22
|
+
const createImport_1 = require("../utils/createImport");
|
|
21
23
|
const createTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ component, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
22
24
|
var _b, _c;
|
|
23
25
|
if (verbose) {
|
|
24
26
|
console.info("Creating triggers...");
|
|
25
27
|
}
|
|
26
28
|
const triggersIndex = yield renderTriggersIndex({
|
|
27
|
-
|
|
29
|
+
imports: Object.entries((_b = component.triggers) !== null && _b !== void 0 ? _b : {}).map(([triggerKey, trigger]) => {
|
|
28
30
|
return {
|
|
29
|
-
|
|
31
|
+
import: (0, createImport_1.createImport)(trigger.key || triggerKey),
|
|
30
32
|
};
|
|
31
33
|
}),
|
|
32
34
|
dryRun,
|
|
@@ -41,6 +43,8 @@ const createTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ comp
|
|
|
41
43
|
const imports = (0, getImports_1.getImports)({ inputs });
|
|
42
44
|
return yield renderTrigger({
|
|
43
45
|
trigger: {
|
|
46
|
+
typeInterface: (0, createTypeInterface_1.createTypeInterface)(trigger.key || triggerKey),
|
|
47
|
+
import: (0, createImport_1.createImport)(trigger.key || triggerKey),
|
|
44
48
|
key: trigger.key || triggerKey,
|
|
45
49
|
label: trigger.display.description,
|
|
46
50
|
description: trigger.display.description,
|
|
@@ -62,12 +66,12 @@ const createTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ comp
|
|
|
62
66
|
});
|
|
63
67
|
});
|
|
64
68
|
exports.createTriggers = createTriggers;
|
|
65
|
-
const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
69
|
+
const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({ imports, dryRun, verbose, sourceDir, destinationDir, }) {
|
|
66
70
|
return yield (0, createTemplate_1.createTemplate)({
|
|
67
71
|
source: path_1.default.join(sourceDir, "triggers", "index.ts.ejs"),
|
|
68
72
|
destination: path_1.default.join(destinationDir, "triggers", "index.ts"),
|
|
69
73
|
data: {
|
|
70
|
-
|
|
74
|
+
imports,
|
|
71
75
|
},
|
|
72
76
|
dryRun,
|
|
73
77
|
verbose,
|
|
@@ -76,7 +80,7 @@ const renderTriggersIndex = (_a) => __awaiter(void 0, [_a], void 0, function* ({
|
|
|
76
80
|
const renderTrigger = (_a) => __awaiter(void 0, [_a], void 0, function* ({ dryRun, imports, trigger, verbose, sourceDir, destinationDir, }) {
|
|
77
81
|
return yield (0, createTemplate_1.createTemplate)({
|
|
78
82
|
source: path_1.default.join(sourceDir, "triggers", "trigger.ts.ejs"),
|
|
79
|
-
destination: path_1.default.join(destinationDir, "triggers", `${trigger.
|
|
83
|
+
destination: path_1.default.join(destinationDir, "triggers", `${trigger.import}.ts`),
|
|
80
84
|
data: {
|
|
81
85
|
helpers: helpers_1.helpers,
|
|
82
86
|
imports,
|
|
@@ -2,4 +2,5 @@ export declare const helpers: {
|
|
|
2
2
|
createDependencyImports: ({ imports }: import("../utils/createDependencyImports").CreateDependencyImportsProps) => string[];
|
|
3
3
|
capitalizeFirstLetter: (value: string) => string;
|
|
4
4
|
generatePackageJsonVersion: () => string;
|
|
5
|
+
formatType: (key: string) => string;
|
|
5
6
|
};
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.helpers = void 0;
|
|
4
4
|
const capitalizeFirstLetter_1 = require("../utils/capitalizeFirstLetter");
|
|
5
5
|
const createDependencyImports_1 = require("../utils/createDependencyImports");
|
|
6
|
+
const formatType_1 = require("../utils/formatType");
|
|
6
7
|
const generatePackageJsonVersion_1 = require("../utils/generatePackageJsonVersion");
|
|
7
8
|
exports.helpers = {
|
|
8
9
|
createDependencyImports: createDependencyImports_1.createDependencyImports,
|
|
9
10
|
capitalizeFirstLetter: capitalizeFirstLetter_1.capitalizeFirstLetter,
|
|
10
11
|
generatePackageJsonVersion: generatePackageJsonVersion_1.generatePackageJsonVersion,
|
|
12
|
+
formatType: formatType_1.formatType,
|
|
11
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) %>
|
|
2
2
|
|
|
3
|
-
export interface <%=
|
|
4
|
-
<%- include('../partials/performArgs.ejs', { inputs: action.inputs }) -%>
|
|
3
|
+
export interface <%= action.typeInterface %>Values {
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: action.inputs, helpers }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,11 +9,12 @@ export interface <%= helpers.capitalizeFirstLetter(action.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @description <%- action.description %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= action.
|
|
12
|
+
export const <%= action.import %> = {
|
|
13
|
+
key: "<%= action.key %>",
|
|
13
14
|
perform: <TReturn>(
|
|
14
|
-
_values: <%=
|
|
15
|
+
_values: <%= action.typeInterface %>Values
|
|
15
16
|
): Promise<TReturn> => Promise.resolve<TReturn>({} as TReturn),
|
|
16
17
|
inputs: {
|
|
17
|
-
<%- include('../partials/inputs.ejs', { inputs: action.inputs }) -%>
|
|
18
|
+
<%- include('../partials/inputs.ejs', { inputs: action.inputs, helpers }) -%>
|
|
18
19
|
}
|
|
19
20
|
} as const;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%- include('../partials/importBarrel.ejs', { imports
|
|
1
|
+
<%- include('../partials/importBarrel.ejs', { imports }) -%>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) %>
|
|
2
2
|
|
|
3
|
-
export interface <%=
|
|
4
|
-
<%- include('../partials/performArgs.ejs', { inputs: connection.inputs }) -%>
|
|
3
|
+
export interface <%= connection.typeInterface %>Values {
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: connection.inputs, helpers }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,14 +9,15 @@ export interface <%= helpers.capitalizeFirstLetter(connection.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @comments <%- connection.comments %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= connection.
|
|
12
|
+
export const <%= connection.import %> = {
|
|
13
|
+
key: "<%= connection.key %>",
|
|
13
14
|
perform: (
|
|
14
|
-
_values: <%=
|
|
15
|
+
_values: <%= connection.typeInterface %>Values
|
|
15
16
|
): Promise<void> => Promise.resolve(),
|
|
16
17
|
<%_ if (connection.onPremAvailable) { -%>
|
|
17
18
|
onPremAvailable: true,
|
|
18
19
|
<%_ } -%>
|
|
19
20
|
inputs: {
|
|
20
|
-
<%- include('../partials/inputs.ejs', { inputs: connection.inputs }) -%>
|
|
21
|
+
<%- include('../partials/inputs.ejs', { inputs: connection.inputs, helpers }) -%>
|
|
21
22
|
}
|
|
22
23
|
} as const;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%- include('../partials/importBarrel.ejs', { imports
|
|
1
|
+
<%- include('../partials/importBarrel.ejs', { imports }) -%>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) %>
|
|
2
2
|
|
|
3
|
-
export interface <%=
|
|
4
|
-
<%- include('../partials/performArgs.ejs', { inputs: dataSource.inputs }) -%>
|
|
3
|
+
export interface <%= dataSource.typeInterface %>Values {
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: dataSource.inputs, helpers }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,12 +9,13 @@ export interface <%= helpers.capitalizeFirstLetter(dataSource.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @description <%- dataSource.description %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= dataSource.
|
|
12
|
+
export const <%= dataSource.import %> = {
|
|
13
|
+
key: "<%= dataSource.key %>",
|
|
13
14
|
perform: (
|
|
14
|
-
_values: <%=
|
|
15
|
+
_values: <%= dataSource.typeInterface %>Values
|
|
15
16
|
): Promise<void> => Promise.resolve(),
|
|
16
17
|
dataSourceType: "<%= dataSource.dataSourceType %>",
|
|
17
18
|
inputs: {
|
|
18
|
-
<%- include('../partials/inputs.ejs', { inputs: dataSource.inputs }) -%>
|
|
19
|
+
<%- include('../partials/inputs.ejs', { inputs: dataSource.inputs, helpers }) -%>
|
|
19
20
|
}
|
|
20
21
|
} as const;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%- include('../partials/importBarrel.ejs', { imports
|
|
1
|
+
<%- include('../partials/importBarrel.ejs', { imports }) -%>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<% imports.forEach((item) => { -%>
|
|
2
|
-
import { <%= item.
|
|
2
|
+
import { <%= item.import %> } from "./<%= item.import %>";
|
|
3
3
|
<% }); -%>
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
<%_ imports.forEach((item) => { -%>
|
|
7
|
-
<%= item.
|
|
7
|
+
<%= item.import %>,
|
|
8
8
|
<%_ }); -%>
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<% inputs.forEach((input) => { -%>
|
|
2
2
|
<%- input.docBlock -%>
|
|
3
|
-
|
|
3
|
+
<%- helpers.formatType(input.key) %><%= input.required ? "" : "?" %>: <%- input.valueType.type ? input.valueType.type : input.valueType %>;
|
|
4
4
|
<% }); -%>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<%- include('../partials/importBarrel.ejs', { imports
|
|
1
|
+
<%- include('../partials/importBarrel.ejs', { imports }) -%>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%- include('../partials/imports.ejs', { imports, helpers }) %>
|
|
2
2
|
|
|
3
|
-
export interface <%=
|
|
4
|
-
<%- include('../partials/performArgs.ejs', { inputs: trigger.inputs }) -%>
|
|
3
|
+
export interface <%= trigger.typeInterface %>Values {
|
|
4
|
+
<%- include('../partials/performArgs.ejs', { inputs: trigger.inputs, helpers }) -%>
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,11 +9,12 @@ export interface <%= helpers.capitalizeFirstLetter(trigger.key) %>Values {
|
|
|
9
9
|
*
|
|
10
10
|
* @description <%- trigger.description %>
|
|
11
11
|
*/
|
|
12
|
-
export const <%= trigger.
|
|
12
|
+
export const <%= trigger.import %> = {
|
|
13
|
+
key: "<%= trigger.key %>",
|
|
13
14
|
perform: <TReturn>(
|
|
14
|
-
_values: <%=
|
|
15
|
+
_values: <%= trigger.typeInterface %>Values
|
|
15
16
|
): Promise<TReturn> => Promise.resolve<TReturn>({} as TReturn),
|
|
16
17
|
inputs: {
|
|
17
|
-
<%- include('../partials/inputs.ejs', { inputs: trigger.inputs }) -%>
|
|
18
|
+
<%- include('../partials/inputs.ejs', { inputs: trigger.inputs, helpers }) -%>
|
|
18
19
|
}
|
|
19
20
|
} as const;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createImport: (key: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createTypeInterface: (key: string) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTypeInterface = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const capitalizeFirstLetter_1 = require("./capitalizeFirstLetter");
|
|
6
|
+
const createTypeInterface = (key) => (0, capitalizeFirstLetter_1.capitalizeFirstLetter)((0, lodash_1.camelCase)(key));
|
|
7
|
+
exports.createTypeInterface = createTypeInterface;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatType: (key: string) => string;
|
|
@@ -156,21 +156,25 @@ const convertConfigVarPermissionAndVisibility = ({ permissionAndVisibilityType,
|
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
158
|
const convertComponentReference = (componentReference, componentRegistry, referenceType) => {
|
|
159
|
-
var _a, _b;
|
|
159
|
+
var _a, _b, _c;
|
|
160
160
|
const manifest = componentRegistry[componentReference.component];
|
|
161
161
|
if (!manifest) {
|
|
162
162
|
throw new Error(`Component with key "${componentReference.component}" not found in component registry.`);
|
|
163
163
|
}
|
|
164
|
+
const manifestEntry = manifest[referenceType][componentReference.key];
|
|
165
|
+
if (!manifestEntry) {
|
|
166
|
+
throw new Error(`Component with key "${componentReference.component}" does not have an entry with key "${componentReference.key}" in the component registry.`);
|
|
167
|
+
}
|
|
164
168
|
const ref = {
|
|
165
169
|
component: {
|
|
166
170
|
key: manifest.key,
|
|
167
171
|
signature: (_a = manifest.signature) !== null && _a !== void 0 ? _a : "",
|
|
168
172
|
isPublic: manifest.public,
|
|
169
173
|
},
|
|
170
|
-
key
|
|
174
|
+
// older versions of the manifest did not contain a key so we fall back to the componentReference key
|
|
175
|
+
key: (_b = manifestEntry.key) !== null && _b !== void 0 ? _b : componentReference.key,
|
|
171
176
|
};
|
|
172
|
-
const
|
|
173
|
-
const inputs = Object.entries((_b = componentReference.values) !== null && _b !== void 0 ? _b : {}).reduce((result, [key, value]) => {
|
|
177
|
+
const inputs = Object.entries((_c = componentReference.values) !== null && _c !== void 0 ? _c : {}).reduce((result, [key, value]) => {
|
|
174
178
|
const manifestEntryInput = manifestEntry.inputs[key];
|
|
175
179
|
const type = manifestEntryInput.collection
|
|
176
180
|
? "complex"
|
|
@@ -397,9 +401,10 @@ const convertOnExecution = (onExecution, componentRegistry) => (context, params)
|
|
|
397
401
|
const invoke = _components.invoke;
|
|
398
402
|
// Construct the component methods from the component registry
|
|
399
403
|
const componentMethods = Object.entries(componentRegistry).reduce((accumulator, [registryComponentKey, { key: componentKey, actions, public: isPublic, signature }]) => {
|
|
400
|
-
const componentActions = Object.entries(actions).reduce((actionsAccumulator, [
|
|
404
|
+
const componentActions = Object.entries(actions).reduce((actionsAccumulator, [registryActionKey, action]) => {
|
|
401
405
|
// Define the method to be called for the action
|
|
402
406
|
const invokeAction = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
407
|
+
var _a;
|
|
403
408
|
// Transform the input values based on the action's inputs
|
|
404
409
|
const transformedValues = Object.entries(values).reduce((transformedAccumulator, [inputKey, inputValue]) => {
|
|
405
410
|
const { collection } = action.inputs[inputKey];
|
|
@@ -412,10 +417,11 @@ const convertOnExecution = (onExecution, componentRegistry) => (context, params)
|
|
|
412
417
|
signature: signature !== null && signature !== void 0 ? signature : "",
|
|
413
418
|
isPublic,
|
|
414
419
|
},
|
|
415
|
-
key
|
|
420
|
+
// older versions of manifests did not contain action.key so we fall back to the registry key
|
|
421
|
+
key: (_a = action.key) !== null && _a !== void 0 ? _a : registryActionKey,
|
|
416
422
|
}, context, transformedValues);
|
|
417
423
|
});
|
|
418
|
-
return Object.assign(Object.assign({}, actionsAccumulator), { [
|
|
424
|
+
return Object.assign(Object.assign({}, actionsAccumulator), { [registryActionKey]: invokeAction });
|
|
419
425
|
}, {});
|
|
420
426
|
return Object.assign(Object.assign({}, accumulator), { [registryComponentKey]: componentActions });
|
|
421
427
|
}, {});
|
|
@@ -15,19 +15,23 @@ interface BaseInput {
|
|
|
15
15
|
default?: unknown;
|
|
16
16
|
}
|
|
17
17
|
export interface ComponentManifestAction {
|
|
18
|
+
key: string;
|
|
18
19
|
perform: (values: any) => Promise<unknown>;
|
|
19
20
|
inputs: Record<string, BaseInput>;
|
|
20
21
|
}
|
|
21
22
|
export interface ComponentManifestTrigger {
|
|
23
|
+
key: string;
|
|
22
24
|
perform: (values: any) => Promise<unknown>;
|
|
23
25
|
inputs: Record<string, BaseInput>;
|
|
24
26
|
}
|
|
25
27
|
export interface ComponentManifestDataSource {
|
|
28
|
+
key: string;
|
|
26
29
|
perform: (values: any) => Promise<unknown>;
|
|
27
30
|
dataSourceType: DataSourceType;
|
|
28
31
|
inputs: Record<string, BaseInput>;
|
|
29
32
|
}
|
|
30
33
|
export interface ComponentManifestConnection {
|
|
34
|
+
key: string;
|
|
31
35
|
perform: (values: any) => Promise<unknown>;
|
|
32
36
|
onPremAvailable?: boolean;
|
|
33
37
|
inputs: Record<string, BaseInput & {
|