@quiltt/core 5.0.0 → 5.0.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/CHANGELOG.md +20 -0
- package/README.md +19 -12
- package/dist/api/browser.cjs +14 -0
- package/dist/api/browser.d.ts +128 -0
- package/dist/api/browser.js +12 -0
- package/dist/api/graphql/SubscriptionLink-12s-ufJBKwu1.js +149 -0
- package/dist/api/graphql/SubscriptionLink-12s-wjkChfxO.cjs +150 -0
- package/dist/api/graphql/index.cjs +218 -0
- package/dist/api/graphql/index.d.ts +82 -0
- package/dist/api/graphql/index.js +184 -0
- package/dist/api/index.cjs +26 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/rest/index.cjs +225 -0
- package/dist/api/rest/index.d.ts +128 -0
- package/dist/api/rest/index.js +217 -0
- package/dist/auth/index.cjs +21 -0
- package/dist/auth/index.d.ts +29 -0
- package/dist/auth/index.js +19 -0
- package/dist/config/index.cjs +44 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +36 -0
- package/dist/index.cjs +61 -0
- package/dist/index.d.ts +8 -524
- package/dist/index.js +8 -449
- package/dist/observables/index.cjs +30 -0
- package/dist/observables/index.d.ts +21 -0
- package/dist/observables/index.js +28 -0
- package/dist/storage/index.cjs +272 -0
- package/dist/storage/index.d.ts +91 -0
- package/dist/{SubscriptionLink-12s-C2VbF8Tf.js → storage/index.js} +2 -139
- package/dist/timing/index.cjs +30 -0
- package/dist/timing/index.d.ts +15 -0
- package/dist/timing/index.js +28 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.js +1 -0
- package/dist/utils/index.cjs +61 -0
- package/dist/utils/index.d.ts +18 -0
- package/dist/utils/index.js +57 -0
- package/package.json +62 -6
- package/src/api/graphql/client.ts +1 -1
- package/src/api/graphql/links/ActionCableLink.ts +7 -6
- package/src/api/graphql/links/AuthLink.ts +13 -9
- package/src/api/graphql/links/BatchHttpLink.ts +1 -1
- package/src/api/graphql/links/ErrorLink.ts +4 -0
- package/src/api/graphql/links/HttpLink.ts +1 -1
- package/src/api/graphql/links/VersionLink.ts +1 -1
- package/src/api/rest/auth.ts +1 -1
- package/src/api/rest/connectors.ts +1 -1
- package/src/auth/index.ts +1 -0
- package/src/{JsonWebToken.ts → auth/json-web-token.ts} +1 -1
- package/src/{configuration.ts → config/configuration.ts} +1 -1
- package/src/config/index.ts +1 -0
- package/src/index.ts +5 -5
- package/src/observables/index.ts +1 -0
- package/src/{Observable.ts → observables/observable.ts} +1 -1
- package/src/storage/Local.ts +1 -1
- package/src/storage/Memory.ts +2 -2
- package/src/storage/Storage.ts +1 -1
- package/src/timing/index.ts +1 -0
- package/src/{Timeoutable.ts → timing/timeoutable.ts} +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/token-validation.ts +67 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare const debugging: boolean;
|
|
2
|
+
declare const version: string;
|
|
3
|
+
declare const cdnBase: string;
|
|
4
|
+
declare const endpointAuth: string;
|
|
5
|
+
declare const endpointGraphQL: string;
|
|
6
|
+
declare const endpointRest: string;
|
|
7
|
+
declare const endpointWebsockets: string;
|
|
8
|
+
|
|
9
|
+
export { cdnBase, debugging, endpointAuth, endpointGraphQL, endpointRest, endpointWebsockets, version };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var name = "@quiltt/core";
|
|
2
|
+
var version$1 = "5.0.2";
|
|
3
|
+
|
|
4
|
+
const QUILTT_API_INSECURE = (()=>{
|
|
5
|
+
try {
|
|
6
|
+
return process.env.QUILTT_API_INSECURE === 'true';
|
|
7
|
+
} catch {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
})();
|
|
11
|
+
const QUILTT_API_DOMAIN = (()=>{
|
|
12
|
+
try {
|
|
13
|
+
return process.env.QUILTT_API_DOMAIN;
|
|
14
|
+
} catch {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
})();
|
|
18
|
+
const QUILTT_DEBUG = (()=>{
|
|
19
|
+
try {
|
|
20
|
+
return process.env.NODE_ENV !== 'production' && process.env.QUILTT_DEBUG === 'true';
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
const domain = QUILTT_API_DOMAIN || 'quiltt.io';
|
|
26
|
+
const protocolHttp = `http${QUILTT_API_INSECURE ? '' : 's'}`;
|
|
27
|
+
const protocolWebsockets = `ws${QUILTT_API_INSECURE ? '' : 's'}`;
|
|
28
|
+
const debugging = QUILTT_DEBUG;
|
|
29
|
+
const version = `${name}: v${version$1}`;
|
|
30
|
+
const cdnBase = `${protocolHttp}://cdn.${domain}`;
|
|
31
|
+
const endpointAuth = `${protocolHttp}://auth.${domain}/v1/users/session`;
|
|
32
|
+
const endpointGraphQL = `${protocolHttp}://api.${domain}/v1/graphql`;
|
|
33
|
+
const endpointRest = `${protocolHttp}://api.${domain}/v1`;
|
|
34
|
+
const endpointWebsockets = `${protocolWebsockets}://api.${domain}/websockets`;
|
|
35
|
+
|
|
36
|
+
export { cdnBase, debugging, endpointAuth, endpointGraphQL, endpointRest, endpointWebsockets, version };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
|
|
3
|
+
var index_cjs = require('./api/index.cjs');
|
|
4
|
+
var index_cjs$1 = require('./auth/index.cjs');
|
|
5
|
+
var index_cjs$2 = require('./config/index.cjs');
|
|
6
|
+
var index_cjs$3 = require('./observables/index.cjs');
|
|
7
|
+
var index_cjs$4 = require('./storage/index.cjs');
|
|
8
|
+
var index_cjs$5 = require('./timing/index.cjs');
|
|
9
|
+
var types_cjs = require('./types.cjs');
|
|
10
|
+
var index_cjs$6 = require('./utils/index.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Object.keys(index_cjs).forEach(function (k) {
|
|
15
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return index_cjs[k]; }
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
Object.keys(index_cjs$1).forEach(function (k) {
|
|
21
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return index_cjs$1[k]; }
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
Object.keys(index_cjs$2).forEach(function (k) {
|
|
27
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return index_cjs$2[k]; }
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
Object.keys(index_cjs$3).forEach(function (k) {
|
|
33
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return index_cjs$3[k]; }
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
Object.keys(index_cjs$4).forEach(function (k) {
|
|
39
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return index_cjs$4[k]; }
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
Object.keys(index_cjs$5).forEach(function (k) {
|
|
45
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return index_cjs$5[k]; }
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
Object.keys(types_cjs).forEach(function (k) {
|
|
51
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return types_cjs[k]; }
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
Object.keys(index_cjs$6).forEach(function (k) {
|
|
57
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () { return index_cjs$6[k]; }
|
|
60
|
+
});
|
|
61
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,524 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
10
|
-
export { InMemoryCache, NormalizedCacheObject } from '@apollo/client/cache';
|
|
11
|
-
export { useMutation, useQuery, useSubscription } from '@apollo/client/react';
|
|
12
|
-
|
|
13
|
-
interface CallbackManager {
|
|
14
|
-
onEvent(callback: ConnectorSDKOnEventCallback): void;
|
|
15
|
-
onOpen(callback: ConnectorSDKOnOpenCallback): void;
|
|
16
|
-
onLoad(callback: ConnectorSDKOnLoadCallback): void;
|
|
17
|
-
onExit(callback: ConnectorSDKOnEventExitCallback): void;
|
|
18
|
-
onExitSuccess(callback: ConnectorSDKOnExitSuccessCallback): void;
|
|
19
|
-
onExitAbort(callback: ConnectorSDKOnExitAbortCallback): void;
|
|
20
|
-
onExitError(callback: ConnectorSDKOnExitErrorCallback): void;
|
|
21
|
-
offEvent(callback: ConnectorSDKOnEventCallback): void;
|
|
22
|
-
offOpen(callback: ConnectorSDKOnOpenCallback): void;
|
|
23
|
-
offLoad(callback: ConnectorSDKOnLoadCallback): void;
|
|
24
|
-
offExit(callback: ConnectorSDKOnEventExitCallback): void;
|
|
25
|
-
offExitSuccess(callback: ConnectorSDKOnExitSuccessCallback): void;
|
|
26
|
-
offExitAbort(callback: ConnectorSDKOnExitAbortCallback): void;
|
|
27
|
-
offExitError(callback: ConnectorSDKOnExitErrorCallback): void;
|
|
28
|
-
}
|
|
29
|
-
interface ConnectorSDK extends CallbackManager {
|
|
30
|
-
authenticate(token: string | null | undefined): void;
|
|
31
|
-
connect(connectorId: string, options?: ConnectorSDKConnectOptions): ConnectorSDKConnector;
|
|
32
|
-
reconnect(connectorId: string, options: ConnectorSDKReconnectOptions): ConnectorSDKConnector;
|
|
33
|
-
reset(): void;
|
|
34
|
-
resetConnector: (connectorId: string) => void;
|
|
35
|
-
}
|
|
36
|
-
interface ConnectorSDKConnector extends CallbackManager {
|
|
37
|
-
open(): void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Types for optional callbacks in the ConnectorSDK.
|
|
41
|
-
*
|
|
42
|
-
* Leaf event nodes return only metadata.
|
|
43
|
-
* Internal nodes return both event type and metadata.
|
|
44
|
-
*/
|
|
45
|
-
type ConnectorSDKCallbacks = {
|
|
46
|
-
onEvent?: ConnectorSDKOnEventCallback;
|
|
47
|
-
onOpen?: ConnectorSDKOnOpenCallback;
|
|
48
|
-
onLoad?: ConnectorSDKOnLoadCallback;
|
|
49
|
-
onExit?: ConnectorSDKOnEventExitCallback;
|
|
50
|
-
onExitSuccess?: ConnectorSDKOnExitSuccessCallback;
|
|
51
|
-
onExitAbort?: ConnectorSDKOnExitAbortCallback;
|
|
52
|
-
onExitError?: ConnectorSDKOnExitErrorCallback;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Callback function to handle all events from the Connector.
|
|
56
|
-
* @param type The type of event that was emitted
|
|
57
|
-
* @param metadata Metadata about the event that was emitted
|
|
58
|
-
*/
|
|
59
|
-
type ConnectorSDKOnEventCallback = (
|
|
60
|
-
/** The type of event that was emitted */
|
|
61
|
-
type: ConnectorSDKEventType,
|
|
62
|
-
/** The metadata from the event */
|
|
63
|
-
metadata: ConnectorSDKCallbackMetadata) => void;
|
|
64
|
-
/** Callback function to handle the Open event */
|
|
65
|
-
type ConnectorSDKOnOpenCallback = (metadata: ConnectorSDKCallbackMetadata) => void;
|
|
66
|
-
/** Callback function to handle the Load event */
|
|
67
|
-
type ConnectorSDKOnLoadCallback = (metadata: ConnectorSDKCallbackMetadata) => void;
|
|
68
|
-
/** Callback function to handle all Exit events */
|
|
69
|
-
type ConnectorSDKOnEventExitCallback = (type: ConnectorSDKEventType, metadata: ConnectorSDKCallbackMetadata) => void;
|
|
70
|
-
/** Callback function to handle the ExitSuccess event */
|
|
71
|
-
type ConnectorSDKOnExitSuccessCallback = (metadata: ConnectorSDKCallbackMetadata) => void;
|
|
72
|
-
/** Callback function to handle the ExitAbort event */
|
|
73
|
-
type ConnectorSDKOnExitAbortCallback = (metadata: ConnectorSDKCallbackMetadata) => void;
|
|
74
|
-
/** Callback function to handle the ExitError event */
|
|
75
|
-
type ConnectorSDKOnExitErrorCallback = (metadata: ConnectorSDKCallbackMetadata) => void;
|
|
76
|
-
/**
|
|
77
|
-
* Enum representing the different types of events emitted by the Connector.
|
|
78
|
-
*/
|
|
79
|
-
declare enum ConnectorSDKEventType {
|
|
80
|
-
/** The Connector modal has been opened */
|
|
81
|
-
Open = "opened",
|
|
82
|
-
/** The Connector has loaded successfully */
|
|
83
|
-
Load = "loaded",
|
|
84
|
-
/** The end-user successfully completed the flow */
|
|
85
|
-
ExitSuccess = "exited.successful",
|
|
86
|
-
/** The end-user exited the Connector before completing the flow */
|
|
87
|
-
ExitAbort = "exited.aborted",
|
|
88
|
-
/** The end-user experienced an error during the flow */
|
|
89
|
-
ExitError = "exited.errored"
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Metadata about a Connector event
|
|
93
|
-
* @param connectorId The ID of the Connector that emitted the event
|
|
94
|
-
* @param profileId The ID of the authenticated Profile
|
|
95
|
-
* @param connectionId The ID of the Connection that was created or reconnected
|
|
96
|
-
*/
|
|
97
|
-
type ConnectorSDKCallbackMetadata = {
|
|
98
|
-
/** The ID of the Connector that emitted the event */
|
|
99
|
-
connectorId: string;
|
|
100
|
-
/** The ID of the authenticated Profile */
|
|
101
|
-
profileId?: string;
|
|
102
|
-
/** The ID of the Connection that was created or reconnected */
|
|
103
|
-
connectionId?: string;
|
|
104
|
-
/** The Connector Session Object */
|
|
105
|
-
connectorSession?: {
|
|
106
|
-
id: string;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
Options for the standard Connect flow
|
|
111
|
-
@param institution The Institution ID or search term to connect
|
|
112
|
-
*/
|
|
113
|
-
type ConnectorSDKConnectOptions = ConnectorSDKCallbacks & {
|
|
114
|
-
/** The Institution ID or search term to connect */
|
|
115
|
-
institution?: string;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Options for the Reconnect flow
|
|
119
|
-
* @param connectionId The ID of the Connection to reconnect
|
|
120
|
-
*/
|
|
121
|
-
type ConnectorSDKReconnectOptions = ConnectorSDKCallbacks & {
|
|
122
|
-
/** The ID of the Connection to reconnect */
|
|
123
|
-
connectionId: string;
|
|
124
|
-
};
|
|
125
|
-
/** Options to initialize Connector
|
|
126
|
-
*
|
|
127
|
-
* @todo: refactor into a union type - it's either or.
|
|
128
|
-
* Union types only allow direct access to properties that exist on all branches, not properties unique to individual branches.
|
|
129
|
-
*/
|
|
130
|
-
type ConnectorSDKConnectorOptions = ConnectorSDKCallbacks & {
|
|
131
|
-
/** The Institution ID or search term to connect */
|
|
132
|
-
institution?: string;
|
|
133
|
-
/** The ID of the Connection to reconnect */
|
|
134
|
-
connectionId?: string;
|
|
135
|
-
/** The nonce to use for the script tag */
|
|
136
|
-
nonce?: string;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
type QuilttClientOptions = Omit<ApolloClient.Options, 'link'> & {
|
|
140
|
-
/** An array of initial links to inject before the default Quiltt Links */
|
|
141
|
-
customLinks?: ApolloLink[];
|
|
142
|
-
/** Platform-specific version link (required) */
|
|
143
|
-
versionLink: ApolloLink;
|
|
144
|
-
};
|
|
145
|
-
declare class QuilttClient extends ApolloClient {
|
|
146
|
-
constructor(options: QuilttClientOptions);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* unauthorizedCallback only triggers in the event the token is present, and
|
|
151
|
-
* returns the token; This allows sessions to be forgotten without race conditions
|
|
152
|
-
* causing null sessions to kill valid sessions, or invalid sessions for killing
|
|
153
|
-
* valid sessions during rotation and networking weirdness.
|
|
154
|
-
*/
|
|
155
|
-
declare class AuthLink extends ApolloLink {
|
|
156
|
-
request(operation: ApolloLink.Operation, forward: ApolloLink.ForwardFunction): Observable$1<ApolloLink.Result>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
declare const BatchHttpLink: BatchHttpLink$1;
|
|
160
|
-
|
|
161
|
-
declare const ErrorLink: ErrorLink$1;
|
|
162
|
-
|
|
163
|
-
declare const ForwardableLink: ApolloLink;
|
|
164
|
-
|
|
165
|
-
declare const HttpLink: HttpLink$1;
|
|
166
|
-
|
|
167
|
-
declare const RetryLink: RetryLink$1;
|
|
168
|
-
|
|
169
|
-
type RequestResult = ApolloLink.Result<{
|
|
170
|
-
[key: string]: unknown;
|
|
171
|
-
}>;
|
|
172
|
-
type ConnectionParams = object | ((operation: ApolloLink.Operation) => object);
|
|
173
|
-
type SubscriptionCallbacks = {
|
|
174
|
-
connected?: (args?: {
|
|
175
|
-
reconnected: boolean;
|
|
176
|
-
}) => void;
|
|
177
|
-
disconnected?: () => void;
|
|
178
|
-
received?: (payload: unknown) => void;
|
|
179
|
-
};
|
|
180
|
-
declare class ActionCableLink extends ApolloLink {
|
|
181
|
-
cables: {
|
|
182
|
-
[id: string]: Consumer;
|
|
183
|
-
};
|
|
184
|
-
channelName: string;
|
|
185
|
-
actionName: string;
|
|
186
|
-
connectionParams: ConnectionParams;
|
|
187
|
-
callbacks: SubscriptionCallbacks;
|
|
188
|
-
constructor(options: {
|
|
189
|
-
channelName?: string;
|
|
190
|
-
actionName?: string;
|
|
191
|
-
connectionParams?: ConnectionParams;
|
|
192
|
-
callbacks?: SubscriptionCallbacks;
|
|
193
|
-
});
|
|
194
|
-
request(operation: ApolloLink.Operation, _next: ApolloLink.ForwardFunction): Observable$1<RequestResult>;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
declare class SubscriptionLink extends ActionCableLink {
|
|
198
|
-
constructor();
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
declare const TerminatingLink: ApolloLink;
|
|
202
|
-
|
|
203
|
-
declare const createVersionLink: (platformInfo: string) => ApolloLink;
|
|
204
|
-
|
|
205
|
-
type FetchResponse<T> = {
|
|
206
|
-
data: T;
|
|
207
|
-
status: number;
|
|
208
|
-
statusText: string;
|
|
209
|
-
headers: Headers;
|
|
210
|
-
ok: boolean;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
type NoContentData = null;
|
|
214
|
-
type ErrorData = {
|
|
215
|
-
message: string;
|
|
216
|
-
instruction: string;
|
|
217
|
-
error_id: string;
|
|
218
|
-
};
|
|
219
|
-
type UnauthorizedData = {
|
|
220
|
-
message: string;
|
|
221
|
-
instruction: string;
|
|
222
|
-
};
|
|
223
|
-
type UnprocessableData = {
|
|
224
|
-
[attribute: string]: Array<string>;
|
|
225
|
-
};
|
|
226
|
-
type BadRequestResponse = FetchResponse<ErrorData>;
|
|
227
|
-
type UnauthorizedResponse = FetchResponse<UnauthorizedData>;
|
|
228
|
-
type UnprocessableResponse = FetchResponse<UnprocessableData>;
|
|
229
|
-
|
|
230
|
-
declare enum AuthStrategies {
|
|
231
|
-
Email = "email",
|
|
232
|
-
Phone = "phone"
|
|
233
|
-
}
|
|
234
|
-
interface EmailInput {
|
|
235
|
-
email: string;
|
|
236
|
-
phone?: never;
|
|
237
|
-
}
|
|
238
|
-
interface PhoneInput {
|
|
239
|
-
phone: string;
|
|
240
|
-
email?: never;
|
|
241
|
-
}
|
|
242
|
-
type UsernamePayload = EmailInput | PhoneInput;
|
|
243
|
-
type PasscodePayload = UsernamePayload & {
|
|
244
|
-
passcode: string;
|
|
245
|
-
};
|
|
246
|
-
type SessionData = {
|
|
247
|
-
token: string;
|
|
248
|
-
};
|
|
249
|
-
type Ping = SessionData | UnauthorizedData;
|
|
250
|
-
type Identify = SessionData | NoContentData | UnprocessableData;
|
|
251
|
-
type Authenticate = SessionData | UnauthorizedData | UnprocessableData;
|
|
252
|
-
type Revoke = NoContentData | UnauthorizedData;
|
|
253
|
-
type SessionResponse = FetchResponse<SessionData>;
|
|
254
|
-
declare class AuthAPI {
|
|
255
|
-
clientId: string | undefined;
|
|
256
|
-
constructor(clientId?: string | undefined);
|
|
257
|
-
/**
|
|
258
|
-
* Response Statuses:
|
|
259
|
-
* - 200: OK -> Session is Valid
|
|
260
|
-
* - 401: Unauthorized -> Session is Invalid
|
|
261
|
-
*/
|
|
262
|
-
ping: (token: string) => Promise<FetchResponse<Ping>>;
|
|
263
|
-
/**
|
|
264
|
-
* Response Statuses:
|
|
265
|
-
* - 201: Created -> Profile Created, New Session Returned
|
|
266
|
-
* - 202: Accepted -> Profile Found, MFA Code Sent for `authenticate`
|
|
267
|
-
* - 422: Unprocessable Entity -> Invalid Payload
|
|
268
|
-
*/
|
|
269
|
-
identify: (payload: UsernamePayload) => Promise<FetchResponse<Identify>>;
|
|
270
|
-
/**
|
|
271
|
-
* Response Statuses:
|
|
272
|
-
* - 201: Created -> MFA Validated, New Session Returned
|
|
273
|
-
* - 401: Unauthorized -> MFA Invalid
|
|
274
|
-
* - 422: Unprocessable Entity -> Invalid Payload
|
|
275
|
-
*/
|
|
276
|
-
authenticate: (payload: PasscodePayload) => Promise<FetchResponse<Authenticate>>;
|
|
277
|
-
/**
|
|
278
|
-
* Response Statuses:
|
|
279
|
-
* - 204: No Content -> Session Revoked
|
|
280
|
-
* - 401: Unauthorized -> Session Not Found
|
|
281
|
-
*/
|
|
282
|
-
revoke: (token: string) => Promise<FetchResponse<Revoke>>;
|
|
283
|
-
private config;
|
|
284
|
-
private validateStatus;
|
|
285
|
-
private body;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
type InstitutionData = {
|
|
289
|
-
name: string;
|
|
290
|
-
logoUrl: string;
|
|
291
|
-
};
|
|
292
|
-
type InstitutionsData = Array<InstitutionData>;
|
|
293
|
-
type ResolvableData = {
|
|
294
|
-
resolvable: boolean;
|
|
295
|
-
};
|
|
296
|
-
type Search = InstitutionsData | ErrorData | UnauthorizedData;
|
|
297
|
-
type Resolvable = ResolvableData | ErrorData | UnauthorizedData;
|
|
298
|
-
type SearchResponse = FetchResponse<InstitutionsData>;
|
|
299
|
-
type ResolvableResponse = FetchResponse<ResolvableData>;
|
|
300
|
-
declare class ConnectorsAPI {
|
|
301
|
-
clientId: string;
|
|
302
|
-
userAgent: string;
|
|
303
|
-
constructor(clientId: string, userAgent?: string);
|
|
304
|
-
/**
|
|
305
|
-
* Response Statuses:
|
|
306
|
-
* - 200: OK -> Institutions Found
|
|
307
|
-
* - 401: Unauthorized -> Invalid Token
|
|
308
|
-
* - 403: Forbidden -> Unsupported SDK
|
|
309
|
-
* - 400: Bad Request -> Invalid Request
|
|
310
|
-
*/
|
|
311
|
-
searchInstitutions: (token: string, connectorId: string, term: string, signal?: AbortSignal) => Promise<FetchResponse<Search>>;
|
|
312
|
-
/**
|
|
313
|
-
* Response Statuses:
|
|
314
|
-
* - 200: OK -> Provider API ID is resolvable or not
|
|
315
|
-
* - 401: Unauthorized -> Invalid Token
|
|
316
|
-
* - 403: Forbidden -> Unsupported SDK
|
|
317
|
-
* - 400: Bad Request -> Missing provider API ID parameter
|
|
318
|
-
* - 404: Not Found -> Connector not found
|
|
319
|
-
*/
|
|
320
|
-
checkResolvable: (token: string, connectorId: string, providerId: {
|
|
321
|
-
plaid?: string;
|
|
322
|
-
mock?: string;
|
|
323
|
-
mx?: string;
|
|
324
|
-
finicity?: string;
|
|
325
|
-
akoya?: string;
|
|
326
|
-
}, signal?: AbortSignal) => Promise<FetchResponse<Resolvable>>;
|
|
327
|
-
private config;
|
|
328
|
-
private validateStatus;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
declare const debugging: boolean;
|
|
332
|
-
declare const version: string;
|
|
333
|
-
declare const cdnBase: string;
|
|
334
|
-
declare const endpointAuth: string;
|
|
335
|
-
declare const endpointGraphQL: string;
|
|
336
|
-
declare const endpointRest: string;
|
|
337
|
-
declare const endpointWebsockets: string;
|
|
338
|
-
|
|
339
|
-
/** Utility types to extend default TS utilities */
|
|
340
|
-
type Maybe<T> = T | null;
|
|
341
|
-
type InputMaybe<T> = Maybe<T>;
|
|
342
|
-
type Exact<T extends {
|
|
343
|
-
[key: string]: unknown;
|
|
344
|
-
}> = {
|
|
345
|
-
[K in keyof T]: T[K];
|
|
346
|
-
};
|
|
347
|
-
type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
348
|
-
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
349
|
-
};
|
|
350
|
-
type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
351
|
-
[SubKey in K]: Maybe<T[SubKey]>;
|
|
352
|
-
};
|
|
353
|
-
type Nullable<T> = {
|
|
354
|
-
[K in keyof T]: T[K] | null;
|
|
355
|
-
};
|
|
356
|
-
type Mutable<Type> = {
|
|
357
|
-
-readonly [Key in keyof Type]: Type[Key];
|
|
358
|
-
};
|
|
359
|
-
type DeepPartial<T> = T extends object ? {
|
|
360
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
361
|
-
} : T;
|
|
362
|
-
type DeepReadonly<T> = T extends object ? {
|
|
363
|
-
[P in keyof T]: DeepReadonly<T[P]>;
|
|
364
|
-
} : T;
|
|
365
|
-
|
|
366
|
-
type RegisteredClaims = {
|
|
367
|
-
iss: string;
|
|
368
|
-
sub: string;
|
|
369
|
-
aud: string;
|
|
370
|
-
exp: number;
|
|
371
|
-
nbf: number;
|
|
372
|
-
iat: number;
|
|
373
|
-
jti: string;
|
|
374
|
-
};
|
|
375
|
-
type PrivateClaims = {
|
|
376
|
-
oid: string;
|
|
377
|
-
eid: string;
|
|
378
|
-
cid: string;
|
|
379
|
-
aid: string;
|
|
380
|
-
ver: number;
|
|
381
|
-
rol: 'basic' | 'core' | 'manager' | 'super-admin';
|
|
382
|
-
};
|
|
383
|
-
type Claims<T> = RegisteredClaims & T;
|
|
384
|
-
type JsonWebToken<T> = {
|
|
385
|
-
token: string;
|
|
386
|
-
claims: Claims<T>;
|
|
387
|
-
};
|
|
388
|
-
type QuilttJWT = JsonWebToken<PrivateClaims>;
|
|
389
|
-
declare const JsonWebTokenParse: <T>(token: Maybe<string> | undefined) => Maybe<JsonWebToken<T>> | undefined;
|
|
390
|
-
|
|
391
|
-
type Observer<T> = Dispatch<SetStateAction<Maybe<T> | undefined>>;
|
|
392
|
-
/**
|
|
393
|
-
* This is designed to support singletons to share the memory states across all
|
|
394
|
-
* instance of hooks to ensure that updates only process once, by storing a value
|
|
395
|
-
* then notifying all subscribers when it's updated.
|
|
396
|
-
*/
|
|
397
|
-
declare class Observable<T> {
|
|
398
|
-
private state?;
|
|
399
|
-
private observers;
|
|
400
|
-
constructor(initialState?: Maybe<T>);
|
|
401
|
-
get: () => Maybe<T> | undefined;
|
|
402
|
-
set: (nextState: Maybe<T> | undefined) => void;
|
|
403
|
-
subscribe: (observer: Observer<T>) => void;
|
|
404
|
-
unsubscribe: (observer: Observer<T>) => void;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* An error and type safe wrapper for localStorage.
|
|
409
|
-
* It allows you to subscribe to changes;
|
|
410
|
-
* but localStorage changes only fire when another
|
|
411
|
-
* window updates the record.
|
|
412
|
-
*/
|
|
413
|
-
declare class LocalStorage<T = any> {
|
|
414
|
-
private observers;
|
|
415
|
-
private readonly keyPrefix;
|
|
416
|
-
constructor(keyPrefix?: string);
|
|
417
|
-
isEnabled: () => boolean;
|
|
418
|
-
isDisabled: () => boolean;
|
|
419
|
-
get: (key: string) => Maybe<T> | undefined;
|
|
420
|
-
set: (key: string, state: Maybe<T> | undefined) => void;
|
|
421
|
-
remove: (key: string) => void;
|
|
422
|
-
has: (key: string) => boolean;
|
|
423
|
-
clear: () => void;
|
|
424
|
-
subscribe: (key: string, observer: Observer<T>) => (() => void);
|
|
425
|
-
unsubscribe: (key: string, observer: Observer<T>) => void;
|
|
426
|
-
keys: () => string[];
|
|
427
|
-
private getFullKey;
|
|
428
|
-
/**
|
|
429
|
-
* Handle storage events from other windows/tabs
|
|
430
|
-
* If there is a key, then trigger the related updates. If there is no key
|
|
431
|
-
* it means that a record has been removed and everything needs to be rechecked.
|
|
432
|
-
*/
|
|
433
|
-
private handleStorageEvent;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* This is designed to support effectively an in memory key value store singleton,
|
|
438
|
-
* similar to localStorage, but allows you to subscribe to changes within the current
|
|
439
|
-
* window.
|
|
440
|
-
*/
|
|
441
|
-
declare class MemoryStorage<T> {
|
|
442
|
-
private observables;
|
|
443
|
-
get: (key: string) => Maybe<T> | undefined;
|
|
444
|
-
set: (key: string, state: Maybe<T> | undefined) => void;
|
|
445
|
-
subscribe: (key: string, observer: Observer<T>) => void;
|
|
446
|
-
unsubscribe: (key: string, observer: Observer<T>) => void;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* This is wraps both local and memory storage to create a unified interface, that
|
|
451
|
-
* allows you to subscribe to all either changes made within this window, or changes
|
|
452
|
-
* made by other windows.
|
|
453
|
-
*/
|
|
454
|
-
declare class Storage<T> {
|
|
455
|
-
private memoryStore;
|
|
456
|
-
private localStore;
|
|
457
|
-
private observers;
|
|
458
|
-
private monitors;
|
|
459
|
-
/**
|
|
460
|
-
* Checks memoryStorage before falling back to localStorage.
|
|
461
|
-
*/
|
|
462
|
-
get: (key: string) => Maybe<T> | undefined;
|
|
463
|
-
/**
|
|
464
|
-
* We don't trust localStorage to always be present, so we can't rely on it to
|
|
465
|
-
* update memoryStorage based on emitted changes. So we manage our own
|
|
466
|
-
* emitting while using the underlying events to keep memoryStore in sync with
|
|
467
|
-
* localStore.
|
|
468
|
-
*/
|
|
469
|
-
set: (key: string, newState: Maybe<T> | undefined) => void;
|
|
470
|
-
/**
|
|
471
|
-
* Allows you to subscribe to all changes in memory or local storage as a
|
|
472
|
-
* single event.
|
|
473
|
-
*/
|
|
474
|
-
subscribe: (key: string, observer: Observer<T>) => void;
|
|
475
|
-
unsubscribe: (key: string, observer: Observer<T>) => void;
|
|
476
|
-
/**
|
|
477
|
-
* Sets bubble the changes down the stack starting with memoryStore and then
|
|
478
|
-
* localStore. memoryStore will emit changes to everything within the current
|
|
479
|
-
* window context, while localStore will emit changes to every other window
|
|
480
|
-
* context.
|
|
481
|
-
*
|
|
482
|
-
* To ensure that the other windows are updated correctly, changes to localStore
|
|
483
|
-
* need to be subscribed and updated to in memory store, which then may be subscribed
|
|
484
|
-
* to outside of storage.
|
|
485
|
-
*/
|
|
486
|
-
private monitorLocalStorageChanges;
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* This is an singleton to share the memory states across all instances; This
|
|
490
|
-
* basically acts like shared memory when there is no localStorage.
|
|
491
|
-
*/
|
|
492
|
-
declare const GlobalStorage: Storage<any>;
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* This is designed to support singletons to timeouts that can broadcast
|
|
496
|
-
* to any observers, preventing race conditions with multiple timeouts.
|
|
497
|
-
*/
|
|
498
|
-
declare class Timeoutable {
|
|
499
|
-
private timeout?;
|
|
500
|
-
private observers;
|
|
501
|
-
set: (callback: () => void, delay: number | undefined) => void;
|
|
502
|
-
clear: (observer: Observer<void>) => void;
|
|
503
|
-
private broadcast;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Extracts version number from formatted version string
|
|
508
|
-
* @param formattedVersion - Formatted version like "@quiltt/core: v4.5.1"
|
|
509
|
-
* @returns Version number like "4.5.1" or "unknown" if not found
|
|
510
|
-
*/
|
|
511
|
-
declare const extractVersionNumber: (formattedVersion: string) => string;
|
|
512
|
-
/**
|
|
513
|
-
* Generates a User-Agent string following standard format
|
|
514
|
-
* Format: Quiltt/<version> (<platform-info>)
|
|
515
|
-
*/
|
|
516
|
-
declare const getUserAgent: (sdkVersion: string, platformInfo: string) => string;
|
|
517
|
-
/**
|
|
518
|
-
* Detects browser information from user agent string
|
|
519
|
-
* Returns browser name and version, or 'Unknown' if not detected
|
|
520
|
-
*/
|
|
521
|
-
declare const getBrowserInfo: () => string;
|
|
522
|
-
|
|
523
|
-
export { AuthAPI, AuthLink, AuthStrategies, BatchHttpLink, ConnectorSDKEventType, ConnectorsAPI, ErrorLink, ForwardableLink, GlobalStorage, HttpLink, JsonWebTokenParse, LocalStorage, MemoryStorage, Observable, QuilttClient, RetryLink, Storage, SubscriptionLink, TerminatingLink, Timeoutable, cdnBase, createVersionLink, debugging, endpointAuth, endpointGraphQL, endpointRest, endpointWebsockets, extractVersionNumber, getBrowserInfo, getUserAgent, version };
|
|
524
|
-
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 };
|
|
1
|
+
export * from './api/index.js';
|
|
2
|
+
export * from './auth/index.js';
|
|
3
|
+
export * from './config/index.js';
|
|
4
|
+
export * from './observables/index.js';
|
|
5
|
+
export * from './storage/index.js';
|
|
6
|
+
export * from './timing/index.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './utils/index.js';
|