@dxos/echo-pipeline 0.5.1-main.39e0ee2 → 0.5.1-main.3c7169d
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 +127 -366
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +122 -356
- 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 +1 -4
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/index.d.ts +0 -1
- package/dist/types/src/automerge/index.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/automerge/automerge-doc-loader.ts +1 -3
- package/src/automerge/automerge-host.ts +4 -23
- package/src/automerge/index.ts +0 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +0 -26
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +0 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +0 -43
- package/dist/types/src/automerge/echo-replicator.d.ts.map +0 -1
- package/src/automerge/echo-network-adapter.ts +0 -155
- package/src/automerge/echo-replicator.ts +0 -56
|
@@ -29,236 +29,15 @@ import { Event } from "@dxos/async";
|
|
|
29
29
|
import { next as automerge, getBackend, getHeads } from "@dxos/automerge/automerge";
|
|
30
30
|
import { Repo } from "@dxos/automerge/automerge-repo";
|
|
31
31
|
import { Context } from "@dxos/context";
|
|
32
|
-
import { invariant as
|
|
32
|
+
import { invariant as invariant3 } from "@dxos/invariant";
|
|
33
33
|
import { PublicKey } from "@dxos/keys";
|
|
34
|
-
import { log as
|
|
34
|
+
import { log as log3 } from "@dxos/log";
|
|
35
35
|
import { idCodec } from "@dxos/protocols";
|
|
36
36
|
import { trace } from "@dxos/tracing";
|
|
37
37
|
import { ComplexMap, ComplexSet, defaultMap, mapValues } from "@dxos/util";
|
|
38
38
|
|
|
39
|
-
// packages/core/echo/echo-pipeline/src/automerge/echo-network-adapter.ts
|
|
40
|
-
import { Trigger, synchronized } from "@dxos/async";
|
|
41
|
-
import { NetworkAdapter } from "@dxos/automerge/automerge-repo";
|
|
42
|
-
import { LifecycleState } from "@dxos/context";
|
|
43
|
-
import { invariant } from "@dxos/invariant";
|
|
44
|
-
import { log } from "@dxos/log";
|
|
45
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
46
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
47
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
48
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
49
|
-
else
|
|
50
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
51
|
-
if (d = decorators[i])
|
|
52
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
53
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
54
|
-
}
|
|
55
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/echo-network-adapter.ts";
|
|
56
|
-
var EchoNetworkAdapter = class extends NetworkAdapter {
|
|
57
|
-
constructor() {
|
|
58
|
-
super(...arguments);
|
|
59
|
-
this._replicators = /* @__PURE__ */ new Set();
|
|
60
|
-
/**
|
|
61
|
-
* Remote peer id -> connection.
|
|
62
|
-
*/
|
|
63
|
-
this._connections = /* @__PURE__ */ new Map();
|
|
64
|
-
this._lifecycleState = LifecycleState.CLOSED;
|
|
65
|
-
this._connected = new Trigger();
|
|
66
|
-
}
|
|
67
|
-
connect(peerId, peerMetadata) {
|
|
68
|
-
this.peerId = peerId;
|
|
69
|
-
this.peerMetadata = peerMetadata;
|
|
70
|
-
this._connected.wake();
|
|
71
|
-
}
|
|
72
|
-
send(message) {
|
|
73
|
-
const connectionEntry = this._connections.get(message.targetId);
|
|
74
|
-
if (!connectionEntry) {
|
|
75
|
-
throw new Error("Connection not found.");
|
|
76
|
-
}
|
|
77
|
-
connectionEntry.writer.write(message).catch((err) => {
|
|
78
|
-
if (connectionEntry.isOpen) {
|
|
79
|
-
log.catch(err, void 0, {
|
|
80
|
-
F: __dxlog_file,
|
|
81
|
-
L: 40,
|
|
82
|
-
S: this,
|
|
83
|
-
C: (f, a) => f(...a)
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
disconnect() {
|
|
89
|
-
}
|
|
90
|
-
async open() {
|
|
91
|
-
invariant(this._lifecycleState === LifecycleState.CLOSED, void 0, {
|
|
92
|
-
F: __dxlog_file,
|
|
93
|
-
L: 51,
|
|
94
|
-
S: this,
|
|
95
|
-
A: [
|
|
96
|
-
"this._lifecycleState === LifecycleState.CLOSED",
|
|
97
|
-
""
|
|
98
|
-
]
|
|
99
|
-
});
|
|
100
|
-
this._lifecycleState = LifecycleState.OPEN;
|
|
101
|
-
this.emit("ready", {
|
|
102
|
-
network: this
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
async close() {
|
|
106
|
-
invariant(this._lifecycleState === LifecycleState.OPEN, void 0, {
|
|
107
|
-
F: __dxlog_file,
|
|
108
|
-
L: 61,
|
|
109
|
-
S: this,
|
|
110
|
-
A: [
|
|
111
|
-
"this._lifecycleState === LifecycleState.OPEN",
|
|
112
|
-
""
|
|
113
|
-
]
|
|
114
|
-
});
|
|
115
|
-
for (const replicator of this._replicators) {
|
|
116
|
-
await replicator.disconnect();
|
|
117
|
-
}
|
|
118
|
-
this._replicators.clear();
|
|
119
|
-
this._lifecycleState = LifecycleState.CLOSED;
|
|
120
|
-
}
|
|
121
|
-
async whenConnected() {
|
|
122
|
-
await this._connected.wait({
|
|
123
|
-
timeout: 1e4
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
async addReplicator(replicator) {
|
|
127
|
-
invariant(this.peerId, void 0, {
|
|
128
|
-
F: __dxlog_file,
|
|
129
|
-
L: 77,
|
|
130
|
-
S: this,
|
|
131
|
-
A: [
|
|
132
|
-
"this.peerId",
|
|
133
|
-
""
|
|
134
|
-
]
|
|
135
|
-
});
|
|
136
|
-
invariant(!this._replicators.has(replicator), void 0, {
|
|
137
|
-
F: __dxlog_file,
|
|
138
|
-
L: 78,
|
|
139
|
-
S: this,
|
|
140
|
-
A: [
|
|
141
|
-
"!this._replicators.has(replicator)",
|
|
142
|
-
""
|
|
143
|
-
]
|
|
144
|
-
});
|
|
145
|
-
await replicator.connect({
|
|
146
|
-
peerId: this.peerId,
|
|
147
|
-
onConnectionOpen: this._onConnectionOpen.bind(this),
|
|
148
|
-
onConnectionClosed: this._onConnectionClosed.bind(this)
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
async removeReplicator(replicator) {
|
|
152
|
-
invariant(this._replicators.has(replicator), void 0, {
|
|
153
|
-
F: __dxlog_file,
|
|
154
|
-
L: 89,
|
|
155
|
-
S: this,
|
|
156
|
-
A: [
|
|
157
|
-
"this._replicators.has(replicator)",
|
|
158
|
-
""
|
|
159
|
-
]
|
|
160
|
-
});
|
|
161
|
-
await replicator.disconnect();
|
|
162
|
-
}
|
|
163
|
-
async shouldAdvertize(peerId, params) {
|
|
164
|
-
const connection = this._connections.get(peerId);
|
|
165
|
-
if (!connection) {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
return connection.connection.shouldAdvertize(params);
|
|
169
|
-
}
|
|
170
|
-
_onConnectionOpen(connection) {
|
|
171
|
-
invariant(!this._connections.has(connection.peerId), void 0, {
|
|
172
|
-
F: __dxlog_file,
|
|
173
|
-
L: 103,
|
|
174
|
-
S: this,
|
|
175
|
-
A: [
|
|
176
|
-
"!this._connections.has(connection.peerId as PeerId)",
|
|
177
|
-
""
|
|
178
|
-
]
|
|
179
|
-
});
|
|
180
|
-
const reader = connection.readable.getReader();
|
|
181
|
-
const writer = connection.writable.getWriter();
|
|
182
|
-
const connectionEntry = {
|
|
183
|
-
connection,
|
|
184
|
-
reader,
|
|
185
|
-
writer,
|
|
186
|
-
isOpen: true
|
|
187
|
-
};
|
|
188
|
-
this._connections.set(connection.peerId, connectionEntry);
|
|
189
|
-
queueMicrotask(async () => {
|
|
190
|
-
try {
|
|
191
|
-
while (true) {
|
|
192
|
-
const { done, value } = await reader.read();
|
|
193
|
-
if (done) {
|
|
194
|
-
break;
|
|
195
|
-
}
|
|
196
|
-
this.emit("message", value);
|
|
197
|
-
}
|
|
198
|
-
} catch (err) {
|
|
199
|
-
if (connectionEntry.isOpen) {
|
|
200
|
-
log.catch(err, void 0, {
|
|
201
|
-
F: __dxlog_file,
|
|
202
|
-
L: 122,
|
|
203
|
-
S: this,
|
|
204
|
-
C: (f, a) => f(...a)
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
this.emit("peer-candidate", {
|
|
210
|
-
peerId: connection.peerId,
|
|
211
|
-
peerMetadata: {
|
|
212
|
-
// TODO(dmaretskyi): Refactor this.
|
|
213
|
-
dxos_peerSource: "EchoNetworkAdapter"
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
_onConnectionClosed(connection) {
|
|
218
|
-
const entry = this._connections.get(connection.peerId);
|
|
219
|
-
invariant(entry, void 0, {
|
|
220
|
-
F: __dxlog_file,
|
|
221
|
-
L: 138,
|
|
222
|
-
S: this,
|
|
223
|
-
A: [
|
|
224
|
-
"entry",
|
|
225
|
-
""
|
|
226
|
-
]
|
|
227
|
-
});
|
|
228
|
-
entry.isOpen = false;
|
|
229
|
-
this.emit("peer-disconnected", {
|
|
230
|
-
peerId: connection.peerId
|
|
231
|
-
});
|
|
232
|
-
void entry.reader.cancel().catch((err) => log.catch(err, void 0, {
|
|
233
|
-
F: __dxlog_file,
|
|
234
|
-
L: 143,
|
|
235
|
-
S: this,
|
|
236
|
-
C: (f, a) => f(...a)
|
|
237
|
-
}));
|
|
238
|
-
void entry.writer.abort().catch((err) => log.catch(err, void 0, {
|
|
239
|
-
F: __dxlog_file,
|
|
240
|
-
L: 144,
|
|
241
|
-
S: this,
|
|
242
|
-
C: (f, a) => f(...a)
|
|
243
|
-
}));
|
|
244
|
-
this._connections.delete(connection.peerId);
|
|
245
|
-
}
|
|
246
|
-
};
|
|
247
|
-
_ts_decorate([
|
|
248
|
-
synchronized
|
|
249
|
-
], EchoNetworkAdapter.prototype, "open", null);
|
|
250
|
-
_ts_decorate([
|
|
251
|
-
synchronized
|
|
252
|
-
], EchoNetworkAdapter.prototype, "close", null);
|
|
253
|
-
_ts_decorate([
|
|
254
|
-
synchronized
|
|
255
|
-
], EchoNetworkAdapter.prototype, "addReplicator", null);
|
|
256
|
-
_ts_decorate([
|
|
257
|
-
synchronized
|
|
258
|
-
], EchoNetworkAdapter.prototype, "removeReplicator", null);
|
|
259
|
-
|
|
260
39
|
// packages/core/echo/echo-pipeline/src/automerge/leveldb-storage-adapter.ts
|
|
261
|
-
import { LifecycleState
|
|
40
|
+
import { LifecycleState, Resource } from "@dxos/context";
|
|
262
41
|
var LevelDBStorageAdapter = class extends Resource {
|
|
263
42
|
constructor(_params) {
|
|
264
43
|
super();
|
|
@@ -266,7 +45,7 @@ var LevelDBStorageAdapter = class extends Resource {
|
|
|
266
45
|
}
|
|
267
46
|
async load(keyArray) {
|
|
268
47
|
try {
|
|
269
|
-
if (this._lifecycleState !==
|
|
48
|
+
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
270
49
|
return void 0;
|
|
271
50
|
}
|
|
272
51
|
return await this._params.db.get(keyArray, {
|
|
@@ -280,7 +59,7 @@ var LevelDBStorageAdapter = class extends Resource {
|
|
|
280
59
|
}
|
|
281
60
|
}
|
|
282
61
|
async save(keyArray, binary) {
|
|
283
|
-
if (this._lifecycleState !==
|
|
62
|
+
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
284
63
|
return void 0;
|
|
285
64
|
}
|
|
286
65
|
const batch = this._params.db.batch();
|
|
@@ -295,7 +74,7 @@ var LevelDBStorageAdapter = class extends Resource {
|
|
|
295
74
|
await this._params.callbacks?.afterSave?.(keyArray);
|
|
296
75
|
}
|
|
297
76
|
async remove(keyArray) {
|
|
298
|
-
if (this._lifecycleState !==
|
|
77
|
+
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
299
78
|
return void 0;
|
|
300
79
|
}
|
|
301
80
|
await this._params.db.del(keyArray, {
|
|
@@ -303,7 +82,7 @@ var LevelDBStorageAdapter = class extends Resource {
|
|
|
303
82
|
});
|
|
304
83
|
}
|
|
305
84
|
async loadRange(keyPrefix) {
|
|
306
|
-
if (this._lifecycleState !==
|
|
85
|
+
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
307
86
|
return [];
|
|
308
87
|
}
|
|
309
88
|
const result = [];
|
|
@@ -323,7 +102,7 @@ var LevelDBStorageAdapter = class extends Resource {
|
|
|
323
102
|
return result;
|
|
324
103
|
}
|
|
325
104
|
async removeRange(keyPrefix) {
|
|
326
|
-
if (this._lifecycleState !==
|
|
105
|
+
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
327
106
|
return void 0;
|
|
328
107
|
}
|
|
329
108
|
const batch = this._params.db.batch();
|
|
@@ -354,16 +133,16 @@ var encodingOptions = {
|
|
|
354
133
|
var isLevelDbNotFoundError = (err) => err.code === "LEVEL_NOT_FOUND";
|
|
355
134
|
|
|
356
135
|
// packages/core/echo/echo-pipeline/src/automerge/local-host-network-adapter.ts
|
|
357
|
-
import { Trigger
|
|
358
|
-
import { NetworkAdapter
|
|
136
|
+
import { Trigger } from "@dxos/async";
|
|
137
|
+
import { NetworkAdapter, cbor } from "@dxos/automerge/automerge-repo";
|
|
359
138
|
import { Stream } from "@dxos/codec-protobuf";
|
|
360
|
-
import { invariant
|
|
361
|
-
var
|
|
362
|
-
var LocalHostNetworkAdapter = class extends
|
|
139
|
+
import { invariant } from "@dxos/invariant";
|
|
140
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/local-host-network-adapter.ts";
|
|
141
|
+
var LocalHostNetworkAdapter = class extends NetworkAdapter {
|
|
363
142
|
constructor() {
|
|
364
143
|
super(...arguments);
|
|
365
144
|
this._peers = /* @__PURE__ */ new Map();
|
|
366
|
-
this._connected = new
|
|
145
|
+
this._connected = new Trigger();
|
|
367
146
|
this._isConnected = false;
|
|
368
147
|
}
|
|
369
148
|
/**
|
|
@@ -386,8 +165,8 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
386
165
|
}
|
|
387
166
|
send(message) {
|
|
388
167
|
const peer = this._peers.get(message.targetId);
|
|
389
|
-
|
|
390
|
-
F:
|
|
168
|
+
invariant(peer, "Peer not found.", {
|
|
169
|
+
F: __dxlog_file,
|
|
391
170
|
L: 51,
|
|
392
171
|
S: this,
|
|
393
172
|
A: [
|
|
@@ -411,8 +190,8 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
411
190
|
syncRepo({ id, syncMessage }) {
|
|
412
191
|
const peerId = this._getPeerId(id);
|
|
413
192
|
return new Stream(({ next, close }) => {
|
|
414
|
-
|
|
415
|
-
F:
|
|
193
|
+
invariant(!this._peers.has(peerId), "Peer already connected.", {
|
|
194
|
+
F: __dxlog_file,
|
|
416
195
|
L: 73,
|
|
417
196
|
S: this,
|
|
418
197
|
A: [
|
|
@@ -435,8 +214,8 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
435
214
|
});
|
|
436
215
|
}
|
|
437
216
|
});
|
|
438
|
-
|
|
439
|
-
F:
|
|
217
|
+
invariant(this._isConnected, void 0, {
|
|
218
|
+
F: __dxlog_file,
|
|
440
219
|
L: 90,
|
|
441
220
|
S: this,
|
|
442
221
|
A: [
|
|
@@ -451,8 +230,8 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
451
230
|
});
|
|
452
231
|
}
|
|
453
232
|
async sendSyncMessage({ id, syncMessage }) {
|
|
454
|
-
|
|
455
|
-
F:
|
|
233
|
+
invariant(this._isConnected, void 0, {
|
|
234
|
+
F: __dxlog_file,
|
|
456
235
|
L: 99,
|
|
457
236
|
S: this,
|
|
458
237
|
A: [
|
|
@@ -464,8 +243,8 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
464
243
|
this.emit("message", message);
|
|
465
244
|
}
|
|
466
245
|
async getHostInfo() {
|
|
467
|
-
|
|
468
|
-
F:
|
|
246
|
+
invariant(this._isConnected, void 0, {
|
|
247
|
+
F: __dxlog_file,
|
|
469
248
|
L: 105,
|
|
470
249
|
S: this,
|
|
471
250
|
A: [
|
|
@@ -473,8 +252,8 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
473
252
|
""
|
|
474
253
|
]
|
|
475
254
|
});
|
|
476
|
-
|
|
477
|
-
F:
|
|
255
|
+
invariant(this.peerId, "Peer id not set.", {
|
|
256
|
+
F: __dxlog_file,
|
|
478
257
|
L: 106,
|
|
479
258
|
S: this,
|
|
480
259
|
A: [
|
|
@@ -492,17 +271,17 @@ var LocalHostNetworkAdapter = class extends NetworkAdapter2 {
|
|
|
492
271
|
};
|
|
493
272
|
|
|
494
273
|
// packages/core/echo/echo-pipeline/src/automerge/mesh-network-adapter.ts
|
|
495
|
-
import { Trigger as
|
|
496
|
-
import { NetworkAdapter as
|
|
497
|
-
import { invariant as
|
|
498
|
-
import { log
|
|
274
|
+
import { Trigger as Trigger2 } from "@dxos/async";
|
|
275
|
+
import { NetworkAdapter as NetworkAdapter2, cbor as cbor2 } from "@dxos/automerge/automerge-repo";
|
|
276
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
277
|
+
import { log } from "@dxos/log";
|
|
499
278
|
import { AutomergeReplicator } from "@dxos/teleport-extension-automerge-replicator";
|
|
500
|
-
var
|
|
501
|
-
var MeshNetworkAdapter = class extends
|
|
279
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/mesh-network-adapter.ts";
|
|
280
|
+
var MeshNetworkAdapter = class extends NetworkAdapter2 {
|
|
502
281
|
constructor() {
|
|
503
282
|
super(...arguments);
|
|
504
283
|
this._extensions = /* @__PURE__ */ new Map();
|
|
505
|
-
this._connected = new
|
|
284
|
+
this._connected = new Trigger2();
|
|
506
285
|
}
|
|
507
286
|
/**
|
|
508
287
|
* Emits `ready` event. That signals to `Repo` that it can start using the adapter.
|
|
@@ -519,8 +298,8 @@ var MeshNetworkAdapter = class extends NetworkAdapter3 {
|
|
|
519
298
|
send(message) {
|
|
520
299
|
const receiverId = message.targetId;
|
|
521
300
|
const extension = this._extensions.get(receiverId);
|
|
522
|
-
|
|
523
|
-
F:
|
|
301
|
+
invariant2(extension, "Extension not found.", {
|
|
302
|
+
F: __dxlog_file2,
|
|
524
303
|
L: 38,
|
|
525
304
|
S: this,
|
|
526
305
|
A: [
|
|
@@ -530,8 +309,8 @@ var MeshNetworkAdapter = class extends NetworkAdapter3 {
|
|
|
530
309
|
});
|
|
531
310
|
extension.sendSyncMessage({
|
|
532
311
|
payload: cbor2.encode(message)
|
|
533
|
-
}).catch((err) =>
|
|
534
|
-
F:
|
|
312
|
+
}).catch((err) => log.catch(err, void 0, {
|
|
313
|
+
F: __dxlog_file2,
|
|
535
314
|
L: 39,
|
|
536
315
|
S: this,
|
|
537
316
|
C: (f, a) => f(...a)
|
|
@@ -540,8 +319,8 @@ var MeshNetworkAdapter = class extends NetworkAdapter3 {
|
|
|
540
319
|
disconnect() {
|
|
541
320
|
}
|
|
542
321
|
createExtension() {
|
|
543
|
-
|
|
544
|
-
F:
|
|
322
|
+
invariant2(this.peerId, "Peer id not set.", {
|
|
323
|
+
F: __dxlog_file2,
|
|
545
324
|
L: 47,
|
|
546
325
|
S: this,
|
|
547
326
|
A: [
|
|
@@ -555,12 +334,12 @@ var MeshNetworkAdapter = class extends NetworkAdapter3 {
|
|
|
555
334
|
}, {
|
|
556
335
|
onStartReplication: async (info, remotePeerId) => {
|
|
557
336
|
await this._connected.wait();
|
|
558
|
-
|
|
337
|
+
log("onStartReplication", {
|
|
559
338
|
id: info.id,
|
|
560
339
|
thisPeerId: this.peerId,
|
|
561
340
|
remotePeerId: remotePeerId.toHex()
|
|
562
341
|
}, {
|
|
563
|
-
F:
|
|
342
|
+
F: __dxlog_file2,
|
|
564
343
|
L: 70,
|
|
565
344
|
S: this,
|
|
566
345
|
C: (f, a) => f(...a)
|
|
@@ -568,12 +347,12 @@ var MeshNetworkAdapter = class extends NetworkAdapter3 {
|
|
|
568
347
|
if (!this._extensions.has(info.id)) {
|
|
569
348
|
peerInfo = info;
|
|
570
349
|
this._extensions.set(info.id, extension);
|
|
571
|
-
|
|
350
|
+
log("peer-candidate", {
|
|
572
351
|
id: info.id,
|
|
573
352
|
thisPeerId: this.peerId,
|
|
574
353
|
remotePeerId: remotePeerId.toHex()
|
|
575
354
|
}, {
|
|
576
|
-
F:
|
|
355
|
+
F: __dxlog_file2,
|
|
577
356
|
L: 76,
|
|
578
357
|
S: this,
|
|
579
358
|
C: (f, a) => f(...a)
|
|
@@ -610,7 +389,7 @@ var MeshNetworkAdapter = class extends NetworkAdapter3 {
|
|
|
610
389
|
|
|
611
390
|
// packages/core/echo/echo-pipeline/src/automerge/migrations.ts
|
|
612
391
|
import { IndexedDBStorageAdapter } from "@dxos/automerge/automerge-repo-storage-indexeddb";
|
|
613
|
-
import { log as
|
|
392
|
+
import { log as log2 } from "@dxos/log";
|
|
614
393
|
import { StorageType } from "@dxos/random-access-storage";
|
|
615
394
|
|
|
616
395
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-storage-adapter.ts
|
|
@@ -690,7 +469,7 @@ var AutomergeStorageAdapter = class {
|
|
|
690
469
|
};
|
|
691
470
|
|
|
692
471
|
// packages/core/echo/echo-pipeline/src/automerge/migrations.ts
|
|
693
|
-
var
|
|
472
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/migrations.ts";
|
|
694
473
|
var levelMigration = async ({ db, directory }) => {
|
|
695
474
|
const isNewLevel = !await db.iterator({
|
|
696
475
|
...encodingOptions
|
|
@@ -704,10 +483,10 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
704
483
|
return;
|
|
705
484
|
}
|
|
706
485
|
const batch = db.batch();
|
|
707
|
-
|
|
486
|
+
log2.info("found chunks on old storage adapter", {
|
|
708
487
|
chunks: chunks.length
|
|
709
488
|
}, {
|
|
710
|
-
F:
|
|
489
|
+
F: __dxlog_file3,
|
|
711
490
|
L: 36,
|
|
712
491
|
S: void 0,
|
|
713
492
|
C: (f, a) => f(...a)
|
|
@@ -721,7 +500,7 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
721
500
|
};
|
|
722
501
|
|
|
723
502
|
// packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
|
|
724
|
-
function
|
|
503
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
725
504
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
726
505
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
727
506
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -731,11 +510,10 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
731
510
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
732
511
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
733
512
|
}
|
|
734
|
-
var
|
|
513
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
735
514
|
var AutomergeHost = class {
|
|
736
515
|
constructor({ directory, db, indexMetadataStore }) {
|
|
737
516
|
this._ctx = new Context();
|
|
738
|
-
this._echoNetworkAdapter = new EchoNetworkAdapter();
|
|
739
517
|
/**
|
|
740
518
|
* spaceKey -> deviceKey[]
|
|
741
519
|
*/
|
|
@@ -765,8 +543,7 @@ var AutomergeHost = class {
|
|
|
765
543
|
peerId: this._peerId,
|
|
766
544
|
network: [
|
|
767
545
|
this._clientNetwork,
|
|
768
|
-
this._meshNetwork
|
|
769
|
-
this._echoNetworkAdapter
|
|
546
|
+
this._meshNetwork
|
|
770
547
|
],
|
|
771
548
|
storage: this._storage,
|
|
772
549
|
// TODO(dmaretskyi): Share based on HALO permissions and space affinity.
|
|
@@ -778,22 +555,16 @@ var AutomergeHost = class {
|
|
|
778
555
|
if (!documentId) {
|
|
779
556
|
return false;
|
|
780
557
|
}
|
|
781
|
-
const peerMetadata = this.repo.peerMetadataByPeerId[peerId];
|
|
782
|
-
if (peerMetadata?.dxos_peerSource === "EchoNetworkAdapter") {
|
|
783
|
-
return this._echoNetworkAdapter.shouldAdvertize(peerId, {
|
|
784
|
-
documentId
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
558
|
const doc = this._repo.handles[documentId]?.docSync();
|
|
788
559
|
if (!doc) {
|
|
789
560
|
const isRequested = this._requestedDocs.has(`automerge:${documentId}`);
|
|
790
|
-
|
|
561
|
+
log3("doc share policy check", {
|
|
791
562
|
peerId,
|
|
792
563
|
documentId,
|
|
793
564
|
isRequested
|
|
794
565
|
}, {
|
|
795
|
-
F:
|
|
796
|
-
L:
|
|
566
|
+
F: __dxlog_file4,
|
|
567
|
+
L: 116,
|
|
797
568
|
S: this,
|
|
798
569
|
C: (f, a) => f(...a)
|
|
799
570
|
});
|
|
@@ -802,26 +573,26 @@ var AutomergeHost = class {
|
|
|
802
573
|
try {
|
|
803
574
|
const spaceKey = getSpaceKeyFromDoc(doc);
|
|
804
575
|
if (!spaceKey) {
|
|
805
|
-
|
|
576
|
+
log3("space key not found for share policy check", {
|
|
806
577
|
peerId,
|
|
807
578
|
documentId
|
|
808
579
|
}, {
|
|
809
|
-
F:
|
|
810
|
-
L:
|
|
580
|
+
F: __dxlog_file4,
|
|
581
|
+
L: 123,
|
|
811
582
|
S: this,
|
|
812
583
|
C: (f, a) => f(...a)
|
|
813
584
|
});
|
|
814
585
|
return false;
|
|
815
586
|
}
|
|
816
587
|
const authorizedDevices = this._authorizedDevices.get(PublicKey.from(spaceKey));
|
|
817
|
-
const deviceKeyHex =
|
|
588
|
+
const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
|
|
818
589
|
if (!deviceKeyHex) {
|
|
819
|
-
|
|
590
|
+
log3("device key not found for share policy check", {
|
|
820
591
|
peerId,
|
|
821
592
|
documentId
|
|
822
593
|
}, {
|
|
823
|
-
F:
|
|
824
|
-
L:
|
|
594
|
+
F: __dxlog_file4,
|
|
595
|
+
L: 132,
|
|
825
596
|
S: this,
|
|
826
597
|
C: (f, a) => f(...a)
|
|
827
598
|
});
|
|
@@ -829,7 +600,7 @@ var AutomergeHost = class {
|
|
|
829
600
|
}
|
|
830
601
|
const deviceKey = PublicKey.from(deviceKeyHex);
|
|
831
602
|
const isAuthorized = authorizedDevices?.has(deviceKey) ?? false;
|
|
832
|
-
|
|
603
|
+
log3("share policy check", {
|
|
833
604
|
localPeer: this._peerId,
|
|
834
605
|
remotePeer: peerId,
|
|
835
606
|
documentId,
|
|
@@ -837,16 +608,16 @@ var AutomergeHost = class {
|
|
|
837
608
|
spaceKey,
|
|
838
609
|
isAuthorized
|
|
839
610
|
}, {
|
|
840
|
-
F:
|
|
841
|
-
L:
|
|
611
|
+
F: __dxlog_file4,
|
|
612
|
+
L: 138,
|
|
842
613
|
S: this,
|
|
843
614
|
C: (f, a) => f(...a)
|
|
844
615
|
});
|
|
845
616
|
return isAuthorized;
|
|
846
617
|
} catch (err) {
|
|
847
|
-
|
|
848
|
-
F:
|
|
849
|
-
L:
|
|
618
|
+
log3.catch(err, void 0, {
|
|
619
|
+
F: __dxlog_file4,
|
|
620
|
+
L: 148,
|
|
850
621
|
S: this,
|
|
851
622
|
C: (f, a) => f(...a)
|
|
852
623
|
});
|
|
@@ -856,25 +627,16 @@ var AutomergeHost = class {
|
|
|
856
627
|
});
|
|
857
628
|
this._clientNetwork.ready();
|
|
858
629
|
this._meshNetwork.ready();
|
|
859
|
-
await this._echoNetworkAdapter.open();
|
|
860
630
|
await this._clientNetwork.whenConnected();
|
|
861
|
-
await this._echoNetworkAdapter.whenConnected();
|
|
862
631
|
}
|
|
863
632
|
async close() {
|
|
864
633
|
await this._storage.close?.();
|
|
865
634
|
await this._clientNetwork.close();
|
|
866
|
-
await this._echoNetworkAdapter.close();
|
|
867
635
|
await this._ctx.dispose();
|
|
868
636
|
}
|
|
869
637
|
get repo() {
|
|
870
638
|
return this._repo;
|
|
871
639
|
}
|
|
872
|
-
async addReplicator(replicator) {
|
|
873
|
-
await this._echoNetworkAdapter.addReplicator(replicator);
|
|
874
|
-
}
|
|
875
|
-
async removeReplicator(replicator) {
|
|
876
|
-
await this._echoNetworkAdapter.removeReplicator(replicator);
|
|
877
|
-
}
|
|
878
640
|
async _beforeSave({ path, batch }) {
|
|
879
641
|
const handle = this._repo.handles[path[0]];
|
|
880
642
|
if (!handle) {
|
|
@@ -932,9 +694,9 @@ var AutomergeHost = class {
|
|
|
932
694
|
//
|
|
933
695
|
async flush({ states }) {
|
|
934
696
|
await Promise.all(states?.map(async ({ heads, documentId }) => {
|
|
935
|
-
|
|
936
|
-
F:
|
|
937
|
-
L:
|
|
697
|
+
invariant3(heads, "heads are required for flush", {
|
|
698
|
+
F: __dxlog_file4,
|
|
699
|
+
L: 233,
|
|
938
700
|
S: this,
|
|
939
701
|
A: [
|
|
940
702
|
"heads",
|
|
@@ -962,37 +724,37 @@ var AutomergeHost = class {
|
|
|
962
724
|
return this._meshNetwork.createExtension();
|
|
963
725
|
}
|
|
964
726
|
authorizeDevice(spaceKey, deviceKey) {
|
|
965
|
-
|
|
727
|
+
log3("authorizeDevice", {
|
|
966
728
|
spaceKey,
|
|
967
729
|
deviceKey
|
|
968
730
|
}, {
|
|
969
|
-
F:
|
|
970
|
-
L:
|
|
731
|
+
F: __dxlog_file4,
|
|
732
|
+
L: 263,
|
|
971
733
|
S: this,
|
|
972
734
|
C: (f, a) => f(...a)
|
|
973
735
|
});
|
|
974
736
|
defaultMap(this._authorizedDevices, spaceKey, () => new ComplexSet(PublicKey.hash)).add(deviceKey);
|
|
975
737
|
}
|
|
976
738
|
};
|
|
977
|
-
|
|
739
|
+
_ts_decorate([
|
|
978
740
|
trace.info()
|
|
979
741
|
], AutomergeHost.prototype, "_peerId", void 0);
|
|
980
|
-
|
|
742
|
+
_ts_decorate([
|
|
981
743
|
trace.info({
|
|
982
744
|
depth: null
|
|
983
745
|
})
|
|
984
746
|
], AutomergeHost.prototype, "_automergeDocs", null);
|
|
985
|
-
|
|
747
|
+
_ts_decorate([
|
|
986
748
|
trace.info({
|
|
987
749
|
depth: null
|
|
988
750
|
})
|
|
989
751
|
], AutomergeHost.prototype, "_automergePeers", null);
|
|
990
|
-
|
|
752
|
+
_ts_decorate([
|
|
991
753
|
trace.span({
|
|
992
754
|
showInBrowserTimeline: true
|
|
993
755
|
})
|
|
994
756
|
], AutomergeHost.prototype, "flush", null);
|
|
995
|
-
AutomergeHost =
|
|
757
|
+
AutomergeHost = _ts_decorate([
|
|
996
758
|
trace.resource()
|
|
997
759
|
], AutomergeHost);
|
|
998
760
|
var getSpaceKeyFromDoc = (doc) => {
|
|
@@ -1025,10 +787,10 @@ var changeIsPresentInDoc = (doc, changeHash) => {
|
|
|
1025
787
|
import { Event as Event2 } from "@dxos/async";
|
|
1026
788
|
import { cancelWithContext } from "@dxos/context";
|
|
1027
789
|
import { warnAfterTimeout } from "@dxos/debug";
|
|
1028
|
-
import { invariant as
|
|
1029
|
-
import { log as
|
|
790
|
+
import { invariant as invariant4 } from "@dxos/invariant";
|
|
791
|
+
import { log as log4 } from "@dxos/log";
|
|
1030
792
|
import { trace as trace2 } from "@dxos/tracing";
|
|
1031
|
-
function
|
|
793
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1032
794
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1033
795
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1034
796
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1038,7 +800,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1038
800
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1039
801
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1040
802
|
}
|
|
1041
|
-
var
|
|
803
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
1042
804
|
var AutomergeDocumentLoaderImpl = class {
|
|
1043
805
|
constructor(_spaceKey, _repo) {
|
|
1044
806
|
this._spaceKey = _spaceKey;
|
|
@@ -1049,21 +811,20 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1049
811
|
this.onObjectDocumentLoaded = new Event2();
|
|
1050
812
|
}
|
|
1051
813
|
getAllHandles() {
|
|
1052
|
-
return
|
|
1053
|
-
this._spaceRootDocHandle,
|
|
814
|
+
return [
|
|
1054
815
|
...new Set(this._objectDocumentHandles.values())
|
|
1055
|
-
]
|
|
816
|
+
];
|
|
1056
817
|
}
|
|
1057
818
|
async loadSpaceRootDocHandle(ctx, spaceState) {
|
|
1058
819
|
if (this._spaceRootDocHandle != null) {
|
|
1059
820
|
return;
|
|
1060
821
|
}
|
|
1061
822
|
if (!spaceState.rootUrl) {
|
|
1062
|
-
|
|
823
|
+
log4.error("Database opened with no rootUrl", {
|
|
1063
824
|
spaceKey: this._spaceKey
|
|
1064
825
|
}, {
|
|
1065
|
-
F:
|
|
1066
|
-
L:
|
|
826
|
+
F: __dxlog_file5,
|
|
827
|
+
L: 68,
|
|
1067
828
|
S: this,
|
|
1068
829
|
C: (f, a) => f(...a)
|
|
1069
830
|
});
|
|
@@ -1071,9 +832,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1071
832
|
} else {
|
|
1072
833
|
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
1073
834
|
const doc = existingDocHandle.docSync();
|
|
1074
|
-
|
|
1075
|
-
F:
|
|
1076
|
-
L:
|
|
835
|
+
invariant4(doc, void 0, {
|
|
836
|
+
F: __dxlog_file5,
|
|
837
|
+
L: 73,
|
|
1077
838
|
S: this,
|
|
1078
839
|
A: [
|
|
1079
840
|
"doc",
|
|
@@ -1093,9 +854,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1093
854
|
let hasUrlsToLoad = false;
|
|
1094
855
|
const urlsToLoad = {};
|
|
1095
856
|
for (const objectId of objectIds) {
|
|
1096
|
-
|
|
1097
|
-
F:
|
|
1098
|
-
L:
|
|
857
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
858
|
+
F: __dxlog_file5,
|
|
859
|
+
L: 86,
|
|
1099
860
|
S: this,
|
|
1100
861
|
A: [
|
|
1101
862
|
"this._spaceRootDocHandle",
|
|
@@ -1106,9 +867,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1106
867
|
continue;
|
|
1107
868
|
}
|
|
1108
869
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
1109
|
-
|
|
1110
|
-
F:
|
|
1111
|
-
L:
|
|
870
|
+
invariant4(spaceRootDoc, void 0, {
|
|
871
|
+
F: __dxlog_file5,
|
|
872
|
+
L: 91,
|
|
1112
873
|
S: this,
|
|
1113
874
|
A: [
|
|
1114
875
|
"spaceRootDoc",
|
|
@@ -1118,11 +879,11 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1118
879
|
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
1119
880
|
if (documentUrl == null) {
|
|
1120
881
|
this._objectsPendingDocumentLoad.add(objectId);
|
|
1121
|
-
|
|
882
|
+
log4.info("loading delayed until object links are initialized", {
|
|
1122
883
|
objectId
|
|
1123
884
|
}, {
|
|
1124
|
-
F:
|
|
1125
|
-
L:
|
|
885
|
+
F: __dxlog_file5,
|
|
886
|
+
L: 95,
|
|
1126
887
|
S: this,
|
|
1127
888
|
C: (f, a) => f(...a)
|
|
1128
889
|
});
|
|
@@ -1144,9 +905,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1144
905
|
linksAwaitingLoad.forEach(([objectId]) => this._objectsPendingDocumentLoad.delete(objectId));
|
|
1145
906
|
}
|
|
1146
907
|
getSpaceRootDocHandle() {
|
|
1147
|
-
|
|
1148
|
-
F:
|
|
1149
|
-
L:
|
|
908
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
909
|
+
F: __dxlog_file5,
|
|
910
|
+
L: 118,
|
|
1150
911
|
S: this,
|
|
1151
912
|
A: [
|
|
1152
913
|
"this._spaceRootDocHandle",
|
|
@@ -1156,9 +917,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1156
917
|
return this._spaceRootDocHandle;
|
|
1157
918
|
}
|
|
1158
919
|
createDocumentForObject(objectId) {
|
|
1159
|
-
|
|
1160
|
-
F:
|
|
1161
|
-
L:
|
|
920
|
+
invariant4(this._spaceRootDocHandle, void 0, {
|
|
921
|
+
F: __dxlog_file5,
|
|
922
|
+
L: 123,
|
|
1162
923
|
S: this,
|
|
1163
924
|
A: [
|
|
1164
925
|
"this._spaceRootDocHandle",
|
|
@@ -1196,30 +957,30 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1196
957
|
};
|
|
1197
958
|
const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
|
|
1198
959
|
if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
|
|
1199
|
-
|
|
960
|
+
log4.warn("object already inlined in a different document, ignoring the link", {
|
|
1200
961
|
...logMeta,
|
|
1201
962
|
actualDocumentUrl: objectDocumentHandle.url
|
|
1202
963
|
}, {
|
|
1203
|
-
F:
|
|
1204
|
-
L:
|
|
964
|
+
F: __dxlog_file5,
|
|
965
|
+
L: 153,
|
|
1205
966
|
S: this,
|
|
1206
967
|
C: (f, a) => f(...a)
|
|
1207
968
|
});
|
|
1208
969
|
continue;
|
|
1209
970
|
}
|
|
1210
971
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
1211
|
-
|
|
1212
|
-
F:
|
|
1213
|
-
L:
|
|
972
|
+
log4.warn("object document was already loaded", logMeta, {
|
|
973
|
+
F: __dxlog_file5,
|
|
974
|
+
L: 160,
|
|
1214
975
|
S: this,
|
|
1215
976
|
C: (f, a) => f(...a)
|
|
1216
977
|
});
|
|
1217
978
|
continue;
|
|
1218
979
|
}
|
|
1219
980
|
const handle = this._repo.find(automergeUrl);
|
|
1220
|
-
|
|
1221
|
-
F:
|
|
1222
|
-
L:
|
|
981
|
+
log4.debug("document loading triggered", logMeta, {
|
|
982
|
+
F: __dxlog_file5,
|
|
983
|
+
L: 164,
|
|
1223
984
|
S: this,
|
|
1224
985
|
C: (f, a) => f(...a)
|
|
1225
986
|
});
|
|
@@ -1237,12 +998,12 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1237
998
|
break;
|
|
1238
999
|
} catch (err) {
|
|
1239
1000
|
if (`${err}`.includes("Timeout")) {
|
|
1240
|
-
|
|
1001
|
+
log4.info("wraparound", {
|
|
1241
1002
|
id: docHandle.documentId,
|
|
1242
1003
|
state: docHandle.state
|
|
1243
1004
|
}, {
|
|
1244
|
-
F:
|
|
1245
|
-
L:
|
|
1005
|
+
F: __dxlog_file5,
|
|
1006
|
+
L: 180,
|
|
1246
1007
|
S: this,
|
|
1247
1008
|
C: (f, a) => f(...a)
|
|
1248
1009
|
});
|
|
@@ -1282,9 +1043,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1282
1043
|
docUrl: handle.url
|
|
1283
1044
|
};
|
|
1284
1045
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1285
|
-
|
|
1286
|
-
F:
|
|
1287
|
-
L:
|
|
1046
|
+
log4.info("document loaded after all listeners were removed", logMeta, {
|
|
1047
|
+
F: __dxlog_file5,
|
|
1048
|
+
L: 216,
|
|
1288
1049
|
S: this,
|
|
1289
1050
|
C: (f, a) => f(...a)
|
|
1290
1051
|
});
|
|
@@ -1292,9 +1053,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1292
1053
|
}
|
|
1293
1054
|
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1294
1055
|
if (objectDocHandle?.url !== handle.url) {
|
|
1295
|
-
|
|
1296
|
-
F:
|
|
1297
|
-
L:
|
|
1056
|
+
log4.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1057
|
+
F: __dxlog_file5,
|
|
1058
|
+
L: 221,
|
|
1298
1059
|
S: this,
|
|
1299
1060
|
C: (f, a) => f(...a)
|
|
1300
1061
|
});
|
|
@@ -1306,14 +1067,14 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1306
1067
|
});
|
|
1307
1068
|
} catch (err) {
|
|
1308
1069
|
const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
|
|
1309
|
-
|
|
1070
|
+
log4.warn("failed to load a document", {
|
|
1310
1071
|
objectId,
|
|
1311
1072
|
automergeUrl: handle.url,
|
|
1312
1073
|
retryLoading: shouldRetryLoading,
|
|
1313
1074
|
err
|
|
1314
1075
|
}, {
|
|
1315
|
-
F:
|
|
1316
|
-
L:
|
|
1076
|
+
F: __dxlog_file5,
|
|
1077
|
+
L: 227,
|
|
1317
1078
|
S: this,
|
|
1318
1079
|
C: (f, a) => f(...a)
|
|
1319
1080
|
});
|
|
@@ -1323,12 +1084,12 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1323
1084
|
}
|
|
1324
1085
|
}
|
|
1325
1086
|
};
|
|
1326
|
-
|
|
1087
|
+
_ts_decorate2([
|
|
1327
1088
|
trace2.span({
|
|
1328
1089
|
showInBrowserTimeline: true
|
|
1329
1090
|
})
|
|
1330
1091
|
], AutomergeDocumentLoaderImpl.prototype, "loadSpaceRootDocHandle", null);
|
|
1331
|
-
AutomergeDocumentLoaderImpl =
|
|
1092
|
+
AutomergeDocumentLoaderImpl = _ts_decorate2([
|
|
1332
1093
|
trace2.resource()
|
|
1333
1094
|
], AutomergeDocumentLoaderImpl);
|
|
1334
1095
|
export {
|