@dxos/echo-pipeline 0.5.9-main.1cc8373 → 0.5.9-main.1ea2105
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-HS77A4I4.mjs → chunk-I2J5TTHJ.mjs} +23 -174
- package/dist/lib/browser/{chunk-HS77A4I4.mjs.map → chunk-I2J5TTHJ.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +3 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +7 -11
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-Y5U7UXEL.cjs → chunk-QPCNQ4ZK.cjs} +34 -185
- package/dist/lib/node/{chunk-Y5U7UXEL.cjs.map → chunk-QPCNQ4ZK.cjs.map} +4 -4
- package/dist/lib/node/index.cjs +25 -32
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +17 -21
- package/dist/lib/node/testing/index.cjs.map +1 -1
- package/dist/types/src/space/index.d.ts +0 -1
- package/dist/types/src/space/index.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +0 -8
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/mesh-echo-replicator.ts +1 -1
- package/src/space/index.ts +0 -1
- package/src/space/space-manager.ts +1 -46
- package/dist/types/src/space/admission-discovery-extension.d.ts +0 -30
- package/dist/types/src/space/admission-discovery-extension.d.ts.map +0 -1
- package/src/space/admission-discovery-extension.ts +0 -90
|
@@ -184,10 +184,7 @@ var MetadataStore = class {
|
|
|
184
184
|
this._spaceLargeMetadata = new ComplexMap(PublicKey2.hash);
|
|
185
185
|
this._metadataFile = void 0;
|
|
186
186
|
this.update = new Event();
|
|
187
|
-
this._invitationCleanupCtx = new Context(
|
|
188
|
-
F: __dxlog_file2,
|
|
189
|
-
L: 53
|
|
190
|
-
});
|
|
187
|
+
this._invitationCleanupCtx = new Context();
|
|
191
188
|
this._directory = directory;
|
|
192
189
|
}
|
|
193
190
|
get metadata() {
|
|
@@ -644,10 +641,7 @@ var PipelineState = class {
|
|
|
644
641
|
constructor(_feeds, _timeframeClock) {
|
|
645
642
|
this._feeds = _feeds;
|
|
646
643
|
this._timeframeClock = _timeframeClock;
|
|
647
|
-
this._ctx = new Context2(
|
|
648
|
-
F: __dxlog_file5,
|
|
649
|
-
L: 41
|
|
650
|
-
});
|
|
644
|
+
this._ctx = new Context2();
|
|
651
645
|
this.timeframeUpdate = this._timeframeClock.update;
|
|
652
646
|
this.stalled = new Event3();
|
|
653
647
|
this._startTimeframe = new Timeframe2();
|
|
@@ -695,10 +689,7 @@ var PipelineState = class {
|
|
|
695
689
|
*
|
|
696
690
|
* @param timeout Timeout in milliseconds to specify the maximum wait time.
|
|
697
691
|
*/
|
|
698
|
-
async waitUntilReachedTargetTimeframe({ ctx = new Context2(
|
|
699
|
-
F: __dxlog_file5,
|
|
700
|
-
L: 129
|
|
701
|
-
}), timeout, breakOnStall = true } = {}) {
|
|
692
|
+
async waitUntilReachedTargetTimeframe({ ctx = new Context2(), timeout, breakOnStall = true } = {}) {
|
|
702
693
|
log4("waitUntilReachedTargetTimeframe", {
|
|
703
694
|
timeout,
|
|
704
695
|
current: this.timeframe,
|
|
@@ -866,10 +857,7 @@ var Pipeline = class {
|
|
|
866
857
|
await this._feedSetIterator?.close();
|
|
867
858
|
await this._processingTrigger.wait();
|
|
868
859
|
await this._state._ctx.dispose();
|
|
869
|
-
this._state._ctx = new Context2(
|
|
870
|
-
F: __dxlog_file5,
|
|
871
|
-
L: 309
|
|
872
|
-
});
|
|
860
|
+
this._state._ctx = new Context2();
|
|
873
861
|
this._state._reachedTargetPromise = void 0;
|
|
874
862
|
this._state._reachedTarget = false;
|
|
875
863
|
this._isStarted = false;
|
|
@@ -1082,9 +1070,6 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1082
1070
|
C: (f, a) => f(...a)
|
|
1083
1071
|
});
|
|
1084
1072
|
}
|
|
1085
|
-
}, {
|
|
1086
|
-
F: __dxlog_file6,
|
|
1087
|
-
L: 26
|
|
1088
1073
|
});
|
|
1089
1074
|
}
|
|
1090
1075
|
async getHandlers() {
|
|
@@ -1199,10 +1184,7 @@ var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
|
1199
1184
|
var USE_SNAPSHOTS = true;
|
|
1200
1185
|
var ControlPipeline = class {
|
|
1201
1186
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1202
|
-
this._ctx = new Context4(
|
|
1203
|
-
F: __dxlog_file7,
|
|
1204
|
-
L: 47
|
|
1205
|
-
});
|
|
1187
|
+
this._ctx = new Context4();
|
|
1206
1188
|
this._lastTimeframeSaveTime = Date.now();
|
|
1207
1189
|
this.onFeedAdmitted = new Callback();
|
|
1208
1190
|
this._usage = new TimeUsageCounter();
|
|
@@ -1281,10 +1263,7 @@ var ControlPipeline = class {
|
|
|
1281
1263
|
C: (f, a) => f(...a)
|
|
1282
1264
|
});
|
|
1283
1265
|
setTimeout(async () => {
|
|
1284
|
-
void this._consumePipeline(new Context4(
|
|
1285
|
-
F: __dxlog_file7,
|
|
1286
|
-
L: 130
|
|
1287
|
-
}));
|
|
1266
|
+
void this._consumePipeline(new Context4());
|
|
1288
1267
|
});
|
|
1289
1268
|
await this._pipeline.start();
|
|
1290
1269
|
log6("started", void 0, {
|
|
@@ -1676,73 +1655,6 @@ var createIdFromSpaceKey = async (spaceKey) => {
|
|
|
1676
1655
|
return spaceId;
|
|
1677
1656
|
};
|
|
1678
1657
|
|
|
1679
|
-
// packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts
|
|
1680
|
-
import { scheduleTask as scheduleTask2 } from "@dxos/async";
|
|
1681
|
-
import { Context as Context5 } from "@dxos/context";
|
|
1682
|
-
import { ProtocolError, schema as schema6 } from "@dxos/protocols";
|
|
1683
|
-
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1684
|
-
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
|
|
1685
|
-
var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
1686
|
-
constructor(_request, _onResult) {
|
|
1687
|
-
super({
|
|
1688
|
-
requested: {
|
|
1689
|
-
AdmissionDiscoveryService: schema6.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1690
|
-
}
|
|
1691
|
-
});
|
|
1692
|
-
this._request = _request;
|
|
1693
|
-
this._onResult = _onResult;
|
|
1694
|
-
this._ctx = new Context5(void 0, {
|
|
1695
|
-
F: __dxlog_file9,
|
|
1696
|
-
L: 25
|
|
1697
|
-
});
|
|
1698
|
-
}
|
|
1699
|
-
async getHandlers() {
|
|
1700
|
-
return {};
|
|
1701
|
-
}
|
|
1702
|
-
async onOpen(context) {
|
|
1703
|
-
await super.onOpen(context);
|
|
1704
|
-
scheduleTask2(this._ctx, async () => {
|
|
1705
|
-
try {
|
|
1706
|
-
const result = await this.rpc.AdmissionDiscoveryService.getAdmissionCredential(this._request);
|
|
1707
|
-
this._onResult.wake(result.admissionCredential);
|
|
1708
|
-
} catch (err) {
|
|
1709
|
-
context.close(err);
|
|
1710
|
-
}
|
|
1711
|
-
});
|
|
1712
|
-
}
|
|
1713
|
-
async onClose() {
|
|
1714
|
-
await this._ctx.dispose();
|
|
1715
|
-
}
|
|
1716
|
-
async onAbort() {
|
|
1717
|
-
await this._ctx.dispose();
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1720
|
-
var CredentialServerExtension = class extends RpcExtension2 {
|
|
1721
|
-
constructor(_space) {
|
|
1722
|
-
super({
|
|
1723
|
-
exposed: {
|
|
1724
|
-
AdmissionDiscoveryService: schema6.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1725
|
-
}
|
|
1726
|
-
});
|
|
1727
|
-
this._space = _space;
|
|
1728
|
-
}
|
|
1729
|
-
async getHandlers() {
|
|
1730
|
-
return {
|
|
1731
|
-
AdmissionDiscoveryService: {
|
|
1732
|
-
getAdmissionCredential: async (request) => {
|
|
1733
|
-
const memberInfo = this._space.spaceState.members.get(request.memberKey);
|
|
1734
|
-
if (!memberInfo?.credential) {
|
|
1735
|
-
throw new ProtocolError("Space member not found.", request);
|
|
1736
|
-
}
|
|
1737
|
-
return {
|
|
1738
|
-
admissionCredential: memberInfo.credential
|
|
1739
|
-
};
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
};
|
|
1743
|
-
}
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
1658
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1747
1659
|
import { discoveryKey, subtleCrypto as subtleCrypto3 } from "@dxos/crypto";
|
|
1748
1660
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
@@ -1763,7 +1675,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1763
1675
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1764
1676
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1765
1677
|
}
|
|
1766
|
-
var
|
|
1678
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
|
|
1767
1679
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1768
1680
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1769
1681
|
var SpaceProtocol = class {
|
|
@@ -1800,7 +1712,7 @@ var SpaceProtocol = class {
|
|
|
1800
1712
|
log8("addFeed", {
|
|
1801
1713
|
key: feed.key
|
|
1802
1714
|
}, {
|
|
1803
|
-
F:
|
|
1715
|
+
F: __dxlog_file9,
|
|
1804
1716
|
L: 109,
|
|
1805
1717
|
S: this,
|
|
1806
1718
|
C: (f, a) => f(...a)
|
|
@@ -1818,7 +1730,7 @@ var SpaceProtocol = class {
|
|
|
1818
1730
|
const credentials = await this._swarmIdentity.credentialProvider(Buffer.from(""));
|
|
1819
1731
|
await this.blobSync.open();
|
|
1820
1732
|
log8("starting...", void 0, {
|
|
1821
|
-
F:
|
|
1733
|
+
F: __dxlog_file9,
|
|
1822
1734
|
L: 128,
|
|
1823
1735
|
S: this,
|
|
1824
1736
|
C: (f, a) => f(...a)
|
|
@@ -1832,7 +1744,7 @@ var SpaceProtocol = class {
|
|
|
1832
1744
|
label: `swarm ${topic.truncate()} for space ${this._spaceKey.truncate()}`
|
|
1833
1745
|
});
|
|
1834
1746
|
log8("started", void 0, {
|
|
1835
|
-
F:
|
|
1747
|
+
F: __dxlog_file9,
|
|
1836
1748
|
L: 138,
|
|
1837
1749
|
S: this,
|
|
1838
1750
|
C: (f, a) => f(...a)
|
|
@@ -1845,14 +1757,14 @@ var SpaceProtocol = class {
|
|
|
1845
1757
|
await this.blobSync.close();
|
|
1846
1758
|
if (this._connection) {
|
|
1847
1759
|
log8("stopping...", void 0, {
|
|
1848
|
-
F:
|
|
1760
|
+
F: __dxlog_file9,
|
|
1849
1761
|
L: 149,
|
|
1850
1762
|
S: this,
|
|
1851
1763
|
C: (f, a) => f(...a)
|
|
1852
1764
|
});
|
|
1853
1765
|
await this._connection.close();
|
|
1854
1766
|
log8("stopped", void 0, {
|
|
1855
|
-
F:
|
|
1767
|
+
F: __dxlog_file9,
|
|
1856
1768
|
L: 151,
|
|
1857
1769
|
S: this,
|
|
1858
1770
|
C: (f, a) => f(...a)
|
|
@@ -1926,7 +1838,7 @@ var SpaceProtocolSession = class {
|
|
|
1926
1838
|
verifier: this._swarmIdentity.credentialAuthenticator,
|
|
1927
1839
|
onAuthSuccess: () => {
|
|
1928
1840
|
log8("Peer authenticated", void 0, {
|
|
1929
|
-
F:
|
|
1841
|
+
F: __dxlog_file9,
|
|
1930
1842
|
L: 248,
|
|
1931
1843
|
S: this,
|
|
1932
1844
|
C: (f, a) => f(...a)
|
|
@@ -1944,7 +1856,7 @@ var SpaceProtocolSession = class {
|
|
|
1944
1856
|
}
|
|
1945
1857
|
async close() {
|
|
1946
1858
|
log8("close", void 0, {
|
|
1947
|
-
F:
|
|
1859
|
+
F: __dxlog_file9,
|
|
1948
1860
|
L: 264,
|
|
1949
1861
|
S: this,
|
|
1950
1862
|
C: (f, a) => f(...a)
|
|
@@ -1963,7 +1875,7 @@ _ts_decorate6([
|
|
|
1963
1875
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
1964
1876
|
|
|
1965
1877
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
1966
|
-
import { synchronized as synchronized4, trackLeaks as trackLeaks3
|
|
1878
|
+
import { synchronized as synchronized4, trackLeaks as trackLeaks3 } from "@dxos/async";
|
|
1967
1879
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1968
1880
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
1969
1881
|
import { log as log9 } from "@dxos/log";
|
|
@@ -1979,7 +1891,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1979
1891
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1980
1892
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1981
1893
|
}
|
|
1982
|
-
var
|
|
1894
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
1983
1895
|
var SpaceManager = class {
|
|
1984
1896
|
constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
|
|
1985
1897
|
this._spaces = new ComplexMap5(PublicKey7.hash);
|
|
@@ -2005,16 +1917,16 @@ var SpaceManager = class {
|
|
|
2005
1917
|
log9.trace("dxos.echo.space-manager.construct-space", trace4.begin({
|
|
2006
1918
|
id: this._instanceId
|
|
2007
1919
|
}), {
|
|
2008
|
-
F:
|
|
2009
|
-
L:
|
|
1920
|
+
F: __dxlog_file10,
|
|
1921
|
+
L: 94,
|
|
2010
1922
|
S: this,
|
|
2011
1923
|
C: (f, a) => f(...a)
|
|
2012
1924
|
});
|
|
2013
1925
|
log9("constructing space...", {
|
|
2014
1926
|
spaceKey: metadata.genesisFeedKey
|
|
2015
1927
|
}, {
|
|
2016
|
-
F:
|
|
2017
|
-
L:
|
|
1928
|
+
F: __dxlog_file10,
|
|
1929
|
+
L: 95,
|
|
2018
1930
|
S: this,
|
|
2019
1931
|
C: (f, a) => f(...a)
|
|
2020
1932
|
});
|
|
@@ -2046,74 +1958,13 @@ var SpaceManager = class {
|
|
|
2046
1958
|
log9.trace("dxos.echo.space-manager.construct-space", trace4.end({
|
|
2047
1959
|
id: this._instanceId
|
|
2048
1960
|
}), {
|
|
2049
|
-
F:
|
|
2050
|
-
L:
|
|
1961
|
+
F: __dxlog_file10,
|
|
1962
|
+
L: 126,
|
|
2051
1963
|
S: this,
|
|
2052
1964
|
C: (f, a) => f(...a)
|
|
2053
1965
|
});
|
|
2054
1966
|
return space;
|
|
2055
1967
|
}
|
|
2056
|
-
async requestSpaceAdmissionCredential(params) {
|
|
2057
|
-
const traceKey = "dxos.echo.space-manager.request-space-admission";
|
|
2058
|
-
log9.trace(traceKey, trace4.begin({
|
|
2059
|
-
id: this._instanceId
|
|
2060
|
-
}), {
|
|
2061
|
-
F: __dxlog_file11,
|
|
2062
|
-
L: 141,
|
|
2063
|
-
S: this,
|
|
2064
|
-
C: (f, a) => f(...a)
|
|
2065
|
-
});
|
|
2066
|
-
log9("requesting space admission credential...", {
|
|
2067
|
-
spaceKey: params.spaceKey
|
|
2068
|
-
}, {
|
|
2069
|
-
F: __dxlog_file11,
|
|
2070
|
-
L: 142,
|
|
2071
|
-
S: this,
|
|
2072
|
-
C: (f, a) => f(...a)
|
|
2073
|
-
});
|
|
2074
|
-
const onCredentialResolved = new Trigger2();
|
|
2075
|
-
const protocol = new SpaceProtocol({
|
|
2076
|
-
topic: params.spaceKey,
|
|
2077
|
-
swarmIdentity: params.swarmIdentity,
|
|
2078
|
-
networkManager: this._networkManager,
|
|
2079
|
-
onSessionAuth: (session) => {
|
|
2080
|
-
session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialRetrieverExtension({
|
|
2081
|
-
spaceKey: params.spaceKey,
|
|
2082
|
-
memberKey: params.identityKey
|
|
2083
|
-
}, onCredentialResolved));
|
|
2084
|
-
},
|
|
2085
|
-
onAuthFailure: (session) => session.close(),
|
|
2086
|
-
blobStore: this._blobStore
|
|
2087
|
-
});
|
|
2088
|
-
try {
|
|
2089
|
-
await protocol.start();
|
|
2090
|
-
const credential = await onCredentialResolved.wait({
|
|
2091
|
-
timeout: params.timeout
|
|
2092
|
-
});
|
|
2093
|
-
log9.trace(traceKey, trace4.end({
|
|
2094
|
-
id: this._instanceId
|
|
2095
|
-
}), {
|
|
2096
|
-
F: __dxlog_file11,
|
|
2097
|
-
L: 165,
|
|
2098
|
-
S: this,
|
|
2099
|
-
C: (f, a) => f(...a)
|
|
2100
|
-
});
|
|
2101
|
-
return credential;
|
|
2102
|
-
} catch (err) {
|
|
2103
|
-
log9.trace(traceKey, trace4.error({
|
|
2104
|
-
id: this._instanceId,
|
|
2105
|
-
error: err
|
|
2106
|
-
}), {
|
|
2107
|
-
F: __dxlog_file11,
|
|
2108
|
-
L: 168,
|
|
2109
|
-
S: this,
|
|
2110
|
-
C: (f, a) => f(...a)
|
|
2111
|
-
});
|
|
2112
|
-
throw err;
|
|
2113
|
-
} finally {
|
|
2114
|
-
await protocol.stop();
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
1968
|
};
|
|
2118
1969
|
_ts_decorate7([
|
|
2119
1970
|
synchronized4
|
|
@@ -2143,8 +1994,6 @@ export {
|
|
|
2143
1994
|
AuthExtension,
|
|
2144
1995
|
Space,
|
|
2145
1996
|
createIdFromSpaceKey,
|
|
2146
|
-
CredentialRetrieverExtension,
|
|
2147
|
-
CredentialServerExtension,
|
|
2148
1997
|
MOCK_AUTH_PROVIDER,
|
|
2149
1998
|
MOCK_AUTH_VERIFIER,
|
|
2150
1999
|
SpaceProtocol,
|
|
@@ -2152,4 +2001,4 @@ export {
|
|
|
2152
2001
|
SpaceProtocolSession,
|
|
2153
2002
|
SpaceManager
|
|
2154
2003
|
};
|
|
2155
|
-
//# sourceMappingURL=chunk-
|
|
2004
|
+
//# sourceMappingURL=chunk-I2J5TTHJ.mjs.map
|