@synonymdev/pubky 0.1.10 → 0.1.12
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 +16 -2
- package/browser.js +69 -40
- package/index.cjs +68 -39
- package/package.json +1 -1
- package/pubky.d.ts +12 -0
- package/pubky_bg.wasm +0 -0
package/index.cjs
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
let imports = {};
|
|
2
2
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
3
|
let wasm;
|
|
4
|
-
const {
|
|
4
|
+
const { TextDecoder, TextEncoder } = require(`util`);
|
|
5
|
+
|
|
6
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
7
|
+
|
|
8
|
+
cachedTextDecoder.decode();
|
|
9
|
+
|
|
10
|
+
let cachedUint8Memory0 = null;
|
|
11
|
+
|
|
12
|
+
function getUint8Memory0() {
|
|
13
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
14
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
15
|
+
}
|
|
16
|
+
return cachedUint8Memory0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getStringFromWasm0(ptr, len) {
|
|
20
|
+
ptr = ptr >>> 0;
|
|
21
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
22
|
+
}
|
|
5
23
|
|
|
6
24
|
const heap = new Array(128).fill(undefined);
|
|
7
25
|
|
|
8
26
|
heap.push(undefined, null, true, false);
|
|
9
27
|
|
|
10
|
-
function getObject(idx) { return heap[idx]; }
|
|
11
|
-
|
|
12
28
|
let heap_next = heap.length;
|
|
13
29
|
|
|
30
|
+
function addHeapObject(obj) {
|
|
31
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
32
|
+
const idx = heap_next;
|
|
33
|
+
heap_next = heap[idx];
|
|
34
|
+
|
|
35
|
+
heap[idx] = obj;
|
|
36
|
+
return idx;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getObject(idx) { return heap[idx]; }
|
|
40
|
+
|
|
14
41
|
function dropObject(idx) {
|
|
15
42
|
if (idx < 132) return;
|
|
16
43
|
heap[idx] = heap_next;
|
|
@@ -25,15 +52,6 @@ function takeObject(idx) {
|
|
|
25
52
|
|
|
26
53
|
let WASM_VECTOR_LEN = 0;
|
|
27
54
|
|
|
28
|
-
let cachedUint8Memory0 = null;
|
|
29
|
-
|
|
30
|
-
function getUint8Memory0() {
|
|
31
|
-
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
32
|
-
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
33
|
-
}
|
|
34
|
-
return cachedUint8Memory0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
55
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
38
56
|
|
|
39
57
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -101,24 +119,6 @@ function getInt32Memory0() {
|
|
|
101
119
|
return cachedInt32Memory0;
|
|
102
120
|
}
|
|
103
121
|
|
|
104
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
105
|
-
|
|
106
|
-
cachedTextDecoder.decode();
|
|
107
|
-
|
|
108
|
-
function getStringFromWasm0(ptr, len) {
|
|
109
|
-
ptr = ptr >>> 0;
|
|
110
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function addHeapObject(obj) {
|
|
114
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
115
|
-
const idx = heap_next;
|
|
116
|
-
heap_next = heap[idx];
|
|
117
|
-
|
|
118
|
-
heap[idx] = obj;
|
|
119
|
-
return idx;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
122
|
function debugString(val) {
|
|
123
123
|
// primitive types
|
|
124
124
|
const type = typeof val;
|
|
@@ -269,7 +269,7 @@ function handleError(f, args) {
|
|
|
269
269
|
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function __wbg_adapter_122(arg0, arg1, arg2, arg3) {
|
|
273
273
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__hcef77123246c6bdb(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -542,6 +542,25 @@ class PubkyClient {
|
|
|
542
542
|
const ret = wasm.pubkyclient_delete(this.__wbg_ptr, ptr0, len0);
|
|
543
543
|
return takeObject(ret);
|
|
544
544
|
}
|
|
545
|
+
/**
|
|
546
|
+
* Returns a list of Pubky URLs of the files within the `url` path,
|
|
547
|
+
* respecting the `cursor`, `reverse` and `limit` options.
|
|
548
|
+
*
|
|
549
|
+
* `cursor` is usually the last url from previous responses.
|
|
550
|
+
* @param {string} url
|
|
551
|
+
* @param {string | undefined} [cursor]
|
|
552
|
+
* @param {boolean | undefined} [reverse]
|
|
553
|
+
* @param {number | undefined} [limit]
|
|
554
|
+
* @returns {Promise<Array<any>>}
|
|
555
|
+
*/
|
|
556
|
+
list(url, cursor, reverse, limit) {
|
|
557
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
558
|
+
const len0 = WASM_VECTOR_LEN;
|
|
559
|
+
var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
560
|
+
var len1 = WASM_VECTOR_LEN;
|
|
561
|
+
const ret = wasm.pubkyclient_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit);
|
|
562
|
+
return takeObject(ret);
|
|
563
|
+
}
|
|
545
564
|
}
|
|
546
565
|
module.exports.PubkyClient = PubkyClient;
|
|
547
566
|
|
|
@@ -651,6 +670,11 @@ class Session {
|
|
|
651
670
|
}
|
|
652
671
|
module.exports.Session = Session;
|
|
653
672
|
|
|
673
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
674
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
675
|
+
return addHeapObject(ret);
|
|
676
|
+
};
|
|
677
|
+
|
|
654
678
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
655
679
|
takeObject(arg0);
|
|
656
680
|
};
|
|
@@ -669,11 +693,6 @@ module.exports.__wbg_session_new = function(arg0) {
|
|
|
669
693
|
return addHeapObject(ret);
|
|
670
694
|
};
|
|
671
695
|
|
|
672
|
-
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
673
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
674
|
-
return addHeapObject(ret);
|
|
675
|
-
};
|
|
676
|
-
|
|
677
696
|
module.exports.__wbg_fetch_1e4e8ed1f64c7e28 = function(arg0) {
|
|
678
697
|
const ret = fetch(getObject(arg0));
|
|
679
698
|
return addHeapObject(ret);
|
|
@@ -824,6 +843,11 @@ module.exports.__wbg_getRandomValues_3aa56aa6edec874c = function() { return hand
|
|
|
824
843
|
getObject(arg0).getRandomValues(getObject(arg1));
|
|
825
844
|
}, arguments) };
|
|
826
845
|
|
|
846
|
+
module.exports.__wbg_new_16b304a2cfa7ff4a = function() {
|
|
847
|
+
const ret = new Array();
|
|
848
|
+
return addHeapObject(ret);
|
|
849
|
+
};
|
|
850
|
+
|
|
827
851
|
module.exports.__wbg_newnoargs_e258087cd0daa0ea = function(arg0, arg1) {
|
|
828
852
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
829
853
|
return addHeapObject(ret);
|
|
@@ -874,6 +898,11 @@ module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
|
874
898
|
return ret;
|
|
875
899
|
};
|
|
876
900
|
|
|
901
|
+
module.exports.__wbg_push_a5b05aedc7234f9f = function(arg0, arg1) {
|
|
902
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
903
|
+
return ret;
|
|
904
|
+
};
|
|
905
|
+
|
|
877
906
|
module.exports.__wbg_new_28c511d9baebfa89 = function(arg0, arg1) {
|
|
878
907
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
879
908
|
return addHeapObject(ret);
|
|
@@ -911,7 +940,7 @@ module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
|
|
|
911
940
|
const a = state0.a;
|
|
912
941
|
state0.a = 0;
|
|
913
942
|
try {
|
|
914
|
-
return
|
|
943
|
+
return __wbg_adapter_122(a, state0.b, arg0, arg1);
|
|
915
944
|
} finally {
|
|
916
945
|
state0.a = a;
|
|
917
946
|
}
|
|
@@ -1009,8 +1038,8 @@ module.exports.__wbindgen_memory = function() {
|
|
|
1009
1038
|
return addHeapObject(ret);
|
|
1010
1039
|
};
|
|
1011
1040
|
|
|
1012
|
-
module.exports.
|
|
1013
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1041
|
+
module.exports.__wbindgen_closure_wrapper1792 = function(arg0, arg1, arg2) {
|
|
1042
|
+
const ret = makeMutClosure(arg0, arg1, 295, __wbg_adapter_26);
|
|
1014
1043
|
return addHeapObject(ret);
|
|
1015
1044
|
};
|
|
1016
1045
|
|
package/package.json
CHANGED
package/pubky.d.ts
CHANGED
|
@@ -117,6 +117,18 @@ export class PubkyClient {
|
|
|
117
117
|
* @returns {Promise<void>}
|
|
118
118
|
*/
|
|
119
119
|
delete(url: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Returns a list of Pubky URLs of the files within the `url` path,
|
|
122
|
+
* respecting the `cursor`, `reverse` and `limit` options.
|
|
123
|
+
*
|
|
124
|
+
* `cursor` is usually the last url from previous responses.
|
|
125
|
+
* @param {string} url
|
|
126
|
+
* @param {string | undefined} [cursor]
|
|
127
|
+
* @param {boolean | undefined} [reverse]
|
|
128
|
+
* @param {number | undefined} [limit]
|
|
129
|
+
* @returns {Promise<Array<any>>}
|
|
130
|
+
*/
|
|
131
|
+
list(url: string, cursor?: string, reverse?: boolean, limit?: number): Promise<Array<any>>;
|
|
120
132
|
}
|
|
121
133
|
/**
|
|
122
134
|
*/
|
package/pubky_bg.wasm
CHANGED
|
Binary file
|