@synonymdev/pubky 0.5.0-rc.2 → 0.5.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/index.cjs +60 -61
- package/index.js +65 -66
- package/package.json +1 -1
- package/pubky.d.ts +12 -12
- package/pubky_bg.wasm +0 -0
package/index.cjs
CHANGED
|
@@ -229,17 +229,6 @@ module.exports.setLogLevel = function(level) {
|
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
-
function getArrayJsValueFromWasm0(ptr, len) {
|
|
233
|
-
ptr = ptr >>> 0;
|
|
234
|
-
const mem = getDataViewMemory0();
|
|
235
|
-
const result = [];
|
|
236
|
-
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
237
|
-
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
238
|
-
}
|
|
239
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
240
|
-
return result;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
232
|
function _assertClass(instance, klass) {
|
|
244
233
|
if (!(instance instanceof klass)) {
|
|
245
234
|
throw new Error(`expected instance of ${klass.name}`);
|
|
@@ -285,20 +274,30 @@ module.exports.decryptRecoveryFile = function(recovery_file, passphrase) {
|
|
|
285
274
|
return Keypair.__wrap(ret[0]);
|
|
286
275
|
};
|
|
287
276
|
|
|
277
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
278
|
+
ptr = ptr >>> 0;
|
|
279
|
+
const mem = getDataViewMemory0();
|
|
280
|
+
const result = [];
|
|
281
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
282
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
283
|
+
}
|
|
284
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
288
287
|
function __wbg_adapter_30(arg0, arg1) {
|
|
289
|
-
wasm.
|
|
288
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h457b2f02283a1dc1(arg0, arg1);
|
|
290
289
|
}
|
|
291
290
|
|
|
292
291
|
function __wbg_adapter_33(arg0, arg1) {
|
|
293
|
-
wasm.
|
|
292
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb951c8f299470c3c(arg0, arg1);
|
|
294
293
|
}
|
|
295
294
|
|
|
296
295
|
function __wbg_adapter_36(arg0, arg1, arg2) {
|
|
297
|
-
wasm.
|
|
296
|
+
wasm.closure602_externref_shim(arg0, arg1, arg2);
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
function __wbg_adapter_178(arg0, arg1, arg2, arg3) {
|
|
301
|
-
wasm.
|
|
300
|
+
wasm.closure622_externref_shim(arg0, arg1, arg2, arg3);
|
|
302
301
|
}
|
|
303
302
|
|
|
304
303
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -389,6 +388,30 @@ class Client {
|
|
|
389
388
|
const ptr = this.__destroy_into_raw();
|
|
390
389
|
wasm.__wbg_client_free(ptr, 0);
|
|
391
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Returns a list of Pubky urls (as strings).
|
|
393
|
+
*
|
|
394
|
+
* - `url`: The Pubky url (string) to the directory you want to list its content.
|
|
395
|
+
* - `cursor`: Either a full `pubky://` Url (from previous list response),
|
|
396
|
+
* or a path (to a file or directory) relative to the `url`
|
|
397
|
+
* - `reverse`: List in reverse order
|
|
398
|
+
* - `limit` Limit the number of urls in the response
|
|
399
|
+
* - `shallow`: List directories and files, instead of flat list of files.
|
|
400
|
+
* @param {string} url
|
|
401
|
+
* @param {string | null} [cursor]
|
|
402
|
+
* @param {boolean | null} [reverse]
|
|
403
|
+
* @param {number | null} [limit]
|
|
404
|
+
* @param {boolean | null} [shallow]
|
|
405
|
+
* @returns {Promise<Array<any>>}
|
|
406
|
+
*/
|
|
407
|
+
list(url, cursor, reverse, limit, shallow) {
|
|
408
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
409
|
+
const len0 = WASM_VECTOR_LEN;
|
|
410
|
+
var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
411
|
+
var len1 = WASM_VECTOR_LEN;
|
|
412
|
+
const ret = wasm.client_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
|
|
413
|
+
return ret;
|
|
414
|
+
}
|
|
392
415
|
/**
|
|
393
416
|
* Signup to a homeserver and update Pkarr accordingly.
|
|
394
417
|
*
|
|
@@ -510,6 +533,17 @@ class Client {
|
|
|
510
533
|
const ret = wasm.client_republishHomeserver(this.__wbg_ptr, keypair.__wbg_ptr, host.__wbg_ptr);
|
|
511
534
|
return ret;
|
|
512
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* @param {string} url
|
|
538
|
+
* @param {any | null} [request_init]
|
|
539
|
+
* @returns {Promise<Promise<any>>}
|
|
540
|
+
*/
|
|
541
|
+
fetch(url, request_init) {
|
|
542
|
+
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
543
|
+
const len0 = WASM_VECTOR_LEN;
|
|
544
|
+
const ret = wasm.client_fetch(this.__wbg_ptr, ptr0, len0, isLikeNone(request_init) ? 0 : addToExternrefTable0(request_init));
|
|
545
|
+
return ret;
|
|
546
|
+
}
|
|
513
547
|
/**
|
|
514
548
|
* Create a new Pubky Client with an optional configuration.
|
|
515
549
|
* @param {PubkyClientConfig | null} [config_opt]
|
|
@@ -534,41 +568,6 @@ class Client {
|
|
|
534
568
|
const ret = wasm.client_testnet();
|
|
535
569
|
return Client.__wrap(ret);
|
|
536
570
|
}
|
|
537
|
-
/**
|
|
538
|
-
* @param {string} url
|
|
539
|
-
* @param {any | null} [request_init]
|
|
540
|
-
* @returns {Promise<Promise<any>>}
|
|
541
|
-
*/
|
|
542
|
-
fetch(url, request_init) {
|
|
543
|
-
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
544
|
-
const len0 = WASM_VECTOR_LEN;
|
|
545
|
-
const ret = wasm.client_fetch(this.__wbg_ptr, ptr0, len0, isLikeNone(request_init) ? 0 : addToExternrefTable0(request_init));
|
|
546
|
-
return ret;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Returns a list of Pubky urls (as strings).
|
|
550
|
-
*
|
|
551
|
-
* - `url`: The Pubky url (string) to the directory you want to list its content.
|
|
552
|
-
* - `cursor`: Either a full `pubky://` Url (from previous list response),
|
|
553
|
-
* or a path (to a file or directory) relative to the `url`
|
|
554
|
-
* - `reverse`: List in reverse order
|
|
555
|
-
* - `limit` Limit the number of urls in the response
|
|
556
|
-
* - `shallow`: List directories and files, instead of flat list of files.
|
|
557
|
-
* @param {string} url
|
|
558
|
-
* @param {string | null} [cursor]
|
|
559
|
-
* @param {boolean | null} [reverse]
|
|
560
|
-
* @param {number | null} [limit]
|
|
561
|
-
* @param {boolean | null} [shallow]
|
|
562
|
-
* @returns {Promise<Array<any>>}
|
|
563
|
-
*/
|
|
564
|
-
list(url, cursor, reverse, limit, shallow) {
|
|
565
|
-
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
566
|
-
const len0 = WASM_VECTOR_LEN;
|
|
567
|
-
var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
568
|
-
var len1 = WASM_VECTOR_LEN;
|
|
569
|
-
const ret = wasm.client_list(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(reverse) ? 0xFFFFFF : reverse ? 1 : 0, isLikeNone(limit) ? 0xFFFFFF : limit, isLikeNone(shallow) ? 0xFFFFFF : shallow ? 1 : 0);
|
|
570
|
-
return ret;
|
|
571
|
-
}
|
|
572
571
|
}
|
|
573
572
|
module.exports.Client = Client;
|
|
574
573
|
|
|
@@ -825,17 +824,17 @@ module.exports.__wbg_error_80de38b3f7cc3c3c = function(arg0, arg1, arg2, arg3) {
|
|
|
825
824
|
console.error(arg0, arg1, arg2, arg3);
|
|
826
825
|
};
|
|
827
826
|
|
|
828
|
-
module.exports.
|
|
829
|
-
const ret =
|
|
827
|
+
module.exports.__wbg_fetch_00edbc0718dc5567 = function(arg0) {
|
|
828
|
+
const ret = fetch(arg0);
|
|
830
829
|
return ret;
|
|
831
830
|
};
|
|
832
831
|
|
|
833
|
-
module.exports.
|
|
834
|
-
const ret = fetch(
|
|
832
|
+
module.exports.__wbg_fetch_509096533071c657 = function(arg0, arg1) {
|
|
833
|
+
const ret = arg0.fetch(arg1);
|
|
835
834
|
return ret;
|
|
836
835
|
};
|
|
837
836
|
|
|
838
|
-
module.exports.
|
|
837
|
+
module.exports.__wbg_fetch_d36a73832f0a45e8 = function(arg0) {
|
|
839
838
|
const ret = fetch(arg0);
|
|
840
839
|
return ret;
|
|
841
840
|
};
|
|
@@ -1154,18 +1153,18 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
1154
1153
|
return ret;
|
|
1155
1154
|
};
|
|
1156
1155
|
|
|
1157
|
-
module.exports.
|
|
1158
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1156
|
+
module.exports.__wbindgen_closure_wrapper1056 = function(arg0, arg1, arg2) {
|
|
1157
|
+
const ret = makeMutClosure(arg0, arg1, 292, __wbg_adapter_30);
|
|
1159
1158
|
return ret;
|
|
1160
1159
|
};
|
|
1161
1160
|
|
|
1162
|
-
module.exports.
|
|
1163
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1161
|
+
module.exports.__wbindgen_closure_wrapper2891 = function(arg0, arg1, arg2) {
|
|
1162
|
+
const ret = makeMutClosure(arg0, arg1, 565, __wbg_adapter_33);
|
|
1164
1163
|
return ret;
|
|
1165
1164
|
};
|
|
1166
1165
|
|
|
1167
|
-
module.exports.
|
|
1168
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1166
|
+
module.exports.__wbindgen_closure_wrapper3118 = function(arg0, arg1, arg2) {
|
|
1167
|
+
const ret = makeMutClosure(arg0, arg1, 603, __wbg_adapter_36);
|
|
1169
1168
|
return ret;
|
|
1170
1169
|
};
|
|
1171
1170
|
|