@dxos/echo-pipeline 0.4.8-main.fff1521 → 0.4.8-next.2e7285f
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/dist/lib/browser/{chunk-3FVT6KX6.mjs → chunk-3PPSCHNN.mjs} +22 -47
- package/dist/lib/browser/chunk-3PPSCHNN.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-WZ4WTAN6.cjs → chunk-EVKDEZDX.cjs} +24 -49
- package/dist/lib/node/chunk-EVKDEZDX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +30 -30
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +16 -16
- package/dist/types/src/space/data-pipeline.d.ts +0 -1
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/space/data-pipeline.ts +1 -44
- package/dist/lib/browser/chunk-3FVT6KX6.mjs.map +0 -7
- package/dist/lib/node/chunk-WZ4WTAN6.cjs.map +0 -7
|
@@ -1487,7 +1487,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1487
1487
|
import { Event as Event4, scheduleTask as scheduleTask2, sleep, synchronized as synchronized3, trackLeaks } from "@dxos/async";
|
|
1488
1488
|
import { Context as Context5 } from "@dxos/context";
|
|
1489
1489
|
import { checkCredentialType } from "@dxos/credentials";
|
|
1490
|
-
import {
|
|
1490
|
+
import { ItemManager } from "@dxos/echo-db";
|
|
1491
1491
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
1492
1492
|
import { log as log8, omit } from "@dxos/log";
|
|
1493
1493
|
import { CancelledError } from "@dxos/protocols";
|
|
@@ -1505,8 +1505,6 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
1505
1505
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1506
1506
|
}
|
|
1507
1507
|
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
|
|
1508
|
-
var MESSAGES_PER_SNAPSHOT = 10;
|
|
1509
|
-
var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
|
|
1510
1508
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 5e3;
|
|
1511
1509
|
var DataPipeline = class {
|
|
1512
1510
|
constructor(_params) {
|
|
@@ -1562,7 +1560,7 @@ var DataPipeline = class {
|
|
|
1562
1560
|
write: (data, options) => {
|
|
1563
1561
|
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1564
1562
|
F: __dxlog_file9,
|
|
1565
|
-
L:
|
|
1563
|
+
L: 152,
|
|
1566
1564
|
S: this,
|
|
1567
1565
|
A: [
|
|
1568
1566
|
"this._pipeline",
|
|
@@ -1571,7 +1569,7 @@ var DataPipeline = class {
|
|
|
1571
1569
|
});
|
|
1572
1570
|
invariant8(this.currentEpoch, "Epoch is not initialized.", {
|
|
1573
1571
|
F: __dxlog_file9,
|
|
1574
|
-
L:
|
|
1572
|
+
L: 153,
|
|
1575
1573
|
S: this,
|
|
1576
1574
|
A: [
|
|
1577
1575
|
"this.currentEpoch",
|
|
@@ -1597,7 +1595,7 @@ var DataPipeline = class {
|
|
|
1597
1595
|
}
|
|
1598
1596
|
log8("close", void 0, {
|
|
1599
1597
|
F: __dxlog_file9,
|
|
1600
|
-
L:
|
|
1598
|
+
L: 177,
|
|
1601
1599
|
S: this,
|
|
1602
1600
|
C: (f, a) => f(...a)
|
|
1603
1601
|
});
|
|
@@ -1605,14 +1603,13 @@ var DataPipeline = class {
|
|
|
1605
1603
|
await this._ctx.dispose();
|
|
1606
1604
|
await this._pipeline?.stop();
|
|
1607
1605
|
try {
|
|
1608
|
-
await this._saveCache();
|
|
1609
1606
|
if (this._pipeline) {
|
|
1610
1607
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1611
1608
|
}
|
|
1612
1609
|
} catch (err) {
|
|
1613
1610
|
log8.catch(err, void 0, {
|
|
1614
1611
|
F: __dxlog_file9,
|
|
1615
|
-
L:
|
|
1612
|
+
L: 189,
|
|
1616
1613
|
S: this,
|
|
1617
1614
|
C: (f, a) => f(...a)
|
|
1618
1615
|
});
|
|
@@ -1638,7 +1635,7 @@ var DataPipeline = class {
|
|
|
1638
1635
|
let messageCounter = 0;
|
|
1639
1636
|
invariant8(pipeline, "Pipeline is not initialized.", {
|
|
1640
1637
|
F: __dxlog_file9,
|
|
1641
|
-
L:
|
|
1638
|
+
L: 216,
|
|
1642
1639
|
S: this,
|
|
1643
1640
|
A: [
|
|
1644
1641
|
"pipeline",
|
|
@@ -1654,7 +1651,7 @@ var DataPipeline = class {
|
|
|
1654
1651
|
seq
|
|
1655
1652
|
}, {
|
|
1656
1653
|
F: __dxlog_file9,
|
|
1657
|
-
L:
|
|
1654
|
+
L: 222,
|
|
1658
1655
|
S: this,
|
|
1659
1656
|
C: (f, a) => f(...a)
|
|
1660
1657
|
});
|
|
@@ -1666,7 +1663,7 @@ var DataPipeline = class {
|
|
|
1666
1663
|
feedKey
|
|
1667
1664
|
}, {
|
|
1668
1665
|
F: __dxlog_file9,
|
|
1669
|
-
L:
|
|
1666
|
+
L: 228,
|
|
1670
1667
|
S: this,
|
|
1671
1668
|
C: (f, a) => f(...a)
|
|
1672
1669
|
});
|
|
@@ -1689,7 +1686,7 @@ var DataPipeline = class {
|
|
|
1689
1686
|
spaceKey: this._params.spaceKey.toHex()
|
|
1690
1687
|
}, {
|
|
1691
1688
|
F: __dxlog_file9,
|
|
1692
|
-
L:
|
|
1689
|
+
L: 245,
|
|
1693
1690
|
S: this,
|
|
1694
1691
|
C: (f, a) => f(...a)
|
|
1695
1692
|
});
|
|
@@ -1698,7 +1695,7 @@ var DataPipeline = class {
|
|
|
1698
1695
|
} catch (err) {
|
|
1699
1696
|
log8.catch(err, void 0, {
|
|
1700
1697
|
F: __dxlog_file9,
|
|
1701
|
-
L:
|
|
1698
|
+
L: 255,
|
|
1702
1699
|
S: this,
|
|
1703
1700
|
C: (f, a) => f(...a)
|
|
1704
1701
|
});
|
|
@@ -1713,7 +1710,7 @@ var DataPipeline = class {
|
|
|
1713
1710
|
_createSnapshot() {
|
|
1714
1711
|
invariant8(this.databaseHost, "Database backend is not initialized.", {
|
|
1715
1712
|
F: __dxlog_file9,
|
|
1716
|
-
L:
|
|
1713
|
+
L: 269,
|
|
1717
1714
|
S: this,
|
|
1718
1715
|
A: [
|
|
1719
1716
|
"this.databaseHost",
|
|
@@ -1731,24 +1728,6 @@ var DataPipeline = class {
|
|
|
1731
1728
|
await this._params.metadataStore.setSpaceDataLatestTimeframe(this._params.spaceKey, newTimeframe);
|
|
1732
1729
|
this._targetTimeframe = newTimeframe;
|
|
1733
1730
|
}
|
|
1734
|
-
async _saveCache() {
|
|
1735
|
-
const cache = {};
|
|
1736
|
-
try {
|
|
1737
|
-
const propertiesItem = this.itemManager.items.find((item) => item.modelMeta?.type === "dxos.org/model/document" && // TODO(burdon): Document?
|
|
1738
|
-
(getStateMachineFromItem(item)?.snapshot()).type === TYPE_PROPERTIES);
|
|
1739
|
-
if (propertiesItem) {
|
|
1740
|
-
cache.properties = getStateMachineFromItem(propertiesItem)?.snapshot();
|
|
1741
|
-
}
|
|
1742
|
-
} catch (err) {
|
|
1743
|
-
log8.warn("Failed to cache properties", err, {
|
|
1744
|
-
F: __dxlog_file9,
|
|
1745
|
-
L: 311,
|
|
1746
|
-
S: this,
|
|
1747
|
-
C: (f, a) => f(...a)
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
await this._params.metadataStore.setCache(this._params.spaceKey, cache);
|
|
1751
|
-
}
|
|
1752
1731
|
async _noteTargetStateIfNeeded(timeframe) {
|
|
1753
1732
|
if (!this._pipeline?.state.reachedTarget) {
|
|
1754
1733
|
return;
|
|
@@ -1757,9 +1736,6 @@ var DataPipeline = class {
|
|
|
1757
1736
|
this._lastTimeframeSaveTime = Date.now();
|
|
1758
1737
|
await this._saveTargetTimeframe(timeframe);
|
|
1759
1738
|
}
|
|
1760
|
-
if (Date.now() - this._lastSnapshotSaveTime > AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL && timeframe.totalMessages() - this._lastAutomaticSnapshotTimeframe.totalMessages() > MESSAGES_PER_SNAPSHOT) {
|
|
1761
|
-
await this._saveCache();
|
|
1762
|
-
}
|
|
1763
1739
|
}
|
|
1764
1740
|
async _processEpochInSeparateTask(epoch) {
|
|
1765
1741
|
if (epoch.subject.assertion.number <= this._lastProcessedEpoch) {
|
|
@@ -1771,14 +1747,14 @@ var DataPipeline = class {
|
|
|
1771
1747
|
if (err instanceof CancelledError) {
|
|
1772
1748
|
log8("Epoch processing cancelled.", void 0, {
|
|
1773
1749
|
F: __dxlog_file9,
|
|
1774
|
-
L:
|
|
1750
|
+
L: 305,
|
|
1775
1751
|
S: this,
|
|
1776
1752
|
C: (f, a) => f(...a)
|
|
1777
1753
|
});
|
|
1778
1754
|
} else {
|
|
1779
1755
|
log8.catch(err, void 0, {
|
|
1780
1756
|
F: __dxlog_file9,
|
|
1781
|
-
L:
|
|
1757
|
+
L: 307,
|
|
1782
1758
|
S: this,
|
|
1783
1759
|
C: (f, a) => f(...a)
|
|
1784
1760
|
});
|
|
@@ -1801,7 +1777,7 @@ var DataPipeline = class {
|
|
|
1801
1777
|
async _processEpoch(ctx, epoch) {
|
|
1802
1778
|
invariant8(this._isOpen, "Space is closed.", {
|
|
1803
1779
|
F: __dxlog_file9,
|
|
1804
|
-
L:
|
|
1780
|
+
L: 331,
|
|
1805
1781
|
S: this,
|
|
1806
1782
|
A: [
|
|
1807
1783
|
"this._isOpen",
|
|
@@ -1810,7 +1786,7 @@ var DataPipeline = class {
|
|
|
1810
1786
|
});
|
|
1811
1787
|
invariant8(this._pipeline, void 0, {
|
|
1812
1788
|
F: __dxlog_file9,
|
|
1813
|
-
L:
|
|
1789
|
+
L: 332,
|
|
1814
1790
|
S: this,
|
|
1815
1791
|
A: [
|
|
1816
1792
|
"this._pipeline",
|
|
@@ -1822,7 +1798,7 @@ var DataPipeline = class {
|
|
|
1822
1798
|
epoch: omit(epoch, "proof")
|
|
1823
1799
|
}, {
|
|
1824
1800
|
F: __dxlog_file9,
|
|
1825
|
-
L:
|
|
1801
|
+
L: 335,
|
|
1826
1802
|
S: this,
|
|
1827
1803
|
C: (f, a) => f(...a)
|
|
1828
1804
|
});
|
|
@@ -1832,7 +1808,7 @@ var DataPipeline = class {
|
|
|
1832
1808
|
}
|
|
1833
1809
|
log8("restarting pipeline from epoch", void 0, {
|
|
1834
1810
|
F: __dxlog_file9,
|
|
1835
|
-
L:
|
|
1811
|
+
L: 341,
|
|
1836
1812
|
S: this,
|
|
1837
1813
|
C: (f, a) => f(...a)
|
|
1838
1814
|
});
|
|
@@ -1843,7 +1819,7 @@ var DataPipeline = class {
|
|
|
1843
1819
|
async waitUntilTimeframe(timeframe) {
|
|
1844
1820
|
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1845
1821
|
F: __dxlog_file9,
|
|
1846
|
-
L:
|
|
1822
|
+
L: 348,
|
|
1847
1823
|
S: this,
|
|
1848
1824
|
A: [
|
|
1849
1825
|
"this._pipeline",
|
|
@@ -1855,7 +1831,7 @@ var DataPipeline = class {
|
|
|
1855
1831
|
async createEpoch() {
|
|
1856
1832
|
invariant8(this._pipeline, void 0, {
|
|
1857
1833
|
F: __dxlog_file9,
|
|
1858
|
-
L:
|
|
1834
|
+
L: 354,
|
|
1859
1835
|
S: this,
|
|
1860
1836
|
A: [
|
|
1861
1837
|
"this._pipeline",
|
|
@@ -1864,7 +1840,7 @@ var DataPipeline = class {
|
|
|
1864
1840
|
});
|
|
1865
1841
|
invariant8(this.currentEpoch, void 0, {
|
|
1866
1842
|
F: __dxlog_file9,
|
|
1867
|
-
L:
|
|
1843
|
+
L: 355,
|
|
1868
1844
|
S: this,
|
|
1869
1845
|
A: [
|
|
1870
1846
|
"this.currentEpoch",
|
|
@@ -1888,14 +1864,13 @@ var DataPipeline = class {
|
|
|
1888
1864
|
}
|
|
1889
1865
|
async _flush() {
|
|
1890
1866
|
try {
|
|
1891
|
-
await this._saveCache();
|
|
1892
1867
|
if (this._pipeline) {
|
|
1893
1868
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1894
1869
|
}
|
|
1895
1870
|
} catch (err) {
|
|
1896
1871
|
log8.catch(err, void 0, {
|
|
1897
1872
|
F: __dxlog_file9,
|
|
1898
|
-
L:
|
|
1873
|
+
L: 384,
|
|
1899
1874
|
S: this,
|
|
1900
1875
|
C: (f, a) => f(...a)
|
|
1901
1876
|
});
|
|
@@ -3455,4 +3430,4 @@ export {
|
|
|
3455
3430
|
AutomergeHost,
|
|
3456
3431
|
getSpaceKeyFromDoc
|
|
3457
3432
|
};
|
|
3458
|
-
//# sourceMappingURL=chunk-
|
|
3433
|
+
//# sourceMappingURL=chunk-3PPSCHNN.mjs.map
|