hyoo_sync_client 0.0.240 → 0.0.242
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/node.d.ts +32 -4
- package/node.deps.json +1 -1
- package/node.js +100 -2
- package/node.js.map +1 -1
- package/node.mjs +100 -2
- package/node.test.js +131 -2
- package/node.test.js.map +1 -1
- package/package.json +6 -1
- package/web.d.ts +81 -49
- package/web.deps.json +1 -1
- package/web.js +213 -94
- package/web.js.map +1 -1
- package/web.mjs +213 -94
- package/web.test.js +61 -5
- package/web.test.js.map +1 -1
package/web.js
CHANGED
|
@@ -400,6 +400,92 @@ var $;
|
|
|
400
400
|
;
|
|
401
401
|
"use strict";
|
|
402
402
|
var $;
|
|
403
|
+
(function ($) {
|
|
404
|
+
function $mol_base64_encode(src) {
|
|
405
|
+
throw new Error('Not implemented');
|
|
406
|
+
}
|
|
407
|
+
$.$mol_base64_encode = $mol_base64_encode;
|
|
408
|
+
})($ || ($ = {}));
|
|
409
|
+
//mol/base64/encode/encode.ts
|
|
410
|
+
;
|
|
411
|
+
"use strict";
|
|
412
|
+
var $;
|
|
413
|
+
(function ($) {
|
|
414
|
+
})($ || ($ = {}));
|
|
415
|
+
//mol/dom/context/context.ts
|
|
416
|
+
;
|
|
417
|
+
"use strict";
|
|
418
|
+
var $;
|
|
419
|
+
(function ($) {
|
|
420
|
+
$.$mol_dom_context = self;
|
|
421
|
+
})($ || ($ = {}));
|
|
422
|
+
//mol/dom/context/context.web.ts
|
|
423
|
+
;
|
|
424
|
+
"use strict";
|
|
425
|
+
var $;
|
|
426
|
+
(function ($) {
|
|
427
|
+
function binary_string(bytes) {
|
|
428
|
+
let binary = '';
|
|
429
|
+
if (typeof bytes !== 'string') {
|
|
430
|
+
for (const byte of bytes)
|
|
431
|
+
binary += String.fromCharCode(byte);
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
binary = unescape(encodeURIComponent(bytes));
|
|
435
|
+
}
|
|
436
|
+
return binary;
|
|
437
|
+
}
|
|
438
|
+
function $mol_base64_encode_web(str) {
|
|
439
|
+
return $mol_dom_context.btoa(binary_string(str));
|
|
440
|
+
}
|
|
441
|
+
$.$mol_base64_encode_web = $mol_base64_encode_web;
|
|
442
|
+
$.$mol_base64_encode = $mol_base64_encode_web;
|
|
443
|
+
})($ || ($ = {}));
|
|
444
|
+
//mol/base64/encode/encode.web.ts
|
|
445
|
+
;
|
|
446
|
+
"use strict";
|
|
447
|
+
var $;
|
|
448
|
+
(function ($) {
|
|
449
|
+
function $mol_base64_encode_safe(buffer) {
|
|
450
|
+
return $mol_base64_encode(buffer).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/, '');
|
|
451
|
+
}
|
|
452
|
+
$.$mol_base64_encode_safe = $mol_base64_encode_safe;
|
|
453
|
+
})($ || ($ = {}));
|
|
454
|
+
//mol/base64/encode/safe/safe.ts
|
|
455
|
+
;
|
|
456
|
+
"use strict";
|
|
457
|
+
var $;
|
|
458
|
+
(function ($) {
|
|
459
|
+
function $mol_base64_decode(base64) {
|
|
460
|
+
throw new Error('Not implemented');
|
|
461
|
+
}
|
|
462
|
+
$.$mol_base64_decode = $mol_base64_decode;
|
|
463
|
+
})($ || ($ = {}));
|
|
464
|
+
//mol/base64/decode/decode.ts
|
|
465
|
+
;
|
|
466
|
+
"use strict";
|
|
467
|
+
var $;
|
|
468
|
+
(function ($) {
|
|
469
|
+
function $mol_base64_decode_web(base64Str) {
|
|
470
|
+
return new Uint8Array($mol_dom_context.atob(base64Str).split('').map(c => c.charCodeAt(0)));
|
|
471
|
+
}
|
|
472
|
+
$.$mol_base64_decode_web = $mol_base64_decode_web;
|
|
473
|
+
$.$mol_base64_decode = $mol_base64_decode_web;
|
|
474
|
+
})($ || ($ = {}));
|
|
475
|
+
//mol/base64/decode/decode.web.ts
|
|
476
|
+
;
|
|
477
|
+
"use strict";
|
|
478
|
+
var $;
|
|
479
|
+
(function ($) {
|
|
480
|
+
function $mol_base64_decode_safe(str) {
|
|
481
|
+
return $mol_base64_decode(str.replace(/-/g, '+').replace(/_/g, '/'));
|
|
482
|
+
}
|
|
483
|
+
$.$mol_base64_decode_safe = $mol_base64_decode_safe;
|
|
484
|
+
})($ || ($ = {}));
|
|
485
|
+
//mol/base64/decode/safe/safe.ts
|
|
486
|
+
;
|
|
487
|
+
"use strict";
|
|
488
|
+
var $;
|
|
403
489
|
(function ($) {
|
|
404
490
|
const algorithm = {
|
|
405
491
|
name: 'ECDSA',
|
|
@@ -416,12 +502,17 @@ var $;
|
|
|
416
502
|
$.$mol_crypto_auditor_pair = $mol_crypto_auditor_pair;
|
|
417
503
|
class $mol_crypto_auditor_public extends Object {
|
|
418
504
|
native;
|
|
419
|
-
static
|
|
505
|
+
static size_str = 86;
|
|
506
|
+
static size_bin = 64;
|
|
420
507
|
constructor(native) {
|
|
421
508
|
super();
|
|
422
509
|
this.native = native;
|
|
423
510
|
}
|
|
424
511
|
static async from(serial) {
|
|
512
|
+
if (typeof serial !== 'string') {
|
|
513
|
+
serial = $mol_base64_encode_safe(serial.subarray(0, 32))
|
|
514
|
+
+ $mol_base64_encode_safe(serial.subarray(32, 64));
|
|
515
|
+
}
|
|
425
516
|
return new this(await $mol_crypto_native.subtle.importKey('jwk', {
|
|
426
517
|
crv: "P-256",
|
|
427
518
|
ext: true,
|
|
@@ -435,6 +526,13 @@ var $;
|
|
|
435
526
|
const { x, y } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
436
527
|
return x + y;
|
|
437
528
|
}
|
|
529
|
+
async toArray() {
|
|
530
|
+
const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
531
|
+
return new Uint8Array([
|
|
532
|
+
...$mol_base64_decode_safe(x),
|
|
533
|
+
...$mol_base64_decode_safe(y),
|
|
534
|
+
]);
|
|
535
|
+
}
|
|
438
536
|
async verify(data, sign) {
|
|
439
537
|
return await $mol_crypto_native.subtle.verify(algorithm, this.native, sign, data);
|
|
440
538
|
}
|
|
@@ -442,12 +540,18 @@ var $;
|
|
|
442
540
|
$.$mol_crypto_auditor_public = $mol_crypto_auditor_public;
|
|
443
541
|
class $mol_crypto_auditor_private extends Object {
|
|
444
542
|
native;
|
|
445
|
-
static
|
|
543
|
+
static size_str = 129;
|
|
544
|
+
static size_bin = 96;
|
|
446
545
|
constructor(native) {
|
|
447
546
|
super();
|
|
448
547
|
this.native = native;
|
|
449
548
|
}
|
|
450
549
|
static async from(serial) {
|
|
550
|
+
if (typeof serial !== 'string') {
|
|
551
|
+
serial = $mol_base64_encode_safe(serial.subarray(0, 32))
|
|
552
|
+
+ $mol_base64_encode_safe(serial.subarray(32, 64))
|
|
553
|
+
+ $mol_base64_encode_safe(serial.subarray(64));
|
|
554
|
+
}
|
|
451
555
|
return new this(await $mol_crypto_native.subtle.importKey('jwk', {
|
|
452
556
|
crv: "P-256",
|
|
453
557
|
ext: true,
|
|
@@ -462,6 +566,14 @@ var $;
|
|
|
462
566
|
const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
463
567
|
return x + y + d;
|
|
464
568
|
}
|
|
569
|
+
async toArray() {
|
|
570
|
+
const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
|
|
571
|
+
return new Uint8Array([
|
|
572
|
+
...$mol_base64_decode_safe(x),
|
|
573
|
+
...$mol_base64_decode_safe(y),
|
|
574
|
+
...$mol_base64_decode_safe(d),
|
|
575
|
+
]);
|
|
576
|
+
}
|
|
465
577
|
async sign(data) {
|
|
466
578
|
return await $mol_crypto_native.subtle.sign(algorithm, this.native, data);
|
|
467
579
|
}
|
|
@@ -1411,11 +1523,15 @@ var $;
|
|
|
1411
1523
|
(function ($) {
|
|
1412
1524
|
$.$mol_key_store = new WeakMap();
|
|
1413
1525
|
function $mol_key(value) {
|
|
1526
|
+
if (typeof value === 'bigint')
|
|
1527
|
+
return value.toString() + 'n';
|
|
1414
1528
|
if (!value)
|
|
1415
1529
|
return JSON.stringify(value);
|
|
1416
1530
|
if (typeof value !== 'object' && typeof value !== 'function')
|
|
1417
1531
|
return JSON.stringify(value);
|
|
1418
1532
|
return JSON.stringify(value, (field, value) => {
|
|
1533
|
+
if (typeof value === 'bigint')
|
|
1534
|
+
return value.toString() + 'n';
|
|
1419
1535
|
if (!value)
|
|
1420
1536
|
return value;
|
|
1421
1537
|
if (typeof value !== 'object' && typeof value !== 'function')
|
|
@@ -1937,19 +2053,6 @@ var $;
|
|
|
1937
2053
|
;
|
|
1938
2054
|
"use strict";
|
|
1939
2055
|
var $;
|
|
1940
|
-
(function ($) {
|
|
1941
|
-
})($ || ($ = {}));
|
|
1942
|
-
//mol/dom/context/context.ts
|
|
1943
|
-
;
|
|
1944
|
-
"use strict";
|
|
1945
|
-
var $;
|
|
1946
|
-
(function ($) {
|
|
1947
|
-
$.$mol_dom_context = self;
|
|
1948
|
-
})($ || ($ = {}));
|
|
1949
|
-
//mol/dom/context/context.web.ts
|
|
1950
|
-
;
|
|
1951
|
-
"use strict";
|
|
1952
|
-
var $;
|
|
1953
2056
|
(function ($) {
|
|
1954
2057
|
function $mol_dom_render_children(el, childNodes) {
|
|
1955
2058
|
const node_set = new Set(childNodes);
|
|
@@ -2172,16 +2275,108 @@ var $;
|
|
|
2172
2275
|
;
|
|
2173
2276
|
"use strict";
|
|
2174
2277
|
var $;
|
|
2278
|
+
(function ($) {
|
|
2279
|
+
function $mol_wire_probe(task, def) {
|
|
2280
|
+
const warm = $mol_wire_fiber.warm;
|
|
2281
|
+
try {
|
|
2282
|
+
$mol_wire_fiber.warm = false;
|
|
2283
|
+
const res = task();
|
|
2284
|
+
if (res === undefined)
|
|
2285
|
+
return def;
|
|
2286
|
+
return res;
|
|
2287
|
+
}
|
|
2288
|
+
finally {
|
|
2289
|
+
$mol_wire_fiber.warm = warm;
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
$.$mol_wire_probe = $mol_wire_probe;
|
|
2293
|
+
})($ || ($ = {}));
|
|
2294
|
+
//mol/wire/probe/probe.ts
|
|
2295
|
+
;
|
|
2296
|
+
"use strict";
|
|
2297
|
+
var $;
|
|
2298
|
+
(function ($) {
|
|
2299
|
+
$.$mol_mem_cached = $mol_wire_probe;
|
|
2300
|
+
})($ || ($ = {}));
|
|
2301
|
+
//mol/mem/cached/cached.ts
|
|
2302
|
+
;
|
|
2303
|
+
"use strict";
|
|
2304
|
+
var $;
|
|
2305
|
+
(function ($) {
|
|
2306
|
+
function $mol_log3_area_lazy(event) {
|
|
2307
|
+
const self = this;
|
|
2308
|
+
const stack = self.$mol_log3_stack;
|
|
2309
|
+
const deep = stack.length;
|
|
2310
|
+
let logged = false;
|
|
2311
|
+
stack.push(() => {
|
|
2312
|
+
logged = true;
|
|
2313
|
+
self.$mol_log3_area.call(self, event);
|
|
2314
|
+
});
|
|
2315
|
+
return () => {
|
|
2316
|
+
if (logged)
|
|
2317
|
+
self.console.groupEnd();
|
|
2318
|
+
if (stack.length > deep)
|
|
2319
|
+
stack.length = deep;
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
2322
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
2323
|
+
$.$mol_log3_stack = [];
|
|
2324
|
+
})($ || ($ = {}));
|
|
2325
|
+
//mol/log3/log3.ts
|
|
2326
|
+
;
|
|
2327
|
+
"use strict";
|
|
2328
|
+
//mol/type/keys/extract/extract.ts
|
|
2329
|
+
;
|
|
2330
|
+
"use strict";
|
|
2331
|
+
var $;
|
|
2332
|
+
(function ($) {
|
|
2333
|
+
function $mol_log3_web_make(level, color) {
|
|
2334
|
+
return function $mol_log3_logger(event) {
|
|
2335
|
+
const pending = this.$mol_log3_stack.pop();
|
|
2336
|
+
if (pending)
|
|
2337
|
+
pending();
|
|
2338
|
+
let tpl = '%c';
|
|
2339
|
+
const chunks = Object.values(event);
|
|
2340
|
+
for (let i = 0; i < chunks.length; ++i) {
|
|
2341
|
+
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
2342
|
+
}
|
|
2343
|
+
const style = `color:${color};font-weight:bolder`;
|
|
2344
|
+
this.console[level](tpl, style, ...chunks);
|
|
2345
|
+
const self = this;
|
|
2346
|
+
return () => self.console.groupEnd();
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
2350
|
+
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
2351
|
+
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
2352
|
+
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
2353
|
+
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
2354
|
+
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
2355
|
+
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
2356
|
+
})($ || ($ = {}));
|
|
2357
|
+
//mol/log3/log3.web.ts
|
|
2358
|
+
;
|
|
2359
|
+
"use strict";
|
|
2360
|
+
var $;
|
|
2175
2361
|
(function ($) {
|
|
2176
2362
|
class $mol_storage extends $mol_object2 {
|
|
2177
2363
|
static native() {
|
|
2178
2364
|
return this.$.$mol_dom_context.navigator.storage;
|
|
2179
2365
|
}
|
|
2180
|
-
static persisted(next) {
|
|
2366
|
+
static persisted(next, cache) {
|
|
2181
2367
|
$mol_mem_persist();
|
|
2368
|
+
if (cache)
|
|
2369
|
+
return Boolean(next);
|
|
2182
2370
|
const native = this.native();
|
|
2183
|
-
if (next)
|
|
2184
|
-
native.persist()
|
|
2371
|
+
if (next && !$mol_mem_cached(() => this.persisted())) {
|
|
2372
|
+
native.persist().then(actual => {
|
|
2373
|
+
setTimeout(() => this.persisted(actual, 'cache'), 5000);
|
|
2374
|
+
if (actual)
|
|
2375
|
+
this.$.$mol_log3_rise({ place: this, message: `Persist` });
|
|
2376
|
+
else
|
|
2377
|
+
this.$.$mol_log3_fail({ place: this, message: `Non persist` });
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2185
2380
|
return next ?? $mol_wire_sync(native).persisted();
|
|
2186
2381
|
}
|
|
2187
2382
|
static estimate() {
|
|
@@ -3381,62 +3576,6 @@ var $;
|
|
|
3381
3576
|
;
|
|
3382
3577
|
"use strict";
|
|
3383
3578
|
var $;
|
|
3384
|
-
(function ($) {
|
|
3385
|
-
function $mol_log3_area_lazy(event) {
|
|
3386
|
-
const self = this;
|
|
3387
|
-
const stack = self.$mol_log3_stack;
|
|
3388
|
-
const deep = stack.length;
|
|
3389
|
-
let logged = false;
|
|
3390
|
-
stack.push(() => {
|
|
3391
|
-
logged = true;
|
|
3392
|
-
self.$mol_log3_area.call(self, event);
|
|
3393
|
-
});
|
|
3394
|
-
return () => {
|
|
3395
|
-
if (logged)
|
|
3396
|
-
self.console.groupEnd();
|
|
3397
|
-
if (stack.length > deep)
|
|
3398
|
-
stack.length = deep;
|
|
3399
|
-
};
|
|
3400
|
-
}
|
|
3401
|
-
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
3402
|
-
$.$mol_log3_stack = [];
|
|
3403
|
-
})($ || ($ = {}));
|
|
3404
|
-
//mol/log3/log3.ts
|
|
3405
|
-
;
|
|
3406
|
-
"use strict";
|
|
3407
|
-
//mol/type/keys/extract/extract.ts
|
|
3408
|
-
;
|
|
3409
|
-
"use strict";
|
|
3410
|
-
var $;
|
|
3411
|
-
(function ($) {
|
|
3412
|
-
function $mol_log3_web_make(level, color) {
|
|
3413
|
-
return function $mol_log3_logger(event) {
|
|
3414
|
-
const pending = this.$mol_log3_stack.pop();
|
|
3415
|
-
if (pending)
|
|
3416
|
-
pending();
|
|
3417
|
-
let tpl = '%c';
|
|
3418
|
-
const chunks = Object.values(event);
|
|
3419
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
3420
|
-
tpl += (typeof chunks[i] === 'string') ? ' ⦙ %s' : ' ⦙ %o';
|
|
3421
|
-
}
|
|
3422
|
-
const style = `color:${color};font-weight:bolder`;
|
|
3423
|
-
this.console[level](tpl, style, ...chunks);
|
|
3424
|
-
const self = this;
|
|
3425
|
-
return () => self.console.groupEnd();
|
|
3426
|
-
};
|
|
3427
|
-
}
|
|
3428
|
-
$.$mol_log3_web_make = $mol_log3_web_make;
|
|
3429
|
-
$.$mol_log3_come = $mol_log3_web_make('info', 'royalblue');
|
|
3430
|
-
$.$mol_log3_done = $mol_log3_web_make('info', 'forestgreen');
|
|
3431
|
-
$.$mol_log3_fail = $mol_log3_web_make('error', 'orangered');
|
|
3432
|
-
$.$mol_log3_warn = $mol_log3_web_make('warn', 'goldenrod');
|
|
3433
|
-
$.$mol_log3_rise = $mol_log3_web_make('log', 'magenta');
|
|
3434
|
-
$.$mol_log3_area = $mol_log3_web_make('group', 'cyan');
|
|
3435
|
-
})($ || ($ = {}));
|
|
3436
|
-
//mol/log3/log3.web.ts
|
|
3437
|
-
;
|
|
3438
|
-
"use strict";
|
|
3439
|
-
var $;
|
|
3440
3579
|
(function ($) {
|
|
3441
3580
|
$.$hyoo_sync_masters = [
|
|
3442
3581
|
`sync.hyoo.ru`,
|
|
@@ -3952,26 +4091,6 @@ var $;
|
|
|
3952
4091
|
;
|
|
3953
4092
|
"use strict";
|
|
3954
4093
|
var $;
|
|
3955
|
-
(function ($) {
|
|
3956
|
-
function $mol_wire_probe(task, def) {
|
|
3957
|
-
const warm = $mol_wire_fiber.warm;
|
|
3958
|
-
try {
|
|
3959
|
-
$mol_wire_fiber.warm = false;
|
|
3960
|
-
const res = task();
|
|
3961
|
-
if (res === undefined)
|
|
3962
|
-
return def;
|
|
3963
|
-
return res;
|
|
3964
|
-
}
|
|
3965
|
-
finally {
|
|
3966
|
-
$mol_wire_fiber.warm = warm;
|
|
3967
|
-
}
|
|
3968
|
-
}
|
|
3969
|
-
$.$mol_wire_probe = $mol_wire_probe;
|
|
3970
|
-
})($ || ($ = {}));
|
|
3971
|
-
//mol/wire/probe/probe.ts
|
|
3972
|
-
;
|
|
3973
|
-
"use strict";
|
|
3974
|
-
var $;
|
|
3975
4094
|
(function ($) {
|
|
3976
4095
|
class $mol_db_database {
|
|
3977
4096
|
native;
|