@dxos/echo-pipeline 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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/neutral/chunk-76DA36YG.mjs +247 -0
- package/dist/lib/neutral/chunk-76DA36YG.mjs.map +7 -0
- package/dist/lib/{browser/chunk-GBFX5J5B.mjs → neutral/chunk-ONB2OWBB.mjs} +290 -198
- package/dist/lib/neutral/chunk-ONB2OWBB.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/filter/index.mjs +3 -2
- package/dist/lib/{browser → neutral}/index.mjs +3452 -1124
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +63 -214
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/automerge/automerge-host.d.ts +56 -45
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts.map +1 -1
- package/dist/types/src/automerge/collection-synchronizer.d.ts +6 -4
- package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +23 -10
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +38 -15
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/heads-store.d.ts +9 -2
- package/dist/types/src/automerge/heads-store.d.ts.map +1 -1
- package/dist/types/src/automerge/index.d.ts +1 -1
- package/dist/types/src/automerge/index.d.ts.map +1 -1
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts +5 -5
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +9 -8
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts +6 -5
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/common/codec.d.ts +1 -1
- package/dist/types/src/common/codec.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts +35 -0
- package/dist/types/src/db-host/automerge-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts +2 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts.map +1 -0
- package/dist/types/src/db-host/data-service.d.ts +8 -7
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/database-root.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +8 -7
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/dist/types/src/db-host/echo-host.d.ts +58 -28
- package/dist/types/src/db-host/echo-host.d.ts.map +1 -1
- package/dist/types/src/db-host/index.d.ts +1 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/dist/types/src/db-host/local-queue-service.d.ts +19 -0
- package/dist/types/src/db-host/local-queue-service.d.ts.map +1 -0
- package/dist/types/src/db-host/query-service.d.ts +14 -9
- package/dist/types/src/db-host/query-service.d.ts.map +1 -1
- package/dist/types/src/db-host/queue-data-source.d.ts +38 -0
- package/dist/types/src/db-host/queue-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/queue-service.test.d.ts +2 -0
- package/dist/types/src/db-host/queue-service.test.d.ts.map +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts +2 -1
- package/dist/types/src/db-host/space-state-manager.d.ts.map +1 -1
- package/dist/types/src/db-host/stub.d.ts +11 -0
- package/dist/types/src/db-host/stub.d.ts.map +1 -0
- package/dist/types/src/edge/echo-edge-replicator.d.ts +10 -7
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
- package/dist/types/src/filter/filter-match.d.ts +4 -1
- package/dist/types/src/filter/filter-match.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +3 -3
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/query/errors.d.ts +21 -9
- package/dist/types/src/query/errors.d.ts.map +1 -1
- package/dist/types/src/query/plan.d.ts +66 -8
- package/dist/types/src/query/plan.d.ts.map +1 -1
- package/dist/types/src/query/query-executor.d.ts +64 -10
- package/dist/types/src/query/query-executor.d.ts.map +1 -1
- package/dist/types/src/query/query-planner.d.ts +12 -1
- package/dist/types/src/query/query-planner.d.ts.map +1 -1
- package/dist/types/src/space/admission-discovery-extension.d.ts.map +1 -1
- package/dist/types/src/space/auth.d.ts +3 -3
- package/dist/types/src/space/auth.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +5 -4
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +8 -7
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +9 -8
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +6 -6
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- 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/dist/types/src/testing/test-network-adapter.d.ts +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -1
- package/dist/types/src/testing/test-replicator.d.ts +14 -13
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -47
- package/src/automerge/automerge-host.test.ts +57 -27
- package/src/automerge/automerge-host.ts +413 -137
- package/src/automerge/automerge-repo.test.ts +215 -47
- package/src/automerge/collection-synchronizer.test.ts +22 -15
- package/src/automerge/collection-synchronizer.ts +71 -30
- package/src/automerge/echo-data-monitor.ts +1 -1
- package/src/automerge/echo-network-adapter.test.ts +5 -4
- package/src/automerge/echo-network-adapter.ts +72 -29
- package/src/automerge/echo-replicator.ts +41 -15
- package/src/automerge/heads-store.ts +42 -3
- package/src/automerge/index.ts +1 -1
- package/src/automerge/leveldb-storage-adapter.ts +11 -11
- package/src/automerge/mesh-echo-replicator-connection.ts +12 -8
- package/src/automerge/mesh-echo-replicator.ts +15 -11
- package/src/automerge/storage-adapter.test.ts +1 -1
- package/src/common/space-id.ts +1 -1
- package/src/db-host/automerge-data-source.test.ts +299 -0
- package/src/db-host/automerge-data-source.ts +187 -0
- package/src/db-host/data-service.ts +25 -26
- package/src/db-host/database-root.ts +2 -2
- package/src/db-host/documents-synchronizer.test.ts +143 -14
- package/src/db-host/documents-synchronizer.ts +61 -45
- package/src/db-host/echo-host.ts +241 -93
- package/src/db-host/index.ts +1 -0
- package/src/db-host/local-queue-service.ts +127 -0
- package/src/db-host/query-service.ts +30 -98
- package/src/db-host/queue-data-source.ts +159 -0
- package/src/db-host/queue-service.test.ts +145 -0
- package/src/db-host/space-state-manager.ts +7 -3
- package/src/db-host/stub.ts +33 -0
- package/src/edge/echo-edge-replicator.test.ts +12 -10
- package/src/edge/echo-edge-replicator.ts +144 -58
- package/src/filter/filter-match.test.ts +68 -32
- package/src/filter/filter-match.ts +184 -20
- package/src/metadata/metadata-store.ts +11 -8
- package/src/pipeline/pipeline-stress.test.ts +1 -1
- package/src/pipeline/pipeline.test.ts +2 -2
- package/src/pipeline/pipeline.ts +9 -7
- package/src/query/errors.ts +3 -1
- package/src/query/plan.ts +82 -8
- package/src/query/query-executor.ts +1027 -163
- package/src/query/query-planner.test.ts +993 -81
- package/src/query/query-planner.ts +467 -27
- package/src/space/admission-discovery-extension.ts +3 -3
- package/src/space/auth.ts +6 -6
- package/src/space/control-pipeline.test.ts +5 -4
- package/src/space/control-pipeline.ts +16 -13
- package/src/space/space-manager.browser.test.ts +1 -1
- package/src/space/space-manager.ts +16 -12
- package/src/space/space-protocol.browser.test.ts +15 -14
- package/src/space/space-protocol.test.ts +15 -14
- package/src/space/space-protocol.ts +22 -18
- package/src/space/space.test.ts +3 -3
- package/src/space/space.ts +11 -11
- package/src/testing/index.ts +0 -2
- package/src/testing/test-agent-builder.ts +3 -3
- package/src/testing/test-network-adapter.ts +16 -3
- package/src/testing/test-replicator.ts +23 -18
- package/src/util.ts +7 -3
- package/dist/lib/browser/chunk-ANZAS5CC.mjs +0 -126
- package/dist/lib/browser/chunk-ANZAS5CC.mjs.map +0 -7
- package/dist/lib/browser/chunk-CGS2ULMK.mjs +0 -11
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-GBFX5J5B.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2SAZ7CCF.mjs +0 -126
- package/dist/lib/node-esm/chunk-2SAZ7CCF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FQFKWA3X.mjs +0 -2067
- package/dist/lib/node-esm/chunk-FQFKWA3X.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/filter/index.mjs +0 -11
- package/dist/lib/node-esm/filter/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -4743
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -742
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -18
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-schema.d.ts +0 -37
- package/dist/types/src/testing/test-schema.d.ts.map +0 -1
- package/src/db-host/documents-iterator.ts +0 -74
- package/src/testing/test-data.ts +0 -127
- package/src/testing/test-schema.ts +0 -53
- /package/dist/lib/{browser → neutral}/filter/index.mjs.map +0 -0
|
@@ -79,15 +79,19 @@ var emptyLargeSpaceMetadata = () => ({});
|
|
|
79
79
|
var EchoMetadata = schema2.getCodecForType("dxos.echo.metadata.EchoMetadata");
|
|
80
80
|
var LargeSpaceMetadata = schema2.getCodecForType("dxos.echo.metadata.LargeSpaceMetadata");
|
|
81
81
|
var MetadataStore = class {
|
|
82
|
+
_metadata = emptyEchoMetadata();
|
|
83
|
+
_spaceLargeMetadata = new ComplexMap2(PublicKey2.hash);
|
|
84
|
+
_metadataFile = void 0;
|
|
85
|
+
update = new Event();
|
|
86
|
+
_invitationCleanupCtx = new Context(void 0, {
|
|
87
|
+
F: __dxlog_file2,
|
|
88
|
+
L: 55
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
_directory;
|
|
82
94
|
constructor(directory) {
|
|
83
|
-
this._metadata = emptyEchoMetadata();
|
|
84
|
-
this._spaceLargeMetadata = new ComplexMap2(PublicKey2.hash);
|
|
85
|
-
this._metadataFile = void 0;
|
|
86
|
-
this.update = new Event();
|
|
87
|
-
this._invitationCleanupCtx = new Context(void 0, {
|
|
88
|
-
F: __dxlog_file2,
|
|
89
|
-
L: 55
|
|
90
|
-
});
|
|
91
95
|
this._directory = directory;
|
|
92
96
|
}
|
|
93
97
|
get metadata() {
|
|
@@ -122,15 +126,20 @@ var MetadataStore = class {
|
|
|
122
126
|
C: (f, a) => f(...a)
|
|
123
127
|
});
|
|
124
128
|
if (fileLength < dataSize + 8) {
|
|
125
|
-
throw new DataCorruptionError(
|
|
126
|
-
|
|
127
|
-
|
|
129
|
+
throw new DataCorruptionError({
|
|
130
|
+
message: "Metadata size is smaller than expected.",
|
|
131
|
+
context: {
|
|
132
|
+
fileLength,
|
|
133
|
+
dataSize
|
|
134
|
+
}
|
|
128
135
|
});
|
|
129
136
|
}
|
|
130
137
|
const data = await file.read(8, dataSize);
|
|
131
138
|
const calculatedChecksum = CRC32.buf(data);
|
|
132
139
|
if (calculatedChecksum !== checksum) {
|
|
133
|
-
throw new DataCorruptionError(
|
|
140
|
+
throw new DataCorruptionError({
|
|
141
|
+
message: "Metadata checksum is invalid."
|
|
142
|
+
});
|
|
134
143
|
}
|
|
135
144
|
return codec2.decode(data);
|
|
136
145
|
} finally {
|
|
@@ -153,7 +162,7 @@ var MetadataStore = class {
|
|
|
153
162
|
checksum
|
|
154
163
|
}, {
|
|
155
164
|
F: __dxlog_file2,
|
|
156
|
-
L:
|
|
165
|
+
L: 129,
|
|
157
166
|
S: this,
|
|
158
167
|
C: (f, a) => f(...a)
|
|
159
168
|
});
|
|
@@ -186,7 +195,7 @@ var MetadataStore = class {
|
|
|
186
195
|
err
|
|
187
196
|
}, {
|
|
188
197
|
F: __dxlog_file2,
|
|
189
|
-
L:
|
|
198
|
+
L: 161,
|
|
190
199
|
S: this,
|
|
191
200
|
C: (f, a) => f(...a)
|
|
192
201
|
});
|
|
@@ -203,7 +212,7 @@ var MetadataStore = class {
|
|
|
203
212
|
err
|
|
204
213
|
}, {
|
|
205
214
|
F: __dxlog_file2,
|
|
206
|
-
L:
|
|
215
|
+
L: 173,
|
|
207
216
|
S: this,
|
|
208
217
|
C: (f, a) => f(...a)
|
|
209
218
|
});
|
|
@@ -240,7 +249,7 @@ var MetadataStore = class {
|
|
|
240
249
|
err
|
|
241
250
|
}, {
|
|
242
251
|
F: __dxlog_file2,
|
|
243
|
-
L:
|
|
252
|
+
L: 215,
|
|
244
253
|
S: this,
|
|
245
254
|
C: (f, a) => f(...a)
|
|
246
255
|
});
|
|
@@ -261,7 +270,7 @@ var MetadataStore = class {
|
|
|
261
270
|
const space = this.spaces.find((space2) => space2.key.equals(spaceKey));
|
|
262
271
|
invariant2(space, "Space not found", {
|
|
263
272
|
F: __dxlog_file2,
|
|
264
|
-
L:
|
|
273
|
+
L: 237,
|
|
265
274
|
S: this,
|
|
266
275
|
A: [
|
|
267
276
|
"space",
|
|
@@ -291,7 +300,7 @@ var MetadataStore = class {
|
|
|
291
300
|
async clear() {
|
|
292
301
|
log("clearing all metadata", void 0, {
|
|
293
302
|
F: __dxlog_file2,
|
|
294
|
-
L:
|
|
303
|
+
L: 265,
|
|
295
304
|
S: this,
|
|
296
305
|
C: (f, a) => f(...a)
|
|
297
306
|
});
|
|
@@ -304,7 +313,7 @@ var MetadataStore = class {
|
|
|
304
313
|
async setIdentityRecord(record) {
|
|
305
314
|
invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
306
315
|
F: __dxlog_file2,
|
|
307
|
-
L:
|
|
316
|
+
L: 275,
|
|
308
317
|
S: this,
|
|
309
318
|
A: [
|
|
310
319
|
"!this._metadata.identity",
|
|
@@ -334,7 +343,7 @@ var MetadataStore = class {
|
|
|
334
343
|
async addSpace(record) {
|
|
335
344
|
invariant2(!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key)), "Cannot overwrite existing space in metadata", {
|
|
336
345
|
F: __dxlog_file2,
|
|
337
|
-
L:
|
|
346
|
+
L: 303,
|
|
338
347
|
S: this,
|
|
339
348
|
A: [
|
|
340
349
|
"!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key))",
|
|
@@ -429,9 +438,11 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
|
429
438
|
index: index + 1
|
|
430
439
|
}));
|
|
431
440
|
var TimeframeClock = class {
|
|
441
|
+
_timeframe;
|
|
442
|
+
update = new Event2();
|
|
443
|
+
_pendingTimeframe;
|
|
432
444
|
constructor(_timeframe = new Timeframe()) {
|
|
433
445
|
this._timeframe = _timeframe;
|
|
434
|
-
this.update = new Event2();
|
|
435
446
|
this._pendingTimeframe = _timeframe;
|
|
436
447
|
}
|
|
437
448
|
/**
|
|
@@ -498,7 +509,7 @@ _ts_decorate2([
|
|
|
498
509
|
], TimeframeClock.prototype, "waitUntilReached", null);
|
|
499
510
|
|
|
500
511
|
// src/pipeline/pipeline.ts
|
|
501
|
-
import { Event as Event3, sleepWithContext, synchronized as synchronized2
|
|
512
|
+
import { Event as Event3, Trigger, sleepWithContext, synchronized as synchronized2 } from "@dxos/async";
|
|
502
513
|
import { Context as Context2, rejectOnDispose } from "@dxos/context";
|
|
503
514
|
import { failUndefined } from "@dxos/debug";
|
|
504
515
|
import { FeedSetIterator } from "@dxos/feed-store";
|
|
@@ -547,17 +558,39 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
547
558
|
}
|
|
548
559
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
549
560
|
var PipelineState = class {
|
|
561
|
+
_feeds;
|
|
562
|
+
_timeframeClock;
|
|
563
|
+
/**
|
|
564
|
+
* @internal
|
|
565
|
+
*/
|
|
566
|
+
_ctx = new Context2(void 0, {
|
|
567
|
+
F: __dxlog_file5,
|
|
568
|
+
L: 41
|
|
569
|
+
});
|
|
570
|
+
// TODO(dmaretskyi): Remove?. Avoid accessing `_timeframeClock` before constructor initialization.
|
|
571
|
+
get timeframeUpdate() {
|
|
572
|
+
return this._timeframeClock.update;
|
|
573
|
+
}
|
|
574
|
+
stalled = new Event3();
|
|
575
|
+
/**
|
|
576
|
+
* @internal
|
|
577
|
+
*/
|
|
578
|
+
_startTimeframe = new Timeframe2();
|
|
579
|
+
/**
|
|
580
|
+
* Target timeframe we are waiting to reach.
|
|
581
|
+
*/
|
|
582
|
+
_targetTimeframe;
|
|
583
|
+
/**
|
|
584
|
+
* @internal
|
|
585
|
+
*/
|
|
586
|
+
_reachedTargetPromise;
|
|
587
|
+
/**
|
|
588
|
+
* @internal
|
|
589
|
+
*/
|
|
590
|
+
_reachedTarget = false;
|
|
550
591
|
constructor(_feeds, _timeframeClock) {
|
|
551
592
|
this._feeds = _feeds;
|
|
552
593
|
this._timeframeClock = _timeframeClock;
|
|
553
|
-
this._ctx = new Context2(void 0, {
|
|
554
|
-
F: __dxlog_file5,
|
|
555
|
-
L: 41
|
|
556
|
-
});
|
|
557
|
-
this.timeframeUpdate = this._timeframeClock.update;
|
|
558
|
-
this.stalled = new Event3();
|
|
559
|
-
this._startTimeframe = new Timeframe2();
|
|
560
|
-
this._reachedTarget = false;
|
|
561
594
|
}
|
|
562
595
|
/**
|
|
563
596
|
* Latest theoretical timeframe based on the last mutation in each feed.
|
|
@@ -603,7 +636,7 @@ var PipelineState = class {
|
|
|
603
636
|
*/
|
|
604
637
|
async waitUntilReachedTargetTimeframe({ ctx = new Context2(void 0, {
|
|
605
638
|
F: __dxlog_file5,
|
|
606
|
-
L:
|
|
639
|
+
L: 131
|
|
607
640
|
}), timeout, breakOnStall = true } = {}) {
|
|
608
641
|
log4("waitUntilReachedTargetTimeframe", {
|
|
609
642
|
timeout,
|
|
@@ -611,7 +644,7 @@ var PipelineState = class {
|
|
|
611
644
|
target: this.targetTimeframe
|
|
612
645
|
}, {
|
|
613
646
|
F: __dxlog_file5,
|
|
614
|
-
L:
|
|
647
|
+
L: 135,
|
|
615
648
|
S: this,
|
|
616
649
|
C: (f, a) => f(...a)
|
|
617
650
|
});
|
|
@@ -643,7 +676,7 @@ var PipelineState = class {
|
|
|
643
676
|
dependencies: Timeframe2.dependencies(this.targetTimeframe, this.timeframe)
|
|
644
677
|
}, {
|
|
645
678
|
F: __dxlog_file5,
|
|
646
|
-
L:
|
|
679
|
+
L: 163,
|
|
647
680
|
S: this,
|
|
648
681
|
C: (f, a) => f(...a)
|
|
649
682
|
});
|
|
@@ -655,28 +688,30 @@ var PipelineState = class {
|
|
|
655
688
|
}
|
|
656
689
|
};
|
|
657
690
|
var Pipeline = class {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
691
|
+
_timeframeClock = new TimeframeClock(new Timeframe2());
|
|
692
|
+
_feeds = new ComplexMap3(PublicKey3.hash);
|
|
693
|
+
// External state accessor.
|
|
694
|
+
_state = new PipelineState(this._feeds, this._timeframeClock);
|
|
695
|
+
// Waits for the message consumer to process the message and yield control back to the pipeline.
|
|
696
|
+
_processingTrigger = new Trigger().wake();
|
|
697
|
+
_pauseTrigger = new Trigger().wake();
|
|
698
|
+
// Pending downloads.
|
|
699
|
+
_downloads = new ComplexMap3((value) => PublicKey3.hash(value.key));
|
|
700
|
+
// Inbound feed stream.
|
|
701
|
+
_feedSetIterator;
|
|
702
|
+
// Outbound feed writer.
|
|
703
|
+
_writer;
|
|
704
|
+
_isStopping = false;
|
|
705
|
+
_isStarted = false;
|
|
706
|
+
_isBeingConsumed = false;
|
|
707
|
+
_isPaused = false;
|
|
673
708
|
get state() {
|
|
674
709
|
return this._state;
|
|
675
710
|
}
|
|
676
711
|
get writer() {
|
|
677
712
|
invariant4(this._writer, "Writer not set.", {
|
|
678
713
|
F: __dxlog_file5,
|
|
679
|
-
L:
|
|
714
|
+
L: 245,
|
|
680
715
|
S: this,
|
|
681
716
|
A: [
|
|
682
717
|
"this._writer",
|
|
@@ -705,7 +740,7 @@ var Pipeline = class {
|
|
|
705
740
|
setWriteFeed(feed) {
|
|
706
741
|
invariant4(!this._writer, "Writer already set.", {
|
|
707
742
|
F: __dxlog_file5,
|
|
708
|
-
L:
|
|
743
|
+
L: 272,
|
|
709
744
|
S: this,
|
|
710
745
|
A: [
|
|
711
746
|
"!this._writer",
|
|
@@ -714,7 +749,7 @@ var Pipeline = class {
|
|
|
714
749
|
});
|
|
715
750
|
invariant4(feed.properties.writable, "Feed must be writable.", {
|
|
716
751
|
F: __dxlog_file5,
|
|
717
|
-
L:
|
|
752
|
+
L: 273,
|
|
718
753
|
S: this,
|
|
719
754
|
A: [
|
|
720
755
|
"feed.properties.writable",
|
|
@@ -729,7 +764,7 @@ var Pipeline = class {
|
|
|
729
764
|
async start() {
|
|
730
765
|
invariant4(!this._isStarted, "Pipeline is already started.", {
|
|
731
766
|
F: __dxlog_file5,
|
|
732
|
-
L:
|
|
767
|
+
L: 286,
|
|
733
768
|
S: this,
|
|
734
769
|
A: [
|
|
735
770
|
"!this._isStarted",
|
|
@@ -738,7 +773,7 @@ var Pipeline = class {
|
|
|
738
773
|
});
|
|
739
774
|
log4("starting...", void 0, {
|
|
740
775
|
F: __dxlog_file5,
|
|
741
|
-
L:
|
|
776
|
+
L: 287,
|
|
742
777
|
S: this,
|
|
743
778
|
C: (f, a) => f(...a)
|
|
744
779
|
});
|
|
@@ -747,7 +782,7 @@ var Pipeline = class {
|
|
|
747
782
|
this._isStarted = true;
|
|
748
783
|
log4("started", void 0, {
|
|
749
784
|
F: __dxlog_file5,
|
|
750
|
-
L:
|
|
785
|
+
L: 291,
|
|
751
786
|
S: this,
|
|
752
787
|
C: (f, a) => f(...a)
|
|
753
788
|
});
|
|
@@ -760,7 +795,7 @@ var Pipeline = class {
|
|
|
760
795
|
async stop() {
|
|
761
796
|
log4("stopping...", void 0, {
|
|
762
797
|
F: __dxlog_file5,
|
|
763
|
-
L:
|
|
798
|
+
L: 302,
|
|
764
799
|
S: this,
|
|
765
800
|
C: (f, a) => f(...a)
|
|
766
801
|
});
|
|
@@ -774,14 +809,14 @@ var Pipeline = class {
|
|
|
774
809
|
await this._state._ctx.dispose();
|
|
775
810
|
this._state._ctx = new Context2(void 0, {
|
|
776
811
|
F: __dxlog_file5,
|
|
777
|
-
L:
|
|
812
|
+
L: 311
|
|
778
813
|
});
|
|
779
814
|
this._state._reachedTargetPromise = void 0;
|
|
780
815
|
this._state._reachedTarget = false;
|
|
781
816
|
this._isStarted = false;
|
|
782
817
|
log4("stopped", void 0, {
|
|
783
818
|
F: __dxlog_file5,
|
|
784
|
-
L:
|
|
819
|
+
L: 315,
|
|
785
820
|
S: this,
|
|
786
821
|
C: (f, a) => f(...a)
|
|
787
822
|
});
|
|
@@ -793,7 +828,7 @@ var Pipeline = class {
|
|
|
793
828
|
async setCursor(timeframe) {
|
|
794
829
|
invariant4(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
795
830
|
F: __dxlog_file5,
|
|
796
|
-
L:
|
|
831
|
+
L: 324,
|
|
797
832
|
S: this,
|
|
798
833
|
A: [
|
|
799
834
|
"!this._isStarted || this._isPaused",
|
|
@@ -822,7 +857,7 @@ var Pipeline = class {
|
|
|
822
857
|
async unpause() {
|
|
823
858
|
invariant4(this._isPaused, "Pipeline is not paused.", {
|
|
824
859
|
F: __dxlog_file5,
|
|
825
|
-
L:
|
|
860
|
+
L: 353,
|
|
826
861
|
S: this,
|
|
827
862
|
A: [
|
|
828
863
|
"this._isPaused",
|
|
@@ -842,7 +877,7 @@ var Pipeline = class {
|
|
|
842
877
|
async *consume() {
|
|
843
878
|
invariant4(!this._isBeingConsumed, "Pipeline is already being consumed.", {
|
|
844
879
|
F: __dxlog_file5,
|
|
845
|
-
L:
|
|
880
|
+
L: 368,
|
|
846
881
|
S: this,
|
|
847
882
|
A: [
|
|
848
883
|
"!this._isBeingConsumed",
|
|
@@ -852,7 +887,7 @@ var Pipeline = class {
|
|
|
852
887
|
this._isBeingConsumed = true;
|
|
853
888
|
invariant4(this._feedSetIterator, "Iterator not initialized.", {
|
|
854
889
|
F: __dxlog_file5,
|
|
855
|
-
L:
|
|
890
|
+
L: 371,
|
|
856
891
|
S: this,
|
|
857
892
|
A: [
|
|
858
893
|
"this._feedSetIterator",
|
|
@@ -866,7 +901,7 @@ var Pipeline = class {
|
|
|
866
901
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
867
902
|
invariant4(this._feedSetIterator, "Iterator not initialized.", {
|
|
868
903
|
F: __dxlog_file5,
|
|
869
|
-
L:
|
|
904
|
+
L: 380,
|
|
870
905
|
S: this,
|
|
871
906
|
A: [
|
|
872
907
|
"this._feedSetIterator",
|
|
@@ -901,7 +936,7 @@ var Pipeline = class {
|
|
|
901
936
|
length: feed.length
|
|
902
937
|
}, {
|
|
903
938
|
F: __dxlog_file5,
|
|
904
|
-
L:
|
|
939
|
+
L: 409,
|
|
905
940
|
S: this,
|
|
906
941
|
C: (f, a) => f(...a)
|
|
907
942
|
});
|
|
@@ -915,7 +950,7 @@ var Pipeline = class {
|
|
|
915
950
|
data
|
|
916
951
|
}, {
|
|
917
952
|
F: __dxlog_file5,
|
|
918
|
-
L:
|
|
953
|
+
L: 414,
|
|
919
954
|
S: this,
|
|
920
955
|
C: (f, a) => f(...a)
|
|
921
956
|
});
|
|
@@ -934,7 +969,7 @@ var Pipeline = class {
|
|
|
934
969
|
targetTimeframe: this._state.targetTimeframe
|
|
935
970
|
}, {
|
|
936
971
|
F: __dxlog_file5,
|
|
937
|
-
L:
|
|
972
|
+
L: 428,
|
|
938
973
|
S: this,
|
|
939
974
|
C: (f, a) => f(...a)
|
|
940
975
|
});
|
|
@@ -971,7 +1006,21 @@ import { schema as schema3 } from "@dxos/protocols/proto";
|
|
|
971
1006
|
import { RpcExtension } from "@dxos/teleport";
|
|
972
1007
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
973
1008
|
var AuthExtension = class extends RpcExtension {
|
|
974
|
-
|
|
1009
|
+
_authProps;
|
|
1010
|
+
_ctx = new Context3({
|
|
1011
|
+
onError: (err) => {
|
|
1012
|
+
log5.catch(err, void 0, {
|
|
1013
|
+
F: __dxlog_file6,
|
|
1014
|
+
L: 28,
|
|
1015
|
+
S: this,
|
|
1016
|
+
C: (f, a) => f(...a)
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}, {
|
|
1020
|
+
F: __dxlog_file6,
|
|
1021
|
+
L: 26
|
|
1022
|
+
});
|
|
1023
|
+
constructor(_authProps) {
|
|
975
1024
|
super({
|
|
976
1025
|
requested: {
|
|
977
1026
|
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
@@ -980,26 +1029,14 @@ var AuthExtension = class extends RpcExtension {
|
|
|
980
1029
|
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
981
1030
|
},
|
|
982
1031
|
timeout: 60 * 1e3
|
|
983
|
-
}), this.
|
|
984
|
-
onError: (err) => {
|
|
985
|
-
log5.catch(err, void 0, {
|
|
986
|
-
F: __dxlog_file6,
|
|
987
|
-
L: 28,
|
|
988
|
-
S: this,
|
|
989
|
-
C: (f, a) => f(...a)
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
}, {
|
|
993
|
-
F: __dxlog_file6,
|
|
994
|
-
L: 26
|
|
995
|
-
});
|
|
1032
|
+
}), this._authProps = _authProps;
|
|
996
1033
|
}
|
|
997
1034
|
async getHandlers() {
|
|
998
1035
|
return {
|
|
999
1036
|
AuthService: {
|
|
1000
1037
|
authenticate: async ({ challenge }) => {
|
|
1001
1038
|
try {
|
|
1002
|
-
const credential = await this.
|
|
1039
|
+
const credential = await this._authProps.provider(challenge);
|
|
1003
1040
|
if (!credential) {
|
|
1004
1041
|
throw new Error("auth rejected");
|
|
1005
1042
|
}
|
|
@@ -1036,7 +1073,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1036
1073
|
"'invalid credential'"
|
|
1037
1074
|
]
|
|
1038
1075
|
});
|
|
1039
|
-
const success = await this.
|
|
1076
|
+
const success = await this._authProps.verifier(challenge, credential);
|
|
1040
1077
|
invariant5(success, "credential not verified", {
|
|
1041
1078
|
F: __dxlog_file6,
|
|
1042
1079
|
L: 71,
|
|
@@ -1046,7 +1083,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1046
1083
|
"'credential not verified'"
|
|
1047
1084
|
]
|
|
1048
1085
|
});
|
|
1049
|
-
runInContext(this._ctx, () => this.
|
|
1086
|
+
runInContext(this._ctx, () => this._authProps.onAuthSuccess());
|
|
1050
1087
|
} catch (err) {
|
|
1051
1088
|
log5("auth failed", err, {
|
|
1052
1089
|
F: __dxlog_file6,
|
|
@@ -1055,7 +1092,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1055
1092
|
C: (f, a) => f(...a)
|
|
1056
1093
|
});
|
|
1057
1094
|
this.close();
|
|
1058
|
-
this.
|
|
1095
|
+
this._authProps.onAuthFailure();
|
|
1059
1096
|
}
|
|
1060
1097
|
});
|
|
1061
1098
|
}
|
|
@@ -1070,7 +1107,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1070
1107
|
};
|
|
1071
1108
|
|
|
1072
1109
|
// src/space/space.ts
|
|
1073
|
-
import { Event as Event4, scheduleMicroTask, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1110
|
+
import { Event as Event4, scheduleMicroTask as scheduleMicroTask2, synchronized as synchronized3, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1074
1111
|
import { Resource } from "@dxos/context";
|
|
1075
1112
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1076
1113
|
import { log as log7, logInfo } from "@dxos/log";
|
|
@@ -1079,7 +1116,7 @@ import { trace as trace2 } from "@dxos/tracing";
|
|
|
1079
1116
|
import { Callback as Callback2 } from "@dxos/util";
|
|
1080
1117
|
|
|
1081
1118
|
// src/space/control-pipeline.ts
|
|
1082
|
-
import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
1119
|
+
import { DeferredTask, scheduleMicroTask, sleepWithContext as sleepWithContext2, trackLeaks } from "@dxos/async";
|
|
1083
1120
|
import { Context as Context4 } from "@dxos/context";
|
|
1084
1121
|
import { SpaceStateMachine } from "@dxos/credentials";
|
|
1085
1122
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
@@ -1099,19 +1136,28 @@ var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
|
1099
1136
|
var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
1100
1137
|
var USE_SNAPSHOTS = true;
|
|
1101
1138
|
var ControlPipeline = class {
|
|
1139
|
+
_ctx = new Context4(void 0, {
|
|
1140
|
+
F: __dxlog_file7,
|
|
1141
|
+
L: 47
|
|
1142
|
+
});
|
|
1143
|
+
_pipeline;
|
|
1144
|
+
_spaceStateMachine;
|
|
1145
|
+
_spaceKey;
|
|
1146
|
+
_metadata;
|
|
1147
|
+
_targetTimeframe;
|
|
1148
|
+
_lastTimeframeSaveTime = Date.now();
|
|
1149
|
+
onFeedAdmitted = new Callback();
|
|
1150
|
+
onMemberRoleChanged;
|
|
1151
|
+
onCredentialProcessed;
|
|
1152
|
+
onDelegatedInvitation;
|
|
1153
|
+
onDelegatedInvitationRemoved;
|
|
1154
|
+
_usage = new TimeUsageCounter();
|
|
1155
|
+
_mutations = new TimeSeriesCounter();
|
|
1156
|
+
_snapshotTask = new DeferredTask(this._ctx, async () => {
|
|
1157
|
+
await sleepWithContext2(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1158
|
+
await this._saveSnapshot();
|
|
1159
|
+
});
|
|
1102
1160
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1103
|
-
this._ctx = new Context4(void 0, {
|
|
1104
|
-
F: __dxlog_file7,
|
|
1105
|
-
L: 47
|
|
1106
|
-
});
|
|
1107
|
-
this._lastTimeframeSaveTime = Date.now();
|
|
1108
|
-
this.onFeedAdmitted = new Callback();
|
|
1109
|
-
this._usage = new TimeUsageCounter();
|
|
1110
|
-
this._mutations = new TimeSeriesCounter();
|
|
1111
|
-
this._snapshotTask = new DeferredTask(this._ctx, async () => {
|
|
1112
|
-
await sleepWithContext2(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1113
|
-
await this._saveSnapshot();
|
|
1114
|
-
});
|
|
1115
1161
|
this._spaceKey = spaceKey;
|
|
1116
1162
|
this._metadata = metadataStore;
|
|
1117
1163
|
this._pipeline = new Pipeline();
|
|
@@ -1122,21 +1168,24 @@ var ControlPipeline = class {
|
|
|
1122
1168
|
key: info.key
|
|
1123
1169
|
}, {
|
|
1124
1170
|
F: __dxlog_file7,
|
|
1125
|
-
L:
|
|
1171
|
+
L: 83,
|
|
1126
1172
|
S: this,
|
|
1127
1173
|
C: (f, a) => f(...a)
|
|
1128
1174
|
});
|
|
1129
1175
|
if (info.assertion.designation === AdmittedFeed.Designation.CONTROL && !info.key.equals(genesisFeed.key)) {
|
|
1130
|
-
|
|
1176
|
+
scheduleMicroTask(this._ctx, async () => {
|
|
1131
1177
|
try {
|
|
1132
1178
|
const feed = await feedProvider(info.key);
|
|
1179
|
+
if (this._ctx.disposed) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1133
1182
|
if (!this._pipeline.hasFeed(feed.key)) {
|
|
1134
1183
|
await this._pipeline.addFeed(feed);
|
|
1135
1184
|
}
|
|
1136
1185
|
} catch (err) {
|
|
1137
1186
|
log6.catch(err, void 0, {
|
|
1138
1187
|
F: __dxlog_file7,
|
|
1139
|
-
L:
|
|
1188
|
+
L: 97,
|
|
1140
1189
|
S: this,
|
|
1141
1190
|
C: (f, a) => f(...a)
|
|
1142
1191
|
});
|
|
@@ -1160,7 +1209,7 @@ var ControlPipeline = class {
|
|
|
1160
1209
|
await this._pipeline.addFeed(feed);
|
|
1161
1210
|
this._pipeline.setWriteFeed(feed);
|
|
1162
1211
|
}
|
|
1163
|
-
async start() {
|
|
1212
|
+
async start(ctx) {
|
|
1164
1213
|
const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
|
|
1165
1214
|
log6("load snapshot", {
|
|
1166
1215
|
key: this._spaceKey,
|
|
@@ -1168,7 +1217,7 @@ var ControlPipeline = class {
|
|
|
1168
1217
|
tf: snapshot?.timeframe
|
|
1169
1218
|
}, {
|
|
1170
1219
|
F: __dxlog_file7,
|
|
1171
|
-
L:
|
|
1220
|
+
L: 127,
|
|
1172
1221
|
S: this,
|
|
1173
1222
|
C: (f, a) => f(...a)
|
|
1174
1223
|
});
|
|
@@ -1177,20 +1226,17 @@ var ControlPipeline = class {
|
|
|
1177
1226
|
}
|
|
1178
1227
|
log6("starting...", void 0, {
|
|
1179
1228
|
F: __dxlog_file7,
|
|
1180
|
-
L:
|
|
1229
|
+
L: 132,
|
|
1181
1230
|
S: this,
|
|
1182
1231
|
C: (f, a) => f(...a)
|
|
1183
1232
|
});
|
|
1184
1233
|
setTimeout(async () => {
|
|
1185
|
-
void this._consumePipeline(
|
|
1186
|
-
F: __dxlog_file7,
|
|
1187
|
-
L: 130
|
|
1188
|
-
}));
|
|
1234
|
+
void this._consumePipeline(ctx);
|
|
1189
1235
|
});
|
|
1190
1236
|
await this._pipeline.start();
|
|
1191
1237
|
log6("started", void 0, {
|
|
1192
1238
|
F: __dxlog_file7,
|
|
1193
|
-
L:
|
|
1239
|
+
L: 138,
|
|
1194
1240
|
S: this,
|
|
1195
1241
|
C: (f, a) => f(...a)
|
|
1196
1242
|
});
|
|
@@ -1207,7 +1253,7 @@ var ControlPipeline = class {
|
|
|
1207
1253
|
message
|
|
1208
1254
|
}, {
|
|
1209
1255
|
F: __dxlog_file7,
|
|
1210
|
-
L:
|
|
1256
|
+
L: 151,
|
|
1211
1257
|
S: this,
|
|
1212
1258
|
C: (f, a) => f(...a)
|
|
1213
1259
|
});
|
|
@@ -1229,7 +1275,7 @@ var ControlPipeline = class {
|
|
|
1229
1275
|
snapshot: getSnapshotLoggerContext(snapshot)
|
|
1230
1276
|
}, {
|
|
1231
1277
|
F: __dxlog_file7,
|
|
1232
|
-
L:
|
|
1278
|
+
L: 167,
|
|
1233
1279
|
S: this,
|
|
1234
1280
|
C: (f, a) => f(...a)
|
|
1235
1281
|
});
|
|
@@ -1244,7 +1290,7 @@ var ControlPipeline = class {
|
|
|
1244
1290
|
} catch (err) {
|
|
1245
1291
|
log6.catch(err, void 0, {
|
|
1246
1292
|
F: __dxlog_file7,
|
|
1247
|
-
L:
|
|
1293
|
+
L: 179,
|
|
1248
1294
|
S: this,
|
|
1249
1295
|
C: (f, a) => f(...a)
|
|
1250
1296
|
});
|
|
@@ -1258,7 +1304,7 @@ var ControlPipeline = class {
|
|
|
1258
1304
|
seq: msg.seq
|
|
1259
1305
|
}, {
|
|
1260
1306
|
F: __dxlog_file7,
|
|
1261
|
-
L:
|
|
1307
|
+
L: 188,
|
|
1262
1308
|
S: this,
|
|
1263
1309
|
C: (f, a) => f(...a)
|
|
1264
1310
|
});
|
|
@@ -1273,7 +1319,7 @@ var ControlPipeline = class {
|
|
|
1273
1319
|
msg
|
|
1274
1320
|
}, {
|
|
1275
1321
|
F: __dxlog_file7,
|
|
1276
|
-
L:
|
|
1322
|
+
L: 197,
|
|
1277
1323
|
S: this,
|
|
1278
1324
|
C: (f, a) => f(...a)
|
|
1279
1325
|
});
|
|
@@ -1292,7 +1338,7 @@ var ControlPipeline = class {
|
|
|
1292
1338
|
async stop() {
|
|
1293
1339
|
log6("stopping...", void 0, {
|
|
1294
1340
|
F: __dxlog_file7,
|
|
1295
|
-
L:
|
|
1341
|
+
L: 217,
|
|
1296
1342
|
S: this,
|
|
1297
1343
|
C: (f, a) => f(...a)
|
|
1298
1344
|
});
|
|
@@ -1301,7 +1347,7 @@ var ControlPipeline = class {
|
|
|
1301
1347
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1302
1348
|
log6("stopped", void 0, {
|
|
1303
1349
|
F: __dxlog_file7,
|
|
1304
|
-
L:
|
|
1350
|
+
L: 221,
|
|
1305
1351
|
S: this,
|
|
1306
1352
|
C: (f, a) => f(...a)
|
|
1307
1353
|
});
|
|
@@ -1314,13 +1360,18 @@ var ControlPipeline = class {
|
|
|
1314
1360
|
} catch (err) {
|
|
1315
1361
|
log6(err, void 0, {
|
|
1316
1362
|
F: __dxlog_file7,
|
|
1317
|
-
L:
|
|
1363
|
+
L: 230,
|
|
1318
1364
|
S: this,
|
|
1319
1365
|
C: (f, a) => f(...a)
|
|
1320
1366
|
});
|
|
1321
1367
|
}
|
|
1322
1368
|
}
|
|
1323
1369
|
};
|
|
1370
|
+
_ts_decorate4([
|
|
1371
|
+
trace.info({
|
|
1372
|
+
spanAttribute: true
|
|
1373
|
+
})
|
|
1374
|
+
], ControlPipeline.prototype, "_spaceKey", void 0);
|
|
1324
1375
|
_ts_decorate4([
|
|
1325
1376
|
trace.metricsCounter()
|
|
1326
1377
|
], ControlPipeline.prototype, "_usage", void 0);
|
|
@@ -1329,14 +1380,15 @@ _ts_decorate4([
|
|
|
1329
1380
|
], ControlPipeline.prototype, "_mutations", void 0);
|
|
1330
1381
|
_ts_decorate4([
|
|
1331
1382
|
trace.span({
|
|
1332
|
-
showInBrowserTimeline: true
|
|
1383
|
+
showInBrowserTimeline: true,
|
|
1384
|
+
op: "lifecycle"
|
|
1333
1385
|
})
|
|
1334
1386
|
], ControlPipeline.prototype, "start", null);
|
|
1335
1387
|
_ts_decorate4([
|
|
1336
|
-
trace.span(
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1388
|
+
trace.span({
|
|
1389
|
+
showInBrowserTimeline: true,
|
|
1390
|
+
showInRemoteTracing: false
|
|
1391
|
+
})
|
|
1340
1392
|
], ControlPipeline.prototype, "_processMessage", null);
|
|
1341
1393
|
ControlPipeline = _ts_decorate4([
|
|
1342
1394
|
trace.resource(),
|
|
@@ -1364,10 +1416,18 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1364
1416
|
}
|
|
1365
1417
|
var __dxlog_file8 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
1366
1418
|
var Space = class extends Resource {
|
|
1419
|
+
onCredentialProcessed = new Callback2();
|
|
1420
|
+
stateUpdate = new Event4();
|
|
1421
|
+
protocol;
|
|
1422
|
+
_id;
|
|
1423
|
+
_key;
|
|
1424
|
+
_genesisFeedKey;
|
|
1425
|
+
_feedProvider;
|
|
1426
|
+
_controlPipeline;
|
|
1427
|
+
_controlFeed;
|
|
1428
|
+
_dataFeed;
|
|
1367
1429
|
constructor(params) {
|
|
1368
1430
|
super();
|
|
1369
|
-
this.onCredentialProcessed = new Callback2();
|
|
1370
|
-
this.stateUpdate = new Event4();
|
|
1371
1431
|
invariant6(params.spaceKey && params.feedProvider, void 0, {
|
|
1372
1432
|
F: __dxlog_file8,
|
|
1373
1433
|
L: 72,
|
|
@@ -1390,7 +1450,7 @@ var Space = class extends Resource {
|
|
|
1390
1450
|
this._controlPipeline.onFeedAdmitted.set(async (info) => {
|
|
1391
1451
|
const sparse = info.assertion.designation === AdmittedFeed2.Designation.DATA;
|
|
1392
1452
|
if (!info.key.equals(params.genesisFeed.key)) {
|
|
1393
|
-
|
|
1453
|
+
scheduleMicroTask2(this._ctx, async () => {
|
|
1394
1454
|
await this.protocol.addFeed(await params.feedProvider(info.key, {
|
|
1395
1455
|
sparse
|
|
1396
1456
|
}));
|
|
@@ -1511,7 +1571,7 @@ var Space = class extends Resource {
|
|
|
1511
1571
|
S: this,
|
|
1512
1572
|
C: (f, a) => f(...a)
|
|
1513
1573
|
});
|
|
1514
|
-
await this._controlPipeline.start();
|
|
1574
|
+
await this._controlPipeline.start(ctx);
|
|
1515
1575
|
log7("opened", void 0, {
|
|
1516
1576
|
F: __dxlog_file8,
|
|
1517
1577
|
L: 181,
|
|
@@ -1519,7 +1579,7 @@ var Space = class extends Resource {
|
|
|
1519
1579
|
C: (f, a) => f(...a)
|
|
1520
1580
|
});
|
|
1521
1581
|
}
|
|
1522
|
-
async startProtocol() {
|
|
1582
|
+
async startProtocol(ctx) {
|
|
1523
1583
|
invariant6(this.isOpen, void 0, {
|
|
1524
1584
|
F: __dxlog_file8,
|
|
1525
1585
|
L: 186,
|
|
@@ -1529,10 +1589,10 @@ var Space = class extends Resource {
|
|
|
1529
1589
|
""
|
|
1530
1590
|
]
|
|
1531
1591
|
});
|
|
1532
|
-
await this.protocol.start();
|
|
1592
|
+
await this.protocol.start(ctx);
|
|
1533
1593
|
await this.protocol.addFeed(await this._feedProvider(this._genesisFeedKey));
|
|
1534
1594
|
}
|
|
1535
|
-
async _close() {
|
|
1595
|
+
async _close(ctx) {
|
|
1536
1596
|
log7("closing...", {
|
|
1537
1597
|
key: this._key
|
|
1538
1598
|
}, {
|
|
@@ -1541,7 +1601,7 @@ var Space = class extends Resource {
|
|
|
1541
1601
|
S: this,
|
|
1542
1602
|
C: (f, a) => f(...a)
|
|
1543
1603
|
});
|
|
1544
|
-
await this.protocol.stop();
|
|
1604
|
+
await this.protocol.stop(ctx);
|
|
1545
1605
|
await this._controlPipeline.stop();
|
|
1546
1606
|
log7("closed", void 0, {
|
|
1547
1607
|
F: __dxlog_file8,
|
|
@@ -1566,7 +1626,9 @@ _ts_decorate5([
|
|
|
1566
1626
|
trace2.info()
|
|
1567
1627
|
], Space.prototype, "key", null);
|
|
1568
1628
|
_ts_decorate5([
|
|
1569
|
-
trace2.span(
|
|
1629
|
+
trace2.span({
|
|
1630
|
+
op: "lifecycle"
|
|
1631
|
+
})
|
|
1570
1632
|
], Space.prototype, "_open", null);
|
|
1571
1633
|
_ts_decorate5([
|
|
1572
1634
|
synchronized3
|
|
@@ -1587,15 +1649,18 @@ import { schema as schema4 } from "@dxos/protocols/proto";
|
|
|
1587
1649
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1588
1650
|
var __dxlog_file9 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
|
|
1589
1651
|
var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
1652
|
+
_request;
|
|
1653
|
+
_onResult;
|
|
1654
|
+
_ctx = new Context5(void 0, {
|
|
1655
|
+
F: __dxlog_file9,
|
|
1656
|
+
L: 26
|
|
1657
|
+
});
|
|
1590
1658
|
constructor(_request, _onResult) {
|
|
1591
1659
|
super({
|
|
1592
1660
|
requested: {
|
|
1593
1661
|
AdmissionDiscoveryService: schema4.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1594
1662
|
}
|
|
1595
|
-
}), this._request = _request, this._onResult = _onResult
|
|
1596
|
-
F: __dxlog_file9,
|
|
1597
|
-
L: 26
|
|
1598
|
-
});
|
|
1663
|
+
}), this._request = _request, this._onResult = _onResult;
|
|
1599
1664
|
}
|
|
1600
1665
|
async getHandlers() {
|
|
1601
1666
|
return {};
|
|
@@ -1619,6 +1684,7 @@ var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
|
1619
1684
|
}
|
|
1620
1685
|
};
|
|
1621
1686
|
var CredentialServerExtension = class extends RpcExtension2 {
|
|
1687
|
+
_space;
|
|
1622
1688
|
constructor(_space) {
|
|
1623
1689
|
super({
|
|
1624
1690
|
exposed: {
|
|
@@ -1632,7 +1698,12 @@ var CredentialServerExtension = class extends RpcExtension2 {
|
|
|
1632
1698
|
getAdmissionCredential: async (request) => {
|
|
1633
1699
|
const memberInfo = this._space.spaceState.members.get(request.memberKey);
|
|
1634
1700
|
if (!memberInfo?.credential) {
|
|
1635
|
-
throw new ProtocolError(
|
|
1701
|
+
throw new ProtocolError({
|
|
1702
|
+
message: "Space member not found.",
|
|
1703
|
+
context: {
|
|
1704
|
+
...request
|
|
1705
|
+
}
|
|
1706
|
+
});
|
|
1636
1707
|
}
|
|
1637
1708
|
return {
|
|
1638
1709
|
admissionCredential: memberInfo.credential
|
|
@@ -1663,16 +1734,34 @@ var __dxlog_file10 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/
|
|
|
1663
1734
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1664
1735
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1665
1736
|
var SpaceProtocol = class {
|
|
1737
|
+
_networkManager;
|
|
1738
|
+
_swarmIdentity;
|
|
1739
|
+
_onSessionAuth;
|
|
1740
|
+
_onAuthFailure;
|
|
1741
|
+
blobSync;
|
|
1742
|
+
_disableP2pReplication;
|
|
1743
|
+
_topic;
|
|
1744
|
+
_spaceKey;
|
|
1745
|
+
_feeds = /* @__PURE__ */ new Set();
|
|
1746
|
+
_sessions = new ComplexMap4(PublicKey5.hash);
|
|
1747
|
+
// TODO(burdon): Move to config (with sensible defaults).
|
|
1748
|
+
_topology = new MMSTTopology({
|
|
1749
|
+
originateConnections: 4,
|
|
1750
|
+
maxPeers: 10,
|
|
1751
|
+
sampleSize: 20
|
|
1752
|
+
});
|
|
1753
|
+
_connection;
|
|
1754
|
+
feedAdded = new CallbackCollection();
|
|
1755
|
+
get sessions() {
|
|
1756
|
+
return this._sessions;
|
|
1757
|
+
}
|
|
1758
|
+
get feeds() {
|
|
1759
|
+
return this._feeds;
|
|
1760
|
+
}
|
|
1761
|
+
get _ownPeerKey() {
|
|
1762
|
+
return this._swarmIdentity.peerKey;
|
|
1763
|
+
}
|
|
1666
1764
|
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore, disableP2pReplication }) {
|
|
1667
|
-
this._feeds = /* @__PURE__ */ new Set();
|
|
1668
|
-
this._sessions = new ComplexMap4(PublicKey5.hash);
|
|
1669
|
-
// TODO(burdon): Move to config (with sensible defaults).
|
|
1670
|
-
this._topology = new MMSTTopology({
|
|
1671
|
-
originateConnections: 4,
|
|
1672
|
-
maxPeers: 10,
|
|
1673
|
-
sampleSize: 20
|
|
1674
|
-
});
|
|
1675
|
-
this.feedAdded = new CallbackCollection();
|
|
1676
1765
|
this._spaceKey = topic;
|
|
1677
1766
|
this._networkManager = networkManager;
|
|
1678
1767
|
this._swarmIdentity = swarmIdentity;
|
|
@@ -1684,22 +1773,13 @@ var SpaceProtocol = class {
|
|
|
1684
1773
|
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
1685
1774
|
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1686
1775
|
}
|
|
1687
|
-
get sessions() {
|
|
1688
|
-
return this._sessions;
|
|
1689
|
-
}
|
|
1690
|
-
get feeds() {
|
|
1691
|
-
return this._feeds;
|
|
1692
|
-
}
|
|
1693
|
-
get _ownPeerKey() {
|
|
1694
|
-
return this._swarmIdentity.peerKey;
|
|
1695
|
-
}
|
|
1696
1776
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
1697
1777
|
async addFeed(feed) {
|
|
1698
1778
|
log8("addFeed", {
|
|
1699
1779
|
key: feed.key
|
|
1700
1780
|
}, {
|
|
1701
1781
|
F: __dxlog_file10,
|
|
1702
|
-
L:
|
|
1782
|
+
L: 132,
|
|
1703
1783
|
S: this,
|
|
1704
1784
|
C: (f, a) => f(...a)
|
|
1705
1785
|
});
|
|
@@ -1710,7 +1790,7 @@ var SpaceProtocol = class {
|
|
|
1710
1790
|
await this.feedAdded.callSerial(feed);
|
|
1711
1791
|
}
|
|
1712
1792
|
// TODO(burdon): Rename open? Common open/close interfaces for all services?
|
|
1713
|
-
async start() {
|
|
1793
|
+
async start(ctx) {
|
|
1714
1794
|
if (this._connection) {
|
|
1715
1795
|
return;
|
|
1716
1796
|
}
|
|
@@ -1718,12 +1798,12 @@ var SpaceProtocol = class {
|
|
|
1718
1798
|
await this.blobSync.open();
|
|
1719
1799
|
log8("starting...", void 0, {
|
|
1720
1800
|
F: __dxlog_file10,
|
|
1721
|
-
L:
|
|
1801
|
+
L: 153,
|
|
1722
1802
|
S: this,
|
|
1723
1803
|
C: (f, a) => f(...a)
|
|
1724
1804
|
});
|
|
1725
1805
|
const topic = await this._topic;
|
|
1726
|
-
this._connection = await this._networkManager.joinSwarm({
|
|
1806
|
+
this._connection = await this._networkManager.joinSwarm(ctx, {
|
|
1727
1807
|
protocolProvider: this._createProtocolProvider(credentials),
|
|
1728
1808
|
topic,
|
|
1729
1809
|
topology: this._topology,
|
|
@@ -1731,7 +1811,7 @@ var SpaceProtocol = class {
|
|
|
1731
1811
|
});
|
|
1732
1812
|
log8("started", void 0, {
|
|
1733
1813
|
F: __dxlog_file10,
|
|
1734
|
-
L:
|
|
1814
|
+
L: 162,
|
|
1735
1815
|
S: this,
|
|
1736
1816
|
C: (f, a) => f(...a)
|
|
1737
1817
|
});
|
|
@@ -1739,35 +1819,35 @@ var SpaceProtocol = class {
|
|
|
1739
1819
|
updateTopology() {
|
|
1740
1820
|
this._topology.forceUpdate();
|
|
1741
1821
|
}
|
|
1742
|
-
async stop() {
|
|
1822
|
+
async stop(ctx) {
|
|
1743
1823
|
await this.blobSync.close();
|
|
1744
1824
|
if (this._connection) {
|
|
1745
1825
|
log8("stopping...", void 0, {
|
|
1746
1826
|
F: __dxlog_file10,
|
|
1747
|
-
L:
|
|
1827
|
+
L: 173,
|
|
1748
1828
|
S: this,
|
|
1749
1829
|
C: (f, a) => f(...a)
|
|
1750
1830
|
});
|
|
1751
|
-
await this._connection.close();
|
|
1831
|
+
await this._connection.close(ctx);
|
|
1752
1832
|
log8("stopped", void 0, {
|
|
1753
1833
|
F: __dxlog_file10,
|
|
1754
|
-
L:
|
|
1834
|
+
L: 175,
|
|
1755
1835
|
S: this,
|
|
1756
1836
|
C: (f, a) => f(...a)
|
|
1757
1837
|
});
|
|
1758
1838
|
}
|
|
1759
1839
|
}
|
|
1760
1840
|
_createProtocolProvider(credentials) {
|
|
1761
|
-
return (
|
|
1841
|
+
return (wireProps) => {
|
|
1762
1842
|
const session = new SpaceProtocolSession({
|
|
1763
|
-
|
|
1843
|
+
wireProps,
|
|
1764
1844
|
swarmIdentity: this._swarmIdentity,
|
|
1765
1845
|
onSessionAuth: this._onSessionAuth,
|
|
1766
1846
|
onAuthFailure: this._onAuthFailure,
|
|
1767
1847
|
blobSync: this.blobSync,
|
|
1768
1848
|
disableP2pReplication: this._disableP2pReplication
|
|
1769
1849
|
});
|
|
1770
|
-
this._sessions.set(
|
|
1850
|
+
this._sessions.set(wireProps.remotePeerId, session);
|
|
1771
1851
|
for (const feed of this._feeds) {
|
|
1772
1852
|
session.replicator.addFeed(feed);
|
|
1773
1853
|
}
|
|
@@ -1788,34 +1868,41 @@ _ts_decorate6([
|
|
|
1788
1868
|
SpaceProtocol = _ts_decorate6([
|
|
1789
1869
|
trace3.resource()
|
|
1790
1870
|
], SpaceProtocol);
|
|
1791
|
-
var AuthStatus = /* @__PURE__ */ function(AuthStatus2) {
|
|
1871
|
+
var AuthStatus = /* @__PURE__ */ (function(AuthStatus2) {
|
|
1792
1872
|
AuthStatus2["INITIAL"] = "INITIAL";
|
|
1793
1873
|
AuthStatus2["SUCCESS"] = "SUCCESS";
|
|
1794
1874
|
AuthStatus2["FAILURE"] = "FAILURE";
|
|
1795
1875
|
return AuthStatus2;
|
|
1796
|
-
}({});
|
|
1876
|
+
})({});
|
|
1797
1877
|
var SpaceProtocolSession = class {
|
|
1878
|
+
_wireProps;
|
|
1879
|
+
_disableP2pReplication;
|
|
1880
|
+
_onSessionAuth;
|
|
1881
|
+
_onAuthFailure;
|
|
1882
|
+
_swarmIdentity;
|
|
1883
|
+
_blobSync;
|
|
1884
|
+
_teleport;
|
|
1885
|
+
// TODO(dmaretskyi): Start with upload=false when switching it on the fly works.
|
|
1886
|
+
replicator = new ReplicatorExtension().setOptions({
|
|
1887
|
+
upload: true
|
|
1888
|
+
});
|
|
1889
|
+
_authStatus = "INITIAL";
|
|
1890
|
+
get authStatus() {
|
|
1891
|
+
return this._authStatus;
|
|
1892
|
+
}
|
|
1893
|
+
get stats() {
|
|
1894
|
+
return this._teleport.stats;
|
|
1895
|
+
}
|
|
1798
1896
|
// TODO(dmaretskyi): Allow to pass in extra extensions.
|
|
1799
|
-
constructor({
|
|
1800
|
-
|
|
1801
|
-
this.replicator = new ReplicatorExtension().setOptions({
|
|
1802
|
-
upload: true
|
|
1803
|
-
});
|
|
1804
|
-
this._authStatus = "INITIAL";
|
|
1805
|
-
this._wireParams = wireParams;
|
|
1897
|
+
constructor({ wireProps, swarmIdentity, onSessionAuth, onAuthFailure, blobSync, disableP2pReplication }) {
|
|
1898
|
+
this._wireProps = wireProps;
|
|
1806
1899
|
this._swarmIdentity = swarmIdentity;
|
|
1807
1900
|
this._onSessionAuth = onSessionAuth;
|
|
1808
1901
|
this._onAuthFailure = onAuthFailure;
|
|
1809
1902
|
this._blobSync = blobSync;
|
|
1810
|
-
this._teleport = new Teleport(
|
|
1903
|
+
this._teleport = new Teleport(wireProps);
|
|
1811
1904
|
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1812
1905
|
}
|
|
1813
|
-
get authStatus() {
|
|
1814
|
-
return this._authStatus;
|
|
1815
|
-
}
|
|
1816
|
-
get stats() {
|
|
1817
|
-
return this._teleport.stats;
|
|
1818
|
-
}
|
|
1819
1906
|
get stream() {
|
|
1820
1907
|
return this._teleport.stream;
|
|
1821
1908
|
}
|
|
@@ -1827,7 +1914,7 @@ var SpaceProtocolSession = class {
|
|
|
1827
1914
|
onAuthSuccess: () => {
|
|
1828
1915
|
log8("Peer authenticated", void 0, {
|
|
1829
1916
|
F: __dxlog_file10,
|
|
1830
|
-
L:
|
|
1917
|
+
L: 286,
|
|
1831
1918
|
S: this,
|
|
1832
1919
|
C: (f, a) => f(...a)
|
|
1833
1920
|
});
|
|
@@ -1847,7 +1934,7 @@ var SpaceProtocolSession = class {
|
|
|
1847
1934
|
async close() {
|
|
1848
1935
|
log8("close", void 0, {
|
|
1849
1936
|
F: __dxlog_file10,
|
|
1850
|
-
L:
|
|
1937
|
+
L: 305,
|
|
1851
1938
|
S: this,
|
|
1852
1939
|
C: (f, a) => f(...a)
|
|
1853
1940
|
});
|
|
@@ -1859,14 +1946,14 @@ var SpaceProtocolSession = class {
|
|
|
1859
1946
|
};
|
|
1860
1947
|
_ts_decorate6([
|
|
1861
1948
|
logInfo2
|
|
1862
|
-
], SpaceProtocolSession.prototype, "
|
|
1949
|
+
], SpaceProtocolSession.prototype, "_wireProps", void 0);
|
|
1863
1950
|
_ts_decorate6([
|
|
1864
1951
|
logInfo2
|
|
1865
1952
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
1866
1953
|
|
|
1867
1954
|
// src/space/space-manager.ts
|
|
1868
1955
|
import { parseAutomergeUrl } from "@automerge/automerge-repo";
|
|
1869
|
-
import {
|
|
1956
|
+
import { Trigger as Trigger2, synchronized as synchronized4, trackLeaks as trackLeaks3 } from "@dxos/async";
|
|
1870
1957
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
1871
1958
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1872
1959
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
@@ -1881,9 +1968,14 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1881
1968
|
}
|
|
1882
1969
|
var __dxlog_file11 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
1883
1970
|
var SpaceManager = class {
|
|
1971
|
+
_spaces = new ComplexMap5(PublicKey6.hash);
|
|
1972
|
+
_feedStore;
|
|
1973
|
+
_networkManager;
|
|
1974
|
+
_metadataStore;
|
|
1975
|
+
_blobStore;
|
|
1976
|
+
_instanceId = PublicKey6.random().toHex();
|
|
1977
|
+
_disableP2pReplication;
|
|
1884
1978
|
constructor({ feedStore, networkManager, metadataStore, blobStore, disableP2pReplication }) {
|
|
1885
|
-
this._spaces = new ComplexMap5(PublicKey6.hash);
|
|
1886
|
-
this._instanceId = PublicKey6.random().toHex();
|
|
1887
1979
|
this._feedStore = feedStore;
|
|
1888
1980
|
this._networkManager = networkManager;
|
|
1889
1981
|
this._metadataStore = metadataStore;
|
|
@@ -1906,7 +1998,7 @@ var SpaceManager = class {
|
|
|
1906
1998
|
id: this._instanceId
|
|
1907
1999
|
}), {
|
|
1908
2000
|
F: __dxlog_file11,
|
|
1909
|
-
L:
|
|
2001
|
+
L: 103,
|
|
1910
2002
|
S: this,
|
|
1911
2003
|
C: (f, a) => f(...a)
|
|
1912
2004
|
});
|
|
@@ -1914,7 +2006,7 @@ var SpaceManager = class {
|
|
|
1914
2006
|
spaceKey: metadata.genesisFeedKey
|
|
1915
2007
|
}, {
|
|
1916
2008
|
F: __dxlog_file11,
|
|
1917
|
-
L:
|
|
2009
|
+
L: 104,
|
|
1918
2010
|
S: this,
|
|
1919
2011
|
C: (f, a) => f(...a)
|
|
1920
2012
|
});
|
|
@@ -1946,19 +2038,19 @@ var SpaceManager = class {
|
|
|
1946
2038
|
id: this._instanceId
|
|
1947
2039
|
}), {
|
|
1948
2040
|
F: __dxlog_file11,
|
|
1949
|
-
L:
|
|
2041
|
+
L: 134,
|
|
1950
2042
|
S: this,
|
|
1951
2043
|
C: (f, a) => f(...a)
|
|
1952
2044
|
});
|
|
1953
2045
|
return space;
|
|
1954
2046
|
}
|
|
1955
|
-
async requestSpaceAdmissionCredential(params) {
|
|
2047
|
+
async requestSpaceAdmissionCredential(ctx, params) {
|
|
1956
2048
|
const traceKey = "dxos.echo.space-manager.request-space-admission";
|
|
1957
2049
|
log9.trace(traceKey, trace4.begin({
|
|
1958
2050
|
id: this._instanceId
|
|
1959
2051
|
}), {
|
|
1960
2052
|
F: __dxlog_file11,
|
|
1961
|
-
L:
|
|
2053
|
+
L: 143,
|
|
1962
2054
|
S: this,
|
|
1963
2055
|
C: (f, a) => f(...a)
|
|
1964
2056
|
});
|
|
@@ -1966,7 +2058,7 @@ var SpaceManager = class {
|
|
|
1966
2058
|
spaceKey: params.spaceKey
|
|
1967
2059
|
}, {
|
|
1968
2060
|
F: __dxlog_file11,
|
|
1969
|
-
L:
|
|
2061
|
+
L: 144,
|
|
1970
2062
|
S: this,
|
|
1971
2063
|
C: (f, a) => f(...a)
|
|
1972
2064
|
});
|
|
@@ -1986,7 +2078,7 @@ var SpaceManager = class {
|
|
|
1986
2078
|
disableP2pReplication: this._disableP2pReplication
|
|
1987
2079
|
});
|
|
1988
2080
|
try {
|
|
1989
|
-
await protocol.start();
|
|
2081
|
+
await protocol.start(ctx);
|
|
1990
2082
|
const credential = await onCredentialResolved.wait({
|
|
1991
2083
|
timeout: params.timeout
|
|
1992
2084
|
});
|
|
@@ -1994,7 +2086,7 @@ var SpaceManager = class {
|
|
|
1994
2086
|
id: this._instanceId
|
|
1995
2087
|
}), {
|
|
1996
2088
|
F: __dxlog_file11,
|
|
1997
|
-
L:
|
|
2089
|
+
L: 168,
|
|
1998
2090
|
S: this,
|
|
1999
2091
|
C: (f, a) => f(...a)
|
|
2000
2092
|
});
|
|
@@ -2005,13 +2097,13 @@ var SpaceManager = class {
|
|
|
2005
2097
|
error: err
|
|
2006
2098
|
}), {
|
|
2007
2099
|
F: __dxlog_file11,
|
|
2008
|
-
L:
|
|
2100
|
+
L: 171,
|
|
2009
2101
|
S: this,
|
|
2010
2102
|
C: (f, a) => f(...a)
|
|
2011
2103
|
});
|
|
2012
2104
|
throw err;
|
|
2013
2105
|
} finally {
|
|
2014
|
-
await protocol.stop();
|
|
2106
|
+
await protocol.stop(ctx);
|
|
2015
2107
|
}
|
|
2016
2108
|
}
|
|
2017
2109
|
findSpaceByRootDocumentId(documentId) {
|
|
@@ -2064,4 +2156,4 @@ export {
|
|
|
2064
2156
|
SpaceProtocolSession,
|
|
2065
2157
|
SpaceManager
|
|
2066
2158
|
};
|
|
2067
|
-
//# sourceMappingURL=chunk-
|
|
2159
|
+
//# sourceMappingURL=chunk-ONB2OWBB.mjs.map
|