@dynamic-labs-wallet/browser 0.0.326 → 0.0.327
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/{index.cjs.js → index.cjs} +106 -12
- package/index.esm.js +106 -12
- package/package.json +4 -4
- package/src/backup/providers/googleDrive.d.ts +25 -0
- package/src/backup/providers/googleDrive.d.ts.map +1 -1
- package/src/backup/utils.d.ts.map +1 -1
- package/src/utils.d.ts.map +1 -1
- /package/{index.cjs.d.ts → index.d.ts} +0 -0
|
@@ -352,6 +352,75 @@ class InvalidPasswordError extends Error {
|
|
|
352
352
|
};
|
|
353
353
|
|
|
354
354
|
const GOOGLE_DRIVE_UPLOAD_API = 'https://www.googleapis.com';
|
|
355
|
+
const NON_RETRYABLE_AUTH_REASONS = new Set([
|
|
356
|
+
'insufficientPermissions',
|
|
357
|
+
'unauthorized',
|
|
358
|
+
'authError'
|
|
359
|
+
]);
|
|
360
|
+
const NON_RETRYABLE_AUTH_DETAIL_REASONS = new Set([
|
|
361
|
+
'ACCESS_TOKEN_SCOPE_INSUFFICIENT',
|
|
362
|
+
'ACCESS_TOKEN_EXPIRED',
|
|
363
|
+
'CREDENTIALS_MISSING'
|
|
364
|
+
]);
|
|
365
|
+
const RATE_LIMIT_REASONS = new Set([
|
|
366
|
+
'rateLimitExceeded',
|
|
367
|
+
'userRateLimitExceeded',
|
|
368
|
+
'dailyLimitExceeded'
|
|
369
|
+
]);
|
|
370
|
+
const NETWORK_ERROR = {
|
|
371
|
+
message: 'Could not reach Google Drive. Please check your internet connection and try again.',
|
|
372
|
+
isRetryable: true
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* Maps a Google Drive API error to an actionable user-facing message and a retry hint.
|
|
376
|
+
* The retry hint is consumed by retryPromise to short-circuit on non-transient failures.
|
|
377
|
+
*/ const mapGoogleDriveUploadError = (httpStatus, body)=>{
|
|
378
|
+
var _error_errors_, _error_errors, _error_details_, _error_details;
|
|
379
|
+
const error = body == null ? void 0 : body.error;
|
|
380
|
+
const reason = error == null ? void 0 : (_error_errors = error.errors) == null ? void 0 : (_error_errors_ = _error_errors[0]) == null ? void 0 : _error_errors_.reason;
|
|
381
|
+
const detailReason = error == null ? void 0 : (_error_details = error.details) == null ? void 0 : (_error_details_ = _error_details[0]) == null ? void 0 : _error_details_.reason;
|
|
382
|
+
if (httpStatus === 401 || reason && NON_RETRYABLE_AUTH_REASONS.has(reason) || detailReason && NON_RETRYABLE_AUTH_DETAIL_REASONS.has(detailReason)) {
|
|
383
|
+
return {
|
|
384
|
+
message: 'Google Drive access denied: missing or insufficient permissions. Make sure the app is requesting Drive permission and that you allowed it during sign-in, then try again.',
|
|
385
|
+
isRetryable: false
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
if (reason === 'storageQuotaExceeded') {
|
|
389
|
+
return {
|
|
390
|
+
message: 'Google Drive storage is full. Free up space in your Google Drive and try again.',
|
|
391
|
+
isRetryable: false
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
if (httpStatus === 429 || reason && RATE_LIMIT_REASONS.has(reason)) {
|
|
395
|
+
return {
|
|
396
|
+
message: 'Google Drive is temporarily rate-limited. Please try again in a few moments.',
|
|
397
|
+
isRetryable: true
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
if (httpStatus >= 500 && httpStatus < 600) {
|
|
401
|
+
return {
|
|
402
|
+
message: 'Google Drive is temporarily unavailable. Please try again shortly.',
|
|
403
|
+
isRetryable: true
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
const detail = reason != null ? reason : error == null ? void 0 : error.status;
|
|
407
|
+
return {
|
|
408
|
+
message: detail ? `Google Drive upload failed (HTTP ${httpStatus}: ${detail}).` : `Google Drive upload failed (HTTP ${httpStatus}).`,
|
|
409
|
+
isRetryable: false
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
const parseGoogleDriveErrorBody = async (response)=>{
|
|
413
|
+
try {
|
|
414
|
+
return await response.json();
|
|
415
|
+
} catch (e) {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
const createGoogleDriveError = (mapped)=>{
|
|
420
|
+
const error = new Error(mapped.message);
|
|
421
|
+
error.isRetryable = mapped.isRetryable;
|
|
422
|
+
return error;
|
|
423
|
+
};
|
|
355
424
|
const uploadFileToGoogleDriveAppStorage = async ({ accessToken, fileName, jsonData })=>{
|
|
356
425
|
return uploadFileToGoogleDrive({
|
|
357
426
|
accessToken,
|
|
@@ -416,9 +485,12 @@ const uploadFileToGoogleDrive = async ({ accessToken, fileName, jsonData, parent
|
|
|
416
485
|
Authorization: `Bearer ${accessToken}`
|
|
417
486
|
},
|
|
418
487
|
body: form
|
|
488
|
+
}).catch(()=>{
|
|
489
|
+
throw createGoogleDriveError(NETWORK_ERROR);
|
|
419
490
|
});
|
|
420
491
|
if (!response.ok) {
|
|
421
|
-
|
|
492
|
+
const body = await parseGoogleDriveErrorBody(response);
|
|
493
|
+
throw createGoogleDriveError(mapGoogleDriveUploadError(response.status, body));
|
|
422
494
|
}
|
|
423
495
|
const result = await response.json();
|
|
424
496
|
const fileId = result.id;
|
|
@@ -600,11 +672,11 @@ const logRetrySuccess = (operationName, attempts, logContext)=>{
|
|
|
600
672
|
attemptsTaken: attempts + 1
|
|
601
673
|
}));
|
|
602
674
|
};
|
|
603
|
-
const logRetryFailure = (operationName, attempts, maxAttempts, errorContext, logContext)=>{
|
|
675
|
+
const logRetryFailure = (operationName, attempts, maxAttempts, errorContext, logContext, isNonRetryable = false)=>{
|
|
604
676
|
core.Logger.warn(`Failed to execute ${operationName} on attempt ${attempts}/${maxAttempts}`, _extends({}, logContext, errorContext, {
|
|
605
677
|
attempt: attempts,
|
|
606
678
|
maxAttempts,
|
|
607
|
-
willRetry: attempts < maxAttempts
|
|
679
|
+
willRetry: !isNonRetryable && attempts < maxAttempts
|
|
608
680
|
}));
|
|
609
681
|
};
|
|
610
682
|
const logRetryExhausted = (operationName, maxAttempts, errorContext, logContext)=>{
|
|
@@ -631,7 +703,12 @@ const logRetryExhausted = (operationName, maxAttempts, errorContext, logContext)
|
|
|
631
703
|
} catch (error) {
|
|
632
704
|
attempts++;
|
|
633
705
|
const errorContext = buildErrorContext(error);
|
|
634
|
-
|
|
706
|
+
const isNonRetryable = (error == null ? void 0 : error.isRetryable) === false;
|
|
707
|
+
logRetryFailure(operationName, attempts, maxAttempts, errorContext, logContext, isNonRetryable);
|
|
708
|
+
if (isNonRetryable) {
|
|
709
|
+
core.Logger.debug(`Skipping retry for ${operationName}: error marked non-retryable`, _extends({}, logContext, errorContext));
|
|
710
|
+
throw error;
|
|
711
|
+
}
|
|
635
712
|
if (attempts === maxAttempts) {
|
|
636
713
|
logRetryExhausted(operationName, maxAttempts, errorContext, logContext);
|
|
637
714
|
throw error;
|
|
@@ -1153,18 +1230,24 @@ const initializeCloudKit = async (config, signInButtonId, onSignInRequired, onSi
|
|
|
1153
1230
|
};
|
|
1154
1231
|
/**
|
|
1155
1232
|
* Processes a single upload result and logs appropriately
|
|
1156
|
-
* @returns
|
|
1233
|
+
* @returns Failure details if rejected, undefined if successful
|
|
1157
1234
|
*/ const processUploadResult = (result, locationName, logContext, logger)=>{
|
|
1235
|
+
var _result_reason;
|
|
1158
1236
|
if (result.status === 'fulfilled') {
|
|
1159
1237
|
logger.info(`[DynamicWaasWalletClient] Successfully uploaded keyshares to ${locationName}`, logContext);
|
|
1160
1238
|
return undefined;
|
|
1161
1239
|
}
|
|
1162
1240
|
const { message, stack } = getErrorDetails(result.reason);
|
|
1241
|
+
const isRetryable = ((_result_reason = result.reason) == null ? void 0 : _result_reason.isRetryable) !== false;
|
|
1163
1242
|
logger.error(`[DynamicWaasWalletClient] Failed to upload keyshares to ${locationName}`, _extends({}, logContext, {
|
|
1164
1243
|
error: message,
|
|
1165
1244
|
errorStack: stack
|
|
1166
1245
|
}));
|
|
1167
|
-
return
|
|
1246
|
+
return {
|
|
1247
|
+
locationName,
|
|
1248
|
+
message,
|
|
1249
|
+
isRetryable
|
|
1250
|
+
};
|
|
1168
1251
|
};
|
|
1169
1252
|
/**
|
|
1170
1253
|
* Uploads a backup to Google Drive App
|
|
@@ -1204,16 +1287,27 @@ const initializeCloudKit = async (config, signInButtonId, onSignInRequired, onSi
|
|
|
1204
1287
|
})
|
|
1205
1288
|
];
|
|
1206
1289
|
const results = await Promise.allSettled(uploadPromises);
|
|
1207
|
-
const
|
|
1290
|
+
const failures = [
|
|
1208
1291
|
processUploadResult(results[0], 'Google Drive App Storage', logContext, logger),
|
|
1209
1292
|
processUploadResult(results[1], 'Google Drive Personal', logContext, logger)
|
|
1210
|
-
].filter((
|
|
1211
|
-
if (
|
|
1293
|
+
].filter((failure)=>failure !== undefined);
|
|
1294
|
+
if (failures.length > 0) {
|
|
1212
1295
|
logger.error('[DynamicWaasWalletClient] Google Drive backup failed', _extends({}, logContext, {
|
|
1213
|
-
errorCount:
|
|
1214
|
-
errors
|
|
1296
|
+
errorCount: failures.length,
|
|
1297
|
+
errors: failures.map((f)=>`Failed to backup keyshares to ${f.locationName}: ${f.message}`)
|
|
1215
1298
|
}));
|
|
1216
|
-
|
|
1299
|
+
// Both upload destinations (appDataFolder + personal) commonly fail with
|
|
1300
|
+
// the same underlying error (e.g., missing OAuth scope). When all failures
|
|
1301
|
+
// share one message, surface it once without per-location wrapping;
|
|
1302
|
+
// otherwise keep a short "Location: message" prefix per failure so the
|
|
1303
|
+
// user can see what differed.
|
|
1304
|
+
const uniqueMessages = [
|
|
1305
|
+
...new Set(failures.map((f)=>f.message))
|
|
1306
|
+
];
|
|
1307
|
+
const finalMessage = uniqueMessages.length === 1 ? uniqueMessages[0] : failures.map((f)=>`${f.locationName}: ${f.message}`).join(' | ');
|
|
1308
|
+
const aggregatedError = new Error(finalMessage);
|
|
1309
|
+
aggregatedError.isRetryable = failures.every((f)=>f.isRetryable);
|
|
1310
|
+
throw aggregatedError;
|
|
1217
1311
|
}
|
|
1218
1312
|
logger.info('[DynamicWaasWalletClient] Google Drive backup completed successfully', logContext);
|
|
1219
1313
|
};
|
package/index.esm.js
CHANGED
|
@@ -353,6 +353,75 @@ class InvalidPasswordError extends Error {
|
|
|
353
353
|
};
|
|
354
354
|
|
|
355
355
|
const GOOGLE_DRIVE_UPLOAD_API = 'https://www.googleapis.com';
|
|
356
|
+
const NON_RETRYABLE_AUTH_REASONS = new Set([
|
|
357
|
+
'insufficientPermissions',
|
|
358
|
+
'unauthorized',
|
|
359
|
+
'authError'
|
|
360
|
+
]);
|
|
361
|
+
const NON_RETRYABLE_AUTH_DETAIL_REASONS = new Set([
|
|
362
|
+
'ACCESS_TOKEN_SCOPE_INSUFFICIENT',
|
|
363
|
+
'ACCESS_TOKEN_EXPIRED',
|
|
364
|
+
'CREDENTIALS_MISSING'
|
|
365
|
+
]);
|
|
366
|
+
const RATE_LIMIT_REASONS = new Set([
|
|
367
|
+
'rateLimitExceeded',
|
|
368
|
+
'userRateLimitExceeded',
|
|
369
|
+
'dailyLimitExceeded'
|
|
370
|
+
]);
|
|
371
|
+
const NETWORK_ERROR = {
|
|
372
|
+
message: 'Could not reach Google Drive. Please check your internet connection and try again.',
|
|
373
|
+
isRetryable: true
|
|
374
|
+
};
|
|
375
|
+
/**
|
|
376
|
+
* Maps a Google Drive API error to an actionable user-facing message and a retry hint.
|
|
377
|
+
* The retry hint is consumed by retryPromise to short-circuit on non-transient failures.
|
|
378
|
+
*/ const mapGoogleDriveUploadError = (httpStatus, body)=>{
|
|
379
|
+
var _error_errors_, _error_errors, _error_details_, _error_details;
|
|
380
|
+
const error = body == null ? void 0 : body.error;
|
|
381
|
+
const reason = error == null ? void 0 : (_error_errors = error.errors) == null ? void 0 : (_error_errors_ = _error_errors[0]) == null ? void 0 : _error_errors_.reason;
|
|
382
|
+
const detailReason = error == null ? void 0 : (_error_details = error.details) == null ? void 0 : (_error_details_ = _error_details[0]) == null ? void 0 : _error_details_.reason;
|
|
383
|
+
if (httpStatus === 401 || reason && NON_RETRYABLE_AUTH_REASONS.has(reason) || detailReason && NON_RETRYABLE_AUTH_DETAIL_REASONS.has(detailReason)) {
|
|
384
|
+
return {
|
|
385
|
+
message: 'Google Drive access denied: missing or insufficient permissions. Make sure the app is requesting Drive permission and that you allowed it during sign-in, then try again.',
|
|
386
|
+
isRetryable: false
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
if (reason === 'storageQuotaExceeded') {
|
|
390
|
+
return {
|
|
391
|
+
message: 'Google Drive storage is full. Free up space in your Google Drive and try again.',
|
|
392
|
+
isRetryable: false
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
if (httpStatus === 429 || reason && RATE_LIMIT_REASONS.has(reason)) {
|
|
396
|
+
return {
|
|
397
|
+
message: 'Google Drive is temporarily rate-limited. Please try again in a few moments.',
|
|
398
|
+
isRetryable: true
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
if (httpStatus >= 500 && httpStatus < 600) {
|
|
402
|
+
return {
|
|
403
|
+
message: 'Google Drive is temporarily unavailable. Please try again shortly.',
|
|
404
|
+
isRetryable: true
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
const detail = reason != null ? reason : error == null ? void 0 : error.status;
|
|
408
|
+
return {
|
|
409
|
+
message: detail ? `Google Drive upload failed (HTTP ${httpStatus}: ${detail}).` : `Google Drive upload failed (HTTP ${httpStatus}).`,
|
|
410
|
+
isRetryable: false
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
const parseGoogleDriveErrorBody = async (response)=>{
|
|
414
|
+
try {
|
|
415
|
+
return await response.json();
|
|
416
|
+
} catch (e) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
const createGoogleDriveError = (mapped)=>{
|
|
421
|
+
const error = new Error(mapped.message);
|
|
422
|
+
error.isRetryable = mapped.isRetryable;
|
|
423
|
+
return error;
|
|
424
|
+
};
|
|
356
425
|
const uploadFileToGoogleDriveAppStorage = async ({ accessToken, fileName, jsonData })=>{
|
|
357
426
|
return uploadFileToGoogleDrive({
|
|
358
427
|
accessToken,
|
|
@@ -417,9 +486,12 @@ const uploadFileToGoogleDrive = async ({ accessToken, fileName, jsonData, parent
|
|
|
417
486
|
Authorization: `Bearer ${accessToken}`
|
|
418
487
|
},
|
|
419
488
|
body: form
|
|
489
|
+
}).catch(()=>{
|
|
490
|
+
throw createGoogleDriveError(NETWORK_ERROR);
|
|
420
491
|
});
|
|
421
492
|
if (!response.ok) {
|
|
422
|
-
|
|
493
|
+
const body = await parseGoogleDriveErrorBody(response);
|
|
494
|
+
throw createGoogleDriveError(mapGoogleDriveUploadError(response.status, body));
|
|
423
495
|
}
|
|
424
496
|
const result = await response.json();
|
|
425
497
|
const fileId = result.id;
|
|
@@ -601,11 +673,11 @@ const logRetrySuccess = (operationName, attempts, logContext)=>{
|
|
|
601
673
|
attemptsTaken: attempts + 1
|
|
602
674
|
}));
|
|
603
675
|
};
|
|
604
|
-
const logRetryFailure = (operationName, attempts, maxAttempts, errorContext, logContext)=>{
|
|
676
|
+
const logRetryFailure = (operationName, attempts, maxAttempts, errorContext, logContext, isNonRetryable = false)=>{
|
|
605
677
|
Logger.warn(`Failed to execute ${operationName} on attempt ${attempts}/${maxAttempts}`, _extends({}, logContext, errorContext, {
|
|
606
678
|
attempt: attempts,
|
|
607
679
|
maxAttempts,
|
|
608
|
-
willRetry: attempts < maxAttempts
|
|
680
|
+
willRetry: !isNonRetryable && attempts < maxAttempts
|
|
609
681
|
}));
|
|
610
682
|
};
|
|
611
683
|
const logRetryExhausted = (operationName, maxAttempts, errorContext, logContext)=>{
|
|
@@ -632,7 +704,12 @@ const logRetryExhausted = (operationName, maxAttempts, errorContext, logContext)
|
|
|
632
704
|
} catch (error) {
|
|
633
705
|
attempts++;
|
|
634
706
|
const errorContext = buildErrorContext(error);
|
|
635
|
-
|
|
707
|
+
const isNonRetryable = (error == null ? void 0 : error.isRetryable) === false;
|
|
708
|
+
logRetryFailure(operationName, attempts, maxAttempts, errorContext, logContext, isNonRetryable);
|
|
709
|
+
if (isNonRetryable) {
|
|
710
|
+
Logger.debug(`Skipping retry for ${operationName}: error marked non-retryable`, _extends({}, logContext, errorContext));
|
|
711
|
+
throw error;
|
|
712
|
+
}
|
|
636
713
|
if (attempts === maxAttempts) {
|
|
637
714
|
logRetryExhausted(operationName, maxAttempts, errorContext, logContext);
|
|
638
715
|
throw error;
|
|
@@ -1154,18 +1231,24 @@ const initializeCloudKit = async (config, signInButtonId, onSignInRequired, onSi
|
|
|
1154
1231
|
};
|
|
1155
1232
|
/**
|
|
1156
1233
|
* Processes a single upload result and logs appropriately
|
|
1157
|
-
* @returns
|
|
1234
|
+
* @returns Failure details if rejected, undefined if successful
|
|
1158
1235
|
*/ const processUploadResult = (result, locationName, logContext, logger)=>{
|
|
1236
|
+
var _result_reason;
|
|
1159
1237
|
if (result.status === 'fulfilled') {
|
|
1160
1238
|
logger.info(`[DynamicWaasWalletClient] Successfully uploaded keyshares to ${locationName}`, logContext);
|
|
1161
1239
|
return undefined;
|
|
1162
1240
|
}
|
|
1163
1241
|
const { message, stack } = getErrorDetails(result.reason);
|
|
1242
|
+
const isRetryable = ((_result_reason = result.reason) == null ? void 0 : _result_reason.isRetryable) !== false;
|
|
1164
1243
|
logger.error(`[DynamicWaasWalletClient] Failed to upload keyshares to ${locationName}`, _extends({}, logContext, {
|
|
1165
1244
|
error: message,
|
|
1166
1245
|
errorStack: stack
|
|
1167
1246
|
}));
|
|
1168
|
-
return
|
|
1247
|
+
return {
|
|
1248
|
+
locationName,
|
|
1249
|
+
message,
|
|
1250
|
+
isRetryable
|
|
1251
|
+
};
|
|
1169
1252
|
};
|
|
1170
1253
|
/**
|
|
1171
1254
|
* Uploads a backup to Google Drive App
|
|
@@ -1205,16 +1288,27 @@ const initializeCloudKit = async (config, signInButtonId, onSignInRequired, onSi
|
|
|
1205
1288
|
})
|
|
1206
1289
|
];
|
|
1207
1290
|
const results = await Promise.allSettled(uploadPromises);
|
|
1208
|
-
const
|
|
1291
|
+
const failures = [
|
|
1209
1292
|
processUploadResult(results[0], 'Google Drive App Storage', logContext, logger),
|
|
1210
1293
|
processUploadResult(results[1], 'Google Drive Personal', logContext, logger)
|
|
1211
|
-
].filter((
|
|
1212
|
-
if (
|
|
1294
|
+
].filter((failure)=>failure !== undefined);
|
|
1295
|
+
if (failures.length > 0) {
|
|
1213
1296
|
logger.error('[DynamicWaasWalletClient] Google Drive backup failed', _extends({}, logContext, {
|
|
1214
|
-
errorCount:
|
|
1215
|
-
errors
|
|
1297
|
+
errorCount: failures.length,
|
|
1298
|
+
errors: failures.map((f)=>`Failed to backup keyshares to ${f.locationName}: ${f.message}`)
|
|
1216
1299
|
}));
|
|
1217
|
-
|
|
1300
|
+
// Both upload destinations (appDataFolder + personal) commonly fail with
|
|
1301
|
+
// the same underlying error (e.g., missing OAuth scope). When all failures
|
|
1302
|
+
// share one message, surface it once without per-location wrapping;
|
|
1303
|
+
// otherwise keep a short "Location: message" prefix per failure so the
|
|
1304
|
+
// user can see what differed.
|
|
1305
|
+
const uniqueMessages = [
|
|
1306
|
+
...new Set(failures.map((f)=>f.message))
|
|
1307
|
+
];
|
|
1308
|
+
const finalMessage = uniqueMessages.length === 1 ? uniqueMessages[0] : failures.map((f)=>`${f.locationName}: ${f.message}`).join(' | ');
|
|
1309
|
+
const aggregatedError = new Error(finalMessage);
|
|
1310
|
+
aggregatedError.isRetryable = failures.every((f)=>f.isRetryable);
|
|
1311
|
+
throw aggregatedError;
|
|
1218
1312
|
}
|
|
1219
1313
|
logger.info('[DynamicWaasWalletClient] Google Drive backup completed successfully', logContext);
|
|
1220
1314
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.327",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.327",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "0.7.0",
|
|
9
9
|
"@dynamic-labs/sdk-api-core": "^0.0.900",
|
|
10
10
|
"argon2id": "1.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"build": {}
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"main": "./index.cjs
|
|
33
|
+
"main": "./index.cjs",
|
|
34
34
|
"module": "./index.esm.js",
|
|
35
35
|
"types": "./index.esm.d.ts",
|
|
36
36
|
"exports": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
".": {
|
|
39
39
|
"types": "./index.esm.d.ts",
|
|
40
40
|
"import": "./index.esm.js",
|
|
41
|
-
"require": "./index.cjs
|
|
41
|
+
"require": "./index.cjs",
|
|
42
42
|
"default": "./index.esm.js"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
type GoogleDriveErrorBody = {
|
|
2
|
+
error?: {
|
|
3
|
+
code?: number;
|
|
4
|
+
status?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
errors?: Array<{
|
|
7
|
+
reason?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
}>;
|
|
10
|
+
details?: Array<{
|
|
11
|
+
reason?: string;
|
|
12
|
+
'@type'?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
type MappedUploadError = {
|
|
17
|
+
message: string;
|
|
18
|
+
isRetryable: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Maps a Google Drive API error to an actionable user-facing message and a retry hint.
|
|
22
|
+
* The retry hint is consumed by retryPromise to short-circuit on non-transient failures.
|
|
23
|
+
*/
|
|
24
|
+
export declare const mapGoogleDriveUploadError: (httpStatus: number, body: GoogleDriveErrorBody | null) => MappedUploadError;
|
|
1
25
|
export declare const uploadFileToGoogleDriveAppStorage: ({ accessToken, fileName, jsonData, }: {
|
|
2
26
|
accessToken: string;
|
|
3
27
|
fileName: string;
|
|
@@ -16,4 +40,5 @@ export declare const downloadFileFromGoogleDrive: ({ accessToken, fileName, }: {
|
|
|
16
40
|
accessToken: string;
|
|
17
41
|
fileName: string;
|
|
18
42
|
}) => Promise<unknown | null>;
|
|
43
|
+
export {};
|
|
19
44
|
//# sourceMappingURL=googleDrive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;
|
|
1
|
+
{"version":3,"file":"googleDrive.d.ts","sourceRoot":"","sources":["../../../src/backup/providers/googleDrive.ts"],"names":[],"mappings":"AAWA,KAAK,oBAAoB,GAAG;IAC1B,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACtD,OAAO,CAAC,EAAE,KAAK,CAAC;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACxD,CAAC;CACH,CAAC;AAEF,KAAK,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC;AAiBnE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,eAAgB,MAAM,QAAQ,oBAAoB,GAAG,IAAI,KAAG,iBA6CjG,CAAC;AAgBF,eAAO,MAAM,iCAAiC,yCAI3C;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AAEF,eAAO,MAAM,+BAA+B,yCAIzC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,iBAOA,CAAC;AA0FF,eAAO,MAAM,wBAAwB,+BAGlC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAuBA,CAAC;AAEF,eAAO,MAAM,2BAA2B,+BAGrC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,KAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CA6BzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/backup/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/backup/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AA8CzD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,yBAAyB,uGASnC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAA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