@dxos/echo-pipeline 0.1.58-next.3349da8 → 0.1.58-next.ffb4cc4
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-VYZEP2BZ.mjs → chunk-BCM3NEND.mjs} +33 -39
- package/dist/lib/browser/chunk-BCM3NEND.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/index.cjs +37 -106
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +142 -146
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/db-host/snapshot-manager.d.ts.map +1 -1
- package/dist/types/src/db-host/snapshot-store.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -1
- package/dist/types/src/index.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.map +1 -1
- package/dist/types/src/pipeline/timeframe-clock.d.ts.map +1 -1
- package/dist/types/src/space/data-pipeline.d.ts +2 -2
- package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +2 -2
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +2 -2
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/package.json +31 -32
- package/src/db-host/snapshot-manager.ts +1 -3
- package/src/db-host/snapshot-store.ts +1 -4
- package/src/index.ts +0 -1
- package/src/metadata/metadata-store.ts +2 -6
- package/src/pipeline/pipeline-stress.test.ts +1 -1
- package/src/pipeline/pipeline.test.ts +1 -1
- package/src/pipeline/pipeline.ts +3 -4
- package/src/pipeline/timeframe-clock.ts +1 -4
- package/src/space/control-pipeline.test.ts +1 -1
- package/src/space/data-pipeline.ts +5 -5
- package/src/space/space-manager.ts +2 -2
- package/src/space/space-protocol.test.ts +1 -1
- package/src/space/space.ts +3 -3
- package/src/testing/test-agent-builder.ts +1 -1
- package/dist/lib/browser/chunk-VYZEP2BZ.mjs.map +0 -7
- package/dist/types/src/errors/errors.d.ts +0 -26
- package/dist/types/src/errors/errors.d.ts.map +0 -1
- package/dist/types/src/errors/index.d.ts +0 -2
- package/dist/types/src/errors/index.d.ts.map +0 -1
- package/src/errors/errors.ts +0 -52
- package/src/errors/index.ts +0 -5
|
@@ -55,15 +55,60 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
55
55
|
var import_teleport_extension_object_sync2 = require("@dxos/teleport-extension-object-sync");
|
|
56
56
|
var import_util10 = require("@dxos/util");
|
|
57
57
|
|
|
58
|
+
// packages/core/echo/echo-pipeline/src/testing/test-feed-builder.ts
|
|
59
|
+
var import_testing = require("@dxos/feed-store/testing");
|
|
60
|
+
|
|
61
|
+
// packages/core/echo/echo-pipeline/src/common/codec.ts
|
|
62
|
+
var import_hypercore = require("@dxos/hypercore");
|
|
63
|
+
var import_protocols = require("@dxos/protocols");
|
|
64
|
+
var codec = import_protocols.schema.getCodecForType("dxos.echo.feed.FeedMessage");
|
|
65
|
+
var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
|
|
66
|
+
|
|
67
|
+
// packages/core/echo/echo-pipeline/src/common/feeds.ts
|
|
68
|
+
var import_invariant = require("@dxos/invariant");
|
|
69
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
|
|
70
|
+
var createMappedFeedWriter = (mapper, writer) => {
|
|
71
|
+
(0, import_invariant.invariant)(mapper, void 0, {
|
|
72
|
+
F: __dxlog_file,
|
|
73
|
+
L: 16,
|
|
74
|
+
S: void 0,
|
|
75
|
+
A: [
|
|
76
|
+
"mapper",
|
|
77
|
+
""
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
(0, import_invariant.invariant)(writer, void 0, {
|
|
81
|
+
F: __dxlog_file,
|
|
82
|
+
L: 17,
|
|
83
|
+
S: void 0,
|
|
84
|
+
A: [
|
|
85
|
+
"writer",
|
|
86
|
+
""
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
write: async (data, options) => await writer.write(await mapper(data), options)
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// packages/core/echo/echo-pipeline/src/testing/test-feed-builder.ts
|
|
95
|
+
var TestFeedBuilder = class extends import_testing.TestBuilder {
|
|
96
|
+
constructor() {
|
|
97
|
+
super({
|
|
98
|
+
valueEncoding
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
|
|
58
103
|
// packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts
|
|
59
104
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
60
105
|
var import_context = require("@dxos/context");
|
|
61
106
|
var import_echo_db = require("@dxos/echo-db");
|
|
62
|
-
var
|
|
107
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
63
108
|
var import_log = require("@dxos/log");
|
|
64
109
|
var import_service = require("@dxos/protocols/proto/dxos/echo/service");
|
|
65
110
|
var import_util = require("@dxos/util");
|
|
66
|
-
var
|
|
111
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
|
|
67
112
|
var DataServiceHost = class {
|
|
68
113
|
constructor(_itemManager, _itemDemuxer, _flush, _writeStream) {
|
|
69
114
|
this._itemManager = _itemManager;
|
|
@@ -100,8 +145,8 @@ var DataServiceHost = class {
|
|
|
100
145
|
});
|
|
101
146
|
this._itemDemuxer.mutation.on(ctx, (message) => {
|
|
102
147
|
const { batch, meta } = message;
|
|
103
|
-
(0,
|
|
104
|
-
F:
|
|
148
|
+
(0, import_invariant2.invariant)(!meta.clientTag, "Unexpected client tag in mutation message", {
|
|
149
|
+
F: __dxlog_file2,
|
|
105
150
|
L: 69,
|
|
106
151
|
S: this,
|
|
107
152
|
A: [
|
|
@@ -113,7 +158,7 @@ var DataServiceHost = class {
|
|
|
113
158
|
batch: batch.objects?.length,
|
|
114
159
|
meta
|
|
115
160
|
}, {
|
|
116
|
-
F:
|
|
161
|
+
F: __dxlog_file2,
|
|
117
162
|
L: 70,
|
|
118
163
|
S: this,
|
|
119
164
|
C: (f, a) => f(...a)
|
|
@@ -140,8 +185,8 @@ var DataServiceHost = class {
|
|
|
140
185
|
});
|
|
141
186
|
}
|
|
142
187
|
async write(request) {
|
|
143
|
-
(0,
|
|
144
|
-
F:
|
|
188
|
+
(0, import_invariant2.invariant)(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
|
|
189
|
+
F: __dxlog_file2,
|
|
145
190
|
L: 96,
|
|
146
191
|
S: this,
|
|
147
192
|
A: [
|
|
@@ -149,8 +194,8 @@ var DataServiceHost = class {
|
|
|
149
194
|
"'Cannot write to closed DataServiceHost'"
|
|
150
195
|
]
|
|
151
196
|
});
|
|
152
|
-
(0,
|
|
153
|
-
F:
|
|
197
|
+
(0, import_invariant2.invariant)(this._writeStream, "Cannot write mutations in readonly mode", {
|
|
198
|
+
F: __dxlog_file2,
|
|
154
199
|
L: 97,
|
|
155
200
|
S: this,
|
|
156
201
|
A: [
|
|
@@ -162,7 +207,7 @@ var DataServiceHost = class {
|
|
|
162
207
|
clientTag: request.clientTag,
|
|
163
208
|
objectCount: request.batch.objects?.length ?? 0
|
|
164
209
|
}, {
|
|
165
|
-
F:
|
|
210
|
+
F: __dxlog_file2,
|
|
166
211
|
L: 99,
|
|
167
212
|
S: this,
|
|
168
213
|
C: (f, a) => f(...a)
|
|
@@ -176,7 +221,7 @@ var DataServiceHost = class {
|
|
|
176
221
|
feedKey: receipt2.feedKey,
|
|
177
222
|
seq: receipt2.seq
|
|
178
223
|
}, {
|
|
179
|
-
F:
|
|
224
|
+
F: __dxlog_file2,
|
|
180
225
|
L: 108,
|
|
181
226
|
S: this,
|
|
182
227
|
C: (f, a) => f(...a)
|
|
@@ -243,7 +288,7 @@ var DatabaseHost = class {
|
|
|
243
288
|
var import_async = require("@dxos/async");
|
|
244
289
|
var import_context2 = require("@dxos/context");
|
|
245
290
|
var import_keys = require("@dxos/keys");
|
|
246
|
-
var
|
|
291
|
+
var import_protocols2 = require("@dxos/protocols");
|
|
247
292
|
var import_blob = require("@dxos/protocols/proto/dxos/echo/blob");
|
|
248
293
|
function _ts_decorate(decorators, target, key, desc) {
|
|
249
294
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -255,9 +300,8 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
255
300
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
256
301
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
257
302
|
}
|
|
258
|
-
var SpaceSnapshot =
|
|
303
|
+
var SpaceSnapshot = import_protocols2.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot");
|
|
259
304
|
var SnapshotManager = class SnapshotManager2 {
|
|
260
|
-
// prettier-ignore
|
|
261
305
|
constructor(_snapshotStore, _blobStore, _blobSync) {
|
|
262
306
|
this._snapshotStore = _snapshotStore;
|
|
263
307
|
this._blobStore = _blobStore;
|
|
@@ -292,10 +336,9 @@ SnapshotManager = _ts_decorate([
|
|
|
292
336
|
|
|
293
337
|
// packages/core/echo/echo-pipeline/src/db-host/snapshot-store.ts
|
|
294
338
|
var import_crypto = require("@dxos/crypto");
|
|
295
|
-
var
|
|
296
|
-
var SpaceSnapshot2 =
|
|
339
|
+
var import_protocols3 = require("@dxos/protocols");
|
|
340
|
+
var SpaceSnapshot2 = import_protocols3.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot");
|
|
297
341
|
var SnapshotStore = class {
|
|
298
|
-
// prettier-ignore
|
|
299
342
|
constructor(_directory) {
|
|
300
343
|
this._directory = _directory;
|
|
301
344
|
}
|
|
@@ -338,11 +381,11 @@ var SnapshotStore = class {
|
|
|
338
381
|
|
|
339
382
|
// packages/core/echo/echo-pipeline/src/db-host/data-service.ts
|
|
340
383
|
var import_debug = require("@dxos/debug");
|
|
341
|
-
var
|
|
384
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
342
385
|
var import_keys2 = require("@dxos/keys");
|
|
343
386
|
var import_log2 = require("@dxos/log");
|
|
344
387
|
var import_util2 = require("@dxos/util");
|
|
345
|
-
var
|
|
388
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
|
|
346
389
|
var DataServiceSubscriptions = class {
|
|
347
390
|
constructor() {
|
|
348
391
|
this._spaces = new import_util2.ComplexMap(import_keys2.PublicKey.hash);
|
|
@@ -354,13 +397,13 @@ var DataServiceSubscriptions = class {
|
|
|
354
397
|
(0, import_log2.log)("Registering space", {
|
|
355
398
|
spaceKey
|
|
356
399
|
}, {
|
|
357
|
-
F:
|
|
400
|
+
F: __dxlog_file3,
|
|
358
401
|
L: 31,
|
|
359
402
|
S: this,
|
|
360
403
|
C: (f, a) => f(...a)
|
|
361
404
|
});
|
|
362
|
-
(0,
|
|
363
|
-
F:
|
|
405
|
+
(0, import_invariant3.invariant)(!this._spaces.has(spaceKey), void 0, {
|
|
406
|
+
F: __dxlog_file3,
|
|
364
407
|
L: 32,
|
|
365
408
|
S: this,
|
|
366
409
|
A: [
|
|
@@ -375,7 +418,7 @@ var DataServiceSubscriptions = class {
|
|
|
375
418
|
(0, import_log2.log)("Unregistering space", {
|
|
376
419
|
spaceKey
|
|
377
420
|
}, {
|
|
378
|
-
F:
|
|
421
|
+
F: __dxlog_file3,
|
|
379
422
|
L: 38,
|
|
380
423
|
S: this,
|
|
381
424
|
C: (f, a) => f(...a)
|
|
@@ -393,8 +436,8 @@ var DataServiceImpl = class {
|
|
|
393
436
|
this._subscriptions = _subscriptions;
|
|
394
437
|
}
|
|
395
438
|
subscribe(request) {
|
|
396
|
-
(0,
|
|
397
|
-
F:
|
|
439
|
+
(0, import_invariant3.invariant)(request.spaceKey, void 0, {
|
|
440
|
+
F: __dxlog_file3,
|
|
398
441
|
L: 57,
|
|
399
442
|
S: this,
|
|
400
443
|
A: [
|
|
@@ -406,8 +449,8 @@ var DataServiceImpl = class {
|
|
|
406
449
|
return host.subscribe();
|
|
407
450
|
}
|
|
408
451
|
write(request) {
|
|
409
|
-
(0,
|
|
410
|
-
F:
|
|
452
|
+
(0, import_invariant3.invariant)(request.spaceKey, void 0, {
|
|
453
|
+
F: __dxlog_file3,
|
|
411
454
|
L: 64,
|
|
412
455
|
S: this,
|
|
413
456
|
A: [
|
|
@@ -415,8 +458,8 @@ var DataServiceImpl = class {
|
|
|
415
458
|
""
|
|
416
459
|
]
|
|
417
460
|
});
|
|
418
|
-
(0,
|
|
419
|
-
F:
|
|
461
|
+
(0, import_invariant3.invariant)(request.batch, void 0, {
|
|
462
|
+
F: __dxlog_file3,
|
|
420
463
|
L: 65,
|
|
421
464
|
S: this,
|
|
422
465
|
A: [
|
|
@@ -428,8 +471,8 @@ var DataServiceImpl = class {
|
|
|
428
471
|
return host.write(request);
|
|
429
472
|
}
|
|
430
473
|
flush(request) {
|
|
431
|
-
(0,
|
|
432
|
-
F:
|
|
474
|
+
(0, import_invariant3.invariant)(request.spaceKey, void 0, {
|
|
475
|
+
F: __dxlog_file3,
|
|
433
476
|
L: 72,
|
|
434
477
|
S: this,
|
|
435
478
|
A: [
|
|
@@ -445,11 +488,10 @@ var DataServiceImpl = class {
|
|
|
445
488
|
// packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
|
|
446
489
|
var import_crc_32 = __toESM(require("crc-32"));
|
|
447
490
|
var import_async2 = require("@dxos/async");
|
|
448
|
-
var
|
|
449
|
-
var import_invariant3 = require("@dxos/invariant");
|
|
491
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
450
492
|
var import_keys3 = require("@dxos/keys");
|
|
451
493
|
var import_log3 = require("@dxos/log");
|
|
452
|
-
var
|
|
494
|
+
var import_protocols4 = require("@dxos/protocols");
|
|
453
495
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
454
496
|
var import_util3 = require("@dxos/util");
|
|
455
497
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
@@ -462,18 +504,17 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
462
504
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
463
505
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
464
506
|
}
|
|
465
|
-
var
|
|
507
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
|
|
466
508
|
var emptyEchoMetadata = () => ({
|
|
467
|
-
version:
|
|
509
|
+
version: import_protocols4.STORAGE_VERSION,
|
|
468
510
|
spaces: [],
|
|
469
511
|
created: /* @__PURE__ */ new Date(),
|
|
470
512
|
updated: /* @__PURE__ */ new Date()
|
|
471
513
|
});
|
|
472
514
|
var emptyLargeSpaceMetadata = () => ({});
|
|
473
|
-
var EchoMetadata =
|
|
474
|
-
var LargeSpaceMetadata =
|
|
515
|
+
var EchoMetadata = import_protocols4.schema.getCodecForType("dxos.echo.metadata.EchoMetadata");
|
|
516
|
+
var LargeSpaceMetadata = import_protocols4.schema.getCodecForType("dxos.echo.metadata.LargeSpaceMetadata");
|
|
475
517
|
var MetadataStore = class {
|
|
476
|
-
// prettier-ignore
|
|
477
518
|
constructor(_directory) {
|
|
478
519
|
this._directory = _directory;
|
|
479
520
|
this._metadata = emptyEchoMetadata();
|
|
@@ -507,13 +548,13 @@ var MetadataStore = class {
|
|
|
507
548
|
checksum,
|
|
508
549
|
name: file.filename
|
|
509
550
|
}, {
|
|
510
|
-
F:
|
|
511
|
-
L:
|
|
551
|
+
F: __dxlog_file4,
|
|
552
|
+
L: 78,
|
|
512
553
|
S: this,
|
|
513
554
|
C: (f, a) => f(...a)
|
|
514
555
|
});
|
|
515
556
|
if (fileLength < dataSize + 8) {
|
|
516
|
-
throw new
|
|
557
|
+
throw new import_protocols4.DataCorruptionError("Metadata size is smaller than expected.", {
|
|
517
558
|
fileLength,
|
|
518
559
|
dataSize
|
|
519
560
|
});
|
|
@@ -521,7 +562,7 @@ var MetadataStore = class {
|
|
|
521
562
|
const data = await file.read(8, dataSize);
|
|
522
563
|
const calculatedChecksum = import_crc_32.default.buf(data);
|
|
523
564
|
if (calculatedChecksum !== checksum) {
|
|
524
|
-
throw new
|
|
565
|
+
throw new import_protocols4.DataCorruptionError("Metadata checksum is invalid.");
|
|
525
566
|
}
|
|
526
567
|
return codec2.decode(data);
|
|
527
568
|
} finally {
|
|
@@ -540,8 +581,8 @@ var MetadataStore = class {
|
|
|
540
581
|
size: encoded.length,
|
|
541
582
|
checksum
|
|
542
583
|
}, {
|
|
543
|
-
F:
|
|
544
|
-
L:
|
|
584
|
+
F: __dxlog_file4,
|
|
585
|
+
L: 110,
|
|
545
586
|
S: this,
|
|
546
587
|
C: (f, a) => f(...a)
|
|
547
588
|
});
|
|
@@ -572,8 +613,8 @@ var MetadataStore = class {
|
|
|
572
613
|
import_log3.log.error("failed to load metadata", {
|
|
573
614
|
err
|
|
574
615
|
}, {
|
|
575
|
-
F:
|
|
576
|
-
L:
|
|
616
|
+
F: __dxlog_file4,
|
|
617
|
+
L: 141,
|
|
577
618
|
S: this,
|
|
578
619
|
C: (f, a) => f(...a)
|
|
579
620
|
});
|
|
@@ -589,8 +630,8 @@ var MetadataStore = class {
|
|
|
589
630
|
import_log3.log.error("failed to load space large metadata", {
|
|
590
631
|
err
|
|
591
632
|
}, {
|
|
592
|
-
F:
|
|
593
|
-
L:
|
|
633
|
+
F: __dxlog_file4,
|
|
634
|
+
L: 153,
|
|
594
635
|
S: this,
|
|
595
636
|
C: (f, a) => f(...a)
|
|
596
637
|
});
|
|
@@ -600,7 +641,7 @@ var MetadataStore = class {
|
|
|
600
641
|
async _save() {
|
|
601
642
|
const data = {
|
|
602
643
|
...this._metadata,
|
|
603
|
-
version:
|
|
644
|
+
version: import_protocols4.STORAGE_VERSION,
|
|
604
645
|
created: this._metadata.created ?? /* @__PURE__ */ new Date(),
|
|
605
646
|
updated: /* @__PURE__ */ new Date()
|
|
606
647
|
};
|
|
@@ -619,8 +660,8 @@ var MetadataStore = class {
|
|
|
619
660
|
import_log3.log.error("failed to load space large metadata", {
|
|
620
661
|
err
|
|
621
662
|
}, {
|
|
622
|
-
F:
|
|
623
|
-
L:
|
|
663
|
+
F: __dxlog_file4,
|
|
664
|
+
L: 182,
|
|
624
665
|
S: this,
|
|
625
666
|
C: (f, a) => f(...a)
|
|
626
667
|
});
|
|
@@ -639,9 +680,9 @@ var MetadataStore = class {
|
|
|
639
680
|
return this._metadata.identity.haloSpace;
|
|
640
681
|
}
|
|
641
682
|
const space = this.spaces.find((space2) => space2.key === spaceKey);
|
|
642
|
-
(0,
|
|
643
|
-
F:
|
|
644
|
-
L:
|
|
683
|
+
(0, import_invariant4.invariant)(space, "Space not found", {
|
|
684
|
+
F: __dxlog_file4,
|
|
685
|
+
L: 204,
|
|
645
686
|
S: this,
|
|
646
687
|
A: [
|
|
647
688
|
"space",
|
|
@@ -664,8 +705,8 @@ var MetadataStore = class {
|
|
|
664
705
|
*/
|
|
665
706
|
async clear() {
|
|
666
707
|
(0, import_log3.log)("clearing all metadata", void 0, {
|
|
667
|
-
F:
|
|
668
|
-
L:
|
|
708
|
+
F: __dxlog_file4,
|
|
709
|
+
L: 223,
|
|
669
710
|
S: this,
|
|
670
711
|
C: (f, a) => f(...a)
|
|
671
712
|
});
|
|
@@ -676,9 +717,9 @@ var MetadataStore = class {
|
|
|
676
717
|
return this._metadata.identity;
|
|
677
718
|
}
|
|
678
719
|
async setIdentityRecord(record) {
|
|
679
|
-
(0,
|
|
680
|
-
F:
|
|
681
|
-
L:
|
|
720
|
+
(0, import_invariant4.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
721
|
+
F: __dxlog_file4,
|
|
722
|
+
L: 233,
|
|
682
723
|
S: this,
|
|
683
724
|
A: [
|
|
684
725
|
"!this._metadata.identity",
|
|
@@ -690,9 +731,9 @@ var MetadataStore = class {
|
|
|
690
731
|
await this.flush();
|
|
691
732
|
}
|
|
692
733
|
async addSpace(record) {
|
|
693
|
-
(0,
|
|
694
|
-
F:
|
|
695
|
-
L:
|
|
734
|
+
(0, import_invariant4.invariant)(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
|
|
735
|
+
F: __dxlog_file4,
|
|
736
|
+
L: 241,
|
|
696
737
|
S: this,
|
|
697
738
|
A: [
|
|
698
739
|
"!(this._metadata.spaces ?? []).find((space) => space.key === record.key)",
|
|
@@ -752,19 +793,19 @@ var fromBytesInt32 = (buf) => buf.readInt32LE(0);
|
|
|
752
793
|
var import_async3 = require("@dxos/async");
|
|
753
794
|
var import_context3 = require("@dxos/context");
|
|
754
795
|
var import_crypto2 = require("@dxos/crypto");
|
|
755
|
-
var
|
|
796
|
+
var import_invariant5 = require("@dxos/invariant");
|
|
756
797
|
var import_log4 = require("@dxos/log");
|
|
757
|
-
var
|
|
798
|
+
var import_protocols5 = require("@dxos/protocols");
|
|
758
799
|
var import_teleport = require("@dxos/teleport");
|
|
759
|
-
var
|
|
800
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
760
801
|
var AuthExtension = class extends import_teleport.RpcExtension {
|
|
761
802
|
constructor(_authParams) {
|
|
762
803
|
super({
|
|
763
804
|
requested: {
|
|
764
|
-
AuthService:
|
|
805
|
+
AuthService: import_protocols5.schema.getService("dxos.mesh.teleport.auth.AuthService")
|
|
765
806
|
},
|
|
766
807
|
exposed: {
|
|
767
|
-
AuthService:
|
|
808
|
+
AuthService: import_protocols5.schema.getService("dxos.mesh.teleport.auth.AuthService")
|
|
768
809
|
},
|
|
769
810
|
timeout: 60 * 1e3
|
|
770
811
|
});
|
|
@@ -772,7 +813,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
772
813
|
this._ctx = new import_context3.Context({
|
|
773
814
|
onError: (err) => {
|
|
774
815
|
import_log4.log.catch(err, void 0, {
|
|
775
|
-
F:
|
|
816
|
+
F: __dxlog_file5,
|
|
776
817
|
L: 28,
|
|
777
818
|
S: this,
|
|
778
819
|
C: (f, a) => f(...a)
|
|
@@ -794,7 +835,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
794
835
|
};
|
|
795
836
|
} catch (err) {
|
|
796
837
|
import_log4.log.error("failed to generate auth credentials", err, {
|
|
797
|
-
F:
|
|
838
|
+
F: __dxlog_file5,
|
|
798
839
|
L: 55,
|
|
799
840
|
S: this,
|
|
800
841
|
C: (f, a) => f(...a)
|
|
@@ -813,8 +854,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
813
854
|
const { credential } = await this.rpc.AuthService.authenticate({
|
|
814
855
|
challenge
|
|
815
856
|
});
|
|
816
|
-
(0,
|
|
817
|
-
F:
|
|
857
|
+
(0, import_invariant5.invariant)(credential?.length > 0, "invalid credential", {
|
|
858
|
+
F: __dxlog_file5,
|
|
818
859
|
L: 69,
|
|
819
860
|
S: this,
|
|
820
861
|
A: [
|
|
@@ -823,8 +864,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
823
864
|
]
|
|
824
865
|
});
|
|
825
866
|
const success = await this._authParams.verifier(challenge, credential);
|
|
826
|
-
(0,
|
|
827
|
-
F:
|
|
867
|
+
(0, import_invariant5.invariant)(success, "credential not verified", {
|
|
868
|
+
F: __dxlog_file5,
|
|
828
869
|
L: 71,
|
|
829
870
|
S: this,
|
|
830
871
|
A: [
|
|
@@ -835,7 +876,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
835
876
|
(0, import_async3.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
|
|
836
877
|
} catch (err) {
|
|
837
878
|
(0, import_log4.log)("auth failed", err, {
|
|
838
|
-
F:
|
|
879
|
+
F: __dxlog_file5,
|
|
839
880
|
L: 74,
|
|
840
881
|
S: this,
|
|
841
882
|
C: (f, a) => f(...a)
|
|
@@ -885,39 +926,6 @@ var import_log7 = require("@dxos/log");
|
|
|
885
926
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
886
927
|
var import_util4 = require("@dxos/util");
|
|
887
928
|
|
|
888
|
-
// packages/core/echo/echo-pipeline/src/common/codec.ts
|
|
889
|
-
var import_hypercore = require("@dxos/hypercore");
|
|
890
|
-
var import_protocols5 = require("@dxos/protocols");
|
|
891
|
-
var codec = import_protocols5.schema.getCodecForType("dxos.echo.feed.FeedMessage");
|
|
892
|
-
var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
|
|
893
|
-
|
|
894
|
-
// packages/core/echo/echo-pipeline/src/common/feeds.ts
|
|
895
|
-
var import_invariant5 = require("@dxos/invariant");
|
|
896
|
-
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
|
|
897
|
-
var createMappedFeedWriter = (mapper, writer) => {
|
|
898
|
-
(0, import_invariant5.invariant)(mapper, void 0, {
|
|
899
|
-
F: __dxlog_file5,
|
|
900
|
-
L: 16,
|
|
901
|
-
S: void 0,
|
|
902
|
-
A: [
|
|
903
|
-
"mapper",
|
|
904
|
-
""
|
|
905
|
-
]
|
|
906
|
-
});
|
|
907
|
-
(0, import_invariant5.invariant)(writer, void 0, {
|
|
908
|
-
F: __dxlog_file5,
|
|
909
|
-
L: 17,
|
|
910
|
-
S: void 0,
|
|
911
|
-
A: [
|
|
912
|
-
"writer",
|
|
913
|
-
""
|
|
914
|
-
]
|
|
915
|
-
});
|
|
916
|
-
return {
|
|
917
|
-
write: async (data, options) => await writer.write(await mapper(data), options)
|
|
918
|
-
};
|
|
919
|
-
};
|
|
920
|
-
|
|
921
929
|
// packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
|
|
922
930
|
var import_invariant6 = require("@dxos/invariant");
|
|
923
931
|
var import_log5 = require("@dxos/log");
|
|
@@ -973,7 +981,6 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
|
973
981
|
index: index + 1
|
|
974
982
|
}));
|
|
975
983
|
var TimeframeClock = class {
|
|
976
|
-
// prettier-ignore
|
|
977
984
|
constructor(_timeframe = new import_timeframe.Timeframe()) {
|
|
978
985
|
this._timeframe = _timeframe;
|
|
979
986
|
this.update = new import_async4.Event();
|
|
@@ -1019,7 +1026,7 @@ var TimeframeClock = class {
|
|
|
1019
1026
|
current: this._timeframe
|
|
1020
1027
|
}, {
|
|
1021
1028
|
F: __dxlog_file7,
|
|
1022
|
-
L:
|
|
1029
|
+
L: 70,
|
|
1023
1030
|
S: this,
|
|
1024
1031
|
C: (f, a) => f(...a)
|
|
1025
1032
|
});
|
|
@@ -1030,7 +1037,7 @@ var TimeframeClock = class {
|
|
|
1030
1037
|
deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
|
|
1031
1038
|
}, {
|
|
1032
1039
|
F: __dxlog_file7,
|
|
1033
|
-
L:
|
|
1040
|
+
L: 72,
|
|
1034
1041
|
S: this,
|
|
1035
1042
|
C: (f, a) => f(...a)
|
|
1036
1043
|
});
|
|
@@ -1055,7 +1062,6 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
1055
1062
|
}
|
|
1056
1063
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
1057
1064
|
var PipelineState = class {
|
|
1058
|
-
// prettier-ignore
|
|
1059
1065
|
constructor(_feeds, _timeframeClock) {
|
|
1060
1066
|
this._feeds = _feeds;
|
|
1061
1067
|
this._timeframeClock = _timeframeClock;
|
|
@@ -1114,7 +1120,7 @@ var PipelineState = class {
|
|
|
1114
1120
|
target: this.targetTimeframe
|
|
1115
1121
|
}, {
|
|
1116
1122
|
F: __dxlog_file8,
|
|
1117
|
-
L:
|
|
1123
|
+
L: 133,
|
|
1118
1124
|
S: this,
|
|
1119
1125
|
C: (f, a) => f(...a)
|
|
1120
1126
|
});
|
|
@@ -1146,7 +1152,7 @@ var PipelineState = class {
|
|
|
1146
1152
|
dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
|
|
1147
1153
|
}, {
|
|
1148
1154
|
F: __dxlog_file8,
|
|
1149
|
-
L:
|
|
1155
|
+
L: 161,
|
|
1150
1156
|
S: this,
|
|
1151
1157
|
C: (f, a) => f(...a)
|
|
1152
1158
|
});
|
|
@@ -1179,7 +1185,7 @@ var Pipeline = class {
|
|
|
1179
1185
|
get writer() {
|
|
1180
1186
|
(0, import_invariant7.invariant)(this._writer, "Writer not set.", {
|
|
1181
1187
|
F: __dxlog_file8,
|
|
1182
|
-
L:
|
|
1188
|
+
L: 242,
|
|
1183
1189
|
S: this,
|
|
1184
1190
|
A: [
|
|
1185
1191
|
"this._writer",
|
|
@@ -1208,7 +1214,7 @@ var Pipeline = class {
|
|
|
1208
1214
|
setWriteFeed(feed) {
|
|
1209
1215
|
(0, import_invariant7.invariant)(!this._writer, "Writer already set.", {
|
|
1210
1216
|
F: __dxlog_file8,
|
|
1211
|
-
L:
|
|
1217
|
+
L: 269,
|
|
1212
1218
|
S: this,
|
|
1213
1219
|
A: [
|
|
1214
1220
|
"!this._writer",
|
|
@@ -1217,7 +1223,7 @@ var Pipeline = class {
|
|
|
1217
1223
|
});
|
|
1218
1224
|
(0, import_invariant7.invariant)(feed.properties.writable, "Feed must be writable.", {
|
|
1219
1225
|
F: __dxlog_file8,
|
|
1220
|
-
L:
|
|
1226
|
+
L: 270,
|
|
1221
1227
|
S: this,
|
|
1222
1228
|
A: [
|
|
1223
1229
|
"feed.properties.writable",
|
|
@@ -1232,7 +1238,7 @@ var Pipeline = class {
|
|
|
1232
1238
|
async start() {
|
|
1233
1239
|
(0, import_invariant7.invariant)(!this._isStarted, "Pipeline is already started.", {
|
|
1234
1240
|
F: __dxlog_file8,
|
|
1235
|
-
L:
|
|
1241
|
+
L: 283,
|
|
1236
1242
|
S: this,
|
|
1237
1243
|
A: [
|
|
1238
1244
|
"!this._isStarted",
|
|
@@ -1241,7 +1247,7 @@ var Pipeline = class {
|
|
|
1241
1247
|
});
|
|
1242
1248
|
(0, import_log7.log)("starting...", void 0, {
|
|
1243
1249
|
F: __dxlog_file8,
|
|
1244
|
-
L:
|
|
1250
|
+
L: 284,
|
|
1245
1251
|
S: this,
|
|
1246
1252
|
C: (f, a) => f(...a)
|
|
1247
1253
|
});
|
|
@@ -1250,7 +1256,7 @@ var Pipeline = class {
|
|
|
1250
1256
|
this._isStarted = true;
|
|
1251
1257
|
(0, import_log7.log)("started", void 0, {
|
|
1252
1258
|
F: __dxlog_file8,
|
|
1253
|
-
L:
|
|
1259
|
+
L: 288,
|
|
1254
1260
|
S: this,
|
|
1255
1261
|
C: (f, a) => f(...a)
|
|
1256
1262
|
});
|
|
@@ -1263,7 +1269,7 @@ var Pipeline = class {
|
|
|
1263
1269
|
async stop() {
|
|
1264
1270
|
(0, import_log7.log)("stopping...", void 0, {
|
|
1265
1271
|
F: __dxlog_file8,
|
|
1266
|
-
L:
|
|
1272
|
+
L: 299,
|
|
1267
1273
|
S: this,
|
|
1268
1274
|
C: (f, a) => f(...a)
|
|
1269
1275
|
});
|
|
@@ -1281,7 +1287,7 @@ var Pipeline = class {
|
|
|
1281
1287
|
this._isStarted = false;
|
|
1282
1288
|
(0, import_log7.log)("stopped", void 0, {
|
|
1283
1289
|
F: __dxlog_file8,
|
|
1284
|
-
L:
|
|
1290
|
+
L: 312,
|
|
1285
1291
|
S: this,
|
|
1286
1292
|
C: (f, a) => f(...a)
|
|
1287
1293
|
});
|
|
@@ -1293,7 +1299,7 @@ var Pipeline = class {
|
|
|
1293
1299
|
async setCursor(timeframe) {
|
|
1294
1300
|
(0, import_invariant7.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
1295
1301
|
F: __dxlog_file8,
|
|
1296
|
-
L:
|
|
1302
|
+
L: 321,
|
|
1297
1303
|
S: this,
|
|
1298
1304
|
A: [
|
|
1299
1305
|
"!this._isStarted || this._isPaused",
|
|
@@ -1322,7 +1328,7 @@ var Pipeline = class {
|
|
|
1322
1328
|
async unpause() {
|
|
1323
1329
|
(0, import_invariant7.invariant)(this._isPaused, "Pipeline is not paused.", {
|
|
1324
1330
|
F: __dxlog_file8,
|
|
1325
|
-
L:
|
|
1331
|
+
L: 350,
|
|
1326
1332
|
S: this,
|
|
1327
1333
|
A: [
|
|
1328
1334
|
"this._isPaused",
|
|
@@ -1342,7 +1348,7 @@ var Pipeline = class {
|
|
|
1342
1348
|
async *consume() {
|
|
1343
1349
|
(0, import_invariant7.invariant)(!this._isBeingConsumed, "Pipeline is already being consumed.", {
|
|
1344
1350
|
F: __dxlog_file8,
|
|
1345
|
-
L:
|
|
1351
|
+
L: 365,
|
|
1346
1352
|
S: this,
|
|
1347
1353
|
A: [
|
|
1348
1354
|
"!this._isBeingConsumed",
|
|
@@ -1352,7 +1358,7 @@ var Pipeline = class {
|
|
|
1352
1358
|
this._isBeingConsumed = true;
|
|
1353
1359
|
(0, import_invariant7.invariant)(this._feedSetIterator, "Iterator not initialized.", {
|
|
1354
1360
|
F: __dxlog_file8,
|
|
1355
|
-
L:
|
|
1361
|
+
L: 368,
|
|
1356
1362
|
S: this,
|
|
1357
1363
|
A: [
|
|
1358
1364
|
"this._feedSetIterator",
|
|
@@ -1366,7 +1372,7 @@ var Pipeline = class {
|
|
|
1366
1372
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
1367
1373
|
(0, import_invariant7.invariant)(this._feedSetIterator, "Iterator not initialized.", {
|
|
1368
1374
|
F: __dxlog_file8,
|
|
1369
|
-
L:
|
|
1375
|
+
L: 377,
|
|
1370
1376
|
S: this,
|
|
1371
1377
|
A: [
|
|
1372
1378
|
"this._feedSetIterator",
|
|
@@ -1401,7 +1407,7 @@ var Pipeline = class {
|
|
|
1401
1407
|
length: feed.length
|
|
1402
1408
|
}, {
|
|
1403
1409
|
F: __dxlog_file8,
|
|
1404
|
-
L:
|
|
1410
|
+
L: 406,
|
|
1405
1411
|
S: this,
|
|
1406
1412
|
C: (f, a) => f(...a)
|
|
1407
1413
|
});
|
|
@@ -1415,7 +1421,7 @@ var Pipeline = class {
|
|
|
1415
1421
|
data
|
|
1416
1422
|
}, {
|
|
1417
1423
|
F: __dxlog_file8,
|
|
1418
|
-
L:
|
|
1424
|
+
L: 411,
|
|
1419
1425
|
S: this,
|
|
1420
1426
|
C: (f, a) => f(...a)
|
|
1421
1427
|
});
|
|
@@ -1431,7 +1437,7 @@ var Pipeline = class {
|
|
|
1431
1437
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1432
1438
|
import_log7.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
|
|
1433
1439
|
F: __dxlog_file8,
|
|
1434
|
-
L:
|
|
1440
|
+
L: 425,
|
|
1435
1441
|
S: this,
|
|
1436
1442
|
C: (f, a) => f(...a)
|
|
1437
1443
|
});
|
|
@@ -1711,9 +1717,9 @@ var import_async7 = require("@dxos/async");
|
|
|
1711
1717
|
var import_context6 = require("@dxos/context");
|
|
1712
1718
|
var import_credentials3 = require("@dxos/credentials");
|
|
1713
1719
|
var import_echo_db3 = require("@dxos/echo-db");
|
|
1714
|
-
var import_errors2 = require("@dxos/errors");
|
|
1715
1720
|
var import_invariant8 = require("@dxos/invariant");
|
|
1716
1721
|
var import_log9 = require("@dxos/log");
|
|
1722
|
+
var import_protocols6 = require("@dxos/protocols");
|
|
1717
1723
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
1718
1724
|
var import_tracing2 = require("@dxos/tracing");
|
|
1719
1725
|
var import_util6 = require("@dxos/util");
|
|
@@ -1956,7 +1962,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1956
1962
|
async _saveCache() {
|
|
1957
1963
|
const cache = {};
|
|
1958
1964
|
try {
|
|
1959
|
-
const propertiesItem = this.itemManager.items.find((item) => item.modelMeta?.type === "dxos
|
|
1965
|
+
const propertiesItem = this.itemManager.items.find((item) => item.modelMeta?.type === "dxos.org/model/document" && // TODO(burdon): Document?
|
|
1960
1966
|
((0, import_echo_db3.getStateMachineFromItem)(item)?.snapshot()).type === import_echo_db3.TYPE_PROPERTIES);
|
|
1961
1967
|
if (propertiesItem) {
|
|
1962
1968
|
cache.properties = (0, import_echo_db3.getStateMachineFromItem)(propertiesItem)?.snapshot();
|
|
@@ -1990,7 +1996,7 @@ var DataPipeline = class DataPipeline2 {
|
|
|
1990
1996
|
await this._epochCtx?.dispose();
|
|
1991
1997
|
const ctx = new import_context6.Context({
|
|
1992
1998
|
onError: (err) => {
|
|
1993
|
-
if (err instanceof
|
|
1999
|
+
if (err instanceof import_protocols6.CancelledError) {
|
|
1994
2000
|
(0, import_log9.log)("Epoch processing cancelled.", void 0, {
|
|
1995
2001
|
F: __dxlog_file10,
|
|
1996
2002
|
L: 335,
|
|
@@ -2399,7 +2405,7 @@ var import_async9 = require("@dxos/async");
|
|
|
2399
2405
|
var import_debug4 = require("@dxos/debug");
|
|
2400
2406
|
var import_keys7 = require("@dxos/keys");
|
|
2401
2407
|
var import_log12 = require("@dxos/log");
|
|
2402
|
-
var
|
|
2408
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
2403
2409
|
var import_util9 = require("@dxos/util");
|
|
2404
2410
|
|
|
2405
2411
|
// packages/core/echo/echo-pipeline/src/space/space-protocol.ts
|
|
@@ -2643,7 +2649,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2643
2649
|
].map((space) => space.close()));
|
|
2644
2650
|
}
|
|
2645
2651
|
async constructSpace({ metadata, swarmIdentity, onNetworkConnection, onAuthFailure, memberKey }) {
|
|
2646
|
-
import_log12.log.trace("dxos.echo.space-manager.construct-space",
|
|
2652
|
+
import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.begin({
|
|
2647
2653
|
id: this._instanceId
|
|
2648
2654
|
}), {
|
|
2649
2655
|
F: __dxlog_file13,
|
|
@@ -2681,7 +2687,7 @@ var SpaceManager = class SpaceManager2 {
|
|
|
2681
2687
|
memberKey
|
|
2682
2688
|
});
|
|
2683
2689
|
this._spaces.set(space.key, space);
|
|
2684
|
-
import_log12.log.trace("dxos.echo.space-manager.construct-space",
|
|
2690
|
+
import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.end({
|
|
2685
2691
|
id: this._instanceId
|
|
2686
2692
|
}), {
|
|
2687
2693
|
F: __dxlog_file13,
|
|
@@ -2702,16 +2708,6 @@ SpaceManager = _ts_decorate9([
|
|
|
2702
2708
|
(0, import_async9.trackLeaks)("open", "close")
|
|
2703
2709
|
], SpaceManager);
|
|
2704
2710
|
|
|
2705
|
-
// packages/core/echo/echo-pipeline/src/testing/test-feed-builder.ts
|
|
2706
|
-
var import_testing = require("@dxos/feed-store/testing");
|
|
2707
|
-
var TestFeedBuilder = class extends import_testing.TestBuilder {
|
|
2708
|
-
constructor() {
|
|
2709
|
-
super({
|
|
2710
|
-
valueEncoding
|
|
2711
|
-
});
|
|
2712
|
-
}
|
|
2713
|
-
};
|
|
2714
|
-
|
|
2715
2711
|
// packages/core/echo/echo-pipeline/src/testing/test-agent-builder.ts
|
|
2716
2712
|
var MemoryNetworkManagerProvider = (signalContext) => () => new import_network_manager2.NetworkManager({
|
|
2717
2713
|
signalManager: new import_messaging.MemorySignalManager(signalContext),
|