@dxos/echo-pipeline 0.5.1-next.260c093 → 0.5.1-next.26de2f3
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/index.mjs +366 -127
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +356 -122
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts +4 -1
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +26 -0
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -0
- package/dist/types/src/automerge/echo-replicator.d.ts +43 -0
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -0
- package/dist/types/src/automerge/index.d.ts +1 -0
- package/dist/types/src/automerge/index.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.ts +3 -1
- package/src/automerge/automerge-host.ts +23 -4
- package/src/automerge/echo-network-adapter.ts +155 -0
- package/src/automerge/echo-replicator.ts +56 -0
- package/src/automerge/index.ts +1 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -60,34 +60,250 @@ var import_log = require("@dxos/log");
|
|
|
60
60
|
var import_protocols = require("@dxos/protocols");
|
|
61
61
|
var import_tracing = require("@dxos/tracing");
|
|
62
62
|
var import_util = require("@dxos/util");
|
|
63
|
-
var import_context2 = require("@dxos/context");
|
|
64
63
|
var import_async2 = require("@dxos/async");
|
|
65
64
|
var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
|
|
66
|
-
var
|
|
65
|
+
var import_context2 = require("@dxos/context");
|
|
67
66
|
var import_invariant2 = require("@dxos/invariant");
|
|
67
|
+
var import_log2 = require("@dxos/log");
|
|
68
|
+
var import_context3 = require("@dxos/context");
|
|
68
69
|
var import_async3 = require("@dxos/async");
|
|
69
70
|
var import_automerge_repo3 = require("@dxos/automerge/automerge-repo");
|
|
71
|
+
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
70
72
|
var import_invariant3 = require("@dxos/invariant");
|
|
71
|
-
var
|
|
73
|
+
var import_async4 = require("@dxos/async");
|
|
74
|
+
var import_automerge_repo4 = require("@dxos/automerge/automerge-repo");
|
|
75
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
76
|
+
var import_log3 = require("@dxos/log");
|
|
72
77
|
var import_teleport_extension_automerge_replicator = require("@dxos/teleport-extension-automerge-replicator");
|
|
73
78
|
var import_automerge_repo_storage_indexeddb = require("@dxos/automerge/automerge-repo-storage-indexeddb");
|
|
74
|
-
var
|
|
79
|
+
var import_log4 = require("@dxos/log");
|
|
75
80
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
76
81
|
var import_util2 = require("@dxos/util");
|
|
77
|
-
var
|
|
78
|
-
var
|
|
82
|
+
var import_async5 = require("@dxos/async");
|
|
83
|
+
var import_context4 = require("@dxos/context");
|
|
79
84
|
var import_debug = require("@dxos/debug");
|
|
80
|
-
var
|
|
81
|
-
var
|
|
85
|
+
var import_invariant5 = require("@dxos/invariant");
|
|
86
|
+
var import_log5 = require("@dxos/log");
|
|
82
87
|
var import_tracing2 = require("@dxos/tracing");
|
|
83
|
-
|
|
88
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
89
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
90
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
91
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
92
|
+
else
|
|
93
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
94
|
+
if (d = decorators[i])
|
|
95
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
96
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
97
|
+
}
|
|
98
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/echo-network-adapter.ts";
|
|
99
|
+
var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
this._replicators = /* @__PURE__ */ new Set();
|
|
103
|
+
this._connections = /* @__PURE__ */ new Map();
|
|
104
|
+
this._lifecycleState = import_context2.LifecycleState.CLOSED;
|
|
105
|
+
this._connected = new import_async2.Trigger();
|
|
106
|
+
}
|
|
107
|
+
connect(peerId, peerMetadata) {
|
|
108
|
+
this.peerId = peerId;
|
|
109
|
+
this.peerMetadata = peerMetadata;
|
|
110
|
+
this._connected.wake();
|
|
111
|
+
}
|
|
112
|
+
send(message) {
|
|
113
|
+
const connectionEntry = this._connections.get(message.targetId);
|
|
114
|
+
if (!connectionEntry) {
|
|
115
|
+
throw new Error("Connection not found.");
|
|
116
|
+
}
|
|
117
|
+
connectionEntry.writer.write(message).catch((err) => {
|
|
118
|
+
if (connectionEntry.isOpen) {
|
|
119
|
+
import_log2.log.catch(err, void 0, {
|
|
120
|
+
F: __dxlog_file,
|
|
121
|
+
L: 40,
|
|
122
|
+
S: this,
|
|
123
|
+
C: (f, a) => f(...a)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
disconnect() {
|
|
129
|
+
}
|
|
130
|
+
async open() {
|
|
131
|
+
(0, import_invariant2.invariant)(this._lifecycleState === import_context2.LifecycleState.CLOSED, void 0, {
|
|
132
|
+
F: __dxlog_file,
|
|
133
|
+
L: 51,
|
|
134
|
+
S: this,
|
|
135
|
+
A: [
|
|
136
|
+
"this._lifecycleState === LifecycleState.CLOSED",
|
|
137
|
+
""
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
this._lifecycleState = import_context2.LifecycleState.OPEN;
|
|
141
|
+
this.emit("ready", {
|
|
142
|
+
network: this
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async close() {
|
|
146
|
+
(0, import_invariant2.invariant)(this._lifecycleState === import_context2.LifecycleState.OPEN, void 0, {
|
|
147
|
+
F: __dxlog_file,
|
|
148
|
+
L: 61,
|
|
149
|
+
S: this,
|
|
150
|
+
A: [
|
|
151
|
+
"this._lifecycleState === LifecycleState.OPEN",
|
|
152
|
+
""
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
for (const replicator of this._replicators) {
|
|
156
|
+
await replicator.disconnect();
|
|
157
|
+
}
|
|
158
|
+
this._replicators.clear();
|
|
159
|
+
this._lifecycleState = import_context2.LifecycleState.CLOSED;
|
|
160
|
+
}
|
|
161
|
+
async whenConnected() {
|
|
162
|
+
await this._connected.wait({
|
|
163
|
+
timeout: 1e4
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
async addReplicator(replicator) {
|
|
167
|
+
(0, import_invariant2.invariant)(this.peerId, void 0, {
|
|
168
|
+
F: __dxlog_file,
|
|
169
|
+
L: 77,
|
|
170
|
+
S: this,
|
|
171
|
+
A: [
|
|
172
|
+
"this.peerId",
|
|
173
|
+
""
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
(0, import_invariant2.invariant)(!this._replicators.has(replicator), void 0, {
|
|
177
|
+
F: __dxlog_file,
|
|
178
|
+
L: 78,
|
|
179
|
+
S: this,
|
|
180
|
+
A: [
|
|
181
|
+
"!this._replicators.has(replicator)",
|
|
182
|
+
""
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
await replicator.connect({
|
|
186
|
+
peerId: this.peerId,
|
|
187
|
+
onConnectionOpen: this._onConnectionOpen.bind(this),
|
|
188
|
+
onConnectionClosed: this._onConnectionClosed.bind(this)
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
async removeReplicator(replicator) {
|
|
192
|
+
(0, import_invariant2.invariant)(this._replicators.has(replicator), void 0, {
|
|
193
|
+
F: __dxlog_file,
|
|
194
|
+
L: 89,
|
|
195
|
+
S: this,
|
|
196
|
+
A: [
|
|
197
|
+
"this._replicators.has(replicator)",
|
|
198
|
+
""
|
|
199
|
+
]
|
|
200
|
+
});
|
|
201
|
+
await replicator.disconnect();
|
|
202
|
+
}
|
|
203
|
+
async shouldAdvertize(peerId, params) {
|
|
204
|
+
const connection = this._connections.get(peerId);
|
|
205
|
+
if (!connection) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
return connection.connection.shouldAdvertize(params);
|
|
209
|
+
}
|
|
210
|
+
_onConnectionOpen(connection) {
|
|
211
|
+
(0, import_invariant2.invariant)(!this._connections.has(connection.peerId), void 0, {
|
|
212
|
+
F: __dxlog_file,
|
|
213
|
+
L: 103,
|
|
214
|
+
S: this,
|
|
215
|
+
A: [
|
|
216
|
+
"!this._connections.has(connection.peerId as PeerId)",
|
|
217
|
+
""
|
|
218
|
+
]
|
|
219
|
+
});
|
|
220
|
+
const reader = connection.readable.getReader();
|
|
221
|
+
const writer = connection.writable.getWriter();
|
|
222
|
+
const connectionEntry = {
|
|
223
|
+
connection,
|
|
224
|
+
reader,
|
|
225
|
+
writer,
|
|
226
|
+
isOpen: true
|
|
227
|
+
};
|
|
228
|
+
this._connections.set(connection.peerId, connectionEntry);
|
|
229
|
+
queueMicrotask(async () => {
|
|
230
|
+
try {
|
|
231
|
+
while (true) {
|
|
232
|
+
const { done, value } = await reader.read();
|
|
233
|
+
if (done) {
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
this.emit("message", value);
|
|
237
|
+
}
|
|
238
|
+
} catch (err) {
|
|
239
|
+
if (connectionEntry.isOpen) {
|
|
240
|
+
import_log2.log.catch(err, void 0, {
|
|
241
|
+
F: __dxlog_file,
|
|
242
|
+
L: 122,
|
|
243
|
+
S: this,
|
|
244
|
+
C: (f, a) => f(...a)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
this.emit("peer-candidate", {
|
|
250
|
+
peerId: connection.peerId,
|
|
251
|
+
peerMetadata: {
|
|
252
|
+
// TODO(dmaretskyi): Refactor this.
|
|
253
|
+
dxos_peerSource: "EchoNetworkAdapter"
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
_onConnectionClosed(connection) {
|
|
258
|
+
const entry = this._connections.get(connection.peerId);
|
|
259
|
+
(0, import_invariant2.invariant)(entry, void 0, {
|
|
260
|
+
F: __dxlog_file,
|
|
261
|
+
L: 138,
|
|
262
|
+
S: this,
|
|
263
|
+
A: [
|
|
264
|
+
"entry",
|
|
265
|
+
""
|
|
266
|
+
]
|
|
267
|
+
});
|
|
268
|
+
entry.isOpen = false;
|
|
269
|
+
this.emit("peer-disconnected", {
|
|
270
|
+
peerId: connection.peerId
|
|
271
|
+
});
|
|
272
|
+
void entry.reader.cancel().catch((err) => import_log2.log.catch(err, void 0, {
|
|
273
|
+
F: __dxlog_file,
|
|
274
|
+
L: 143,
|
|
275
|
+
S: this,
|
|
276
|
+
C: (f, a) => f(...a)
|
|
277
|
+
}));
|
|
278
|
+
void entry.writer.abort().catch((err) => import_log2.log.catch(err, void 0, {
|
|
279
|
+
F: __dxlog_file,
|
|
280
|
+
L: 144,
|
|
281
|
+
S: this,
|
|
282
|
+
C: (f, a) => f(...a)
|
|
283
|
+
}));
|
|
284
|
+
this._connections.delete(connection.peerId);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
_ts_decorate([
|
|
288
|
+
import_async2.synchronized
|
|
289
|
+
], EchoNetworkAdapter.prototype, "open", null);
|
|
290
|
+
_ts_decorate([
|
|
291
|
+
import_async2.synchronized
|
|
292
|
+
], EchoNetworkAdapter.prototype, "close", null);
|
|
293
|
+
_ts_decorate([
|
|
294
|
+
import_async2.synchronized
|
|
295
|
+
], EchoNetworkAdapter.prototype, "addReplicator", null);
|
|
296
|
+
_ts_decorate([
|
|
297
|
+
import_async2.synchronized
|
|
298
|
+
], EchoNetworkAdapter.prototype, "removeReplicator", null);
|
|
299
|
+
var LevelDBStorageAdapter = class extends import_context3.Resource {
|
|
84
300
|
constructor(_params) {
|
|
85
301
|
super();
|
|
86
302
|
this._params = _params;
|
|
87
303
|
}
|
|
88
304
|
async load(keyArray) {
|
|
89
305
|
try {
|
|
90
|
-
if (this._lifecycleState !==
|
|
306
|
+
if (this._lifecycleState !== import_context3.LifecycleState.OPEN) {
|
|
91
307
|
return void 0;
|
|
92
308
|
}
|
|
93
309
|
return await this._params.db.get(keyArray, {
|
|
@@ -101,7 +317,7 @@ var LevelDBStorageAdapter = class extends import_context2.Resource {
|
|
|
101
317
|
}
|
|
102
318
|
}
|
|
103
319
|
async save(keyArray, binary) {
|
|
104
|
-
if (this._lifecycleState !==
|
|
320
|
+
if (this._lifecycleState !== import_context3.LifecycleState.OPEN) {
|
|
105
321
|
return void 0;
|
|
106
322
|
}
|
|
107
323
|
const batch = this._params.db.batch();
|
|
@@ -116,7 +332,7 @@ var LevelDBStorageAdapter = class extends import_context2.Resource {
|
|
|
116
332
|
await this._params.callbacks?.afterSave?.(keyArray);
|
|
117
333
|
}
|
|
118
334
|
async remove(keyArray) {
|
|
119
|
-
if (this._lifecycleState !==
|
|
335
|
+
if (this._lifecycleState !== import_context3.LifecycleState.OPEN) {
|
|
120
336
|
return void 0;
|
|
121
337
|
}
|
|
122
338
|
await this._params.db.del(keyArray, {
|
|
@@ -124,7 +340,7 @@ var LevelDBStorageAdapter = class extends import_context2.Resource {
|
|
|
124
340
|
});
|
|
125
341
|
}
|
|
126
342
|
async loadRange(keyPrefix) {
|
|
127
|
-
if (this._lifecycleState !==
|
|
343
|
+
if (this._lifecycleState !== import_context3.LifecycleState.OPEN) {
|
|
128
344
|
return [];
|
|
129
345
|
}
|
|
130
346
|
const result = [];
|
|
@@ -144,7 +360,7 @@ var LevelDBStorageAdapter = class extends import_context2.Resource {
|
|
|
144
360
|
return result;
|
|
145
361
|
}
|
|
146
362
|
async removeRange(keyPrefix) {
|
|
147
|
-
if (this._lifecycleState !==
|
|
363
|
+
if (this._lifecycleState !== import_context3.LifecycleState.OPEN) {
|
|
148
364
|
return void 0;
|
|
149
365
|
}
|
|
150
366
|
const batch = this._params.db.batch();
|
|
@@ -173,12 +389,12 @@ var encodingOptions = {
|
|
|
173
389
|
valueEncoding: "buffer"
|
|
174
390
|
};
|
|
175
391
|
var isLevelDbNotFoundError = (err) => err.code === "LEVEL_NOT_FOUND";
|
|
176
|
-
var
|
|
177
|
-
var LocalHostNetworkAdapter = class extends
|
|
392
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/local-host-network-adapter.ts";
|
|
393
|
+
var LocalHostNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
178
394
|
constructor() {
|
|
179
395
|
super(...arguments);
|
|
180
396
|
this._peers = /* @__PURE__ */ new Map();
|
|
181
|
-
this._connected = new
|
|
397
|
+
this._connected = new import_async3.Trigger();
|
|
182
398
|
this._isConnected = false;
|
|
183
399
|
}
|
|
184
400
|
/**
|
|
@@ -201,8 +417,8 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
201
417
|
}
|
|
202
418
|
send(message) {
|
|
203
419
|
const peer = this._peers.get(message.targetId);
|
|
204
|
-
(0,
|
|
205
|
-
F:
|
|
420
|
+
(0, import_invariant3.invariant)(peer, "Peer not found.", {
|
|
421
|
+
F: __dxlog_file2,
|
|
206
422
|
L: 51,
|
|
207
423
|
S: this,
|
|
208
424
|
A: [
|
|
@@ -226,8 +442,8 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
226
442
|
syncRepo({ id, syncMessage }) {
|
|
227
443
|
const peerId = this._getPeerId(id);
|
|
228
444
|
return new import_codec_protobuf.Stream(({ next, close }) => {
|
|
229
|
-
(0,
|
|
230
|
-
F:
|
|
445
|
+
(0, import_invariant3.invariant)(!this._peers.has(peerId), "Peer already connected.", {
|
|
446
|
+
F: __dxlog_file2,
|
|
231
447
|
L: 73,
|
|
232
448
|
S: this,
|
|
233
449
|
A: [
|
|
@@ -239,7 +455,7 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
239
455
|
connected: true,
|
|
240
456
|
send: (message) => {
|
|
241
457
|
next({
|
|
242
|
-
syncMessage:
|
|
458
|
+
syncMessage: import_automerge_repo3.cbor.encode(message)
|
|
243
459
|
});
|
|
244
460
|
},
|
|
245
461
|
disconnect: () => {
|
|
@@ -250,8 +466,8 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
250
466
|
});
|
|
251
467
|
}
|
|
252
468
|
});
|
|
253
|
-
(0,
|
|
254
|
-
F:
|
|
469
|
+
(0, import_invariant3.invariant)(this._isConnected, void 0, {
|
|
470
|
+
F: __dxlog_file2,
|
|
255
471
|
L: 90,
|
|
256
472
|
S: this,
|
|
257
473
|
A: [
|
|
@@ -266,8 +482,8 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
266
482
|
});
|
|
267
483
|
}
|
|
268
484
|
async sendSyncMessage({ id, syncMessage }) {
|
|
269
|
-
(0,
|
|
270
|
-
F:
|
|
485
|
+
(0, import_invariant3.invariant)(this._isConnected, void 0, {
|
|
486
|
+
F: __dxlog_file2,
|
|
271
487
|
L: 99,
|
|
272
488
|
S: this,
|
|
273
489
|
A: [
|
|
@@ -275,12 +491,12 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
275
491
|
""
|
|
276
492
|
]
|
|
277
493
|
});
|
|
278
|
-
const message =
|
|
494
|
+
const message = import_automerge_repo3.cbor.decode(syncMessage);
|
|
279
495
|
this.emit("message", message);
|
|
280
496
|
}
|
|
281
497
|
async getHostInfo() {
|
|
282
|
-
(0,
|
|
283
|
-
F:
|
|
498
|
+
(0, import_invariant3.invariant)(this._isConnected, void 0, {
|
|
499
|
+
F: __dxlog_file2,
|
|
284
500
|
L: 105,
|
|
285
501
|
S: this,
|
|
286
502
|
A: [
|
|
@@ -288,8 +504,8 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
288
504
|
""
|
|
289
505
|
]
|
|
290
506
|
});
|
|
291
|
-
(0,
|
|
292
|
-
F:
|
|
507
|
+
(0, import_invariant3.invariant)(this.peerId, "Peer id not set.", {
|
|
508
|
+
F: __dxlog_file2,
|
|
293
509
|
L: 106,
|
|
294
510
|
S: this,
|
|
295
511
|
A: [
|
|
@@ -305,12 +521,12 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
305
521
|
return id;
|
|
306
522
|
}
|
|
307
523
|
};
|
|
308
|
-
var
|
|
309
|
-
var MeshNetworkAdapter = class extends
|
|
524
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-network-adapter.ts";
|
|
525
|
+
var MeshNetworkAdapter = class extends import_automerge_repo4.NetworkAdapter {
|
|
310
526
|
constructor() {
|
|
311
527
|
super(...arguments);
|
|
312
528
|
this._extensions = /* @__PURE__ */ new Map();
|
|
313
|
-
this._connected = new
|
|
529
|
+
this._connected = new import_async4.Trigger();
|
|
314
530
|
}
|
|
315
531
|
/**
|
|
316
532
|
* Emits `ready` event. That signals to `Repo` that it can start using the adapter.
|
|
@@ -327,8 +543,8 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
327
543
|
send(message) {
|
|
328
544
|
const receiverId = message.targetId;
|
|
329
545
|
const extension = this._extensions.get(receiverId);
|
|
330
|
-
(0,
|
|
331
|
-
F:
|
|
546
|
+
(0, import_invariant4.invariant)(extension, "Extension not found.", {
|
|
547
|
+
F: __dxlog_file3,
|
|
332
548
|
L: 38,
|
|
333
549
|
S: this,
|
|
334
550
|
A: [
|
|
@@ -337,9 +553,9 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
337
553
|
]
|
|
338
554
|
});
|
|
339
555
|
extension.sendSyncMessage({
|
|
340
|
-
payload:
|
|
341
|
-
}).catch((err) =>
|
|
342
|
-
F:
|
|
556
|
+
payload: import_automerge_repo4.cbor.encode(message)
|
|
557
|
+
}).catch((err) => import_log3.log.catch(err, void 0, {
|
|
558
|
+
F: __dxlog_file3,
|
|
343
559
|
L: 39,
|
|
344
560
|
S: this,
|
|
345
561
|
C: (f, a) => f(...a)
|
|
@@ -348,8 +564,8 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
348
564
|
disconnect() {
|
|
349
565
|
}
|
|
350
566
|
createExtension() {
|
|
351
|
-
(0,
|
|
352
|
-
F:
|
|
567
|
+
(0, import_invariant4.invariant)(this.peerId, "Peer id not set.", {
|
|
568
|
+
F: __dxlog_file3,
|
|
353
569
|
L: 47,
|
|
354
570
|
S: this,
|
|
355
571
|
A: [
|
|
@@ -363,12 +579,12 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
363
579
|
}, {
|
|
364
580
|
onStartReplication: async (info, remotePeerId) => {
|
|
365
581
|
await this._connected.wait();
|
|
366
|
-
(0,
|
|
582
|
+
(0, import_log3.log)("onStartReplication", {
|
|
367
583
|
id: info.id,
|
|
368
584
|
thisPeerId: this.peerId,
|
|
369
585
|
remotePeerId: remotePeerId.toHex()
|
|
370
586
|
}, {
|
|
371
|
-
F:
|
|
587
|
+
F: __dxlog_file3,
|
|
372
588
|
L: 70,
|
|
373
589
|
S: this,
|
|
374
590
|
C: (f, a) => f(...a)
|
|
@@ -376,12 +592,12 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
376
592
|
if (!this._extensions.has(info.id)) {
|
|
377
593
|
peerInfo = info;
|
|
378
594
|
this._extensions.set(info.id, extension);
|
|
379
|
-
(0,
|
|
595
|
+
(0, import_log3.log)("peer-candidate", {
|
|
380
596
|
id: info.id,
|
|
381
597
|
thisPeerId: this.peerId,
|
|
382
598
|
remotePeerId: remotePeerId.toHex()
|
|
383
599
|
}, {
|
|
384
|
-
F:
|
|
600
|
+
F: __dxlog_file3,
|
|
385
601
|
L: 76,
|
|
386
602
|
S: this,
|
|
387
603
|
C: (f, a) => f(...a)
|
|
@@ -399,7 +615,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
399
615
|
if (!peerInfo) {
|
|
400
616
|
return;
|
|
401
617
|
}
|
|
402
|
-
const message =
|
|
618
|
+
const message = import_automerge_repo4.cbor.decode(payload);
|
|
403
619
|
this.emit("message", message);
|
|
404
620
|
},
|
|
405
621
|
onClose: async () => {
|
|
@@ -488,7 +704,7 @@ var AutomergeStorageAdapter = class {
|
|
|
488
704
|
return filename.split("-").map((k) => k.replaceAll("%2D", "-").replaceAll("%25", "%"));
|
|
489
705
|
}
|
|
490
706
|
};
|
|
491
|
-
var
|
|
707
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/migrations.ts";
|
|
492
708
|
var levelMigration = async ({ db, directory }) => {
|
|
493
709
|
const isNewLevel = !await db.iterator({
|
|
494
710
|
...encodingOptions
|
|
@@ -502,10 +718,10 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
502
718
|
return;
|
|
503
719
|
}
|
|
504
720
|
const batch = db.batch();
|
|
505
|
-
|
|
721
|
+
import_log4.log.info("found chunks on old storage adapter", {
|
|
506
722
|
chunks: chunks.length
|
|
507
723
|
}, {
|
|
508
|
-
F:
|
|
724
|
+
F: __dxlog_file4,
|
|
509
725
|
L: 36,
|
|
510
726
|
S: void 0,
|
|
511
727
|
C: (f, a) => f(...a)
|
|
@@ -517,7 +733,7 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
517
733
|
}
|
|
518
734
|
await batch.write();
|
|
519
735
|
};
|
|
520
|
-
function
|
|
736
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
521
737
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
522
738
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
523
739
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -527,10 +743,11 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
527
743
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
528
744
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
529
745
|
}
|
|
530
|
-
var
|
|
746
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
531
747
|
var AutomergeHost = class {
|
|
532
748
|
constructor({ directory, db, indexMetadataStore }) {
|
|
533
749
|
this._ctx = new import_context.Context();
|
|
750
|
+
this._echoNetworkAdapter = new EchoNetworkAdapter();
|
|
534
751
|
this._authorizedDevices = new import_util.ComplexMap(import_keys.PublicKey.hash);
|
|
535
752
|
this._requestedDocs = /* @__PURE__ */ new Set();
|
|
536
753
|
this._directory = directory;
|
|
@@ -557,7 +774,8 @@ var AutomergeHost = class {
|
|
|
557
774
|
peerId: this._peerId,
|
|
558
775
|
network: [
|
|
559
776
|
this._clientNetwork,
|
|
560
|
-
this._meshNetwork
|
|
777
|
+
this._meshNetwork,
|
|
778
|
+
this._echoNetworkAdapter
|
|
561
779
|
],
|
|
562
780
|
storage: this._storage,
|
|
563
781
|
// TODO(dmaretskyi): Share based on HALO permissions and space affinity.
|
|
@@ -569,6 +787,12 @@ var AutomergeHost = class {
|
|
|
569
787
|
if (!documentId) {
|
|
570
788
|
return false;
|
|
571
789
|
}
|
|
790
|
+
const peerMetadata = this.repo.peerMetadataByPeerId[peerId];
|
|
791
|
+
if (peerMetadata?.dxos_peerSource === "EchoNetworkAdapter") {
|
|
792
|
+
return this._echoNetworkAdapter.shouldAdvertize(peerId, {
|
|
793
|
+
documentId
|
|
794
|
+
});
|
|
795
|
+
}
|
|
572
796
|
const doc = this._repo.handles[documentId]?.docSync();
|
|
573
797
|
if (!doc) {
|
|
574
798
|
const isRequested = this._requestedDocs.has(`automerge:${documentId}`);
|
|
@@ -577,8 +801,8 @@ var AutomergeHost = class {
|
|
|
577
801
|
documentId,
|
|
578
802
|
isRequested
|
|
579
803
|
}, {
|
|
580
|
-
F:
|
|
581
|
-
L:
|
|
804
|
+
F: __dxlog_file5,
|
|
805
|
+
L: 124,
|
|
582
806
|
S: this,
|
|
583
807
|
C: (f, a) => f(...a)
|
|
584
808
|
});
|
|
@@ -591,22 +815,22 @@ var AutomergeHost = class {
|
|
|
591
815
|
peerId,
|
|
592
816
|
documentId
|
|
593
817
|
}, {
|
|
594
|
-
F:
|
|
595
|
-
L:
|
|
818
|
+
F: __dxlog_file5,
|
|
819
|
+
L: 131,
|
|
596
820
|
S: this,
|
|
597
821
|
C: (f, a) => f(...a)
|
|
598
822
|
});
|
|
599
823
|
return false;
|
|
600
824
|
}
|
|
601
825
|
const authorizedDevices = this._authorizedDevices.get(import_keys.PublicKey.from(spaceKey));
|
|
602
|
-
const deviceKeyHex =
|
|
826
|
+
const deviceKeyHex = peerMetadata?.dxos_deviceKey;
|
|
603
827
|
if (!deviceKeyHex) {
|
|
604
828
|
(0, import_log.log)("device key not found for share policy check", {
|
|
605
829
|
peerId,
|
|
606
830
|
documentId
|
|
607
831
|
}, {
|
|
608
|
-
F:
|
|
609
|
-
L:
|
|
832
|
+
F: __dxlog_file5,
|
|
833
|
+
L: 140,
|
|
610
834
|
S: this,
|
|
611
835
|
C: (f, a) => f(...a)
|
|
612
836
|
});
|
|
@@ -622,16 +846,16 @@ var AutomergeHost = class {
|
|
|
622
846
|
spaceKey,
|
|
623
847
|
isAuthorized
|
|
624
848
|
}, {
|
|
625
|
-
F:
|
|
626
|
-
L:
|
|
849
|
+
F: __dxlog_file5,
|
|
850
|
+
L: 146,
|
|
627
851
|
S: this,
|
|
628
852
|
C: (f, a) => f(...a)
|
|
629
853
|
});
|
|
630
854
|
return isAuthorized;
|
|
631
855
|
} catch (err) {
|
|
632
856
|
import_log.log.catch(err, void 0, {
|
|
633
|
-
F:
|
|
634
|
-
L:
|
|
857
|
+
F: __dxlog_file5,
|
|
858
|
+
L: 156,
|
|
635
859
|
S: this,
|
|
636
860
|
C: (f, a) => f(...a)
|
|
637
861
|
});
|
|
@@ -641,16 +865,25 @@ var AutomergeHost = class {
|
|
|
641
865
|
});
|
|
642
866
|
this._clientNetwork.ready();
|
|
643
867
|
this._meshNetwork.ready();
|
|
868
|
+
await this._echoNetworkAdapter.open();
|
|
644
869
|
await this._clientNetwork.whenConnected();
|
|
870
|
+
await this._echoNetworkAdapter.whenConnected();
|
|
645
871
|
}
|
|
646
872
|
async close() {
|
|
647
873
|
await this._storage.close?.();
|
|
648
874
|
await this._clientNetwork.close();
|
|
875
|
+
await this._echoNetworkAdapter.close();
|
|
649
876
|
await this._ctx.dispose();
|
|
650
877
|
}
|
|
651
878
|
get repo() {
|
|
652
879
|
return this._repo;
|
|
653
880
|
}
|
|
881
|
+
async addReplicator(replicator) {
|
|
882
|
+
await this._echoNetworkAdapter.addReplicator(replicator);
|
|
883
|
+
}
|
|
884
|
+
async removeReplicator(replicator) {
|
|
885
|
+
await this._echoNetworkAdapter.removeReplicator(replicator);
|
|
886
|
+
}
|
|
654
887
|
async _beforeSave({ path, batch }) {
|
|
655
888
|
const handle = this._repo.handles[path[0]];
|
|
656
889
|
if (!handle) {
|
|
@@ -709,8 +942,8 @@ var AutomergeHost = class {
|
|
|
709
942
|
async flush({ states }) {
|
|
710
943
|
await Promise.all(states?.map(async ({ heads, documentId }) => {
|
|
711
944
|
(0, import_invariant.invariant)(heads, "heads are required for flush", {
|
|
712
|
-
F:
|
|
713
|
-
L:
|
|
945
|
+
F: __dxlog_file5,
|
|
946
|
+
L: 252,
|
|
714
947
|
S: this,
|
|
715
948
|
A: [
|
|
716
949
|
"heads",
|
|
@@ -742,33 +975,33 @@ var AutomergeHost = class {
|
|
|
742
975
|
spaceKey,
|
|
743
976
|
deviceKey
|
|
744
977
|
}, {
|
|
745
|
-
F:
|
|
746
|
-
L:
|
|
978
|
+
F: __dxlog_file5,
|
|
979
|
+
L: 282,
|
|
747
980
|
S: this,
|
|
748
981
|
C: (f, a) => f(...a)
|
|
749
982
|
});
|
|
750
983
|
(0, import_util.defaultMap)(this._authorizedDevices, spaceKey, () => new import_util.ComplexSet(import_keys.PublicKey.hash)).add(deviceKey);
|
|
751
984
|
}
|
|
752
985
|
};
|
|
753
|
-
|
|
986
|
+
_ts_decorate2([
|
|
754
987
|
import_tracing.trace.info()
|
|
755
988
|
], AutomergeHost.prototype, "_peerId", void 0);
|
|
756
|
-
|
|
989
|
+
_ts_decorate2([
|
|
757
990
|
import_tracing.trace.info({
|
|
758
991
|
depth: null
|
|
759
992
|
})
|
|
760
993
|
], AutomergeHost.prototype, "_automergeDocs", null);
|
|
761
|
-
|
|
994
|
+
_ts_decorate2([
|
|
762
995
|
import_tracing.trace.info({
|
|
763
996
|
depth: null
|
|
764
997
|
})
|
|
765
998
|
], AutomergeHost.prototype, "_automergePeers", null);
|
|
766
|
-
|
|
999
|
+
_ts_decorate2([
|
|
767
1000
|
import_tracing.trace.span({
|
|
768
1001
|
showInBrowserTimeline: true
|
|
769
1002
|
})
|
|
770
1003
|
], AutomergeHost.prototype, "flush", null);
|
|
771
|
-
AutomergeHost =
|
|
1004
|
+
AutomergeHost = _ts_decorate2([
|
|
772
1005
|
import_tracing.trace.resource()
|
|
773
1006
|
], AutomergeHost);
|
|
774
1007
|
var getSpaceKeyFromDoc = (doc) => {
|
|
@@ -796,7 +1029,7 @@ var waitForHeads = async (handle, heads) => {
|
|
|
796
1029
|
var changeIsPresentInDoc = (doc, changeHash) => {
|
|
797
1030
|
return !!(0, import_automerge.getBackend)(doc).getChangeByHash(changeHash);
|
|
798
1031
|
};
|
|
799
|
-
function
|
|
1032
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
800
1033
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
801
1034
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
802
1035
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -806,7 +1039,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
806
1039
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
807
1040
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
808
1041
|
}
|
|
809
|
-
var
|
|
1042
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
810
1043
|
var AutomergeDocumentLoaderImpl = class {
|
|
811
1044
|
constructor(_spaceKey, _repo) {
|
|
812
1045
|
this._spaceKey = _spaceKey;
|
|
@@ -814,23 +1047,24 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
814
1047
|
this._spaceRootDocHandle = null;
|
|
815
1048
|
this._objectDocumentHandles = /* @__PURE__ */ new Map();
|
|
816
1049
|
this._objectsPendingDocumentLoad = /* @__PURE__ */ new Set();
|
|
817
|
-
this.onObjectDocumentLoaded = new
|
|
1050
|
+
this.onObjectDocumentLoaded = new import_async5.Event();
|
|
818
1051
|
}
|
|
819
1052
|
getAllHandles() {
|
|
820
|
-
return [
|
|
1053
|
+
return this._spaceRootDocHandle != null ? [
|
|
1054
|
+
this._spaceRootDocHandle,
|
|
821
1055
|
...new Set(this._objectDocumentHandles.values())
|
|
822
|
-
];
|
|
1056
|
+
] : [];
|
|
823
1057
|
}
|
|
824
1058
|
async loadSpaceRootDocHandle(ctx, spaceState) {
|
|
825
1059
|
if (this._spaceRootDocHandle != null) {
|
|
826
1060
|
return;
|
|
827
1061
|
}
|
|
828
1062
|
if (!spaceState.rootUrl) {
|
|
829
|
-
|
|
1063
|
+
import_log5.log.error("Database opened with no rootUrl", {
|
|
830
1064
|
spaceKey: this._spaceKey
|
|
831
1065
|
}, {
|
|
832
|
-
F:
|
|
833
|
-
L:
|
|
1066
|
+
F: __dxlog_file6,
|
|
1067
|
+
L: 70,
|
|
834
1068
|
S: this,
|
|
835
1069
|
C: (f, a) => f(...a)
|
|
836
1070
|
});
|
|
@@ -838,9 +1072,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
838
1072
|
} else {
|
|
839
1073
|
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
840
1074
|
const doc = existingDocHandle.docSync();
|
|
841
|
-
(0,
|
|
842
|
-
F:
|
|
843
|
-
L:
|
|
1075
|
+
(0, import_invariant5.invariant)(doc, void 0, {
|
|
1076
|
+
F: __dxlog_file6,
|
|
1077
|
+
L: 75,
|
|
844
1078
|
S: this,
|
|
845
1079
|
A: [
|
|
846
1080
|
"doc",
|
|
@@ -860,9 +1094,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
860
1094
|
let hasUrlsToLoad = false;
|
|
861
1095
|
const urlsToLoad = {};
|
|
862
1096
|
for (const objectId of objectIds) {
|
|
863
|
-
(0,
|
|
864
|
-
F:
|
|
865
|
-
L:
|
|
1097
|
+
(0, import_invariant5.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1098
|
+
F: __dxlog_file6,
|
|
1099
|
+
L: 88,
|
|
866
1100
|
S: this,
|
|
867
1101
|
A: [
|
|
868
1102
|
"this._spaceRootDocHandle",
|
|
@@ -873,9 +1107,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
873
1107
|
continue;
|
|
874
1108
|
}
|
|
875
1109
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
876
|
-
(0,
|
|
877
|
-
F:
|
|
878
|
-
L:
|
|
1110
|
+
(0, import_invariant5.invariant)(spaceRootDoc, void 0, {
|
|
1111
|
+
F: __dxlog_file6,
|
|
1112
|
+
L: 93,
|
|
879
1113
|
S: this,
|
|
880
1114
|
A: [
|
|
881
1115
|
"spaceRootDoc",
|
|
@@ -885,11 +1119,11 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
885
1119
|
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
886
1120
|
if (documentUrl == null) {
|
|
887
1121
|
this._objectsPendingDocumentLoad.add(objectId);
|
|
888
|
-
|
|
1122
|
+
import_log5.log.info("loading delayed until object links are initialized", {
|
|
889
1123
|
objectId
|
|
890
1124
|
}, {
|
|
891
|
-
F:
|
|
892
|
-
L:
|
|
1125
|
+
F: __dxlog_file6,
|
|
1126
|
+
L: 97,
|
|
893
1127
|
S: this,
|
|
894
1128
|
C: (f, a) => f(...a)
|
|
895
1129
|
});
|
|
@@ -911,9 +1145,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
911
1145
|
linksAwaitingLoad.forEach(([objectId]) => this._objectsPendingDocumentLoad.delete(objectId));
|
|
912
1146
|
}
|
|
913
1147
|
getSpaceRootDocHandle() {
|
|
914
|
-
(0,
|
|
915
|
-
F:
|
|
916
|
-
L:
|
|
1148
|
+
(0, import_invariant5.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1149
|
+
F: __dxlog_file6,
|
|
1150
|
+
L: 120,
|
|
917
1151
|
S: this,
|
|
918
1152
|
A: [
|
|
919
1153
|
"this._spaceRootDocHandle",
|
|
@@ -923,9 +1157,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
923
1157
|
return this._spaceRootDocHandle;
|
|
924
1158
|
}
|
|
925
1159
|
createDocumentForObject(objectId) {
|
|
926
|
-
(0,
|
|
927
|
-
F:
|
|
928
|
-
L:
|
|
1160
|
+
(0, import_invariant5.invariant)(this._spaceRootDocHandle, void 0, {
|
|
1161
|
+
F: __dxlog_file6,
|
|
1162
|
+
L: 125,
|
|
929
1163
|
S: this,
|
|
930
1164
|
A: [
|
|
931
1165
|
"this._spaceRootDocHandle",
|
|
@@ -963,30 +1197,30 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
963
1197
|
};
|
|
964
1198
|
const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
|
|
965
1199
|
if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
|
|
966
|
-
|
|
1200
|
+
import_log5.log.warn("object already inlined in a different document, ignoring the link", {
|
|
967
1201
|
...logMeta,
|
|
968
1202
|
actualDocumentUrl: objectDocumentHandle.url
|
|
969
1203
|
}, {
|
|
970
|
-
F:
|
|
971
|
-
L:
|
|
1204
|
+
F: __dxlog_file6,
|
|
1205
|
+
L: 155,
|
|
972
1206
|
S: this,
|
|
973
1207
|
C: (f, a) => f(...a)
|
|
974
1208
|
});
|
|
975
1209
|
continue;
|
|
976
1210
|
}
|
|
977
1211
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
978
|
-
|
|
979
|
-
F:
|
|
980
|
-
L:
|
|
1212
|
+
import_log5.log.warn("object document was already loaded", logMeta, {
|
|
1213
|
+
F: __dxlog_file6,
|
|
1214
|
+
L: 162,
|
|
981
1215
|
S: this,
|
|
982
1216
|
C: (f, a) => f(...a)
|
|
983
1217
|
});
|
|
984
1218
|
continue;
|
|
985
1219
|
}
|
|
986
1220
|
const handle = this._repo.find(automergeUrl);
|
|
987
|
-
|
|
988
|
-
F:
|
|
989
|
-
L:
|
|
1221
|
+
import_log5.log.debug("document loading triggered", logMeta, {
|
|
1222
|
+
F: __dxlog_file6,
|
|
1223
|
+
L: 166,
|
|
990
1224
|
S: this,
|
|
991
1225
|
C: (f, a) => f(...a)
|
|
992
1226
|
});
|
|
@@ -999,17 +1233,17 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
999
1233
|
while (true) {
|
|
1000
1234
|
try {
|
|
1001
1235
|
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (AutomergeDb)", async () => {
|
|
1002
|
-
await (0,
|
|
1236
|
+
await (0, import_context4.cancelWithContext)(ctx, docHandle.whenReady());
|
|
1003
1237
|
});
|
|
1004
1238
|
break;
|
|
1005
1239
|
} catch (err) {
|
|
1006
1240
|
if (`${err}`.includes("Timeout")) {
|
|
1007
|
-
|
|
1241
|
+
import_log5.log.info("wraparound", {
|
|
1008
1242
|
id: docHandle.documentId,
|
|
1009
1243
|
state: docHandle.state
|
|
1010
1244
|
}, {
|
|
1011
|
-
F:
|
|
1012
|
-
L:
|
|
1245
|
+
F: __dxlog_file6,
|
|
1246
|
+
L: 182,
|
|
1013
1247
|
S: this,
|
|
1014
1248
|
C: (f, a) => f(...a)
|
|
1015
1249
|
});
|
|
@@ -1049,9 +1283,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1049
1283
|
docUrl: handle.url
|
|
1050
1284
|
};
|
|
1051
1285
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1052
|
-
|
|
1053
|
-
F:
|
|
1054
|
-
L:
|
|
1286
|
+
import_log5.log.info("document loaded after all listeners were removed", logMeta, {
|
|
1287
|
+
F: __dxlog_file6,
|
|
1288
|
+
L: 218,
|
|
1055
1289
|
S: this,
|
|
1056
1290
|
C: (f, a) => f(...a)
|
|
1057
1291
|
});
|
|
@@ -1059,9 +1293,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1059
1293
|
}
|
|
1060
1294
|
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1061
1295
|
if (objectDocHandle?.url !== handle.url) {
|
|
1062
|
-
|
|
1063
|
-
F:
|
|
1064
|
-
L:
|
|
1296
|
+
import_log5.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1297
|
+
F: __dxlog_file6,
|
|
1298
|
+
L: 223,
|
|
1065
1299
|
S: this,
|
|
1066
1300
|
C: (f, a) => f(...a)
|
|
1067
1301
|
});
|
|
@@ -1073,14 +1307,14 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1073
1307
|
});
|
|
1074
1308
|
} catch (err) {
|
|
1075
1309
|
const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
|
|
1076
|
-
|
|
1310
|
+
import_log5.log.warn("failed to load a document", {
|
|
1077
1311
|
objectId,
|
|
1078
1312
|
automergeUrl: handle.url,
|
|
1079
1313
|
retryLoading: shouldRetryLoading,
|
|
1080
1314
|
err
|
|
1081
1315
|
}, {
|
|
1082
|
-
F:
|
|
1083
|
-
L:
|
|
1316
|
+
F: __dxlog_file6,
|
|
1317
|
+
L: 229,
|
|
1084
1318
|
S: this,
|
|
1085
1319
|
C: (f, a) => f(...a)
|
|
1086
1320
|
});
|
|
@@ -1090,12 +1324,12 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1090
1324
|
}
|
|
1091
1325
|
}
|
|
1092
1326
|
};
|
|
1093
|
-
|
|
1327
|
+
_ts_decorate3([
|
|
1094
1328
|
import_tracing2.trace.span({
|
|
1095
1329
|
showInBrowserTimeline: true
|
|
1096
1330
|
})
|
|
1097
1331
|
], AutomergeDocumentLoaderImpl.prototype, "loadSpaceRootDocHandle", null);
|
|
1098
|
-
AutomergeDocumentLoaderImpl =
|
|
1332
|
+
AutomergeDocumentLoaderImpl = _ts_decorate3([
|
|
1099
1333
|
import_tracing2.trace.resource()
|
|
1100
1334
|
], AutomergeDocumentLoaderImpl);
|
|
1101
1335
|
// Annotate the CommonJS export names for ESM import in node:
|