@dxos/echo-pipeline 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055
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-FR6GJ4S4.mjs → neutral/chunk-DN4YBAWV.mjs} +73 -69
- package/dist/lib/neutral/chunk-DN4YBAWV.mjs.map +7 -0
- package/dist/lib/{browser/chunk-WJJXJTNS.mjs → neutral/chunk-IMPFMBJK.mjs} +13 -12
- package/dist/lib/neutral/chunk-IMPFMBJK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/filter/index.mjs +1 -2
- package/dist/lib/{browser → neutral}/index.mjs +2623 -1051
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +31 -204
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/automerge/automerge-host.d.ts +42 -18
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts.map +1 -1
- package/dist/types/src/automerge/collection-synchronizer.d.ts +3 -2
- package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +17 -11
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +20 -16
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/heads-store.d.ts +9 -2
- package/dist/types/src/automerge/heads-store.d.ts.map +1 -1
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts +4 -4
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +8 -8
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts +6 -5
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts +35 -0
- package/dist/types/src/db-host/automerge-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts +2 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts.map +1 -0
- package/dist/types/src/db-host/data-service.d.ts +4 -3
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +8 -7
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/dist/types/src/db-host/echo-host.d.ts +58 -28
- package/dist/types/src/db-host/echo-host.d.ts.map +1 -1
- package/dist/types/src/db-host/index.d.ts +1 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/dist/types/src/db-host/local-queue-service.d.ts +18 -0
- package/dist/types/src/db-host/local-queue-service.d.ts.map +1 -0
- package/dist/types/src/db-host/query-service.d.ts +13 -8
- package/dist/types/src/db-host/query-service.d.ts.map +1 -1
- package/dist/types/src/db-host/queue-data-source.d.ts +38 -0
- package/dist/types/src/db-host/queue-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/queue-service.test.d.ts +2 -0
- package/dist/types/src/db-host/queue-service.test.d.ts.map +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts.map +1 -1
- package/dist/types/src/db-host/stub.d.ts +11 -0
- package/dist/types/src/db-host/stub.d.ts.map +1 -0
- package/dist/types/src/edge/echo-edge-replicator.d.ts +7 -6
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
- package/dist/types/src/filter/filter-match.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +2 -2
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/query/errors.d.ts +6 -8
- package/dist/types/src/query/errors.d.ts.map +1 -1
- package/dist/types/src/query/plan.d.ts +59 -8
- package/dist/types/src/query/plan.d.ts.map +1 -1
- package/dist/types/src/query/query-executor.d.ts +47 -11
- package/dist/types/src/query/query-executor.d.ts.map +1 -1
- package/dist/types/src/query/query-planner.d.ts +10 -1
- package/dist/types/src/query/query-planner.d.ts.map +1 -1
- package/dist/types/src/space/auth.d.ts +3 -3
- package/dist/types/src/space/auth.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +4 -3
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +7 -6
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +8 -7
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +5 -5
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -1
- package/dist/types/src/testing/test-replicator.d.ts +13 -13
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -46
- package/src/automerge/automerge-host.test.ts +40 -19
- package/src/automerge/automerge-host.ts +154 -77
- package/src/automerge/automerge-repo.test.ts +149 -31
- package/src/automerge/collection-synchronizer.test.ts +16 -10
- package/src/automerge/collection-synchronizer.ts +41 -11
- package/src/automerge/echo-network-adapter.test.ts +2 -1
- package/src/automerge/echo-network-adapter.ts +40 -28
- package/src/automerge/echo-replicator.ts +21 -16
- package/src/automerge/heads-store.ts +42 -3
- package/src/automerge/leveldb-storage-adapter.ts +4 -4
- package/src/automerge/mesh-echo-replicator-connection.ts +8 -8
- package/src/automerge/mesh-echo-replicator.ts +14 -10
- package/src/db-host/automerge-data-source.test.ts +300 -0
- package/src/db-host/automerge-data-source.ts +187 -0
- package/src/db-host/data-service.ts +14 -6
- package/src/db-host/documents-synchronizer.test.ts +73 -13
- package/src/db-host/documents-synchronizer.ts +54 -51
- package/src/db-host/echo-host.ts +233 -83
- package/src/db-host/index.ts +1 -0
- package/src/db-host/local-queue-service.ts +126 -0
- package/src/db-host/query-service.ts +27 -102
- package/src/db-host/queue-data-source.ts +159 -0
- package/src/db-host/queue-service.test.ts +145 -0
- package/src/db-host/space-state-manager.ts +5 -1
- package/src/db-host/stub.ts +33 -0
- package/src/edge/echo-edge-replicator.test.ts +9 -8
- package/src/edge/echo-edge-replicator.ts +39 -30
- package/src/filter/filter-match.test.ts +41 -25
- package/src/filter/filter-match.ts +21 -19
- package/src/metadata/metadata-store.ts +8 -5
- package/src/pipeline/pipeline.ts +2 -2
- package/src/query/errors.ts +2 -2
- package/src/query/plan.ts +71 -8
- package/src/query/query-executor.ts +938 -169
- package/src/query/query-planner.test.ts +778 -95
- package/src/query/query-planner.ts +335 -27
- package/src/space/admission-discovery-extension.ts +1 -1
- package/src/space/auth.ts +6 -6
- package/src/space/control-pipeline.test.ts +2 -1
- package/src/space/control-pipeline.ts +4 -5
- package/src/space/space-manager.ts +12 -8
- package/src/space/space-protocol.browser.test.ts +13 -12
- package/src/space/space-protocol.test.ts +13 -12
- package/src/space/space-protocol.ts +16 -15
- package/src/space/space.test.ts +2 -2
- package/src/space/space.ts +8 -8
- package/src/testing/index.ts +0 -2
- package/src/testing/test-network-adapter.ts +16 -3
- package/src/testing/test-replicator.ts +19 -18
- package/src/util.ts +7 -3
- package/dist/lib/browser/chunk-CGS2ULMK.mjs +0 -11
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-FR6GJ4S4.mjs.map +0 -7
- package/dist/lib/browser/chunk-WJJXJTNS.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JQCCVDLT.mjs +0 -2144
- package/dist/lib/node-esm/chunk-JQCCVDLT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LEQ77KAT.mjs +0 -240
- package/dist/lib/node-esm/chunk-LEQ77KAT.mjs.map +0 -7
- package/dist/lib/node-esm/filter/index.mjs +0 -13
- package/dist/lib/node-esm/filter/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -5498
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -764
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -18
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-schema.d.ts +0 -37
- package/dist/types/src/testing/test-schema.d.ts.map +0 -1
- package/src/db-host/documents-iterator.ts +0 -74
- package/src/testing/test-data.ts +0 -127
- package/src/testing/test-schema.ts +0 -53
- /package/dist/lib/{browser → neutral}/filter/index.mjs.map +0 -0
|
@@ -126,15 +126,20 @@ var MetadataStore = class {
|
|
|
126
126
|
C: (f, a) => f(...a)
|
|
127
127
|
});
|
|
128
128
|
if (fileLength < dataSize + 8) {
|
|
129
|
-
throw new DataCorruptionError(
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
throw new DataCorruptionError({
|
|
130
|
+
message: "Metadata size is smaller than expected.",
|
|
131
|
+
context: {
|
|
132
|
+
fileLength,
|
|
133
|
+
dataSize
|
|
134
|
+
}
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
const data = await file.read(8, dataSize);
|
|
135
138
|
const calculatedChecksum = CRC32.buf(data);
|
|
136
139
|
if (calculatedChecksum !== checksum) {
|
|
137
|
-
throw new DataCorruptionError(
|
|
140
|
+
throw new DataCorruptionError({
|
|
141
|
+
message: "Metadata checksum is invalid."
|
|
142
|
+
});
|
|
138
143
|
}
|
|
139
144
|
return codec2.decode(data);
|
|
140
145
|
} finally {
|
|
@@ -157,7 +162,7 @@ var MetadataStore = class {
|
|
|
157
162
|
checksum
|
|
158
163
|
}, {
|
|
159
164
|
F: __dxlog_file2,
|
|
160
|
-
L:
|
|
165
|
+
L: 129,
|
|
161
166
|
S: this,
|
|
162
167
|
C: (f, a) => f(...a)
|
|
163
168
|
});
|
|
@@ -190,7 +195,7 @@ var MetadataStore = class {
|
|
|
190
195
|
err
|
|
191
196
|
}, {
|
|
192
197
|
F: __dxlog_file2,
|
|
193
|
-
L:
|
|
198
|
+
L: 161,
|
|
194
199
|
S: this,
|
|
195
200
|
C: (f, a) => f(...a)
|
|
196
201
|
});
|
|
@@ -207,7 +212,7 @@ var MetadataStore = class {
|
|
|
207
212
|
err
|
|
208
213
|
}, {
|
|
209
214
|
F: __dxlog_file2,
|
|
210
|
-
L:
|
|
215
|
+
L: 173,
|
|
211
216
|
S: this,
|
|
212
217
|
C: (f, a) => f(...a)
|
|
213
218
|
});
|
|
@@ -244,7 +249,7 @@ var MetadataStore = class {
|
|
|
244
249
|
err
|
|
245
250
|
}, {
|
|
246
251
|
F: __dxlog_file2,
|
|
247
|
-
L:
|
|
252
|
+
L: 215,
|
|
248
253
|
S: this,
|
|
249
254
|
C: (f, a) => f(...a)
|
|
250
255
|
});
|
|
@@ -265,7 +270,7 @@ var MetadataStore = class {
|
|
|
265
270
|
const space = this.spaces.find((space2) => space2.key.equals(spaceKey));
|
|
266
271
|
invariant2(space, "Space not found", {
|
|
267
272
|
F: __dxlog_file2,
|
|
268
|
-
L:
|
|
273
|
+
L: 237,
|
|
269
274
|
S: this,
|
|
270
275
|
A: [
|
|
271
276
|
"space",
|
|
@@ -295,7 +300,7 @@ var MetadataStore = class {
|
|
|
295
300
|
async clear() {
|
|
296
301
|
log("clearing all metadata", void 0, {
|
|
297
302
|
F: __dxlog_file2,
|
|
298
|
-
L:
|
|
303
|
+
L: 265,
|
|
299
304
|
S: this,
|
|
300
305
|
C: (f, a) => f(...a)
|
|
301
306
|
});
|
|
@@ -308,7 +313,7 @@ var MetadataStore = class {
|
|
|
308
313
|
async setIdentityRecord(record) {
|
|
309
314
|
invariant2(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
|
|
310
315
|
F: __dxlog_file2,
|
|
311
|
-
L:
|
|
316
|
+
L: 275,
|
|
312
317
|
S: this,
|
|
313
318
|
A: [
|
|
314
319
|
"!this._metadata.identity",
|
|
@@ -338,7 +343,7 @@ var MetadataStore = class {
|
|
|
338
343
|
async addSpace(record) {
|
|
339
344
|
invariant2(!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key)), "Cannot overwrite existing space in metadata", {
|
|
340
345
|
F: __dxlog_file2,
|
|
341
|
-
L:
|
|
346
|
+
L: 303,
|
|
342
347
|
S: this,
|
|
343
348
|
A: [
|
|
344
349
|
"!(this._metadata.spaces ?? []).find((space) => space.key.equals(record.key))",
|
|
@@ -1001,7 +1006,7 @@ import { schema as schema3 } from "@dxos/protocols/proto";
|
|
|
1001
1006
|
import { RpcExtension } from "@dxos/teleport";
|
|
1002
1007
|
var __dxlog_file6 = "/__w/dxos/dxos/packages/core/echo/echo-pipeline/src/space/auth.ts";
|
|
1003
1008
|
var AuthExtension = class extends RpcExtension {
|
|
1004
|
-
|
|
1009
|
+
_authProps;
|
|
1005
1010
|
_ctx = new Context3({
|
|
1006
1011
|
onError: (err) => {
|
|
1007
1012
|
log5.catch(err, void 0, {
|
|
@@ -1015,7 +1020,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1015
1020
|
F: __dxlog_file6,
|
|
1016
1021
|
L: 26
|
|
1017
1022
|
});
|
|
1018
|
-
constructor(
|
|
1023
|
+
constructor(_authProps) {
|
|
1019
1024
|
super({
|
|
1020
1025
|
requested: {
|
|
1021
1026
|
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
@@ -1024,14 +1029,14 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1024
1029
|
AuthService: schema3.getService("dxos.mesh.teleport.auth.AuthService")
|
|
1025
1030
|
},
|
|
1026
1031
|
timeout: 60 * 1e3
|
|
1027
|
-
}), this.
|
|
1032
|
+
}), this._authProps = _authProps;
|
|
1028
1033
|
}
|
|
1029
1034
|
async getHandlers() {
|
|
1030
1035
|
return {
|
|
1031
1036
|
AuthService: {
|
|
1032
1037
|
authenticate: async ({ challenge }) => {
|
|
1033
1038
|
try {
|
|
1034
|
-
const credential = await this.
|
|
1039
|
+
const credential = await this._authProps.provider(challenge);
|
|
1035
1040
|
if (!credential) {
|
|
1036
1041
|
throw new Error("auth rejected");
|
|
1037
1042
|
}
|
|
@@ -1068,7 +1073,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1068
1073
|
"'invalid credential'"
|
|
1069
1074
|
]
|
|
1070
1075
|
});
|
|
1071
|
-
const success = await this.
|
|
1076
|
+
const success = await this._authProps.verifier(challenge, credential);
|
|
1072
1077
|
invariant5(success, "credential not verified", {
|
|
1073
1078
|
F: __dxlog_file6,
|
|
1074
1079
|
L: 71,
|
|
@@ -1078,7 +1083,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1078
1083
|
"'credential not verified'"
|
|
1079
1084
|
]
|
|
1080
1085
|
});
|
|
1081
|
-
runInContext(this._ctx, () => this.
|
|
1086
|
+
runInContext(this._ctx, () => this._authProps.onAuthSuccess());
|
|
1082
1087
|
} catch (err) {
|
|
1083
1088
|
log5("auth failed", err, {
|
|
1084
1089
|
F: __dxlog_file6,
|
|
@@ -1087,7 +1092,7 @@ var AuthExtension = class extends RpcExtension {
|
|
|
1087
1092
|
C: (f, a) => f(...a)
|
|
1088
1093
|
});
|
|
1089
1094
|
this.close();
|
|
1090
|
-
this.
|
|
1095
|
+
this._authProps.onAuthFailure();
|
|
1091
1096
|
}
|
|
1092
1097
|
});
|
|
1093
1098
|
}
|
|
@@ -1204,7 +1209,7 @@ var ControlPipeline = class {
|
|
|
1204
1209
|
await this._pipeline.addFeed(feed);
|
|
1205
1210
|
this._pipeline.setWriteFeed(feed);
|
|
1206
1211
|
}
|
|
1207
|
-
async start() {
|
|
1212
|
+
async start(ctx) {
|
|
1208
1213
|
const snapshot = this._metadata.getSpaceControlPipelineSnapshot(this._spaceKey);
|
|
1209
1214
|
log6("load snapshot", {
|
|
1210
1215
|
key: this._spaceKey,
|
|
@@ -1226,10 +1231,7 @@ var ControlPipeline = class {
|
|
|
1226
1231
|
C: (f, a) => f(...a)
|
|
1227
1232
|
});
|
|
1228
1233
|
setTimeout(async () => {
|
|
1229
|
-
void this._consumePipeline(
|
|
1230
|
-
F: __dxlog_file7,
|
|
1231
|
-
L: 133
|
|
1232
|
-
}));
|
|
1234
|
+
void this._consumePipeline(ctx);
|
|
1233
1235
|
});
|
|
1234
1236
|
await this._pipeline.start();
|
|
1235
1237
|
log6("started", void 0, {
|
|
@@ -1288,7 +1290,7 @@ var ControlPipeline = class {
|
|
|
1288
1290
|
} catch (err) {
|
|
1289
1291
|
log6.catch(err, void 0, {
|
|
1290
1292
|
F: __dxlog_file7,
|
|
1291
|
-
L:
|
|
1293
|
+
L: 178,
|
|
1292
1294
|
S: this,
|
|
1293
1295
|
C: (f, a) => f(...a)
|
|
1294
1296
|
});
|
|
@@ -1302,7 +1304,7 @@ var ControlPipeline = class {
|
|
|
1302
1304
|
seq: msg.seq
|
|
1303
1305
|
}, {
|
|
1304
1306
|
F: __dxlog_file7,
|
|
1305
|
-
L:
|
|
1307
|
+
L: 187,
|
|
1306
1308
|
S: this,
|
|
1307
1309
|
C: (f, a) => f(...a)
|
|
1308
1310
|
});
|
|
@@ -1317,7 +1319,7 @@ var ControlPipeline = class {
|
|
|
1317
1319
|
msg
|
|
1318
1320
|
}, {
|
|
1319
1321
|
F: __dxlog_file7,
|
|
1320
|
-
L:
|
|
1322
|
+
L: 196,
|
|
1321
1323
|
S: this,
|
|
1322
1324
|
C: (f, a) => f(...a)
|
|
1323
1325
|
});
|
|
@@ -1336,7 +1338,7 @@ var ControlPipeline = class {
|
|
|
1336
1338
|
async stop() {
|
|
1337
1339
|
log6("stopping...", void 0, {
|
|
1338
1340
|
F: __dxlog_file7,
|
|
1339
|
-
L:
|
|
1341
|
+
L: 216,
|
|
1340
1342
|
S: this,
|
|
1341
1343
|
C: (f, a) => f(...a)
|
|
1342
1344
|
});
|
|
@@ -1345,7 +1347,7 @@ var ControlPipeline = class {
|
|
|
1345
1347
|
await this._saveTargetTimeframe(this._pipeline.state.timeframe);
|
|
1346
1348
|
log6("stopped", void 0, {
|
|
1347
1349
|
F: __dxlog_file7,
|
|
1348
|
-
L:
|
|
1350
|
+
L: 220,
|
|
1349
1351
|
S: this,
|
|
1350
1352
|
C: (f, a) => f(...a)
|
|
1351
1353
|
});
|
|
@@ -1358,7 +1360,7 @@ var ControlPipeline = class {
|
|
|
1358
1360
|
} catch (err) {
|
|
1359
1361
|
log6(err, void 0, {
|
|
1360
1362
|
F: __dxlog_file7,
|
|
1361
|
-
L:
|
|
1363
|
+
L: 229,
|
|
1362
1364
|
S: this,
|
|
1363
1365
|
C: (f, a) => f(...a)
|
|
1364
1366
|
});
|
|
@@ -1376,9 +1378,6 @@ _ts_decorate4([
|
|
|
1376
1378
|
showInBrowserTimeline: true
|
|
1377
1379
|
})
|
|
1378
1380
|
], ControlPipeline.prototype, "start", null);
|
|
1379
|
-
_ts_decorate4([
|
|
1380
|
-
trace.span()
|
|
1381
|
-
], ControlPipeline.prototype, "_consumePipeline", null);
|
|
1382
1381
|
_ts_decorate4([
|
|
1383
1382
|
trace.span()
|
|
1384
1383
|
], ControlPipeline.prototype, "_processMessage", null);
|
|
@@ -1563,7 +1562,7 @@ var Space = class extends Resource {
|
|
|
1563
1562
|
S: this,
|
|
1564
1563
|
C: (f, a) => f(...a)
|
|
1565
1564
|
});
|
|
1566
|
-
await this._controlPipeline.start();
|
|
1565
|
+
await this._controlPipeline.start(ctx);
|
|
1567
1566
|
log7("opened", void 0, {
|
|
1568
1567
|
F: __dxlog_file8,
|
|
1569
1568
|
L: 182,
|
|
@@ -1571,7 +1570,7 @@ var Space = class extends Resource {
|
|
|
1571
1570
|
C: (f, a) => f(...a)
|
|
1572
1571
|
});
|
|
1573
1572
|
}
|
|
1574
|
-
async startProtocol() {
|
|
1573
|
+
async startProtocol(ctx) {
|
|
1575
1574
|
invariant6(this.isOpen, void 0, {
|
|
1576
1575
|
F: __dxlog_file8,
|
|
1577
1576
|
L: 187,
|
|
@@ -1581,10 +1580,10 @@ var Space = class extends Resource {
|
|
|
1581
1580
|
""
|
|
1582
1581
|
]
|
|
1583
1582
|
});
|
|
1584
|
-
await this.protocol.start();
|
|
1583
|
+
await this.protocol.start(ctx);
|
|
1585
1584
|
await this.protocol.addFeed(await this._feedProvider(this._genesisFeedKey));
|
|
1586
1585
|
}
|
|
1587
|
-
async _close() {
|
|
1586
|
+
async _close(ctx) {
|
|
1588
1587
|
log7("closing...", {
|
|
1589
1588
|
key: this._key
|
|
1590
1589
|
}, {
|
|
@@ -1593,7 +1592,7 @@ var Space = class extends Resource {
|
|
|
1593
1592
|
S: this,
|
|
1594
1593
|
C: (f, a) => f(...a)
|
|
1595
1594
|
});
|
|
1596
|
-
await this.protocol.stop();
|
|
1595
|
+
await this.protocol.stop(ctx);
|
|
1597
1596
|
await this._controlPipeline.stop();
|
|
1598
1597
|
log7("closed", void 0, {
|
|
1599
1598
|
F: __dxlog_file8,
|
|
@@ -1688,7 +1687,12 @@ var CredentialServerExtension = class extends RpcExtension2 {
|
|
|
1688
1687
|
getAdmissionCredential: async (request) => {
|
|
1689
1688
|
const memberInfo = this._space.spaceState.members.get(request.memberKey);
|
|
1690
1689
|
if (!memberInfo?.credential) {
|
|
1691
|
-
throw new ProtocolError(
|
|
1690
|
+
throw new ProtocolError({
|
|
1691
|
+
message: "Space member not found.",
|
|
1692
|
+
context: {
|
|
1693
|
+
...request
|
|
1694
|
+
}
|
|
1695
|
+
});
|
|
1692
1696
|
}
|
|
1693
1697
|
return {
|
|
1694
1698
|
admissionCredential: memberInfo.credential
|
|
@@ -1764,7 +1768,7 @@ var SpaceProtocol = class {
|
|
|
1764
1768
|
key: feed.key
|
|
1765
1769
|
}, {
|
|
1766
1770
|
F: __dxlog_file10,
|
|
1767
|
-
L:
|
|
1771
|
+
L: 132,
|
|
1768
1772
|
S: this,
|
|
1769
1773
|
C: (f, a) => f(...a)
|
|
1770
1774
|
});
|
|
@@ -1775,7 +1779,7 @@ var SpaceProtocol = class {
|
|
|
1775
1779
|
await this.feedAdded.callSerial(feed);
|
|
1776
1780
|
}
|
|
1777
1781
|
// TODO(burdon): Rename open? Common open/close interfaces for all services?
|
|
1778
|
-
async start() {
|
|
1782
|
+
async start(ctx) {
|
|
1779
1783
|
if (this._connection) {
|
|
1780
1784
|
return;
|
|
1781
1785
|
}
|
|
@@ -1783,12 +1787,12 @@ var SpaceProtocol = class {
|
|
|
1783
1787
|
await this.blobSync.open();
|
|
1784
1788
|
log8("starting...", void 0, {
|
|
1785
1789
|
F: __dxlog_file10,
|
|
1786
|
-
L:
|
|
1790
|
+
L: 153,
|
|
1787
1791
|
S: this,
|
|
1788
1792
|
C: (f, a) => f(...a)
|
|
1789
1793
|
});
|
|
1790
1794
|
const topic = await this._topic;
|
|
1791
|
-
this._connection = await this._networkManager.joinSwarm({
|
|
1795
|
+
this._connection = await this._networkManager.joinSwarm(ctx, {
|
|
1792
1796
|
protocolProvider: this._createProtocolProvider(credentials),
|
|
1793
1797
|
topic,
|
|
1794
1798
|
topology: this._topology,
|
|
@@ -1796,7 +1800,7 @@ var SpaceProtocol = class {
|
|
|
1796
1800
|
});
|
|
1797
1801
|
log8("started", void 0, {
|
|
1798
1802
|
F: __dxlog_file10,
|
|
1799
|
-
L:
|
|
1803
|
+
L: 162,
|
|
1800
1804
|
S: this,
|
|
1801
1805
|
C: (f, a) => f(...a)
|
|
1802
1806
|
});
|
|
@@ -1804,35 +1808,35 @@ var SpaceProtocol = class {
|
|
|
1804
1808
|
updateTopology() {
|
|
1805
1809
|
this._topology.forceUpdate();
|
|
1806
1810
|
}
|
|
1807
|
-
async stop() {
|
|
1811
|
+
async stop(ctx) {
|
|
1808
1812
|
await this.blobSync.close();
|
|
1809
1813
|
if (this._connection) {
|
|
1810
1814
|
log8("stopping...", void 0, {
|
|
1811
1815
|
F: __dxlog_file10,
|
|
1812
|
-
L:
|
|
1816
|
+
L: 173,
|
|
1813
1817
|
S: this,
|
|
1814
1818
|
C: (f, a) => f(...a)
|
|
1815
1819
|
});
|
|
1816
|
-
await this._connection.close();
|
|
1820
|
+
await this._connection.close(ctx);
|
|
1817
1821
|
log8("stopped", void 0, {
|
|
1818
1822
|
F: __dxlog_file10,
|
|
1819
|
-
L:
|
|
1823
|
+
L: 175,
|
|
1820
1824
|
S: this,
|
|
1821
1825
|
C: (f, a) => f(...a)
|
|
1822
1826
|
});
|
|
1823
1827
|
}
|
|
1824
1828
|
}
|
|
1825
1829
|
_createProtocolProvider(credentials) {
|
|
1826
|
-
return (
|
|
1830
|
+
return (wireProps) => {
|
|
1827
1831
|
const session = new SpaceProtocolSession({
|
|
1828
|
-
|
|
1832
|
+
wireProps,
|
|
1829
1833
|
swarmIdentity: this._swarmIdentity,
|
|
1830
1834
|
onSessionAuth: this._onSessionAuth,
|
|
1831
1835
|
onAuthFailure: this._onAuthFailure,
|
|
1832
1836
|
blobSync: this.blobSync,
|
|
1833
1837
|
disableP2pReplication: this._disableP2pReplication
|
|
1834
1838
|
});
|
|
1835
|
-
this._sessions.set(
|
|
1839
|
+
this._sessions.set(wireProps.remotePeerId, session);
|
|
1836
1840
|
for (const feed of this._feeds) {
|
|
1837
1841
|
session.replicator.addFeed(feed);
|
|
1838
1842
|
}
|
|
@@ -1860,7 +1864,7 @@ var AuthStatus = /* @__PURE__ */ (function(AuthStatus2) {
|
|
|
1860
1864
|
return AuthStatus2;
|
|
1861
1865
|
})({});
|
|
1862
1866
|
var SpaceProtocolSession = class {
|
|
1863
|
-
|
|
1867
|
+
_wireProps;
|
|
1864
1868
|
_disableP2pReplication;
|
|
1865
1869
|
_onSessionAuth;
|
|
1866
1870
|
_onAuthFailure;
|
|
@@ -1879,13 +1883,13 @@ var SpaceProtocolSession = class {
|
|
|
1879
1883
|
return this._teleport.stats;
|
|
1880
1884
|
}
|
|
1881
1885
|
// TODO(dmaretskyi): Allow to pass in extra extensions.
|
|
1882
|
-
constructor({
|
|
1883
|
-
this.
|
|
1886
|
+
constructor({ wireProps, swarmIdentity, onSessionAuth, onAuthFailure, blobSync, disableP2pReplication }) {
|
|
1887
|
+
this._wireProps = wireProps;
|
|
1884
1888
|
this._swarmIdentity = swarmIdentity;
|
|
1885
1889
|
this._onSessionAuth = onSessionAuth;
|
|
1886
1890
|
this._onAuthFailure = onAuthFailure;
|
|
1887
1891
|
this._blobSync = blobSync;
|
|
1888
|
-
this._teleport = new Teleport(
|
|
1892
|
+
this._teleport = new Teleport(wireProps);
|
|
1889
1893
|
this._disableP2pReplication = disableP2pReplication ?? false;
|
|
1890
1894
|
}
|
|
1891
1895
|
get stream() {
|
|
@@ -1899,7 +1903,7 @@ var SpaceProtocolSession = class {
|
|
|
1899
1903
|
onAuthSuccess: () => {
|
|
1900
1904
|
log8("Peer authenticated", void 0, {
|
|
1901
1905
|
F: __dxlog_file10,
|
|
1902
|
-
L:
|
|
1906
|
+
L: 286,
|
|
1903
1907
|
S: this,
|
|
1904
1908
|
C: (f, a) => f(...a)
|
|
1905
1909
|
});
|
|
@@ -1919,7 +1923,7 @@ var SpaceProtocolSession = class {
|
|
|
1919
1923
|
async close() {
|
|
1920
1924
|
log8("close", void 0, {
|
|
1921
1925
|
F: __dxlog_file10,
|
|
1922
|
-
L:
|
|
1926
|
+
L: 305,
|
|
1923
1927
|
S: this,
|
|
1924
1928
|
C: (f, a) => f(...a)
|
|
1925
1929
|
});
|
|
@@ -1931,7 +1935,7 @@ var SpaceProtocolSession = class {
|
|
|
1931
1935
|
};
|
|
1932
1936
|
_ts_decorate6([
|
|
1933
1937
|
logInfo2
|
|
1934
|
-
], SpaceProtocolSession.prototype, "
|
|
1938
|
+
], SpaceProtocolSession.prototype, "_wireProps", void 0);
|
|
1935
1939
|
_ts_decorate6([
|
|
1936
1940
|
logInfo2
|
|
1937
1941
|
], SpaceProtocolSession.prototype, "authStatus", null);
|
|
@@ -1983,7 +1987,7 @@ var SpaceManager = class {
|
|
|
1983
1987
|
id: this._instanceId
|
|
1984
1988
|
}), {
|
|
1985
1989
|
F: __dxlog_file11,
|
|
1986
|
-
L:
|
|
1990
|
+
L: 104,
|
|
1987
1991
|
S: this,
|
|
1988
1992
|
C: (f, a) => f(...a)
|
|
1989
1993
|
});
|
|
@@ -1991,7 +1995,7 @@ var SpaceManager = class {
|
|
|
1991
1995
|
spaceKey: metadata.genesisFeedKey
|
|
1992
1996
|
}, {
|
|
1993
1997
|
F: __dxlog_file11,
|
|
1994
|
-
L:
|
|
1998
|
+
L: 105,
|
|
1995
1999
|
S: this,
|
|
1996
2000
|
C: (f, a) => f(...a)
|
|
1997
2001
|
});
|
|
@@ -2023,19 +2027,19 @@ var SpaceManager = class {
|
|
|
2023
2027
|
id: this._instanceId
|
|
2024
2028
|
}), {
|
|
2025
2029
|
F: __dxlog_file11,
|
|
2026
|
-
L:
|
|
2030
|
+
L: 135,
|
|
2027
2031
|
S: this,
|
|
2028
2032
|
C: (f, a) => f(...a)
|
|
2029
2033
|
});
|
|
2030
2034
|
return space;
|
|
2031
2035
|
}
|
|
2032
|
-
async requestSpaceAdmissionCredential(params) {
|
|
2036
|
+
async requestSpaceAdmissionCredential(ctx, params) {
|
|
2033
2037
|
const traceKey = "dxos.echo.space-manager.request-space-admission";
|
|
2034
2038
|
log9.trace(traceKey, trace4.begin({
|
|
2035
2039
|
id: this._instanceId
|
|
2036
2040
|
}), {
|
|
2037
2041
|
F: __dxlog_file11,
|
|
2038
|
-
L:
|
|
2042
|
+
L: 144,
|
|
2039
2043
|
S: this,
|
|
2040
2044
|
C: (f, a) => f(...a)
|
|
2041
2045
|
});
|
|
@@ -2043,7 +2047,7 @@ var SpaceManager = class {
|
|
|
2043
2047
|
spaceKey: params.spaceKey
|
|
2044
2048
|
}, {
|
|
2045
2049
|
F: __dxlog_file11,
|
|
2046
|
-
L:
|
|
2050
|
+
L: 145,
|
|
2047
2051
|
S: this,
|
|
2048
2052
|
C: (f, a) => f(...a)
|
|
2049
2053
|
});
|
|
@@ -2063,7 +2067,7 @@ var SpaceManager = class {
|
|
|
2063
2067
|
disableP2pReplication: this._disableP2pReplication
|
|
2064
2068
|
});
|
|
2065
2069
|
try {
|
|
2066
|
-
await protocol.start();
|
|
2070
|
+
await protocol.start(ctx);
|
|
2067
2071
|
const credential = await onCredentialResolved.wait({
|
|
2068
2072
|
timeout: params.timeout
|
|
2069
2073
|
});
|
|
@@ -2071,7 +2075,7 @@ var SpaceManager = class {
|
|
|
2071
2075
|
id: this._instanceId
|
|
2072
2076
|
}), {
|
|
2073
2077
|
F: __dxlog_file11,
|
|
2074
|
-
L:
|
|
2078
|
+
L: 169,
|
|
2075
2079
|
S: this,
|
|
2076
2080
|
C: (f, a) => f(...a)
|
|
2077
2081
|
});
|
|
@@ -2082,13 +2086,13 @@ var SpaceManager = class {
|
|
|
2082
2086
|
error: err
|
|
2083
2087
|
}), {
|
|
2084
2088
|
F: __dxlog_file11,
|
|
2085
|
-
L:
|
|
2089
|
+
L: 172,
|
|
2086
2090
|
S: this,
|
|
2087
2091
|
C: (f, a) => f(...a)
|
|
2088
2092
|
});
|
|
2089
2093
|
throw err;
|
|
2090
2094
|
} finally {
|
|
2091
|
-
await protocol.stop();
|
|
2095
|
+
await protocol.stop(ctx);
|
|
2092
2096
|
}
|
|
2093
2097
|
}
|
|
2094
2098
|
findSpaceByRootDocumentId(documentId) {
|
|
@@ -2141,4 +2145,4 @@ export {
|
|
|
2141
2145
|
SpaceProtocolSession,
|
|
2142
2146
|
SpaceManager
|
|
2143
2147
|
};
|
|
2144
|
-
//# sourceMappingURL=chunk-
|
|
2148
|
+
//# sourceMappingURL=chunk-DN4YBAWV.mjs.map
|