hyoo_sync_client 0.0.255 → 0.0.257

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.mjs CHANGED
@@ -91,7 +91,7 @@ var $;
91
91
  try {
92
92
  if (!having)
93
93
  return false;
94
- if (typeof having !== 'object')
94
+ if (typeof having !== 'object' && typeof having !== 'function')
95
95
  return false;
96
96
  if (having instanceof $mol_delegate)
97
97
  return false;
@@ -227,11 +227,12 @@ var $;
227
227
  return this.name;
228
228
  }
229
229
  destructor() { }
230
+ static destructor() { }
230
231
  toString() {
231
232
  return this[Symbol.toStringTag] || this.constructor.name + '()';
232
233
  }
233
234
  static toJSON() {
234
- return this.$.$mol_func_name(this);
235
+ return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
235
236
  }
236
237
  toJSON() {
237
238
  return this.toString();
@@ -2661,19 +2662,87 @@ var $;
2661
2662
  ;
2662
2663
  "use strict";
2663
2664
  var $;
2665
+ (function ($) {
2666
+ function $mol_wire_solid() {
2667
+ const current = $mol_wire_auto();
2668
+ if (current.reap !== nothing) {
2669
+ current?.sub_on(sub, sub.data.length);
2670
+ }
2671
+ current.reap = nothing;
2672
+ }
2673
+ $.$mol_wire_solid = $mol_wire_solid;
2674
+ const nothing = () => { };
2675
+ const sub = new $mol_wire_pub_sub;
2676
+ })($ || ($ = {}));
2677
+ //mol/wire/solid/solid.ts
2678
+ ;
2679
+ "use strict";
2680
+ var $;
2681
+ (function ($) {
2682
+ $.$mol_mem_persist = $mol_wire_solid;
2683
+ })($ || ($ = {}));
2684
+ //mol/mem/persist/persist.ts
2685
+ ;
2686
+ "use strict";
2687
+ var $;
2688
+ (function ($) {
2689
+ function $mol_wire_probe(task, def) {
2690
+ const warm = $mol_wire_fiber.warm;
2691
+ try {
2692
+ $mol_wire_fiber.warm = false;
2693
+ const res = task();
2694
+ if (res === undefined)
2695
+ return def;
2696
+ return res;
2697
+ }
2698
+ finally {
2699
+ $mol_wire_fiber.warm = warm;
2700
+ }
2701
+ }
2702
+ $.$mol_wire_probe = $mol_wire_probe;
2703
+ })($ || ($ = {}));
2704
+ //mol/wire/probe/probe.ts
2705
+ ;
2706
+ "use strict";
2707
+ var $;
2708
+ (function ($) {
2709
+ $.$mol_mem_cached = $mol_wire_probe;
2710
+ })($ || ($ = {}));
2711
+ //mol/mem/cached/cached.ts
2712
+ ;
2713
+ "use strict";
2714
+ var $;
2664
2715
  (function ($) {
2665
2716
  class $mol_storage extends $mol_object2 {
2666
2717
  static native() {
2667
- return null;
2718
+ return this.$.$mol_dom_context.navigator.storage ?? {
2719
+ persisted: async () => false,
2720
+ persist: async () => false,
2721
+ estimate: async () => ({}),
2722
+ getDirectory: async () => null,
2723
+ };
2668
2724
  }
2669
- static persisted(next) {
2670
- return false;
2725
+ static persisted(next, cache) {
2726
+ $mol_mem_persist();
2727
+ if (cache)
2728
+ return Boolean(next);
2729
+ const native = this.native();
2730
+ if (next && !$mol_mem_cached(() => this.persisted())) {
2731
+ native.persist().then(actual => {
2732
+ setTimeout(() => this.persisted(actual, 'cache'), 5000);
2733
+ if (actual)
2734
+ this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
2735
+ else
2736
+ this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
2737
+ });
2738
+ }
2739
+ return next ?? $mol_wire_sync(native).persisted();
2671
2740
  }
2672
2741
  static estimate() {
2673
- return 0;
2742
+ return $mol_wire_sync(this.native() ?? {}).estimate();
2674
2743
  }
2675
2744
  static dir() {
2676
- return null;
2745
+ return $mol_wire_sync(this.native()).getDirectory();
2677
2746
  }
2678
2747
  }
2679
2748
  __decorate([
@@ -2684,7 +2753,7 @@ var $;
2684
2753
  ], $mol_storage, "persisted", null);
2685
2754
  $.$mol_storage = $mol_storage;
2686
2755
  })($ || ($ = {}));
2687
- //mol/storage/storage.node.ts
2756
+ //mol/storage/storage.ts
2688
2757
  ;
2689
2758
  "use strict";
2690
2759
  var $;
@@ -2764,22 +2833,6 @@ var $;
2764
2833
  ;
2765
2834
  "use strict";
2766
2835
  var $;
2767
- (function ($) {
2768
- function $mol_wire_solid() {
2769
- const current = $mol_wire_auto();
2770
- if (current.reap !== nothing) {
2771
- current?.sub_on(sub, sub.data.length);
2772
- }
2773
- current.reap = nothing;
2774
- }
2775
- $.$mol_wire_solid = $mol_wire_solid;
2776
- const nothing = () => { };
2777
- const sub = new $mol_wire_pub_sub;
2778
- })($ || ($ = {}));
2779
- //mol/wire/solid/solid.ts
2780
- ;
2781
- "use strict";
2782
- var $;
2783
2836
  (function ($) {
2784
2837
  class $mol_wrapper extends $mol_object2 {
2785
2838
  static wrap;
@@ -4356,26 +4409,6 @@ var $;
4356
4409
  ;
4357
4410
  "use strict";
4358
4411
  var $;
4359
- (function ($) {
4360
- function $mol_wire_probe(task, def) {
4361
- const warm = $mol_wire_fiber.warm;
4362
- try {
4363
- $mol_wire_fiber.warm = false;
4364
- const res = task();
4365
- if (res === undefined)
4366
- return def;
4367
- return res;
4368
- }
4369
- finally {
4370
- $mol_wire_fiber.warm = warm;
4371
- }
4372
- }
4373
- $.$mol_wire_probe = $mol_wire_probe;
4374
- })($ || ($ = {}));
4375
- //mol/wire/probe/probe.ts
4376
- ;
4377
- "use strict";
4378
- var $;
4379
4412
  (function ($) {
4380
4413
  class $mol_db_database {
4381
4414
  native;
package/node.test.js CHANGED
@@ -83,7 +83,7 @@ var $;
83
83
  try {
84
84
  if (!having)
85
85
  return false;
86
- if (typeof having !== 'object')
86
+ if (typeof having !== 'object' && typeof having !== 'function')
87
87
  return false;
88
88
  if (having instanceof $mol_delegate)
89
89
  return false;
@@ -219,11 +219,12 @@ var $;
219
219
  return this.name;
220
220
  }
221
221
  destructor() { }
222
+ static destructor() { }
222
223
  toString() {
223
224
  return this[Symbol.toStringTag] || this.constructor.name + '()';
224
225
  }
225
226
  static toJSON() {
226
- return this.$.$mol_func_name(this);
227
+ return this[Symbol.toStringTag] || this.$.$mol_func_name(this);
227
228
  }
228
229
  toJSON() {
229
230
  return this.toString();
@@ -2653,19 +2654,87 @@ var $;
2653
2654
  ;
2654
2655
  "use strict";
2655
2656
  var $;
2657
+ (function ($) {
2658
+ function $mol_wire_solid() {
2659
+ const current = $mol_wire_auto();
2660
+ if (current.reap !== nothing) {
2661
+ current?.sub_on(sub, sub.data.length);
2662
+ }
2663
+ current.reap = nothing;
2664
+ }
2665
+ $.$mol_wire_solid = $mol_wire_solid;
2666
+ const nothing = () => { };
2667
+ const sub = new $mol_wire_pub_sub;
2668
+ })($ || ($ = {}));
2669
+ //mol/wire/solid/solid.ts
2670
+ ;
2671
+ "use strict";
2672
+ var $;
2673
+ (function ($) {
2674
+ $.$mol_mem_persist = $mol_wire_solid;
2675
+ })($ || ($ = {}));
2676
+ //mol/mem/persist/persist.ts
2677
+ ;
2678
+ "use strict";
2679
+ var $;
2680
+ (function ($) {
2681
+ function $mol_wire_probe(task, def) {
2682
+ const warm = $mol_wire_fiber.warm;
2683
+ try {
2684
+ $mol_wire_fiber.warm = false;
2685
+ const res = task();
2686
+ if (res === undefined)
2687
+ return def;
2688
+ return res;
2689
+ }
2690
+ finally {
2691
+ $mol_wire_fiber.warm = warm;
2692
+ }
2693
+ }
2694
+ $.$mol_wire_probe = $mol_wire_probe;
2695
+ })($ || ($ = {}));
2696
+ //mol/wire/probe/probe.ts
2697
+ ;
2698
+ "use strict";
2699
+ var $;
2700
+ (function ($) {
2701
+ $.$mol_mem_cached = $mol_wire_probe;
2702
+ })($ || ($ = {}));
2703
+ //mol/mem/cached/cached.ts
2704
+ ;
2705
+ "use strict";
2706
+ var $;
2656
2707
  (function ($) {
2657
2708
  class $mol_storage extends $mol_object2 {
2658
2709
  static native() {
2659
- return null;
2710
+ return this.$.$mol_dom_context.navigator.storage ?? {
2711
+ persisted: async () => false,
2712
+ persist: async () => false,
2713
+ estimate: async () => ({}),
2714
+ getDirectory: async () => null,
2715
+ };
2660
2716
  }
2661
- static persisted(next) {
2662
- return false;
2717
+ static persisted(next, cache) {
2718
+ $mol_mem_persist();
2719
+ if (cache)
2720
+ return Boolean(next);
2721
+ const native = this.native();
2722
+ if (next && !$mol_mem_cached(() => this.persisted())) {
2723
+ native.persist().then(actual => {
2724
+ setTimeout(() => this.persisted(actual, 'cache'), 5000);
2725
+ if (actual)
2726
+ this.$.$mol_log3_rise({ place: `$mol_storage`, message: `Persist: Yes` });
2727
+ else
2728
+ this.$.$mol_log3_fail({ place: `$mol_storage`, message: `Persist: No` });
2729
+ });
2730
+ }
2731
+ return next ?? $mol_wire_sync(native).persisted();
2663
2732
  }
2664
2733
  static estimate() {
2665
- return 0;
2734
+ return $mol_wire_sync(this.native() ?? {}).estimate();
2666
2735
  }
2667
2736
  static dir() {
2668
- return null;
2737
+ return $mol_wire_sync(this.native()).getDirectory();
2669
2738
  }
2670
2739
  }
2671
2740
  __decorate([
@@ -2676,7 +2745,7 @@ var $;
2676
2745
  ], $mol_storage, "persisted", null);
2677
2746
  $.$mol_storage = $mol_storage;
2678
2747
  })($ || ($ = {}));
2679
- //mol/storage/storage.node.ts
2748
+ //mol/storage/storage.ts
2680
2749
  ;
2681
2750
  "use strict";
2682
2751
  var $;
@@ -2756,22 +2825,6 @@ var $;
2756
2825
  ;
2757
2826
  "use strict";
2758
2827
  var $;
2759
- (function ($) {
2760
- function $mol_wire_solid() {
2761
- const current = $mol_wire_auto();
2762
- if (current.reap !== nothing) {
2763
- current?.sub_on(sub, sub.data.length);
2764
- }
2765
- current.reap = nothing;
2766
- }
2767
- $.$mol_wire_solid = $mol_wire_solid;
2768
- const nothing = () => { };
2769
- const sub = new $mol_wire_pub_sub;
2770
- })($ || ($ = {}));
2771
- //mol/wire/solid/solid.ts
2772
- ;
2773
- "use strict";
2774
- var $;
2775
2828
  (function ($) {
2776
2829
  class $mol_wrapper extends $mol_object2 {
2777
2830
  static wrap;
@@ -4348,26 +4401,6 @@ var $;
4348
4401
  ;
4349
4402
  "use strict";
4350
4403
  var $;
4351
- (function ($) {
4352
- function $mol_wire_probe(task, def) {
4353
- const warm = $mol_wire_fiber.warm;
4354
- try {
4355
- $mol_wire_fiber.warm = false;
4356
- const res = task();
4357
- if (res === undefined)
4358
- return def;
4359
- return res;
4360
- }
4361
- finally {
4362
- $mol_wire_fiber.warm = warm;
4363
- }
4364
- }
4365
- $.$mol_wire_probe = $mol_wire_probe;
4366
- })($ || ($ = {}));
4367
- //mol/wire/probe/probe.ts
4368
- ;
4369
- "use strict";
4370
- var $;
4371
4404
  (function ($) {
4372
4405
  class $mol_db_database {
4373
4406
  native;