@dxos/echo-pipeline 0.4.10-main.3e35a2f → 0.4.10-main.3f5e2d2
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-SYE4EK33.mjs → chunk-KMWJLYEQ.mjs} +52 -27
- package/dist/lib/browser/{chunk-SYE4EK33.mjs.map → chunk-KMWJLYEQ.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +192 -171
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -2
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-WCTX6RNS.cjs → chunk-YZA42CKA.cjs} +55 -30
- package/dist/lib/node/chunk-YZA42CKA.cjs.map +7 -0
- package/dist/lib/node/index.cjs +221 -198
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +14 -12
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-host.d.ts +7 -14
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts +2 -0
- package/dist/types/src/automerge/automerge-repo.test.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/dist/types/src/automerge/leveldb-storage-adapter.d.ts +11 -8
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/local-host-network-adapter.d.ts +8 -1
- package/dist/types/src/automerge/local-host-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/migrations.d.ts +2 -2
- package/dist/types/src/automerge/reference.d.ts +1 -1
- package/dist/types/src/automerge/reference.d.ts.map +1 -1
- package/dist/types/src/automerge/types.d.ts +4 -3
- package/dist/types/src/automerge/types.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +3 -1
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +3 -1
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +2 -1
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/level.d.ts +2 -2
- package/dist/types/src/testing/level.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/automerge/automerge-doc-loader.ts +3 -0
- package/src/automerge/automerge-host.test.ts +26 -17
- package/src/automerge/automerge-host.ts +59 -98
- package/src/automerge/automerge-repo.test.ts +61 -0
- package/src/automerge/index.ts +1 -0
- package/src/automerge/level.test.ts +41 -2
- package/src/automerge/leveldb-storage-adapter.ts +36 -24
- package/src/automerge/local-host-network-adapter.ts +19 -13
- package/src/automerge/migrations.ts +2 -2
- package/src/automerge/reference.ts +1 -1
- package/src/automerge/storage-adapter.test.ts +4 -4
- package/src/automerge/types.ts +4 -3
- package/src/space/control-pipeline.ts +11 -1
- package/src/space/space-manager.ts +4 -0
- package/src/space/space.ts +11 -1
- package/src/testing/level.ts +3 -2
- package/src/testing/test-agent-builder.ts +1 -0
- package/dist/lib/node/chunk-WCTX6RNS.cjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -18,93 +18,109 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var node_exports = {};
|
|
20
20
|
__export(node_exports, {
|
|
21
|
-
AuthExtension: () =>
|
|
22
|
-
AuthStatus: () =>
|
|
21
|
+
AuthExtension: () => import_chunk_YZA42CKA.AuthExtension,
|
|
22
|
+
AuthStatus: () => import_chunk_YZA42CKA.AuthStatus,
|
|
23
23
|
AutomergeDocumentLoaderImpl: () => AutomergeDocumentLoaderImpl,
|
|
24
24
|
AutomergeHost: () => AutomergeHost,
|
|
25
25
|
AutomergeStorageAdapter: () => AutomergeStorageAdapter,
|
|
26
|
-
DataServiceImpl: () =>
|
|
26
|
+
DataServiceImpl: () => import_chunk_YZA42CKA.DataServiceImpl,
|
|
27
|
+
LevelDBStorageAdapter: () => LevelDBStorageAdapter,
|
|
27
28
|
LocalHostNetworkAdapter: () => LocalHostNetworkAdapter,
|
|
28
|
-
MOCK_AUTH_PROVIDER: () =>
|
|
29
|
-
MOCK_AUTH_VERIFIER: () =>
|
|
29
|
+
MOCK_AUTH_PROVIDER: () => import_chunk_YZA42CKA.MOCK_AUTH_PROVIDER,
|
|
30
|
+
MOCK_AUTH_VERIFIER: () => import_chunk_YZA42CKA.MOCK_AUTH_VERIFIER,
|
|
30
31
|
MeshNetworkAdapter: () => MeshNetworkAdapter,
|
|
31
|
-
MetadataStore: () =>
|
|
32
|
-
Pipeline: () =>
|
|
32
|
+
MetadataStore: () => import_chunk_YZA42CKA.MetadataStore,
|
|
33
|
+
Pipeline: () => import_chunk_YZA42CKA.Pipeline,
|
|
33
34
|
REFERENCE_TYPE_TAG: () => REFERENCE_TYPE_TAG,
|
|
34
|
-
SnapshotManager: () =>
|
|
35
|
-
SnapshotStore: () =>
|
|
36
|
-
Space: () =>
|
|
37
|
-
SpaceManager: () =>
|
|
38
|
-
SpaceProtocol: () =>
|
|
39
|
-
SpaceProtocolSession: () =>
|
|
40
|
-
TimeframeClock: () =>
|
|
41
|
-
codec: () =>
|
|
42
|
-
createMappedFeedWriter: () =>
|
|
35
|
+
SnapshotManager: () => import_chunk_YZA42CKA.SnapshotManager,
|
|
36
|
+
SnapshotStore: () => import_chunk_YZA42CKA.SnapshotStore,
|
|
37
|
+
Space: () => import_chunk_YZA42CKA.Space,
|
|
38
|
+
SpaceManager: () => import_chunk_YZA42CKA.SpaceManager,
|
|
39
|
+
SpaceProtocol: () => import_chunk_YZA42CKA.SpaceProtocol,
|
|
40
|
+
SpaceProtocolSession: () => import_chunk_YZA42CKA.SpaceProtocolSession,
|
|
41
|
+
TimeframeClock: () => import_chunk_YZA42CKA.TimeframeClock,
|
|
42
|
+
codec: () => import_chunk_YZA42CKA.codec,
|
|
43
|
+
createMappedFeedWriter: () => import_chunk_YZA42CKA.createMappedFeedWriter,
|
|
43
44
|
decodeReference: () => decodeReference,
|
|
44
45
|
encodeReference: () => encodeReference,
|
|
46
|
+
encodingOptions: () => encodingOptions,
|
|
45
47
|
getSpaceKeyFromDoc: () => getSpaceKeyFromDoc,
|
|
46
|
-
hasInvitationExpired: () =>
|
|
48
|
+
hasInvitationExpired: () => import_chunk_YZA42CKA.hasInvitationExpired,
|
|
47
49
|
isEncodedReferenceObject: () => isEncodedReferenceObject,
|
|
48
|
-
mapFeedIndexesToTimeframe: () =>
|
|
49
|
-
mapTimeframeToFeedIndexes: () =>
|
|
50
|
-
startAfter: () =>
|
|
51
|
-
valueEncoding: () =>
|
|
50
|
+
mapFeedIndexesToTimeframe: () => import_chunk_YZA42CKA.mapFeedIndexesToTimeframe,
|
|
51
|
+
mapTimeframeToFeedIndexes: () => import_chunk_YZA42CKA.mapTimeframeToFeedIndexes,
|
|
52
|
+
startAfter: () => import_chunk_YZA42CKA.startAfter,
|
|
53
|
+
valueEncoding: () => import_chunk_YZA42CKA.valueEncoding
|
|
52
54
|
});
|
|
53
55
|
module.exports = __toCommonJS(node_exports);
|
|
54
|
-
var
|
|
56
|
+
var import_chunk_YZA42CKA = require("./chunk-YZA42CKA.cjs");
|
|
57
|
+
var import_async = require("@dxos/async");
|
|
55
58
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
56
59
|
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
57
60
|
var import_context = require("@dxos/context");
|
|
61
|
+
var import_invariant = require("@dxos/invariant");
|
|
58
62
|
var import_keys = require("@dxos/keys");
|
|
59
63
|
var import_log = require("@dxos/log");
|
|
60
|
-
var import_protocols = require("@dxos/protocols");
|
|
61
64
|
var import_tracing = require("@dxos/tracing");
|
|
62
65
|
var import_util = require("@dxos/util");
|
|
63
|
-
var
|
|
66
|
+
var import_context2 = require("@dxos/context");
|
|
67
|
+
var import_async2 = require("@dxos/async");
|
|
64
68
|
var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
|
|
65
69
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
|
-
var import_invariant = require("@dxos/invariant");
|
|
67
|
-
var import_log2 = require("@dxos/log");
|
|
68
|
-
var import_async2 = require("@dxos/async");
|
|
69
|
-
var import_automerge_repo3 = require("@dxos/automerge/automerge-repo");
|
|
70
70
|
var import_invariant2 = require("@dxos/invariant");
|
|
71
|
-
var
|
|
71
|
+
var import_async3 = require("@dxos/async");
|
|
72
|
+
var import_automerge_repo3 = require("@dxos/automerge/automerge-repo");
|
|
73
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
74
|
+
var import_log2 = require("@dxos/log");
|
|
72
75
|
var import_teleport_extension_automerge_replicator = require("@dxos/teleport-extension-automerge-replicator");
|
|
73
76
|
var import_automerge_repo_storage_indexeddb = require("@dxos/automerge/automerge-repo-storage-indexeddb");
|
|
74
|
-
var
|
|
77
|
+
var import_log3 = require("@dxos/log");
|
|
75
78
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
76
79
|
var import_util2 = require("@dxos/util");
|
|
77
|
-
var
|
|
78
|
-
var
|
|
80
|
+
var import_async4 = require("@dxos/async");
|
|
81
|
+
var import_context3 = require("@dxos/context");
|
|
79
82
|
var import_debug = require("@dxos/debug");
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
83
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
84
|
+
var import_log4 = require("@dxos/log");
|
|
85
|
+
var import_tracing2 = require("@dxos/tracing");
|
|
86
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
87
|
+
var LevelDBStorageAdapter = class extends import_context2.Resource {
|
|
84
88
|
constructor(_params) {
|
|
89
|
+
super();
|
|
85
90
|
this._params = _params;
|
|
86
|
-
this._state = "opened";
|
|
87
91
|
}
|
|
88
92
|
async load(keyArray) {
|
|
89
|
-
|
|
90
|
-
|
|
93
|
+
try {
|
|
94
|
+
if (this._lifecycleState !== import_context2.LifecycleState.OPEN) {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
return await this._params.db.get(keyArray, {
|
|
98
|
+
...encodingOptions
|
|
99
|
+
});
|
|
100
|
+
} catch (err) {
|
|
101
|
+
if (isLevelDbNotFoundError(err)) {
|
|
102
|
+
return void 0;
|
|
103
|
+
}
|
|
104
|
+
throw err;
|
|
91
105
|
}
|
|
92
|
-
return this._params.db.get(keyArray, {
|
|
93
|
-
...encodingOptions
|
|
94
|
-
}).catch((err) => err.code === "LEVEL_NOT_FOUND" ? void 0 : Promise.reject(err));
|
|
95
106
|
}
|
|
96
107
|
async save(keyArray, binary) {
|
|
97
|
-
if (this.
|
|
108
|
+
if (this._lifecycleState !== import_context2.LifecycleState.OPEN) {
|
|
98
109
|
return void 0;
|
|
99
110
|
}
|
|
100
|
-
|
|
101
|
-
await this._params.
|
|
111
|
+
const batch = this._params.db.batch();
|
|
112
|
+
await this._params.callbacks?.beforeSave?.({
|
|
113
|
+
path: keyArray,
|
|
114
|
+
batch
|
|
115
|
+
});
|
|
116
|
+
batch.put(keyArray, Buffer.from(binary), {
|
|
102
117
|
...encodingOptions
|
|
103
118
|
});
|
|
119
|
+
await batch.write();
|
|
104
120
|
await this._params.callbacks?.afterSave?.(keyArray);
|
|
105
121
|
}
|
|
106
122
|
async remove(keyArray) {
|
|
107
|
-
if (this.
|
|
123
|
+
if (this._lifecycleState !== import_context2.LifecycleState.OPEN) {
|
|
108
124
|
return void 0;
|
|
109
125
|
}
|
|
110
126
|
await this._params.db.del(keyArray, {
|
|
@@ -112,7 +128,7 @@ var LevelDBStorageAdapter = class {
|
|
|
112
128
|
});
|
|
113
129
|
}
|
|
114
130
|
async loadRange(keyPrefix) {
|
|
115
|
-
if (this.
|
|
131
|
+
if (this._lifecycleState !== import_context2.LifecycleState.OPEN) {
|
|
116
132
|
return [];
|
|
117
133
|
}
|
|
118
134
|
const result = [];
|
|
@@ -132,7 +148,7 @@ var LevelDBStorageAdapter = class {
|
|
|
132
148
|
return result;
|
|
133
149
|
}
|
|
134
150
|
async removeRange(keyPrefix) {
|
|
135
|
-
if (this.
|
|
151
|
+
if (this._lifecycleState !== import_context2.LifecycleState.OPEN) {
|
|
136
152
|
return void 0;
|
|
137
153
|
}
|
|
138
154
|
const batch = this._params.db.batch();
|
|
@@ -150,9 +166,6 @@ var LevelDBStorageAdapter = class {
|
|
|
150
166
|
}
|
|
151
167
|
await batch.write();
|
|
152
168
|
}
|
|
153
|
-
close() {
|
|
154
|
-
this._state = "closed";
|
|
155
|
-
}
|
|
156
169
|
};
|
|
157
170
|
var keyEncoder = {
|
|
158
171
|
encode: (key) => Buffer.from(key.map((k) => k.replaceAll("%", "%25").replaceAll("-", "%2D")).join("-")),
|
|
@@ -162,12 +175,14 @@ var encodingOptions = {
|
|
|
162
175
|
keyEncoding: keyEncoder,
|
|
163
176
|
valueEncoding: "buffer"
|
|
164
177
|
};
|
|
178
|
+
var isLevelDbNotFoundError = (err) => err.code === "LEVEL_NOT_FOUND";
|
|
165
179
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/local-host-network-adapter.ts";
|
|
166
180
|
var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
|
|
167
181
|
constructor() {
|
|
168
182
|
super(...arguments);
|
|
169
183
|
this._peers = /* @__PURE__ */ new Map();
|
|
170
|
-
this._connected = new
|
|
184
|
+
this._connected = new import_async2.Trigger();
|
|
185
|
+
this._isConnected = false;
|
|
171
186
|
}
|
|
172
187
|
/**
|
|
173
188
|
* Emits `ready` event. That signals to `Repo` that it can start using the adapter.
|
|
@@ -177,15 +192,21 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
177
192
|
network: this
|
|
178
193
|
});
|
|
179
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Called by `Repo` to connect to the network.
|
|
197
|
+
*
|
|
198
|
+
* @param peerId Our peer Id.
|
|
199
|
+
*/
|
|
180
200
|
connect(peerId) {
|
|
181
201
|
this.peerId = peerId;
|
|
202
|
+
this._isConnected = true;
|
|
182
203
|
this._connected.wake();
|
|
183
204
|
}
|
|
184
205
|
send(message) {
|
|
185
206
|
const peer = this._peers.get(message.targetId);
|
|
186
|
-
(0,
|
|
207
|
+
(0, import_invariant2.invariant)(peer, "Peer not found.", {
|
|
187
208
|
F: __dxlog_file,
|
|
188
|
-
L:
|
|
209
|
+
L: 51,
|
|
189
210
|
S: this,
|
|
190
211
|
A: [
|
|
191
212
|
"peer",
|
|
@@ -200,12 +221,17 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
200
221
|
}
|
|
201
222
|
disconnect() {
|
|
202
223
|
}
|
|
224
|
+
async whenConnected() {
|
|
225
|
+
await this._connected.wait({
|
|
226
|
+
timeout: 1e4
|
|
227
|
+
});
|
|
228
|
+
}
|
|
203
229
|
syncRepo({ id, syncMessage }) {
|
|
204
230
|
const peerId = this._getPeerId(id);
|
|
205
231
|
return new import_codec_protobuf.Stream(({ next, close }) => {
|
|
206
|
-
(0,
|
|
232
|
+
(0, import_invariant2.invariant)(!this._peers.has(peerId), "Peer already connected.", {
|
|
207
233
|
F: __dxlog_file,
|
|
208
|
-
L:
|
|
234
|
+
L: 73,
|
|
209
235
|
S: this,
|
|
210
236
|
A: [
|
|
211
237
|
"!this._peers.has(peerId)",
|
|
@@ -227,35 +253,47 @@ var LocalHostNetworkAdapter = class extends import_automerge_repo2.NetworkAdapte
|
|
|
227
253
|
});
|
|
228
254
|
}
|
|
229
255
|
});
|
|
230
|
-
this.
|
|
231
|
-
timeout: 1e3
|
|
232
|
-
}).then(() => {
|
|
233
|
-
this.emit("peer-candidate", {
|
|
234
|
-
peerMetadata: {},
|
|
235
|
-
peerId
|
|
236
|
-
});
|
|
237
|
-
}).catch((err) => import_log2.log.catch(err, void 0, {
|
|
256
|
+
(0, import_invariant2.invariant)(this._isConnected, void 0, {
|
|
238
257
|
F: __dxlog_file,
|
|
239
|
-
L:
|
|
258
|
+
L: 90,
|
|
240
259
|
S: this,
|
|
241
|
-
|
|
242
|
-
|
|
260
|
+
A: [
|
|
261
|
+
"this._isConnected",
|
|
262
|
+
""
|
|
263
|
+
]
|
|
264
|
+
});
|
|
265
|
+
this.emit("peer-candidate", {
|
|
266
|
+
peerMetadata: {},
|
|
267
|
+
peerId
|
|
268
|
+
});
|
|
243
269
|
});
|
|
244
270
|
}
|
|
245
271
|
async sendSyncMessage({ id, syncMessage }) {
|
|
246
|
-
|
|
247
|
-
|
|
272
|
+
(0, import_invariant2.invariant)(this._isConnected, void 0, {
|
|
273
|
+
F: __dxlog_file,
|
|
274
|
+
L: 99,
|
|
275
|
+
S: this,
|
|
276
|
+
A: [
|
|
277
|
+
"this._isConnected",
|
|
278
|
+
""
|
|
279
|
+
]
|
|
248
280
|
});
|
|
249
281
|
const message = import_automerge_repo2.cbor.decode(syncMessage);
|
|
250
282
|
this.emit("message", message);
|
|
251
283
|
}
|
|
252
284
|
async getHostInfo() {
|
|
253
|
-
|
|
254
|
-
|
|
285
|
+
(0, import_invariant2.invariant)(this._isConnected, void 0, {
|
|
286
|
+
F: __dxlog_file,
|
|
287
|
+
L: 105,
|
|
288
|
+
S: this,
|
|
289
|
+
A: [
|
|
290
|
+
"this._isConnected",
|
|
291
|
+
""
|
|
292
|
+
]
|
|
255
293
|
});
|
|
256
|
-
(0,
|
|
294
|
+
(0, import_invariant2.invariant)(this.peerId, "Peer id not set.", {
|
|
257
295
|
F: __dxlog_file,
|
|
258
|
-
L:
|
|
296
|
+
L: 106,
|
|
259
297
|
S: this,
|
|
260
298
|
A: [
|
|
261
299
|
"this.peerId",
|
|
@@ -275,7 +313,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
275
313
|
constructor() {
|
|
276
314
|
super(...arguments);
|
|
277
315
|
this._extensions = /* @__PURE__ */ new Map();
|
|
278
|
-
this._connected = new
|
|
316
|
+
this._connected = new import_async3.Trigger();
|
|
279
317
|
}
|
|
280
318
|
/**
|
|
281
319
|
* Emits `ready` event. That signals to `Repo` that it can start using the adapter.
|
|
@@ -292,7 +330,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
292
330
|
send(message) {
|
|
293
331
|
const receiverId = message.targetId;
|
|
294
332
|
const extension = this._extensions.get(receiverId);
|
|
295
|
-
(0,
|
|
333
|
+
(0, import_invariant3.invariant)(extension, "Extension not found.", {
|
|
296
334
|
F: __dxlog_file2,
|
|
297
335
|
L: 38,
|
|
298
336
|
S: this,
|
|
@@ -303,7 +341,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
303
341
|
});
|
|
304
342
|
extension.sendSyncMessage({
|
|
305
343
|
payload: import_automerge_repo3.cbor.encode(message)
|
|
306
|
-
}).catch((err) =>
|
|
344
|
+
}).catch((err) => import_log2.log.catch(err, void 0, {
|
|
307
345
|
F: __dxlog_file2,
|
|
308
346
|
L: 39,
|
|
309
347
|
S: this,
|
|
@@ -313,7 +351,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
313
351
|
disconnect() {
|
|
314
352
|
}
|
|
315
353
|
createExtension() {
|
|
316
|
-
(0,
|
|
354
|
+
(0, import_invariant3.invariant)(this.peerId, "Peer id not set.", {
|
|
317
355
|
F: __dxlog_file2,
|
|
318
356
|
L: 47,
|
|
319
357
|
S: this,
|
|
@@ -328,7 +366,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
328
366
|
}, {
|
|
329
367
|
onStartReplication: async (info, remotePeerId) => {
|
|
330
368
|
await this._connected.wait();
|
|
331
|
-
(0,
|
|
369
|
+
(0, import_log2.log)("onStartReplication", {
|
|
332
370
|
id: info.id,
|
|
333
371
|
thisPeerId: this.peerId,
|
|
334
372
|
remotePeerId: remotePeerId.toHex()
|
|
@@ -341,7 +379,7 @@ var MeshNetworkAdapter = class extends import_automerge_repo3.NetworkAdapter {
|
|
|
341
379
|
if (!this._extensions.has(info.id)) {
|
|
342
380
|
peerInfo = info;
|
|
343
381
|
this._extensions.set(info.id, extension);
|
|
344
|
-
(0,
|
|
382
|
+
(0, import_log2.log)("peer-candidate", {
|
|
345
383
|
id: info.id,
|
|
346
384
|
thisPeerId: this.peerId,
|
|
347
385
|
remotePeerId: remotePeerId.toHex()
|
|
@@ -467,7 +505,7 @@ var levelMigration = async ({ db, directory }) => {
|
|
|
467
505
|
return;
|
|
468
506
|
}
|
|
469
507
|
const batch = db.batch();
|
|
470
|
-
|
|
508
|
+
import_log3.log.info("found chunks on old storage adapter", {
|
|
471
509
|
chunks: chunks.length
|
|
472
510
|
}, {
|
|
473
511
|
F: __dxlog_file3,
|
|
@@ -494,26 +532,24 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
494
532
|
}
|
|
495
533
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
|
|
496
534
|
var AutomergeHost = class {
|
|
497
|
-
constructor({ directory, db,
|
|
535
|
+
constructor({ directory, db, storageCallbacks }) {
|
|
498
536
|
this._ctx = new import_context.Context();
|
|
499
537
|
this._authorizedDevices = new import_util.ComplexMap(import_keys.PublicKey.hash);
|
|
500
|
-
this._updatingMetadata = /* @__PURE__ */ new Map();
|
|
501
538
|
this._requestedDocs = /* @__PURE__ */ new Set();
|
|
502
539
|
this._directory = directory;
|
|
503
540
|
this._db = db;
|
|
504
|
-
this.
|
|
541
|
+
this._storageCallbacks = storageCallbacks;
|
|
505
542
|
}
|
|
506
543
|
async open() {
|
|
507
544
|
this._directory && await levelMigration({
|
|
508
|
-
db:
|
|
545
|
+
db: this._db,
|
|
509
546
|
directory: this._directory
|
|
510
547
|
});
|
|
511
548
|
this._storage = new LevelDBStorageAdapter({
|
|
512
|
-
db:
|
|
513
|
-
callbacks:
|
|
514
|
-
beforeSave: (params) => this._beforeSave(params)
|
|
515
|
-
}
|
|
549
|
+
db: this._db,
|
|
550
|
+
callbacks: this._storageCallbacks
|
|
516
551
|
});
|
|
552
|
+
await this._storage.open?.();
|
|
517
553
|
this._peerId = `host-${import_keys.PublicKey.random().toHex()}`;
|
|
518
554
|
this._meshNetwork = new MeshNetworkAdapter();
|
|
519
555
|
this._clientNetwork = new LocalHostNetworkAdapter();
|
|
@@ -542,7 +578,7 @@ var AutomergeHost = class {
|
|
|
542
578
|
isRequested
|
|
543
579
|
}, {
|
|
544
580
|
F: __dxlog_file4,
|
|
545
|
-
L:
|
|
581
|
+
L: 108,
|
|
546
582
|
S: this,
|
|
547
583
|
C: (f, a) => f(...a)
|
|
548
584
|
});
|
|
@@ -556,7 +592,7 @@ var AutomergeHost = class {
|
|
|
556
592
|
documentId
|
|
557
593
|
}, {
|
|
558
594
|
F: __dxlog_file4,
|
|
559
|
-
L:
|
|
595
|
+
L: 115,
|
|
560
596
|
S: this,
|
|
561
597
|
C: (f, a) => f(...a)
|
|
562
598
|
});
|
|
@@ -570,7 +606,7 @@ var AutomergeHost = class {
|
|
|
570
606
|
documentId
|
|
571
607
|
}, {
|
|
572
608
|
F: __dxlog_file4,
|
|
573
|
-
L:
|
|
609
|
+
L: 124,
|
|
574
610
|
S: this,
|
|
575
611
|
C: (f, a) => f(...a)
|
|
576
612
|
});
|
|
@@ -587,7 +623,7 @@ var AutomergeHost = class {
|
|
|
587
623
|
isAuthorized
|
|
588
624
|
}, {
|
|
589
625
|
F: __dxlog_file4,
|
|
590
|
-
L:
|
|
626
|
+
L: 130,
|
|
591
627
|
S: this,
|
|
592
628
|
C: (f, a) => f(...a)
|
|
593
629
|
});
|
|
@@ -595,7 +631,7 @@ var AutomergeHost = class {
|
|
|
595
631
|
} catch (err) {
|
|
596
632
|
import_log.log.catch(err, void 0, {
|
|
597
633
|
F: __dxlog_file4,
|
|
598
|
-
L:
|
|
634
|
+
L: 140,
|
|
599
635
|
S: this,
|
|
600
636
|
C: (f, a) => f(...a)
|
|
601
637
|
});
|
|
@@ -605,66 +641,16 @@ var AutomergeHost = class {
|
|
|
605
641
|
});
|
|
606
642
|
this._clientNetwork.ready();
|
|
607
643
|
this._meshNetwork.ready();
|
|
608
|
-
|
|
609
|
-
const listener = ({ handle }) => this._onDocument(handle);
|
|
610
|
-
this._repo.on("document", listener);
|
|
611
|
-
this._ctx.onDispose(() => {
|
|
612
|
-
this._repo.off("document", listener);
|
|
613
|
-
Object.values(this._repo.handles).forEach((handle) => handle.off("change"));
|
|
614
|
-
});
|
|
615
|
-
}
|
|
644
|
+
await this._clientNetwork.whenConnected();
|
|
616
645
|
}
|
|
617
646
|
async close() {
|
|
618
|
-
this._storage.close?.();
|
|
647
|
+
await this._storage.close?.();
|
|
619
648
|
await this._clientNetwork.close();
|
|
620
649
|
await this._ctx.dispose();
|
|
621
650
|
}
|
|
622
651
|
get repo() {
|
|
623
652
|
return this._repo;
|
|
624
653
|
}
|
|
625
|
-
async _beforeSave(path) {
|
|
626
|
-
const id = path[0];
|
|
627
|
-
if (this._updatingMetadata.has(id)) {
|
|
628
|
-
return this._updatingMetadata.get(id);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
_onDocument(handle) {
|
|
632
|
-
const listener = (event) => this._onUpdate(event);
|
|
633
|
-
handle.on("change", listener);
|
|
634
|
-
}
|
|
635
|
-
_onUpdate(event) {
|
|
636
|
-
if (this._metadata == null) {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
const objectIds = getInlineChanges(event);
|
|
640
|
-
if (objectIds.length === 0) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
const heads = (0, import_automerge.getHeads)(event.doc);
|
|
644
|
-
const lastAvailableHash = heads.join("");
|
|
645
|
-
if (!lastAvailableHash) {
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
const encodedIds = objectIds.map((objectId) => import_protocols.idCodec.encode({
|
|
649
|
-
documentId: event.handle.documentId,
|
|
650
|
-
objectId
|
|
651
|
-
}));
|
|
652
|
-
const idToLastHash = new Map(encodedIds.map((id) => [
|
|
653
|
-
id,
|
|
654
|
-
lastAvailableHash
|
|
655
|
-
]));
|
|
656
|
-
const markingDirtyPromise = this._metadata.markDirty(idToLastHash).then(() => {
|
|
657
|
-
this._updatingMetadata.delete(event.handle.documentId);
|
|
658
|
-
}).catch((err) => {
|
|
659
|
-
this._ctx.disposed && import_log.log.catch(err, void 0, {
|
|
660
|
-
F: __dxlog_file4,
|
|
661
|
-
L: 207,
|
|
662
|
-
S: this,
|
|
663
|
-
C: (f, a) => f(...a)
|
|
664
|
-
});
|
|
665
|
-
});
|
|
666
|
-
this._updatingMetadata.set(event.handle.documentId, markingDirtyPromise);
|
|
667
|
-
}
|
|
668
654
|
_automergeDocs() {
|
|
669
655
|
return (0, import_util.mapValues)(this._repo.handles, (handle) => ({
|
|
670
656
|
state: handle.state,
|
|
@@ -693,9 +679,21 @@ var AutomergeHost = class {
|
|
|
693
679
|
//
|
|
694
680
|
// Methods for client-services.
|
|
695
681
|
//
|
|
696
|
-
async flush({
|
|
697
|
-
await Promise.all(
|
|
698
|
-
|
|
682
|
+
async flush({ states }) {
|
|
683
|
+
await Promise.all(states?.map(async ({ heads, documentId }) => {
|
|
684
|
+
(0, import_invariant.invariant)(heads, "heads are required for flush", {
|
|
685
|
+
F: __dxlog_file4,
|
|
686
|
+
L: 200,
|
|
687
|
+
S: this,
|
|
688
|
+
A: [
|
|
689
|
+
"heads",
|
|
690
|
+
"'heads are required for flush'"
|
|
691
|
+
]
|
|
692
|
+
});
|
|
693
|
+
const handle = this.repo.handles[documentId] ?? this._repo.find(documentId);
|
|
694
|
+
await waitForHeads(handle, heads);
|
|
695
|
+
}) ?? []);
|
|
696
|
+
await this._repo.flush(states?.map(({ documentId }) => documentId));
|
|
699
697
|
}
|
|
700
698
|
syncRepo(request) {
|
|
701
699
|
return this._clientNetwork.syncRepo(request);
|
|
@@ -718,7 +716,7 @@ var AutomergeHost = class {
|
|
|
718
716
|
deviceKey
|
|
719
717
|
}, {
|
|
720
718
|
F: __dxlog_file4,
|
|
721
|
-
L:
|
|
719
|
+
L: 230,
|
|
722
720
|
S: this,
|
|
723
721
|
C: (f, a) => f(...a)
|
|
724
722
|
});
|
|
@@ -738,27 +736,14 @@ _ts_decorate([
|
|
|
738
736
|
depth: null
|
|
739
737
|
})
|
|
740
738
|
], AutomergeHost.prototype, "_automergePeers", null);
|
|
739
|
+
_ts_decorate([
|
|
740
|
+
import_tracing.trace.span({
|
|
741
|
+
showInBrowserTimeline: true
|
|
742
|
+
})
|
|
743
|
+
], AutomergeHost.prototype, "flush", null);
|
|
741
744
|
AutomergeHost = _ts_decorate([
|
|
742
745
|
import_tracing.trace.resource()
|
|
743
746
|
], AutomergeHost);
|
|
744
|
-
var getInlineChanges = (event) => {
|
|
745
|
-
const inlineChangedObjectIds = /* @__PURE__ */ new Set();
|
|
746
|
-
for (const { path } of event.patches) {
|
|
747
|
-
if (path.length < 2) {
|
|
748
|
-
continue;
|
|
749
|
-
}
|
|
750
|
-
switch (path[0]) {
|
|
751
|
-
case "objects":
|
|
752
|
-
if (path.length >= 2) {
|
|
753
|
-
inlineChangedObjectIds.add(path[1]);
|
|
754
|
-
}
|
|
755
|
-
break;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
return [
|
|
759
|
-
...inlineChangedObjectIds
|
|
760
|
-
];
|
|
761
|
-
};
|
|
762
747
|
var getSpaceKeyFromDoc = (doc) => {
|
|
763
748
|
const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
|
|
764
749
|
if (rawSpaceKey == null) {
|
|
@@ -766,6 +751,34 @@ var getSpaceKeyFromDoc = (doc) => {
|
|
|
766
751
|
}
|
|
767
752
|
return String(rawSpaceKey);
|
|
768
753
|
};
|
|
754
|
+
var waitForHeads = async (handle, heads) => {
|
|
755
|
+
await handle.whenReady();
|
|
756
|
+
const unavailableHeads = new Set(heads);
|
|
757
|
+
await import_async.Event.wrap(handle, "change").waitForCondition(() => {
|
|
758
|
+
for (const changeHash of unavailableHeads.values()) {
|
|
759
|
+
if (changeIsPresentInDoc(handle.docSync(), changeHash)) {
|
|
760
|
+
unavailableHeads.delete(changeHash);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
if (unavailableHeads.size === 0) {
|
|
764
|
+
return true;
|
|
765
|
+
}
|
|
766
|
+
return false;
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
var changeIsPresentInDoc = (doc, changeHash) => {
|
|
770
|
+
return !!(0, import_automerge.getBackend)(doc).getChangeByHash(changeHash);
|
|
771
|
+
};
|
|
772
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
773
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
774
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
775
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
776
|
+
else
|
|
777
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
778
|
+
if (d = decorators[i])
|
|
779
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
780
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
781
|
+
}
|
|
769
782
|
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-doc-loader.ts";
|
|
770
783
|
var AutomergeDocumentLoaderImpl = class {
|
|
771
784
|
constructor(_spaceKey, _repo) {
|
|
@@ -774,7 +787,7 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
774
787
|
this._spaceRootDocHandle = null;
|
|
775
788
|
this._objectDocumentHandles = /* @__PURE__ */ new Map();
|
|
776
789
|
this._objectsPendingDocumentLoad = /* @__PURE__ */ new Set();
|
|
777
|
-
this.onObjectDocumentLoaded = new
|
|
790
|
+
this.onObjectDocumentLoaded = new import_async4.Event();
|
|
778
791
|
}
|
|
779
792
|
getAllHandles() {
|
|
780
793
|
return [
|
|
@@ -786,11 +799,11 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
786
799
|
return;
|
|
787
800
|
}
|
|
788
801
|
if (!spaceState.rootUrl) {
|
|
789
|
-
|
|
802
|
+
import_log4.log.error("Database opened with no rootUrl", {
|
|
790
803
|
spaceKey: this._spaceKey
|
|
791
804
|
}, {
|
|
792
805
|
F: __dxlog_file5,
|
|
793
|
-
L:
|
|
806
|
+
L: 69,
|
|
794
807
|
S: this,
|
|
795
808
|
C: (f, a) => f(...a)
|
|
796
809
|
});
|
|
@@ -798,9 +811,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
798
811
|
} else {
|
|
799
812
|
const existingDocHandle = await this._initDocHandle(ctx, spaceState.rootUrl);
|
|
800
813
|
const doc = existingDocHandle.docSync();
|
|
801
|
-
(0,
|
|
814
|
+
(0, import_invariant4.invariant)(doc, void 0, {
|
|
802
815
|
F: __dxlog_file5,
|
|
803
|
-
L:
|
|
816
|
+
L: 74,
|
|
804
817
|
S: this,
|
|
805
818
|
A: [
|
|
806
819
|
"doc",
|
|
@@ -814,9 +827,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
814
827
|
}
|
|
815
828
|
}
|
|
816
829
|
loadObjectDocument(objectId) {
|
|
817
|
-
(0,
|
|
830
|
+
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
818
831
|
F: __dxlog_file5,
|
|
819
|
-
L:
|
|
832
|
+
L: 83,
|
|
820
833
|
S: this,
|
|
821
834
|
A: [
|
|
822
835
|
"this._spaceRootDocHandle",
|
|
@@ -827,9 +840,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
827
840
|
return;
|
|
828
841
|
}
|
|
829
842
|
const spaceRootDoc = this._spaceRootDocHandle.docSync();
|
|
830
|
-
(0,
|
|
843
|
+
(0, import_invariant4.invariant)(spaceRootDoc, void 0, {
|
|
831
844
|
F: __dxlog_file5,
|
|
832
|
-
L:
|
|
845
|
+
L: 88,
|
|
833
846
|
S: this,
|
|
834
847
|
A: [
|
|
835
848
|
"spaceRootDoc",
|
|
@@ -839,11 +852,11 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
839
852
|
const documentUrl = (spaceRootDoc.links ?? {})[objectId];
|
|
840
853
|
if (documentUrl == null) {
|
|
841
854
|
this._objectsPendingDocumentLoad.add(objectId);
|
|
842
|
-
|
|
855
|
+
import_log4.log.info("loading delayed until object links are initialized", {
|
|
843
856
|
objectId
|
|
844
857
|
}, {
|
|
845
858
|
F: __dxlog_file5,
|
|
846
|
-
L:
|
|
859
|
+
L: 92,
|
|
847
860
|
S: this,
|
|
848
861
|
C: (f, a) => f(...a)
|
|
849
862
|
});
|
|
@@ -862,9 +875,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
862
875
|
linksAwaitingLoad.forEach(([objectId]) => this._objectsPendingDocumentLoad.delete(objectId));
|
|
863
876
|
}
|
|
864
877
|
getSpaceRootDocHandle() {
|
|
865
|
-
(0,
|
|
878
|
+
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
866
879
|
F: __dxlog_file5,
|
|
867
|
-
L:
|
|
880
|
+
L: 110,
|
|
868
881
|
S: this,
|
|
869
882
|
A: [
|
|
870
883
|
"this._spaceRootDocHandle",
|
|
@@ -874,9 +887,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
874
887
|
return this._spaceRootDocHandle;
|
|
875
888
|
}
|
|
876
889
|
createDocumentForObject(objectId) {
|
|
877
|
-
(0,
|
|
890
|
+
(0, import_invariant4.invariant)(this._spaceRootDocHandle, void 0, {
|
|
878
891
|
F: __dxlog_file5,
|
|
879
|
-
L:
|
|
892
|
+
L: 115,
|
|
880
893
|
S: this,
|
|
881
894
|
A: [
|
|
882
895
|
"this._spaceRootDocHandle",
|
|
@@ -914,30 +927,30 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
914
927
|
};
|
|
915
928
|
const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
|
|
916
929
|
if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
|
|
917
|
-
|
|
930
|
+
import_log4.log.warn("object already inlined in a different document, ignoring the link", {
|
|
918
931
|
...logMeta,
|
|
919
932
|
actualDocumentUrl: objectDocumentHandle.url
|
|
920
933
|
}, {
|
|
921
934
|
F: __dxlog_file5,
|
|
922
|
-
L:
|
|
935
|
+
L: 145,
|
|
923
936
|
S: this,
|
|
924
937
|
C: (f, a) => f(...a)
|
|
925
938
|
});
|
|
926
939
|
continue;
|
|
927
940
|
}
|
|
928
941
|
if (objectDocumentHandle?.url === automergeUrl) {
|
|
929
|
-
|
|
942
|
+
import_log4.log.warn("object document was already loaded", logMeta, {
|
|
930
943
|
F: __dxlog_file5,
|
|
931
|
-
L:
|
|
944
|
+
L: 152,
|
|
932
945
|
S: this,
|
|
933
946
|
C: (f, a) => f(...a)
|
|
934
947
|
});
|
|
935
948
|
continue;
|
|
936
949
|
}
|
|
937
950
|
const handle = this._repo.find(automergeUrl);
|
|
938
|
-
|
|
951
|
+
import_log4.log.debug("document loading triggered", logMeta, {
|
|
939
952
|
F: __dxlog_file5,
|
|
940
|
-
L:
|
|
953
|
+
L: 156,
|
|
941
954
|
S: this,
|
|
942
955
|
C: (f, a) => f(...a)
|
|
943
956
|
});
|
|
@@ -950,17 +963,17 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
950
963
|
while (true) {
|
|
951
964
|
try {
|
|
952
965
|
await (0, import_debug.warnAfterTimeout)(5e3, "Automerge root doc load timeout (AutomergeDb)", async () => {
|
|
953
|
-
await (0,
|
|
966
|
+
await (0, import_context3.cancelWithContext)(ctx, docHandle.whenReady());
|
|
954
967
|
});
|
|
955
968
|
break;
|
|
956
969
|
} catch (err) {
|
|
957
970
|
if (`${err}`.includes("Timeout")) {
|
|
958
|
-
|
|
971
|
+
import_log4.log.info("wraparound", {
|
|
959
972
|
id: docHandle.documentId,
|
|
960
973
|
state: docHandle.state
|
|
961
974
|
}, {
|
|
962
975
|
F: __dxlog_file5,
|
|
963
|
-
L:
|
|
976
|
+
L: 172,
|
|
964
977
|
S: this,
|
|
965
978
|
C: (f, a) => f(...a)
|
|
966
979
|
});
|
|
@@ -1000,9 +1013,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1000
1013
|
docUrl: handle.url
|
|
1001
1014
|
};
|
|
1002
1015
|
if (this.onObjectDocumentLoaded.listenerCount() === 0) {
|
|
1003
|
-
|
|
1016
|
+
import_log4.log.info("document loaded after all listeners were removed", logMeta, {
|
|
1004
1017
|
F: __dxlog_file5,
|
|
1005
|
-
L:
|
|
1018
|
+
L: 208,
|
|
1006
1019
|
S: this,
|
|
1007
1020
|
C: (f, a) => f(...a)
|
|
1008
1021
|
});
|
|
@@ -1010,9 +1023,9 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1010
1023
|
}
|
|
1011
1024
|
const objectDocHandle = this._objectDocumentHandles.get(objectId);
|
|
1012
1025
|
if (objectDocHandle?.url !== handle.url) {
|
|
1013
|
-
|
|
1026
|
+
import_log4.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
|
|
1014
1027
|
F: __dxlog_file5,
|
|
1015
|
-
L:
|
|
1028
|
+
L: 213,
|
|
1016
1029
|
S: this,
|
|
1017
1030
|
C: (f, a) => f(...a)
|
|
1018
1031
|
});
|
|
@@ -1024,14 +1037,14 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1024
1037
|
});
|
|
1025
1038
|
} catch (err) {
|
|
1026
1039
|
const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
|
|
1027
|
-
|
|
1040
|
+
import_log4.log.warn("failed to load a document", {
|
|
1028
1041
|
objectId,
|
|
1029
1042
|
automergeUrl: handle.url,
|
|
1030
1043
|
retryLoading: shouldRetryLoading,
|
|
1031
1044
|
err
|
|
1032
1045
|
}, {
|
|
1033
1046
|
F: __dxlog_file5,
|
|
1034
|
-
L:
|
|
1047
|
+
L: 219,
|
|
1035
1048
|
S: this,
|
|
1036
1049
|
C: (f, a) => f(...a)
|
|
1037
1050
|
});
|
|
@@ -1041,6 +1054,14 @@ var AutomergeDocumentLoaderImpl = class {
|
|
|
1041
1054
|
}
|
|
1042
1055
|
}
|
|
1043
1056
|
};
|
|
1057
|
+
_ts_decorate2([
|
|
1058
|
+
import_tracing2.trace.span({
|
|
1059
|
+
showInBrowserTimeline: true
|
|
1060
|
+
})
|
|
1061
|
+
], AutomergeDocumentLoaderImpl.prototype, "loadSpaceRootDocHandle", null);
|
|
1062
|
+
AutomergeDocumentLoaderImpl = _ts_decorate2([
|
|
1063
|
+
import_tracing2.trace.resource()
|
|
1064
|
+
], AutomergeDocumentLoaderImpl);
|
|
1044
1065
|
var REFERENCE_TYPE_TAG = "dxos.echo.model.document.Reference";
|
|
1045
1066
|
var encodeReference = (reference) => ({
|
|
1046
1067
|
"@type": REFERENCE_TYPE_TAG,
|
|
@@ -1049,7 +1070,7 @@ var encodeReference = (reference) => ({
|
|
|
1049
1070
|
protocol: reference.protocol ?? null,
|
|
1050
1071
|
host: reference.host ?? null
|
|
1051
1072
|
});
|
|
1052
|
-
var decodeReference = (value) => new
|
|
1073
|
+
var decodeReference = (value) => new import_echo_schema.Reference(value.itemId, value.protocol ?? void 0, value.host ?? void 0);
|
|
1053
1074
|
var isEncodedReferenceObject = (value) => typeof value === "object" && value !== null && value["@type"] === REFERENCE_TYPE_TAG;
|
|
1054
1075
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1055
1076
|
0 && (module.exports = {
|
|
@@ -1059,6 +1080,7 @@ var isEncodedReferenceObject = (value) => typeof value === "object" && value !==
|
|
|
1059
1080
|
AutomergeHost,
|
|
1060
1081
|
AutomergeStorageAdapter,
|
|
1061
1082
|
DataServiceImpl,
|
|
1083
|
+
LevelDBStorageAdapter,
|
|
1062
1084
|
LocalHostNetworkAdapter,
|
|
1063
1085
|
MOCK_AUTH_PROVIDER,
|
|
1064
1086
|
MOCK_AUTH_VERIFIER,
|
|
@@ -1077,6 +1099,7 @@ var isEncodedReferenceObject = (value) => typeof value === "object" && value !==
|
|
|
1077
1099
|
createMappedFeedWriter,
|
|
1078
1100
|
decodeReference,
|
|
1079
1101
|
encodeReference,
|
|
1102
|
+
encodingOptions,
|
|
1080
1103
|
getSpaceKeyFromDoc,
|
|
1081
1104
|
hasInvitationExpired,
|
|
1082
1105
|
isEncodedReferenceObject,
|