@prismatic-io/spectral 8.0.0-preview8 → 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.
Files changed (35) hide show
  1. package/dist/clients/http/index.d.ts +1 -1
  2. package/dist/index.d.ts +15 -16
  3. package/dist/index.js +11 -10
  4. package/dist/serverTypes/convert.d.ts +3 -3
  5. package/dist/serverTypes/convert.js +6 -270
  6. package/dist/serverTypes/convertIntegration.d.ts +3 -0
  7. package/dist/serverTypes/convertIntegration.js +242 -0
  8. package/dist/serverTypes/index.d.ts +10 -9
  9. package/dist/serverTypes/integration.d.ts +60 -0
  10. package/dist/serverTypes/integration.js +4 -0
  11. package/dist/testing.d.ts +20 -20
  12. package/dist/testing.js +67 -76
  13. package/dist/types/ActionDefinition.d.ts +3 -3
  14. package/dist/types/ActionInputParameters.d.ts +1 -14
  15. package/dist/types/ActionPerformFunction.d.ts +6 -6
  16. package/dist/types/ComponentDefinition.d.ts +3 -3
  17. package/dist/types/DataSourceDefinition.d.ts +3 -3
  18. package/dist/types/DataSourcePerformFunction.d.ts +3 -8
  19. package/dist/types/DataSourceResult.d.ts +1 -3
  20. package/dist/types/Inputs.d.ts +52 -42
  21. package/dist/types/IntegrationDefinition.d.ts +44 -118
  22. package/dist/types/IntegrationDefinition.js +5 -19
  23. package/dist/types/TriggerDefinition.d.ts +5 -5
  24. package/dist/types/TriggerEventFunction.d.ts +2 -2
  25. package/dist/types/TriggerPerformFunction.d.ts +2 -2
  26. package/dist/types/TriggerResult.d.ts +4 -4
  27. package/dist/types/utils.d.ts +5 -0
  28. package/dist/types/utils.js +2 -0
  29. package/package.json +5 -4
  30. package/dist/clients/soap/index.d.ts +0 -2
  31. package/dist/clients/soap/index.js +0 -18
  32. package/dist/clients/soap/types.d.ts +0 -71
  33. package/dist/clients/soap/types.js +0 -24
  34. package/dist/clients/soap/utils.d.ts +0 -12
  35. package/dist/clients/soap/utils.js +0 -191
@@ -1,6 +1,13 @@
1
- import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType } from ".";
1
+ import { DataSourceDefinition, ConnectionDefinition, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, Inputs, TriggerResult, DataSourceType, TriggerPayload, Connection, JSONForm, ObjectFieldMap, ObjectSelection, ConfigVarResultCollection } from ".";
2
+ import { Prettify, UnionToIntersection, ValueOf } from "./utils";
3
+ declare type ToDataSourceRuntimeType<TType extends DataSourceType> = TType extends "jsonForm" ? JSONForm : TType extends "objectSelection" ? ObjectSelection : TType extends "objectFieldMap" ? ObjectFieldMap : string;
4
+ export declare type ElementToRuntimeType<TElement extends ConfigPageElement> = TElement extends ConnectionConfigVar ? Connection : TElement extends DataSourceConfigVar ? ToDataSourceRuntimeType<TElement["dataSourceType"]> : TElement extends StandardConfigVar ? string : never;
5
+ declare type GetElements<TConfigPages extends ConfigPages> = TConfigPages extends ConfigPages ? UnionToIntersection<ValueOf<TConfigPages>["elements"]> : never;
6
+ export declare type ExtractConfigVars<TConfigPages extends ConfigPages, TElements extends ConfigPage["elements"] = GetElements<TConfigPages>> = Prettify<{
7
+ [Key in keyof TElements]: ElementToRuntimeType<TElements[Key]>;
8
+ }>;
2
9
  /** Defines attributes of a Code-Native Integration. */
3
- export declare type IntegrationDefinition = {
10
+ export declare type IntegrationDefinition<TConfigPages extends ConfigPages> = {
4
11
  /** The unique name for this Integration. */
5
12
  name: string;
6
13
  /** Optional description for this Integration. */
@@ -23,18 +30,16 @@ export declare type IntegrationDefinition = {
23
30
  * Cannot specify this if a Preprocess Flow is also configured. */
24
31
  triggerPreprocessFlowConfig?: PreprocessFlowConfig;
25
32
  /** Flows for this Integration. */
26
- flows: Flow[];
27
- /** Config Vars used on this Integration. */
28
- configVars?: ConfigVar[];
33
+ flows: Flow<TConfigPages>[];
29
34
  /** Config Wizard Pages for this Integration. */
30
- configPages?: ConfigPage[];
31
- /** Specifies any Data Sources that are defined as part of this Integration. */
32
- dataSources?: Record<string, CodeNativeDataSource>;
35
+ configPages?: TConfigPages;
33
36
  };
34
- /** Defines common attributes of a Flow of a Code-Native Integration. */
35
- declare type BaseFlow = {
37
+ /** Defines attributes of a Flow of a Code-Native Integration. */
38
+ export interface Flow<TConfigPages extends ConfigPages, TTriggerPayload extends TriggerPayload = TriggerPayload> {
36
39
  /** The unique name for this Flow. */
37
40
  name: string;
41
+ /** A unique, unchanging value that is used to maintain identity for the Flow even if the name changes. */
42
+ stableKey: string;
38
43
  /** Optional description for this Flow. */
39
44
  description?: string;
40
45
  /** 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,62 +56,31 @@ declare type BaseFlow = {
51
56
  schedule?: FlowSchedule;
52
57
  /** Optional error handling configuration. */
53
58
  errorConfig?: StepErrorConfig;
54
- /** Specifies the main function for this Flow */
55
- onExecution: ActionPerformFunction<Inputs, false, ActionPerformReturn<false, unknown>>;
56
- };
57
- /** Defines attributes of a Flow that will have custom Trigger logic. */
58
- declare type CustomTriggerFlow = BaseFlow & {
59
59
  /** Specifies the trigger function for this Flow, which returns a payload and optional HTTP response. */
60
- onTrigger: TriggerPerformFunction<Inputs, false, TriggerResult<false>>;
60
+ onTrigger: TriggerPerformFunction<Inputs, ExtractConfigVars<TConfigPages>, false, TriggerResult<false, TTriggerPayload>>;
61
61
  /** Specifies the function to execute when an Instance of this Integration is deployed. */
62
- onInstanceDeploy?: TriggerEventFunction<Inputs>;
62
+ onInstanceDeploy?: TriggerEventFunction<Inputs, ExtractConfigVars<TConfigPages>>;
63
63
  /** Specifies the function to execute when an Instance of an Integration is deleted. */
64
- onInstanceDelete?: TriggerEventFunction<Inputs>;
65
- };
66
- /** Defines attributes of a Flow that will use a Trigger from an existing Component. */
67
- declare type PrebuiltTriggerFlow = BaseFlow & {
68
- /** Specifies the prebuilt Trigger that will run when this Flow executes. */
69
- trigger: TriggerReference;
70
- };
71
- /** Defines attributes of a Flow of a Code-Native Integration. */
72
- export declare type Flow = CustomTriggerFlow | PrebuiltTriggerFlow;
73
- /** Defines attributes of a Data Source that is defined as part of a Code Native Integration. */
74
- export declare type CodeNativeDataSource = Pick<DataSourceDefinition<Inputs, DataSourceType>, "display" | "perform" | "dataSourceType" | "detailDataSource">;
75
- /** Defines attributes of a reference to an existing Trigger. */
76
- export declare type TriggerReference = {
77
- /** Attributes of the referenced Component. */
78
- component: ComponentReference;
79
- /** The unique key that identifies the Trigger within the Component. */
80
- key: string;
81
- /** Optional input values for this Trigger. */
82
- inputs?: InputValues;
83
- };
84
- /** Defines attributes of a reference to an existing Data Source. */
85
- export declare type DataSourceReference = {
86
- /** Attributes of the referenced Component. */
87
- component: ComponentReference;
88
- /** The unique key that identifies the Data Source within the Component. */
89
- key: string;
90
- };
91
- /** Defines attributes of a reference to a member of an existing Component. */
92
- export declare type ComponentReference = {
93
- /** The unique key that identifies the Component. */
94
- key: string;
95
- /** The version of the Component. */
96
- version: number | "LATEST";
97
- /** Specifies whether the Component is in the public library or a private Component. */
98
- isPublic: boolean;
99
- };
64
+ onInstanceDelete?: TriggerEventFunction<Inputs, ExtractConfigVars<TConfigPages>>;
65
+ /** Specifies the main function for this Flow */
66
+ onExecution: ActionPerformFunction<{
67
+ onTrigger: {
68
+ type: "data";
69
+ label: string;
70
+ clean: (value: unknown) => {
71
+ results: TTriggerPayload;
72
+ };
73
+ };
74
+ }, ExtractConfigVars<TConfigPages>, false, ActionPerformReturn<false, unknown>>;
75
+ }
100
76
  /** Common attribute shared by all types of Config Vars. */
101
77
  declare type BaseConfigVar = {
102
- /** The unique key for this Config Var. */
103
- key: string;
78
+ /** A unique, unchanging value that is used to maintain identity for the Config Var even if the key changes. */
79
+ stableKey: string;
104
80
  /** Optional description for this Config Var. */
105
81
  description?: string;
106
82
  /** Optional value that specifies whether this Config Var is only configurable by Organization users. @default false */
107
83
  orgOnly?: boolean;
108
- /** Optional input values for this Config Var. */
109
- inputs?: InputValues;
110
84
  /** Optional value that specifies whether this Config Var is visible to an Organization deployer. @default true */
111
85
  visibleToOrgDeployer?: boolean;
112
86
  /** Optional value that specifies whether this Config Var is visible to a Customer deployer. @default true */
@@ -114,10 +88,10 @@ declare type BaseConfigVar = {
114
88
  };
115
89
  /** Defines attributes of a standard Config Var. */
116
90
  export declare type StandardConfigVar = BaseConfigVar & {
117
- /** Optional default value for the Config Var. */
118
- defaultValue?: string;
119
91
  /** The data type of the Config Var. */
120
92
  dataType: ConfigVarDataType;
93
+ /** Optional default value for the Config Var. */
94
+ defaultValue?: string;
121
95
  /** Optional list of picklist values if the Config Var is a multi-choice selection value. */
122
96
  pickList?: string[];
123
97
  /** Optional schedule type that defines the cadence of the schedule. */
@@ -128,54 +102,22 @@ export declare type StandardConfigVar = BaseConfigVar & {
128
102
  codeLanguage?: CodeLanguageType;
129
103
  /** Optional value to specify the type of collection if the Config Var is multi-value. */
130
104
  collectionType?: CollectionType;
131
- /** Optional value to specify the Data Source where the Config Var sources
132
- * its values. If it's a string then it's expected to be the key of a
133
- * CodeNativeDataSource defined in the Code Native Integration. Otherwise it
134
- * is expected to be a reference to an existing Data Source. */
135
- dataSource?: string | DataSourceReference;
136
105
  };
106
+ /** Defines attributes of a data source Config Var. */
107
+ export declare type DataSourceConfigVar = BaseConfigVar & Omit<DataSourceDefinition<Inputs, ConfigVarResultCollection, DataSourceType>, "display" | "inputs" | "examplePayload">;
137
108
  /** Defines attributes of a Config Var that represents a Connection. */
138
- export declare type ConnectionConfigVar = Omit<BaseConfigVar, "description" | "inputs"> & ConnectionDefinition;
139
- export declare type ConnectionRefConfigVar = BaseConfigVar & {
140
- /** Attributes of the referenced Component. */
141
- component: ComponentReference;
142
- };
143
- export declare type ConfigVar = StandardConfigVar | ConnectionConfigVar | ConnectionRefConfigVar;
109
+ export declare type ConnectionConfigVar = BaseConfigVar & Omit<ConnectionDefinition, "label" | "comments" | "key">;
110
+ export declare type ConfigVar = StandardConfigVar | DataSourceConfigVar | ConnectionConfigVar;
111
+ export declare const isDataSourceConfigVar: (cv: ConfigVar) => cv is DataSourceConfigVar;
112
+ export declare const isConnectionConfigVar: (cv: ConfigVar) => cv is ConnectionConfigVar;
113
+ export declare type ConfigPageElement = string | ConfigVar;
114
+ export declare type ConfigPages = Record<string, ConfigPage>;
144
115
  /** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */
145
116
  export declare type ConfigPage = {
146
- /** The unique name for this Config Page. */
147
- name: string;
117
+ /** Elements included on this Config Page. */
118
+ elements: Record<string, ConfigPageElement>;
148
119
  /** Specifies an optional tagline for this Config Page. */
149
120
  tagline?: string;
150
- /** Optional value that specifies whether this Config Page is configured as
151
- * part of User Level Configuration. @default false */
152
- userLevelConfigured?: boolean;
153
- /** Elements included on this Config Page. */
154
- elements: ConfigPageElement[];
155
- };
156
- /** Defines attributes of Inputs for Connections, Actions, Triggers,
157
- * Data Sources, and Config Vars. */
158
- export declare type InputValues = Record<string, InputValue>;
159
- export declare type InputValue = SimpleInputValue | ComplexInputValue;
160
- export declare type SimpleInputValue = {
161
- name?: string;
162
- type: SimpleInputValueType;
163
- value: string;
164
- meta?: Record<string, unknown>;
165
- };
166
- export declare type ComplexInputValue = {
167
- name?: string;
168
- type: "complex";
169
- value: ComplexInputValueType;
170
- meta?: Record<string, unknown>;
171
- };
172
- export declare type ComplexInputValueType = (string | InputValue | ComplexInputValueType)[];
173
- /** Defines attributes of an Element that appears on a Config Wizard Page. */
174
- export declare type ConfigPageElement = {
175
- /** Specifies what type of data is represented by this Element. */
176
- type: ConfigPageElementType;
177
- /** Specifies the value of this Element. */
178
- value: string;
179
121
  };
180
122
  /** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */
181
123
  export declare type PreprocessFlowConfig = {
@@ -222,13 +164,6 @@ export declare type FlowSchedule = {
222
164
  /** Specifies an optional value to use as the timezone. */
223
165
  timeZone?: string;
224
166
  };
225
- /** Choices of Simple Input Value Types that may be used by Simple Input Values. */
226
- export declare enum SimpleInputValueType {
227
- Value = "value",
228
- Reference = "reference",
229
- ConfigVar = "configVar",
230
- Template = "template"
231
- }
232
167
  /** Choices of Endpoint Types that may be used by Instances of an Integration. */
233
168
  export declare enum EndpointType {
234
169
  FlowSpecific = "flow_specific",
@@ -242,12 +177,6 @@ export declare enum EndpointSecurityType {
242
177
  CustomerRequired = "customer_required",
243
178
  Organization = "organization"
244
179
  }
245
- /** Choices of Config Page Element Types that may be used for Elements on a Config Wizard Page. */
246
- export declare enum ConfigPageElementType {
247
- ConfigVar = "configVar",
248
- HTML = "htmlElement",
249
- JSONForm = "jsonForm"
250
- }
251
180
  /** Choices of Step Error Handlers that define the behavior when a step error occurs. */
252
181
  export declare enum StepErrorHandlerType {
253
182
  Fail = "fail",
@@ -272,10 +201,7 @@ export declare enum ConfigVarDataType {
272
201
  Schedule = "schedule",
273
202
  Code = "code",
274
203
  Boolean = "boolean",
275
- Number = "number",
276
- ObjectSelection = "objectSelection",
277
- ObjectFieldMap = "objectFieldMap",
278
- JSONForm = "jsonForm"
204
+ Number = "number"
279
205
  }
280
206
  /** Choices of programming languages that may be used for Config Var code values. */
281
207
  export declare enum CodeLanguageType {
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
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 = {}));
3
+ exports.CollectionType = exports.CodeLanguageType = exports.ConfigVarDataType = exports.ScheduleType = exports.StepErrorHandlerType = exports.EndpointSecurityType = exports.EndpointType = exports.isConnectionConfigVar = exports.isDataSourceConfigVar = void 0;
4
+ const isDataSourceConfigVar = (cv) => "dataSourceType" in cv;
5
+ exports.isDataSourceConfigVar = isDataSourceConfigVar;
6
+ const isConnectionConfigVar = (cv) => "inputs" in cv;
7
+ exports.isConnectionConfigVar = isConnectionConfigVar;
12
8
  /** Choices of Endpoint Types that may be used by Instances of an Integration. */
13
9
  var EndpointType;
14
10
  (function (EndpointType) {
@@ -24,13 +20,6 @@ var EndpointSecurityType;
24
20
  EndpointSecurityType["CustomerRequired"] = "customer_required";
25
21
  EndpointSecurityType["Organization"] = "organization";
26
22
  })(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
23
  /** Choices of Step Error Handlers that define the behavior when a step error occurs. */
35
24
  var StepErrorHandlerType;
36
25
  (function (StepErrorHandlerType) {
@@ -59,9 +48,6 @@ var ConfigVarDataType;
59
48
  ConfigVarDataType["Code"] = "code";
60
49
  ConfigVarDataType["Boolean"] = "boolean";
61
50
  ConfigVarDataType["Number"] = "number";
62
- ConfigVarDataType["ObjectSelection"] = "objectSelection";
63
- ConfigVarDataType["ObjectFieldMap"] = "objectFieldMap";
64
- ConfigVarDataType["JSONForm"] = "jsonForm";
65
51
  })(ConfigVarDataType = exports.ConfigVarDataType || (exports.ConfigVarDataType = {}));
66
52
  /** Choices of programming languages that may be used for Config Var code values. */
67
53
  var CodeLanguageType;
@@ -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, 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>;
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>;
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> = (context: ActionContext<TConfigVars>, 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, TAllowsBranching extends boolean | undefined, TResult extends TriggerResult<TAllowsBranching, TriggerPayload>> = (context: ActionContext<TConfigVars>, 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;
@@ -0,0 +1,5 @@
1
+ export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
2
+ export declare type Prettify<T> = {
3
+ [K in keyof T]: T[K];
4
+ };
5
+ export declare type ValueOf<T> = T[keyof T];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismatic-io/spectral",
3
- "version": "8.0.0-preview8",
3
+ "version": "8.0.1",
4
4
  "description": "Utility library for building Prismatic components",
5
5
  "keywords": [
6
6
  "prismatic"
@@ -38,14 +38,14 @@
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
+ "lodash": "4.17.21",
46
47
  "safe-stable-stringify": "2.3.1",
47
48
  "serialize-error": "8.1.0",
48
- "soap": "1.0.0",
49
49
  "url-join": "5.0.0",
50
50
  "uuid": "8.3.2",
51
51
  "valid-url": "1.0.9",
@@ -53,6 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/jest": "27.4.1",
56
+ "@types/lodash": "4.14.202",
56
57
  "@types/node": "14.14.35",
57
58
  "@types/sax": "1.2.4",
58
59
  "@types/url-join": "4.0.1",
@@ -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;