@quiltt/core 4.3.2 → 4.4.0
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/CHANGELOG.md +42 -0
- package/dist/{SubscriptionLink-12s-BTrDDGH7.js → SubscriptionLink-12s-CoOidlX2.js} +1 -1
- package/dist/index.d.ts +25 -4
- package/dist/index.js +27 -7
- package/package.json +1 -1
- package/src/api/rest/connectors.ts +101 -0
- package/src/api/rest/index.ts +1 -1
- package/src/api/rest/institutions.ts +0 -70
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# @quiltt/core
|
|
2
2
|
|
|
3
|
+
## 4.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#378](https://github.com/quiltt/quiltt-js/pull/378) [`0af4e66`](https://github.com/quiltt/quiltt-js/commit/0af4e6622d1542e0c0c02ac7e897e3e4f9219cbd) Thanks [@sirwolfgang](https://github.com/sirwolfgang)! - Add connector institution search and provider migration support.
|
|
8
|
+
|
|
9
|
+
## New APIs
|
|
10
|
+
|
|
11
|
+
### `useQuilttResolvable` Hook
|
|
12
|
+
|
|
13
|
+
Check if external provider institution IDs (e.g., Plaid) can be migrated to your connector.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { useQuilttResolvable } from "@quiltt/react";
|
|
17
|
+
import { useEffect } from "react";
|
|
18
|
+
|
|
19
|
+
function ResolvableConnector({ plaidInstitutionId, children }) {
|
|
20
|
+
const { checkResolvable, isResolvable, isLoading } =
|
|
21
|
+
useQuilttResolvable("my-connector-id");
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
checkResolvable({ plaid: plaidInstitutionId });
|
|
25
|
+
}, [plaidInstitutionId]);
|
|
26
|
+
|
|
27
|
+
if (isLoading) return <div>Checking...</div>;
|
|
28
|
+
if (!isResolvable) return null;
|
|
29
|
+
|
|
30
|
+
return <>{children}</>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Usage
|
|
34
|
+
<ResolvableConnector plaidInstitutionId="ins_3">
|
|
35
|
+
<QuilttButton connectorId="my-connector-id" />
|
|
36
|
+
</ResolvableConnector>;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 4.3.3
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- [#375](https://github.com/quiltt/quiltt-js/pull/375) [`fdc91e3`](https://github.com/quiltt/quiltt-js/commit/fdc91e3efb3f63659580f2d1d2ea0ff7fcaee8f5) Thanks [@sirwolfgang](https://github.com/sirwolfgang)! - Add 403 callback to Auth useIdentifySession
|
|
44
|
+
|
|
3
45
|
## 4.3.2
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -283,9 +283,14 @@ type InstitutionData = {
|
|
|
283
283
|
logoUrl: string;
|
|
284
284
|
};
|
|
285
285
|
type InstitutionsData = Array<InstitutionData>;
|
|
286
|
+
type ResolvableData = {
|
|
287
|
+
resolvable: boolean;
|
|
288
|
+
};
|
|
286
289
|
type Search = InstitutionsData | ErrorData | UnauthorizedData;
|
|
290
|
+
type Resolvable = ResolvableData | ErrorData | UnauthorizedData;
|
|
287
291
|
type SearchResponse = FetchResponse<InstitutionsData>;
|
|
288
|
-
|
|
292
|
+
type ResolvableResponse = FetchResponse<ResolvableData>;
|
|
293
|
+
declare class ConnectorsAPI {
|
|
289
294
|
clientId: string;
|
|
290
295
|
agent: string;
|
|
291
296
|
constructor(clientId: string, agent?: string);
|
|
@@ -293,9 +298,25 @@ declare class InstitutionsAPI {
|
|
|
293
298
|
* Response Statuses:
|
|
294
299
|
* - 200: OK -> Institutions Found
|
|
295
300
|
* - 401: Unauthorized -> Invalid Token
|
|
301
|
+
* - 403: Forbidden -> Unsupported SDK
|
|
296
302
|
* - 400: Bad Request -> Invalid Request
|
|
297
303
|
*/
|
|
298
|
-
|
|
304
|
+
searchInstitutions: (token: string, connectorId: string, term: string, signal?: AbortSignal) => Promise<FetchResponse<Search>>;
|
|
305
|
+
/**
|
|
306
|
+
* Response Statuses:
|
|
307
|
+
* - 200: OK -> Provider API ID is resolvable or not
|
|
308
|
+
* - 401: Unauthorized -> Invalid Token
|
|
309
|
+
* - 403: Forbidden -> Unsupported SDK
|
|
310
|
+
* - 400: Bad Request -> Missing provider API ID parameter
|
|
311
|
+
* - 404: Not Found -> Connector not found
|
|
312
|
+
*/
|
|
313
|
+
checkResolvable: (token: string, connectorId: string, providerId: {
|
|
314
|
+
plaid?: string;
|
|
315
|
+
mock?: string;
|
|
316
|
+
mx?: string;
|
|
317
|
+
finicity?: string;
|
|
318
|
+
akoya?: string;
|
|
319
|
+
}, signal?: AbortSignal) => Promise<FetchResponse<Resolvable>>;
|
|
299
320
|
private config;
|
|
300
321
|
private validateStatus;
|
|
301
322
|
}
|
|
@@ -475,5 +496,5 @@ declare class Timeoutable {
|
|
|
475
496
|
private broadcast;
|
|
476
497
|
}
|
|
477
498
|
|
|
478
|
-
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, ConnectorSDKEventType, ErrorLink, ForwardableLink, GlobalStorage, HttpLink,
|
|
479
|
-
export type { BadRequestResponse, Claims, ConnectorSDK, ConnectorSDKCallbackMetadata, ConnectorSDKCallbacks, ConnectorSDKConnectOptions, ConnectorSDKConnector, ConnectorSDKConnectorOptions, ConnectorSDKOnEventCallback, ConnectorSDKOnEventExitCallback, ConnectorSDKOnExitAbortCallback, ConnectorSDKOnExitErrorCallback, ConnectorSDKOnExitSuccessCallback, ConnectorSDKOnLoadCallback, ConnectorSDKOnOpenCallback, ConnectorSDKReconnectOptions, DeepPartial, DeepReadonly, ErrorData, Exact, InputMaybe, InstitutionData, InstitutionsData, JsonWebToken, MakeMaybe, MakeOptional, Maybe, Mutable, NoContentData, Nullable, Observer, PasscodePayload, PrivateClaims, QuilttClientOptions, QuilttJWT, RegisteredClaims, SearchResponse, SessionResponse, UnauthorizedData, UnauthorizedResponse, UnprocessableData, UnprocessableResponse, UsernamePayload };
|
|
499
|
+
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, ConnectorSDKEventType, ConnectorsAPI, ErrorLink, ForwardableLink, GlobalStorage, HttpLink, JsonWebTokenParse, LocalStorage, MemoryStorage, Observable, QuilttClient, RetryLink, Storage, SubscriptionLink, TerminatingLink, Timeoutable, VersionLink, cdnBase, debugging, endpointAuth, endpointGraphQL, endpointRest, endpointWebsockets, version };
|
|
500
|
+
export type { BadRequestResponse, Claims, ConnectorSDK, ConnectorSDKCallbackMetadata, ConnectorSDKCallbacks, ConnectorSDKConnectOptions, ConnectorSDKConnector, ConnectorSDKConnectorOptions, ConnectorSDKOnEventCallback, ConnectorSDKOnEventExitCallback, ConnectorSDKOnExitAbortCallback, ConnectorSDKOnExitErrorCallback, ConnectorSDKOnExitSuccessCallback, ConnectorSDKOnLoadCallback, ConnectorSDKOnOpenCallback, ConnectorSDKReconnectOptions, DeepPartial, DeepReadonly, ErrorData, Exact, InputMaybe, InstitutionData, InstitutionsData, JsonWebToken, MakeMaybe, MakeOptional, Maybe, Mutable, NoContentData, Nullable, Observer, PasscodePayload, PrivateClaims, QuilttClientOptions, QuilttJWT, RegisteredClaims, ResolvableData, ResolvableResponse, SearchResponse, SessionResponse, UnauthorizedData, UnauthorizedResponse, UnprocessableData, UnprocessableResponse, UsernamePayload };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApolloLink, ApolloClient } from '@apollo/client/core/index.js';
|
|
2
2
|
export { gql } from '@apollo/client/core/index.js';
|
|
3
|
-
import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth, b as endpointRest } from './SubscriptionLink-12s-
|
|
4
|
-
export { L as LocalStorage, M as MemoryStorage, O as Observable, g as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-12s-
|
|
3
|
+
import { G as GlobalStorage, e as endpointGraphQL, v as version, d as debugging, S as SubscriptionLink, a as endpointAuth, b as endpointRest } from './SubscriptionLink-12s-CoOidlX2.js';
|
|
4
|
+
export { L as LocalStorage, M as MemoryStorage, O as Observable, g as Storage, c as cdnBase, f as endpointWebsockets } from './SubscriptionLink-12s-CoOidlX2.js';
|
|
5
5
|
import { BatchHttpLink as BatchHttpLink$1 } from '@apollo/client/link/batch-http/index.js';
|
|
6
6
|
import crossfetch from 'cross-fetch';
|
|
7
7
|
import { onError } from '@apollo/client/link/error/index.js';
|
|
@@ -258,18 +258,38 @@ class AuthAPI {
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
class
|
|
261
|
+
class ConnectorsAPI {
|
|
262
262
|
constructor(clientId, agent = 'web'){
|
|
263
263
|
/**
|
|
264
264
|
* Response Statuses:
|
|
265
265
|
* - 200: OK -> Institutions Found
|
|
266
266
|
* - 401: Unauthorized -> Invalid Token
|
|
267
|
+
* - 403: Forbidden -> Unsupported SDK
|
|
267
268
|
* - 400: Bad Request -> Invalid Request
|
|
268
|
-
*/ this.
|
|
269
|
+
*/ this.searchInstitutions = async (token, connectorId, term, signal)=>{
|
|
269
270
|
const params = new URLSearchParams();
|
|
270
|
-
params.append('connectorId', connectorId);
|
|
271
271
|
params.append('term', term);
|
|
272
|
-
const response = await fetchWithRetry(`${endpointRest}/sdk/institutions?${params}`, {
|
|
272
|
+
const response = await fetchWithRetry(`${endpointRest}/sdk/connectors/${connectorId}/institutions?${params}`, {
|
|
273
|
+
method: 'GET',
|
|
274
|
+
signal,
|
|
275
|
+
...this.config(token)
|
|
276
|
+
});
|
|
277
|
+
return response;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Response Statuses:
|
|
281
|
+
* - 200: OK -> Provider API ID is resolvable or not
|
|
282
|
+
* - 401: Unauthorized -> Invalid Token
|
|
283
|
+
* - 403: Forbidden -> Unsupported SDK
|
|
284
|
+
* - 400: Bad Request -> Missing provider API ID parameter
|
|
285
|
+
* - 404: Not Found -> Connector not found
|
|
286
|
+
*/ this.checkResolvable = async (token, connectorId, providerId, signal)=>{
|
|
287
|
+
const params = new URLSearchParams();
|
|
288
|
+
const providerKey = Object.keys(providerId)[0];
|
|
289
|
+
if (providerKey && providerId[providerKey]) {
|
|
290
|
+
params.append(providerKey, providerId[providerKey]);
|
|
291
|
+
}
|
|
292
|
+
const response = await fetchWithRetry(`${endpointRest}/sdk/connectors/${connectorId}/resolvable?${params}`, {
|
|
273
293
|
method: 'GET',
|
|
274
294
|
signal,
|
|
275
295
|
...this.config(token)
|
|
@@ -339,4 +359,4 @@ const JsonWebTokenParse = (token)=>{
|
|
|
339
359
|
}
|
|
340
360
|
}
|
|
341
361
|
|
|
342
|
-
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, ConnectorSDKEventType, ErrorLink, ForwardableLink, GlobalStorage, HttpLink,
|
|
362
|
+
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, ConnectorSDKEventType, ConnectorsAPI, ErrorLink, ForwardableLink, GlobalStorage, HttpLink, JsonWebTokenParse, QuilttClient, RetryLink, SubscriptionLink, TerminatingLink, Timeoutable, VersionLink, debugging, endpointAuth, endpointGraphQL, endpointRest, version };
|
package/package.json
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { endpointRest } from '@/configuration'
|
|
2
|
+
|
|
3
|
+
import type { FetchResponse } from './fetchWithRetry'
|
|
4
|
+
import { fetchWithRetry } from './fetchWithRetry'
|
|
5
|
+
import type { ErrorData, UnauthorizedData } from './types'
|
|
6
|
+
|
|
7
|
+
export type InstitutionData = { name: string; logoUrl: string }
|
|
8
|
+
export type InstitutionsData = Array<InstitutionData>
|
|
9
|
+
|
|
10
|
+
export type ResolvableData = { resolvable: boolean }
|
|
11
|
+
|
|
12
|
+
type Search = InstitutionsData | ErrorData | UnauthorizedData
|
|
13
|
+
type Resolvable = ResolvableData | ErrorData | UnauthorizedData
|
|
14
|
+
|
|
15
|
+
export type SearchResponse = FetchResponse<InstitutionsData>
|
|
16
|
+
export type ResolvableResponse = FetchResponse<ResolvableData>
|
|
17
|
+
|
|
18
|
+
export class ConnectorsAPI {
|
|
19
|
+
clientId: string
|
|
20
|
+
agent: string
|
|
21
|
+
|
|
22
|
+
constructor(clientId: string, agent = 'web') {
|
|
23
|
+
this.clientId = clientId
|
|
24
|
+
this.agent = agent
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Response Statuses:
|
|
29
|
+
* - 200: OK -> Institutions Found
|
|
30
|
+
* - 401: Unauthorized -> Invalid Token
|
|
31
|
+
* - 403: Forbidden -> Unsupported SDK
|
|
32
|
+
* - 400: Bad Request -> Invalid Request
|
|
33
|
+
*/
|
|
34
|
+
searchInstitutions = async (
|
|
35
|
+
token: string,
|
|
36
|
+
connectorId: string,
|
|
37
|
+
term: string,
|
|
38
|
+
signal?: AbortSignal,
|
|
39
|
+
) => {
|
|
40
|
+
const params = new URLSearchParams()
|
|
41
|
+
params.append('term', term)
|
|
42
|
+
|
|
43
|
+
const response = await fetchWithRetry<Search>(
|
|
44
|
+
`${endpointRest}/sdk/connectors/${connectorId}/institutions?${params}`,
|
|
45
|
+
{
|
|
46
|
+
method: 'GET',
|
|
47
|
+
signal,
|
|
48
|
+
...this.config(token),
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
return response
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Response Statuses:
|
|
56
|
+
* - 200: OK -> Provider API ID is resolvable or not
|
|
57
|
+
* - 401: Unauthorized -> Invalid Token
|
|
58
|
+
* - 403: Forbidden -> Unsupported SDK
|
|
59
|
+
* - 400: Bad Request -> Missing provider API ID parameter
|
|
60
|
+
* - 404: Not Found -> Connector not found
|
|
61
|
+
*/
|
|
62
|
+
checkResolvable = async (
|
|
63
|
+
token: string,
|
|
64
|
+
connectorId: string,
|
|
65
|
+
providerId: { plaid?: string; mock?: string; mx?: string; finicity?: string; akoya?: string },
|
|
66
|
+
signal?: AbortSignal,
|
|
67
|
+
) => {
|
|
68
|
+
const params = new URLSearchParams()
|
|
69
|
+
|
|
70
|
+
const providerKey = Object.keys(providerId)[0] as keyof typeof providerId
|
|
71
|
+
if (providerKey && providerId[providerKey]) {
|
|
72
|
+
params.append(providerKey, providerId[providerKey])
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const response = await fetchWithRetry<Resolvable>(
|
|
76
|
+
`${endpointRest}/sdk/connectors/${connectorId}/resolvable?${params}`,
|
|
77
|
+
{
|
|
78
|
+
method: 'GET',
|
|
79
|
+
signal,
|
|
80
|
+
...this.config(token),
|
|
81
|
+
},
|
|
82
|
+
)
|
|
83
|
+
return response
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private config = (token?: string) => {
|
|
87
|
+
const headers = new Headers()
|
|
88
|
+
headers.set('Content-Type', 'application/json')
|
|
89
|
+
headers.set('Accept', 'application/json')
|
|
90
|
+
headers.set('Quiltt-SDK-Agent', this.agent)
|
|
91
|
+
headers.set('Authorization', `Bearer ${token}`)
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
headers,
|
|
95
|
+
validateStatus: this.validateStatus,
|
|
96
|
+
retry: true,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private validateStatus = (status: number) => status < 500 && status !== 429
|
|
101
|
+
}
|
package/src/api/rest/index.ts
CHANGED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { endpointRest } from '@/configuration'
|
|
2
|
-
|
|
3
|
-
import type { FetchResponse } from './fetchWithRetry'
|
|
4
|
-
import { fetchWithRetry } from './fetchWithRetry'
|
|
5
|
-
import type { ErrorData, UnauthorizedData } from './types'
|
|
6
|
-
|
|
7
|
-
export type InstitutionData = { name: string; logoUrl: string }
|
|
8
|
-
export type InstitutionsData = Array<InstitutionData>
|
|
9
|
-
|
|
10
|
-
type Search = InstitutionsData | ErrorData | UnauthorizedData
|
|
11
|
-
|
|
12
|
-
export type SearchResponse = FetchResponse<InstitutionsData>
|
|
13
|
-
|
|
14
|
-
export class InstitutionsAPI {
|
|
15
|
-
clientId: string
|
|
16
|
-
agent: string
|
|
17
|
-
|
|
18
|
-
constructor(clientId: string, agent = 'web') {
|
|
19
|
-
this.clientId = clientId
|
|
20
|
-
this.agent = agent
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Response Statuses:
|
|
25
|
-
* - 200: OK -> Institutions Found
|
|
26
|
-
* - 401: Unauthorized -> Invalid Token
|
|
27
|
-
* - 400: Bad Request -> Invalid Request
|
|
28
|
-
*/
|
|
29
|
-
search = async (token: string, connectorId: string, term: string, signal?: AbortSignal) => {
|
|
30
|
-
const params = new URLSearchParams()
|
|
31
|
-
params.append('connectorId', connectorId)
|
|
32
|
-
params.append('term', term)
|
|
33
|
-
|
|
34
|
-
const response = await fetchWithRetry<Search>(`${endpointRest}/sdk/institutions?${params}`, {
|
|
35
|
-
method: 'GET',
|
|
36
|
-
signal,
|
|
37
|
-
...this.config(token),
|
|
38
|
-
})
|
|
39
|
-
return response
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private config = (token?: string) => {
|
|
43
|
-
const headers = new Headers()
|
|
44
|
-
headers.set('Content-Type', 'application/json')
|
|
45
|
-
headers.set('Accept', 'application/json')
|
|
46
|
-
headers.set('Quiltt-SDK-Agent', this.agent)
|
|
47
|
-
headers.set('Authorization', `Bearer ${token}`)
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
headers,
|
|
51
|
-
validateStatus: this.validateStatus,
|
|
52
|
-
retry: true,
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
private validateStatus = (status: number) => status < 500 && status !== 429
|
|
57
|
-
|
|
58
|
-
// private body = (payload: any) => {
|
|
59
|
-
// if (!this.clientId) {
|
|
60
|
-
// console.error('Quiltt Client ID is not set. Unable to identify & authenticate')
|
|
61
|
-
// }
|
|
62
|
-
|
|
63
|
-
// return {
|
|
64
|
-
// session: {
|
|
65
|
-
// clientId: this.clientId,
|
|
66
|
-
// ...payload,
|
|
67
|
-
// },
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
}
|