@edge-markets/connect 1.2.0 → 1.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/README.md +11 -18
- package/dist/index.d.mts +437 -292
- package/dist/index.d.ts +437 -292
- package/dist/index.js +23 -33
- package/dist/index.mjs +21 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
EdgeAuthenticationError: () => EdgeAuthenticationError,
|
|
28
28
|
EdgeConsentRequiredError: () => EdgeConsentRequiredError,
|
|
29
29
|
EdgeError: () => EdgeError,
|
|
30
|
+
EdgeIdentityVerificationError: () => EdgeIdentityVerificationError,
|
|
30
31
|
EdgeInsufficientScopeError: () => EdgeInsufficientScopeError,
|
|
31
32
|
EdgeNetworkError: () => EdgeNetworkError,
|
|
32
33
|
EdgeNotFoundError: () => EdgeNotFoundError,
|
|
@@ -50,6 +51,7 @@ __export(index_exports, {
|
|
|
50
51
|
isAuthenticationError: () => isAuthenticationError,
|
|
51
52
|
isConsentRequiredError: () => isConsentRequiredError,
|
|
52
53
|
isEdgeError: () => isEdgeError,
|
|
54
|
+
isIdentityVerificationError: () => isIdentityVerificationError,
|
|
53
55
|
isNetworkError: () => isNetworkError,
|
|
54
56
|
isProductionEnvironment: () => isProductionEnvironment,
|
|
55
57
|
isValidScope: () => isValidScope,
|
|
@@ -65,7 +67,7 @@ var TRANSFER_STATUSES = [
|
|
|
65
67
|
"failed",
|
|
66
68
|
"expired"
|
|
67
69
|
];
|
|
68
|
-
var OTP_METHODS = ["sms", "totp"];
|
|
70
|
+
var OTP_METHODS = ["sms", "totp", "email"];
|
|
69
71
|
|
|
70
72
|
// src/config/environments.ts
|
|
71
73
|
var EDGE_ENVIRONMENTS = {
|
|
@@ -203,34 +205,19 @@ var EdgeError = class _EdgeError extends Error {
|
|
|
203
205
|
};
|
|
204
206
|
var EdgeAuthenticationError = class extends EdgeError {
|
|
205
207
|
constructor(message, details) {
|
|
206
|
-
super(
|
|
207
|
-
"authentication_failed",
|
|
208
|
-
message || "Authentication failed or access token is invalid/expired",
|
|
209
|
-
401,
|
|
210
|
-
details
|
|
211
|
-
);
|
|
208
|
+
super("authentication_failed", message || "Authentication failed or access token is invalid/expired", 401, details);
|
|
212
209
|
this.name = "EdgeAuthenticationError";
|
|
213
210
|
}
|
|
214
211
|
};
|
|
215
212
|
var EdgeTokenExchangeError = class extends EdgeError {
|
|
216
213
|
constructor(message, details) {
|
|
217
|
-
super(
|
|
218
|
-
"token_exchange_failed",
|
|
219
|
-
message || "Failed to exchange authorization code for tokens",
|
|
220
|
-
400,
|
|
221
|
-
details
|
|
222
|
-
);
|
|
214
|
+
super("token_exchange_failed", message || "Failed to exchange authorization code for tokens", 400, details);
|
|
223
215
|
this.name = "EdgeTokenExchangeError";
|
|
224
216
|
}
|
|
225
217
|
};
|
|
226
218
|
var EdgeConsentRequiredError = class extends EdgeError {
|
|
227
219
|
constructor(clientId, consentUrl, message) {
|
|
228
|
-
super(
|
|
229
|
-
"consent_required",
|
|
230
|
-
message || "User has not granted consent to this application",
|
|
231
|
-
403,
|
|
232
|
-
{ clientId, consentUrl }
|
|
233
|
-
);
|
|
220
|
+
super("consent_required", message || "User has not granted consent to this application", 403, { clientId, consentUrl });
|
|
234
221
|
this.name = "EdgeConsentRequiredError";
|
|
235
222
|
this.clientId = clientId;
|
|
236
223
|
this.consentUrl = consentUrl;
|
|
@@ -238,12 +225,7 @@ var EdgeConsentRequiredError = class extends EdgeError {
|
|
|
238
225
|
};
|
|
239
226
|
var EdgeInsufficientScopeError = class extends EdgeError {
|
|
240
227
|
constructor(missingScopes, message) {
|
|
241
|
-
super(
|
|
242
|
-
"insufficient_scope",
|
|
243
|
-
message || `Missing required scopes: ${missingScopes.join(", ")}`,
|
|
244
|
-
403,
|
|
245
|
-
{ missingScopes }
|
|
246
|
-
);
|
|
228
|
+
super("insufficient_scope", message || `Missing required scopes: ${missingScopes.join(", ")}`, 403, { missingScopes });
|
|
247
229
|
this.name = "EdgeInsufficientScopeError";
|
|
248
230
|
this.missingScopes = missingScopes;
|
|
249
231
|
}
|
|
@@ -269,12 +251,18 @@ var EdgeValidationError = class extends EdgeError {
|
|
|
269
251
|
this.validationErrors = validationErrors;
|
|
270
252
|
}
|
|
271
253
|
};
|
|
254
|
+
var EdgeIdentityVerificationError = class extends EdgeError {
|
|
255
|
+
constructor(fieldErrors, message) {
|
|
256
|
+
super("identity_verification_failed", message || "Identity verification failed. Please contact support.", 422, {
|
|
257
|
+
fieldErrors
|
|
258
|
+
});
|
|
259
|
+
this.name = "EdgeIdentityVerificationError";
|
|
260
|
+
this.fieldErrors = fieldErrors;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
272
263
|
var EdgePopupBlockedError = class extends EdgeError {
|
|
273
264
|
constructor() {
|
|
274
|
-
super(
|
|
275
|
-
"popup_blocked",
|
|
276
|
-
"Popup was blocked by the browser. Please allow popups for this site and try again."
|
|
277
|
-
);
|
|
265
|
+
super("popup_blocked", "Popup was blocked by the browser. Please allow popups for this site and try again.");
|
|
278
266
|
this.name = "EdgePopupBlockedError";
|
|
279
267
|
}
|
|
280
268
|
toUserMessage() {
|
|
@@ -289,10 +277,7 @@ var EdgePopupClosedError = class extends EdgeError {
|
|
|
289
277
|
};
|
|
290
278
|
var EdgeStateMismatchError = class extends EdgeError {
|
|
291
279
|
constructor() {
|
|
292
|
-
super(
|
|
293
|
-
"state_mismatch",
|
|
294
|
-
"Security error: state parameter mismatch. Please try again."
|
|
295
|
-
);
|
|
280
|
+
super("state_mismatch", "Security error: state parameter mismatch. Please try again.");
|
|
296
281
|
this.name = "EdgeStateMismatchError";
|
|
297
282
|
}
|
|
298
283
|
};
|
|
@@ -317,6 +302,9 @@ function isConsentRequiredError(error) {
|
|
|
317
302
|
function isApiError(error) {
|
|
318
303
|
return error instanceof EdgeApiError;
|
|
319
304
|
}
|
|
305
|
+
function isIdentityVerificationError(error) {
|
|
306
|
+
return error instanceof EdgeIdentityVerificationError;
|
|
307
|
+
}
|
|
320
308
|
function isNetworkError(error) {
|
|
321
309
|
return error instanceof EdgeNetworkError;
|
|
322
310
|
}
|
|
@@ -333,6 +321,7 @@ var SDK_NAME = "@edge-markets/connect";
|
|
|
333
321
|
EdgeAuthenticationError,
|
|
334
322
|
EdgeConsentRequiredError,
|
|
335
323
|
EdgeError,
|
|
324
|
+
EdgeIdentityVerificationError,
|
|
336
325
|
EdgeInsufficientScopeError,
|
|
337
326
|
EdgeNetworkError,
|
|
338
327
|
EdgeNotFoundError,
|
|
@@ -356,6 +345,7 @@ var SDK_NAME = "@edge-markets/connect";
|
|
|
356
345
|
isAuthenticationError,
|
|
357
346
|
isConsentRequiredError,
|
|
358
347
|
isEdgeError,
|
|
348
|
+
isIdentityVerificationError,
|
|
359
349
|
isNetworkError,
|
|
360
350
|
isProductionEnvironment,
|
|
361
351
|
isValidScope,
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var TRANSFER_STATUSES = [
|
|
|
6
6
|
"failed",
|
|
7
7
|
"expired"
|
|
8
8
|
];
|
|
9
|
-
var OTP_METHODS = ["sms", "totp"];
|
|
9
|
+
var OTP_METHODS = ["sms", "totp", "email"];
|
|
10
10
|
|
|
11
11
|
// src/config/environments.ts
|
|
12
12
|
var EDGE_ENVIRONMENTS = {
|
|
@@ -144,34 +144,19 @@ var EdgeError = class _EdgeError extends Error {
|
|
|
144
144
|
};
|
|
145
145
|
var EdgeAuthenticationError = class extends EdgeError {
|
|
146
146
|
constructor(message, details) {
|
|
147
|
-
super(
|
|
148
|
-
"authentication_failed",
|
|
149
|
-
message || "Authentication failed or access token is invalid/expired",
|
|
150
|
-
401,
|
|
151
|
-
details
|
|
152
|
-
);
|
|
147
|
+
super("authentication_failed", message || "Authentication failed or access token is invalid/expired", 401, details);
|
|
153
148
|
this.name = "EdgeAuthenticationError";
|
|
154
149
|
}
|
|
155
150
|
};
|
|
156
151
|
var EdgeTokenExchangeError = class extends EdgeError {
|
|
157
152
|
constructor(message, details) {
|
|
158
|
-
super(
|
|
159
|
-
"token_exchange_failed",
|
|
160
|
-
message || "Failed to exchange authorization code for tokens",
|
|
161
|
-
400,
|
|
162
|
-
details
|
|
163
|
-
);
|
|
153
|
+
super("token_exchange_failed", message || "Failed to exchange authorization code for tokens", 400, details);
|
|
164
154
|
this.name = "EdgeTokenExchangeError";
|
|
165
155
|
}
|
|
166
156
|
};
|
|
167
157
|
var EdgeConsentRequiredError = class extends EdgeError {
|
|
168
158
|
constructor(clientId, consentUrl, message) {
|
|
169
|
-
super(
|
|
170
|
-
"consent_required",
|
|
171
|
-
message || "User has not granted consent to this application",
|
|
172
|
-
403,
|
|
173
|
-
{ clientId, consentUrl }
|
|
174
|
-
);
|
|
159
|
+
super("consent_required", message || "User has not granted consent to this application", 403, { clientId, consentUrl });
|
|
175
160
|
this.name = "EdgeConsentRequiredError";
|
|
176
161
|
this.clientId = clientId;
|
|
177
162
|
this.consentUrl = consentUrl;
|
|
@@ -179,12 +164,7 @@ var EdgeConsentRequiredError = class extends EdgeError {
|
|
|
179
164
|
};
|
|
180
165
|
var EdgeInsufficientScopeError = class extends EdgeError {
|
|
181
166
|
constructor(missingScopes, message) {
|
|
182
|
-
super(
|
|
183
|
-
"insufficient_scope",
|
|
184
|
-
message || `Missing required scopes: ${missingScopes.join(", ")}`,
|
|
185
|
-
403,
|
|
186
|
-
{ missingScopes }
|
|
187
|
-
);
|
|
167
|
+
super("insufficient_scope", message || `Missing required scopes: ${missingScopes.join(", ")}`, 403, { missingScopes });
|
|
188
168
|
this.name = "EdgeInsufficientScopeError";
|
|
189
169
|
this.missingScopes = missingScopes;
|
|
190
170
|
}
|
|
@@ -210,12 +190,18 @@ var EdgeValidationError = class extends EdgeError {
|
|
|
210
190
|
this.validationErrors = validationErrors;
|
|
211
191
|
}
|
|
212
192
|
};
|
|
193
|
+
var EdgeIdentityVerificationError = class extends EdgeError {
|
|
194
|
+
constructor(fieldErrors, message) {
|
|
195
|
+
super("identity_verification_failed", message || "Identity verification failed. Please contact support.", 422, {
|
|
196
|
+
fieldErrors
|
|
197
|
+
});
|
|
198
|
+
this.name = "EdgeIdentityVerificationError";
|
|
199
|
+
this.fieldErrors = fieldErrors;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
213
202
|
var EdgePopupBlockedError = class extends EdgeError {
|
|
214
203
|
constructor() {
|
|
215
|
-
super(
|
|
216
|
-
"popup_blocked",
|
|
217
|
-
"Popup was blocked by the browser. Please allow popups for this site and try again."
|
|
218
|
-
);
|
|
204
|
+
super("popup_blocked", "Popup was blocked by the browser. Please allow popups for this site and try again.");
|
|
219
205
|
this.name = "EdgePopupBlockedError";
|
|
220
206
|
}
|
|
221
207
|
toUserMessage() {
|
|
@@ -230,10 +216,7 @@ var EdgePopupClosedError = class extends EdgeError {
|
|
|
230
216
|
};
|
|
231
217
|
var EdgeStateMismatchError = class extends EdgeError {
|
|
232
218
|
constructor() {
|
|
233
|
-
super(
|
|
234
|
-
"state_mismatch",
|
|
235
|
-
"Security error: state parameter mismatch. Please try again."
|
|
236
|
-
);
|
|
219
|
+
super("state_mismatch", "Security error: state parameter mismatch. Please try again.");
|
|
237
220
|
this.name = "EdgeStateMismatchError";
|
|
238
221
|
}
|
|
239
222
|
};
|
|
@@ -258,6 +241,9 @@ function isConsentRequiredError(error) {
|
|
|
258
241
|
function isApiError(error) {
|
|
259
242
|
return error instanceof EdgeApiError;
|
|
260
243
|
}
|
|
244
|
+
function isIdentityVerificationError(error) {
|
|
245
|
+
return error instanceof EdgeIdentityVerificationError;
|
|
246
|
+
}
|
|
261
247
|
function isNetworkError(error) {
|
|
262
248
|
return error instanceof EdgeNetworkError;
|
|
263
249
|
}
|
|
@@ -273,6 +259,7 @@ export {
|
|
|
273
259
|
EdgeAuthenticationError,
|
|
274
260
|
EdgeConsentRequiredError,
|
|
275
261
|
EdgeError,
|
|
262
|
+
EdgeIdentityVerificationError,
|
|
276
263
|
EdgeInsufficientScopeError,
|
|
277
264
|
EdgeNetworkError,
|
|
278
265
|
EdgeNotFoundError,
|
|
@@ -296,6 +283,7 @@ export {
|
|
|
296
283
|
isAuthenticationError,
|
|
297
284
|
isConsentRequiredError,
|
|
298
285
|
isEdgeError,
|
|
286
|
+
isIdentityVerificationError,
|
|
299
287
|
isNetworkError,
|
|
300
288
|
isProductionEnvironment,
|
|
301
289
|
isValidScope,
|