hyoo_sync_client 0.0.227 → 0.0.229

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
@@ -1924,12 +1924,26 @@ var $;
1924
1924
  }
1925
1925
  if (!$mol_promise_like(this.cache))
1926
1926
  return this.cache;
1927
- await this.cache;
1927
+ await Promise.race([this.cache, this.step()]);
1928
+ if (!$mol_promise_like(this.cache))
1929
+ return this.cache;
1928
1930
  if (this.cursor === $mol_wire_cursor.final) {
1929
1931
  await new Promise(() => { });
1930
1932
  }
1931
1933
  }
1932
1934
  }
1935
+ step() {
1936
+ return new Promise(done => {
1937
+ const sub = new $mol_wire_pub_sub;
1938
+ const prev = sub.track_on();
1939
+ sub.track_next(this);
1940
+ sub.track_off(prev);
1941
+ sub.absorb = () => {
1942
+ done(null);
1943
+ sub.destructor();
1944
+ };
1945
+ });
1946
+ }
1933
1947
  }
1934
1948
  $.$mol_wire_fiber = $mol_wire_fiber;
1935
1949
  })($ || ($ = {}));
package/node.test.js CHANGED
@@ -1916,12 +1916,26 @@ var $;
1916
1916
  }
1917
1917
  if (!$mol_promise_like(this.cache))
1918
1918
  return this.cache;
1919
- await this.cache;
1919
+ await Promise.race([this.cache, this.step()]);
1920
+ if (!$mol_promise_like(this.cache))
1921
+ return this.cache;
1920
1922
  if (this.cursor === $mol_wire_cursor.final) {
1921
1923
  await new Promise(() => { });
1922
1924
  }
1923
1925
  }
1924
1926
  }
1927
+ step() {
1928
+ return new Promise(done => {
1929
+ const sub = new $mol_wire_pub_sub;
1930
+ const prev = sub.track_on();
1931
+ sub.track_next(this);
1932
+ sub.track_off(prev);
1933
+ sub.absorb = () => {
1934
+ done(null);
1935
+ sub.destructor();
1936
+ };
1937
+ });
1938
+ }
1925
1939
  }
1926
1940
  $.$mol_wire_fiber = $mol_wire_fiber;
1927
1941
  })($ || ($ = {}));
@@ -5305,7 +5319,7 @@ var $;
5305
5319
  if ('outerHTML' in val)
5306
5320
  return val.outerHTML;
5307
5321
  try {
5308
- return JSON.stringify(val);
5322
+ return JSON.stringify(val, null, '\t');
5309
5323
  }
5310
5324
  catch (error) {
5311
5325
  console.error(error);
@@ -5352,6 +5366,12 @@ var $;
5352
5366
  'three must be alike'() {
5353
5367
  $mol_assert_like([3], [3], [3]);
5354
5368
  },
5369
+ 'two object must be alike'() {
5370
+ $mol_assert_like({ a: 1 }, { a: 1 });
5371
+ },
5372
+ 'three object must be alike'() {
5373
+ $mol_assert_like({ a: 1 }, { a: 1 }, { a: 1 });
5374
+ },
5355
5375
  });
5356
5376
  })($ || ($ = {}));
5357
5377
  //mol/assert/assert.test.ts
@@ -6396,6 +6416,31 @@ var $;
6396
6416
  var $;
6397
6417
  (function ($_1) {
6398
6418
  $mol_test({
6419
+ async 'Error caching'($) {
6420
+ const next_cached = 123;
6421
+ class Some extends $mol_object2 {
6422
+ static $ = $;
6423
+ static data(id, next) {
6424
+ if (next)
6425
+ return next;
6426
+ setTimeout(() => {
6427
+ $mol_wire_async(this).data(id, next_cached);
6428
+ }, 10);
6429
+ $mol_fail_hidden(new Promise(() => { }));
6430
+ }
6431
+ static run() {
6432
+ return this.data('1');
6433
+ }
6434
+ }
6435
+ __decorate([
6436
+ $mol_wire_plex
6437
+ ], Some, "data", null);
6438
+ __decorate([
6439
+ $mol_wire_method
6440
+ ], Some, "run", null);
6441
+ const val = await $mol_wire_async(Some).run();
6442
+ $mol_assert_equal(val, next_cached);
6443
+ },
6399
6444
  'Memoize by single simple key'($) {
6400
6445
  class Team extends $mol_object2 {
6401
6446
  static $ = $;