@useparagon/connect 0.0.16-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/src/ConnectSDK.d.ts +245 -0
- package/dist/src/SDKEventEmitter.d.ts +56 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/entities/base.entity.d.ts +5 -0
- package/dist/src/entities/connectCredential.interface.d.ts +36 -0
- package/dist/src/entities/credential.interface.d.ts +15 -0
- package/dist/src/entities/customIntegration.interface.d.ts +60 -0
- package/dist/src/entities/integration.interface.d.ts +45 -0
- package/dist/src/entities/integrationConfig.interface.d.ts +9 -0
- package/dist/src/entities/license.interface.d.ts +6 -0
- package/dist/src/entities/persona.interface.d.ts +34 -0
- package/dist/src/entities/project.interface.d.ts +32 -0
- package/dist/src/entities/steps.d.ts +30 -0
- package/dist/src/entities/team.interface.d.ts +19 -0
- package/dist/src/entities/user.interface.d.ts +23 -0
- package/dist/src/entities/workflow.interface.d.ts +11 -0
- package/dist/src/file-picker/integrations/googledrive.d.ts +24 -0
- package/dist/src/file-picker/integrations/index.d.ts +5 -0
- package/dist/src/file-picker/types/baseFilePicker.d.ts +32 -0
- package/dist/src/file-picker/types/externalFilePicker.d.ts +9 -0
- package/dist/src/file-picker/types/index.d.ts +1 -0
- package/dist/src/helpers/ConnectUserContext.d.ts +18 -0
- package/dist/src/helpers/index.d.ts +29 -0
- package/dist/src/helpers/oauth.d.ts +20 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.LICENSE.txt +14 -0
- package/dist/src/server.types.d.ts +14 -0
- package/dist/src/types/action.d.ts +266 -0
- package/dist/src/types/billing.d.ts +2 -0
- package/dist/src/types/connect.d.ts +213 -0
- package/dist/src/types/connectModal.d.ts +35 -0
- package/dist/src/types/environment.d.ts +16 -0
- package/dist/src/types/execution.d.ts +5 -0
- package/dist/src/types/index.d.ts +9 -0
- package/dist/src/types/resolvers.d.ts +297 -0
- package/dist/src/types/sdk.d.ts +302 -0
- package/dist/src/types/stripe.d.ts +23 -0
- package/dist/src/utils/connect.d.ts +13 -0
- package/dist/src/utils/crypto.d.ts +7 -0
- package/dist/src/utils/generic.d.ts +30 -0
- package/dist/src/utils/http.d.ts +57 -0
- package/dist/src/utils/throttle.d.ts +118 -0
- package/package.json +103 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { TokenType } from './action';
|
|
3
|
+
import { FanoutStackEntry } from './execution';
|
|
4
|
+
export declare enum DataType {
|
|
5
|
+
STRING = "STRING",
|
|
6
|
+
NUMBER = "NUMBER",
|
|
7
|
+
DATE = "DATE",
|
|
8
|
+
BOOLEAN = "BOOLEAN",
|
|
9
|
+
EMAIL = "EMAIL",
|
|
10
|
+
OBJECT = "OBJECT",
|
|
11
|
+
ARRAY = "ARRAY",
|
|
12
|
+
ANY = "ANY",
|
|
13
|
+
FILE = "FILE",
|
|
14
|
+
NON_DECIMAL = "NON_DECIMAL"
|
|
15
|
+
}
|
|
16
|
+
export type TokenizedSource<T extends DataType = DataType> = {
|
|
17
|
+
dataType?: T;
|
|
18
|
+
type: 'TOKENIZED';
|
|
19
|
+
parts: TokenizedValue[];
|
|
20
|
+
};
|
|
21
|
+
type TokenizedValue<T extends DataType = DataType> = ValueSource<T> | VariableSource<T> | SecretSource | ConnectCredentialSource | ObjectValueSource | PersonaMetadataSource;
|
|
22
|
+
type ObjectValueSource<T extends DataType = DataType> = {
|
|
23
|
+
type: 'OBJECT_VALUE';
|
|
24
|
+
name: string;
|
|
25
|
+
path: string[];
|
|
26
|
+
dataType?: T;
|
|
27
|
+
};
|
|
28
|
+
type VariableSource<T extends DataType = DataType> = {
|
|
29
|
+
dataType?: T;
|
|
30
|
+
type: 'VARIABLE';
|
|
31
|
+
stepId: string;
|
|
32
|
+
path: string[];
|
|
33
|
+
};
|
|
34
|
+
type SecretSource = {
|
|
35
|
+
type: 'ENVIRONMENT_SECRET';
|
|
36
|
+
environmentSecretId: string;
|
|
37
|
+
};
|
|
38
|
+
type ValueSource<T extends DataType = DataType> = {
|
|
39
|
+
dataType?: T;
|
|
40
|
+
type: 'VALUE';
|
|
41
|
+
value: DataTypeValues[T];
|
|
42
|
+
};
|
|
43
|
+
type ConnectCredentialSource = {
|
|
44
|
+
type: 'CONNECT_CREDENTIAL_FIELD';
|
|
45
|
+
fieldType: 'WORKFLOW_SETTING';
|
|
46
|
+
inputId: string;
|
|
47
|
+
/**
|
|
48
|
+
* @since PARA-3065: ConnectInputValue can now include more than a string/number type, so a
|
|
49
|
+
* path is specified similarly to VariableSource to traverse object types.
|
|
50
|
+
*/
|
|
51
|
+
path?: string[];
|
|
52
|
+
} | {
|
|
53
|
+
type: 'CONNECT_CREDENTIAL_FIELD';
|
|
54
|
+
fieldType: 'SHARED_WORKFLOW_SETTING';
|
|
55
|
+
inputId: string;
|
|
56
|
+
path?: string[];
|
|
57
|
+
} | {
|
|
58
|
+
type: 'CONNECT_CREDENTIAL_FIELD';
|
|
59
|
+
fieldType: 'EXTERNAL_USER_ID';
|
|
60
|
+
} | {
|
|
61
|
+
type: 'CONNECT_CREDENTIAL_FIELD';
|
|
62
|
+
fieldType: 'EXTERNAL_USER_PROVIDER_ID';
|
|
63
|
+
} | {
|
|
64
|
+
type: 'CONNECT_CREDENTIAL_FIELD';
|
|
65
|
+
fieldType: 'OAUTH_ACCESS_TOKEN';
|
|
66
|
+
} | {
|
|
67
|
+
type: 'CONNECT_CREDENTIAL_FIELD';
|
|
68
|
+
fieldType: 'EXTERNAL_USER_PROVIDER_DATA';
|
|
69
|
+
dataKey: string;
|
|
70
|
+
};
|
|
71
|
+
type PersonaMetadataSource = {
|
|
72
|
+
type: 'PERSONA_METADATA';
|
|
73
|
+
path?: string[];
|
|
74
|
+
};
|
|
75
|
+
type DataTypeValues = {
|
|
76
|
+
[DataType.STRING]: string;
|
|
77
|
+
[DataType.NUMBER]: number;
|
|
78
|
+
[DataType.DATE]: Date;
|
|
79
|
+
[DataType.BOOLEAN]: boolean;
|
|
80
|
+
[DataType.EMAIL]: string;
|
|
81
|
+
[DataType.OBJECT]: object;
|
|
82
|
+
[DataType.ARRAY]: any[];
|
|
83
|
+
[DataType.ANY]: any;
|
|
84
|
+
[DataType.FILE]: FileValue;
|
|
85
|
+
[DataType.NON_DECIMAL]: number;
|
|
86
|
+
};
|
|
87
|
+
type FileDataType = Buffer;
|
|
88
|
+
type FileValue = {
|
|
89
|
+
data: FileDataType;
|
|
90
|
+
dataType: DataType.FILE;
|
|
91
|
+
encoding?: string;
|
|
92
|
+
id?: string;
|
|
93
|
+
mimeType?: string;
|
|
94
|
+
name?: string;
|
|
95
|
+
size?: string;
|
|
96
|
+
};
|
|
97
|
+
export type KeyedSource<T extends DataType = DataType> = {
|
|
98
|
+
key: string;
|
|
99
|
+
source: Source<T>;
|
|
100
|
+
};
|
|
101
|
+
export type Source<T extends DataType = DataType> = ValueSource<T> | VariableSource<T> | TokenizedSource<T> | ConditionSource | SecretSource | ExecutionSource | FanoutExecutionSource | UserSuppliedCredentialSource | ConnectCredentialSource | ObjectValueSource | PersonaMetadataSource;
|
|
102
|
+
type ConditionSource = {
|
|
103
|
+
type: 'CONDITION';
|
|
104
|
+
condition: ConditionWrapper;
|
|
105
|
+
};
|
|
106
|
+
type ConditionWrapper = JoinedConditions | OperatorCondition;
|
|
107
|
+
type JoinedConditions = AndConditions | OrConditions;
|
|
108
|
+
type AndConditions = {
|
|
109
|
+
type: 'JOIN';
|
|
110
|
+
join: 'AND';
|
|
111
|
+
conditions: ConditionWrapper[];
|
|
112
|
+
};
|
|
113
|
+
export type OrConditions = {
|
|
114
|
+
type: 'JOIN';
|
|
115
|
+
join: 'OR';
|
|
116
|
+
conditions: ConditionWrapper[];
|
|
117
|
+
};
|
|
118
|
+
type OperatorCondition = {
|
|
119
|
+
type: 'OPERATOR';
|
|
120
|
+
condition: Condition;
|
|
121
|
+
};
|
|
122
|
+
type Condition = {
|
|
123
|
+
operator: Operator.None;
|
|
124
|
+
variable: Source<DataType.ANY>;
|
|
125
|
+
} | {
|
|
126
|
+
operator: Operator.StringContains;
|
|
127
|
+
variable: Source<DataType.STRING>;
|
|
128
|
+
argument: Source<DataType.STRING>;
|
|
129
|
+
} | {
|
|
130
|
+
operator: Operator.StringDoesNotContain;
|
|
131
|
+
variable: Source<DataType.STRING>;
|
|
132
|
+
argument: Source<DataType.STRING>;
|
|
133
|
+
} | {
|
|
134
|
+
operator: Operator.StringExactlyMatches;
|
|
135
|
+
variable: Source<DataType.STRING>;
|
|
136
|
+
argument: Source<DataType.STRING>;
|
|
137
|
+
} | {
|
|
138
|
+
operator: Operator.StringDoesNotExactlyMatch;
|
|
139
|
+
variable: Source<DataType.STRING>;
|
|
140
|
+
argument: Source<DataType.STRING>;
|
|
141
|
+
} | {
|
|
142
|
+
operator: Operator.StringIsIn;
|
|
143
|
+
variable: Source<DataType.STRING>;
|
|
144
|
+
argument: Source<DataType.STRING>;
|
|
145
|
+
} | {
|
|
146
|
+
operator: Operator.StringIsNotIn;
|
|
147
|
+
variable: Source<DataType.STRING>;
|
|
148
|
+
argument: Source<DataType.STRING>;
|
|
149
|
+
} | {
|
|
150
|
+
operator: Operator.StringStartsWith;
|
|
151
|
+
variable: Source<DataType.STRING>;
|
|
152
|
+
argument: Source<DataType.STRING>;
|
|
153
|
+
} | {
|
|
154
|
+
operator: Operator.StringDoesNotStartWith;
|
|
155
|
+
variable: Source<DataType.STRING>;
|
|
156
|
+
argument: Source<DataType.STRING>;
|
|
157
|
+
} | {
|
|
158
|
+
operator: Operator.StringEndsWith;
|
|
159
|
+
variable: Source<DataType.STRING>;
|
|
160
|
+
argument: Source<DataType.STRING>;
|
|
161
|
+
} | {
|
|
162
|
+
operator: Operator.StringDoesNotEndWith;
|
|
163
|
+
variable: Source<DataType.STRING>;
|
|
164
|
+
argument: Source<DataType.STRING>;
|
|
165
|
+
} | {
|
|
166
|
+
operator: Operator.NumberGreaterThan;
|
|
167
|
+
variable: Source<DataType.NUMBER>;
|
|
168
|
+
argument: Source<DataType.NUMBER>;
|
|
169
|
+
} | {
|
|
170
|
+
operator: Operator.NumberLessThan;
|
|
171
|
+
variable: Source<DataType.NUMBER>;
|
|
172
|
+
argument: Source<DataType.NUMBER>;
|
|
173
|
+
} | {
|
|
174
|
+
operator: Operator.NumberGreaterThanOrEqualTo;
|
|
175
|
+
variable: Source<DataType.NUMBER>;
|
|
176
|
+
argument: Source<DataType.NUMBER>;
|
|
177
|
+
} | {
|
|
178
|
+
operator: Operator.NumberLessThanOrEqualTo;
|
|
179
|
+
variable: Source<DataType.NUMBER>;
|
|
180
|
+
argument: Source<DataType.NUMBER>;
|
|
181
|
+
} | {
|
|
182
|
+
operator: Operator.NumberEquals;
|
|
183
|
+
variable: Source<DataType.NUMBER>;
|
|
184
|
+
argument: Source<DataType.NUMBER>;
|
|
185
|
+
} | {
|
|
186
|
+
operator: Operator.NumberDoesNotEqual;
|
|
187
|
+
variable: Source<DataType.NUMBER>;
|
|
188
|
+
argument: Source<DataType.NUMBER>;
|
|
189
|
+
} | {
|
|
190
|
+
operator: Operator.DateTimeAfter;
|
|
191
|
+
variable: Source<DataType.DATE>;
|
|
192
|
+
argument: Source<DataType.DATE>;
|
|
193
|
+
} | {
|
|
194
|
+
operator: Operator.DateTimeBefore;
|
|
195
|
+
variable: Source<DataType.DATE>;
|
|
196
|
+
argument: Source<DataType.DATE>;
|
|
197
|
+
} | {
|
|
198
|
+
operator: Operator.DateTimeEquals;
|
|
199
|
+
variable: Source<DataType.DATE>;
|
|
200
|
+
argument: Source<DataType.DATE>;
|
|
201
|
+
} | {
|
|
202
|
+
operator: Operator.BooleanTrue;
|
|
203
|
+
variable: Source<DataType.BOOLEAN>;
|
|
204
|
+
} | {
|
|
205
|
+
operator: Operator.BooleanFalse;
|
|
206
|
+
variable: Source<DataType.BOOLEAN>;
|
|
207
|
+
} | {
|
|
208
|
+
operator: Operator.IsNull;
|
|
209
|
+
variable: Source;
|
|
210
|
+
} | {
|
|
211
|
+
operator: Operator.IsNotNull;
|
|
212
|
+
variable: Source;
|
|
213
|
+
} | {
|
|
214
|
+
operator: Operator.Exists;
|
|
215
|
+
variable: Source;
|
|
216
|
+
} | {
|
|
217
|
+
operator: Operator.DoesNotExist;
|
|
218
|
+
variable: Source;
|
|
219
|
+
} | {
|
|
220
|
+
operator: Operator.ArrayIsEmpty;
|
|
221
|
+
variable: Source<DataType.ARRAY>;
|
|
222
|
+
} | {
|
|
223
|
+
operator: Operator.ArrayIsNotEmpty;
|
|
224
|
+
variable: Source<DataType.ARRAY>;
|
|
225
|
+
} | {
|
|
226
|
+
operator: Operator.StringGreaterThan;
|
|
227
|
+
variable: Source<DataType.STRING>;
|
|
228
|
+
argument: Source<DataType.STRING>;
|
|
229
|
+
} | {
|
|
230
|
+
operator: Operator.StringLessThan;
|
|
231
|
+
variable: Source<DataType.STRING>;
|
|
232
|
+
argument: Source<DataType.STRING>;
|
|
233
|
+
};
|
|
234
|
+
declare enum Operator {
|
|
235
|
+
'None' = "$none",
|
|
236
|
+
'StringContains' = "$stringContains",
|
|
237
|
+
'StringDoesNotContain' = "$stringDoesNotContain",
|
|
238
|
+
'StringExactlyMatches' = "$stringExactlyMatches",
|
|
239
|
+
'StringDoesNotExactlyMatch' = "$stringDoesNotExactlyMatch",
|
|
240
|
+
'StringIsIn' = "$stringIsIn",
|
|
241
|
+
'StringIsNotIn' = "$stringIsNotIn",
|
|
242
|
+
'StringStartsWith' = "$stringStartsWith",
|
|
243
|
+
'StringDoesNotStartWith' = "$stringDoesNotStartWith",
|
|
244
|
+
'StringEndsWith' = "$stringEndsWith",
|
|
245
|
+
'StringDoesNotEndWith' = "$stringDoesNotEndWith",
|
|
246
|
+
'NumberGreaterThan' = "$numberGreaterThan",
|
|
247
|
+
'NumberLessThan' = "$numberLessThan",
|
|
248
|
+
'NumberEquals' = "$numberEquals",
|
|
249
|
+
'NumberDoesNotEqual' = "$numberDoesNotEqual",
|
|
250
|
+
'NumberLessThanOrEqualTo' = "$numberLessThanOrEqualTo",
|
|
251
|
+
'NumberGreaterThanOrEqualTo' = "$numberGreaterThanOrEqualTo",
|
|
252
|
+
'DateTimeAfter' = "$dateTimeAfter",
|
|
253
|
+
'DateTimeBefore' = "$dateTimeBefore",
|
|
254
|
+
'DateTimeEquals' = "$dateTimeEquals",
|
|
255
|
+
'BooleanTrue' = "$booleanTrue",
|
|
256
|
+
'BooleanFalse' = "$booleanFalse",
|
|
257
|
+
/** (PARA-5551) previously operators for Does Exist / Does Not Exist do a strict check for equality to null, resulting in a bug where value is undefined
|
|
258
|
+
* to handle this situation, we are adding 2 new operators IsNotNull and IsNull and changing functionality of
|
|
259
|
+
* Exist and DoesNotExist operators to handle undefined values
|
|
260
|
+
*/
|
|
261
|
+
'IsNotNull' = "$exists",
|
|
262
|
+
'IsNull' = "$doesNotExist",
|
|
263
|
+
'Exists' = "$isNotUndefinedOrNull",
|
|
264
|
+
'DoesNotExist' = "$isUndefinedOrNull",
|
|
265
|
+
'ArrayIsIn' = "$arrayIsIn",
|
|
266
|
+
'ArrayIsNotIn' = "$arrayIsNotIn",
|
|
267
|
+
'ArrayIsEmpty' = "$arrayIsEmpty",
|
|
268
|
+
'ArrayIsNotEmpty' = "$arrayIsNotEmpty",
|
|
269
|
+
'StringGreaterThan' = "$stringGreaterThan",
|
|
270
|
+
'StringLessThan' = "$stringLessThan"
|
|
271
|
+
}
|
|
272
|
+
type ExecutionSource = {
|
|
273
|
+
type: 'EXECUTION';
|
|
274
|
+
id: string;
|
|
275
|
+
stepId: string;
|
|
276
|
+
/**
|
|
277
|
+
* a timestamp representing when the execution occurred
|
|
278
|
+
*/
|
|
279
|
+
start: number;
|
|
280
|
+
fanoutStack: FanoutStackEntry[];
|
|
281
|
+
/**
|
|
282
|
+
* This flag suggests that the content of the variable will be stored on remmote storage service
|
|
283
|
+
* such as s3
|
|
284
|
+
*/
|
|
285
|
+
remoteCached?: boolean;
|
|
286
|
+
};
|
|
287
|
+
type FanoutExecutionSource = {
|
|
288
|
+
type: 'FANOUT_EXECUTION';
|
|
289
|
+
stepId: string;
|
|
290
|
+
};
|
|
291
|
+
type UserSuppliedCredentialSource = {
|
|
292
|
+
type: 'USER_SUPPLIED_CREDENTIAL';
|
|
293
|
+
tokenType: TokenType;
|
|
294
|
+
providerType: string;
|
|
295
|
+
credential: TokenizedSource<DataType.STRING>;
|
|
296
|
+
};
|
|
297
|
+
export {};
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import ConnectSDK from '../ConnectSDK';
|
|
2
|
+
import { IConnectCredential } from '../entities/connectCredential.interface';
|
|
3
|
+
import { OauthCallbackResponse } from '../entities/credential.interface';
|
|
4
|
+
import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from '../entities/integration.interface';
|
|
5
|
+
import { PersonaMeta } from '../entities/persona.interface';
|
|
6
|
+
import { IConnectUserContext } from '../helpers/ConnectUserContext';
|
|
7
|
+
import { AuthenticatedConnectUser, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, GetIntegrationAccountOptions, IntegrationWorkflowState, UninstallOptions } from '../types/connect';
|
|
8
|
+
import { Props as ConnectModalProps } from './connectModal';
|
|
9
|
+
export type ConnectUser = {
|
|
10
|
+
authenticated: false;
|
|
11
|
+
} | AuthenticatedConnectUser;
|
|
12
|
+
export type FunctionPropertyNames<T> = {
|
|
13
|
+
[K in keyof T]: T[K] extends Function ? K : never;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
type NonFunctionPropertyNames<T> = {
|
|
16
|
+
[K in keyof T]: T[K] extends Function ? never : K;
|
|
17
|
+
}[keyof T];
|
|
18
|
+
export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
|
19
|
+
export type UnwrapPromise<T> = T extends PromiseLike<infer U> ? U : T;
|
|
20
|
+
export type NonNullUndefinedField<T> = {
|
|
21
|
+
[P in keyof T]-?: NonNullUndefinedField<NonNullable<T[P]>>;
|
|
22
|
+
};
|
|
23
|
+
export type UIUpdateMessage = {
|
|
24
|
+
messageType: 'UI_UPDATE';
|
|
25
|
+
nextContext: NonFunctionProperties<IConnectUserContext>;
|
|
26
|
+
nextModalState: NonFunctionProperties<ConnectModalProps>;
|
|
27
|
+
};
|
|
28
|
+
export type SDKFunctionInvocationMessage<T extends FunctionPropertyNames<ConnectSDK> = never> = {
|
|
29
|
+
messageType: 'SDK_FUNCTION_INVOCATION';
|
|
30
|
+
type: T;
|
|
31
|
+
parameters: Parameters<ConnectSDK[T]>;
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
export type SDKFunctionResponseMessage<T extends FunctionPropertyNames<ConnectSDK> = never> = {
|
|
35
|
+
messageType: 'SDK_FUNCTION_RESPONSE';
|
|
36
|
+
type: T;
|
|
37
|
+
result: UnwrapPromise<ReturnType<ConnectSDK[T]>>;
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
export type SDKFunctionErrorMessage = {
|
|
41
|
+
messageType: 'SDK_FUNCTION_ERROR';
|
|
42
|
+
error: true;
|
|
43
|
+
message: string;
|
|
44
|
+
id: string;
|
|
45
|
+
};
|
|
46
|
+
export type SDKReceivedMessage = SDKFunctionInvocationMessage;
|
|
47
|
+
export type InstallIntegrationOptions = Partial<Omit<InstallOptions, 'isApiInstallation'> & Omit<CallbackMap, 'onOpen' | 'onClose'>>;
|
|
48
|
+
export type CompleteInstallOptions = {
|
|
49
|
+
authorizationCode: string;
|
|
50
|
+
showPortalAfterInstall?: boolean;
|
|
51
|
+
redirectUrl?: string;
|
|
52
|
+
integrationOptions?: {
|
|
53
|
+
installOptions?: InstallOptions & {
|
|
54
|
+
[key in string]: unknown;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export interface IConnectSDK {
|
|
59
|
+
authenticate(projectId: string, token: string, options?: AuthenticateOptions): Promise<void>;
|
|
60
|
+
connect(action: string, options: ConnectParams): void;
|
|
61
|
+
getUser(): ConnectUser;
|
|
62
|
+
/**
|
|
63
|
+
* **Do not call this function directly.**
|
|
64
|
+
*
|
|
65
|
+
* Invoked by the OAuth popup after finishing the credential exchange.
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
_oauthCallback(credential: OauthCallbackResponse, credentialId?: string): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* **Do not call this function directly.**
|
|
71
|
+
*
|
|
72
|
+
* Invoked by the OAuth popup on an error encountered during the credential exchange.
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
_oauthErrorCallback(errorMessage: string, event?: MessageEvent): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* installs an integration without the need to click on enable button from portal
|
|
78
|
+
* Install Options:
|
|
79
|
+
* `{showPortalAfterInstall: boolean}` decides wether to show portal with configuration view after the installation is completed
|
|
80
|
+
*/
|
|
81
|
+
installIntegration(name: string, options: InstallIntegrationOptions): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* uninstalls an integration for connected user.
|
|
84
|
+
*/
|
|
85
|
+
uninstallIntegration(name: string, options: UninstallOptions): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* disables a workflow for the connected user and unsubscribes all the workflows in hermes
|
|
88
|
+
*/
|
|
89
|
+
disableWorkflow(workflowId: string, options: DisableWorkflowOptions): Promise<void>;
|
|
90
|
+
setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
|
|
91
|
+
/**
|
|
92
|
+
* sets the base url for different services used in connect sdk
|
|
93
|
+
*/
|
|
94
|
+
configureGlobal(options: {
|
|
95
|
+
host: string;
|
|
96
|
+
envPrefix?: string;
|
|
97
|
+
}): void;
|
|
98
|
+
/**
|
|
99
|
+
* returns metadata for given integration
|
|
100
|
+
* @param integrationName integration name
|
|
101
|
+
*/
|
|
102
|
+
getIntegrationMetadata(): IIntegrationMetadata[];
|
|
103
|
+
getIntegrationMetadata(integrationKey: string): IIntegrationMetadata;
|
|
104
|
+
getIntegrationMetadata(integrationKey?: string): IIntegrationMetadata | IIntegrationMetadata[];
|
|
105
|
+
/**
|
|
106
|
+
* triggers all workflows for event
|
|
107
|
+
* @param name eventName
|
|
108
|
+
* @param payload event payload object
|
|
109
|
+
*/
|
|
110
|
+
event(name: string, payload: Record<string, unknown>): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* makes an connect proxy action request
|
|
113
|
+
* @param action actionName
|
|
114
|
+
* @param path request path
|
|
115
|
+
* @param init request initialization options {method: httpMethod, body:RequestBody, header}
|
|
116
|
+
*/
|
|
117
|
+
request<TResponse>(action: string, path: string, init: {
|
|
118
|
+
method: RequestInit['method'];
|
|
119
|
+
body: RequestInit['body'] | object;
|
|
120
|
+
headers: RequestInit['headers'];
|
|
121
|
+
}): Promise<TResponse | undefined>;
|
|
122
|
+
/**
|
|
123
|
+
* listen on connect sdk events
|
|
124
|
+
* @param eventName SDKEVENTS
|
|
125
|
+
* @param listener
|
|
126
|
+
*/
|
|
127
|
+
subscribe(eventName: SDK_EVENT, listener: ListenerFunction): () => boolean;
|
|
128
|
+
/**
|
|
129
|
+
* remove listeners on connect sdk events
|
|
130
|
+
* @param eventName SDKEVENTS
|
|
131
|
+
* @param listener
|
|
132
|
+
*/
|
|
133
|
+
unsubscribe(eventName: SDK_EVENT, listener: ListenerFunction): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* trigger connect endpoint trigger workflow
|
|
136
|
+
* @param workflowId
|
|
137
|
+
* @param triggerWorkflowRequest
|
|
138
|
+
*/
|
|
139
|
+
workflow(workflowId: string, triggerWorkflowRequest: TriggerWorkflowRequest): Promise<object | undefined>;
|
|
140
|
+
/**
|
|
141
|
+
* completes installation using authorizationCode of actions e.g. "pipedrive"
|
|
142
|
+
* @param action
|
|
143
|
+
* @param options
|
|
144
|
+
*/
|
|
145
|
+
completeInstall(action: string, options: CompleteInstallOptions): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options.
|
|
148
|
+
* Note that accountAuth is allowed for only some of the integrations.
|
|
149
|
+
* @param integrationType
|
|
150
|
+
* @param options
|
|
151
|
+
*/
|
|
152
|
+
getIntegrationAccount(integrationType: string, options: GetIntegrationAccountOptions): Promise<IConnectIntegrationWithCredentialInfo>;
|
|
153
|
+
/**
|
|
154
|
+
* Connects to a resource using the provided credentials payload.
|
|
155
|
+
* @param resourceSlug
|
|
156
|
+
* @param payload
|
|
157
|
+
*/
|
|
158
|
+
connectAction(resourceName: string, payload: Record<string, unknown>): Promise<IConnectCredential>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* sdk install options
|
|
162
|
+
*/
|
|
163
|
+
export type InstallOptions = {
|
|
164
|
+
/**
|
|
165
|
+
* api only install or ui install
|
|
166
|
+
*/
|
|
167
|
+
isApiInstallation?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* if true show portal when install with api install option
|
|
170
|
+
*/
|
|
171
|
+
showPortalAfterInstall?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* not show post oauth promt if this is true
|
|
174
|
+
*/
|
|
175
|
+
bypassPostOAuthPrompt?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* skips account type selection
|
|
178
|
+
*/
|
|
179
|
+
accountType?: string;
|
|
180
|
+
allowMultipleCredentials?: boolean;
|
|
181
|
+
selectedCredentialId?: string;
|
|
182
|
+
/**
|
|
183
|
+
* used to override redirect url passed in getAuthUrl instead of our passport url
|
|
184
|
+
*/
|
|
185
|
+
overrideRedirectUrl?: string;
|
|
186
|
+
};
|
|
187
|
+
export type AuthenticateOptions = {
|
|
188
|
+
metadata?: PersonaMeta;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Connect Modal Tabs
|
|
192
|
+
*/
|
|
193
|
+
export declare enum ModalView {
|
|
194
|
+
OVERVIEW = "overview",
|
|
195
|
+
CONFIGURATION = "configuration"
|
|
196
|
+
}
|
|
197
|
+
export type IntegrationInstallEvent = {
|
|
198
|
+
integrationId: string;
|
|
199
|
+
integrationType: string;
|
|
200
|
+
};
|
|
201
|
+
export type IntegrationUninstallEvent = IntegrationInstallEvent;
|
|
202
|
+
export type WorkflowStateChangeEvent = {
|
|
203
|
+
integrationId: string;
|
|
204
|
+
workflowId: string;
|
|
205
|
+
workflowStateChange: Partial<IntegrationWorkflowState>;
|
|
206
|
+
};
|
|
207
|
+
export type PortalOpenEvent = {
|
|
208
|
+
integrationId: string;
|
|
209
|
+
integrationType: string;
|
|
210
|
+
};
|
|
211
|
+
export type PortalCloseEvent = PortalOpenEvent;
|
|
212
|
+
export type CallbackMap = {
|
|
213
|
+
onSuccess?: (event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => void;
|
|
214
|
+
onInstall?: (event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => void;
|
|
215
|
+
onError?: (err: Error) => void;
|
|
216
|
+
onUninstall?: (event: IntegrationUninstallEvent, user: AuthenticatedConnectUser) => void;
|
|
217
|
+
onWorkflowChange?: (event: WorkflowStateChangeEvent, user: AuthenticatedConnectUser) => void;
|
|
218
|
+
onOpen?: (event: PortalOpenEvent, user: AuthenticatedConnectUser) => void;
|
|
219
|
+
onClose?: (event: PortalCloseEvent, user: AuthenticatedConnectUser) => void;
|
|
220
|
+
};
|
|
221
|
+
export type UserProvidedIntegrationConfig = {
|
|
222
|
+
/**
|
|
223
|
+
* used to override redirect url passed in getAuthUrl instead of our passport url
|
|
224
|
+
*/
|
|
225
|
+
overrideRedirectUrl?: string;
|
|
226
|
+
/**
|
|
227
|
+
* This will allow users to provide dynamic fields options for object mapping inputs
|
|
228
|
+
*/
|
|
229
|
+
mapObjectFields?: {
|
|
230
|
+
[objectName: string]: DynamicMappingField[] | DynamicMappingOptions;
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions;
|
|
234
|
+
export type EventInfo = {
|
|
235
|
+
type: SDK_EVENT;
|
|
236
|
+
integrationId: string;
|
|
237
|
+
integrationType: string;
|
|
238
|
+
workflowId?: string;
|
|
239
|
+
workflowStateChange?: Partial<IntegrationWorkflowState>;
|
|
240
|
+
};
|
|
241
|
+
export declare enum SDK_EVENT {
|
|
242
|
+
ON_INTEGRATION_INSTALL = "onIntegrationInstall",
|
|
243
|
+
ON_INTEGRATION_UNINSTALL = "onIntegrationUninstall",
|
|
244
|
+
ON_WORKFLOW_CHANGE = "onWorkflowChange",
|
|
245
|
+
ON_PORTAL_OPEN = "onPortalOpen",
|
|
246
|
+
ON_PORTAL_CLOSE = "onPortalClose"
|
|
247
|
+
}
|
|
248
|
+
export type SDKEventListenerMap = {
|
|
249
|
+
[SDK_EVENT.ON_INTEGRATION_INSTALL]: Array<(event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => void>;
|
|
250
|
+
[SDK_EVENT.ON_INTEGRATION_UNINSTALL]: Array<(event: IntegrationUninstallEvent, user: AuthenticatedConnectUser) => void>;
|
|
251
|
+
[SDK_EVENT.ON_PORTAL_CLOSE]: Array<(event: PortalCloseEvent, user: AuthenticatedConnectUser) => void>;
|
|
252
|
+
[SDK_EVENT.ON_PORTAL_OPEN]: Array<(event: PortalOpenEvent, user: AuthenticatedConnectUser) => void>;
|
|
253
|
+
[SDK_EVENT.ON_WORKFLOW_CHANGE]: Array<(event: WorkflowStateChangeEvent, user: AuthenticatedConnectUser) => void>;
|
|
254
|
+
};
|
|
255
|
+
export type ListenerFunction = SDKEventListenerMap[keyof SDKEventListenerMap][number];
|
|
256
|
+
export declare enum DocumentLoadingState {
|
|
257
|
+
LOADING = "loading",
|
|
258
|
+
INTERACTIVE = "interactive",
|
|
259
|
+
COMPLETE = "complete"
|
|
260
|
+
}
|
|
261
|
+
export type TriggerWorkflowRequest = {
|
|
262
|
+
body?: RequestInit['body'] | object;
|
|
263
|
+
headers?: RequestInit['headers'];
|
|
264
|
+
query?: Record<string, string>;
|
|
265
|
+
selectedCredentialId?: string;
|
|
266
|
+
};
|
|
267
|
+
export interface IFilePicker {
|
|
268
|
+
/**
|
|
269
|
+
* opens file picker of integrations e.g. googledrive
|
|
270
|
+
*/
|
|
271
|
+
open(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* initiates addition of file picker dependency
|
|
274
|
+
*/
|
|
275
|
+
init(options: FilePickerInitOptions): Promise<boolean>;
|
|
276
|
+
/**
|
|
277
|
+
* returns instance of the integration based on how file picker opens
|
|
278
|
+
*/
|
|
279
|
+
getInstance(): unknown;
|
|
280
|
+
}
|
|
281
|
+
export type FilePickerOptions = {
|
|
282
|
+
allowedTypes?: string[];
|
|
283
|
+
allowMultiSelect?: boolean;
|
|
284
|
+
allowFolderSelect?: boolean;
|
|
285
|
+
onOpen?: () => void;
|
|
286
|
+
onClose?: () => void;
|
|
287
|
+
onFileSelect?: (files: unknown) => void;
|
|
288
|
+
onCancel?: () => void;
|
|
289
|
+
};
|
|
290
|
+
export type FilePickerInitOptions = {
|
|
291
|
+
developerKey: string;
|
|
292
|
+
};
|
|
293
|
+
export declare enum FilePickerStatus {
|
|
294
|
+
LOADING = "loading",
|
|
295
|
+
FAILED = "failed",
|
|
296
|
+
LOADED = "loaded"
|
|
297
|
+
}
|
|
298
|
+
export interface ExternalFilePickerConstruct {
|
|
299
|
+
new (action: string, options: FilePickerOptions): IFilePicker;
|
|
300
|
+
(action: string, options: FilePickerOptions): IFilePicker;
|
|
301
|
+
}
|
|
302
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare enum BillingPlan {
|
|
2
|
+
ClassicFree = "free",
|
|
3
|
+
ClassicStarter = "starter",
|
|
4
|
+
ClassicBusiness = "business",
|
|
5
|
+
ClassicPremium = "premium",
|
|
6
|
+
ClassicEnterprise = "enterprise",
|
|
7
|
+
ConnectTrial = "connect_trial",
|
|
8
|
+
ConnectBasic = "basic",
|
|
9
|
+
ConnectPro = "pro",
|
|
10
|
+
ConnectEnterprise = "connect_enterprise"
|
|
11
|
+
}
|
|
12
|
+
export declare enum ConnectAddOn {
|
|
13
|
+
CustomIntegrationBuilder = "byo",
|
|
14
|
+
DynamicFieldMapper = "dfm",
|
|
15
|
+
HeadlessConnectPortal = "headless-cp",
|
|
16
|
+
TaskHistoryAPI = "th-api",
|
|
17
|
+
Monitoring = "monitoring",
|
|
18
|
+
RoleBasedAccessControl = "rbac",
|
|
19
|
+
UserMetadata = "user-metadata",
|
|
20
|
+
WhiteLabeling = "whitelabel",
|
|
21
|
+
WorkflowPermission = "workflow-permissions"
|
|
22
|
+
}
|
|
23
|
+
export type ConnectNonTrialBillingPlan = BillingPlan.ConnectBasic | BillingPlan.ConnectPro | BillingPlan.ConnectEnterprise;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NODE_ENV, PLATFORM_ENV } from '../types/environment';
|
|
2
|
+
/**
|
|
3
|
+
* get asset url i.e. cdn public url or dashboard public url
|
|
4
|
+
* @param env
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare const getAssetUrl: ({ CDN_PUBLIC_URL: cdnHost, DASHBOARD_PUBLIC_URL: dashboardPublicURL, VERSION: version, PLATFORM_ENV: platformEnv, NODE_ENV: nodeEnv, }: {
|
|
8
|
+
CDN_PUBLIC_URL: string;
|
|
9
|
+
DASHBOARD_PUBLIC_URL: string;
|
|
10
|
+
NODE_ENV: string;
|
|
11
|
+
PLATFORM_ENV: string;
|
|
12
|
+
VERSION: string;
|
|
13
|
+
}) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* a helper class for creating deferred promises
|
|
3
|
+
* @tutorial https://gist.github.com/GFoley83/5877f6c09fbcfd62569c51dc91444cf0
|
|
4
|
+
*/
|
|
5
|
+
export declare class DeferredPromise<T> implements Promise<T> {
|
|
6
|
+
[Symbol.toStringTag]: 'Promise';
|
|
7
|
+
private _promise;
|
|
8
|
+
private _resolve;
|
|
9
|
+
private _reject;
|
|
10
|
+
private _state;
|
|
11
|
+
get state(): 'pending' | 'fulfilled' | 'rejected';
|
|
12
|
+
constructor();
|
|
13
|
+
then<TResult1, TResult2>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
14
|
+
catch<TResult>(onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
|
15
|
+
resolve(value?: T | PromiseLike<T>): void;
|
|
16
|
+
reject(reason?: any): void;
|
|
17
|
+
finally(onfinally?: () => void): Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* given a type definition of a record and possible values for each key,
|
|
21
|
+
* it generates an array of every permutation
|
|
22
|
+
*
|
|
23
|
+
* @template T
|
|
24
|
+
* @param {{ [k in keyof T]: T[k][] }} input
|
|
25
|
+
* @returns {T[]}
|
|
26
|
+
*/
|
|
27
|
+
export declare function generateMatrix<T extends Record<string, any>>(input: {
|
|
28
|
+
[k in keyof T]: T[k][];
|
|
29
|
+
}, limit?: number): T[];
|
|
30
|
+
export declare function sleep(milliseconds: number): Promise<void>;
|