@siafoundation/sia-storage 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siafoundation/sia-storage",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,6 +8,9 @@
8
8
  },
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
11
+ "bin": {
12
+ "sia-storage-worker": "dist/cli.js"
13
+ },
11
14
  "files": [
12
15
  "dist",
13
16
  "wasm"
@@ -32,27 +35,40 @@
32
35
  "default": "./dist/index.js"
33
36
  }
34
37
  },
38
+ "./stream-worker": {
39
+ "types": "./dist/stream-worker.d.ts",
40
+ "default": "./dist/stream-worker.js"
41
+ },
42
+ "./vite": {
43
+ "types": "./dist/vite.d.ts",
44
+ "default": "./dist/vite.js"
45
+ },
46
+ "./next": {
47
+ "types": "./dist/next.d.ts",
48
+ "default": "./dist/next.js"
49
+ },
50
+ "./sia-storage-sw.js": "./dist/sia-storage-sw.js",
35
51
  "./wasm": "./wasm/sia_storage_wasm.js",
36
52
  "./wasm/*": "./wasm/*"
37
53
  },
38
54
  "scripts": {
39
- "build": "bun run build-wasm && tsup && bun run scripts/build-node-types.ts",
55
+ "build": "bun run build-wasm && tsup --config tsup.worker.config.ts && tsup && bun run scripts/build-node-types.ts",
40
56
  "build-wasm": "bun run scripts/build-wasm.ts",
41
57
  "setup": "bun run scripts/setup-rust.ts",
42
58
  "setup-napi-test": "bun run scripts/setup-napi-test.ts",
43
59
  "typecheck": "tsc --noEmit",
44
60
  "test": "bun test src/tests/install-integration.test.ts",
45
- "test:browser": "bun test src/tests/vite-integration.test.ts src/tests/esbuild-integration.test.ts src/tests/webpack-integration.test.ts src/tests/rollup-integration.test.ts src/tests/nextjs-integration.test.ts",
61
+ "test:browser": "bun test src/tests/vite-integration.test.ts src/tests/esbuild-integration.test.ts src/tests/webpack-integration.test.ts src/tests/rollup-integration.test.ts src/tests/nextjs-integration.test.ts src/tests/streaming.test.ts src/tests/stream-prebuilt-worker.test.ts",
46
62
  "test:all": "bun test",
47
63
  "prepublishOnly": "bun run build && bun test",
48
64
  "publish-npm": "bun run scripts/publish.ts"
49
65
  },
50
66
  "optionalDependencies": {
51
- "@siafoundation/sia-storage-darwin-arm64": "0.1.0",
52
- "@siafoundation/sia-storage-darwin-x64": "0.1.0",
53
- "@siafoundation/sia-storage-linux-x64-gnu": "0.1.0",
54
- "@siafoundation/sia-storage-linux-arm64-gnu": "0.1.0",
55
- "@siafoundation/sia-storage-win32-x64-msvc": "0.1.0"
67
+ "@siafoundation/sia-storage-darwin-arm64": "0.1.1",
68
+ "@siafoundation/sia-storage-darwin-x64": "0.1.1",
69
+ "@siafoundation/sia-storage-linux-x64-gnu": "0.1.1",
70
+ "@siafoundation/sia-storage-linux-arm64-gnu": "0.1.1",
71
+ "@siafoundation/sia-storage-win32-x64-msvc": "0.1.1"
56
72
  },
57
73
  "devDependencies": {
58
74
  "@types/bun": "^1.3.12",
@@ -91,6 +91,14 @@ export interface App {
91
91
  serviceUrl: string | undefined;
92
92
  }
93
93
 
94
+ /**
95
+ * Geographic coordinates used to sort hosts by proximity.
96
+ */
97
+ export interface GeoLocation {
98
+ latitude: number;
99
+ longitude: number;
100
+ }
101
+
94
102
  /**
95
103
  * Information about the user's account on the indexer.
96
104
  */
@@ -123,9 +131,10 @@ export interface ShardProgress {
123
131
  * Query parameters for filtering hosts.
124
132
  */
125
133
  export interface HostQuery {
126
- country: string | undefined;
127
- limit: number | undefined;
128
- offset: number | undefined;
134
+ location?: GeoLocation;
135
+ country?: string;
136
+ limit?: number;
137
+ offset?: number;
129
138
  }
130
139
 
131
140
  /**
@@ -559,7 +568,7 @@ export class Sdk {
559
568
  * Detaches an object from a sharing key, leaving the key and its other
560
569
  * attachments in place.
561
570
  */
562
- unshareObject(key: SharingKey, object: PinnedObject): Promise<void>;
571
+ unshareObject(key: SharingKey, id: string): Promise<void>;
563
572
  /**
564
573
  * Updates an object's metadata on the indexer.
565
574
  */
@@ -756,7 +765,7 @@ export interface InitOutput {
756
765
  readonly sdk_sharingKey: (a: number, b: number) => any;
757
766
  readonly sdk_sharingKeys: (a: number, b: number, c: number) => any;
758
767
  readonly sdk_slab: (a: number, b: number, c: number) => any;
759
- readonly sdk_unshareObject: (a: number, b: number, c: number) => any;
768
+ readonly sdk_unshareObject: (a: number, b: number, c: number, d: number) => any;
760
769
  readonly sdk_updateObjectMetadata: (a: number, b: number) => any;
761
770
  readonly sdk_upload: (a: number, b: number, c: any, d: number) => any;
762
771
  readonly sdk_uploadPacked: (a: number, b: number) => [number, number, number];
@@ -980,13 +980,14 @@ export class Sdk {
980
980
  * Detaches an object from a sharing key, leaving the key and its other
981
981
  * attachments in place.
982
982
  * @param {SharingKey} key
983
- * @param {PinnedObject} object
983
+ * @param {string} id
984
984
  * @returns {Promise<void>}
985
985
  */
986
- unshareObject(key, object) {
986
+ unshareObject(key, id) {
987
987
  _assertClass(key, SharingKey);
988
- _assertClass(object, PinnedObject);
989
- const ret = wasm.sdk_unshareObject(this.__wbg_ptr, key.__wbg_ptr, object.__wbg_ptr);
988
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
989
+ const len0 = WASM_VECTOR_LEN;
990
+ const ret = wasm.sdk_unshareObject(this.__wbg_ptr, key.__wbg_ptr, ptr0, len0);
990
991
  return ret;
991
992
  }
992
993
  /**
@@ -1893,32 +1894,32 @@ function __wbg_get_imports() {
1893
1894
  return ret;
1894
1895
  },
1895
1896
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1896
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1057, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1897
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1058, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1897
1898
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_baa1b51bcdcd1a91___convert__closures_____invoke___wasm_bindgen_baa1b51bcdcd1a91___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_baa1b51bcdcd1a91___JsError___true_);
1898
1899
  return ret;
1899
1900
  },
1900
1901
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
1901
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 524, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1902
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 525, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1902
1903
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_baa1b51bcdcd1a91___convert__closures_____invoke___wasm_bindgen_baa1b51bcdcd1a91___JsValue______true_);
1903
1904
  return ret;
1904
1905
  },
1905
1906
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1906
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 580, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1907
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 581, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1907
1908
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_baa1b51bcdcd1a91___convert__closures_____invoke___wasm_bindgen_baa1b51bcdcd1a91___sys__Undefined__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_baa1b51bcdcd1a91___JsError___true_);
1908
1909
  return ret;
1909
1910
  },
1910
1911
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
1911
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WebTransportBidirectionalStream")], shim_idx: 580, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1912
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("WebTransportBidirectionalStream")], shim_idx: 581, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1912
1913
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_baa1b51bcdcd1a91___convert__closures_____invoke___wasm_bindgen_baa1b51bcdcd1a91___sys__Undefined__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_baa1b51bcdcd1a91___JsError___true__3);
1913
1914
  return ret;
1914
1915
  },
1915
1916
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
1916
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 580, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1917
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 581, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1917
1918
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_baa1b51bcdcd1a91___convert__closures_____invoke___wasm_bindgen_baa1b51bcdcd1a91___sys__Undefined__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_baa1b51bcdcd1a91___JsError___true__4);
1918
1919
  return ret;
1919
1920
  },
1920
1921
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
1921
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 869, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1922
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 870, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1922
1923
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_baa1b51bcdcd1a91___convert__closures_____invoke_______true_);
1923
1924
  return ret;
1924
1925
  },
Binary file
@@ -70,7 +70,7 @@ export const sdk_sharedObjects: (a: number, b: number, c: number, d: number) =>
70
70
  export const sdk_sharingKey: (a: number, b: number) => any;
71
71
  export const sdk_sharingKeys: (a: number, b: number, c: number) => any;
72
72
  export const sdk_slab: (a: number, b: number, c: number) => any;
73
- export const sdk_unshareObject: (a: number, b: number, c: number) => any;
73
+ export const sdk_unshareObject: (a: number, b: number, c: number, d: number) => any;
74
74
  export const sdk_updateObjectMetadata: (a: number, b: number) => any;
75
75
  export const sdk_upload: (a: number, b: number, c: any, d: number) => any;
76
76
  export const sdk_uploadPacked: (a: number, b: number) => [number, number, number];