@useparagon/connect
Advanced tools
Comparing version 1.0.22-experimental.4 to 1.0.22-experimental.5
import { IConnectCredential } from './entities/connectCredential.interface'; | ||
import { IConnectCredentialConfig } from './entities/connectCredentialConfig.interface'; | ||
import { OauthCallbackResponse } from './entities/credential.interface'; | ||
@@ -7,3 +8,3 @@ import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from './entities/integration.interface'; | ||
import { ConnectSdkEnvironments } from './server.types'; | ||
import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, TriggerWorkflowRequest, UninstallOptions } from './types'; | ||
import { AuthenticateOptions, AuthenticatedConnectUser, CompleteInstallOptions, Props as ConnectModalProps, ConnectParams, ConnectUser, CreateConfigurationOptions, CredentialConfigOptions, DeleteConfigurationOptions, DisableWorkflowOptions, EventInfo, GetIntegrationAccountOptions, IConnectSDK, InstallIntegrationOptions, TriggerWorkflowRequest, UninstallOptions, UpdateConfigurationOptions } from './types'; | ||
export declare const PARAGON_OVERFLOW_EMPTY_VALUE = "PARAGON_OVERFLOW_EMPTY_VALUE"; | ||
@@ -56,3 +57,3 @@ export default class ConnectSDK extends SDKEventEmitter implements IConnectSDK { | ||
* checks | ||
* - if integartion name is valid | ||
* - if integration name is valid | ||
* - if integration is setup in project | ||
@@ -120,2 +121,4 @@ * - if integration is active in project | ||
connect(action: string, params?: ConnectParams): Promise<void>; | ||
private setCredentialConfigForUserState; | ||
private getCredentialAndConfig; | ||
/** | ||
@@ -155,3 +158,3 @@ * Retrieves an integration object from the loaded integrations based on the integration ID. | ||
}): Promise<TResponse | undefined>; | ||
event(name: string, payload: Record<string, unknown>): Promise<void>; | ||
event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>; | ||
/** | ||
@@ -189,3 +192,3 @@ * @summary this will be called to close the modal | ||
*/ | ||
workflow(workflowId: string, { selectedCredentialId, body, query, headers }?: TriggerWorkflowRequest): Promise<object | undefined>; | ||
workflow(workflowId: string, { selectedCredentialId, selectedConfigurationId, body, query, headers, }?: TriggerWorkflowRequest): Promise<object | undefined>; | ||
/** | ||
@@ -201,2 +204,3 @@ * for programmatically installing an integration | ||
disableWorkflow(workflowId: string, options?: DisableWorkflowOptions): Promise<void>; | ||
enableWorkflow(workflowId: string, options?: CredentialConfigOptions): Promise<void>; | ||
/** | ||
@@ -210,6 +214,2 @@ * Get account details by integration type. To get accountAuth, includeAccountAuth should be true in options. | ||
/** | ||
* also returns false if unable to find workflow in configured workflow property of any integration | ||
*/ | ||
private isWorkflowEnabled; | ||
/** | ||
* gets the user data from api `/sdk/me` | ||
@@ -256,10 +256,14 @@ */ | ||
connectAction(resourceName: string, payload: Record<string, unknown>): Promise<IConnectCredential>; | ||
private pollForCredential; | ||
/** | ||
* get custom webhook trigger url | ||
* @param workflowId | ||
* @param connectCredentialId | ||
* @returns custom webhook trigger url for user level + manual | ||
* Creates a new configuration using the provided credentials. | ||
* @param {CreateConfigurationOptions} param0 | ||
* @returns {Promise<IConnectCredentialConfig> } | ||
*/ | ||
getCustomWebhookUserManualUrl(workflowId: string, connectCredentialId?: string): Promise<string>; | ||
createConfiguration({ credentialId, externalId, }: CreateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
/** | ||
* Destroys an existing configuration using the provided instance ID. | ||
*/ | ||
destroyConfiguration({ id, credentialId }: DeleteConfigurationOptions): Promise<void>; | ||
updateConfiguration({ id, credentialId, meta, }: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
private pollForCredential; | ||
} |
export declare const ACTION_CUSTOM = "custom"; | ||
export declare const ISUFFICIENT_PERMISSION: string; |
@@ -10,4 +10,4 @@ import { SDKConnectCredentialConfig } from '../types/connect'; | ||
*/ | ||
config: SDKConnectCredentialConfig; | ||
configurations?: IConnectCredentialConfig[]; | ||
config?: SDKConnectCredentialConfig; | ||
configurations: IConnectCredentialConfig[]; | ||
personaId: string; | ||
@@ -14,0 +14,0 @@ isPreviewCredential: boolean; |
import { SDKIntegrationConfig } from '../types/connect'; | ||
import { ICustomIntegration } from './customIntegration.interface'; | ||
import { IConnectIntegrationConfig } from './integrationConfig.interface'; | ||
import { ISDKWorkflowBase } from './workflow.interface'; | ||
import { IWorkflowBase } from './workflow.interface'; | ||
export type IConnectIntegration = { | ||
@@ -11,3 +11,3 @@ id: string; | ||
configs: IConnectIntegrationConfig[]; | ||
workflows: ISDKWorkflowBase[]; | ||
workflows: IWorkflowBase[]; | ||
type: string; | ||
@@ -14,0 +14,0 @@ isActive: boolean; |
@@ -12,6 +12,1 @@ import { IBaseEntity } from './base.entity'; | ||
export type IWorkflowBase = Omit<IWorkflow, 'project' | 'projectId'>; | ||
export type ISDKWorkflowBase = IWorkflowBase & { | ||
customWebhookTriggerId?: string; | ||
defaultConnectCredentialId?: string; | ||
resourceId?: string; | ||
}; |
@@ -14,3 +14,2 @@ /** | ||
ZEUS_PUBLIC_URL: string; | ||
HERMES_PUBLIC_URL: string; | ||
}; |
@@ -6,2 +6,3 @@ import { ConnectCredentialProviderData, CredentialStatus, IConnectCredential } from '../entities/connectCredential.interface'; | ||
import { OrConditions } from './resolvers'; | ||
import { CredentialConfigOptions } from './sdk'; | ||
export interface SDKConnectCredentialConfig { | ||
@@ -49,2 +50,5 @@ sharedSettings?: IntegrationSharedInputStateMap; | ||
}; | ||
export type IntegrationSharedInputStateMap = { | ||
[inputId: string]: ConnectInputValue | undefined; | ||
}; | ||
export type IntegrationWorkflowState = { | ||
@@ -56,5 +60,2 @@ enabled: boolean; | ||
}; | ||
export type IntegrationSharedInputStateMap = { | ||
[inputId: string]: ConnectInputValue | undefined; | ||
}; | ||
export type ModalConfig = { | ||
@@ -188,3 +189,2 @@ /** | ||
credentialStatus?: CredentialStatus; | ||
integrationId?: string; | ||
}; | ||
@@ -199,3 +199,3 @@ export type SDKIntegration = { | ||
allCredentials: IConnectCredential[]; | ||
allConfigurations?: IConnectCredentialConfig[]; | ||
allConfigurations: IConnectCredentialConfig[]; | ||
} & SDKConnectCredentialConfig; | ||
@@ -218,8 +218,4 @@ export type SDKIntegrationConfig = { | ||
export type SDKIntegrationState = Partial<Record<string, SDKIntegration>>; | ||
export type UninstallOptions = { | ||
selectedCredentialId?: string; | ||
}; | ||
export type DisableWorkflowOptions = { | ||
selectedCredentialId?: string; | ||
}; | ||
export type UninstallOptions = Pick<CredentialConfigOptions, 'selectedCredentialId'>; | ||
export type DisableWorkflowOptions = CredentialConfigOptions; | ||
/** | ||
@@ -235,2 +231,3 @@ * method options for getIntegrationAccount in sdk | ||
export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential"; | ||
export declare const SELECTED_CREDENTIAL_CONFIG_ID_HEADER = "X-Paragon-Configuration-Id"; | ||
export {}; |
import ConnectSDK from '../ConnectSDK'; | ||
import { IConnectCredential } from '../entities/connectCredential.interface'; | ||
import { IConnectCredentialConfig } from '../entities/connectCredentialConfig.interface'; | ||
import { OauthCallbackResponse } from '../entities/credential.interface'; | ||
@@ -91,2 +92,6 @@ import { IConnectIntegrationWithCredentialInfo, IIntegrationMetadata } from '../entities/integration.interface'; | ||
disableWorkflow(workflowId: string, options: DisableWorkflowOptions): Promise<void>; | ||
/** | ||
* enables a workflow for the connected user and subscribe the workflows in hermes | ||
*/ | ||
enableWorkflow(workflowId: string, options: CredentialConfigOptions): Promise<void>; | ||
setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>; | ||
@@ -111,3 +116,3 @@ /** | ||
*/ | ||
event(name: string, payload: Record<string, unknown>): Promise<void>; | ||
event(name: string, payload: Record<string, unknown>, options?: CredentialConfigOptions): Promise<void>; | ||
/** | ||
@@ -166,7 +171,21 @@ * makes an connect proxy action request | ||
/** | ||
* Get custom webhook user level, manual url | ||
* @param workflowId | ||
* @param connectCredentialId | ||
* Creates a new configuration using the provided credentials. | ||
* | ||
* @param {CreateConfigurationOptions} params - An object containing the necessary parameters. | ||
* @param {string} params.credentialId - The ID of the credential to create the configuration for. | ||
* @param {string} params.externalId - (Optional) An external identifier associated with the configuration. | ||
* @returns {Promise<ICreateConfiguration>} - A promise that resolves to the created configuration object. | ||
*/ | ||
getCustomWebhookUserManualUrl(workflowId: string, connectCredentialId?: string): Promise<string>; | ||
createConfiguration(params: CreateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
/** | ||
* Destroys an existing configuration using the provided instance ID. | ||
* | ||
* @param {DestroyConfigurationParams} params - An object containing the necessary parameters. | ||
* @param {string} params.id - The ID of the configuration to be destroyed. | ||
* @returns {Promise<void>} - A promise that resolves when the configuration is successfully destroyed. | ||
*/ | ||
destroyConfiguration(params: { | ||
id: string; | ||
}): Promise<void>; | ||
updateConfiguration(dto: UpdateConfigurationOptions): Promise<IConnectCredentialConfig>; | ||
} | ||
@@ -194,3 +213,2 @@ /** | ||
allowMultipleCredentials?: boolean; | ||
selectedCredentialId?: string; | ||
/** | ||
@@ -201,2 +219,19 @@ * used to override redirect url passed in getAuthUrl instead of our passport url | ||
}; | ||
export type CredentialConfigOptions = { | ||
selectedCredentialId?: string; | ||
selectedConfigurationId?: string; | ||
}; | ||
export type CreateConfigurationOptions = { | ||
credentialId: string; | ||
externalId?: string; | ||
}; | ||
export type DeleteConfigurationOptions = { | ||
id: string; | ||
credentialId: string; | ||
}; | ||
export type UpdateConfigurationOptions = { | ||
id: string; | ||
credentialId: string; | ||
meta: Record<string, unknown>; | ||
}; | ||
export type AuthenticateOptions = { | ||
@@ -248,3 +283,3 @@ metadata?: PersonaMeta; | ||
}; | ||
export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions; | ||
export type ConnectParams = CallbackMap & UserProvidedIntegrationConfig & InstallOptions & CredentialConfigOptions; | ||
export type EventInfo = { | ||
@@ -277,7 +312,6 @@ type: SDK_EVENT; | ||
} | ||
export type TriggerWorkflowRequest = { | ||
export type TriggerWorkflowRequest = CredentialConfigOptions & { | ||
body?: RequestInit['body'] | object; | ||
headers?: RequestInit['headers']; | ||
query?: Record<string, string>; | ||
selectedCredentialId?: string; | ||
}; | ||
@@ -284,0 +318,0 @@ export interface IFilePicker { |
@@ -14,1 +14,7 @@ import { NODE_ENV, PLATFORM_ENV } from '../types/environment'; | ||
}) => string; | ||
/** | ||
* | ||
* @param externalId | ||
* @returns | ||
*/ | ||
export declare function sanitizeExternalConfigId(externalId: string): string; |
@@ -31,2 +31,4 @@ /** | ||
export declare function sleep(milliseconds: number): Promise<void>; | ||
export declare const uuidPattern: RegExp; | ||
export declare function isUUID(value: string | unknown): boolean; | ||
/** | ||
@@ -33,0 +35,0 @@ * keeps attempting to execute a method until a desired result is achieved |
{ | ||
"name": "@useparagon/connect", | ||
"version": "1.0.22-experimental.4", | ||
"version": "1.0.22-experimental.5", | ||
"description": "Embed integrations into your app with the Paragon SDK", | ||
@@ -9,2 +9,3 @@ "main": "dist/src/index.js", | ||
"scripts": { | ||
"start:dev": "NODE_ENV=development webpack serve", | ||
"build:prod": "yarn typecheck && yarn clean && webpack --config webpack.config.js", | ||
@@ -64,2 +65,3 @@ "build:watch": "yarn build --watch", | ||
"glob": "^10.3.10", | ||
"html-webpack-plugin": "^5.6.3", | ||
"jest": "^27.0.6", | ||
@@ -69,2 +71,3 @@ "jest-fetch-mock": "useparagon/jest-fetch-mock.git#3.0.4", | ||
"jest-json-reporter2": "^1.1.0", | ||
"jsonwebtoken": "^9.0.2", | ||
"node-notifier": "^10.0.0", | ||
@@ -90,3 +93,4 @@ "nyc": "^15.1.0", | ||
"webpack-bundle-analyzer": "^4.3.0", | ||
"webpack-cli": "^5.0.2" | ||
"webpack-cli": "^5.0.2", | ||
"webpack-dev-server": "^5.1.0" | ||
}, | ||
@@ -93,0 +97,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188648
48
2312
56
5