hyoo_sync_client 0.0.637 → 0.0.639

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/web.mjs CHANGED
@@ -3058,28 +3058,31 @@ var $;
3058
3058
  "use strict";
3059
3059
  var $;
3060
3060
  (function ($) {
3061
- /** State of time moment */
3062
- class $mol_state_time extends $mol_object {
3063
- static task(precision, reset) {
3064
- if (precision) {
3065
- return new $mol_after_timeout(precision, () => this.task(precision, null));
3066
- }
3067
- else {
3068
- return new $mol_after_frame(() => this.task(precision, null));
3069
- }
3070
- }
3071
- static now(precision) {
3072
- this.task(precision);
3073
- return Date.now();
3074
- }
3061
+ /** Convert a pseudo-synchronous (Suspense API) API to an explicit asynchronous one (for integrating with external systems). */
3062
+ function $mol_wire_async(obj) {
3063
+ let fiber;
3064
+ const temp = $mol_wire_task.getter(obj);
3065
+ return new Proxy(obj, {
3066
+ get(obj, field) {
3067
+ const val = obj[field];
3068
+ if (typeof val !== 'function')
3069
+ return val;
3070
+ let fiber;
3071
+ const temp = $mol_wire_task.getter(val);
3072
+ return function $mol_wire_async(...args) {
3073
+ fiber?.destructor();
3074
+ fiber = temp(obj, args);
3075
+ return fiber.async();
3076
+ };
3077
+ },
3078
+ apply(obj, self, args) {
3079
+ fiber?.destructor();
3080
+ fiber = temp(self, args);
3081
+ return fiber.async();
3082
+ },
3083
+ });
3075
3084
  }
3076
- __decorate([
3077
- $mol_mem_key
3078
- ], $mol_state_time, "task", null);
3079
- __decorate([
3080
- $mol_mem_key
3081
- ], $mol_state_time, "now", null);
3082
- $.$mol_state_time = $mol_state_time;
3085
+ $.$mol_wire_async = $mol_wire_async;
3083
3086
  })($ || ($ = {}));
3084
3087
 
3085
3088
  ;
@@ -3113,18 +3116,9 @@ var $;
3113
3116
  }
3114
3117
  return next ?? $mol_wire_sync(native).persisted();
3115
3118
  }
3116
- static estimate() {
3117
- $mol_state_time.now(1000);
3118
- try {
3119
- return $mol_wire_sync(this.native() ?? {}).estimate();
3120
- }
3121
- catch (error) {
3122
- $mol_fail_log(error);
3123
- return {
3124
- usage: 0,
3125
- quota: 0,
3126
- };
3127
- }
3119
+ static estimate(next) {
3120
+ new this.$.$mol_after_timeout(1000, $mol_wire_async(() => this.estimate(null)));
3121
+ return $mol_wire_sync(this.native() ?? {}).estimate();
3128
3122
  }
3129
3123
  static total() {
3130
3124
  return this.estimate().quota ?? 0;
@@ -4400,37 +4394,6 @@ var $;
4400
4394
  ];
4401
4395
  })($ || ($ = {}));
4402
4396
 
4403
- ;
4404
- "use strict";
4405
- var $;
4406
- (function ($) {
4407
- /** Convert a pseudo-synchronous (Suspense API) API to an explicit asynchronous one (for integrating with external systems). */
4408
- function $mol_wire_async(obj) {
4409
- let fiber;
4410
- const temp = $mol_wire_task.getter(obj);
4411
- return new Proxy(obj, {
4412
- get(obj, field) {
4413
- const val = obj[field];
4414
- if (typeof val !== 'function')
4415
- return val;
4416
- let fiber;
4417
- const temp = $mol_wire_task.getter(val);
4418
- return function $mol_wire_async(...args) {
4419
- fiber?.destructor();
4420
- fiber = temp(obj, args);
4421
- return fiber.async();
4422
- };
4423
- },
4424
- apply(obj, self, args) {
4425
- fiber?.destructor();
4426
- fiber = temp(self, args);
4427
- return fiber.async();
4428
- },
4429
- });
4430
- }
4431
- $.$mol_wire_async = $mol_wire_async;
4432
- })($ || ($ = {}));
4433
-
4434
4397
  ;
4435
4398
  "use strict";
4436
4399
  var $;
package/web.test.js CHANGED
@@ -2302,39 +2302,6 @@ var $;
2302
2302
  });
2303
2303
  })($ || ($ = {}));
2304
2304
 
2305
- ;
2306
- "use strict";
2307
- var $;
2308
- (function ($_1) {
2309
- $mol_test_mocks.push($ => {
2310
- $.$mol_after_frame = $mol_after_mock_commmon;
2311
- });
2312
- })($ || ($ = {}));
2313
-
2314
- ;
2315
- "use strict";
2316
- var $;
2317
- (function ($) {
2318
- $mol_test({
2319
- 'return result without errors'() {
2320
- $mol_assert_equal($mol_try(() => false), false);
2321
- },
2322
- //'return error if thrown'() {
2323
- //
2324
- // const error = new Error( '$mol_try test error' )
2325
- // $mol_assert_equal( $mol_try( ()=> { throw error } ) , error )
2326
- //
2327
- //} ,
2328
- });
2329
- })($ || ($ = {}));
2330
-
2331
- ;
2332
- "use strict";
2333
- var $;
2334
- (function ($_1) {
2335
- $mol_test_mocks.push($ => $.$mol_fail_log = () => false);
2336
- })($ || ($ = {}));
2337
-
2338
2305
  ;
2339
2306
  "use strict";
2340
2307
  var $;
@@ -4619,6 +4586,30 @@ var $;
4619
4586
  });
4620
4587
  })($ || ($ = {}));
4621
4588
 
4589
+ ;
4590
+ "use strict";
4591
+ var $;
4592
+ (function ($) {
4593
+ $mol_test({
4594
+ 'return result without errors'() {
4595
+ $mol_assert_equal($mol_try(() => false), false);
4596
+ },
4597
+ //'return error if thrown'() {
4598
+ //
4599
+ // const error = new Error( '$mol_try test error' )
4600
+ // $mol_assert_equal( $mol_try( ()=> { throw error } ) , error )
4601
+ //
4602
+ //} ,
4603
+ });
4604
+ })($ || ($ = {}));
4605
+
4606
+ ;
4607
+ "use strict";
4608
+ var $;
4609
+ (function ($_1) {
4610
+ $mol_test_mocks.push($ => $.$mol_fail_log = () => false);
4611
+ })($ || ($ = {}));
4612
+
4622
4613
  ;
4623
4614
  "use strict";
4624
4615
  var $;
@@ -4629,6 +4620,15 @@ var $;
4629
4620
  ];
4630
4621
  })($ || ($ = {}));
4631
4622
 
4623
+ ;
4624
+ "use strict";
4625
+ var $;
4626
+ (function ($_1) {
4627
+ $mol_test_mocks.push($ => {
4628
+ $.$mol_after_frame = $mol_after_mock_commmon;
4629
+ });
4630
+ })($ || ($ = {}));
4631
+
4632
4632
  ;
4633
4633
  "use strict";
4634
4634