@dxos/echo-pipeline 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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-XGG76KKU.mjs → neutral/chunk-FE3UY2NU.mjs} +370 -446
- package/dist/lib/neutral/chunk-FE3UY2NU.mjs.map +7 -0
- package/dist/lib/{browser/chunk-WJJXJTNS.mjs → neutral/chunk-FJPXA75J.mjs} +7 -12
- package/dist/lib/neutral/chunk-FJPXA75J.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/filter/index.mjs +1 -2
- package/dist/lib/{browser → neutral}/index.mjs +2644 -1517
- 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 +92 -306
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/automerge/automerge-host.d.ts +39 -15
- 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 +5 -3
- package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +14 -9
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +17 -14
- 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/leveldb-storage-adapter.d.ts +4 -4
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +8 -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 +5 -5
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts +34 -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 +4 -3
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +6 -5
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/dist/types/src/db-host/echo-host.d.ts +45 -24
- 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 +17 -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 +13 -8
- package/dist/types/src/db-host/query-service.d.ts.map +1 -1
- package/dist/types/src/db-host/queue-data-source.d.ts +28 -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 +1 -0
- 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 +5 -5
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
- package/dist/types/src/filter/filter-match.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +2 -2
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/query/errors.d.ts +11 -15
- package/dist/types/src/query/errors.d.ts.map +1 -1
- package/dist/types/src/query/plan.d.ts +47 -7
- package/dist/types/src/query/plan.d.ts.map +1 -1
- package/dist/types/src/query/query-executor.d.ts +52 -9
- package/dist/types/src/query/query-executor.d.ts.map +1 -1
- package/dist/types/src/query/query-planner.d.ts +10 -1
- package/dist/types/src/query/query-planner.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 +2 -2
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +6 -6
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +5 -5
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +3 -3
- 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-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 +13 -13
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -46
- package/src/automerge/automerge-host.test.ts +37 -16
- package/src/automerge/automerge-host.ts +140 -63
- package/src/automerge/automerge-repo.test.ts +147 -30
- package/src/automerge/collection-synchronizer.test.ts +20 -13
- package/src/automerge/collection-synchronizer.ts +54 -19
- package/src/automerge/echo-network-adapter.ts +34 -22
- package/src/automerge/echo-replicator.ts +18 -14
- package/src/automerge/heads-store.ts +42 -3
- package/src/automerge/leveldb-storage-adapter.ts +4 -4
- package/src/automerge/mesh-echo-replicator-connection.ts +8 -8
- package/src/automerge/mesh-echo-replicator.ts +13 -10
- package/src/db-host/automerge-data-source.test.ts +292 -0
- package/src/db-host/automerge-data-source.ts +144 -0
- package/src/db-host/data-service.ts +10 -3
- package/src/db-host/documents-synchronizer.test.ts +73 -13
- package/src/db-host/documents-synchronizer.ts +51 -50
- package/src/db-host/echo-host.ts +177 -73
- package/src/db-host/index.ts +1 -0
- package/src/db-host/local-queue-service.ts +125 -0
- package/src/db-host/query-service.ts +25 -99
- package/src/db-host/queue-data-source.ts +132 -0
- package/src/db-host/queue-service.test.ts +145 -0
- package/src/db-host/space-state-manager.ts +5 -1
- package/src/db-host/stub.ts +33 -0
- package/src/edge/echo-edge-replicator.test.ts +4 -4
- package/src/edge/echo-edge-replicator.ts +51 -26
- package/src/filter/filter-match.test.ts +31 -25
- package/src/filter/filter-match.ts +8 -14
- package/src/metadata/metadata-store.ts +8 -5
- package/src/pipeline/pipeline.ts +2 -2
- package/src/query/errors.ts +2 -2
- package/src/query/plan.ts +57 -7
- package/src/query/query-executor.ts +917 -192
- package/src/query/query-planner.test.ts +834 -86
- package/src/query/query-planner.ts +218 -27
- package/src/space/admission-discovery-extension.ts +1 -1
- package/src/space/auth.ts +6 -6
- package/src/space/control-pipeline.ts +2 -2
- package/src/space/space-manager.ts +6 -6
- package/src/space/space-protocol.ts +11 -11
- package/src/space/space.ts +3 -3
- package/src/testing/index.ts +0 -2
- package/src/testing/test-network-adapter.ts +16 -3
- package/src/testing/test-replicator.ts +19 -18
- package/src/util.ts +7 -3
- package/dist/lib/browser/chunk-CGS2ULMK.mjs +0 -11
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-WJJXJTNS.mjs.map +0 -7
- package/dist/lib/browser/chunk-XGG76KKU.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-CHMJJ4DG.mjs +0 -2230
- package/dist/lib/node-esm/chunk-CHMJJ4DG.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/chunk-LEQ77KAT.mjs +0 -240
- package/dist/lib/node-esm/chunk-LEQ77KAT.mjs.map +0 -7
- package/dist/lib/node-esm/filter/index.mjs +0 -13
- package/dist/lib/node-esm/filter/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -5561
- 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 -805
- 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
|
@@ -61,19 +61,6 @@ import { DataCorruptionError, STORAGE_VERSION } from "@dxos/protocols";
|
|
|
61
61
|
import { schema as schema2 } from "@dxos/protocols/proto";
|
|
62
62
|
import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
63
63
|
import { ComplexMap as ComplexMap2, arrayToBuffer, forEachAsync, isNonNullable } from "@dxos/util";
|
|
64
|
-
function _define_property(obj, key, value) {
|
|
65
|
-
if (key in obj) {
|
|
66
|
-
Object.defineProperty(obj, key, {
|
|
67
|
-
value,
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
obj[key] = value;
|
|
74
|
-
}
|
|
75
|
-
return obj;
|
|
76
|
-
}
|
|
77
64
|
function _ts_decorate(decorators, target, key, desc) {
|
|
78
65
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
79
66
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -92,6 +79,21 @@ var emptyLargeSpaceMetadata = () => ({});
|
|
|
92
79
|
var EchoMetadata = schema2.getCodecForType("dxos.echo.metadata.EchoMetadata");
|
|
93
80
|
var LargeSpaceMetadata = schema2.getCodecForType("dxos.echo.metadata.LargeSpaceMetadata");
|
|
94
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;
|
|
94
|
+
constructor(directory) {
|
|
95
|
+
this._directory = directory;
|
|
96
|
+
}
|
|
95
97
|
get metadata() {
|
|
96
98
|
return this._metadata;
|
|
97
99
|
}
|
|
@@ -124,15 +126,20 @@ var MetadataStore = class {
|
|
|
124
126
|
C: (f, a) => f(...a)
|
|
125
127
|
});
|
|
126
128
|
if (fileLength < dataSize + 8) {
|
|
127
|
-
throw new DataCorruptionError(
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
throw new DataCorruptionError({
|
|
130
|
+
message: "Metadata size is smaller than expected.",
|
|
131
|
+
context: {
|
|
132
|
+
fileLength,
|
|
133
|
+
dataSize
|
|
134
|
+
}
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
137
|
const data = await file.read(8, dataSize);
|
|
133
138
|
const calculatedChecksum = CRC32.buf(data);
|
|
134
139
|
if (calculatedChecksum !== checksum) {
|
|
135
|
-
throw new DataCorruptionError(
|
|
140
|
+
throw new DataCorruptionError({
|
|
141
|
+
message: "Metadata checksum is invalid."
|
|
142
|
+
});
|
|
136
143
|
}
|
|
137
144
|
return codec2.decode(data);
|
|
138
145
|
} finally {
|
|
@@ -155,7 +162,7 @@ var MetadataStore = class {
|
|
|
155
162
|
checksum
|
|
156
163
|
}, {
|
|
157
164
|
F: __dxlog_file2,
|
|
158
|
-
L:
|
|
165
|
+
L: 129,
|
|
159
166
|
S: this,
|
|
160
167
|
C: (f, a) => f(...a)
|
|
161
168
|
});
|
|
@@ -181,15 +188,14 @@ var MetadataStore = class {
|
|
|
181
188
|
this._metadata = metadata;
|
|
182
189
|
}
|
|
183
190
|
this._metadata.spaces?.forEach((space) => {
|
|
184
|
-
|
|
185
|
-
(_space = space).state ?? (_space.state = SpaceState.SPACE_ACTIVE);
|
|
191
|
+
space.state ??= SpaceState.SPACE_ACTIVE;
|
|
186
192
|
});
|
|
187
193
|
} catch (err) {
|
|
188
194
|
log.error("failed to load metadata", {
|
|
189
195
|
err
|
|
190
196
|
}, {
|
|
191
197
|
F: __dxlog_file2,
|
|
192
|
-
L:
|
|
198
|
+
L: 161,
|
|
193
199
|
S: this,
|
|
194
200
|
C: (f, a) => f(...a)
|
|
195
201
|
});
|
|
@@ -206,7 +212,7 @@ var MetadataStore = class {
|
|
|
206
212
|
err
|
|
207
213
|
}, {
|
|
208
214
|
F: __dxlog_file2,
|
|
209
|
-
L:
|
|
215
|
+
L: 173,
|
|
210
216
|
S: this,
|
|
211
217
|
C: (f, a) => f(...a)
|
|
212
218
|
});
|
|
@@ -243,7 +249,7 @@ var MetadataStore = class {
|
|
|
243
249
|
err
|
|
244
250
|
}, {
|
|
245
251
|
F: __dxlog_file2,
|
|
246
|
-
L:
|
|
252
|
+
L: 215,
|
|
247
253
|
S: this,
|
|
248
254
|
C: (f, a) => f(...a)
|
|
249
255
|
});
|
|
@@ -264,7 +270,7 @@ var MetadataStore = class {
|
|
|
264
270
|
const space = this.spaces.find((space2) => space2.key.equals(spaceKey));
|
|
265
271
|
invariant2(space, "Space not found", {
|
|
266
272
|
F: __dxlog_file2,
|
|
267
|
-
L:
|
|
273
|
+
L: 237,
|
|
268
274
|
S: this,
|
|
269
275
|
A: [
|
|
270
276
|
"space",
|
|
@@ -294,7 +300,7 @@ var MetadataStore = class {
|
|
|
294
300
|
async clear() {
|
|
295
301
|
log("clearing all metadata", void 0, {
|
|
296
302
|
F: __dxlog_file2,
|
|
297
|
-
L:
|
|
303
|
+
L: 265,
|
|
298
304
|
S: this,
|
|
299
305
|
C: (f, a) => f(...a)
|
|
300
306
|
});
|
|
@@ -307,7 +313,7 @@ var MetadataStore = class {
|
|
|
307
313
|
async setIdentityRecord(record) {
|
|
308
314
|
invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
309
315
|
F: __dxlog_file2,
|
|
310
|
-
L:
|
|
316
|
+
L: 275,
|
|
311
317
|
S: this,
|
|
312
318
|
A: [
|
|
313
319
|
"!this._metadata.identity",
|
|
@@ -322,11 +328,10 @@ var MetadataStore = class {
|
|
|
322
328
|
return this._metadata.invitations ?? [];
|
|
323
329
|
}
|
|
324
330
|
async addInvitation(invitation) {
|
|
325
|
-
var _this__metadata;
|
|
326
331
|
if (this._metadata.invitations?.find((i) => i.invitationId === invitation.invitationId)) {
|
|
327
332
|
return;
|
|
328
333
|
}
|
|
329
|
-
(
|
|
334
|
+
(this._metadata.invitations ??= []).push(invitation);
|
|
330
335
|
await this._save();
|
|
331
336
|
await this.flush();
|
|
332
337
|
}
|
|
@@ -336,17 +341,16 @@ var MetadataStore = class {
|
|
|
336
341
|
await this.flush();
|
|
337
342
|
}
|
|
338
343
|
async addSpace(record) {
|
|
339
|
-
var _this__metadata;
|
|
340
344
|
invariant2(!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key)), "Cannot overwrite existing space in metadata", {
|
|
341
345
|
F: __dxlog_file2,
|
|
342
|
-
L:
|
|
346
|
+
L: 303,
|
|
343
347
|
S: this,
|
|
344
348
|
A: [
|
|
345
349
|
"!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key))",
|
|
346
350
|
"'Cannot overwrite existing space in metadata'"
|
|
347
351
|
]
|
|
348
352
|
});
|
|
349
|
-
(
|
|
353
|
+
(this._metadata.spaces ??= []).push(record);
|
|
350
354
|
await this._save();
|
|
351
355
|
await this.flush();
|
|
352
356
|
}
|
|
@@ -391,18 +395,6 @@ var MetadataStore = class {
|
|
|
391
395
|
await this._save();
|
|
392
396
|
await this.flush();
|
|
393
397
|
}
|
|
394
|
-
constructor(directory) {
|
|
395
|
-
_define_property(this, "_metadata", emptyEchoMetadata());
|
|
396
|
-
_define_property(this, "_spaceLargeMetadata", new ComplexMap2(PublicKey2.hash));
|
|
397
|
-
_define_property(this, "_metadataFile", void 0);
|
|
398
|
-
_define_property(this, "update", new Event());
|
|
399
|
-
_define_property(this, "_invitationCleanupCtx", new Context(void 0, {
|
|
400
|
-
F: __dxlog_file2,
|
|
401
|
-
L: 55
|
|
402
|
-
}));
|
|
403
|
-
_define_property(this, "_directory", void 0);
|
|
404
|
-
this._directory = directory;
|
|
405
|
-
}
|
|
406
398
|
};
|
|
407
399
|
_ts_decorate([
|
|
408
400
|
synchronized
|
|
@@ -426,19 +418,6 @@ import { Event as Event2 } from "@dxos/async";
|
|
|
426
418
|
import { timed } from "@dxos/debug";
|
|
427
419
|
import { log as log2 } from "@dxos/log";
|
|
428
420
|
import { Timeframe } from "@dxos/timeframe";
|
|
429
|
-
function _define_property2(obj, key, value) {
|
|
430
|
-
if (key in obj) {
|
|
431
|
-
Object.defineProperty(obj, key, {
|
|
432
|
-
value,
|
|
433
|
-
enumerable: true,
|
|
434
|
-
configurable: true,
|
|
435
|
-
writable: true
|
|
436
|
-
});
|
|
437
|
-
} else {
|
|
438
|
-
obj[key] = value;
|
|
439
|
-
}
|
|
440
|
-
return obj;
|
|
441
|
-
}
|
|
442
421
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
443
422
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
444
423
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -459,6 +438,13 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
|
459
438
|
index: index + 1
|
|
460
439
|
}));
|
|
461
440
|
var TimeframeClock = class {
|
|
441
|
+
_timeframe;
|
|
442
|
+
update = new Event2();
|
|
443
|
+
_pendingTimeframe;
|
|
444
|
+
constructor(_timeframe = new Timeframe()) {
|
|
445
|
+
this._timeframe = _timeframe;
|
|
446
|
+
this._pendingTimeframe = _timeframe;
|
|
447
|
+
}
|
|
462
448
|
/**
|
|
463
449
|
* Timeframe that was processed by ECHO.
|
|
464
450
|
*/
|
|
@@ -517,14 +503,6 @@ var TimeframeClock = class {
|
|
|
517
503
|
return Timeframe.dependencies(target, this._timeframe).isEmpty();
|
|
518
504
|
});
|
|
519
505
|
}
|
|
520
|
-
constructor(_timeframe = new Timeframe()) {
|
|
521
|
-
_define_property2(this, "_timeframe", void 0);
|
|
522
|
-
_define_property2(this, "update", void 0);
|
|
523
|
-
_define_property2(this, "_pendingTimeframe", void 0);
|
|
524
|
-
this._timeframe = _timeframe;
|
|
525
|
-
this.update = new Event2();
|
|
526
|
-
this._pendingTimeframe = _timeframe;
|
|
527
|
-
}
|
|
528
506
|
};
|
|
529
507
|
_ts_decorate2([
|
|
530
508
|
timed(5e3)
|
|
@@ -572,19 +550,6 @@ var createMessageSelector = (timeframeClock) => {
|
|
|
572
550
|
};
|
|
573
551
|
|
|
574
552
|
// src/pipeline/pipeline.ts
|
|
575
|
-
function _define_property3(obj, key, value) {
|
|
576
|
-
if (key in obj) {
|
|
577
|
-
Object.defineProperty(obj, key, {
|
|
578
|
-
value,
|
|
579
|
-
enumerable: true,
|
|
580
|
-
configurable: true,
|
|
581
|
-
writable: true
|
|
582
|
-
});
|
|
583
|
-
} else {
|
|
584
|
-
obj[key] = value;
|
|
585
|
-
}
|
|
586
|
-
return obj;
|
|
587
|
-
}
|
|
588
553
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
589
554
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
590
555
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -593,10 +558,40 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
593
558
|
}
|
|
594
559
|
var __dxlog_file5 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
595
560
|
var PipelineState = class {
|
|
561
|
+
_feeds;
|
|
562
|
+
_timeframeClock;
|
|
563
|
+
/**
|
|
564
|
+
* @internal
|
|
565
|
+
*/
|
|
566
|
+
_ctx = new Context2(void 0, {
|
|
567
|
+
F: __dxlog_file5,
|
|
568
|
+
L: 42
|
|
569
|
+
});
|
|
596
570
|
// TODO(dmaretskyi): Remove?. Avoid accessing `_timeframeClock` before constructor initialization.
|
|
597
571
|
get timeframeUpdate() {
|
|
598
572
|
return this._timeframeClock.update;
|
|
599
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;
|
|
591
|
+
constructor(_feeds, _timeframeClock) {
|
|
592
|
+
this._feeds = _feeds;
|
|
593
|
+
this._timeframeClock = _timeframeClock;
|
|
594
|
+
}
|
|
600
595
|
/**
|
|
601
596
|
* Latest theoretical timeframe based on the last mutation in each feed.
|
|
602
597
|
* NOTE: This might never be reached if the mutation dependencies
|
|
@@ -653,14 +648,14 @@ var PipelineState = class {
|
|
|
653
648
|
S: this,
|
|
654
649
|
C: (f, a) => f(...a)
|
|
655
650
|
});
|
|
656
|
-
this._reachedTargetPromise
|
|
651
|
+
this._reachedTargetPromise ??= Promise.race([
|
|
657
652
|
this._timeframeClock.update.waitForCondition(() => {
|
|
658
653
|
return Timeframe2.dependencies(this.targetTimeframe, this.timeframe).isEmpty();
|
|
659
654
|
}),
|
|
660
655
|
...breakOnStall ? [
|
|
661
656
|
this.stalled.discardParameter().waitForCount(1)
|
|
662
657
|
] : []
|
|
663
|
-
])
|
|
658
|
+
]);
|
|
664
659
|
let done = false;
|
|
665
660
|
if (timeout) {
|
|
666
661
|
return Promise.race([
|
|
@@ -691,27 +686,25 @@ var PipelineState = class {
|
|
|
691
686
|
return this._reachedTargetPromise;
|
|
692
687
|
}
|
|
693
688
|
}
|
|
694
|
-
constructor(_feeds, _timeframeClock) {
|
|
695
|
-
_define_property3(this, "_feeds", void 0);
|
|
696
|
-
_define_property3(this, "_timeframeClock", void 0);
|
|
697
|
-
_define_property3(this, "_ctx", void 0);
|
|
698
|
-
_define_property3(this, "stalled", void 0);
|
|
699
|
-
_define_property3(this, "_startTimeframe", void 0);
|
|
700
|
-
_define_property3(this, "_targetTimeframe", void 0);
|
|
701
|
-
_define_property3(this, "_reachedTargetPromise", void 0);
|
|
702
|
-
_define_property3(this, "_reachedTarget", void 0);
|
|
703
|
-
this._feeds = _feeds;
|
|
704
|
-
this._timeframeClock = _timeframeClock;
|
|
705
|
-
this._ctx = new Context2(void 0, {
|
|
706
|
-
F: __dxlog_file5,
|
|
707
|
-
L: 42
|
|
708
|
-
});
|
|
709
|
-
this.stalled = new Event3();
|
|
710
|
-
this._startTimeframe = new Timeframe2();
|
|
711
|
-
this._reachedTarget = false;
|
|
712
|
-
}
|
|
713
689
|
};
|
|
714
690
|
var Pipeline = class {
|
|
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;
|
|
715
708
|
get state() {
|
|
716
709
|
return this._state;
|
|
717
710
|
}
|
|
@@ -986,20 +979,6 @@ var Pipeline = class {
|
|
|
986
979
|
await this._feedSetIterator.addFeed(feed);
|
|
987
980
|
}
|
|
988
981
|
}
|
|
989
|
-
constructor() {
|
|
990
|
-
_define_property3(this, "_timeframeClock", new TimeframeClock(new Timeframe2()));
|
|
991
|
-
_define_property3(this, "_feeds", new ComplexMap3(PublicKey3.hash));
|
|
992
|
-
_define_property3(this, "_state", new PipelineState(this._feeds, this._timeframeClock));
|
|
993
|
-
_define_property3(this, "_processingTrigger", new Trigger().wake());
|
|
994
|
-
_define_property3(this, "_pauseTrigger", new Trigger().wake());
|
|
995
|
-
_define_property3(this, "_downloads", new ComplexMap3((value) => PublicKey3.hash(value.key)));
|
|
996
|
-
_define_property3(this, "_feedSetIterator", void 0);
|
|
997
|
-
_define_property3(this, "_writer", void 0);
|
|
998
|
-
_define_property3(this, "_isStopping", false);
|
|
999
|
-
_define_property3(this, "_isStarted", false);
|
|
1000
|
-
_define_property3(this, "_isBeingConsumed", false);
|
|
1001
|
-
_define_property3(this, "_isPaused", false);
|
|
1002
|
-
}
|
|
1003
982
|
};
|
|
1004
983
|
_ts_decorate3([
|
|
1005
984
|
synchronized2
|
|
@@ -1025,27 +1004,39 @@ import { invariant as invariant5 } from "@dxos/invariant";
|
|
|
1025
1004
|
import { log as log5 } from "@dxos/log";
|
|
1026
1005
|
import { schema as schema3 } from "@dxos/protocols/proto";
|
|
1027
1006
|
import { RpcExtension } from "@dxos/teleport";
|
|
1028
|
-
function _define_property4(obj, key, value) {
|
|
1029
|
-
if (key in obj) {
|
|
1030
|
-
Object.defineProperty(obj, key, {
|
|
1031
|
-
value,
|
|
1032
|
-
enumerable: true,
|
|
1033
|
-
configurable: true,
|
|
1034
|
-
writable: true
|
|
1035
|
-
});
|
|
1036
|
-
} else {
|
|
1037
|
-
obj[key] = value;
|
|
1038
|
-
}
|
|
1039
|
-
return obj;
|
|
1040
|
-
}
|
|
1041
1007
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
1042
1008
|
var AuthExtension = class extends RpcExtension {
|
|
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) {
|
|
1024
|
+
super({
|
|
1025
|
+
requested: {
|
|
1026
|
+
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
1027
|
+
},
|
|
1028
|
+
exposed: {
|
|
1029
|
+
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
1030
|
+
},
|
|
1031
|
+
timeout: 60 * 1e3
|
|
1032
|
+
}), this._authProps = _authProps;
|
|
1033
|
+
}
|
|
1043
1034
|
async getHandlers() {
|
|
1044
1035
|
return {
|
|
1045
1036
|
AuthService: {
|
|
1046
1037
|
authenticate: async ({ challenge }) => {
|
|
1047
1038
|
try {
|
|
1048
|
-
const credential = await this.
|
|
1039
|
+
const credential = await this._authProps.provider(challenge);
|
|
1049
1040
|
if (!credential) {
|
|
1050
1041
|
throw new Error("auth rejected");
|
|
1051
1042
|
}
|
|
@@ -1082,7 +1073,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1082
1073
|
"'invalid credential'"
|
|
1083
1074
|
]
|
|
1084
1075
|
});
|
|
1085
|
-
const success = await this.
|
|
1076
|
+
const success = await this._authProps.verifier(challenge, credential);
|
|
1086
1077
|
invariant5(success, "credential not verified", {
|
|
1087
1078
|
F: __dxlog_file6,
|
|
1088
1079
|
L: 71,
|
|
@@ -1092,7 +1083,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1092
1083
|
"'credential not verified'"
|
|
1093
1084
|
]
|
|
1094
1085
|
});
|
|
1095
|
-
runInContext(this._ctx, () => this.
|
|
1086
|
+
runInContext(this._ctx, () => this._authProps.onAuthSuccess());
|
|
1096
1087
|
} catch (err) {
|
|
1097
1088
|
log5("auth failed", err, {
|
|
1098
1089
|
F: __dxlog_file6,
|
|
@@ -1101,7 +1092,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1101
1092
|
C: (f, a) => f(...a)
|
|
1102
1093
|
});
|
|
1103
1094
|
this.close();
|
|
1104
|
-
this.
|
|
1095
|
+
this._authProps.onAuthFailure();
|
|
1105
1096
|
}
|
|
1106
1097
|
});
|
|
1107
1098
|
}
|
|
@@ -1113,29 +1104,6 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1113
1104
|
await this._ctx.dispose();
|
|
1114
1105
|
await super.onAbort();
|
|
1115
1106
|
}
|
|
1116
|
-
constructor(_authParams) {
|
|
1117
|
-
super({
|
|
1118
|
-
requested: {
|
|
1119
|
-
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
1120
|
-
},
|
|
1121
|
-
exposed: {
|
|
1122
|
-
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
1123
|
-
},
|
|
1124
|
-
timeout: 60 * 1e3
|
|
1125
|
-
}), _define_property4(this, "_authParams", void 0), _define_property4(this, "_ctx", void 0), this._authParams = _authParams, this._ctx = new Context3({
|
|
1126
|
-
onError: (err) => {
|
|
1127
|
-
log5.catch(err, void 0, {
|
|
1128
|
-
F: __dxlog_file6,
|
|
1129
|
-
L: 28,
|
|
1130
|
-
S: this,
|
|
1131
|
-
C: (f, a) => f(...a)
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
}, {
|
|
1135
|
-
F: __dxlog_file6,
|
|
1136
|
-
L: 26
|
|
1137
|
-
});
|
|
1138
|
-
}
|
|
1139
1107
|
};
|
|
1140
1108
|
|
|
1141
1109
|
// src/space/space.ts
|
|
@@ -1157,19 +1125,6 @@ import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
|
1157
1125
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
1158
1126
|
import { TimeSeriesCounter, TimeUsageCounter, trace } from "@dxos/tracing";
|
|
1159
1127
|
import { Callback, tracer } from "@dxos/util";
|
|
1160
|
-
function _define_property5(obj, key, value) {
|
|
1161
|
-
if (key in obj) {
|
|
1162
|
-
Object.defineProperty(obj, key, {
|
|
1163
|
-
value,
|
|
1164
|
-
enumerable: true,
|
|
1165
|
-
configurable: true,
|
|
1166
|
-
writable: true
|
|
1167
|
-
});
|
|
1168
|
-
} else {
|
|
1169
|
-
obj[key] = value;
|
|
1170
|
-
}
|
|
1171
|
-
return obj;
|
|
1172
|
-
}
|
|
1173
1128
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
1174
1129
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1175
1130
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1181,6 +1136,69 @@ var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
|
1181
1136
|
var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
1182
1137
|
var USE_SNAPSHOTS = true;
|
|
1183
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
|
+
});
|
|
1160
|
+
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1161
|
+
this._spaceKey = spaceKey;
|
|
1162
|
+
this._metadata = metadataStore;
|
|
1163
|
+
this._pipeline = new Pipeline();
|
|
1164
|
+
void this._pipeline.addFeed(genesisFeed);
|
|
1165
|
+
this._spaceStateMachine = new SpaceStateMachine(spaceKey);
|
|
1166
|
+
this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
|
|
1167
|
+
log6("feed admitted", {
|
|
1168
|
+
key: info.key
|
|
1169
|
+
}, {
|
|
1170
|
+
F: __dxlog_file7,
|
|
1171
|
+
L: 82,
|
|
1172
|
+
S: this,
|
|
1173
|
+
C: (f, a) => f(...a)
|
|
1174
|
+
});
|
|
1175
|
+
if (info.assertion.designation === AdmittedFeed.Designation.CONTROL && !info.key.equals(genesisFeed.key)) {
|
|
1176
|
+
scheduleMicroTask(this._ctx, async () => {
|
|
1177
|
+
try {
|
|
1178
|
+
const feed = await feedProvider(info.key);
|
|
1179
|
+
if (this._ctx.disposed) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (!this._pipeline.hasFeed(feed.key)) {
|
|
1183
|
+
await this._pipeline.addFeed(feed);
|
|
1184
|
+
}
|
|
1185
|
+
} catch (err) {
|
|
1186
|
+
log6.catch(err, void 0, {
|
|
1187
|
+
F: __dxlog_file7,
|
|
1188
|
+
L: 96,
|
|
1189
|
+
S: this,
|
|
1190
|
+
C: (f, a) => f(...a)
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
await this.onFeedAdmitted.callIfSet(info);
|
|
1196
|
+
});
|
|
1197
|
+
this.onMemberRoleChanged = this._spaceStateMachine.onMemberRoleChanged;
|
|
1198
|
+
this.onCredentialProcessed = this._spaceStateMachine.onCredentialProcessed;
|
|
1199
|
+
this.onDelegatedInvitation = this._spaceStateMachine.onDelegatedInvitation;
|
|
1200
|
+
this.onDelegatedInvitationRemoved = this._spaceStateMachine.onDelegatedInvitationRemoved;
|
|
1201
|
+
}
|
|
1184
1202
|
get spaceState() {
|
|
1185
1203
|
return this._spaceStateMachine;
|
|
1186
1204
|
}
|
|
@@ -1351,69 +1369,6 @@ var ControlPipeline = class {
|
|
|
1351
1369
|
});
|
|
1352
1370
|
}
|
|
1353
1371
|
}
|
|
1354
|
-
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1355
|
-
_define_property5(this, "_ctx", new Context4(void 0, {
|
|
1356
|
-
F: __dxlog_file7,
|
|
1357
|
-
L: 47
|
|
1358
|
-
}));
|
|
1359
|
-
_define_property5(this, "_pipeline", void 0);
|
|
1360
|
-
_define_property5(this, "_spaceStateMachine", void 0);
|
|
1361
|
-
_define_property5(this, "_spaceKey", void 0);
|
|
1362
|
-
_define_property5(this, "_metadata", void 0);
|
|
1363
|
-
_define_property5(this, "_targetTimeframe", void 0);
|
|
1364
|
-
_define_property5(this, "_lastTimeframeSaveTime", Date.now());
|
|
1365
|
-
_define_property5(this, "onFeedAdmitted", new Callback());
|
|
1366
|
-
_define_property5(this, "onMemberRoleChanged", void 0);
|
|
1367
|
-
_define_property5(this, "onCredentialProcessed", void 0);
|
|
1368
|
-
_define_property5(this, "onDelegatedInvitation", void 0);
|
|
1369
|
-
_define_property5(this, "onDelegatedInvitationRemoved", void 0);
|
|
1370
|
-
_define_property5(this, "_usage", new TimeUsageCounter());
|
|
1371
|
-
_define_property5(this, "_mutations", new TimeSeriesCounter());
|
|
1372
|
-
_define_property5(this, "_snapshotTask", new DeferredTask(this._ctx, async () => {
|
|
1373
|
-
await sleepWithContext2(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1374
|
-
await this._saveSnapshot();
|
|
1375
|
-
}));
|
|
1376
|
-
this._spaceKey = spaceKey;
|
|
1377
|
-
this._metadata = metadataStore;
|
|
1378
|
-
this._pipeline = new Pipeline();
|
|
1379
|
-
void this._pipeline.addFeed(genesisFeed);
|
|
1380
|
-
this._spaceStateMachine = new SpaceStateMachine(spaceKey);
|
|
1381
|
-
this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
|
|
1382
|
-
log6("feed admitted", {
|
|
1383
|
-
key: info.key
|
|
1384
|
-
}, {
|
|
1385
|
-
F: __dxlog_file7,
|
|
1386
|
-
L: 82,
|
|
1387
|
-
S: this,
|
|
1388
|
-
C: (f, a) => f(...a)
|
|
1389
|
-
});
|
|
1390
|
-
if (info.assertion.designation === AdmittedFeed.Designation.CONTROL && !info.key.equals(genesisFeed.key)) {
|
|
1391
|
-
scheduleMicroTask(this._ctx, async () => {
|
|
1392
|
-
try {
|
|
1393
|
-
const feed = await feedProvider(info.key);
|
|
1394
|
-
if (this._ctx.disposed) {
|
|
1395
|
-
return;
|
|
1396
|
-
}
|
|
1397
|
-
if (!this._pipeline.hasFeed(feed.key)) {
|
|
1398
|
-
await this._pipeline.addFeed(feed);
|
|
1399
|
-
}
|
|
1400
|
-
} catch (err) {
|
|
1401
|
-
log6.catch(err, void 0, {
|
|
1402
|
-
F: __dxlog_file7,
|
|
1403
|
-
L: 96,
|
|
1404
|
-
S: this,
|
|
1405
|
-
C: (f, a) => f(...a)
|
|
1406
|
-
});
|
|
1407
|
-
}
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
await this.onFeedAdmitted.callIfSet(info);
|
|
1411
|
-
});
|
|
1412
|
-
this.onMemberRoleChanged = this._spaceStateMachine.onMemberRoleChanged;
|
|
1413
|
-
this.onCredentialProcessed = this._spaceStateMachine.onCredentialProcessed;
|
|
1414
|
-
this.onDelegatedInvitation = this._spaceStateMachine.onDelegatedInvitation;
|
|
1415
|
-
this.onDelegatedInvitationRemoved = this._spaceStateMachine.onDelegatedInvitationRemoved;
|
|
1416
|
-
}
|
|
1417
1372
|
};
|
|
1418
1373
|
_ts_decorate4([
|
|
1419
1374
|
trace.metricsCounter()
|
|
@@ -1450,19 +1405,6 @@ var getSnapshotLoggerContext = (snapshot) => {
|
|
|
1450
1405
|
};
|
|
1451
1406
|
|
|
1452
1407
|
// src/space/space.ts
|
|
1453
|
-
function _define_property6(obj, key, value) {
|
|
1454
|
-
if (key in obj) {
|
|
1455
|
-
Object.defineProperty(obj, key, {
|
|
1456
|
-
value,
|
|
1457
|
-
enumerable: true,
|
|
1458
|
-
configurable: true,
|
|
1459
|
-
writable: true
|
|
1460
|
-
});
|
|
1461
|
-
} else {
|
|
1462
|
-
obj[key] = value;
|
|
1463
|
-
}
|
|
1464
|
-
return obj;
|
|
1465
|
-
}
|
|
1466
1408
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1467
1409
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1468
1410
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1471,6 +1413,97 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1471
1413
|
}
|
|
1472
1414
|
var __dxlog_file8 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
1473
1415
|
var Space = class extends Resource {
|
|
1416
|
+
onCredentialProcessed = new Callback2();
|
|
1417
|
+
stateUpdate = new Event4();
|
|
1418
|
+
protocol;
|
|
1419
|
+
_id;
|
|
1420
|
+
_key;
|
|
1421
|
+
_genesisFeedKey;
|
|
1422
|
+
_feedProvider;
|
|
1423
|
+
_controlPipeline;
|
|
1424
|
+
_controlFeed;
|
|
1425
|
+
_dataFeed;
|
|
1426
|
+
constructor(params) {
|
|
1427
|
+
super();
|
|
1428
|
+
invariant6(params.spaceKey && params.feedProvider, void 0, {
|
|
1429
|
+
F: __dxlog_file8,
|
|
1430
|
+
L: 73,
|
|
1431
|
+
S: this,
|
|
1432
|
+
A: [
|
|
1433
|
+
"params.spaceKey && params.feedProvider",
|
|
1434
|
+
""
|
|
1435
|
+
]
|
|
1436
|
+
});
|
|
1437
|
+
this._id = params.id;
|
|
1438
|
+
this._key = params.spaceKey;
|
|
1439
|
+
this._genesisFeedKey = params.genesisFeed.key;
|
|
1440
|
+
this._feedProvider = params.feedProvider;
|
|
1441
|
+
this._controlPipeline = new ControlPipeline({
|
|
1442
|
+
spaceKey: params.spaceKey,
|
|
1443
|
+
genesisFeed: params.genesisFeed,
|
|
1444
|
+
feedProvider: params.feedProvider,
|
|
1445
|
+
metadataStore: params.metadataStore
|
|
1446
|
+
});
|
|
1447
|
+
this._controlPipeline.onFeedAdmitted.set(async (info) => {
|
|
1448
|
+
const sparse = info.assertion.designation === AdmittedFeed2.Designation.DATA;
|
|
1449
|
+
if (!info.key.equals(params.genesisFeed.key)) {
|
|
1450
|
+
scheduleMicroTask2(this._ctx, async () => {
|
|
1451
|
+
await this.protocol.addFeed(await params.feedProvider(info.key, {
|
|
1452
|
+
sparse
|
|
1453
|
+
}));
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
this._controlPipeline.onCredentialProcessed.set(async (credential) => {
|
|
1458
|
+
await this.onCredentialProcessed.callIfSet(credential);
|
|
1459
|
+
log7("onCredentialProcessed", {
|
|
1460
|
+
credential
|
|
1461
|
+
}, {
|
|
1462
|
+
F: __dxlog_file8,
|
|
1463
|
+
L: 100,
|
|
1464
|
+
S: this,
|
|
1465
|
+
C: (f, a) => f(...a)
|
|
1466
|
+
});
|
|
1467
|
+
this.stateUpdate.emit();
|
|
1468
|
+
});
|
|
1469
|
+
this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
|
|
1470
|
+
log7("onDelegatedInvitation", {
|
|
1471
|
+
invitation
|
|
1472
|
+
}, {
|
|
1473
|
+
F: __dxlog_file8,
|
|
1474
|
+
L: 104,
|
|
1475
|
+
S: this,
|
|
1476
|
+
C: (f, a) => f(...a)
|
|
1477
|
+
});
|
|
1478
|
+
await params.onDelegatedInvitationStatusChange(invitation, true);
|
|
1479
|
+
});
|
|
1480
|
+
this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
|
|
1481
|
+
log7("onDelegatedInvitationRemoved", {
|
|
1482
|
+
invitation
|
|
1483
|
+
}, {
|
|
1484
|
+
F: __dxlog_file8,
|
|
1485
|
+
L: 108,
|
|
1486
|
+
S: this,
|
|
1487
|
+
C: (f, a) => f(...a)
|
|
1488
|
+
});
|
|
1489
|
+
await params.onDelegatedInvitationStatusChange(invitation, false);
|
|
1490
|
+
});
|
|
1491
|
+
this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
|
|
1492
|
+
log7("onMemberRoleChanged", () => ({
|
|
1493
|
+
changedMembers: changedMembers.map((m) => [
|
|
1494
|
+
m.key,
|
|
1495
|
+
m.role
|
|
1496
|
+
])
|
|
1497
|
+
}), {
|
|
1498
|
+
F: __dxlog_file8,
|
|
1499
|
+
L: 112,
|
|
1500
|
+
S: this,
|
|
1501
|
+
C: (f, a) => f(...a)
|
|
1502
|
+
});
|
|
1503
|
+
await params.onMemberRolesChanged(changedMembers);
|
|
1504
|
+
});
|
|
1505
|
+
this.protocol = params.protocol;
|
|
1506
|
+
}
|
|
1474
1507
|
get id() {
|
|
1475
1508
|
return this._id;
|
|
1476
1509
|
}
|
|
@@ -1574,87 +1607,6 @@ var Space = class extends Resource {
|
|
|
1574
1607
|
C: (f, a) => f(...a)
|
|
1575
1608
|
});
|
|
1576
1609
|
}
|
|
1577
|
-
constructor(params) {
|
|
1578
|
-
super(), _define_property6(this, "onCredentialProcessed", new Callback2()), _define_property6(this, "stateUpdate", new Event4()), _define_property6(this, "protocol", void 0), _define_property6(this, "_id", void 0), _define_property6(this, "_key", void 0), _define_property6(this, "_genesisFeedKey", void 0), _define_property6(this, "_feedProvider", void 0), _define_property6(this, "_controlPipeline", void 0), _define_property6(this, "_controlFeed", void 0), _define_property6(this, "_dataFeed", void 0);
|
|
1579
|
-
invariant6(params.spaceKey && params.feedProvider, void 0, {
|
|
1580
|
-
F: __dxlog_file8,
|
|
1581
|
-
L: 73,
|
|
1582
|
-
S: this,
|
|
1583
|
-
A: [
|
|
1584
|
-
"params.spaceKey && params.feedProvider",
|
|
1585
|
-
""
|
|
1586
|
-
]
|
|
1587
|
-
});
|
|
1588
|
-
this._id = params.id;
|
|
1589
|
-
this._key = params.spaceKey;
|
|
1590
|
-
this._genesisFeedKey = params.genesisFeed.key;
|
|
1591
|
-
this._feedProvider = params.feedProvider;
|
|
1592
|
-
this._controlPipeline = new ControlPipeline({
|
|
1593
|
-
spaceKey: params.spaceKey,
|
|
1594
|
-
genesisFeed: params.genesisFeed,
|
|
1595
|
-
feedProvider: params.feedProvider,
|
|
1596
|
-
metadataStore: params.metadataStore
|
|
1597
|
-
});
|
|
1598
|
-
this._controlPipeline.onFeedAdmitted.set(async (info) => {
|
|
1599
|
-
const sparse = info.assertion.designation === AdmittedFeed2.Designation.DATA;
|
|
1600
|
-
if (!info.key.equals(params.genesisFeed.key)) {
|
|
1601
|
-
scheduleMicroTask2(this._ctx, async () => {
|
|
1602
|
-
await this.protocol.addFeed(await params.feedProvider(info.key, {
|
|
1603
|
-
sparse
|
|
1604
|
-
}));
|
|
1605
|
-
});
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
this._controlPipeline.onCredentialProcessed.set(async (credential) => {
|
|
1609
|
-
await this.onCredentialProcessed.callIfSet(credential);
|
|
1610
|
-
log7("onCredentialProcessed", {
|
|
1611
|
-
credential
|
|
1612
|
-
}, {
|
|
1613
|
-
F: __dxlog_file8,
|
|
1614
|
-
L: 100,
|
|
1615
|
-
S: this,
|
|
1616
|
-
C: (f, a) => f(...a)
|
|
1617
|
-
});
|
|
1618
|
-
this.stateUpdate.emit();
|
|
1619
|
-
});
|
|
1620
|
-
this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
|
|
1621
|
-
log7("onDelegatedInvitation", {
|
|
1622
|
-
invitation
|
|
1623
|
-
}, {
|
|
1624
|
-
F: __dxlog_file8,
|
|
1625
|
-
L: 104,
|
|
1626
|
-
S: this,
|
|
1627
|
-
C: (f, a) => f(...a)
|
|
1628
|
-
});
|
|
1629
|
-
await params.onDelegatedInvitationStatusChange(invitation, true);
|
|
1630
|
-
});
|
|
1631
|
-
this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
|
|
1632
|
-
log7("onDelegatedInvitationRemoved", {
|
|
1633
|
-
invitation
|
|
1634
|
-
}, {
|
|
1635
|
-
F: __dxlog_file8,
|
|
1636
|
-
L: 108,
|
|
1637
|
-
S: this,
|
|
1638
|
-
C: (f, a) => f(...a)
|
|
1639
|
-
});
|
|
1640
|
-
await params.onDelegatedInvitationStatusChange(invitation, false);
|
|
1641
|
-
});
|
|
1642
|
-
this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
|
|
1643
|
-
log7("onMemberRoleChanged", () => ({
|
|
1644
|
-
changedMembers: changedMembers.map((m) => [
|
|
1645
|
-
m.key,
|
|
1646
|
-
m.role
|
|
1647
|
-
])
|
|
1648
|
-
}), {
|
|
1649
|
-
F: __dxlog_file8,
|
|
1650
|
-
L: 112,
|
|
1651
|
-
S: this,
|
|
1652
|
-
C: (f, a) => f(...a)
|
|
1653
|
-
});
|
|
1654
|
-
await params.onMemberRolesChanged(changedMembers);
|
|
1655
|
-
});
|
|
1656
|
-
this.protocol = params.protocol;
|
|
1657
|
-
}
|
|
1658
1610
|
};
|
|
1659
1611
|
_ts_decorate5([
|
|
1660
1612
|
trace2.info()
|
|
@@ -1690,21 +1642,21 @@ import { Context as Context5 } from "@dxos/context";
|
|
|
1690
1642
|
import { ProtocolError } from "@dxos/protocols";
|
|
1691
1643
|
import { schema as schema4 } from "@dxos/protocols/proto";
|
|
1692
1644
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1693
|
-
function _define_property7(obj, key, value) {
|
|
1694
|
-
if (key in obj) {
|
|
1695
|
-
Object.defineProperty(obj, key, {
|
|
1696
|
-
value,
|
|
1697
|
-
enumerable: true,
|
|
1698
|
-
configurable: true,
|
|
1699
|
-
writable: true
|
|
1700
|
-
});
|
|
1701
|
-
} else {
|
|
1702
|
-
obj[key] = value;
|
|
1703
|
-
}
|
|
1704
|
-
return obj;
|
|
1705
|
-
}
|
|
1706
1645
|
var __dxlog_file9 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
|
|
1707
1646
|
var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
1647
|
+
_request;
|
|
1648
|
+
_onResult;
|
|
1649
|
+
_ctx = new Context5(void 0, {
|
|
1650
|
+
F: __dxlog_file9,
|
|
1651
|
+
L: 26
|
|
1652
|
+
});
|
|
1653
|
+
constructor(_request, _onResult) {
|
|
1654
|
+
super({
|
|
1655
|
+
requested: {
|
|
1656
|
+
AdmissionDiscoveryService: schema4.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1657
|
+
}
|
|
1658
|
+
}), this._request = _request, this._onResult = _onResult;
|
|
1659
|
+
}
|
|
1708
1660
|
async getHandlers() {
|
|
1709
1661
|
return {};
|
|
1710
1662
|
}
|
|
@@ -1725,25 +1677,28 @@ var CredentialRetrieverExtension = class extends RpcExtension2 {
|
|
|
1725
1677
|
async onAbort() {
|
|
1726
1678
|
await this._ctx.dispose();
|
|
1727
1679
|
}
|
|
1728
|
-
|
|
1680
|
+
};
|
|
1681
|
+
var CredentialServerExtension = class extends RpcExtension2 {
|
|
1682
|
+
_space;
|
|
1683
|
+
constructor(_space) {
|
|
1729
1684
|
super({
|
|
1730
|
-
|
|
1685
|
+
exposed: {
|
|
1731
1686
|
AdmissionDiscoveryService: schema4.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1732
1687
|
}
|
|
1733
|
-
}),
|
|
1734
|
-
F: __dxlog_file9,
|
|
1735
|
-
L: 26
|
|
1736
|
-
});
|
|
1688
|
+
}), this._space = _space;
|
|
1737
1689
|
}
|
|
1738
|
-
};
|
|
1739
|
-
var CredentialServerExtension = class extends RpcExtension2 {
|
|
1740
1690
|
async getHandlers() {
|
|
1741
1691
|
return {
|
|
1742
1692
|
AdmissionDiscoveryService: {
|
|
1743
1693
|
getAdmissionCredential: async (request) => {
|
|
1744
1694
|
const memberInfo = this._space.spaceState.members.get(request.memberKey);
|
|
1745
1695
|
if (!memberInfo?.credential) {
|
|
1746
|
-
throw new ProtocolError(
|
|
1696
|
+
throw new ProtocolError({
|
|
1697
|
+
message: "Space member not found.",
|
|
1698
|
+
context: {
|
|
1699
|
+
...request
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1747
1702
|
}
|
|
1748
1703
|
return {
|
|
1749
1704
|
admissionCredential: memberInfo.credential
|
|
@@ -1752,13 +1707,6 @@ var CredentialServerExtension = class extends RpcExtension2 {
|
|
|
1752
1707
|
}
|
|
1753
1708
|
};
|
|
1754
1709
|
}
|
|
1755
|
-
constructor(_space) {
|
|
1756
|
-
super({
|
|
1757
|
-
exposed: {
|
|
1758
|
-
AdmissionDiscoveryService: schema4.getService("dxos.mesh.teleport.AdmissionDiscoveryService")
|
|
1759
|
-
}
|
|
1760
|
-
}), _define_property7(this, "_space", void 0), this._space = _space;
|
|
1761
|
-
}
|
|
1762
1710
|
};
|
|
1763
1711
|
|
|
1764
1712
|
// src/space/space-protocol.ts
|
|
@@ -1771,19 +1719,6 @@ import { BlobSync } from "@dxos/teleport-extension-object-sync";
|
|
|
1771
1719
|
import { ReplicatorExtension } from "@dxos/teleport-extension-replicator";
|
|
1772
1720
|
import { trace as trace3 } from "@dxos/tracing";
|
|
1773
1721
|
import { CallbackCollection, ComplexMap as ComplexMap4 } from "@dxos/util";
|
|
1774
|
-
function _define_property8(obj, key, value) {
|
|
1775
|
-
if (key in obj) {
|
|
1776
|
-
Object.defineProperty(obj, key, {
|
|
1777
|
-
value,
|
|
1778
|
-
enumerable: true,
|
|
1779
|
-
configurable: true,
|
|
1780
|
-
writable: true
|
|
1781
|
-
});
|
|
1782
|
-
} else {
|
|
1783
|
-
obj[key] = value;
|
|
1784
|
-
}
|
|
1785
|
-
return obj;
|
|
1786
|
-
}
|
|
1787
1722
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
1788
1723
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1789
1724
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1794,6 +1729,24 @@ var __dxlog_file10 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/
|
|
|
1794
1729
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1795
1730
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1796
1731
|
var SpaceProtocol = class {
|
|
1732
|
+
_networkManager;
|
|
1733
|
+
_swarmIdentity;
|
|
1734
|
+
_onSessionAuth;
|
|
1735
|
+
_onAuthFailure;
|
|
1736
|
+
blobSync;
|
|
1737
|
+
_disableP2pReplication;
|
|
1738
|
+
_topic;
|
|
1739
|
+
_spaceKey;
|
|
1740
|
+
_feeds = /* @__PURE__ */ new Set();
|
|
1741
|
+
_sessions = new ComplexMap4(PublicKey5.hash);
|
|
1742
|
+
// TODO(burdon): Move to config (with sensible defaults).
|
|
1743
|
+
_topology = new MMSTTopology({
|
|
1744
|
+
originateConnections: 4,
|
|
1745
|
+
maxPeers: 10,
|
|
1746
|
+
sampleSize: 20
|
|
1747
|
+
});
|
|
1748
|
+
_connection;
|
|
1749
|
+
feedAdded = new CallbackCollection();
|
|
1797
1750
|
get sessions() {
|
|
1798
1751
|
return this._sessions;
|
|
1799
1752
|
}
|
|
@@ -1803,6 +1756,18 @@ var SpaceProtocol = class {
|
|
|
1803
1756
|
get _ownPeerKey() {
|
|
1804
1757
|
return this._swarmIdentity.peerKey;
|
|
1805
1758
|
}
|
|
1759
|
+
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore, disableP2pReplication }) {
|
|
1760
|
+
this._spaceKey = topic;
|
|
1761
|
+
this._networkManager = networkManager;
|
|
1762
|
+
this._swarmIdentity = swarmIdentity;
|
|
1763
|
+
this._onSessionAuth = onSessionAuth;
|
|
1764
|
+
this._onAuthFailure = onAuthFailure;
|
|
1765
|
+
this.blobSync = new BlobSync({
|
|
1766
|
+
blobStore
|
|
1767
|
+
});
|
|
1768
|
+
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
1769
|
+
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1770
|
+
}
|
|
1806
1771
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
1807
1772
|
async addFeed(feed) {
|
|
1808
1773
|
log8("addFeed", {
|
|
@@ -1868,51 +1833,22 @@ var SpaceProtocol = class {
|
|
|
1868
1833
|
}
|
|
1869
1834
|
}
|
|
1870
1835
|
_createProtocolProvider(credentials) {
|
|
1871
|
-
return (
|
|
1836
|
+
return (wireProps) => {
|
|
1872
1837
|
const session = new SpaceProtocolSession({
|
|
1873
|
-
|
|
1838
|
+
wireProps,
|
|
1874
1839
|
swarmIdentity: this._swarmIdentity,
|
|
1875
1840
|
onSessionAuth: this._onSessionAuth,
|
|
1876
1841
|
onAuthFailure: this._onAuthFailure,
|
|
1877
1842
|
blobSync: this.blobSync,
|
|
1878
1843
|
disableP2pReplication: this._disableP2pReplication
|
|
1879
1844
|
});
|
|
1880
|
-
this._sessions.set(
|
|
1845
|
+
this._sessions.set(wireProps.remotePeerId, session);
|
|
1881
1846
|
for (const feed of this._feeds) {
|
|
1882
1847
|
session.replicator.addFeed(feed);
|
|
1883
1848
|
}
|
|
1884
1849
|
return session;
|
|
1885
1850
|
};
|
|
1886
1851
|
}
|
|
1887
|
-
constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore, disableP2pReplication }) {
|
|
1888
|
-
_define_property8(this, "_networkManager", void 0);
|
|
1889
|
-
_define_property8(this, "_swarmIdentity", void 0);
|
|
1890
|
-
_define_property8(this, "_onSessionAuth", void 0);
|
|
1891
|
-
_define_property8(this, "_onAuthFailure", void 0);
|
|
1892
|
-
_define_property8(this, "blobSync", void 0);
|
|
1893
|
-
_define_property8(this, "_disableP2pReplication", void 0);
|
|
1894
|
-
_define_property8(this, "_topic", void 0);
|
|
1895
|
-
_define_property8(this, "_spaceKey", void 0);
|
|
1896
|
-
_define_property8(this, "_feeds", /* @__PURE__ */ new Set());
|
|
1897
|
-
_define_property8(this, "_sessions", new ComplexMap4(PublicKey5.hash));
|
|
1898
|
-
_define_property8(this, "_topology", new MMSTTopology({
|
|
1899
|
-
originateConnections: 4,
|
|
1900
|
-
maxPeers: 10,
|
|
1901
|
-
sampleSize: 20
|
|
1902
|
-
}));
|
|
1903
|
-
_define_property8(this, "_connection", void 0);
|
|
1904
|
-
_define_property8(this, "feedAdded", new CallbackCollection());
|
|
1905
|
-
this._spaceKey = topic;
|
|
1906
|
-
this._networkManager = networkManager;
|
|
1907
|
-
this._swarmIdentity = swarmIdentity;
|
|
1908
|
-
this._onSessionAuth = onSessionAuth;
|
|
1909
|
-
this._onAuthFailure = onAuthFailure;
|
|
1910
|
-
this.blobSync = new BlobSync({
|
|
1911
|
-
blobStore
|
|
1912
|
-
});
|
|
1913
|
-
this._topic = subtleCrypto2.digest("SHA-256", topic.asBuffer()).then(discoveryKey).then(PublicKey5.from);
|
|
1914
|
-
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1915
|
-
}
|
|
1916
1852
|
};
|
|
1917
1853
|
_ts_decorate6([
|
|
1918
1854
|
logInfo2,
|
|
@@ -1934,12 +1870,34 @@ var AuthStatus = /* @__PURE__ */ (function(AuthStatus2) {
|
|
|
1934
1870
|
return AuthStatus2;
|
|
1935
1871
|
})({});
|
|
1936
1872
|
var SpaceProtocolSession = class {
|
|
1873
|
+
_wireProps;
|
|
1874
|
+
_disableP2pReplication;
|
|
1875
|
+
_onSessionAuth;
|
|
1876
|
+
_onAuthFailure;
|
|
1877
|
+
_swarmIdentity;
|
|
1878
|
+
_blobSync;
|
|
1879
|
+
_teleport;
|
|
1880
|
+
// TODO(dmaretskyi): Start with upload=false when switching it on the fly works.
|
|
1881
|
+
replicator = new ReplicatorExtension().setOptions({
|
|
1882
|
+
upload: true
|
|
1883
|
+
});
|
|
1884
|
+
_authStatus = "INITIAL";
|
|
1937
1885
|
get authStatus() {
|
|
1938
1886
|
return this._authStatus;
|
|
1939
1887
|
}
|
|
1940
1888
|
get stats() {
|
|
1941
1889
|
return this._teleport.stats;
|
|
1942
1890
|
}
|
|
1891
|
+
// TODO(dmaretskyi): Allow to pass in extra extensions.
|
|
1892
|
+
constructor({ wireProps, swarmIdentity, onSessionAuth, onAuthFailure, blobSync, disableP2pReplication }) {
|
|
1893
|
+
this._wireProps = wireProps;
|
|
1894
|
+
this._swarmIdentity = swarmIdentity;
|
|
1895
|
+
this._onSessionAuth = onSessionAuth;
|
|
1896
|
+
this._onAuthFailure = onAuthFailure;
|
|
1897
|
+
this._blobSync = blobSync;
|
|
1898
|
+
this._teleport = new Teleport(wireProps);
|
|
1899
|
+
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1900
|
+
}
|
|
1943
1901
|
get stream() {
|
|
1944
1902
|
return this._teleport.stream;
|
|
1945
1903
|
}
|
|
@@ -1980,31 +1938,10 @@ var SpaceProtocolSession = class {
|
|
|
1980
1938
|
async abort() {
|
|
1981
1939
|
await this._teleport.abort();
|
|
1982
1940
|
}
|
|
1983
|
-
// TODO(dmaretskyi): Allow to pass in extra extensions.
|
|
1984
|
-
constructor({ wireParams, swarmIdentity, onSessionAuth, onAuthFailure, blobSync, disableP2pReplication }) {
|
|
1985
|
-
_define_property8(this, "_wireParams", void 0);
|
|
1986
|
-
_define_property8(this, "_disableP2pReplication", void 0);
|
|
1987
|
-
_define_property8(this, "_onSessionAuth", void 0);
|
|
1988
|
-
_define_property8(this, "_onAuthFailure", void 0);
|
|
1989
|
-
_define_property8(this, "_swarmIdentity", void 0);
|
|
1990
|
-
_define_property8(this, "_blobSync", void 0);
|
|
1991
|
-
_define_property8(this, "_teleport", void 0);
|
|
1992
|
-
_define_property8(this, "replicator", new ReplicatorExtension().setOptions({
|
|
1993
|
-
upload: true
|
|
1994
|
-
}));
|
|
1995
|
-
_define_property8(this, "_authStatus", "INITIAL");
|
|
1996
|
-
this._wireParams = wireParams;
|
|
1997
|
-
this._swarmIdentity = swarmIdentity;
|
|
1998
|
-
this._onSessionAuth = onSessionAuth;
|
|
1999
|
-
this._onAuthFailure = onAuthFailure;
|
|
2000
|
-
this._blobSync = blobSync;
|
|
2001
|
-
this._teleport = new Teleport(wireParams);
|
|
2002
|
-
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
2003
|
-
}
|
|
2004
1941
|
};
|
|
2005
1942
|
_ts_decorate6([
|
|
2006
1943
|
logInfo2
|
|
2007
|
-
], SpaceProtocolSession.prototype, "
|
|
1944
|
+
], SpaceProtocolSession.prototype, "_wireProps", void 0);
|
|
2008
1945
|
_ts_decorate6([
|
|
2009
1946
|
logInfo2
|
|
2010
1947
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
@@ -2018,19 +1955,6 @@ import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
|
2018
1955
|
import { log as log9 } from "@dxos/log";
|
|
2019
1956
|
import { trace as trace4 } from "@dxos/protocols";
|
|
2020
1957
|
import { ComplexMap as ComplexMap5 } from "@dxos/util";
|
|
2021
|
-
function _define_property9(obj, key, value) {
|
|
2022
|
-
if (key in obj) {
|
|
2023
|
-
Object.defineProperty(obj, key, {
|
|
2024
|
-
value,
|
|
2025
|
-
enumerable: true,
|
|
2026
|
-
configurable: true,
|
|
2027
|
-
writable: true
|
|
2028
|
-
});
|
|
2029
|
-
} else {
|
|
2030
|
-
obj[key] = value;
|
|
2031
|
-
}
|
|
2032
|
-
return obj;
|
|
2033
|
-
}
|
|
2034
1958
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
2035
1959
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2036
1960
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2039,6 +1963,20 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
2039
1963
|
}
|
|
2040
1964
|
var __dxlog_file11 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
2041
1965
|
var SpaceManager = class {
|
|
1966
|
+
_spaces = new ComplexMap5(PublicKey6.hash);
|
|
1967
|
+
_feedStore;
|
|
1968
|
+
_networkManager;
|
|
1969
|
+
_metadataStore;
|
|
1970
|
+
_blobStore;
|
|
1971
|
+
_instanceId = PublicKey6.random().toHex();
|
|
1972
|
+
_disableP2pReplication;
|
|
1973
|
+
constructor({ feedStore, networkManager, metadataStore, blobStore, disableP2pReplication }) {
|
|
1974
|
+
this._feedStore = feedStore;
|
|
1975
|
+
this._networkManager = networkManager;
|
|
1976
|
+
this._metadataStore = metadataStore;
|
|
1977
|
+
this._blobStore = blobStore;
|
|
1978
|
+
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1979
|
+
}
|
|
2042
1980
|
// TODO(burdon): Remove.
|
|
2043
1981
|
get spaces() {
|
|
2044
1982
|
return this._spaces;
|
|
@@ -2179,20 +2117,6 @@ var SpaceManager = class {
|
|
|
2179
2117
|
});
|
|
2180
2118
|
});
|
|
2181
2119
|
}
|
|
2182
|
-
constructor({ feedStore, networkManager, metadataStore, blobStore, disableP2pReplication }) {
|
|
2183
|
-
_define_property9(this, "_spaces", new ComplexMap5(PublicKey6.hash));
|
|
2184
|
-
_define_property9(this, "_feedStore", void 0);
|
|
2185
|
-
_define_property9(this, "_networkManager", void 0);
|
|
2186
|
-
_define_property9(this, "_metadataStore", void 0);
|
|
2187
|
-
_define_property9(this, "_blobStore", void 0);
|
|
2188
|
-
_define_property9(this, "_instanceId", PublicKey6.random().toHex());
|
|
2189
|
-
_define_property9(this, "_disableP2pReplication", void 0);
|
|
2190
|
-
this._feedStore = feedStore;
|
|
2191
|
-
this._networkManager = networkManager;
|
|
2192
|
-
this._metadataStore = metadataStore;
|
|
2193
|
-
this._blobStore = blobStore;
|
|
2194
|
-
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
2195
|
-
}
|
|
2196
2120
|
};
|
|
2197
2121
|
_ts_decorate7([
|
|
2198
2122
|
synchronized4
|
|
@@ -2227,4 +2151,4 @@ export {
|
|
|
2227
2151
|
SpaceProtocolSession,
|
|
2228
2152
|
SpaceManager
|
|
2229
2153
|
};
|
|
2230
|
-
//# sourceMappingURL=chunk-
|
|
2154
|
+
//# sourceMappingURL=chunk-FE3UY2NU.mjs.map
|