@prismatic-io/spectral 8.0.0-preview8 → 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,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, ActionPerformFunction, ActionPerformReturn, TriggerEventFunction, TriggerPerformFunction, 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,18 +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
37
  };
34
- /** Defines common attributes of a Flow of a Code-Native Integration. */
35
- declare type BaseFlow = {
38
+ /** Defines attributes of a Flow of a Code-Native Integration. */
39
+ export interface Flow<TConfigVars extends ConfigVarCollection = ConfigVarCollection, TTriggerPayload extends TriggerPayload = TriggerPayload> {
36
40
  /** The unique name for this Flow. */
37
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;
38
44
  /** Optional description for this Flow. */
39
45
  description?: string;
40
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,56 +57,31 @@ declare type BaseFlow = {
51
57
  schedule?: FlowSchedule;
52
58
  /** Optional error handling configuration. */
53
59
  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
60
  /** Specifies the trigger function for this Flow, which returns a payload and optional HTTP response. */
60
- onTrigger: TriggerPerformFunction<Inputs, false, TriggerResult<false>>;
61
+ onTrigger: TriggerPerformFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true, false, TriggerResult<false, TTriggerPayload>>;
61
62
  /** Specifies the function to execute when an Instance of this Integration is deployed. */
62
- onInstanceDeploy?: TriggerEventFunction<Inputs>;
63
+ onInstanceDeploy?: TriggerEventFunction<Inputs, ConfigVarDefinitionsToResults<TConfigVars>, true>;
63
64
  /** 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;
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
+ }
73
77
  /** Defines attributes of a Data Source that is defined as part of a Code Native Integration. */
74
78
  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
- };
100
79
  /** Common attribute shared by all types of Config Vars. */
101
80
  declare type BaseConfigVar = {
102
81
  /** The unique key for this Config Var. */
103
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;
104
85
  /** Optional description for this Config Var. */
105
86
  description?: string;
106
87
  /** Optional value that specifies whether this Config Var is only configurable by Organization users. @default false */
@@ -128,21 +109,15 @@ export declare type StandardConfigVar = BaseConfigVar & {
128
109
  codeLanguage?: CodeLanguageType;
129
110
  /** Optional value to specify the type of collection if the Config Var is multi-value. */
130
111
  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;
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;
136
115
  };
137
116
  /** Defines attributes of a Config Var that represents a Connection. */
138
117
  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;
118
+ export declare type ConfigVar = StandardConfigVar | ConnectionConfigVar;
144
119
  /** Defines attributes of a Config Wizard Page used when deploying an Instance of an Integration. */
145
- export declare type ConfigPage = {
120
+ export declare type ConfigPage<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = {
146
121
  /** The unique name for this Config Page. */
147
122
  name: string;
148
123
  /** Specifies an optional tagline for this Config Page. */
@@ -151,7 +126,7 @@ export declare type ConfigPage = {
151
126
  * part of User Level Configuration. @default false */
152
127
  userLevelConfigured?: boolean;
153
128
  /** Elements included on this Config Page. */
154
- elements: ConfigPageElement[];
129
+ elements: ConfigPageElement<TConfigVars>[];
155
130
  };
156
131
  /** Defines attributes of Inputs for Connections, Actions, Triggers,
157
132
  * Data Sources, and Config Vars. */
@@ -171,12 +146,19 @@ export declare type ComplexInputValue = {
171
146
  };
172
147
  export declare type ComplexInputValueType = (string | InputValue | ComplexInputValueType)[];
173
148
  /** 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. */
149
+ export declare type ConfigPageElement<TConfigVars extends ConfigVarCollection = ConfigVarCollection> = HTMLConfigPageElement | JSONFormConfigPageElement | ConfigVarPageElement<TConfigVars>;
150
+ declare type HTMLConfigPageElement = {
151
+ type: ConfigPageElementType.HTML;
178
152
  value: string;
179
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
+ };
180
162
  /** Defines attributes of a Preprocess Flow Configuration used by a Flow of an Integration. */
181
163
  export declare type PreprocessFlowConfig = {
182
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-preview8",
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;