@dxos/echo-pipeline 0.3.8-next.f4e0086 → 0.3.9-main.325dd0a

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.
@@ -122,7 +122,7 @@ var DataServiceHost = class {
122
122
  const { batch, meta } = message;
123
123
  invariant2(!meta.clientTag, "Unexpected client tag in mutation message", {
124
124
  F: __dxlog_file2,
125
- L: 131,
125
+ L: 137,
126
126
  S: this,
127
127
  A: [
128
128
  "!(meta as any).clientTag",
@@ -134,7 +134,7 @@ var DataServiceHost = class {
134
134
  meta
135
135
  }, {
136
136
  F: __dxlog_file2,
137
- L: 132,
137
+ L: 138,
138
138
  S: this,
139
139
  C: (f, a) => f(...a)
140
140
  });
@@ -178,7 +178,7 @@ var DataServiceHost = class {
178
178
  async write(request) {
179
179
  invariant2(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
180
180
  F: __dxlog_file2,
181
- L: 177,
181
+ L: 183,
182
182
  S: this,
183
183
  A: [
184
184
  "!this._ctx.disposed",
@@ -187,7 +187,7 @@ var DataServiceHost = class {
187
187
  });
188
188
  invariant2(this._writeStream, "Cannot write mutations in readonly mode", {
189
189
  F: __dxlog_file2,
190
- L: 178,
190
+ L: 184,
191
191
  S: this,
192
192
  A: [
193
193
  "this._writeStream",
@@ -199,7 +199,7 @@ var DataServiceHost = class {
199
199
  objectCount: request.batch.objects?.length ?? 0
200
200
  }, {
201
201
  F: __dxlog_file2,
202
- L: 180,
202
+ L: 186,
203
203
  S: this,
204
204
  C: (f, a) => f(...a)
205
205
  });
@@ -213,7 +213,7 @@ var DataServiceHost = class {
213
213
  seq: receipt2.seq
214
214
  }, {
215
215
  F: __dxlog_file2,
216
- L: 189,
216
+ L: 195,
217
217
  S: this,
218
218
  C: (f, a) => f(...a)
219
219
  });
@@ -229,6 +229,12 @@ var DataServiceHost = class {
229
229
  async flush() {
230
230
  await this._flush();
231
231
  }
232
+ syncRepo(request) {
233
+ throw new Error("Method not implemented.");
234
+ }
235
+ sendSyncMessage(request) {
236
+ throw new Error("Method not implemented.");
237
+ }
232
238
  };
233
239
  var createDataMessage = (batch) => ({
234
240
  batch: {
@@ -375,13 +381,13 @@ var DataServiceSubscriptions = class {
375
381
  spaceKey
376
382
  }, {
377
383
  F: __dxlog_file3,
378
- L: 31,
384
+ L: 33,
379
385
  S: this,
380
386
  C: (f, a) => f(...a)
381
387
  });
382
388
  invariant3(!this._spaces.has(spaceKey), void 0, {
383
389
  F: __dxlog_file3,
384
- L: 32,
390
+ L: 34,
385
391
  S: this,
386
392
  A: [
387
393
  "!this._spaces.has(spaceKey)",
@@ -396,7 +402,7 @@ var DataServiceSubscriptions = class {
396
402
  spaceKey
397
403
  }, {
398
404
  F: __dxlog_file3,
399
- L: 38,
405
+ L: 40,
400
406
  S: this,
401
407
  C: (f, a) => f(...a)
402
408
  });
@@ -415,7 +421,7 @@ var DataServiceImpl = class {
415
421
  subscribe(request) {
416
422
  invariant3(request.spaceKey, void 0, {
417
423
  F: __dxlog_file3,
418
- L: 57,
424
+ L: 59,
419
425
  S: this,
420
426
  A: [
421
427
  "request.spaceKey",
@@ -428,7 +434,7 @@ var DataServiceImpl = class {
428
434
  write(request) {
429
435
  invariant3(request.spaceKey, void 0, {
430
436
  F: __dxlog_file3,
431
- L: 64,
437
+ L: 66,
432
438
  S: this,
433
439
  A: [
434
440
  "request.spaceKey",
@@ -437,7 +443,7 @@ var DataServiceImpl = class {
437
443
  });
438
444
  invariant3(request.batch, void 0, {
439
445
  F: __dxlog_file3,
440
- L: 65,
446
+ L: 67,
441
447
  S: this,
442
448
  A: [
443
449
  "request.batch",
@@ -450,7 +456,7 @@ var DataServiceImpl = class {
450
456
  flush(request) {
451
457
  invariant3(request.spaceKey, void 0, {
452
458
  F: __dxlog_file3,
453
- L: 72,
459
+ L: 74,
454
460
  S: this,
455
461
  A: [
456
462
  "request.spaceKey",
@@ -460,6 +466,12 @@ var DataServiceImpl = class {
460
466
  const host = this._subscriptions.getDataService(request.spaceKey) ?? raise(new Error(`space not found: ${request.spaceKey}`));
461
467
  return host.flush();
462
468
  }
469
+ syncRepo(request) {
470
+ throw new Error("Method not implemented.");
471
+ }
472
+ sendSyncMessage(request) {
473
+ throw new Error("Method not implemented.");
474
+ }
463
475
  };
464
476
 
465
477
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
@@ -1580,7 +1592,7 @@ var DataPipeline = class DataPipeline2 {
1580
1592
  let messageCounter = 0;
1581
1593
  invariant8(this._pipeline, "Pipeline is not initialized.", {
1582
1594
  F: __dxlog_file9,
1583
- L: 222,
1595
+ L: 223,
1584
1596
  S: this,
1585
1597
  A: [
1586
1598
  "this._pipeline",
@@ -1596,7 +1608,7 @@ var DataPipeline = class DataPipeline2 {
1596
1608
  seq
1597
1609
  }, {
1598
1610
  F: __dxlog_file9,
1599
- L: 228,
1611
+ L: 229,
1600
1612
  S: this,
1601
1613
  C: (f, a) => f(...a)
1602
1614
  });
@@ -1608,7 +1620,7 @@ var DataPipeline = class DataPipeline2 {
1608
1620
  feedKey
1609
1621
  }, {
1610
1622
  F: __dxlog_file9,
1611
- L: 234,
1623
+ L: 235,
1612
1624
  S: this,
1613
1625
  C: (f, a) => f(...a)
1614
1626
  });
@@ -1631,7 +1643,7 @@ var DataPipeline = class DataPipeline2 {
1631
1643
  spaceKey: this._params.spaceKey.toHex()
1632
1644
  }, {
1633
1645
  F: __dxlog_file9,
1634
- L: 251,
1646
+ L: 252,
1635
1647
  S: this,
1636
1648
  C: (f, a) => f(...a)
1637
1649
  });
@@ -1640,22 +1652,22 @@ var DataPipeline = class DataPipeline2 {
1640
1652
  } catch (err) {
1641
1653
  log8.catch(err, void 0, {
1642
1654
  F: __dxlog_file9,
1643
- L: 261,
1655
+ L: 262,
1644
1656
  S: this,
1645
1657
  C: (f, a) => f(...a)
1646
1658
  });
1647
1659
  }
1648
1660
  span.end();
1649
- if (++messageCounter > 1e3) {
1661
+ if (++messageCounter > 100) {
1650
1662
  messageCounter = 0;
1651
- await sleep(1);
1663
+ await idle(1e3);
1652
1664
  }
1653
1665
  }
1654
1666
  }
1655
1667
  _createSnapshot() {
1656
1668
  invariant8(this.databaseHost, "Database backend is not initialized.", {
1657
1669
  F: __dxlog_file9,
1658
- L: 275,
1670
+ L: 276,
1659
1671
  S: this,
1660
1672
  A: [
1661
1673
  "this.databaseHost",
@@ -1684,7 +1696,7 @@ var DataPipeline = class DataPipeline2 {
1684
1696
  } catch (err) {
1685
1697
  log8.warn("Failed to cache properties", err, {
1686
1698
  F: __dxlog_file9,
1687
- L: 304,
1699
+ L: 305,
1688
1700
  S: this,
1689
1701
  C: (f, a) => f(...a)
1690
1702
  });
@@ -1713,14 +1725,14 @@ var DataPipeline = class DataPipeline2 {
1713
1725
  if (err instanceof CancelledError) {
1714
1726
  log8("Epoch processing cancelled.", void 0, {
1715
1727
  F: __dxlog_file9,
1716
- L: 340,
1728
+ L: 341,
1717
1729
  S: this,
1718
1730
  C: (f, a) => f(...a)
1719
1731
  });
1720
1732
  } else {
1721
1733
  log8.catch(err, void 0, {
1722
1734
  F: __dxlog_file9,
1723
- L: 342,
1735
+ L: 343,
1724
1736
  S: this,
1725
1737
  C: (f, a) => f(...a)
1726
1738
  });
@@ -1740,7 +1752,7 @@ var DataPipeline = class DataPipeline2 {
1740
1752
  async _processEpoch(ctx, epoch) {
1741
1753
  invariant8(this._isOpen, "Space is closed.", {
1742
1754
  F: __dxlog_file9,
1743
- L: 361,
1755
+ L: 362,
1744
1756
  S: this,
1745
1757
  A: [
1746
1758
  "this._isOpen",
@@ -1749,7 +1761,7 @@ var DataPipeline = class DataPipeline2 {
1749
1761
  });
1750
1762
  invariant8(this._pipeline, void 0, {
1751
1763
  F: __dxlog_file9,
1752
- L: 362,
1764
+ L: 363,
1753
1765
  S: this,
1754
1766
  A: [
1755
1767
  "this._pipeline",
@@ -1761,7 +1773,7 @@ var DataPipeline = class DataPipeline2 {
1761
1773
  epoch: omit(epoch, "proof")
1762
1774
  }, {
1763
1775
  F: __dxlog_file9,
1764
- L: 365,
1776
+ L: 366,
1765
1777
  S: this,
1766
1778
  C: (f, a) => f(...a)
1767
1779
  });
@@ -1771,7 +1783,7 @@ var DataPipeline = class DataPipeline2 {
1771
1783
  }
1772
1784
  log8("restarting pipeline from epoch", void 0, {
1773
1785
  F: __dxlog_file9,
1774
- L: 371,
1786
+ L: 372,
1775
1787
  S: this,
1776
1788
  C: (f, a) => f(...a)
1777
1789
  });
@@ -1782,7 +1794,7 @@ var DataPipeline = class DataPipeline2 {
1782
1794
  async waitUntilTimeframe(timeframe) {
1783
1795
  invariant8(this._pipeline, "Pipeline is not initialized.", {
1784
1796
  F: __dxlog_file9,
1785
- L: 378,
1797
+ L: 379,
1786
1798
  S: this,
1787
1799
  A: [
1788
1800
  "this._pipeline",
@@ -1794,7 +1806,7 @@ var DataPipeline = class DataPipeline2 {
1794
1806
  async createEpoch() {
1795
1807
  invariant8(this._pipeline, void 0, {
1796
1808
  F: __dxlog_file9,
1797
- L: 384,
1809
+ L: 385,
1798
1810
  S: this,
1799
1811
  A: [
1800
1812
  "this._pipeline",
@@ -1803,7 +1815,7 @@ var DataPipeline = class DataPipeline2 {
1803
1815
  });
1804
1816
  invariant8(this.currentEpoch, void 0, {
1805
1817
  F: __dxlog_file9,
1806
- L: 385,
1818
+ L: 386,
1807
1819
  S: this,
1808
1820
  A: [
1809
1821
  "this.currentEpoch",
@@ -1834,7 +1846,7 @@ var DataPipeline = class DataPipeline2 {
1834
1846
  } catch (err) {
1835
1847
  log8.catch(err, void 0, {
1836
1848
  F: __dxlog_file9,
1837
- L: 415,
1849
+ L: 416,
1838
1850
  S: this,
1839
1851
  C: (f, a) => f(...a)
1840
1852
  });
@@ -1864,6 +1876,31 @@ DataPipeline = _ts_decorate4([
1864
1876
  trackLeaks("open", "close"),
1865
1877
  trace.resource()
1866
1878
  ], DataPipeline);
1879
+ var idle = async (timeout) => {
1880
+ if (!("scheduler" in globalThis && typeof globalThis.scheduler.postTask === "function")) {
1881
+ await sleep(1);
1882
+ return;
1883
+ }
1884
+ await new Promise((resolve) => {
1885
+ const cleanup = () => {
1886
+ clearTimeout(timer);
1887
+ controller.abort();
1888
+ };
1889
+ const controller = new AbortController();
1890
+ void globalThis.scheduler.postTask(() => {
1891
+ cleanup();
1892
+ resolve();
1893
+ }, {
1894
+ priority: "background",
1895
+ signal: controller.signal
1896
+ }).catch(() => {
1897
+ });
1898
+ const timer = setTimeout(() => {
1899
+ cleanup();
1900
+ resolve();
1901
+ }, timeout);
1902
+ });
1903
+ };
1867
1904
 
1868
1905
  // packages/core/echo/echo-pipeline/src/space/space.ts
1869
1906
  import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeaks3, Lock } from "@dxos/async";
@@ -2712,4 +2749,4 @@ export {
2712
2749
  SpaceProtocolSession,
2713
2750
  SpaceManager
2714
2751
  };
2715
- //# sourceMappingURL=chunk-KD6OVLI6.mjs.map
2752
+ //# sourceMappingURL=chunk-MPEQ7BV3.mjs.map