@sparkvault/sdk-js 9.1.2 → 9.2.1
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 +338 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +338 -23
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +5 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/upload/api.d.ts +34 -1
- package/package.json +1 -1
|
@@ -44,10 +44,39 @@ 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
|
+
* Confirm the server finalized a fully received upload.
|
|
57
|
+
*
|
|
58
|
+
* The server persists the session's final offset BEFORE it finalizes, so an
|
|
59
|
+
* offset read from a resume HEAD can equal the file size while finalization
|
|
60
|
+
* failed or is still running — treating that offset as success would report
|
|
61
|
+
* a stored file whose ingot was never published. The zero-length PATCH at
|
|
62
|
+
* the final offset is the server's finalization re-drive: it answers 2xx
|
|
63
|
+
* only once finalization has actually completed, the same receipt a
|
|
64
|
+
* successful final chunk carries.
|
|
65
|
+
*/
|
|
66
|
+
private confirmServerFinalized;
|
|
67
|
+
/**
|
|
68
|
+
* Read the offset a failed chunk should resume from.
|
|
69
|
+
*
|
|
70
|
+
* Forge commits a chunk before it answers, so a PATCH that died in transit
|
|
71
|
+
* may have landed in full or not at all (never in part — the chunk object
|
|
72
|
+
* is written atomically before the offset advances); only the session's own
|
|
73
|
+
* persisted offset knows which, and the client's arithmetic is worthless
|
|
74
|
+
* here. An offset past the declared total is a protocol violation rather
|
|
75
|
+
* than a resume point: honoring it would end the loop early and report a
|
|
76
|
+
* partial upload as complete, the same trap {@link patchChunk} guards
|
|
77
|
+
* against on a PATCH's own offset.
|
|
78
|
+
*/
|
|
79
|
+
private readResumeOffset;
|
|
51
80
|
/**
|
|
52
81
|
* Create the TUS upload session. Forge reads only `Tus-Resumable`,
|
|
53
82
|
* `Upload-Length`, and `X-ISTK` on create, and returns the session URL in
|
|
@@ -85,12 +114,16 @@ export declare class UploadApi extends SparkVaultApi {
|
|
|
85
114
|
*/
|
|
86
115
|
verifyUploadFinalized(uploadUrl: string, expectedOffset: number): Promise<void>;
|
|
87
116
|
/**
|
|
88
|
-
* Read the server's persisted upload offset via a TUS HEAD request
|
|
117
|
+
* Read the server's persisted upload offset via a TUS HEAD request — the one
|
|
118
|
+
* place the client asks Forge where a session really stands, for both
|
|
119
|
+
* mid-upload resume and end-of-upload confirmation.
|
|
89
120
|
*
|
|
90
121
|
* Uses raw `fetch` rather than the JSON envelope helper: TUS responses
|
|
91
122
|
* carry an empty body and surface state in the `Upload-Offset` header.
|
|
92
123
|
* Honors the session abort signal and request timeout like every other
|
|
93
124
|
* client call.
|
|
125
|
+
*
|
|
126
|
+
* @param check - Which caller this read serves; shapes the failure copy.
|
|
94
127
|
*/
|
|
95
128
|
private headUploadOffset;
|
|
96
129
|
}
|