@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.
Files changed (48) hide show
  1. package/dist/src/index.html +161 -0
  2. package/dist/src/index.js +5924 -0
  3. package/dist/src/sandbox/sandbox.d.ts +10 -0
  4. package/dist/src/sandbox.js +43817 -0
  5. package/dist/src/src/ConnectSDK.d.ts +266 -0
  6. package/dist/src/src/SDKEventEmitter.d.ts +56 -0
  7. package/dist/src/src/constants.d.ts +2 -0
  8. package/dist/src/src/entities/base.entity.d.ts +5 -0
  9. package/dist/src/src/entities/connectCredential.interface.d.ts +41 -0
  10. package/dist/src/src/entities/connectCredentialConfig.interface.d.ts +31 -0
  11. package/dist/src/src/entities/credential.interface.d.ts +15 -0
  12. package/dist/src/src/entities/customIntegration.interface.d.ts +60 -0
  13. package/dist/src/src/entities/integration.interface.d.ts +45 -0
  14. package/dist/src/src/entities/integrationConfig.interface.d.ts +9 -0
  15. package/dist/src/src/entities/license.interface.d.ts +6 -0
  16. package/dist/src/src/entities/persona.interface.d.ts +34 -0
  17. package/dist/src/src/entities/project.interface.d.ts +32 -0
  18. package/dist/src/src/entities/steps.d.ts +30 -0
  19. package/dist/src/src/entities/team.interface.d.ts +19 -0
  20. package/dist/src/src/entities/user.interface.d.ts +23 -0
  21. package/dist/src/src/entities/workflow.interface.d.ts +11 -0
  22. package/dist/src/src/file-picker/integrations/googledrive.d.ts +24 -0
  23. package/dist/src/src/file-picker/integrations/index.d.ts +7 -0
  24. package/dist/src/src/file-picker/integrations/onedrive.d.ts +35 -0
  25. package/dist/src/src/file-picker/types/baseFilePicker.d.ts +51 -0
  26. package/dist/src/src/file-picker/types/externalFilePicker.d.ts +9 -0
  27. package/dist/src/src/file-picker/types/index.d.ts +1 -0
  28. package/dist/src/src/helpers/ConnectUserContext.d.ts +18 -0
  29. package/dist/src/src/helpers/index.d.ts +29 -0
  30. package/dist/src/src/helpers/oauth.d.ts +22 -0
  31. package/dist/src/src/index.d.ts +8 -0
  32. package/dist/src/src/server.types.d.ts +14 -0
  33. package/dist/src/src/types/action.d.ts +266 -0
  34. package/dist/src/src/types/billing.d.ts +2 -0
  35. package/dist/src/src/types/connect.d.ts +226 -0
  36. package/dist/src/src/types/connectModal.d.ts +35 -0
  37. package/dist/src/src/types/environment.d.ts +16 -0
  38. package/dist/src/src/types/execution.d.ts +5 -0
  39. package/dist/src/src/types/index.d.ts +9 -0
  40. package/dist/src/src/types/resolvers.d.ts +297 -0
  41. package/dist/src/src/types/sdk.d.ts +391 -0
  42. package/dist/src/src/types/stripe.d.ts +23 -0
  43. package/dist/src/src/utils/connect.d.ts +19 -0
  44. package/dist/src/src/utils/crypto.d.ts +7 -0
  45. package/dist/src/src/utils/generic.d.ts +41 -0
  46. package/dist/src/src/utils/http.d.ts +57 -0
  47. package/dist/src/src/utils/throttle.d.ts +118 -0
  48. package/package.json +1 -1
@@ -0,0 +1,266 @@
1
+ import { IConnectCredential } from './entities/connectCredential.interface';
2
+ import { IConnectCredentialConfig } from './entities/connectCredentialConfig.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 SDKEventEmitter from './SDKEventEmitter';
7
+ import { ConnectSdkEnvironments } from './server.types';
8
+ import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, CreateConfigurationOptions, CredentialConfigOptions, DeleteConfigurationOptions, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, IntegrationInstallEvent, LoadCustomDropdownOptionsResult, TriggerWorkflowRequest, UninstallOptions, UpdateConfigurationOptions } from './types';
9
+ export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE";
10
+ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK {
11
+ root: HTMLIFrameElement | undefined;
12
+ private rootLoaded;
13
+ /**
14
+ * sometime DOMContentLoaded event firing twice
15
+ * so it was creating two iframes see PARA-8749
16
+ */
17
+ private rootElementCreated;
18
+ private projectId;
19
+ private integrationToBeEnabled;
20
+ private modalState;
21
+ private userState;
22
+ private loadedConfigs;
23
+ private loadedIntegrations;
24
+ private endUserIntegrationConfig;
25
+ private environments;
26
+ private project;
27
+ /**
28
+ * map b/w integration key name to integration metadata
29
+ */
30
+ private metadata;
31
+ /**
32
+ * cache service
33
+ */
34
+ private cachedApiResponse;
35
+ /**
36
+ * in order to not call multiple same GET request at same time
37
+ * we are storing {key -> promise} map
38
+ */
39
+ private keyToRequestPromiseMap;
40
+ /**
41
+ * this will store the original overflow style of body
42
+ * we are using PARAGON_OVERFLOW_EMPTY_VALUE as default
43
+ * so that we will be able to know whether style is added in body or not
44
+ */
45
+ private originalBodyOverflow;
46
+ constructor(environments?: ConnectSdkEnvironments);
47
+ /**
48
+ * post message handler
49
+ * @param event
50
+ */
51
+ private eventMessageHandler;
52
+ private functionInvocationHandler;
53
+ private createReactRoot;
54
+ /**
55
+ * checks
56
+ * - if integration name is valid
57
+ * - if integration is setup in project
58
+ * - if integration is active in project
59
+ * throws error if any of these is not met
60
+ * @param action
61
+ * @param validateIsEnabled boolean
62
+ */
63
+ validateAction(action: string): void;
64
+ /**
65
+ * checks if the integration is installed.
66
+ * Assumes that the user is authenticated
67
+ * @param action
68
+ * @param userState
69
+ * @returns boolean value
70
+ */
71
+ private isAlreadyInstalled;
72
+ private bootstrapSDKState;
73
+ setModalState(statePartial: Partial<ConnectModalProps>): void;
74
+ /**
75
+ * Loads previous SDK state saved in localStorage.
76
+ *
77
+ * **Warning:** This favors stored to current state. This should typically be called in
78
+ * unauthenticated contexts, as a fallback.
79
+ */
80
+ private loadState;
81
+ /**
82
+ * Saves the current SDK state into localStorage, if available.
83
+ */
84
+ private saveState;
85
+ /**
86
+ * Clears the current SDK state from localStorage, if available.
87
+ */
88
+ private clearState;
89
+ private render;
90
+ /**
91
+ * this will update container style
92
+ * @param param0
93
+ * @returns
94
+ */
95
+ updateContainerStyle({ isModalShown }: {
96
+ isModalShown: boolean;
97
+ }): void;
98
+ /**
99
+ * Authenticate your end user into the Paragon Connect SDK.
100
+ *
101
+ * @param projectId Your Paragon project ID.
102
+ * @param token A JWT signed by your App Server. The JWT should include a user ID and a
103
+ * session expiration time.
104
+ */
105
+ authenticate(projectId: string, token: string, options?: AuthenticateOptions): Promise<void>;
106
+ /**
107
+ * Get the Paragon authentication and integration state of your end user.
108
+ */
109
+ getUser(): ConnectUser;
110
+ updateAuthenticatedUser(statePartial: Partial<AuthenticatedConnectUser>): void;
111
+ /**
112
+ * Logout the currently authenticated end user from the Paragon SDK.
113
+ */
114
+ logout(): void;
115
+ /**
116
+ * Display the Paragon Connect modal
117
+ */
118
+ connect(action: string, params?: ConnectParams): Promise<IntegrationInstallEvent>;
119
+ private setCredentialConfigForUserState;
120
+ private getCredentialAndConfig;
121
+ /**
122
+ * Retrieves an integration object from the loaded integrations based on the integration ID.
123
+ * @param integrationId The ID of the integration to retrieve.
124
+ * @returns The integration object if found, otherwise undefined.
125
+ */
126
+ _getIntegration(integrationId: string): IConnectIntegrationWithCredentialInfo | undefined;
127
+ _oauthCallback(oauthResponse: OauthCallbackResponse, credentialId?: string): Promise<void>;
128
+ _oauthErrorCallback(errorMessage: string | object, event?: MessageEvent): Promise<void>;
129
+ customDropdownOptionsLoaders: Record<string, (cursor?: string | undefined, search?: string | undefined) => LoadCustomDropdownOptionsResult>;
130
+ /**
131
+ * Display the Paragon Connect modal
132
+ */
133
+ _loadCustomDropdownOptions(key: string, cursor?: string | undefined, search?: string | undefined): LoadCustomDropdownOptionsResult;
134
+ /**
135
+ * Send a Connect API request. Automatically handles authorization and errors.
136
+ *
137
+ * @param path The path of the request, including the leading slash, i.e. `/sdk/actions`
138
+ * @param init Options for the request, excluding headers (automatically added).
139
+ * @param prefixWithProjectPath Defaults to true. Prepends /projects/${this.projectId}` to the
140
+ * path.
141
+ */
142
+ sendConnectRequest<TResponse>(path: string, init?: RequestInit & {
143
+ cacheResult?: boolean;
144
+ baseURLOverride?: string;
145
+ }, prefixWithProjectPath?: boolean): Promise<TResponse | undefined>;
146
+ private sendRequest;
147
+ /**
148
+ * Sends a proxy request to an action
149
+ * @param action
150
+ * @param path
151
+ * @param init
152
+ * @returns api request response
153
+ */
154
+ request<TResponse>(action: string, path: string, init: {
155
+ selectedCredentialId?: string;
156
+ method: RequestInit['method'];
157
+ body: RequestInit['body'] | object;
158
+ headers: RequestInit['headers'];
159
+ }): Promise<TResponse | undefined>;
160
+ event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>;
161
+ /**
162
+ * @summary this will be called to close the modal
163
+ * @param forceClose is set when modal is closed by cross btn
164
+ * @returns
165
+ */
166
+ onClose(forceClose?: boolean): void;
167
+ /**
168
+ * @summary this will be called when modal will be visible
169
+ */
170
+ onOpen(): void;
171
+ /**
172
+ * this is shared in ConnectUserContext
173
+ * so that event can be trigger from components
174
+ * @param eventInfo
175
+ */
176
+ triggerSDKEvent(eventInfo: EventInfo): void;
177
+ /**
178
+ * get single or all metadata info for integrations
179
+ * @param integrationKey
180
+ * @returns
181
+ */
182
+ getIntegrationMetadata(): IIntegrationMetadata[];
183
+ getIntegrationMetadata(integrationKey: string): IIntegrationMetadata;
184
+ /**
185
+ * Closing the portal by invoking this method
186
+ */
187
+ closePortal(): void;
188
+ /**
189
+ * trigger connect endpoint trigger workflow
190
+ * @param workflowId
191
+ * @param payload
192
+ */
193
+ workflow(workflowId: string, { selectedCredentialId, selectedConfigurationId, body, query, headers, }?: TriggerWorkflowRequest): Promise<object | undefined>;
194
+ /**
195
+ * for programmatically installing an integration
196
+ */
197
+ installIntegration(action: string, params?: InstallIntegrationOptions): Promise<void | IntegrationInstallEvent>;
198
+ /**
199
+ * gates headless feature to pro and enterprise users
200
+ */
201
+ ensureHeadlessIsSupported(): void;
202
+ uninstallIntegration(action: string, options?: UninstallOptions): Promise<void>;
203
+ disableWorkflow(workflowId: string, options?: DisableWorkflowOptions): Promise<void>;
204
+ enableWorkflow(workflowId: string, options?: CredentialConfigOptions): Promise<void>;
205
+ /**
206
+ * Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options.
207
+ * Note that accountAuth is allowed for only some of the integrations.
208
+ */
209
+ getIntegrationAccount(integrationType: string, options?: GetIntegrationAccountOptions): Promise<IConnectIntegrationWithCredentialInfo>;
210
+ private getIntegrationForWorkflow;
211
+ private updateLocalState;
212
+ /**
213
+ * gets the user data from api `/sdk/me`
214
+ */
215
+ private fetchUserData;
216
+ /**
217
+ * Gets the integrations from api `/sdk/integrations`
218
+ * Required this another request for integrations, as `/sdk/me` provides only minimal data for integrations
219
+ * we also need integration config and other credentials info which is not included in `sdk/me`
220
+ */
221
+ private fetchIntegrations;
222
+ /**
223
+ * Updates internal state where integration information may be used.
224
+ */
225
+ private updateIntegrations;
226
+ setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
227
+ /**
228
+ * @param param
229
+ * @param overrideEnvs
230
+ * sets the domain for making http service request
231
+ * example: `configureGlobal({host: 'myDomain.com'});` would set service urls as `https://service.myDomain.com`
232
+ */
233
+ configureGlobal(param: {
234
+ host: string;
235
+ }, overrideEnvs?: Partial<ConnectSdkEnvironments>): void;
236
+ /**
237
+ * some integration required flow in which user recieve authorization code
238
+ * from marketplace oauth flow , so needed this method see PARA-8385
239
+ */
240
+ completeInstall(action: string, options: CompleteInstallOptions): Promise<void>;
241
+ /**
242
+ * update credential data in integration
243
+ * @param newCredential
244
+ * @param integration
245
+ */
246
+ private updateCredentialData;
247
+ /**
248
+ * create resource connection
249
+ * @param resourceName
250
+ * @param payload
251
+ * @returns
252
+ */
253
+ connectAction(resourceName: string, payload: Record<string, unknown>): Promise<IConnectCredential>;
254
+ /**
255
+ * Creates a new configuration using the provided credentials.
256
+ * @param {CreateConfigurationOptions} param0
257
+ * @returns {Promise<IConnectCredentialConfig> }
258
+ */
259
+ createConfiguration({ credentialId, externalId, }: CreateConfigurationOptions): Promise<IConnectCredentialConfig>;
260
+ /**
261
+ * Destroys an existing configuration using the provided instance ID.
262
+ */
263
+ destroyConfiguration({ id, credentialId }: DeleteConfigurationOptions): Promise<void>;
264
+ updateConfiguration({ id, credentialId, meta, }: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>;
265
+ private pollForCredential;
266
+ }
@@ -0,0 +1,56 @@
1
+ import { AuthenticatedConnectUser, CallbackMap, EventInfo, ListenerFunction, SDK_EVENT } from './types';
2
+ export default class SDKEventEmitter {
3
+ private eventListenersMap;
4
+ private integrationStateCallbacks;
5
+ /**
6
+ * this will add listener to event listeners list
7
+ * @param eventName
8
+ * @returns function to unsubscribe current listener
9
+ */
10
+ subscribe(eventName: SDK_EVENT, listener: ListenerFunction): () => boolean;
11
+ /**
12
+ * this method add bind callbackMap to integration type
13
+ * and emit event for particular integration
14
+ * @param integrationType
15
+ * @param callbackMap
16
+ */
17
+ subscribeToIntegration(integrationType: string, callbackMap: CallbackMap): void;
18
+ /**
19
+ * this method removes listener from evenListenerMap
20
+ * @param eventName
21
+ * @param listener
22
+ * @returns true if successfully unsubscribed else false
23
+ */
24
+ unsubscribe(eventName: SDK_EVENT, listener: ListenerFunction): boolean;
25
+ /**
26
+ * check if event is valid paragon sdk event
27
+ * @param eventName
28
+ */
29
+ private assertEventType;
30
+ /**
31
+ * this method call attached listeners with payload for eventName type
32
+ * @param eventName
33
+ * @param eventPayload
34
+ */
35
+ private emitSafe;
36
+ /**
37
+ * this method will call errorCallback for integration
38
+ * @param error
39
+ * @param integrationType
40
+ */
41
+ emitError(error: Error, integrationType: string): void;
42
+ /**
43
+ * this will call callBack function inside try-catch block
44
+ * @param integrationType
45
+ * @param callbackType
46
+ * @param payload
47
+ */
48
+ private invokeCallbackSafe;
49
+ /**
50
+ * this will invoke emitSafe method with proper payload
51
+ * @param event
52
+ * @param userState
53
+ * @param modalState
54
+ */
55
+ triggerEvent({ type, integrationId, integrationType, workflowId, workflowStateChange }: EventInfo, userState: AuthenticatedConnectUser): void;
56
+ }
@@ -0,0 +1,2 @@
1
+ export declare const ACTION_CUSTOM = "custom";
2
+ export declare const INSUFFICIENT_PERMISSION: string;
@@ -0,0 +1,5 @@
1
+ export interface IBaseEntity {
2
+ id: string;
3
+ dateCreated: Date;
4
+ dateUpdated: Date;
5
+ }
@@ -0,0 +1,41 @@
1
+ import { SDKConnectCredentialConfig } from '../types/connect';
2
+ import { IConnectCredentialConfig } from './connectCredentialConfig.interface';
3
+ export interface IConnectCredential {
4
+ id: string;
5
+ projectId: string;
6
+ integrationId: string;
7
+ /**
8
+ * @deprecated
9
+ */
10
+ config?: SDKConnectCredentialConfig;
11
+ configurations: IConnectCredentialConfig[];
12
+ personaId: string;
13
+ isPreviewCredential: boolean;
14
+ /**
15
+ * @property providerId : this property stores user's identifiers in third party database e.g. Shopify
16
+ */
17
+ providerId: string;
18
+ dateCreated: Date;
19
+ dateUpdated: Date;
20
+ dateValidUntil?: Date;
21
+ dateRefreshed: Date;
22
+ status: CredentialStatus;
23
+ /**
24
+ * miscellaneous integration provider data received along with access_token/userinfo
25
+ */
26
+ providerData: ConnectCredentialProviderData;
27
+ /**
28
+ * count how many times credential failed to refresh
29
+ */
30
+ refreshFailureCount: number;
31
+ /**
32
+ * accountAuth contains the decrypted oauth access token. This property will only be available for some of integrations
33
+ */
34
+ accountAuth?: Record<string, string>;
35
+ }
36
+ export type ConnectCredentialProviderData = Record<string, string | number | boolean>;
37
+ export declare enum CredentialStatus {
38
+ PENDING = "PENDING",
39
+ INVALID = "INVALID",
40
+ VALID = "VALID"
41
+ }
@@ -0,0 +1,31 @@
1
+ import { IntegrationSharedInputStateMap, IntegrationWorkflowStateMap } from '../types';
2
+ import { IBaseEntity } from './base.entity';
3
+ export type ConnectCredentialConfigMeta = {
4
+ isIntegrationEnableTriggered?: boolean;
5
+ };
6
+ export interface IConnectCredentialConfig extends IBaseEntity {
7
+ /**
8
+ * connect credential id config is associated to
9
+ */
10
+ connectCredentialId: string;
11
+ /**
12
+ * workflow settings defined for config
13
+ */
14
+ workflowSettings: IntegrationWorkflowStateMap;
15
+ /**
16
+ * shared settings defined for config
17
+ */
18
+ sharedSettings: IntegrationSharedInputStateMap;
19
+ /**
20
+ * other information defined ex. postOauthFilled , triggered integration enabled workflow
21
+ */
22
+ configMeta: ConnectCredentialConfigMeta;
23
+ /**
24
+ * id defined by user for config
25
+ */
26
+ externalId?: string;
27
+ /**
28
+ * if this config is default config or created separately by sdk
29
+ */
30
+ isDefault: boolean;
31
+ }
@@ -0,0 +1,15 @@
1
+ export declare enum AuthenticationScheme {
2
+ BASIC = "basic",
3
+ OAUTH = "oauth",
4
+ OAUTH_CLIENT_CREDENTIAL = "oauth_client_credential",
5
+ SERVICE_ACCOUNT = "service_account",
6
+ OAUTH_APP = "oauth_app",
7
+ IMPERSONATED_APP = "impersonated_app"
8
+ }
9
+ /**
10
+ * oauth response return from our service
11
+ */
12
+ export type OauthCallbackResponse = {
13
+ integrationId: string;
14
+ payload: Record<string, string | number | boolean | any>;
15
+ };
@@ -0,0 +1,60 @@
1
+ import { IntegrationConnectInput } from '../types/action';
2
+ import { DataType, TokenizedSource } from '../types/resolvers';
3
+ import { IBaseEntity } from './base.entity';
4
+ import { AuthenticationScheme } from './credential.interface';
5
+ import { IConnectIntegration } from './integration.interface';
6
+ import { IProject } from './project.interface';
7
+ import { RequestAuthorization } from './steps';
8
+ export interface ICustomIntegration extends IBaseEntity {
9
+ /**
10
+ * the project that authored and maintains this custom integration.
11
+ */
12
+ project: IProject;
13
+ /**
14
+ * The ID of the project that authored and maintains this custom integration.
15
+ */
16
+ projectId: string;
17
+ name?: string;
18
+ /**
19
+ * a slug generated from the name of the custom integration (e.g. `custom.github`)
20
+ * it's stripped of non-alphanumeric characters and lowercased
21
+ * they're unique between projects
22
+ */
23
+ readonly slug?: string;
24
+ /**
25
+ * The CDN path of the custom integration's SVG-format icon file.
26
+ */
27
+ icon?: string;
28
+ /**
29
+ * Instances of this custom integration configured for a particular project.
30
+ *
31
+ * Currently, we only expect that one integration will be associated with a custom integration
32
+ * at a time. However, this is subject to change and should not be treated as an invariant in
33
+ * code (hence the array typing).
34
+ */
35
+ integrations: IConnectIntegration[];
36
+ /**
37
+ * Basic (API keys) and OAuth 2.0 authentication types are supported for custom integrations.
38
+ */
39
+ authenticationType?: AuthenticationScheme;
40
+ inputFields: IntegrationConnectInput[];
41
+ oauthAuthorizationUrl?: TokenizedSource<DataType.STRING>;
42
+ oauthAccessTokenUrl?: TokenizedSource<DataType.STRING>;
43
+ oauthScopes?: string;
44
+ oauthIncludeClientAuthorizationHeader?: boolean;
45
+ usePKCEInCodeExchange: boolean;
46
+ apiBaseUrl?: TokenizedSource<DataType.STRING>;
47
+ testEndpointPath?: TokenizedSource<DataType.STRING>;
48
+ apiAuthorization: RequestAuthorization;
49
+ isPublished: boolean;
50
+ }
51
+ export interface IPublishedCustomIntegration extends ICustomIntegration {
52
+ isPublished: true;
53
+ name: string;
54
+ readonly slug: string;
55
+ icon: string;
56
+ authenticationType: AuthenticationScheme;
57
+ oauthClientId: string;
58
+ oauthScopes: string;
59
+ }
60
+ export declare function generateSlugForIntegration(customIntegration: ICustomIntegration): string | undefined;
@@ -0,0 +1,45 @@
1
+ import { SDKIntegrationConfig } from '../types/connect';
2
+ import { ICustomIntegration } from './customIntegration.interface';
3
+ import { IConnectIntegrationConfig } from './integrationConfig.interface';
4
+ import { IWorkflowBase } from './workflow.interface';
5
+ export type IConnectIntegration = {
6
+ id: string;
7
+ dateCreated: Date;
8
+ dateUpdated: Date;
9
+ projectId: string;
10
+ configs: IConnectIntegrationConfig[];
11
+ workflows: IWorkflowBase[];
12
+ type: string;
13
+ isActive: boolean;
14
+ customIntegrationId?: string;
15
+ customIntegration?: ICustomIntegration;
16
+ };
17
+ export interface IConnectIntegrationWithCredentialInfo extends IConnectIntegration {
18
+ hasCredential: boolean;
19
+ connectedUserLimitOnDevCred: number;
20
+ connectedUserLimitReached: boolean;
21
+ }
22
+ export interface IIntegrationMetadata {
23
+ type: string;
24
+ name: string;
25
+ icon: string;
26
+ brandColor: string;
27
+ }
28
+ export declare function getIntegrationTypeName(integration: IConnectIntegration): string | undefined;
29
+ export declare function isCustomIntegrationTypeName(type: string): boolean;
30
+ export interface IConnectIntegrationWithCredentialInfo extends IConnectIntegration {
31
+ hasCredential: boolean;
32
+ connectedUserLimitOnDevCred: number;
33
+ connectedUserLimitReached: boolean;
34
+ needPreOauthInputs: boolean;
35
+ name: string;
36
+ brandColor: string;
37
+ /**
38
+ * accountAuth contains the decrypted oauth access token. This property will only be available for some of integrations
39
+ */
40
+ accountAuth?: Record<string, string>;
41
+ /**
42
+ * sdkIntegrationConfig on a integration is available only for those which are active
43
+ */
44
+ sdkIntegrationConfig?: SDKIntegrationConfig | null;
45
+ }
@@ -0,0 +1,9 @@
1
+ import { ModalConfig } from '../types/connect';
2
+ import { IBaseEntity } from './base.entity';
3
+ import { IConnectIntegration } from './integration.interface';
4
+ export interface IConnectIntegrationConfig extends IBaseEntity {
5
+ id: string;
6
+ integration: IConnectIntegration;
7
+ integrationId: string;
8
+ values: ModalConfig;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { ITeam } from './team.interface';
2
+ export interface ILicense {
3
+ id: string;
4
+ team: ITeam;
5
+ active: boolean;
6
+ }
@@ -0,0 +1,34 @@
1
+ import { IBaseEntity } from './base.entity';
2
+ import { IConnectCredential } from './connectCredential.interface';
3
+ export type PersonaMeta = {
4
+ Name?: string;
5
+ Email?: string;
6
+ } & {
7
+ [key: string]: unknown;
8
+ };
9
+ export interface IPersona extends IBaseEntity {
10
+ projectId: string;
11
+ endUserId: string;
12
+ meta: PersonaMeta;
13
+ /**
14
+ * timestamp value for the latest workflow execution by persona. Will be populated
15
+ * later on by chronos
16
+ */
17
+ dateLastActive: Date;
18
+ /**
19
+ * boolean value that tells wether there are integration errors for persona.
20
+ * In a future work effort this would be populated by the chronos service.
21
+ */
22
+ hasIntegrationErrors: boolean;
23
+ /**
24
+ * boolean value that tells if persona has any failed workflows. This will be
25
+ * populated by chronos work effort later
26
+ */
27
+ hasWorkflowErrors: boolean;
28
+ /**
29
+ * boolean value . A persona may be disabled from connected users dashboard and
30
+ * will not be able to perform any activity
31
+ */
32
+ active: boolean;
33
+ connectCredentials?: IConnectCredential[];
34
+ }
@@ -0,0 +1,32 @@
1
+ import { BillingPlan, ConnectAddOn } from '../types/stripe';
2
+ import { IBaseEntity } from './base.entity';
3
+ import { ICustomIntegration } from './customIntegration.interface';
4
+ import { ITeam } from './team.interface';
5
+ import { IUserSanitized } from './user.interface';
6
+ declare enum ProjectType {
7
+ PERSONAL = "PERSONAL",
8
+ BUSINESS = "BUSINESS"
9
+ }
10
+ export interface IProject extends IBaseEntity {
11
+ title: string;
12
+ owner: IUserSanitized;
13
+ ownerId: string;
14
+ team: ITeam;
15
+ teamId: string;
16
+ billingPeriodEndAt?: Date;
17
+ completedQualification?: boolean;
18
+ projectType?: ProjectType;
19
+ projectPurpose?: string;
20
+ isConnectProject?: boolean;
21
+ customIntegrations: ICustomIntegration[];
22
+ isHidden: boolean;
23
+ }
24
+ /**
25
+ * a light version of a project sent to end users interacting with the connect sdk
26
+ */
27
+ export interface IConnectSDKProject {
28
+ id: string;
29
+ billingPlan: BillingPlan;
30
+ accessibleFeatures: ConnectAddOn[];
31
+ }
32
+ export {};
@@ -0,0 +1,30 @@
1
+ import { DataType, KeyedSource, TokenizedSource } from '../types/resolvers';
2
+ export type RequestAuthorization = NoAuthorization | BearerAuthorization | BasicAuthorization | QueryParamAuthorization | AuthHeaderAuthorization;
3
+ declare enum RequestAuthorizationType {
4
+ NONE = "none",
5
+ BEARER_TOKEN = "bearer",
6
+ BASIC = "basic",
7
+ QUERY_PARAMS = "query_params",
8
+ AUTH_HEADER = "auth_header"
9
+ }
10
+ type NoAuthorization = {
11
+ type: RequestAuthorizationType.NONE;
12
+ };
13
+ type BearerAuthorization = {
14
+ type: RequestAuthorizationType.BEARER_TOKEN;
15
+ token: TokenizedSource<DataType.STRING>;
16
+ };
17
+ type BasicAuthorization = {
18
+ type: RequestAuthorizationType.BASIC;
19
+ username: TokenizedSource<DataType.STRING>;
20
+ password: TokenizedSource<DataType.STRING>;
21
+ };
22
+ type QueryParamAuthorization = {
23
+ type: RequestAuthorizationType.QUERY_PARAMS;
24
+ params: KeyedSource<DataType.STRING>[];
25
+ };
26
+ type AuthHeaderAuthorization = {
27
+ type: RequestAuthorizationType.AUTH_HEADER;
28
+ headers: KeyedSource<DataType.STRING>[];
29
+ };
30
+ export {};
@@ -0,0 +1,19 @@
1
+ import { IBaseEntity } from './base.entity';
2
+ import { ILicense } from './license.interface';
3
+ export interface ITeam extends IBaseEntity {
4
+ name: string;
5
+ website?: string;
6
+ licenses?: ILicense[];
7
+ organizationId: string;
8
+ }
9
+ export interface ITeamMember {
10
+ id: string;
11
+ organizationId: string;
12
+ userId?: string;
13
+ role: TeamMemberRole;
14
+ }
15
+ declare enum TeamMemberRole {
16
+ ADMIN = "ADMIN",
17
+ MEMBER = "MEMBER"
18
+ }
19
+ export {};