@dxos/echo-pipeline 0.1.52 → 0.1.53-main.01c99c0

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 (51) hide show
  1. package/dist/lib/browser/{chunk-AXGWKSM3.mjs → chunk-OJGL5427.mjs} +450 -396
  2. package/dist/lib/browser/chunk-OJGL5427.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +2 -2
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +3 -3
  7. package/dist/lib/browser/testing/index.mjs.map +2 -2
  8. package/dist/lib/node/index.cjs +518 -464
  9. package/dist/lib/node/index.cjs.map +3 -3
  10. package/dist/lib/node/meta.json +1 -1
  11. package/dist/lib/node/testing/index.cjs +508 -454
  12. package/dist/lib/node/testing/index.cjs.map +3 -3
  13. package/dist/types/src/dbhost/data-service-host.d.ts +3 -0
  14. package/dist/types/src/dbhost/data-service-host.d.ts.map +1 -1
  15. package/dist/types/src/dbhost/data-service.d.ts +2 -2
  16. package/dist/types/src/dbhost/data-service.d.ts.map +1 -1
  17. package/dist/types/src/dbhost/snapshot-manager.d.ts +2 -0
  18. package/dist/types/src/dbhost/snapshot-manager.d.ts.map +1 -1
  19. package/dist/types/src/dbhost/snapshot-store.d.ts +5 -0
  20. package/dist/types/src/dbhost/snapshot-store.d.ts.map +1 -1
  21. package/dist/types/src/metadata/metadata-store.d.ts +4 -0
  22. package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
  23. package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
  24. package/dist/types/src/pipeline/pipeline.d.ts +0 -1
  25. package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
  26. package/dist/types/src/space/data-pipeline.d.ts +3 -3
  27. package/dist/types/src/space/data-pipeline.d.ts.map +1 -1
  28. package/dist/types/src/space/space-protocol.d.ts +3 -0
  29. package/dist/types/src/space/space-protocol.d.ts.map +1 -1
  30. package/dist/types/src/space/space.d.ts +0 -1
  31. package/dist/types/src/space/space.d.ts.map +1 -1
  32. package/package.json +31 -32
  33. package/src/common/feeds.ts +3 -3
  34. package/src/dbhost/data-service-host.ts +17 -4
  35. package/src/dbhost/data-service.ts +10 -6
  36. package/src/dbhost/snapshot-manager.ts +4 -4
  37. package/src/dbhost/snapshot-store.ts +6 -2
  38. package/src/metadata/metadata-store.ts +20 -6
  39. package/src/pipeline/message-selector.ts +3 -5
  40. package/src/pipeline/pipeline.ts +24 -12
  41. package/src/space/auth.ts +3 -3
  42. package/src/space/data-pipeline.ts +36 -29
  43. package/src/space/replication.browser.test.ts +2 -2
  44. package/src/space/space-protocol.browser.test.ts +2 -2
  45. package/src/space/space-protocol.test.ts +2 -2
  46. package/src/space/space-protocol.ts +10 -4
  47. package/src/space/space.test.ts +46 -5
  48. package/src/space/space.ts +8 -17
  49. package/src/testing/util.ts +1 -1
  50. package/src/tests/database.test.ts +1 -1
  51. package/dist/lib/browser/chunk-AXGWKSM3.mjs.map +0 -7
@@ -115,12 +115,14 @@ var UnknownModelError = class extends DBError {
115
115
 
116
116
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
117
117
  var import_crc_32 = __toESM(require("crc-32"));
118
- var import_node_assert = __toESM(require("node:assert"));
118
+ var import_tiny_invariant = __toESM(require("tiny-invariant"));
119
119
  var import_async = require("@dxos/async");
120
120
  var import_errors = require("@dxos/errors");
121
121
  var import_log = require("@dxos/log");
122
122
  var import_protocols = require("@dxos/protocols");
123
- var __decorate = function(decorators, target, key, desc) {
123
+ var import_services = require("@dxos/protocols/proto/dxos/client/services");
124
+ var import_util = require("@dxos/util");
125
+ function _ts_decorate(decorators, target, key, desc) {
124
126
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
125
127
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
126
128
  r = Reflect.decorate(decorators, target, key, desc);
@@ -129,13 +131,15 @@ var __decorate = function(decorators, target, key, desc) {
129
131
  if (d = decorators[i])
130
132
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
131
133
  return c > 3 && r && Object.defineProperty(target, key, r), r;
132
- };
134
+ }
135
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
133
136
  var emptyEchoMetadata = () => ({
134
137
  version: import_protocols.STORAGE_VERSION,
135
138
  spaces: [],
136
139
  created: new Date(),
137
140
  updated: new Date()
138
141
  });
142
+ var EchoMetadata = import_protocols.schema.getCodecForType("dxos.echo.metadata.EchoMetadata");
139
143
  var MetadataStore = class {
140
144
  // prettier-ignore
141
145
  constructor(_directory) {
@@ -162,6 +166,7 @@ var MetadataStore = class {
162
166
  * Loads metadata from persistent storage.
163
167
  */
164
168
  async load() {
169
+ var _a;
165
170
  const file = this._directory.getOrCreateFile("EchoMetadata");
166
171
  try {
167
172
  const { size: fileLength } = await file.stat();
@@ -174,10 +179,10 @@ var MetadataStore = class {
174
179
  size: dataSize,
175
180
  checksum
176
181
  }, {
177
- file: "metadata-store.ts",
178
- line: 68,
179
- scope: this,
180
- callSite: (f, a) => f(...a)
182
+ F: __dxlog_file,
183
+ L: 72,
184
+ S: this,
185
+ C: (f, a) => f(...a)
181
186
  });
182
187
  if (fileLength < dataSize + 8) {
183
188
  throw new import_errors.DataCorruptionError("Metadata size is smaller than expected.");
@@ -187,15 +192,19 @@ var MetadataStore = class {
187
192
  if (calculatedChecksum !== checksum) {
188
193
  throw new import_errors.DataCorruptionError("Metadata checksum is invalid.");
189
194
  }
190
- this._metadata = import_protocols.schema.getCodecForType("dxos.echo.metadata.EchoMetadata").decode(data);
195
+ this._metadata = EchoMetadata.decode(data);
196
+ (_a = this._metadata.spaces) == null ? void 0 : _a.forEach((space) => {
197
+ var _a2;
198
+ (_a2 = space.state) != null ? _a2 : space.state = import_services.SpaceState.ACTIVE;
199
+ });
191
200
  } catch (err) {
192
201
  import_log.log.error("failed to load metadata", {
193
202
  err
194
203
  }, {
195
- file: "metadata-store.ts",
196
- line: 83,
197
- scope: this,
198
- callSite: (f, a) => f(...a)
204
+ F: __dxlog_file,
205
+ L: 92,
206
+ S: this,
207
+ C: (f, a) => f(...a)
199
208
  });
200
209
  this._metadata = emptyEchoMetadata();
201
210
  } finally {
@@ -213,7 +222,7 @@ var MetadataStore = class {
213
222
  this.update.emit(data);
214
223
  const file = this._directory.getOrCreateFile("EchoMetadata");
215
224
  try {
216
- const encoded = Buffer.from(import_protocols.schema.getCodecForType("dxos.echo.metadata.EchoMetadata").encode(data));
225
+ const encoded = (0, import_util.arrayToBuffer)(EchoMetadata.encode(data));
217
226
  const checksum = import_crc_32.default.buf(encoded);
218
227
  const result = Buffer.alloc(8 + encoded.length);
219
228
  result.writeInt32LE(encoded.length, 0);
@@ -224,10 +233,10 @@ var MetadataStore = class {
224
233
  size: encoded.length,
225
234
  checksum
226
235
  }, {
227
- file: "metadata-store.ts",
228
- line: 115,
229
- scope: this,
230
- callSite: (f, a) => f(...a)
236
+ F: __dxlog_file,
237
+ L: 124,
238
+ S: this,
239
+ C: (f, a) => f(...a)
231
240
  });
232
241
  } finally {
233
242
  await file.close();
@@ -239,18 +248,18 @@ var MetadataStore = class {
239
248
  return this._metadata.identity.haloSpace;
240
249
  }
241
250
  const space = this.spaces.find((space2) => space2.key === spaceKey);
242
- (0, import_node_assert.default)(space, "Space not found");
251
+ (0, import_tiny_invariant.default)(space, "Space not found");
243
252
  return space;
244
253
  }
245
254
  /**
246
255
  * Clears storage - doesn't work for now.
247
256
  */
248
257
  async clear() {
249
- (0, import_log.log)("clearing all metadata", {}, {
250
- file: "metadata-store.ts",
251
- line: 136,
252
- scope: this,
253
- callSite: (f, a) => f(...a)
258
+ (0, import_log.log)("clearing all metadata", void 0, {
259
+ F: __dxlog_file,
260
+ L: 145,
261
+ S: this,
262
+ C: (f, a) => f(...a)
254
263
  });
255
264
  await this._directory.delete();
256
265
  this._metadata = emptyEchoMetadata();
@@ -259,13 +268,13 @@ var MetadataStore = class {
259
268
  return this._metadata.identity;
260
269
  }
261
270
  async setIdentityRecord(record) {
262
- (0, import_node_assert.default)(!this._metadata.identity, "Cannot overwrite existing identity in metadata");
271
+ (0, import_tiny_invariant.default)(!this._metadata.identity, "Cannot overwrite existing identity in metadata");
263
272
  this._metadata.identity = record;
264
273
  await this._save();
265
274
  }
266
275
  async addSpace(record) {
267
276
  var _a, _b, _c;
268
- (0, import_node_assert.default)(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata");
277
+ (0, import_tiny_invariant.default)(!((_a = this._metadata.spaces) != null ? _a : []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata");
269
278
  ((_c = (_b = this._metadata).spaces) != null ? _c : _b.spaces = []).push(record);
270
279
  await this._save();
271
280
  }
@@ -287,25 +296,29 @@ var MetadataStore = class {
287
296
  space.dataFeedKey = dataFeedKey;
288
297
  await this._save();
289
298
  }
299
+ async setSpaceState(spaceKey, state) {
300
+ this._getSpace(spaceKey).state = state;
301
+ await this._save();
302
+ }
290
303
  };
291
- __decorate([
304
+ _ts_decorate([
292
305
  import_async.synchronized
293
306
  ], MetadataStore.prototype, "load", null);
294
- __decorate([
307
+ _ts_decorate([
295
308
  import_async.synchronized
296
309
  ], MetadataStore.prototype, "_save", null);
297
310
  var fromBytesInt32 = (buf) => buf.readInt32LE(0);
298
311
 
299
312
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
300
- var import_node_assert4 = __toESM(require("node:assert"));
313
+ var import_tiny_invariant4 = __toESM(require("tiny-invariant"));
301
314
  var import_async3 = require("@dxos/async");
302
315
  var import_context = require("@dxos/context");
303
- var import_debug3 = require("@dxos/debug");
316
+ var import_debug2 = require("@dxos/debug");
304
317
  var import_feed_store = require("@dxos/feed-store");
305
318
  var import_keys = require("@dxos/keys");
306
- var import_log3 = require("@dxos/log");
319
+ var import_log4 = require("@dxos/log");
307
320
  var import_timeframe2 = require("@dxos/timeframe");
308
- var import_util = require("@dxos/util");
321
+ var import_util2 = require("@dxos/util");
309
322
 
310
323
  // packages/core/echo/echo-pipeline/src/common/codec.ts
311
324
  var import_hypercore = require("@dxos/hypercore");
@@ -314,38 +327,43 @@ var codec = import_protocols2.schema.getCodecForType("dxos.echo.feed.FeedMessage
314
327
  var valueEncoding = (0, import_hypercore.createCodecEncoding)(codec);
315
328
 
316
329
  // packages/core/echo/echo-pipeline/src/common/feeds.ts
317
- var import_node_assert2 = __toESM(require("node:assert"));
330
+ var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
318
331
  var createMappedFeedWriter = (mapper, writer) => {
319
- (0, import_node_assert2.default)(mapper);
320
- (0, import_node_assert2.default)(writer);
332
+ (0, import_tiny_invariant2.default)(mapper);
333
+ (0, import_tiny_invariant2.default)(writer);
321
334
  return {
322
335
  write: async (data, options) => await writer.write(await mapper(data), options)
323
336
  };
324
337
  };
325
338
 
326
339
  // packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts
327
- var import_debug = __toESM(require("debug"));
328
- var import_node_assert3 = __toESM(require("node:assert"));
329
- var log2 = (0, import_debug.default)("dxos:echo-db:message-selector");
340
+ var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
341
+ var import_log2 = require("@dxos/log");
342
+ var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
330
343
  var createMessageSelector = (timeframeClock) => {
331
344
  return (messages) => {
332
345
  for (let i = 0; i < messages.length; i++) {
333
346
  const { data: { timeframe } } = messages[i];
334
- (0, import_node_assert3.default)(timeframe);
347
+ (0, import_tiny_invariant3.default)(timeframe);
335
348
  if (!timeframeClock.hasGaps(timeframe)) {
336
349
  return i;
337
350
  }
338
351
  }
339
- log2("Skipping...");
352
+ (0, import_log2.log)("Skipping...", void 0, {
353
+ F: __dxlog_file2,
354
+ L: 34,
355
+ S: void 0,
356
+ C: (f, a) => f(...a)
357
+ });
340
358
  };
341
359
  };
342
360
 
343
361
  // packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts
344
362
  var import_async2 = require("@dxos/async");
345
- var import_debug2 = require("@dxos/debug");
346
- var import_log2 = require("@dxos/log");
363
+ var import_debug = require("@dxos/debug");
364
+ var import_log3 = require("@dxos/log");
347
365
  var import_timeframe = require("@dxos/timeframe");
348
- var __decorate2 = function(decorators, target, key, desc) {
366
+ function _ts_decorate2(decorators, target, key, desc) {
349
367
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
350
368
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
351
369
  r = Reflect.decorate(decorators, target, key, desc);
@@ -354,7 +372,8 @@ var __decorate2 = function(decorators, target, key, desc) {
354
372
  if (d = decorators[i])
355
373
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
356
374
  return c > 3 && r && Object.defineProperty(target, key, r), r;
357
- };
375
+ }
376
+ var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
358
377
  var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
359
378
  feedKey,
360
379
  index
@@ -409,36 +428,36 @@ var TimeframeClock = class {
409
428
  return !gaps.isEmpty();
410
429
  }
411
430
  async waitUntilReached(target) {
412
- (0, import_log2.log)("waitUntilReached", {
431
+ (0, import_log3.log)("waitUntilReached", {
413
432
  target,
414
433
  current: this._timeframe
415
434
  }, {
416
- file: "timeframe-clock.ts",
417
- line: 73,
418
- scope: this,
419
- callSite: (f, a) => f(...a)
435
+ F: __dxlog_file3,
436
+ L: 73,
437
+ S: this,
438
+ C: (f, a) => f(...a)
420
439
  });
421
440
  await this.update.waitForCondition(() => {
422
- (0, import_log2.log)("check if reached", {
441
+ (0, import_log3.log)("check if reached", {
423
442
  target,
424
443
  current: this._timeframe,
425
444
  deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
426
445
  }, {
427
- file: "timeframe-clock.ts",
428
- line: 75,
429
- scope: this,
430
- callSite: (f, a) => f(...a)
446
+ F: __dxlog_file3,
447
+ L: 75,
448
+ S: this,
449
+ C: (f, a) => f(...a)
431
450
  });
432
451
  return import_timeframe.Timeframe.dependencies(target, this._timeframe).isEmpty();
433
452
  });
434
453
  }
435
454
  };
436
- __decorate2([
437
- (0, import_debug2.timed)(5e3)
455
+ _ts_decorate2([
456
+ (0, import_debug.timed)(5e3)
438
457
  ], TimeframeClock.prototype, "waitUntilReached", null);
439
458
 
440
459
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
441
- var __decorate3 = function(decorators, target, key, desc) {
460
+ function _ts_decorate3(decorators, target, key, desc) {
442
461
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
443
462
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
444
463
  r = Reflect.decorate(decorators, target, key, desc);
@@ -447,12 +466,14 @@ var __decorate3 = function(decorators, target, key, desc) {
447
466
  if (d = decorators[i])
448
467
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
449
468
  return c > 3 && r && Object.defineProperty(target, key, r), r;
450
- };
469
+ }
470
+ var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
451
471
  var PipelineState = class {
452
472
  // prettier-ignore
453
473
  constructor(_feeds, _timeframeClock) {
454
474
  this._feeds = _feeds;
455
475
  this._timeframeClock = _timeframeClock;
476
+ this._ctx = new import_context.Context();
456
477
  this.timeframeUpdate = this._timeframeClock.update;
457
478
  this.stalled = new import_async3.Event();
458
479
  this._startTimeframe = new import_timeframe2.Timeframe();
@@ -498,15 +519,15 @@ var PipelineState = class {
498
519
  */
499
520
  async waitUntilReachedTargetTimeframe({ ctx = new import_context.Context(), timeout, breakOnStall = true } = {}) {
500
521
  var _a;
501
- (0, import_log3.log)("waitUntilReachedTargetTimeframe", {
522
+ (0, import_log4.log)("waitUntilReachedTargetTimeframe", {
502
523
  timeout,
503
524
  current: this.timeframe,
504
525
  target: this.targetTimeframe
505
526
  }, {
506
- file: "pipeline.ts",
507
- line: 118,
508
- scope: this,
509
- callSite: (f, a) => f(...a)
527
+ F: __dxlog_file4,
528
+ L: 126,
529
+ S: this,
530
+ C: (f, a) => f(...a)
510
531
  });
511
532
  (_a = this._reachedTargetPromise) != null ? _a : this._reachedTargetPromise = Promise.race([
512
533
  this._timeframeClock.update.waitForCondition(() => {
@@ -520,6 +541,7 @@ var PipelineState = class {
520
541
  if (timeout) {
521
542
  return Promise.race([
522
543
  (0, import_context.rejectOnDispose)(ctx),
544
+ (0, import_context.rejectOnDispose)(this._ctx),
523
545
  this._reachedTargetPromise.then(() => {
524
546
  done = true;
525
547
  }),
@@ -527,16 +549,16 @@ var PipelineState = class {
527
549
  if (done) {
528
550
  return;
529
551
  }
530
- import_log3.log.warn("waitUntilReachedTargetTimeframe timed out", {
552
+ import_log4.log.warn("waitUntilReachedTargetTimeframe timed out", {
531
553
  timeout,
532
554
  current: this.timeframe,
533
555
  target: this.targetTimeframe,
534
556
  dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
535
557
  }, {
536
- file: "pipeline.ts",
537
- line: 144,
538
- scope: this,
539
- callSite: (f, a) => f(...a)
558
+ F: __dxlog_file4,
559
+ L: 153,
560
+ S: this,
561
+ C: (f, a) => f(...a)
540
562
  });
541
563
  })
542
564
  ]);
@@ -548,7 +570,7 @@ var PipelineState = class {
548
570
  var Pipeline = class {
549
571
  constructor() {
550
572
  this._timeframeClock = new TimeframeClock(new import_timeframe2.Timeframe());
551
- this._feeds = new import_util.ComplexMap(import_keys.PublicKey.hash);
573
+ this._feeds = new import_util2.ComplexMap(import_keys.PublicKey.hash);
552
574
  // External state accessor.
553
575
  this._state = new PipelineState(this._feeds, this._timeframeClock);
554
576
  // Waits for the message consumer to process the message and yield control back to the pipeline.
@@ -563,7 +585,7 @@ var Pipeline = class {
563
585
  return this._state;
564
586
  }
565
587
  get writer() {
566
- (0, import_node_assert4.default)(this._writer, "Writer not set.");
588
+ (0, import_tiny_invariant4.default)(this._writer, "Writer not set.");
567
589
  return this._writer;
568
590
  }
569
591
  getFeeds() {
@@ -582,46 +604,49 @@ var Pipeline = class {
582
604
  return this._feeds.has(feedKey);
583
605
  }
584
606
  setWriteFeed(feed) {
585
- (0, import_node_assert4.default)(!this._writer, "Writer already set.");
586
- (0, import_node_assert4.default)(feed.properties.writable, "Feed must be writable.");
607
+ (0, import_tiny_invariant4.default)(!this._writer, "Writer already set.");
608
+ (0, import_tiny_invariant4.default)(feed.properties.writable, "Feed must be writable.");
587
609
  this._writer = createMappedFeedWriter((payload) => ({
588
610
  timeframe: this._timeframeClock.timeframe,
589
611
  payload
590
612
  }), feed.createFeedWriter());
591
613
  }
592
614
  async start() {
593
- (0, import_log3.log)("starting...", {}, {
594
- file: "pipeline.ts",
595
- line: 264,
596
- scope: this,
597
- callSite: (f, a) => f(...a)
615
+ (0, import_log4.log)("starting...", {}, {
616
+ F: __dxlog_file4,
617
+ L: 273,
618
+ S: this,
619
+ C: (f, a) => f(...a)
598
620
  });
599
621
  await this._initIterator();
600
622
  await this._feedSetIterator.open();
601
- (0, import_log3.log)("started", {}, {
602
- file: "pipeline.ts",
603
- line: 267,
604
- scope: this,
605
- callSite: (f, a) => f(...a)
623
+ (0, import_log4.log)("started", void 0, {
624
+ F: __dxlog_file4,
625
+ L: 276,
626
+ S: this,
627
+ C: (f, a) => f(...a)
606
628
  });
607
629
  this._isStarted = true;
608
630
  }
609
631
  async stop() {
610
632
  var _a;
611
- (0, import_log3.log)("stopping...", {}, {
612
- file: "pipeline.ts",
613
- line: 273,
614
- scope: this,
615
- callSite: (f, a) => f(...a)
633
+ (0, import_log4.log)("stopping...", {}, {
634
+ F: __dxlog_file4,
635
+ L: 282,
636
+ S: this,
637
+ C: (f, a) => f(...a)
616
638
  });
617
639
  this._isStopping = true;
618
640
  await ((_a = this._feedSetIterator) == null ? void 0 : _a.close());
619
641
  await this._processingTrigger.wait();
620
- (0, import_log3.log)("stopped", {}, {
621
- file: "pipeline.ts",
622
- line: 277,
623
- scope: this,
624
- callSite: (f, a) => f(...a)
642
+ await this._state._ctx.dispose();
643
+ this._state._ctx = new import_context.Context();
644
+ this._state._reachedTargetPromise = void 0;
645
+ (0, import_log4.log)("stopped", void 0, {
646
+ F: __dxlog_file4,
647
+ L: 289,
648
+ S: this,
649
+ C: (f, a) => f(...a)
625
650
  });
626
651
  this._isStarted = false;
627
652
  }
@@ -629,7 +654,7 @@ var Pipeline = class {
629
654
  * @param timeframe Timeframe of already processed messages. The pipeline will start processing messages AFTER this timeframe.
630
655
  */
631
656
  async setCursor(timeframe) {
632
- (0, import_node_assert4.default)(!this._isStarted || this._isPaused, "Invalid state.");
657
+ (0, import_tiny_invariant4.default)(!this._isStarted || this._isPaused, "Invalid state.");
633
658
  this._state._startTimeframe = timeframe;
634
659
  this._timeframeClock.setTimeframe(timeframe);
635
660
  for (const feed of this._feeds.values()) {
@@ -645,7 +670,7 @@ var Pipeline = class {
645
670
  * Calling pause while processing will cause a deadlock.
646
671
  */
647
672
  async pause() {
648
- (0, import_node_assert4.default)(this._isStarted, "Pipeline is not open.");
673
+ (0, import_tiny_invariant4.default)(this._isStarted, "Pipeline is not open.");
649
674
  if (this._isPaused) {
650
675
  return;
651
676
  }
@@ -654,8 +679,8 @@ var Pipeline = class {
654
679
  this._isPaused = true;
655
680
  }
656
681
  async unpause() {
657
- (0, import_node_assert4.default)(this._isStarted, "Pipeline is not open.");
658
- (0, import_node_assert4.default)(this._isPaused, "Pipeline is not paused.");
682
+ (0, import_tiny_invariant4.default)(this._isStarted, "Pipeline is not open.");
683
+ (0, import_tiny_invariant4.default)(this._isPaused, "Pipeline is not paused.");
659
684
  this._pauseTrigger.wake();
660
685
  this._isPaused = false;
661
686
  }
@@ -664,15 +689,15 @@ var Pipeline = class {
664
689
  * Updates the timeframe clock after the message has bee processed.
665
690
  */
666
691
  async *consume() {
667
- (0, import_node_assert4.default)(!this._isOpen, "Pipeline is already being consumed.");
692
+ (0, import_tiny_invariant4.default)(!this._isOpen, "Pipeline is already being consumed.");
668
693
  this._isOpen = true;
669
- (0, import_node_assert4.default)(this._feedSetIterator, "Iterator not initialized.");
694
+ (0, import_tiny_invariant4.default)(this._feedSetIterator, "Iterator not initialized.");
670
695
  let lastFeedSetIterator = this._feedSetIterator;
671
696
  let iterable = lastFeedSetIterator[Symbol.asyncIterator]();
672
697
  while (!this._isStopping) {
673
698
  await this._pauseTrigger.wait();
674
699
  if (lastFeedSetIterator !== this._feedSetIterator) {
675
- (0, import_node_assert4.default)(this._feedSetIterator, "Iterator not initialized.");
700
+ (0, import_tiny_invariant4.default)(this._feedSetIterator, "Iterator not initialized.");
676
701
  lastFeedSetIterator = this._feedSetIterator;
677
702
  iterable = lastFeedSetIterator[Symbol.asyncIterator]();
678
703
  }
@@ -680,7 +705,7 @@ var Pipeline = class {
680
705
  if (done) {
681
706
  continue;
682
707
  }
683
- const block = value != null ? value : (0, import_debug3.failUndefined)();
708
+ const block = value != null ? value : (0, import_debug2.failUndefined)();
684
709
  this._processingTrigger.reset();
685
710
  this._timeframeClock.updatePendingTimeframe(import_keys.PublicKey.from(block.feedKey), block.seq);
686
711
  yield block;
@@ -694,24 +719,24 @@ var Pipeline = class {
694
719
  const timeframe = this._state._startTimeframe;
695
720
  const seq = (_a = timeframe.get(feed.key)) != null ? _a : 0;
696
721
  feed.undownload({
697
- callback: () => (0, import_log3.log)("Undownloaded", {}, {
698
- file: "pipeline.ts",
699
- line: 371,
700
- scope: this,
701
- callSite: (f, a) => f(...a)
722
+ callback: () => (0, import_log4.log)("Undownloaded", void 0, {
723
+ F: __dxlog_file4,
724
+ L: 383,
725
+ S: this,
726
+ C: (f, a) => f(...a)
702
727
  })
703
728
  });
704
729
  feed.download({
705
730
  start: seq + 1,
706
731
  linear: true
707
732
  }).catch((err) => {
708
- (0, import_log3.log)("failed to download feed", {
733
+ (0, import_log4.log)("failed to download feed", {
709
734
  err
710
735
  }, {
711
- file: "pipeline.ts",
712
- line: 374,
713
- scope: this,
714
- callSite: (f, a) => f(...a)
736
+ F: __dxlog_file4,
737
+ L: 386,
738
+ S: this,
739
+ C: (f, a) => f(...a)
715
740
  });
716
741
  });
717
742
  }
@@ -721,11 +746,11 @@ var Pipeline = class {
721
746
  stallTimeout: 1e3
722
747
  });
723
748
  this._feedSetIterator.stalled.on((iterator) => {
724
- import_log3.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, {}, {
725
- file: "pipeline.ts",
726
- line: 384,
727
- scope: this,
728
- callSite: (f, a) => f(...a)
749
+ import_log4.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
750
+ F: __dxlog_file4,
751
+ L: 396,
752
+ S: this,
753
+ C: (f, a) => f(...a)
729
754
  });
730
755
  this._state.stalled.emit();
731
756
  });
@@ -734,30 +759,31 @@ var Pipeline = class {
734
759
  }
735
760
  }
736
761
  };
737
- __decorate3([
762
+ _ts_decorate3([
738
763
  import_async3.synchronized
739
764
  ], Pipeline.prototype, "start", null);
740
- __decorate3([
765
+ _ts_decorate3([
741
766
  import_async3.synchronized
742
767
  ], Pipeline.prototype, "stop", null);
743
- __decorate3([
768
+ _ts_decorate3([
744
769
  import_async3.synchronized
745
770
  ], Pipeline.prototype, "setCursor", null);
746
- __decorate3([
771
+ _ts_decorate3([
747
772
  import_async3.synchronized
748
773
  ], Pipeline.prototype, "pause", null);
749
- __decorate3([
774
+ _ts_decorate3([
750
775
  import_async3.synchronized
751
776
  ], Pipeline.prototype, "unpause", null);
752
777
 
753
778
  // packages/core/echo/echo-pipeline/src/space/auth.ts
754
- var import_node_assert5 = __toESM(require("node:assert"));
779
+ var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
755
780
  var import_async4 = require("@dxos/async");
756
781
  var import_context2 = require("@dxos/context");
757
782
  var import_crypto = require("@dxos/crypto");
758
- var import_log4 = require("@dxos/log");
783
+ var import_log5 = require("@dxos/log");
759
784
  var import_protocols3 = require("@dxos/protocols");
760
785
  var import_teleport = require("@dxos/teleport");
786
+ var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
761
787
  var AuthExtension = class extends import_teleport.RpcExtension {
762
788
  constructor(_authParams) {
763
789
  super({
@@ -772,11 +798,11 @@ var AuthExtension = class extends import_teleport.RpcExtension {
772
798
  this._authParams = _authParams;
773
799
  this._ctx = new import_context2.Context({
774
800
  onError: (err) => {
775
- import_log4.log.catch(err, {}, {
776
- file: "auth.ts",
777
- line: 29,
778
- scope: this,
779
- callSite: (f, a) => f(...a)
801
+ import_log5.log.catch(err, void 0, {
802
+ F: __dxlog_file5,
803
+ L: 29,
804
+ S: this,
805
+ C: (f, a) => f(...a)
780
806
  });
781
807
  }
782
808
  });
@@ -794,11 +820,11 @@ var AuthExtension = class extends import_teleport.RpcExtension {
794
820
  credential
795
821
  };
796
822
  } catch (err) {
797
- import_log4.log.error("failed to generate auth credentials", err, {
798
- file: "auth.ts",
799
- line: 56,
800
- scope: this,
801
- callSite: (f, a) => f(...a)
823
+ import_log5.log.error("failed to generate auth credentials", err, {
824
+ F: __dxlog_file5,
825
+ L: 56,
826
+ S: this,
827
+ C: (f, a) => f(...a)
802
828
  });
803
829
  throw new Error("auth rejected");
804
830
  }
@@ -814,16 +840,16 @@ var AuthExtension = class extends import_teleport.RpcExtension {
814
840
  const { credential } = await this.rpc.AuthService.authenticate({
815
841
  challenge
816
842
  });
817
- (0, import_node_assert5.default)((credential == null ? void 0 : credential.length) > 0, "invalid credential");
843
+ (0, import_tiny_invariant5.default)((credential == null ? void 0 : credential.length) > 0, "invalid credential");
818
844
  const success = await this._authParams.verifier(challenge, credential);
819
- (0, import_node_assert5.default)(success, "credential not verified");
845
+ (0, import_tiny_invariant5.default)(success, "credential not verified");
820
846
  (0, import_async4.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
821
847
  } catch (err) {
822
- (0, import_log4.log)("auth failed", err, {
823
- file: "auth.ts",
824
- line: 75,
825
- scope: this,
826
- callSite: (f, a) => f(...a)
848
+ (0, import_log5.log)("auth failed", err, {
849
+ F: __dxlog_file5,
850
+ L: 75,
851
+ S: this,
852
+ C: (f, a) => f(...a)
827
853
  });
828
854
  this.close();
829
855
  this._authParams.onAuthFailure();
@@ -837,48 +863,49 @@ var AuthExtension = class extends import_teleport.RpcExtension {
837
863
  };
838
864
 
839
865
  // packages/core/echo/echo-pipeline/src/space/space.ts
840
- var import_node_assert9 = __toESM(require("node:assert"));
866
+ var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
841
867
  var import_async7 = require("@dxos/async");
842
- var import_log9 = require("@dxos/log");
868
+ var import_log10 = require("@dxos/log");
843
869
  var import_credentials4 = require("@dxos/protocols/proto/dxos/halo/credentials");
844
- var import_util5 = require("@dxos/util");
870
+ var import_util6 = require("@dxos/util");
845
871
 
846
872
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
847
873
  var import_credentials = require("@dxos/credentials");
848
874
  var import_keys2 = require("@dxos/keys");
849
- var import_log5 = require("@dxos/log");
875
+ var import_log6 = require("@dxos/log");
850
876
  var import_credentials2 = require("@dxos/protocols/proto/dxos/halo/credentials");
851
877
  var import_timeframe3 = require("@dxos/timeframe");
852
- var import_util2 = require("@dxos/util");
878
+ var import_util3 = require("@dxos/util");
879
+ var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
853
880
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
854
881
  var ControlPipeline = class {
855
882
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
856
883
  this._lastTimeframeSaveTime = Date.now();
857
- this.onFeedAdmitted = new import_util2.Callback();
884
+ this.onFeedAdmitted = new import_util3.Callback();
858
885
  this._spaceKey = spaceKey;
859
886
  this._metadata = metadataStore;
860
887
  this._pipeline = new Pipeline();
861
888
  void this._pipeline.addFeed(genesisFeed);
862
889
  this._spaceStateMachine = new import_credentials.SpaceStateMachine(spaceKey);
863
890
  this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
864
- (0, import_log5.log)("feed admitted", {
891
+ (0, import_log6.log)("feed admitted", {
865
892
  key: info.key
866
893
  }, {
867
- file: "control-pipeline.ts",
868
- line: 51,
869
- scope: this,
870
- callSite: (f, a) => f(...a)
894
+ F: __dxlog_file6,
895
+ L: 51,
896
+ S: this,
897
+ C: (f, a) => f(...a)
871
898
  });
872
899
  if (info.assertion.designation === import_credentials2.AdmittedFeed.Designation.CONTROL && !info.key.equals(genesisFeed.key)) {
873
900
  try {
874
901
  const feed = await feedProvider(info.key);
875
902
  await this._pipeline.addFeed(feed);
876
903
  } catch (err) {
877
- import_log5.log.catch(err, {}, {
878
- file: "control-pipeline.ts",
879
- line: 59,
880
- scope: this,
881
- callSite: (f, a) => f(...a)
904
+ import_log6.log.catch(err, void 0, {
905
+ F: __dxlog_file6,
906
+ L: 59,
907
+ S: this,
908
+ C: (f, a) => f(...a)
882
909
  });
883
910
  }
884
911
  }
@@ -897,55 +924,55 @@ var ControlPipeline = class {
897
924
  this._pipeline.setWriteFeed(feed);
898
925
  }
899
926
  async start() {
900
- (0, import_log5.log)("starting...", {}, {
901
- file: "control-pipeline.ts",
902
- line: 83,
903
- scope: this,
904
- callSite: (f, a) => f(...a)
927
+ (0, import_log6.log)("starting...", void 0, {
928
+ F: __dxlog_file6,
929
+ L: 83,
930
+ S: this,
931
+ C: (f, a) => f(...a)
905
932
  });
906
933
  setTimeout(async () => {
907
934
  for await (const msg of this._pipeline.consume()) {
908
935
  try {
909
- (0, import_log5.log)("processing", {
936
+ (0, import_log6.log)("processing", {
910
937
  key: msg.feedKey,
911
938
  seq: msg.seq
912
939
  }, {
913
- file: "control-pipeline.ts",
914
- line: 88,
915
- scope: this,
916
- callSite: (f, a) => f(...a)
940
+ F: __dxlog_file6,
941
+ L: 88,
942
+ S: this,
943
+ C: (f, a) => f(...a)
917
944
  });
918
945
  if (msg.data.payload.credential) {
919
946
  const result = await this._spaceStateMachine.process(msg.data.payload.credential.credential, import_keys2.PublicKey.from(msg.feedKey));
920
947
  if (!result) {
921
- import_log5.log.warn("processing failed", {
948
+ import_log6.log.warn("processing failed", {
922
949
  msg
923
950
  }, {
924
- file: "control-pipeline.ts",
925
- line: 95,
926
- scope: this,
927
- callSite: (f, a) => f(...a)
951
+ F: __dxlog_file6,
952
+ L: 95,
953
+ S: this,
954
+ C: (f, a) => f(...a)
928
955
  });
929
956
  } else {
930
957
  await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
931
958
  }
932
959
  }
933
960
  } catch (err) {
934
- import_log5.log.catch(err, {}, {
935
- file: "control-pipeline.ts",
936
- line: 101,
937
- scope: this,
938
- callSite: (f, a) => f(...a)
961
+ import_log6.log.catch(err, void 0, {
962
+ F: __dxlog_file6,
963
+ L: 101,
964
+ S: this,
965
+ C: (f, a) => f(...a)
939
966
  });
940
967
  }
941
968
  }
942
969
  });
943
970
  await this._pipeline.start();
944
- (0, import_log5.log)("started", {}, {
945
- file: "control-pipeline.ts",
946
- line: 107,
947
- scope: this,
948
- callSite: (f, a) => f(...a)
971
+ (0, import_log6.log)("started", void 0, {
972
+ F: __dxlog_file6,
973
+ L: 107,
974
+ S: this,
975
+ C: (f, a) => f(...a)
949
976
  });
950
977
  }
951
978
  async _noteTargetStateIfNeeded(timeframe) {
@@ -955,19 +982,19 @@ var ControlPipeline = class {
955
982
  }
956
983
  }
957
984
  async stop() {
958
- (0, import_log5.log)("stopping...", {}, {
959
- file: "control-pipeline.ts",
960
- line: 121,
961
- scope: this,
962
- callSite: (f, a) => f(...a)
985
+ (0, import_log6.log)("stopping...", void 0, {
986
+ F: __dxlog_file6,
987
+ L: 121,
988
+ S: this,
989
+ C: (f, a) => f(...a)
963
990
  });
964
991
  await this._pipeline.stop();
965
992
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
966
- (0, import_log5.log)("stopped", {}, {
967
- file: "control-pipeline.ts",
968
- line: 124,
969
- scope: this,
970
- callSite: (f, a) => f(...a)
993
+ (0, import_log6.log)("stopped", void 0, {
994
+ F: __dxlog_file6,
995
+ L: 124,
996
+ S: this,
997
+ C: (f, a) => f(...a)
971
998
  });
972
999
  }
973
1000
  async _saveTargetTimeframe(timeframe) {
@@ -977,44 +1004,53 @@ var ControlPipeline = class {
977
1004
  await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
978
1005
  this._targetTimeframe = newTimeframe;
979
1006
  } catch (err) {
980
- (0, import_log5.log)(err, {}, {
981
- file: "control-pipeline.ts",
982
- line: 133,
983
- scope: this,
984
- callSite: (f, a) => f(...a)
1007
+ (0, import_log6.log)(err, void 0, {
1008
+ F: __dxlog_file6,
1009
+ L: 133,
1010
+ S: this,
1011
+ C: (f, a) => f(...a)
985
1012
  });
986
1013
  }
987
1014
  }
988
1015
  };
989
1016
 
990
1017
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
991
- var import_node_assert8 = __toESM(require("node:assert"));
1018
+ var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
992
1019
  var import_async6 = require("@dxos/async");
993
- var import_context4 = require("@dxos/context");
1020
+ var import_context5 = require("@dxos/context");
994
1021
  var import_credentials3 = require("@dxos/credentials");
995
1022
  var import_echo_db3 = require("@dxos/echo-db");
996
1023
  var import_errors2 = require("@dxos/errors");
997
- var import_log8 = require("@dxos/log");
1024
+ var import_log9 = require("@dxos/log");
998
1025
  var import_timeframe4 = require("@dxos/timeframe");
999
1026
 
1000
1027
  // packages/core/echo/echo-pipeline/src/dbhost/data-service-host.ts
1001
- var import_node_assert6 = __toESM(require("node:assert"));
1028
+ var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
1002
1029
  var import_codec_protobuf = require("@dxos/codec-protobuf");
1030
+ var import_context3 = require("@dxos/context");
1003
1031
  var import_echo_db = require("@dxos/echo-db");
1004
- var import_log6 = require("@dxos/log");
1005
- var import_util3 = require("@dxos/util");
1032
+ var import_log7 = require("@dxos/log");
1033
+ var import_util4 = require("@dxos/util");
1034
+ var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/dbhost/data-service-host.ts";
1006
1035
  var DataServiceHost = class {
1007
1036
  constructor(_itemManager, _itemDemuxer, _writeStream) {
1008
1037
  this._itemManager = _itemManager;
1009
1038
  this._itemDemuxer = _itemDemuxer;
1010
1039
  this._writeStream = _writeStream;
1011
- this._clientTagMap = new import_util3.ComplexMap(([feedKey, seq]) => `${feedKey.toHex()}:${seq}`);
1040
+ this._ctx = new import_context3.Context();
1041
+ this._clientTagMap = new import_util4.ComplexMap(([feedKey, seq]) => `${feedKey.toHex()}:${seq}`);
1042
+ }
1043
+ async open() {
1044
+ }
1045
+ async close() {
1046
+ await this._ctx.dispose();
1012
1047
  }
1013
1048
  /**
1014
1049
  * Real-time subscription to data objects in a space.
1015
1050
  */
1016
1051
  subscribe() {
1017
- return new import_codec_protobuf.Stream(({ next, ctx }) => {
1052
+ return new import_codec_protobuf.Stream(({ next, close, ctx }) => {
1053
+ ctx.onDispose(this._ctx.onDispose(close));
1018
1054
  const objects = Array.from(this._itemManager.entities.values()).map((entity) => entity.createSnapshot());
1019
1055
  next({
1020
1056
  batch: {
@@ -1024,15 +1060,15 @@ var DataServiceHost = class {
1024
1060
  this._itemDemuxer.mutation.on(ctx, (message) => {
1025
1061
  var _a;
1026
1062
  const { batch, meta } = message;
1027
- (0, import_node_assert6.default)(!meta.clientTag, "Unexpected client tag in mutation message");
1028
- (0, import_log6.log)("message", {
1063
+ (0, import_tiny_invariant6.default)(!meta.clientTag, "Unexpected client tag in mutation message");
1064
+ (0, import_log7.log)("message", {
1029
1065
  batch,
1030
1066
  meta
1031
1067
  }, {
1032
- file: "data-service-host.ts",
1033
- line: 51,
1034
- scope: this,
1035
- callSite: (f, a) => f(...a)
1068
+ F: __dxlog_file7,
1069
+ L: 63,
1070
+ S: this,
1071
+ C: (f, a) => f(...a)
1036
1072
  });
1037
1073
  const clientTag = this._clientTagMap.get([
1038
1074
  message.meta.feedKey,
@@ -1057,29 +1093,30 @@ var DataServiceHost = class {
1057
1093
  }
1058
1094
  async write(request) {
1059
1095
  var _a, _b;
1060
- (0, import_node_assert6.default)(this._writeStream, "Cannot write mutations in readonly mode");
1061
- (0, import_log6.log)("write", {
1096
+ (0, import_tiny_invariant6.default)(!this._ctx.disposed, "Cannot write to closed DataServiceHost");
1097
+ (0, import_tiny_invariant6.default)(this._writeStream, "Cannot write mutations in readonly mode");
1098
+ (0, import_log7.log)("write", {
1062
1099
  clientTag: request.clientTag,
1063
1100
  objectCount: (_b = (_a = request.batch.objects) == null ? void 0 : _a.length) != null ? _b : 0
1064
1101
  }, {
1065
- file: "data-service-host.ts",
1066
- line: 79,
1067
- scope: this,
1068
- callSite: (f, a) => f(...a)
1102
+ F: __dxlog_file7,
1103
+ L: 92,
1104
+ S: this,
1105
+ C: (f, a) => f(...a)
1069
1106
  });
1070
1107
  const message = createDataMessage(request.batch);
1071
1108
  const receipt = await this._writeStream.write(message, {
1072
1109
  afterWrite: async (receipt2) => {
1073
1110
  if (request.clientTag) {
1074
- (0, import_log6.log)("tag", {
1111
+ (0, import_log7.log)("tag", {
1075
1112
  clientTag: request.clientTag,
1076
1113
  feedKey: receipt2.feedKey,
1077
1114
  seq: receipt2.seq
1078
1115
  }, {
1079
- file: "data-service-host.ts",
1080
- line: 88,
1081
- scope: this,
1082
- callSite: (f, a) => f(...a)
1116
+ F: __dxlog_file7,
1117
+ L: 101,
1118
+ S: this,
1119
+ C: (f, a) => f(...a)
1083
1120
  });
1084
1121
  this._clientTagMap.set([
1085
1122
  receipt2.feedKey,
@@ -1144,12 +1181,12 @@ var DatabaseHost = class {
1144
1181
 
1145
1182
  // packages/core/echo/echo-pipeline/src/dbhost/snapshot-manager.ts
1146
1183
  var import_async5 = require("@dxos/async");
1147
- var import_context3 = require("@dxos/context");
1148
- var import_debug4 = require("@dxos/debug");
1184
+ var import_context4 = require("@dxos/context");
1185
+ var import_debug3 = require("@dxos/debug");
1149
1186
  var import_keys3 = require("@dxos/keys");
1150
1187
  var import_protocols4 = require("@dxos/protocols");
1151
1188
  var import_blob = require("@dxos/protocols/proto/dxos/echo/blob");
1152
- var __decorate4 = function(decorators, target, key, desc) {
1189
+ function _ts_decorate4(decorators, target, key, desc) {
1153
1190
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1154
1191
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1155
1192
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1158,7 +1195,8 @@ var __decorate4 = function(decorators, target, key, desc) {
1158
1195
  if (d = decorators[i])
1159
1196
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1160
1197
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1161
- };
1198
+ }
1199
+ var SpaceSnapshot = import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot");
1162
1200
  var SnapshotManager = class SnapshotManager2 {
1163
1201
  // prettier-ignore
1164
1202
  constructor(_snapshotStore, _blobStore, _blobSync) {
@@ -1168,7 +1206,7 @@ var SnapshotManager = class SnapshotManager2 {
1168
1206
  }
1169
1207
  async _getBlob(blobId) {
1170
1208
  const blob = await this._blobStore.get(blobId);
1171
- return import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(blob);
1209
+ return SpaceSnapshot.decode(blob);
1172
1210
  }
1173
1211
  async load(ctx, id) {
1174
1212
  const blobId = import_keys3.PublicKey.fromHex(id).asUint8Array();
@@ -1176,7 +1214,7 @@ var SnapshotManager = class SnapshotManager2 {
1176
1214
  if (blobMeta && blobMeta.state === import_blob.BlobMeta.State.FULLY_PRESENT) {
1177
1215
  return this._getBlob(blobId);
1178
1216
  }
1179
- const fallbackStore = await (0, import_context3.cancelWithContext)(ctx, this._snapshotStore.loadSnapshot(id));
1217
+ const fallbackStore = await (0, import_context4.cancelWithContext)(ctx, this._snapshotStore.loadSnapshot(id));
1180
1218
  if (fallbackStore) {
1181
1219
  return fallbackStore;
1182
1220
  }
@@ -1184,28 +1222,29 @@ var SnapshotManager = class SnapshotManager2 {
1184
1222
  return this._getBlob(blobId);
1185
1223
  }
1186
1224
  async store(snapshot) {
1187
- const { id } = await this._blobStore.set(import_protocols4.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").encode(snapshot));
1225
+ const { id } = await this._blobStore.set(SpaceSnapshot.encode(snapshot));
1188
1226
  await this._blobSync.notifyBlobAdded(id);
1189
1227
  return import_keys3.PublicKey.from(id).toHex();
1190
1228
  }
1191
1229
  };
1192
- __decorate4([
1193
- (0, import_debug4.timed)(1e4)
1230
+ _ts_decorate4([
1231
+ (0, import_debug3.timed)(1e4)
1194
1232
  ], SnapshotManager.prototype, "load", null);
1195
- SnapshotManager = __decorate4([
1233
+ SnapshotManager = _ts_decorate4([
1196
1234
  (0, import_async5.trackLeaks)("open", "close")
1197
1235
  ], SnapshotManager);
1198
1236
 
1199
1237
  // packages/core/echo/echo-pipeline/src/dbhost/snapshot-store.ts
1200
1238
  var import_crypto2 = require("@dxos/crypto");
1201
1239
  var import_protocols5 = require("@dxos/protocols");
1240
+ var SpaceSnapshot2 = import_protocols5.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot");
1202
1241
  var SnapshotStore = class {
1203
1242
  // prettier-ignore
1204
1243
  constructor(_directory) {
1205
1244
  this._directory = _directory;
1206
1245
  }
1207
1246
  async saveSnapshot(snapshot) {
1208
- const encoded = import_protocols5.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").encode(snapshot);
1247
+ const encoded = SpaceSnapshot2.encode(snapshot);
1209
1248
  const key = await import_crypto2.subtleCrypto.digest("SHA-256", encoded);
1210
1249
  const keyString = Buffer.from(key).toString("hex");
1211
1250
  const file = await this._directory.getOrCreateFile(keyString);
@@ -1224,7 +1263,7 @@ var SnapshotStore = class {
1224
1263
  return void 0;
1225
1264
  }
1226
1265
  const buffer = await file.read(0, size);
1227
- return import_protocols5.schema.getCodecForType("dxos.echo.snapshot.SpaceSnapshot").decode(buffer);
1266
+ return SpaceSnapshot2.decode(buffer);
1228
1267
  } finally {
1229
1268
  await file.close();
1230
1269
  }
@@ -1242,38 +1281,43 @@ var SnapshotStore = class {
1242
1281
  };
1243
1282
 
1244
1283
  // packages/core/echo/echo-pipeline/src/dbhost/data-service.ts
1245
- var import_node_assert7 = __toESM(require("node:assert"));
1246
- var import_debug5 = require("@dxos/debug");
1284
+ var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
1285
+ var import_debug4 = require("@dxos/debug");
1247
1286
  var import_keys4 = require("@dxos/keys");
1248
- var import_log7 = require("@dxos/log");
1249
- var import_util4 = require("@dxos/util");
1287
+ var import_log8 = require("@dxos/log");
1288
+ var import_util5 = require("@dxos/util");
1289
+ var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/dbhost/data-service.ts";
1250
1290
  var DataServiceSubscriptions = class {
1251
1291
  constructor() {
1252
- this._spaces = new import_util4.ComplexMap(import_keys4.PublicKey.hash);
1292
+ this._spaces = new import_util5.ComplexMap(import_keys4.PublicKey.hash);
1253
1293
  }
1254
1294
  clear() {
1255
1295
  this._spaces.clear();
1256
1296
  }
1257
- registerSpace(spaceKey, host) {
1258
- (0, import_log7.log)("Registering space", {
1297
+ async registerSpace(spaceKey, host) {
1298
+ (0, import_log8.log)("Registering space", {
1259
1299
  spaceKey
1260
1300
  }, {
1261
- file: "data-service.ts",
1262
- line: 31,
1263
- scope: this,
1264
- callSite: (f, a) => f(...a)
1301
+ F: __dxlog_file8,
1302
+ L: 31,
1303
+ S: this,
1304
+ C: (f, a) => f(...a)
1265
1305
  });
1306
+ (0, import_tiny_invariant7.default)(!this._spaces.has(spaceKey));
1307
+ await host.open();
1266
1308
  this._spaces.set(spaceKey, host);
1267
1309
  }
1268
- unregisterSpace(spaceKey) {
1269
- (0, import_log7.log)("Unregistering space", {
1310
+ async unregisterSpace(spaceKey) {
1311
+ (0, import_log8.log)("Unregistering space", {
1270
1312
  spaceKey
1271
1313
  }, {
1272
- file: "data-service.ts",
1273
- line: 36,
1274
- scope: this,
1275
- callSite: (f, a) => f(...a)
1314
+ F: __dxlog_file8,
1315
+ L: 38,
1316
+ S: this,
1317
+ C: (f, a) => f(...a)
1276
1318
  });
1319
+ const host = this._spaces.get(spaceKey);
1320
+ await (host == null ? void 0 : host.close());
1277
1321
  this._spaces.delete(spaceKey);
1278
1322
  }
1279
1323
  getDataService(spaceKey) {
@@ -1286,21 +1330,21 @@ var DataServiceImpl = class {
1286
1330
  }
1287
1331
  subscribe(request) {
1288
1332
  var _a;
1289
- (0, import_node_assert7.default)(request.spaceKey);
1290
- const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug5.raise)(new Error(`space not found: ${request.spaceKey}`));
1333
+ (0, import_tiny_invariant7.default)(request.spaceKey);
1334
+ const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug4.raise)(new Error(`space not found: ${request.spaceKey}`));
1291
1335
  return host.subscribe();
1292
1336
  }
1293
1337
  write(request) {
1294
1338
  var _a;
1295
- (0, import_node_assert7.default)(request.spaceKey);
1296
- (0, import_node_assert7.default)(request.batch);
1297
- const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug5.raise)(new Error(`space not found: ${request.spaceKey}`));
1339
+ (0, import_tiny_invariant7.default)(request.spaceKey);
1340
+ (0, import_tiny_invariant7.default)(request.batch);
1341
+ const host = (_a = this._subscriptions.getDataService(request.spaceKey)) != null ? _a : (0, import_debug4.raise)(new Error(`space not found: ${request.spaceKey}`));
1298
1342
  return host.write(request);
1299
1343
  }
1300
1344
  };
1301
1345
 
1302
1346
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
1303
- var __decorate5 = function(decorators, target, key, desc) {
1347
+ function _ts_decorate5(decorators, target, key, desc) {
1304
1348
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1305
1349
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1306
1350
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1309,18 +1353,23 @@ var __decorate5 = function(decorators, target, key, desc) {
1309
1353
  if (d = decorators[i])
1310
1354
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1311
1355
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1312
- };
1356
+ }
1357
+ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/data-pipeline.ts";
1313
1358
  var MESSAGES_PER_SNAPSHOT = 10;
1314
1359
  var AUTOMATIC_SNAPSHOT_DEBOUNCE_INTERVAL = 5e3;
1315
1360
  var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL2 = 500;
1316
1361
  var DataPipeline = class DataPipeline2 {
1317
1362
  constructor(_params) {
1318
1363
  this._params = _params;
1319
- this._ctx = new import_context4.Context();
1364
+ this._ctx = new import_context5.Context();
1365
+ this._pipeline = void 0;
1366
+ this._targetTimeframe = void 0;
1320
1367
  this._lastAutomaticSnapshotTimeframe = new import_timeframe4.Timeframe();
1321
1368
  this._isOpen = false;
1322
1369
  this._lastTimeframeSaveTime = 0;
1323
1370
  this._lastSnapshotSaveTime = 0;
1371
+ this.currentEpoch = void 0;
1372
+ this.appliedEpoch = void 0;
1324
1373
  this._lastProcessedEpoch = -1;
1325
1374
  this.onNewEpoch = new import_async6.Event();
1326
1375
  }
@@ -1339,18 +1388,14 @@ var DataPipeline = class DataPipeline2 {
1339
1388
  this._targetTimeframe = timeframe;
1340
1389
  (_a = this._pipeline) == null ? void 0 : _a.state.setTargetTimeframe(timeframe);
1341
1390
  }
1342
- createCredentialProcessor() {
1343
- return {
1344
- process: async (credential) => {
1345
- if (!(0, import_credentials3.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
1346
- return;
1347
- }
1348
- this.currentEpoch = credential;
1349
- if (this._isOpen) {
1350
- await this._processEpochInSeparateTask(credential);
1351
- }
1352
- }
1353
- };
1391
+ async processCredential(credential) {
1392
+ if (!(0, import_credentials3.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
1393
+ return;
1394
+ }
1395
+ this.currentEpoch = credential;
1396
+ if (this._isOpen) {
1397
+ await this._processEpochInSeparateTask(credential);
1398
+ }
1354
1399
  }
1355
1400
  async open() {
1356
1401
  if (this._isOpen) {
@@ -1365,8 +1410,8 @@ var DataPipeline = class DataPipeline2 {
1365
1410
  }
1366
1411
  const feedWriter = {
1367
1412
  write: (data, options) => {
1368
- (0, import_node_assert8.default)(this._pipeline, "Pipeline is not initialized.");
1369
- (0, import_node_assert8.default)(this.currentEpoch, "Epoch is not initialized.");
1413
+ (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1414
+ (0, import_tiny_invariant8.default)(this.currentEpoch, "Epoch is not initialized.");
1370
1415
  return this._pipeline.writer.write({
1371
1416
  data
1372
1417
  }, options);
@@ -1385,11 +1430,11 @@ var DataPipeline = class DataPipeline2 {
1385
1430
  if (!this._isOpen) {
1386
1431
  return;
1387
1432
  }
1388
- (0, import_log8.log)("close", {}, {
1389
- file: "data-pipeline.ts",
1390
- line: 174,
1391
- scope: this,
1392
- callSite: (f, a) => f(...a)
1433
+ (0, import_log9.log)("close", void 0, {
1434
+ F: __dxlog_file9,
1435
+ L: 171,
1436
+ S: this,
1437
+ C: (f, a) => f(...a)
1393
1438
  });
1394
1439
  this._isOpen = false;
1395
1440
  await this._ctx.dispose();
@@ -1400,15 +1445,23 @@ var DataPipeline = class DataPipeline2 {
1400
1445
  await this._saveTargetTimeframe(this._pipeline.state.timeframe);
1401
1446
  }
1402
1447
  } catch (err) {
1403
- import_log8.log.catch(err, {}, {
1404
- file: "data-pipeline.ts",
1405
- line: 187,
1406
- scope: this,
1407
- callSite: (f, a) => f(...a)
1448
+ import_log9.log.catch(err, void 0, {
1449
+ F: __dxlog_file9,
1450
+ L: 184,
1451
+ S: this,
1452
+ C: (f, a) => f(...a)
1408
1453
  });
1409
1454
  }
1410
1455
  await ((_b = this.databaseHost) == null ? void 0 : _b.close());
1411
1456
  await ((_c = this.itemManager) == null ? void 0 : _c.destroy());
1457
+ this._ctx = new import_context5.Context();
1458
+ this._pipeline = void 0;
1459
+ this._targetTimeframe = void 0;
1460
+ this._lastAutomaticSnapshotTimeframe = new import_timeframe4.Timeframe();
1461
+ this.currentEpoch = void 0;
1462
+ this.appliedEpoch = void 0;
1463
+ this._lastProcessedEpoch = -1;
1464
+ this._epochCtx = void 0;
1412
1465
  }
1413
1466
  async _consumePipeline() {
1414
1467
  if (this.currentEpoch) {
@@ -1416,29 +1469,29 @@ var DataPipeline = class DataPipeline2 {
1416
1469
  await this._processEpochInSeparateTask(this.currentEpoch);
1417
1470
  await waitForOneEpoch;
1418
1471
  }
1419
- (0, import_node_assert8.default)(this._pipeline, "Pipeline is not initialized.");
1472
+ (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1420
1473
  for await (const msg of this._pipeline.consume()) {
1421
1474
  const { feedKey, seq, data } = msg;
1422
- (0, import_log8.log)("processing message", {
1475
+ (0, import_log9.log)("processing message", {
1423
1476
  feedKey,
1424
1477
  seq
1425
1478
  }, {
1426
- file: "data-pipeline.ts",
1427
- line: 204,
1428
- scope: this,
1429
- callSite: (f, a) => f(...a)
1479
+ F: __dxlog_file9,
1480
+ L: 210,
1481
+ S: this,
1482
+ C: (f, a) => f(...a)
1430
1483
  });
1431
1484
  try {
1432
1485
  if (data.payload.data) {
1433
1486
  const feedInfo = this._params.feedInfoProvider(feedKey);
1434
1487
  if (!feedInfo) {
1435
- import_log8.log.error("Could not find feed.", {
1488
+ import_log9.log.error("Could not find feed.", {
1436
1489
  feedKey
1437
1490
  }, {
1438
- file: "data-pipeline.ts",
1439
- line: 210,
1440
- scope: this,
1441
- callSite: (f, a) => f(...a)
1491
+ F: __dxlog_file9,
1492
+ L: 216,
1493
+ S: this,
1494
+ C: (f, a) => f(...a)
1442
1495
  });
1443
1496
  continue;
1444
1497
  }
@@ -1451,30 +1504,30 @@ var DataPipeline = class DataPipeline2 {
1451
1504
  memberKey: feedInfo.assertion.identityKey
1452
1505
  }
1453
1506
  });
1454
- import_log8.log.trace("dxos.echo.data-pipeline.processed", {
1507
+ import_log9.log.trace("dxos.echo.data-pipeline.processed", {
1455
1508
  feedKey: feedKey.toHex(),
1456
1509
  seq,
1457
1510
  spaceKey: this._params.spaceKey.toHex()
1458
1511
  }, {
1459
- file: "data-pipeline.ts",
1460
- line: 224,
1461
- scope: this,
1462
- callSite: (f, a) => f(...a)
1512
+ F: __dxlog_file9,
1513
+ L: 230,
1514
+ S: this,
1515
+ C: (f, a) => f(...a)
1463
1516
  });
1464
1517
  await this._noteTargetStateIfNeeded(this._pipeline.state.pendingTimeframe);
1465
1518
  }
1466
1519
  } catch (err) {
1467
- import_log8.log.catch(err, {}, {
1468
- file: "data-pipeline.ts",
1469
- line: 234,
1470
- scope: this,
1471
- callSite: (f, a) => f(...a)
1520
+ import_log9.log.catch(err, void 0, {
1521
+ F: __dxlog_file9,
1522
+ L: 240,
1523
+ S: this,
1524
+ C: (f, a) => f(...a)
1472
1525
  });
1473
1526
  }
1474
1527
  }
1475
1528
  }
1476
1529
  _createSnapshot() {
1477
- (0, import_node_assert8.default)(this.databaseHost, "Database backend is not initialized.");
1530
+ (0, import_tiny_invariant8.default)(this.databaseHost, "Database backend is not initialized.");
1478
1531
  return {
1479
1532
  spaceKey: this._params.spaceKey.asUint8Array(),
1480
1533
  timeframe: this._pipeline.state.timeframe,
@@ -1493,17 +1546,17 @@ var DataPipeline = class DataPipeline2 {
1493
1546
  try {
1494
1547
  const propertiesItem = this.itemManager.items.find((item) => {
1495
1548
  var _a2, _b;
1496
- 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";
1549
+ 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";
1497
1550
  });
1498
1551
  if (propertiesItem) {
1499
1552
  cache.properties = (_a = (0, import_echo_db3.getStateMachineFromItem)(propertiesItem)) == null ? void 0 : _a.snapshot();
1500
1553
  }
1501
1554
  } catch (err) {
1502
- import_log8.log.warn("Failed to cache properties", err, {
1503
- file: "data-pipeline.ts",
1504
- line: 268,
1505
- scope: this,
1506
- callSite: (f, a) => f(...a)
1555
+ import_log9.log.warn("Failed to cache properties", err, {
1556
+ F: __dxlog_file9,
1557
+ L: 275,
1558
+ S: this,
1559
+ C: (f, a) => f(...a)
1507
1560
  });
1508
1561
  }
1509
1562
  await this._params.metadataStore.setCache(this._params.spaceKey, cache);
@@ -1523,21 +1576,21 @@ var DataPipeline = class DataPipeline2 {
1523
1576
  return;
1524
1577
  }
1525
1578
  await ((_a = this._epochCtx) == null ? void 0 : _a.dispose());
1526
- const ctx = new import_context4.Context({
1579
+ const ctx = new import_context5.Context({
1527
1580
  onError: (err) => {
1528
1581
  if (err instanceof import_errors2.CancelledError) {
1529
- (0, import_log8.log)("Epoch processing cancelled.", {}, {
1530
- file: "data-pipeline.ts",
1531
- line: 300,
1532
- scope: this,
1533
- callSite: (f, a) => f(...a)
1582
+ (0, import_log9.log)("Epoch processing cancelled.", void 0, {
1583
+ F: __dxlog_file9,
1584
+ L: 307,
1585
+ S: this,
1586
+ C: (f, a) => f(...a)
1534
1587
  });
1535
1588
  } else {
1536
- import_log8.log.catch(err, {}, {
1537
- file: "data-pipeline.ts",
1538
- line: 302,
1539
- scope: this,
1540
- callSite: (f, a) => f(...a)
1589
+ import_log9.log.catch(err, void 0, {
1590
+ F: __dxlog_file9,
1591
+ L: 309,
1592
+ S: this,
1593
+ C: (f, a) => f(...a)
1541
1594
  });
1542
1595
  }
1543
1596
  }
@@ -1547,13 +1600,13 @@ var DataPipeline = class DataPipeline2 {
1547
1600
  if (!this._isOpen) {
1548
1601
  return;
1549
1602
  }
1550
- (0, import_log8.log)("process epoch", {
1603
+ (0, import_log9.log)("process epoch", {
1551
1604
  epoch
1552
1605
  }, {
1553
- file: "data-pipeline.ts",
1554
- line: 312,
1555
- scope: this,
1556
- callSite: (f, a) => f(...a)
1606
+ F: __dxlog_file9,
1607
+ L: 319,
1608
+ S: this,
1609
+ C: (f, a) => f(...a)
1557
1610
  });
1558
1611
  await this._processEpoch(ctx, epoch.subject.assertion);
1559
1612
  this.appliedEpoch = epoch;
@@ -1561,38 +1614,38 @@ var DataPipeline = class DataPipeline2 {
1561
1614
  });
1562
1615
  }
1563
1616
  async _processEpoch(ctx, epoch) {
1564
- (0, import_node_assert8.default)(this._isOpen, "Space is closed.");
1565
- (0, import_node_assert8.default)(this._pipeline);
1617
+ (0, import_tiny_invariant8.default)(this._isOpen, "Space is closed.");
1618
+ (0, import_tiny_invariant8.default)(this._pipeline);
1566
1619
  this._lastProcessedEpoch = epoch.number;
1567
- (0, import_log8.log)("Processing epoch", {
1620
+ (0, import_log9.log)("Processing epoch", {
1568
1621
  epoch
1569
1622
  }, {
1570
- file: "data-pipeline.ts",
1571
- line: 326,
1572
- scope: this,
1573
- callSite: (f, a) => f(...a)
1623
+ F: __dxlog_file9,
1624
+ L: 333,
1625
+ S: this,
1626
+ C: (f, a) => f(...a)
1574
1627
  });
1575
1628
  if (epoch.snapshotCid) {
1576
1629
  const snapshot = await this._params.snapshotManager.load(ctx, epoch.snapshotCid);
1577
1630
  this.databaseHost._itemDemuxer.restoreFromSnapshot(snapshot.database);
1578
1631
  }
1579
- (0, import_log8.log)("restarting pipeline for epoch", {}, {
1580
- file: "data-pipeline.ts",
1581
- line: 334,
1582
- scope: this,
1583
- callSite: (f, a) => f(...a)
1632
+ (0, import_log9.log)("restarting pipeline for epoch", void 0, {
1633
+ F: __dxlog_file9,
1634
+ L: 341,
1635
+ S: this,
1636
+ C: (f, a) => f(...a)
1584
1637
  });
1585
1638
  await this._pipeline.pause();
1586
1639
  await this._pipeline.setCursor(epoch.timeframe);
1587
1640
  await this._pipeline.unpause();
1588
1641
  }
1589
1642
  async waitUntilTimeframe(timeframe) {
1590
- (0, import_node_assert8.default)(this._pipeline, "Pipeline is not initialized.");
1643
+ (0, import_tiny_invariant8.default)(this._pipeline, "Pipeline is not initialized.");
1591
1644
  await this._pipeline.state.waitUntilTimeframe(timeframe);
1592
1645
  }
1593
1646
  async createEpoch() {
1594
- (0, import_node_assert8.default)(this._pipeline);
1595
- (0, import_node_assert8.default)(this.currentEpoch);
1647
+ (0, import_tiny_invariant8.default)(this._pipeline);
1648
+ (0, import_tiny_invariant8.default)(this.currentEpoch);
1596
1649
  await this._pipeline.pause();
1597
1650
  const snapshot = await this._createSnapshot();
1598
1651
  const snapshotCid = await this._params.snapshotManager.store(snapshot);
@@ -1609,24 +1662,24 @@ var DataPipeline = class DataPipeline2 {
1609
1662
  await this.onNewEpoch.waitForCondition(() => !!this.currentEpoch);
1610
1663
  }
1611
1664
  };
1612
- __decorate5([
1665
+ _ts_decorate5([
1613
1666
  import_async6.synchronized
1614
1667
  ], DataPipeline.prototype, "open", null);
1615
- __decorate5([
1668
+ _ts_decorate5([
1616
1669
  import_async6.synchronized
1617
1670
  ], DataPipeline.prototype, "close", null);
1618
- __decorate5([
1671
+ _ts_decorate5([
1619
1672
  import_async6.synchronized
1620
1673
  ], DataPipeline.prototype, "_processEpoch", null);
1621
- __decorate5([
1674
+ _ts_decorate5([
1622
1675
  import_async6.synchronized
1623
1676
  ], DataPipeline.prototype, "createEpoch", null);
1624
- DataPipeline = __decorate5([
1677
+ DataPipeline = _ts_decorate5([
1625
1678
  (0, import_async6.trackLeaks)("open", "close")
1626
1679
  ], DataPipeline);
1627
1680
 
1628
1681
  // packages/core/echo/echo-pipeline/src/space/space.ts
1629
- var __decorate6 = function(decorators, target, key, desc) {
1682
+ function _ts_decorate6(decorators, target, key, desc) {
1630
1683
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1631
1684
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1632
1685
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1635,16 +1688,15 @@ var __decorate6 = function(decorators, target, key, desc) {
1635
1688
  if (d = decorators[i])
1636
1689
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1637
1690
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1638
- };
1691
+ }
1692
+ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
1639
1693
  var Space = class Space2 {
1640
1694
  constructor(params) {
1641
1695
  this._addFeedLock = new import_async7.Lock();
1642
- this.onCredentialProcessed = new import_util5.Callback();
1696
+ this.onCredentialProcessed = new import_util6.Callback();
1643
1697
  this.stateUpdate = new import_async7.Event();
1644
- // Processes epoch credentials.
1645
- this._dataPipelineCredentialConsumer = void 0;
1646
1698
  this._isOpen = false;
1647
- (0, import_node_assert9.default)(params.spaceKey && params.feedProvider);
1699
+ (0, import_tiny_invariant9.default)(params.spaceKey && params.feedProvider);
1648
1700
  this._key = params.spaceKey;
1649
1701
  this._genesisFeedKey = params.genesisFeed.key;
1650
1702
  this._feedProvider = params.feedProvider;
@@ -1676,13 +1728,13 @@ var Space = class Space2 {
1676
1728
  });
1677
1729
  this._controlPipeline.onCredentialProcessed.set(async (credential) => {
1678
1730
  await this.onCredentialProcessed.callIfSet(credential);
1679
- (0, import_log9.log)("onCredentialProcessed", {
1731
+ (0, import_log10.log)("onCredentialProcessed", {
1680
1732
  credential
1681
1733
  }, {
1682
- file: "space.ts",
1683
- line: 110,
1684
- scope: this,
1685
- callSite: (f, a) => f(...a)
1734
+ F: __dxlog_file10,
1735
+ L: 107,
1736
+ S: this,
1737
+ C: (f, a) => f(...a)
1686
1738
  });
1687
1739
  this.stateUpdate.emit();
1688
1740
  });
@@ -1745,14 +1797,14 @@ var Space = class Space2 {
1745
1797
  return this._snapshotManager;
1746
1798
  }
1747
1799
  setControlFeed(feed) {
1748
- (0, import_node_assert9.default)(!this._controlFeed, "Control feed already set.");
1800
+ (0, import_tiny_invariant9.default)(!this._controlFeed, "Control feed already set.");
1749
1801
  this._controlFeed = feed;
1750
1802
  this._controlPipeline.setWriteFeed(feed);
1751
1803
  return this;
1752
1804
  }
1753
1805
  setDataFeed(feed) {
1754
1806
  var _a;
1755
- (0, import_node_assert9.default)(!this._dataFeed, "Data feed already set.");
1807
+ (0, import_tiny_invariant9.default)(!this._dataFeed, "Data feed already set.");
1756
1808
  this._dataFeed = feed;
1757
1809
  (_a = this._dataPipeline.pipeline) == null ? void 0 : _a.setWriteFeed(feed);
1758
1810
  return this;
@@ -1770,98 +1822,95 @@ var Space = class Space2 {
1770
1822
  // return this._dataPipeline?.getFeeds();
1771
1823
  // }
1772
1824
  async open() {
1773
- (0, import_log9.log)("opening...", {}, {
1774
- file: "space.ts",
1775
- line: 212,
1776
- scope: this,
1777
- callSite: (f, a) => f(...a)
1825
+ (0, import_log10.log)("opening...", void 0, {
1826
+ F: __dxlog_file10,
1827
+ L: 209,
1828
+ S: this,
1829
+ C: (f, a) => f(...a)
1778
1830
  });
1779
1831
  if (this._isOpen) {
1780
1832
  return;
1781
1833
  }
1782
1834
  await this._controlPipeline.start();
1783
1835
  await this.protocol.start();
1784
- this._dataPipelineCredentialConsumer = this._controlPipeline.spaceState.registerProcessor(this._dataPipeline.createCredentialProcessor());
1785
- await this._dataPipelineCredentialConsumer.open();
1836
+ await this._controlPipeline.spaceState.addCredentialProcessor(this._dataPipeline);
1786
1837
  this._isOpen = true;
1787
- (0, import_log9.log)("opened", {}, {
1788
- file: "space.ts",
1789
- line: 228,
1790
- scope: this,
1791
- callSite: (f, a) => f(...a)
1838
+ (0, import_log10.log)("opened", void 0, {
1839
+ F: __dxlog_file10,
1840
+ L: 220,
1841
+ S: this,
1842
+ C: (f, a) => f(...a)
1792
1843
  });
1793
1844
  }
1794
1845
  async close() {
1795
- var _a;
1796
- (0, import_log9.log)("closing...", {
1846
+ (0, import_log10.log)("closing...", {
1797
1847
  key: this._key
1798
1848
  }, {
1799
- file: "space.ts",
1800
- line: 233,
1801
- scope: this,
1802
- callSite: (f, a) => f(...a)
1849
+ F: __dxlog_file10,
1850
+ L: 225,
1851
+ S: this,
1852
+ C: (f, a) => f(...a)
1803
1853
  });
1804
1854
  if (!this._isOpen) {
1805
1855
  return;
1806
1856
  }
1807
- await ((_a = this._dataPipelineCredentialConsumer) == null ? void 0 : _a.close());
1808
- this._dataPipelineCredentialConsumer = void 0;
1857
+ await this._controlPipeline.spaceState.removeCredentialProcessor(this._dataPipeline);
1809
1858
  await this._dataPipeline.close();
1810
1859
  await this.protocol.stop();
1811
1860
  await this._controlPipeline.stop();
1812
1861
  this._isOpen = false;
1813
- (0, import_log9.log)("closed", {}, {
1814
- file: "space.ts",
1815
- line: 247,
1816
- scope: this,
1817
- callSite: (f, a) => f(...a)
1862
+ (0, import_log10.log)("closed", void 0, {
1863
+ F: __dxlog_file10,
1864
+ L: 238,
1865
+ S: this,
1866
+ C: (f, a) => f(...a)
1818
1867
  });
1819
1868
  }
1820
1869
  async initializeDataPipeline() {
1821
- (0, import_log9.log)("initializeDataPipeline", {}, {
1822
- file: "space.ts",
1823
- line: 252,
1824
- scope: this,
1825
- callSite: (f, a) => f(...a)
1870
+ (0, import_log10.log)("initializeDataPipeline", void 0, {
1871
+ F: __dxlog_file10,
1872
+ L: 243,
1873
+ S: this,
1874
+ C: (f, a) => f(...a)
1826
1875
  });
1827
- (0, import_node_assert9.default)(this._isOpen, "Space must be open to initialize data pipeline.");
1876
+ (0, import_tiny_invariant9.default)(this._isOpen, "Space must be open to initialize data pipeline.");
1828
1877
  await this._dataPipeline.open();
1829
1878
  }
1830
1879
  };
1831
- __decorate6([
1832
- import_log9.logInfo
1880
+ _ts_decorate6([
1881
+ import_log10.logInfo
1833
1882
  ], Space.prototype, "key", null);
1834
- __decorate6([
1883
+ _ts_decorate6([
1835
1884
  import_async7.synchronized
1836
1885
  ], Space.prototype, "open", null);
1837
- __decorate6([
1886
+ _ts_decorate6([
1838
1887
  import_async7.synchronized
1839
1888
  ], Space.prototype, "close", null);
1840
- __decorate6([
1889
+ _ts_decorate6([
1841
1890
  import_async7.synchronized
1842
1891
  ], Space.prototype, "initializeDataPipeline", null);
1843
- Space = __decorate6([
1892
+ Space = _ts_decorate6([
1844
1893
  (0, import_async7.trackLeaks)("open", "close")
1845
1894
  ], Space);
1846
1895
 
1847
1896
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
1848
1897
  var import_async8 = require("@dxos/async");
1849
- var import_debug6 = require("@dxos/debug");
1898
+ var import_debug5 = require("@dxos/debug");
1850
1899
  var import_keys6 = require("@dxos/keys");
1851
- var import_log11 = require("@dxos/log");
1900
+ var import_log12 = require("@dxos/log");
1852
1901
  var import_protocols6 = require("@dxos/protocols");
1853
- var import_util7 = require("@dxos/util");
1902
+ var import_util8 = require("@dxos/util");
1854
1903
 
1855
1904
  // packages/core/echo/echo-pipeline/src/space/space-protocol.ts
1856
1905
  var import_crypto3 = require("@dxos/crypto");
1857
1906
  var import_keys5 = require("@dxos/keys");
1858
- var import_log10 = require("@dxos/log");
1907
+ var import_log11 = require("@dxos/log");
1859
1908
  var import_network_manager = require("@dxos/network-manager");
1860
1909
  var import_teleport2 = require("@dxos/teleport");
1861
1910
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
1862
1911
  var import_teleport_extension_replicator = require("@dxos/teleport-extension-replicator");
1863
- var import_util6 = require("@dxos/util");
1864
- var __decorate7 = function(decorators, target, key, desc) {
1912
+ var import_util7 = require("@dxos/util");
1913
+ function _ts_decorate7(decorators, target, key, desc) {
1865
1914
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1866
1915
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1867
1916
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1870,13 +1919,14 @@ var __decorate7 = function(decorators, target, key, desc) {
1870
1919
  if (d = decorators[i])
1871
1920
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1872
1921
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1873
- };
1922
+ }
1923
+ var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
1874
1924
  var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
1875
1925
  var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
1876
1926
  var SpaceProtocol = class {
1877
1927
  constructor({ topic, swarmIdentity, networkManager, onSessionAuth, onAuthFailure, blobStore }) {
1878
1928
  this._feeds = /* @__PURE__ */ new Set();
1879
- this._sessions = new import_util6.ComplexMap(import_keys5.PublicKey.hash);
1929
+ this._sessions = new import_util7.ComplexMap(import_keys5.PublicKey.hash);
1880
1930
  this._networkManager = networkManager;
1881
1931
  this._swarmIdentity = swarmIdentity;
1882
1932
  this._onSessionAuth = onSessionAuth;
@@ -1884,7 +1934,7 @@ var SpaceProtocol = class {
1884
1934
  this.blobSync = new import_teleport_extension_object_sync.BlobSync({
1885
1935
  blobStore
1886
1936
  });
1887
- this._topic = import_keys5.PublicKey.from((0, import_crypto3.discoveryKey)((0, import_crypto3.sha256)(topic.toHex())));
1937
+ this._topic = import_crypto3.subtleCrypto.digest("SHA-256", topic.asBuffer()).then(import_crypto3.discoveryKey).then(import_keys5.PublicKey.from);
1888
1938
  }
1889
1939
  get sessions() {
1890
1940
  return this._sessions;
@@ -1897,13 +1947,13 @@ var SpaceProtocol = class {
1897
1947
  }
1898
1948
  // TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
1899
1949
  addFeed(feed) {
1900
- (0, import_log10.log)("addFeed", {
1950
+ (0, import_log11.log)("addFeed", {
1901
1951
  key: feed.key
1902
1952
  }, {
1903
- file: "space-protocol.ts",
1904
- line: 94,
1905
- scope: this,
1906
- callSite: (f, a) => f(...a)
1953
+ F: __dxlog_file11,
1954
+ L: 96,
1955
+ S: this,
1956
+ C: (f, a) => f(...a)
1907
1957
  });
1908
1958
  this._feeds.add(feed);
1909
1959
  for (const session of this._sessions.values()) {
@@ -1921,41 +1971,41 @@ var SpaceProtocol = class {
1921
1971
  sampleSize: 20
1922
1972
  };
1923
1973
  await this.blobSync.open();
1924
- (0, import_log10.log)("starting...", {}, {
1925
- file: "space-protocol.ts",
1926
- line: 119,
1927
- scope: this,
1928
- callSite: (f, a) => f(...a)
1974
+ (0, import_log11.log)("starting...", void 0, {
1975
+ F: __dxlog_file11,
1976
+ L: 121,
1977
+ S: this,
1978
+ C: (f, a) => f(...a)
1929
1979
  });
1930
1980
  this._connection = await this._networkManager.joinSwarm({
1931
1981
  protocolProvider: this._createProtocolProvider(credentials),
1932
1982
  peerId: this._swarmIdentity.peerKey,
1933
- topic: this._topic,
1983
+ topic: await this._topic,
1934
1984
  topology: new import_network_manager.MMSTTopology(topologyConfig),
1935
1985
  label: `Protocol swarm: ${this._topic}`
1936
1986
  });
1937
- (0, import_log10.log)("started", {}, {
1938
- file: "space-protocol.ts",
1939
- line: 128,
1940
- scope: this,
1941
- callSite: (f, a) => f(...a)
1987
+ (0, import_log11.log)("started", void 0, {
1988
+ F: __dxlog_file11,
1989
+ L: 130,
1990
+ S: this,
1991
+ C: (f, a) => f(...a)
1942
1992
  });
1943
1993
  }
1944
1994
  async stop() {
1945
1995
  await this.blobSync.close();
1946
1996
  if (this._connection) {
1947
- (0, import_log10.log)("stopping...", {}, {
1948
- file: "space-protocol.ts",
1949
- line: 135,
1950
- scope: this,
1951
- callSite: (f, a) => f(...a)
1997
+ (0, import_log11.log)("stopping...", void 0, {
1998
+ F: __dxlog_file11,
1999
+ L: 137,
2000
+ S: this,
2001
+ C: (f, a) => f(...a)
1952
2002
  });
1953
2003
  await this._connection.close();
1954
- (0, import_log10.log)("stopped", {}, {
1955
- file: "space-protocol.ts",
1956
- line: 137,
1957
- scope: this,
1958
- callSite: (f, a) => f(...a)
2004
+ (0, import_log11.log)("stopped", void 0, {
2005
+ F: __dxlog_file11,
2006
+ L: 139,
2007
+ S: this,
2008
+ C: (f, a) => f(...a)
1959
2009
  });
1960
2010
  }
1961
2011
  }
@@ -1976,11 +2026,11 @@ var SpaceProtocol = class {
1976
2026
  };
1977
2027
  }
1978
2028
  };
1979
- __decorate7([
1980
- import_log10.logInfo
2029
+ _ts_decorate7([
2030
+ import_log11.logInfo
1981
2031
  ], SpaceProtocol.prototype, "_topic", void 0);
1982
- __decorate7([
1983
- import_log10.logInfo
2032
+ _ts_decorate7([
2033
+ import_log11.logInfo
1984
2034
  ], SpaceProtocol.prototype, "_ownPeerKey", null);
1985
2035
  var AuthStatus;
1986
2036
  (function(AuthStatus2) {
@@ -2006,6 +2056,9 @@ var SpaceProtocolSession = class {
2006
2056
  get authStatus() {
2007
2057
  return this._authStatus;
2008
2058
  }
2059
+ get stats() {
2060
+ return this._teleport.stats;
2061
+ }
2009
2062
  get stream() {
2010
2063
  return this._teleport.stream;
2011
2064
  }
@@ -2016,11 +2069,11 @@ var SpaceProtocolSession = class {
2016
2069
  verifier: this._swarmIdentity.credentialAuthenticator,
2017
2070
  onAuthSuccess: () => {
2018
2071
  var _a;
2019
- (0, import_log10.log)("Peer authenticated", {}, {
2020
- file: "space-protocol.ts",
2021
- line: 230,
2022
- scope: this,
2023
- callSite: (f, a) => f(...a)
2072
+ (0, import_log11.log)("Peer authenticated", void 0, {
2073
+ F: __dxlog_file11,
2074
+ L: 236,
2075
+ S: this,
2076
+ C: (f, a) => f(...a)
2024
2077
  });
2025
2078
  this._authStatus = AuthStatus.SUCCESS;
2026
2079
  (_a = this._onSessionAuth) == null ? void 0 : _a.call(this, this._teleport);
@@ -2038,15 +2091,15 @@ var SpaceProtocolSession = class {
2038
2091
  await this._teleport.close();
2039
2092
  }
2040
2093
  };
2041
- __decorate7([
2042
- import_log10.logInfo
2094
+ _ts_decorate7([
2095
+ import_log11.logInfo
2043
2096
  ], SpaceProtocolSession.prototype, "_wireParams", void 0);
2044
- __decorate7([
2045
- import_log10.logInfo
2097
+ _ts_decorate7([
2098
+ import_log11.logInfo
2046
2099
  ], SpaceProtocolSession.prototype, "authStatus", null);
2047
2100
 
2048
2101
  // packages/core/echo/echo-pipeline/src/space/space-manager.ts
2049
- var __decorate8 = function(decorators, target, key, desc) {
2102
+ function _ts_decorate8(decorators, target, key, desc) {
2050
2103
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2051
2104
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2052
2105
  r = Reflect.decorate(decorators, target, key, desc);
@@ -2055,10 +2108,11 @@ var __decorate8 = function(decorators, target, key, desc) {
2055
2108
  if (d = decorators[i])
2056
2109
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2057
2110
  return c > 3 && r && Object.defineProperty(target, key, r), r;
2058
- };
2111
+ }
2112
+ var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
2059
2113
  var SpaceManager = class SpaceManager2 {
2060
2114
  constructor({ feedStore, networkManager, modelFactory, metadataStore, snapshotStore, blobStore }) {
2061
- this._spaces = new import_util7.ComplexMap(import_keys6.PublicKey.hash);
2115
+ this._spaces = new import_util8.ComplexMap(import_keys6.PublicKey.hash);
2062
2116
  this._instanceId = import_keys6.PublicKey.random().toHex();
2063
2117
  this._feedStore = feedStore;
2064
2118
  this._networkManager = networkManager;
@@ -2080,23 +2134,23 @@ var SpaceManager = class SpaceManager2 {
2080
2134
  }
2081
2135
  async constructSpace({ metadata, swarmIdentity, onNetworkConnection, onAuthFailure, memberKey }) {
2082
2136
  var _a;
2083
- import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
2137
+ import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.begin({
2084
2138
  id: this._instanceId
2085
2139
  }), {
2086
- file: "space-manager.ts",
2087
- line: 97,
2088
- scope: this,
2089
- callSite: (f, a) => f(...a)
2140
+ F: __dxlog_file12,
2141
+ L: 97,
2142
+ S: this,
2143
+ C: (f, a) => f(...a)
2090
2144
  });
2091
- (0, import_log11.log)("constructing space...", {
2145
+ (0, import_log12.log)("constructing space...", {
2092
2146
  spaceKey: metadata.genesisFeedKey
2093
2147
  }, {
2094
- file: "space-manager.ts",
2095
- line: 98,
2096
- scope: this,
2097
- callSite: (f, a) => f(...a)
2148
+ F: __dxlog_file12,
2149
+ L: 98,
2150
+ S: this,
2151
+ C: (f, a) => f(...a)
2098
2152
  });
2099
- const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug6.failUndefined)());
2153
+ const genesisFeed = await this._feedStore.openFeed((_a = metadata.genesisFeedKey) != null ? _a : (0, import_debug5.failUndefined)());
2100
2154
  const spaceKey = metadata.key;
2101
2155
  const protocol = new SpaceProtocol({
2102
2156
  topic: spaceKey,
@@ -2118,24 +2172,24 @@ var SpaceManager = class SpaceManager2 {
2118
2172
  memberKey
2119
2173
  });
2120
2174
  this._spaces.set(space.key, space);
2121
- import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
2175
+ import_log12.log.trace("dxos.echo.space-manager.construct-space", import_protocols6.trace.end({
2122
2176
  id: this._instanceId
2123
2177
  }), {
2124
- file: "space-manager.ts",
2125
- line: 125,
2126
- scope: this,
2127
- callSite: (f, a) => f(...a)
2178
+ F: __dxlog_file12,
2179
+ L: 125,
2180
+ S: this,
2181
+ C: (f, a) => f(...a)
2128
2182
  });
2129
2183
  return space;
2130
2184
  }
2131
2185
  };
2132
- __decorate8([
2186
+ _ts_decorate8([
2133
2187
  import_async8.synchronized
2134
2188
  ], SpaceManager.prototype, "open", null);
2135
- __decorate8([
2189
+ _ts_decorate8([
2136
2190
  import_async8.synchronized
2137
2191
  ], SpaceManager.prototype, "close", null);
2138
- SpaceManager = __decorate8([
2192
+ SpaceManager = _ts_decorate8([
2139
2193
  (0, import_async8.trackLeaks)("open", "close")
2140
2194
  ], SpaceManager);
2141
2195
  // Annotate the CommonJS export names for ESM import in node: