@prismatic-io/spectral 8.0.0 → 8.0.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.
package/dist/index.d.ts CHANGED
@@ -3,8 +3,9 @@
3
3
  * authors create inputs, actions, and components that can
4
4
  * be processed by the Prismatic API.
5
5
  */
6
- import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVar, ConfigVarResultCollection, ConfigVarCollection, TriggerPayload } from "./types";
7
- import { convertComponent, convertIntegration } from "./serverTypes/convert";
6
+ import { ActionDefinition, InputFieldDefinition, ComponentDefinition, DefaultConnectionDefinition, OAuth2ConnectionDefinition, Inputs, TriggerDefinition, ActionPerformReturn, TriggerResult, DataSourceDefinition, IntegrationDefinition, Flow, ConfigPage, StandardConfigVar, ConnectionConfigVar, ConfigVarResultCollection, TriggerPayload, DataSourceConfigVar, ConfigPages } from "./types";
7
+ import { convertComponent } from "./serverTypes/convert";
8
+ import { convertIntegration } from "./serverTypes/convertIntegration";
8
9
  /**
9
10
  * This function creates a Integration object that can be
10
11
  * imported into the Prismatic API. For information on using
@@ -13,21 +14,21 @@ import { convertComponent, convertIntegration } from "./serverTypes/convert";
13
14
  * @param definition An IntegrationDefinition type object.
14
15
  * @returns This function returns an integration object that has the shape the Prismatic API expects.
15
16
  */
16
- export declare const integration: <TConfigVar extends Record<string, ConfigVar> = Record<string, ConfigVar>>(definition: IntegrationDefinition<TConfigVar>) => ReturnType<typeof convertIntegration>;
17
+ export declare const integration: <TConfigPages extends ConfigPages = ConfigPages>(definition: IntegrationDefinition<TConfigPages>) => ReturnType<typeof convertIntegration>;
17
18
  /**
18
19
  * For information on writing Code Native Integrations, see
19
20
  * https://prismatic.io/docs/code-native-integrations/#adding-flows.
20
21
  * @param definition A Flow type object.
21
22
  * @returns This function returns a flow object that has the shape the Prismatic API expects.
22
23
  */
23
- export declare const flow: <TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload, T extends Flow<TConfigVars, TTriggerPayload> = Flow<TConfigVars, TTriggerPayload>>(definition: T) => T;
24
+ export declare const flow: <TConfigPages extends ConfigPages = ConfigPages, TTriggerPayload extends TriggerPayload = TriggerPayload, T extends Flow<TConfigPages, TTriggerPayload> = Flow<TConfigPages, TTriggerPayload>>(definition: T) => T;
24
25
  /**
25
26
  * For information on writing Code Native Integrations, see
26
27
  * https://prismatic.io/docs/code-native-integrations/#adding-config-pages.
27
28
  * @param definition A Config Page type object.
28
29
  * @returns This function returns a config page object that has the shape the Prismatic API expects.
29
30
  */
30
- export declare const configPage: <T extends ConfigPage<ConfigVarCollection>>(definition: T) => T;
31
+ export declare const configPage: <T extends ConfigPage>(definition: T) => T;
31
32
  /**
32
33
  * For information on writing Code Native Integrations, see
33
34
  * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
@@ -35,6 +36,13 @@ export declare const configPage: <T extends ConfigPage<ConfigVarCollection>>(def
35
36
  * @returns This function returns a standard config var object that has the shape the Prismatic API expects.
36
37
  */
37
38
  export declare const configVar: <T extends StandardConfigVar>(definition: T) => T;
39
+ /**
40
+ * For information on writing Code Native Integrations, see
41
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
42
+ * @param definition A Data Source Config Var type object.
43
+ * @returns This function returns a data source config var object that has the shape the Prismatic API expects.
44
+ */
45
+ export declare const dataSourceConfigVar: <T extends DataSourceConfigVar>(definition: T) => T;
38
46
  /**
39
47
  * For information on writing Code Native Integrations, see
40
48
  * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
@@ -80,7 +88,7 @@ export declare const trigger: <TInputs extends Inputs, TConfigVar extends Config
80
88
  * @param definition A DataSourceDefinition type object that includes UI display information, a function to perform when the data source is invoked, and a an object containing inputs for the perform function.
81
89
  * @returns This function validates the shape of the `definition` object provided, and returns the same data source object.
82
90
  */
83
- export declare const dataSource: <TInputs extends Inputs, TDataSourceType extends keyof {
91
+ export declare const dataSource: <TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TDataSourceType extends keyof {
84
92
  string: string;
85
93
  date: string;
86
94
  timestamp: string;
@@ -89,14 +97,12 @@ export declare const dataSource: <TInputs extends Inputs, TDataSourceType extend
89
97
  value: string;
90
98
  };
91
99
  code: string;
92
- credential: unknown;
93
100
  boolean: boolean;
94
101
  number: number;
95
- connection: import("./types").Connection;
96
102
  objectSelection: import("./types").ObjectSelection;
97
103
  objectFieldMap: import("./types").ObjectFieldMap;
98
104
  jsonForm: import("./types").JSONForm;
99
- }>(definition: DataSourceDefinition<TInputs, TDataSourceType>) => DataSourceDefinition<TInputs, TDataSourceType>;
105
+ }>(definition: DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>) => DataSourceDefinition<TInputs, TConfigVars, TDataSourceType>;
100
106
  /**
101
107
  * For information and examples on how to write inputs
102
108
  * for custom component actions and triggers, see
package/dist/index.js CHANGED
@@ -22,8 +22,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
22
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.configVar = exports.configPage = exports.flow = exports.integration = void 0;
25
+ exports.testing = exports.util = exports.oauth2Connection = exports.connection = exports.input = exports.dataSource = exports.trigger = exports.action = exports.component = exports.connectionConfigVar = exports.dataSourceConfigVar = exports.configVar = exports.configPage = exports.flow = exports.integration = void 0;
26
26
  const convert_1 = require("./serverTypes/convert");
27
+ const convertIntegration_1 = require("./serverTypes/convertIntegration");
27
28
  /**
28
29
  * This function creates a Integration object that can be
29
30
  * imported into the Prismatic API. For information on using
@@ -32,7 +33,7 @@ const convert_1 = require("./serverTypes/convert");
32
33
  * @param definition An IntegrationDefinition type object.
33
34
  * @returns This function returns an integration object that has the shape the Prismatic API expects.
34
35
  */
35
- const integration = (definition) => (0, convert_1.convertIntegration)(definition);
36
+ const integration = (definition) => (0, convertIntegration_1.convertIntegration)(definition);
36
37
  exports.integration = integration;
37
38
  /**
38
39
  * For information on writing Code Native Integrations, see
@@ -58,6 +59,14 @@ exports.configPage = configPage;
58
59
  */
59
60
  const configVar = (definition) => definition;
60
61
  exports.configVar = configVar;
62
+ /**
63
+ * For information on writing Code Native Integrations, see
64
+ * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
65
+ * @param definition A Data Source Config Var type object.
66
+ * @returns This function returns a data source config var object that has the shape the Prismatic API expects.
67
+ */
68
+ const dataSourceConfigVar = (definition) => definition;
69
+ exports.dataSourceConfigVar = dataSourceConfigVar;
61
70
  /**
62
71
  * For information on writing Code Native Integrations, see
63
72
  * https://prismatic.io/docs/code-native-integrations/#adding-config-vars.
@@ -1,4 +1,4 @@
1
- import { ComponentDefinition, IntegrationDefinition } from "../types";
2
- import { Component as ServerComponent } from ".";
1
+ import { InputFieldDefinition, ComponentDefinition } from "../types";
2
+ import { Component as ServerComponent, Input as ServerInput } from ".";
3
+ export declare const convertInput: (key: string, { default: defaultValue, type, label, collection, ...rest }: InputFieldDefinition) => ServerInput;
3
4
  export declare const convertComponent: <TPublic extends boolean, TKey extends string>({ connections, actions, triggers, dataSources, hooks, ...definition }: ComponentDefinition<TPublic, TKey>) => ServerComponent;
4
- export declare const convertIntegration: (definition: IntegrationDefinition) => ServerComponent;
@@ -10,13 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  }
11
11
  return t;
12
12
  };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
13
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.convertIntegration = exports.convertComponent = void 0;
18
- const yaml_1 = __importDefault(require("yaml"));
19
- const uuid_1 = require("uuid");
14
+ exports.convertComponent = exports.convertInput = void 0;
20
15
  const types_1 = require("../types");
21
16
  const perform_1 = require("./perform");
22
17
  const convertInput = (key, _a) => {
@@ -27,9 +22,10 @@ const convertInput = (key, _a) => {
27
22
  return Object.assign(Object.assign({}, rest), { key,
28
23
  type, default: defaultValue !== null && defaultValue !== void 0 ? defaultValue : types_1.InputFieldDefaultMap[type], collection, label: typeof label === "string" ? label : label.value, keyLabel });
29
24
  };
25
+ exports.convertInput = convertInput;
30
26
  const convertAction = (actionKey, _a, hooks) => {
31
27
  var { inputs = {}, perform } = _a, action = __rest(_a, ["inputs", "perform"]);
32
- const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
28
+ const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
33
29
  const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
34
30
  return Object.assign(Object.assign({}, action), { key: actionKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {
35
31
  inputCleaners,
@@ -38,7 +34,7 @@ const convertAction = (actionKey, _a, hooks) => {
38
34
  };
39
35
  const convertTrigger = (triggerKey, _a, hooks) => {
40
36
  var { inputs = {}, perform, onInstanceDeploy, onInstanceDelete } = _a, trigger = __rest(_a, ["inputs", "perform", "onInstanceDeploy", "onInstanceDelete"]);
41
- const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
37
+ const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
42
38
  const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
43
39
  const result = Object.assign(Object.assign({}, trigger), { key: triggerKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {
44
40
  inputCleaners,
@@ -62,7 +58,7 @@ const convertTrigger = (triggerKey, _a, hooks) => {
62
58
  };
63
59
  const convertDataSource = (dataSourceKey, _a, hooks) => {
64
60
  var { inputs = {}, perform } = _a, dataSource = __rest(_a, ["inputs", "perform"]);
65
- const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
61
+ const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
66
62
  const inputCleaners = Object.entries(inputs).reduce((result, [key, { clean }]) => (Object.assign(Object.assign({}, result), { [key]: clean })), {});
67
63
  return Object.assign(Object.assign({}, dataSource), { key: dataSourceKey, inputs: convertedInputs, perform: (0, perform_1.createPerform)(perform, {
68
64
  inputCleaners,
@@ -71,7 +67,7 @@ const convertDataSource = (dataSourceKey, _a, hooks) => {
71
67
  };
72
68
  const convertConnection = (_a) => {
73
69
  var { inputs = {} } = _a, connection = __rest(_a, ["inputs"]);
74
- const convertedInputs = Object.entries(inputs).map(([key, value]) => convertInput(key, value));
70
+ const convertedInputs = Object.entries(inputs).map(([key, value]) => (0, exports.convertInput)(key, value));
75
71
  return Object.assign(Object.assign({}, connection), { inputs: convertedInputs });
76
72
  };
77
73
  const convertComponent = (_a) => {
@@ -82,247 +78,3 @@ const convertComponent = (_a) => {
82
78
  return Object.assign(Object.assign({}, definition), { connections: connections.map(convertConnection), actions: convertedActions, triggers: convertedTriggers, dataSources: convertedDataSources });
83
79
  };
84
80
  exports.convertComponent = convertComponent;
85
- const convertIntegration = (definition) => {
86
- // Generate a unique reference key that will be used to reference the
87
- // actions, triggers, data sources, and connections that are created
88
- // inline as part of the integration definition.
89
- const referenceKey = (0, uuid_1.v4)();
90
- return Object.assign(Object.assign({}, codeNativeIntegrationComponent(definition, referenceKey)), { codeNativeIntegrationYAML: codeNativeIntegrationYaml(definition, referenceKey) });
91
- };
92
- exports.convertIntegration = convertIntegration;
93
- const codeNativeIntegrationYaml = ({ name, description, category, documentation, version, labels, configVars, endpointType, triggerPreprocessFlowConfig, flows, configPages, }, referenceKey) => {
94
- const DEFINITION_VERSION = 7;
95
- // Find the preprocess flow config on the flow, if one exists.
96
- const preprocessFlows = flows.filter((flow) => flow.preprocessFlowConfig);
97
- // Do some validation of preprocess flow configs.
98
- if (preprocessFlows.length > 1) {
99
- throw new Error("Only one flow may define a Preprocess Flow Config.");
100
- }
101
- if (preprocessFlows.length && triggerPreprocessFlowConfig) {
102
- throw new Error("Integration must not define both a Trigger Preprocess Flow Config and a Preprocess Flow.");
103
- }
104
- const hasPreprocessFlow = preprocessFlows.length > 0;
105
- const preprocessFlowConfig = hasPreprocessFlow
106
- ? preprocessFlows[0].preprocessFlowConfig
107
- : triggerPreprocessFlowConfig;
108
- if ([types_1.EndpointType.InstanceSpecific, types_1.EndpointType.SharedInstance].includes(endpointType || types_1.EndpointType.FlowSpecific) &&
109
- !preprocessFlowConfig) {
110
- throw new Error("Integration with specified EndpointType must define either a Trigger Preprocess Flow Config or a Preprocess Flow.");
111
- }
112
- // Transform the IntegrationDefinition into the structure that is appropriate
113
- // for generating YAML, which will then be used by the Prismatic API to import
114
- // the integration as a Code Native Integration.
115
- const result = {
116
- definitionVersion: DEFINITION_VERSION,
117
- isCodeNative: true,
118
- name,
119
- description,
120
- category,
121
- documentation,
122
- version,
123
- labels,
124
- requiredConfigVars: Object.entries(configVars || {}).map(([key, configVar]) => convertConfigVar(Object.assign(Object.assign({}, configVar), { key }), referenceKey)),
125
- endpointType,
126
- preprocessFlowName: hasPreprocessFlow ? preprocessFlows[0].name : undefined,
127
- externalCustomerIdField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.externalCustomerIdField),
128
- externalCustomerUserIdField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.externalCustomerUserIdField),
129
- flowNameField: fieldNameToReferenceInput(hasPreprocessFlow ? "onExecution" : "payload", preprocessFlowConfig === null || preprocessFlowConfig === void 0 ? void 0 : preprocessFlowConfig.flowNameField),
130
- flows: flows.map((flow) => convertFlow(flow, referenceKey)),
131
- configPages,
132
- };
133
- return yaml_1.default.stringify(result);
134
- };
135
- /** Converts a Flow into the structure necessary for YAML generation. */
136
- const convertFlow = (flow, referenceKey) => {
137
- const result = Object.assign({}, flow);
138
- delete result.onTrigger;
139
- delete result.trigger;
140
- delete result.onInstanceDeploy;
141
- delete result.onInstanceDelete;
142
- delete result.onExecution;
143
- delete result.preprocessFlowConfig;
144
- delete result.errorConfig;
145
- const triggerStep = {
146
- name: "On Trigger",
147
- stableKey: `${flow.stableKey}-onTrigger`,
148
- description: "The function that will be executed by the flow to return an HTTP response.",
149
- isTrigger: true,
150
- errorConfig: "errorConfig" in flow ? Object.assign({}, flow.errorConfig) : undefined,
151
- action: {
152
- key: flowFunctionKey(flow.name, "onTrigger"),
153
- component: { key: referenceKey, version: "LATEST", isPublic: false },
154
- },
155
- };
156
- if ("schedule" in flow && typeof flow.schedule === "object") {
157
- triggerStep.schedule = {
158
- type: "cronExpression" in flow.schedule
159
- ? types_1.SimpleInputValueType.Value
160
- : types_1.SimpleInputValueType.ConfigVar,
161
- value: "cronExpression" in flow.schedule
162
- ? flow.schedule.cronExpression
163
- : flow.schedule.configVarKey,
164
- meta: {
165
- scheduleType: types_1.ScheduleType.Custom,
166
- timeZone: flow.schedule.timeZone,
167
- },
168
- };
169
- delete result.schedule;
170
- }
171
- const actionStep = {
172
- action: {
173
- key: flowFunctionKey(flow.name, "onExecution"),
174
- component: { key: referenceKey, version: "LATEST", isPublic: false },
175
- },
176
- name: "On Execution",
177
- stableKey: `${flow.stableKey}-onExecution`,
178
- description: "The function that will be executed by the flow.",
179
- errorConfig: "errorConfig" in flow ? Object.assign({}, flow.errorConfig) : undefined,
180
- };
181
- result.steps = [triggerStep, actionStep];
182
- return result;
183
- };
184
- /** Converts a Config Var into the structure necessary for YAML generation. */
185
- const convertConfigVar = (configVar, referenceKey) => {
186
- // This is unfortunate but we need to strip out some fields that are not
187
- // relevant to config vars.
188
- const fields = [
189
- "key",
190
- "stableKey",
191
- "description",
192
- "orgOnly",
193
- "inputs",
194
- "defaultValue",
195
- "dataType",
196
- "pickList",
197
- "scheduleType",
198
- "timeZone",
199
- "codeLanguage",
200
- "collectionType",
201
- "dataSource",
202
- ];
203
- const result = Object.entries(configVar).reduce((result, [key, value]) => {
204
- if (!fields.includes(key)) {
205
- return result;
206
- }
207
- return Object.assign(Object.assign({}, result), { [key]: value });
208
- }, { meta: {} });
209
- // Handle some non-standard fields.
210
- if ("visibleToOrgDeployer" in configVar) {
211
- result.meta.visibleToOrgDeployer = configVar.visibleToOrgDeployer;
212
- }
213
- if ("visibleToCustomerDeployer" in configVar) {
214
- result.meta.visibleToCustomerDeployer = configVar.visibleToCustomerDeployer;
215
- }
216
- // Handle connections.
217
- if ("label" in configVar) {
218
- result.dataType = "connection";
219
- // This refers to a connection we are creating.
220
- result.connection = {
221
- key: configVar.key,
222
- component: { key: referenceKey, version: "LATEST", isPublic: false },
223
- };
224
- result.description = configVar.label;
225
- // Convert connection inputs to the inputs expected in the YAML.
226
- // FIXME: This is just a placeholder for now.
227
- // TODO: It seems like using the default value as the value is probably correct?
228
- result.inputs = Object.entries(configVar.inputs).reduce((result, [key, input]) => {
229
- var _a;
230
- return Object.assign(Object.assign({}, result), { [key]: {
231
- type: types_1.SimpleInputValueType.Value,
232
- value: (_a = input.default) !== null && _a !== void 0 ? _a : "",
233
- } });
234
- }, {});
235
- }
236
- // Handle data source references.
237
- if ("dataSource" in result) {
238
- // This is a reference to a data source we are creating.
239
- result.dataSource = {
240
- key: result.dataSource,
241
- component: { key: referenceKey, version: "LATEST", isPublic: false },
242
- };
243
- }
244
- return result;
245
- };
246
- /** Maps the step name field to a fully qualified input. */
247
- const fieldNameToReferenceInput = (stepName, fieldName) => {
248
- if (!fieldName) {
249
- return undefined;
250
- }
251
- return {
252
- type: types_1.SimpleInputValueType.Reference,
253
- value: `${stepName}.results.${fieldName}`,
254
- };
255
- };
256
- /** Actions and Triggers will be scoped to their flow by combining the flow
257
- * name and the function name. This is to ensure that the keys are unique
258
- * on the resulting object, which will be turned into a Component. */
259
- const flowFunctionKey = (flowName, functionName) => {
260
- const flowKey = flowName
261
- .replace(/[^0-9a-zA-Z]+/g, " ")
262
- .trim()
263
- .split(" ")
264
- .map((w, i) => i === 0
265
- ? w.toLowerCase()
266
- : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase())
267
- .join("");
268
- return `${flowKey}_${functionName}`;
269
- };
270
- /** Creates the structure necessary to import a Component as part of a
271
- * Code Native integration. */
272
- const codeNativeIntegrationComponent = ({ name, iconPath, description, flows = [], dataSources = {}, configVars = {}, }, referenceKey) => {
273
- const convertedActions = flows.reduce((result, { name, onExecution }) => {
274
- const actionKey = flowFunctionKey(name, "onExecution");
275
- return Object.assign(Object.assign({}, result), { [actionKey]: convertAction(actionKey, {
276
- display: {
277
- label: `${name} - onExecution`,
278
- description: "The function that will be executed by the flow.",
279
- },
280
- perform: onExecution,
281
- inputs: {},
282
- }) });
283
- }, {});
284
- const convertedTriggers = flows.reduce((result, flow) => {
285
- // Filter out TriggerReferences.
286
- if ("trigger" in flow)
287
- return result;
288
- const { name, onTrigger, onInstanceDeploy, onInstanceDelete } = flow;
289
- const triggerKey = flowFunctionKey(name, "onTrigger");
290
- return Object.assign(Object.assign({}, result), { [triggerKey]: convertTrigger(triggerKey, {
291
- display: {
292
- label: `${name} - onTrigger`,
293
- description: "The function that will be executed by the flow to return an HTTP response.",
294
- },
295
- perform: onTrigger,
296
- onInstanceDeploy: onInstanceDeploy,
297
- onInstanceDelete: onInstanceDelete,
298
- inputs: {},
299
- scheduleSupport: "valid",
300
- synchronousResponseSupport: "valid",
301
- }) });
302
- }, {});
303
- const convertedDataSources = Object.entries(dataSources).reduce((result, [dataSourceKey, dataSource]) => (Object.assign(Object.assign({}, result), { [dataSourceKey]: convertDataSource(dataSourceKey, Object.assign(Object.assign({}, dataSource), { inputs: {} })) })), {});
304
- const convertedConnections = Object.entries(configVars).reduce((result, [key, configVar]) => {
305
- if (!("label" in configVar)) {
306
- return result;
307
- }
308
- // Remove a few fields that are not relevant to connections.
309
- const {
310
- /* eslint-disable @typescript-eslint/no-unused-vars */
311
- orgOnly, visibleToOrgDeployer, visibleToCustomerDeployer, stableKey } = configVar,
312
- /* eslint-enable @typescript-eslint/no-unused-vars */
313
- connection = __rest(configVar, ["orgOnly", "visibleToOrgDeployer", "visibleToCustomerDeployer", "stableKey"]);
314
- return [...result, convertConnection(Object.assign(Object.assign({}, connection), { key }))];
315
- }, []);
316
- return {
317
- key: referenceKey,
318
- display: {
319
- label: referenceKey,
320
- iconPath,
321
- description: description || name,
322
- },
323
- connections: convertedConnections,
324
- actions: convertedActions,
325
- triggers: convertedTriggers,
326
- dataSources: convertedDataSources,
327
- };
328
- };
@@ -0,0 +1,3 @@
1
+ import { IntegrationDefinition, ConfigPages } from "../types";
2
+ import { Component as ServerComponent } from ".";
3
+ export declare const convertIntegration: (definition: IntegrationDefinition<ConfigPages>) => ServerComponent;