@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.
Files changed (47) hide show
  1. package/dist/generators/componentManifest/cli.js +34 -32
  2. package/dist/generators/componentManifest/createActions.d.ts +1 -1
  3. package/dist/generators/componentManifest/createActions.js +14 -6
  4. package/dist/generators/componentManifest/createConnections.d.ts +1 -1
  5. package/dist/generators/componentManifest/createConnections.js +26 -6
  6. package/dist/generators/componentManifest/createDataSources.d.ts +1 -1
  7. package/dist/generators/componentManifest/createDataSources.js +14 -6
  8. package/dist/generators/componentManifest/createStaticFiles.d.ts +1 -1
  9. package/dist/generators/componentManifest/createTriggers.d.ts +1 -1
  10. package/dist/generators/componentManifest/createTriggers.js +14 -6
  11. package/dist/generators/componentManifest/getImports.d.ts +1 -1
  12. package/dist/generators/componentManifest/getImports.js +6 -6
  13. package/dist/generators/componentManifest/getInputs.d.ts +18 -7
  14. package/dist/generators/componentManifest/getInputs.js +62 -28
  15. package/dist/generators/componentManifest/index.d.ts +4 -4
  16. package/dist/generators/componentManifest/index.js +4 -4
  17. package/dist/generators/componentManifest/removeComponentManifest.js +4 -2
  18. package/dist/generators/componentManifest/templates/actions/action.ts.ejs +9 -4
  19. package/dist/generators/componentManifest/templates/connections/connection.ts.ejs +12 -4
  20. package/dist/generators/componentManifest/templates/dataSources/dataSource.ts.ejs +9 -4
  21. package/dist/generators/componentManifest/templates/package.json.ejs +2 -1
  22. package/dist/generators/componentManifest/templates/partials/inputs.ejs +19 -0
  23. package/dist/generators/componentManifest/templates/partials/{inputTypes.ejs → performArgs.ejs} +1 -1
  24. package/dist/generators/componentManifest/templates/triggers/trigger.ts.ejs +9 -4
  25. package/dist/generators/utils/createDependencyImports.d.ts +1 -1
  26. package/dist/generators/utils/getComponentSignatureWithPrism.d.ts +5 -1
  27. package/dist/generators/utils/getComponentSignatureWithPrism.js +12 -9
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.js +2 -2
  30. package/dist/serverTypes/convertIntegration.js +176 -46
  31. package/dist/serverTypes/index.d.ts +5 -1
  32. package/dist/types/ActionPerformFunction.d.ts +5 -1
  33. package/dist/types/ComponentManifest.d.ts +27 -4
  34. package/dist/types/ComponentRegistry.d.ts +83 -0
  35. package/dist/types/ComponentRegistry.js +5 -0
  36. package/dist/types/ConfigPages.d.ts +46 -0
  37. package/dist/types/ConfigPages.js +2 -0
  38. package/dist/types/ConfigVars.d.ts +138 -0
  39. package/dist/types/ConfigVars.js +18 -0
  40. package/dist/types/Inputs.d.ts +1 -1
  41. package/dist/types/IntegrationDefinition.d.ts +3 -184
  42. package/dist/types/IntegrationDefinition.js +0 -17
  43. package/dist/types/index.d.ts +3 -0
  44. package/dist/types/index.js +3 -0
  45. package/package.json +1 -1
  46. /package/dist/serverTypes/{convert.d.ts → convertComponent.d.ts} +0 -0
  47. /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
- if (!componentDir) {
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: process.argv.slice(3),
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: process.argv.slice(3),
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: process.argv.slice(3),
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: process.argv.slice(3),
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: process.argv.slice(3),
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
- include_signature: {
90
- flag: ["--include-signature", "-s"],
72
+ skip_signature_verify: {
73
+ flag: ["--skip-signature-verify"],
91
74
  value: (0, getFlagBooleanValue_1.getFlagsBooleanValue)({
92
- args: process.argv.slice(3),
93
- flags: ["--include-signature", "-s"],
75
+ args,
76
+ flags: ["--skip-signature-verify"],
94
77
  }),
95
- description: "This will include the published component's signature key. Allowing you to publish the Code Native Integrations (CNI) where this component manifest is used.",
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: process.argv.slice(3),
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
- includeSignature: flags.include_signature.value,
118
- packageName: (_a = flags.name.value) !== null && _a !== void 0 ? _a : `@components/${component.key}-manifest`,
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,
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateActionsProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -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 DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
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
- documentProperties: DOCUMENT_PROPERTIES,
54
+ docBlock: DOC_BLOCK,
47
55
  });
48
56
  const imports = (0, getImports_1.getImports)({ inputs });
49
57
  return yield renderAction({
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateConnectionsProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -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 DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
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
- documentProperties: DOCUMENT_PROPERTIES,
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,
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateDataSourcesProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -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 DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
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
- documentProperties: DOCUMENT_PROPERTIES,
54
+ docBlock: DOC_BLOCK,
47
55
  });
48
56
  const imports = (0, getImports_1.getImports)({ inputs });
49
57
  return yield renderDataSource({
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  export interface PackageDependencies {
3
3
  spectral: string;
4
4
  dependencies: Record<string, string>;
@@ -1,4 +1,4 @@
1
- import { Component } from "../../serverTypes";
1
+ import type { Component } from "../../serverTypes";
2
2
  interface CreateTriggersProps {
3
3
  component: Component;
4
4
  dryRun: boolean;
@@ -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 DOCUMENT_PROPERTIES = [
22
- "comments",
23
- "default",
24
- "example",
25
- "placeholder",
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
- documentProperties: DOCUMENT_PROPERTIES,
54
+ docBlock: DOC_BLOCK,
47
55
  });
48
56
  const imports = (0, getImports_1.getImports)({ inputs });
49
57
  return yield renderTrigger({
@@ -1,4 +1,4 @@
1
- import { Input } from "./getInputs";
1
+ import type { Input } from "./getInputs";
2
2
  export declare type Imports = Record<string, string[]>;
3
3
  interface GetImportsProps {
4
4
  inputs: Input[];
@@ -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.type === "string") {
6
+ if (typeof input.valueType === "string") {
7
7
  return acc;
8
8
  }
9
- return Object.assign(Object.assign({}, acc), { [input.type.module]: acc[input.type.module]
10
- ? !acc[input.type.module].includes(input.type.type)
11
- ? [...acc[input.type.module], input.type.type]
12
- : acc[input.type.module]
13
- : [input.type.type] });
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 ServerTypeInput } from "../../serverTypes";
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
- type: InputType;
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 InputType = string | {
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
- documentProperties: (keyof ServerTypeInput)[];
30
+ docBlock: DocBlock;
20
31
  }
21
- export declare const getInputs: ({ inputs, documentProperties, }: GetInputsProps) => Input[];
22
- export declare const INPUT_TYPE_MAP: Record<InputFieldDefinition["type"], InputType>;
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, documentProperties, }) => {
5
- return inputs.map((input) => {
6
- return {
7
- key: input.key,
8
- label: input.label,
9
- type: getInputType(input),
10
- required: input.required,
11
- properties: documentProperties.reduce((acc, key) => {
12
- const value = input[key]
13
- ? JSON.stringify(input[key])
14
- .replace(/(^"|"$)|(^'|'$)/g, "")
15
- .trim()
16
- : null;
17
- if (typeof value === "undefined" || value === null || value === "") {
18
- return acc;
19
- }
20
- return [
21
- ...acc,
22
- {
23
- key,
24
- value,
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 getInputType = (input) => {
63
- return input.model
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
- includeSignature: boolean;
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, includeSignature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }: CreateComponentManifestProps) => Promise<void>;
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, includeSignature, packageName, dependencies, verbose, sourceDir, destinationDir, registry, }) => __awaiter(void 0, void 0, void 0, function* () {
25
- const signature = includeSignature
26
- ? yield (0, getComponentSignatureWithPrism_1.getComponentSignatureWithPrism)()
27
- : null;
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 fs_extra_1 = require("fs-extra");
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, fs_extra_1.removeSync)(destinationDir);
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/inputTypes.ejs', { inputs: action.inputs }) -%>
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 %> = <TReturn>(
13
- _values: <%= helpers.capitalizeFirstLetter(action.key) %>Values
14
- ): Promise<TReturn> => Promise.resolve<TReturn>({} as TReturn);
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/inputTypes.ejs', { inputs: connection.inputs }) -%>
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 %> = <TReturn>(
13
- _values: <%= helpers.capitalizeFirstLetter(connection.key) %>Values
14
- ): Promise<TReturn> => Promise.resolve<TReturn>({} as TReturn);
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/inputTypes.ejs', { inputs: dataSource.inputs }) -%>
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 %> = <TReturn>(
13
- _values: <%= helpers.capitalizeFirstLetter(dataSource.key) %>Values
14
- ): Promise<TReturn> => Promise.resolve<TReturn>({} as TReturn);
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": "rm -rf dist",
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": {