@dxos/echo-pipeline 0.3.11-main.e19f39d → 0.3.11-main.e28df4f
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-PB5T4DLC.mjs → chunk-D7UMNYLJ.mjs} +115 -62
- package/dist/lib/browser/{chunk-PB5T4DLC.mjs.map → chunk-D7UMNYLJ.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -4
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/node/{chunk-WGNVVL2H.cjs → chunk-GQW6RLGD.cjs} +113 -60
- package/dist/lib/node/chunk-GQW6RLGD.cjs.map +7 -0
- package/dist/lib/node/index.cjs +26 -26
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +19 -19
- package/dist/lib/node/testing/index.cjs.map +2 -2
- package/dist/types/src/automerge/automerge-host.d.ts +2 -0
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.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/dist/types/src/testing/database-test-rig.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-host.ts +21 -4
- package/src/pipeline/pipeline-stress.test.ts +9 -2
- package/src/space/data-pipeline.ts +4 -3
- package/src/space/space-protocol.ts +4 -0
- package/src/space/space.ts +8 -3
- package/src/testing/database-test-rig.ts +4 -1
- package/dist/lib/node/chunk-WGNVVL2H.cjs.map +0 -7
|
@@ -1602,22 +1602,23 @@ var DataPipeline = class {
|
|
|
1602
1602
|
this._epochCtx = void 0;
|
|
1603
1603
|
}
|
|
1604
1604
|
async _consumePipeline() {
|
|
1605
|
+
const pipeline = this._pipeline;
|
|
1605
1606
|
if (this.currentEpoch) {
|
|
1606
1607
|
const waitForOneEpoch = this.onNewEpoch.waitForCount(1);
|
|
1607
1608
|
await this._processEpochInSeparateTask(this.currentEpoch);
|
|
1608
1609
|
await waitForOneEpoch;
|
|
1609
1610
|
}
|
|
1610
1611
|
let messageCounter = 0;
|
|
1611
|
-
invariant8(
|
|
1612
|
+
invariant8(pipeline, "Pipeline is not initialized.", {
|
|
1612
1613
|
F: __dxlog_file9,
|
|
1613
|
-
L:
|
|
1614
|
+
L: 229,
|
|
1614
1615
|
S: this,
|
|
1615
1616
|
A: [
|
|
1616
|
-
"
|
|
1617
|
+
"pipeline",
|
|
1617
1618
|
"'Pipeline is not initialized.'"
|
|
1618
1619
|
]
|
|
1619
1620
|
});
|
|
1620
|
-
for await (const msg of
|
|
1621
|
+
for await (const msg of pipeline.consume()) {
|
|
1621
1622
|
const span = this._usage.beginRecording();
|
|
1622
1623
|
this._mutations.inc();
|
|
1623
1624
|
const { feedKey, seq, data } = msg;
|
|
@@ -1626,7 +1627,7 @@ var DataPipeline = class {
|
|
|
1626
1627
|
seq
|
|
1627
1628
|
}, {
|
|
1628
1629
|
F: __dxlog_file9,
|
|
1629
|
-
L:
|
|
1630
|
+
L: 235,
|
|
1630
1631
|
S: this,
|
|
1631
1632
|
C: (f, a) => f(...a)
|
|
1632
1633
|
});
|
|
@@ -1638,7 +1639,7 @@ var DataPipeline = class {
|
|
|
1638
1639
|
feedKey
|
|
1639
1640
|
}, {
|
|
1640
1641
|
F: __dxlog_file9,
|
|
1641
|
-
L:
|
|
1642
|
+
L: 241,
|
|
1642
1643
|
S: this,
|
|
1643
1644
|
C: (f, a) => f(...a)
|
|
1644
1645
|
});
|
|
@@ -1661,16 +1662,16 @@ var DataPipeline = class {
|
|
|
1661
1662
|
spaceKey: this._params.spaceKey.toHex()
|
|
1662
1663
|
}, {
|
|
1663
1664
|
F: __dxlog_file9,
|
|
1664
|
-
L:
|
|
1665
|
+
L: 258,
|
|
1665
1666
|
S: this,
|
|
1666
1667
|
C: (f, a) => f(...a)
|
|
1667
1668
|
});
|
|
1668
|
-
await this._noteTargetStateIfNeeded(
|
|
1669
|
+
await this._noteTargetStateIfNeeded(pipeline.state.pendingTimeframe);
|
|
1669
1670
|
}
|
|
1670
1671
|
} catch (err) {
|
|
1671
1672
|
log8.catch(err, void 0, {
|
|
1672
1673
|
F: __dxlog_file9,
|
|
1673
|
-
L:
|
|
1674
|
+
L: 268,
|
|
1674
1675
|
S: this,
|
|
1675
1676
|
C: (f, a) => f(...a)
|
|
1676
1677
|
});
|
|
@@ -1685,7 +1686,7 @@ var DataPipeline = class {
|
|
|
1685
1686
|
_createSnapshot() {
|
|
1686
1687
|
invariant8(this.databaseHost, "Database backend is not initialized.", {
|
|
1687
1688
|
F: __dxlog_file9,
|
|
1688
|
-
L:
|
|
1689
|
+
L: 282,
|
|
1689
1690
|
S: this,
|
|
1690
1691
|
A: [
|
|
1691
1692
|
"this.databaseHost",
|
|
@@ -1714,7 +1715,7 @@ var DataPipeline = class {
|
|
|
1714
1715
|
} catch (err) {
|
|
1715
1716
|
log8.warn("Failed to cache properties", err, {
|
|
1716
1717
|
F: __dxlog_file9,
|
|
1717
|
-
L:
|
|
1718
|
+
L: 311,
|
|
1718
1719
|
S: this,
|
|
1719
1720
|
C: (f, a) => f(...a)
|
|
1720
1721
|
});
|
|
@@ -1743,14 +1744,14 @@ var DataPipeline = class {
|
|
|
1743
1744
|
if (err instanceof CancelledError) {
|
|
1744
1745
|
log8("Epoch processing cancelled.", void 0, {
|
|
1745
1746
|
F: __dxlog_file9,
|
|
1746
|
-
L:
|
|
1747
|
+
L: 347,
|
|
1747
1748
|
S: this,
|
|
1748
1749
|
C: (f, a) => f(...a)
|
|
1749
1750
|
});
|
|
1750
1751
|
} else {
|
|
1751
1752
|
log8.catch(err, void 0, {
|
|
1752
1753
|
F: __dxlog_file9,
|
|
1753
|
-
L:
|
|
1754
|
+
L: 349,
|
|
1754
1755
|
S: this,
|
|
1755
1756
|
C: (f, a) => f(...a)
|
|
1756
1757
|
});
|
|
@@ -1773,7 +1774,7 @@ var DataPipeline = class {
|
|
|
1773
1774
|
async _processEpoch(ctx, epoch) {
|
|
1774
1775
|
invariant8(this._isOpen, "Space is closed.", {
|
|
1775
1776
|
F: __dxlog_file9,
|
|
1776
|
-
L:
|
|
1777
|
+
L: 373,
|
|
1777
1778
|
S: this,
|
|
1778
1779
|
A: [
|
|
1779
1780
|
"this._isOpen",
|
|
@@ -1782,7 +1783,7 @@ var DataPipeline = class {
|
|
|
1782
1783
|
});
|
|
1783
1784
|
invariant8(this._pipeline, void 0, {
|
|
1784
1785
|
F: __dxlog_file9,
|
|
1785
|
-
L:
|
|
1786
|
+
L: 374,
|
|
1786
1787
|
S: this,
|
|
1787
1788
|
A: [
|
|
1788
1789
|
"this._pipeline",
|
|
@@ -1794,7 +1795,7 @@ var DataPipeline = class {
|
|
|
1794
1795
|
epoch: omit(epoch, "proof")
|
|
1795
1796
|
}, {
|
|
1796
1797
|
F: __dxlog_file9,
|
|
1797
|
-
L:
|
|
1798
|
+
L: 377,
|
|
1798
1799
|
S: this,
|
|
1799
1800
|
C: (f, a) => f(...a)
|
|
1800
1801
|
});
|
|
@@ -1804,7 +1805,7 @@ var DataPipeline = class {
|
|
|
1804
1805
|
}
|
|
1805
1806
|
log8("restarting pipeline from epoch", void 0, {
|
|
1806
1807
|
F: __dxlog_file9,
|
|
1807
|
-
L:
|
|
1808
|
+
L: 383,
|
|
1808
1809
|
S: this,
|
|
1809
1810
|
C: (f, a) => f(...a)
|
|
1810
1811
|
});
|
|
@@ -1815,7 +1816,7 @@ var DataPipeline = class {
|
|
|
1815
1816
|
async waitUntilTimeframe(timeframe) {
|
|
1816
1817
|
invariant8(this._pipeline, "Pipeline is not initialized.", {
|
|
1817
1818
|
F: __dxlog_file9,
|
|
1818
|
-
L:
|
|
1819
|
+
L: 390,
|
|
1819
1820
|
S: this,
|
|
1820
1821
|
A: [
|
|
1821
1822
|
"this._pipeline",
|
|
@@ -1827,7 +1828,7 @@ var DataPipeline = class {
|
|
|
1827
1828
|
async createEpoch() {
|
|
1828
1829
|
invariant8(this._pipeline, void 0, {
|
|
1829
1830
|
F: __dxlog_file9,
|
|
1830
|
-
L:
|
|
1831
|
+
L: 396,
|
|
1831
1832
|
S: this,
|
|
1832
1833
|
A: [
|
|
1833
1834
|
"this._pipeline",
|
|
@@ -1836,7 +1837,7 @@ var DataPipeline = class {
|
|
|
1836
1837
|
});
|
|
1837
1838
|
invariant8(this.currentEpoch, void 0, {
|
|
1838
1839
|
F: __dxlog_file9,
|
|
1839
|
-
L:
|
|
1840
|
+
L: 397,
|
|
1840
1841
|
S: this,
|
|
1841
1842
|
A: [
|
|
1842
1843
|
"this.currentEpoch",
|
|
@@ -1867,7 +1868,7 @@ var DataPipeline = class {
|
|
|
1867
1868
|
} catch (err) {
|
|
1868
1869
|
log8.catch(err, void 0, {
|
|
1869
1870
|
F: __dxlog_file9,
|
|
1870
|
-
L:
|
|
1871
|
+
L: 427,
|
|
1871
1872
|
S: this,
|
|
1872
1873
|
C: (f, a) => f(...a)
|
|
1873
1874
|
});
|
|
@@ -1924,7 +1925,7 @@ var idle = async (timeout) => {
|
|
|
1924
1925
|
};
|
|
1925
1926
|
|
|
1926
1927
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1927
|
-
import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeaks3,
|
|
1928
|
+
import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeaks3, Mutex } from "@dxos/async";
|
|
1928
1929
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
1929
1930
|
import { log as log10, logInfo } from "@dxos/log";
|
|
1930
1931
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -2203,13 +2204,13 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
2203
2204
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
2204
2205
|
var Space = class {
|
|
2205
2206
|
constructor(params) {
|
|
2206
|
-
this.
|
|
2207
|
+
this._addFeedMutex = new Mutex();
|
|
2207
2208
|
this.onCredentialProcessed = new Callback2();
|
|
2208
2209
|
this.stateUpdate = new Event5();
|
|
2209
2210
|
this._isOpen = false;
|
|
2210
2211
|
invariant9(params.spaceKey && params.feedProvider, void 0, {
|
|
2211
2212
|
F: __dxlog_file11,
|
|
2212
|
-
L:
|
|
2213
|
+
L: 78,
|
|
2213
2214
|
S: this,
|
|
2214
2215
|
A: [
|
|
2215
2216
|
"params.spaceKey && params.feedProvider",
|
|
@@ -2253,7 +2254,7 @@ var Space = class {
|
|
|
2253
2254
|
credential
|
|
2254
2255
|
}, {
|
|
2255
2256
|
F: __dxlog_file11,
|
|
2256
|
-
L:
|
|
2257
|
+
L: 116,
|
|
2257
2258
|
S: this,
|
|
2258
2259
|
C: (f, a) => f(...a)
|
|
2259
2260
|
});
|
|
@@ -2273,7 +2274,7 @@ var Space = class {
|
|
|
2273
2274
|
if (this._dataFeed) {
|
|
2274
2275
|
pipeline.setWriteFeed(this._dataFeed);
|
|
2275
2276
|
}
|
|
2276
|
-
await this.
|
|
2277
|
+
await this._addFeedMutex.executeSynchronized(async () => {
|
|
2277
2278
|
for (const feed of this._controlPipeline.spaceState.feeds.values()) {
|
|
2278
2279
|
if (feed.assertion.designation === AdmittedFeed2.Designation.DATA && !pipeline.hasFeed(feed.key)) {
|
|
2279
2280
|
await pipeline.addFeed(await this._feedProvider(feed.key, {
|
|
@@ -2318,7 +2319,7 @@ var Space = class {
|
|
|
2318
2319
|
setControlFeed(feed) {
|
|
2319
2320
|
invariant9(!this._controlFeed, "Control feed already set.", {
|
|
2320
2321
|
F: __dxlog_file11,
|
|
2321
|
-
L:
|
|
2322
|
+
L: 191,
|
|
2322
2323
|
S: this,
|
|
2323
2324
|
A: [
|
|
2324
2325
|
"!this._controlFeed",
|
|
@@ -2332,7 +2333,7 @@ var Space = class {
|
|
|
2332
2333
|
setDataFeed(feed) {
|
|
2333
2334
|
invariant9(!this._dataFeed, "Data feed already set.", {
|
|
2334
2335
|
F: __dxlog_file11,
|
|
2335
|
-
L:
|
|
2336
|
+
L: 198,
|
|
2336
2337
|
S: this,
|
|
2337
2338
|
A: [
|
|
2338
2339
|
"!this._dataFeed",
|
|
@@ -2358,7 +2359,7 @@ var Space = class {
|
|
|
2358
2359
|
async open(ctx) {
|
|
2359
2360
|
log10("opening...", void 0, {
|
|
2360
2361
|
F: __dxlog_file11,
|
|
2361
|
-
L:
|
|
2362
|
+
L: 220,
|
|
2362
2363
|
S: this,
|
|
2363
2364
|
C: (f, a) => f(...a)
|
|
2364
2365
|
});
|
|
@@ -2371,7 +2372,7 @@ var Space = class {
|
|
|
2371
2372
|
this._isOpen = true;
|
|
2372
2373
|
log10("opened", void 0, {
|
|
2373
2374
|
F: __dxlog_file11,
|
|
2374
|
-
L:
|
|
2375
|
+
L: 231,
|
|
2375
2376
|
S: this,
|
|
2376
2377
|
C: (f, a) => f(...a)
|
|
2377
2378
|
});
|
|
@@ -2381,7 +2382,7 @@ var Space = class {
|
|
|
2381
2382
|
key: this._key
|
|
2382
2383
|
}, {
|
|
2383
2384
|
F: __dxlog_file11,
|
|
2384
|
-
L:
|
|
2385
|
+
L: 236,
|
|
2385
2386
|
S: this,
|
|
2386
2387
|
C: (f, a) => f(...a)
|
|
2387
2388
|
});
|
|
@@ -2395,7 +2396,7 @@ var Space = class {
|
|
|
2395
2396
|
this._isOpen = false;
|
|
2396
2397
|
log10("closed", void 0, {
|
|
2397
2398
|
F: __dxlog_file11,
|
|
2398
|
-
L:
|
|
2399
|
+
L: 249,
|
|
2399
2400
|
S: this,
|
|
2400
2401
|
C: (f, a) => f(...a)
|
|
2401
2402
|
});
|
|
@@ -2403,13 +2404,13 @@ var Space = class {
|
|
|
2403
2404
|
async initializeDataPipeline() {
|
|
2404
2405
|
log10("initializeDataPipeline", void 0, {
|
|
2405
2406
|
F: __dxlog_file11,
|
|
2406
|
-
L:
|
|
2407
|
+
L: 254,
|
|
2407
2408
|
S: this,
|
|
2408
2409
|
C: (f, a) => f(...a)
|
|
2409
2410
|
});
|
|
2410
2411
|
invariant9(this._isOpen, "Space must be open to initialize data pipeline.", {
|
|
2411
2412
|
F: __dxlog_file11,
|
|
2412
|
-
L:
|
|
2413
|
+
L: 255,
|
|
2413
2414
|
S: this,
|
|
2414
2415
|
A: [
|
|
2415
2416
|
"this._isOpen",
|
|
@@ -2419,6 +2420,15 @@ var Space = class {
|
|
|
2419
2420
|
await this._dataPipeline.open();
|
|
2420
2421
|
}
|
|
2421
2422
|
};
|
|
2423
|
+
_ts_decorate6([
|
|
2424
|
+
trace3.info()
|
|
2425
|
+
], Space.prototype, "protocol", void 0);
|
|
2426
|
+
_ts_decorate6([
|
|
2427
|
+
trace3.info()
|
|
2428
|
+
], Space.prototype, "_controlPipeline", void 0);
|
|
2429
|
+
_ts_decorate6([
|
|
2430
|
+
trace3.info()
|
|
2431
|
+
], Space.prototype, "_dataPipeline", void 0);
|
|
2422
2432
|
_ts_decorate6([
|
|
2423
2433
|
logInfo,
|
|
2424
2434
|
trace3.info()
|
|
@@ -2446,6 +2456,7 @@ import { MMSTTopology } from "@dxos/network-manager";
|
|
|
2446
2456
|
import { Teleport } from "@dxos/teleport";
|
|
2447
2457
|
import { BlobSync } from "@dxos/teleport-extension-object-sync";
|
|
2448
2458
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
2459
|
+
import { trace as trace4 } from "@dxos/tracing";
|
|
2449
2460
|
import { ComplexMap as ComplexMap5 } from "@dxos/util";
|
|
2450
2461
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
2451
2462
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2489,7 +2500,7 @@ var SpaceProtocol = class {
|
|
|
2489
2500
|
key: feed.key
|
|
2490
2501
|
}, {
|
|
2491
2502
|
F: __dxlog_file12,
|
|
2492
|
-
L:
|
|
2503
|
+
L: 103,
|
|
2493
2504
|
S: this,
|
|
2494
2505
|
C: (f, a) => f(...a)
|
|
2495
2506
|
});
|
|
@@ -2512,7 +2523,7 @@ var SpaceProtocol = class {
|
|
|
2512
2523
|
await this.blobSync.open();
|
|
2513
2524
|
log11("starting...", void 0, {
|
|
2514
2525
|
F: __dxlog_file12,
|
|
2515
|
-
L:
|
|
2526
|
+
L: 129,
|
|
2516
2527
|
S: this,
|
|
2517
2528
|
C: (f, a) => f(...a)
|
|
2518
2529
|
});
|
|
@@ -2526,7 +2537,7 @@ var SpaceProtocol = class {
|
|
|
2526
2537
|
});
|
|
2527
2538
|
log11("started", void 0, {
|
|
2528
2539
|
F: __dxlog_file12,
|
|
2529
|
-
L:
|
|
2540
|
+
L: 139,
|
|
2530
2541
|
S: this,
|
|
2531
2542
|
C: (f, a) => f(...a)
|
|
2532
2543
|
});
|
|
@@ -2536,14 +2547,14 @@ var SpaceProtocol = class {
|
|
|
2536
2547
|
if (this._connection) {
|
|
2537
2548
|
log11("stopping...", void 0, {
|
|
2538
2549
|
F: __dxlog_file12,
|
|
2539
|
-
L:
|
|
2550
|
+
L: 146,
|
|
2540
2551
|
S: this,
|
|
2541
2552
|
C: (f, a) => f(...a)
|
|
2542
2553
|
});
|
|
2543
2554
|
await this._connection.close();
|
|
2544
2555
|
log11("stopped", void 0, {
|
|
2545
2556
|
F: __dxlog_file12,
|
|
2546
|
-
L:
|
|
2557
|
+
L: 148,
|
|
2547
2558
|
S: this,
|
|
2548
2559
|
C: (f, a) => f(...a)
|
|
2549
2560
|
});
|
|
@@ -2567,11 +2578,18 @@ var SpaceProtocol = class {
|
|
|
2567
2578
|
}
|
|
2568
2579
|
};
|
|
2569
2580
|
_ts_decorate7([
|
|
2570
|
-
logInfo2
|
|
2581
|
+
logInfo2,
|
|
2582
|
+
trace4.info()
|
|
2571
2583
|
], SpaceProtocol.prototype, "_topic", void 0);
|
|
2584
|
+
_ts_decorate7([
|
|
2585
|
+
trace4.info()
|
|
2586
|
+
], SpaceProtocol.prototype, "_spaceKey", void 0);
|
|
2572
2587
|
_ts_decorate7([
|
|
2573
2588
|
logInfo2
|
|
2574
2589
|
], SpaceProtocol.prototype, "_ownPeerKey", null);
|
|
2590
|
+
SpaceProtocol = _ts_decorate7([
|
|
2591
|
+
trace4.resource()
|
|
2592
|
+
], SpaceProtocol);
|
|
2575
2593
|
var AuthStatus;
|
|
2576
2594
|
(function(AuthStatus2) {
|
|
2577
2595
|
AuthStatus2["INITIAL"] = "INITIAL";
|
|
@@ -2610,7 +2628,7 @@ var SpaceProtocolSession = class {
|
|
|
2610
2628
|
onAuthSuccess: () => {
|
|
2611
2629
|
log11("Peer authenticated", void 0, {
|
|
2612
2630
|
F: __dxlog_file12,
|
|
2613
|
-
L:
|
|
2631
|
+
L: 245,
|
|
2614
2632
|
S: this,
|
|
2615
2633
|
C: (f, a) => f(...a)
|
|
2616
2634
|
});
|
|
@@ -2628,7 +2646,7 @@ var SpaceProtocolSession = class {
|
|
|
2628
2646
|
async close() {
|
|
2629
2647
|
log11("close", void 0, {
|
|
2630
2648
|
F: __dxlog_file12,
|
|
2631
|
-
L:
|
|
2649
|
+
L: 261,
|
|
2632
2650
|
S: this,
|
|
2633
2651
|
C: (f, a) => f(...a)
|
|
2634
2652
|
});
|
|
@@ -2650,7 +2668,7 @@ import { synchronized as synchronized5, trackLeaks as trackLeaks4 } from "@dxos/
|
|
|
2650
2668
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
2651
2669
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
2652
2670
|
import { log as log12 } from "@dxos/log";
|
|
2653
|
-
import { trace as
|
|
2671
|
+
import { trace as trace5 } from "@dxos/protocols";
|
|
2654
2672
|
import { ComplexMap as ComplexMap6 } from "@dxos/util";
|
|
2655
2673
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
2656
2674
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2686,7 +2704,7 @@ var SpaceManager = class {
|
|
|
2686
2704
|
].map((space) => space.close()));
|
|
2687
2705
|
}
|
|
2688
2706
|
async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, memberKey }) {
|
|
2689
|
-
log12.trace("dxos.echo.space-manager.construct-space",
|
|
2707
|
+
log12.trace("dxos.echo.space-manager.construct-space", trace5.begin({
|
|
2690
2708
|
id: this._instanceId
|
|
2691
2709
|
}), {
|
|
2692
2710
|
F: __dxlog_file13,
|
|
@@ -2724,7 +2742,7 @@ var SpaceManager = class {
|
|
|
2724
2742
|
memberKey
|
|
2725
2743
|
});
|
|
2726
2744
|
this._spaces.set(space.key, space);
|
|
2727
|
-
log12.trace("dxos.echo.space-manager.construct-space",
|
|
2745
|
+
log12.trace("dxos.echo.space-manager.construct-space", trace5.end({
|
|
2728
2746
|
id: this._instanceId
|
|
2729
2747
|
}), {
|
|
2730
2748
|
F: __dxlog_file13,
|
|
@@ -2747,6 +2765,7 @@ SpaceManager = _ts_decorate8([
|
|
|
2747
2765
|
|
|
2748
2766
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
|
|
2749
2767
|
import { Trigger as Trigger2 } from "@dxos/async";
|
|
2768
|
+
import { next as automerge } from "@dxos/automerge/automerge";
|
|
2750
2769
|
import { Repo, NetworkAdapter, StorageAdapter, cbor } from "@dxos/automerge/automerge-repo";
|
|
2751
2770
|
import { IndexedDBStorageAdapter } from "@dxos/automerge/automerge-repo-storage-indexeddb";
|
|
2752
2771
|
import { Stream as Stream2 } from "@dxos/codec-protobuf";
|
|
@@ -2755,7 +2774,18 @@ import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
|
2755
2774
|
import { log as log13 } from "@dxos/log";
|
|
2756
2775
|
import { StorageType } from "@dxos/random-access-storage";
|
|
2757
2776
|
import { AutomergeReplicator } from "@dxos/teleport-extension-automerge-replicator";
|
|
2758
|
-
import {
|
|
2777
|
+
import { trace as trace6 } from "@dxos/tracing";
|
|
2778
|
+
import { ComplexMap as ComplexMap7, ComplexSet, arrayToBuffer as arrayToBuffer2, bufferToArray, defaultMap, mapValues } from "@dxos/util";
|
|
2779
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2780
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2781
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
2782
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
2783
|
+
else
|
|
2784
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
2785
|
+
if (d = decorators[i])
|
|
2786
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2787
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2788
|
+
}
|
|
2759
2789
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
2760
2790
|
var AutomergeHost = class {
|
|
2761
2791
|
constructor(storageDirectory) {
|
|
@@ -2789,7 +2819,7 @@ var AutomergeHost = class {
|
|
|
2789
2819
|
documentId
|
|
2790
2820
|
}, {
|
|
2791
2821
|
F: __dxlog_file14,
|
|
2792
|
-
L:
|
|
2822
|
+
L: 68,
|
|
2793
2823
|
S: this,
|
|
2794
2824
|
C: (f, a) => f(...a)
|
|
2795
2825
|
});
|
|
@@ -2797,12 +2827,12 @@ var AutomergeHost = class {
|
|
|
2797
2827
|
}
|
|
2798
2828
|
try {
|
|
2799
2829
|
if (!doc.experimental_spaceKey) {
|
|
2800
|
-
log13
|
|
2830
|
+
log13("space key not found for share policy check", {
|
|
2801
2831
|
peerId,
|
|
2802
2832
|
documentId
|
|
2803
2833
|
}, {
|
|
2804
2834
|
F: __dxlog_file14,
|
|
2805
|
-
L:
|
|
2835
|
+
L: 74,
|
|
2806
2836
|
S: this,
|
|
2807
2837
|
C: (f, a) => f(...a)
|
|
2808
2838
|
});
|
|
@@ -2812,12 +2842,12 @@ var AutomergeHost = class {
|
|
|
2812
2842
|
const authorizedDevices = this._authorizedDevices.get(spaceKey);
|
|
2813
2843
|
const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
|
|
2814
2844
|
if (!deviceKeyHex) {
|
|
2815
|
-
log13
|
|
2845
|
+
log13("device key not found for share policy check", {
|
|
2816
2846
|
peerId,
|
|
2817
2847
|
documentId
|
|
2818
2848
|
}, {
|
|
2819
2849
|
F: __dxlog_file14,
|
|
2820
|
-
L:
|
|
2850
|
+
L: 84,
|
|
2821
2851
|
S: this,
|
|
2822
2852
|
C: (f, a) => f(...a)
|
|
2823
2853
|
});
|
|
@@ -2825,7 +2855,7 @@ var AutomergeHost = class {
|
|
|
2825
2855
|
}
|
|
2826
2856
|
const deviceKey = PublicKey8.from(deviceKeyHex);
|
|
2827
2857
|
const isAuthorized = authorizedDevices?.has(deviceKey) ?? false;
|
|
2828
|
-
log13
|
|
2858
|
+
log13("share policy check", {
|
|
2829
2859
|
peerId,
|
|
2830
2860
|
documentId,
|
|
2831
2861
|
deviceKey,
|
|
@@ -2833,7 +2863,7 @@ var AutomergeHost = class {
|
|
|
2833
2863
|
isAuthorized
|
|
2834
2864
|
}, {
|
|
2835
2865
|
F: __dxlog_file14,
|
|
2836
|
-
L:
|
|
2866
|
+
L: 90,
|
|
2837
2867
|
S: this,
|
|
2838
2868
|
C: (f, a) => f(...a)
|
|
2839
2869
|
});
|
|
@@ -2841,7 +2871,7 @@ var AutomergeHost = class {
|
|
|
2841
2871
|
} catch (err) {
|
|
2842
2872
|
log13.catch(err, void 0, {
|
|
2843
2873
|
F: __dxlog_file14,
|
|
2844
|
-
L:
|
|
2874
|
+
L: 93,
|
|
2845
2875
|
S: this,
|
|
2846
2876
|
C: (f, a) => f(...a)
|
|
2847
2877
|
});
|
|
@@ -2855,6 +2885,16 @@ var AutomergeHost = class {
|
|
|
2855
2885
|
get repo() {
|
|
2856
2886
|
return this._repo;
|
|
2857
2887
|
}
|
|
2888
|
+
_automergeDocs() {
|
|
2889
|
+
return mapValues(this._repo.handles, (handle) => ({
|
|
2890
|
+
state: handle.state,
|
|
2891
|
+
hasDoc: !!handle.docSync(),
|
|
2892
|
+
heads: handle.docSync() ? automerge.getHeads(handle.docSync()) : null
|
|
2893
|
+
}));
|
|
2894
|
+
}
|
|
2895
|
+
_automergePeers() {
|
|
2896
|
+
return this._repo.peers;
|
|
2897
|
+
}
|
|
2858
2898
|
async close() {
|
|
2859
2899
|
this._storage instanceof AutomergeStorageAdapter && await this._storage.close();
|
|
2860
2900
|
await this._clientNetwork.close();
|
|
@@ -2881,6 +2921,19 @@ var AutomergeHost = class {
|
|
|
2881
2921
|
defaultMap(this._authorizedDevices, spaceKey, () => new ComplexSet(PublicKey8.hash)).add(deviceKey);
|
|
2882
2922
|
}
|
|
2883
2923
|
};
|
|
2924
|
+
_ts_decorate9([
|
|
2925
|
+
trace6.info({
|
|
2926
|
+
depth: null
|
|
2927
|
+
})
|
|
2928
|
+
], AutomergeHost.prototype, "_automergeDocs", null);
|
|
2929
|
+
_ts_decorate9([
|
|
2930
|
+
trace6.info({
|
|
2931
|
+
depth: null
|
|
2932
|
+
})
|
|
2933
|
+
], AutomergeHost.prototype, "_automergePeers", null);
|
|
2934
|
+
AutomergeHost = _ts_decorate9([
|
|
2935
|
+
trace6.resource()
|
|
2936
|
+
], AutomergeHost);
|
|
2884
2937
|
var LocalHostNetworkAdapter = class extends NetworkAdapter {
|
|
2885
2938
|
constructor() {
|
|
2886
2939
|
super(...arguments);
|
|
@@ -2903,7 +2956,7 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter {
|
|
|
2903
2956
|
const peer = this._peers.get(message.targetId);
|
|
2904
2957
|
invariant10(peer, "Peer not found.", {
|
|
2905
2958
|
F: __dxlog_file14,
|
|
2906
|
-
L:
|
|
2959
|
+
L: 187,
|
|
2907
2960
|
S: this,
|
|
2908
2961
|
A: [
|
|
2909
2962
|
"peer",
|
|
@@ -2923,7 +2976,7 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter {
|
|
|
2923
2976
|
return new Stream2(({ next, close }) => {
|
|
2924
2977
|
invariant10(!this._peers.has(peerId), "Peer already connected.", {
|
|
2925
2978
|
F: __dxlog_file14,
|
|
2926
|
-
L:
|
|
2979
|
+
L: 205,
|
|
2927
2980
|
S: this,
|
|
2928
2981
|
A: [
|
|
2929
2982
|
"!this._peers.has(peerId)",
|
|
@@ -2954,7 +3007,7 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter {
|
|
|
2954
3007
|
});
|
|
2955
3008
|
}).catch((err) => log13.catch(err, void 0, {
|
|
2956
3009
|
F: __dxlog_file14,
|
|
2957
|
-
L:
|
|
3010
|
+
L: 230,
|
|
2958
3011
|
S: this,
|
|
2959
3012
|
C: (f, a) => f(...a)
|
|
2960
3013
|
}));
|
|
@@ -2973,7 +3026,7 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter {
|
|
|
2973
3026
|
});
|
|
2974
3027
|
invariant10(this.peerId, "Peer id not set.", {
|
|
2975
3028
|
F: __dxlog_file14,
|
|
2976
|
-
L:
|
|
3029
|
+
L: 242,
|
|
2977
3030
|
S: this,
|
|
2978
3031
|
A: [
|
|
2979
3032
|
"this.peerId",
|
|
@@ -3009,7 +3062,7 @@ var MeshNetworkAdapter = class extends NetworkAdapter {
|
|
|
3009
3062
|
const extension = this._extensions.get(receiverId);
|
|
3010
3063
|
invariant10(extension, "Extension not found.", {
|
|
3011
3064
|
F: __dxlog_file14,
|
|
3012
|
-
L:
|
|
3065
|
+
L: 277,
|
|
3013
3066
|
S: this,
|
|
3014
3067
|
A: [
|
|
3015
3068
|
"extension",
|
|
@@ -3020,7 +3073,7 @@ var MeshNetworkAdapter = class extends NetworkAdapter {
|
|
|
3020
3073
|
payload: cbor.encode(message)
|
|
3021
3074
|
}).catch((err) => log13.catch(err, void 0, {
|
|
3022
3075
|
F: __dxlog_file14,
|
|
3023
|
-
L:
|
|
3076
|
+
L: 278,
|
|
3024
3077
|
S: this,
|
|
3025
3078
|
C: (f, a) => f(...a)
|
|
3026
3079
|
}));
|
|
@@ -3030,7 +3083,7 @@ var MeshNetworkAdapter = class extends NetworkAdapter {
|
|
|
3030
3083
|
createExtension() {
|
|
3031
3084
|
invariant10(this.peerId, "Peer id not set.", {
|
|
3032
3085
|
F: __dxlog_file14,
|
|
3033
|
-
L:
|
|
3086
|
+
L: 286,
|
|
3034
3087
|
S: this,
|
|
3035
3088
|
A: [
|
|
3036
3089
|
"this.peerId",
|
|
@@ -3174,4 +3227,4 @@ export {
|
|
|
3174
3227
|
SpaceManager,
|
|
3175
3228
|
AutomergeHost
|
|
3176
3229
|
};
|
|
3177
|
-
//# sourceMappingURL=chunk-
|
|
3230
|
+
//# sourceMappingURL=chunk-D7UMNYLJ.mjs.map
|