@sparkvault/sdk-js 11.1.12 → 11.1.14
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 +199 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +65 -2
- package/dist/index.mjs +199 -15
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/index.d.ts +46 -3
- package/dist/ingots/types.d.ts +20 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/vaults/upload/api.d.ts +39 -2
- package/package.json +1 -1
|
@@ -119,9 +119,37 @@ export declare class UploadApi extends SparkVaultApi {
|
|
|
119
119
|
* Resolves only once the server has confirmed finalization
|
|
120
120
|
* ({@link confirmServerFinalized}), so a caller that gets a resolved promise
|
|
121
121
|
* is always looking at a published ingot; a publication the server still
|
|
122
|
-
* defers at the idle limit throws `upload_received_publishing`.
|
|
122
|
+
* defers at the idle limit throws `upload_received_publishing`. The
|
|
123
|
+
* session's URL goes to `onSessionCreated` once Forge opens it, before the
|
|
124
|
+
* first byte, so the caller can continue the upload in it
|
|
125
|
+
* ({@link resumeUploadToForge}) whatever becomes of this transfer.
|
|
123
126
|
*/
|
|
124
|
-
uploadFileToForge(file: File | Blob, forgeUrl: string, onProgress?: (bytesUploaded: number, bytesTotal: number) => void): Promise<void>;
|
|
127
|
+
uploadFileToForge(file: File | Blob, forgeUrl: string, onProgress?: (bytesUploaded: number, bytesTotal: number) => void, onSessionCreated?: (sessionUrl: string) => void): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Continue an upload in the session {@link uploadFileToForge} opened for
|
|
130
|
+
* `file` (the session URL its `onSessionCreated` handed over), through the same
|
|
131
|
+
* transfer: Forge is asked where the session stands (a HEAD, retried under
|
|
132
|
+
* the transfer policy as any request of the upload is), only the bytes it
|
|
133
|
+
* lacks are sent, and the upload resolves on the same receipt, so a
|
|
134
|
+
* resolved promise is a published ingot. A session at its full offset sends
|
|
135
|
+
* no byte and only takes the receipt: this is how a caller learns what
|
|
136
|
+
* became of an upload whose publication was still deferred
|
|
137
|
+
* (`upload_received_publishing`). It throws as an upload does: `session_gone`
|
|
138
|
+
* once Forge no longer holds the session (cancelled, expired, or ended when
|
|
139
|
+
* Core refused its publication), `upload_refused` for a refusal Core
|
|
140
|
+
* decided, `upload_received_publishing` again for a publication still
|
|
141
|
+
* deferred at the idle limit. A session URL that is not an upload session
|
|
142
|
+
* on an allowed transfer host is refused (`invalid_forge_url`), and one
|
|
143
|
+
* whose upload is not this file's length (`session_mismatch`), before any
|
|
144
|
+
* byte is sent.
|
|
145
|
+
*/
|
|
146
|
+
resumeUploadToForge(file: File | Blob, sessionUrl: string, onProgress?: (bytesUploaded: number, bytesTotal: number) => void): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Send `file` into its session from `offset` (0 for a session just opened,
|
|
149
|
+
* the server's own offset for a resumed one) until the receipt confirms
|
|
150
|
+
* publication: the one loop every transfer runs.
|
|
151
|
+
*/
|
|
152
|
+
private sendFile;
|
|
125
153
|
/**
|
|
126
154
|
* Where the upload stands after a failed chunk PATCH, in the server's words:
|
|
127
155
|
* a 409's own `Upload-Offset` at once, otherwise the session's HEAD after
|
|
@@ -172,6 +200,15 @@ export declare class UploadApi extends SparkVaultApi {
|
|
|
172
200
|
* missing, and the upload continues from there.
|
|
173
201
|
*/
|
|
174
202
|
private confirmServerFinalized;
|
|
203
|
+
/**
|
|
204
|
+
* Where a session a resume continues stands, from its HEAD: the bytes it
|
|
205
|
+
* holds, the length of the upload it was opened for, and its chunk size
|
|
206
|
+
* (Forge echoes `X-Chunk-Size` on a HEAD as on the create). A HEAD that
|
|
207
|
+
* fails is asked again under the upload's budget as any request of it is;
|
|
208
|
+
* a session the server no longer holds throws `session_gone`, and a refusal
|
|
209
|
+
* Core decided its `upload_refused`.
|
|
210
|
+
*/
|
|
211
|
+
private readSessionStanding;
|
|
175
212
|
/**
|
|
176
213
|
* Read the offset a failed chunk should resume from, from the session's
|
|
177
214
|
* HEAD. At the full offset it proves receipt only, published or not, so the
|