@sparkvault/sdk-js 11.1.13 → 11.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.
- package/dist/index.cjs +250 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +92 -8
- package/dist/index.mjs +250 -30
- 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/index.d.ts +7 -4
- package/dist/vaults/types.d.ts +41 -8
- package/dist/vaults/upload/api.d.ts +39 -2
- package/package.json +1 -1
package/dist/vaults/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ResolvedConfig } from '../config';
|
|
10
10
|
import { HttpClient } from '../http';
|
|
11
|
-
import type { CreateVaultOptions, Vault, UnsealedVault, VaultPage, ListVaultsOptions, VaultDetail, UpdatedVault, VaultSharingConfig, VaultSharingOptions, AccessLogRetention, VaultUploadSettings, UpdateVaultUploadOptions } from './types';
|
|
11
|
+
import type { CreateVaultOptions, Vault, UnsealedVault, VaultPage, ListVaultsOptions, VaultDetail, ScheduledVaultDeletion, UpdatedVault, VaultSharingConfig, VaultSharingOptions, AccessLogRetention, VaultUploadSettings, UpdateVaultUploadOptions } from './types';
|
|
12
12
|
import { type UploadOptions, type UploadAttachOptions, type UploadResult } from './upload';
|
|
13
13
|
/**
|
|
14
14
|
* Callable upload interface with methods.
|
|
@@ -100,7 +100,8 @@ export declare class VaultsModule {
|
|
|
100
100
|
*/
|
|
101
101
|
seal(vaultId: string): Promise<void>;
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Schedule permanent deletion in seven days and immediately lock all vault access.
|
|
104
|
+
* Company admins only; cancelDeletion can abort this schedule before its deadline.
|
|
104
105
|
*
|
|
105
106
|
* Requires the vault's exact name as confirmation, matched case-sensitively.
|
|
106
107
|
* The name is sent base64(UTF-8) as the `X-Confirm-Name-B64` header so a vault
|
|
@@ -110,7 +111,9 @@ export declare class VaultsModule {
|
|
|
110
111
|
* @example
|
|
111
112
|
* await sv.vaults.delete('vlt_abc', 'My Vault');
|
|
112
113
|
*/
|
|
113
|
-
delete(vaultId: string, name: string): Promise<
|
|
114
|
+
delete(vaultId: string, name: string): Promise<ScheduledVaultDeletion>;
|
|
115
|
+
/** Cancel this exact deletion schedule before its deadline; company admins only. */
|
|
116
|
+
cancelDeletion(vaultId: string, deletionScheduleId: string): Promise<VaultDetail>;
|
|
114
117
|
/**
|
|
115
118
|
* Get a vault's public-sharing configuration.
|
|
116
119
|
*
|
|
@@ -206,6 +209,6 @@ export declare class VaultsModule {
|
|
|
206
209
|
private toggleUploadChannel;
|
|
207
210
|
private validateCreateOptions;
|
|
208
211
|
}
|
|
209
|
-
export type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, VaultPage, ListVaultsOptions, VaultDetail, UpdatedVault, VaultSharingConfig, VaultSharingOptions, AccessLogRetention, VaultUploadSettings, UpdateVaultUploadOptions, } from './types';
|
|
212
|
+
export type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, VaultPage, ListVaultsOptions, VaultDetail, VaultLifecycle, ScheduledVaultDeletion, UpdatedVault, VaultSharingConfig, VaultSharingOptions, AccessLogRetention, VaultUploadSettings, UpdateVaultUploadOptions, } from './types';
|
|
210
213
|
export type { UploadOptions, UploadAttachOptions, UploadResult, UploadProgress, VaultUploadConfig, UploadBranding, } from './upload';
|
|
211
214
|
export { VaultUploadModule } from './upload';
|
package/dist/vaults/types.d.ts
CHANGED
|
@@ -27,7 +27,27 @@ export interface UnsealedVault {
|
|
|
27
27
|
/** VAT lifetime in seconds */
|
|
28
28
|
ttlSeconds: number;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
/** Lifecycle metadata, including the lockout and seven-day cancellation window. */
|
|
31
|
+
export interface VaultLifecycle {
|
|
32
|
+
/** sealed, unsealed, deletion_scheduled, or deleting */
|
|
33
|
+
status: string;
|
|
34
|
+
/** Unix seconds when deletion was requested */
|
|
35
|
+
deletionRequestedAt?: number;
|
|
36
|
+
/** Unix seconds after which deletion cannot be cancelled */
|
|
37
|
+
deletionScheduledFor?: number;
|
|
38
|
+
deletionRequestedBy?: string;
|
|
39
|
+
/** Pass this exact schedule to cancelDeletion. */
|
|
40
|
+
deletionScheduleId?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface ScheduledVaultDeletion {
|
|
43
|
+
id: string;
|
|
44
|
+
status: 'deletion_scheduled';
|
|
45
|
+
deletionRequestedAt: number;
|
|
46
|
+
deletionScheduledFor: number;
|
|
47
|
+
deletionRequestedBy: string;
|
|
48
|
+
deletionScheduleId: string;
|
|
49
|
+
}
|
|
50
|
+
export interface VaultSummary extends VaultLifecycle {
|
|
31
51
|
/** Vault ID */
|
|
32
52
|
id: string;
|
|
33
53
|
/** Vault name */
|
|
@@ -54,15 +74,13 @@ export interface VaultPage {
|
|
|
54
74
|
nextCursor?: string;
|
|
55
75
|
}
|
|
56
76
|
/** A single vault's detail, as returned by get. */
|
|
57
|
-
export interface VaultDetail {
|
|
77
|
+
export interface VaultDetail extends VaultLifecycle {
|
|
58
78
|
/** Vault ID */
|
|
59
79
|
id: string;
|
|
60
80
|
/** Vault name */
|
|
61
81
|
name: string;
|
|
62
82
|
/** Optional description */
|
|
63
83
|
description: string | null;
|
|
64
|
-
/** Sealed/unsealed status */
|
|
65
|
-
status: string;
|
|
66
84
|
/** Number of ingots */
|
|
67
85
|
ingotCount: number;
|
|
68
86
|
/** Total storage used in bytes */
|
|
@@ -151,21 +169,35 @@ export interface UnsealVaultResponse {
|
|
|
151
169
|
expires_at: number;
|
|
152
170
|
ttl_seconds: number;
|
|
153
171
|
}
|
|
172
|
+
interface VaultLifecycleResponse {
|
|
173
|
+
status: string;
|
|
174
|
+
deletion_requested_at?: number;
|
|
175
|
+
deletion_scheduled_for?: number;
|
|
176
|
+
deletion_requested_by?: string;
|
|
177
|
+
deletion_schedule_id?: string;
|
|
178
|
+
}
|
|
179
|
+
export interface ScheduleVaultDeletionResponse {
|
|
180
|
+
vault_id: string;
|
|
181
|
+
status: 'deletion_scheduled';
|
|
182
|
+
deletion_requested_at: number;
|
|
183
|
+
deletion_scheduled_for: number;
|
|
184
|
+
deletion_requested_by: string;
|
|
185
|
+
deletion_schedule_id: string;
|
|
186
|
+
}
|
|
154
187
|
export interface ListVaultsResponse {
|
|
155
|
-
vaults: {
|
|
188
|
+
vaults: (VaultLifecycleResponse & {
|
|
156
189
|
vault_id: string;
|
|
157
190
|
name: string;
|
|
158
191
|
created_at: number;
|
|
159
192
|
ingot_count: number;
|
|
160
193
|
storage_bytes: number;
|
|
161
|
-
}[];
|
|
194
|
+
})[];
|
|
162
195
|
next_cursor?: string;
|
|
163
196
|
}
|
|
164
|
-
export interface VaultDetailResponse {
|
|
197
|
+
export interface VaultDetailResponse extends VaultLifecycleResponse {
|
|
165
198
|
vault_id: string;
|
|
166
199
|
name: string;
|
|
167
200
|
description?: string | null;
|
|
168
|
-
status: string;
|
|
169
201
|
ingot_count?: number;
|
|
170
202
|
storage_bytes?: number;
|
|
171
203
|
created_at: number;
|
|
@@ -207,3 +239,4 @@ export interface UploadChannelToggleResponse {
|
|
|
207
239
|
disabled_at?: number;
|
|
208
240
|
portal_url?: string;
|
|
209
241
|
}
|
|
242
|
+
export {};
|
|
@@ -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
|