@sequenceholdings/storage 0.1.1 → 0.1.3
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/README.md +9 -1
- package/dist/client.d.ts +2 -529
- package/dist/client.js +16 -320
- package/dist/contracts.d.ts +2 -362
- package/dist/contracts.js +16 -230
- package/dist/crc32c.d.ts +2 -11
- package/dist/crc32c.js +16 -74
- package/dist/index.d.ts +2 -6
- package/dist/index.js +2 -6
- package/dist/paths.d.ts +2 -4
- package/dist/paths.js +16 -26
- package/dist/scope.d.ts +2 -15
- package/dist/scope.js +16 -40
- package/dist/transfer.d.ts +2 -34
- package/dist/transfer.js +16 -254
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Atlas storage client
|
|
2
2
|
|
|
3
3
|
Typed Workspaces V2 metadata and direct-to-GCS sequential resumable transfers.
|
|
4
|
-
|
|
4
|
+
Preview. See the public Workspaces V2 developer documentation.
|
|
5
5
|
|
|
6
6
|
```ts
|
|
7
7
|
import { createStorageClient } from '@sequenceholdings/storage'
|
|
@@ -102,3 +102,11 @@ host and `storage.googleapis.com`. Delegation expires shortly after the function
|
|
|
102
102
|
For local integration use the normal local Atlas environment, `seq-studio storage`
|
|
103
103
|
and `functions deploy -e local`. File references in ORM remain application-owned;
|
|
104
104
|
there is no automatic row-to-file authorization or deletion cascade.
|
|
105
|
+
|
|
106
|
+
## Shared Platform runtime
|
|
107
|
+
|
|
108
|
+
`@sequenceholdings/storage` retains its existing runtime exports as compatibility adapters over
|
|
109
|
+
`@sequenceholdings/platform/storage`. Runtime contracts, clients and transport live in the shared
|
|
110
|
+
package; primitive authoring/build responsibilities remain here. The coordinated
|
|
111
|
+
release is prepared and unpublished. Build and publish Platform before this
|
|
112
|
+
package and update downstream consumer lockfiles together.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,529 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { type StorageUploadSource, type StorageTransferOptions } from './transfer.js';
|
|
4
|
-
export declare const STORAGE_TOKEN_HEADER = "x-sequence-storage-token";
|
|
5
|
-
export declare const STORAGE_SERVICE_TOKEN_HEADER = "x-sequence-storage-token-service";
|
|
6
|
-
export interface StorageTransport {
|
|
7
|
-
request(method: string, path: string, body?: unknown): Promise<unknown>;
|
|
8
|
-
}
|
|
9
|
-
export interface StorageListOptions {
|
|
10
|
-
cursor?: string;
|
|
11
|
-
limit?: number;
|
|
12
|
-
q?: string;
|
|
13
|
-
sort?: 'name' | 'newest';
|
|
14
|
-
}
|
|
15
|
-
export declare class StorageApiError extends Error {
|
|
16
|
-
readonly status: number;
|
|
17
|
-
readonly code: string;
|
|
18
|
-
constructor(status: number, code: string, message: string);
|
|
19
|
-
}
|
|
20
|
-
/** Backoff for replay-safe requests (see `replayable`). */
|
|
21
|
-
export interface StoragePermissionsRetry {
|
|
22
|
-
/** Total attempts including the first; 1 disables retrying. */
|
|
23
|
-
attempts?: number;
|
|
24
|
-
/** Ceiling of the first backoff; each later retry doubles it. */
|
|
25
|
-
baseDelayMs?: number;
|
|
26
|
-
}
|
|
27
|
-
export declare const storageDownloadSchema: z.ZodObject<{
|
|
28
|
-
url: z.ZodURL;
|
|
29
|
-
expiresAt: z.ZodString;
|
|
30
|
-
preview: z.ZodBoolean;
|
|
31
|
-
}, z.core.$strip>;
|
|
32
|
-
/** Supply a transport for an Artifact bridge, or use createStorageClient for HTTP. */
|
|
33
|
-
export declare function storageClient(transport: StorageTransport, { permissionsRetry, }?: {
|
|
34
|
-
permissionsRetry?: StoragePermissionsRetry;
|
|
35
|
-
}): {
|
|
36
|
-
capabilities: () => Promise<{
|
|
37
|
-
canProvision: boolean;
|
|
38
|
-
uploadMethods: string[];
|
|
39
|
-
pendingUploads: {
|
|
40
|
-
perPrincipal: number;
|
|
41
|
-
perWorkspace: number;
|
|
42
|
-
};
|
|
43
|
-
uploadBatchLimit: number;
|
|
44
|
-
importConcurrency: {
|
|
45
|
-
default: number;
|
|
46
|
-
max: number;
|
|
47
|
-
};
|
|
48
|
-
}>;
|
|
49
|
-
list: (options?: StorageListOptions) => Promise<{
|
|
50
|
-
items: {
|
|
51
|
-
id: string;
|
|
52
|
-
name: string;
|
|
53
|
-
description: string;
|
|
54
|
-
environment: string;
|
|
55
|
-
state: "active" | "trashed" | "purging";
|
|
56
|
-
revision: number;
|
|
57
|
-
createdAt: string;
|
|
58
|
-
role: "viewer" | "editor" | "admin" | "owner";
|
|
59
|
-
quotaBytes: number;
|
|
60
|
-
usedBytes: number;
|
|
61
|
-
reservedBytes: number;
|
|
62
|
-
}[];
|
|
63
|
-
nextCursor: string | null;
|
|
64
|
-
}>;
|
|
65
|
-
shared: (options?: StorageListOptions & {
|
|
66
|
-
trash?: boolean;
|
|
67
|
-
}) => Promise<{
|
|
68
|
-
items: {
|
|
69
|
-
id: string;
|
|
70
|
-
workspaceId: string;
|
|
71
|
-
parentId: string | null;
|
|
72
|
-
name: string;
|
|
73
|
-
kind: "file" | "folder";
|
|
74
|
-
state: "active" | "trashed" | "purging";
|
|
75
|
-
restricted: boolean;
|
|
76
|
-
revision: number;
|
|
77
|
-
currentVersionId: string | null;
|
|
78
|
-
metadata: Record<string, string>;
|
|
79
|
-
createdAt: string;
|
|
80
|
-
updatedAt: string;
|
|
81
|
-
role: "viewer" | "editor" | "admin";
|
|
82
|
-
size: number | null;
|
|
83
|
-
contentType: string | null;
|
|
84
|
-
}[];
|
|
85
|
-
nextCursor: string | null;
|
|
86
|
-
}>;
|
|
87
|
-
apply: (manifest: WorkspaceManifest) => Promise<{
|
|
88
|
-
id: string;
|
|
89
|
-
name: string;
|
|
90
|
-
description: string;
|
|
91
|
-
environment: string;
|
|
92
|
-
state: "active" | "trashed" | "purging";
|
|
93
|
-
revision: number;
|
|
94
|
-
createdAt: string;
|
|
95
|
-
role: "viewer" | "editor" | "admin" | "owner";
|
|
96
|
-
quotaBytes: number;
|
|
97
|
-
usedBytes: number;
|
|
98
|
-
reservedBytes: number;
|
|
99
|
-
}>;
|
|
100
|
-
workspace(id: string): {
|
|
101
|
-
get: () => Promise<{
|
|
102
|
-
id: string;
|
|
103
|
-
name: string;
|
|
104
|
-
description: string;
|
|
105
|
-
environment: string;
|
|
106
|
-
state: "active" | "trashed" | "purging";
|
|
107
|
-
revision: number;
|
|
108
|
-
createdAt: string;
|
|
109
|
-
role: "viewer" | "editor" | "admin" | "owner";
|
|
110
|
-
quotaBytes: number;
|
|
111
|
-
usedBytes: number;
|
|
112
|
-
reservedBytes: number;
|
|
113
|
-
}>;
|
|
114
|
-
delete: (expectedRevision: number) => Promise<{
|
|
115
|
-
id: string;
|
|
116
|
-
workspaceId: string;
|
|
117
|
-
targetId: string | null;
|
|
118
|
-
kind: "purge" | "delete_version";
|
|
119
|
-
status: "queued" | "running" | "succeeded" | "failed";
|
|
120
|
-
completed: number;
|
|
121
|
-
total: number;
|
|
122
|
-
error: string | null;
|
|
123
|
-
createdAt: string;
|
|
124
|
-
updatedAt: string;
|
|
125
|
-
canRetry: boolean;
|
|
126
|
-
}>;
|
|
127
|
-
list: (options?: StorageListOptions & {
|
|
128
|
-
parentId?: string | null;
|
|
129
|
-
trash?: boolean;
|
|
130
|
-
}) => Promise<{
|
|
131
|
-
items: {
|
|
132
|
-
id: string;
|
|
133
|
-
workspaceId: string;
|
|
134
|
-
parentId: string | null;
|
|
135
|
-
name: string;
|
|
136
|
-
kind: "file" | "folder";
|
|
137
|
-
state: "active" | "trashed" | "purging";
|
|
138
|
-
restricted: boolean;
|
|
139
|
-
revision: number;
|
|
140
|
-
currentVersionId: string | null;
|
|
141
|
-
metadata: Record<string, string>;
|
|
142
|
-
createdAt: string;
|
|
143
|
-
updatedAt: string;
|
|
144
|
-
role: "viewer" | "editor" | "admin";
|
|
145
|
-
size: number | null;
|
|
146
|
-
contentType: string | null;
|
|
147
|
-
}[];
|
|
148
|
-
nextCursor: string | null;
|
|
149
|
-
}>;
|
|
150
|
-
getNode: (id: string) => Promise<{
|
|
151
|
-
id: string;
|
|
152
|
-
workspaceId: string;
|
|
153
|
-
parentId: string | null;
|
|
154
|
-
name: string;
|
|
155
|
-
kind: "file" | "folder";
|
|
156
|
-
state: "active" | "trashed" | "purging";
|
|
157
|
-
restricted: boolean;
|
|
158
|
-
revision: number;
|
|
159
|
-
currentVersionId: string | null;
|
|
160
|
-
metadata: Record<string, string>;
|
|
161
|
-
createdAt: string;
|
|
162
|
-
updatedAt: string;
|
|
163
|
-
role: "viewer" | "editor" | "admin";
|
|
164
|
-
size: number | null;
|
|
165
|
-
contentType: string | null;
|
|
166
|
-
}>;
|
|
167
|
-
/**
|
|
168
|
-
* Keyed like upload start, so every resend (storage_busy,
|
|
169
|
-
* permissions_pending, a lost reply) returns the one folder it made.
|
|
170
|
-
* Pass `idempotencyKey` to extend that across your own retries.
|
|
171
|
-
*/
|
|
172
|
-
createFolder: (name: string, parentId?: string | null, { idempotencyKey, }?: {
|
|
173
|
-
idempotencyKey?: string;
|
|
174
|
-
}) => Promise<{
|
|
175
|
-
id: string;
|
|
176
|
-
workspaceId: string;
|
|
177
|
-
parentId: string | null;
|
|
178
|
-
name: string;
|
|
179
|
-
kind: "file" | "folder";
|
|
180
|
-
state: "active" | "trashed" | "purging";
|
|
181
|
-
restricted: boolean;
|
|
182
|
-
revision: number;
|
|
183
|
-
currentVersionId: string | null;
|
|
184
|
-
metadata: Record<string, string>;
|
|
185
|
-
createdAt: string;
|
|
186
|
-
updatedAt: string;
|
|
187
|
-
role: "viewer" | "editor" | "admin";
|
|
188
|
-
size: number | null;
|
|
189
|
-
contentType: string | null;
|
|
190
|
-
}>;
|
|
191
|
-
update: (id: string, input: z.input<typeof updateNodeSchema>) => Promise<{
|
|
192
|
-
id: string;
|
|
193
|
-
workspaceId: string;
|
|
194
|
-
parentId: string | null;
|
|
195
|
-
name: string;
|
|
196
|
-
kind: "file" | "folder";
|
|
197
|
-
state: "active" | "trashed" | "purging";
|
|
198
|
-
restricted: boolean;
|
|
199
|
-
revision: number;
|
|
200
|
-
currentVersionId: string | null;
|
|
201
|
-
metadata: Record<string, string>;
|
|
202
|
-
createdAt: string;
|
|
203
|
-
updatedAt: string;
|
|
204
|
-
role: "viewer" | "editor" | "admin";
|
|
205
|
-
size: number | null;
|
|
206
|
-
contentType: string | null;
|
|
207
|
-
}>;
|
|
208
|
-
trash: (id: string, expectedRevision: number) => Promise<{
|
|
209
|
-
id: string;
|
|
210
|
-
workspaceId: string;
|
|
211
|
-
parentId: string | null;
|
|
212
|
-
name: string;
|
|
213
|
-
kind: "file" | "folder";
|
|
214
|
-
state: "active" | "trashed" | "purging";
|
|
215
|
-
restricted: boolean;
|
|
216
|
-
revision: number;
|
|
217
|
-
currentVersionId: string | null;
|
|
218
|
-
metadata: Record<string, string>;
|
|
219
|
-
createdAt: string;
|
|
220
|
-
updatedAt: string;
|
|
221
|
-
role: "viewer" | "editor" | "admin";
|
|
222
|
-
size: number | null;
|
|
223
|
-
contentType: string | null;
|
|
224
|
-
}>;
|
|
225
|
-
restore: (id: string, expectedRevision: number) => Promise<{
|
|
226
|
-
id: string;
|
|
227
|
-
workspaceId: string;
|
|
228
|
-
parentId: string | null;
|
|
229
|
-
name: string;
|
|
230
|
-
kind: "file" | "folder";
|
|
231
|
-
state: "active" | "trashed" | "purging";
|
|
232
|
-
restricted: boolean;
|
|
233
|
-
revision: number;
|
|
234
|
-
currentVersionId: string | null;
|
|
235
|
-
metadata: Record<string, string>;
|
|
236
|
-
createdAt: string;
|
|
237
|
-
updatedAt: string;
|
|
238
|
-
role: "viewer" | "editor" | "admin";
|
|
239
|
-
size: number | null;
|
|
240
|
-
contentType: string | null;
|
|
241
|
-
}>;
|
|
242
|
-
purge: (id: string, expectedRevision: number) => Promise<{
|
|
243
|
-
id: string;
|
|
244
|
-
workspaceId: string;
|
|
245
|
-
targetId: string | null;
|
|
246
|
-
kind: "purge" | "delete_version";
|
|
247
|
-
status: "queued" | "running" | "succeeded" | "failed";
|
|
248
|
-
completed: number;
|
|
249
|
-
total: number;
|
|
250
|
-
error: string | null;
|
|
251
|
-
createdAt: string;
|
|
252
|
-
updatedAt: string;
|
|
253
|
-
canRetry: boolean;
|
|
254
|
-
}>;
|
|
255
|
-
download: (id: string, options?: {
|
|
256
|
-
versionId?: string;
|
|
257
|
-
preview?: boolean;
|
|
258
|
-
}) => Promise<{
|
|
259
|
-
url: string;
|
|
260
|
-
expiresAt: string;
|
|
261
|
-
preview: boolean;
|
|
262
|
-
}>;
|
|
263
|
-
versions: (id: string, options?: {
|
|
264
|
-
before?: number;
|
|
265
|
-
limit?: number;
|
|
266
|
-
}) => Promise<{
|
|
267
|
-
items: {
|
|
268
|
-
id: string;
|
|
269
|
-
fileId: string;
|
|
270
|
-
revision: number;
|
|
271
|
-
size: number;
|
|
272
|
-
checksum: string;
|
|
273
|
-
contentType: string;
|
|
274
|
-
createdAt: string;
|
|
275
|
-
createdBy: string;
|
|
276
|
-
state: "active" | "purging";
|
|
277
|
-
}[];
|
|
278
|
-
nextRevision: number | null;
|
|
279
|
-
}>;
|
|
280
|
-
restoreVersion: (id: string, versionId: string, expectedRevision: number) => Promise<{
|
|
281
|
-
id: string;
|
|
282
|
-
fileId: string;
|
|
283
|
-
revision: number;
|
|
284
|
-
size: number;
|
|
285
|
-
checksum: string;
|
|
286
|
-
contentType: string;
|
|
287
|
-
createdAt: string;
|
|
288
|
-
createdBy: string;
|
|
289
|
-
state: "active" | "purging";
|
|
290
|
-
}>;
|
|
291
|
-
deleteVersion: (id: string, versionId: string, expectedRevision: number) => Promise<{
|
|
292
|
-
id: string;
|
|
293
|
-
workspaceId: string;
|
|
294
|
-
targetId: string | null;
|
|
295
|
-
kind: "purge" | "delete_version";
|
|
296
|
-
status: "queued" | "running" | "succeeded" | "failed";
|
|
297
|
-
completed: number;
|
|
298
|
-
total: number;
|
|
299
|
-
error: string | null;
|
|
300
|
-
createdAt: string;
|
|
301
|
-
updatedAt: string;
|
|
302
|
-
canRetry: boolean;
|
|
303
|
-
}>;
|
|
304
|
-
access: (id?: string) => Promise<{
|
|
305
|
-
revision: number;
|
|
306
|
-
restricted: boolean;
|
|
307
|
-
grants: {
|
|
308
|
-
type: "user" | "group" | "organization" | "service_account";
|
|
309
|
-
id: string;
|
|
310
|
-
role: "viewer" | "editor" | "admin";
|
|
311
|
-
}[];
|
|
312
|
-
owner: string | null;
|
|
313
|
-
inherited: boolean;
|
|
314
|
-
workspaceAdminOverride: true;
|
|
315
|
-
displayNames: Record<string, string>;
|
|
316
|
-
}>;
|
|
317
|
-
setAccess: (input: z.input<typeof updateStorageAccessSchema>, id?: string) => Promise<{
|
|
318
|
-
revision: number;
|
|
319
|
-
restricted: boolean;
|
|
320
|
-
grants: {
|
|
321
|
-
type: "user" | "group" | "organization" | "service_account";
|
|
322
|
-
id: string;
|
|
323
|
-
role: "viewer" | "editor" | "admin";
|
|
324
|
-
}[];
|
|
325
|
-
owner: string | null;
|
|
326
|
-
inherited: boolean;
|
|
327
|
-
workspaceAdminOverride: true;
|
|
328
|
-
displayNames: Record<string, string>;
|
|
329
|
-
}>;
|
|
330
|
-
transferOwner: (principal: {
|
|
331
|
-
type: "user" | "service_account";
|
|
332
|
-
id: string;
|
|
333
|
-
}, expectedRevision: number) => Promise<{
|
|
334
|
-
revision: number;
|
|
335
|
-
restricted: boolean;
|
|
336
|
-
grants: {
|
|
337
|
-
type: "user" | "group" | "organization" | "service_account";
|
|
338
|
-
id: string;
|
|
339
|
-
role: "viewer" | "editor" | "admin";
|
|
340
|
-
}[];
|
|
341
|
-
owner: string | null;
|
|
342
|
-
inherited: boolean;
|
|
343
|
-
workspaceAdminOverride: true;
|
|
344
|
-
displayNames: Record<string, string>;
|
|
345
|
-
}>;
|
|
346
|
-
operations: (options?: {
|
|
347
|
-
before?: string;
|
|
348
|
-
limit?: number;
|
|
349
|
-
scope?: StorageOperationScope;
|
|
350
|
-
}) => Promise<{
|
|
351
|
-
items: {
|
|
352
|
-
id: string;
|
|
353
|
-
workspaceId: string;
|
|
354
|
-
targetId: string | null;
|
|
355
|
-
kind: "purge" | "delete_version";
|
|
356
|
-
status: "queued" | "running" | "succeeded" | "failed";
|
|
357
|
-
completed: number;
|
|
358
|
-
total: number;
|
|
359
|
-
error: string | null;
|
|
360
|
-
createdAt: string;
|
|
361
|
-
updatedAt: string;
|
|
362
|
-
canRetry: boolean;
|
|
363
|
-
}[];
|
|
364
|
-
nextCursor: string | null;
|
|
365
|
-
}>;
|
|
366
|
-
retryOperation: (id: string) => Promise<{
|
|
367
|
-
id: string;
|
|
368
|
-
workspaceId: string;
|
|
369
|
-
targetId: string | null;
|
|
370
|
-
kind: "purge" | "delete_version";
|
|
371
|
-
status: "queued" | "running" | "succeeded" | "failed";
|
|
372
|
-
completed: number;
|
|
373
|
-
total: number;
|
|
374
|
-
error: string | null;
|
|
375
|
-
createdAt: string;
|
|
376
|
-
updatedAt: string;
|
|
377
|
-
canRetry: boolean;
|
|
378
|
-
}>;
|
|
379
|
-
uploads: {
|
|
380
|
-
start: (input: StartStorageUpload) => Promise<{
|
|
381
|
-
id: string;
|
|
382
|
-
fileId: string;
|
|
383
|
-
uploadUrl: string | null;
|
|
384
|
-
expiresAt: string;
|
|
385
|
-
state: "pending" | "complete" | "aborted";
|
|
386
|
-
versionId: string | null;
|
|
387
|
-
maxBytes: number;
|
|
388
|
-
}>;
|
|
389
|
-
get: (id: string) => Promise<{
|
|
390
|
-
id: string;
|
|
391
|
-
fileId: string;
|
|
392
|
-
uploadUrl: string | null;
|
|
393
|
-
expiresAt: string;
|
|
394
|
-
state: "pending" | "complete" | "aborted";
|
|
395
|
-
versionId: string | null;
|
|
396
|
-
maxBytes: number;
|
|
397
|
-
}>;
|
|
398
|
-
/** `resume` passes the CRC32C it computed; pass your own when transferring bytes yourself. */
|
|
399
|
-
complete: (id: string, input?: CompleteStorageUpload) => Promise<{
|
|
400
|
-
id: string;
|
|
401
|
-
fileId: string;
|
|
402
|
-
uploadUrl: string | null;
|
|
403
|
-
expiresAt: string;
|
|
404
|
-
state: "pending" | "complete" | "aborted";
|
|
405
|
-
versionId: string | null;
|
|
406
|
-
maxBytes: number;
|
|
407
|
-
}>;
|
|
408
|
-
abort: (id: string) => Promise<{
|
|
409
|
-
id: string;
|
|
410
|
-
fileId: string;
|
|
411
|
-
uploadUrl: string | null;
|
|
412
|
-
expiresAt: string;
|
|
413
|
-
state: "pending" | "complete" | "aborted";
|
|
414
|
-
versionId: string | null;
|
|
415
|
-
maxBytes: number;
|
|
416
|
-
}>;
|
|
417
|
-
startBatch: (items: StartStorageUpload[]) => Promise<{
|
|
418
|
-
items: {
|
|
419
|
-
id: string;
|
|
420
|
-
fileId: string;
|
|
421
|
-
uploadUrl: string | null;
|
|
422
|
-
expiresAt: string;
|
|
423
|
-
state: "pending" | "complete" | "aborted";
|
|
424
|
-
versionId: string | null;
|
|
425
|
-
maxBytes: number;
|
|
426
|
-
}[];
|
|
427
|
-
}>;
|
|
428
|
-
list: () => Promise<{
|
|
429
|
-
items: {
|
|
430
|
-
id: string;
|
|
431
|
-
fileId: string;
|
|
432
|
-
name: string;
|
|
433
|
-
state: "pending" | "complete" | "aborted";
|
|
434
|
-
expiresAt: string;
|
|
435
|
-
maxBytes: number;
|
|
436
|
-
expectedSize: number | null;
|
|
437
|
-
versionId: string | null;
|
|
438
|
-
}[];
|
|
439
|
-
limits: {
|
|
440
|
-
perPrincipal: number;
|
|
441
|
-
perWorkspace: number;
|
|
442
|
-
};
|
|
443
|
-
}>;
|
|
444
|
-
reconcile: (input?: {
|
|
445
|
-
abortIncomplete?: boolean;
|
|
446
|
-
}) => Promise<{
|
|
447
|
-
completed: {
|
|
448
|
-
id: string;
|
|
449
|
-
fileId: string;
|
|
450
|
-
name: string;
|
|
451
|
-
state: "pending" | "complete" | "aborted";
|
|
452
|
-
expiresAt: string;
|
|
453
|
-
maxBytes: number;
|
|
454
|
-
expectedSize: number | null;
|
|
455
|
-
versionId: string | null;
|
|
456
|
-
code: string;
|
|
457
|
-
message: string;
|
|
458
|
-
}[];
|
|
459
|
-
aborted: {
|
|
460
|
-
id: string;
|
|
461
|
-
fileId: string;
|
|
462
|
-
name: string;
|
|
463
|
-
state: "pending" | "complete" | "aborted";
|
|
464
|
-
expiresAt: string;
|
|
465
|
-
maxBytes: number;
|
|
466
|
-
expectedSize: number | null;
|
|
467
|
-
versionId: string | null;
|
|
468
|
-
code: string;
|
|
469
|
-
message: string;
|
|
470
|
-
}[];
|
|
471
|
-
pending: {
|
|
472
|
-
id: string;
|
|
473
|
-
fileId: string;
|
|
474
|
-
name: string;
|
|
475
|
-
state: "pending" | "complete" | "aborted";
|
|
476
|
-
expiresAt: string;
|
|
477
|
-
maxBytes: number;
|
|
478
|
-
expectedSize: number | null;
|
|
479
|
-
versionId: string | null;
|
|
480
|
-
code: string;
|
|
481
|
-
message: string;
|
|
482
|
-
}[];
|
|
483
|
-
}>;
|
|
484
|
-
resume(id: string, source: StorageUploadSource, options?: StorageTransferOptions & {
|
|
485
|
-
size?: number;
|
|
486
|
-
}): Promise<{
|
|
487
|
-
id: string;
|
|
488
|
-
fileId: string;
|
|
489
|
-
uploadUrl: string | null;
|
|
490
|
-
expiresAt: string;
|
|
491
|
-
state: "pending" | "complete" | "aborted";
|
|
492
|
-
versionId: string | null;
|
|
493
|
-
maxBytes: number;
|
|
494
|
-
}>;
|
|
495
|
-
/**
|
|
496
|
-
* Start, transfer and complete in one call. A failure after the session
|
|
497
|
-
* starts aborts it (best effort) to release its reservation; pass
|
|
498
|
-
* `keepSessionOnFailure` to keep it for a manual `resume`.
|
|
499
|
-
*/
|
|
500
|
-
put(input: Omit<StartStorageUpload, "idempotencyKey"> & {
|
|
501
|
-
/** Defaults to a fresh key per put, reused across its start retries. */
|
|
502
|
-
idempotencyKey?: string;
|
|
503
|
-
}, source: StorageUploadSource, { keepSessionOnFailure, ...options }?: StorageTransferOptions & {
|
|
504
|
-
keepSessionOnFailure?: boolean;
|
|
505
|
-
}): Promise<{
|
|
506
|
-
id: string;
|
|
507
|
-
fileId: string;
|
|
508
|
-
uploadUrl: string | null;
|
|
509
|
-
expiresAt: string;
|
|
510
|
-
state: "pending" | "complete" | "aborted";
|
|
511
|
-
versionId: string | null;
|
|
512
|
-
maxBytes: number;
|
|
513
|
-
}>;
|
|
514
|
-
};
|
|
515
|
-
};
|
|
516
|
-
};
|
|
517
|
-
export type StorageClient = ReturnType<typeof storageClient>;
|
|
518
|
-
export declare function createStorageClient({ baseUrl, getToken, getHeaders, fetch: fetcher, permissionsRetry, requestTimeoutMs, }: {
|
|
519
|
-
baseUrl: string;
|
|
520
|
-
getToken?: () => string | Promise<string>;
|
|
521
|
-
getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
522
|
-
fetch?: typeof fetch;
|
|
523
|
-
permissionsRetry?: StoragePermissionsRetry;
|
|
524
|
-
/**
|
|
525
|
-
* Per metadata request, including reading the reply; 0 disables it. Byte
|
|
526
|
-
* transfer goes to the provider directly and is not bounded by this.
|
|
527
|
-
*/
|
|
528
|
-
requestTimeoutMs?: number;
|
|
529
|
-
}): StorageClient;
|
|
1
|
+
/** Runtime compatibility export; implementation lives in the platform SDK. */
|
|
2
|
+
export * from "@sequenceholdings/platform/storage";
|