@sparkvault/sdk-js 9.1.2 → 9.2.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.
@@ -44,10 +44,27 @@ export declare class UploadApi extends SparkVaultApi {
44
44
  * every server-reported offset, and honors the session abort signal plus
45
45
  * per-request timeouts.
46
46
  *
47
+ * A chunk that fails in transit is retried against the session's *true*
48
+ * offset rather than failing the whole transfer — see {@link CHUNK_MAX_ATTEMPTS}
49
+ * and {@link readResumeOffset}.
50
+ *
47
51
  * Returns the TUS session URL so the caller can confirm server-side
48
52
  * finalization via {@link verifyUploadFinalized} before reporting success.
49
53
  */
50
54
  uploadFileToForge(file: File | Blob, forgeUrl: string, onProgress?: (bytesUploaded: number, bytesTotal: number) => void): Promise<string>;
55
+ /**
56
+ * Read the offset a failed chunk should resume from.
57
+ *
58
+ * Forge commits a chunk before it answers, so a PATCH that died in transit
59
+ * may have landed in full or not at all (never in part — the chunk object
60
+ * is written atomically before the offset advances); only the session's own
61
+ * persisted offset knows which, and the client's arithmetic is worthless
62
+ * here. An offset past the declared total is a protocol violation rather
63
+ * than a resume point: honoring it would end the loop early and report a
64
+ * partial upload as complete, the same trap {@link patchChunk} guards
65
+ * against on a PATCH's own offset.
66
+ */
67
+ private readResumeOffset;
51
68
  /**
52
69
  * Create the TUS upload session. Forge reads only `Tus-Resumable`,
53
70
  * `Upload-Length`, and `X-ISTK` on create, and returns the session URL in
@@ -85,12 +102,16 @@ export declare class UploadApi extends SparkVaultApi {
85
102
  */
86
103
  verifyUploadFinalized(uploadUrl: string, expectedOffset: number): Promise<void>;
87
104
  /**
88
- * Read the server's persisted upload offset via a TUS HEAD request.
105
+ * Read the server's persisted upload offset via a TUS HEAD request — the one
106
+ * place the client asks Forge where a session really stands, for both
107
+ * mid-upload resume and end-of-upload confirmation.
89
108
  *
90
109
  * Uses raw `fetch` rather than the JSON envelope helper: TUS responses
91
110
  * carry an empty body and surface state in the `Upload-Offset` header.
92
111
  * Honors the session abort signal and request timeout like every other
93
112
  * client call.
113
+ *
114
+ * @param check - Which caller this read serves; shapes the failure copy.
94
115
  */
95
116
  private headUploadOffset;
96
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkvault/sdk-js",
3
- "version": "9.1.2",
3
+ "version": "9.2.0",
4
4
  "description": "SparkVault JavaScript SDK - Identity Verification and Encrypted Vaults",
5
5
  "type": "module",
6
6
  "exports": {