@dxos/echo-pipeline 0.5.8-main.f69e6e4 → 0.5.8
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-I2J5TTHJ.mjs → chunk-GANAND63.mjs} +23 -48
- package/dist/lib/browser/{chunk-I2J5TTHJ.mjs.map → chunk-GANAND63.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +26 -31
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -99
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/{chunk-QPCNQ4ZK.cjs → chunk-M475BGBI.cjs} +25 -51
- package/dist/lib/node/chunk-M475BGBI.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -52
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +13 -107
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/automerge/automerge-doc-loader.d.ts +3 -7
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/migrations.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +2 -2
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +2 -2
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +1 -9
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +2 -2
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.test.ts +2 -5
- package/src/automerge/automerge-doc-loader.ts +4 -6
- package/src/automerge/automerge-host.test.ts +553 -1
- package/src/automerge/automerge-host.ts +5 -12
- package/src/automerge/automerge-repo.test.ts +2 -450
- package/src/automerge/migrations.ts +1 -2
- package/src/automerge/storage-adapter.test.ts +15 -81
- package/src/space/space-manager.ts +4 -6
- package/src/space/space-protocol.test.ts +3 -3
- package/src/space/space-protocol.ts +3 -3
- package/src/space/space.ts +2 -32
- package/src/testing/index.ts +0 -1
- package/src/testing/test-agent-builder.ts +4 -4
- package/dist/lib/node/chunk-QPCNQ4ZK.cjs.map +0 -7
- package/dist/types/src/testing/test-network-adapter.d.ts +0 -18
- package/dist/types/src/testing/test-network-adapter.d.ts.map +0 -1
- package/src/testing/test-network-adapter.ts +0 -62
|
@@ -1150,13 +1150,11 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1150
1150
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1151
1151
|
import { Event as Event4, Mutex, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1152
1152
|
import { LifecycleState, Resource } from "@dxos/context";
|
|
1153
|
-
import { subtleCrypto as subtleCrypto2 } from "@dxos/crypto";
|
|
1154
1153
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1155
|
-
import { PublicKey as PublicKey5, SpaceId } from "@dxos/keys";
|
|
1156
1154
|
import { log as log7, logInfo } from "@dxos/log";
|
|
1157
1155
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1158
1156
|
import { trace as trace2 } from "@dxos/tracing";
|
|
1159
|
-
import { Callback as Callback2
|
|
1157
|
+
import { Callback as Callback2 } from "@dxos/util";
|
|
1160
1158
|
|
|
1161
1159
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1162
1160
|
import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
@@ -1441,14 +1439,13 @@ var Space = class extends Resource {
|
|
|
1441
1439
|
this.stateUpdate = new Event4();
|
|
1442
1440
|
invariant6(params.spaceKey && params.feedProvider, void 0, {
|
|
1443
1441
|
F: __dxlog_file8,
|
|
1444
|
-
L:
|
|
1442
|
+
L: 75,
|
|
1445
1443
|
S: this,
|
|
1446
1444
|
A: [
|
|
1447
1445
|
"params.spaceKey && params.feedProvider",
|
|
1448
1446
|
""
|
|
1449
1447
|
]
|
|
1450
1448
|
});
|
|
1451
|
-
this._id = params.id;
|
|
1452
1449
|
this._key = params.spaceKey;
|
|
1453
1450
|
this._genesisFeedKey = params.genesisFeed.key;
|
|
1454
1451
|
this._feedProvider = params.feedProvider;
|
|
@@ -1475,7 +1472,7 @@ var Space = class extends Resource {
|
|
|
1475
1472
|
credential
|
|
1476
1473
|
}, {
|
|
1477
1474
|
F: __dxlog_file8,
|
|
1478
|
-
L:
|
|
1475
|
+
L: 102,
|
|
1479
1476
|
S: this,
|
|
1480
1477
|
C: (f, a) => f(...a)
|
|
1481
1478
|
});
|
|
@@ -1486,7 +1483,7 @@ var Space = class extends Resource {
|
|
|
1486
1483
|
invitation
|
|
1487
1484
|
}, {
|
|
1488
1485
|
F: __dxlog_file8,
|
|
1489
|
-
L:
|
|
1486
|
+
L: 106,
|
|
1490
1487
|
S: this,
|
|
1491
1488
|
C: (f, a) => f(...a)
|
|
1492
1489
|
});
|
|
@@ -1497,7 +1494,7 @@ var Space = class extends Resource {
|
|
|
1497
1494
|
invitation
|
|
1498
1495
|
}, {
|
|
1499
1496
|
F: __dxlog_file8,
|
|
1500
|
-
L:
|
|
1497
|
+
L: 110,
|
|
1501
1498
|
S: this,
|
|
1502
1499
|
C: (f, a) => f(...a)
|
|
1503
1500
|
});
|
|
@@ -1511,7 +1508,7 @@ var Space = class extends Resource {
|
|
|
1511
1508
|
])
|
|
1512
1509
|
}), {
|
|
1513
1510
|
F: __dxlog_file8,
|
|
1514
|
-
L:
|
|
1511
|
+
L: 114,
|
|
1515
1512
|
S: this,
|
|
1516
1513
|
C: (f, a) => f(...a)
|
|
1517
1514
|
});
|
|
@@ -1520,9 +1517,6 @@ var Space = class extends Resource {
|
|
|
1520
1517
|
this.protocol = params.protocol;
|
|
1521
1518
|
this.protocol.addFeed(params.genesisFeed);
|
|
1522
1519
|
}
|
|
1523
|
-
get id() {
|
|
1524
|
-
return this._id;
|
|
1525
|
-
}
|
|
1526
1520
|
get key() {
|
|
1527
1521
|
return this._key;
|
|
1528
1522
|
}
|
|
@@ -1553,7 +1547,7 @@ var Space = class extends Resource {
|
|
|
1553
1547
|
async setControlFeed(feed) {
|
|
1554
1548
|
invariant6(!this._controlFeed, "Control feed already set.", {
|
|
1555
1549
|
F: __dxlog_file8,
|
|
1556
|
-
L:
|
|
1550
|
+
L: 161,
|
|
1557
1551
|
S: this,
|
|
1558
1552
|
A: [
|
|
1559
1553
|
"!this._controlFeed",
|
|
@@ -1567,7 +1561,7 @@ var Space = class extends Resource {
|
|
|
1567
1561
|
async setDataFeed(feed) {
|
|
1568
1562
|
invariant6(!this._dataFeed, "Data feed already set.", {
|
|
1569
1563
|
F: __dxlog_file8,
|
|
1570
|
-
L:
|
|
1564
|
+
L: 168,
|
|
1571
1565
|
S: this,
|
|
1572
1566
|
A: [
|
|
1573
1567
|
"!this._dataFeed",
|
|
@@ -1586,7 +1580,7 @@ var Space = class extends Resource {
|
|
|
1586
1580
|
async _open(ctx) {
|
|
1587
1581
|
log7("opening...", void 0, {
|
|
1588
1582
|
F: __dxlog_file8,
|
|
1589
|
-
L:
|
|
1583
|
+
L: 182,
|
|
1590
1584
|
S: this,
|
|
1591
1585
|
C: (f, a) => f(...a)
|
|
1592
1586
|
});
|
|
@@ -1594,7 +1588,7 @@ var Space = class extends Resource {
|
|
|
1594
1588
|
await this.protocol.start();
|
|
1595
1589
|
log7("opened", void 0, {
|
|
1596
1590
|
F: __dxlog_file8,
|
|
1597
|
-
L:
|
|
1591
|
+
L: 188,
|
|
1598
1592
|
S: this,
|
|
1599
1593
|
C: (f, a) => f(...a)
|
|
1600
1594
|
});
|
|
@@ -1604,7 +1598,7 @@ var Space = class extends Resource {
|
|
|
1604
1598
|
key: this._key
|
|
1605
1599
|
}, {
|
|
1606
1600
|
F: __dxlog_file8,
|
|
1607
|
-
L:
|
|
1601
|
+
L: 193,
|
|
1608
1602
|
S: this,
|
|
1609
1603
|
C: (f, a) => f(...a)
|
|
1610
1604
|
});
|
|
@@ -1612,7 +1606,7 @@ var Space = class extends Resource {
|
|
|
1612
1606
|
await this._controlPipeline.stop();
|
|
1613
1607
|
log7("closed", void 0, {
|
|
1614
1608
|
F: __dxlog_file8,
|
|
1615
|
-
L:
|
|
1609
|
+
L: 199,
|
|
1616
1610
|
S: this,
|
|
1617
1611
|
C: (f, a) => f(...a)
|
|
1618
1612
|
});
|
|
@@ -1624,10 +1618,6 @@ _ts_decorate5([
|
|
|
1624
1618
|
_ts_decorate5([
|
|
1625
1619
|
trace2.info()
|
|
1626
1620
|
], Space.prototype, "_controlPipeline", void 0);
|
|
1627
|
-
_ts_decorate5([
|
|
1628
|
-
logInfo,
|
|
1629
|
-
trace2.info()
|
|
1630
|
-
], Space.prototype, "id", null);
|
|
1631
1621
|
_ts_decorate5([
|
|
1632
1622
|
logInfo,
|
|
1633
1623
|
trace2.info()
|
|
@@ -1642,29 +1632,17 @@ Space = _ts_decorate5([
|
|
|
1642
1632
|
trackLeaks2("open", "close"),
|
|
1643
1633
|
trace2.resource()
|
|
1644
1634
|
], Space);
|
|
1645
|
-
var SPACE_IDS_CACHE = new ComplexMap3(PublicKey5.hash);
|
|
1646
|
-
var createIdFromSpaceKey = async (spaceKey) => {
|
|
1647
|
-
const cachedValue = SPACE_IDS_CACHE.get(spaceKey);
|
|
1648
|
-
if (cachedValue !== void 0) {
|
|
1649
|
-
return cachedValue;
|
|
1650
|
-
}
|
|
1651
|
-
const digest = await subtleCrypto2.digest("SHA-256", spaceKey.asUint8Array());
|
|
1652
|
-
const bytes = new Uint8Array(digest).slice(0, SpaceId.byteLength);
|
|
1653
|
-
const spaceId = SpaceId.encode(bytes);
|
|
1654
|
-
SPACE_IDS_CACHE.set(spaceKey, spaceId);
|
|
1655
|
-
return spaceId;
|
|
1656
|
-
};
|
|
1657
1635
|
|
|
1658
1636
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1659
|
-
import { discoveryKey, subtleCrypto as
|
|
1660
|
-
import { PublicKey as
|
|
1637
|
+
import { discoveryKey, subtleCrypto as subtleCrypto2 } from "@dxos/crypto";
|
|
1638
|
+
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1661
1639
|
import { log as log8, logInfo as logInfo2 } from "@dxos/log";
|
|
1662
1640
|
import { MMSTTopology } from "@dxos/network-manager";
|
|
1663
1641
|
import { Teleport } from "@dxos/teleport";
|
|
1664
1642
|
import { BlobSync } from "@dxos/teleport-extension-object-sync";
|
|
1665
1643
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
1666
1644
|
import { trace as trace3 } from "@dxos/tracing";
|
|
1667
|
-
import { ComplexMap as
|
|
1645
|
+
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
1668
1646
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
1669
1647
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1670
1648
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1681,7 +1659,7 @@ var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
|
1681
1659
|
var SpaceProtocol = class {
|
|
1682
1660
|
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore }) {
|
|
1683
1661
|
this._feeds = /* @__PURE__ */ new Set();
|
|
1684
|
-
this._sessions = new
|
|
1662
|
+
this._sessions = new ComplexMap3(PublicKey5.hash);
|
|
1685
1663
|
// TODO(burdon): Move to config (with sensible defaults).
|
|
1686
1664
|
this._topology = new MMSTTopology({
|
|
1687
1665
|
originateConnections: 4,
|
|
@@ -1696,7 +1674,7 @@ var SpaceProtocol = class {
|
|
|
1696
1674
|
this.blobSync = new BlobSync({
|
|
1697
1675
|
blobStore
|
|
1698
1676
|
});
|
|
1699
|
-
this._topic =
|
|
1677
|
+
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
1700
1678
|
}
|
|
1701
1679
|
get sessions() {
|
|
1702
1680
|
return this._sessions;
|
|
@@ -1877,10 +1855,10 @@ _ts_decorate6([
|
|
|
1877
1855
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
1878
1856
|
import { synchronized as synchronized4, trackLeaks as trackLeaks3 } from "@dxos/async";
|
|
1879
1857
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1880
|
-
import { PublicKey as
|
|
1858
|
+
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
1881
1859
|
import { log as log9 } from "@dxos/log";
|
|
1882
1860
|
import { trace as trace4 } from "@dxos/protocols";
|
|
1883
|
-
import { ComplexMap as
|
|
1861
|
+
import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
1884
1862
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
1885
1863
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1886
1864
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1894,8 +1872,8 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1894
1872
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
1895
1873
|
var SpaceManager = class {
|
|
1896
1874
|
constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
|
|
1897
|
-
this._spaces = new
|
|
1898
|
-
this._instanceId =
|
|
1875
|
+
this._spaces = new ComplexMap4(PublicKey6.hash);
|
|
1876
|
+
this._instanceId = PublicKey6.random().toHex();
|
|
1899
1877
|
this._feedStore = feedStore;
|
|
1900
1878
|
this._networkManager = networkManager;
|
|
1901
1879
|
this._metadataStore = metadataStore;
|
|
@@ -1932,7 +1910,6 @@ var SpaceManager = class {
|
|
|
1932
1910
|
});
|
|
1933
1911
|
const genesisFeed = await this._feedStore.openFeed(metadata.genesisFeedKey ?? failUndefined2());
|
|
1934
1912
|
const spaceKey = metadata.key;
|
|
1935
|
-
const spaceId = await createIdFromSpaceKey(spaceKey);
|
|
1936
1913
|
const protocol = new SpaceProtocol({
|
|
1937
1914
|
topic: spaceKey,
|
|
1938
1915
|
swarmIdentity,
|
|
@@ -1943,7 +1920,6 @@ var SpaceManager = class {
|
|
|
1943
1920
|
});
|
|
1944
1921
|
const snapshotManager = new SnapshotManager(this._snapshotStore, this._blobStore, protocol.blobSync);
|
|
1945
1922
|
const space = new Space({
|
|
1946
|
-
id: spaceId,
|
|
1947
1923
|
spaceKey,
|
|
1948
1924
|
protocol,
|
|
1949
1925
|
genesisFeed,
|
|
@@ -1959,7 +1935,7 @@ var SpaceManager = class {
|
|
|
1959
1935
|
id: this._instanceId
|
|
1960
1936
|
}), {
|
|
1961
1937
|
F: __dxlog_file10,
|
|
1962
|
-
L:
|
|
1938
|
+
L: 124,
|
|
1963
1939
|
S: this,
|
|
1964
1940
|
C: (f, a) => f(...a)
|
|
1965
1941
|
});
|
|
@@ -1993,7 +1969,6 @@ export {
|
|
|
1993
1969
|
Pipeline,
|
|
1994
1970
|
AuthExtension,
|
|
1995
1971
|
Space,
|
|
1996
|
-
createIdFromSpaceKey,
|
|
1997
1972
|
MOCK_AUTH_PROVIDER,
|
|
1998
1973
|
MOCK_AUTH_VERIFIER,
|
|
1999
1974
|
SpaceProtocol,
|
|
@@ -2001,4 +1976,4 @@ export {
|
|
|
2001
1976
|
SpaceProtocolSession,
|
|
2002
1977
|
SpaceManager
|
|
2003
1978
|
};
|
|
2004
|
-
//# sourceMappingURL=chunk-
|
|
1979
|
+
//# sourceMappingURL=chunk-GANAND63.mjs.map
|