@prismatic-io/spectral 8.0.0-preview7 → 8.0.0

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.
@@ -1,6 +1,6 @@
1
1
  import { Inputs } from ".";
2
2
  import { ConditionalExpression } from "./conditional-logic";
3
- import { InputFieldCollection, InputCleanFunction, Connection } from "./Inputs";
3
+ import { InputFieldCollection, InputCleanFunction, Connection, KeyValuePair } from "./Inputs";
4
4
  /**
5
5
  * Collection of input parameters.
6
6
  * Inputs can be static values, references to config variables, or
@@ -10,16 +10,3 @@ export declare type ActionInputParameters<TInputs extends Inputs> = {
10
10
  [Property in keyof TInputs]: TInputs[Property]["clean"] extends InputCleanFunction<any> ? ReturnType<TInputs[Property]["clean"]> : TInputs[Property]["type"] extends "connection" ? ExtractValue<Connection, TInputs[Property]["collection"]> : TInputs[Property]["type"] extends "conditional" ? ExtractValue<ConditionalExpression, TInputs[Property]["collection"]> : ExtractValue<TInputs[Property]["default"], TInputs[Property]["collection"]>;
11
11
  };
12
12
  export declare type ExtractValue<TType, TCollection extends InputFieldCollection | undefined> = TCollection extends "keyvaluelist" ? KeyValuePair<TType>[] : TCollection extends "valuelist" ? TType[] : TType;
13
- /**
14
- * KeyValuePair input parameter type.
15
- * This allows users to input multiple keys / values as an input.
16
- * To see an example of how this can be used, see the `tagging` input
17
- * of the `putObject` action of the AWS S3 component:
18
- * https://github.com/prismatic-io/examples/blob/main/components/aws-s3/src/actions.ts
19
- */
20
- export interface KeyValuePair<V = unknown> {
21
- /** Key of the KeyValuePair */
22
- key: string;
23
- /** Value of the KeyValuePair */
24
- value: V;
25
- }
@@ -1,12 +1,10 @@
1
- import { Inputs, ActionPerformReturn, ActionInputParameters, ActionLogger, InstanceAttributes, CustomerAttributes, UserAttributes, IntegrationAttributes, FlowAttributes } 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
- /** Code Components and Code Native Integration Actions will have access to all Config Vars, otherwise this will be undefined. */
9
- configVars?: Record<string, unknown>;
10
8
  /** A a flow-specific key/value store that may be used to store small amounts of data that is persisted between Instance executions */
11
9
  instanceState: Record<string, unknown>;
12
10
  /** A key/value store that is shared between flows on an Instance that may be used to store small amounts of data that is persisted between Instance executions */
@@ -37,4 +35,7 @@ export interface ActionContext {
37
35
  flow: FlowAttributes;
38
36
  /** The time in UTC that execution started. */
39
37
  startedAt: string;
40
- }
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,18 @@
1
1
  import { ConditionalExpression } from "./conditional-logic";
2
2
  import { JsonSchema, UISchemaElement } from "@jsonforms/core";
3
+ /**
4
+ * KeyValuePair input parameter type.
5
+ * This allows users to input multiple keys / values as an input.
6
+ * To see an example of how this can be used, see the `tagging` input
7
+ * of the `putObject` action of the AWS S3 component:
8
+ * https://github.com/prismatic-io/examples/blob/main/components/aws-s3/src/actions.ts
9
+ */
10
+ export interface KeyValuePair<V = unknown> {
11
+ /** Key of the KeyValuePair */
12
+ key: string;
13
+ /** Value of the KeyValuePair */
14
+ value: V;
15
+ }
3
16
  export declare type Element = {
4
17
  key: string;
5
18
  label?: string;
@@ -66,81 +79,76 @@ interface BaseInputField {
66
79
  /** Indicate if this InputField is required. */
67
80
  required?: boolean;
68
81
  }
69
- export interface StringInputField extends BaseInputField {
70
- /** Data type the InputField will collect. */
71
- type: "string";
82
+ declare type CollectionOptions<T> = SingleValue<T> | ValueListCollection<T> | KeyValueListCollection<T>;
83
+ interface SingleValue<T> {
72
84
  /** Collection type of the InputField */
73
- collection?: InputFieldCollection;
85
+ collection?: undefined;
74
86
  /** Default value for this field. */
75
- default?: unknown;
87
+ default?: T;
88
+ }
89
+ interface ValueListCollection<T> {
90
+ /** Collection type of the InputField */
91
+ collection: "valuelist";
92
+ /** Default value for this field. */
93
+ default?: T[];
94
+ }
95
+ interface KeyValueListCollection<T> {
96
+ /** Collection type of the InputField */
97
+ collection: "keyvaluelist";
98
+ /** Default value for this field. */
99
+ default?: KeyValuePair<T>[];
100
+ }
101
+ export declare type StringInputField = BaseInputField & CollectionOptions<string> & {
102
+ /** Data type the InputField will collect. */
103
+ type: "string";
76
104
  /** Dictates possible choices for the input. */
77
105
  model?: InputFieldChoice[];
78
106
  /** Clean function */
79
- clean?: InputCleanFunction<this["default"]>;
80
- }
81
- export interface DataInputField extends BaseInputField {
107
+ clean?: InputCleanFunction<unknown>;
108
+ };
109
+ export declare type DataInputField = BaseInputField & CollectionOptions<string> & {
82
110
  /** Data type the InputField will collect. */
83
111
  type: "data";
84
- /** Collection type of the InputField */
85
- collection?: InputFieldCollection;
86
- /** Default value for this field. */
87
- default?: unknown;
88
112
  /** Dictates possible choices for the input. */
89
113
  model?: InputFieldChoice[];
90
114
  /** Clean function */
91
- clean?: InputCleanFunction<this["default"]>;
92
- }
93
- export interface TextInputField extends BaseInputField {
115
+ clean?: InputCleanFunction<unknown>;
116
+ };
117
+ export declare type TextInputField = BaseInputField & CollectionOptions<string> & {
94
118
  /** Data type the InputField will collect. */
95
119
  type: "text";
96
- /** Collection type of the InputField */
97
- collection?: InputFieldCollection;
98
- /** Default value for this field. */
99
- default?: unknown;
100
120
  /** Dictates possible choices for the input. */
101
121
  model?: InputFieldChoice[];
102
122
  /** Clean function */
103
- clean?: InputCleanFunction<this["default"]>;
104
- }
105
- export interface PasswordInputField extends BaseInputField {
123
+ clean?: InputCleanFunction<unknown>;
124
+ };
125
+ export declare type PasswordInputField = BaseInputField & CollectionOptions<string> & {
106
126
  /** Data type the InputField will collect. */
107
127
  type: "password";
108
- /** Collection type of the InputField */
109
- collection?: InputFieldCollection;
110
- /** Default value for this field. */
111
- default?: unknown;
112
128
  /** Dictates possible choices for the input. */
113
129
  model?: InputFieldChoice[];
114
130
  /** Clean function */
115
- clean?: InputCleanFunction<this["default"]>;
116
- }
117
- export interface BooleanInputField extends BaseInputField {
131
+ clean?: InputCleanFunction<unknown>;
132
+ };
133
+ export declare type BooleanInputField = BaseInputField & CollectionOptions<string> & {
118
134
  /** Data type the InputField will collect. */
119
135
  type: "boolean";
120
- /** Collection type of the InputField */
121
- collection?: InputFieldCollection;
122
- /** Default value for this field. */
123
- default?: unknown;
124
136
  /** Dictates possible choices for the input. */
125
137
  model?: InputFieldChoice[];
126
138
  /** Clean function */
127
- clean?: InputCleanFunction<this["default"]>;
128
- }
139
+ clean?: InputCleanFunction<unknown>;
140
+ };
129
141
  /** Defines attributes of a CodeInputField. */
130
- export interface CodeInputField extends BaseInputField {
142
+ export declare type CodeInputField = BaseInputField & CollectionOptions<string> & {
131
143
  /** Data type the InputField will collect. */
132
144
  type: "code";
133
- /** Collection type of the InputField */
134
- collection?: InputFieldCollection;
135
- /** Default value for this field. */
136
- default?: unknown;
137
145
  /** Code language for syntax highlighting. For no syntax highlighting, choose "plaintext" */
138
146
  language: "css" | "graphql" | "handlebars" | "hcl" | "html" | "javascript" | "json" | "liquid" | "markdown" | "mysql" | "pgsql" | "plaintext" | "sql" | "typescript" | "xml" | "yaml";
139
147
  /** Dictates possible choices for the input. */
140
148
  model?: InputFieldChoice[];
141
149
  /** Clean function */
142
- clean?: InputCleanFunction<this["default"]>;
143
- }
150
+ clean?: InputCleanFunction<unknown>;
151
+ };
144
152
  /** Defines attributes of a ConditionalInputField. */
145
153
  export interface ConditionalInputField extends BaseInputField {
146
154
  /** Data type the InputField will collect. */
@@ -239,4 +247,6 @@ export interface InputFieldChoice {
239
247
  }
240
248
  /** InputField collection enumeration */
241
249
  export declare type InputFieldCollection = "valuelist" | "keyvaluelist";
250
+ /** Config variable result collection */
251
+ export declare type ConfigVarResultCollection = Record<string, string | Connection | JSONForm | ObjectSelection>;
242
252
  export {};
@@ -1,6 +1,10 @@
1
- import { DataSourceDefinition, ConnectionDefinition, ActionDefinition, ActionPerformReturn, TriggerDefinition, Inputs, TriggerResult, DataSourceType } from ".";
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
+ };
2
6
  /** Defines attributes of a Code-Native Integration. */
3
- export declare type IntegrationDefinition = {
7
+ export declare type IntegrationDefinition<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
4
8
  /** The unique name for this Integration. */
5
9
  name: string;
6
10
  /** Optional description for this Integration. */
@@ -23,20 +27,20 @@ export declare type IntegrationDefinition = {
23
27
  * Cannot specify this if a Preprocess Flow is also configured. */
24
28
  triggerPreprocessFlowConfig?: PreprocessFlowConfig;
25
29
  /** Flows for this Integration. */
26
- flows: Flow[];
30
+ flows: Flow<TConfigVars>[];
27
31
  /** Config Vars used on this Integration. */
28
- configVars?: ConfigVar[];
32
+ configVars?: TConfigVars;
29
33
  /** Config Wizard Pages for this Integration. */
30
- configPages?: ConfigPage[];
34
+ configPages?: ConfigPage<TConfigVars>[];
31
35
  /** Specifies any Data Sources that are defined as part of this Integration. */
32
36
  dataSources?: Record<string, CodeNativeDataSource>;
33
- /** Specifies any Connections that are defined as part of this Integration. */
34
- connections?: ConnectionDefinition[];
35
37
  };
36
38
  /** Defines attributes of a Flow of a Code-Native Integration. */
37
- export declare type Flow = {
39
+ export interface Flow<TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload> {
38
40
  /** The unique name for this Flow. */
39
41
  name: string;
42
+ /** A unique, unchanging value that is used to maintain identity for the Flow even if the name changes. */
43
+ stableKey: string;
40
44
  /** Optional description for this Flow. */
41
45
  description?: string;
42
46
  /** Optional Preprocess Flow configuration for when the result of this Flow contains the flow routing attributes. Only one Flow per Integration may define this. */
@@ -51,59 +55,33 @@ export declare type Flow = {
51
55
  organizationApiKeys?: string[];
52
56
  /** Optional schedule configuration that defines the frequency with which this Flow will be automatically executed. */
53
57
  schedule?: FlowSchedule;
54
- /** Specifies the trigger for this Flow. */
55
- trigger: (CodeNativeTrigger | TriggerReference) & {
56
- /** Optional error handling configuration. */
57
- errorConfig?: StepErrorConfig;
58
- };
59
- /** Specifies the main function for this Flow. */
60
- action: CodeNativeAction;
61
- };
62
- /** Defines attributes of a Data Source that is defined as part of a Code Native Integration. */
63
- export declare type CodeNativeDataSource = Pick<DataSourceDefinition<Inputs, DataSourceType>, "display" | "perform" | "dataSourceType" | "detailDataSource">;
64
- /** Defines attributes of a Trigger that is defined as part of a Code Native Integration. */
65
- export declare type CodeNativeTrigger = Pick<TriggerDefinition<Inputs, false, TriggerResult<false>>, "display" | "perform" | "onInstanceDeploy" | "onInstanceDelete">;
66
- /** Defines attributes of an CodeNativeAction, which is the main function that will be executed for a Flow of a Code Native Integration. */
67
- export declare type CodeNativeAction = Pick<ActionDefinition<Inputs, false, ActionPerformReturn<false, unknown>>, "display" | "perform"> & {
68
58
  /** Optional error handling configuration. */
69
59
  errorConfig?: StepErrorConfig;
70
- };
71
- /** Defines attributes of a reference to an existing Trigger. */
72
- export declare type TriggerReference = {
73
- /** Attributes of the referenced Component. */
74
- component: ComponentReference;
75
- /** The unique key that identifies the Trigger within the Component. */
76
- key: string;
77
- /** Optional input values for this Trigger. */
78
- inputs?: InputValues;
79
- };
80
- /** Defines attributes of a reference to an existing Data Source. */
81
- export declare type DataSourceReference = {
82
- /** Attributes of the referenced Component. */
83
- component: ComponentReference;
84
- /** The unique key that identifies the Data Source within the Component. */
85
- key: string;
86
- };
87
- /** Defines attributes of a reference to an existing Connection. */
88
- export declare type ConnectionReference = {
89
- /** Attributes of the referenced Component. */
90
- component: ComponentReference;
91
- /** The unique key that identifies the Connection within the Component. */
92
- key: string;
93
- };
94
- /** Defines attributes of a reference to a member of an existing Component. */
95
- export declare type ComponentReference = {
96
- /** The unique key that identifies the Component. */
97
- key: string;
98
- /** The version of the Component. */
99
- version: number | "LATEST";
100
- /** Specifies whether the Component is in the public library or a private Component. */
101
- isPublic: boolean;
102
- };
60
+ /** Specifies the trigger function for this Flow, which returns a payload and optional HTTP response. */
61
+ onTrigger: TriggerPerformFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true, false, TriggerResult<false, TTriggerPayload>>;
62
+ /** Specifies the function to execute when an Instance of this Integration is deployed. */
63
+ onInstanceDeploy?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
64
+ /** Specifies the function to execute when an Instance of an Integration is deleted. */
65
+ onInstanceDelete?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
66
+ /** Specifies the main function for this Flow */
67
+ onExecution: ActionPerformFunction<{
68
+ onTrigger: {
69
+ type: "data";
70
+ label: string;
71
+ clean: (value: unknown) => {
72
+ results: TTriggerPayload;
73
+ };
74
+ };
75
+ }, ConfigVarDefinitionsToResults<TConfigVars>, true, false, ActionPerformReturn<false, unknown>>;
76
+ }
77
+ /** Defines attributes of a Data Source that is defined as part of a Code Native Integration. */
78
+ export declare type CodeNativeDataSource = Pick<DataSourceDefinition<Inputs, DataSourceType>, "display" | "perform" | "dataSourceType" | "detailDataSource">;
103
79
  /** Common attribute shared by all types of Config Vars. */
104
80
  declare type BaseConfigVar = {
105
81
  /** The unique key for this Config Var. */
106
82
  key: string;
83
+ /** A unique, unchanging value that is used to maintain identity for the Config Var even if the key changes. */
84
+ stableKey: string;
107
85
  /** Optional description for this Config Var. */
108
86
  description?: string;
109
87
  /** Optional value that specifies whether this Config Var is only configurable by Organization users. @default false */
@@ -116,7 +94,7 @@ declare type BaseConfigVar = {
116
94
  visibleToCustomerDeployer?: boolean;
117
95
  };
118
96
  /** Defines attributes of a standard Config Var. */
119
- declare type StandardConfigVar = BaseConfigVar & {
97
+ export declare type StandardConfigVar = BaseConfigVar & {
120
98
  /** Optional default value for the Config Var. */
121
99
  defaultValue?: string;
122
100
  /** The data type of the Config Var. */
@@ -131,25 +109,15 @@ declare type StandardConfigVar = BaseConfigVar & {
131
109
  codeLanguage?: CodeLanguageType;
132
110
  /** Optional value to specify the type of collection if the Config Var is multi-value. */
133
111
  collectionType?: CollectionType;
134
- /** Optional value to specify the Data Source where the Config Var sources
135
- * its values. If it's a string then it's expected to be the key of a
136
- * CodeNativeDataSource defined in the Code Native Integration. Otherwise it
137
- * is expected to be a reference to an existing Data Source. */
138
- dataSource?: string | DataSourceReference;
112
+ /** Optional value to specify the key of a Data Source defined in this CNI
113
+ * where the Config Var sources its values. */
114
+ dataSource?: string;
139
115
  };
140
116
  /** Defines attributes of a Config Var that represents a Connection. */
141
- declare type ConnectionConfigVar = BaseConfigVar & {
142
- dataType: "connection";
143
- /** Optional value to specify the Data Source where the Config Var sources
144
- * its values. If it's a string then it's expected to be the key of a
145
- * Connection defined in the Code Native Integration. Otherwise it is
146
- * expected to be a reference to an existing Connection. */
147
- connection: string | ConnectionReference;
148
- };
149
- /** Defines attributes of a Config Var whose value is configured as part of deploying an Instance of an Integration. */
117
+ export declare type ConnectionConfigVar = Omit<BaseConfigVar, "description" | "inputs"> & ConnectionDefinition;
150
118
  export declare type ConfigVar = StandardConfigVar | ConnectionConfigVar;
151
119
  /** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */
152
- export declare type ConfigPage = {
120
+ export declare type ConfigPage<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
153
121
  /** The unique name for this Config Page. */
154
122
  name: string;
155
123
  /** Specifies an optional tagline for this Config Page. */
@@ -158,7 +126,7 @@ export declare type ConfigPage = {
158
126
  * part of User Level Configuration. @default false */
159
127
  userLevelConfigured?: boolean;
160
128
  /** Elements included on this Config Page. */
161
- elements: ConfigPageElement[];
129
+ elements: ConfigPageElement<TConfigVars>[];
162
130
  };
163
131
  /** Defines attributes of Inputs for Connections, Actions, Triggers,
164
132
  * Data Sources, and Config Vars. */
@@ -178,12 +146,19 @@ export declare type ComplexInputValue = {
178
146
  };
179
147
  export declare type ComplexInputValueType = (string | InputValue | ComplexInputValueType)[];
180
148
  /** Defines attributes of an Element that appears on a Config Wizard Page. */
181
- export declare type ConfigPageElement = {
182
- /** Specifies what type of data is represented by this Element. */
183
- type: ConfigPageElementType;
184
- /** Specifies the value of this Element. */
149
+ export declare type ConfigPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = HTMLConfigPageElement | JSONFormConfigPageElement | ConfigVarPageElement<TConfigVars>;
150
+ declare type HTMLConfigPageElement = {
151
+ type: ConfigPageElementType.HTML;
185
152
  value: string;
186
153
  };
154
+ declare type JSONFormConfigPageElement = {
155
+ type: ConfigPageElementType.JSONForm;
156
+ value: string;
157
+ };
158
+ declare type ConfigVarPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
159
+ type: ConfigPageElementType.ConfigVar;
160
+ value: keyof TConfigVars;
161
+ };
187
162
  /** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */
188
163
  export declare type PreprocessFlowConfig = {
189
164
  /** Name of the field in the data payload returned by the Preprocess Flow to use for a Flow Name. */
@@ -1,4 +1,4 @@
1
- import { ActionDisplayDefinition, TriggerPerformFunction, TriggerEventFunction, Inputs, TriggerResult } from ".";
1
+ import { ActionDisplayDefinition, TriggerPerformFunction, TriggerEventFunction, Inputs, TriggerResult, ConfigVarResultCollection, TriggerPayload } from ".";
2
2
  declare const optionChoices: readonly ["invalid", "valid", "required"];
3
3
  export declare type TriggerOptionChoice = typeof optionChoices[number];
4
4
  export declare const TriggerOptionChoices: TriggerOptionChoice[];
@@ -6,15 +6,15 @@ export declare const TriggerOptionChoices: TriggerOptionChoice[];
6
6
  * TriggerDefinition is the type of the object that is passed in to `trigger` function to
7
7
  * define a component trigger.
8
8
  */
9
- export interface TriggerDefinition<TInputs extends Inputs, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching>> {
9
+ export interface TriggerDefinition<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, TAllowsBranching extends boolean, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> {
10
10
  /** Defines how the Trigger is displayed in the Prismatic interface. */
11
11
  display: ActionDisplayDefinition;
12
12
  /** Function to perform when this Trigger is invoked. */
13
- perform: TriggerPerformFunction<TInputs, TAllowsBranching, TResult>;
13
+ perform: TriggerPerformFunction<TInputs, TConfigVars, false, TAllowsBranching, TResult>;
14
14
  /** Function to execute when an Instance of an Integration with a Flow that uses this Trigger is deployed. */
15
- onInstanceDeploy?: TriggerEventFunction<TInputs>;
15
+ onInstanceDeploy?: TriggerEventFunction<TInputs, TConfigVars, false>;
16
16
  /** Function to execute when an Instance of an Integration with a Flow that uses this Trigger is deleted. */
17
- onInstanceDelete?: TriggerEventFunction<TInputs>;
17
+ onInstanceDelete?: TriggerEventFunction<TInputs, TConfigVars, false>;
18
18
  /** InputFields to present in the Prismatic interface for configuration of this Trigger. */
19
19
  inputs: TInputs;
20
20
  /** Specifies whether this Trigger supports executing the Integration on a recurring schedule. */
@@ -1,4 +1,4 @@
1
- import { Inputs, ActionContext, ActionInputParameters } from ".";
1
+ import { Inputs, ActionContext, ActionInputParameters, ConfigVarResultCollection } from ".";
2
2
  export declare type TriggerEventFunctionReturn = {
3
3
  /** An optional object, the keys and values of which will be persisted in the flow-specific instanceState and available for subsequent actions and executions */
4
4
  instanceState?: Record<string, unknown>;
@@ -10,4 +10,4 @@ export declare type TriggerEventFunctionReturn = {
10
10
  integrationState?: Record<string, unknown>;
11
11
  };
12
12
  /** Definition of the function to execute when a Trigger Event occurs. */
13
- export declare type TriggerEventFunction<TInputs extends Inputs> = (context: ActionContext, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>;
13
+ export declare type TriggerEventFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean> = (context: ActionContext<TConfigVars, THasConfigVars>, params: ActionInputParameters<TInputs>) => Promise<void | TriggerEventFunctionReturn>;
@@ -1,3 +1,3 @@
1
- import { Inputs, TriggerResult, ActionInputParameters, ActionContext, TriggerPayload } from ".";
1
+ import { Inputs, TriggerResult, ActionInputParameters, ActionContext, TriggerPayload, ConfigVarResultCollection } from ".";
2
2
  /** Definition of the function to perform when a Trigger is invoked. */
3
- export declare type TriggerPerformFunction<T extends Inputs, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching>> = (context: ActionContext, payload: TriggerPayload, params: ActionInputParameters<T>) => Promise<TResult>;
3
+ export declare type TriggerPerformFunction<TInputs extends Inputs, TConfigVars extends ConfigVarResultCollection, THasConfigVars extends boolean, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars, THasConfigVars>, payload: TriggerPayload, params: ActionInputParameters<TInputs>) => Promise<TResult>;
@@ -1,9 +1,9 @@
1
1
  import { TriggerPayload } from "./TriggerPayload";
2
2
  import { HttpResponse } from "./HttpResponse";
3
3
  /** Represents the result of a Trigger action. */
4
- export interface TriggerBaseResult {
4
+ export interface TriggerBaseResult<TPayload extends TriggerPayload> {
5
5
  /** The payload in the request that invoked the Integration, which is returned as a result for later use. */
6
- payload: TriggerPayload;
6
+ payload: TPayload;
7
7
  /** Optional HTTP response to the request that invoked the integration. */
8
8
  response?: HttpResponse;
9
9
  /** An optional object, the keys and values of which will be persisted in the flow-specific instanceState and available for subsequent actions and executions */
@@ -20,9 +20,9 @@ export interface TriggerBaseResult {
20
20
  error?: Record<string, unknown>;
21
21
  }
22
22
  /** Represents the result of a Trigger action that uses branching. */
23
- export interface TriggerBranchingResult extends TriggerBaseResult {
23
+ export interface TriggerBranchingResult<TPayload extends TriggerPayload> extends TriggerBaseResult<TPayload> {
24
24
  /** Name of the Branch to take. */
25
25
  branch: string;
26
26
  }
27
27
  /** Required return type of all trigger perform functions */
28
- export declare type TriggerResult<AllowsBranching extends boolean | undefined> = (AllowsBranching extends true ? TriggerBranchingResult : TriggerBaseResult) | undefined;
28
+ export declare type TriggerResult<AllowsBranching extends boolean | undefined, TPayload extends TriggerPayload> = (AllowsBranching extends true ? TriggerBranchingResult<TPayload> : TriggerBaseResult<TPayload>) | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "8.0.0-preview7",
3
+ "version": "8.0.0",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"
@@ -38,14 +38,13 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@jsonforms/core": "3.0.0",
41
- "axios": "0.27.2",
42
- "axios-retry": "3.2.5",
41
+ "axios": "1.6.2",
42
+ "axios-retry": "3.9.1",
43
43
  "date-fns": "2.30.0",
44
44
  "form-data": "4.0.0",
45
45
  "jest-mock": "27.0.3",
46
46
  "safe-stable-stringify": "2.3.1",
47
47
  "serialize-error": "8.1.0",
48
- "soap": "1.0.0",
49
48
  "url-join": "5.0.0",
50
49
  "uuid": "8.3.2",
51
50
  "valid-url": "1.0.9",
@@ -1,2 +0,0 @@
1
- export * from "./types";
2
- export * from "./utils";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./utils"), exports);
@@ -1,71 +0,0 @@
1
- import { Connection } from "../../index";
2
- import { IMTOMAttachments } from "soap";
3
- /**
4
- * SOAPConnection takes standard connection fields, and adds an optional `wsdlDefinitionUrl` field.
5
- */
6
- export interface SOAPConnection extends Connection {
7
- fields: {
8
- [key: string]: unknown;
9
- wsdlDefinitionUrl?: string;
10
- };
11
- }
12
- /**
13
- * This function determines if the object presented is a SOAP connection with a `wsdlDefinitionUrl` field.
14
- * @param connection The connection to test
15
- * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
16
- */
17
- export declare const isSOAPConnection: (connection: unknown) => connection is SOAPConnection;
18
- /**
19
- * SOAP requests return a 4-tuple or 5-tuple with the response first, the XML response second, headers third, and the XML request fourth, and optional message attachments fifth.
20
- */
21
- export declare type SOAPResponse = [any, any, any, any, IMTOMAttachments?];
22
- /**
23
- * Overload the `soapRequest` function to take a variety of types of arguments.
24
- */
25
- export interface SOAPRequest {
26
- (params: RequestParams): Promise<SOAPResponse>;
27
- (params: RequestParams, methodParams: Record<string, unknown>): Promise<SOAPResponse>;
28
- (params: RequestParams, methodParams: undefined): Promise<SOAPResponse>;
29
- }
30
- export interface RequestParams {
31
- wsdlParam: SOAPConnection | string;
32
- method: string;
33
- overrides?: ClientOverrides;
34
- debug?: boolean;
35
- }
36
- export interface ClientOverrides {
37
- endpointURL?: string;
38
- soapHeaders?: unknown[];
39
- }
40
- export interface HeaderPayload {
41
- [x: string]: any;
42
- }
43
- export interface GenerateHeader {
44
- (wsdlParam: SOAPConnection | string, headerPayload: HeaderPayload, headerOptions: undefined): Promise<string>;
45
- (wsdlParam: SOAPConnection | string, headerPayload: HeaderPayload, headerOptions: {
46
- namespace: string;
47
- xmlns: string;
48
- }): Promise<string>;
49
- }
50
- export interface BasicAuthConnection extends Connection {
51
- fields: {
52
- [key: string]: unknown;
53
- username: unknown;
54
- password: unknown;
55
- loginMethod: unknown;
56
- };
57
- }
58
- /**
59
- * This function determines if the object presented is a Basic Auth connection with `username`, `password`, and `loginMethod` fields.
60
- * @param connection The connection to test
61
- * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
62
- */
63
- export declare const isBasicAuthConnection: (connection: Connection) => connection is BasicAuthConnection;
64
- export interface SOAPAuth {
65
- (connection: BasicAuthConnection, wsdlDefinition: string): Promise<any>;
66
- (connection: BasicAuthConnection & SOAPConnection): Promise<any>;
67
- }
68
- export interface DescribeWSDL {
69
- (connection: SOAPConnection): Promise<any>;
70
- (wsdlDefinition: string): Promise<any>;
71
- }
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBasicAuthConnection = exports.isSOAPConnection = void 0;
4
- /**
5
- * This function determines if the object presented is a SOAP connection with a `wsdlDefinitionUrl` field.
6
- * @param connection The connection to test
7
- * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
8
- */
9
- const isSOAPConnection = (connection) => {
10
- if (typeof connection === "object" && connection !== null)
11
- return "wsdlDefinitionURL" in (connection === null || connection === void 0 ? void 0 : connection.fields);
12
- return false;
13
- };
14
- exports.isSOAPConnection = isSOAPConnection;
15
- /**
16
- * This function determines if the object presented is a Basic Auth connection with `username`, `password`, and `loginMethod` fields.
17
- * @param connection The connection to test
18
- * @returns This function returns true if the connection is a SOAPConnection, and false otherwise.
19
- */
20
- const isBasicAuthConnection = (connection) => {
21
- const { fields } = connection;
22
- return ("username" in fields && "password" in fields && "loginMethod" in fields);
23
- };
24
- exports.isBasicAuthConnection = isBasicAuthConnection;
@@ -1,12 +0,0 @@
1
- import { ClientOverrides, GenerateHeader, SOAPAuth, SOAPConnection, SOAPRequest, DescribeWSDL } from "./types";
2
- import { Client } from "soap";
3
- declare const _default: {
4
- describeWSDL: DescribeWSDL;
5
- generateHeader: GenerateHeader;
6
- getSOAPAuth: SOAPAuth;
7
- getSOAPClient: <T extends string | SOAPConnection = string | SOAPConnection>(wsdlParam: T) => Promise<Client>;
8
- getWSDL: (wsdlDefinitionURL: string) => Promise<string>;
9
- overrideClientDefaults: (client: Client, overrides: ClientOverrides) => void;
10
- soapRequest: SOAPRequest;
11
- };
12
- export default _default;