hyoo_sync_client 0.0.351 → 0.0.353
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 +3 -6
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +5 -23
- package/node.js.map +1 -1
- package/node.mjs +5 -23
- package/node.test.js +24 -52
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +3 -6
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +9 -23
- package/web.js.map +1 -1
- package/web.mjs +9 -23
- package/web.test.js +19 -29
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -996,28 +996,11 @@ var $;
|
|
|
996
996
|
var $;
|
|
997
997
|
(function ($) {
|
|
998
998
|
class $mol_error_mix extends AggregateError {
|
|
999
|
-
|
|
1000
|
-
constructor(
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
return [].concat(...this.errors.map(e => e.cause).filter(Boolean));
|
|
1005
|
-
}
|
|
1006
|
-
toJSON() {
|
|
1007
|
-
return this.errors.map(e => e.message);
|
|
1008
|
-
}
|
|
1009
|
-
pick(Class) {
|
|
1010
|
-
if (this instanceof Class)
|
|
1011
|
-
return this;
|
|
1012
|
-
for (const e of this.errors) {
|
|
1013
|
-
if (e instanceof Class)
|
|
1014
|
-
return e;
|
|
1015
|
-
}
|
|
1016
|
-
for (const e of this.cause) {
|
|
1017
|
-
if (e && e instanceof Class)
|
|
1018
|
-
return e;
|
|
1019
|
-
}
|
|
1020
|
-
return null;
|
|
999
|
+
cause;
|
|
1000
|
+
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
|
1001
|
+
constructor(message, cause, ...errors) {
|
|
1002
|
+
super(errors, message, { cause });
|
|
1003
|
+
this.cause = cause;
|
|
1021
1004
|
}
|
|
1022
1005
|
}
|
|
1023
1006
|
$.$mol_error_mix = $mol_error_mix;
|
|
@@ -1028,7 +1011,6 @@ var $;
|
|
|
1028
1011
|
var $;
|
|
1029
1012
|
(function ($) {
|
|
1030
1013
|
class $mol_data_error extends $mol_error_mix {
|
|
1031
|
-
name = '$mol_data_error';
|
|
1032
1014
|
}
|
|
1033
1015
|
$.$mol_data_error = $mol_data_error;
|
|
1034
1016
|
})($ || ($ = {}));
|
package/node.test.js
CHANGED
|
@@ -987,28 +987,11 @@ var $;
|
|
|
987
987
|
var $;
|
|
988
988
|
(function ($) {
|
|
989
989
|
class $mol_error_mix extends AggregateError {
|
|
990
|
-
|
|
991
|
-
constructor(
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
return [].concat(...this.errors.map(e => e.cause).filter(Boolean));
|
|
996
|
-
}
|
|
997
|
-
toJSON() {
|
|
998
|
-
return this.errors.map(e => e.message);
|
|
999
|
-
}
|
|
1000
|
-
pick(Class) {
|
|
1001
|
-
if (this instanceof Class)
|
|
1002
|
-
return this;
|
|
1003
|
-
for (const e of this.errors) {
|
|
1004
|
-
if (e instanceof Class)
|
|
1005
|
-
return e;
|
|
1006
|
-
}
|
|
1007
|
-
for (const e of this.cause) {
|
|
1008
|
-
if (e && e instanceof Class)
|
|
1009
|
-
return e;
|
|
1010
|
-
}
|
|
1011
|
-
return null;
|
|
990
|
+
cause;
|
|
991
|
+
name = $$.$mol_func_name(this.constructor).replace(/^\$/, '') + '_Error';
|
|
992
|
+
constructor(message, cause, ...errors) {
|
|
993
|
+
super(errors, message, { cause });
|
|
994
|
+
this.cause = cause;
|
|
1012
995
|
}
|
|
1013
996
|
}
|
|
1014
997
|
$.$mol_error_mix = $mol_error_mix;
|
|
@@ -1019,7 +1002,6 @@ var $;
|
|
|
1019
1002
|
var $;
|
|
1020
1003
|
(function ($) {
|
|
1021
1004
|
class $mol_data_error extends $mol_error_mix {
|
|
1022
|
-
name = '$mol_data_error';
|
|
1023
1005
|
}
|
|
1024
1006
|
$.$mol_data_error = $mol_data_error;
|
|
1025
1007
|
})($ || ($ = {}));
|
|
@@ -5664,39 +5646,29 @@ var $;
|
|
|
5664
5646
|
(function ($) {
|
|
5665
5647
|
$mol_test({
|
|
5666
5648
|
'auto name'() {
|
|
5667
|
-
class
|
|
5649
|
+
class Invalid extends $mol_error_mix {
|
|
5668
5650
|
}
|
|
5669
|
-
const mix = new
|
|
5670
|
-
$mol_assert_equal(mix.name, '
|
|
5651
|
+
const mix = new Invalid('foo');
|
|
5652
|
+
$mol_assert_equal(mix.name, 'Invalid_Error');
|
|
5671
5653
|
},
|
|
5672
|
-
'
|
|
5673
|
-
const mix = new $mol_error_mix('foo');
|
|
5654
|
+
'simpe mix'() {
|
|
5655
|
+
const mix = new $mol_error_mix('foo', null, new Error('bar'), new Error('lol'));
|
|
5674
5656
|
$mol_assert_equal(mix.message, 'foo');
|
|
5675
|
-
$mol_assert_equal(mix.
|
|
5657
|
+
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
|
|
5676
5658
|
},
|
|
5677
|
-
'
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
$
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
new SyntaxError('xxx1'),
|
|
5691
|
-
new SyntaxError('xxx2'),
|
|
5692
|
-
new TypeError('lol0'),
|
|
5693
|
-
],
|
|
5694
|
-
}), new TypeError('lol1', {
|
|
5695
|
-
cause: new TypeError('xxx3'),
|
|
5696
|
-
}), new TypeError('lol2'));
|
|
5697
|
-
$mol_assert_equal(mix.pick(RangeError).message, 'bar');
|
|
5698
|
-
$mol_assert_equal(mix.pick(SyntaxError).message, 'xxx1');
|
|
5699
|
-
$mol_assert_equal(mix.pick(TypeError).message, 'lol1');
|
|
5659
|
+
'provide additional info'() {
|
|
5660
|
+
class Invalid extends $mol_error_mix {
|
|
5661
|
+
}
|
|
5662
|
+
const mix = new $mol_error_mix('Wrong password', null, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
|
|
5663
|
+
const hints = [];
|
|
5664
|
+
if (mix instanceof $mol_error_mix) {
|
|
5665
|
+
for (const er of mix.errors) {
|
|
5666
|
+
if (er instanceof Invalid) {
|
|
5667
|
+
hints.push(er.cause?.hint ?? '');
|
|
5668
|
+
}
|
|
5669
|
+
}
|
|
5670
|
+
}
|
|
5671
|
+
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
|
|
5700
5672
|
},
|
|
5701
5673
|
});
|
|
5702
5674
|
})($ || ($ = {}));
|