@siafoundation/sia-storage 0.1.2 → 0.1.4
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 +41 -3
- package/dist/{chunk-QYQQIWFH.js → chunk-YOMDUMYW.js} +7 -3
- package/dist/chunk-YOMDUMYW.js.map +1 -0
- package/dist/index.d.ts +59 -6
- package/dist/index.js +120 -29
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +40 -15
- package/dist/next.js +1 -1
- package/dist/sia-storage-sw.js +2 -2
- package/dist/stream-worker.js +111 -14
- package/dist/stream-worker.js.map +1 -1
- package/package.json +8 -7
- package/wasm/sia_storage_wasm.d.ts +61 -38
- package/wasm/sia_storage_wasm.js +141 -40
- package/wasm/sia_storage_wasm_bg.wasm +0 -0
- package/wasm/sia_storage_wasm_bg.wasm.d.ts +10 -4
- package/dist/chunk-QYQQIWFH.js.map +0 -1
|
@@ -31,14 +31,6 @@ export interface Slab {
|
|
|
31
31
|
sectors: Sector[];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface PinnedSlab {
|
|
35
|
-
version: number;
|
|
36
|
-
id: string;
|
|
37
|
-
encryptionKey: string;
|
|
38
|
-
minShards: number;
|
|
39
|
-
sectors: Sector[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
34
|
export interface Host {
|
|
43
35
|
publicKey: string;
|
|
44
36
|
addresses: { protocol: string; address: string }[];
|
|
@@ -66,20 +58,6 @@ export interface PackedUploadOptions {
|
|
|
66
58
|
}
|
|
67
59
|
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
interface Sdk {
|
|
71
|
-
download(object: PinnedObject, options?: DownloadOptions): ReadableStream;
|
|
72
|
-
upload(object: PinnedObject, source: ReadableStream, options?: UploadOptions): Promise<PinnedObject>;
|
|
73
|
-
uploadPacked(options?: PackedUploadOptions): PackedUpload;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
interface SharedSdk {
|
|
79
|
-
download(object: PinnedObject, options?: DownloadOptions): ReadableStream;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
61
|
/**
|
|
84
62
|
* Application info registered with the indexer.
|
|
85
63
|
*/
|
|
@@ -273,7 +251,7 @@ export class Builder {
|
|
|
273
251
|
waitForApproval(): Promise<void>;
|
|
274
252
|
}
|
|
275
253
|
|
|
276
|
-
|
|
254
|
+
declare class IntoUnderlyingByteSource {
|
|
277
255
|
private constructor();
|
|
278
256
|
free(): void;
|
|
279
257
|
[Symbol.dispose](): void;
|
|
@@ -283,8 +261,9 @@ export class IntoUnderlyingByteSource {
|
|
|
283
261
|
readonly autoAllocateChunkSize: number;
|
|
284
262
|
readonly type: ReadableStreamType;
|
|
285
263
|
}
|
|
264
|
+
export type { IntoUnderlyingByteSource };
|
|
286
265
|
|
|
287
|
-
|
|
266
|
+
declare class IntoUnderlyingSink {
|
|
288
267
|
private constructor();
|
|
289
268
|
free(): void;
|
|
290
269
|
[Symbol.dispose](): void;
|
|
@@ -292,14 +271,16 @@ export class IntoUnderlyingSink {
|
|
|
292
271
|
close(): Promise<any>;
|
|
293
272
|
write(chunk: any): Promise<any>;
|
|
294
273
|
}
|
|
274
|
+
export type { IntoUnderlyingSink };
|
|
295
275
|
|
|
296
|
-
|
|
276
|
+
declare class IntoUnderlyingSource {
|
|
297
277
|
private constructor();
|
|
298
278
|
free(): void;
|
|
299
279
|
[Symbol.dispose](): void;
|
|
300
280
|
cancel(): void;
|
|
301
281
|
pull(controller: ReadableStreamDefaultController): Promise<any>;
|
|
302
282
|
}
|
|
283
|
+
export type { IntoUnderlyingSource };
|
|
303
284
|
|
|
304
285
|
/**
|
|
305
286
|
* The indexer's record for a sharing key, including how many objects it grants
|
|
@@ -341,6 +322,37 @@ export class ObjectEvent {
|
|
|
341
322
|
readonly updatedAt: Date;
|
|
342
323
|
}
|
|
343
324
|
|
|
325
|
+
/**
|
|
326
|
+
* An object listed without its slabs, as `SharedSdk.objectSummaries` returns
|
|
327
|
+
* it. It describes the object but cannot be downloaded. Fetch the full
|
|
328
|
+
* object with `SharedSdk.object(id)` to download it.
|
|
329
|
+
*/
|
|
330
|
+
export class ObjectSummary {
|
|
331
|
+
private constructor();
|
|
332
|
+
free(): void;
|
|
333
|
+
[Symbol.dispose](): void;
|
|
334
|
+
/**
|
|
335
|
+
* The creation time.
|
|
336
|
+
*/
|
|
337
|
+
readonly createdAt: Date;
|
|
338
|
+
/**
|
|
339
|
+
* The object's ID as a hex string.
|
|
340
|
+
*/
|
|
341
|
+
readonly id: string;
|
|
342
|
+
/**
|
|
343
|
+
* The object's decrypted metadata.
|
|
344
|
+
*/
|
|
345
|
+
readonly metadata: Uint8Array;
|
|
346
|
+
/**
|
|
347
|
+
* The object's size in bytes.
|
|
348
|
+
*/
|
|
349
|
+
readonly size: number;
|
|
350
|
+
/**
|
|
351
|
+
* The last updated time.
|
|
352
|
+
*/
|
|
353
|
+
readonly updatedAt: Date;
|
|
354
|
+
}
|
|
355
|
+
|
|
344
356
|
/**
|
|
345
357
|
* A packed upload handle for efficiently uploading multiple objects
|
|
346
358
|
* together. Objects are packed into shared slabs to avoid wasting storage.
|
|
@@ -503,7 +515,7 @@ export class Sdk {
|
|
|
503
515
|
* }
|
|
504
516
|
* ```
|
|
505
517
|
*/
|
|
506
|
-
download(object: PinnedObject, options?:
|
|
518
|
+
download(object: PinnedObject, options?: DownloadOptions): ReadableStream;
|
|
507
519
|
/**
|
|
508
520
|
* Returns a list of usable hosts, optionally filtered by a HostQuery.
|
|
509
521
|
*/
|
|
@@ -534,8 +546,11 @@ export class Sdk {
|
|
|
534
546
|
pinObject(object: PinnedObject): Promise<void>;
|
|
535
547
|
/**
|
|
536
548
|
* Prunes unused slabs from the indexer.
|
|
549
|
+
*
|
|
550
|
+
* `before` prunes only slabs pinned before that date. Omitting it leaves
|
|
551
|
+
* the cutoff to the indexer.
|
|
537
552
|
*/
|
|
538
|
-
pruneSlabs(): Promise<void>;
|
|
553
|
+
pruneSlabs(before?: Date | null): Promise<void>;
|
|
539
554
|
/**
|
|
540
555
|
* Deletes a sharing key along with all of its attachments, revoking
|
|
541
556
|
* recipients' access. Account tokens already issued stay valid until they
|
|
@@ -560,10 +575,6 @@ export class Sdk {
|
|
|
560
575
|
* Lists the account's sharing keys, most recently created first.
|
|
561
576
|
*/
|
|
562
577
|
sharingKeys(offset: number, limit: number): Promise<KeyRecord[]>;
|
|
563
|
-
/**
|
|
564
|
-
* Retrieves a pinned slab from the indexer by its hex ID.
|
|
565
|
-
*/
|
|
566
|
-
slab(slab_id: string): Promise<PinnedSlab>;
|
|
567
578
|
/**
|
|
568
579
|
* Detaches an object from a sharing key, leaving the key and its other
|
|
569
580
|
* attachments in place.
|
|
@@ -585,14 +596,14 @@ export class Sdk {
|
|
|
585
596
|
* await sdk.pinObject(obj);
|
|
586
597
|
* ```
|
|
587
598
|
*/
|
|
588
|
-
upload(object: PinnedObject, source: ReadableStream, options?:
|
|
599
|
+
upload(object: PinnedObject, source: ReadableStream, options?: UploadOptions): Promise<PinnedObject>;
|
|
589
600
|
/**
|
|
590
601
|
* Starts a packed upload for efficiently uploading multiple small objects.
|
|
591
602
|
* Objects smaller than the slab size (~40 MiB) are packed into shared slabs
|
|
592
603
|
* to avoid wasting storage. Call `add(data)` for each object, then
|
|
593
604
|
* `finalize()` to get the resulting `PinnedObject` handles.
|
|
594
605
|
*/
|
|
595
|
-
uploadPacked(options?:
|
|
606
|
+
uploadPacked(options?: PackedUploadOptions): PackedUpload;
|
|
596
607
|
}
|
|
597
608
|
|
|
598
609
|
/**
|
|
@@ -613,7 +624,7 @@ export class SharedSdk {
|
|
|
613
624
|
/**
|
|
614
625
|
* Streams a shared object's data.
|
|
615
626
|
*/
|
|
616
|
-
download(object: PinnedObject, options?:
|
|
627
|
+
download(object: PinnedObject, options?: DownloadOptions): ReadableStream;
|
|
617
628
|
/**
|
|
618
629
|
* Returns the hosts serving this key's objects, optionally filtered by a
|
|
619
630
|
* HostQuery. Mirrors `Sdk.hosts()` but is scoped to the sharing key, so the
|
|
@@ -624,6 +635,12 @@ export class SharedSdk {
|
|
|
624
635
|
* Fetches and decrypts one object the key grants access to.
|
|
625
636
|
*/
|
|
626
637
|
object(id: string): Promise<PinnedObject>;
|
|
638
|
+
/**
|
|
639
|
+
* Lists a page of the objects the key grants access to without their
|
|
640
|
+
* slabs, which is much smaller and faster than `objects`. Each summary
|
|
641
|
+
* has the object's id, size, decrypted metadata and timestamps.
|
|
642
|
+
*/
|
|
643
|
+
objectSummaries(offset: number, limit: number): Promise<ObjectSummary[]>;
|
|
627
644
|
/**
|
|
628
645
|
* Lists and decrypts a page of the objects the key grants access to.
|
|
629
646
|
*/
|
|
@@ -700,6 +717,7 @@ export interface InitOutput {
|
|
|
700
717
|
readonly __wbg_builder_free: (a: number, b: number) => void;
|
|
701
718
|
readonly __wbg_keyrecord_free: (a: number, b: number) => void;
|
|
702
719
|
readonly __wbg_objectevent_free: (a: number, b: number) => void;
|
|
720
|
+
readonly __wbg_objectsummary_free: (a: number, b: number) => void;
|
|
703
721
|
readonly __wbg_packedupload_free: (a: number, b: number) => void;
|
|
704
722
|
readonly __wbg_pinnedobject_free: (a: number, b: number) => void;
|
|
705
723
|
readonly __wbg_sdk_free: (a: number, b: number) => void;
|
|
@@ -718,7 +736,7 @@ export interface InitOutput {
|
|
|
718
736
|
readonly builder_requestConnection: (a: number) => any;
|
|
719
737
|
readonly builder_responseUrl: (a: number) => [number, number, number, number];
|
|
720
738
|
readonly builder_waitForApproval: (a: number) => any;
|
|
721
|
-
readonly encodedSize: (a: number, b: number, c: number) => number;
|
|
739
|
+
readonly encodedSize: (a: number, b: number, c: number) => [number, number, number];
|
|
722
740
|
readonly generateRecoveryPhrase: () => [number, number];
|
|
723
741
|
readonly init: () => void;
|
|
724
742
|
readonly keyrecord_description: (a: number) => [number, number];
|
|
@@ -728,6 +746,11 @@ export interface InitOutput {
|
|
|
728
746
|
readonly objectevent_id: (a: number) => [number, number];
|
|
729
747
|
readonly objectevent_object: (a: number) => number;
|
|
730
748
|
readonly objectevent_updatedAt: (a: number) => any;
|
|
749
|
+
readonly objectsummary_createdAt: (a: number) => any;
|
|
750
|
+
readonly objectsummary_id: (a: number) => [number, number];
|
|
751
|
+
readonly objectsummary_metadata: (a: number) => [number, number];
|
|
752
|
+
readonly objectsummary_size: (a: number) => number;
|
|
753
|
+
readonly objectsummary_updatedAt: (a: number) => any;
|
|
731
754
|
readonly packedupload_add: (a: number, b: any) => any;
|
|
732
755
|
readonly packedupload_cancel: (a: number) => void;
|
|
733
756
|
readonly packedupload_finalize: (a: number) => any;
|
|
@@ -758,13 +781,12 @@ export interface InitOutput {
|
|
|
758
781
|
readonly sdk_objectFromShareUrl: (a: number, b: number, c: number) => any;
|
|
759
782
|
readonly sdk_objectShareUrl: (a: number, b: number, c: any) => [number, number, number, number];
|
|
760
783
|
readonly sdk_pinObject: (a: number, b: number) => any;
|
|
761
|
-
readonly sdk_pruneSlabs: (a: number) => any;
|
|
784
|
+
readonly sdk_pruneSlabs: (a: number, b: number) => any;
|
|
762
785
|
readonly sdk_revokeSharingKey: (a: number, b: number) => any;
|
|
763
786
|
readonly sdk_shareObject: (a: number, b: number, c: number) => any;
|
|
764
787
|
readonly sdk_sharedObjects: (a: number, b: number, c: number, d: number) => any;
|
|
765
788
|
readonly sdk_sharingKey: (a: number, b: number) => any;
|
|
766
789
|
readonly sdk_sharingKeys: (a: number, b: number, c: number) => any;
|
|
767
|
-
readonly sdk_slab: (a: number, b: number, c: number) => any;
|
|
768
790
|
readonly sdk_unshareObject: (a: number, b: number, c: number, d: number) => any;
|
|
769
791
|
readonly sdk_updateObjectMetadata: (a: number, b: number) => any;
|
|
770
792
|
readonly sdk_upload: (a: number, b: number, c: any, d: number) => any;
|
|
@@ -774,6 +796,7 @@ export interface InitOutput {
|
|
|
774
796
|
readonly sharedsdk_download: (a: number, b: number, c: number) => [number, number, number];
|
|
775
797
|
readonly sharedsdk_hosts: (a: number, b: number) => any;
|
|
776
798
|
readonly sharedsdk_object: (a: number, b: number, c: number) => any;
|
|
799
|
+
readonly sharedsdk_objectSummaries: (a: number, b: number, c: number) => any;
|
|
777
800
|
readonly sharedsdk_objects: (a: number, b: number, c: number) => any;
|
|
778
801
|
readonly sharedsdk_stats: (a: number) => any;
|
|
779
802
|
readonly sharingkey_fromSeed: (a: number, b: number) => [number, number, number];
|
|
@@ -798,7 +821,7 @@ export interface InitOutput {
|
|
|
798
821
|
readonly wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___sys__Undefined__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
799
822
|
readonly wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___sys__Undefined__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true__3: (a: number, b: number, c: any) => [number, number];
|
|
800
823
|
readonly wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___sys__Undefined__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true__4: (a: number, b: number, c: any) => [number, number];
|
|
801
|
-
readonly
|
|
824
|
+
readonly wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
802
825
|
readonly wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___JsValue______true_: (a: number, b: number, c: any) => void;
|
|
803
826
|
readonly wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
804
827
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
package/wasm/sia_storage_wasm.js
CHANGED
|
@@ -240,7 +240,7 @@ export class Builder {
|
|
|
240
240
|
}
|
|
241
241
|
if (Symbol.dispose) Builder.prototype[Symbol.dispose] = Builder.prototype.free;
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
class IntoUnderlyingByteSource {
|
|
244
244
|
static __wrap(ptr) {
|
|
245
245
|
const obj = Object.create(IntoUnderlyingByteSource.prototype);
|
|
246
246
|
obj.__wbg_ptr = ptr;
|
|
@@ -292,7 +292,7 @@ export class IntoUnderlyingByteSource {
|
|
|
292
292
|
}
|
|
293
293
|
if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
class IntoUnderlyingSink {
|
|
296
296
|
__destroy_into_raw() {
|
|
297
297
|
const ptr = this.__wbg_ptr;
|
|
298
298
|
this.__wbg_ptr = 0;
|
|
@@ -331,7 +331,7 @@ export class IntoUnderlyingSink {
|
|
|
331
331
|
}
|
|
332
332
|
if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
|
|
333
333
|
|
|
334
|
-
|
|
334
|
+
class IntoUnderlyingSource {
|
|
335
335
|
__destroy_into_raw() {
|
|
336
336
|
const ptr = this.__wbg_ptr;
|
|
337
337
|
this.__wbg_ptr = 0;
|
|
@@ -478,6 +478,81 @@ export class ObjectEvent {
|
|
|
478
478
|
}
|
|
479
479
|
if (Symbol.dispose) ObjectEvent.prototype[Symbol.dispose] = ObjectEvent.prototype.free;
|
|
480
480
|
|
|
481
|
+
/**
|
|
482
|
+
* An object listed without its slabs, as `SharedSdk.objectSummaries` returns
|
|
483
|
+
* it. It describes the object but cannot be downloaded. Fetch the full
|
|
484
|
+
* object with `SharedSdk.object(id)` to download it.
|
|
485
|
+
*/
|
|
486
|
+
export class ObjectSummary {
|
|
487
|
+
static __wrap(ptr) {
|
|
488
|
+
const obj = Object.create(ObjectSummary.prototype);
|
|
489
|
+
obj.__wbg_ptr = ptr;
|
|
490
|
+
ObjectSummaryFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
491
|
+
return obj;
|
|
492
|
+
}
|
|
493
|
+
__destroy_into_raw() {
|
|
494
|
+
const ptr = this.__wbg_ptr;
|
|
495
|
+
this.__wbg_ptr = 0;
|
|
496
|
+
ObjectSummaryFinalization.unregister(this);
|
|
497
|
+
return ptr;
|
|
498
|
+
}
|
|
499
|
+
free() {
|
|
500
|
+
const ptr = this.__destroy_into_raw();
|
|
501
|
+
wasm.__wbg_objectsummary_free(ptr, 0);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* The creation time.
|
|
505
|
+
* @returns {Date}
|
|
506
|
+
*/
|
|
507
|
+
get createdAt() {
|
|
508
|
+
const ret = wasm.objectsummary_createdAt(this.__wbg_ptr);
|
|
509
|
+
return ret;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* The object's ID as a hex string.
|
|
513
|
+
* @returns {string}
|
|
514
|
+
*/
|
|
515
|
+
get id() {
|
|
516
|
+
let deferred1_0;
|
|
517
|
+
let deferred1_1;
|
|
518
|
+
try {
|
|
519
|
+
const ret = wasm.objectsummary_id(this.__wbg_ptr);
|
|
520
|
+
deferred1_0 = ret[0];
|
|
521
|
+
deferred1_1 = ret[1];
|
|
522
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
523
|
+
} finally {
|
|
524
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* The object's decrypted metadata.
|
|
529
|
+
* @returns {Uint8Array}
|
|
530
|
+
*/
|
|
531
|
+
get metadata() {
|
|
532
|
+
const ret = wasm.objectsummary_metadata(this.__wbg_ptr);
|
|
533
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
534
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
535
|
+
return v1;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* The object's size in bytes.
|
|
539
|
+
* @returns {number}
|
|
540
|
+
*/
|
|
541
|
+
get size() {
|
|
542
|
+
const ret = wasm.objectsummary_size(this.__wbg_ptr);
|
|
543
|
+
return ret;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* The last updated time.
|
|
547
|
+
* @returns {Date}
|
|
548
|
+
*/
|
|
549
|
+
get updatedAt() {
|
|
550
|
+
const ret = wasm.objectsummary_updatedAt(this.__wbg_ptr);
|
|
551
|
+
return ret;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (Symbol.dispose) ObjectSummary.prototype[Symbol.dispose] = ObjectSummary.prototype.free;
|
|
555
|
+
|
|
481
556
|
/**
|
|
482
557
|
* A packed upload handle for efficiently uploading multiple objects
|
|
483
558
|
* together. Objects are packed into shared slabs to avoid wasting storage.
|
|
@@ -808,7 +883,7 @@ export class Sdk {
|
|
|
808
883
|
* }
|
|
809
884
|
* ```
|
|
810
885
|
* @param {PinnedObject} object
|
|
811
|
-
* @param {
|
|
886
|
+
* @param {DownloadOptions} [options]
|
|
812
887
|
* @returns {ReadableStream}
|
|
813
888
|
*/
|
|
814
889
|
download(object, options) {
|
|
@@ -901,10 +976,14 @@ export class Sdk {
|
|
|
901
976
|
}
|
|
902
977
|
/**
|
|
903
978
|
* Prunes unused slabs from the indexer.
|
|
979
|
+
*
|
|
980
|
+
* `before` prunes only slabs pinned before that date. Omitting it leaves
|
|
981
|
+
* the cutoff to the indexer.
|
|
982
|
+
* @param {Date | null} [before]
|
|
904
983
|
* @returns {Promise<void>}
|
|
905
984
|
*/
|
|
906
|
-
pruneSlabs() {
|
|
907
|
-
const ret = wasm.sdk_pruneSlabs(this.__wbg_ptr);
|
|
985
|
+
pruneSlabs(before) {
|
|
986
|
+
const ret = wasm.sdk_pruneSlabs(this.__wbg_ptr, isLikeNone(before) ? 0 : addToExternrefTable0(before));
|
|
908
987
|
return ret;
|
|
909
988
|
}
|
|
910
989
|
/**
|
|
@@ -965,17 +1044,6 @@ export class Sdk {
|
|
|
965
1044
|
const ret = wasm.sdk_sharingKeys(this.__wbg_ptr, offset, limit);
|
|
966
1045
|
return ret;
|
|
967
1046
|
}
|
|
968
|
-
/**
|
|
969
|
-
* Retrieves a pinned slab from the indexer by its hex ID.
|
|
970
|
-
* @param {string} slab_id
|
|
971
|
-
* @returns {PinnedSlab}
|
|
972
|
-
*/
|
|
973
|
-
slab(slab_id) {
|
|
974
|
-
const ptr0 = passStringToWasm0(slab_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
975
|
-
const len0 = WASM_VECTOR_LEN;
|
|
976
|
-
const ret = wasm.sdk_slab(this.__wbg_ptr, ptr0, len0);
|
|
977
|
-
return ret;
|
|
978
|
-
}
|
|
979
1047
|
/**
|
|
980
1048
|
* Detaches an object from a sharing key, leaving the key and its other
|
|
981
1049
|
* attachments in place.
|
|
@@ -1013,7 +1081,7 @@ export class Sdk {
|
|
|
1013
1081
|
* ```
|
|
1014
1082
|
* @param {PinnedObject} object
|
|
1015
1083
|
* @param {ReadableStream} source
|
|
1016
|
-
* @param {
|
|
1084
|
+
* @param {UploadOptions} [options]
|
|
1017
1085
|
* @returns {Promise<PinnedObject>}
|
|
1018
1086
|
*/
|
|
1019
1087
|
upload(object, source, options) {
|
|
@@ -1027,7 +1095,7 @@ export class Sdk {
|
|
|
1027
1095
|
* Objects smaller than the slab size (~40 MiB) are packed into shared slabs
|
|
1028
1096
|
* to avoid wasting storage. Call `add(data)` for each object, then
|
|
1029
1097
|
* `finalize()` to get the resulting `PinnedObject` handles.
|
|
1030
|
-
* @param {
|
|
1098
|
+
* @param {PackedUploadOptions} [options]
|
|
1031
1099
|
* @returns {PackedUpload}
|
|
1032
1100
|
*/
|
|
1033
1101
|
uploadPacked(options) {
|
|
@@ -1081,7 +1149,7 @@ export class SharedSdk {
|
|
|
1081
1149
|
/**
|
|
1082
1150
|
* Streams a shared object's data.
|
|
1083
1151
|
* @param {PinnedObject} object
|
|
1084
|
-
* @param {
|
|
1152
|
+
* @param {DownloadOptions} [options]
|
|
1085
1153
|
* @returns {ReadableStream}
|
|
1086
1154
|
*/
|
|
1087
1155
|
download(object, options) {
|
|
@@ -1114,6 +1182,18 @@ export class SharedSdk {
|
|
|
1114
1182
|
const ret = wasm.sharedsdk_object(this.__wbg_ptr, ptr0, len0);
|
|
1115
1183
|
return ret;
|
|
1116
1184
|
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Lists a page of the objects the key grants access to without their
|
|
1187
|
+
* slabs, which is much smaller and faster than `objects`. Each summary
|
|
1188
|
+
* has the object's id, size, decrypted metadata and timestamps.
|
|
1189
|
+
* @param {number} offset
|
|
1190
|
+
* @param {number} limit
|
|
1191
|
+
* @returns {Promise<ObjectSummary[]>}
|
|
1192
|
+
*/
|
|
1193
|
+
objectSummaries(offset, limit) {
|
|
1194
|
+
const ret = wasm.sharedsdk_objectSummaries(this.__wbg_ptr, offset, limit);
|
|
1195
|
+
return ret;
|
|
1196
|
+
}
|
|
1117
1197
|
/**
|
|
1118
1198
|
* Lists and decrypts a page of the objects the key grants access to.
|
|
1119
1199
|
* @param {number} offset
|
|
@@ -1220,7 +1300,10 @@ if (Symbol.dispose) SharingKey.prototype[Symbol.dispose] = SharingKey.prototype.
|
|
|
1220
1300
|
*/
|
|
1221
1301
|
export function encodedSize(data_size, data_shards, parity_shards) {
|
|
1222
1302
|
const ret = wasm.encodedSize(data_size, data_shards, parity_shards);
|
|
1223
|
-
|
|
1303
|
+
if (ret[2]) {
|
|
1304
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1305
|
+
}
|
|
1306
|
+
return ret[0];
|
|
1224
1307
|
}
|
|
1225
1308
|
|
|
1226
1309
|
/**
|
|
@@ -1365,6 +1448,10 @@ function __wbg_get_imports() {
|
|
|
1365
1448
|
__wbg_abort_8bae0f33e7833997: function(arg0) {
|
|
1366
1449
|
arg0.abort();
|
|
1367
1450
|
},
|
|
1451
|
+
__wbg_abort_962541bfa57985c4: function(arg0) {
|
|
1452
|
+
const ret = arg0.abort();
|
|
1453
|
+
return ret;
|
|
1454
|
+
},
|
|
1368
1455
|
__wbg_abort_eee9248a6d680839: function(arg0, arg1) {
|
|
1369
1456
|
arg0.abort(arg1);
|
|
1370
1457
|
},
|
|
@@ -1440,11 +1527,11 @@ function __wbg_get_imports() {
|
|
|
1440
1527
|
const ret = arg0.createBidirectionalStream();
|
|
1441
1528
|
return ret;
|
|
1442
1529
|
},
|
|
1443
|
-
|
|
1530
|
+
__wbg_done_11408d3db12f8f67: function(arg0) {
|
|
1444
1531
|
const ret = arg0.done;
|
|
1445
1532
|
return ret;
|
|
1446
1533
|
},
|
|
1447
|
-
|
|
1534
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
1448
1535
|
const ret = arg0.done;
|
|
1449
1536
|
return ret;
|
|
1450
1537
|
},
|
|
@@ -1473,15 +1560,15 @@ function __wbg_get_imports() {
|
|
|
1473
1560
|
__wbg_getRandomValues_cc7f052a444bb2ce: function() { return handleError(function (arg0, arg1) {
|
|
1474
1561
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1475
1562
|
}, arguments); },
|
|
1476
|
-
__wbg_getReader_1ef752ebe7bb7900: function() { return handleError(function (arg0, arg1) {
|
|
1477
|
-
const ret = arg0.getReader(arg1);
|
|
1478
|
-
return ret;
|
|
1479
|
-
}, arguments); },
|
|
1480
1563
|
__wbg_getReader_7455d080fa48369b: function(arg0) {
|
|
1481
1564
|
const ret = arg0.getReader();
|
|
1482
1565
|
return ret;
|
|
1483
1566
|
},
|
|
1484
|
-
|
|
1567
|
+
__wbg_getReader_9838808cf6e83f4f: function() { return handleError(function (arg0, arg1) {
|
|
1568
|
+
const ret = arg0.getReader(arg1);
|
|
1569
|
+
return ret;
|
|
1570
|
+
}, arguments); },
|
|
1571
|
+
__wbg_getReader_bf34f92ee19c42b4: function() { return handleError(function (arg0) {
|
|
1485
1572
|
const ret = arg0.getReader();
|
|
1486
1573
|
return ret;
|
|
1487
1574
|
}, arguments); },
|
|
@@ -1630,7 +1717,7 @@ function __wbg_get_imports() {
|
|
|
1630
1717
|
const a = state0.a;
|
|
1631
1718
|
state0.a = 0;
|
|
1632
1719
|
try {
|
|
1633
|
-
return
|
|
1720
|
+
return wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
1634
1721
|
} finally {
|
|
1635
1722
|
state0.a = a;
|
|
1636
1723
|
}
|
|
@@ -1668,7 +1755,7 @@ function __wbg_get_imports() {
|
|
|
1668
1755
|
const a = state0.a;
|
|
1669
1756
|
state0.a = 0;
|
|
1670
1757
|
try {
|
|
1671
|
-
return
|
|
1758
|
+
return wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined_______true_(a, state0.b, arg0, arg1);
|
|
1672
1759
|
} finally {
|
|
1673
1760
|
state0.a = a;
|
|
1674
1761
|
}
|
|
@@ -1683,7 +1770,7 @@ function __wbg_get_imports() {
|
|
|
1683
1770
|
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
1684
1771
|
return ret;
|
|
1685
1772
|
},
|
|
1686
|
-
|
|
1773
|
+
__wbg_new_with_into_underlying_byte_source_e1bffc8549ce4568: function() { return handleError(function (arg0) {
|
|
1687
1774
|
const ret = new ReadableStream(IntoUnderlyingByteSource.__wrap(arg0));
|
|
1688
1775
|
return ret;
|
|
1689
1776
|
}, arguments); },
|
|
@@ -1715,6 +1802,10 @@ function __wbg_get_imports() {
|
|
|
1715
1802
|
const ret = ObjectEvent.__wrap(arg0);
|
|
1716
1803
|
return ret;
|
|
1717
1804
|
},
|
|
1805
|
+
__wbg_objectsummary_new: function(arg0) {
|
|
1806
|
+
const ret = ObjectSummary.__wrap(arg0);
|
|
1807
|
+
return ret;
|
|
1808
|
+
},
|
|
1718
1809
|
__wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
|
|
1719
1810
|
const ret = arg0.performance;
|
|
1720
1811
|
return ret;
|
|
@@ -1873,7 +1964,7 @@ function __wbg_get_imports() {
|
|
|
1873
1964
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1874
1965
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1875
1966
|
},
|
|
1876
|
-
|
|
1967
|
+
__wbg_value_015ff34c896f8461: function(arg0) {
|
|
1877
1968
|
const ret = arg0.value;
|
|
1878
1969
|
return ret;
|
|
1879
1970
|
},
|
|
@@ -1894,32 +1985,32 @@ function __wbg_get_imports() {
|
|
|
1894
1985
|
return ret;
|
|
1895
1986
|
},
|
|
1896
1987
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1897
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1988
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1022, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1898
1989
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true_);
|
|
1899
1990
|
return ret;
|
|
1900
1991
|
},
|
|
1901
1992
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1902
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1993
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 481, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1903
1994
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___JsValue______true_);
|
|
1904
1995
|
return ret;
|
|
1905
1996
|
},
|
|
1906
1997
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1907
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1998
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 539, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1908
1999
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___sys__Undefined__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true_);
|
|
1909
2000
|
return ret;
|
|
1910
2001
|
},
|
|
1911
2002
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1912
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WebTransportBidirectionalStream")], shim_idx:
|
|
2003
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WebTransportBidirectionalStream")], shim_idx: 539, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1913
2004
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___sys__Undefined__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true__3);
|
|
1914
2005
|
return ret;
|
|
1915
2006
|
},
|
|
1916
2007
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1917
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx:
|
|
2008
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 539, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1918
2009
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___sys__Undefined__core_608f92abc48d28da___result__Result_____wasm_bindgen_a939ac12ad536d64___JsError___true__4);
|
|
1919
2010
|
return ret;
|
|
1920
2011
|
},
|
|
1921
2012
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
1922
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
2013
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 829, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1923
2014
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke_______true_);
|
|
1924
2015
|
return ret;
|
|
1925
2016
|
},
|
|
@@ -1953,6 +2044,13 @@ function __wbg_get_imports() {
|
|
|
1953
2044
|
return ret;
|
|
1954
2045
|
},
|
|
1955
2046
|
__wbindgen_cast_000000000000000c: function(arg0, arg1) {
|
|
2047
|
+
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
2048
|
+
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
2049
|
+
// Cast intrinsic for `Vector(NamedExternref("ObjectSummary")) -> Externref`.
|
|
2050
|
+
const ret = v0;
|
|
2051
|
+
return ret;
|
|
2052
|
+
},
|
|
2053
|
+
__wbindgen_cast_000000000000000d: function(arg0, arg1) {
|
|
1956
2054
|
var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
|
|
1957
2055
|
wasm.__wbindgen_free(arg0, arg1 * 4, 4);
|
|
1958
2056
|
// Cast intrinsic for `Vector(NamedExternref("PinnedObject")) -> Externref`.
|
|
@@ -2011,8 +2109,8 @@ function wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bin
|
|
|
2011
2109
|
}
|
|
2012
2110
|
}
|
|
2013
2111
|
|
|
2014
|
-
function
|
|
2015
|
-
wasm.
|
|
2112
|
+
function wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined_______true_(arg0, arg1, arg2, arg3) {
|
|
2113
|
+
wasm.wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined___js_sys_32e95d01f2c64d55___Function_fn_wasm_bindgen_a939ac12ad536d64___JsValue_____wasm_bindgen_a939ac12ad536d64___sys__Undefined_______true_(arg0, arg1, arg2, arg3);
|
|
2016
2114
|
}
|
|
2017
2115
|
|
|
2018
2116
|
|
|
@@ -2050,6 +2148,9 @@ const KeyRecordFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2050
2148
|
const ObjectEventFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2051
2149
|
? { register: () => {}, unregister: () => {} }
|
|
2052
2150
|
: new FinalizationRegistry(ptr => wasm.__wbg_objectevent_free(ptr, 1));
|
|
2151
|
+
const ObjectSummaryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2152
|
+
? { register: () => {}, unregister: () => {} }
|
|
2153
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_objectsummary_free(ptr, 1));
|
|
2053
2154
|
const PackedUploadFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2054
2155
|
? { register: () => {}, unregister: () => {} }
|
|
2055
2156
|
: new FinalizationRegistry(ptr => wasm.__wbg_packedupload_free(ptr, 1));
|
|
Binary file
|