@prismatic-io/spectral 7.8.4 → 8.0.0-preview10

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 (33) hide show
  1. package/dist/clients/http/index.d.ts +1 -1
  2. package/dist/index.d.ts +41 -12
  3. package/dist/index.js +43 -1
  4. package/dist/serverTypes/convert.d.ts +2 -1
  5. package/dist/serverTypes/convert.js +247 -1
  6. package/dist/serverTypes/index.d.ts +27 -24
  7. package/dist/testing.d.ts +14 -9
  8. package/dist/testing.js +57 -49
  9. package/dist/types/ActionDefinition.d.ts +3 -3
  10. package/dist/types/ActionPerformFunction.d.ts +12 -9
  11. package/dist/types/ComponentDefinition.d.ts +2 -2
  12. package/dist/types/{Customer.d.ts → CustomerAttributes.d.ts} +1 -1
  13. package/dist/types/DataSourcePerformFunction.d.ts +4 -4
  14. package/dist/types/{Flow.d.ts → FlowAttributes.d.ts} +1 -1
  15. package/dist/types/Inputs.d.ts +2 -0
  16. package/dist/types/{Instance.d.ts → InstanceAttributes.d.ts} +1 -1
  17. package/dist/types/{Integration.d.ts → IntegrationAttributes.d.ts} +2 -1
  18. package/dist/types/IntegrationDefinition.d.ts +269 -0
  19. package/dist/types/IntegrationDefinition.js +78 -0
  20. package/dist/types/TriggerDefinition.d.ts +5 -5
  21. package/dist/types/TriggerEventFunction.d.ts +2 -2
  22. package/dist/types/TriggerPayload.d.ts +6 -6
  23. package/dist/types/TriggerPerformFunction.d.ts +2 -2
  24. package/dist/types/TriggerResult.d.ts +4 -4
  25. package/dist/types/{User.d.ts → UserAttributes.d.ts} +1 -1
  26. package/dist/types/index.d.ts +6 -5
  27. package/dist/types/index.js +6 -5
  28. package/package.json +3 -2
  29. /package/dist/types/{Customer.js → CustomerAttributes.js} +0 -0
  30. /package/dist/types/{Flow.js → FlowAttributes.js} +0 -0
  31. /package/dist/types/{Instance.js → InstanceAttributes.js} +0 -0
  32. /package/dist/types/{Integration.js → IntegrationAttributes.js} +0 -0
  33. /package/dist/types/{User.js → UserAttributes.js} +0 -0
package/dist/testing.js CHANGED
@@ -15,7 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  });
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.createHarness = exports.ComponentTestHarness = exports.invokeDataSource = exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.loggerMock = exports.createConnection = void 0;
18
+ exports.createHarness = exports.ComponentTestHarness = exports.invokeFlow = exports.invokeDataSource = exports.invokeTrigger = exports.defaultTriggerPayload = exports.invoke = exports.loggerMock = exports.createConnection = void 0;
19
19
  const jest_mock_1 = require("jest-mock");
20
20
  const createConnection = ({ key }, values, tokenValues) => ({
21
21
  configVarKey: "",
@@ -38,46 +38,32 @@ const loggerMock = () => ({
38
38
  error: (0, jest_mock_1.spyOn)(console, "error"),
39
39
  });
40
40
  exports.loggerMock = loggerMock;
41
- const baseActionContext = {
42
- logger: (0, exports.loggerMock)(),
43
- instanceState: {},
44
- crossFlowState: {},
45
- executionState: {},
46
- integrationState: {},
47
- stepId: "mockStepId",
48
- executionId: "mockExecutionId",
49
- webhookUrls: {
50
- "Flow 1": "https://example.com",
51
- },
52
- webhookApiKeys: {
53
- "Flow 1": ["example-123", "example-456"],
54
- },
55
- invokeUrl: "https://example.com",
56
- customer: {
57
- id: "customerId",
58
- name: "Customer 1",
59
- externalId: "1234",
60
- },
61
- instance: {
62
- id: "instanceId",
63
- name: "Instance 1",
64
- },
65
- user: {
66
- id: "userId",
67
- email: "user@example.com",
68
- name: "User 1",
69
- externalId: "1234",
70
- },
71
- integration: {
72
- id: "integrationId",
73
- name: "Integration 1",
74
- versionSequenceId: "1234",
75
- },
76
- flow: {
77
- id: "flowId",
78
- name: "Flow 1",
79
- },
80
- startedAt: new Date().toISOString(),
41
+ const createActionContext = (context) => {
42
+ return Object.assign({ logger: (0, exports.loggerMock)(), instanceState: {}, crossFlowState: {}, executionState: {}, integrationState: {}, stepId: "mockStepId", executionId: "mockExecutionId", webhookUrls: {
43
+ "Flow 1": "https://example.com",
44
+ }, webhookApiKeys: {
45
+ "Flow 1": ["example-123", "example-456"],
46
+ }, invokeUrl: "https://example.com", customer: {
47
+ id: "customerId",
48
+ name: "Customer 1",
49
+ externalId: "1234",
50
+ }, instance: {
51
+ id: "instanceId",
52
+ name: "Instance 1",
53
+ }, user: {
54
+ id: "userId",
55
+ email: "user@example.com",
56
+ name: "User 1",
57
+ externalId: "1234",
58
+ }, integration: {
59
+ id: "integrationId",
60
+ name: "Integration 1",
61
+ versionSequenceId: "1234",
62
+ externalVersion: "1.0.0",
63
+ }, flow: {
64
+ id: "flowId",
65
+ name: "Flow 1",
66
+ }, startedAt: new Date().toISOString() }, context);
81
67
  };
82
68
  /**
83
69
  * Invokes specified ActionDefinition perform function using supplied params
@@ -85,8 +71,8 @@ const baseActionContext = {
85
71
  * to avoid extra casting within test methods. Returns an InvokeResult containing both the
86
72
  * action result and a mock logger for asserting logging.
87
73
  */
88
- const invoke = ({ perform }, params, context) => __awaiter(void 0, void 0, void 0, function* () {
89
- const realizedContext = Object.assign(Object.assign({}, baseActionContext), context);
74
+ const invoke = ({ perform, }, params, context) => __awaiter(void 0, void 0, void 0, function* () {
75
+ const realizedContext = createActionContext(context);
90
76
  const result = yield perform(realizedContext, params);
91
77
  return {
92
78
  result,
@@ -138,6 +124,7 @@ const defaultTriggerPayload = () => {
138
124
  id: "integrationId",
139
125
  name: "Integration 1",
140
126
  versionSequenceId: "1234",
127
+ externalVersion: "1.0.0",
141
128
  },
142
129
  flow: {
143
130
  id: "flowId",
@@ -153,8 +140,8 @@ exports.defaultTriggerPayload = defaultTriggerPayload;
153
140
  * to avoid extra casting within test methods. Returns an InvokeResult containing both the
154
141
  * trigger result and a mock logger for asserting logging.
155
142
  */
156
- const invokeTrigger = ({ perform }, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
157
- const realizedContext = Object.assign(Object.assign({}, baseActionContext), context);
143
+ const invokeTrigger = ({ perform, }, context, payload, params) => __awaiter(void 0, void 0, void 0, function* () {
144
+ const realizedContext = createActionContext(context);
158
145
  const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload);
159
146
  const realizedParams = params || {};
160
147
  const result = yield perform(realizedContext, realizedPayload, realizedParams);
@@ -193,6 +180,27 @@ const invokeDataSource = ({ perform }, params, context) => __awaiter(void 0, voi
193
180
  return result;
194
181
  });
195
182
  exports.invokeDataSource = invokeDataSource;
183
+ /**
184
+ * Invokes specified Flow of a Code Native Integration using supplied params.
185
+ * Runs the Trigger and then the Action function and returns the result of the Action.
186
+ */
187
+ const invokeFlow = (flow, context, payload) => __awaiter(void 0, void 0, void 0, function* () {
188
+ const realizedContext = createActionContext(context);
189
+ const realizedPayload = Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload);
190
+ const params = {
191
+ onTrigger: { results: null },
192
+ };
193
+ if ("onTrigger" in flow) {
194
+ const triggerResult = yield flow.onTrigger(realizedContext, realizedPayload, params);
195
+ params.onTrigger = { results: triggerResult === null || triggerResult === void 0 ? void 0 : triggerResult.payload };
196
+ }
197
+ const result = yield flow.onExecution(realizedContext, params);
198
+ return {
199
+ result,
200
+ loggerMock: realizedContext.logger,
201
+ };
202
+ });
203
+ exports.invokeFlow = invokeFlow;
196
204
  class ComponentTestHarness {
197
205
  constructor(component) {
198
206
  this.component = component;
@@ -215,7 +223,7 @@ class ComponentTestHarness {
215
223
  trigger(key, payload, params, context) {
216
224
  return __awaiter(this, void 0, void 0, function* () {
217
225
  const trigger = this.component.triggers[key];
218
- return trigger.perform(this.buildContext(baseActionContext, context), Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload), this.buildParams(trigger.inputs, params));
226
+ return trigger.perform(createActionContext(context), Object.assign(Object.assign({}, (0, exports.defaultTriggerPayload)()), payload), this.buildParams(trigger.inputs, params));
219
227
  });
220
228
  }
221
229
  triggerOnInstanceDeploy(key, params, context) {
@@ -224,7 +232,7 @@ class ComponentTestHarness {
224
232
  if (!trigger.onInstanceDeploy) {
225
233
  throw new Error("Trigger does not support onInstanceDeploy");
226
234
  }
227
- return trigger.onInstanceDeploy(this.buildContext(baseActionContext, context), this.buildParams(trigger.inputs, params));
235
+ return trigger.onInstanceDeploy(createActionContext(context), this.buildParams(trigger.inputs, params));
228
236
  });
229
237
  }
230
238
  triggerOnInstanceDelete(key, params, context) {
@@ -233,13 +241,13 @@ class ComponentTestHarness {
233
241
  if (!trigger.onInstanceDelete) {
234
242
  throw new Error("Trigger does not support onInstanceDelete");
235
243
  }
236
- return trigger.onInstanceDelete(this.buildContext(baseActionContext, context), this.buildParams(trigger.inputs, params));
244
+ return trigger.onInstanceDelete(createActionContext(context), this.buildParams(trigger.inputs, params));
237
245
  });
238
246
  }
239
247
  action(key, params, context) {
240
248
  return __awaiter(this, void 0, void 0, function* () {
241
249
  const action = this.component.actions[key];
242
- return action.perform(this.buildContext(baseActionContext, context), this.buildParams(action.inputs, params));
250
+ return action.perform(createActionContext(context), this.buildParams(action.inputs, params));
243
251
  });
244
252
  }
245
253
  dataSource(key, params, context) {
@@ -1,13 +1,13 @@
1
- import { ActionDisplayDefinition, ActionPerformFunction, ActionPerformReturn, Inputs } from ".";
1
+ import { ActionDisplayDefinition, ActionPerformFunction, ActionPerformReturn, ConfigVarResultCollection, Inputs } from ".";
2
2
  /**
3
3
  * ActionDefinition is the type of the object that is passed in to `action` function to
4
4
  * define a component action.
5
5
  */
6
- export interface ActionDefinition<TInputs extends Inputs, TAllowsBranching extends boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> {
6
+ export interface ActionDefinition<TInputs extends Inputs = Inputs, TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, TAllowsBranching extends boolean = boolean, TReturn extends ActionPerformReturn<TAllowsBranching, unknown> = ActionPerformReturn<TAllowsBranching, unknown>> {
7
7
  /** Defines how the Action is displayed in the Prismatic interface. */
8
8
  display: ActionDisplayDefinition;
9
9
  /** Function to perform when this Action is invoked. */
10
- perform: ActionPerformFunction<TInputs, TAllowsBranching, TReturn>;
10
+ perform: ActionPerformFunction<TInputs, TConfigVars, false, TAllowsBranching, TReturn>;
11
11
  /** InputFields to present in the Prismatic interface for configuration of this Action. */
12
12
  inputs: TInputs;
13
13
  /** Optional attribute that specifies whether an Action will terminate execution.*/
@@ -1,8 +1,8 @@
1
- import { Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger, Instance, Customer, User, Integration, Flow } from ".";
1
+ import { Inputs, ConfigVarResultCollection, ActionPerformReturn, ActionInputParameters, ActionLogger, InstanceAttributes, CustomerAttributes, UserAttributes, IntegrationAttributes, FlowAttributes } from ".";
2
2
  /** Definition of the function to perform when an Action is invoked. */
3
- export declare type ActionPerformFunction<TInputs extends Inputs, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext, params: ActionInputParameters<TInputs>) => Promise<TReturn>;
3
+ export declare type ActionPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean, TAllowsBranching extends boolean | undefined, TReturn extends ActionPerformReturn<TAllowsBranching, unknown>> = (context: ActionContext<TConfigVars, THasConfigVars>, params: ActionInputParameters<TInputs>) => Promise<TReturn>;
4
4
  /** Context provided to perform method containing helpers and contextual data */
5
- export interface ActionContext {
5
+ export declare type ActionContext<TConfigVars extends ConfigVarResultCollection = ConfigVarResultCollection, THasConfigVars extends boolean = false> = {
6
6
  /** Logger for permanent logging; console calls are also captured */
7
7
  logger: ActionLogger;
8
8
  /** A a flow-specific key/value store that may be used to store small amounts of data that is persisted between Instance executions */
@@ -24,15 +24,18 @@ export interface ActionContext {
24
24
  /** The URL used to invoke the current execution */
25
25
  invokeUrl: string;
26
26
  /** Contains attributes of the Customer for whom an Instance is being executed. */
27
- customer: Customer;
27
+ customer: CustomerAttributes;
28
28
  /** Contains attributes of the Instance that is being executed. */
29
- instance: Instance;
29
+ instance: InstanceAttributes;
30
30
  /** Contains attributes of the User for whom a User Level Configuration is being used. */
31
- user: User;
31
+ user: UserAttributes;
32
32
  /** Contains attributes of the Integration that is being executed. */
33
- integration: Integration;
33
+ integration: IntegrationAttributes;
34
34
  /** Contains attributes of the Flow that is being executed. */
35
- flow: Flow;
35
+ flow: FlowAttributes;
36
36
  /** The time in UTC that execution started. */
37
37
  startedAt: string;
38
- }
38
+ } & (THasConfigVars extends true ? {
39
+ /** Key/value collection of config variables of the integration. */
40
+ configVars: TConfigVars;
41
+ } : Record<string, never>);
@@ -13,9 +13,9 @@ export declare type ComponentDefinition<TPublic extends boolean, TKey extends st
13
13
  /** Defines how the Component is displayed in the Prismatic interface. */
14
14
  display: ComponentDisplayDefinition<TPublic>;
15
15
  /** Specifies the supported Actions of this Component. */
16
- actions?: Record<string, ActionDefinition<any, boolean, any>>;
16
+ actions?: Record<string, ActionDefinition<any, any, boolean, any>>;
17
17
  /** Specifies the supported Triggers of this Component. */
18
- triggers?: Record<string, TriggerDefinition<any, boolean, any>>;
18
+ triggers?: Record<string, TriggerDefinition<any, any, boolean, any>>;
19
19
  /** Specifies the supported Data Sources of this Component. */
20
20
  dataSources?: Record<string, DataSourceDefinition<any, any>>;
21
21
  /** Specifies the supported Connections of this Component. */
@@ -1,5 +1,5 @@
1
1
  /** Contains attributes of the Customer for whom an Instance is being executed. */
2
- export interface Customer {
2
+ export interface CustomerAttributes {
3
3
  id: string;
4
4
  externalId: string;
5
5
  name: string;
@@ -1,10 +1,10 @@
1
- import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ActionLogger, Customer, Instance, User } from ".";
1
+ import { Inputs, DataSourceResult, DataSourceType, ActionInputParameters, ActionLogger, CustomerAttributes, InstanceAttributes, UserAttributes } from ".";
2
2
  /** Context provided to perform method containing helpers and contextual data */
3
3
  export interface DataSourceContext {
4
4
  logger: ActionLogger;
5
- customer: Customer;
6
- instance: Instance;
7
- user: User;
5
+ customer: CustomerAttributes;
6
+ instance: InstanceAttributes;
7
+ user: UserAttributes;
8
8
  }
9
9
  /** Definition of the function to perform when a Data Source is invoked. */
10
10
  export declare type DataSourcePerformFunction<TInputs extends Inputs, TDataSourceType extends DataSourceType> = (context: DataSourceContext, params: ActionInputParameters<TInputs>) => Promise<DataSourceResult<TDataSourceType>>;
@@ -1,5 +1,5 @@
1
1
  /** Contains attributes of the Flow that is being executed. */
2
- export interface Flow {
2
+ export interface FlowAttributes {
3
3
  id: string;
4
4
  name: string;
5
5
  }
@@ -239,4 +239,6 @@ export interface InputFieldChoice {
239
239
  }
240
240
  /** InputField collection enumeration */
241
241
  export declare type InputFieldCollection = "valuelist" | "keyvaluelist";
242
+ /** Config variable result collection */
243
+ export declare type ConfigVarResultCollection = Record<string, string | Connection | JSONForm | ObjectSelection>;
242
244
  export {};
@@ -1,5 +1,5 @@
1
1
  /** Contains attributes of the Instance that is being executed. */
2
- export interface Instance {
2
+ export interface InstanceAttributes {
3
3
  id: string;
4
4
  name: string;
5
5
  }
@@ -1,6 +1,7 @@
1
1
  /** Contains attributes of the Integration that is being executed. */
2
- export interface Integration {
2
+ export interface IntegrationAttributes {
3
3
  id: string;
4
4
  name: string;
5
5
  versionSequenceId: string;
6
+ externalVersion: string;
6
7
  }
@@ -0,0 +1,269 @@
1
+ import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, Connection as ConnectionResult, TriggerPayload } from ".";
2
+ export declare type ConfigVarCollection = Record<string, ConfigVar>;
3
+ export declare type ConfigVarDefinitionsToResults<TConfigVars extends ConfigVarCollection> = {
4
+ [Key in keyof TConfigVars]: TConfigVars[Key]["inputs"] extends Record<string, any> ? ConnectionResult : string;
5
+ };
6
+ /** Defines attributes of a Code-Native Integration. */
7
+ export declare type IntegrationDefinition<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
8
+ /** The unique name for this Integration. */
9
+ name: string;
10
+ /** Optional description for this Integration. */
11
+ description?: string;
12
+ /** Optional path to icon to use for this Integration. Path should be relative to the built Integration source. */
13
+ iconPath?: string;
14
+ /** Optional category for this Integration. */
15
+ category?: string;
16
+ /** Optional documentation for this Integration. */
17
+ documentation?: string;
18
+ /** Optional version identifier for this Integration. */
19
+ version?: string;
20
+ /** Optional labels for this Integration. */
21
+ labels?: string[];
22
+ /** Optional endpoint type used by Instances of this Integration.
23
+ * A Preprocess Flow Config must be specified when using anything other than 'Flow Specific'.
24
+ * @default EndpointType.FlowSpecific. */
25
+ endpointType?: EndpointType;
26
+ /** Optional Preprocess Flow configuration for when the Trigger payload contains the flow routing attributes.
27
+ * Cannot specify this if a Preprocess Flow is also configured. */
28
+ triggerPreprocessFlowConfig?: PreprocessFlowConfig;
29
+ /** Flows for this Integration. */
30
+ flows: Flow<TConfigVars>[];
31
+ /** Config Vars used on this Integration. */
32
+ configVars?: TConfigVars;
33
+ /** Config Wizard Pages for this Integration. */
34
+ configPages?: ConfigPage<TConfigVars>[];
35
+ /** Specifies any Data Sources that are defined as part of this Integration. */
36
+ dataSources?: Record<string, CodeNativeDataSource>;
37
+ };
38
+ /** Defines attributes of a Flow of a Code-Native Integration. */
39
+ export interface Flow<TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload> {
40
+ /** The unique name for this Flow. */
41
+ name: string;
42
+ /** Optional description for this Flow. */
43
+ description?: string;
44
+ /** Optional Preprocess Flow configuration for when the result of this Flow contains the flow routing attributes. Only one Flow per Integration may define this. */
45
+ preprocessFlowConfig?: PreprocessFlowConfig;
46
+ /** Optional value that specifies whether this Flow is synchronous. @default false */
47
+ isSynchronous?: boolean;
48
+ /** Optional Retry Configuration for this Flow. */
49
+ retryConfig?: RetryConfig;
50
+ /** Optional security configuration to use for the endpoint of this Flow. @default EndpointSecurityType.CustomerOptional */
51
+ endpointSecurityType?: EndpointSecurityType;
52
+ /** Optional list of API key(s) to use for the endpoint of this Flow when the endpoint security type is EndpointSecurityType.Organization. */
53
+ organizationApiKeys?: string[];
54
+ /** Optional schedule configuration that defines the frequency with which this Flow will be automatically executed. */
55
+ schedule?: FlowSchedule;
56
+ /** Optional error handling configuration. */
57
+ errorConfig?: StepErrorConfig;
58
+ /** Specifies the trigger function for this Flow, which returns a payload and optional HTTP response. */
59
+ onTrigger: TriggerPerformFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true, false, TriggerResult<false, TTriggerPayload>>;
60
+ /** Specifies the function to execute when an Instance of this Integration is deployed. */
61
+ onInstanceDeploy?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
62
+ /** Specifies the function to execute when an Instance of an Integration is deleted. */
63
+ onInstanceDelete?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
64
+ /** Specifies the main function for this Flow */
65
+ onExecution: ActionPerformFunction<{
66
+ onTrigger: {
67
+ type: "data";
68
+ label: string;
69
+ clean: (value: unknown) => {
70
+ results: TTriggerPayload;
71
+ };
72
+ };
73
+ }, ConfigVarDefinitionsToResults<TConfigVars>, true, false, ActionPerformReturn<false, unknown>>;
74
+ }
75
+ /** Defines attributes of a Data Source that is defined as part of a Code Native Integration. */
76
+ export declare type CodeNativeDataSource = Pick<DataSourceDefinition<Inputs, DataSourceType>, "display" | "perform" | "dataSourceType" | "detailDataSource">;
77
+ /** Common attribute shared by all types of Config Vars. */
78
+ declare type BaseConfigVar = {
79
+ /** The unique key for this Config Var. */
80
+ key: string;
81
+ /** Optional description for this Config Var. */
82
+ description?: string;
83
+ /** Optional value that specifies whether this Config Var is only configurable by Organization users. @default false */
84
+ orgOnly?: boolean;
85
+ /** Optional input values for this Config Var. */
86
+ inputs?: InputValues;
87
+ /** Optional value that specifies whether this Config Var is visible to an Organization deployer. @default true */
88
+ visibleToOrgDeployer?: boolean;
89
+ /** Optional value that specifies whether this Config Var is visible to a Customer deployer. @default true */
90
+ visibleToCustomerDeployer?: boolean;
91
+ };
92
+ /** Defines attributes of a standard Config Var. */
93
+ export declare type StandardConfigVar = BaseConfigVar & {
94
+ /** Optional default value for the Config Var. */
95
+ defaultValue?: string;
96
+ /** The data type of the Config Var. */
97
+ dataType: ConfigVarDataType;
98
+ /** Optional list of picklist values if the Config Var is a multi-choice selection value. */
99
+ pickList?: string[];
100
+ /** Optional schedule type that defines the cadence of the schedule. */
101
+ scheduleType?: ScheduleType;
102
+ /** Optional value to use as a timezone if the Config Var is a schedule value. */
103
+ timeZone?: string;
104
+ /** Optional value to specify the type of language if the Config Var is a code value. */
105
+ codeLanguage?: CodeLanguageType;
106
+ /** Optional value to specify the type of collection if the Config Var is multi-value. */
107
+ collectionType?: CollectionType;
108
+ /** Optional value to specify the key of a Data Source defined in this CNI
109
+ * where the Config Var sources its values. */
110
+ dataSource?: string;
111
+ };
112
+ /** Defines attributes of a Config Var that represents a Connection. */
113
+ export declare type ConnectionConfigVar = Omit<BaseConfigVar, "description" | "inputs"> & ConnectionDefinition;
114
+ export declare type ConfigVar = StandardConfigVar | ConnectionConfigVar;
115
+ /** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */
116
+ export declare type ConfigPage<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
117
+ /** The unique name for this Config Page. */
118
+ name: string;
119
+ /** Specifies an optional tagline for this Config Page. */
120
+ tagline?: string;
121
+ /** Optional value that specifies whether this Config Page is configured as
122
+ * part of User Level Configuration. @default false */
123
+ userLevelConfigured?: boolean;
124
+ /** Elements included on this Config Page. */
125
+ elements: ConfigPageElement<TConfigVars>[];
126
+ };
127
+ /** Defines attributes of Inputs for Connections, Actions, Triggers,
128
+ * Data Sources, and Config Vars. */
129
+ export declare type InputValues = Record<string, InputValue>;
130
+ export declare type InputValue = SimpleInputValue | ComplexInputValue;
131
+ export declare type SimpleInputValue = {
132
+ name?: string;
133
+ type: SimpleInputValueType;
134
+ value: string;
135
+ meta?: Record<string, unknown>;
136
+ };
137
+ export declare type ComplexInputValue = {
138
+ name?: string;
139
+ type: "complex";
140
+ value: ComplexInputValueType;
141
+ meta?: Record<string, unknown>;
142
+ };
143
+ export declare type ComplexInputValueType = (string | InputValue | ComplexInputValueType)[];
144
+ /** Defines attributes of an Element that appears on a Config Wizard Page. */
145
+ export declare type ConfigPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = HTMLConfigPageElement | JSONFormConfigPageElement | ConfigVarPageElement<TConfigVars>;
146
+ declare type HTMLConfigPageElement = {
147
+ type: ConfigPageElementType.HTML;
148
+ value: string;
149
+ };
150
+ declare type JSONFormConfigPageElement = {
151
+ type: ConfigPageElementType.JSONForm;
152
+ value: string;
153
+ };
154
+ declare type ConfigVarPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
155
+ type: ConfigPageElementType.ConfigVar;
156
+ value: keyof TConfigVars;
157
+ };
158
+ /** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */
159
+ export declare type PreprocessFlowConfig = {
160
+ /** Name of the field in the data payload returned by the Preprocess Flow to use for a Flow Name. */
161
+ flowNameField: string;
162
+ /** Optional name of the field in the data payload returned by the Preprocess Flow to use for an External Customer Id. */
163
+ externalCustomerIdField?: string;
164
+ /** Optional name of the field in the data payload returned by the Preprocess Flow to use for an External Customer User Id. */
165
+ externalCustomerUserIdField?: string;
166
+ };
167
+ /** Defines attributes of a Retry Configuration used by a Flow of an Integration. */
168
+ export declare type RetryConfig = {
169
+ /** The maximum number of retry attempts. Must be between 0 and 10. */
170
+ maxAttempts: number;
171
+ /** The delay in minutes to wait between retry attempts. Must be between 0 and 60. */
172
+ delayMinutes: number;
173
+ /** Specifies whether to use exponential backoff to calculate the delay between retry attempts. */
174
+ usesExponentialBackoff: boolean;
175
+ /** Name of the field in the data payload returned by the Flow Trigger to use as a Unique Request ID for retry request cancellation. */
176
+ uniqueRequestIdField?: string;
177
+ };
178
+ /** Defines attributes of a Step Error Configuration used to determine how to handle errors during Flow step execution. */
179
+ export declare type StepErrorConfig = {
180
+ /** Defines the type of error handler. */
181
+ errorHandlerType: StepErrorHandlerType;
182
+ /** The maximum number of retry attempts. Must be between 0 and 5. */
183
+ maxAttempts?: number;
184
+ /** The delay in seconds to wait between retry attempts. Must be between 0 and 60. */
185
+ delaySeconds?: number;
186
+ /** Specifies whether to use exponential backoff to calculate the delay between retry attempts. @default false */
187
+ usesExponentialBackoff?: boolean;
188
+ /** Specifies whether to ignore the final error after the final retry attempt. @default false */
189
+ ignoreFinalError?: boolean;
190
+ };
191
+ /** Defines attributes of a Schedule that controls how often a Flow is automatically executed. */
192
+ export declare type FlowSchedule = {
193
+ /** The cron expression to use for defining an execution schedule. */
194
+ cronExpression: string;
195
+ /** Specifies an optional value to use as the timezone. */
196
+ timeZone?: string;
197
+ } | {
198
+ /** The key of the Config Var whose value will define the execution schedule. */
199
+ configVarKey: string;
200
+ /** Specifies an optional value to use as the timezone. */
201
+ timeZone?: string;
202
+ };
203
+ /** Choices of Simple Input Value Types that may be used by Simple Input Values. */
204
+ export declare enum SimpleInputValueType {
205
+ Value = "value",
206
+ Reference = "reference",
207
+ ConfigVar = "configVar",
208
+ Template = "template"
209
+ }
210
+ /** Choices of Endpoint Types that may be used by Instances of an Integration. */
211
+ export declare enum EndpointType {
212
+ FlowSpecific = "flow_specific",
213
+ InstanceSpecific = "instance_specific",
214
+ SharedInstance = "shared_instance"
215
+ }
216
+ /** Choices of Endpoint Security Types that may be used by endpoints of a Flow. */
217
+ export declare enum EndpointSecurityType {
218
+ Unsecured = "unsecured",
219
+ CustomerOptional = "customer_optional",
220
+ CustomerRequired = "customer_required",
221
+ Organization = "organization"
222
+ }
223
+ /** Choices of Config Page Element Types that may be used for Elements on a Config Wizard Page. */
224
+ export declare enum ConfigPageElementType {
225
+ ConfigVar = "configVar",
226
+ HTML = "htmlElement",
227
+ JSONForm = "jsonForm"
228
+ }
229
+ /** Choices of Step Error Handlers that define the behavior when a step error occurs. */
230
+ export declare enum StepErrorHandlerType {
231
+ Fail = "fail",
232
+ Ignore = "ignore",
233
+ Retry = "retry"
234
+ }
235
+ /** Choices for Schedules that add context for the cadence of a given schedule. */
236
+ export declare enum ScheduleType {
237
+ None = "none",
238
+ Custom = "custom",
239
+ Minute = "minute",
240
+ Hour = "hour",
241
+ Day = "day",
242
+ Week = "week"
243
+ }
244
+ /** Supported data types for Config Vars. */
245
+ export declare enum ConfigVarDataType {
246
+ String = "string",
247
+ Date = "date",
248
+ Timestamp = "timestamp",
249
+ Picklist = "picklist",
250
+ Schedule = "schedule",
251
+ Code = "code",
252
+ Boolean = "boolean",
253
+ Number = "number",
254
+ ObjectSelection = "objectSelection",
255
+ ObjectFieldMap = "objectFieldMap",
256
+ JSONForm = "jsonForm"
257
+ }
258
+ /** Choices of programming languages that may be used for Config Var code values. */
259
+ export declare enum CodeLanguageType {
260
+ JSON = "json",
261
+ XML = "xml",
262
+ HTML = "html"
263
+ }
264
+ /** Choices of collection types for multi-value Config Vars. */
265
+ export declare enum CollectionType {
266
+ ValueList = "valuelist",
267
+ KeyValueList = "keyvaluelist"
268
+ }
269
+ export {};
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CollectionType = exports.CodeLanguageType = exports.ConfigVarDataType = exports.ScheduleType = exports.StepErrorHandlerType = exports.ConfigPageElementType = exports.EndpointSecurityType = exports.EndpointType = exports.SimpleInputValueType = void 0;
4
+ /** Choices of Simple Input Value Types that may be used by Simple Input Values. */
5
+ var SimpleInputValueType;
6
+ (function (SimpleInputValueType) {
7
+ SimpleInputValueType["Value"] = "value";
8
+ SimpleInputValueType["Reference"] = "reference";
9
+ SimpleInputValueType["ConfigVar"] = "configVar";
10
+ SimpleInputValueType["Template"] = "template";
11
+ })(SimpleInputValueType = exports.SimpleInputValueType || (exports.SimpleInputValueType = {}));
12
+ /** Choices of Endpoint Types that may be used by Instances of an Integration. */
13
+ var EndpointType;
14
+ (function (EndpointType) {
15
+ EndpointType["FlowSpecific"] = "flow_specific";
16
+ EndpointType["InstanceSpecific"] = "instance_specific";
17
+ EndpointType["SharedInstance"] = "shared_instance";
18
+ })(EndpointType = exports.EndpointType || (exports.EndpointType = {}));
19
+ /** Choices of Endpoint Security Types that may be used by endpoints of a Flow. */
20
+ var EndpointSecurityType;
21
+ (function (EndpointSecurityType) {
22
+ EndpointSecurityType["Unsecured"] = "unsecured";
23
+ EndpointSecurityType["CustomerOptional"] = "customer_optional";
24
+ EndpointSecurityType["CustomerRequired"] = "customer_required";
25
+ EndpointSecurityType["Organization"] = "organization";
26
+ })(EndpointSecurityType = exports.EndpointSecurityType || (exports.EndpointSecurityType = {}));
27
+ /** Choices of Config Page Element Types that may be used for Elements on a Config Wizard Page. */
28
+ var ConfigPageElementType;
29
+ (function (ConfigPageElementType) {
30
+ ConfigPageElementType["ConfigVar"] = "configVar";
31
+ ConfigPageElementType["HTML"] = "htmlElement";
32
+ ConfigPageElementType["JSONForm"] = "jsonForm";
33
+ })(ConfigPageElementType = exports.ConfigPageElementType || (exports.ConfigPageElementType = {}));
34
+ /** Choices of Step Error Handlers that define the behavior when a step error occurs. */
35
+ var StepErrorHandlerType;
36
+ (function (StepErrorHandlerType) {
37
+ StepErrorHandlerType["Fail"] = "fail";
38
+ StepErrorHandlerType["Ignore"] = "ignore";
39
+ StepErrorHandlerType["Retry"] = "retry";
40
+ })(StepErrorHandlerType = exports.StepErrorHandlerType || (exports.StepErrorHandlerType = {}));
41
+ /** Choices for Schedules that add context for the cadence of a given schedule. */
42
+ var ScheduleType;
43
+ (function (ScheduleType) {
44
+ ScheduleType["None"] = "none";
45
+ ScheduleType["Custom"] = "custom";
46
+ ScheduleType["Minute"] = "minute";
47
+ ScheduleType["Hour"] = "hour";
48
+ ScheduleType["Day"] = "day";
49
+ ScheduleType["Week"] = "week";
50
+ })(ScheduleType = exports.ScheduleType || (exports.ScheduleType = {}));
51
+ /** Supported data types for Config Vars. */
52
+ var ConfigVarDataType;
53
+ (function (ConfigVarDataType) {
54
+ ConfigVarDataType["String"] = "string";
55
+ ConfigVarDataType["Date"] = "date";
56
+ ConfigVarDataType["Timestamp"] = "timestamp";
57
+ ConfigVarDataType["Picklist"] = "picklist";
58
+ ConfigVarDataType["Schedule"] = "schedule";
59
+ ConfigVarDataType["Code"] = "code";
60
+ ConfigVarDataType["Boolean"] = "boolean";
61
+ ConfigVarDataType["Number"] = "number";
62
+ ConfigVarDataType["ObjectSelection"] = "objectSelection";
63
+ ConfigVarDataType["ObjectFieldMap"] = "objectFieldMap";
64
+ ConfigVarDataType["JSONForm"] = "jsonForm";
65
+ })(ConfigVarDataType = exports.ConfigVarDataType || (exports.ConfigVarDataType = {}));
66
+ /** Choices of programming languages that may be used for Config Var code values. */
67
+ var CodeLanguageType;
68
+ (function (CodeLanguageType) {
69
+ CodeLanguageType["JSON"] = "json";
70
+ CodeLanguageType["XML"] = "xml";
71
+ CodeLanguageType["HTML"] = "html";
72
+ })(CodeLanguageType = exports.CodeLanguageType || (exports.CodeLanguageType = {}));
73
+ /** Choices of collection types for multi-value Config Vars. */
74
+ var CollectionType;
75
+ (function (CollectionType) {
76
+ CollectionType["ValueList"] = "valuelist";
77
+ CollectionType["KeyValueList"] = "keyvaluelist";
78
+ })(CollectionType = exports.CollectionType || (exports.CollectionType = {}));