@dxos/echo-pipeline 0.5.8-main.d2aa75a → 0.5.8-main.f69e6e4
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-BE5QQHWH.mjs → chunk-I2J5TTHJ.mjs} +19 -22
- package/dist/lib/browser/{chunk-BE5QQHWH.mjs.map → chunk-I2J5TTHJ.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +19 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-ZELCNJ3D.cjs → chunk-QPCNQ4ZK.cjs} +12 -15
- package/dist/lib/node/{chunk-ZELCNJ3D.cjs.map → chunk-QPCNQ4ZK.cjs.map} +3 -3
- package/dist/lib/node/index.cjs +41 -40
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +11 -11
- package/dist/types/src/automerge/automerge-doc-loader.d.ts +7 -3
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +1 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.test.ts +3 -1
- package/src/automerge/automerge-doc-loader.ts +5 -3
- package/src/space/space.ts +11 -10
|
@@ -1152,11 +1152,11 @@ import { Event as Event4, Mutex, synchronized as synchronized3, trackLeaks as tr
|
|
|
1152
1152
|
import { LifecycleState, Resource } from "@dxos/context";
|
|
1153
1153
|
import { subtleCrypto as subtleCrypto2 } from "@dxos/crypto";
|
|
1154
1154
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1155
|
-
import { SpaceId } from "@dxos/keys";
|
|
1155
|
+
import { PublicKey as PublicKey5, SpaceId } from "@dxos/keys";
|
|
1156
1156
|
import { log as log7, logInfo } from "@dxos/log";
|
|
1157
1157
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1158
1158
|
import { trace as trace2 } from "@dxos/tracing";
|
|
1159
|
-
import { Callback as Callback2 } from "@dxos/util";
|
|
1159
|
+
import { Callback as Callback2, ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
1160
1160
|
|
|
1161
1161
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1162
1162
|
import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
@@ -1642,32 +1642,29 @@ Space = _ts_decorate5([
|
|
|
1642
1642
|
trackLeaks2("open", "close"),
|
|
1643
1643
|
trace2.resource()
|
|
1644
1644
|
], Space);
|
|
1645
|
+
var SPACE_IDS_CACHE = new ComplexMap3(PublicKey5.hash);
|
|
1645
1646
|
var createIdFromSpaceKey = async (spaceKey) => {
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
A: [
|
|
1651
|
-
"spaceKey.length === EXPECTED_SPACE_KEY_LENGTH",
|
|
1652
|
-
""
|
|
1653
|
-
]
|
|
1654
|
-
});
|
|
1647
|
+
const cachedValue = SPACE_IDS_CACHE.get(spaceKey);
|
|
1648
|
+
if (cachedValue !== void 0) {
|
|
1649
|
+
return cachedValue;
|
|
1650
|
+
}
|
|
1655
1651
|
const digest = await subtleCrypto2.digest("SHA-256", spaceKey.asUint8Array());
|
|
1656
1652
|
const bytes = new Uint8Array(digest).slice(0, SpaceId.byteLength);
|
|
1657
|
-
|
|
1653
|
+
const spaceId = SpaceId.encode(bytes);
|
|
1654
|
+
SPACE_IDS_CACHE.set(spaceKey, spaceId);
|
|
1655
|
+
return spaceId;
|
|
1658
1656
|
};
|
|
1659
|
-
var EXPECTED_SPACE_KEY_LENGTH = 65;
|
|
1660
1657
|
|
|
1661
1658
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1662
1659
|
import { discoveryKey, subtleCrypto as subtleCrypto3 } from "@dxos/crypto";
|
|
1663
|
-
import { PublicKey as
|
|
1660
|
+
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
1664
1661
|
import { log as log8, logInfo as logInfo2 } from "@dxos/log";
|
|
1665
1662
|
import { MMSTTopology } from "@dxos/network-manager";
|
|
1666
1663
|
import { Teleport } from "@dxos/teleport";
|
|
1667
1664
|
import { BlobSync } from "@dxos/teleport-extension-object-sync";
|
|
1668
1665
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
1669
1666
|
import { trace as trace3 } from "@dxos/tracing";
|
|
1670
|
-
import { ComplexMap as
|
|
1667
|
+
import { ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
1671
1668
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
1672
1669
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1673
1670
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1684,7 +1681,7 @@ var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
|
1684
1681
|
var SpaceProtocol = class {
|
|
1685
1682
|
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore }) {
|
|
1686
1683
|
this._feeds = /* @__PURE__ */ new Set();
|
|
1687
|
-
this._sessions = new
|
|
1684
|
+
this._sessions = new ComplexMap4(PublicKey6.hash);
|
|
1688
1685
|
// TODO(burdon): Move to config (with sensible defaults).
|
|
1689
1686
|
this._topology = new MMSTTopology({
|
|
1690
1687
|
originateConnections: 4,
|
|
@@ -1699,7 +1696,7 @@ var SpaceProtocol = class {
|
|
|
1699
1696
|
this.blobSync = new BlobSync({
|
|
1700
1697
|
blobStore
|
|
1701
1698
|
});
|
|
1702
|
-
this._topic = subtleCrypto3.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(
|
|
1699
|
+
this._topic = subtleCrypto3.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey6.from);
|
|
1703
1700
|
}
|
|
1704
1701
|
get sessions() {
|
|
1705
1702
|
return this._sessions;
|
|
@@ -1880,10 +1877,10 @@ _ts_decorate6([
|
|
|
1880
1877
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
1881
1878
|
import { synchronized as synchronized4, trackLeaks as trackLeaks3 } from "@dxos/async";
|
|
1882
1879
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1883
|
-
import { PublicKey as
|
|
1880
|
+
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
1884
1881
|
import { log as log9 } from "@dxos/log";
|
|
1885
1882
|
import { trace as trace4 } from "@dxos/protocols";
|
|
1886
|
-
import { ComplexMap as
|
|
1883
|
+
import { ComplexMap as ComplexMap5 } from "@dxos/util";
|
|
1887
1884
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
1888
1885
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1889
1886
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -1897,8 +1894,8 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1897
1894
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
1898
1895
|
var SpaceManager = class {
|
|
1899
1896
|
constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
|
|
1900
|
-
this._spaces = new
|
|
1901
|
-
this._instanceId =
|
|
1897
|
+
this._spaces = new ComplexMap5(PublicKey7.hash);
|
|
1898
|
+
this._instanceId = PublicKey7.random().toHex();
|
|
1902
1899
|
this._feedStore = feedStore;
|
|
1903
1900
|
this._networkManager = networkManager;
|
|
1904
1901
|
this._metadataStore = metadataStore;
|
|
@@ -2004,4 +2001,4 @@ export {
|
|
|
2004
2001
|
SpaceProtocolSession,
|
|
2005
2002
|
SpaceManager
|
|
2006
2003
|
};
|
|
2007
|
-
//# sourceMappingURL=chunk-
|
|
2004
|
+
//# sourceMappingURL=chunk-I2J5TTHJ.mjs.map
|