@dxos/client-services 0.1.58-main.ffbb8a1 → 0.1.58-next.6d0af18
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-YLR3BYMV.mjs → chunk-DJ4JCFP7.mjs} +271 -191
- package/dist/lib/browser/chunk-DJ4JCFP7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +5 -5
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +313 -233
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +310 -230
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.test.ts +1 -1
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/identity/authenticator.ts +2 -5
- package/src/packlets/identity/identity-manager.test.ts +1 -1
- package/src/packlets/identity/identity-service.test.ts +1 -1
- package/src/packlets/identity/identity.test.ts +1 -1
- package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
- package/src/packlets/invitations/invitation-extension.ts +1 -2
- package/src/packlets/invitations/invitations-handler.ts +7 -8
- package/src/packlets/invitations/invitations-service.ts +11 -5
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
- package/src/packlets/network/network-service.test.ts +1 -1
- package/src/packlets/services/diagnostics.ts +2 -2
- package/src/packlets/services/service-context.ts +7 -13
- package/src/packlets/services/service-host.test.ts +3 -3
- package/src/packlets/services/service-host.ts +42 -6
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +1 -1
- package/src/packlets/spaces/data-space.ts +11 -3
- package/src/packlets/spaces/spaces-service.test.ts +1 -1
- package/src/packlets/spaces/spaces-service.ts +31 -10
- package/src/packlets/storage/storage.ts +10 -10
- package/src/packlets/testing/invitation-utils.ts +9 -9
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/vault/iframe-host-runtime.ts +1 -1
- package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
- package/src/packlets/vault/shell-runtime.ts +4 -4
- package/src/packlets/vault/worker-runtime.ts +9 -6
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-YLR3BYMV.mjs.map +0 -7
|
@@ -52,7 +52,7 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
|
|
|
52
52
|
|
|
53
53
|
// packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
|
|
54
54
|
var import_async18 = require("@dxos/async");
|
|
55
|
-
var
|
|
55
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
56
56
|
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
57
57
|
|
|
58
58
|
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
@@ -70,9 +70,6 @@ var import_log = require("@dxos/log");
|
|
|
70
70
|
var import_protocols = require("@dxos/protocols");
|
|
71
71
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
72
72
|
|
|
73
|
-
// packages/sdk/client-services/src/version.ts
|
|
74
|
-
var DXOS_VERSION = "0.1.58-main.ffbb8a1";
|
|
75
|
-
|
|
76
73
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
77
74
|
var getPlatform = () => {
|
|
78
75
|
if (process.browser) {
|
|
@@ -101,6 +98,9 @@ var getPlatform = () => {
|
|
|
101
98
|
}
|
|
102
99
|
};
|
|
103
100
|
|
|
101
|
+
// packages/sdk/client-services/src/version.ts
|
|
102
|
+
var DXOS_VERSION = "0.1.58-next.6d0af18";
|
|
103
|
+
|
|
104
104
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
105
105
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
106
106
|
var DEFAULT_TIMEOUT = 1e3;
|
|
@@ -224,13 +224,13 @@ var import_async11 = require("@dxos/async");
|
|
|
224
224
|
var import_context8 = require("@dxos/context");
|
|
225
225
|
var import_credentials15 = require("@dxos/credentials");
|
|
226
226
|
var import_debug7 = require("@dxos/debug");
|
|
227
|
-
var
|
|
227
|
+
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
228
228
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
229
|
-
var
|
|
229
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
230
230
|
var import_keyring = require("@dxos/keyring");
|
|
231
231
|
var import_keys8 = require("@dxos/keys");
|
|
232
232
|
var import_log13 = require("@dxos/log");
|
|
233
|
-
var
|
|
233
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
234
234
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
235
235
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
236
236
|
var import_tracing4 = require("@dxos/tracing");
|
|
@@ -255,7 +255,6 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
255
255
|
return Credential.encode(credential);
|
|
256
256
|
};
|
|
257
257
|
var TrustedKeySetAuthVerifier = class {
|
|
258
|
-
// prettier-ignore
|
|
259
258
|
constructor(_params) {
|
|
260
259
|
this._params = _params;
|
|
261
260
|
this._ctx = new import_context.Context();
|
|
@@ -270,7 +269,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
270
269
|
credential
|
|
271
270
|
}, {
|
|
272
271
|
F: __dxlog_file2,
|
|
273
|
-
L:
|
|
272
|
+
L: 56,
|
|
274
273
|
S: this,
|
|
275
274
|
C: (f, a) => f(...a)
|
|
276
275
|
});
|
|
@@ -280,7 +279,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
280
279
|
result
|
|
281
280
|
}, {
|
|
282
281
|
F: __dxlog_file2,
|
|
283
|
-
L:
|
|
282
|
+
L: 60,
|
|
284
283
|
S: this,
|
|
285
284
|
C: (f, a) => f(...a)
|
|
286
285
|
});
|
|
@@ -292,7 +291,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
292
291
|
credential
|
|
293
292
|
}, {
|
|
294
293
|
F: __dxlog_file2,
|
|
295
|
-
L:
|
|
294
|
+
L: 65,
|
|
296
295
|
S: this,
|
|
297
296
|
C: (f, a) => f(...a)
|
|
298
297
|
});
|
|
@@ -303,7 +302,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
303
302
|
key: credential.issuer
|
|
304
303
|
}, {
|
|
305
304
|
F: __dxlog_file2,
|
|
306
|
-
L:
|
|
305
|
+
L: 70,
|
|
307
306
|
S: this,
|
|
308
307
|
C: (f, a) => f(...a)
|
|
309
308
|
});
|
|
@@ -319,7 +318,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
319
318
|
key: credential.issuer
|
|
320
319
|
}, {
|
|
321
320
|
F: __dxlog_file2,
|
|
322
|
-
L:
|
|
321
|
+
L: 81,
|
|
323
322
|
S: this,
|
|
324
323
|
C: (f, a) => f(...a)
|
|
325
324
|
});
|
|
@@ -329,7 +328,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
329
328
|
key: credential.issuer
|
|
330
329
|
}, {
|
|
331
330
|
F: __dxlog_file2,
|
|
332
|
-
L:
|
|
331
|
+
L: 84,
|
|
333
332
|
S: this,
|
|
334
333
|
C: (f, a) => f(...a)
|
|
335
334
|
});
|
|
@@ -1059,7 +1058,6 @@ var import_async5 = require("@dxos/async");
|
|
|
1059
1058
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
1060
1059
|
var import_context4 = require("@dxos/context");
|
|
1061
1060
|
var import_credentials9 = require("@dxos/credentials");
|
|
1062
|
-
var import_errors2 = require("@dxos/errors");
|
|
1063
1061
|
var import_invariant7 = require("@dxos/invariant");
|
|
1064
1062
|
var import_keys4 = require("@dxos/keys");
|
|
1065
1063
|
var import_log6 = require("@dxos/log");
|
|
@@ -1071,7 +1069,6 @@ var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations")
|
|
|
1071
1069
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1072
1070
|
var import_async4 = require("@dxos/async");
|
|
1073
1071
|
var import_context3 = require("@dxos/context");
|
|
1074
|
-
var import_errors = require("@dxos/errors");
|
|
1075
1072
|
var import_invariant6 = require("@dxos/invariant");
|
|
1076
1073
|
var import_keys3 = require("@dxos/keys");
|
|
1077
1074
|
var import_log5 = require("@dxos/log");
|
|
@@ -1109,7 +1106,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1109
1106
|
options: async (options) => {
|
|
1110
1107
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1111
1108
|
F: __dxlog_file7,
|
|
1112
|
-
L:
|
|
1109
|
+
L: 87,
|
|
1113
1110
|
S: this,
|
|
1114
1111
|
A: [
|
|
1115
1112
|
"!this._remoteOptions",
|
|
@@ -1126,7 +1123,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1126
1123
|
id: traceId
|
|
1127
1124
|
}), {
|
|
1128
1125
|
F: __dxlog_file7,
|
|
1129
|
-
L:
|
|
1126
|
+
L: 96,
|
|
1130
1127
|
S: this,
|
|
1131
1128
|
C: (f, a) => f(...a)
|
|
1132
1129
|
});
|
|
@@ -1136,7 +1133,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1136
1133
|
invitationId
|
|
1137
1134
|
}, {
|
|
1138
1135
|
F: __dxlog_file7,
|
|
1139
|
-
L:
|
|
1136
|
+
L: 100,
|
|
1140
1137
|
S: this,
|
|
1141
1138
|
C: (f, a) => f(...a)
|
|
1142
1139
|
});
|
|
@@ -1150,7 +1147,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1150
1147
|
guestProfile: profile
|
|
1151
1148
|
}, {
|
|
1152
1149
|
F: __dxlog_file7,
|
|
1153
|
-
L:
|
|
1150
|
+
L: 109,
|
|
1154
1151
|
S: this,
|
|
1155
1152
|
C: (f, a) => f(...a)
|
|
1156
1153
|
});
|
|
@@ -1163,7 +1160,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1163
1160
|
id: traceId
|
|
1164
1161
|
}), {
|
|
1165
1162
|
F: __dxlog_file7,
|
|
1166
|
-
L:
|
|
1163
|
+
L: 116,
|
|
1167
1164
|
S: this,
|
|
1168
1165
|
C: (f, a) => f(...a)
|
|
1169
1166
|
});
|
|
@@ -1178,7 +1175,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1178
1175
|
id: traceId
|
|
1179
1176
|
}), {
|
|
1180
1177
|
F: __dxlog_file7,
|
|
1181
|
-
L:
|
|
1178
|
+
L: 125,
|
|
1182
1179
|
S: this,
|
|
1183
1180
|
C: (f, a) => f(...a)
|
|
1184
1181
|
});
|
|
@@ -1186,14 +1183,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1186
1183
|
authCode: code
|
|
1187
1184
|
}, {
|
|
1188
1185
|
F: __dxlog_file7,
|
|
1189
|
-
L:
|
|
1186
|
+
L: 126,
|
|
1190
1187
|
S: this,
|
|
1191
1188
|
C: (f, a) => f(...a)
|
|
1192
1189
|
});
|
|
1193
1190
|
let status = import_invitations.AuthenticationResponse.Status.OK;
|
|
1194
1191
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1195
1192
|
F: __dxlog_file7,
|
|
1196
|
-
L:
|
|
1193
|
+
L: 129,
|
|
1197
1194
|
S: this,
|
|
1198
1195
|
A: [
|
|
1199
1196
|
"this.invitation",
|
|
@@ -1204,7 +1201,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1204
1201
|
case import_services3.Invitation.AuthMethod.NONE: {
|
|
1205
1202
|
(0, import_log5.log)("authentication not required", void 0, {
|
|
1206
1203
|
F: __dxlog_file7,
|
|
1207
|
-
L:
|
|
1204
|
+
L: 132,
|
|
1208
1205
|
S: this,
|
|
1209
1206
|
C: (f, a) => f(...a)
|
|
1210
1207
|
});
|
|
@@ -1229,7 +1226,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1229
1226
|
authMethod: this.invitation.authMethod
|
|
1230
1227
|
}, {
|
|
1231
1228
|
F: __dxlog_file7,
|
|
1232
|
-
L:
|
|
1229
|
+
L: 150,
|
|
1233
1230
|
S: this,
|
|
1234
1231
|
C: (f, a) => f(...a)
|
|
1235
1232
|
});
|
|
@@ -1244,7 +1241,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1244
1241
|
}
|
|
1245
1242
|
}), {
|
|
1246
1243
|
F: __dxlog_file7,
|
|
1247
|
-
L:
|
|
1244
|
+
L: 156,
|
|
1248
1245
|
S: this,
|
|
1249
1246
|
C: (f, a) => f(...a)
|
|
1250
1247
|
});
|
|
@@ -1258,14 +1255,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1258
1255
|
id: traceId
|
|
1259
1256
|
}), {
|
|
1260
1257
|
F: __dxlog_file7,
|
|
1261
|
-
L:
|
|
1258
|
+
L: 162,
|
|
1262
1259
|
S: this,
|
|
1263
1260
|
C: (f, a) => f(...a)
|
|
1264
1261
|
});
|
|
1265
1262
|
try {
|
|
1266
1263
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1267
1264
|
F: __dxlog_file7,
|
|
1268
|
-
L:
|
|
1265
|
+
L: 165,
|
|
1269
1266
|
S: this,
|
|
1270
1267
|
A: [
|
|
1271
1268
|
"this.invitation",
|
|
@@ -1280,7 +1277,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1280
1277
|
id: traceId
|
|
1281
1278
|
}), {
|
|
1282
1279
|
F: __dxlog_file7,
|
|
1283
|
-
L:
|
|
1280
|
+
L: 173,
|
|
1284
1281
|
S: this,
|
|
1285
1282
|
C: (f, a) => f(...a)
|
|
1286
1283
|
});
|
|
@@ -1303,7 +1300,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1303
1300
|
timeout: OPTIONS_TIMEOUT
|
|
1304
1301
|
}));
|
|
1305
1302
|
if (this._remoteOptions?.role !== import_invitations.Options.Role.GUEST) {
|
|
1306
|
-
throw new
|
|
1303
|
+
throw new import_protocols4.InvalidInvitationExtensionRoleError(void 0, {
|
|
1307
1304
|
expected: import_invitations.Options.Role.GUEST,
|
|
1308
1305
|
remoteOptions: this._remoteOptions
|
|
1309
1306
|
});
|
|
@@ -1337,7 +1334,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1337
1334
|
options: async (options) => {
|
|
1338
1335
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1339
1336
|
F: __dxlog_file7,
|
|
1340
|
-
L:
|
|
1337
|
+
L: 240,
|
|
1341
1338
|
S: this,
|
|
1342
1339
|
A: [
|
|
1343
1340
|
"!this._remoteOptions",
|
|
@@ -1364,7 +1361,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1364
1361
|
try {
|
|
1365
1362
|
(0, import_log5.log)("begin options", void 0, {
|
|
1366
1363
|
F: __dxlog_file7,
|
|
1367
|
-
L:
|
|
1364
|
+
L: 261,
|
|
1368
1365
|
S: this,
|
|
1369
1366
|
C: (f, a) => f(...a)
|
|
1370
1367
|
});
|
|
@@ -1376,12 +1373,12 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1376
1373
|
}));
|
|
1377
1374
|
(0, import_log5.log)("end options", void 0, {
|
|
1378
1375
|
F: __dxlog_file7,
|
|
1379
|
-
L:
|
|
1376
|
+
L: 264,
|
|
1380
1377
|
S: this,
|
|
1381
1378
|
C: (f, a) => f(...a)
|
|
1382
1379
|
});
|
|
1383
1380
|
if (this._remoteOptions?.role !== import_invitations.Options.Role.HOST) {
|
|
1384
|
-
throw new
|
|
1381
|
+
throw new import_protocols4.InvalidInvitationExtensionRoleError(void 0, {
|
|
1385
1382
|
expected: import_invitations.Options.Role.HOST,
|
|
1386
1383
|
remoteOptions: this._remoteOptions
|
|
1387
1384
|
});
|
|
@@ -1390,7 +1387,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1390
1387
|
} catch (err) {
|
|
1391
1388
|
(0, import_log5.log)("openError", err, {
|
|
1392
1389
|
F: __dxlog_file7,
|
|
1393
|
-
L:
|
|
1390
|
+
L: 274,
|
|
1394
1391
|
S: this,
|
|
1395
1392
|
C: (f, a) => f(...a)
|
|
1396
1393
|
});
|
|
@@ -1400,7 +1397,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1400
1397
|
async onClose() {
|
|
1401
1398
|
(0, import_log5.log)("onClose", void 0, {
|
|
1402
1399
|
F: __dxlog_file7,
|
|
1403
|
-
L:
|
|
1400
|
+
L: 280,
|
|
1404
1401
|
S: this,
|
|
1405
1402
|
C: (f, a) => f(...a)
|
|
1406
1403
|
});
|
|
@@ -1423,7 +1420,7 @@ var InvitationsHandler = class {
|
|
|
1423
1420
|
const authCode = options?.authCode ?? (authMethod === import_services4.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials9.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1424
1421
|
(0, import_invariant7.invariant)(protocol, void 0, {
|
|
1425
1422
|
F: __dxlog_file8,
|
|
1426
|
-
L:
|
|
1423
|
+
L: 75,
|
|
1427
1424
|
S: this,
|
|
1428
1425
|
A: [
|
|
1429
1426
|
"protocol",
|
|
@@ -1452,7 +1449,7 @@ var InvitationsHandler = class {
|
|
|
1452
1449
|
...protocol.toJSON()
|
|
1453
1450
|
}, {
|
|
1454
1451
|
F: __dxlog_file8,
|
|
1455
|
-
L:
|
|
1452
|
+
L: 97,
|
|
1456
1453
|
S: this,
|
|
1457
1454
|
C: (f, a) => f(...a)
|
|
1458
1455
|
});
|
|
@@ -1477,7 +1474,7 @@ var InvitationsHandler = class {
|
|
|
1477
1474
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1478
1475
|
(0, import_invariant7.invariant)(deviceKey, void 0, {
|
|
1479
1476
|
F: __dxlog_file8,
|
|
1480
|
-
L:
|
|
1477
|
+
L: 118,
|
|
1481
1478
|
S: this,
|
|
1482
1479
|
A: [
|
|
1483
1480
|
"deviceKey",
|
|
@@ -1500,7 +1497,7 @@ var InvitationsHandler = class {
|
|
|
1500
1497
|
id: traceId
|
|
1501
1498
|
}), {
|
|
1502
1499
|
F: __dxlog_file8,
|
|
1503
|
-
L:
|
|
1500
|
+
L: 136,
|
|
1504
1501
|
S: this,
|
|
1505
1502
|
C: (f, a) => f(...a)
|
|
1506
1503
|
});
|
|
@@ -1508,7 +1505,7 @@ var InvitationsHandler = class {
|
|
|
1508
1505
|
...protocol.toJSON()
|
|
1509
1506
|
}, {
|
|
1510
1507
|
F: __dxlog_file8,
|
|
1511
|
-
L:
|
|
1508
|
+
L: 137,
|
|
1512
1509
|
S: this,
|
|
1513
1510
|
C: (f, a) => f(...a)
|
|
1514
1511
|
});
|
|
@@ -1524,7 +1521,7 @@ var InvitationsHandler = class {
|
|
|
1524
1521
|
...protocol.toJSON()
|
|
1525
1522
|
}, {
|
|
1526
1523
|
F: __dxlog_file8,
|
|
1527
|
-
L:
|
|
1524
|
+
L: 140,
|
|
1528
1525
|
S: this,
|
|
1529
1526
|
C: (f, a) => f(...a)
|
|
1530
1527
|
});
|
|
@@ -1536,7 +1533,7 @@ var InvitationsHandler = class {
|
|
|
1536
1533
|
id: traceId
|
|
1537
1534
|
}), {
|
|
1538
1535
|
F: __dxlog_file8,
|
|
1539
|
-
L:
|
|
1536
|
+
L: 142,
|
|
1540
1537
|
S: this,
|
|
1541
1538
|
C: (f, a) => f(...a)
|
|
1542
1539
|
});
|
|
@@ -1546,7 +1543,7 @@ var InvitationsHandler = class {
|
|
|
1546
1543
|
...protocol.toJSON()
|
|
1547
1544
|
}, {
|
|
1548
1545
|
F: __dxlog_file8,
|
|
1549
|
-
L:
|
|
1546
|
+
L: 145,
|
|
1550
1547
|
S: this,
|
|
1551
1548
|
C: (f, a) => f(...a)
|
|
1552
1549
|
});
|
|
@@ -1557,7 +1554,7 @@ var InvitationsHandler = class {
|
|
|
1557
1554
|
} else {
|
|
1558
1555
|
import_log6.log.error("failed", err, {
|
|
1559
1556
|
F: __dxlog_file8,
|
|
1560
|
-
L:
|
|
1557
|
+
L: 148,
|
|
1561
1558
|
S: this,
|
|
1562
1559
|
C: (f, a) => f(...a)
|
|
1563
1560
|
});
|
|
@@ -1568,7 +1565,7 @@ var InvitationsHandler = class {
|
|
|
1568
1565
|
error: err
|
|
1569
1566
|
}), {
|
|
1570
1567
|
F: __dxlog_file8,
|
|
1571
|
-
L:
|
|
1568
|
+
L: 151,
|
|
1572
1569
|
S: this,
|
|
1573
1570
|
C: (f, a) => f(...a)
|
|
1574
1571
|
});
|
|
@@ -1581,7 +1578,7 @@ var InvitationsHandler = class {
|
|
|
1581
1578
|
});
|
|
1582
1579
|
},
|
|
1583
1580
|
onError: (err) => {
|
|
1584
|
-
if (err instanceof
|
|
1581
|
+
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1585
1582
|
return;
|
|
1586
1583
|
}
|
|
1587
1584
|
if (err instanceof import_async5.TimeoutError) {
|
|
@@ -1589,7 +1586,7 @@ var InvitationsHandler = class {
|
|
|
1589
1586
|
...protocol.toJSON()
|
|
1590
1587
|
}, {
|
|
1591
1588
|
F: __dxlog_file8,
|
|
1592
|
-
L:
|
|
1589
|
+
L: 166,
|
|
1593
1590
|
S: this,
|
|
1594
1591
|
C: (f, a) => f(...a)
|
|
1595
1592
|
});
|
|
@@ -1600,7 +1597,7 @@ var InvitationsHandler = class {
|
|
|
1600
1597
|
} else {
|
|
1601
1598
|
import_log6.log.error("failed", err, {
|
|
1602
1599
|
F: __dxlog_file8,
|
|
1603
|
-
L:
|
|
1600
|
+
L: 169,
|
|
1604
1601
|
S: this,
|
|
1605
1602
|
C: (f, a) => f(...a)
|
|
1606
1603
|
});
|
|
@@ -1628,7 +1625,7 @@ var InvitationsHandler = class {
|
|
|
1628
1625
|
state: import_services4.Invitation.State.CONNECTING
|
|
1629
1626
|
});
|
|
1630
1627
|
});
|
|
1631
|
-
const observable = new import_client_protocol2.
|
|
1628
|
+
const observable = new import_client_protocol2.CancellableInvitation({
|
|
1632
1629
|
initialInvitation: invitation,
|
|
1633
1630
|
subscriber: stream.observable,
|
|
1634
1631
|
onCancel: async () => {
|
|
@@ -1645,7 +1642,7 @@ var InvitationsHandler = class {
|
|
|
1645
1642
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
1646
1643
|
(0, import_invariant7.invariant)(protocol, void 0, {
|
|
1647
1644
|
F: __dxlog_file8,
|
|
1648
|
-
L:
|
|
1645
|
+
L: 210,
|
|
1649
1646
|
S: this,
|
|
1650
1647
|
A: [
|
|
1651
1648
|
"protocol",
|
|
@@ -1659,7 +1656,7 @@ var InvitationsHandler = class {
|
|
|
1659
1656
|
const setState = (newData) => {
|
|
1660
1657
|
(0, import_invariant7.invariant)(newData.state !== void 0, void 0, {
|
|
1661
1658
|
F: __dxlog_file8,
|
|
1662
|
-
L:
|
|
1659
|
+
L: 221,
|
|
1663
1660
|
S: this,
|
|
1664
1661
|
A: [
|
|
1665
1662
|
"newData.state !== undefined",
|
|
@@ -1679,7 +1676,7 @@ var InvitationsHandler = class {
|
|
|
1679
1676
|
...protocol.toJSON()
|
|
1680
1677
|
}, {
|
|
1681
1678
|
F: __dxlog_file8,
|
|
1682
|
-
L:
|
|
1679
|
+
L: 229,
|
|
1683
1680
|
S: this,
|
|
1684
1681
|
C: (f, a) => f(...a)
|
|
1685
1682
|
});
|
|
@@ -1689,7 +1686,7 @@ var InvitationsHandler = class {
|
|
|
1689
1686
|
} else {
|
|
1690
1687
|
import_log6.log.warn("auth failed", err, {
|
|
1691
1688
|
F: __dxlog_file8,
|
|
1692
|
-
L:
|
|
1689
|
+
L: 232,
|
|
1693
1690
|
S: this,
|
|
1694
1691
|
C: (f, a) => f(...a)
|
|
1695
1692
|
});
|
|
@@ -1703,7 +1700,7 @@ var InvitationsHandler = class {
|
|
|
1703
1700
|
...protocol.toJSON()
|
|
1704
1701
|
}, {
|
|
1705
1702
|
F: __dxlog_file8,
|
|
1706
|
-
L:
|
|
1703
|
+
L: 240,
|
|
1707
1704
|
S: this,
|
|
1708
1705
|
C: (f, a) => f(...a)
|
|
1709
1706
|
});
|
|
@@ -1718,7 +1715,7 @@ var InvitationsHandler = class {
|
|
|
1718
1715
|
currentState
|
|
1719
1716
|
}, {
|
|
1720
1717
|
F: __dxlog_file8,
|
|
1721
|
-
L:
|
|
1718
|
+
L: 250,
|
|
1722
1719
|
S: this,
|
|
1723
1720
|
C: (f, a) => f(...a)
|
|
1724
1721
|
});
|
|
@@ -1733,7 +1730,7 @@ var InvitationsHandler = class {
|
|
|
1733
1730
|
id: traceId
|
|
1734
1731
|
}), {
|
|
1735
1732
|
F: __dxlog_file8,
|
|
1736
|
-
L:
|
|
1733
|
+
L: 259,
|
|
1737
1734
|
S: this,
|
|
1738
1735
|
C: (f, a) => f(...a)
|
|
1739
1736
|
});
|
|
@@ -1745,7 +1742,7 @@ var InvitationsHandler = class {
|
|
|
1745
1742
|
...protocol.toJSON()
|
|
1746
1743
|
}, {
|
|
1747
1744
|
F: __dxlog_file8,
|
|
1748
|
-
L:
|
|
1745
|
+
L: 267,
|
|
1749
1746
|
S: this,
|
|
1750
1747
|
C: (f, a) => f(...a)
|
|
1751
1748
|
});
|
|
@@ -1756,7 +1753,7 @@ var InvitationsHandler = class {
|
|
|
1756
1753
|
...protocol.toJSON()
|
|
1757
1754
|
}, {
|
|
1758
1755
|
F: __dxlog_file8,
|
|
1759
|
-
L:
|
|
1756
|
+
L: 271,
|
|
1760
1757
|
S: this,
|
|
1761
1758
|
C: (f, a) => f(...a)
|
|
1762
1759
|
});
|
|
@@ -1766,7 +1763,7 @@ var InvitationsHandler = class {
|
|
|
1766
1763
|
response: introductionResponse
|
|
1767
1764
|
}, {
|
|
1768
1765
|
F: __dxlog_file8,
|
|
1769
|
-
L:
|
|
1766
|
+
L: 275,
|
|
1770
1767
|
S: this,
|
|
1771
1768
|
C: (f, a) => f(...a)
|
|
1772
1769
|
});
|
|
@@ -1778,7 +1775,7 @@ var InvitationsHandler = class {
|
|
|
1778
1775
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1779
1776
|
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
1780
1777
|
F: __dxlog_file8,
|
|
1781
|
-
L:
|
|
1778
|
+
L: 284,
|
|
1782
1779
|
S: this,
|
|
1783
1780
|
C: (f, a) => f(...a)
|
|
1784
1781
|
});
|
|
@@ -1790,7 +1787,7 @@ var InvitationsHandler = class {
|
|
|
1790
1787
|
});
|
|
1791
1788
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
1792
1789
|
F: __dxlog_file8,
|
|
1793
|
-
L:
|
|
1790
|
+
L: 288,
|
|
1794
1791
|
S: this,
|
|
1795
1792
|
C: (f, a) => f(...a)
|
|
1796
1793
|
});
|
|
@@ -1811,7 +1808,7 @@ var InvitationsHandler = class {
|
|
|
1811
1808
|
attempt
|
|
1812
1809
|
}, {
|
|
1813
1810
|
F: __dxlog_file8,
|
|
1814
|
-
L:
|
|
1811
|
+
L: 299,
|
|
1815
1812
|
S: this,
|
|
1816
1813
|
C: (f, a) => f(...a)
|
|
1817
1814
|
});
|
|
@@ -1828,7 +1825,7 @@ var InvitationsHandler = class {
|
|
|
1828
1825
|
...protocol.toJSON()
|
|
1829
1826
|
}, {
|
|
1830
1827
|
F: __dxlog_file8,
|
|
1831
|
-
L:
|
|
1828
|
+
L: 310,
|
|
1832
1829
|
S: this,
|
|
1833
1830
|
C: (f, a) => f(...a)
|
|
1834
1831
|
});
|
|
@@ -1840,7 +1837,7 @@ var InvitationsHandler = class {
|
|
|
1840
1837
|
...protocol.toJSON()
|
|
1841
1838
|
}, {
|
|
1842
1839
|
F: __dxlog_file8,
|
|
1843
|
-
L:
|
|
1840
|
+
L: 321,
|
|
1844
1841
|
S: this,
|
|
1845
1842
|
C: (f, a) => f(...a)
|
|
1846
1843
|
});
|
|
@@ -1852,7 +1849,7 @@ var InvitationsHandler = class {
|
|
|
1852
1849
|
id: traceId
|
|
1853
1850
|
}), {
|
|
1854
1851
|
F: __dxlog_file8,
|
|
1855
|
-
L:
|
|
1852
|
+
L: 323,
|
|
1856
1853
|
S: this,
|
|
1857
1854
|
C: (f, a) => f(...a)
|
|
1858
1855
|
});
|
|
@@ -1862,7 +1859,7 @@ var InvitationsHandler = class {
|
|
|
1862
1859
|
...protocol.toJSON()
|
|
1863
1860
|
}, {
|
|
1864
1861
|
F: __dxlog_file8,
|
|
1865
|
-
L:
|
|
1862
|
+
L: 326,
|
|
1866
1863
|
S: this,
|
|
1867
1864
|
C: (f, a) => f(...a)
|
|
1868
1865
|
});
|
|
@@ -1872,7 +1869,7 @@ var InvitationsHandler = class {
|
|
|
1872
1869
|
} else {
|
|
1873
1870
|
(0, import_log6.log)("auth failed", err, {
|
|
1874
1871
|
F: __dxlog_file8,
|
|
1875
|
-
L:
|
|
1872
|
+
L: 329,
|
|
1876
1873
|
S: this,
|
|
1877
1874
|
C: (f, a) => f(...a)
|
|
1878
1875
|
});
|
|
@@ -1883,7 +1880,7 @@ var InvitationsHandler = class {
|
|
|
1883
1880
|
error: err
|
|
1884
1881
|
}), {
|
|
1885
1882
|
F: __dxlog_file8,
|
|
1886
|
-
L:
|
|
1883
|
+
L: 332,
|
|
1887
1884
|
S: this,
|
|
1888
1885
|
C: (f, a) => f(...a)
|
|
1889
1886
|
});
|
|
@@ -1893,7 +1890,7 @@ var InvitationsHandler = class {
|
|
|
1893
1890
|
});
|
|
1894
1891
|
},
|
|
1895
1892
|
onError: (err) => {
|
|
1896
|
-
if (err instanceof
|
|
1893
|
+
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
1897
1894
|
return;
|
|
1898
1895
|
}
|
|
1899
1896
|
if (err instanceof import_async5.TimeoutError) {
|
|
@@ -1901,7 +1898,7 @@ var InvitationsHandler = class {
|
|
|
1901
1898
|
...protocol.toJSON()
|
|
1902
1899
|
}, {
|
|
1903
1900
|
F: __dxlog_file8,
|
|
1904
|
-
L:
|
|
1901
|
+
L: 343,
|
|
1905
1902
|
S: this,
|
|
1906
1903
|
C: (f, a) => f(...a)
|
|
1907
1904
|
});
|
|
@@ -1911,7 +1908,7 @@ var InvitationsHandler = class {
|
|
|
1911
1908
|
} else {
|
|
1912
1909
|
(0, import_log6.log)("auth failed", err, {
|
|
1913
1910
|
F: __dxlog_file8,
|
|
1914
|
-
L:
|
|
1911
|
+
L: 346,
|
|
1915
1912
|
S: this,
|
|
1916
1913
|
C: (f, a) => f(...a)
|
|
1917
1914
|
});
|
|
@@ -1924,7 +1921,7 @@ var InvitationsHandler = class {
|
|
|
1924
1921
|
(0, import_async5.scheduleTask)(ctx, async () => {
|
|
1925
1922
|
(0, import_invariant7.invariant)(invitation.swarmKey, void 0, {
|
|
1926
1923
|
F: __dxlog_file8,
|
|
1927
|
-
L:
|
|
1924
|
+
L: 356,
|
|
1928
1925
|
S: this,
|
|
1929
1926
|
A: [
|
|
1930
1927
|
"invitation.swarmKey",
|
|
@@ -1946,7 +1943,7 @@ var InvitationsHandler = class {
|
|
|
1946
1943
|
state: import_services4.Invitation.State.CONNECTING
|
|
1947
1944
|
});
|
|
1948
1945
|
});
|
|
1949
|
-
const observable = new import_client_protocol2.
|
|
1946
|
+
const observable = new import_client_protocol2.AuthenticatingInvitation({
|
|
1950
1947
|
initialInvitation: invitation,
|
|
1951
1948
|
subscriber: stream.observable,
|
|
1952
1949
|
onCancel: async () => {
|
|
@@ -2004,6 +2001,9 @@ var InvitationsServiceImpl = class {
|
|
|
2004
2001
|
}, () => {
|
|
2005
2002
|
close();
|
|
2006
2003
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2004
|
+
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2005
|
+
this._removedCreated.emit(invitation.get());
|
|
2006
|
+
}
|
|
2007
2007
|
});
|
|
2008
2008
|
});
|
|
2009
2009
|
}
|
|
@@ -2026,19 +2026,22 @@ var InvitationsServiceImpl = class {
|
|
|
2026
2026
|
}, () => {
|
|
2027
2027
|
close();
|
|
2028
2028
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2029
|
+
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2030
|
+
this._removedAccepted.emit(invitation.get());
|
|
2031
|
+
}
|
|
2029
2032
|
});
|
|
2030
2033
|
});
|
|
2031
2034
|
}
|
|
2032
2035
|
async authenticate({ invitationId, authCode }) {
|
|
2033
2036
|
(0, import_log7.log)("authenticating...", void 0, {
|
|
2034
2037
|
F: __dxlog_file9,
|
|
2035
|
-
L:
|
|
2038
|
+
L: 108,
|
|
2036
2039
|
S: this,
|
|
2037
2040
|
C: (f, a) => f(...a)
|
|
2038
2041
|
});
|
|
2039
2042
|
(0, import_invariant8.invariant)(invitationId, void 0, {
|
|
2040
2043
|
F: __dxlog_file9,
|
|
2041
|
-
L:
|
|
2044
|
+
L: 109,
|
|
2042
2045
|
S: this,
|
|
2043
2046
|
A: [
|
|
2044
2047
|
"invitationId",
|
|
@@ -2051,7 +2054,7 @@ var InvitationsServiceImpl = class {
|
|
|
2051
2054
|
invitationId
|
|
2052
2055
|
}, {
|
|
2053
2056
|
F: __dxlog_file9,
|
|
2054
|
-
L:
|
|
2057
|
+
L: 112,
|
|
2055
2058
|
S: this,
|
|
2056
2059
|
C: (f, a) => f(...a)
|
|
2057
2060
|
});
|
|
@@ -2062,13 +2065,13 @@ var InvitationsServiceImpl = class {
|
|
|
2062
2065
|
async cancelInvitation({ invitationId }) {
|
|
2063
2066
|
(0, import_log7.log)("deleting...", void 0, {
|
|
2064
2067
|
F: __dxlog_file9,
|
|
2065
|
-
L:
|
|
2068
|
+
L: 119,
|
|
2066
2069
|
S: this,
|
|
2067
2070
|
C: (f, a) => f(...a)
|
|
2068
2071
|
});
|
|
2069
2072
|
(0, import_invariant8.invariant)(invitationId, void 0, {
|
|
2070
2073
|
F: __dxlog_file9,
|
|
2071
|
-
L:
|
|
2074
|
+
L: 120,
|
|
2072
2075
|
S: this,
|
|
2073
2076
|
A: [
|
|
2074
2077
|
"invitationId",
|
|
@@ -2090,7 +2093,7 @@ var InvitationsServiceImpl = class {
|
|
|
2090
2093
|
invitationId
|
|
2091
2094
|
}, {
|
|
2092
2095
|
F: __dxlog_file9,
|
|
2093
|
-
L:
|
|
2096
|
+
L: 132,
|
|
2094
2097
|
S: this,
|
|
2095
2098
|
C: (f, a) => f(...a)
|
|
2096
2099
|
});
|
|
@@ -2309,7 +2312,7 @@ var import_credentials14 = require("@dxos/credentials");
|
|
|
2309
2312
|
var import_invariant11 = require("@dxos/invariant");
|
|
2310
2313
|
var import_keys7 = require("@dxos/keys");
|
|
2311
2314
|
var import_log11 = require("@dxos/log");
|
|
2312
|
-
var
|
|
2315
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
2313
2316
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2314
2317
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
2315
2318
|
var import_util4 = require("@dxos/util");
|
|
@@ -2320,9 +2323,9 @@ var import_client_protocol3 = require("@dxos/client-protocol");
|
|
|
2320
2323
|
var import_context6 = require("@dxos/context");
|
|
2321
2324
|
var import_debug4 = require("@dxos/debug");
|
|
2322
2325
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
2323
|
-
var import_errors3 = require("@dxos/errors");
|
|
2324
2326
|
var import_keys6 = require("@dxos/keys");
|
|
2325
2327
|
var import_log10 = require("@dxos/log");
|
|
2328
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
2326
2329
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2327
2330
|
var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
2328
2331
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
@@ -2631,7 +2634,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2631
2634
|
this._signingContext = params.signingContext;
|
|
2632
2635
|
this._callbacks = params.callbacks ?? {};
|
|
2633
2636
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
2634
|
-
trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.
|
|
2637
|
+
trustedKeysProvider: () => new import_util3.ComplexSet(import_keys6.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
|
|
2635
2638
|
update: this._inner.stateUpdate,
|
|
2636
2639
|
authTimeout: import_client_protocol3.AUTH_TIMEOUT
|
|
2637
2640
|
});
|
|
@@ -2641,7 +2644,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2641
2644
|
state: import_services7.SpaceState[this._state]
|
|
2642
2645
|
}, {
|
|
2643
2646
|
F: __dxlog_file12,
|
|
2644
|
-
L:
|
|
2647
|
+
L: 118,
|
|
2645
2648
|
S: this,
|
|
2646
2649
|
C: (f, a) => f(...a)
|
|
2647
2650
|
});
|
|
@@ -2675,6 +2678,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2675
2678
|
await this._open();
|
|
2676
2679
|
}
|
|
2677
2680
|
async _open() {
|
|
2681
|
+
await this._gossip.open();
|
|
2678
2682
|
await this._notarizationPlugin.open();
|
|
2679
2683
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
2680
2684
|
await this._inner.open(new import_context6.Context());
|
|
@@ -2683,7 +2687,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2683
2687
|
state: import_services7.SpaceState[this._state]
|
|
2684
2688
|
}, {
|
|
2685
2689
|
F: __dxlog_file12,
|
|
2686
|
-
L:
|
|
2690
|
+
L: 165,
|
|
2687
2691
|
S: this,
|
|
2688
2692
|
C: (f, a) => f(...a)
|
|
2689
2693
|
});
|
|
@@ -2701,7 +2705,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2701
2705
|
state: import_services7.SpaceState[this._state]
|
|
2702
2706
|
}, {
|
|
2703
2707
|
F: __dxlog_file12,
|
|
2704
|
-
L:
|
|
2708
|
+
L: 179,
|
|
2705
2709
|
S: this,
|
|
2706
2710
|
C: (f, a) => f(...a)
|
|
2707
2711
|
});
|
|
@@ -2712,6 +2716,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2712
2716
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
2713
2717
|
await this._notarizationPlugin.close();
|
|
2714
2718
|
await this._presence.destroy();
|
|
2719
|
+
await this._gossip.close();
|
|
2715
2720
|
}
|
|
2716
2721
|
async postMessage(channel, message) {
|
|
2717
2722
|
return this._gossip.postMessage(channel, message);
|
|
@@ -2728,10 +2733,10 @@ var DataSpace = class DataSpace2 {
|
|
|
2728
2733
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
2729
2734
|
await this.initializeDataPipeline();
|
|
2730
2735
|
} catch (err) {
|
|
2731
|
-
if (err instanceof
|
|
2736
|
+
if (err instanceof import_protocols7.CancelledError) {
|
|
2732
2737
|
(0, import_log10.log)("data pipeline initialization cancelled", err, {
|
|
2733
2738
|
F: __dxlog_file12,
|
|
2734
|
-
L:
|
|
2739
|
+
L: 211,
|
|
2735
2740
|
S: this,
|
|
2736
2741
|
C: (f, a) => f(...a)
|
|
2737
2742
|
});
|
|
@@ -2739,7 +2744,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2739
2744
|
}
|
|
2740
2745
|
import_log10.log.error("Error initializing data pipeline", err, {
|
|
2741
2746
|
F: __dxlog_file12,
|
|
2742
|
-
L:
|
|
2747
|
+
L: 215,
|
|
2743
2748
|
S: this,
|
|
2744
2749
|
C: (f, a) => f(...a)
|
|
2745
2750
|
});
|
|
@@ -2748,7 +2753,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2748
2753
|
state: import_services7.SpaceState[this._state]
|
|
2749
2754
|
}, {
|
|
2750
2755
|
F: __dxlog_file12,
|
|
2751
|
-
L:
|
|
2756
|
+
L: 217,
|
|
2752
2757
|
S: this,
|
|
2753
2758
|
C: (f, a) => f(...a)
|
|
2754
2759
|
});
|
|
@@ -2761,14 +2766,14 @@ var DataSpace = class DataSpace2 {
|
|
|
2761
2766
|
}
|
|
2762
2767
|
async initializeDataPipeline() {
|
|
2763
2768
|
if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
|
|
2764
|
-
throw new
|
|
2769
|
+
throw new import_protocols7.SystemError("Invalid operation");
|
|
2765
2770
|
}
|
|
2766
2771
|
this._state = import_services7.SpaceState.INITIALIZING;
|
|
2767
2772
|
(0, import_log10.log)("new state", {
|
|
2768
2773
|
state: import_services7.SpaceState[this._state]
|
|
2769
2774
|
}, {
|
|
2770
2775
|
F: __dxlog_file12,
|
|
2771
|
-
L:
|
|
2776
|
+
L: 233,
|
|
2772
2777
|
S: this,
|
|
2773
2778
|
C: (f, a) => f(...a)
|
|
2774
2779
|
});
|
|
@@ -2779,7 +2784,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2779
2784
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
2780
2785
|
(0, import_log10.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
2781
2786
|
F: __dxlog_file12,
|
|
2782
|
-
L:
|
|
2787
|
+
L: 247,
|
|
2783
2788
|
S: this,
|
|
2784
2789
|
C: (f, a) => f(...a)
|
|
2785
2790
|
});
|
|
@@ -2790,7 +2795,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2790
2795
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
2791
2796
|
(0, import_log10.log)("data pipeline ready", void 0, {
|
|
2792
2797
|
F: __dxlog_file12,
|
|
2793
|
-
L:
|
|
2798
|
+
L: 256,
|
|
2794
2799
|
S: this,
|
|
2795
2800
|
C: (f, a) => f(...a)
|
|
2796
2801
|
});
|
|
@@ -2800,7 +2805,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2800
2805
|
state: import_services7.SpaceState[this._state]
|
|
2801
2806
|
}, {
|
|
2802
2807
|
F: __dxlog_file12,
|
|
2803
|
-
L:
|
|
2808
|
+
L: 260,
|
|
2804
2809
|
S: this,
|
|
2805
2810
|
C: (f, a) => f(...a)
|
|
2806
2811
|
});
|
|
@@ -2816,7 +2821,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2816
2821
|
await this._createWritableFeeds();
|
|
2817
2822
|
(0, import_log10.log)("writable feeds created", void 0, {
|
|
2818
2823
|
F: __dxlog_file12,
|
|
2819
|
-
L:
|
|
2824
|
+
L: 276,
|
|
2820
2825
|
S: this,
|
|
2821
2826
|
C: (f, a) => f(...a)
|
|
2822
2827
|
});
|
|
@@ -2921,7 +2926,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2921
2926
|
state: import_services7.SpaceState[this._state]
|
|
2922
2927
|
}, {
|
|
2923
2928
|
F: __dxlog_file12,
|
|
2924
|
-
L:
|
|
2929
|
+
L: 392,
|
|
2925
2930
|
S: this,
|
|
2926
2931
|
C: (f, a) => f(...a)
|
|
2927
2932
|
});
|
|
@@ -3063,7 +3068,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3063
3068
|
S: this,
|
|
3064
3069
|
C: (f, a) => f(...a)
|
|
3065
3070
|
});
|
|
3066
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3071
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.begin({
|
|
3067
3072
|
id: this._instanceId
|
|
3068
3073
|
}), {
|
|
3069
3074
|
F: __dxlog_file13,
|
|
@@ -3109,7 +3114,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3109
3114
|
space.initializeDataPipelineAsync();
|
|
3110
3115
|
}
|
|
3111
3116
|
}
|
|
3112
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3117
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols8.trace.end({
|
|
3113
3118
|
id: this._instanceId
|
|
3114
3119
|
}), {
|
|
3115
3120
|
F: __dxlog_file13,
|
|
@@ -3363,10 +3368,9 @@ DataSpaceManager = _ts_decorate4([
|
|
|
3363
3368
|
var import_async10 = require("@dxos/async");
|
|
3364
3369
|
var import_codec_protobuf5 = require("@dxos/codec-protobuf");
|
|
3365
3370
|
var import_debug6 = require("@dxos/debug");
|
|
3366
|
-
var
|
|
3367
|
-
var import_errors4 = require("@dxos/errors");
|
|
3371
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
3368
3372
|
var import_log12 = require("@dxos/log");
|
|
3369
|
-
var
|
|
3373
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
3370
3374
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3371
3375
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
3372
3376
|
var SpacesServiceImpl = class {
|
|
@@ -3386,7 +3390,7 @@ var SpacesServiceImpl = class {
|
|
|
3386
3390
|
}
|
|
3387
3391
|
async updateSpace({ spaceKey, state }) {
|
|
3388
3392
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3389
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3393
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3390
3394
|
if (state) {
|
|
3391
3395
|
switch (state) {
|
|
3392
3396
|
case import_services9.SpaceState.ACTIVE:
|
|
@@ -3396,7 +3400,7 @@ var SpacesServiceImpl = class {
|
|
|
3396
3400
|
await space.deactivate();
|
|
3397
3401
|
break;
|
|
3398
3402
|
default:
|
|
3399
|
-
throw new
|
|
3403
|
+
throw new import_protocols9.ApiError("Invalid space state");
|
|
3400
3404
|
}
|
|
3401
3405
|
}
|
|
3402
3406
|
}
|
|
@@ -3429,7 +3433,7 @@ var SpacesServiceImpl = class {
|
|
|
3429
3433
|
subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
|
|
3430
3434
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
3431
3435
|
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
3432
|
-
space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
|
|
3436
|
+
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3433
3437
|
if (space.dataPipeline.pipelineState) {
|
|
3434
3438
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3435
3439
|
}
|
|
@@ -3451,14 +3455,14 @@ var SpacesServiceImpl = class {
|
|
|
3451
3455
|
}
|
|
3452
3456
|
async postMessage({ spaceKey, channel, message }) {
|
|
3453
3457
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3454
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3458
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3455
3459
|
await space.postMessage(getChannelId(channel), message);
|
|
3456
3460
|
}
|
|
3457
3461
|
subscribeMessages({ spaceKey, channel }) {
|
|
3458
3462
|
return new import_codec_protobuf5.Stream(({ ctx, next }) => {
|
|
3459
3463
|
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3460
3464
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3461
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3465
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3462
3466
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
3463
3467
|
next(message);
|
|
3464
3468
|
});
|
|
@@ -3466,38 +3470,83 @@ var SpacesServiceImpl = class {
|
|
|
3466
3470
|
});
|
|
3467
3471
|
});
|
|
3468
3472
|
}
|
|
3469
|
-
queryCredentials({ spaceKey }) {
|
|
3470
|
-
return new import_codec_protobuf5.Stream(({ ctx, next }) => {
|
|
3471
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3473
|
+
queryCredentials({ spaceKey, noTail }) {
|
|
3474
|
+
return new import_codec_protobuf5.Stream(({ ctx, next, close }) => {
|
|
3475
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3472
3476
|
const processor = {
|
|
3473
3477
|
processCredential: async (credential) => {
|
|
3474
3478
|
next(credential);
|
|
3475
3479
|
}
|
|
3476
3480
|
};
|
|
3477
3481
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3478
|
-
(0, import_async10.scheduleTask)(ctx, () =>
|
|
3482
|
+
(0, import_async10.scheduleTask)(ctx, async () => {
|
|
3483
|
+
await space.spaceState.addCredentialProcessor(processor);
|
|
3484
|
+
if (noTail) {
|
|
3485
|
+
close();
|
|
3486
|
+
}
|
|
3487
|
+
});
|
|
3479
3488
|
});
|
|
3480
3489
|
}
|
|
3481
3490
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3482
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3491
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3483
3492
|
for (const credential of credentials ?? []) {
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
credential
|
|
3487
|
-
|
|
3488
|
-
|
|
3493
|
+
if (credential.proof) {
|
|
3494
|
+
await space.controlPipeline.writer.write({
|
|
3495
|
+
credential: {
|
|
3496
|
+
credential
|
|
3497
|
+
}
|
|
3498
|
+
});
|
|
3499
|
+
} else {
|
|
3500
|
+
(0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
3501
|
+
F: __dxlog_file14,
|
|
3502
|
+
L: 168,
|
|
3503
|
+
S: this,
|
|
3504
|
+
A: [
|
|
3505
|
+
"!credential.id",
|
|
3506
|
+
"'Id on unsigned credentials is not allowed'"
|
|
3507
|
+
]
|
|
3508
|
+
});
|
|
3509
|
+
(0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
3510
|
+
F: __dxlog_file14,
|
|
3511
|
+
L: 169,
|
|
3512
|
+
S: this,
|
|
3513
|
+
A: [
|
|
3514
|
+
"this._identityManager.identity",
|
|
3515
|
+
"'Identity is not available'"
|
|
3516
|
+
]
|
|
3517
|
+
});
|
|
3518
|
+
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
3519
|
+
(0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
3520
|
+
F: __dxlog_file14,
|
|
3521
|
+
L: 171,
|
|
3522
|
+
S: this,
|
|
3523
|
+
A: [
|
|
3524
|
+
"credential.issuer.equals(signer.getIssuer())",
|
|
3525
|
+
""
|
|
3526
|
+
]
|
|
3527
|
+
});
|
|
3528
|
+
const signedCredential = await signer.createCredential({
|
|
3529
|
+
subject: credential.subject.id,
|
|
3530
|
+
assertion: credential.subject.assertion
|
|
3531
|
+
});
|
|
3532
|
+
await space.controlPipeline.writer.write({
|
|
3533
|
+
credential: {
|
|
3534
|
+
credential: signedCredential
|
|
3535
|
+
}
|
|
3536
|
+
});
|
|
3537
|
+
}
|
|
3489
3538
|
}
|
|
3490
3539
|
}
|
|
3491
3540
|
async createEpoch({ spaceKey }) {
|
|
3492
3541
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3493
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3542
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols9.SpaceNotFoundError(spaceKey));
|
|
3494
3543
|
await space.createEpoch();
|
|
3495
3544
|
}
|
|
3496
3545
|
_serializeSpace(space) {
|
|
3497
3546
|
return {
|
|
3498
3547
|
spaceKey: space.key,
|
|
3499
3548
|
state: space.state,
|
|
3500
|
-
error: space.error ? (0,
|
|
3549
|
+
error: space.error ? (0, import_protocols9.encodeError)(space.error) : void 0,
|
|
3501
3550
|
pipeline: {
|
|
3502
3551
|
currentEpoch: space.dataPipeline.currentEpoch,
|
|
3503
3552
|
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
@@ -3524,7 +3573,7 @@ var SpacesServiceImpl = class {
|
|
|
3524
3573
|
displayName: member.assertion.profile?.displayName
|
|
3525
3574
|
}
|
|
3526
3575
|
},
|
|
3527
|
-
presence: isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
|
|
3576
|
+
presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
|
|
3528
3577
|
peerStates: peers
|
|
3529
3578
|
};
|
|
3530
3579
|
}),
|
|
@@ -3549,18 +3598,17 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3549
3598
|
}
|
|
3550
3599
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
3551
3600
|
var ServiceContext = class ServiceContext2 {
|
|
3552
|
-
// prettier-ignore
|
|
3553
3601
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
3554
3602
|
this.storage = storage;
|
|
3555
3603
|
this.networkManager = networkManager;
|
|
3556
3604
|
this.signalManager = signalManager;
|
|
3557
3605
|
this.modelFactory = modelFactory;
|
|
3558
3606
|
this.initialized = new import_async11.Trigger();
|
|
3559
|
-
this.dataServiceSubscriptions = new
|
|
3607
|
+
this.dataServiceSubscriptions = new import_echo_pipeline2.DataServiceSubscriptions();
|
|
3560
3608
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
3561
3609
|
this._instanceId = import_keys8.PublicKey.random().toHex();
|
|
3562
|
-
this.metadataStore = new
|
|
3563
|
-
this.snapshotStore = new
|
|
3610
|
+
this.metadataStore = new import_echo_pipeline2.MetadataStore(storage.createDirectory("metadata"));
|
|
3611
|
+
this.snapshotStore = new import_echo_pipeline2.SnapshotStore(storage.createDirectory("snapshots"));
|
|
3564
3612
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
3565
3613
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
3566
3614
|
this.feedStore = new import_feed_store3.FeedStore({
|
|
@@ -3568,12 +3616,12 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3568
3616
|
root: storage.createDirectory("feeds"),
|
|
3569
3617
|
signer: this.keyring,
|
|
3570
3618
|
hypercore: {
|
|
3571
|
-
valueEncoding:
|
|
3619
|
+
valueEncoding: import_echo_pipeline2.valueEncoding,
|
|
3572
3620
|
stats: true
|
|
3573
3621
|
}
|
|
3574
3622
|
})
|
|
3575
3623
|
});
|
|
3576
|
-
this.spaceManager = new
|
|
3624
|
+
this.spaceManager = new import_echo_pipeline2.SpaceManager({
|
|
3577
3625
|
feedStore: this.feedStore,
|
|
3578
3626
|
networkManager: this.networkManager,
|
|
3579
3627
|
blobStore: this.blobStore,
|
|
@@ -3589,15 +3637,15 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3589
3637
|
await this._checkStorageVersion();
|
|
3590
3638
|
(0, import_log13.log)("opening...", void 0, {
|
|
3591
3639
|
F: __dxlog_file15,
|
|
3592
|
-
L:
|
|
3640
|
+
L: 129,
|
|
3593
3641
|
S: this,
|
|
3594
3642
|
C: (f, a) => f(...a)
|
|
3595
3643
|
});
|
|
3596
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
3644
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.begin({
|
|
3597
3645
|
id: this._instanceId
|
|
3598
3646
|
}), {
|
|
3599
3647
|
F: __dxlog_file15,
|
|
3600
|
-
L:
|
|
3648
|
+
L: 130,
|
|
3601
3649
|
S: this,
|
|
3602
3650
|
C: (f, a) => f(...a)
|
|
3603
3651
|
});
|
|
@@ -3609,17 +3657,17 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3609
3657
|
if (this.identityManager.identity) {
|
|
3610
3658
|
await this._initialize(ctx);
|
|
3611
3659
|
}
|
|
3612
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
3660
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols10.trace.end({
|
|
3613
3661
|
id: this._instanceId
|
|
3614
3662
|
}), {
|
|
3615
3663
|
F: __dxlog_file15,
|
|
3616
|
-
L:
|
|
3664
|
+
L: 140,
|
|
3617
3665
|
S: this,
|
|
3618
3666
|
C: (f, a) => f(...a)
|
|
3619
3667
|
});
|
|
3620
3668
|
(0, import_log13.log)("opened", void 0, {
|
|
3621
3669
|
F: __dxlog_file15,
|
|
3622
|
-
L:
|
|
3670
|
+
L: 141,
|
|
3623
3671
|
S: this,
|
|
3624
3672
|
C: (f, a) => f(...a)
|
|
3625
3673
|
});
|
|
@@ -3627,7 +3675,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3627
3675
|
async close() {
|
|
3628
3676
|
(0, import_log13.log)("closing...", void 0, {
|
|
3629
3677
|
F: __dxlog_file15,
|
|
3630
|
-
L:
|
|
3678
|
+
L: 145,
|
|
3631
3679
|
S: this,
|
|
3632
3680
|
C: (f, a) => f(...a)
|
|
3633
3681
|
});
|
|
@@ -3644,7 +3692,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3644
3692
|
await this.metadataStore.close();
|
|
3645
3693
|
(0, import_log13.log)("closed", void 0, {
|
|
3646
3694
|
F: __dxlog_file15,
|
|
3647
|
-
L:
|
|
3695
|
+
L: 157,
|
|
3648
3696
|
S: this,
|
|
3649
3697
|
C: (f, a) => f(...a)
|
|
3650
3698
|
});
|
|
@@ -3656,9 +3704,9 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3656
3704
|
}
|
|
3657
3705
|
getInvitationHandler(invitation) {
|
|
3658
3706
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3659
|
-
(0,
|
|
3707
|
+
(0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
3660
3708
|
F: __dxlog_file15,
|
|
3661
|
-
L:
|
|
3709
|
+
L: 168,
|
|
3662
3710
|
S: this,
|
|
3663
3711
|
A: [
|
|
3664
3712
|
"factory",
|
|
@@ -3674,15 +3722,15 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3674
3722
|
}
|
|
3675
3723
|
async _checkStorageVersion() {
|
|
3676
3724
|
await this.metadataStore.load();
|
|
3677
|
-
if (this.metadataStore.version !==
|
|
3678
|
-
throw new
|
|
3725
|
+
if (this.metadataStore.version !== import_protocols10.STORAGE_VERSION) {
|
|
3726
|
+
throw new import_protocols10.InvalidStorageVersionError(import_protocols10.STORAGE_VERSION, this.metadataStore.version);
|
|
3679
3727
|
}
|
|
3680
3728
|
}
|
|
3681
3729
|
// Called when identity is created.
|
|
3682
3730
|
async _initialize(ctx) {
|
|
3683
3731
|
(0, import_log13.log)("initializing spaces...", void 0, {
|
|
3684
3732
|
F: __dxlog_file15,
|
|
3685
|
-
L:
|
|
3733
|
+
L: 189,
|
|
3686
3734
|
S: this,
|
|
3687
3735
|
C: (f, a) => f(...a)
|
|
3688
3736
|
});
|
|
@@ -3703,9 +3751,9 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3703
3751
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
3704
3752
|
await this.dataSpaceManager.open();
|
|
3705
3753
|
this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
|
|
3706
|
-
(0,
|
|
3754
|
+
(0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
3707
3755
|
F: __dxlog_file15,
|
|
3708
|
-
L:
|
|
3756
|
+
L: 212,
|
|
3709
3757
|
S: this,
|
|
3710
3758
|
A: [
|
|
3711
3759
|
"this.dataSpaceManager",
|
|
@@ -3729,7 +3777,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3729
3777
|
details: assertion
|
|
3730
3778
|
}, {
|
|
3731
3779
|
F: __dxlog_file15,
|
|
3732
|
-
L:
|
|
3780
|
+
L: 228,
|
|
3733
3781
|
S: this,
|
|
3734
3782
|
C: (f, a) => f(...a)
|
|
3735
3783
|
});
|
|
@@ -3740,7 +3788,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3740
3788
|
details: assertion
|
|
3741
3789
|
}, {
|
|
3742
3790
|
F: __dxlog_file15,
|
|
3743
|
-
L:
|
|
3791
|
+
L: 232,
|
|
3744
3792
|
S: this,
|
|
3745
3793
|
C: (f, a) => f(...a)
|
|
3746
3794
|
});
|
|
@@ -3751,7 +3799,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3751
3799
|
details: assertion
|
|
3752
3800
|
}, {
|
|
3753
3801
|
F: __dxlog_file15,
|
|
3754
|
-
L:
|
|
3802
|
+
L: 237,
|
|
3755
3803
|
S: this,
|
|
3756
3804
|
C: (f, a) => f(...a)
|
|
3757
3805
|
});
|
|
@@ -3762,7 +3810,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3762
3810
|
} catch (err) {
|
|
3763
3811
|
import_log13.log.catch(err, void 0, {
|
|
3764
3812
|
F: __dxlog_file15,
|
|
3765
|
-
L:
|
|
3813
|
+
L: 243,
|
|
3766
3814
|
S: this,
|
|
3767
3815
|
C: (f, a) => f(...a)
|
|
3768
3816
|
});
|
|
@@ -3788,19 +3836,44 @@ var import_async17 = require("@dxos/async");
|
|
|
3788
3836
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3789
3837
|
var import_context10 = require("@dxos/context");
|
|
3790
3838
|
var import_document_model2 = require("@dxos/document-model");
|
|
3791
|
-
var
|
|
3792
|
-
var
|
|
3839
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
3840
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
3841
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
3793
3842
|
var import_keys12 = require("@dxos/keys");
|
|
3794
3843
|
var import_log16 = require("@dxos/log");
|
|
3795
3844
|
var import_messaging = require("@dxos/messaging");
|
|
3796
3845
|
var import_model_factory = require("@dxos/model-factory");
|
|
3797
3846
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
3798
|
-
var
|
|
3847
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
3799
3848
|
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3800
3849
|
var import_text_model = require("@dxos/text-model");
|
|
3801
3850
|
var import_tracing5 = require("@dxos/tracing");
|
|
3802
3851
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
3803
3852
|
|
|
3853
|
+
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
3854
|
+
var ServiceRegistry = class {
|
|
3855
|
+
// prettier-ignore
|
|
3856
|
+
constructor(_serviceBundle, _handlers = {}) {
|
|
3857
|
+
this._serviceBundle = _serviceBundle;
|
|
3858
|
+
this._handlers = _handlers;
|
|
3859
|
+
}
|
|
3860
|
+
get descriptors() {
|
|
3861
|
+
return this._serviceBundle;
|
|
3862
|
+
}
|
|
3863
|
+
get services() {
|
|
3864
|
+
return this._handlers;
|
|
3865
|
+
}
|
|
3866
|
+
setServices(services) {
|
|
3867
|
+
this._handlers = services;
|
|
3868
|
+
}
|
|
3869
|
+
addService(name, service) {
|
|
3870
|
+
this._handlers[name] = service;
|
|
3871
|
+
}
|
|
3872
|
+
removeService(name) {
|
|
3873
|
+
delete this._handlers[name];
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3804
3877
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3805
3878
|
var import_async12 = require("@dxos/async");
|
|
3806
3879
|
var import_codec_protobuf6 = require("@dxos/codec-protobuf");
|
|
@@ -4153,7 +4226,7 @@ var DevtoolsServiceImpl = class {
|
|
|
4153
4226
|
};
|
|
4154
4227
|
|
|
4155
4228
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
4156
|
-
var
|
|
4229
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
4157
4230
|
var import_lock_file = require("@dxos/lock-file");
|
|
4158
4231
|
var import_log14 = require("@dxos/log");
|
|
4159
4232
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
@@ -4194,7 +4267,7 @@ var Lock = class {
|
|
|
4194
4267
|
}
|
|
4195
4268
|
async release() {
|
|
4196
4269
|
await this._onRelease?.();
|
|
4197
|
-
(0,
|
|
4270
|
+
(0, import_invariant14.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4198
4271
|
F: __dxlog_file16,
|
|
4199
4272
|
L: 42,
|
|
4200
4273
|
S: this,
|
|
@@ -4361,29 +4434,29 @@ var NetworkServiceImpl = class {
|
|
|
4361
4434
|
|
|
4362
4435
|
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
4363
4436
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
4364
|
-
var
|
|
4437
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
4365
4438
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
4366
4439
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
4367
4440
|
var import_util8 = require("@dxos/util");
|
|
4368
4441
|
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4369
4442
|
var createStorageObjects = (config) => {
|
|
4370
|
-
const {
|
|
4371
|
-
if (persistent &&
|
|
4372
|
-
throw new
|
|
4443
|
+
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4444
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4445
|
+
throw new import_protocols11.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4373
4446
|
}
|
|
4374
|
-
if (!persistent &&
|
|
4375
|
-
throw new
|
|
4447
|
+
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4448
|
+
throw new import_protocols11.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4376
4449
|
}
|
|
4377
|
-
if (persistent &&
|
|
4378
|
-
throw new
|
|
4450
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4451
|
+
throw new import_protocols11.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4379
4452
|
}
|
|
4380
|
-
if (!persistent &&
|
|
4381
|
-
throw new
|
|
4453
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4454
|
+
throw new import_protocols11.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4382
4455
|
}
|
|
4383
4456
|
return {
|
|
4384
4457
|
storage: (0, import_random_access_storage.createStorage)({
|
|
4385
|
-
type: persistent ? toStorageType(
|
|
4386
|
-
root: `${
|
|
4458
|
+
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
4459
|
+
root: `${dataRoot}/`
|
|
4387
4460
|
})
|
|
4388
4461
|
};
|
|
4389
4462
|
};
|
|
@@ -4462,30 +4535,6 @@ var SystemServiceImpl = class {
|
|
|
4462
4535
|
}
|
|
4463
4536
|
};
|
|
4464
4537
|
|
|
4465
|
-
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
4466
|
-
var ServiceRegistry = class {
|
|
4467
|
-
// prettier-ignore
|
|
4468
|
-
constructor(_serviceBundle, _handlers = {}) {
|
|
4469
|
-
this._serviceBundle = _serviceBundle;
|
|
4470
|
-
this._handlers = _handlers;
|
|
4471
|
-
}
|
|
4472
|
-
get descriptors() {
|
|
4473
|
-
return this._serviceBundle;
|
|
4474
|
-
}
|
|
4475
|
-
get services() {
|
|
4476
|
-
return this._handlers;
|
|
4477
|
-
}
|
|
4478
|
-
setServices(services) {
|
|
4479
|
-
this._handlers = services;
|
|
4480
|
-
}
|
|
4481
|
-
addService(name, service) {
|
|
4482
|
-
this._handlers[name] = service;
|
|
4483
|
-
}
|
|
4484
|
-
removeService(name) {
|
|
4485
|
-
delete this._handlers[name];
|
|
4486
|
-
}
|
|
4487
|
-
};
|
|
4488
|
-
|
|
4489
4538
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4490
4539
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
4491
4540
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -4501,6 +4550,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4501
4550
|
var createDefaultModelFactory = () => {
|
|
4502
4551
|
return new import_model_factory.ModelFactory().registerModel(import_document_model2.DocumentModel).registerModel(import_text_model.TextModel);
|
|
4503
4552
|
};
|
|
4553
|
+
var createGenesisMutationFromTypedObject = (obj) => {
|
|
4554
|
+
const snapshot = obj[import_echo_schema.base]._createSnapshot();
|
|
4555
|
+
return {
|
|
4556
|
+
objectId: obj[import_echo_schema.base]._id,
|
|
4557
|
+
genesis: {
|
|
4558
|
+
modelType: obj[import_echo_schema.base]._modelConstructor.meta.type
|
|
4559
|
+
},
|
|
4560
|
+
snapshot: {
|
|
4561
|
+
model: snapshot
|
|
4562
|
+
}
|
|
4563
|
+
};
|
|
4564
|
+
};
|
|
4504
4565
|
var ClientServicesHost = class ClientServicesHost2 {
|
|
4505
4566
|
constructor({
|
|
4506
4567
|
config,
|
|
@@ -4585,9 +4646,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4585
4646
|
* Can only be called once.
|
|
4586
4647
|
*/
|
|
4587
4648
|
initialize({ config, ...options }) {
|
|
4588
|
-
(0,
|
|
4649
|
+
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
4589
4650
|
F: __dxlog_file17,
|
|
4590
|
-
L:
|
|
4651
|
+
L: 201,
|
|
4591
4652
|
S: this,
|
|
4592
4653
|
A: [
|
|
4593
4654
|
"!this._open",
|
|
@@ -4596,14 +4657,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4596
4657
|
});
|
|
4597
4658
|
(0, import_log16.log)("initializing...", void 0, {
|
|
4598
4659
|
F: __dxlog_file17,
|
|
4599
|
-
L:
|
|
4660
|
+
L: 202,
|
|
4600
4661
|
S: this,
|
|
4601
4662
|
C: (f, a) => f(...a)
|
|
4602
4663
|
});
|
|
4603
4664
|
if (config) {
|
|
4604
|
-
(0,
|
|
4665
|
+
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
4605
4666
|
F: __dxlog_file17,
|
|
4606
|
-
L:
|
|
4667
|
+
L: 205,
|
|
4607
4668
|
S: this,
|
|
4608
4669
|
A: [
|
|
4609
4670
|
"!this._config",
|
|
@@ -4619,9 +4680,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4619
4680
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4620
4681
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4621
4682
|
this._signalManager = signalManager;
|
|
4622
|
-
(0,
|
|
4683
|
+
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
4623
4684
|
F: __dxlog_file17,
|
|
4624
|
-
L:
|
|
4685
|
+
L: 221,
|
|
4625
4686
|
S: this,
|
|
4626
4687
|
A: [
|
|
4627
4688
|
"!this._networkManager",
|
|
@@ -4635,7 +4696,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4635
4696
|
});
|
|
4636
4697
|
(0, import_log16.log)("initialized", void 0, {
|
|
4637
4698
|
F: __dxlog_file17,
|
|
4638
|
-
L:
|
|
4699
|
+
L: 228,
|
|
4639
4700
|
S: this,
|
|
4640
4701
|
C: (f, a) => f(...a)
|
|
4641
4702
|
});
|
|
@@ -4645,44 +4706,44 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4645
4706
|
return;
|
|
4646
4707
|
}
|
|
4647
4708
|
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4648
|
-
import_log16.log.trace("dxos.client-services.host.open",
|
|
4709
|
+
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.begin({
|
|
4649
4710
|
id: traceId
|
|
4650
4711
|
}), {
|
|
4651
4712
|
F: __dxlog_file17,
|
|
4652
|
-
L:
|
|
4713
|
+
L: 239,
|
|
4653
4714
|
S: this,
|
|
4654
4715
|
C: (f, a) => f(...a)
|
|
4655
4716
|
});
|
|
4656
|
-
(0,
|
|
4717
|
+
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
4657
4718
|
F: __dxlog_file17,
|
|
4658
|
-
L:
|
|
4719
|
+
L: 241,
|
|
4659
4720
|
S: this,
|
|
4660
4721
|
A: [
|
|
4661
4722
|
"this._config",
|
|
4662
4723
|
"'config not set'"
|
|
4663
4724
|
]
|
|
4664
4725
|
});
|
|
4665
|
-
(0,
|
|
4726
|
+
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
4666
4727
|
F: __dxlog_file17,
|
|
4667
|
-
L:
|
|
4728
|
+
L: 242,
|
|
4668
4729
|
S: this,
|
|
4669
4730
|
A: [
|
|
4670
4731
|
"this._storage",
|
|
4671
4732
|
"'storage not set'"
|
|
4672
4733
|
]
|
|
4673
4734
|
});
|
|
4674
|
-
(0,
|
|
4735
|
+
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
4675
4736
|
F: __dxlog_file17,
|
|
4676
|
-
L:
|
|
4737
|
+
L: 243,
|
|
4677
4738
|
S: this,
|
|
4678
4739
|
A: [
|
|
4679
4740
|
"this._signalManager",
|
|
4680
4741
|
"'signal manager not set'"
|
|
4681
4742
|
]
|
|
4682
4743
|
});
|
|
4683
|
-
(0,
|
|
4744
|
+
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
4684
4745
|
F: __dxlog_file17,
|
|
4685
|
-
L:
|
|
4746
|
+
L: 244,
|
|
4686
4747
|
S: this,
|
|
4687
4748
|
A: [
|
|
4688
4749
|
"this._networkManager",
|
|
@@ -4694,7 +4755,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4694
4755
|
lockKey: this._resourceLock?.lockKey
|
|
4695
4756
|
}, {
|
|
4696
4757
|
F: __dxlog_file17,
|
|
4697
|
-
L:
|
|
4758
|
+
L: 247,
|
|
4698
4759
|
S: this,
|
|
4699
4760
|
C: (f, a) => f(...a)
|
|
4700
4761
|
});
|
|
@@ -4703,14 +4764,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4703
4764
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4704
4765
|
this._serviceRegistry.setServices({
|
|
4705
4766
|
SystemService: this._systemService,
|
|
4706
|
-
IdentityService: new IdentityServiceImpl((params) => this.
|
|
4767
|
+
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
|
|
4707
4768
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4708
4769
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4709
4770
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
4710
4771
|
await this._serviceContext.initialized.wait();
|
|
4711
4772
|
return this._serviceContext.dataSpaceManager;
|
|
4712
4773
|
}),
|
|
4713
|
-
DataService: new
|
|
4774
|
+
DataService: new import_echo_pipeline3.DataServiceImpl(this._serviceContext.dataServiceSubscriptions),
|
|
4714
4775
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
4715
4776
|
LoggingService: this._loggingService,
|
|
4716
4777
|
TracingService: this._tracingService,
|
|
@@ -4740,15 +4801,15 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4740
4801
|
deviceKey
|
|
4741
4802
|
}, {
|
|
4742
4803
|
F: __dxlog_file17,
|
|
4743
|
-
L:
|
|
4804
|
+
L: 316,
|
|
4744
4805
|
S: this,
|
|
4745
4806
|
C: (f, a) => f(...a)
|
|
4746
4807
|
});
|
|
4747
|
-
import_log16.log.trace("dxos.client-services.host.open",
|
|
4808
|
+
import_log16.log.trace("dxos.client-services.host.open", import_protocols12.trace.end({
|
|
4748
4809
|
id: traceId
|
|
4749
4810
|
}), {
|
|
4750
4811
|
F: __dxlog_file17,
|
|
4751
|
-
L:
|
|
4812
|
+
L: 317,
|
|
4752
4813
|
S: this,
|
|
4753
4814
|
C: (f, a) => f(...a)
|
|
4754
4815
|
});
|
|
@@ -4762,7 +4823,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4762
4823
|
deviceKey
|
|
4763
4824
|
}, {
|
|
4764
4825
|
F: __dxlog_file17,
|
|
4765
|
-
L:
|
|
4826
|
+
L: 328,
|
|
4766
4827
|
S: this,
|
|
4767
4828
|
C: (f, a) => f(...a)
|
|
4768
4829
|
});
|
|
@@ -4778,24 +4839,24 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4778
4839
|
deviceKey
|
|
4779
4840
|
}, {
|
|
4780
4841
|
F: __dxlog_file17,
|
|
4781
|
-
L:
|
|
4842
|
+
L: 335,
|
|
4782
4843
|
S: this,
|
|
4783
4844
|
C: (f, a) => f(...a)
|
|
4784
4845
|
});
|
|
4785
4846
|
}
|
|
4786
4847
|
async reset() {
|
|
4787
4848
|
const traceId = import_keys12.PublicKey.random().toHex();
|
|
4788
|
-
import_log16.log.trace("dxos.sdk.client-services-host.reset",
|
|
4849
|
+
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.begin({
|
|
4789
4850
|
id: traceId
|
|
4790
4851
|
}), {
|
|
4791
4852
|
F: __dxlog_file17,
|
|
4792
|
-
L:
|
|
4853
|
+
L: 340,
|
|
4793
4854
|
S: this,
|
|
4794
4855
|
C: (f, a) => f(...a)
|
|
4795
4856
|
});
|
|
4796
4857
|
(0, import_log16.log)("resetting...", void 0, {
|
|
4797
4858
|
F: __dxlog_file17,
|
|
4798
|
-
L:
|
|
4859
|
+
L: 342,
|
|
4799
4860
|
S: this,
|
|
4800
4861
|
C: (f, a) => f(...a)
|
|
4801
4862
|
});
|
|
@@ -4803,20 +4864,39 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4803
4864
|
await this._storage.reset();
|
|
4804
4865
|
(0, import_log16.log)("reset", void 0, {
|
|
4805
4866
|
F: __dxlog_file17,
|
|
4806
|
-
L:
|
|
4867
|
+
L: 345,
|
|
4807
4868
|
S: this,
|
|
4808
4869
|
C: (f, a) => f(...a)
|
|
4809
4870
|
});
|
|
4810
|
-
import_log16.log.trace("dxos.sdk.client-services-host.reset",
|
|
4871
|
+
import_log16.log.trace("dxos.sdk.client-services-host.reset", import_protocols12.trace.end({
|
|
4811
4872
|
id: traceId
|
|
4812
4873
|
}), {
|
|
4813
4874
|
F: __dxlog_file17,
|
|
4814
|
-
L:
|
|
4875
|
+
L: 346,
|
|
4815
4876
|
S: this,
|
|
4816
4877
|
C: (f, a) => f(...a)
|
|
4817
4878
|
});
|
|
4818
4879
|
await this._callbacks?.onReset?.();
|
|
4819
4880
|
}
|
|
4881
|
+
async _createIdentity(params) {
|
|
4882
|
+
const identity = await this._serviceContext.createIdentity(params);
|
|
4883
|
+
await this._serviceContext.initialized.wait();
|
|
4884
|
+
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
4885
|
+
const obj = new import_client_protocol5.Properties();
|
|
4886
|
+
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
4887
|
+
await this._serviceRegistry.services.DataService.write({
|
|
4888
|
+
spaceKey: space.key,
|
|
4889
|
+
batch: {
|
|
4890
|
+
objects: [
|
|
4891
|
+
createGenesisMutationFromTypedObject(obj)
|
|
4892
|
+
]
|
|
4893
|
+
}
|
|
4894
|
+
});
|
|
4895
|
+
await this._serviceRegistry.services.DataService.flush({
|
|
4896
|
+
spaceKey: space.key
|
|
4897
|
+
});
|
|
4898
|
+
return identity;
|
|
4899
|
+
}
|
|
4820
4900
|
};
|
|
4821
4901
|
_ts_decorate7([
|
|
4822
4902
|
import_tracing5.trace.info()
|
|
@@ -4867,7 +4947,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
|
|
|
4867
4947
|
if (hooks?.guest?.onConnecting?.(guestObservable)) {
|
|
4868
4948
|
break;
|
|
4869
4949
|
}
|
|
4870
|
-
(0,
|
|
4950
|
+
(0, import_invariant16.invariant)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey), void 0, {
|
|
4871
4951
|
F: __dxlog_file18,
|
|
4872
4952
|
L: 84,
|
|
4873
4953
|
S: void 0,
|
|
@@ -5000,7 +5080,7 @@ var createInvitation = (host, options) => {
|
|
|
5000
5080
|
});
|
|
5001
5081
|
return host.invitations.createInvitation(hostHandler, options);
|
|
5002
5082
|
}
|
|
5003
|
-
return host.
|
|
5083
|
+
return host.share(options);
|
|
5004
5084
|
};
|
|
5005
5085
|
var acceptInvitation = (guest, invitation) => {
|
|
5006
5086
|
invitation = sanitizeInvitation(invitation);
|
|
@@ -5010,14 +5090,14 @@ var acceptInvitation = (guest, invitation) => {
|
|
|
5010
5090
|
});
|
|
5011
5091
|
return guest.invitations.acceptInvitation(guestHandler, invitation);
|
|
5012
5092
|
}
|
|
5013
|
-
return guest.
|
|
5093
|
+
return guest.join(invitation);
|
|
5014
5094
|
};
|
|
5015
5095
|
|
|
5016
5096
|
// packages/sdk/client-services/src/packlets/testing/test-builder.ts
|
|
5017
5097
|
var import_context11 = require("@dxos/context");
|
|
5018
5098
|
var import_credentials16 = require("@dxos/credentials");
|
|
5019
5099
|
var import_debug8 = require("@dxos/debug");
|
|
5020
|
-
var
|
|
5100
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
5021
5101
|
var import_testing = require("@dxos/echo-pipeline/testing");
|
|
5022
5102
|
var import_feed_store5 = require("@dxos/feed-store");
|
|
5023
5103
|
var import_keyring2 = require("@dxos/keyring");
|
|
@@ -5077,7 +5157,7 @@ var TestBuilder = class {
|
|
|
5077
5157
|
};
|
|
5078
5158
|
var TestPeer = class {
|
|
5079
5159
|
constructor(signalContext, opts = {
|
|
5080
|
-
|
|
5160
|
+
dataStore: import_random_access_storage2.StorageType.RAM
|
|
5081
5161
|
}) {
|
|
5082
5162
|
this.signalContext = signalContext;
|
|
5083
5163
|
this.opts = opts;
|
|
@@ -5088,7 +5168,7 @@ var TestPeer = class {
|
|
|
5088
5168
|
}
|
|
5089
5169
|
get storage() {
|
|
5090
5170
|
return this._props.storage ??= (0, import_random_access_storage2.createStorage)({
|
|
5091
|
-
type: this.opts.
|
|
5171
|
+
type: this.opts.dataStore
|
|
5092
5172
|
});
|
|
5093
5173
|
}
|
|
5094
5174
|
get keyring() {
|
|
@@ -5100,19 +5180,19 @@ var TestPeer = class {
|
|
|
5100
5180
|
root: this.storage.createDirectory("feeds"),
|
|
5101
5181
|
signer: this.keyring,
|
|
5102
5182
|
hypercore: {
|
|
5103
|
-
valueEncoding:
|
|
5183
|
+
valueEncoding: import_echo_pipeline4.valueEncoding
|
|
5104
5184
|
}
|
|
5105
5185
|
})
|
|
5106
5186
|
});
|
|
5107
5187
|
}
|
|
5108
5188
|
get metadataStore() {
|
|
5109
|
-
return this._props.metadataStore ??= new
|
|
5189
|
+
return this._props.metadataStore ??= new import_echo_pipeline4.MetadataStore(this.storage.createDirectory("metadata"));
|
|
5110
5190
|
}
|
|
5111
5191
|
get blobStore() {
|
|
5112
5192
|
return this._props.blobStore ??= new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
|
|
5113
5193
|
}
|
|
5114
5194
|
get snapshotStore() {
|
|
5115
|
-
return this._props.snapshotStore ??= new
|
|
5195
|
+
return this._props.snapshotStore ??= new import_echo_pipeline4.SnapshotStore(this.storage.createDirectory("snapshots"));
|
|
5116
5196
|
}
|
|
5117
5197
|
get networkManager() {
|
|
5118
5198
|
return this._props.networkManager ??= new import_network_manager3.NetworkManager({
|
|
@@ -5121,7 +5201,7 @@ var TestPeer = class {
|
|
|
5121
5201
|
});
|
|
5122
5202
|
}
|
|
5123
5203
|
get spaceManager() {
|
|
5124
|
-
return this._props.spaceManager ??= new
|
|
5204
|
+
return this._props.spaceManager ??= new import_echo_pipeline4.SpaceManager({
|
|
5125
5205
|
feedStore: this.feedStore,
|
|
5126
5206
|
networkManager: this.networkManager,
|
|
5127
5207
|
metadataStore: this.metadataStore,
|
|
@@ -5134,7 +5214,7 @@ var TestPeer = class {
|
|
|
5134
5214
|
return this._props.signingContext ?? (0, import_debug8.failUndefined)();
|
|
5135
5215
|
}
|
|
5136
5216
|
get dataSpaceManager() {
|
|
5137
|
-
return this._props.dataSpaceManager ??= new DataSpaceManager(this.spaceManager, this.metadataStore, new
|
|
5217
|
+
return this._props.dataSpaceManager ??= new DataSpaceManager(this.spaceManager, this.metadataStore, new import_echo_pipeline4.DataServiceSubscriptions(), this.keyring, this.identity, this.feedStore);
|
|
5138
5218
|
}
|
|
5139
5219
|
async createIdentity() {
|
|
5140
5220
|
this._props.signingContext ??= await createSigningContext(this.keyring);
|