@siafoundation/sia-storage 0.1.3 → 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 +21 -3
- package/dist/{chunk-QICJ5CIY.js → chunk-YOMDUMYW.js} +5 -2
- package/dist/chunk-YOMDUMYW.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.js +48 -8
- package/dist/index.js.map +1 -1
- package/dist/index.node.d.ts +26 -13
- package/dist/next.js +1 -1
- package/dist/sia-storage-sw.js +2 -2
- package/dist/stream-worker.js +28 -12
- 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-QICJ5CIY.js.map +0 -1
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
|
|
@@ -5,6 +5,7 @@ export const __wbg_appkey_free: (a: number, b: number) => void;
|
|
|
5
5
|
export const __wbg_builder_free: (a: number, b: number) => void;
|
|
6
6
|
export const __wbg_keyrecord_free: (a: number, b: number) => void;
|
|
7
7
|
export const __wbg_objectevent_free: (a: number, b: number) => void;
|
|
8
|
+
export const __wbg_objectsummary_free: (a: number, b: number) => void;
|
|
8
9
|
export const __wbg_packedupload_free: (a: number, b: number) => void;
|
|
9
10
|
export const __wbg_pinnedobject_free: (a: number, b: number) => void;
|
|
10
11
|
export const __wbg_sdk_free: (a: number, b: number) => void;
|
|
@@ -23,7 +24,7 @@ export const builder_register: (a: number, b: number, c: number) => any;
|
|
|
23
24
|
export const builder_requestConnection: (a: number) => any;
|
|
24
25
|
export const builder_responseUrl: (a: number) => [number, number, number, number];
|
|
25
26
|
export const builder_waitForApproval: (a: number) => any;
|
|
26
|
-
export const encodedSize: (a: number, b: number, c: number) => number;
|
|
27
|
+
export const encodedSize: (a: number, b: number, c: number) => [number, number, number];
|
|
27
28
|
export const generateRecoveryPhrase: () => [number, number];
|
|
28
29
|
export const init: () => void;
|
|
29
30
|
export const keyrecord_description: (a: number) => [number, number];
|
|
@@ -33,6 +34,11 @@ export const objectevent_deleted: (a: number) => number;
|
|
|
33
34
|
export const objectevent_id: (a: number) => [number, number];
|
|
34
35
|
export const objectevent_object: (a: number) => number;
|
|
35
36
|
export const objectevent_updatedAt: (a: number) => any;
|
|
37
|
+
export const objectsummary_createdAt: (a: number) => any;
|
|
38
|
+
export const objectsummary_id: (a: number) => [number, number];
|
|
39
|
+
export const objectsummary_metadata: (a: number) => [number, number];
|
|
40
|
+
export const objectsummary_size: (a: number) => number;
|
|
41
|
+
export const objectsummary_updatedAt: (a: number) => any;
|
|
36
42
|
export const packedupload_add: (a: number, b: any) => any;
|
|
37
43
|
export const packedupload_cancel: (a: number) => void;
|
|
38
44
|
export const packedupload_finalize: (a: number) => any;
|
|
@@ -63,13 +69,12 @@ export const sdk_objectEvents: (a: number, b: any, c: number) => any;
|
|
|
63
69
|
export const sdk_objectFromShareUrl: (a: number, b: number, c: number) => any;
|
|
64
70
|
export const sdk_objectShareUrl: (a: number, b: number, c: any) => [number, number, number, number];
|
|
65
71
|
export const sdk_pinObject: (a: number, b: number) => any;
|
|
66
|
-
export const sdk_pruneSlabs: (a: number) => any;
|
|
72
|
+
export const sdk_pruneSlabs: (a: number, b: number) => any;
|
|
67
73
|
export const sdk_revokeSharingKey: (a: number, b: number) => any;
|
|
68
74
|
export const sdk_shareObject: (a: number, b: number, c: number) => any;
|
|
69
75
|
export const sdk_sharedObjects: (a: number, b: number, c: number, d: number) => any;
|
|
70
76
|
export const sdk_sharingKey: (a: number, b: number) => any;
|
|
71
77
|
export const sdk_sharingKeys: (a: number, b: number, c: number) => any;
|
|
72
|
-
export const sdk_slab: (a: number, b: number, c: number) => any;
|
|
73
78
|
export const sdk_unshareObject: (a: number, b: number, c: number, d: number) => any;
|
|
74
79
|
export const sdk_updateObjectMetadata: (a: number, b: number) => any;
|
|
75
80
|
export const sdk_upload: (a: number, b: number, c: any, d: number) => any;
|
|
@@ -79,6 +84,7 @@ export const sharedsdk_connect: (a: number, b: number, c: number, d: number) =>
|
|
|
79
84
|
export const sharedsdk_download: (a: number, b: number, c: number) => [number, number, number];
|
|
80
85
|
export const sharedsdk_hosts: (a: number, b: number) => any;
|
|
81
86
|
export const sharedsdk_object: (a: number, b: number, c: number) => any;
|
|
87
|
+
export const sharedsdk_objectSummaries: (a: number, b: number, c: number) => any;
|
|
82
88
|
export const sharedsdk_objects: (a: number, b: number, c: number) => any;
|
|
83
89
|
export const sharedsdk_stats: (a: number) => any;
|
|
84
90
|
export const sharingkey_fromSeed: (a: number, b: number) => [number, number, number];
|
|
@@ -103,7 +109,7 @@ export const wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm
|
|
|
103
109
|
export const 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];
|
|
104
110
|
export const 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];
|
|
105
111
|
export const 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];
|
|
106
|
-
export const
|
|
112
|
+
export const 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;
|
|
107
113
|
export const wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke___wasm_bindgen_a939ac12ad536d64___JsValue______true_: (a: number, b: number, c: any) => void;
|
|
108
114
|
export const wasm_bindgen_a939ac12ad536d64___convert__closures_____invoke_______true_: (a: number, b: number) => void;
|
|
109
115
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stream/errors.ts","../src/stream/protocol.ts"],"sourcesContent":["/** Only sanitized strings cross the diagnostic boundary, never raw SDK objects. */\nexport function streamErrorMessage(error: unknown): string {\n const message =\n error instanceof Error\n ? error.message\n : typeof error === 'string'\n ? error\n : 'Unknown streaming failure'\n return message\n .replace(/\\b(?:https?|wss?|sia):\\/\\/[^\\s\"'<>]+/gi, '[URL redacted]')\n .replace(/(?:bearer\\s+)[^\\s,;]+/gi, 'Bearer [redacted]')\n .replace(\n /((?:seed|share|token|key|authorization)\\s*[=:]\\s*)[^\\s,;]+/gi,\n '$1[redacted]',\n )\n .replace(/[a-f0-9]{64,}/gi, '[redacted]')\n .replace(/[\\r\\n\\t]/g, ' ')\n .slice(0, 1000)\n}\n\nexport function reportStreamError(\n error: unknown,\n name: string,\n range: { offset: number; length: number } | undefined,\n) {\n const message = streamErrorMessage(error)\n // One string rather than an object, so it reads the same in every console.\n const bytes = range\n ? ` bytes ${range.offset}-${range.offset + range.length - 1}`\n : ''\n console.error(`[Sia stream] ${streamErrorMessage(name)}${bytes}: ${message}`)\n return message\n}\n","/**\n * Messages between a page and its streaming service worker.\n *\n * Stream URLs carry only the page's client id and a random token. When the\n * worker meets a token it does not know, it asks the page that made it for the\n * file and the share's credentials. The page and a worker can come from\n * different deployed versions, so the worker checks the page's reply before\n * using it.\n */\nimport type {\n AppMetadata,\n SealedObject,\n ShardProgress,\n} from '../../wasm/sia_storage_wasm.js'\n\n/**\n * What a stream URL is doing. `connecting` is a request waiting for its first\n * bytes, which on the URL's first request includes the worker connecting its\n * SDK and finding the object. `downloading` means bytes are arriving. `idle`\n * means no request for the URL is in flight, after the last one finished, was\n * cancelled or failed.\n */\nexport type StreamStatus = 'connecting' | 'downloading' | 'idle'\n\n/** The reports a page can ask for, one per callback it was given. */\nexport type StreamEvent = 'status' | 'progress' | 'shards'\nconst STREAM_EVENTS: readonly unknown[] = ['status', 'progress', 'shards']\n\n/**\n * What the worker connects its own SDK with. A `SharedSdk` reconnects from its\n * sharing key's seed, and an `Sdk` from its app key, as hex, and app metadata.\n */\nexport type Connection =\n | { kind: 'shared'; indexerUrl: string; seed: string }\n | { kind: 'app'; indexerUrl: string; appKey: string; appMeta: AppMetadata }\n\nexport type SourceDetails = {\n // One per opened SDK, so the worker can release it as a whole.\n session: string\n connection: Connection\n objectId: string\n // An `Sdk`'s object, sealed with its app key, so the worker can open it\n // without a lookup. A `SharedSdk`'s object is looked up by `objectId`.\n sealed?: SealedObject\n name: string\n mime: string\n size: number\n // The reports the page wants for this URL. The worker sends no others, and\n // asks the SDK for shard reports only when `shards` is here.\n events?: StreamEvent[]\n}\n\n/** Page to worker. */\nexport type PageMessage =\n | { type: 'sia-client' }\n | { type: 'sia-release'; token: string }\n | { type: 'sia-release-share'; session: string }\n\n/** Worker to page. */\nexport type WorkerMessage =\n | { type: 'sia-source'; token: string }\n | {\n type: 'sia-stream-error'\n token: string\n message: string\n offset?: number\n length?: number\n }\n | { type: 'sia-stream-status'; token: string; status: StreamStatus }\n | {\n type: 'sia-stream-progress'\n token: string\n // Bytes served since the previous progress message.\n bytes: number\n shards: ShardProgress[]\n }\n\n/** The worker's answer to `sia-client`. */\nexport type ClientReply = { clientId: string; supported: boolean }\n\n/** The page's answer to `sia-source`. */\nexport type SourceReply =\n | ({ type: 'source' } & SourceDetails)\n | { type: 'error' }\n\n// Stream URLs sit under the worker's scope, so a download's navigation, which\n// only a worker whose scope covers the URL can answer, reaches it on sites\n// served from a sub-path too.\nconst STREAM_PATH = /\\/__sia_stream__\\/([^/]+)\\/([^/]+)\\/[^/]+$/\n\n/** `scope` is the worker registration's scope URL, which ends in a slash. */\nexport function streamPath(scope: string, clientId: string, token: string) {\n return `${scope}__sia_stream__/${clientId}/${token}/file`\n}\n\nexport function parseStreamPath(pathname: string) {\n const match = STREAM_PATH.exec(pathname)\n return match ? { clientId: match[1]!, token: match[2]! } : undefined\n}\n\ntype Fields = Record<string, unknown> | null | undefined\n\nconst strings = (data: Fields, fields: string[]) =>\n fields.every((field) => typeof data?.[field] === 'string')\n\n/** Checked on both sides, so bad metadata fails in `openStreams`, not per request. */\nexport function isAppMetadata(value: unknown): value is AppMetadata {\n return strings(value as Fields, ['appId', 'name', 'description', 'serviceUrl'])\n}\n\nfunction isConnection(value: unknown): value is Connection {\n const data = value as Fields\n if (data?.kind === 'shared') return strings(data, ['indexerUrl', 'seed'])\n return (\n data?.kind === 'app' &&\n strings(data, ['indexerUrl', 'appKey']) &&\n isAppMetadata(data.appMeta)\n )\n}\n\nexport function isSourceReply(\n reply: unknown,\n): reply is { type: 'source' } & SourceDetails {\n const data = reply as Fields\n return (\n data?.type === 'source' &&\n strings(data, ['session', 'objectId', 'name', 'mime']) &&\n isConnection(data.connection) &&\n (data.connection.kind === 'shared' ||\n (typeof data.sealed === 'object' && data.sealed !== null)) &&\n Number.isSafeInteger(data.size) &&\n (data.size as number) >= 0 &&\n (data.events === undefined ||\n (Array.isArray(data.events) &&\n data.events.every((event) => STREAM_EVENTS.includes(event))))\n )\n}\n\n/**\n * Posts `message` with a reply port and resolves with the first reply. Rejects\n * after `timeout` ms, or when `signal` aborts.\n */\nexport function requestReply(\n target: { postMessage(message: unknown, transfer: Transferable[]): void },\n message: unknown,\n { timeout, signal }: { timeout?: number; signal?: AbortSignal },\n): Promise<unknown> {\n return new Promise((resolve, reject) => {\n const { port1, port2 } = new MessageChannel()\n const timer =\n timeout === undefined\n ? undefined\n : setTimeout(\n () => settle(() => reject(new Error('No reply in time.'))),\n timeout,\n )\n const abort = () => settle(() => reject(signal?.reason))\n function settle(outcome: () => void) {\n clearTimeout(timer)\n signal?.removeEventListener('abort', abort)\n port1.close()\n port2.close()\n outcome()\n }\n if (signal?.aborted) return abort()\n signal?.addEventListener('abort', abort, { once: true })\n port1.onmessage = ({ data }) => settle(() => resolve(data))\n port1.onmessageerror = () =>\n settle(() => reject(new Error('Unreadable reply.')))\n try {\n target.postMessage(message, [port2])\n } catch (error) {\n settle(() => reject(error))\n }\n })\n}\n"],"mappings":"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","names":[]}
|