@useparagon/connect 1.0.24-experimental.12 → 1.0.24-experimental.13
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/dist/src/index.html +161 -0
- package/dist/src/index.js +5924 -0
- package/dist/src/sandbox/sandbox.d.ts +10 -0
- package/dist/src/sandbox.js +43817 -0
- package/dist/src/src/ConnectSDK.d.ts +266 -0
- package/dist/src/src/SDKEventEmitter.d.ts +56 -0
- package/dist/src/src/constants.d.ts +2 -0
- package/dist/src/src/entities/base.entity.d.ts +5 -0
- package/dist/src/src/entities/connectCredential.interface.d.ts +41 -0
- package/dist/src/src/entities/connectCredentialConfig.interface.d.ts +31 -0
- package/dist/src/src/entities/credential.interface.d.ts +15 -0
- package/dist/src/src/entities/customIntegration.interface.d.ts +60 -0
- package/dist/src/src/entities/integration.interface.d.ts +45 -0
- package/dist/src/src/entities/integrationConfig.interface.d.ts +9 -0
- package/dist/src/src/entities/license.interface.d.ts +6 -0
- package/dist/src/src/entities/persona.interface.d.ts +34 -0
- package/dist/src/src/entities/project.interface.d.ts +32 -0
- package/dist/src/src/entities/steps.d.ts +30 -0
- package/dist/src/src/entities/team.interface.d.ts +19 -0
- package/dist/src/src/entities/user.interface.d.ts +23 -0
- package/dist/src/src/entities/workflow.interface.d.ts +11 -0
- package/dist/src/src/file-picker/integrations/googledrive.d.ts +24 -0
- package/dist/src/src/file-picker/integrations/index.d.ts +7 -0
- package/dist/src/src/file-picker/integrations/onedrive.d.ts +35 -0
- package/dist/src/src/file-picker/types/baseFilePicker.d.ts +51 -0
- package/dist/src/src/file-picker/types/externalFilePicker.d.ts +9 -0
- package/dist/src/src/file-picker/types/index.d.ts +1 -0
- package/dist/src/src/helpers/ConnectUserContext.d.ts +18 -0
- package/dist/src/src/helpers/index.d.ts +29 -0
- package/dist/src/src/helpers/oauth.d.ts +22 -0
- package/dist/src/src/index.d.ts +8 -0
- package/dist/src/src/server.types.d.ts +14 -0
- package/dist/src/src/types/action.d.ts +266 -0
- package/dist/src/src/types/billing.d.ts +2 -0
- package/dist/src/src/types/connect.d.ts +226 -0
- package/dist/src/src/types/connectModal.d.ts +35 -0
- package/dist/src/src/types/environment.d.ts +16 -0
- package/dist/src/src/types/execution.d.ts +5 -0
- package/dist/src/src/types/index.d.ts +9 -0
- package/dist/src/src/types/resolvers.d.ts +297 -0
- package/dist/src/src/types/sdk.d.ts +391 -0
- package/dist/src/src/types/stripe.d.ts +23 -0
- package/dist/src/src/utils/connect.d.ts +19 -0
- package/dist/src/src/utils/crypto.d.ts +7 -0
- package/dist/src/src/utils/generic.d.ts +41 -0
- package/dist/src/src/utils/http.d.ts +57 -0
- package/dist/src/src/utils/throttle.d.ts +118 -0
- package/package.json +1 -1
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import ConnectSDK from '../ConnectSDK';
|
|
2
|
+
import { IConnectCredential } from '../entities/connectCredential.interface';
|
|
3
|
+
import { IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface';
|
|
4
|
+
import { OauthCallbackResponse } from '../entities/credential.interface';
|
|
5
|
+
import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from '../entities/integration.interface';
|
|
6
|
+
import { PersonaMeta } from '../entities/persona.interface';
|
|
7
|
+
import { IConnectUserContext } from '../helpers/ConnectUserContext';
|
|
8
|
+
import { ConnectSdkEnvironments } from '../server.types';
|
|
9
|
+
import { AuthenticatedConnectUser, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, GetIntegrationAccountOptions, IntegrationWorkflowState, UninstallOptions } from '../types/connect';
|
|
10
|
+
import { Props as ConnectModalProps } from './connectModal';
|
|
11
|
+
export type ConnectUser = {
|
|
12
|
+
authenticated: false;
|
|
13
|
+
} | AuthenticatedConnectUser;
|
|
14
|
+
export type FunctionPropertyNames<T> = {
|
|
15
|
+
[K in keyof T]: T[K] extends Function ? K : never;
|
|
16
|
+
}[keyof T];
|
|
17
|
+
type NonFunctionPropertyNames<T> = {
|
|
18
|
+
[K in keyof T]: T[K] extends Function ? never : K;
|
|
19
|
+
}[keyof T];
|
|
20
|
+
export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
|
21
|
+
export type UnwrapPromise<T> = T extends PromiseLike<infer U> ? U : T;
|
|
22
|
+
export type NonNullUndefinedField<T> = {
|
|
23
|
+
[P in keyof T]-?: NonNullUndefinedField<NonNullable<T[P]>>;
|
|
24
|
+
};
|
|
25
|
+
export type UIUpdateMessage = {
|
|
26
|
+
messageType: 'UI_UPDATE';
|
|
27
|
+
nextContext: NonFunctionProperties<IConnectUserContext>;
|
|
28
|
+
nextModalState: NonFunctionProperties<ConnectModalProps>;
|
|
29
|
+
};
|
|
30
|
+
export type SDKFunctionInvocationMessage<T extends FunctionPropertyNames<ConnectSDK> = never> = {
|
|
31
|
+
messageType: 'SDK_FUNCTION_INVOCATION';
|
|
32
|
+
type: T;
|
|
33
|
+
parameters: Parameters<ConnectSDK[T]>;
|
|
34
|
+
id: string;
|
|
35
|
+
};
|
|
36
|
+
export type SDKFunctionResponseMessage<T extends FunctionPropertyNames<ConnectSDK> = never> = {
|
|
37
|
+
messageType: 'SDK_FUNCTION_RESPONSE';
|
|
38
|
+
type: T;
|
|
39
|
+
result: UnwrapPromise<ReturnType<ConnectSDK[T]>>;
|
|
40
|
+
id: string;
|
|
41
|
+
};
|
|
42
|
+
export type SDKFunctionErrorMessage = {
|
|
43
|
+
messageType: 'SDK_FUNCTION_ERROR';
|
|
44
|
+
error: true;
|
|
45
|
+
message: string;
|
|
46
|
+
id: string;
|
|
47
|
+
};
|
|
48
|
+
export type SDKReceivedMessage = SDKFunctionInvocationMessage;
|
|
49
|
+
export type InstallIntegrationOptions = Partial<Omit<InstallOptions, 'isApiInstallation'> & Omit<CallbackMap, 'onOpen' | 'onClose'>>;
|
|
50
|
+
export type CompleteInstallOptions = {
|
|
51
|
+
authorizationCode: string;
|
|
52
|
+
showPortalAfterInstall?: boolean;
|
|
53
|
+
redirectUrl?: string;
|
|
54
|
+
integrationOptions?: {
|
|
55
|
+
installOptions?: InstallOptions & {
|
|
56
|
+
[key in string]: unknown;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type LoadCustomDropdownOptionsResult = Promise<{
|
|
61
|
+
options: {
|
|
62
|
+
label: string;
|
|
63
|
+
value: string;
|
|
64
|
+
}[];
|
|
65
|
+
nextPageCursor: string | null;
|
|
66
|
+
}>;
|
|
67
|
+
export interface IConnectSDK {
|
|
68
|
+
authenticate(projectId: string, token: string, options?: AuthenticateOptions): Promise<void>;
|
|
69
|
+
connect(action: string, options: ConnectParams): void;
|
|
70
|
+
getUser(): ConnectUser;
|
|
71
|
+
/**
|
|
72
|
+
* **Do not call this function directly.**
|
|
73
|
+
*
|
|
74
|
+
* Invoked by the OAuth popup after finishing the credential exchange.
|
|
75
|
+
* @private
|
|
76
|
+
*/
|
|
77
|
+
_oauthCallback(credential: OauthCallbackResponse, credentialId?: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* **Do not call this function directly.**
|
|
80
|
+
*
|
|
81
|
+
* Invoked by the OAuth popup on an error encountered during the credential exchange.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
_oauthErrorCallback(errorMessage: string, event?: MessageEvent): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* TODO(UI/UX): Document this
|
|
87
|
+
* TODO(UI/UX): Create type
|
|
88
|
+
* Destroys an existing configuration using the provided instance ID.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} cursor - An object containing the necessary parameters.
|
|
91
|
+
* @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed.
|
|
92
|
+
*/
|
|
93
|
+
_loadCustomDropdownOptions(key: string, cursor?: string | undefined, search?: string | undefined): LoadCustomDropdownOptionsResult;
|
|
94
|
+
/**
|
|
95
|
+
* installs an integration without the need to click on enable button from portal
|
|
96
|
+
* Install Options:
|
|
97
|
+
* `{showPortalAfterInstall: boolean}` decides wether to show portal with configuration view after the installation is completed
|
|
98
|
+
*/
|
|
99
|
+
installIntegration(name: string, options: InstallIntegrationOptions): Promise<void | IntegrationInstallEvent>;
|
|
100
|
+
/**
|
|
101
|
+
* uninstalls an integration for connected user.
|
|
102
|
+
*/
|
|
103
|
+
uninstallIntegration(name: string, options: UninstallOptions): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* disables a workflow for the connected user and unsubscribes all the workflows in hermes
|
|
106
|
+
*/
|
|
107
|
+
disableWorkflow(workflowId: string, options: DisableWorkflowOptions): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* enables a workflow for the connected user and subscribe the workflows in hermes
|
|
110
|
+
*/
|
|
111
|
+
enableWorkflow(workflowId: string, options: CredentialConfigOptions): Promise<void>;
|
|
112
|
+
setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
|
|
113
|
+
/**
|
|
114
|
+
* sets the base url for different services used in connect sdk
|
|
115
|
+
*/
|
|
116
|
+
configureGlobal(options: {
|
|
117
|
+
host: string;
|
|
118
|
+
}, overrideEnvs?: Partial<ConnectSdkEnvironments>): void;
|
|
119
|
+
/**
|
|
120
|
+
* returns metadata for given integration
|
|
121
|
+
* @param integrationName integration name
|
|
122
|
+
*/
|
|
123
|
+
getIntegrationMetadata(): IIntegrationMetadata[];
|
|
124
|
+
getIntegrationMetadata(integrationKey: string): IIntegrationMetadata;
|
|
125
|
+
getIntegrationMetadata(integrationKey?: string): IIntegrationMetadata | IIntegrationMetadata[];
|
|
126
|
+
/**
|
|
127
|
+
* triggers all workflows for event
|
|
128
|
+
* @param name eventName
|
|
129
|
+
* @param payload event payload object
|
|
130
|
+
*/
|
|
131
|
+
event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* makes an connect proxy action request
|
|
134
|
+
* @param action actionName
|
|
135
|
+
* @param path request path
|
|
136
|
+
* @param init request initialization options {method: httpMethod, body:RequestBody, header}
|
|
137
|
+
*/
|
|
138
|
+
request<TResponse>(action: string, path: string, init: {
|
|
139
|
+
method: RequestInit['method'];
|
|
140
|
+
body: RequestInit['body'] | object;
|
|
141
|
+
headers: RequestInit['headers'];
|
|
142
|
+
}): Promise<TResponse | undefined>;
|
|
143
|
+
/**
|
|
144
|
+
* listen on connect sdk events
|
|
145
|
+
* @param eventName SDKEVENTS
|
|
146
|
+
* @param listener
|
|
147
|
+
*/
|
|
148
|
+
subscribe(eventName: SDK_EVENT, listener: ListenerFunction): () => boolean;
|
|
149
|
+
/**
|
|
150
|
+
* remove listeners on connect sdk events
|
|
151
|
+
* @param eventName SDKEVENTS
|
|
152
|
+
* @param listener
|
|
153
|
+
*/
|
|
154
|
+
unsubscribe(eventName: SDK_EVENT, listener: ListenerFunction): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* trigger connect endpoint trigger workflow
|
|
157
|
+
* @param workflowId
|
|
158
|
+
* @param triggerWorkflowRequest
|
|
159
|
+
*/
|
|
160
|
+
workflow(workflowId: string, triggerWorkflowRequest: TriggerWorkflowRequest): Promise<object | undefined>;
|
|
161
|
+
/**
|
|
162
|
+
* completes installation using authorizationCode of actions e.g. "pipedrive"
|
|
163
|
+
* @param action
|
|
164
|
+
* @param options
|
|
165
|
+
*/
|
|
166
|
+
completeInstall(action: string, options: CompleteInstallOptions): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options.
|
|
169
|
+
* Note that accountAuth is allowed for only some of the integrations.
|
|
170
|
+
* @param integrationType
|
|
171
|
+
* @param options
|
|
172
|
+
*/
|
|
173
|
+
getIntegrationAccount(integrationType: string, options: GetIntegrationAccountOptions): Promise<IConnectIntegrationWithCredentialInfo>;
|
|
174
|
+
/**
|
|
175
|
+
* Connects to a resource using the provided credentials payload.
|
|
176
|
+
* @param resourceSlug
|
|
177
|
+
* @param payload
|
|
178
|
+
*/
|
|
179
|
+
connectAction(resourceName: string, payload: Record<string, unknown>): Promise<IConnectCredential>;
|
|
180
|
+
/**
|
|
181
|
+
* Closing the portal by invoking this method
|
|
182
|
+
*/
|
|
183
|
+
closePortal(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Creates a new configuration using the provided credentials.
|
|
186
|
+
*
|
|
187
|
+
* @param {CreateConfigurationOptions} params - An object containing the necessary parameters.
|
|
188
|
+
* @param {string} params.credentialId - The ID of the credential to create the configuration for.
|
|
189
|
+
* @param {string} params.externalId - (Optional) An external identifier associated with the configuration.
|
|
190
|
+
* @returns {Promise<ICreateConfiguration>} - A promise that resolves to the created configuration object.
|
|
191
|
+
*/
|
|
192
|
+
createConfiguration(params: CreateConfigurationOptions): Promise<IConnectCredentialConfig>;
|
|
193
|
+
/**
|
|
194
|
+
* Destroys an existing configuration using the provided instance ID.
|
|
195
|
+
*
|
|
196
|
+
* @param {DestroyConfigurationParams} params - An object containing the necessary parameters.
|
|
197
|
+
* @param {string} params.id - The ID of the configuration to be destroyed.
|
|
198
|
+
* @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed.
|
|
199
|
+
*/
|
|
200
|
+
destroyConfiguration(params: {
|
|
201
|
+
id: string;
|
|
202
|
+
}): Promise<void>;
|
|
203
|
+
updateConfiguration(dto: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* sdk install options
|
|
207
|
+
*/
|
|
208
|
+
export type InstallOptions = {
|
|
209
|
+
/**
|
|
210
|
+
* api only install or ui install
|
|
211
|
+
*/
|
|
212
|
+
isApiInstallation?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* if true show portal when install with api install option
|
|
215
|
+
*/
|
|
216
|
+
showPortalAfterInstall?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* not show post oauth promt if this is true
|
|
219
|
+
*/
|
|
220
|
+
bypassPostOAuthPrompt?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* skips account type selection
|
|
223
|
+
*/
|
|
224
|
+
accountType?: string;
|
|
225
|
+
allowMultipleCredentials?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* used to override redirect url passed in getAuthUrl instead of our passport url
|
|
228
|
+
*/
|
|
229
|
+
overrideRedirectUrl?: string;
|
|
230
|
+
};
|
|
231
|
+
export type CredentialConfigOptions = {
|
|
232
|
+
selectedCredentialId?: string;
|
|
233
|
+
selectedConfigurationId?: string;
|
|
234
|
+
};
|
|
235
|
+
export type CreateConfigurationOptions = {
|
|
236
|
+
credentialId: string;
|
|
237
|
+
externalId?: string;
|
|
238
|
+
};
|
|
239
|
+
export type DeleteConfigurationOptions = {
|
|
240
|
+
id: string;
|
|
241
|
+
credentialId: string;
|
|
242
|
+
};
|
|
243
|
+
export type UpdateConfigurationOptions = {
|
|
244
|
+
id: string;
|
|
245
|
+
credentialId: string;
|
|
246
|
+
meta: Record<string, unknown>;
|
|
247
|
+
};
|
|
248
|
+
export type AuthenticateOptions = {
|
|
249
|
+
metadata?: PersonaMeta;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Connect Modal Tabs
|
|
253
|
+
*/
|
|
254
|
+
export declare enum ModalView {
|
|
255
|
+
OVERVIEW = "overview",
|
|
256
|
+
CONFIGURATION = "configuration"
|
|
257
|
+
}
|
|
258
|
+
export type IntegrationInstallEvent = {
|
|
259
|
+
integrationId: string;
|
|
260
|
+
integrationType: string;
|
|
261
|
+
credentialId?: string;
|
|
262
|
+
credential?: IConnectCredential | undefined;
|
|
263
|
+
};
|
|
264
|
+
export type IntegrationUninstallEvent = IntegrationInstallEvent;
|
|
265
|
+
export type WorkflowStateChangeEvent = {
|
|
266
|
+
integrationId: string;
|
|
267
|
+
workflowId: string;
|
|
268
|
+
workflowStateChange: Partial<IntegrationWorkflowState>;
|
|
269
|
+
};
|
|
270
|
+
export type PortalOpenEvent = {
|
|
271
|
+
integrationId: string;
|
|
272
|
+
integrationType: string;
|
|
273
|
+
};
|
|
274
|
+
export type PortalCloseEvent = PortalOpenEvent;
|
|
275
|
+
export type CallbackMap = {
|
|
276
|
+
onSuccess?: (event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => void;
|
|
277
|
+
onInstall?: (event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => void;
|
|
278
|
+
onError?: (err: Error) => void;
|
|
279
|
+
onUninstall?: (event: IntegrationUninstallEvent, user: AuthenticatedConnectUser) => void;
|
|
280
|
+
onWorkflowChange?: (event: WorkflowStateChangeEvent, user: AuthenticatedConnectUser) => void;
|
|
281
|
+
onOpen?: (event: PortalOpenEvent, user: AuthenticatedConnectUser) => void;
|
|
282
|
+
onClose?: (event: PortalCloseEvent, user: AuthenticatedConnectUser) => void;
|
|
283
|
+
};
|
|
284
|
+
export type UserProvidedIntegrationConfig = {
|
|
285
|
+
/**
|
|
286
|
+
* used to override redirect url passed in getAuthUrl instead of our passport url
|
|
287
|
+
*/
|
|
288
|
+
overrideRedirectUrl?: string;
|
|
289
|
+
/**
|
|
290
|
+
* This will allow users to provide dynamic fields options for object mapping inputs
|
|
291
|
+
*/
|
|
292
|
+
mapObjectFields?: {
|
|
293
|
+
[objectName: string]: DynamicMappingField[] | DynamicMappingOptions;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions & CredentialConfigOptions;
|
|
297
|
+
export type EventInfo = {
|
|
298
|
+
type: SDK_EVENT;
|
|
299
|
+
integrationId: string;
|
|
300
|
+
integrationType: string;
|
|
301
|
+
workflowId?: string;
|
|
302
|
+
workflowStateChange?: Partial<IntegrationWorkflowState>;
|
|
303
|
+
};
|
|
304
|
+
export declare enum SDK_EVENT {
|
|
305
|
+
ON_INTEGRATION_INSTALL = "onIntegrationInstall",
|
|
306
|
+
ON_INTEGRATION_UNINSTALL = "onIntegrationUninstall",
|
|
307
|
+
ON_WORKFLOW_CHANGE = "onWorkflowChange",
|
|
308
|
+
ON_PORTAL_OPEN = "onPortalOpen",
|
|
309
|
+
ON_PORTAL_CLOSE = "onPortalClose"
|
|
310
|
+
}
|
|
311
|
+
export type SDKEventListenerMap = {
|
|
312
|
+
[SDK_EVENT.ON_INTEGRATION_INSTALL]: Array<(event: IntegrationInstallEvent, user: AuthenticatedConnectUser) => void>;
|
|
313
|
+
[SDK_EVENT.ON_INTEGRATION_UNINSTALL]: Array<(event: IntegrationUninstallEvent, user: AuthenticatedConnectUser) => void>;
|
|
314
|
+
[SDK_EVENT.ON_PORTAL_CLOSE]: Array<(event: PortalCloseEvent, user: AuthenticatedConnectUser) => void>;
|
|
315
|
+
[SDK_EVENT.ON_PORTAL_OPEN]: Array<(event: PortalOpenEvent, user: AuthenticatedConnectUser) => void>;
|
|
316
|
+
[SDK_EVENT.ON_WORKFLOW_CHANGE]: Array<(event: WorkflowStateChangeEvent, user: AuthenticatedConnectUser) => void>;
|
|
317
|
+
};
|
|
318
|
+
export type ListenerFunction = SDKEventListenerMap[keyof SDKEventListenerMap][number];
|
|
319
|
+
export declare enum DocumentLoadingState {
|
|
320
|
+
LOADING = "loading",
|
|
321
|
+
INTERACTIVE = "interactive",
|
|
322
|
+
COMPLETE = "complete"
|
|
323
|
+
}
|
|
324
|
+
export type TriggerWorkflowRequest = CredentialConfigOptions & {
|
|
325
|
+
body?: RequestInit['body'] | object;
|
|
326
|
+
headers?: RequestInit['headers'];
|
|
327
|
+
query?: Record<string, string>;
|
|
328
|
+
};
|
|
329
|
+
export interface IFilePicker {
|
|
330
|
+
/**
|
|
331
|
+
* opens file picker of integrations e.g. googledrive
|
|
332
|
+
*/
|
|
333
|
+
open(): boolean;
|
|
334
|
+
/**
|
|
335
|
+
* initiates addition of file picker dependency
|
|
336
|
+
*/
|
|
337
|
+
init(options: FilePickerInitOptions): Promise<boolean>;
|
|
338
|
+
/**
|
|
339
|
+
* returns instance of the integration based on how file picker opens
|
|
340
|
+
*/
|
|
341
|
+
getInstance(): unknown;
|
|
342
|
+
}
|
|
343
|
+
export type FilePickerOptions = {
|
|
344
|
+
allowedTypes?: string[];
|
|
345
|
+
allowMultiSelect?: boolean;
|
|
346
|
+
allowFolderSelect?: boolean;
|
|
347
|
+
onOpen?: () => void;
|
|
348
|
+
onClose?: () => void;
|
|
349
|
+
onFileSelect?: (files: unknown) => void;
|
|
350
|
+
onCancel?: () => void;
|
|
351
|
+
};
|
|
352
|
+
export type FilePickerInitOptions = {
|
|
353
|
+
developerKey?: string;
|
|
354
|
+
DocsViewMode?: string;
|
|
355
|
+
appId?: string;
|
|
356
|
+
clientId?: string;
|
|
357
|
+
};
|
|
358
|
+
export declare enum FilePickerStatus {
|
|
359
|
+
LOADING = "loading",
|
|
360
|
+
FAILED = "failed",
|
|
361
|
+
LOADED = "loaded"
|
|
362
|
+
}
|
|
363
|
+
export interface ExternalFilePickerConstruct {
|
|
364
|
+
new (action: string, options: FilePickerOptions): IFilePicker;
|
|
365
|
+
(action: string, options: FilePickerOptions): IFilePicker;
|
|
366
|
+
}
|
|
367
|
+
export declare enum DocsViewMode {
|
|
368
|
+
GRID = "grid",
|
|
369
|
+
LIST = "list"
|
|
370
|
+
}
|
|
371
|
+
export declare const supportedModesForDocsViewMode: string[];
|
|
372
|
+
export interface OpenOptions {
|
|
373
|
+
clientId: string;
|
|
374
|
+
action: 'share' | 'download' | 'upload' | string;
|
|
375
|
+
advanced?: {
|
|
376
|
+
queryParameters?: string;
|
|
377
|
+
accessToken?: string;
|
|
378
|
+
};
|
|
379
|
+
multiSelect?: boolean;
|
|
380
|
+
openInNewWindow: boolean;
|
|
381
|
+
success?: (files: File[]) => void;
|
|
382
|
+
cancel?: () => void;
|
|
383
|
+
error?: (error: Error) => void;
|
|
384
|
+
}
|
|
385
|
+
export interface File {
|
|
386
|
+
id: string;
|
|
387
|
+
name: string;
|
|
388
|
+
size: number;
|
|
389
|
+
link: string;
|
|
390
|
+
}
|
|
391
|
+
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,19 @@
|
|
|
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;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param externalId
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
export declare function sanitizeExternalConfigId(externalId: string): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
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>;
|
|
31
|
+
export declare const uuidPattern: RegExp;
|
|
32
|
+
export declare function isUUID(value: string | unknown): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* keeps attempting to execute a method until a desired result is achieved
|
|
35
|
+
*
|
|
36
|
+
* @param {() => Promise<T>} method
|
|
37
|
+
* @param {((result: T, attempt: number) => Promise<boolean> | boolean)} shouldRetry
|
|
38
|
+
* @param {(number | ((attempt: number) => number))} backoff
|
|
39
|
+
* @returns {Promise<T>}
|
|
40
|
+
*/
|
|
41
|
+
export declare function tryUntil<T = any>(method: () => Promise<T> | T, shouldRetry: (result: T | null, error?: Error | null, attempt?: number) => Promise<boolean> | boolean, backoff: number | ((attempt: number) => number)): Promise<T>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* check if url is valid or not
|
|
3
|
+
* @param url
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare const isValidUrl: (url: string) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* it will add https protocol if protocol is not added in utl
|
|
9
|
+
* @param url
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function sanitizeUrl(url: string): string;
|
|
13
|
+
export declare function getServiceUrl(service: string, domain: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Validation error description.
|
|
16
|
+
* @see https://github.com/typestack/class-validator
|
|
17
|
+
*
|
|
18
|
+
* class-validator@0.13.0
|
|
19
|
+
*
|
|
20
|
+
* @publicApi
|
|
21
|
+
*/
|
|
22
|
+
export interface ValidationError {
|
|
23
|
+
/**
|
|
24
|
+
* Constraints that failed validation with error messages.
|
|
25
|
+
*/
|
|
26
|
+
constraints?: {
|
|
27
|
+
[type: string]: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Contains all nested validation errors of the property.
|
|
31
|
+
*/
|
|
32
|
+
children?: ValidationError[];
|
|
33
|
+
}
|
|
34
|
+
export type MessageWithErrorBody = {
|
|
35
|
+
message: string;
|
|
36
|
+
response: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* extract error message from response object
|
|
40
|
+
* @param response
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export declare function getErrorMessage(response: Response): Promise<string>;
|
|
44
|
+
export declare function getErrorMessage(response: Response, isProxyRequestFailure: true): Promise<MessageWithErrorBody>;
|
|
45
|
+
export declare function getErrorMessage(response: Response, isProxyRequestFailure: false): Promise<string>;
|
|
46
|
+
export declare class ProxyRequestError extends Error {
|
|
47
|
+
response: Record<string, unknown>;
|
|
48
|
+
constructor(message: string, response: any);
|
|
49
|
+
}
|
|
50
|
+
export declare const isIntegrationError: (error: unknown) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Parses an error message and determines if it represents an integration error.
|
|
53
|
+
*
|
|
54
|
+
* @param {string | Error} err - The error message or Error object to parse.
|
|
55
|
+
* @returns {boolean} - True if the error represents an integration error, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
export declare function errorMessageParser(err: string | Error): boolean;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* whether to debounce or throttle cached items
|
|
3
|
+
* defaults to `Debounce` behavior
|
|
4
|
+
*/
|
|
5
|
+
export declare enum CacheMode {
|
|
6
|
+
Debounce = "debounce",
|
|
7
|
+
Throttle = "throttle"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* configuration parameters for a CacheThrottle instance
|
|
11
|
+
*/
|
|
12
|
+
export type CacheThrottleConfig<T = any> = Partial<{
|
|
13
|
+
/**
|
|
14
|
+
* when enabled, this clears pending `del` calls from the queue when `get`, `set`, or `getOrSet` is called
|
|
15
|
+
* this can be used to prevent queued delete calls from deleting recently retrieved stateful values, like db connections
|
|
16
|
+
*/
|
|
17
|
+
clearPendingDeletes: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* whether to operate in Throttle or Debounce mode
|
|
20
|
+
*/
|
|
21
|
+
mode: CacheMode;
|
|
22
|
+
/**
|
|
23
|
+
* an optional callback for handling items when they get deregistered from the cache
|
|
24
|
+
*/
|
|
25
|
+
onDeregister: (value: T) => Promise<void> | void;
|
|
26
|
+
/**
|
|
27
|
+
* an optional callback for serializing keys
|
|
28
|
+
* in the case that keys are particularly long, this can be used to shorten them
|
|
29
|
+
*/
|
|
30
|
+
serializeKey: (key: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* how long items should remain in the cache
|
|
33
|
+
* the ttl is reset every time a key is accessed
|
|
34
|
+
*/
|
|
35
|
+
ttl: number;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* A helper class for caching items in memory and throttling / debouncing function calls
|
|
39
|
+
* methods for getters, setters, and executors are queued to prevent race conditions between calls.
|
|
40
|
+
* It provides helper methods for handling deregistering of items.
|
|
41
|
+
* Useful for caching database connections or rate-limiting outgoing Sentry calls.
|
|
42
|
+
*/
|
|
43
|
+
export declare class CacheThrottle<T = any> {
|
|
44
|
+
#private;
|
|
45
|
+
constructor(config?: CacheThrottleConfig<T>);
|
|
46
|
+
/**
|
|
47
|
+
* attempts to retrieve a key from the cache
|
|
48
|
+
*
|
|
49
|
+
* @param {string} key
|
|
50
|
+
* @param {boolean} [asap] asap = as soon as possible. should this be queued or execute immediately
|
|
51
|
+
* @returns {(Promise<T | undefined>)}
|
|
52
|
+
* @memberof CacheThrottle
|
|
53
|
+
*/
|
|
54
|
+
get(key: string, asap?: boolean): Promise<T | undefined>;
|
|
55
|
+
/**
|
|
56
|
+
* stores an item in the cache
|
|
57
|
+
*
|
|
58
|
+
* @param {string} key
|
|
59
|
+
* @param {T} value
|
|
60
|
+
* @param {number} [ttl=this.]
|
|
61
|
+
* @param {*} config
|
|
62
|
+
* @param {*} ttl
|
|
63
|
+
* @param {CacheMode} [mode]
|
|
64
|
+
* @param {boolean} [asap] asap = as soon as possible. should this be queued or execute immediately
|
|
65
|
+
* @returns {Promise<T>}
|
|
66
|
+
* @memberof CacheThrottle
|
|
67
|
+
*/
|
|
68
|
+
set(key: string, value: T, ttl?: number, mode?: CacheMode, asap?: boolean): Promise<T>;
|
|
69
|
+
/**
|
|
70
|
+
* attempts to retrieve a value from the cache
|
|
71
|
+
* if it's not available, it sets the value using the provided generator method
|
|
72
|
+
*/
|
|
73
|
+
getOrSet(key: string, generator: () => T | Promise<T>, ttl?: number, mode?: CacheMode, asap?: boolean): Promise<T>;
|
|
74
|
+
/**
|
|
75
|
+
* deletes an item from the cache
|
|
76
|
+
*
|
|
77
|
+
* @param {string} key
|
|
78
|
+
* @param {boolean} [isKeySerialized=false]
|
|
79
|
+
* @param {boolean} [asap] asap = as soon as possible. should this be queued or execute immediately
|
|
80
|
+
* @returns {(Promise<T | undefined>)}
|
|
81
|
+
* @memberof CacheThrottle
|
|
82
|
+
*/
|
|
83
|
+
del(key: string, isKeySerialized?: boolean, asap?: boolean): Promise<T | undefined>;
|
|
84
|
+
/**
|
|
85
|
+
* returns the keys stored in the cache
|
|
86
|
+
*/
|
|
87
|
+
keys(): string[];
|
|
88
|
+
/**
|
|
89
|
+
* executes a method. the `key` is used as a unique identifier for rate-limiting calls
|
|
90
|
+
*/
|
|
91
|
+
do(key: string, method: () => T | Promise<T>, ttl?: number, mode?: CacheMode): Promise<T>;
|
|
92
|
+
/**
|
|
93
|
+
* removes all the items from the cache, clears timeouts, and calls deregister methods
|
|
94
|
+
*/
|
|
95
|
+
close(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* refreshes a set interval for clearing an item from the cache
|
|
98
|
+
* if an existing interval exists, it removes it
|
|
99
|
+
*/
|
|
100
|
+
private refreshTimeout;
|
|
101
|
+
/**
|
|
102
|
+
* removes any pending delete calls on a key
|
|
103
|
+
* @param key
|
|
104
|
+
*/
|
|
105
|
+
private clearPendingDeletesOnKey;
|
|
106
|
+
/**
|
|
107
|
+
* generates the key used for storing items in the cache
|
|
108
|
+
*/
|
|
109
|
+
private serializeKey;
|
|
110
|
+
/**
|
|
111
|
+
* queues a method for processing
|
|
112
|
+
*/
|
|
113
|
+
private enqueue;
|
|
114
|
+
/**
|
|
115
|
+
* calls the methods in the queue
|
|
116
|
+
*/
|
|
117
|
+
private flush;
|
|
118
|
+
}
|
package/package.json
CHANGED