@dxos/echo-pipeline 0.1.55 → 0.1.56-main.01afb72

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.
Files changed (37) hide show
  1. package/dist/lib/browser/{chunk-4VJRJ4SY.mjs → chunk-7S5RJM3K.mjs} +478 -169
  2. package/dist/lib/browser/chunk-7S5RJM3K.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +3 -2
  6. package/dist/lib/browser/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/index.cjs +474 -165
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +464 -154
  11. package/dist/lib/node/testing/index.cjs.map +3 -3
  12. package/dist/types/src/common/feeds.d.ts.map +1 -1
  13. package/dist/types/src/db-host/data-service-host.d.ts.map +1 -1
  14. package/dist/types/src/db-host/data-service.d.ts.map +1 -1
  15. package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
  16. package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
  17. package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
  18. package/dist/types/src/space/auth.d.ts.map +1 -1
  19. package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
  20. package/dist/types/src/space/space-protocol.d.ts.map +1 -1
  21. package/dist/types/src/space/space.d.ts +2 -1
  22. package/dist/types/src/space/space.d.ts.map +1 -1
  23. package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
  24. package/package.json +32 -31
  25. package/src/common/feeds.ts +1 -2
  26. package/src/db-host/data-service-host.ts +1 -2
  27. package/src/db-host/data-service.ts +1 -2
  28. package/src/metadata/metadata-store.ts +1 -1
  29. package/src/pipeline/message-selector.ts +1 -2
  30. package/src/pipeline/pipeline.ts +1 -2
  31. package/src/space/auth.ts +1 -2
  32. package/src/space/data-pipeline.ts +1 -2
  33. package/src/space/space-protocol.ts +3 -2
  34. package/src/space/space.test.ts +18 -17
  35. package/src/space/space.ts +6 -3
  36. package/src/testing/test-agent-builder.ts +2 -1
  37. package/dist/lib/browser/chunk-4VJRJ4SY.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,13 +56,13 @@ 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
- var __dxlog_file = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
65
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service-host.ts";
65
66
  var DataServiceHost = class {
66
67
  constructor(_itemManager, _itemDemuxer, _writeStream) {
67
68
  this._itemManager = _itemManager;
@@ -90,13 +91,21 @@ var DataServiceHost = class {
90
91
  this._itemDemuxer.mutation.on(ctx, (message) => {
91
92
  var _a;
92
93
  const { batch, meta } = message;
93
- (0, import_tiny_invariant.default)(!meta.clientTag, "Unexpected client tag in mutation message");
94
+ (0, import_invariant.invariant)(!meta.clientTag, "Unexpected client tag in mutation message", {
95
+ F: __dxlog_file,
96
+ L: 61,
97
+ S: this,
98
+ A: [
99
+ "!(meta as any).clientTag",
100
+ "'Unexpected client tag in mutation message'"
101
+ ]
102
+ });
94
103
  (0, import_log.log)("message", {
95
104
  batch,
96
105
  meta
97
106
  }, {
98
107
  F: __dxlog_file,
99
- L: 63,
108
+ L: 62,
100
109
  S: this,
101
110
  C: (f, a) => f(...a)
102
111
  });
@@ -123,14 +132,30 @@ var DataServiceHost = class {
123
132
  }
124
133
  async write(request) {
125
134
  var _a, _b;
126
- (0, import_tiny_invariant.default)(!this._ctx.disposed, "Cannot write to closed DataServiceHost");
127
- (0, import_tiny_invariant.default)(this._writeStream, "Cannot write mutations in readonly mode");
135
+ (0, import_invariant.invariant)(!this._ctx.disposed, "Cannot write to closed DataServiceHost", {
136
+ F: __dxlog_file,
137
+ L: 88,
138
+ S: this,
139
+ A: [
140
+ "!this._ctx.disposed",
141
+ "'Cannot write to closed DataServiceHost'"
142
+ ]
143
+ });
144
+ (0, import_invariant.invariant)(this._writeStream, "Cannot write mutations in readonly mode", {
145
+ F: __dxlog_file,
146
+ L: 89,
147
+ S: this,
148
+ A: [
149
+ "this._writeStream",
150
+ "'Cannot write mutations in readonly mode'"
151
+ ]
152
+ });
128
153
  (0, import_log.log)("write", {
129
154
  clientTag: request.clientTag,
130
155
  objectCount: (_b = (_a = request.batch.objects) == null ? void 0 : _a.length) != null ? _b : 0
131
156
  }, {
132
157
  F: __dxlog_file,
133
- L: 92,
158
+ L: 91,
134
159
  S: this,
135
160
  C: (f, a) => f(...a)
136
161
  });
@@ -144,7 +169,7 @@ var DataServiceHost = class {
144
169
  seq: receipt2.seq
145
170
  }, {
146
171
  F: __dxlog_file,
147
- L: 101,
172
+ L: 100,
148
173
  S: this,
149
174
  C: (f, a) => f(...a)
150
175
  });
@@ -311,12 +336,12 @@ var SnapshotStore = class {
311
336
  };
312
337
 
313
338
  // packages/core/echo/echo-pipeline/src/db-host/data-service.ts
314
- var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
315
339
  var import_debug2 = require("@dxos/debug");
340
+ var import_invariant2 = require("@dxos/invariant");
316
341
  var import_keys2 = require("@dxos/keys");
317
342
  var import_log2 = require("@dxos/log");
318
343
  var import_util2 = require("@dxos/util");
319
- var __dxlog_file2 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
344
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
320
345
  var DataServiceSubscriptions = class {
321
346
  constructor() {
322
347
  this._spaces = new import_util2.ComplexMap(import_keys2.PublicKey.hash);
@@ -329,11 +354,19 @@ var DataServiceSubscriptions = class {
329
354
  spaceKey
330
355
  }, {
331
356
  F: __dxlog_file2,
332
- L: 31,
357
+ L: 30,
333
358
  S: this,
334
359
  C: (f, a) => f(...a)
335
360
  });
336
- (0, import_tiny_invariant2.default)(!this._spaces.has(spaceKey));
361
+ (0, import_invariant2.invariant)(!this._spaces.has(spaceKey), void 0, {
362
+ F: __dxlog_file2,
363
+ L: 31,
364
+ S: this,
365
+ A: [
366
+ "!this._spaces.has(spaceKey)",
367
+ ""
368
+ ]
369
+ });
337
370
  await host.open();
338
371
  this._spaces.set(spaceKey, host);
339
372
  }
@@ -342,7 +375,7 @@ var DataServiceSubscriptions = class {
342
375
  spaceKey
343
376
  }, {
344
377
  F: __dxlog_file2,
345
- L: 38,
378
+ L: 37,
346
379
  S: this,
347
380
  C: (f, a) => f(...a)
348
381
  });
@@ -360,14 +393,38 @@ var DataServiceImpl = class {
360
393
  }
361
394
  subscribe(request) {
362
395
  var _a;
363
- (0, import_tiny_invariant2.default)(request.spaceKey);
396
+ (0, import_invariant2.invariant)(request.spaceKey, void 0, {
397
+ F: __dxlog_file2,
398
+ L: 56,
399
+ S: this,
400
+ A: [
401
+ "request.spaceKey",
402
+ ""
403
+ ]
404
+ });
364
405
  const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
365
406
  return host.subscribe();
366
407
  }
367
408
  write(request) {
368
409
  var _a;
369
- (0, import_tiny_invariant2.default)(request.spaceKey);
370
- (0, import_tiny_invariant2.default)(request.batch);
410
+ (0, import_invariant2.invariant)(request.spaceKey, void 0, {
411
+ F: __dxlog_file2,
412
+ L: 63,
413
+ S: this,
414
+ A: [
415
+ "request.spaceKey",
416
+ ""
417
+ ]
418
+ });
419
+ (0, import_invariant2.invariant)(request.batch, void 0, {
420
+ F: __dxlog_file2,
421
+ L: 64,
422
+ S: this,
423
+ A: [
424
+ "request.batch",
425
+ ""
426
+ ]
427
+ });
371
428
  const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug2.raise)(new Error(`space not found: ${request.spaceKey}`));
372
429
  return host.write(request);
373
430
  }
@@ -375,9 +432,9 @@ var DataServiceImpl = class {
375
432
 
376
433
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
377
434
  var import_crc_32 = __toESM(require("crc-32"));
378
- var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
379
435
  var import_async2 = require("@dxos/async");
380
436
  var import_errors = require("@dxos/errors");
437
+ var import_invariant3 = require("@dxos/invariant");
381
438
  var import_log3 = require("@dxos/log");
382
439
  var import_protocols3 = require("@dxos/protocols");
383
440
  var import_services = require("@dxos/protocols/proto/dxos/client/services");
@@ -392,7 +449,7 @@ function _ts_decorate2(decorators, target, key, desc) {
392
449
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
393
450
  return c > 3 && r && Object.defineProperty(target, key, r), r;
394
451
  }
395
- var __dxlog_file3 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
452
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
396
453
  var emptyEchoMetadata = () => ({
397
454
  version: import_protocols3.STORAGE_VERSION,
398
455
  spaces: [],
@@ -508,7 +565,15 @@ var MetadataStore = class {
508
565
  return this._metadata.identity.haloSpace;
509
566
  }
510
567
  const space = this.spaces.find((space2) => space2.key === spaceKey);
511
- (0, import_tiny_invariant3.default)(space, "Space not found");
568
+ (0, import_invariant3.invariant)(space, "Space not found", {
569
+ F: __dxlog_file3,
570
+ L: 137,
571
+ S: this,
572
+ A: [
573
+ "space",
574
+ "'Space not found'"
575
+ ]
576
+ });
512
577
  return space;
513
578
  }
514
579
  /**
@@ -528,13 +593,29 @@ var MetadataStore = class {
528
593
  return this._metadata.identity;
529
594
  }
530
595
  async setIdentityRecord(record) {
531
- (0, import_tiny_invariant3.default)(!this._metadata.identity, "Cannot overwrite existing identity in metadata");
596
+ (0, import_invariant3.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
597
+ F: __dxlog_file3,
598
+ L: 155,
599
+ S: this,
600
+ A: [
601
+ "!this._metadata.identity",
602
+ "'Cannot overwrite existing identity in metadata'"
603
+ ]
604
+ });
532
605
  this._metadata.identity = record;
533
606
  await this._save();
534
607
  }
535
608
  async addSpace(record) {
536
609
  var _a, _b, _c;
537
- (0, import_tiny_invariant3.default)(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata");
610
+ (0, import_invariant3.invariant)(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
611
+ F: __dxlog_file3,
612
+ L: 162,
613
+ S: this,
614
+ A: [
615
+ "!(this._metadata.spaces ?? []).find((space) => space.key === record.key)",
616
+ "'Cannot overwrite existing space in metadata'"
617
+ ]
618
+ });
538
619
  ((_c = (_b = this._metadata).spaces) != null ? _c : _b.spaces = []).push(record);
539
620
  await this._save();
540
621
  }
@@ -570,14 +651,14 @@ _ts_decorate2([
570
651
  var fromBytesInt32 = (buf) => buf.readInt32LE(0);
571
652
 
572
653
  // packages/core/echo/echo-pipeline/src/space/auth.ts
573
- var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
574
654
  var import_async3 = require("@dxos/async");
575
655
  var import_context3 = require("@dxos/context");
576
656
  var import_crypto2 = require("@dxos/crypto");
657
+ var import_invariant4 = require("@dxos/invariant");
577
658
  var import_log4 = require("@dxos/log");
578
659
  var import_protocols4 = require("@dxos/protocols");
579
660
  var import_teleport = require("@dxos/teleport");
580
- var __dxlog_file4 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/auth.ts";
661
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
581
662
  var AuthExtension = class extends import_teleport.RpcExtension {
582
663
  constructor(_authParams) {
583
664
  super({
@@ -594,7 +675,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
594
675
  onError: (err) => {
595
676
  import_log4.log.catch(err, void 0, {
596
677
  F: __dxlog_file4,
597
- L: 29,
678
+ L: 28,
598
679
  S: this,
599
680
  C: (f, a) => f(...a)
600
681
  });
@@ -616,7 +697,7 @@ var AuthExtension = class extends import_teleport.RpcExtension {
616
697
  } catch (err) {
617
698
  import_log4.log.error("failed to generate auth credentials", err, {
618
699
  F: __dxlog_file4,
619
- L: 56,
700
+ L: 55,
620
701
  S: this,
621
702
  C: (f, a) => f(...a)
622
703
  });
@@ -634,14 +715,30 @@ var AuthExtension = class extends import_teleport.RpcExtension {
634
715
  const { credential } = await this.rpc.AuthService.authenticate({
635
716
  challenge
636
717
  });
637
- (0, import_tiny_invariant4.default)((credential == null ? void 0 : credential.length) > 0, "invalid credential");
718
+ (0, import_invariant4.invariant)((credential == null ? void 0 : credential.length) > 0, "invalid credential", {
719
+ F: __dxlog_file4,
720
+ L: 69,
721
+ S: this,
722
+ A: [
723
+ "credential?.length > 0",
724
+ "'invalid credential'"
725
+ ]
726
+ });
638
727
  const success = await this._authParams.verifier(challenge, credential);
639
- (0, import_tiny_invariant4.default)(success, "credential not verified");
728
+ (0, import_invariant4.invariant)(success, "credential not verified", {
729
+ F: __dxlog_file4,
730
+ L: 71,
731
+ S: this,
732
+ A: [
733
+ "success",
734
+ "'credential not verified'"
735
+ ]
736
+ });
640
737
  (0, import_async3.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
641
738
  } catch (err) {
642
739
  (0, import_log4.log)("auth failed", err, {
643
740
  F: __dxlog_file4,
644
- L: 75,
741
+ L: 74,
645
742
  S: this,
646
743
  C: (f, a) => f(...a)
647
744
  });
@@ -657,10 +754,11 @@ var AuthExtension = class extends import_teleport.RpcExtension {
657
754
  };
658
755
 
659
756
  // packages/core/echo/echo-pipeline/src/space/space.ts
660
- var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
661
757
  var import_async7 = require("@dxos/async");
758
+ var import_invariant9 = require("@dxos/invariant");
662
759
  var import_log10 = require("@dxos/log");
663
760
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
761
+ var import_tracing = require("@dxos/tracing");
664
762
  var import_util7 = require("@dxos/util");
665
763
 
666
764
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
@@ -672,11 +770,11 @@ var import_timeframe3 = require("@dxos/timeframe");
672
770
  var import_util5 = require("@dxos/util");
673
771
 
674
772
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
675
- var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
676
773
  var import_async5 = require("@dxos/async");
677
774
  var import_context4 = require("@dxos/context");
678
775
  var import_debug4 = require("@dxos/debug");
679
776
  var import_feed_store = require("@dxos/feed-store");
777
+ var import_invariant7 = require("@dxos/invariant");
680
778
  var import_keys3 = require("@dxos/keys");
681
779
  var import_log7 = require("@dxos/log");
682
780
  var import_timeframe2 = require("@dxos/timeframe");
@@ -689,31 +787,56 @@ var codec = import_protocols5.schema.getCodecForType("dxos.echo.feed.FeedMessage
689
787
  var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
690
788
 
691
789
  // packages/core/echo/echo-pipeline/src/common/feeds.ts
692
- var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
790
+ var import_invariant5 = require("@dxos/invariant");
791
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/common/feeds.ts";
693
792
  var createMappedFeedWriter = (mapper, writer) => {
694
- (0, import_tiny_invariant5.default)(mapper);
695
- (0, import_tiny_invariant5.default)(writer);
793
+ (0, import_invariant5.invariant)(mapper, void 0, {
794
+ F: __dxlog_file5,
795
+ L: 16,
796
+ S: void 0,
797
+ A: [
798
+ "mapper",
799
+ ""
800
+ ]
801
+ });
802
+ (0, import_invariant5.invariant)(writer, void 0, {
803
+ F: __dxlog_file5,
804
+ L: 17,
805
+ S: void 0,
806
+ A: [
807
+ "writer",
808
+ ""
809
+ ]
810
+ });
696
811
  return {
697
812
  write: async (data, options) => await writer.write(await mapper(data), options)
698
813
  };
699
814
  };
700
815
 
701
816
  // packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
702
- var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
817
+ var import_invariant6 = require("@dxos/invariant");
703
818
  var import_log5 = require("@dxos/log");
704
- var __dxlog_file5 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
819
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
705
820
  var createMessageSelector = (timeframeClock) => {
706
821
  return (messages) => {
707
822
  for (let i = 0; i < messages.length; i++) {
708
823
  const { data: { timeframe } } = messages[i];
709
- (0, import_tiny_invariant6.default)(timeframe);
824
+ (0, import_invariant6.invariant)(timeframe, void 0, {
825
+ F: __dxlog_file6,
826
+ L: 25,
827
+ S: void 0,
828
+ A: [
829
+ "timeframe",
830
+ ""
831
+ ]
832
+ });
710
833
  if (!timeframeClock.hasGaps(timeframe)) {
711
834
  return i;
712
835
  }
713
836
  }
714
837
  (0, import_log5.log)("Skipping...", void 0, {
715
- F: __dxlog_file5,
716
- L: 34,
838
+ F: __dxlog_file6,
839
+ L: 33,
717
840
  S: void 0,
718
841
  C: (f, a) => f(...a)
719
842
  });
@@ -735,7 +858,7 @@ function _ts_decorate3(decorators, target, key, desc) {
735
858
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
736
859
  return c > 3 && r && Object.defineProperty(target, key, r), r;
737
860
  }
738
- var __dxlog_file6 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
861
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
739
862
  var mapFeedIndexesToTimeframe = (indexes) => new import_timeframe.Timeframe(indexes.map(({ feedKey, index }) => [
740
863
  feedKey,
741
864
  index
@@ -790,7 +913,7 @@ var TimeframeClock = class {
790
913
  target,
791
914
  current: this._timeframe
792
915
  }, {
793
- F: __dxlog_file6,
916
+ F: __dxlog_file7,
794
917
  L: 73,
795
918
  S: this,
796
919
  C: (f, a) => f(...a)
@@ -801,7 +924,7 @@ var TimeframeClock = class {
801
924
  current: this._timeframe,
802
925
  deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
803
926
  }, {
804
- F: __dxlog_file6,
927
+ F: __dxlog_file7,
805
928
  L: 75,
806
929
  S: this,
807
930
  C: (f, a) => f(...a)
@@ -825,7 +948,7 @@ function _ts_decorate4(decorators, target, key, desc) {
825
948
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
826
949
  return c > 3 && r && Object.defineProperty(target, key, r), r;
827
950
  }
828
- var __dxlog_file7 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
951
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
829
952
  var PipelineState = class {
830
953
  // prettier-ignore
831
954
  constructor(_feeds, _timeframeClock) {
@@ -882,8 +1005,8 @@ var PipelineState = class {
882
1005
  current: this.timeframe,
883
1006
  target: this.targetTimeframe
884
1007
  }, {
885
- F: __dxlog_file7,
886
- L: 126,
1008
+ F: __dxlog_file8,
1009
+ L: 125,
887
1010
  S: this,
888
1011
  C: (f, a) => f(...a)
889
1012
  });
@@ -913,8 +1036,8 @@ var PipelineState = class {
913
1036
  target: this.targetTimeframe,
914
1037
  dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
915
1038
  }, {
916
- F: __dxlog_file7,
917
- L: 153,
1039
+ F: __dxlog_file8,
1040
+ L: 152,
918
1041
  S: this,
919
1042
  C: (f, a) => f(...a)
920
1043
  });
@@ -943,7 +1066,15 @@ var Pipeline = class {
943
1066
  return this._state;
944
1067
  }
945
1068
  get writer() {
946
- (0, import_tiny_invariant7.default)(this._writer, "Writer not set.");
1069
+ (0, import_invariant7.invariant)(this._writer, "Writer not set.", {
1070
+ F: __dxlog_file8,
1071
+ L: 230,
1072
+ S: this,
1073
+ A: [
1074
+ "this._writer",
1075
+ "'Writer not set.'"
1076
+ ]
1077
+ });
947
1078
  return this._writer;
948
1079
  }
949
1080
  hasFeed(feedKey) {
@@ -962,8 +1093,24 @@ var Pipeline = class {
962
1093
  this._setFeedDownloadState(feed);
963
1094
  }
964
1095
  setWriteFeed(feed) {
965
- (0, import_tiny_invariant7.default)(!this._writer, "Writer already set.");
966
- (0, import_tiny_invariant7.default)(feed.properties.writable, "Feed must be writable.");
1096
+ (0, import_invariant7.invariant)(!this._writer, "Writer already set.", {
1097
+ F: __dxlog_file8,
1098
+ L: 253,
1099
+ S: this,
1100
+ A: [
1101
+ "!this._writer",
1102
+ "'Writer already set.'"
1103
+ ]
1104
+ });
1105
+ (0, import_invariant7.invariant)(feed.properties.writable, "Feed must be writable.", {
1106
+ F: __dxlog_file8,
1107
+ L: 254,
1108
+ S: this,
1109
+ A: [
1110
+ "feed.properties.writable",
1111
+ "'Feed must be writable.'"
1112
+ ]
1113
+ });
967
1114
  this._writer = createMappedFeedWriter((payload) => ({
968
1115
  timeframe: this._timeframeClock.timeframe,
969
1116
  payload
@@ -971,8 +1118,8 @@ var Pipeline = class {
971
1118
  }
972
1119
  async start() {
973
1120
  (0, import_log7.log)("starting...", void 0, {
974
- F: __dxlog_file7,
975
- L: 268,
1121
+ F: __dxlog_file8,
1122
+ L: 267,
976
1123
  S: this,
977
1124
  C: (f, a) => f(...a)
978
1125
  });
@@ -980,8 +1127,8 @@ var Pipeline = class {
980
1127
  await this._feedSetIterator.open();
981
1128
  this._isStarted = true;
982
1129
  (0, import_log7.log)("started", void 0, {
983
- F: __dxlog_file7,
984
- L: 272,
1130
+ F: __dxlog_file8,
1131
+ L: 271,
985
1132
  S: this,
986
1133
  C: (f, a) => f(...a)
987
1134
  });
@@ -989,8 +1136,8 @@ var Pipeline = class {
989
1136
  async stop() {
990
1137
  var _a;
991
1138
  (0, import_log7.log)("stopping...", void 0, {
992
- F: __dxlog_file7,
993
- L: 277,
1139
+ F: __dxlog_file8,
1140
+ L: 276,
994
1141
  S: this,
995
1142
  C: (f, a) => f(...a)
996
1143
  });
@@ -1002,8 +1149,8 @@ var Pipeline = class {
1002
1149
  this._state._reachedTargetPromise = void 0;
1003
1150
  this._isStarted = false;
1004
1151
  (0, import_log7.log)("stopped", void 0, {
1005
- F: __dxlog_file7,
1006
- L: 285,
1152
+ F: __dxlog_file8,
1153
+ L: 284,
1007
1154
  S: this,
1008
1155
  C: (f, a) => f(...a)
1009
1156
  });
@@ -1013,7 +1160,15 @@ var Pipeline = class {
1013
1160
  * The pipeline will start processing messages AFTER this timeframe.
1014
1161
  */
1015
1162
  async setCursor(timeframe) {
1016
- (0, import_tiny_invariant7.default)(!this._isStarted || this._isPaused, "Invalid state.");
1163
+ (0, import_invariant7.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
1164
+ F: __dxlog_file8,
1165
+ L: 293,
1166
+ S: this,
1167
+ A: [
1168
+ "!this._isStarted || this._isPaused",
1169
+ "'Invalid state.'"
1170
+ ]
1171
+ });
1017
1172
  this._state._startTimeframe = timeframe;
1018
1173
  this._timeframeClock.setTimeframe(timeframe);
1019
1174
  for (const feed of this._feeds.values()) {
@@ -1029,7 +1184,15 @@ var Pipeline = class {
1029
1184
  * Calling pause while processing will cause a deadlock.
1030
1185
  */
1031
1186
  async pause() {
1032
- (0, import_tiny_invariant7.default)(this._isStarted, "Pipeline is not open.");
1187
+ (0, import_invariant7.invariant)(this._isStarted, "Pipeline is not open.", {
1188
+ F: __dxlog_file8,
1189
+ L: 315,
1190
+ S: this,
1191
+ A: [
1192
+ "this._isStarted",
1193
+ "'Pipeline is not open.'"
1194
+ ]
1195
+ });
1033
1196
  if (this._isPaused) {
1034
1197
  return;
1035
1198
  }
@@ -1038,8 +1201,24 @@ var Pipeline = class {
1038
1201
  this._isPaused = true;
1039
1202
  }
1040
1203
  async unpause() {
1041
- (0, import_tiny_invariant7.default)(this._isStarted, "Pipeline is not open.");
1042
- (0, import_tiny_invariant7.default)(this._isPaused, "Pipeline is not paused.");
1204
+ (0, import_invariant7.invariant)(this._isStarted, "Pipeline is not open.", {
1205
+ F: __dxlog_file8,
1206
+ L: 327,
1207
+ S: this,
1208
+ A: [
1209
+ "this._isStarted",
1210
+ "'Pipeline is not open.'"
1211
+ ]
1212
+ });
1213
+ (0, import_invariant7.invariant)(this._isPaused, "Pipeline is not paused.", {
1214
+ F: __dxlog_file8,
1215
+ L: 328,
1216
+ S: this,
1217
+ A: [
1218
+ "this._isPaused",
1219
+ "'Pipeline is not paused.'"
1220
+ ]
1221
+ });
1043
1222
  this._pauseTrigger.wake();
1044
1223
  this._isPaused = false;
1045
1224
  }
@@ -1048,15 +1227,39 @@ var Pipeline = class {
1048
1227
  * Updates the timeframe clock after the message has bee processed.
1049
1228
  */
1050
1229
  async *consume() {
1051
- (0, import_tiny_invariant7.default)(!this._isOpen, "Pipeline is already being consumed.");
1230
+ (0, import_invariant7.invariant)(!this._isOpen, "Pipeline is already being consumed.", {
1231
+ F: __dxlog_file8,
1232
+ L: 339,
1233
+ S: this,
1234
+ A: [
1235
+ "!this._isOpen",
1236
+ "'Pipeline is already being consumed.'"
1237
+ ]
1238
+ });
1052
1239
  this._isOpen = true;
1053
- (0, import_tiny_invariant7.default)(this._feedSetIterator, "Iterator not initialized.");
1240
+ (0, import_invariant7.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1241
+ F: __dxlog_file8,
1242
+ L: 342,
1243
+ S: this,
1244
+ A: [
1245
+ "this._feedSetIterator",
1246
+ "'Iterator not initialized.'"
1247
+ ]
1248
+ });
1054
1249
  let lastFeedSetIterator = this._feedSetIterator;
1055
1250
  let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
1056
1251
  while (!this._isStopping) {
1057
1252
  await this._pauseTrigger.wait();
1058
1253
  if (lastFeedSetIterator !== this._feedSetIterator) {
1059
- (0, import_tiny_invariant7.default)(this._feedSetIterator, "Iterator not initialized.");
1254
+ (0, import_invariant7.invariant)(this._feedSetIterator, "Iterator not initialized.", {
1255
+ F: __dxlog_file8,
1256
+ L: 351,
1257
+ S: this,
1258
+ A: [
1259
+ "this._feedSetIterator",
1260
+ "'Iterator not initialized.'"
1261
+ ]
1262
+ });
1060
1263
  lastFeedSetIterator = this._feedSetIterator;
1061
1264
  iterable = lastFeedSetIterator[Symbol.asyncIterator]();
1062
1265
  }
@@ -1078,8 +1281,8 @@ var Pipeline = class {
1078
1281
  const seq = (_a = timeframe.get(feed.key)) != null ? _a : 0;
1079
1282
  feed.undownload({
1080
1283
  callback: () => (0, import_log7.log)("undownload", void 0, {
1081
- F: __dxlog_file7,
1082
- L: 376,
1284
+ F: __dxlog_file8,
1285
+ L: 375,
1083
1286
  S: this,
1084
1287
  C: (f, a) => f(...a)
1085
1288
  })
@@ -1091,8 +1294,8 @@ var Pipeline = class {
1091
1294
  (0, import_log7.log)("failed to download feed", {
1092
1295
  err
1093
1296
  }, {
1094
- F: __dxlog_file7,
1095
- L: 378,
1297
+ F: __dxlog_file8,
1298
+ L: 377,
1096
1299
  S: this,
1097
1300
  C: (f, a) => f(...a)
1098
1301
  });
@@ -1105,8 +1308,8 @@ var Pipeline = class {
1105
1308
  });
1106
1309
  this._feedSetIterator.stalled.on((iterator) => {
1107
1310
  import_log7.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
1108
- F: __dxlog_file7,
1109
- L: 389,
1311
+ F: __dxlog_file8,
1312
+ L: 388,
1110
1313
  S: this,
1111
1314
  C: (f, a) => f(...a)
1112
1315
  });
@@ -1134,7 +1337,7 @@ _ts_decorate4([
1134
1337
  ], Pipeline.prototype, "unpause", null);
1135
1338
 
1136
1339
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
1137
- var __dxlog_file8 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1340
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
1138
1341
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
1139
1342
  var ControlPipeline = class {
1140
1343
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
@@ -1149,7 +1352,7 @@ var ControlPipeline = class {
1149
1352
  (0, import_log8.log)("feed admitted", {
1150
1353
  key: info.key
1151
1354
  }, {
1152
- F: __dxlog_file8,
1355
+ F: __dxlog_file9,
1153
1356
  L: 51,
1154
1357
  S: this,
1155
1358
  C: (f, a) => f(...a)
@@ -1160,7 +1363,7 @@ var ControlPipeline = class {
1160
1363
  await this._pipeline.addFeed(feed);
1161
1364
  } catch (err) {
1162
1365
  import_log8.log.catch(err, void 0, {
1163
- F: __dxlog_file8,
1366
+ F: __dxlog_file9,
1164
1367
  L: 59,
1165
1368
  S: this,
1166
1369
  C: (f, a) => f(...a)
@@ -1183,7 +1386,7 @@ var ControlPipeline = class {
1183
1386
  }
1184
1387
  async start() {
1185
1388
  (0, import_log8.log)("starting...", void 0, {
1186
- F: __dxlog_file8,
1389
+ F: __dxlog_file9,
1187
1390
  L: 83,
1188
1391
  S: this,
1189
1392
  C: (f, a) => f(...a)
@@ -1195,7 +1398,7 @@ var ControlPipeline = class {
1195
1398
  key: msg.feedKey,
1196
1399
  seq: msg.seq
1197
1400
  }, {
1198
- F: __dxlog_file8,
1401
+ F: __dxlog_file9,
1199
1402
  L: 88,
1200
1403
  S: this,
1201
1404
  C: (f, a) => f(...a)
@@ -1208,7 +1411,7 @@ var ControlPipeline = class {
1208
1411
  import_log8.log.warn("processing failed", {
1209
1412
  msg
1210
1413
  }, {
1211
- F: __dxlog_file8,
1414
+ F: __dxlog_file9,
1212
1415
  L: 98,
1213
1416
  S: this,
1214
1417
  C: (f, a) => f(...a)
@@ -1219,7 +1422,7 @@ var ControlPipeline = class {
1219
1422
  }
1220
1423
  } catch (err) {
1221
1424
  import_log8.log.catch(err, void 0, {
1222
- F: __dxlog_file8,
1425
+ F: __dxlog_file9,
1223
1426
  L: 104,
1224
1427
  S: this,
1225
1428
  C: (f, a) => f(...a)
@@ -1229,7 +1432,7 @@ var ControlPipeline = class {
1229
1432
  });
1230
1433
  await this._pipeline.start();
1231
1434
  (0, import_log8.log)("started", void 0, {
1232
- F: __dxlog_file8,
1435
+ F: __dxlog_file9,
1233
1436
  L: 110,
1234
1437
  S: this,
1235
1438
  C: (f, a) => f(...a)
@@ -1243,7 +1446,7 @@ var ControlPipeline = class {
1243
1446
  }
1244
1447
  async stop() {
1245
1448
  (0, import_log8.log)("stopping...", void 0, {
1246
- F: __dxlog_file8,
1449
+ F: __dxlog_file9,
1247
1450
  L: 124,
1248
1451
  S: this,
1249
1452
  C: (f, a) => f(...a)
@@ -1251,7 +1454,7 @@ var ControlPipeline = class {
1251
1454
  await this._pipeline.stop();
1252
1455
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1253
1456
  (0, import_log8.log)("stopped", void 0, {
1254
- F: __dxlog_file8,
1457
+ F: __dxlog_file9,
1255
1458
  L: 127,
1256
1459
  S: this,
1257
1460
  C: (f, a) => f(...a)
@@ -1265,7 +1468,7 @@ var ControlPipeline = class {
1265
1468
  this._targetTimeframe = newTimeframe;
1266
1469
  } catch (err) {
1267
1470
  (0, import_log8.log)(err, void 0, {
1268
- F: __dxlog_file8,
1471
+ F: __dxlog_file9,
1269
1472
  L: 136,
1270
1473
  S: this,
1271
1474
  C: (f, a) => f(...a)
@@ -1275,12 +1478,12 @@ var ControlPipeline = class {
1275
1478
  };
1276
1479
 
1277
1480
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
1278
- var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
1279
1481
  var import_async6 = require("@dxos/async");
1280
1482
  var import_context5 = require("@dxos/context");
1281
1483
  var import_credentials3 = require("@dxos/credentials");
1282
1484
  var import_echo_db3 = require("@dxos/echo-db");
1283
1485
  var import_errors2 = require("@dxos/errors");
1486
+ var import_invariant8 = require("@dxos/invariant");
1284
1487
  var import_log9 = require("@dxos/log");
1285
1488
  var import_timeframe4 = require("@dxos/timeframe");
1286
1489
  var import_util6 = require("@dxos/util");
@@ -1294,7 +1497,7 @@ function _ts_decorate5(decorators, target, key, desc) {
1294
1497
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1295
1498
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1296
1499
  }
1297
- var __dxlog_file9 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1500
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1298
1501
  var MESSAGES_PER_SNAPSHOT = 10;
1299
1502
  var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
1300
1503
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
@@ -1350,8 +1553,24 @@ var DataPipeline = class DataPipeline2 {
1350
1553
  }
1351
1554
  const feedWriter = {
1352
1555
  write: (data, options) => {
1353
- (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1354
- (0, import_tiny_invariant8.default)(this.currentEpoch, "Epoch is not initialized.");
1556
+ (0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
1557
+ F: __dxlog_file10,
1558
+ L: 145,
1559
+ S: this,
1560
+ A: [
1561
+ "this._pipeline",
1562
+ "'Pipeline is not initialized.'"
1563
+ ]
1564
+ });
1565
+ (0, import_invariant8.invariant)(this.currentEpoch, "Epoch is not initialized.", {
1566
+ F: __dxlog_file10,
1567
+ L: 146,
1568
+ S: this,
1569
+ A: [
1570
+ "this.currentEpoch",
1571
+ "'Epoch is not initialized.'"
1572
+ ]
1573
+ });
1355
1574
  return this._pipeline.writer.write({
1356
1575
  data
1357
1576
  }, options);
@@ -1371,8 +1590,8 @@ var DataPipeline = class DataPipeline2 {
1371
1590
  return;
1372
1591
  }
1373
1592
  (0, import_log9.log)("close", void 0, {
1374
- F: __dxlog_file9,
1375
- L: 171,
1593
+ F: __dxlog_file10,
1594
+ L: 170,
1376
1595
  S: this,
1377
1596
  C: (f, a) => f(...a)
1378
1597
  });
@@ -1386,8 +1605,8 @@ var DataPipeline = class DataPipeline2 {
1386
1605
  }
1387
1606
  } catch (err) {
1388
1607
  import_log9.log.catch(err, void 0, {
1389
- F: __dxlog_file9,
1390
- L: 184,
1608
+ F: __dxlog_file10,
1609
+ L: 183,
1391
1610
  S: this,
1392
1611
  C: (f, a) => f(...a)
1393
1612
  });
@@ -1409,15 +1628,23 @@ var DataPipeline = class DataPipeline2 {
1409
1628
  await this._processEpochInSeparateTask(this.currentEpoch);
1410
1629
  await waitForOneEpoch;
1411
1630
  }
1412
- (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1631
+ (0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
1632
+ F: __dxlog_file10,
1633
+ L: 206,
1634
+ S: this,
1635
+ A: [
1636
+ "this._pipeline",
1637
+ "'Pipeline is not initialized.'"
1638
+ ]
1639
+ });
1413
1640
  for await (const msg of this._pipeline.consume()) {
1414
1641
  const { feedKey, seq, data } = msg;
1415
1642
  (0, import_log9.log)("processing message", {
1416
1643
  feedKey,
1417
1644
  seq
1418
1645
  }, {
1419
- F: __dxlog_file9,
1420
- L: 210,
1646
+ F: __dxlog_file10,
1647
+ L: 209,
1421
1648
  S: this,
1422
1649
  C: (f, a) => f(...a)
1423
1650
  });
@@ -1428,8 +1655,8 @@ var DataPipeline = class DataPipeline2 {
1428
1655
  import_log9.log.warn("Could not find feed", {
1429
1656
  feedKey
1430
1657
  }, {
1431
- F: __dxlog_file9,
1432
- L: 216,
1658
+ F: __dxlog_file10,
1659
+ L: 215,
1433
1660
  S: this,
1434
1661
  C: (f, a) => f(...a)
1435
1662
  });
@@ -1451,8 +1678,8 @@ var DataPipeline = class DataPipeline2 {
1451
1678
  seq,
1452
1679
  spaceKey: this._params.spaceKey.toHex()
1453
1680
  }, {
1454
- F: __dxlog_file9,
1455
- L: 233,
1681
+ F: __dxlog_file10,
1682
+ L: 232,
1456
1683
  S: this,
1457
1684
  C: (f, a) => f(...a)
1458
1685
  });
@@ -1460,8 +1687,8 @@ var DataPipeline = class DataPipeline2 {
1460
1687
  }
1461
1688
  } catch (err) {
1462
1689
  import_log9.log.catch(err, void 0, {
1463
- F: __dxlog_file9,
1464
- L: 243,
1690
+ F: __dxlog_file10,
1691
+ L: 242,
1465
1692
  S: this,
1466
1693
  C: (f, a) => f(...a)
1467
1694
  });
@@ -1469,7 +1696,15 @@ var DataPipeline = class DataPipeline2 {
1469
1696
  }
1470
1697
  }
1471
1698
  _createSnapshot() {
1472
- (0, import_tiny_invariant8.default)(this.databaseHost, "Database backend is not initialized.");
1699
+ (0, import_invariant8.invariant)(this.databaseHost, "Database backend is not initialized.", {
1700
+ F: __dxlog_file10,
1701
+ L: 248,
1702
+ S: this,
1703
+ A: [
1704
+ "this.databaseHost",
1705
+ "'Database backend is not initialized.'"
1706
+ ]
1707
+ });
1473
1708
  return {
1474
1709
  spaceKey: this._params.spaceKey.asUint8Array(),
1475
1710
  timeframe: this._pipeline.state.timeframe,
@@ -1495,8 +1730,8 @@ var DataPipeline = class DataPipeline2 {
1495
1730
  }
1496
1731
  } catch (err) {
1497
1732
  import_log9.log.warn("Failed to cache properties", err, {
1498
- F: __dxlog_file9,
1499
- L: 278,
1733
+ F: __dxlog_file10,
1734
+ L: 277,
1500
1735
  S: this,
1501
1736
  C: (f, a) => f(...a)
1502
1737
  });
@@ -1522,15 +1757,15 @@ var DataPipeline = class DataPipeline2 {
1522
1757
  onError: (err) => {
1523
1758
  if (err instanceof import_errors2.CancelledError) {
1524
1759
  (0, import_log9.log)("Epoch processing cancelled.", void 0, {
1525
- F: __dxlog_file9,
1526
- L: 310,
1760
+ F: __dxlog_file10,
1761
+ L: 309,
1527
1762
  S: this,
1528
1763
  C: (f, a) => f(...a)
1529
1764
  });
1530
1765
  } else {
1531
1766
  import_log9.log.catch(err, void 0, {
1532
- F: __dxlog_file9,
1533
- L: 312,
1767
+ F: __dxlog_file10,
1768
+ L: 311,
1534
1769
  S: this,
1535
1770
  C: (f, a) => f(...a)
1536
1771
  });
@@ -1545,8 +1780,8 @@ var DataPipeline = class DataPipeline2 {
1545
1780
  (0, import_log9.log)("process epoch", {
1546
1781
  epoch
1547
1782
  }, {
1548
- F: __dxlog_file9,
1549
- L: 322,
1783
+ F: __dxlog_file10,
1784
+ L: 321,
1550
1785
  S: this,
1551
1786
  C: (f, a) => f(...a)
1552
1787
  });
@@ -1556,14 +1791,30 @@ var DataPipeline = class DataPipeline2 {
1556
1791
  });
1557
1792
  }
1558
1793
  async _processEpoch(ctx, epoch) {
1559
- (0, import_tiny_invariant8.default)(this._isOpen, "Space is closed.");
1560
- (0, import_tiny_invariant8.default)(this._pipeline);
1794
+ (0, import_invariant8.invariant)(this._isOpen, "Space is closed.", {
1795
+ F: __dxlog_file10,
1796
+ L: 331,
1797
+ S: this,
1798
+ A: [
1799
+ "this._isOpen",
1800
+ "'Space is closed.'"
1801
+ ]
1802
+ });
1803
+ (0, import_invariant8.invariant)(this._pipeline, void 0, {
1804
+ F: __dxlog_file10,
1805
+ L: 332,
1806
+ S: this,
1807
+ A: [
1808
+ "this._pipeline",
1809
+ ""
1810
+ ]
1811
+ });
1561
1812
  this._lastProcessedEpoch = epoch.number;
1562
1813
  (0, import_log9.log)("Processing epoch", {
1563
1814
  epoch
1564
1815
  }, {
1565
- F: __dxlog_file9,
1566
- L: 336,
1816
+ F: __dxlog_file10,
1817
+ L: 335,
1567
1818
  S: this,
1568
1819
  C: (f, a) => f(...a)
1569
1820
  });
@@ -1572,8 +1823,8 @@ var DataPipeline = class DataPipeline2 {
1572
1823
  this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
1573
1824
  }
1574
1825
  (0, import_log9.log)("restarting pipeline for epoch", void 0, {
1575
- F: __dxlog_file9,
1576
- L: 344,
1826
+ F: __dxlog_file10,
1827
+ L: 343,
1577
1828
  S: this,
1578
1829
  C: (f, a) => f(...a)
1579
1830
  });
@@ -1582,12 +1833,36 @@ var DataPipeline = class DataPipeline2 {
1582
1833
  await this._pipeline.unpause();
1583
1834
  }
1584
1835
  async waitUntilTimeframe(timeframe) {
1585
- (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1836
+ (0, import_invariant8.invariant)(this._pipeline, "Pipeline is not initialized.", {
1837
+ F: __dxlog_file10,
1838
+ L: 351,
1839
+ S: this,
1840
+ A: [
1841
+ "this._pipeline",
1842
+ "'Pipeline is not initialized.'"
1843
+ ]
1844
+ });
1586
1845
  await this._pipeline.state.waitUntilTimeframe(timeframe);
1587
1846
  }
1588
1847
  async createEpoch() {
1589
- (0, import_tiny_invariant8.default)(this._pipeline);
1590
- (0, import_tiny_invariant8.default)(this.currentEpoch);
1848
+ (0, import_invariant8.invariant)(this._pipeline, void 0, {
1849
+ F: __dxlog_file10,
1850
+ L: 357,
1851
+ S: this,
1852
+ A: [
1853
+ "this._pipeline",
1854
+ ""
1855
+ ]
1856
+ });
1857
+ (0, import_invariant8.invariant)(this.currentEpoch, void 0, {
1858
+ F: __dxlog_file10,
1859
+ L: 358,
1860
+ S: this,
1861
+ A: [
1862
+ "this.currentEpoch",
1863
+ ""
1864
+ ]
1865
+ });
1591
1866
  await this._pipeline.pause();
1592
1867
  const snapshot = await this._createSnapshot();
1593
1868
  const snapshotCid = await this._params.snapshotManager.store(snapshot);
@@ -1631,14 +1906,22 @@ function _ts_decorate6(decorators, target, key, desc) {
1631
1906
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1632
1907
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1633
1908
  }
1634
- var __dxlog_file10 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space.ts";
1909
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1635
1910
  var Space = class Space2 {
1636
1911
  constructor(params) {
1637
1912
  this._addFeedLock = new import_async7.Lock();
1638
1913
  this.onCredentialProcessed = new import_util7.Callback();
1639
1914
  this.stateUpdate = new import_async7.Event();
1640
1915
  this._isOpen = false;
1641
- (0, import_tiny_invariant9.default)(params.spaceKey && params.feedProvider);
1916
+ (0, import_invariant9.invariant)(params.spaceKey && params.feedProvider, void 0, {
1917
+ F: __dxlog_file11,
1918
+ L: 73,
1919
+ S: this,
1920
+ A: [
1921
+ "params.spaceKey && params.feedProvider",
1922
+ ""
1923
+ ]
1924
+ });
1642
1925
  this._key = params.spaceKey;
1643
1926
  this._genesisFeedKey = params.genesisFeed.key;
1644
1927
  this._feedProvider = params.feedProvider;
@@ -1673,8 +1956,8 @@ var Space = class Space2 {
1673
1956
  (0, import_log10.log)("onCredentialProcessed", {
1674
1957
  credential
1675
1958
  }, {
1676
- F: __dxlog_file10,
1677
- L: 107,
1959
+ F: __dxlog_file11,
1960
+ L: 109,
1678
1961
  S: this,
1679
1962
  C: (f, a) => f(...a)
1680
1963
  });
@@ -1739,14 +2022,30 @@ var Space = class Space2 {
1739
2022
  return this._snapshotManager;
1740
2023
  }
1741
2024
  setControlFeed(feed) {
1742
- (0, import_tiny_invariant9.default)(!this._controlFeed, "Control feed already set.");
2025
+ (0, import_invariant9.invariant)(!this._controlFeed, "Control feed already set.", {
2026
+ F: __dxlog_file11,
2027
+ L: 183,
2028
+ S: this,
2029
+ A: [
2030
+ "!this._controlFeed",
2031
+ "'Control feed already set.'"
2032
+ ]
2033
+ });
1743
2034
  this._controlFeed = feed;
1744
2035
  this._controlPipeline.setWriteFeed(feed);
1745
2036
  return this;
1746
2037
  }
1747
2038
  setDataFeed(feed) {
1748
2039
  var _a;
1749
- (0, import_tiny_invariant9.default)(!this._dataFeed, "Data feed already set.");
2040
+ (0, import_invariant9.invariant)(!this._dataFeed, "Data feed already set.", {
2041
+ F: __dxlog_file11,
2042
+ L: 190,
2043
+ S: this,
2044
+ A: [
2045
+ "!this._dataFeed",
2046
+ "'Data feed already set.'"
2047
+ ]
2048
+ });
1750
2049
  this._dataFeed = feed;
1751
2050
  (_a = this._dataPipeline.pipeline) == null ? void 0 : _a.setWriteFeed(feed);
1752
2051
  return this;
@@ -1763,10 +2062,10 @@ var Space = class Space2 {
1763
2062
  // getDataFeeds(): FeedInfo[] {
1764
2063
  // return this._dataPipeline?.getFeeds();
1765
2064
  // }
1766
- async open() {
2065
+ async open(ctx) {
1767
2066
  (0, import_log10.log)("opening...", void 0, {
1768
- F: __dxlog_file10,
1769
- L: 209,
2067
+ F: __dxlog_file11,
2068
+ L: 212,
1770
2069
  S: this,
1771
2070
  C: (f, a) => f(...a)
1772
2071
  });
@@ -1778,8 +2077,8 @@ var Space = class Space2 {
1778
2077
  await this._controlPipeline.spaceState.addCredentialProcessor(this._dataPipeline);
1779
2078
  this._isOpen = true;
1780
2079
  (0, import_log10.log)("opened", void 0, {
1781
- F: __dxlog_file10,
1782
- L: 220,
2080
+ F: __dxlog_file11,
2081
+ L: 223,
1783
2082
  S: this,
1784
2083
  C: (f, a) => f(...a)
1785
2084
  });
@@ -1788,8 +2087,8 @@ var Space = class Space2 {
1788
2087
  (0, import_log10.log)("closing...", {
1789
2088
  key: this._key
1790
2089
  }, {
1791
- F: __dxlog_file10,
1792
- L: 225,
2090
+ F: __dxlog_file11,
2091
+ L: 228,
1793
2092
  S: this,
1794
2093
  C: (f, a) => f(...a)
1795
2094
  });
@@ -1802,20 +2101,28 @@ var Space = class Space2 {
1802
2101
  await this._controlPipeline.stop();
1803
2102
  this._isOpen = false;
1804
2103
  (0, import_log10.log)("closed", void 0, {
1805
- F: __dxlog_file10,
1806
- L: 238,
2104
+ F: __dxlog_file11,
2105
+ L: 241,
1807
2106
  S: this,
1808
2107
  C: (f, a) => f(...a)
1809
2108
  });
1810
2109
  }
1811
2110
  async initializeDataPipeline() {
1812
2111
  (0, import_log10.log)("initializeDataPipeline", void 0, {
1813
- F: __dxlog_file10,
1814
- L: 243,
2112
+ F: __dxlog_file11,
2113
+ L: 246,
1815
2114
  S: this,
1816
2115
  C: (f, a) => f(...a)
1817
2116
  });
1818
- (0, import_tiny_invariant9.default)(this._isOpen, "Space must be open to initialize data pipeline.");
2117
+ (0, import_invariant9.invariant)(this._isOpen, "Space must be open to initialize data pipeline.", {
2118
+ F: __dxlog_file11,
2119
+ L: 247,
2120
+ S: this,
2121
+ A: [
2122
+ "this._isOpen",
2123
+ "'Space must be open to initialize data pipeline.'"
2124
+ ]
2125
+ });
1819
2126
  await this._dataPipeline.open();
1820
2127
  }
1821
2128
  };
@@ -1823,7 +2130,8 @@ _ts_decorate6([
1823
2130
  import_log10.logInfo
1824
2131
  ], Space.prototype, "key", null);
1825
2132
  _ts_decorate6([
1826
- import_async7.synchronized
2133
+ import_async7.synchronized,
2134
+ import_tracing.trace.span()
1827
2135
  ], Space.prototype, "open", null);
1828
2136
  _ts_decorate6([
1829
2137
  import_async7.synchronized
@@ -1832,7 +2140,8 @@ _ts_decorate6([
1832
2140
  import_async7.synchronized
1833
2141
  ], Space.prototype, "initializeDataPipeline", null);
1834
2142
  Space = _ts_decorate6([
1835
- (0, import_async7.trackLeaks)("open", "close")
2143
+ (0, import_async7.trackLeaks)("open", "close"),
2144
+ import_tracing.trace.resource()
1836
2145
  ], Space);
1837
2146
 
1838
2147
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
@@ -1862,7 +2171,7 @@ function _ts_decorate7(decorators, target, key, desc) {
1862
2171
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1863
2172
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1864
2173
  }
1865
- var __dxlog_file11 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
2174
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1866
2175
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1867
2176
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1868
2177
  var SpaceProtocol = class {
@@ -1892,7 +2201,7 @@ var SpaceProtocol = class {
1892
2201
  (0, import_log11.log)("addFeed", {
1893
2202
  key: feed.key
1894
2203
  }, {
1895
- F: __dxlog_file11,
2204
+ F: __dxlog_file12,
1896
2205
  L: 95,
1897
2206
  S: this,
1898
2207
  C: (f, a) => f(...a)
@@ -1914,21 +2223,22 @@ var SpaceProtocol = class {
1914
2223
  };
1915
2224
  await this.blobSync.open();
1916
2225
  (0, import_log11.log)("starting...", void 0, {
1917
- F: __dxlog_file11,
2226
+ F: __dxlog_file12,
1918
2227
  L: 120,
1919
2228
  S: this,
1920
2229
  C: (f, a) => f(...a)
1921
2230
  });
2231
+ const topic = await this._topic;
1922
2232
  this._connection = await this._networkManager.joinSwarm({
1923
2233
  protocolProvider: this._createProtocolProvider(credentials),
1924
2234
  peerId: this._swarmIdentity.peerKey,
1925
- topic: await this._topic,
2235
+ topic,
1926
2236
  topology: new import_network_manager.MMSTTopology(topologyConfig),
1927
- label: `Protocol swarm: ${this._topic}`
2237
+ label: `Protocol swarm: ${topic}`
1928
2238
  });
1929
2239
  (0, import_log11.log)("started", void 0, {
1930
- F: __dxlog_file11,
1931
- L: 129,
2240
+ F: __dxlog_file12,
2241
+ L: 130,
1932
2242
  S: this,
1933
2243
  C: (f, a) => f(...a)
1934
2244
  });
@@ -1937,15 +2247,15 @@ var SpaceProtocol = class {
1937
2247
  await this.blobSync.close();
1938
2248
  if (this._connection) {
1939
2249
  (0, import_log11.log)("stopping...", void 0, {
1940
- F: __dxlog_file11,
1941
- L: 136,
2250
+ F: __dxlog_file12,
2251
+ L: 137,
1942
2252
  S: this,
1943
2253
  C: (f, a) => f(...a)
1944
2254
  });
1945
2255
  await this._connection.close();
1946
2256
  (0, import_log11.log)("stopped", void 0, {
1947
- F: __dxlog_file11,
1948
- L: 138,
2257
+ F: __dxlog_file12,
2258
+ L: 139,
1949
2259
  S: this,
1950
2260
  C: (f, a) => f(...a)
1951
2261
  });
@@ -2012,8 +2322,8 @@ var SpaceProtocolSession = class {
2012
2322
  onAuthSuccess: () => {
2013
2323
  var _a;
2014
2324
  (0, import_log11.log)("Peer authenticated", void 0, {
2015
- F: __dxlog_file11,
2016
- L: 235,
2325
+ F: __dxlog_file12,
2326
+ L: 236,
2017
2327
  S: this,
2018
2328
  C: (f, a) => f(...a)
2019
2329
  });
@@ -2051,7 +2361,7 @@ function _ts_decorate8(decorators, target, key, desc) {
2051
2361
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2052
2362
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2053
2363
  }
2054
- var __dxlog_file12 = "/mnt/ramdisk/work/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2364
+ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2055
2365
  var SpaceManager = class SpaceManager2 {
2056
2366
  constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
2057
2367
  this._spaces = new import_util9.ComplexMap(import_keys6.PublicKey.hash);
@@ -2079,7 +2389,7 @@ var SpaceManager = class SpaceManager2 {
2079
2389
  import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
2080
2390
  id: this._instanceId
2081
2391
  }), {
2082
- F: __dxlog_file12,
2392
+ F: __dxlog_file13,
2083
2393
  L: 97,
2084
2394
  S: this,
2085
2395
  C: (f, a) => f(...a)
@@ -2087,7 +2397,7 @@ var SpaceManager = class SpaceManager2 {
2087
2397
  (0, import_log12.log)("constructing space...", {
2088
2398
  spaceKey: metadata.genesisFeedKey
2089
2399
  }, {
2090
- F: __dxlog_file12,
2400
+ F: __dxlog_file13,
2091
2401
  L: 98,
2092
2402
  S: this,
2093
2403
  C: (f, a) => f(...a)
@@ -2117,7 +2427,7 @@ var SpaceManager = class SpaceManager2 {
2117
2427
  import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
2118
2428
  id: this._instanceId
2119
2429
  }), {
2120
- F: __dxlog_file12,
2430
+ F: __dxlog_file13,
2121
2431
  L: 125,
2122
2432
  S: this,
2123
2433
  C: (f, a) => f(...a)
@@ -2271,7 +2581,7 @@ var TestAgent = class {
2271
2581
  });
2272
2582
  space.setControlFeed(controlFeed);
2273
2583
  space.setDataFeed(dataFeed);
2274
- await space.open();
2584
+ await space.open(new import_context6.Context());
2275
2585
  this._spaces.set(spaceKey, space);
2276
2586
  return space;
2277
2587
  }