@dxos/echo-pipeline 0.1.56-main.e47dfd1 → 0.1.56-main.ed2f871
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-7U2NXI2P.mjs → chunk-3OTHGQEY.mjs} +531 -251
- package/dist/lib/browser/chunk-3OTHGQEY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +14 -18
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +530 -250
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +527 -251
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/common/feeds.d.ts.map +1 -1
- package/dist/types/src/db-host/data-service-host.d.ts.map +1 -1
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/snapshot-manager.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/space/auth.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +2 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/package.json +32 -31
- package/src/common/feeds.ts +1 -2
- package/src/db-host/data-service-host.ts +1 -2
- package/src/db-host/data-service.ts +1 -2
- package/src/db-host/snapshot-manager.ts +0 -2
- package/src/metadata/metadata-store.ts +2 -2
- package/src/pipeline/message-selector.ts +1 -2
- package/src/pipeline/pipeline.test.ts +37 -1
- package/src/pipeline/pipeline.ts +3 -2
- package/src/space/auth.ts +1 -2
- package/src/space/data-pipeline.ts +1 -2
- package/src/space/space.test.ts +18 -17
- package/src/space/space.ts +6 -3
- package/src/testing/test-agent-builder.ts +2 -1
- package/dist/lib/browser/chunk-7U2NXI2P.mjs.map +0 -7
|
@@ -42,6 +42,7 @@ __export(testing_exports, {
|
|
|
42
42
|
module.exports = __toCommonJS(testing_exports);
|
|
43
43
|
|
|
44
44
|
// packages/core/echo/echo-pipeline/src/testing/test-agent-builder.ts
|
|
45
|
+
var import_context6 = require("@dxos/context");
|
|
45
46
|
var import_credentials5 = require("@dxos/credentials");
|
|
46
47
|
var import_document_model = require("@dxos/document-model");
|
|
47
48
|
var import_keys7 = require("@dxos/keys");
|
|
@@ -55,10 +56,10 @@ var import_teleport_extension_object_sync2 = require("@dxos/teleport-extension-o
|
|
|
55
56
|
var import_util10 = require("@dxos/util");
|
|
56
57
|
|
|
57
58
|
// packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
|
|
58
|
-
var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
59
59
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
60
60
|
var import_context = require("@dxos/context");
|
|
61
61
|
var import_echo_db = require("@dxos/echo-db");
|
|
62
|
+
var import_invariant = require("@dxos/invariant");
|
|
62
63
|
var import_log = require("@dxos/log");
|
|
63
64
|
var import_util = require("@dxos/util");
|
|
64
65
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
|
|
@@ -88,15 +89,22 @@ var DataServiceHost = class {
|
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
91
|
this._itemDemuxer.mutation.on(ctx, (message) => {
|
|
91
|
-
var _a;
|
|
92
92
|
const { batch, meta } = message;
|
|
93
|
-
(0,
|
|
93
|
+
(0, import_invariant.invariant)(!meta.clientTag, "Unexpected client tag in mutation message", {
|
|
94
|
+
F: __dxlog_file,
|
|
95
|
+
L: 61,
|
|
96
|
+
S: this,
|
|
97
|
+
A: [
|
|
98
|
+
"!(meta as any).clientTag",
|
|
99
|
+
"'Unexpected client tag in mutation message'"
|
|
100
|
+
]
|
|
101
|
+
});
|
|
94
102
|
(0, import_log.log)("message", {
|
|
95
103
|
batch,
|
|
96
104
|
meta
|
|
97
105
|
}, {
|
|
98
106
|
F: __dxlog_file,
|
|
99
|
-
L:
|
|
107
|
+
L: 62,
|
|
100
108
|
S: this,
|
|
101
109
|
C: (f, a) => f(...a)
|
|
102
110
|
});
|
|
@@ -104,7 +112,7 @@ var DataServiceHost = class {
|
|
|
104
112
|
message.meta.feedKey,
|
|
105
113
|
message.meta.seq
|
|
106
114
|
]);
|
|
107
|
-
|
|
115
|
+
batch.objects?.forEach((object) => {
|
|
108
116
|
(0, import_echo_db.setMetadataOnObject)(object, {
|
|
109
117
|
...meta
|
|
110
118
|
});
|
|
@@ -122,15 +130,30 @@ var DataServiceHost = class {
|
|
|
122
130
|
});
|
|
123
131
|
}
|
|
124
132
|
async write(request) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
(0, import_invariant.invariant)(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
|
|
134
|
+
F: __dxlog_file,
|
|
135
|
+
L: 88,
|
|
136
|
+
S: this,
|
|
137
|
+
A: [
|
|
138
|
+
"!this._ctx.disposed",
|
|
139
|
+
"'Cannot write to closed DataServiceHost'"
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
(0, import_invariant.invariant)(this._writeStream, "Cannot write mutations in readonly mode", {
|
|
143
|
+
F: __dxlog_file,
|
|
144
|
+
L: 89,
|
|
145
|
+
S: this,
|
|
146
|
+
A: [
|
|
147
|
+
"this._writeStream",
|
|
148
|
+
"'Cannot write mutations in readonly mode'"
|
|
149
|
+
]
|
|
150
|
+
});
|
|
128
151
|
(0, import_log.log)("write", {
|
|
129
152
|
clientTag: request.clientTag,
|
|
130
|
-
objectCount:
|
|
153
|
+
objectCount: request.batch.objects?.length ?? 0
|
|
131
154
|
}, {
|
|
132
155
|
F: __dxlog_file,
|
|
133
|
-
L:
|
|
156
|
+
L: 91,
|
|
134
157
|
S: this,
|
|
135
158
|
C: (f, a) => f(...a)
|
|
136
159
|
});
|
|
@@ -144,7 +167,7 @@ var DataServiceHost = class {
|
|
|
144
167
|
seq: receipt2.seq
|
|
145
168
|
}, {
|
|
146
169
|
F: __dxlog_file,
|
|
147
|
-
L:
|
|
170
|
+
L: 100,
|
|
148
171
|
S: this,
|
|
149
172
|
C: (f, a) => f(...a)
|
|
150
173
|
});
|
|
@@ -158,24 +181,18 @@ var DataServiceHost = class {
|
|
|
158
181
|
return receipt;
|
|
159
182
|
}
|
|
160
183
|
};
|
|
161
|
-
var createDataMessage = (batch) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
meta: void 0
|
|
174
|
-
};
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
};
|
|
184
|
+
var createDataMessage = (batch) => ({
|
|
185
|
+
batch: {
|
|
186
|
+
objects: batch.objects?.map((object) => ({
|
|
187
|
+
...object,
|
|
188
|
+
mutations: object.mutations?.map((mutation) => ({
|
|
189
|
+
...mutation,
|
|
190
|
+
meta: void 0
|
|
191
|
+
})),
|
|
192
|
+
meta: void 0
|
|
193
|
+
}))
|
|
194
|
+
}
|
|
195
|
+
});
|
|
179
196
|
|
|
180
197
|
// packages/core/echo/echo-pipeline/src/db-host/database-host.ts
|
|
181
198
|
var import_echo_db2 = require("@dxos/echo-db");
|
|
@@ -204,15 +221,13 @@ var DatabaseHost = class {
|
|
|
204
221
|
return this._itemDemuxer.createSnapshot();
|
|
205
222
|
}
|
|
206
223
|
createDataServiceHost() {
|
|
207
|
-
|
|
208
|
-
return new DataServiceHost(this._itemManager, this._itemDemuxer, (_a = this._outboundStream) != null ? _a : void 0);
|
|
224
|
+
return new DataServiceHost(this._itemManager, this._itemDemuxer, this._outboundStream ?? void 0);
|
|
209
225
|
}
|
|
210
226
|
};
|
|
211
227
|
|
|
212
228
|
// packages/core/echo/echo-pipeline/src/db-host/snapshot-manager.ts
|
|
213
229
|
var import_async = require("@dxos/async");
|
|
214
230
|
var import_context2 = require("@dxos/context");
|
|
215
|
-
var import_debug = require("@dxos/debug");
|
|
216
231
|
var import_keys = require("@dxos/keys");
|
|
217
232
|
var import_protocols = require("@dxos/protocols");
|
|
218
233
|
var import_blob = require("@dxos/protocols/proto/dxos/echo/blob");
|
|
@@ -257,9 +272,6 @@ var SnapshotManager = class SnapshotManager2 {
|
|
|
257
272
|
return import_keys.PublicKey.from(id).toHex();
|
|
258
273
|
}
|
|
259
274
|
};
|
|
260
|
-
_ts_decorate([
|
|
261
|
-
(0, import_debug.timed)(1e4)
|
|
262
|
-
], SnapshotManager.prototype, "load", null);
|
|
263
275
|
SnapshotManager = _ts_decorate([
|
|
264
276
|
(0, import_async.trackLeaks)("open", "close")
|
|
265
277
|
], SnapshotManager);
|
|
@@ -311,8 +323,8 @@ var SnapshotStore = class {
|
|
|
311
323
|
};
|
|
312
324
|
|
|
313
325
|
// packages/core/echo/echo-pipeline/src/db-host/data-service.ts
|
|
314
|
-
var
|
|
315
|
-
var
|
|
326
|
+
var import_debug = require("@dxos/debug");
|
|
327
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
316
328
|
var import_keys2 = require("@dxos/keys");
|
|
317
329
|
var import_log2 = require("@dxos/log");
|
|
318
330
|
var import_util2 = require("@dxos/util");
|
|
@@ -329,11 +341,19 @@ var DataServiceSubscriptions = class {
|
|
|
329
341
|
spaceKey
|
|
330
342
|
}, {
|
|
331
343
|
F: __dxlog_file2,
|
|
332
|
-
L:
|
|
344
|
+
L: 30,
|
|
333
345
|
S: this,
|
|
334
346
|
C: (f, a) => f(...a)
|
|
335
347
|
});
|
|
336
|
-
(0,
|
|
348
|
+
(0, import_invariant2.invariant)(!this._spaces.has(spaceKey), void 0, {
|
|
349
|
+
F: __dxlog_file2,
|
|
350
|
+
L: 31,
|
|
351
|
+
S: this,
|
|
352
|
+
A: [
|
|
353
|
+
"!this._spaces.has(spaceKey)",
|
|
354
|
+
""
|
|
355
|
+
]
|
|
356
|
+
});
|
|
337
357
|
await host.open();
|
|
338
358
|
this._spaces.set(spaceKey, host);
|
|
339
359
|
}
|
|
@@ -342,12 +362,12 @@ var DataServiceSubscriptions = class {
|
|
|
342
362
|
spaceKey
|
|
343
363
|
}, {
|
|
344
364
|
F: __dxlog_file2,
|
|
345
|
-
L:
|
|
365
|
+
L: 37,
|
|
346
366
|
S: this,
|
|
347
367
|
C: (f, a) => f(...a)
|
|
348
368
|
});
|
|
349
369
|
const host = this._spaces.get(spaceKey);
|
|
350
|
-
await
|
|
370
|
+
await host?.close();
|
|
351
371
|
this._spaces.delete(spaceKey);
|
|
352
372
|
}
|
|
353
373
|
getDataService(spaceKey) {
|
|
@@ -359,25 +379,47 @@ var DataServiceImpl = class {
|
|
|
359
379
|
this._subscriptions = _subscriptions;
|
|
360
380
|
}
|
|
361
381
|
subscribe(request) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
382
|
+
(0, import_invariant2.invariant)(request.spaceKey, void 0, {
|
|
383
|
+
F: __dxlog_file2,
|
|
384
|
+
L: 56,
|
|
385
|
+
S: this,
|
|
386
|
+
A: [
|
|
387
|
+
"request.spaceKey",
|
|
388
|
+
""
|
|
389
|
+
]
|
|
390
|
+
});
|
|
391
|
+
const host = this._subscriptions.getDataService(request.spaceKey) ?? (0, import_debug.raise)(new Error(`space not found: ${request.spaceKey}`));
|
|
365
392
|
return host.subscribe();
|
|
366
393
|
}
|
|
367
394
|
write(request) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
395
|
+
(0, import_invariant2.invariant)(request.spaceKey, void 0, {
|
|
396
|
+
F: __dxlog_file2,
|
|
397
|
+
L: 63,
|
|
398
|
+
S: this,
|
|
399
|
+
A: [
|
|
400
|
+
"request.spaceKey",
|
|
401
|
+
""
|
|
402
|
+
]
|
|
403
|
+
});
|
|
404
|
+
(0, import_invariant2.invariant)(request.batch, void 0, {
|
|
405
|
+
F: __dxlog_file2,
|
|
406
|
+
L: 64,
|
|
407
|
+
S: this,
|
|
408
|
+
A: [
|
|
409
|
+
"request.batch",
|
|
410
|
+
""
|
|
411
|
+
]
|
|
412
|
+
});
|
|
413
|
+
const host = this._subscriptions.getDataService(request.spaceKey) ?? (0, import_debug.raise)(new Error(`space not found: ${request.spaceKey}`));
|
|
372
414
|
return host.write(request);
|
|
373
415
|
}
|
|
374
416
|
};
|
|
375
417
|
|
|
376
418
|
// packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
|
|
377
419
|
var import_crc_32 = __toESM(require("crc-32"));
|
|
378
|
-
var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
|
|
379
420
|
var import_async2 = require("@dxos/async");
|
|
380
421
|
var import_errors = require("@dxos/errors");
|
|
422
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
381
423
|
var import_log3 = require("@dxos/log");
|
|
382
424
|
var import_protocols3 = require("@dxos/protocols");
|
|
383
425
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -396,8 +438,8 @@ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipelin
|
|
|
396
438
|
var emptyEchoMetadata = () => ({
|
|
397
439
|
version: import_protocols3.STORAGE_VERSION,
|
|
398
440
|
spaces: [],
|
|
399
|
-
created: new Date(),
|
|
400
|
-
updated: new Date()
|
|
441
|
+
created: /* @__PURE__ */ new Date(),
|
|
442
|
+
updated: /* @__PURE__ */ new Date()
|
|
401
443
|
});
|
|
402
444
|
var EchoMetadata = import_protocols3.schema.getCodecForType("dxos.echo.metadata.EchoMetadata");
|
|
403
445
|
var MetadataStore = class {
|
|
@@ -411,22 +453,19 @@ var MetadataStore = class {
|
|
|
411
453
|
return this._metadata;
|
|
412
454
|
}
|
|
413
455
|
get version() {
|
|
414
|
-
|
|
415
|
-
return (_a = this._metadata.version) != null ? _a : 0;
|
|
456
|
+
return this._metadata.version ?? 0;
|
|
416
457
|
}
|
|
417
458
|
/**
|
|
418
459
|
* Returns a list of currently saved spaces. The list and objects in it can be modified addSpace and
|
|
419
460
|
* addSpaceFeed functions.
|
|
420
461
|
*/
|
|
421
462
|
get spaces() {
|
|
422
|
-
|
|
423
|
-
return (_a = this._metadata.spaces) != null ? _a : [];
|
|
463
|
+
return this._metadata.spaces ?? [];
|
|
424
464
|
}
|
|
425
465
|
/**
|
|
426
466
|
* Loads metadata from persistent storage.
|
|
427
467
|
*/
|
|
428
468
|
async load() {
|
|
429
|
-
var _a;
|
|
430
469
|
const file = this._directory.getOrCreateFile("EchoMetadata");
|
|
431
470
|
try {
|
|
432
471
|
const { size: fileLength } = await file.stat();
|
|
@@ -445,7 +484,10 @@ var MetadataStore = class {
|
|
|
445
484
|
C: (f, a) => f(...a)
|
|
446
485
|
});
|
|
447
486
|
if (fileLength < dataSize + 8) {
|
|
448
|
-
throw new import_errors.DataCorruptionError("Metadata size is smaller than expected."
|
|
487
|
+
throw new import_errors.DataCorruptionError("Metadata size is smaller than expected.", {
|
|
488
|
+
fileLength,
|
|
489
|
+
dataSize
|
|
490
|
+
});
|
|
449
491
|
}
|
|
450
492
|
const data = await file.read(8, dataSize);
|
|
451
493
|
const calculatedChecksum = import_crc_32.default.buf(data);
|
|
@@ -453,9 +495,8 @@ var MetadataStore = class {
|
|
|
453
495
|
throw new import_errors.DataCorruptionError("Metadata checksum is invalid.");
|
|
454
496
|
}
|
|
455
497
|
this._metadata = EchoMetadata.decode(data);
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
(_a2 = space.state) != null ? _a2 : space.state = import_services.SpaceState.ACTIVE;
|
|
498
|
+
this._metadata.spaces?.forEach((space) => {
|
|
499
|
+
space.state ??= import_services.SpaceState.ACTIVE;
|
|
459
500
|
});
|
|
460
501
|
} catch (err) {
|
|
461
502
|
import_log3.log.error("failed to load metadata", {
|
|
@@ -472,12 +513,11 @@ var MetadataStore = class {
|
|
|
472
513
|
}
|
|
473
514
|
}
|
|
474
515
|
async _save() {
|
|
475
|
-
var _a;
|
|
476
516
|
const data = {
|
|
477
517
|
...this._metadata,
|
|
478
518
|
version: import_protocols3.STORAGE_VERSION,
|
|
479
|
-
created:
|
|
480
|
-
updated: new Date()
|
|
519
|
+
created: this._metadata.created ?? /* @__PURE__ */ new Date(),
|
|
520
|
+
updated: /* @__PURE__ */ new Date()
|
|
481
521
|
};
|
|
482
522
|
this.update.emit(data);
|
|
483
523
|
const file = this._directory.getOrCreateFile("EchoMetadata");
|
|
@@ -503,12 +543,19 @@ var MetadataStore = class {
|
|
|
503
543
|
}
|
|
504
544
|
}
|
|
505
545
|
_getSpace(spaceKey) {
|
|
506
|
-
|
|
507
|
-
if ((_a = this._metadata.identity) == null ? void 0 : _a.haloSpace.key.equals(spaceKey)) {
|
|
546
|
+
if (this._metadata.identity?.haloSpace.key.equals(spaceKey)) {
|
|
508
547
|
return this._metadata.identity.haloSpace;
|
|
509
548
|
}
|
|
510
549
|
const space = this.spaces.find((space2) => space2.key === spaceKey);
|
|
511
|
-
(0,
|
|
550
|
+
(0, import_invariant3.invariant)(space, "Space not found", {
|
|
551
|
+
F: __dxlog_file3,
|
|
552
|
+
L: 137,
|
|
553
|
+
S: this,
|
|
554
|
+
A: [
|
|
555
|
+
"space",
|
|
556
|
+
"'Space not found'"
|
|
557
|
+
]
|
|
558
|
+
});
|
|
512
559
|
return space;
|
|
513
560
|
}
|
|
514
561
|
/**
|
|
@@ -528,14 +575,29 @@ var MetadataStore = class {
|
|
|
528
575
|
return this._metadata.identity;
|
|
529
576
|
}
|
|
530
577
|
async setIdentityRecord(record) {
|
|
531
|
-
(0,
|
|
578
|
+
(0, import_invariant3.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
579
|
+
F: __dxlog_file3,
|
|
580
|
+
L: 155,
|
|
581
|
+
S: this,
|
|
582
|
+
A: [
|
|
583
|
+
"!this._metadata.identity",
|
|
584
|
+
"'Cannot overwrite existing identity in metadata'"
|
|
585
|
+
]
|
|
586
|
+
});
|
|
532
587
|
this._metadata.identity = record;
|
|
533
588
|
await this._save();
|
|
534
589
|
}
|
|
535
590
|
async addSpace(record) {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
591
|
+
(0, import_invariant3.invariant)(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
|
|
592
|
+
F: __dxlog_file3,
|
|
593
|
+
L: 162,
|
|
594
|
+
S: this,
|
|
595
|
+
A: [
|
|
596
|
+
"!(this._metadata.spaces ?? []).find((space) => space.key === record.key)",
|
|
597
|
+
"'Cannot overwrite existing space in metadata'"
|
|
598
|
+
]
|
|
599
|
+
});
|
|
600
|
+
(this._metadata.spaces ??= []).push(record);
|
|
539
601
|
await this._save();
|
|
540
602
|
}
|
|
541
603
|
async setSpaceDataLatestTimeframe(spaceKey, timeframe) {
|
|
@@ -570,10 +632,10 @@ _ts_decorate2([
|
|
|
570
632
|
var fromBytesInt32 = (buf) => buf.readInt32LE(0);
|
|
571
633
|
|
|
572
634
|
// packages/core/echo/echo-pipeline/src/space/auth.ts
|
|
573
|
-
var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
|
|
574
635
|
var import_async3 = require("@dxos/async");
|
|
575
636
|
var import_context3 = require("@dxos/context");
|
|
576
637
|
var import_crypto2 = require("@dxos/crypto");
|
|
638
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
577
639
|
var import_log4 = require("@dxos/log");
|
|
578
640
|
var import_protocols4 = require("@dxos/protocols");
|
|
579
641
|
var import_teleport = require("@dxos/teleport");
|
|
@@ -594,7 +656,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
594
656
|
onError: (err) => {
|
|
595
657
|
import_log4.log.catch(err, void 0, {
|
|
596
658
|
F: __dxlog_file4,
|
|
597
|
-
L:
|
|
659
|
+
L: 28,
|
|
598
660
|
S: this,
|
|
599
661
|
C: (f, a) => f(...a)
|
|
600
662
|
});
|
|
@@ -616,7 +678,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
616
678
|
} catch (err) {
|
|
617
679
|
import_log4.log.error("failed to generate auth credentials", err, {
|
|
618
680
|
F: __dxlog_file4,
|
|
619
|
-
L:
|
|
681
|
+
L: 55,
|
|
620
682
|
S: this,
|
|
621
683
|
C: (f, a) => f(...a)
|
|
622
684
|
});
|
|
@@ -634,14 +696,30 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
634
696
|
const { credential } = await this.rpc.AuthService.authenticate({
|
|
635
697
|
challenge
|
|
636
698
|
});
|
|
637
|
-
(0,
|
|
699
|
+
(0, import_invariant4.invariant)(credential?.length > 0, "invalid credential", {
|
|
700
|
+
F: __dxlog_file4,
|
|
701
|
+
L: 69,
|
|
702
|
+
S: this,
|
|
703
|
+
A: [
|
|
704
|
+
"credential?.length > 0",
|
|
705
|
+
"'invalid credential'"
|
|
706
|
+
]
|
|
707
|
+
});
|
|
638
708
|
const success = await this._authParams.verifier(challenge, credential);
|
|
639
|
-
(0,
|
|
709
|
+
(0, import_invariant4.invariant)(success, "credential not verified", {
|
|
710
|
+
F: __dxlog_file4,
|
|
711
|
+
L: 71,
|
|
712
|
+
S: this,
|
|
713
|
+
A: [
|
|
714
|
+
"success",
|
|
715
|
+
"'credential not verified'"
|
|
716
|
+
]
|
|
717
|
+
});
|
|
640
718
|
(0, import_async3.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
|
|
641
719
|
} catch (err) {
|
|
642
720
|
(0, import_log4.log)("auth failed", err, {
|
|
643
721
|
F: __dxlog_file4,
|
|
644
|
-
L:
|
|
722
|
+
L: 74,
|
|
645
723
|
S: this,
|
|
646
724
|
C: (f, a) => f(...a)
|
|
647
725
|
});
|
|
@@ -657,10 +735,11 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
657
735
|
};
|
|
658
736
|
|
|
659
737
|
// packages/core/echo/echo-pipeline/src/space/space.ts
|
|
660
|
-
var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
|
|
661
738
|
var import_async7 = require("@dxos/async");
|
|
739
|
+
var import_invariant9 = require("@dxos/invariant");
|
|
662
740
|
var import_log10 = require("@dxos/log");
|
|
663
741
|
var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
742
|
+
var import_tracing = require("@dxos/tracing");
|
|
664
743
|
var import_util7 = require("@dxos/util");
|
|
665
744
|
|
|
666
745
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
@@ -672,11 +751,11 @@ var import_timeframe3 = require("@dxos/timeframe");
|
|
|
672
751
|
var import_util5 = require("@dxos/util");
|
|
673
752
|
|
|
674
753
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
675
|
-
var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
|
|
676
754
|
var import_async5 = require("@dxos/async");
|
|
677
755
|
var import_context4 = require("@dxos/context");
|
|
678
|
-
var
|
|
756
|
+
var import_debug3 = require("@dxos/debug");
|
|
679
757
|
var import_feed_store = require("@dxos/feed-store");
|
|
758
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
680
759
|
var import_keys3 = require("@dxos/keys");
|
|
681
760
|
var import_log7 = require("@dxos/log");
|
|
682
761
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
@@ -689,31 +768,56 @@ var codec = import_protocols5.schema.getCodecForType("dxos.echo.feed.FeedMessage
|
|
|
689
768
|
var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
|
|
690
769
|
|
|
691
770
|
// packages/core/echo/echo-pipeline/src/common/feeds.ts
|
|
692
|
-
var
|
|
771
|
+
var import_invariant5 = require("@dxos/invariant");
|
|
772
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
|
|
693
773
|
var createMappedFeedWriter = (mapper, writer) => {
|
|
694
|
-
(0,
|
|
695
|
-
|
|
774
|
+
(0, import_invariant5.invariant)(mapper, void 0, {
|
|
775
|
+
F: __dxlog_file5,
|
|
776
|
+
L: 16,
|
|
777
|
+
S: void 0,
|
|
778
|
+
A: [
|
|
779
|
+
"mapper",
|
|
780
|
+
""
|
|
781
|
+
]
|
|
782
|
+
});
|
|
783
|
+
(0, import_invariant5.invariant)(writer, void 0, {
|
|
784
|
+
F: __dxlog_file5,
|
|
785
|
+
L: 17,
|
|
786
|
+
S: void 0,
|
|
787
|
+
A: [
|
|
788
|
+
"writer",
|
|
789
|
+
""
|
|
790
|
+
]
|
|
791
|
+
});
|
|
696
792
|
return {
|
|
697
793
|
write: async (data, options) => await writer.write(await mapper(data), options)
|
|
698
794
|
};
|
|
699
795
|
};
|
|
700
796
|
|
|
701
797
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
702
|
-
var
|
|
798
|
+
var import_invariant6 = require("@dxos/invariant");
|
|
703
799
|
var import_log5 = require("@dxos/log");
|
|
704
|
-
var
|
|
800
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
|
|
705
801
|
var createMessageSelector = (timeframeClock) => {
|
|
706
802
|
return (messages) => {
|
|
707
803
|
for (let i = 0; i < messages.length; i++) {
|
|
708
804
|
const { data: { timeframe } } = messages[i];
|
|
709
|
-
(0,
|
|
805
|
+
(0, import_invariant6.invariant)(timeframe, void 0, {
|
|
806
|
+
F: __dxlog_file6,
|
|
807
|
+
L: 25,
|
|
808
|
+
S: void 0,
|
|
809
|
+
A: [
|
|
810
|
+
"timeframe",
|
|
811
|
+
""
|
|
812
|
+
]
|
|
813
|
+
});
|
|
710
814
|
if (!timeframeClock.hasGaps(timeframe)) {
|
|
711
815
|
return i;
|
|
712
816
|
}
|
|
713
817
|
}
|
|
714
818
|
(0, import_log5.log)("Skipping...", void 0, {
|
|
715
|
-
F:
|
|
716
|
-
L:
|
|
819
|
+
F: __dxlog_file6,
|
|
820
|
+
L: 33,
|
|
717
821
|
S: void 0,
|
|
718
822
|
C: (f, a) => f(...a)
|
|
719
823
|
});
|
|
@@ -722,7 +826,7 @@ var createMessageSelector = (timeframeClock) => {
|
|
|
722
826
|
|
|
723
827
|
// packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
|
|
724
828
|
var import_async4 = require("@dxos/async");
|
|
725
|
-
var
|
|
829
|
+
var import_debug2 = require("@dxos/debug");
|
|
726
830
|
var import_log6 = require("@dxos/log");
|
|
727
831
|
var import_timeframe = require("@dxos/timeframe");
|
|
728
832
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -735,7 +839,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
735
839
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
736
840
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
737
841
|
}
|
|
738
|
-
var
|
|
842
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
|
|
739
843
|
var mapFeedIndexesToTimeframe = (indexes) => new import_timeframe.Timeframe(indexes.map(({ feedKey, index }) => [
|
|
740
844
|
feedKey,
|
|
741
845
|
index
|
|
@@ -790,7 +894,7 @@ var TimeframeClock = class {
|
|
|
790
894
|
target,
|
|
791
895
|
current: this._timeframe
|
|
792
896
|
}, {
|
|
793
|
-
F:
|
|
897
|
+
F: __dxlog_file7,
|
|
794
898
|
L: 73,
|
|
795
899
|
S: this,
|
|
796
900
|
C: (f, a) => f(...a)
|
|
@@ -801,7 +905,7 @@ var TimeframeClock = class {
|
|
|
801
905
|
current: this._timeframe,
|
|
802
906
|
deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
|
|
803
907
|
}, {
|
|
804
|
-
F:
|
|
908
|
+
F: __dxlog_file7,
|
|
805
909
|
L: 75,
|
|
806
910
|
S: this,
|
|
807
911
|
C: (f, a) => f(...a)
|
|
@@ -811,7 +915,7 @@ var TimeframeClock = class {
|
|
|
811
915
|
}
|
|
812
916
|
};
|
|
813
917
|
_ts_decorate3([
|
|
814
|
-
(0,
|
|
918
|
+
(0, import_debug2.timed)(5e3)
|
|
815
919
|
], TimeframeClock.prototype, "waitUntilReached", null);
|
|
816
920
|
|
|
817
921
|
// packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
|
|
@@ -825,7 +929,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
825
929
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
826
930
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
827
931
|
}
|
|
828
|
-
var
|
|
932
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
829
933
|
var PipelineState = class {
|
|
830
934
|
// prettier-ignore
|
|
831
935
|
constructor(_feeds, _timeframeClock) {
|
|
@@ -876,18 +980,17 @@ var PipelineState = class {
|
|
|
876
980
|
* @param timeout Timeout in milliseconds to specify the maximum wait time.
|
|
877
981
|
*/
|
|
878
982
|
async waitUntilReachedTargetTimeframe({ ctx = new import_context4.Context(), timeout, breakOnStall = true } = {}) {
|
|
879
|
-
var _a;
|
|
880
983
|
(0, import_log7.log)("waitUntilReachedTargetTimeframe", {
|
|
881
984
|
timeout,
|
|
882
985
|
current: this.timeframe,
|
|
883
986
|
target: this.targetTimeframe
|
|
884
987
|
}, {
|
|
885
|
-
F:
|
|
886
|
-
L:
|
|
988
|
+
F: __dxlog_file8,
|
|
989
|
+
L: 125,
|
|
887
990
|
S: this,
|
|
888
991
|
C: (f, a) => f(...a)
|
|
889
992
|
});
|
|
890
|
-
|
|
993
|
+
this._reachedTargetPromise ??= Promise.race([
|
|
891
994
|
this._timeframeClock.update.waitForCondition(() => {
|
|
892
995
|
return import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe).isEmpty();
|
|
893
996
|
}),
|
|
@@ -913,8 +1016,8 @@ var PipelineState = class {
|
|
|
913
1016
|
target: this.targetTimeframe,
|
|
914
1017
|
dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
|
|
915
1018
|
}, {
|
|
916
|
-
F:
|
|
917
|
-
L:
|
|
1019
|
+
F: __dxlog_file8,
|
|
1020
|
+
L: 152,
|
|
918
1021
|
S: this,
|
|
919
1022
|
C: (f, a) => f(...a)
|
|
920
1023
|
});
|
|
@@ -943,7 +1046,15 @@ var Pipeline = class {
|
|
|
943
1046
|
return this._state;
|
|
944
1047
|
}
|
|
945
1048
|
get writer() {
|
|
946
|
-
(0,
|
|
1049
|
+
(0, import_invariant7.invariant)(this._writer, "Writer not set.", {
|
|
1050
|
+
F: __dxlog_file8,
|
|
1051
|
+
L: 230,
|
|
1052
|
+
S: this,
|
|
1053
|
+
A: [
|
|
1054
|
+
"this._writer",
|
|
1055
|
+
"'Writer not set.'"
|
|
1056
|
+
]
|
|
1057
|
+
});
|
|
947
1058
|
return this._writer;
|
|
948
1059
|
}
|
|
949
1060
|
hasFeed(feedKey) {
|
|
@@ -962,16 +1073,41 @@ var Pipeline = class {
|
|
|
962
1073
|
this._setFeedDownloadState(feed);
|
|
963
1074
|
}
|
|
964
1075
|
setWriteFeed(feed) {
|
|
965
|
-
(0,
|
|
966
|
-
|
|
1076
|
+
(0, import_invariant7.invariant)(!this._writer, "Writer already set.", {
|
|
1077
|
+
F: __dxlog_file8,
|
|
1078
|
+
L: 253,
|
|
1079
|
+
S: this,
|
|
1080
|
+
A: [
|
|
1081
|
+
"!this._writer",
|
|
1082
|
+
"'Writer already set.'"
|
|
1083
|
+
]
|
|
1084
|
+
});
|
|
1085
|
+
(0, import_invariant7.invariant)(feed.properties.writable, "Feed must be writable.", {
|
|
1086
|
+
F: __dxlog_file8,
|
|
1087
|
+
L: 254,
|
|
1088
|
+
S: this,
|
|
1089
|
+
A: [
|
|
1090
|
+
"feed.properties.writable",
|
|
1091
|
+
"'Feed must be writable.'"
|
|
1092
|
+
]
|
|
1093
|
+
});
|
|
967
1094
|
this._writer = createMappedFeedWriter((payload) => ({
|
|
968
1095
|
timeframe: this._timeframeClock.timeframe,
|
|
969
1096
|
payload
|
|
970
1097
|
}), feed.createFeedWriter());
|
|
971
1098
|
}
|
|
972
1099
|
async start() {
|
|
1100
|
+
(0, import_invariant7.invariant)(!this._isStarted, "Pipeline is already started.", {
|
|
1101
|
+
F: __dxlog_file8,
|
|
1102
|
+
L: 267,
|
|
1103
|
+
S: this,
|
|
1104
|
+
A: [
|
|
1105
|
+
"!this._isStarted",
|
|
1106
|
+
"'Pipeline is already started.'"
|
|
1107
|
+
]
|
|
1108
|
+
});
|
|
973
1109
|
(0, import_log7.log)("starting...", void 0, {
|
|
974
|
-
F:
|
|
1110
|
+
F: __dxlog_file8,
|
|
975
1111
|
L: 268,
|
|
976
1112
|
S: this,
|
|
977
1113
|
C: (f, a) => f(...a)
|
|
@@ -980,29 +1116,28 @@ var Pipeline = class {
|
|
|
980
1116
|
await this._feedSetIterator.open();
|
|
981
1117
|
this._isStarted = true;
|
|
982
1118
|
(0, import_log7.log)("started", void 0, {
|
|
983
|
-
F:
|
|
1119
|
+
F: __dxlog_file8,
|
|
984
1120
|
L: 272,
|
|
985
1121
|
S: this,
|
|
986
1122
|
C: (f, a) => f(...a)
|
|
987
1123
|
});
|
|
988
1124
|
}
|
|
989
1125
|
async stop() {
|
|
990
|
-
var _a;
|
|
991
1126
|
(0, import_log7.log)("stopping...", void 0, {
|
|
992
|
-
F:
|
|
1127
|
+
F: __dxlog_file8,
|
|
993
1128
|
L: 277,
|
|
994
1129
|
S: this,
|
|
995
1130
|
C: (f, a) => f(...a)
|
|
996
1131
|
});
|
|
997
1132
|
this._isStopping = true;
|
|
998
|
-
await
|
|
1133
|
+
await this._feedSetIterator?.close();
|
|
999
1134
|
await this._processingTrigger.wait();
|
|
1000
1135
|
await this._state._ctx.dispose();
|
|
1001
1136
|
this._state._ctx = new import_context4.Context();
|
|
1002
1137
|
this._state._reachedTargetPromise = void 0;
|
|
1003
1138
|
this._isStarted = false;
|
|
1004
1139
|
(0, import_log7.log)("stopped", void 0, {
|
|
1005
|
-
F:
|
|
1140
|
+
F: __dxlog_file8,
|
|
1006
1141
|
L: 285,
|
|
1007
1142
|
S: this,
|
|
1008
1143
|
C: (f, a) => f(...a)
|
|
@@ -1013,7 +1148,15 @@ var Pipeline = class {
|
|
|
1013
1148
|
* The pipeline will start processing messages AFTER this timeframe.
|
|
1014
1149
|
*/
|
|
1015
1150
|
async setCursor(timeframe) {
|
|
1016
|
-
(0,
|
|
1151
|
+
(0, import_invariant7.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
1152
|
+
F: __dxlog_file8,
|
|
1153
|
+
L: 294,
|
|
1154
|
+
S: this,
|
|
1155
|
+
A: [
|
|
1156
|
+
"!this._isStarted || this._isPaused",
|
|
1157
|
+
"'Invalid state.'"
|
|
1158
|
+
]
|
|
1159
|
+
});
|
|
1017
1160
|
this._state._startTimeframe = timeframe;
|
|
1018
1161
|
this._timeframeClock.setTimeframe(timeframe);
|
|
1019
1162
|
for (const feed of this._feeds.values()) {
|
|
@@ -1029,7 +1172,15 @@ var Pipeline = class {
|
|
|
1029
1172
|
* Calling pause while processing will cause a deadlock.
|
|
1030
1173
|
*/
|
|
1031
1174
|
async pause() {
|
|
1032
|
-
(0,
|
|
1175
|
+
(0, import_invariant7.invariant)(this._isStarted, "Pipeline is not open.", {
|
|
1176
|
+
F: __dxlog_file8,
|
|
1177
|
+
L: 316,
|
|
1178
|
+
S: this,
|
|
1179
|
+
A: [
|
|
1180
|
+
"this._isStarted",
|
|
1181
|
+
"'Pipeline is not open.'"
|
|
1182
|
+
]
|
|
1183
|
+
});
|
|
1033
1184
|
if (this._isPaused) {
|
|
1034
1185
|
return;
|
|
1035
1186
|
}
|
|
@@ -1038,8 +1189,24 @@ var Pipeline = class {
|
|
|
1038
1189
|
this._isPaused = true;
|
|
1039
1190
|
}
|
|
1040
1191
|
async unpause() {
|
|
1041
|
-
(0,
|
|
1042
|
-
|
|
1192
|
+
(0, import_invariant7.invariant)(this._isStarted, "Pipeline is not open.", {
|
|
1193
|
+
F: __dxlog_file8,
|
|
1194
|
+
L: 328,
|
|
1195
|
+
S: this,
|
|
1196
|
+
A: [
|
|
1197
|
+
"this._isStarted",
|
|
1198
|
+
"'Pipeline is not open.'"
|
|
1199
|
+
]
|
|
1200
|
+
});
|
|
1201
|
+
(0, import_invariant7.invariant)(this._isPaused, "Pipeline is not paused.", {
|
|
1202
|
+
F: __dxlog_file8,
|
|
1203
|
+
L: 329,
|
|
1204
|
+
S: this,
|
|
1205
|
+
A: [
|
|
1206
|
+
"this._isPaused",
|
|
1207
|
+
"'Pipeline is not paused.'"
|
|
1208
|
+
]
|
|
1209
|
+
});
|
|
1043
1210
|
this._pauseTrigger.wake();
|
|
1044
1211
|
this._isPaused = false;
|
|
1045
1212
|
}
|
|
@@ -1048,21 +1215,45 @@ var Pipeline = class {
|
|
|
1048
1215
|
* Updates the timeframe clock after the message has bee processed.
|
|
1049
1216
|
*/
|
|
1050
1217
|
async *consume() {
|
|
1051
|
-
(0,
|
|
1218
|
+
(0, import_invariant7.invariant)(!this._isOpen, "Pipeline is already being consumed.", {
|
|
1219
|
+
F: __dxlog_file8,
|
|
1220
|
+
L: 340,
|
|
1221
|
+
S: this,
|
|
1222
|
+
A: [
|
|
1223
|
+
"!this._isOpen",
|
|
1224
|
+
"'Pipeline is already being consumed.'"
|
|
1225
|
+
]
|
|
1226
|
+
});
|
|
1052
1227
|
this._isOpen = true;
|
|
1053
|
-
(0,
|
|
1228
|
+
(0, import_invariant7.invariant)(this._feedSetIterator, "Iterator not initialized.", {
|
|
1229
|
+
F: __dxlog_file8,
|
|
1230
|
+
L: 343,
|
|
1231
|
+
S: this,
|
|
1232
|
+
A: [
|
|
1233
|
+
"this._feedSetIterator",
|
|
1234
|
+
"'Iterator not initialized.'"
|
|
1235
|
+
]
|
|
1236
|
+
});
|
|
1054
1237
|
let lastFeedSetIterator = this._feedSetIterator;
|
|
1055
1238
|
let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
|
|
1056
1239
|
while (!this._isStopping) {
|
|
1057
1240
|
await this._pauseTrigger.wait();
|
|
1058
1241
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
1059
|
-
(0,
|
|
1242
|
+
(0, import_invariant7.invariant)(this._feedSetIterator, "Iterator not initialized.", {
|
|
1243
|
+
F: __dxlog_file8,
|
|
1244
|
+
L: 352,
|
|
1245
|
+
S: this,
|
|
1246
|
+
A: [
|
|
1247
|
+
"this._feedSetIterator",
|
|
1248
|
+
"'Iterator not initialized.'"
|
|
1249
|
+
]
|
|
1250
|
+
});
|
|
1060
1251
|
lastFeedSetIterator = this._feedSetIterator;
|
|
1061
1252
|
iterable = lastFeedSetIterator[Symbol.asyncIterator]();
|
|
1062
1253
|
}
|
|
1063
1254
|
const { done, value } = await iterable.next();
|
|
1064
1255
|
if (!done) {
|
|
1065
|
-
const block = value
|
|
1256
|
+
const block = value ?? (0, import_debug3.failUndefined)();
|
|
1066
1257
|
this._processingTrigger.reset();
|
|
1067
1258
|
this._timeframeClock.updatePendingTimeframe(import_keys3.PublicKey.from(block.feedKey), block.seq);
|
|
1068
1259
|
yield block;
|
|
@@ -1073,13 +1264,12 @@ var Pipeline = class {
|
|
|
1073
1264
|
this._isOpen = false;
|
|
1074
1265
|
}
|
|
1075
1266
|
_setFeedDownloadState(feed) {
|
|
1076
|
-
var _a;
|
|
1077
1267
|
const timeframe = this._state._startTimeframe;
|
|
1078
|
-
const seq =
|
|
1268
|
+
const seq = timeframe.get(feed.key) ?? 0;
|
|
1079
1269
|
feed.undownload({
|
|
1080
1270
|
callback: () => (0, import_log7.log)("undownload", void 0, {
|
|
1081
|
-
F:
|
|
1082
|
-
L:
|
|
1271
|
+
F: __dxlog_file8,
|
|
1272
|
+
L: 377,
|
|
1083
1273
|
S: this,
|
|
1084
1274
|
C: (f, a) => f(...a)
|
|
1085
1275
|
})
|
|
@@ -1091,8 +1281,8 @@ var Pipeline = class {
|
|
|
1091
1281
|
(0, import_log7.log)("failed to download feed", {
|
|
1092
1282
|
err
|
|
1093
1283
|
}, {
|
|
1094
|
-
F:
|
|
1095
|
-
L:
|
|
1284
|
+
F: __dxlog_file8,
|
|
1285
|
+
L: 379,
|
|
1096
1286
|
S: this,
|
|
1097
1287
|
C: (f, a) => f(...a)
|
|
1098
1288
|
});
|
|
@@ -1105,8 +1295,8 @@ var Pipeline = class {
|
|
|
1105
1295
|
});
|
|
1106
1296
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1107
1297
|
import_log7.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
|
|
1108
|
-
F:
|
|
1109
|
-
L:
|
|
1298
|
+
F: __dxlog_file8,
|
|
1299
|
+
L: 390,
|
|
1110
1300
|
S: this,
|
|
1111
1301
|
C: (f, a) => f(...a)
|
|
1112
1302
|
});
|
|
@@ -1134,7 +1324,7 @@ _ts_decorate4([
|
|
|
1134
1324
|
], Pipeline.prototype, "unpause", null);
|
|
1135
1325
|
|
|
1136
1326
|
// packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
|
|
1137
|
-
var
|
|
1327
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
|
|
1138
1328
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
1139
1329
|
var ControlPipeline = class {
|
|
1140
1330
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
@@ -1149,7 +1339,7 @@ var ControlPipeline = class {
|
|
|
1149
1339
|
(0, import_log8.log)("feed admitted", {
|
|
1150
1340
|
key: info.key
|
|
1151
1341
|
}, {
|
|
1152
|
-
F:
|
|
1342
|
+
F: __dxlog_file9,
|
|
1153
1343
|
L: 51,
|
|
1154
1344
|
S: this,
|
|
1155
1345
|
C: (f, a) => f(...a)
|
|
@@ -1160,7 +1350,7 @@ var ControlPipeline = class {
|
|
|
1160
1350
|
await this._pipeline.addFeed(feed);
|
|
1161
1351
|
} catch (err) {
|
|
1162
1352
|
import_log8.log.catch(err, void 0, {
|
|
1163
|
-
F:
|
|
1353
|
+
F: __dxlog_file9,
|
|
1164
1354
|
L: 59,
|
|
1165
1355
|
S: this,
|
|
1166
1356
|
C: (f, a) => f(...a)
|
|
@@ -1183,7 +1373,7 @@ var ControlPipeline = class {
|
|
|
1183
1373
|
}
|
|
1184
1374
|
async start() {
|
|
1185
1375
|
(0, import_log8.log)("starting...", void 0, {
|
|
1186
|
-
F:
|
|
1376
|
+
F: __dxlog_file9,
|
|
1187
1377
|
L: 83,
|
|
1188
1378
|
S: this,
|
|
1189
1379
|
C: (f, a) => f(...a)
|
|
@@ -1195,7 +1385,7 @@ var ControlPipeline = class {
|
|
|
1195
1385
|
key: msg.feedKey,
|
|
1196
1386
|
seq: msg.seq
|
|
1197
1387
|
}, {
|
|
1198
|
-
F:
|
|
1388
|
+
F: __dxlog_file9,
|
|
1199
1389
|
L: 88,
|
|
1200
1390
|
S: this,
|
|
1201
1391
|
C: (f, a) => f(...a)
|
|
@@ -1208,7 +1398,7 @@ var ControlPipeline = class {
|
|
|
1208
1398
|
import_log8.log.warn("processing failed", {
|
|
1209
1399
|
msg
|
|
1210
1400
|
}, {
|
|
1211
|
-
F:
|
|
1401
|
+
F: __dxlog_file9,
|
|
1212
1402
|
L: 98,
|
|
1213
1403
|
S: this,
|
|
1214
1404
|
C: (f, a) => f(...a)
|
|
@@ -1219,7 +1409,7 @@ var ControlPipeline = class {
|
|
|
1219
1409
|
}
|
|
1220
1410
|
} catch (err) {
|
|
1221
1411
|
import_log8.log.catch(err, void 0, {
|
|
1222
|
-
F:
|
|
1412
|
+
F: __dxlog_file9,
|
|
1223
1413
|
L: 104,
|
|
1224
1414
|
S: this,
|
|
1225
1415
|
C: (f, a) => f(...a)
|
|
@@ -1229,7 +1419,7 @@ var ControlPipeline = class {
|
|
|
1229
1419
|
});
|
|
1230
1420
|
await this._pipeline.start();
|
|
1231
1421
|
(0, import_log8.log)("started", void 0, {
|
|
1232
|
-
F:
|
|
1422
|
+
F: __dxlog_file9,
|
|
1233
1423
|
L: 110,
|
|
1234
1424
|
S: this,
|
|
1235
1425
|
C: (f, a) => f(...a)
|
|
@@ -1243,7 +1433,7 @@ var ControlPipeline = class {
|
|
|
1243
1433
|
}
|
|
1244
1434
|
async stop() {
|
|
1245
1435
|
(0, import_log8.log)("stopping...", void 0, {
|
|
1246
|
-
F:
|
|
1436
|
+
F: __dxlog_file9,
|
|
1247
1437
|
L: 124,
|
|
1248
1438
|
S: this,
|
|
1249
1439
|
C: (f, a) => f(...a)
|
|
@@ -1251,21 +1441,20 @@ var ControlPipeline = class {
|
|
|
1251
1441
|
await this._pipeline.stop();
|
|
1252
1442
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1253
1443
|
(0, import_log8.log)("stopped", void 0, {
|
|
1254
|
-
F:
|
|
1444
|
+
F: __dxlog_file9,
|
|
1255
1445
|
L: 127,
|
|
1256
1446
|
S: this,
|
|
1257
1447
|
C: (f, a) => f(...a)
|
|
1258
1448
|
});
|
|
1259
1449
|
}
|
|
1260
1450
|
async _saveTargetTimeframe(timeframe) {
|
|
1261
|
-
var _a;
|
|
1262
1451
|
try {
|
|
1263
|
-
const newTimeframe = import_timeframe3.Timeframe.merge(
|
|
1452
|
+
const newTimeframe = import_timeframe3.Timeframe.merge(this._targetTimeframe ?? new import_timeframe3.Timeframe(), timeframe);
|
|
1264
1453
|
await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
|
|
1265
1454
|
this._targetTimeframe = newTimeframe;
|
|
1266
1455
|
} catch (err) {
|
|
1267
1456
|
(0, import_log8.log)(err, void 0, {
|
|
1268
|
-
F:
|
|
1457
|
+
F: __dxlog_file9,
|
|
1269
1458
|
L: 136,
|
|
1270
1459
|
S: this,
|
|
1271
1460
|
C: (f, a) => f(...a)
|
|
@@ -1275,12 +1464,12 @@ var ControlPipeline = class {
|
|
|
1275
1464
|
};
|
|
1276
1465
|
|
|
1277
1466
|
// packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
|
|
1278
|
-
var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
|
|
1279
1467
|
var import_async6 = require("@dxos/async");
|
|
1280
1468
|
var import_context5 = require("@dxos/context");
|
|
1281
1469
|
var import_credentials3 = require("@dxos/credentials");
|
|
1282
1470
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
1283
1471
|
var import_errors2 = require("@dxos/errors");
|
|
1472
|
+
var import_invariant8 = require("@dxos/invariant");
|
|
1284
1473
|
var import_log9 = require("@dxos/log");
|
|
1285
1474
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
1286
1475
|
var import_util6 = require("@dxos/util");
|
|
@@ -1294,7 +1483,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1294
1483
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1295
1484
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1296
1485
|
}
|
|
1297
|
-
var
|
|
1486
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
|
|
1298
1487
|
var MESSAGES_PER_SNAPSHOT = 10;
|
|
1299
1488
|
var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
|
|
1300
1489
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
|
|
@@ -1320,13 +1509,11 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1320
1509
|
return this._pipeline;
|
|
1321
1510
|
}
|
|
1322
1511
|
get pipelineState() {
|
|
1323
|
-
|
|
1324
|
-
return (_a = this._pipeline) == null ? void 0 : _a.state;
|
|
1512
|
+
return this._pipeline?.state;
|
|
1325
1513
|
}
|
|
1326
1514
|
setTargetTimeframe(timeframe) {
|
|
1327
|
-
var _a;
|
|
1328
1515
|
this._targetTimeframe = timeframe;
|
|
1329
|
-
|
|
1516
|
+
this._pipeline?.state.setTargetTimeframe(timeframe);
|
|
1330
1517
|
}
|
|
1331
1518
|
async processCredential(credential) {
|
|
1332
1519
|
if (!(0, import_credentials3.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
@@ -1350,8 +1537,24 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1350
1537
|
}
|
|
1351
1538
|
const feedWriter = {
|
|
1352
1539
|
write: (data, options) => {
|
|
1353
|
-
(0,
|
|
1354
|
-
|
|
1540
|
+
(0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
|
|
1541
|
+
F: __dxlog_file10,
|
|
1542
|
+
L: 145,
|
|
1543
|
+
S: this,
|
|
1544
|
+
A: [
|
|
1545
|
+
"this._pipeline",
|
|
1546
|
+
"'Pipeline is not initialized.'"
|
|
1547
|
+
]
|
|
1548
|
+
});
|
|
1549
|
+
(0, import_invariant8.invariant)(this.currentEpoch, "Epoch is not initialized.", {
|
|
1550
|
+
F: __dxlog_file10,
|
|
1551
|
+
L: 146,
|
|
1552
|
+
S: this,
|
|
1553
|
+
A: [
|
|
1554
|
+
"this.currentEpoch",
|
|
1555
|
+
"'Epoch is not initialized.'"
|
|
1556
|
+
]
|
|
1557
|
+
});
|
|
1355
1558
|
return this._pipeline.writer.write({
|
|
1356
1559
|
data
|
|
1357
1560
|
}, options);
|
|
@@ -1366,19 +1569,18 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1366
1569
|
this._isOpen = true;
|
|
1367
1570
|
}
|
|
1368
1571
|
async close() {
|
|
1369
|
-
var _a, _b, _c;
|
|
1370
1572
|
if (!this._isOpen) {
|
|
1371
1573
|
return;
|
|
1372
1574
|
}
|
|
1373
1575
|
(0, import_log9.log)("close", void 0, {
|
|
1374
|
-
F:
|
|
1375
|
-
L:
|
|
1576
|
+
F: __dxlog_file10,
|
|
1577
|
+
L: 170,
|
|
1376
1578
|
S: this,
|
|
1377
1579
|
C: (f, a) => f(...a)
|
|
1378
1580
|
});
|
|
1379
1581
|
this._isOpen = false;
|
|
1380
1582
|
await this._ctx.dispose();
|
|
1381
|
-
await
|
|
1583
|
+
await this._pipeline?.stop();
|
|
1382
1584
|
try {
|
|
1383
1585
|
await this._saveCache();
|
|
1384
1586
|
if (this._pipeline) {
|
|
@@ -1386,14 +1588,14 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1386
1588
|
}
|
|
1387
1589
|
} catch (err) {
|
|
1388
1590
|
import_log9.log.catch(err, void 0, {
|
|
1389
|
-
F:
|
|
1390
|
-
L:
|
|
1591
|
+
F: __dxlog_file10,
|
|
1592
|
+
L: 183,
|
|
1391
1593
|
S: this,
|
|
1392
1594
|
C: (f, a) => f(...a)
|
|
1393
1595
|
});
|
|
1394
1596
|
}
|
|
1395
|
-
await
|
|
1396
|
-
await
|
|
1597
|
+
await this.databaseHost?.close();
|
|
1598
|
+
await this.itemManager?.destroy();
|
|
1397
1599
|
this._ctx = new import_context5.Context();
|
|
1398
1600
|
this._pipeline = void 0;
|
|
1399
1601
|
this._targetTimeframe = void 0;
|
|
@@ -1409,15 +1611,23 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1409
1611
|
await this._processEpochInSeparateTask(this.currentEpoch);
|
|
1410
1612
|
await waitForOneEpoch;
|
|
1411
1613
|
}
|
|
1412
|
-
(0,
|
|
1614
|
+
(0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
|
|
1615
|
+
F: __dxlog_file10,
|
|
1616
|
+
L: 206,
|
|
1617
|
+
S: this,
|
|
1618
|
+
A: [
|
|
1619
|
+
"this._pipeline",
|
|
1620
|
+
"'Pipeline is not initialized.'"
|
|
1621
|
+
]
|
|
1622
|
+
});
|
|
1413
1623
|
for await (const msg of this._pipeline.consume()) {
|
|
1414
1624
|
const { feedKey, seq, data } = msg;
|
|
1415
1625
|
(0, import_log9.log)("processing message", {
|
|
1416
1626
|
feedKey,
|
|
1417
1627
|
seq
|
|
1418
1628
|
}, {
|
|
1419
|
-
F:
|
|
1420
|
-
L:
|
|
1629
|
+
F: __dxlog_file10,
|
|
1630
|
+
L: 209,
|
|
1421
1631
|
S: this,
|
|
1422
1632
|
C: (f, a) => f(...a)
|
|
1423
1633
|
});
|
|
@@ -1428,8 +1638,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1428
1638
|
import_log9.log.warn("Could not find feed", {
|
|
1429
1639
|
feedKey
|
|
1430
1640
|
}, {
|
|
1431
|
-
F:
|
|
1432
|
-
L:
|
|
1641
|
+
F: __dxlog_file10,
|
|
1642
|
+
L: 215,
|
|
1433
1643
|
S: this,
|
|
1434
1644
|
C: (f, a) => f(...a)
|
|
1435
1645
|
});
|
|
@@ -1451,8 +1661,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1451
1661
|
seq,
|
|
1452
1662
|
spaceKey: this._params.spaceKey.toHex()
|
|
1453
1663
|
}, {
|
|
1454
|
-
F:
|
|
1455
|
-
L:
|
|
1664
|
+
F: __dxlog_file10,
|
|
1665
|
+
L: 232,
|
|
1456
1666
|
S: this,
|
|
1457
1667
|
C: (f, a) => f(...a)
|
|
1458
1668
|
});
|
|
@@ -1460,8 +1670,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1460
1670
|
}
|
|
1461
1671
|
} catch (err) {
|
|
1462
1672
|
import_log9.log.catch(err, void 0, {
|
|
1463
|
-
F:
|
|
1464
|
-
L:
|
|
1673
|
+
F: __dxlog_file10,
|
|
1674
|
+
L: 242,
|
|
1465
1675
|
S: this,
|
|
1466
1676
|
C: (f, a) => f(...a)
|
|
1467
1677
|
});
|
|
@@ -1469,7 +1679,15 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1469
1679
|
}
|
|
1470
1680
|
}
|
|
1471
1681
|
_createSnapshot() {
|
|
1472
|
-
(0,
|
|
1682
|
+
(0, import_invariant8.invariant)(this.databaseHost, "Database backend is not initialized.", {
|
|
1683
|
+
F: __dxlog_file10,
|
|
1684
|
+
L: 248,
|
|
1685
|
+
S: this,
|
|
1686
|
+
A: [
|
|
1687
|
+
"this.databaseHost",
|
|
1688
|
+
"'Database backend is not initialized.'"
|
|
1689
|
+
]
|
|
1690
|
+
});
|
|
1473
1691
|
return {
|
|
1474
1692
|
spaceKey: this._params.spaceKey.asUint8Array(),
|
|
1475
1693
|
timeframe: this._pipeline.state.timeframe,
|
|
@@ -1477,26 +1695,22 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1477
1695
|
};
|
|
1478
1696
|
}
|
|
1479
1697
|
async _saveTargetTimeframe(timeframe) {
|
|
1480
|
-
|
|
1481
|
-
const newTimeframe = import_timeframe4.Timeframe.merge((_a = this._targetTimeframe) != null ? _a : new import_timeframe4.Timeframe(), timeframe);
|
|
1698
|
+
const newTimeframe = import_timeframe4.Timeframe.merge(this._targetTimeframe ?? new import_timeframe4.Timeframe(), timeframe);
|
|
1482
1699
|
await this._params.metadataStore.setSpaceDataLatestTimeframe(this._params.spaceKey, newTimeframe);
|
|
1483
1700
|
this._targetTimeframe = newTimeframe;
|
|
1484
1701
|
}
|
|
1485
1702
|
async _saveCache() {
|
|
1486
|
-
var _a;
|
|
1487
1703
|
const cache = {};
|
|
1488
1704
|
try {
|
|
1489
|
-
const propertiesItem = this.itemManager.items.find((item) =>
|
|
1490
|
-
|
|
1491
|
-
return ((_a2 = item.modelMeta) == null ? void 0 : _a2.type) === "dxos:model/document" && ((_b = (0, import_echo_db3.getStateMachineFromItem)(item)) == null ? void 0 : _b.snapshot()).type === "dxos.sdk.client.Properties";
|
|
1492
|
-
});
|
|
1705
|
+
const propertiesItem = this.itemManager.items.find((item) => item.modelMeta?.type === "dxos:model/document" && // TODO(burdon): Document?
|
|
1706
|
+
((0, import_echo_db3.getStateMachineFromItem)(item)?.snapshot()).type === "dxos.sdk.client.Properties");
|
|
1493
1707
|
if (propertiesItem) {
|
|
1494
|
-
cache.properties = (
|
|
1708
|
+
cache.properties = (0, import_echo_db3.getStateMachineFromItem)(propertiesItem)?.snapshot();
|
|
1495
1709
|
}
|
|
1496
1710
|
} catch (err) {
|
|
1497
1711
|
import_log9.log.warn("Failed to cache properties", err, {
|
|
1498
|
-
F:
|
|
1499
|
-
L:
|
|
1712
|
+
F: __dxlog_file10,
|
|
1713
|
+
L: 277,
|
|
1500
1714
|
S: this,
|
|
1501
1715
|
C: (f, a) => f(...a)
|
|
1502
1716
|
});
|
|
@@ -1513,24 +1727,23 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1513
1727
|
}
|
|
1514
1728
|
}
|
|
1515
1729
|
async _processEpochInSeparateTask(epoch) {
|
|
1516
|
-
var _a;
|
|
1517
1730
|
if (epoch.subject.assertion.number <= this._lastProcessedEpoch) {
|
|
1518
1731
|
return;
|
|
1519
1732
|
}
|
|
1520
|
-
await
|
|
1733
|
+
await this._epochCtx?.dispose();
|
|
1521
1734
|
const ctx = new import_context5.Context({
|
|
1522
1735
|
onError: (err) => {
|
|
1523
1736
|
if (err instanceof import_errors2.CancelledError) {
|
|
1524
1737
|
(0, import_log9.log)("Epoch processing cancelled.", void 0, {
|
|
1525
|
-
F:
|
|
1526
|
-
L:
|
|
1738
|
+
F: __dxlog_file10,
|
|
1739
|
+
L: 309,
|
|
1527
1740
|
S: this,
|
|
1528
1741
|
C: (f, a) => f(...a)
|
|
1529
1742
|
});
|
|
1530
1743
|
} else {
|
|
1531
1744
|
import_log9.log.catch(err, void 0, {
|
|
1532
|
-
F:
|
|
1533
|
-
L:
|
|
1745
|
+
F: __dxlog_file10,
|
|
1746
|
+
L: 311,
|
|
1534
1747
|
S: this,
|
|
1535
1748
|
C: (f, a) => f(...a)
|
|
1536
1749
|
});
|
|
@@ -1545,8 +1758,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1545
1758
|
(0, import_log9.log)("process epoch", {
|
|
1546
1759
|
epoch
|
|
1547
1760
|
}, {
|
|
1548
|
-
F:
|
|
1549
|
-
L:
|
|
1761
|
+
F: __dxlog_file10,
|
|
1762
|
+
L: 321,
|
|
1550
1763
|
S: this,
|
|
1551
1764
|
C: (f, a) => f(...a)
|
|
1552
1765
|
});
|
|
@@ -1556,14 +1769,30 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1556
1769
|
});
|
|
1557
1770
|
}
|
|
1558
1771
|
async _processEpoch(ctx, epoch) {
|
|
1559
|
-
(0,
|
|
1560
|
-
|
|
1772
|
+
(0, import_invariant8.invariant)(this._isOpen, "Space is closed.", {
|
|
1773
|
+
F: __dxlog_file10,
|
|
1774
|
+
L: 331,
|
|
1775
|
+
S: this,
|
|
1776
|
+
A: [
|
|
1777
|
+
"this._isOpen",
|
|
1778
|
+
"'Space is closed.'"
|
|
1779
|
+
]
|
|
1780
|
+
});
|
|
1781
|
+
(0, import_invariant8.invariant)(this._pipeline, void 0, {
|
|
1782
|
+
F: __dxlog_file10,
|
|
1783
|
+
L: 332,
|
|
1784
|
+
S: this,
|
|
1785
|
+
A: [
|
|
1786
|
+
"this._pipeline",
|
|
1787
|
+
""
|
|
1788
|
+
]
|
|
1789
|
+
});
|
|
1561
1790
|
this._lastProcessedEpoch = epoch.number;
|
|
1562
1791
|
(0, import_log9.log)("Processing epoch", {
|
|
1563
1792
|
epoch
|
|
1564
1793
|
}, {
|
|
1565
|
-
F:
|
|
1566
|
-
L:
|
|
1794
|
+
F: __dxlog_file10,
|
|
1795
|
+
L: 335,
|
|
1567
1796
|
S: this,
|
|
1568
1797
|
C: (f, a) => f(...a)
|
|
1569
1798
|
});
|
|
@@ -1572,8 +1801,8 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1572
1801
|
this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
|
|
1573
1802
|
}
|
|
1574
1803
|
(0, import_log9.log)("restarting pipeline for epoch", void 0, {
|
|
1575
|
-
F:
|
|
1576
|
-
L:
|
|
1804
|
+
F: __dxlog_file10,
|
|
1805
|
+
L: 343,
|
|
1577
1806
|
S: this,
|
|
1578
1807
|
C: (f, a) => f(...a)
|
|
1579
1808
|
});
|
|
@@ -1582,12 +1811,36 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1582
1811
|
await this._pipeline.unpause();
|
|
1583
1812
|
}
|
|
1584
1813
|
async waitUntilTimeframe(timeframe) {
|
|
1585
|
-
(0,
|
|
1814
|
+
(0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
|
|
1815
|
+
F: __dxlog_file10,
|
|
1816
|
+
L: 351,
|
|
1817
|
+
S: this,
|
|
1818
|
+
A: [
|
|
1819
|
+
"this._pipeline",
|
|
1820
|
+
"'Pipeline is not initialized.'"
|
|
1821
|
+
]
|
|
1822
|
+
});
|
|
1586
1823
|
await this._pipeline.state.waitUntilTimeframe(timeframe);
|
|
1587
1824
|
}
|
|
1588
1825
|
async createEpoch() {
|
|
1589
|
-
(0,
|
|
1590
|
-
|
|
1826
|
+
(0, import_invariant8.invariant)(this._pipeline, void 0, {
|
|
1827
|
+
F: __dxlog_file10,
|
|
1828
|
+
L: 357,
|
|
1829
|
+
S: this,
|
|
1830
|
+
A: [
|
|
1831
|
+
"this._pipeline",
|
|
1832
|
+
""
|
|
1833
|
+
]
|
|
1834
|
+
});
|
|
1835
|
+
(0, import_invariant8.invariant)(this.currentEpoch, void 0, {
|
|
1836
|
+
F: __dxlog_file10,
|
|
1837
|
+
L: 358,
|
|
1838
|
+
S: this,
|
|
1839
|
+
A: [
|
|
1840
|
+
"this.currentEpoch",
|
|
1841
|
+
""
|
|
1842
|
+
]
|
|
1843
|
+
});
|
|
1591
1844
|
await this._pipeline.pause();
|
|
1592
1845
|
const snapshot = await this._createSnapshot();
|
|
1593
1846
|
const snapshotCid = await this._params.snapshotManager.store(snapshot);
|
|
@@ -1631,14 +1884,22 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1631
1884
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1632
1885
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1633
1886
|
}
|
|
1634
|
-
var
|
|
1887
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
1635
1888
|
var Space = class Space2 {
|
|
1636
1889
|
constructor(params) {
|
|
1637
1890
|
this._addFeedLock = new import_async7.Lock();
|
|
1638
1891
|
this.onCredentialProcessed = new import_util7.Callback();
|
|
1639
1892
|
this.stateUpdate = new import_async7.Event();
|
|
1640
1893
|
this._isOpen = false;
|
|
1641
|
-
(0,
|
|
1894
|
+
(0, import_invariant9.invariant)(params.spaceKey && params.feedProvider, void 0, {
|
|
1895
|
+
F: __dxlog_file11,
|
|
1896
|
+
L: 73,
|
|
1897
|
+
S: this,
|
|
1898
|
+
A: [
|
|
1899
|
+
"params.spaceKey && params.feedProvider",
|
|
1900
|
+
""
|
|
1901
|
+
]
|
|
1902
|
+
});
|
|
1642
1903
|
this._key = params.spaceKey;
|
|
1643
1904
|
this._genesisFeedKey = params.genesisFeed.key;
|
|
1644
1905
|
this._feedProvider = params.feedProvider;
|
|
@@ -1673,8 +1934,8 @@ var Space = class Space2 {
|
|
|
1673
1934
|
(0, import_log10.log)("onCredentialProcessed", {
|
|
1674
1935
|
credential
|
|
1675
1936
|
}, {
|
|
1676
|
-
F:
|
|
1677
|
-
L:
|
|
1937
|
+
F: __dxlog_file11,
|
|
1938
|
+
L: 109,
|
|
1678
1939
|
S: this,
|
|
1679
1940
|
C: (f, a) => f(...a)
|
|
1680
1941
|
});
|
|
@@ -1716,12 +1977,10 @@ var Space = class Space2 {
|
|
|
1716
1977
|
return this._genesisFeedKey;
|
|
1717
1978
|
}
|
|
1718
1979
|
get controlFeedKey() {
|
|
1719
|
-
|
|
1720
|
-
return (_a = this._controlFeed) == null ? void 0 : _a.key;
|
|
1980
|
+
return this._controlFeed?.key;
|
|
1721
1981
|
}
|
|
1722
1982
|
get dataFeedKey() {
|
|
1723
|
-
|
|
1724
|
-
return (_a = this._dataFeed) == null ? void 0 : _a.key;
|
|
1983
|
+
return this._dataFeed?.key;
|
|
1725
1984
|
}
|
|
1726
1985
|
get spaceState() {
|
|
1727
1986
|
return this._controlPipeline.spaceState;
|
|
@@ -1739,16 +1998,31 @@ var Space = class Space2 {
|
|
|
1739
1998
|
return this._snapshotManager;
|
|
1740
1999
|
}
|
|
1741
2000
|
setControlFeed(feed) {
|
|
1742
|
-
(0,
|
|
2001
|
+
(0, import_invariant9.invariant)(!this._controlFeed, "Control feed already set.", {
|
|
2002
|
+
F: __dxlog_file11,
|
|
2003
|
+
L: 183,
|
|
2004
|
+
S: this,
|
|
2005
|
+
A: [
|
|
2006
|
+
"!this._controlFeed",
|
|
2007
|
+
"'Control feed already set.'"
|
|
2008
|
+
]
|
|
2009
|
+
});
|
|
1743
2010
|
this._controlFeed = feed;
|
|
1744
2011
|
this._controlPipeline.setWriteFeed(feed);
|
|
1745
2012
|
return this;
|
|
1746
2013
|
}
|
|
1747
2014
|
setDataFeed(feed) {
|
|
1748
|
-
|
|
1749
|
-
|
|
2015
|
+
(0, import_invariant9.invariant)(!this._dataFeed, "Data feed already set.", {
|
|
2016
|
+
F: __dxlog_file11,
|
|
2017
|
+
L: 190,
|
|
2018
|
+
S: this,
|
|
2019
|
+
A: [
|
|
2020
|
+
"!this._dataFeed",
|
|
2021
|
+
"'Data feed already set.'"
|
|
2022
|
+
]
|
|
2023
|
+
});
|
|
1750
2024
|
this._dataFeed = feed;
|
|
1751
|
-
|
|
2025
|
+
this._dataPipeline.pipeline?.setWriteFeed(feed);
|
|
1752
2026
|
return this;
|
|
1753
2027
|
}
|
|
1754
2028
|
/**
|
|
@@ -1763,10 +2037,10 @@ var Space = class Space2 {
|
|
|
1763
2037
|
// getDataFeeds(): FeedInfo[] {
|
|
1764
2038
|
// return this._dataPipeline?.getFeeds();
|
|
1765
2039
|
// }
|
|
1766
|
-
async open() {
|
|
2040
|
+
async open(ctx) {
|
|
1767
2041
|
(0, import_log10.log)("opening...", void 0, {
|
|
1768
|
-
F:
|
|
1769
|
-
L:
|
|
2042
|
+
F: __dxlog_file11,
|
|
2043
|
+
L: 212,
|
|
1770
2044
|
S: this,
|
|
1771
2045
|
C: (f, a) => f(...a)
|
|
1772
2046
|
});
|
|
@@ -1778,8 +2052,8 @@ var Space = class Space2 {
|
|
|
1778
2052
|
await this._controlPipeline.spaceState.addCredentialProcessor(this._dataPipeline);
|
|
1779
2053
|
this._isOpen = true;
|
|
1780
2054
|
(0, import_log10.log)("opened", void 0, {
|
|
1781
|
-
F:
|
|
1782
|
-
L:
|
|
2055
|
+
F: __dxlog_file11,
|
|
2056
|
+
L: 223,
|
|
1783
2057
|
S: this,
|
|
1784
2058
|
C: (f, a) => f(...a)
|
|
1785
2059
|
});
|
|
@@ -1788,8 +2062,8 @@ var Space = class Space2 {
|
|
|
1788
2062
|
(0, import_log10.log)("closing...", {
|
|
1789
2063
|
key: this._key
|
|
1790
2064
|
}, {
|
|
1791
|
-
F:
|
|
1792
|
-
L:
|
|
2065
|
+
F: __dxlog_file11,
|
|
2066
|
+
L: 228,
|
|
1793
2067
|
S: this,
|
|
1794
2068
|
C: (f, a) => f(...a)
|
|
1795
2069
|
});
|
|
@@ -1802,20 +2076,28 @@ var Space = class Space2 {
|
|
|
1802
2076
|
await this._controlPipeline.stop();
|
|
1803
2077
|
this._isOpen = false;
|
|
1804
2078
|
(0, import_log10.log)("closed", void 0, {
|
|
1805
|
-
F:
|
|
1806
|
-
L:
|
|
2079
|
+
F: __dxlog_file11,
|
|
2080
|
+
L: 241,
|
|
1807
2081
|
S: this,
|
|
1808
2082
|
C: (f, a) => f(...a)
|
|
1809
2083
|
});
|
|
1810
2084
|
}
|
|
1811
2085
|
async initializeDataPipeline() {
|
|
1812
2086
|
(0, import_log10.log)("initializeDataPipeline", void 0, {
|
|
1813
|
-
F:
|
|
1814
|
-
L:
|
|
2087
|
+
F: __dxlog_file11,
|
|
2088
|
+
L: 246,
|
|
1815
2089
|
S: this,
|
|
1816
2090
|
C: (f, a) => f(...a)
|
|
1817
2091
|
});
|
|
1818
|
-
(0,
|
|
2092
|
+
(0, import_invariant9.invariant)(this._isOpen, "Space must be open to initialize data pipeline.", {
|
|
2093
|
+
F: __dxlog_file11,
|
|
2094
|
+
L: 247,
|
|
2095
|
+
S: this,
|
|
2096
|
+
A: [
|
|
2097
|
+
"this._isOpen",
|
|
2098
|
+
"'Space must be open to initialize data pipeline.'"
|
|
2099
|
+
]
|
|
2100
|
+
});
|
|
1819
2101
|
await this._dataPipeline.open();
|
|
1820
2102
|
}
|
|
1821
2103
|
};
|
|
@@ -1823,7 +2105,8 @@ _ts_decorate6([
|
|
|
1823
2105
|
import_log10.logInfo
|
|
1824
2106
|
], Space.prototype, "key", null);
|
|
1825
2107
|
_ts_decorate6([
|
|
1826
|
-
import_async7.synchronized
|
|
2108
|
+
import_async7.synchronized,
|
|
2109
|
+
import_tracing.trace.span()
|
|
1827
2110
|
], Space.prototype, "open", null);
|
|
1828
2111
|
_ts_decorate6([
|
|
1829
2112
|
import_async7.synchronized
|
|
@@ -1832,12 +2115,13 @@ _ts_decorate6([
|
|
|
1832
2115
|
import_async7.synchronized
|
|
1833
2116
|
], Space.prototype, "initializeDataPipeline", null);
|
|
1834
2117
|
Space = _ts_decorate6([
|
|
1835
|
-
(0, import_async7.trackLeaks)("open", "close")
|
|
2118
|
+
(0, import_async7.trackLeaks)("open", "close"),
|
|
2119
|
+
import_tracing.trace.resource()
|
|
1836
2120
|
], Space);
|
|
1837
2121
|
|
|
1838
2122
|
// packages/core/echo/echo-pipeline/src/space/space-manager.ts
|
|
1839
2123
|
var import_async8 = require("@dxos/async");
|
|
1840
|
-
var
|
|
2124
|
+
var import_debug4 = require("@dxos/debug");
|
|
1841
2125
|
var import_keys6 = require("@dxos/keys");
|
|
1842
2126
|
var import_log12 = require("@dxos/log");
|
|
1843
2127
|
var import_protocols6 = require("@dxos/protocols");
|
|
@@ -1862,7 +2146,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
1862
2146
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1863
2147
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1864
2148
|
}
|
|
1865
|
-
var
|
|
2149
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
|
|
1866
2150
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1867
2151
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1868
2152
|
var SpaceProtocol = class {
|
|
@@ -1892,7 +2176,7 @@ var SpaceProtocol = class {
|
|
|
1892
2176
|
(0, import_log11.log)("addFeed", {
|
|
1893
2177
|
key: feed.key
|
|
1894
2178
|
}, {
|
|
1895
|
-
F:
|
|
2179
|
+
F: __dxlog_file12,
|
|
1896
2180
|
L: 95,
|
|
1897
2181
|
S: this,
|
|
1898
2182
|
C: (f, a) => f(...a)
|
|
@@ -1914,7 +2198,7 @@ var SpaceProtocol = class {
|
|
|
1914
2198
|
};
|
|
1915
2199
|
await this.blobSync.open();
|
|
1916
2200
|
(0, import_log11.log)("starting...", void 0, {
|
|
1917
|
-
F:
|
|
2201
|
+
F: __dxlog_file12,
|
|
1918
2202
|
L: 120,
|
|
1919
2203
|
S: this,
|
|
1920
2204
|
C: (f, a) => f(...a)
|
|
@@ -1928,7 +2212,7 @@ var SpaceProtocol = class {
|
|
|
1928
2212
|
label: `Protocol swarm: ${topic}`
|
|
1929
2213
|
});
|
|
1930
2214
|
(0, import_log11.log)("started", void 0, {
|
|
1931
|
-
F:
|
|
2215
|
+
F: __dxlog_file12,
|
|
1932
2216
|
L: 130,
|
|
1933
2217
|
S: this,
|
|
1934
2218
|
C: (f, a) => f(...a)
|
|
@@ -1938,14 +2222,14 @@ var SpaceProtocol = class {
|
|
|
1938
2222
|
await this.blobSync.close();
|
|
1939
2223
|
if (this._connection) {
|
|
1940
2224
|
(0, import_log11.log)("stopping...", void 0, {
|
|
1941
|
-
F:
|
|
2225
|
+
F: __dxlog_file12,
|
|
1942
2226
|
L: 137,
|
|
1943
2227
|
S: this,
|
|
1944
2228
|
C: (f, a) => f(...a)
|
|
1945
2229
|
});
|
|
1946
2230
|
await this._connection.close();
|
|
1947
2231
|
(0, import_log11.log)("stopped", void 0, {
|
|
1948
|
-
F:
|
|
2232
|
+
F: __dxlog_file12,
|
|
1949
2233
|
L: 139,
|
|
1950
2234
|
S: this,
|
|
1951
2235
|
C: (f, a) => f(...a)
|
|
@@ -2011,20 +2295,18 @@ var SpaceProtocolSession = class {
|
|
|
2011
2295
|
provider: this._swarmIdentity.credentialProvider,
|
|
2012
2296
|
verifier: this._swarmIdentity.credentialAuthenticator,
|
|
2013
2297
|
onAuthSuccess: () => {
|
|
2014
|
-
var _a;
|
|
2015
2298
|
(0, import_log11.log)("Peer authenticated", void 0, {
|
|
2016
|
-
F:
|
|
2299
|
+
F: __dxlog_file12,
|
|
2017
2300
|
L: 236,
|
|
2018
2301
|
S: this,
|
|
2019
2302
|
C: (f, a) => f(...a)
|
|
2020
2303
|
});
|
|
2021
2304
|
this._authStatus = AuthStatus.SUCCESS;
|
|
2022
|
-
|
|
2305
|
+
this._onSessionAuth?.(this._teleport);
|
|
2023
2306
|
},
|
|
2024
2307
|
onAuthFailure: () => {
|
|
2025
|
-
var _a;
|
|
2026
2308
|
this._authStatus = AuthStatus.FAILURE;
|
|
2027
|
-
|
|
2309
|
+
this._onAuthFailure?.(this._teleport);
|
|
2028
2310
|
}
|
|
2029
2311
|
}));
|
|
2030
2312
|
this._teleport.addExtension("dxos.mesh.teleport.replicator", this.replicator);
|
|
@@ -2052,7 +2334,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
2052
2334
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2053
2335
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2054
2336
|
}
|
|
2055
|
-
var
|
|
2337
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
2056
2338
|
var SpaceManager = class SpaceManager2 {
|
|
2057
2339
|
constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
|
|
2058
2340
|
this._spaces = new import_util9.ComplexMap(import_keys6.PublicKey.hash);
|
|
@@ -2076,11 +2358,10 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2076
2358
|
].map((space) => space.close()));
|
|
2077
2359
|
}
|
|
2078
2360
|
async constructSpace({ metadata, swarmIdentity, onNetworkConnection, onAuthFailure, memberKey }) {
|
|
2079
|
-
var _a;
|
|
2080
2361
|
import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
|
|
2081
2362
|
id: this._instanceId
|
|
2082
2363
|
}), {
|
|
2083
|
-
F:
|
|
2364
|
+
F: __dxlog_file13,
|
|
2084
2365
|
L: 97,
|
|
2085
2366
|
S: this,
|
|
2086
2367
|
C: (f, a) => f(...a)
|
|
@@ -2088,12 +2369,12 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2088
2369
|
(0, import_log12.log)("constructing space...", {
|
|
2089
2370
|
spaceKey: metadata.genesisFeedKey
|
|
2090
2371
|
}, {
|
|
2091
|
-
F:
|
|
2372
|
+
F: __dxlog_file13,
|
|
2092
2373
|
L: 98,
|
|
2093
2374
|
S: this,
|
|
2094
2375
|
C: (f, a) => f(...a)
|
|
2095
2376
|
});
|
|
2096
|
-
const genesisFeed = await this._feedStore.openFeed(
|
|
2377
|
+
const genesisFeed = await this._feedStore.openFeed(metadata.genesisFeedKey ?? (0, import_debug4.failUndefined)());
|
|
2097
2378
|
const spaceKey = metadata.key;
|
|
2098
2379
|
const protocol = new SpaceProtocol({
|
|
2099
2380
|
topic: spaceKey,
|
|
@@ -2118,7 +2399,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2118
2399
|
import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
|
|
2119
2400
|
id: this._instanceId
|
|
2120
2401
|
}), {
|
|
2121
|
-
F:
|
|
2402
|
+
F: __dxlog_file13,
|
|
2122
2403
|
L: 125,
|
|
2123
2404
|
S: this,
|
|
2124
2405
|
C: (f, a) => f(...a)
|
|
@@ -2162,10 +2443,10 @@ var WebsocketNetworkManagerProvider = (signalUrl) => () => new import_network_ma
|
|
|
2162
2443
|
var TestAgentBuilder = class {
|
|
2163
2444
|
constructor({ storage, networkManagerProvider } = {}) {
|
|
2164
2445
|
this._agents = new import_util10.ComplexMap(import_keys7.PublicKey.hash);
|
|
2165
|
-
this._storage = storage
|
|
2446
|
+
this._storage = storage ?? (0, import_random_access_storage.createStorage)({
|
|
2166
2447
|
type: import_random_access_storage.StorageType.RAM
|
|
2167
2448
|
});
|
|
2168
|
-
this._networkManagerProvider = networkManagerProvider
|
|
2449
|
+
this._networkManagerProvider = networkManagerProvider ?? MemoryNetworkManagerProvider(new import_messaging.MemorySignalManagerContext());
|
|
2169
2450
|
}
|
|
2170
2451
|
async close() {
|
|
2171
2452
|
return Promise.all(this.agents.map((agent) => agent.close()));
|
|
@@ -2187,16 +2468,13 @@ var TestAgentBuilder = class {
|
|
|
2187
2468
|
};
|
|
2188
2469
|
var TestAgent = class {
|
|
2189
2470
|
get metadataStore() {
|
|
2190
|
-
|
|
2191
|
-
return (_a = this._metadataStore) != null ? _a : this._metadataStore = new MetadataStore(this.storage.createDirectory("metadata"));
|
|
2471
|
+
return this._metadataStore ??= new MetadataStore(this.storage.createDirectory("metadata"));
|
|
2192
2472
|
}
|
|
2193
2473
|
get snapshotStore() {
|
|
2194
|
-
|
|
2195
|
-
return (_a = this._snapshotStore) != null ? _a : this._snapshotStore = new SnapshotStore(this.storage.createDirectory("snapshots"));
|
|
2474
|
+
return this._snapshotStore ??= new SnapshotStore(this.storage.createDirectory("snapshots"));
|
|
2196
2475
|
}
|
|
2197
2476
|
get blobStore() {
|
|
2198
|
-
|
|
2199
|
-
return (_a = this._blobStore) != null ? _a : this._blobStore = new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
|
|
2477
|
+
return this._blobStore ??= new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
|
|
2200
2478
|
}
|
|
2201
2479
|
constructor(_networkManagerProvider, _feedBuilder, identityKey, deviceKey) {
|
|
2202
2480
|
this._networkManagerProvider = _networkManagerProvider;
|
|
@@ -2221,8 +2499,7 @@ var TestAgent = class {
|
|
|
2221
2499
|
return this._spaces.get(spaceKey);
|
|
2222
2500
|
}
|
|
2223
2501
|
get spaceManager() {
|
|
2224
|
-
|
|
2225
|
-
return (_a = this._spaceManager) != null ? _a : this._spaceManager = new SpaceManager({
|
|
2502
|
+
return this._spaceManager ??= new SpaceManager({
|
|
2226
2503
|
feedStore: this.feedStore,
|
|
2227
2504
|
networkManager: this._networkManagerProvider(),
|
|
2228
2505
|
modelFactory: this.modelFactory,
|
|
@@ -2242,7 +2519,7 @@ var TestAgent = class {
|
|
|
2242
2519
|
const controlFeed = await this.feedStore.openFeed(genesisKey, {
|
|
2243
2520
|
writable: true
|
|
2244
2521
|
});
|
|
2245
|
-
const dataFeed = await this.feedStore.openFeed(dataKey
|
|
2522
|
+
const dataFeed = await this.feedStore.openFeed(dataKey ?? await this.keyring.createKey(), {
|
|
2246
2523
|
writable: true,
|
|
2247
2524
|
sparse: true
|
|
2248
2525
|
});
|
|
@@ -2272,7 +2549,7 @@ var TestAgent = class {
|
|
|
2272
2549
|
});
|
|
2273
2550
|
space.setControlFeed(controlFeed);
|
|
2274
2551
|
space.setDataFeed(dataFeed);
|
|
2275
|
-
await space.open();
|
|
2552
|
+
await space.open(new import_context6.Context());
|
|
2276
2553
|
this._spaces.set(spaceKey, space);
|
|
2277
2554
|
return space;
|
|
2278
2555
|
}
|
|
@@ -2287,7 +2564,7 @@ var TestAgent = class {
|
|
|
2287
2564
|
networkManager: this._networkManagerProvider(),
|
|
2288
2565
|
blobStore: this.blobStore,
|
|
2289
2566
|
onSessionAuth: (session) => {
|
|
2290
|
-
session.addExtension("dxos.mesh.teleport.gossip", (gossip
|
|
2567
|
+
session.addExtension("dxos.mesh.teleport.gossip", (gossip ?? this.createGossip()).createExtension({
|
|
2291
2568
|
remotePeerId: session.remotePeerId
|
|
2292
2569
|
}));
|
|
2293
2570
|
}
|
|
@@ -2303,7 +2580,7 @@ var TestAgent = class {
|
|
|
2303
2580
|
announceInterval: 30,
|
|
2304
2581
|
offlineTimeout: 200,
|
|
2305
2582
|
identityKey: this.identityKey,
|
|
2306
|
-
gossip: gossip
|
|
2583
|
+
gossip: gossip ?? this.createGossip()
|
|
2307
2584
|
});
|
|
2308
2585
|
}
|
|
2309
2586
|
async spaceGenesis(space) {
|
|
@@ -2368,9 +2645,8 @@ var createRemoteDatabaseFromDataServiceHost = async (modelFactory, dataServiceHo
|
|
|
2368
2645
|
};
|
|
2369
2646
|
};
|
|
2370
2647
|
var testLocalDatabase = async (create, check = create) => {
|
|
2371
|
-
var _a;
|
|
2372
2648
|
const objectId = import_keys8.PublicKey.random().toHex();
|
|
2373
|
-
await
|
|
2649
|
+
await create.databaseHost.getWriteStream()?.write({
|
|
2374
2650
|
batch: {
|
|
2375
2651
|
objects: [
|
|
2376
2652
|
{
|
|
@@ -2381,7 +2657,7 @@ var testLocalDatabase = async (create, check = create) => {
|
|
|
2381
2657
|
}
|
|
2382
2658
|
]
|
|
2383
2659
|
}
|
|
2384
|
-
})
|
|
2660
|
+
});
|
|
2385
2661
|
await (0, import_async9.asyncTimeout)(check.databaseHost._itemDemuxer.mutation.waitForCondition(() => check.itemManager.entities.has(objectId)), 2e3);
|
|
2386
2662
|
};
|
|
2387
2663
|
// Annotate the CommonJS export names for ESM import in node:
|