@dxos/echo-pipeline 0.6.1 → 0.6.2-main.1f6dcc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-DMUP426Q.mjs → chunk-UJQ5VS5V.mjs} +383 -196
- package/dist/lib/browser/chunk-UJQ5VS5V.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +59 -562
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-NH5WJKOW.cjs → chunk-RH6TDRML.cjs} +438 -256
- package/dist/lib/node/chunk-RH6TDRML.cjs.map +7 -0
- package/dist/lib/node/index.cjs +80 -581
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +11 -11
- package/dist/types/src/automerge/automerge-host.d.ts +2 -17
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +1 -1
- package/dist/types/src/automerge/index.d.ts +0 -2
- package/dist/types/src/automerge/index.d.ts.map +1 -1
- package/dist/types/src/db-host/data-service.d.ts +10 -7
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +43 -0
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -0
- package/dist/types/src/db-host/documents-synchronizer.test.d.ts +2 -0
- package/dist/types/src/db-host/documents-synchronizer.test.d.ts.map +1 -0
- package/dist/types/src/db-host/index.d.ts +1 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-host.ts +6 -56
- package/src/automerge/automerge-repo.test.ts +124 -1
- package/src/automerge/echo-network-adapter.ts +1 -1
- package/src/automerge/index.ts +0 -2
- package/src/db-host/data-service.ts +49 -25
- package/src/db-host/documents-synchronizer.test.ts +40 -0
- package/src/db-host/documents-synchronizer.ts +156 -0
- package/src/db-host/index.ts +1 -0
- package/dist/lib/browser/chunk-DMUP426Q.mjs.map +0 -7
- package/dist/lib/node/chunk-NH5WJKOW.cjs.map +0 -7
- package/dist/types/src/automerge/automerge-doc-loader.d.ts +0 -71
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +0 -1
- package/dist/types/src/automerge/automerge-doc-loader.test.d.ts +0 -2
- package/dist/types/src/automerge/automerge-doc-loader.test.d.ts.map +0 -1
- package/dist/types/src/automerge/local-host-network-adapter.d.ts +0 -30
- package/dist/types/src/automerge/local-host-network-adapter.d.ts.map +0 -1
- package/src/automerge/automerge-doc-loader.test.ts +0 -103
- package/src/automerge/automerge-doc-loader.ts +0 -267
- package/src/automerge/local-host-network-adapter.ts +0 -115
|
@@ -26,13 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_RH6TDRML_exports = {};
|
|
30
|
+
__export(chunk_RH6TDRML_exports, {
|
|
31
31
|
AuthExtension: () => AuthExtension,
|
|
32
32
|
AuthStatus: () => AuthStatus,
|
|
33
33
|
CredentialRetrieverExtension: () => CredentialRetrieverExtension,
|
|
34
34
|
CredentialServerExtension: () => CredentialServerExtension,
|
|
35
35
|
DataServiceImpl: () => DataServiceImpl,
|
|
36
|
+
DocumentsSynchronizer: () => DocumentsSynchronizer,
|
|
36
37
|
MOCK_AUTH_PROVIDER: () => MOCK_AUTH_PROVIDER,
|
|
37
38
|
MOCK_AUTH_VERIFIER: () => MOCK_AUTH_VERIFIER,
|
|
38
39
|
MetadataStore: () => MetadataStore,
|
|
@@ -53,7 +54,7 @@ __export(chunk_NH5WJKOW_exports, {
|
|
|
53
54
|
startAfter: () => startAfter,
|
|
54
55
|
valueEncoding: () => valueEncoding
|
|
55
56
|
});
|
|
56
|
-
module.exports = __toCommonJS(
|
|
57
|
+
module.exports = __toCommonJS(chunk_RH6TDRML_exports);
|
|
57
58
|
var import_hypercore = require("@dxos/hypercore");
|
|
58
59
|
var import_protocols = require("@dxos/protocols");
|
|
59
60
|
var import_invariant = require("@dxos/invariant");
|
|
@@ -63,72 +64,80 @@ var import_protocols2 = require("@dxos/protocols");
|
|
|
63
64
|
var import_blob = require("@dxos/protocols/proto/dxos/echo/blob");
|
|
64
65
|
var import_crypto = require("@dxos/crypto");
|
|
65
66
|
var import_protocols3 = require("@dxos/protocols");
|
|
66
|
-
var import_crc_32 = __toESM(require("crc-32"));
|
|
67
67
|
var import_async = require("@dxos/async");
|
|
68
|
+
var import_automerge = require("@dxos/automerge/automerge");
|
|
68
69
|
var import_context2 = require("@dxos/context");
|
|
69
70
|
var import_invariant2 = require("@dxos/invariant");
|
|
70
|
-
var import_keys2 = require("@dxos/keys");
|
|
71
71
|
var import_log = require("@dxos/log");
|
|
72
|
+
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
73
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
74
|
+
var import_log2 = require("@dxos/log");
|
|
75
|
+
var import_crc_32 = __toESM(require("crc-32"));
|
|
76
|
+
var import_async2 = require("@dxos/async");
|
|
77
|
+
var import_context3 = require("@dxos/context");
|
|
78
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
79
|
+
var import_keys2 = require("@dxos/keys");
|
|
80
|
+
var import_log3 = require("@dxos/log");
|
|
72
81
|
var import_protocols4 = require("@dxos/protocols");
|
|
73
82
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
74
83
|
var import_util = require("@dxos/util");
|
|
75
|
-
var
|
|
84
|
+
var import_async3 = require("@dxos/async");
|
|
76
85
|
var import_debug = require("@dxos/debug");
|
|
77
|
-
var
|
|
86
|
+
var import_log4 = require("@dxos/log");
|
|
78
87
|
var import_timeframe = require("@dxos/timeframe");
|
|
79
|
-
var
|
|
80
|
-
var
|
|
88
|
+
var import_async4 = require("@dxos/async");
|
|
89
|
+
var import_context4 = require("@dxos/context");
|
|
81
90
|
var import_debug2 = require("@dxos/debug");
|
|
82
91
|
var import_feed_store = require("@dxos/feed-store");
|
|
83
|
-
var
|
|
92
|
+
var import_invariant5 = require("@dxos/invariant");
|
|
84
93
|
var import_keys3 = require("@dxos/keys");
|
|
85
|
-
var
|
|
94
|
+
var import_log5 = require("@dxos/log");
|
|
86
95
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
87
96
|
var import_util2 = require("@dxos/util");
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
97
|
+
var import_invariant6 = require("@dxos/invariant");
|
|
98
|
+
var import_log6 = require("@dxos/log");
|
|
99
|
+
var import_async5 = require("@dxos/async");
|
|
100
|
+
var import_context5 = require("@dxos/context");
|
|
92
101
|
var import_crypto2 = require("@dxos/crypto");
|
|
93
|
-
var
|
|
94
|
-
var
|
|
102
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
103
|
+
var import_log7 = require("@dxos/log");
|
|
95
104
|
var import_protocols5 = require("@dxos/protocols");
|
|
96
105
|
var import_teleport = require("@dxos/teleport");
|
|
97
|
-
var
|
|
98
|
-
var
|
|
106
|
+
var import_async6 = require("@dxos/async");
|
|
107
|
+
var import_context6 = require("@dxos/context");
|
|
99
108
|
var import_crypto3 = require("@dxos/crypto");
|
|
100
|
-
var
|
|
109
|
+
var import_invariant8 = require("@dxos/invariant");
|
|
101
110
|
var import_keys4 = require("@dxos/keys");
|
|
102
|
-
var
|
|
111
|
+
var import_log8 = require("@dxos/log");
|
|
103
112
|
var import_credentials = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
104
113
|
var import_tracing = require("@dxos/tracing");
|
|
105
114
|
var import_util3 = require("@dxos/util");
|
|
106
|
-
var
|
|
107
|
-
var
|
|
115
|
+
var import_async7 = require("@dxos/async");
|
|
116
|
+
var import_context7 = require("@dxos/context");
|
|
108
117
|
var import_credentials2 = require("@dxos/credentials");
|
|
109
118
|
var import_keys5 = require("@dxos/keys");
|
|
110
|
-
var
|
|
119
|
+
var import_log9 = require("@dxos/log");
|
|
111
120
|
var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
112
121
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
113
122
|
var import_tracing2 = require("@dxos/tracing");
|
|
114
123
|
var import_util4 = require("@dxos/util");
|
|
115
|
-
var
|
|
116
|
-
var
|
|
124
|
+
var import_async8 = require("@dxos/async");
|
|
125
|
+
var import_context8 = require("@dxos/context");
|
|
117
126
|
var import_protocols6 = require("@dxos/protocols");
|
|
118
127
|
var import_teleport2 = require("@dxos/teleport");
|
|
119
128
|
var import_crypto4 = require("@dxos/crypto");
|
|
120
129
|
var import_keys6 = require("@dxos/keys");
|
|
121
|
-
var
|
|
130
|
+
var import_log10 = require("@dxos/log");
|
|
122
131
|
var import_network_manager = require("@dxos/network-manager");
|
|
123
132
|
var import_teleport3 = require("@dxos/teleport");
|
|
124
133
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
125
134
|
var import_teleport_extension_replicator = require("@dxos/teleport-extension-replicator");
|
|
126
135
|
var import_tracing3 = require("@dxos/tracing");
|
|
127
136
|
var import_util5 = require("@dxos/util");
|
|
128
|
-
var
|
|
137
|
+
var import_async9 = require("@dxos/async");
|
|
129
138
|
var import_debug3 = require("@dxos/debug");
|
|
130
139
|
var import_keys7 = require("@dxos/keys");
|
|
131
|
-
var
|
|
140
|
+
var import_log11 = require("@dxos/log");
|
|
132
141
|
var import_protocols7 = require("@dxos/protocols");
|
|
133
142
|
var import_util6 = require("@dxos/util");
|
|
134
143
|
var codec = import_protocols.schema.getCodecForType("dxos.echo.feed.FeedMessage");
|
|
@@ -228,30 +237,202 @@ var SnapshotStore = class {
|
|
|
228
237
|
}));
|
|
229
238
|
}
|
|
230
239
|
};
|
|
240
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/documents-synchronizer.ts";
|
|
241
|
+
var MAX_UPDATE_FREQ = 10;
|
|
242
|
+
var DocumentsSynchronizer = class extends import_context2.Resource {
|
|
243
|
+
constructor(_params) {
|
|
244
|
+
super();
|
|
245
|
+
this._params = _params;
|
|
246
|
+
this._syncStates = /* @__PURE__ */ new Map();
|
|
247
|
+
this._pendingUpdates = /* @__PURE__ */ new Set();
|
|
248
|
+
this._sendUpdatesJob = void 0;
|
|
249
|
+
}
|
|
250
|
+
async addDocuments(documentIds) {
|
|
251
|
+
for (const documentId of documentIds) {
|
|
252
|
+
const doc = this._params.repo.find(documentId);
|
|
253
|
+
await doc.whenReady();
|
|
254
|
+
this._startSync(doc);
|
|
255
|
+
this._pendingUpdates.add(doc.documentId);
|
|
256
|
+
}
|
|
257
|
+
this._sendUpdatesJob.trigger();
|
|
258
|
+
}
|
|
259
|
+
removeDocuments(documentIds) {
|
|
260
|
+
for (const documentId of documentIds) {
|
|
261
|
+
this._syncStates.get(documentId)?.clearSubscriptions?.();
|
|
262
|
+
this._syncStates.delete(documentId);
|
|
263
|
+
this._pendingUpdates.delete(documentId);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async _open() {
|
|
267
|
+
this._sendUpdatesJob = new import_async.UpdateScheduler(this._ctx, this._checkAndSendUpdates.bind(this), {
|
|
268
|
+
maxFrequency: MAX_UPDATE_FREQ
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
async _close() {
|
|
272
|
+
await this._sendUpdatesJob.join();
|
|
273
|
+
this._syncStates.clear();
|
|
274
|
+
}
|
|
275
|
+
update(updates) {
|
|
276
|
+
for (const { documentId, mutation, isNew } of updates) {
|
|
277
|
+
if (isNew) {
|
|
278
|
+
const doc = this._params.repo.find(documentId);
|
|
279
|
+
doc.update((doc2) => import_automerge.next.loadIncremental(doc2, mutation));
|
|
280
|
+
this._startSync(doc);
|
|
281
|
+
} else {
|
|
282
|
+
this._writeMutation(documentId, mutation);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
_startSync(doc) {
|
|
287
|
+
if (this._syncStates.has(doc.documentId)) {
|
|
288
|
+
import_log.log.info("Document already being synced", {
|
|
289
|
+
documentId: doc.documentId
|
|
290
|
+
}, {
|
|
291
|
+
F: __dxlog_file2,
|
|
292
|
+
L: 90,
|
|
293
|
+
S: this,
|
|
294
|
+
C: (f, a) => f(...a)
|
|
295
|
+
});
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const syncState = {
|
|
299
|
+
handle: doc
|
|
300
|
+
};
|
|
301
|
+
this._subscribeForChanges(syncState);
|
|
302
|
+
this._syncStates.set(doc.documentId, syncState);
|
|
303
|
+
}
|
|
304
|
+
_subscribeForChanges(syncState) {
|
|
305
|
+
const handler = () => {
|
|
306
|
+
this._pendingUpdates.add(syncState.handle.documentId);
|
|
307
|
+
this._sendUpdatesJob.trigger();
|
|
308
|
+
};
|
|
309
|
+
syncState.handle.on("heads-changed", handler);
|
|
310
|
+
syncState.clearSubscriptions = () => syncState.handle.off("heads-changed", handler);
|
|
311
|
+
}
|
|
312
|
+
async _checkAndSendUpdates() {
|
|
313
|
+
const updates = [];
|
|
314
|
+
const docsWithPendingUpdates = Array.from(this._pendingUpdates);
|
|
315
|
+
this._pendingUpdates.clear();
|
|
316
|
+
for (const documentId of docsWithPendingUpdates) {
|
|
317
|
+
const update = this._getPendingChanges(documentId);
|
|
318
|
+
if (update) {
|
|
319
|
+
updates.push({
|
|
320
|
+
documentId,
|
|
321
|
+
mutation: update
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (updates.length > 0) {
|
|
326
|
+
this._params.sendUpdates({
|
|
327
|
+
updates
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
_getPendingChanges(documentId) {
|
|
332
|
+
const syncState = this._syncStates.get(documentId);
|
|
333
|
+
(0, import_invariant2.invariant)(syncState, "Sync state for document not found", {
|
|
334
|
+
F: __dxlog_file2,
|
|
335
|
+
L: 131,
|
|
336
|
+
S: this,
|
|
337
|
+
A: [
|
|
338
|
+
"syncState",
|
|
339
|
+
"'Sync state for document not found'"
|
|
340
|
+
]
|
|
341
|
+
});
|
|
342
|
+
const doc = syncState.handle.docSync();
|
|
343
|
+
if (!doc) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const mutation = syncState.lastSentHead ? import_automerge.next.saveSince(doc, syncState.lastSentHead) : import_automerge.next.save(doc);
|
|
347
|
+
if (mutation.length === 0) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
syncState.lastSentHead = import_automerge.next.getHeads(doc);
|
|
351
|
+
return mutation;
|
|
352
|
+
}
|
|
353
|
+
_writeMutation(documentId, mutation) {
|
|
354
|
+
const syncState = this._syncStates.get(documentId);
|
|
355
|
+
(0, import_invariant2.invariant)(syncState, "Sync state for document not found", {
|
|
356
|
+
F: __dxlog_file2,
|
|
357
|
+
L: 146,
|
|
358
|
+
S: this,
|
|
359
|
+
A: [
|
|
360
|
+
"syncState",
|
|
361
|
+
"'Sync state for document not found'"
|
|
362
|
+
]
|
|
363
|
+
});
|
|
364
|
+
syncState.handle.update((doc) => {
|
|
365
|
+
const headsBefore = import_automerge.next.getHeads(doc);
|
|
366
|
+
const newDoc = import_automerge.next.loadIncremental(doc, mutation);
|
|
367
|
+
if (import_automerge.next.equals(headsBefore, syncState.lastSentHead)) {
|
|
368
|
+
syncState.lastSentHead = import_automerge.next.getHeads(newDoc);
|
|
369
|
+
}
|
|
370
|
+
return newDoc;
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/db-host/data-service.ts";
|
|
231
375
|
var DataServiceImpl = class {
|
|
232
376
|
constructor(params) {
|
|
377
|
+
this._subscriptions = /* @__PURE__ */ new Map();
|
|
233
378
|
this._automergeHost = params.automergeHost;
|
|
234
379
|
this._updateIndexes = params.updateIndexes;
|
|
235
380
|
}
|
|
236
381
|
subscribe(request) {
|
|
237
|
-
|
|
382
|
+
return new import_codec_protobuf.Stream(({ next, ready }) => {
|
|
383
|
+
const synchronizer = new DocumentsSynchronizer({
|
|
384
|
+
repo: this._automergeHost.repo,
|
|
385
|
+
sendUpdates: (updates) => next(updates)
|
|
386
|
+
});
|
|
387
|
+
synchronizer.open().then(() => {
|
|
388
|
+
this._subscriptions.set(request.subscriptionId, synchronizer);
|
|
389
|
+
ready();
|
|
390
|
+
}).catch((err) => import_log2.log.catch(err, void 0, {
|
|
391
|
+
F: __dxlog_file3,
|
|
392
|
+
L: 62,
|
|
393
|
+
S: this,
|
|
394
|
+
C: (f, a) => f(...a)
|
|
395
|
+
}));
|
|
396
|
+
return () => synchronizer.close();
|
|
397
|
+
});
|
|
238
398
|
}
|
|
239
|
-
|
|
240
|
-
|
|
399
|
+
async updateSubscription(request) {
|
|
400
|
+
const synchronizer = this._subscriptions.get(request.subscriptionId);
|
|
401
|
+
(0, import_invariant3.invariant)(synchronizer, "Subscription not found", {
|
|
402
|
+
F: __dxlog_file3,
|
|
403
|
+
L: 69,
|
|
404
|
+
S: this,
|
|
405
|
+
A: [
|
|
406
|
+
"synchronizer",
|
|
407
|
+
"'Subscription not found'"
|
|
408
|
+
]
|
|
409
|
+
});
|
|
410
|
+
if (request.addIds?.length) {
|
|
411
|
+
await synchronizer.addDocuments(request.addIds);
|
|
412
|
+
}
|
|
413
|
+
if (request.removeIds?.length) {
|
|
414
|
+
await synchronizer.removeDocuments(request.removeIds);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
async update(request) {
|
|
418
|
+
if (!request.updates) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const synchronizer = this._subscriptions.get(request.subscriptionId);
|
|
422
|
+
(0, import_invariant3.invariant)(synchronizer, "Subscription not found", {
|
|
423
|
+
F: __dxlog_file3,
|
|
424
|
+
L: 84,
|
|
425
|
+
S: this,
|
|
426
|
+
A: [
|
|
427
|
+
"synchronizer",
|
|
428
|
+
"'Subscription not found'"
|
|
429
|
+
]
|
|
430
|
+
});
|
|
431
|
+
synchronizer.update(request.updates);
|
|
241
432
|
}
|
|
242
433
|
async flush(request) {
|
|
243
434
|
await this._automergeHost.flush(request);
|
|
244
435
|
}
|
|
245
|
-
// Automerge specific.
|
|
246
|
-
async getHostInfo(request) {
|
|
247
|
-
return this._automergeHost.getHostInfo();
|
|
248
|
-
}
|
|
249
|
-
syncRepo(request) {
|
|
250
|
-
return this._automergeHost.syncRepo(request);
|
|
251
|
-
}
|
|
252
|
-
sendSyncMessage(request) {
|
|
253
|
-
return this._automergeHost.sendSyncMessage(request);
|
|
254
|
-
}
|
|
255
436
|
async getDocumentHeads(request) {
|
|
256
437
|
const entries = await Promise.all(request.documentIds?.map(async (documentId) => {
|
|
257
438
|
const heads = await this._automergeHost.getHeads(documentId);
|
|
@@ -286,7 +467,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
286
467
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
287
468
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
288
469
|
}
|
|
289
|
-
var
|
|
470
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
|
|
290
471
|
var EXPIRED_INVITATION_CLEANUP_INTERVAL = 60 * 60 * 1e3;
|
|
291
472
|
var emptyEchoMetadata = () => ({
|
|
292
473
|
version: import_protocols4.STORAGE_VERSION,
|
|
@@ -302,9 +483,9 @@ var MetadataStore = class {
|
|
|
302
483
|
this._metadata = emptyEchoMetadata();
|
|
303
484
|
this._spaceLargeMetadata = new import_util.ComplexMap(import_keys2.PublicKey.hash);
|
|
304
485
|
this._metadataFile = void 0;
|
|
305
|
-
this.update = new
|
|
306
|
-
this._invitationCleanupCtx = new
|
|
307
|
-
F:
|
|
486
|
+
this.update = new import_async2.Event();
|
|
487
|
+
this._invitationCleanupCtx = new import_context3.Context(void 0, {
|
|
488
|
+
F: __dxlog_file4,
|
|
308
489
|
L: 53
|
|
309
490
|
});
|
|
310
491
|
this._directory = directory;
|
|
@@ -330,12 +511,12 @@ var MetadataStore = class {
|
|
|
330
511
|
}
|
|
331
512
|
const dataSize = fromBytesInt32(await file.read(0, 4));
|
|
332
513
|
const checksum = fromBytesInt32(await file.read(4, 4));
|
|
333
|
-
(0,
|
|
514
|
+
(0, import_log3.log)("loaded", {
|
|
334
515
|
size: dataSize,
|
|
335
516
|
checksum,
|
|
336
517
|
name: file.filename
|
|
337
518
|
}, {
|
|
338
|
-
F:
|
|
519
|
+
F: __dxlog_file4,
|
|
339
520
|
L: 89,
|
|
340
521
|
S: this,
|
|
341
522
|
C: (f, a) => f(...a)
|
|
@@ -367,11 +548,11 @@ var MetadataStore = class {
|
|
|
367
548
|
result.writeInt32LE(checksum, 4);
|
|
368
549
|
encoded.copy(result, 8);
|
|
369
550
|
await file.write(0, result);
|
|
370
|
-
(0,
|
|
551
|
+
(0, import_log3.log)("saved", {
|
|
371
552
|
size: encoded.length,
|
|
372
553
|
checksum
|
|
373
554
|
}, {
|
|
374
|
-
F:
|
|
555
|
+
F: __dxlog_file4,
|
|
375
556
|
L: 124,
|
|
376
557
|
S: this,
|
|
377
558
|
C: (f, a) => f(...a)
|
|
@@ -401,10 +582,10 @@ var MetadataStore = class {
|
|
|
401
582
|
space.state ??= import_services.SpaceState.ACTIVE;
|
|
402
583
|
});
|
|
403
584
|
} catch (err) {
|
|
404
|
-
|
|
585
|
+
import_log3.log.error("failed to load metadata", {
|
|
405
586
|
err
|
|
406
587
|
}, {
|
|
407
|
-
F:
|
|
588
|
+
F: __dxlog_file4,
|
|
408
589
|
L: 156,
|
|
409
590
|
S: this,
|
|
410
591
|
C: (f, a) => f(...a)
|
|
@@ -418,17 +599,17 @@ var MetadataStore = class {
|
|
|
418
599
|
try {
|
|
419
600
|
await this._loadSpaceLargeMetadata(key);
|
|
420
601
|
} catch (err) {
|
|
421
|
-
|
|
602
|
+
import_log3.log.error("failed to load space large metadata", {
|
|
422
603
|
err
|
|
423
604
|
}, {
|
|
424
|
-
F:
|
|
605
|
+
F: __dxlog_file4,
|
|
425
606
|
L: 168,
|
|
426
607
|
S: this,
|
|
427
608
|
C: (f, a) => f(...a)
|
|
428
609
|
});
|
|
429
610
|
}
|
|
430
611
|
});
|
|
431
|
-
(0,
|
|
612
|
+
(0, import_async2.scheduleTaskInterval)(this._invitationCleanupCtx, async () => {
|
|
432
613
|
for (const invitation of this._metadata.invitations ?? []) {
|
|
433
614
|
if (hasInvitationExpired(invitation) || isLegacyInvitationFormat(invitation)) {
|
|
434
615
|
await this.removeInvitation(invitation.invitationId);
|
|
@@ -455,10 +636,10 @@ var MetadataStore = class {
|
|
|
455
636
|
this._spaceLargeMetadata.set(key, metadata);
|
|
456
637
|
}
|
|
457
638
|
} catch (err) {
|
|
458
|
-
|
|
639
|
+
import_log3.log.error("failed to load space large metadata", {
|
|
459
640
|
err
|
|
460
641
|
}, {
|
|
461
|
-
F:
|
|
642
|
+
F: __dxlog_file4,
|
|
462
643
|
L: 210,
|
|
463
644
|
S: this,
|
|
464
645
|
C: (f, a) => f(...a)
|
|
@@ -478,8 +659,8 @@ var MetadataStore = class {
|
|
|
478
659
|
return this._metadata.identity.haloSpace;
|
|
479
660
|
}
|
|
480
661
|
const space = this.spaces.find((space2) => space2.key === spaceKey);
|
|
481
|
-
(0,
|
|
482
|
-
F:
|
|
662
|
+
(0, import_invariant4.invariant)(space, "Space not found", {
|
|
663
|
+
F: __dxlog_file4,
|
|
483
664
|
L: 232,
|
|
484
665
|
S: this,
|
|
485
666
|
A: [
|
|
@@ -502,8 +683,8 @@ var MetadataStore = class {
|
|
|
502
683
|
* Clears storage - doesn't work for now.
|
|
503
684
|
*/
|
|
504
685
|
async clear() {
|
|
505
|
-
(0,
|
|
506
|
-
F:
|
|
686
|
+
(0, import_log3.log)("clearing all metadata", void 0, {
|
|
687
|
+
F: __dxlog_file4,
|
|
507
688
|
L: 251,
|
|
508
689
|
S: this,
|
|
509
690
|
C: (f, a) => f(...a)
|
|
@@ -515,8 +696,8 @@ var MetadataStore = class {
|
|
|
515
696
|
return this._metadata.identity;
|
|
516
697
|
}
|
|
517
698
|
async setIdentityRecord(record) {
|
|
518
|
-
(0,
|
|
519
|
-
F:
|
|
699
|
+
(0, import_invariant4.invariant)(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
700
|
+
F: __dxlog_file4,
|
|
520
701
|
L: 261,
|
|
521
702
|
S: this,
|
|
522
703
|
A: [
|
|
@@ -545,8 +726,8 @@ var MetadataStore = class {
|
|
|
545
726
|
await this.flush();
|
|
546
727
|
}
|
|
547
728
|
async addSpace(record) {
|
|
548
|
-
(0,
|
|
549
|
-
F:
|
|
729
|
+
(0, import_invariant4.invariant)(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
|
|
730
|
+
F: __dxlog_file4,
|
|
550
731
|
L: 289,
|
|
551
732
|
S: this,
|
|
552
733
|
A: [
|
|
@@ -593,13 +774,13 @@ var MetadataStore = class {
|
|
|
593
774
|
}
|
|
594
775
|
};
|
|
595
776
|
_ts_decorate([
|
|
596
|
-
|
|
777
|
+
import_async2.synchronized
|
|
597
778
|
], MetadataStore.prototype, "load", null);
|
|
598
779
|
_ts_decorate([
|
|
599
|
-
|
|
780
|
+
import_async2.synchronized
|
|
600
781
|
], MetadataStore.prototype, "_save", null);
|
|
601
782
|
_ts_decorate([
|
|
602
|
-
|
|
783
|
+
import_async2.synchronized
|
|
603
784
|
], MetadataStore.prototype, "_saveSpaceLargeMetadata", null);
|
|
604
785
|
var fromBytesInt32 = (buf) => buf.readInt32LE(0);
|
|
605
786
|
var hasInvitationExpired = (invitation) => {
|
|
@@ -618,7 +799,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
618
799
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
619
800
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
620
801
|
}
|
|
621
|
-
var
|
|
802
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/timeframe-clock.ts";
|
|
622
803
|
var mapTimeframeToFeedIndexes = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
623
804
|
feedKey,
|
|
624
805
|
index
|
|
@@ -634,7 +815,7 @@ var startAfter = (timeframe) => timeframe.frames().map(([feedKey, index]) => ({
|
|
|
634
815
|
var TimeframeClock = class {
|
|
635
816
|
constructor(_timeframe = new import_timeframe.Timeframe()) {
|
|
636
817
|
this._timeframe = _timeframe;
|
|
637
|
-
this.update = new
|
|
818
|
+
this.update = new import_async3.Event();
|
|
638
819
|
this._pendingTimeframe = _timeframe;
|
|
639
820
|
}
|
|
640
821
|
/**
|
|
@@ -672,22 +853,22 @@ var TimeframeClock = class {
|
|
|
672
853
|
return !gaps.isEmpty();
|
|
673
854
|
}
|
|
674
855
|
async waitUntilReached(target) {
|
|
675
|
-
(0,
|
|
856
|
+
(0, import_log4.log)("waitUntilReached", {
|
|
676
857
|
target,
|
|
677
858
|
current: this._timeframe
|
|
678
859
|
}, {
|
|
679
|
-
F:
|
|
860
|
+
F: __dxlog_file5,
|
|
680
861
|
L: 70,
|
|
681
862
|
S: this,
|
|
682
863
|
C: (f, a) => f(...a)
|
|
683
864
|
});
|
|
684
865
|
await this.update.waitForCondition(() => {
|
|
685
|
-
(0,
|
|
866
|
+
(0, import_log4.log)("check if reached", {
|
|
686
867
|
target,
|
|
687
868
|
current: this._timeframe,
|
|
688
869
|
deps: import_timeframe.Timeframe.dependencies(target, this._timeframe)
|
|
689
870
|
}, {
|
|
690
|
-
F:
|
|
871
|
+
F: __dxlog_file5,
|
|
691
872
|
L: 72,
|
|
692
873
|
S: this,
|
|
693
874
|
C: (f, a) => f(...a)
|
|
@@ -699,13 +880,13 @@ var TimeframeClock = class {
|
|
|
699
880
|
_ts_decorate2([
|
|
700
881
|
(0, import_debug.timed)(5e3)
|
|
701
882
|
], TimeframeClock.prototype, "waitUntilReached", null);
|
|
702
|
-
var
|
|
883
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/message-selector.ts";
|
|
703
884
|
var createMessageSelector = (timeframeClock) => {
|
|
704
885
|
return (messages) => {
|
|
705
886
|
for (let i = 0; i < messages.length; i++) {
|
|
706
887
|
const { data: { timeframe } } = messages[i];
|
|
707
|
-
(0,
|
|
708
|
-
F:
|
|
888
|
+
(0, import_invariant6.invariant)(timeframe, void 0, {
|
|
889
|
+
F: __dxlog_file6,
|
|
709
890
|
L: 25,
|
|
710
891
|
S: void 0,
|
|
711
892
|
A: [
|
|
@@ -717,8 +898,8 @@ var createMessageSelector = (timeframeClock) => {
|
|
|
717
898
|
return i;
|
|
718
899
|
}
|
|
719
900
|
}
|
|
720
|
-
(0,
|
|
721
|
-
F:
|
|
901
|
+
(0, import_log6.log)("Skipping...", void 0, {
|
|
902
|
+
F: __dxlog_file6,
|
|
722
903
|
L: 33,
|
|
723
904
|
S: void 0,
|
|
724
905
|
C: (f, a) => f(...a)
|
|
@@ -735,17 +916,17 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
735
916
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
736
917
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
737
918
|
}
|
|
738
|
-
var
|
|
919
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts";
|
|
739
920
|
var PipelineState = class {
|
|
740
921
|
constructor(_feeds, _timeframeClock) {
|
|
741
922
|
this._feeds = _feeds;
|
|
742
923
|
this._timeframeClock = _timeframeClock;
|
|
743
|
-
this._ctx = new
|
|
744
|
-
F:
|
|
924
|
+
this._ctx = new import_context4.Context(void 0, {
|
|
925
|
+
F: __dxlog_file7,
|
|
745
926
|
L: 41
|
|
746
927
|
});
|
|
747
928
|
this.timeframeUpdate = this._timeframeClock.update;
|
|
748
|
-
this.stalled = new
|
|
929
|
+
this.stalled = new import_async4.Event();
|
|
749
930
|
this._startTimeframe = new import_timeframe2.Timeframe();
|
|
750
931
|
this._reachedTarget = false;
|
|
751
932
|
}
|
|
@@ -791,16 +972,16 @@ var PipelineState = class {
|
|
|
791
972
|
*
|
|
792
973
|
* @param timeout Timeout in milliseconds to specify the maximum wait time.
|
|
793
974
|
*/
|
|
794
|
-
async waitUntilReachedTargetTimeframe({ ctx = new
|
|
795
|
-
F:
|
|
975
|
+
async waitUntilReachedTargetTimeframe({ ctx = new import_context4.Context(void 0, {
|
|
976
|
+
F: __dxlog_file7,
|
|
796
977
|
L: 129
|
|
797
978
|
}), timeout, breakOnStall = true } = {}) {
|
|
798
|
-
(0,
|
|
979
|
+
(0, import_log5.log)("waitUntilReachedTargetTimeframe", {
|
|
799
980
|
timeout,
|
|
800
981
|
current: this.timeframe,
|
|
801
982
|
target: this.targetTimeframe
|
|
802
983
|
}, {
|
|
803
|
-
F:
|
|
984
|
+
F: __dxlog_file7,
|
|
804
985
|
L: 133,
|
|
805
986
|
S: this,
|
|
806
987
|
C: (f, a) => f(...a)
|
|
@@ -816,23 +997,23 @@ var PipelineState = class {
|
|
|
816
997
|
let done = false;
|
|
817
998
|
if (timeout) {
|
|
818
999
|
return Promise.race([
|
|
819
|
-
(0,
|
|
820
|
-
(0,
|
|
1000
|
+
(0, import_context4.rejectOnDispose)(ctx),
|
|
1001
|
+
(0, import_context4.rejectOnDispose)(this._ctx),
|
|
821
1002
|
this._reachedTargetPromise.then(() => {
|
|
822
1003
|
done = true;
|
|
823
1004
|
this._reachedTarget = true;
|
|
824
1005
|
}),
|
|
825
|
-
(0,
|
|
1006
|
+
(0, import_async4.sleepWithContext)(this._ctx, timeout).then(() => {
|
|
826
1007
|
if (done) {
|
|
827
1008
|
return;
|
|
828
1009
|
}
|
|
829
|
-
|
|
1010
|
+
import_log5.log.warn("waitUntilReachedTargetTimeframe timed out", {
|
|
830
1011
|
timeout,
|
|
831
1012
|
current: this.timeframe,
|
|
832
1013
|
target: this.targetTimeframe,
|
|
833
1014
|
dependencies: import_timeframe2.Timeframe.dependencies(this.targetTimeframe, this.timeframe)
|
|
834
1015
|
}, {
|
|
835
|
-
F:
|
|
1016
|
+
F: __dxlog_file7,
|
|
836
1017
|
L: 161,
|
|
837
1018
|
S: this,
|
|
838
1019
|
C: (f, a) => f(...a)
|
|
@@ -849,8 +1030,8 @@ var Pipeline = class {
|
|
|
849
1030
|
this._timeframeClock = new TimeframeClock(new import_timeframe2.Timeframe());
|
|
850
1031
|
this._feeds = new import_util2.ComplexMap(import_keys3.PublicKey.hash);
|
|
851
1032
|
this._state = new PipelineState(this._feeds, this._timeframeClock);
|
|
852
|
-
this._processingTrigger = new
|
|
853
|
-
this._pauseTrigger = new
|
|
1033
|
+
this._processingTrigger = new import_async4.Trigger().wake();
|
|
1034
|
+
this._pauseTrigger = new import_async4.Trigger().wake();
|
|
854
1035
|
this._downloads = new import_util2.ComplexMap((value) => import_keys3.PublicKey.hash(value.key));
|
|
855
1036
|
this._isStopping = false;
|
|
856
1037
|
this._isStarted = false;
|
|
@@ -861,8 +1042,8 @@ var Pipeline = class {
|
|
|
861
1042
|
return this._state;
|
|
862
1043
|
}
|
|
863
1044
|
get writer() {
|
|
864
|
-
(0,
|
|
865
|
-
F:
|
|
1045
|
+
(0, import_invariant5.invariant)(this._writer, "Writer not set.", {
|
|
1046
|
+
F: __dxlog_file7,
|
|
866
1047
|
L: 243,
|
|
867
1048
|
S: this,
|
|
868
1049
|
A: [
|
|
@@ -890,8 +1071,8 @@ var Pipeline = class {
|
|
|
890
1071
|
}
|
|
891
1072
|
}
|
|
892
1073
|
setWriteFeed(feed) {
|
|
893
|
-
(0,
|
|
894
|
-
F:
|
|
1074
|
+
(0, import_invariant5.invariant)(!this._writer, "Writer already set.", {
|
|
1075
|
+
F: __dxlog_file7,
|
|
895
1076
|
L: 270,
|
|
896
1077
|
S: this,
|
|
897
1078
|
A: [
|
|
@@ -899,8 +1080,8 @@ var Pipeline = class {
|
|
|
899
1080
|
"'Writer already set.'"
|
|
900
1081
|
]
|
|
901
1082
|
});
|
|
902
|
-
(0,
|
|
903
|
-
F:
|
|
1083
|
+
(0, import_invariant5.invariant)(feed.properties.writable, "Feed must be writable.", {
|
|
1084
|
+
F: __dxlog_file7,
|
|
904
1085
|
L: 271,
|
|
905
1086
|
S: this,
|
|
906
1087
|
A: [
|
|
@@ -914,8 +1095,8 @@ var Pipeline = class {
|
|
|
914
1095
|
}), feed.createFeedWriter());
|
|
915
1096
|
}
|
|
916
1097
|
async start() {
|
|
917
|
-
(0,
|
|
918
|
-
F:
|
|
1098
|
+
(0, import_invariant5.invariant)(!this._isStarted, "Pipeline is already started.", {
|
|
1099
|
+
F: __dxlog_file7,
|
|
919
1100
|
L: 284,
|
|
920
1101
|
S: this,
|
|
921
1102
|
A: [
|
|
@@ -923,8 +1104,8 @@ var Pipeline = class {
|
|
|
923
1104
|
"'Pipeline is already started.'"
|
|
924
1105
|
]
|
|
925
1106
|
});
|
|
926
|
-
(0,
|
|
927
|
-
F:
|
|
1107
|
+
(0, import_log5.log)("starting...", void 0, {
|
|
1108
|
+
F: __dxlog_file7,
|
|
928
1109
|
L: 285,
|
|
929
1110
|
S: this,
|
|
930
1111
|
C: (f, a) => f(...a)
|
|
@@ -932,8 +1113,8 @@ var Pipeline = class {
|
|
|
932
1113
|
await this._initIterator();
|
|
933
1114
|
await this._feedSetIterator.open();
|
|
934
1115
|
this._isStarted = true;
|
|
935
|
-
(0,
|
|
936
|
-
F:
|
|
1116
|
+
(0, import_log5.log)("started", void 0, {
|
|
1117
|
+
F: __dxlog_file7,
|
|
937
1118
|
L: 289,
|
|
938
1119
|
S: this,
|
|
939
1120
|
C: (f, a) => f(...a)
|
|
@@ -945,8 +1126,8 @@ var Pipeline = class {
|
|
|
945
1126
|
}
|
|
946
1127
|
}
|
|
947
1128
|
async stop() {
|
|
948
|
-
(0,
|
|
949
|
-
F:
|
|
1129
|
+
(0, import_log5.log)("stopping...", void 0, {
|
|
1130
|
+
F: __dxlog_file7,
|
|
950
1131
|
L: 300,
|
|
951
1132
|
S: this,
|
|
952
1133
|
C: (f, a) => f(...a)
|
|
@@ -959,15 +1140,15 @@ var Pipeline = class {
|
|
|
959
1140
|
await this._feedSetIterator?.close();
|
|
960
1141
|
await this._processingTrigger.wait();
|
|
961
1142
|
await this._state._ctx.dispose();
|
|
962
|
-
this._state._ctx = new
|
|
963
|
-
F:
|
|
1143
|
+
this._state._ctx = new import_context4.Context(void 0, {
|
|
1144
|
+
F: __dxlog_file7,
|
|
964
1145
|
L: 309
|
|
965
1146
|
});
|
|
966
1147
|
this._state._reachedTargetPromise = void 0;
|
|
967
1148
|
this._state._reachedTarget = false;
|
|
968
1149
|
this._isStarted = false;
|
|
969
|
-
(0,
|
|
970
|
-
F:
|
|
1150
|
+
(0, import_log5.log)("stopped", void 0, {
|
|
1151
|
+
F: __dxlog_file7,
|
|
971
1152
|
L: 313,
|
|
972
1153
|
S: this,
|
|
973
1154
|
C: (f, a) => f(...a)
|
|
@@ -978,8 +1159,8 @@ var Pipeline = class {
|
|
|
978
1159
|
* The pipeline will start processing messages AFTER this timeframe.
|
|
979
1160
|
*/
|
|
980
1161
|
async setCursor(timeframe) {
|
|
981
|
-
(0,
|
|
982
|
-
F:
|
|
1162
|
+
(0, import_invariant5.invariant)(!this._isStarted || this._isPaused, "Invalid state.", {
|
|
1163
|
+
F: __dxlog_file7,
|
|
983
1164
|
L: 322,
|
|
984
1165
|
S: this,
|
|
985
1166
|
A: [
|
|
@@ -1007,8 +1188,8 @@ var Pipeline = class {
|
|
|
1007
1188
|
this._isPaused = true;
|
|
1008
1189
|
}
|
|
1009
1190
|
async unpause() {
|
|
1010
|
-
(0,
|
|
1011
|
-
F:
|
|
1191
|
+
(0, import_invariant5.invariant)(this._isPaused, "Pipeline is not paused.", {
|
|
1192
|
+
F: __dxlog_file7,
|
|
1012
1193
|
L: 351,
|
|
1013
1194
|
S: this,
|
|
1014
1195
|
A: [
|
|
@@ -1027,8 +1208,8 @@ var Pipeline = class {
|
|
|
1027
1208
|
* Updates the timeframe clock after the message has bee processed.
|
|
1028
1209
|
*/
|
|
1029
1210
|
async *consume() {
|
|
1030
|
-
(0,
|
|
1031
|
-
F:
|
|
1211
|
+
(0, import_invariant5.invariant)(!this._isBeingConsumed, "Pipeline is already being consumed.", {
|
|
1212
|
+
F: __dxlog_file7,
|
|
1032
1213
|
L: 366,
|
|
1033
1214
|
S: this,
|
|
1034
1215
|
A: [
|
|
@@ -1037,8 +1218,8 @@ var Pipeline = class {
|
|
|
1037
1218
|
]
|
|
1038
1219
|
});
|
|
1039
1220
|
this._isBeingConsumed = true;
|
|
1040
|
-
(0,
|
|
1041
|
-
F:
|
|
1221
|
+
(0, import_invariant5.invariant)(this._feedSetIterator, "Iterator not initialized.", {
|
|
1222
|
+
F: __dxlog_file7,
|
|
1042
1223
|
L: 369,
|
|
1043
1224
|
S: this,
|
|
1044
1225
|
A: [
|
|
@@ -1051,8 +1232,8 @@ var Pipeline = class {
|
|
|
1051
1232
|
while (!this._isStopping) {
|
|
1052
1233
|
await this._pauseTrigger.wait();
|
|
1053
1234
|
if (lastFeedSetIterator !== this._feedSetIterator) {
|
|
1054
|
-
(0,
|
|
1055
|
-
F:
|
|
1235
|
+
(0, import_invariant5.invariant)(this._feedSetIterator, "Iterator not initialized.", {
|
|
1236
|
+
F: __dxlog_file7,
|
|
1056
1237
|
L: 378,
|
|
1057
1238
|
S: this,
|
|
1058
1239
|
A: [
|
|
@@ -1082,12 +1263,12 @@ var Pipeline = class {
|
|
|
1082
1263
|
}
|
|
1083
1264
|
const timeframe = this._state._startTimeframe;
|
|
1084
1265
|
const seq = timeframe.get(feed.key) ?? -1;
|
|
1085
|
-
(0,
|
|
1266
|
+
(0, import_log5.log)("download", {
|
|
1086
1267
|
feed: feed.key.truncate(),
|
|
1087
1268
|
seq,
|
|
1088
1269
|
length: feed.length
|
|
1089
1270
|
}, {
|
|
1090
|
-
F:
|
|
1271
|
+
F: __dxlog_file7,
|
|
1091
1272
|
L: 407,
|
|
1092
1273
|
S: this,
|
|
1093
1274
|
C: (f, a) => f(...a)
|
|
@@ -1098,10 +1279,10 @@ var Pipeline = class {
|
|
|
1098
1279
|
}, (err, data) => {
|
|
1099
1280
|
if (err) {
|
|
1100
1281
|
} else {
|
|
1101
|
-
|
|
1282
|
+
import_log5.log.info("downloaded", {
|
|
1102
1283
|
data
|
|
1103
1284
|
}, {
|
|
1104
|
-
F:
|
|
1285
|
+
F: __dxlog_file7,
|
|
1105
1286
|
L: 412,
|
|
1106
1287
|
S: this,
|
|
1107
1288
|
C: (f, a) => f(...a)
|
|
@@ -1116,8 +1297,8 @@ var Pipeline = class {
|
|
|
1116
1297
|
stallTimeout: 1e3
|
|
1117
1298
|
});
|
|
1118
1299
|
this._feedSetIterator.stalled.on((iterator) => {
|
|
1119
|
-
|
|
1120
|
-
F:
|
|
1300
|
+
import_log5.log.warn(`Stalled after ${iterator.options.stallTimeout}ms with ${iterator.size} feeds.`, void 0, {
|
|
1301
|
+
F: __dxlog_file7,
|
|
1121
1302
|
L: 426,
|
|
1122
1303
|
S: this,
|
|
1123
1304
|
C: (f, a) => f(...a)
|
|
@@ -1130,21 +1311,21 @@ var Pipeline = class {
|
|
|
1130
1311
|
}
|
|
1131
1312
|
};
|
|
1132
1313
|
_ts_decorate3([
|
|
1133
|
-
|
|
1314
|
+
import_async4.synchronized
|
|
1134
1315
|
], Pipeline.prototype, "start", null);
|
|
1135
1316
|
_ts_decorate3([
|
|
1136
|
-
|
|
1317
|
+
import_async4.synchronized
|
|
1137
1318
|
], Pipeline.prototype, "stop", null);
|
|
1138
1319
|
_ts_decorate3([
|
|
1139
|
-
|
|
1320
|
+
import_async4.synchronized
|
|
1140
1321
|
], Pipeline.prototype, "setCursor", null);
|
|
1141
1322
|
_ts_decorate3([
|
|
1142
|
-
|
|
1323
|
+
import_async4.synchronized
|
|
1143
1324
|
], Pipeline.prototype, "pause", null);
|
|
1144
1325
|
_ts_decorate3([
|
|
1145
|
-
|
|
1326
|
+
import_async4.synchronized
|
|
1146
1327
|
], Pipeline.prototype, "unpause", null);
|
|
1147
|
-
var
|
|
1328
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
1148
1329
|
var AuthExtension = class extends import_teleport.RpcExtension {
|
|
1149
1330
|
constructor(_authParams) {
|
|
1150
1331
|
super({
|
|
@@ -1157,17 +1338,17 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
1157
1338
|
timeout: 60 * 1e3
|
|
1158
1339
|
});
|
|
1159
1340
|
this._authParams = _authParams;
|
|
1160
|
-
this._ctx = new
|
|
1341
|
+
this._ctx = new import_context5.Context({
|
|
1161
1342
|
onError: (err) => {
|
|
1162
|
-
|
|
1163
|
-
F:
|
|
1343
|
+
import_log7.log.catch(err, void 0, {
|
|
1344
|
+
F: __dxlog_file8,
|
|
1164
1345
|
L: 28,
|
|
1165
1346
|
S: this,
|
|
1166
1347
|
C: (f, a) => f(...a)
|
|
1167
1348
|
});
|
|
1168
1349
|
}
|
|
1169
1350
|
}, {
|
|
1170
|
-
F:
|
|
1351
|
+
F: __dxlog_file8,
|
|
1171
1352
|
L: 26
|
|
1172
1353
|
});
|
|
1173
1354
|
}
|
|
@@ -1184,8 +1365,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
1184
1365
|
credential
|
|
1185
1366
|
};
|
|
1186
1367
|
} catch (err) {
|
|
1187
|
-
|
|
1188
|
-
F:
|
|
1368
|
+
import_log7.log.error("failed to generate auth credentials", err, {
|
|
1369
|
+
F: __dxlog_file8,
|
|
1189
1370
|
L: 55,
|
|
1190
1371
|
S: this,
|
|
1191
1372
|
C: (f, a) => f(...a)
|
|
@@ -1198,14 +1379,14 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
1198
1379
|
}
|
|
1199
1380
|
async onOpen(context) {
|
|
1200
1381
|
await super.onOpen(context);
|
|
1201
|
-
(0,
|
|
1382
|
+
(0, import_async5.scheduleTask)(this._ctx, async () => {
|
|
1202
1383
|
try {
|
|
1203
1384
|
const challenge = (0, import_crypto2.randomBytes)(32);
|
|
1204
1385
|
const { credential } = await this.rpc.AuthService.authenticate({
|
|
1205
1386
|
challenge
|
|
1206
1387
|
});
|
|
1207
|
-
(0,
|
|
1208
|
-
F:
|
|
1388
|
+
(0, import_invariant7.invariant)(credential?.length > 0, "invalid credential", {
|
|
1389
|
+
F: __dxlog_file8,
|
|
1209
1390
|
L: 69,
|
|
1210
1391
|
S: this,
|
|
1211
1392
|
A: [
|
|
@@ -1214,8 +1395,8 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
1214
1395
|
]
|
|
1215
1396
|
});
|
|
1216
1397
|
const success = await this._authParams.verifier(challenge, credential);
|
|
1217
|
-
(0,
|
|
1218
|
-
F:
|
|
1398
|
+
(0, import_invariant7.invariant)(success, "credential not verified", {
|
|
1399
|
+
F: __dxlog_file8,
|
|
1219
1400
|
L: 71,
|
|
1220
1401
|
S: this,
|
|
1221
1402
|
A: [
|
|
@@ -1223,10 +1404,10 @@ var AuthExtension = class extends import_teleport.RpcExtension {
|
|
|
1223
1404
|
"'credential not verified'"
|
|
1224
1405
|
]
|
|
1225
1406
|
});
|
|
1226
|
-
(0,
|
|
1407
|
+
(0, import_async5.runInContext)(this._ctx, () => this._authParams.onAuthSuccess());
|
|
1227
1408
|
} catch (err) {
|
|
1228
|
-
(0,
|
|
1229
|
-
F:
|
|
1409
|
+
(0, import_log7.log)("auth failed", err, {
|
|
1410
|
+
F: __dxlog_file8,
|
|
1230
1411
|
L: 74,
|
|
1231
1412
|
S: this,
|
|
1232
1413
|
C: (f, a) => f(...a)
|
|
@@ -1255,22 +1436,22 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
1255
1436
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1256
1437
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1257
1438
|
}
|
|
1258
|
-
var
|
|
1439
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/control-pipeline.ts";
|
|
1259
1440
|
var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 500;
|
|
1260
1441
|
var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
|
|
1261
1442
|
var USE_SNAPSHOTS = true;
|
|
1262
1443
|
var ControlPipeline = class {
|
|
1263
1444
|
constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
|
|
1264
|
-
this._ctx = new
|
|
1265
|
-
F:
|
|
1445
|
+
this._ctx = new import_context7.Context(void 0, {
|
|
1446
|
+
F: __dxlog_file9,
|
|
1266
1447
|
L: 47
|
|
1267
1448
|
});
|
|
1268
1449
|
this._lastTimeframeSaveTime = Date.now();
|
|
1269
1450
|
this.onFeedAdmitted = new import_util4.Callback();
|
|
1270
1451
|
this._usage = new import_tracing2.TimeUsageCounter();
|
|
1271
1452
|
this._mutations = new import_tracing2.TimeSeriesCounter();
|
|
1272
|
-
this._snapshotTask = new
|
|
1273
|
-
await (0,
|
|
1453
|
+
this._snapshotTask = new import_async7.DeferredTask(this._ctx, async () => {
|
|
1454
|
+
await (0, import_async7.sleepWithContext)(this._ctx, CONTROL_PIPELINE_SNAPSHOT_DELAY);
|
|
1274
1455
|
await this._saveSnapshot();
|
|
1275
1456
|
});
|
|
1276
1457
|
this._spaceKey = spaceKey;
|
|
@@ -1279,10 +1460,10 @@ var ControlPipeline = class {
|
|
|
1279
1460
|
void this._pipeline.addFeed(genesisFeed);
|
|
1280
1461
|
this._spaceStateMachine = new import_credentials2.SpaceStateMachine(spaceKey);
|
|
1281
1462
|
this._spaceStateMachine.onFeedAdmitted.set(async (info) => {
|
|
1282
|
-
(0,
|
|
1463
|
+
(0, import_log9.log)("feed admitted", {
|
|
1283
1464
|
key: info.key
|
|
1284
1465
|
}, {
|
|
1285
|
-
F:
|
|
1466
|
+
F: __dxlog_file9,
|
|
1286
1467
|
L: 82,
|
|
1287
1468
|
S: this,
|
|
1288
1469
|
C: (f, a) => f(...a)
|
|
@@ -1295,8 +1476,8 @@ var ControlPipeline = class {
|
|
|
1295
1476
|
await this._pipeline.addFeed(feed);
|
|
1296
1477
|
}
|
|
1297
1478
|
} catch (err) {
|
|
1298
|
-
|
|
1299
|
-
F:
|
|
1479
|
+
import_log9.log.catch(err, void 0, {
|
|
1480
|
+
F: __dxlog_file9,
|
|
1300
1481
|
L: 93,
|
|
1301
1482
|
S: this,
|
|
1302
1483
|
C: (f, a) => f(...a)
|
|
@@ -1323,12 +1504,12 @@ var ControlPipeline = class {
|
|
|
1323
1504
|
}
|
|
1324
1505
|
async start() {
|
|
1325
1506
|
const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
|
|
1326
|
-
(0,
|
|
1507
|
+
(0, import_log9.log)("load snapshot", {
|
|
1327
1508
|
key: this._spaceKey,
|
|
1328
1509
|
present: !!snapshot,
|
|
1329
1510
|
tf: snapshot?.timeframe
|
|
1330
1511
|
}, {
|
|
1331
|
-
F:
|
|
1512
|
+
F: __dxlog_file9,
|
|
1332
1513
|
L: 123,
|
|
1333
1514
|
S: this,
|
|
1334
1515
|
C: (f, a) => f(...a)
|
|
@@ -1336,21 +1517,21 @@ var ControlPipeline = class {
|
|
|
1336
1517
|
if (USE_SNAPSHOTS && snapshot) {
|
|
1337
1518
|
await this._processSnapshot(snapshot);
|
|
1338
1519
|
}
|
|
1339
|
-
(0,
|
|
1340
|
-
F:
|
|
1520
|
+
(0, import_log9.log)("starting...", void 0, {
|
|
1521
|
+
F: __dxlog_file9,
|
|
1341
1522
|
L: 128,
|
|
1342
1523
|
S: this,
|
|
1343
1524
|
C: (f, a) => f(...a)
|
|
1344
1525
|
});
|
|
1345
1526
|
setTimeout(async () => {
|
|
1346
|
-
void this._consumePipeline(new
|
|
1347
|
-
F:
|
|
1527
|
+
void this._consumePipeline(new import_context7.Context(void 0, {
|
|
1528
|
+
F: __dxlog_file9,
|
|
1348
1529
|
L: 130
|
|
1349
1530
|
}));
|
|
1350
1531
|
});
|
|
1351
1532
|
await this._pipeline.start();
|
|
1352
|
-
(0,
|
|
1353
|
-
F:
|
|
1533
|
+
(0, import_log9.log)("started", void 0, {
|
|
1534
|
+
F: __dxlog_file9,
|
|
1354
1535
|
L: 134,
|
|
1355
1536
|
S: this,
|
|
1356
1537
|
C: (f, a) => f(...a)
|
|
@@ -1364,10 +1545,10 @@ var ControlPipeline = class {
|
|
|
1364
1545
|
skipVerification: true
|
|
1365
1546
|
});
|
|
1366
1547
|
if (!result) {
|
|
1367
|
-
|
|
1548
|
+
import_log9.log.warn("credential processing failed from snapshot", {
|
|
1368
1549
|
message
|
|
1369
1550
|
}, {
|
|
1370
|
-
F:
|
|
1551
|
+
F: __dxlog_file9,
|
|
1371
1552
|
L: 147,
|
|
1372
1553
|
S: this,
|
|
1373
1554
|
C: (f, a) => f(...a)
|
|
@@ -1385,11 +1566,11 @@ var ControlPipeline = class {
|
|
|
1385
1566
|
}))
|
|
1386
1567
|
};
|
|
1387
1568
|
await this._pipeline.unpause();
|
|
1388
|
-
(0,
|
|
1569
|
+
(0, import_log9.log)("save snapshot", {
|
|
1389
1570
|
key: this._spaceKey,
|
|
1390
1571
|
snapshot
|
|
1391
1572
|
}, {
|
|
1392
|
-
F:
|
|
1573
|
+
F: __dxlog_file9,
|
|
1393
1574
|
L: 163,
|
|
1394
1575
|
S: this,
|
|
1395
1576
|
C: (f, a) => f(...a)
|
|
@@ -1403,8 +1584,8 @@ var ControlPipeline = class {
|
|
|
1403
1584
|
try {
|
|
1404
1585
|
await this._processMessage(ctx, msg);
|
|
1405
1586
|
} catch (err) {
|
|
1406
|
-
|
|
1407
|
-
F:
|
|
1587
|
+
import_log9.log.catch(err, void 0, {
|
|
1588
|
+
F: __dxlog_file9,
|
|
1408
1589
|
L: 176,
|
|
1409
1590
|
S: this,
|
|
1410
1591
|
C: (f, a) => f(...a)
|
|
@@ -1414,11 +1595,11 @@ var ControlPipeline = class {
|
|
|
1414
1595
|
}
|
|
1415
1596
|
}
|
|
1416
1597
|
async _processMessage(ctx, msg) {
|
|
1417
|
-
(0,
|
|
1598
|
+
(0, import_log9.log)("processing", {
|
|
1418
1599
|
key: msg.feedKey,
|
|
1419
1600
|
seq: msg.seq
|
|
1420
1601
|
}, {
|
|
1421
|
-
F:
|
|
1602
|
+
F: __dxlog_file9,
|
|
1422
1603
|
L: 186,
|
|
1423
1604
|
S: this,
|
|
1424
1605
|
C: (f, a) => f(...a)
|
|
@@ -1430,10 +1611,10 @@ var ControlPipeline = class {
|
|
|
1430
1611
|
});
|
|
1431
1612
|
timer.end();
|
|
1432
1613
|
if (!result) {
|
|
1433
|
-
|
|
1614
|
+
import_log9.log.warn("processing failed", {
|
|
1434
1615
|
msg
|
|
1435
1616
|
}, {
|
|
1436
|
-
F:
|
|
1617
|
+
F: __dxlog_file9,
|
|
1437
1618
|
L: 195,
|
|
1438
1619
|
S: this,
|
|
1439
1620
|
C: (f, a) => f(...a)
|
|
@@ -1451,8 +1632,8 @@ var ControlPipeline = class {
|
|
|
1451
1632
|
}
|
|
1452
1633
|
}
|
|
1453
1634
|
async stop() {
|
|
1454
|
-
(0,
|
|
1455
|
-
F:
|
|
1635
|
+
(0, import_log9.log)("stopping...", void 0, {
|
|
1636
|
+
F: __dxlog_file9,
|
|
1456
1637
|
L: 215,
|
|
1457
1638
|
S: this,
|
|
1458
1639
|
C: (f, a) => f(...a)
|
|
@@ -1460,8 +1641,8 @@ var ControlPipeline = class {
|
|
|
1460
1641
|
await this._ctx.dispose();
|
|
1461
1642
|
await this._pipeline.stop();
|
|
1462
1643
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1463
|
-
(0,
|
|
1464
|
-
F:
|
|
1644
|
+
(0, import_log9.log)("stopped", void 0, {
|
|
1645
|
+
F: __dxlog_file9,
|
|
1465
1646
|
L: 219,
|
|
1466
1647
|
S: this,
|
|
1467
1648
|
C: (f, a) => f(...a)
|
|
@@ -1473,8 +1654,8 @@ var ControlPipeline = class {
|
|
|
1473
1654
|
await this._metadata.setSpaceControlLatestTimeframe(this._spaceKey, newTimeframe);
|
|
1474
1655
|
this._targetTimeframe = newTimeframe;
|
|
1475
1656
|
} catch (err) {
|
|
1476
|
-
(0,
|
|
1477
|
-
F:
|
|
1657
|
+
(0, import_log9.log)(err, void 0, {
|
|
1658
|
+
F: __dxlog_file9,
|
|
1478
1659
|
L: 228,
|
|
1479
1660
|
S: this,
|
|
1480
1661
|
C: (f, a) => f(...a)
|
|
@@ -1501,7 +1682,7 @@ _ts_decorate4([
|
|
|
1501
1682
|
], ControlPipeline.prototype, "_processMessage", null);
|
|
1502
1683
|
ControlPipeline = _ts_decorate4([
|
|
1503
1684
|
import_tracing2.trace.resource(),
|
|
1504
|
-
(0,
|
|
1685
|
+
(0, import_async7.trackLeaks)("start", "stop")
|
|
1505
1686
|
], ControlPipeline);
|
|
1506
1687
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1507
1688
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1513,15 +1694,15 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1513
1694
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1514
1695
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1515
1696
|
}
|
|
1516
|
-
var
|
|
1517
|
-
var Space = class extends
|
|
1697
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space.ts";
|
|
1698
|
+
var Space = class extends import_context6.Resource {
|
|
1518
1699
|
constructor(params) {
|
|
1519
1700
|
super();
|
|
1520
|
-
this._addFeedMutex = new
|
|
1701
|
+
this._addFeedMutex = new import_async6.Mutex();
|
|
1521
1702
|
this.onCredentialProcessed = new import_util3.Callback();
|
|
1522
|
-
this.stateUpdate = new
|
|
1523
|
-
(0,
|
|
1524
|
-
F:
|
|
1703
|
+
this.stateUpdate = new import_async6.Event();
|
|
1704
|
+
(0, import_invariant8.invariant)(params.spaceKey && params.feedProvider, void 0, {
|
|
1705
|
+
F: __dxlog_file10,
|
|
1525
1706
|
L: 78,
|
|
1526
1707
|
S: this,
|
|
1527
1708
|
A: [
|
|
@@ -1552,10 +1733,10 @@ var Space = class extends import_context5.Resource {
|
|
|
1552
1733
|
});
|
|
1553
1734
|
this._controlPipeline.onCredentialProcessed.set(async (credential) => {
|
|
1554
1735
|
await this.onCredentialProcessed.callIfSet(credential);
|
|
1555
|
-
(0,
|
|
1736
|
+
(0, import_log8.log)("onCredentialProcessed", {
|
|
1556
1737
|
credential
|
|
1557
1738
|
}, {
|
|
1558
|
-
F:
|
|
1739
|
+
F: __dxlog_file10,
|
|
1559
1740
|
L: 106,
|
|
1560
1741
|
S: this,
|
|
1561
1742
|
C: (f, a) => f(...a)
|
|
@@ -1563,10 +1744,10 @@ var Space = class extends import_context5.Resource {
|
|
|
1563
1744
|
this.stateUpdate.emit();
|
|
1564
1745
|
});
|
|
1565
1746
|
this._controlPipeline.onDelegatedInvitation.set(async (invitation) => {
|
|
1566
|
-
(0,
|
|
1747
|
+
(0, import_log8.log)("onDelegatedInvitation", {
|
|
1567
1748
|
invitation
|
|
1568
1749
|
}, {
|
|
1569
|
-
F:
|
|
1750
|
+
F: __dxlog_file10,
|
|
1570
1751
|
L: 110,
|
|
1571
1752
|
S: this,
|
|
1572
1753
|
C: (f, a) => f(...a)
|
|
@@ -1574,10 +1755,10 @@ var Space = class extends import_context5.Resource {
|
|
|
1574
1755
|
await params.onDelegatedInvitationStatusChange(invitation, true);
|
|
1575
1756
|
});
|
|
1576
1757
|
this._controlPipeline.onDelegatedInvitationRemoved.set(async (invitation) => {
|
|
1577
|
-
(0,
|
|
1758
|
+
(0, import_log8.log)("onDelegatedInvitationRemoved", {
|
|
1578
1759
|
invitation
|
|
1579
1760
|
}, {
|
|
1580
|
-
F:
|
|
1761
|
+
F: __dxlog_file10,
|
|
1581
1762
|
L: 114,
|
|
1582
1763
|
S: this,
|
|
1583
1764
|
C: (f, a) => f(...a)
|
|
@@ -1585,13 +1766,13 @@ var Space = class extends import_context5.Resource {
|
|
|
1585
1766
|
await params.onDelegatedInvitationStatusChange(invitation, false);
|
|
1586
1767
|
});
|
|
1587
1768
|
this._controlPipeline.onMemberRoleChanged.set(async (changedMembers) => {
|
|
1588
|
-
(0,
|
|
1769
|
+
(0, import_log8.log)("onMemberRoleChanged", () => ({
|
|
1589
1770
|
changedMembers: changedMembers.map((m) => [
|
|
1590
1771
|
m.key,
|
|
1591
1772
|
m.role
|
|
1592
1773
|
])
|
|
1593
1774
|
}), {
|
|
1594
|
-
F:
|
|
1775
|
+
F: __dxlog_file10,
|
|
1595
1776
|
L: 118,
|
|
1596
1777
|
S: this,
|
|
1597
1778
|
C: (f, a) => f(...a)
|
|
@@ -1608,7 +1789,7 @@ var Space = class extends import_context5.Resource {
|
|
|
1608
1789
|
return this._key;
|
|
1609
1790
|
}
|
|
1610
1791
|
get isOpen() {
|
|
1611
|
-
return this._lifecycleState ===
|
|
1792
|
+
return this._lifecycleState === import_context6.LifecycleState.OPEN;
|
|
1612
1793
|
}
|
|
1613
1794
|
get genesisFeedKey() {
|
|
1614
1795
|
return this._genesisFeedKey;
|
|
@@ -1632,8 +1813,8 @@ var Space = class extends import_context5.Resource {
|
|
|
1632
1813
|
return this._snapshotManager;
|
|
1633
1814
|
}
|
|
1634
1815
|
async setControlFeed(feed) {
|
|
1635
|
-
(0,
|
|
1636
|
-
F:
|
|
1816
|
+
(0, import_invariant8.invariant)(!this._controlFeed, "Control feed already set.", {
|
|
1817
|
+
F: __dxlog_file10,
|
|
1637
1818
|
L: 171,
|
|
1638
1819
|
S: this,
|
|
1639
1820
|
A: [
|
|
@@ -1646,8 +1827,8 @@ var Space = class extends import_context5.Resource {
|
|
|
1646
1827
|
return this;
|
|
1647
1828
|
}
|
|
1648
1829
|
async setDataFeed(feed) {
|
|
1649
|
-
(0,
|
|
1650
|
-
F:
|
|
1830
|
+
(0, import_invariant8.invariant)(!this._dataFeed, "Data feed already set.", {
|
|
1831
|
+
F: __dxlog_file10,
|
|
1651
1832
|
L: 178,
|
|
1652
1833
|
S: this,
|
|
1653
1834
|
A: [
|
|
@@ -1665,34 +1846,34 @@ var Space = class extends import_context5.Resource {
|
|
|
1665
1846
|
return Array.from(this._controlPipeline.spaceState.feeds.values());
|
|
1666
1847
|
}
|
|
1667
1848
|
async _open(ctx) {
|
|
1668
|
-
(0,
|
|
1669
|
-
F:
|
|
1849
|
+
(0, import_log8.log)("opening...", void 0, {
|
|
1850
|
+
F: __dxlog_file10,
|
|
1670
1851
|
L: 192,
|
|
1671
1852
|
S: this,
|
|
1672
1853
|
C: (f, a) => f(...a)
|
|
1673
1854
|
});
|
|
1674
1855
|
await this._controlPipeline.start();
|
|
1675
1856
|
await this.protocol.start();
|
|
1676
|
-
(0,
|
|
1677
|
-
F:
|
|
1857
|
+
(0, import_log8.log)("opened", void 0, {
|
|
1858
|
+
F: __dxlog_file10,
|
|
1678
1859
|
L: 198,
|
|
1679
1860
|
S: this,
|
|
1680
1861
|
C: (f, a) => f(...a)
|
|
1681
1862
|
});
|
|
1682
1863
|
}
|
|
1683
1864
|
async _close() {
|
|
1684
|
-
(0,
|
|
1865
|
+
(0, import_log8.log)("closing...", {
|
|
1685
1866
|
key: this._key
|
|
1686
1867
|
}, {
|
|
1687
|
-
F:
|
|
1868
|
+
F: __dxlog_file10,
|
|
1688
1869
|
L: 203,
|
|
1689
1870
|
S: this,
|
|
1690
1871
|
C: (f, a) => f(...a)
|
|
1691
1872
|
});
|
|
1692
1873
|
await this.protocol.stop();
|
|
1693
1874
|
await this._controlPipeline.stop();
|
|
1694
|
-
(0,
|
|
1695
|
-
F:
|
|
1875
|
+
(0, import_log8.log)("closed", void 0, {
|
|
1876
|
+
F: __dxlog_file10,
|
|
1696
1877
|
L: 209,
|
|
1697
1878
|
S: this,
|
|
1698
1879
|
C: (f, a) => f(...a)
|
|
@@ -1706,21 +1887,21 @@ _ts_decorate5([
|
|
|
1706
1887
|
import_tracing.trace.info()
|
|
1707
1888
|
], Space.prototype, "_controlPipeline", void 0);
|
|
1708
1889
|
_ts_decorate5([
|
|
1709
|
-
|
|
1890
|
+
import_log8.logInfo,
|
|
1710
1891
|
import_tracing.trace.info()
|
|
1711
1892
|
], Space.prototype, "id", null);
|
|
1712
1893
|
_ts_decorate5([
|
|
1713
|
-
|
|
1894
|
+
import_log8.logInfo,
|
|
1714
1895
|
import_tracing.trace.info()
|
|
1715
1896
|
], Space.prototype, "key", null);
|
|
1716
1897
|
_ts_decorate5([
|
|
1717
1898
|
import_tracing.trace.span()
|
|
1718
1899
|
], Space.prototype, "_open", null);
|
|
1719
1900
|
_ts_decorate5([
|
|
1720
|
-
|
|
1901
|
+
import_async6.synchronized
|
|
1721
1902
|
], Space.prototype, "_close", null);
|
|
1722
1903
|
Space = _ts_decorate5([
|
|
1723
|
-
(0,
|
|
1904
|
+
(0, import_async6.trackLeaks)("open", "close"),
|
|
1724
1905
|
import_tracing.trace.resource()
|
|
1725
1906
|
], Space);
|
|
1726
1907
|
var SPACE_IDS_CACHE = new import_util3.ComplexMap(import_keys4.PublicKey.hash);
|
|
@@ -1735,7 +1916,7 @@ var createIdFromSpaceKey = async (spaceKey) => {
|
|
|
1735
1916
|
SPACE_IDS_CACHE.set(spaceKey, spaceId);
|
|
1736
1917
|
return spaceId;
|
|
1737
1918
|
};
|
|
1738
|
-
var
|
|
1919
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/admission-discovery-extension.ts";
|
|
1739
1920
|
var CredentialRetrieverExtension = class extends import_teleport2.RpcExtension {
|
|
1740
1921
|
constructor(_request, _onResult) {
|
|
1741
1922
|
super({
|
|
@@ -1745,8 +1926,8 @@ var CredentialRetrieverExtension = class extends import_teleport2.RpcExtension {
|
|
|
1745
1926
|
});
|
|
1746
1927
|
this._request = _request;
|
|
1747
1928
|
this._onResult = _onResult;
|
|
1748
|
-
this._ctx = new
|
|
1749
|
-
F:
|
|
1929
|
+
this._ctx = new import_context8.Context(void 0, {
|
|
1930
|
+
F: __dxlog_file11,
|
|
1750
1931
|
L: 25
|
|
1751
1932
|
});
|
|
1752
1933
|
}
|
|
@@ -1755,7 +1936,7 @@ var CredentialRetrieverExtension = class extends import_teleport2.RpcExtension {
|
|
|
1755
1936
|
}
|
|
1756
1937
|
async onOpen(context) {
|
|
1757
1938
|
await super.onOpen(context);
|
|
1758
|
-
(0,
|
|
1939
|
+
(0, import_async8.scheduleTask)(this._ctx, async () => {
|
|
1759
1940
|
try {
|
|
1760
1941
|
const result = await this.rpc.AdmissionDiscoveryService.getAdmissionCredential(this._request);
|
|
1761
1942
|
this._onResult.wake(result.admissionCredential);
|
|
@@ -1806,7 +1987,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1806
1987
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1807
1988
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1808
1989
|
}
|
|
1809
|
-
var
|
|
1990
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-protocol.ts";
|
|
1810
1991
|
var MOCK_AUTH_PROVIDER = async (nonce) => Buffer.from("mock");
|
|
1811
1992
|
var MOCK_AUTH_VERIFIER = async (nonce, credential) => true;
|
|
1812
1993
|
var SpaceProtocol = class {
|
|
@@ -1839,10 +2020,10 @@ var SpaceProtocol = class {
|
|
|
1839
2020
|
}
|
|
1840
2021
|
// TODO(burdon): Create abstraction for Space (e.g., add keys and have provider).
|
|
1841
2022
|
addFeed(feed) {
|
|
1842
|
-
(0,
|
|
2023
|
+
(0, import_log10.log)("addFeed", {
|
|
1843
2024
|
key: feed.key
|
|
1844
2025
|
}, {
|
|
1845
|
-
F:
|
|
2026
|
+
F: __dxlog_file12,
|
|
1846
2027
|
L: 109,
|
|
1847
2028
|
S: this,
|
|
1848
2029
|
C: (f, a) => f(...a)
|
|
@@ -1859,8 +2040,8 @@ var SpaceProtocol = class {
|
|
|
1859
2040
|
}
|
|
1860
2041
|
const credentials = await this._swarmIdentity.credentialProvider(Buffer.from(""));
|
|
1861
2042
|
await this.blobSync.open();
|
|
1862
|
-
(0,
|
|
1863
|
-
F:
|
|
2043
|
+
(0, import_log10.log)("starting...", void 0, {
|
|
2044
|
+
F: __dxlog_file12,
|
|
1864
2045
|
L: 128,
|
|
1865
2046
|
S: this,
|
|
1866
2047
|
C: (f, a) => f(...a)
|
|
@@ -1873,8 +2054,8 @@ var SpaceProtocol = class {
|
|
|
1873
2054
|
topology: this._topology,
|
|
1874
2055
|
label: `swarm ${topic.truncate()} for space ${this._spaceKey.truncate()}`
|
|
1875
2056
|
});
|
|
1876
|
-
(0,
|
|
1877
|
-
F:
|
|
2057
|
+
(0, import_log10.log)("started", void 0, {
|
|
2058
|
+
F: __dxlog_file12,
|
|
1878
2059
|
L: 138,
|
|
1879
2060
|
S: this,
|
|
1880
2061
|
C: (f, a) => f(...a)
|
|
@@ -1886,15 +2067,15 @@ var SpaceProtocol = class {
|
|
|
1886
2067
|
async stop() {
|
|
1887
2068
|
await this.blobSync.close();
|
|
1888
2069
|
if (this._connection) {
|
|
1889
|
-
(0,
|
|
1890
|
-
F:
|
|
2070
|
+
(0, import_log10.log)("stopping...", void 0, {
|
|
2071
|
+
F: __dxlog_file12,
|
|
1891
2072
|
L: 149,
|
|
1892
2073
|
S: this,
|
|
1893
2074
|
C: (f, a) => f(...a)
|
|
1894
2075
|
});
|
|
1895
2076
|
await this._connection.close();
|
|
1896
|
-
(0,
|
|
1897
|
-
F:
|
|
2077
|
+
(0, import_log10.log)("stopped", void 0, {
|
|
2078
|
+
F: __dxlog_file12,
|
|
1898
2079
|
L: 151,
|
|
1899
2080
|
S: this,
|
|
1900
2081
|
C: (f, a) => f(...a)
|
|
@@ -1919,14 +2100,14 @@ var SpaceProtocol = class {
|
|
|
1919
2100
|
}
|
|
1920
2101
|
};
|
|
1921
2102
|
_ts_decorate6([
|
|
1922
|
-
|
|
2103
|
+
import_log10.logInfo,
|
|
1923
2104
|
import_tracing3.trace.info()
|
|
1924
2105
|
], SpaceProtocol.prototype, "_topic", void 0);
|
|
1925
2106
|
_ts_decorate6([
|
|
1926
2107
|
import_tracing3.trace.info()
|
|
1927
2108
|
], SpaceProtocol.prototype, "_spaceKey", void 0);
|
|
1928
2109
|
_ts_decorate6([
|
|
1929
|
-
|
|
2110
|
+
import_log10.logInfo
|
|
1930
2111
|
], SpaceProtocol.prototype, "_ownPeerKey", null);
|
|
1931
2112
|
SpaceProtocol = _ts_decorate6([
|
|
1932
2113
|
import_tracing3.trace.resource()
|
|
@@ -1966,8 +2147,8 @@ var SpaceProtocolSession = class {
|
|
|
1966
2147
|
provider: this._swarmIdentity.credentialProvider,
|
|
1967
2148
|
verifier: this._swarmIdentity.credentialAuthenticator,
|
|
1968
2149
|
onAuthSuccess: () => {
|
|
1969
|
-
(0,
|
|
1970
|
-
F:
|
|
2150
|
+
(0, import_log10.log)("Peer authenticated", void 0, {
|
|
2151
|
+
F: __dxlog_file12,
|
|
1971
2152
|
L: 248,
|
|
1972
2153
|
S: this,
|
|
1973
2154
|
C: (f, a) => f(...a)
|
|
@@ -1984,8 +2165,8 @@ var SpaceProtocolSession = class {
|
|
|
1984
2165
|
this._teleport.addExtension("dxos.mesh.teleport.blobsync", this._blobSync.createExtension());
|
|
1985
2166
|
}
|
|
1986
2167
|
async close() {
|
|
1987
|
-
(0,
|
|
1988
|
-
F:
|
|
2168
|
+
(0, import_log10.log)("close", void 0, {
|
|
2169
|
+
F: __dxlog_file12,
|
|
1989
2170
|
L: 264,
|
|
1990
2171
|
S: this,
|
|
1991
2172
|
C: (f, a) => f(...a)
|
|
@@ -1997,10 +2178,10 @@ var SpaceProtocolSession = class {
|
|
|
1997
2178
|
}
|
|
1998
2179
|
};
|
|
1999
2180
|
_ts_decorate6([
|
|
2000
|
-
|
|
2181
|
+
import_log10.logInfo
|
|
2001
2182
|
], SpaceProtocolSession.prototype, "_wireParams", void 0);
|
|
2002
2183
|
_ts_decorate6([
|
|
2003
|
-
|
|
2184
|
+
import_log10.logInfo
|
|
2004
2185
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
2005
2186
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
2006
2187
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2012,7 +2193,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
2012
2193
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2013
2194
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2014
2195
|
}
|
|
2015
|
-
var
|
|
2196
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/space/space-manager.ts";
|
|
2016
2197
|
var SpaceManager = class {
|
|
2017
2198
|
constructor({ feedStore, networkManager, metadataStore, snapshotStore, blobStore }) {
|
|
2018
2199
|
this._spaces = new import_util6.ComplexMap(import_keys7.PublicKey.hash);
|
|
@@ -2035,18 +2216,18 @@ var SpaceManager = class {
|
|
|
2035
2216
|
].map((space) => space.close()));
|
|
2036
2217
|
}
|
|
2037
2218
|
async constructSpace({ metadata, swarmIdentity, onAuthorizedConnection, onAuthFailure, onDelegatedInvitationStatusChange, onMemberRolesChanged, memberKey }) {
|
|
2038
|
-
|
|
2219
|
+
import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.begin({
|
|
2039
2220
|
id: this._instanceId
|
|
2040
2221
|
}), {
|
|
2041
|
-
F:
|
|
2222
|
+
F: __dxlog_file13,
|
|
2042
2223
|
L: 103,
|
|
2043
2224
|
S: this,
|
|
2044
2225
|
C: (f, a) => f(...a)
|
|
2045
2226
|
});
|
|
2046
|
-
(0,
|
|
2227
|
+
(0, import_log11.log)("constructing space...", {
|
|
2047
2228
|
spaceKey: metadata.genesisFeedKey
|
|
2048
2229
|
}, {
|
|
2049
|
-
F:
|
|
2230
|
+
F: __dxlog_file13,
|
|
2050
2231
|
L: 104,
|
|
2051
2232
|
S: this,
|
|
2052
2233
|
C: (f, a) => f(...a)
|
|
@@ -2076,10 +2257,10 @@ var SpaceManager = class {
|
|
|
2076
2257
|
onMemberRolesChanged
|
|
2077
2258
|
});
|
|
2078
2259
|
this._spaces.set(space.key, space);
|
|
2079
|
-
|
|
2260
|
+
import_log11.log.trace("dxos.echo.space-manager.construct-space", import_protocols7.trace.end({
|
|
2080
2261
|
id: this._instanceId
|
|
2081
2262
|
}), {
|
|
2082
|
-
F:
|
|
2263
|
+
F: __dxlog_file13,
|
|
2083
2264
|
L: 135,
|
|
2084
2265
|
S: this,
|
|
2085
2266
|
C: (f, a) => f(...a)
|
|
@@ -2088,23 +2269,23 @@ var SpaceManager = class {
|
|
|
2088
2269
|
}
|
|
2089
2270
|
async requestSpaceAdmissionCredential(params) {
|
|
2090
2271
|
const traceKey = "dxos.echo.space-manager.request-space-admission";
|
|
2091
|
-
|
|
2272
|
+
import_log11.log.trace(traceKey, import_protocols7.trace.begin({
|
|
2092
2273
|
id: this._instanceId
|
|
2093
2274
|
}), {
|
|
2094
|
-
F:
|
|
2275
|
+
F: __dxlog_file13,
|
|
2095
2276
|
L: 141,
|
|
2096
2277
|
S: this,
|
|
2097
2278
|
C: (f, a) => f(...a)
|
|
2098
2279
|
});
|
|
2099
|
-
(0,
|
|
2280
|
+
(0, import_log11.log)("requesting space admission credential...", {
|
|
2100
2281
|
spaceKey: params.spaceKey
|
|
2101
2282
|
}, {
|
|
2102
|
-
F:
|
|
2283
|
+
F: __dxlog_file13,
|
|
2103
2284
|
L: 142,
|
|
2104
2285
|
S: this,
|
|
2105
2286
|
C: (f, a) => f(...a)
|
|
2106
2287
|
});
|
|
2107
|
-
const onCredentialResolved = new
|
|
2288
|
+
const onCredentialResolved = new import_async9.Trigger();
|
|
2108
2289
|
const protocol = new SpaceProtocol({
|
|
2109
2290
|
topic: params.spaceKey,
|
|
2110
2291
|
swarmIdentity: params.swarmIdentity,
|
|
@@ -2123,21 +2304,21 @@ var SpaceManager = class {
|
|
|
2123
2304
|
const credential = await onCredentialResolved.wait({
|
|
2124
2305
|
timeout: params.timeout
|
|
2125
2306
|
});
|
|
2126
|
-
|
|
2307
|
+
import_log11.log.trace(traceKey, import_protocols7.trace.end({
|
|
2127
2308
|
id: this._instanceId
|
|
2128
2309
|
}), {
|
|
2129
|
-
F:
|
|
2310
|
+
F: __dxlog_file13,
|
|
2130
2311
|
L: 165,
|
|
2131
2312
|
S: this,
|
|
2132
2313
|
C: (f, a) => f(...a)
|
|
2133
2314
|
});
|
|
2134
2315
|
return credential;
|
|
2135
2316
|
} catch (err) {
|
|
2136
|
-
|
|
2317
|
+
import_log11.log.trace(traceKey, import_protocols7.trace.error({
|
|
2137
2318
|
id: this._instanceId,
|
|
2138
2319
|
error: err
|
|
2139
2320
|
}), {
|
|
2140
|
-
F:
|
|
2321
|
+
F: __dxlog_file13,
|
|
2141
2322
|
L: 168,
|
|
2142
2323
|
S: this,
|
|
2143
2324
|
C: (f, a) => f(...a)
|
|
@@ -2149,13 +2330,13 @@ var SpaceManager = class {
|
|
|
2149
2330
|
}
|
|
2150
2331
|
};
|
|
2151
2332
|
_ts_decorate7([
|
|
2152
|
-
|
|
2333
|
+
import_async9.synchronized
|
|
2153
2334
|
], SpaceManager.prototype, "open", null);
|
|
2154
2335
|
_ts_decorate7([
|
|
2155
|
-
|
|
2336
|
+
import_async9.synchronized
|
|
2156
2337
|
], SpaceManager.prototype, "close", null);
|
|
2157
2338
|
SpaceManager = _ts_decorate7([
|
|
2158
|
-
(0,
|
|
2339
|
+
(0, import_async9.trackLeaks)("open", "close")
|
|
2159
2340
|
], SpaceManager);
|
|
2160
2341
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2161
2342
|
0 && (module.exports = {
|
|
@@ -2164,6 +2345,7 @@ SpaceManager = _ts_decorate7([
|
|
|
2164
2345
|
CredentialRetrieverExtension,
|
|
2165
2346
|
CredentialServerExtension,
|
|
2166
2347
|
DataServiceImpl,
|
|
2348
|
+
DocumentsSynchronizer,
|
|
2167
2349
|
MOCK_AUTH_PROVIDER,
|
|
2168
2350
|
MOCK_AUTH_VERIFIER,
|
|
2169
2351
|
MetadataStore,
|
|
@@ -2184,4 +2366,4 @@ SpaceManager = _ts_decorate7([
|
|
|
2184
2366
|
startAfter,
|
|
2185
2367
|
valueEncoding
|
|
2186
2368
|
});
|
|
2187
|
-
//# sourceMappingURL=chunk-
|
|
2369
|
+
//# sourceMappingURL=chunk-RH6TDRML.cjs.map
|