@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.cjs CHANGED
@@ -10047,29 +10047,15 @@ function summarizeErrorBody(body) {
10047
10047
  const RESUME_CHECK = {
10048
10048
  name: 'Upload resume check',
10049
10049
  code: 'resume_check_failed',
10050
+ serverFailureMessage: 'Upload could not be resumed: the server no longer recognizes this upload session.',
10050
10051
  networkMessage: 'Unable to resume upload. Please check your connection and try again.',
10051
10052
  };
10052
10053
  const FINALIZATION_CHECK = {
10053
10054
  name: 'Upload finalization check',
10054
10055
  code: 'finalization_check_failed',
10056
+ serverFailureMessage: 'Upload could not be confirmed: the server did not finalize the file.',
10055
10057
  networkMessage: 'Unable to confirm upload. Please check your connection and try again.',
10056
10058
  };
10057
- /**
10058
- * Turn a terminal confirmation failure into something a person can read.
10059
- *
10060
- * The upload widget prints `error.message` verbatim, and a bare status line
10061
- * ("Upload finalization check failed: 500") tells the user nothing about their
10062
- * file. Only the status-carrying failure is rewritten: a timeout or a
10063
- * connection failure already explains itself in the user's terms, and its code
10064
- * is load-bearing taxonomy. The status and the server's own detail move into
10065
- * `details`, where support can still read them.
10066
- */
10067
- function asFinalizationFailure(error) {
10068
- if (!(error instanceof UploadApiError) || error.code !== FINALIZATION_CHECK.code) {
10069
- return error;
10070
- }
10071
- 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 });
10072
- }
10073
10059
  class UploadApi extends SparkVaultApi {
10074
10060
  constructor(config) {
10075
10061
  super(config.timeout);
@@ -10282,7 +10268,7 @@ class UploadApi extends SparkVaultApi {
10282
10268
  if (attempt >= FINALIZE_MAX_ATTEMPTS ||
10283
10269
  consecutiveTimeouts >= FINALIZE_MAX_CONSECUTIVE_TIMEOUTS ||
10284
10270
  !isRetryableTransferFailure(error)) {
10285
- throw asFinalizationFailure(error);
10271
+ throw error;
10286
10272
  }
10287
10273
  await abortableDelay(FINALIZE_RETRY_MS, this.getAbortSignal());
10288
10274
  }
@@ -10488,7 +10474,7 @@ class UploadApi extends SparkVaultApi {
10488
10474
  // attempt. What it says is the only server-side detail this client
10489
10475
  // ever sees, so it rides along in `details` for support.
10490
10476
  const detail = summarizeErrorBody(await response.text().catch(() => ''));
10491
- throw new UploadApiError(`${check.name} failed: ${response.status}`, check.code, response.status, detail ? { serverDetail: detail } : undefined);
10477
+ throw new UploadApiError(check.serverFailureMessage, check.code, response.status, { status: response.status, ...(detail ? { serverDetail: detail } : {}) });
10492
10478
  }
10493
10479
  return response;
10494
10480
  }
@@ -15075,7 +15061,7 @@ class SparkVault {
15075
15061
  }
15076
15062
  /** Get the SDK version */
15077
15063
  static get version() {
15078
- return '9.2.2';
15064
+ return '9.2.3';
15079
15065
  }
15080
15066
  }
15081
15067
  if (typeof window !== 'undefined') {