@sparkvault/sdk-mobile 9.0.9 → 9.0.11

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/src/http.ts CHANGED
@@ -29,18 +29,22 @@ export type AuthEventListener = (event: AuthEvent) => void;
29
29
  /**
30
30
  * How a token refresh ended.
31
31
  * - `refreshed`: a new access token is stored.
32
- * - `rejected`: the session is over - no refresh token is stored, or the
33
- * server refused it (the stored pair is then cleared and 'logout' emitted).
32
+ * - `rejected`: the session is over - no refresh token is stored, or Core
33
+ * refused it (the stored pair is then cleared and 'logout' emitted).
34
34
  * - `transient`: the refresh could not complete (connectivity, timeout, a
35
- * 408/429/5xx answer, a token-store failure). The session stands, and
36
- * `error` is what the caller surfaces: it must never read as an
37
- * authentication failure, which callers treat as a rejected credential.
35
+ * 408/429/5xx answer, any other answer but Core's refusal, a token-store
36
+ * failure). The session stands, and `error` is what the caller surfaces:
37
+ * it must never read as an authentication failure, which callers treat as
38
+ * a rejected credential.
38
39
  */
39
40
  export type RefreshOutcome =
40
41
  | { status: 'refreshed' }
41
42
  | { status: 'rejected' }
42
43
  | { status: 'transient'; error: unknown };
43
44
 
45
+ /** What a caller reads when the request never reached SparkVault's API. */
46
+ const UNREACHED_MESSAGE = "Couldn't reach SparkVault. Check your connection.";
47
+
44
48
  function parseRetryAfter(headers: Headers): number | null {
45
49
  const retryAfter = headers.get('Retry-After');
46
50
  if (!retryAfter) return null;
@@ -83,8 +87,8 @@ export class MobileHttpClient {
83
87
 
84
88
  /**
85
89
  * Broadcast a session-ended signal to auth listeners. The client emits this
86
- * itself when a token refresh fails (a forced logout); the app calls it for a
87
- * user-initiated logout so both paths run the exact same teardown.
90
+ * itself when Core refuses a token refresh (a forced logout); the app calls
91
+ * it for a user-initiated logout so both paths run the exact same teardown.
88
92
  */
89
93
  signalLogout(): void {
90
94
  this.emitAuthEvent('logout');
@@ -135,39 +139,60 @@ export class MobileHttpClient {
135
139
  // normalize to SparkVaultNetworkError or consumers misclassify an offline
136
140
  // failure as a generic (non-retryable) error.
137
141
  if (err instanceof TypeError || (err instanceof Error && err.name === 'NetworkError')) {
138
- return new SparkVaultNetworkError("Couldn't reach SparkVault. Check your connection.");
142
+ return new SparkVaultNetworkError(UNREACHED_MESSAGE);
139
143
  }
140
144
 
141
145
  return new SparkVaultMobileError(err instanceof Error ? err.message : 'Unknown request error');
142
146
  }
143
147
 
144
- /** An error response's JSON body, or an empty one when it has none. */
148
+ /**
149
+ * An error response's JSON object body, or an empty one when it carries
150
+ * none (a page that is not JSON, or JSON such as `null` that is not an
151
+ * object): every caller reads its fields.
152
+ */
145
153
  private async readErrorBody(response: Response): Promise<ApiErrorBody> {
146
- try {
147
- return await response.json();
148
- } catch {
149
- this.config.logger.debug('Failed to parse error response body', { status: response.status });
150
- return {};
154
+ const body: unknown = await response.json().catch(() => null);
155
+ if (body && typeof body === 'object') {
156
+ return body as ApiErrorBody;
151
157
  }
158
+ this.config.logger.debug('Error response carries no JSON object body', { status: response.status });
159
+ return {};
152
160
  }
153
161
 
154
162
  /**
155
- * Throw a 401 that is not Core refusing the login itself. Only Core's
156
- * session code (AUTHENTICATION_ERROR) naming no refused vault access token
157
- * is a dead login a refresh can renew (`isRefusedLogin`,
158
- * @sparkvault/app-sdk/vat-refusal). A refused VAT (VAT_INVALID), or a key
159
- * the request presents refused (an unseal's DVAK: UNAUTHORIZED), leaves
160
- * the session standing: no refresh revives either, so it is thrown as it
161
- * is, with the one-time refresh token unspent.
163
+ * Whether an error answer is Core refusing the login itself: its session
164
+ * code (AUTHENTICATION_ERROR) naming no refused vault access token
165
+ * (`isRefusedLogin`, @sparkvault/app-sdk/vat-refusal).
162
166
  */
163
- private async throwUnlessRefusedLogin(response: Response): Promise<void> {
164
- const body = await this.readErrorBody(response);
165
- const refusal = {
166
- statusCode: response.status,
167
+ private refusesLogin(status: number, body: ApiErrorBody): boolean {
168
+ return isRefusedLogin({
169
+ statusCode: status,
167
170
  upstreamCode: typeof body.error?.code === 'string' ? body.error.code : null,
168
171
  details: body.error?.details,
169
- };
170
- if (!isRefusedLogin(refusal)) {
172
+ });
173
+ }
174
+
175
+ /**
176
+ * Whether an answer to the refresh is Core refusing the refresh token: the
177
+ * login refusal (`refusesLogin`: an unknown, revoked or expired token, or
178
+ * an account that is unavailable), or a token already spent, whose replay
179
+ * revoked its whole family (401 TOKEN_REPLAY,
180
+ * apps/api/src/lib/refresh-tokens.js).
181
+ */
182
+ private refusesRefresh(status: number, body: ApiErrorBody): boolean {
183
+ return this.refusesLogin(status, body) || (status === 401 && body.error?.code === 'TOKEN_REPLAY');
184
+ }
185
+
186
+ /**
187
+ * Throw a 401 that is not Core refusing the login itself. Only that
188
+ * refusal is a dead login a refresh can renew. A refused VAT (VAT_INVALID),
189
+ * or a key the request presents refused (an unseal's DVAK: UNAUTHORIZED),
190
+ * leaves the session standing: no refresh revives either, so it is thrown
191
+ * as it is, with the one-time refresh token unspent.
192
+ */
193
+ private async throwUnlessRefusedLogin(response: Response): Promise<void> {
194
+ const body = await this.readErrorBody(response);
195
+ if (!this.refusesLogin(response.status, body)) {
171
196
  throw this.httpError(response.status, body);
172
197
  }
173
198
  }
@@ -248,16 +273,18 @@ export class MobileHttpClient {
248
273
  }
249
274
 
250
275
  if (!response.ok) {
276
+ const errorBody = await this.readErrorBody(response);
277
+ if (this.refusesRefresh(response.status, errorBody)) {
278
+ return this.endRefusedSession();
279
+ }
251
280
  if (isTransientHttpStatus(response.status)) {
252
281
  this.config.logger.warn('Token refresh failed with transient HTTP status', {
253
282
  status: response.status,
254
283
  retryAfterMs: parseRetryAfter(response.headers),
255
284
  });
256
- const errorBody: ApiErrorBody = await response.json().catch(() => ({}));
257
285
  return { status: 'transient', error: this.httpError(response.status, errorBody) };
258
286
  }
259
-
260
- return this.endRefusedSession();
287
+ return this.refreshUnreached(response.status);
261
288
  }
262
289
 
263
290
  const body = await response.json().catch(() => ({} as ApiResponse<{
@@ -267,11 +294,7 @@ export class MobileHttpClient {
267
294
  const data = body?.data;
268
295
 
269
296
  if (!data || typeof data.access_token !== 'string' || !data.access_token) {
270
- this.config.logger.error('Invalid token refresh response', {
271
- hasData: Boolean(data),
272
- accessTokenType: typeof data?.access_token,
273
- });
274
- return this.endRefusedSession();
297
+ return this.refreshUnreached(response.status);
275
298
  }
276
299
 
277
300
  // Refresh tokens rotate and are one-time-use: persist the pair through a
@@ -294,9 +317,22 @@ export class MobileHttpClient {
294
317
  }
295
318
 
296
319
  /**
297
- * The server refused the session: drop the stored pair and end it. The
298
- * session is over whether or not the local clear lands, so 'logout' always
299
- * fires and the app's teardown runs.
320
+ * A refresh answered by something that is not Core's refresh route: an
321
+ * edge challenge, the origin guard's not-found, a captive portal's page, a
322
+ * 2xx with no access token. Only Core's refusal ends a session, so it
323
+ * stands, and the caller hears that SparkVault was not reached: the
324
+ * answer's own status would read as a refused credential (401, 403) or a
325
+ * missing resource (404), which callers act on.
326
+ */
327
+ private refreshUnreached(status: number): RefreshOutcome {
328
+ this.config.logger.warn("Token refresh was answered by something other than Core's refresh route", { status });
329
+ return { status: 'transient', error: new SparkVaultNetworkError(UNREACHED_MESSAGE) };
330
+ }
331
+
332
+ /**
333
+ * Core refused the session: drop the stored pair and end it. The session
334
+ * is over whether or not the local clear lands, so 'logout' always fires
335
+ * and the app's teardown runs.
300
336
  */
301
337
  private async endRefusedSession(): Promise<RefreshOutcome> {
302
338
  try {
package/src/ingots.ts CHANGED
@@ -463,14 +463,6 @@ function uploadIdOf(uploadUrl: string): string {
463
463
  }
464
464
 
465
465
  export class MobileIngotsClient {
466
- // Server-side finalization (encryption) of a just-uploaded ingot runs
467
- // asynchronously and scales with file size, so a large video can sit in
468
- // `processing` for well over a minute. Poll with backoff up to a generous
469
- // budget for a terminal state; the initial/max/budget are wall-clock, not a
470
- // fixed attempt count, so the wait tracks real finalization time.
471
- private static readonly INGOT_STATUS_POLL_INITIAL_MS = 1000;
472
- private static readonly INGOT_STATUS_POLL_MAX_MS = 5000;
473
- private static readonly INGOT_STATUS_POLL_BUDGET_MS = 120000;
474
466
  private static readonly DOWNLOAD_MAX_ATTEMPTS = 3;
475
467
  private static readonly DOWNLOAD_RETRY_BASE_MS = 1000;
476
468
 
@@ -543,8 +535,7 @@ export class MobileIngotsClient {
543
535
 
544
536
  const ingot = await this.verifyIngotActive(
545
537
  { vaultId: options.vaultId, ingotId: init.ingotId, vat: options.vat },
546
- { filename: name, fileSize: options.fileSize },
547
- options.debug
538
+ { filename: name, fileSize: options.fileSize }
548
539
  );
549
540
 
550
541
  return {
@@ -595,8 +586,7 @@ export class MobileIngotsClient {
595
586
 
596
587
  const ingot = await this.verifyIngotActive(
597
588
  { vaultId: options.vaultId, ingotId: options.ingotId, vat: options.vat },
598
- { filename: options.name, fileSize: options.fileSize },
599
- options.debug
589
+ { filename: options.name, fileSize: options.fileSize }
600
590
  );
601
591
 
602
592
  return {
@@ -784,8 +774,7 @@ export class MobileIngotsClient {
784
774
 
785
775
  const ingot = await this.verifyIngotActive(
786
776
  { vaultId, ingotId: response.data.ingot_id, vat },
787
- { filename: name, fileSize },
788
- debug
777
+ { filename: name, fileSize }
789
778
  );
790
779
 
791
780
  return {
@@ -1113,54 +1102,32 @@ export class MobileIngotsClient {
1113
1102
  }
1114
1103
 
1115
1104
  /**
1116
- * Read a just-uploaded ingot until the server reports it `active`.
1105
+ * Read a just-uploaded ingot once and require it `active`.
1117
1106
  *
1118
1107
  * The upload resolved on Forge's receipt (a 2xx to the PATCH at the final
1119
- * offset, which Forge answers only once the ingot is published), so a read
1120
- * that is not `active` yet is a read lagging that publication, which the
1121
- * poll waits out. It never re-creates or re-uploads anything. A row still
1122
- * not `active` past the poll budget is never reported as a success: it
1123
- * throws a `TusUploadError` whose `retryLater` is set (every byte is
1124
- * received, publication is unconfirmed), so the caller resumes the session
1125
- * it persisted later, which asks Forge for the receipt again and sends no
1126
- * bytes, rather than recording a backup the vault may not hold.
1127
- *
1128
- * Every read is strongly consistent: an eventually consistent read can
1129
- * still serve the row as it stood before this upload published, and a
1130
- * replaced row reads `active` throughout, so that stale image would pass
1131
- * the status check and report a `content_version` older than this
1132
- * upload's. A consistent read reports the version at the read, which a
1133
- * later writer's publication can already have replaced: the upload's own
1134
- * publication is its session's `uploadId`.
1108
+ * offset, which Forge answers only once the ingot is published), and the
1109
+ * read is strongly consistent, so it cannot lag that publication: an
1110
+ * eventually consistent read could still serve the row as it stood before
1111
+ * this upload published, and a replaced row reads `active` throughout, so
1112
+ * that stale image would pass the status check and report a
1113
+ * `content_version` older than this upload's. A row the read finds in any
1114
+ * other status is never reported as a success, which would record a
1115
+ * backup the vault may not hold. The read reports the version at the read,
1116
+ * which a later writer's publication can already have replaced: the
1117
+ * upload's own publication is its session's `uploadId`.
1135
1118
  */
1136
1119
  private async verifyIngotActive(
1137
1120
  ingotRef: { vaultId: string; ingotId: string; vat: string },
1138
- upload: { filename: string; fileSize: number },
1139
- debug?: DebugLogger
1121
+ upload: { filename: string; fileSize: number }
1140
1122
  ): Promise<Ingot> {
1141
1123
  const { vaultId, ingotId, vat } = ingotRef;
1142
- const deadline = Date.now() + MobileIngotsClient.INGOT_STATUS_POLL_BUDGET_MS;
1143
- let delay = MobileIngotsClient.INGOT_STATUS_POLL_INITIAL_MS;
1144
- let ingot = await this.get(vaultId, ingotId, vat, { consistent: true });
1145
-
1146
- while (ingot.status !== 'active') {
1147
- const remaining = deadline - Date.now();
1148
- if (remaining <= 0) {
1149
- debug?.log(
1150
- `Ingot ${ingotId} still '${ingot.status}' after ${MobileIngotsClient.INGOT_STATUS_POLL_BUDGET_MS}ms; ` +
1151
- 'the upload is received and will be confirmed on a later attempt'
1152
- );
1153
- throw new TusUploadError(
1154
- `Upload received; the vault has not confirmed ingot ${ingotId} published yet (status ${ingot.status ?? 'unknown'})`,
1155
- { ...upload, phase: 'finalize', retryLater: true }
1156
- );
1157
- }
1158
-
1159
- await new Promise(resolve => setTimeout(resolve, Math.min(delay, remaining)));
1160
- delay = Math.min(delay * 2, MobileIngotsClient.INGOT_STATUS_POLL_MAX_MS);
1161
- ingot = await this.get(vaultId, ingotId, vat, { consistent: true });
1124
+ const ingot = await this.get(vaultId, ingotId, vat, { consistent: true });
1125
+ if (ingot.status !== 'active') {
1126
+ throw new TusUploadError(
1127
+ `Upload received, but the vault reads ingot ${ingotId} as '${ingot.status ?? 'unknown'}', not published`,
1128
+ { ...upload, phase: 'finalize' }
1129
+ );
1162
1130
  }
1163
-
1164
1131
  return ingot;
1165
1132
  }
1166
1133
 
package/src/tus.ts CHANGED
@@ -272,8 +272,6 @@ export function isCancelledTransfer(err: unknown, signal: AbortSignal | undefine
272
272
  */
273
273
  interface TusChunk {
274
274
  base64: string;
275
- /** Decoded payload size — the read length requested from the file. */
276
- byteLength: number;
277
275
  }
278
276
 
279
277
  /**
@@ -422,6 +420,8 @@ const RESUME_HEAD_REQUEST: TusRequestKind = { label: 'TUS HEAD', phase: 'create'
422
420
  const OFFSET_HEAD_REQUEST: TusRequestKind = { label: 'TUS HEAD', phase: 'upload', gonePhase: 'create', receipt: false };
423
421
  const CHUNK_REQUEST: TusRequestKind = { label: 'Chunk upload', phase: 'upload', gonePhase: 'upload', receipt: false };
424
422
  const RECEIPT_REQUEST: TusRequestKind = { label: 'TUS finalization', phase: 'upload', gonePhase: 'create', receipt: true };
423
+ /** The OS transfer engine's PATCHes, whose failure arrives as the one answer that ended the range. */
424
+ const ENGINE_REQUEST: TusRequestKind = { label: 'Background chunk upload', phase: 'upload', gonePhase: 'upload', receipt: false };
425
425
 
426
426
  /** What a caller hears once Forge kept deferring the publication until the upload's idle limit. */
427
427
  const RECEIVED_PUBLISHING_MESSAGE =
@@ -482,21 +482,28 @@ function failureOf(
482
482
  return { error: errorOf(answer, outcome, request, context), outcome, unanswered: answer.unanswered !== null };
483
483
  }
484
484
 
485
+ /**
486
+ * The error a caller sees for an answer (failureOf). `cause` is what
487
+ * reported the answer when this SDK did not receive it itself: the OS
488
+ * engine's failure.
489
+ */
485
490
  function errorOf(
486
491
  answer: TransferAnswer,
487
492
  outcome: TransferOutcome,
488
493
  request: TusRequestKind,
489
- context: TusErrorContext
494
+ context: TusErrorContext,
495
+ cause: Error | null = null
490
496
  ): SparkVaultMobileError {
491
497
  if (answer.unanswered) return answer.unanswered;
492
498
  if (outcome.verdict === TRANSFER_VERDICT.REFUSED && outcome.coreCode !== null) {
493
- return refusedError(answer.status, answer.envelope, outcome.coreCode, context, request.phase);
499
+ return refusedError(answer.status, answer.envelope, outcome.coreCode, context, request.phase, cause);
494
500
  }
495
501
  if (outcome.verdict === TRANSFER_VERDICT.GONE && request.gonePhase !== null) {
496
- return sessionLostError(answer.status, context, request.gonePhase, null, outcome.coreCode);
502
+ return sessionLostError(answer.status, context, request.gonePhase, cause, outcome.coreCode);
497
503
  }
498
504
  if (outcome.verdict === TRANSFER_VERDICT.DEFERRED) {
499
505
  return new TusUploadError(RECEIVED_PUBLISHING_MESSAGE, {
506
+ cause,
500
507
  httpStatus: answer.status,
501
508
  code: RECEIVED_STILL_SAVING,
502
509
  retryAfterMs: outcome.retryAfterMs,
@@ -508,6 +515,7 @@ function errorOf(
508
515
  const gateError = gateErrorFromBody(answer.status, answer.envelope);
509
516
  if (gateError) return gateError;
510
517
  return new TusUploadError(`${request.label} failed: ${answer.status} - ${answer.body.substring(0, 200)}`, {
518
+ cause,
511
519
  httpStatus: answer.status,
512
520
  retryAfterMs: outcome.retryAfterMs,
513
521
  ...context,
@@ -1013,18 +1021,18 @@ async function sendWholeFileInBackground(
1013
1021
  /**
1014
1022
  * Translate what the OS transfer adapter reports into the SDK's one error
1015
1023
  * taxonomy, so a caller sees the same `TusUploadError` phases and typed gate
1016
- * errors whichever engine carried the bytes. Forge's status, body and
1017
- * `X-Upload-Refusal` ride through untouched: the refusal Core decided is
1018
- * `upload_refused` in Core's words as on the XHR path, a 402 becomes the
1019
- * gate error the XHR path throws, a status `isSessionGone` recognises marks
1020
- * the session lost exactly as HEAD would, and any other status keeps its
1021
- * number for the caller's own policy (a 409 during finalize is a
1022
- * retry-later, not a lost session). The remaining kinds are transport
1023
- * outcomes: the caller's own abort is `cancelled`; an OS-ended task
1024
- * (`interrupted`) is a network failure, because the right response is the
1025
- * same as for a dropped connection: resume from the server offset. Anything
1026
- * that is not a `BackgroundTransferError` is an adapter defect and is
1027
- * reported as a network failure with the cause attached, never swallowed.
1024
+ * errors whichever engine carried the bytes. An `http` failure is Forge's
1025
+ * answer (its status, body and `X-Upload-Refusal`), read by the one reading
1026
+ * the XHR path's answers get (`readOutcome`, `errorOf`): the refusal Core
1027
+ * decided is `upload_refused` in Core's words, a 402 the gate error, a gone
1028
+ * session `sessionLost`, and any other status keeps its number for the
1029
+ * caller's own policy (a 409 during finalize is a retry-later, not a lost
1030
+ * session). The remaining kinds are transport outcomes: the caller's own
1031
+ * abort is `cancelled`; an OS-ended task (`interrupted`) is a network
1032
+ * failure, because the right response is the same as for a dropped
1033
+ * connection: resume from the server offset. Anything that is not a
1034
+ * `BackgroundTransferError` is an adapter defect and is reported as a
1035
+ * network failure with the cause attached, never swallowed.
1028
1036
  */
1029
1037
  export function mapBackgroundTransferError(
1030
1038
  err: unknown,
@@ -1042,28 +1050,23 @@ export function mapBackgroundTransferError(
1042
1050
  case 'http': {
1043
1051
  const status = err.httpStatus;
1044
1052
  const body = err.body ?? '';
1045
- if (status !== undefined) {
1046
- const envelope = parseErrorBody(body);
1047
- // The engine hands over the one header a refusal Core decided is
1048
- // named in, so a bodiless answer reads as it does on the XHR path.
1049
- const header = (name: string) =>
1050
- name.toLowerCase() === UPLOAD_REFUSAL_HEADER.toLowerCase() ? err.uploadRefusal ?? null : null;
1051
- const outcome = Number.isSafeInteger(status) && status > 0
1052
- ? classifyTransferResponse({ status, headers: header, details: envelope.error?.details ?? null })
1053
- : null;
1054
- if (outcome?.verdict === TRANSFER_VERDICT.REFUSED && outcome.coreCode !== null) {
1055
- return refusedError(status, envelope, outcome.coreCode, context, 'upload', err);
1056
- }
1057
- const gateError = gateErrorFromBody(status, envelope);
1058
- if (gateError) return gateError;
1059
- if (outcome?.verdict === TRANSFER_VERDICT.GONE) {
1060
- return sessionLostError(status, context, 'upload', err, outcome.coreCode);
1061
- }
1053
+ // A status the adapter lost leaves no answer to read: still an upload
1054
+ // failure, never a gate or a lost session.
1055
+ if (status === undefined || !Number.isSafeInteger(status) || status <= 0) {
1056
+ return new TusUploadError(`${ENGINE_REQUEST.label} failed: unknown status - ${body.substring(0, 200)}`, {
1057
+ cause: err,
1058
+ ...context,
1059
+ phase: 'upload',
1060
+ });
1062
1061
  }
1063
- return new TusUploadError(
1064
- `Background chunk upload failed: ${status ?? 'unknown status'} - ${body.substring(0, 200)}`,
1065
- { cause: err, httpStatus: status ?? null, ...context, phase: 'upload' }
1062
+ // The engine hands over the one header a refusal Core decided is named
1063
+ // in, so a bodiless answer reads as it does on the XHR path.
1064
+ const answer = answerOf(
1065
+ status,
1066
+ name => (name.toLowerCase() === UPLOAD_REFUSAL_HEADER.toLowerCase() ? err.uploadRefusal ?? null : null),
1067
+ body
1066
1068
  );
1069
+ return errorOf(answer, readOutcome(answer, ENGINE_REQUEST), ENGINE_REQUEST, context, err);
1067
1070
  }
1068
1071
  case 'cancelled':
1069
1072
  return new TusUploadError('Upload cancelled', { cause: err, ...context, phase: 'cancelled' });
@@ -1808,11 +1811,6 @@ export class MobileTusUploader {
1808
1811
  );
1809
1812
  }
1810
1813
 
1811
- // Size the chunk from the string itself, not the requested read length: a
1812
- // short read (file truncated/evicted mid-upload) must keep the
1813
- // offset-fallback arithmetic and the stall guard honest about the bytes
1814
- // actually sent.
1815
- const padding = base64.endsWith('==') ? 2 : base64.endsWith('=') ? 1 : 0;
1816
- return { base64, byteLength: (base64.length / 4) * 3 - padding };
1814
+ return { base64 };
1817
1815
  }
1818
1816
  }
package/src/types.ts CHANGED
@@ -874,9 +874,8 @@ export interface UploadResult {
874
874
  created?: boolean;
875
875
  /**
876
876
  * The ingot status the upload confirmed: `active`, the server's read of
877
- * the published ingot. An upload whose activation the poll budget could
878
- * not confirm never resolves: it rejects with a `TusUploadError` whose
879
- * `retryLater` is set.
877
+ * the published ingot. An upload whose read finds any other status never
878
+ * resolves: it rejects with a `TusUploadError` in phase `finalize`.
880
879
  */
881
880
  status?: Ingot['status'];
882
881
  /**