@sparkvault/sdk-js 11.2.3 → 11.2.5

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.
@@ -45,10 +45,13 @@ export declare class IngotsModule {
45
45
  * no longer holds (it expired, was cancelled, or its ingot was removed)
46
46
  * rejects with code `session_gone`, and only a new upload session — a new
47
47
  * {@link createUpload}, or {@link upload} again — can store the file. An
48
- * upload the server refused for good (the account's storage pool cannot
49
- * take it, or a later upload replaced it) rejects with code
50
- * `upload_refused`, its message the server's own sentence and its code in
51
- * `details.coreCode`: a new upload is no remedy. A publication the server
48
+ * upload the server refused (the account's storage pool cannot take it, a
49
+ * later upload replaced it, or its vault is scheduled for deletion: a 409
50
+ * `VAULT_DELETION_SCHEDULED`, whose session the server keeps until the
51
+ * deletion runs or is cancelled, or the session lapses on its own) rejects
52
+ * at once with code `upload_refused`, its message the server's own sentence
53
+ * and its code in `details.coreCode`: a new upload is no remedy. A
54
+ * publication the server
52
55
  * still defers at the transfer's idle limit rejects with code
53
56
  * `upload_received_publishing`: every byte is received, and the server
54
57
  * finishes the publication on its own, so never upload the file again; a
@@ -78,8 +81,11 @@ export declare class IngotsModule {
78
81
  *
79
82
  * It rejects as {@link sendUpload} does: `session_gone` once the server no
80
83
  * longer holds the session (it expired, was cancelled, or ended when the
81
- * server refused to publish it), `upload_refused` for an upload refused for
82
- * good, `upload_received_publishing` again for a publication the server
84
+ * server refused to publish it), `upload_refused` for an upload the server
85
+ * refused (its storage pool, a later upload, or its vault scheduled for
86
+ * deletion, a 409 `VAULT_DELETION_SCHEDULED` that keeps the session, so a
87
+ * resume once the deletion is cancelled goes on while the session stands),
88
+ * `upload_received_publishing` again for a publication the server
83
89
  * still defers at the transfer's idle limit, which leaves the session to
84
90
  * resume again later. A session URL that is not an upload session on an
85
91
  * allowed transfer host is refused (`invalid_forge_url`), and one whose
@@ -111,9 +117,10 @@ export declare class IngotsModule {
111
117
  *
112
118
  * Creates the upload session, streams the file to Forge over TUS, then
113
119
  * confirms the server finalized the upload before resolving. A file the
114
- * server refused for good — another upload of it superseded this one, at
115
- * its create or while it streamed, or the storage pool cannot take it —
116
- * rejects with code `upload_refused`, as {@link sendUpload} does.
120
+ * server refused — another upload of it superseded this one, at its create
121
+ * or while it streamed, the storage pool cannot take it, or its vault is
122
+ * scheduled for deletion (a 409 `VAULT_DELETION_SCHEDULED`) — rejects with
123
+ * code `upload_refused`, as {@link sendUpload} does.
117
124
  *
118
125
  * @example
119
126
  * const ingot = await sv.ingots.upload(unsealed, {
@@ -213,8 +220,14 @@ export declare class IngotsModule {
213
220
  * and a link that is not a Forge decrypt URL on an allowed host, is final.
214
221
  *
215
222
  * @example
223
+ * const ingot = await sv.ingots.get(unsealed, 'ing_abc');
216
224
  * const blob = await sv.ingots.download(unsealed, 'ing_abc');
217
- * const url = URL.createObjectURL(blob);
225
+ * // Saved under the name Forge would send, as opaque bytes, which no
226
+ * // browser renames by a type (see Ingot.downloadFilename).
227
+ * const link = document.createElement('a');
228
+ * link.href = URL.createObjectURL(new Blob([blob], { type: 'application/octet-stream' }));
229
+ * link.download = ingot.downloadFilename;
230
+ * link.click();
218
231
  */
219
232
  download(vault: UnsealedVault, ingotId: string): Promise<Blob>;
220
233
  /**
@@ -32,6 +32,22 @@ export interface Ingot {
32
32
  id: string;
33
33
  /** Ingot name */
34
34
  name: string;
35
+ /**
36
+ * The name a download of the ingot saves under, as Forge names it: `name`,
37
+ * kept as it is when the first word of the extension it shows (up to an
38
+ * ASCII space, in any case) is one the MIME registry knows or holds a
39
+ * character none of the registry's extensions is spelled with, which may
40
+ * draw as one, and otherwise completed with the first extension the
41
+ * registry lists for `contentType`, never one a saved copy must never open
42
+ * as. Save a copy under it, handed to a browser as
43
+ * `application/octet-stream` unless `contentType` is a raster image, audio,
44
+ * video or PDF format (never SVG, a playlist or a stream redirector): a
45
+ * browser renames a saved copy by the type it is handed (Chrome saves
46
+ * `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
47
+ * completes or replaces no extension of a copy handed as
48
+ * `application/octet-stream`.
49
+ */
50
+ downloadFilename: string;
35
51
  /** Content type (MIME) */
36
52
  contentType: string;
37
53
  /** Size in bytes */
@@ -323,6 +339,7 @@ export interface AccessLogsOptions {
323
339
  export interface IngotWire {
324
340
  ingot_id: string;
325
341
  name: string;
342
+ download_filename: string;
326
343
  content_type: string;
327
344
  size_bytes: number;
328
345
  status?: Ingot['status'];
@@ -46,6 +46,22 @@ export interface Spark {
46
46
  burnedAt: number;
47
47
  /** Optional file name (for file payloads) */
48
48
  filename?: string;
49
+ /**
50
+ * The name the payload saves under: `filename`, or `download` for a spark
51
+ * with none, kept as it is when the first word of the extension it shows
52
+ * (up to an ASCII space, in any case) is one the MIME registry knows or
53
+ * holds a character none of the registry's extensions is spelled with,
54
+ * which may draw as one, and otherwise completed with the first extension
55
+ * the registry lists for `contentType`, never one a saved copy must never
56
+ * open as. Save a copy under it, handed to a browser as
57
+ * `application/octet-stream` unless `contentType` is a raster image, audio,
58
+ * video or PDF format (never SVG, a playlist or a stream redirector): a
59
+ * browser renames a saved copy by the type it is handed (Chrome saves
60
+ * `Invoice` typed `application/x-msdownload` as `Invoice.exe`), and
61
+ * completes or replaces no extension of a copy handed as
62
+ * `application/octet-stream`.
63
+ */
64
+ downloadFilename: string;
49
65
  }
50
66
  /** A newly created spark. */
51
67
  export interface CreatedSpark {
@@ -155,6 +171,7 @@ export interface SparkResponse {
155
171
  created_at: number;
156
172
  burned_at: number;
157
173
  filename?: string;
174
+ download_filename: string;
158
175
  }
159
176
  export interface CreateSparkResponse {
160
177
  spark_id: string;