@sparkvault/sdk-js 9.2.2 → 9.2.3

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/dist/index.mjs CHANGED
@@ -10043,29 +10043,15 @@ function summarizeErrorBody(body) {
10043
10043
  const RESUME_CHECK = {
10044
10044
  name: 'Upload resume check',
10045
10045
  code: 'resume_check_failed',
10046
+ serverFailureMessage: 'Upload could not be resumed: the server no longer recognizes this upload session.',
10046
10047
  networkMessage: 'Unable to resume upload. Please check your connection and try again.',
10047
10048
  };
10048
10049
  const FINALIZATION_CHECK = {
10049
10050
  name: 'Upload finalization check',
10050
10051
  code: 'finalization_check_failed',
10052
+ serverFailureMessage: 'Upload could not be confirmed: the server did not finalize the file.',
10051
10053
  networkMessage: 'Unable to confirm upload. Please check your connection and try again.',
10052
10054
  };
10053
- /**
10054
- * Turn a terminal confirmation failure into something a person can read.
10055
- *
10056
- * The upload widget prints `error.message` verbatim, and a bare status line
10057
- * ("Upload finalization check failed: 500") tells the user nothing about their
10058
- * file. Only the status-carrying failure is rewritten: a timeout or a
10059
- * connection failure already explains itself in the user's terms, and its code
10060
- * is load-bearing taxonomy. The status and the server's own detail move into
10061
- * `details`, where support can still read them.
10062
- */
10063
- function asFinalizationFailure(error) {
10064
- if (!(error instanceof UploadApiError) || error.code !== FINALIZATION_CHECK.code) {
10065
- return error;
10066
- }
10067
- return new UploadApiError('Upload could not be confirmed: the server did not finalize the file.', error.code, error.statusCode ?? 0, { ...error.details, status: error.statusCode ?? 0 });
10068
- }
10069
10055
  class UploadApi extends SparkVaultApi {
10070
10056
  constructor(config) {
10071
10057
  super(config.timeout);
@@ -10278,7 +10264,7 @@ class UploadApi extends SparkVaultApi {
10278
10264
  if (attempt >= FINALIZE_MAX_ATTEMPTS ||
10279
10265
  consecutiveTimeouts >= FINALIZE_MAX_CONSECUTIVE_TIMEOUTS ||
10280
10266
  !isRetryableTransferFailure(error)) {
10281
- throw asFinalizationFailure(error);
10267
+ throw error;
10282
10268
  }
10283
10269
  await abortableDelay(FINALIZE_RETRY_MS, this.getAbortSignal());
10284
10270
  }
@@ -10484,7 +10470,7 @@ class UploadApi extends SparkVaultApi {
10484
10470
  // attempt. What it says is the only server-side detail this client
10485
10471
  // ever sees, so it rides along in `details` for support.
10486
10472
  const detail = summarizeErrorBody(await response.text().catch(() => ''));
10487
- throw new UploadApiError(`${check.name} failed: ${response.status}`, check.code, response.status, detail ? { serverDetail: detail } : undefined);
10473
+ throw new UploadApiError(check.serverFailureMessage, check.code, response.status, { status: response.status, ...(detail ? { serverDetail: detail } : {}) });
10488
10474
  }
10489
10475
  return response;
10490
10476
  }
@@ -15071,7 +15057,7 @@ class SparkVault {
15071
15057
  }
15072
15058
  /** Get the SDK version */
15073
15059
  static get version() {
15074
- return '9.2.2';
15060
+ return '9.2.3';
15075
15061
  }
15076
15062
  }
15077
15063
  if (typeof window !== 'undefined') {