@useparagon/connect 1.0.2 → 1.0.3-experimental.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/.github/pull_request_template.md +43 -0
- package/.github/workflows/build.yaml +133 -0
- package/.github/workflows/publish.yaml +106 -0
- package/.github/workflows/release.yaml +36 -0
- package/.nvmrc +1 -0
- package/changelog.md +12 -1
- package/dist/src/ConnectSDK.d.ts +39 -6
- package/dist/src/entities/integration.interface.d.ts +3 -0
- package/dist/src/helpers/index.d.ts +8 -0
- package/dist/src/helpers/oauth.d.ts +0 -14
- package/dist/src/index.js +257 -202
- package/dist/src/types/action.d.ts +0 -9
- package/dist/src/types/connect.d.ts +17 -8
- package/dist/src/types/index.d.ts +0 -1
- package/dist/src/types/sdk.d.ts +17 -3
- package/dist/src/utils/http.d.ts +26 -0
- package/package.json +16 -6
- package/useparagon-connect-1.0.3-experimental.1.tgz +0 -0
- package/useparagon-connect-v1.0.3-experimental.1.tgz +0 -0
- package/dist/src/types/oauth.d.ts +0 -3
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { AuthenticationScheme } from '../entities/credential.interface';
|
|
3
2
|
import { SidebarInput } from './connect';
|
|
4
3
|
import { DataType, KeyedSource, Source } from './resolvers';
|
|
5
4
|
export declare enum SidebarInputType {
|
|
@@ -241,12 +240,4 @@ type ActionStepParameters = BaseActionStepParameters & {
|
|
|
241
240
|
* It will override the action alias for making files name more cleaner
|
|
242
241
|
*/
|
|
243
242
|
export declare const overrideActionAlias: Partial<Record<string, string>>;
|
|
244
|
-
export type ActionConfigDTO = {
|
|
245
|
-
name: string;
|
|
246
|
-
brandColor: string;
|
|
247
|
-
provider: string | undefined;
|
|
248
|
-
authScheme: AuthenticationScheme | undefined;
|
|
249
|
-
endUserSuppliedValues: IntegrationConnectInput[] | undefined;
|
|
250
|
-
isAccountTypeSupported: boolean;
|
|
251
|
-
};
|
|
252
243
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectCredentialProviderData, CredentialStatus } from '../entities/connectCredential.interface';
|
|
1
|
+
import { ConnectCredentialProviderData, CredentialStatus, IConnectCredential } from '../entities/connectCredential.interface';
|
|
2
2
|
import { PersonaMeta } from '../entities/persona.interface';
|
|
3
3
|
import { DataSource, IntegrationConnectInput, SidebarInputType } from './action';
|
|
4
4
|
import { OrConditions } from './resolvers';
|
|
@@ -182,19 +182,28 @@ export type AuthenticatedConnectUser = {
|
|
|
182
182
|
integrations: SDKIntegrationState;
|
|
183
183
|
meta: PersonaMeta;
|
|
184
184
|
};
|
|
185
|
+
export type SDKIntegration = {
|
|
186
|
+
enabled: boolean;
|
|
187
|
+
credentialId?: string;
|
|
188
|
+
credentialStatus?: CredentialStatus;
|
|
189
|
+
providerId?: string;
|
|
190
|
+
providerData?: ConnectCredentialProviderData;
|
|
191
|
+
allCredentials: IConnectCredential[];
|
|
192
|
+
} & ConnectCredentialConfig;
|
|
185
193
|
/**
|
|
186
194
|
* The contents of the `integrations` field for an authenticated ConnectUser.
|
|
187
195
|
*
|
|
188
196
|
* The fields from `ConnectCredentialConfig` are stored; all other fields are computed from other
|
|
189
197
|
* available entities.
|
|
190
198
|
*/
|
|
191
|
-
type SDKIntegrationState = Partial<Record<string,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
199
|
+
type SDKIntegrationState = Partial<Record<string, SDKIntegration>>;
|
|
200
|
+
export type UninstallOptions = {
|
|
201
|
+
selectedCredentialId?: string;
|
|
202
|
+
};
|
|
203
|
+
export type DisableWorkflowOptions = {
|
|
204
|
+
selectedCredentialId?: string;
|
|
205
|
+
};
|
|
198
206
|
export type IConnectUser = Omit<AuthenticatedConnectUser, 'token'>;
|
|
199
207
|
export declare const INFER_CONTENT_TYPE_FROM_CONNECT_OPTIONS = "auto";
|
|
208
|
+
export declare const SELECTED_CREDENTIAL_ID_HEADER = "X-Paragon-Credential";
|
|
200
209
|
export {};
|
package/dist/src/types/sdk.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { OauthCallbackResponse } from '../entities/credential.interface';
|
|
|
3
3
|
import { IIntegrationMetadata } from '../entities/integration.interface';
|
|
4
4
|
import { PersonaMeta } from '../entities/persona.interface';
|
|
5
5
|
import { IConnectUserContext } from '../helpers/ConnectUserContext';
|
|
6
|
-
import { AuthenticatedConnectUser, DynamicMappingField, DynamicMappingOptions, IntegrationWorkflowState } from '../types/connect';
|
|
6
|
+
import { AuthenticatedConnectUser, DisableWorkflowOptions, DynamicMappingField, DynamicMappingOptions, IntegrationWorkflowState, UninstallOptions } from '../types/connect';
|
|
7
7
|
import { Props as ConnectModalProps } from './connectModal';
|
|
8
8
|
export type ConnectUser = {
|
|
9
9
|
authenticated: false;
|
|
@@ -70,11 +70,11 @@ export interface IConnectSDK {
|
|
|
70
70
|
/**
|
|
71
71
|
* uninstalls an integration for connected user.
|
|
72
72
|
*/
|
|
73
|
-
uninstallIntegration(name: string): Promise<void>;
|
|
73
|
+
uninstallIntegration(name: string, options: UninstallOptions): Promise<void>;
|
|
74
74
|
/**
|
|
75
75
|
* disables a workflow for the connected user and unsubscribes all the workflows in hermes
|
|
76
76
|
*/
|
|
77
|
-
disableWorkflow(workflowId: string): Promise<void>;
|
|
77
|
+
disableWorkflow(workflowId: string, options: DisableWorkflowOptions): Promise<void>;
|
|
78
78
|
setUserMetadata(meta: PersonaMeta): Promise<AuthenticatedConnectUser>;
|
|
79
79
|
/**
|
|
80
80
|
* sets the base url for different services used in connect sdk
|
|
@@ -123,6 +123,17 @@ export interface IConnectSDK {
|
|
|
123
123
|
* @param triggerWorkflowRequest
|
|
124
124
|
*/
|
|
125
125
|
workflow(workflowId: string, triggerWorkflowRequest: TriggerWorkflowRequest): Promise<object | undefined>;
|
|
126
|
+
/**
|
|
127
|
+
* completes installation using authorizationCode of actions e.g. "pipedrive"
|
|
128
|
+
* @param action
|
|
129
|
+
* @param options
|
|
130
|
+
*/
|
|
131
|
+
completeInstall(action: string, options: {
|
|
132
|
+
authorizationCode: string;
|
|
133
|
+
showPortalAfterInstall?: boolean;
|
|
134
|
+
redirectUrl?: string;
|
|
135
|
+
integrationOptions?: Record<string, unknown>;
|
|
136
|
+
}): Promise<void>;
|
|
126
137
|
}
|
|
127
138
|
/**
|
|
128
139
|
* sdk install options
|
|
@@ -140,6 +151,8 @@ export type InstallOptions = {
|
|
|
140
151
|
* not show post oauth promt if this is true
|
|
141
152
|
*/
|
|
142
153
|
bypassPostOAuthPrompt?: boolean;
|
|
154
|
+
allowMultipleCredentials?: boolean;
|
|
155
|
+
selectedCredentialId?: string;
|
|
143
156
|
};
|
|
144
157
|
export type AuthenticateOptions = {
|
|
145
158
|
metadata?: PersonaMeta;
|
|
@@ -219,5 +232,6 @@ export type TriggerWorkflowRequest = {
|
|
|
219
232
|
body?: RequestInit['body'] | object;
|
|
220
233
|
headers?: RequestInit['headers'];
|
|
221
234
|
query?: Record<string, string>;
|
|
235
|
+
selectedCredentialId?: string;
|
|
222
236
|
};
|
|
223
237
|
export {};
|
package/dist/src/utils/http.d.ts
CHANGED
|
@@ -11,3 +11,29 @@ export declare const isValidUrl: (url: string) => boolean;
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function sanitizeUrl(url: string): string;
|
|
13
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
|
+
/**
|
|
35
|
+
* extract error message from response object
|
|
36
|
+
* @param response
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
export declare function getErrorMessage(response: Response): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useparagon/connect",
|
|
3
|
-
"version": "1.0.2",
|
|
3
|
+
"version": "1.0.3-experimental.2",
|
|
4
4
|
"description": "paragon connect npm package",
|
|
5
5
|
"main": "dist/src/index.ts",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"exports": "./dist/src/index.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "yarn typecheck && yarn clean && webpack --config webpack.config.js",
|
|
10
9
|
"build:prod": "yarn typecheck && yarn clean && webpack --config webpack.config.js",
|
|
11
10
|
"build:watch": "yarn build --watch",
|
|
12
|
-
"
|
|
11
|
+
"build": "yarn typecheck && yarn clean && webpack --config webpack.config.js",
|
|
12
|
+
"ci:compile": "whiskers",
|
|
13
13
|
"clean:server": "rimraf ./dist/src",
|
|
14
|
+
"clean": "rimraf coverage dist",
|
|
14
15
|
"format:check": "prettier --ignore-path=./prettierignore --config=prettier.config.js --check .",
|
|
15
16
|
"format": "prettier --ignore-path=./.prettierignore --write .",
|
|
16
|
-
"lint": "NODE_OPTIONS=--max-old-space-size=4096 yarn -s lint:cmd \"src{/**/,/}*.{js,jsx,ts,tsx}\"",
|
|
17
17
|
"lint:cmd": "eslint --no-error-on-unmatched-pattern -c ./.eslintrc.js --cache --cache-strategy content --cache-location ./eslintcache/ --quiet",
|
|
18
18
|
"lint:fix": "yarn -s lint --fix",
|
|
19
19
|
"lint:staged": "yarn -s lint:cmd --fix",
|
|
20
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=4096 yarn -s lint:cmd \"src{/**/,/}*.{js,jsx,ts,tsx}\"",
|
|
20
21
|
"prebuild": "yarn -s clean",
|
|
22
|
+
"release:publish:experimental": "yarn publish --new-version=$npm_package_version --tag=experimental",
|
|
23
|
+
"release:publish:stable": "yarn publish --new-version=$npm_package_version --tag=latest",
|
|
24
|
+
"release:version:bump": "ts-node ./scripts/version-bump.ts",
|
|
21
25
|
"test": "NODE_OPTIONS=--max-old-space-size=4096 jest",
|
|
22
|
-
"typecheck": "tsc -p tsconfig.json"
|
|
23
|
-
"prepublishOnly":"yarn lint && yarn build"
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
29
|
"hash.js": "^1.1.7",
|
|
@@ -38,6 +41,7 @@
|
|
|
38
41
|
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
39
42
|
"@typescript-eslint/eslint-plugin-tslint": "^5.21.0",
|
|
40
43
|
"@typescript-eslint/parser": "^5.21.0",
|
|
44
|
+
"@useparagon/whiskers-cli": "^0.0.1-canary.15",
|
|
41
45
|
"babel-loader": "^8.2.1",
|
|
42
46
|
"concurrently": "^6.2.0",
|
|
43
47
|
"crypto-browserify": "^3.12.0",
|
|
@@ -50,6 +54,7 @@
|
|
|
50
54
|
"eslint-plugin-react": "^7.29.4",
|
|
51
55
|
"eslint-plugin-react-hooks": "^4.4.0",
|
|
52
56
|
"eslint-plugin-unicorn": "^41.0.0",
|
|
57
|
+
"glob": "^10.3.10",
|
|
53
58
|
"jest": "^27.0.6",
|
|
54
59
|
"jest-fetch-mock": "useparagon/jest-fetch-mock.git#3.0.4",
|
|
55
60
|
"jest-json": "^1.0.4",
|
|
@@ -83,5 +88,10 @@
|
|
|
83
88
|
"./dist/src/**/*",
|
|
84
89
|
"./dist/**/*.json"
|
|
85
90
|
]
|
|
91
|
+
},
|
|
92
|
+
"resolutions": {
|
|
93
|
+
"string-width": "^4.2.3",
|
|
94
|
+
"strip-ansi": "^6.0.1",
|
|
95
|
+
"wrap-ansi": "^6.2.0"
|
|
86
96
|
}
|
|
87
97
|
}
|
|
Binary file
|
|
Binary file
|