@dxos/echo-pipeline 0.1.53-main.706990e → 0.1.53-main.797c2c4
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-RD75WUUV.mjs → chunk-ZYDZBSIT.mjs} +72 -64
- package/dist/lib/browser/chunk-ZYDZBSIT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -2
- package/dist/lib/node/index.cjs +165 -157
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +148 -140
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/dbhost/snapshot-store.d.ts +3 -0
- package/dist/types/src/dbhost/snapshot-store.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +3 -0
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/package.json +31 -32
- package/src/common/feeds.ts +3 -3
- package/src/dbhost/data-service-host.ts +3 -3
- package/src/dbhost/data-service.ts +4 -4
- package/src/dbhost/snapshot-store.ts +3 -0
- package/src/metadata/metadata-store.ts +6 -5
- package/src/pipeline/message-selector.ts +3 -5
- package/src/pipeline/pipeline.ts +11 -11
- package/src/space/auth.ts +3 -3
- package/src/space/data-pipeline.ts +10 -10
- package/src/space/space-protocol.browser.test.ts +2 -2
- package/src/space/space-protocol.test.ts +2 -2
- package/src/space/space-protocol.ts +10 -4
- package/src/space/space.ts +5 -5
- package/dist/lib/browser/chunk-RD75WUUV.mjs.map +0 -7
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import "@dxos/node-std/globals"
|
|
1
|
+
import "@dxos/node-std/globals";
|
|
2
2
|
|
|
3
3
|
// packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
|
|
4
4
|
import CRC32 from "crc-32";
|
|
5
|
-
import
|
|
5
|
+
import invariant from "tiny-invariant";
|
|
6
6
|
import { synchronized, Event } from "@dxos/async";
|
|
7
7
|
import { DataCorruptionError } from "@dxos/errors";
|
|
8
8
|
import { log } from "@dxos/log";
|
|
9
9
|
import { STORAGE_VERSION, schema } from "@dxos/protocols";
|
|
10
|
+
import { arrayToBuffer } from "@dxos/util";
|
|
10
11
|
var __decorate = function(decorators, target, key, desc) {
|
|
11
12
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
13
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -62,7 +63,7 @@ var MetadataStore = class {
|
|
|
62
63
|
checksum
|
|
63
64
|
}, {
|
|
64
65
|
file: "metadata-store.ts",
|
|
65
|
-
line:
|
|
66
|
+
line: 69,
|
|
66
67
|
scope: this,
|
|
67
68
|
callSite: (f, a) => f(...a)
|
|
68
69
|
});
|
|
@@ -80,7 +81,7 @@ var MetadataStore = class {
|
|
|
80
81
|
err
|
|
81
82
|
}, {
|
|
82
83
|
file: "metadata-store.ts",
|
|
83
|
-
line:
|
|
84
|
+
line: 84,
|
|
84
85
|
scope: this,
|
|
85
86
|
callSite: (f, a) => f(...a)
|
|
86
87
|
});
|
|
@@ -100,7 +101,7 @@ var MetadataStore = class {
|
|
|
100
101
|
this.update.emit(data);
|
|
101
102
|
const file = this._directory.getOrCreateFile("EchoMetadata");
|
|
102
103
|
try {
|
|
103
|
-
const encoded =
|
|
104
|
+
const encoded = arrayToBuffer(schema.getCodecForType("dxos.echo.metadata.EchoMetadata").encode(data));
|
|
104
105
|
const checksum = CRC32.buf(encoded);
|
|
105
106
|
const result = Buffer.alloc(8 + encoded.length);
|
|
106
107
|
result.writeInt32LE(encoded.length, 0);
|
|
@@ -112,7 +113,7 @@ var MetadataStore = class {
|
|
|
112
113
|
checksum
|
|
113
114
|
}, {
|
|
114
115
|
file: "metadata-store.ts",
|
|
115
|
-
line:
|
|
116
|
+
line: 116,
|
|
116
117
|
scope: this,
|
|
117
118
|
callSite: (f, a) => f(...a)
|
|
118
119
|
});
|
|
@@ -126,7 +127,7 @@ var MetadataStore = class {
|
|
|
126
127
|
return this._metadata.identity.haloSpace;
|
|
127
128
|
}
|
|
128
129
|
const space = this.spaces.find((space2) => space2.key === spaceKey);
|
|
129
|
-
|
|
130
|
+
invariant(space, "Space not found");
|
|
130
131
|
return space;
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
@@ -135,7 +136,7 @@ var MetadataStore = class {
|
|
|
135
136
|
async clear() {
|
|
136
137
|
log("clearing all metadata", {}, {
|
|
137
138
|
file: "metadata-store.ts",
|
|
138
|
-
line:
|
|
139
|
+
line: 137,
|
|
139
140
|
scope: this,
|
|
140
141
|
callSite: (f, a) => f(...a)
|
|
141
142
|
});
|
|
@@ -146,13 +147,13 @@ var MetadataStore = class {
|
|
|
146
147
|
return this._metadata.identity;
|
|
147
148
|
}
|
|
148
149
|
async setIdentityRecord(record) {
|
|
149
|
-
|
|
150
|
+
invariant(!this._metadata.identity, "Cannot overwrite existing identity in metadata");
|
|
150
151
|
this._metadata.identity = record;
|
|
151
152
|
await this._save();
|
|
152
153
|
}
|
|
153
154
|
async addSpace(record) {
|
|
154
155
|
var _a, _b, _c;
|
|
155
|
-
|
|
156
|
+
invariant(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata");
|
|
156
157
|
((_c = (_b = this._metadata).spaces) != null ? _c : _b.spaces = []).push(record);
|
|
157
158
|
await this._save();
|
|
158
159
|
}
|
|
@@ -190,10 +191,10 @@ var codec = schema2.getCodecForType("dxos.echo.feed.FeedMessage");
|
|
|
190
191
|
var valueEncoding = createCodecEncoding(codec);
|
|
191
192
|
|
|
192
193
|
// packages/core/echo/echo-pipeline/src/common/feeds.ts
|
|
193
|
-
import
|
|
194
|
+
import invariant2 from "tiny-invariant";
|
|
194
195
|
var createMappedFeedWriter = (mapper, writer) => {
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
invariant2(mapper);
|
|
197
|
+
invariant2(writer);
|
|
197
198
|
return {
|
|
198
199
|
write: async (data, options) => await writer.write(await mapper(data), options)
|
|
199
200
|
};
|
|
@@ -297,7 +298,7 @@ __decorate2([
|
|
|
297
298
|
], TimeframeClock.prototype, "waitUntilReached", null);
|
|
298
299
|
|
|
299
300
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
300
|
-
import
|
|
301
|
+
import invariant4 from "tiny-invariant";
|
|
301
302
|
import { Event as Event3, sleep, synchronized as synchronized2, Trigger } from "@dxos/async";
|
|
302
303
|
import { Context, rejectOnDispose } from "@dxos/context";
|
|
303
304
|
import { failUndefined } from "@dxos/debug";
|
|
@@ -308,19 +309,23 @@ import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
|
308
309
|
import { ComplexMap } from "@dxos/util";
|
|
309
310
|
|
|
310
311
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
311
|
-
import
|
|
312
|
-
import
|
|
313
|
-
var log3 = debug("dxos:echo-db:message-selector");
|
|
312
|
+
import invariant3 from "tiny-invariant";
|
|
313
|
+
import { log as log3 } from "@dxos/log";
|
|
314
314
|
var createMessageSelector = (timeframeClock) => {
|
|
315
315
|
return (messages) => {
|
|
316
316
|
for (let i = 0; i < messages.length; i++) {
|
|
317
317
|
const { data: { timeframe } } = messages[i];
|
|
318
|
-
|
|
318
|
+
invariant3(timeframe);
|
|
319
319
|
if (!timeframeClock.hasGaps(timeframe)) {
|
|
320
320
|
return i;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
log3("Skipping..."
|
|
323
|
+
log3("Skipping...", {}, {
|
|
324
|
+
file: "message-selector.ts",
|
|
325
|
+
line: 34,
|
|
326
|
+
scope: void 0,
|
|
327
|
+
callSite: (f, a) => f(...a)
|
|
328
|
+
});
|
|
324
329
|
};
|
|
325
330
|
};
|
|
326
331
|
|
|
@@ -450,7 +455,7 @@ var Pipeline = class {
|
|
|
450
455
|
return this._state;
|
|
451
456
|
}
|
|
452
457
|
get writer() {
|
|
453
|
-
|
|
458
|
+
invariant4(this._writer, "Writer not set.");
|
|
454
459
|
return this._writer;
|
|
455
460
|
}
|
|
456
461
|
getFeeds() {
|
|
@@ -469,8 +474,8 @@ var Pipeline = class {
|
|
|
469
474
|
return this._feeds.has(feedKey);
|
|
470
475
|
}
|
|
471
476
|
setWriteFeed(feed) {
|
|
472
|
-
|
|
473
|
-
|
|
477
|
+
invariant4(!this._writer, "Writer already set.");
|
|
478
|
+
invariant4(feed.properties.writable, "Feed must be writable.");
|
|
474
479
|
this._writer = createMappedFeedWriter((payload) => ({
|
|
475
480
|
timeframe: this._timeframeClock.timeframe,
|
|
476
481
|
payload
|
|
@@ -516,7 +521,7 @@ var Pipeline = class {
|
|
|
516
521
|
* @param timeframe Timeframe of already processed messages. The pipeline will start processing messages AFTER this timeframe.
|
|
517
522
|
*/
|
|
518
523
|
async setCursor(timeframe) {
|
|
519
|
-
|
|
524
|
+
invariant4(!this._isStarted || this._isPaused, "Invalid state.");
|
|
520
525
|
this._state._startTimeframe = timeframe;
|
|
521
526
|
this._timeframeClock.setTimeframe(timeframe);
|
|
522
527
|
for (const feed of this._feeds.values()) {
|
|
@@ -532,7 +537,7 @@ var Pipeline = class {
|
|
|
532
537
|
* Calling pause while processing will cause a deadlock.
|
|
533
538
|
*/
|
|
534
539
|
async pause() {
|
|
535
|
-
|
|
540
|
+
invariant4(this._isStarted, "Pipeline is not open.");
|
|
536
541
|
if (this._isPaused) {
|
|
537
542
|
return;
|
|
538
543
|
}
|
|
@@ -541,8 +546,8 @@ var Pipeline = class {
|
|
|
541
546
|
this._isPaused = true;
|
|
542
547
|
}
|
|
543
548
|
async unpause() {
|
|
544
|
-
|
|
545
|
-
|
|
549
|
+
invariant4(this._isStarted, "Pipeline is not open.");
|
|
550
|
+
invariant4(this._isPaused, "Pipeline is not paused.");
|
|
546
551
|
this._pauseTrigger.wake();
|
|
547
552
|
this._isPaused = false;
|
|
548
553
|
}
|
|
@@ -551,15 +556,15 @@ var Pipeline = class {
|
|
|
551
556
|
* Updates the timeframe clock after the message has bee processed.
|
|
552
557
|
*/
|
|
553
558
|
async *consume() {
|
|
554
|
-
|
|
559
|
+
invariant4(!this._isOpen, "Pipeline is already being consumed.");
|
|
555
560
|
this._isOpen = true;
|
|
556
|
-
|
|
561
|
+
invariant4(this._feedSetIterator, "Iterator not initialized.");
|
|
557
562
|
let lastFeedSetIterator = this._feedSetIterator;
|
|
558
563
|
let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
|
|
559
564
|
while (!this._isStopping) {
|
|
560
565
|
await this._pauseTrigger.wait();
|
|
561
566
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
562
|
-
|
|
567
|
+
invariant4(this._feedSetIterator, "Iterator not initialized.");
|
|
563
568
|
lastFeedSetIterator = this._feedSetIterator;
|
|
564
569
|
iterable = lastFeedSetIterator[Symbol.asyncIterator]();
|
|
565
570
|
}
|
|
@@ -638,7 +643,7 @@ __decorate3([
|
|
|
638
643
|
], Pipeline.prototype, "unpause", null);
|
|
639
644
|
|
|
640
645
|
// packages/core/echo/echo-pipeline/src/space/auth.ts
|
|
641
|
-
import
|
|
646
|
+
import invariant5 from "tiny-invariant";
|
|
642
647
|
import { runInContext, scheduleTask } from "@dxos/async";
|
|
643
648
|
import { Context as Context2 } from "@dxos/context";
|
|
644
649
|
import { randomBytes } from "@dxos/crypto";
|
|
@@ -701,9 +706,9 @@ var AuthExtension = class extends RpcExtension {
|
|
|
701
706
|
const { credential } = await this.rpc.AuthService.authenticate({
|
|
702
707
|
challenge
|
|
703
708
|
});
|
|
704
|
-
|
|
709
|
+
invariant5((credential == null ? void 0 : credential.length) > 0, "invalid credential");
|
|
705
710
|
const success = await this._authParams.verifier(challenge, credential);
|
|
706
|
-
|
|
711
|
+
invariant5(success, "credential not verified");
|
|
707
712
|
runInContext(this._ctx, () => this._authParams.onAuthSuccess());
|
|
708
713
|
} catch (err) {
|
|
709
714
|
log5("auth failed", err, {
|
|
@@ -724,7 +729,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
724
729
|
};
|
|
725
730
|
|
|
726
731
|
// packages/core/echo/echo-pipeline/src/dbhost/data-service-host.ts
|
|
727
|
-
import
|
|
732
|
+
import invariant6 from "tiny-invariant";
|
|
728
733
|
import { Stream } from "@dxos/codec-protobuf";
|
|
729
734
|
import { tagMutationsInBatch, setMetadataOnObject } from "@dxos/echo-db";
|
|
730
735
|
import { log as log6 } from "@dxos/log";
|
|
@@ -750,7 +755,7 @@ var DataServiceHost = class {
|
|
|
750
755
|
this._itemDemuxer.mutation.on(ctx, (message) => {
|
|
751
756
|
var _a;
|
|
752
757
|
const { batch, meta } = message;
|
|
753
|
-
|
|
758
|
+
invariant6(!meta.clientTag, "Unexpected client tag in mutation message");
|
|
754
759
|
log6("message", {
|
|
755
760
|
batch,
|
|
756
761
|
meta
|
|
@@ -783,7 +788,7 @@ var DataServiceHost = class {
|
|
|
783
788
|
}
|
|
784
789
|
async write(request) {
|
|
785
790
|
var _a, _b;
|
|
786
|
-
|
|
791
|
+
invariant6(this._writeStream, "Cannot write mutations in readonly mode");
|
|
787
792
|
log6("write", {
|
|
788
793
|
clientTag: request.clientTag,
|
|
789
794
|
objectCount: (_b = (_a = request.batch.objects) == null ? void 0 : _a.length) != null ? _b : 0
|
|
@@ -968,7 +973,7 @@ var SnapshotStore = class {
|
|
|
968
973
|
};
|
|
969
974
|
|
|
970
975
|
// packages/core/echo/echo-pipeline/src/dbhost/data-service.ts
|
|
971
|
-
import
|
|
976
|
+
import invariant7 from "tiny-invariant";
|
|
972
977
|
import { raise } from "@dxos/debug";
|
|
973
978
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
974
979
|
import { log as log7 } from "@dxos/log";
|
|
@@ -1012,21 +1017,21 @@ var DataServiceImpl = class {
|
|
|
1012
1017
|
}
|
|
1013
1018
|
subscribe(request) {
|
|
1014
1019
|
var _a;
|
|
1015
|
-
|
|
1020
|
+
invariant7(request.spaceKey);
|
|
1016
1021
|
const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : raise(new Error(`space not found: ${request.spaceKey}`));
|
|
1017
1022
|
return host.subscribe();
|
|
1018
1023
|
}
|
|
1019
1024
|
write(request) {
|
|
1020
1025
|
var _a;
|
|
1021
|
-
|
|
1022
|
-
|
|
1026
|
+
invariant7(request.spaceKey);
|
|
1027
|
+
invariant7(request.batch);
|
|
1023
1028
|
const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : raise(new Error(`space not found: ${request.spaceKey}`));
|
|
1024
1029
|
return host.write(request);
|
|
1025
1030
|
}
|
|
1026
1031
|
};
|
|
1027
1032
|
|
|
1028
1033
|
// packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
|
|
1029
|
-
import
|
|
1034
|
+
import invariant8 from "tiny-invariant";
|
|
1030
1035
|
import { Event as Event4, scheduleTask as scheduleTask2, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1031
1036
|
import { Context as Context3 } from "@dxos/context";
|
|
1032
1037
|
import { checkCredentialType } from "@dxos/credentials";
|
|
@@ -1099,8 +1104,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1099
1104
|
}
|
|
1100
1105
|
const feedWriter = {
|
|
1101
1106
|
write: (data, options) => {
|
|
1102
|
-
|
|
1103
|
-
|
|
1107
|
+
invariant8(this._pipeline, "Pipeline is not initialized.");
|
|
1108
|
+
invariant8(this.currentEpoch, "Epoch is not initialized.");
|
|
1104
1109
|
return this._pipeline.writer.write({
|
|
1105
1110
|
data
|
|
1106
1111
|
}, options);
|
|
@@ -1150,7 +1155,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1150
1155
|
await this._processEpochInSeparateTask(this.currentEpoch);
|
|
1151
1156
|
await waitForOneEpoch;
|
|
1152
1157
|
}
|
|
1153
|
-
|
|
1158
|
+
invariant8(this._pipeline, "Pipeline is not initialized.");
|
|
1154
1159
|
for await (const msg of this._pipeline.consume()) {
|
|
1155
1160
|
const { feedKey, seq, data } = msg;
|
|
1156
1161
|
log8("processing message", {
|
|
@@ -1208,7 +1213,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1208
1213
|
}
|
|
1209
1214
|
}
|
|
1210
1215
|
_createSnapshot() {
|
|
1211
|
-
|
|
1216
|
+
invariant8(this.databaseHost, "Database backend is not initialized.");
|
|
1212
1217
|
return {
|
|
1213
1218
|
spaceKey: this._params.spaceKey.asUint8Array(),
|
|
1214
1219
|
timeframe: this._pipeline.state.timeframe,
|
|
@@ -1296,8 +1301,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1296
1301
|
});
|
|
1297
1302
|
}
|
|
1298
1303
|
async _processEpoch(ctx, epoch) {
|
|
1299
|
-
|
|
1300
|
-
|
|
1304
|
+
invariant8(this._isOpen, "Space is closed.");
|
|
1305
|
+
invariant8(this._pipeline);
|
|
1301
1306
|
this._lastProcessedEpoch = epoch.number;
|
|
1302
1307
|
log8("Processing epoch", {
|
|
1303
1308
|
epoch
|
|
@@ -1322,12 +1327,12 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1322
1327
|
await this._pipeline.unpause();
|
|
1323
1328
|
}
|
|
1324
1329
|
async waitUntilTimeframe(timeframe) {
|
|
1325
|
-
|
|
1330
|
+
invariant8(this._pipeline, "Pipeline is not initialized.");
|
|
1326
1331
|
await this._pipeline.state.waitUntilTimeframe(timeframe);
|
|
1327
1332
|
}
|
|
1328
1333
|
async createEpoch() {
|
|
1329
|
-
|
|
1330
|
-
|
|
1334
|
+
invariant8(this._pipeline);
|
|
1335
|
+
invariant8(this.currentEpoch);
|
|
1331
1336
|
await this._pipeline.pause();
|
|
1332
1337
|
const snapshot = await this._createSnapshot();
|
|
1333
1338
|
const snapshotCid = await this._params.snapshotManager.store(snapshot);
|
|
@@ -1361,7 +1366,7 @@ DataPipeline = __decorate5([
|
|
|
1361
1366
|
], DataPipeline);
|
|
1362
1367
|
|
|
1363
1368
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
1364
|
-
import
|
|
1369
|
+
import invariant9 from "tiny-invariant";
|
|
1365
1370
|
import { Event as Event5, synchronized as synchronized4, trackLeaks as trackLeaks3, Lock } from "@dxos/async";
|
|
1366
1371
|
import { log as log10, logInfo } from "@dxos/log";
|
|
1367
1372
|
import { AdmittedFeed as AdmittedFeed2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -1530,7 +1535,7 @@ var Space = class Space2 {
|
|
|
1530
1535
|
// Processes epoch credentials.
|
|
1531
1536
|
this._dataPipelineCredentialConsumer = void 0;
|
|
1532
1537
|
this._isOpen = false;
|
|
1533
|
-
|
|
1538
|
+
invariant9(params.spaceKey && params.feedProvider);
|
|
1534
1539
|
this._key = params.spaceKey;
|
|
1535
1540
|
this._genesisFeedKey = params.genesisFeed.key;
|
|
1536
1541
|
this._feedProvider = params.feedProvider;
|
|
@@ -1631,14 +1636,14 @@ var Space = class Space2 {
|
|
|
1631
1636
|
return this._snapshotManager;
|
|
1632
1637
|
}
|
|
1633
1638
|
setControlFeed(feed) {
|
|
1634
|
-
|
|
1639
|
+
invariant9(!this._controlFeed, "Control feed already set.");
|
|
1635
1640
|
this._controlFeed = feed;
|
|
1636
1641
|
this._controlPipeline.setWriteFeed(feed);
|
|
1637
1642
|
return this;
|
|
1638
1643
|
}
|
|
1639
1644
|
setDataFeed(feed) {
|
|
1640
1645
|
var _a;
|
|
1641
|
-
|
|
1646
|
+
invariant9(!this._dataFeed, "Data feed already set.");
|
|
1642
1647
|
this._dataFeed = feed;
|
|
1643
1648
|
(_a = this._dataPipeline.pipeline) == null ? void 0 : _a.setWriteFeed(feed);
|
|
1644
1649
|
return this;
|
|
@@ -1710,7 +1715,7 @@ var Space = class Space2 {
|
|
|
1710
1715
|
scope: this,
|
|
1711
1716
|
callSite: (f, a) => f(...a)
|
|
1712
1717
|
});
|
|
1713
|
-
|
|
1718
|
+
invariant9(this._isOpen, "Space must be open to initialize data pipeline.");
|
|
1714
1719
|
await this._dataPipeline.open();
|
|
1715
1720
|
}
|
|
1716
1721
|
};
|
|
@@ -1731,7 +1736,7 @@ Space = __decorate6([
|
|
|
1731
1736
|
], Space);
|
|
1732
1737
|
|
|
1733
1738
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
1734
|
-
import { discoveryKey,
|
|
1739
|
+
import { discoveryKey, subtleCrypto as subtleCrypto2 } from "@dxos/crypto";
|
|
1735
1740
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1736
1741
|
import { log as log11, logInfo as logInfo2 } from "@dxos/log";
|
|
1737
1742
|
import { MMSTTopology } from "@dxos/network-manager";
|
|
@@ -1762,7 +1767,7 @@ var SpaceProtocol = class {
|
|
|
1762
1767
|
this.blobSync = new BlobSync({
|
|
1763
1768
|
blobStore
|
|
1764
1769
|
});
|
|
1765
|
-
this._topic =
|
|
1770
|
+
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
1766
1771
|
}
|
|
1767
1772
|
get sessions() {
|
|
1768
1773
|
return this._sessions;
|
|
@@ -1779,7 +1784,7 @@ var SpaceProtocol = class {
|
|
|
1779
1784
|
key: feed.key
|
|
1780
1785
|
}, {
|
|
1781
1786
|
file: "space-protocol.ts",
|
|
1782
|
-
line:
|
|
1787
|
+
line: 96,
|
|
1783
1788
|
scope: this,
|
|
1784
1789
|
callSite: (f, a) => f(...a)
|
|
1785
1790
|
});
|
|
@@ -1801,20 +1806,20 @@ var SpaceProtocol = class {
|
|
|
1801
1806
|
await this.blobSync.open();
|
|
1802
1807
|
log11("starting...", {}, {
|
|
1803
1808
|
file: "space-protocol.ts",
|
|
1804
|
-
line:
|
|
1809
|
+
line: 121,
|
|
1805
1810
|
scope: this,
|
|
1806
1811
|
callSite: (f, a) => f(...a)
|
|
1807
1812
|
});
|
|
1808
1813
|
this._connection = await this._networkManager.joinSwarm({
|
|
1809
1814
|
protocolProvider: this._createProtocolProvider(credentials),
|
|
1810
1815
|
peerId: this._swarmIdentity.peerKey,
|
|
1811
|
-
topic: this._topic,
|
|
1816
|
+
topic: await this._topic,
|
|
1812
1817
|
topology: new MMSTTopology(topologyConfig),
|
|
1813
1818
|
label: `Protocol swarm: ${this._topic}`
|
|
1814
1819
|
});
|
|
1815
1820
|
log11("started", {}, {
|
|
1816
1821
|
file: "space-protocol.ts",
|
|
1817
|
-
line:
|
|
1822
|
+
line: 130,
|
|
1818
1823
|
scope: this,
|
|
1819
1824
|
callSite: (f, a) => f(...a)
|
|
1820
1825
|
});
|
|
@@ -1824,14 +1829,14 @@ var SpaceProtocol = class {
|
|
|
1824
1829
|
if (this._connection) {
|
|
1825
1830
|
log11("stopping...", {}, {
|
|
1826
1831
|
file: "space-protocol.ts",
|
|
1827
|
-
line:
|
|
1832
|
+
line: 137,
|
|
1828
1833
|
scope: this,
|
|
1829
1834
|
callSite: (f, a) => f(...a)
|
|
1830
1835
|
});
|
|
1831
1836
|
await this._connection.close();
|
|
1832
1837
|
log11("stopped", {}, {
|
|
1833
1838
|
file: "space-protocol.ts",
|
|
1834
|
-
line:
|
|
1839
|
+
line: 139,
|
|
1835
1840
|
scope: this,
|
|
1836
1841
|
callSite: (f, a) => f(...a)
|
|
1837
1842
|
});
|
|
@@ -1884,6 +1889,9 @@ var SpaceProtocolSession = class {
|
|
|
1884
1889
|
get authStatus() {
|
|
1885
1890
|
return this._authStatus;
|
|
1886
1891
|
}
|
|
1892
|
+
get stats() {
|
|
1893
|
+
return this._teleport.stats;
|
|
1894
|
+
}
|
|
1887
1895
|
get stream() {
|
|
1888
1896
|
return this._teleport.stream;
|
|
1889
1897
|
}
|
|
@@ -1896,7 +1904,7 @@ var SpaceProtocolSession = class {
|
|
|
1896
1904
|
var _a;
|
|
1897
1905
|
log11("Peer authenticated", {}, {
|
|
1898
1906
|
file: "space-protocol.ts",
|
|
1899
|
-
line:
|
|
1907
|
+
line: 236,
|
|
1900
1908
|
scope: this,
|
|
1901
1909
|
callSite: (f, a) => f(...a)
|
|
1902
1910
|
});
|
|
@@ -2049,4 +2057,4 @@ export {
|
|
|
2049
2057
|
SpaceProtocolSession,
|
|
2050
2058
|
SpaceManager
|
|
2051
2059
|
};
|
|
2052
|
-
//# sourceMappingURL=chunk-
|
|
2060
|
+
//# sourceMappingURL=chunk-ZYDZBSIT.mjs.map
|