@dxos/client-services 0.3.11-main.d7d4c52 → 0.3.11-main.d8b8a39
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-CKB4252E.mjs → chunk-BF2EZUZV.mjs} +116 -75
- package/dist/lib/browser/chunk-BF2EZUZV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -11
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-5EUWM7NI.cjs → chunk-H5EXDUBC.cjs} +173 -132
- package/dist/lib/node/chunk-H5EXDUBC.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +11 -18
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts +3 -3
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -0
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +28 -3
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/identity/identity-service.test.ts +1 -1
- package/src/packlets/identity/identity-service.ts +6 -3
- package/src/packlets/invitations/device-invitation-protocol.test.ts +14 -0
- package/src/packlets/invitations/device-invitation-protocol.ts +14 -0
- package/src/packlets/invitations/invitation-protocol.ts +44 -6
- package/src/packlets/invitations/invitations-handler.ts +20 -18
- package/src/packlets/invitations/space-invitation-protocol.test.ts +28 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -0
- package/src/packlets/services/service-host.ts +27 -12
- package/src/packlets/testing/invitation-utils.ts +2 -10
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-CKB4252E.mjs.map +0 -7
- package/dist/lib/node/chunk-5EUWM7NI.cjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_H5EXDUBC_exports = {};
|
|
30
|
+
__export(chunk_H5EXDUBC_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_5EUWM7NI_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_H5EXDUBC_exports);
|
|
64
64
|
var import_async = require("@dxos/async");
|
|
65
65
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
66
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -108,6 +108,7 @@ var import_credentials6 = require("@dxos/credentials");
|
|
|
108
108
|
var import_debug2 = require("@dxos/debug");
|
|
109
109
|
var import_invariant3 = require("@dxos/invariant");
|
|
110
110
|
var import_invariant4 = require("@dxos/invariant");
|
|
111
|
+
var import_protocols3 = require("@dxos/protocols");
|
|
111
112
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
112
113
|
var import_async7 = require("@dxos/async");
|
|
113
114
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
@@ -117,7 +118,7 @@ var import_invariant5 = require("@dxos/invariant");
|
|
|
117
118
|
var import_keys5 = require("@dxos/keys");
|
|
118
119
|
var import_log4 = require("@dxos/log");
|
|
119
120
|
var import_network_manager = require("@dxos/network-manager");
|
|
120
|
-
var
|
|
121
|
+
var import_protocols4 = require("@dxos/protocols");
|
|
121
122
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
122
123
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
123
124
|
var import_async8 = require("@dxos/async");
|
|
@@ -125,7 +126,7 @@ var import_context5 = require("@dxos/context");
|
|
|
125
126
|
var import_invariant6 = require("@dxos/invariant");
|
|
126
127
|
var import_keys6 = require("@dxos/keys");
|
|
127
128
|
var import_log5 = require("@dxos/log");
|
|
128
|
-
var
|
|
129
|
+
var import_protocols5 = require("@dxos/protocols");
|
|
129
130
|
var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
130
131
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
131
132
|
var import_teleport = require("@dxos/teleport");
|
|
@@ -138,6 +139,7 @@ var import_credentials8 = require("@dxos/credentials");
|
|
|
138
139
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
139
140
|
var import_invariant8 = require("@dxos/invariant");
|
|
140
141
|
var import_log7 = require("@dxos/log");
|
|
142
|
+
var import_protocols6 = require("@dxos/protocols");
|
|
141
143
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
142
144
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
143
145
|
var import_debug3 = require("@dxos/debug");
|
|
@@ -149,7 +151,7 @@ var import_document_model = require("@dxos/document-model");
|
|
|
149
151
|
var import_echo_db = require("@dxos/echo-db");
|
|
150
152
|
var import_invariant9 = require("@dxos/invariant");
|
|
151
153
|
var import_log8 = require("@dxos/log");
|
|
152
|
-
var
|
|
154
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
153
155
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
154
156
|
var import_async10 = require("@dxos/async");
|
|
155
157
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
@@ -158,7 +160,7 @@ var import_debug4 = require("@dxos/debug");
|
|
|
158
160
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
159
161
|
var import_keys7 = require("@dxos/keys");
|
|
160
162
|
var import_log9 = require("@dxos/log");
|
|
161
|
-
var
|
|
163
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
162
164
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
163
165
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
164
166
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
@@ -170,7 +172,7 @@ var import_context7 = require("@dxos/context");
|
|
|
170
172
|
var import_invariant10 = require("@dxos/invariant");
|
|
171
173
|
var import_keys8 = require("@dxos/keys");
|
|
172
174
|
var import_log10 = require("@dxos/log");
|
|
173
|
-
var
|
|
175
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
174
176
|
var import_teleport2 = require("@dxos/teleport");
|
|
175
177
|
var import_util5 = require("@dxos/util");
|
|
176
178
|
var import_async12 = require("@dxos/async");
|
|
@@ -179,7 +181,7 @@ var import_credentials12 = require("@dxos/credentials");
|
|
|
179
181
|
var import_invariant11 = require("@dxos/invariant");
|
|
180
182
|
var import_keys9 = require("@dxos/keys");
|
|
181
183
|
var import_log11 = require("@dxos/log");
|
|
182
|
-
var
|
|
184
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
183
185
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
184
186
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
185
187
|
var import_util6 = require("@dxos/util");
|
|
@@ -192,7 +194,7 @@ var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
|
192
194
|
var import_debug6 = require("@dxos/debug");
|
|
193
195
|
var import_invariant12 = require("@dxos/invariant");
|
|
194
196
|
var import_log12 = require("@dxos/log");
|
|
195
|
-
var
|
|
197
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
196
198
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
197
199
|
var import_async14 = require("@dxos/async");
|
|
198
200
|
var import_context9 = require("@dxos/context");
|
|
@@ -204,7 +206,7 @@ var import_invariant13 = require("@dxos/invariant");
|
|
|
204
206
|
var import_keyring = require("@dxos/keyring");
|
|
205
207
|
var import_keys10 = require("@dxos/keys");
|
|
206
208
|
var import_log13 = require("@dxos/log");
|
|
207
|
-
var
|
|
209
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
208
210
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
209
211
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
210
212
|
var import_tracing5 = require("@dxos/tracing");
|
|
@@ -213,7 +215,7 @@ var import_invariant14 = require("@dxos/invariant");
|
|
|
213
215
|
var import_lock_file = require("@dxos/lock-file");
|
|
214
216
|
var import_log14 = require("@dxos/log");
|
|
215
217
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
216
|
-
var
|
|
218
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
217
219
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
218
220
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
219
221
|
var import_util8 = require("@dxos/util");
|
|
@@ -229,7 +231,7 @@ var import_log15 = require("@dxos/log");
|
|
|
229
231
|
var import_messaging = require("@dxos/messaging");
|
|
230
232
|
var import_model_factory = require("@dxos/model-factory");
|
|
231
233
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
232
|
-
var
|
|
234
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
233
235
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
234
236
|
var import_text_model = require("@dxos/text-model");
|
|
235
237
|
var import_tracing6 = require("@dxos/tracing");
|
|
@@ -675,7 +677,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
675
677
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
676
678
|
}
|
|
677
679
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
678
|
-
var Identity = class
|
|
680
|
+
var Identity = class {
|
|
679
681
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
680
682
|
this.stateUpdate = new import_async5.Event();
|
|
681
683
|
this.space = space;
|
|
@@ -843,7 +845,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
843
845
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
844
846
|
}
|
|
845
847
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
846
|
-
var IdentityManager = class
|
|
848
|
+
var IdentityManager = class {
|
|
847
849
|
// TODO(burdon): IdentityManagerParams.
|
|
848
850
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
849
851
|
constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
|
|
@@ -1197,6 +1199,7 @@ IdentityManager = _ts_decorate2([
|
|
|
1197
1199
|
import_tracing2.trace.resource()
|
|
1198
1200
|
], IdentityManager);
|
|
1199
1201
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1202
|
+
var CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT = true;
|
|
1200
1203
|
var IdentityServiceImpl = class {
|
|
1201
1204
|
constructor(_createIdentity, _identityManager, _keyring, _onProfileUpdate) {
|
|
1202
1205
|
this._createIdentity = _createIdentity;
|
|
@@ -1205,7 +1208,7 @@ var IdentityServiceImpl = class {
|
|
|
1205
1208
|
this._onProfileUpdate = _onProfileUpdate;
|
|
1206
1209
|
}
|
|
1207
1210
|
async createIdentity(request) {
|
|
1208
|
-
await this._createIdentity(request);
|
|
1211
|
+
await this._createIdentity(request.profile ?? {}, request.useAutomerge ?? CREATE_PROFILE_WITH_AUTOMERGE_DEFAULT);
|
|
1209
1212
|
return this._getIdentity();
|
|
1210
1213
|
}
|
|
1211
1214
|
async recoverIdentity(request) {
|
|
@@ -1233,7 +1236,7 @@ var IdentityServiceImpl = class {
|
|
|
1233
1236
|
async updateProfile(profile) {
|
|
1234
1237
|
(0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1235
1238
|
F: __dxlog_file4,
|
|
1236
|
-
L:
|
|
1239
|
+
L: 63,
|
|
1237
1240
|
S: this,
|
|
1238
1241
|
A: [
|
|
1239
1242
|
"this._identityManager.identity",
|
|
@@ -1247,7 +1250,7 @@ var IdentityServiceImpl = class {
|
|
|
1247
1250
|
async signPresentation({ presentation, nonce }) {
|
|
1248
1251
|
(0, import_invariant3.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1249
1252
|
F: __dxlog_file4,
|
|
1250
|
-
L:
|
|
1253
|
+
L: 70,
|
|
1251
1254
|
S: this,
|
|
1252
1255
|
A: [
|
|
1253
1256
|
"this._identityManager.identity",
|
|
@@ -1281,7 +1284,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1281
1284
|
async admit(request) {
|
|
1282
1285
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1283
1286
|
F: __dxlog_file5,
|
|
1284
|
-
L:
|
|
1287
|
+
L: 36,
|
|
1285
1288
|
S: this,
|
|
1286
1289
|
A: [
|
|
1287
1290
|
"request.device",
|
|
@@ -1299,6 +1302,15 @@ var DeviceInvitationProtocol = class {
|
|
|
1299
1302
|
}
|
|
1300
1303
|
};
|
|
1301
1304
|
}
|
|
1305
|
+
checkInvitation(invitation) {
|
|
1306
|
+
try {
|
|
1307
|
+
const identity = this._getIdentity();
|
|
1308
|
+
if (identity) {
|
|
1309
|
+
return new import_protocols3.AlreadyJoinedError("Currently only one identity per client is supported.");
|
|
1310
|
+
}
|
|
1311
|
+
} catch {
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1302
1314
|
createIntroduction() {
|
|
1303
1315
|
return {};
|
|
1304
1316
|
}
|
|
@@ -1317,7 +1329,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1317
1329
|
async accept(response, request) {
|
|
1318
1330
|
(0, import_invariant4.invariant)(response.device, void 0, {
|
|
1319
1331
|
F: __dxlog_file5,
|
|
1320
|
-
L:
|
|
1332
|
+
L: 80,
|
|
1321
1333
|
S: this,
|
|
1322
1334
|
A: [
|
|
1323
1335
|
"response.device",
|
|
@@ -1327,7 +1339,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1327
1339
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1328
1340
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1329
1341
|
F: __dxlog_file5,
|
|
1330
|
-
L:
|
|
1342
|
+
L: 83,
|
|
1331
1343
|
S: this,
|
|
1332
1344
|
A: [
|
|
1333
1345
|
"request.device",
|
|
@@ -1356,10 +1368,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1356
1368
|
constructor(_callbacks) {
|
|
1357
1369
|
super({
|
|
1358
1370
|
requested: {
|
|
1359
|
-
InvitationHostService:
|
|
1371
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1360
1372
|
},
|
|
1361
1373
|
exposed: {
|
|
1362
|
-
InvitationHostService:
|
|
1374
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1363
1375
|
}
|
|
1364
1376
|
});
|
|
1365
1377
|
this._callbacks = _callbacks;
|
|
@@ -1392,7 +1404,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1392
1404
|
introduce: async (request) => {
|
|
1393
1405
|
const { profile, invitationId } = request;
|
|
1394
1406
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1395
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce",
|
|
1407
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.begin({
|
|
1396
1408
|
id: traceId
|
|
1397
1409
|
}), {
|
|
1398
1410
|
F: __dxlog_file6,
|
|
@@ -1429,7 +1441,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1429
1441
|
...this.invitation,
|
|
1430
1442
|
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1431
1443
|
});
|
|
1432
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce",
|
|
1444
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1433
1445
|
id: traceId
|
|
1434
1446
|
}), {
|
|
1435
1447
|
F: __dxlog_file6,
|
|
@@ -1443,7 +1455,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1443
1455
|
},
|
|
1444
1456
|
authenticate: async ({ authCode: code }) => {
|
|
1445
1457
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1446
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate",
|
|
1458
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.begin({
|
|
1447
1459
|
id: traceId
|
|
1448
1460
|
}), {
|
|
1449
1461
|
F: __dxlog_file6,
|
|
@@ -1506,7 +1518,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1506
1518
|
break;
|
|
1507
1519
|
}
|
|
1508
1520
|
}
|
|
1509
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate",
|
|
1521
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.end({
|
|
1510
1522
|
id: traceId,
|
|
1511
1523
|
data: {
|
|
1512
1524
|
status
|
|
@@ -1523,7 +1535,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1523
1535
|
},
|
|
1524
1536
|
admit: async (request) => {
|
|
1525
1537
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1526
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit",
|
|
1538
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols5.trace.begin({
|
|
1527
1539
|
id: traceId
|
|
1528
1540
|
}), {
|
|
1529
1541
|
F: __dxlog_file6,
|
|
@@ -1545,7 +1557,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1545
1557
|
throw new Error("Not authenticated");
|
|
1546
1558
|
}
|
|
1547
1559
|
const response = await this._callbacks.admit(request);
|
|
1548
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit",
|
|
1560
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols5.trace.end({
|
|
1549
1561
|
id: traceId
|
|
1550
1562
|
}), {
|
|
1551
1563
|
F: __dxlog_file6,
|
|
@@ -1572,7 +1584,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1572
1584
|
timeout: OPTIONS_TIMEOUT
|
|
1573
1585
|
}));
|
|
1574
1586
|
if (this._remoteOptions?.role !== import_invitations2.Options.Role.GUEST) {
|
|
1575
|
-
throw new
|
|
1587
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
1576
1588
|
expected: import_invitations2.Options.Role.GUEST,
|
|
1577
1589
|
remoteOptions: this._remoteOptions
|
|
1578
1590
|
});
|
|
@@ -1590,10 +1602,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1590
1602
|
constructor(_callbacks) {
|
|
1591
1603
|
super({
|
|
1592
1604
|
requested: {
|
|
1593
|
-
InvitationHostService:
|
|
1605
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1594
1606
|
},
|
|
1595
1607
|
exposed: {
|
|
1596
|
-
InvitationHostService:
|
|
1608
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1597
1609
|
}
|
|
1598
1610
|
});
|
|
1599
1611
|
this._callbacks = _callbacks;
|
|
@@ -1650,7 +1662,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1650
1662
|
C: (f, a) => f(...a)
|
|
1651
1663
|
});
|
|
1652
1664
|
if (this._remoteOptions?.role !== import_invitations2.Options.Role.HOST) {
|
|
1653
|
-
throw new
|
|
1665
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
1654
1666
|
expected: import_invitations2.Options.Role.HOST,
|
|
1655
1667
|
remoteOptions: this._remoteOptions
|
|
1656
1668
|
});
|
|
@@ -1763,7 +1775,7 @@ var InvitationsHandler = class {
|
|
|
1763
1775
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1764
1776
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1765
1777
|
try {
|
|
1766
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1778
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1767
1779
|
id: traceId
|
|
1768
1780
|
}), {
|
|
1769
1781
|
F: __dxlog_file7,
|
|
@@ -1799,7 +1811,7 @@ var InvitationsHandler = class {
|
|
|
1799
1811
|
...invitation,
|
|
1800
1812
|
state: import_services2.Invitation.State.SUCCESS
|
|
1801
1813
|
});
|
|
1802
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1814
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1803
1815
|
id: traceId
|
|
1804
1816
|
}), {
|
|
1805
1817
|
F: __dxlog_file7,
|
|
@@ -1830,7 +1842,7 @@ var InvitationsHandler = class {
|
|
|
1830
1842
|
});
|
|
1831
1843
|
stream.error(err);
|
|
1832
1844
|
}
|
|
1833
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1845
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.error({
|
|
1834
1846
|
id: traceId,
|
|
1835
1847
|
error: err
|
|
1836
1848
|
}), {
|
|
@@ -1848,7 +1860,7 @@ var InvitationsHandler = class {
|
|
|
1848
1860
|
});
|
|
1849
1861
|
},
|
|
1850
1862
|
onError: (err) => {
|
|
1851
|
-
if (err instanceof
|
|
1863
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
1852
1864
|
return;
|
|
1853
1865
|
}
|
|
1854
1866
|
if (err instanceof import_async7.TimeoutError) {
|
|
@@ -1996,7 +2008,7 @@ var InvitationsHandler = class {
|
|
|
1996
2008
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1997
2009
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1998
2010
|
try {
|
|
1999
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2011
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
2000
2012
|
id: traceId
|
|
2001
2013
|
}), {
|
|
2002
2014
|
F: __dxlog_file7,
|
|
@@ -2083,16 +2095,12 @@ var InvitationsHandler = class {
|
|
|
2083
2095
|
}
|
|
2084
2096
|
}
|
|
2085
2097
|
}
|
|
2086
|
-
} else {
|
|
2087
|
-
setState({
|
|
2088
|
-
state: import_services2.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2089
|
-
});
|
|
2090
2098
|
}
|
|
2091
2099
|
(0, import_log4.log)("request admission", {
|
|
2092
2100
|
...protocol.toJSON()
|
|
2093
2101
|
}, {
|
|
2094
2102
|
F: __dxlog_file7,
|
|
2095
|
-
L:
|
|
2103
|
+
L: 309,
|
|
2096
2104
|
S: this,
|
|
2097
2105
|
C: (f, a) => f(...a)
|
|
2098
2106
|
});
|
|
@@ -2104,19 +2112,20 @@ var InvitationsHandler = class {
|
|
|
2104
2112
|
...protocol.toJSON()
|
|
2105
2113
|
}, {
|
|
2106
2114
|
F: __dxlog_file7,
|
|
2107
|
-
L:
|
|
2115
|
+
L: 320,
|
|
2108
2116
|
S: this,
|
|
2109
2117
|
C: (f, a) => f(...a)
|
|
2110
2118
|
});
|
|
2111
2119
|
setState({
|
|
2112
2120
|
...result,
|
|
2121
|
+
target: invitation.target,
|
|
2113
2122
|
state: import_services2.Invitation.State.SUCCESS
|
|
2114
2123
|
});
|
|
2115
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2124
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
2116
2125
|
id: traceId
|
|
2117
2126
|
}), {
|
|
2118
2127
|
F: __dxlog_file7,
|
|
2119
|
-
L:
|
|
2128
|
+
L: 322,
|
|
2120
2129
|
S: this,
|
|
2121
2130
|
C: (f, a) => f(...a)
|
|
2122
2131
|
});
|
|
@@ -2126,7 +2135,7 @@ var InvitationsHandler = class {
|
|
|
2126
2135
|
...protocol.toJSON()
|
|
2127
2136
|
}, {
|
|
2128
2137
|
F: __dxlog_file7,
|
|
2129
|
-
L:
|
|
2138
|
+
L: 325,
|
|
2130
2139
|
S: this,
|
|
2131
2140
|
C: (f, a) => f(...a)
|
|
2132
2141
|
});
|
|
@@ -2136,18 +2145,18 @@ var InvitationsHandler = class {
|
|
|
2136
2145
|
} else {
|
|
2137
2146
|
(0, import_log4.log)("auth failed", err, {
|
|
2138
2147
|
F: __dxlog_file7,
|
|
2139
|
-
L:
|
|
2148
|
+
L: 328,
|
|
2140
2149
|
S: this,
|
|
2141
2150
|
C: (f, a) => f(...a)
|
|
2142
2151
|
});
|
|
2143
2152
|
stream.error(err);
|
|
2144
2153
|
}
|
|
2145
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2154
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.error({
|
|
2146
2155
|
id: traceId,
|
|
2147
2156
|
error: err
|
|
2148
2157
|
}), {
|
|
2149
2158
|
F: __dxlog_file7,
|
|
2150
|
-
L:
|
|
2159
|
+
L: 331,
|
|
2151
2160
|
S: this,
|
|
2152
2161
|
C: (f, a) => f(...a)
|
|
2153
2162
|
});
|
|
@@ -2157,7 +2166,7 @@ var InvitationsHandler = class {
|
|
|
2157
2166
|
});
|
|
2158
2167
|
},
|
|
2159
2168
|
onError: (err) => {
|
|
2160
|
-
if (err instanceof
|
|
2169
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
2161
2170
|
return;
|
|
2162
2171
|
}
|
|
2163
2172
|
if (err instanceof import_async7.TimeoutError) {
|
|
@@ -2165,7 +2174,7 @@ var InvitationsHandler = class {
|
|
|
2165
2174
|
...protocol.toJSON()
|
|
2166
2175
|
}, {
|
|
2167
2176
|
F: __dxlog_file7,
|
|
2168
|
-
L:
|
|
2177
|
+
L: 342,
|
|
2169
2178
|
S: this,
|
|
2170
2179
|
C: (f, a) => f(...a)
|
|
2171
2180
|
});
|
|
@@ -2175,7 +2184,7 @@ var InvitationsHandler = class {
|
|
|
2175
2184
|
} else {
|
|
2176
2185
|
(0, import_log4.log)("auth failed", err, {
|
|
2177
2186
|
F: __dxlog_file7,
|
|
2178
|
-
L:
|
|
2187
|
+
L: 345,
|
|
2179
2188
|
S: this,
|
|
2180
2189
|
C: (f, a) => f(...a)
|
|
2181
2190
|
});
|
|
@@ -2186,29 +2195,34 @@ var InvitationsHandler = class {
|
|
|
2186
2195
|
return extension;
|
|
2187
2196
|
};
|
|
2188
2197
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2198
|
+
const error = protocol.checkInvitation(invitation);
|
|
2199
|
+
if (error) {
|
|
2200
|
+
stream.error(error);
|
|
2201
|
+
} else {
|
|
2202
|
+
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2203
|
+
F: __dxlog_file7,
|
|
2204
|
+
L: 359,
|
|
2205
|
+
S: this,
|
|
2206
|
+
A: [
|
|
2207
|
+
"invitation.swarmKey",
|
|
2208
|
+
""
|
|
2209
|
+
]
|
|
2210
|
+
});
|
|
2211
|
+
const topic = invitation.swarmKey;
|
|
2212
|
+
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2213
|
+
topic,
|
|
2214
|
+
peerId: import_keys5.PublicKey.random(),
|
|
2215
|
+
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
2216
|
+
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
2217
|
+
}),
|
|
2218
|
+
topology: new import_network_manager.StarTopology(topic),
|
|
2219
|
+
label: "invitation guest"
|
|
2220
|
+
});
|
|
2221
|
+
ctx.onDispose(() => swarmConnection.close());
|
|
2222
|
+
setState({
|
|
2223
|
+
state: import_services2.Invitation.State.CONNECTING
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2212
2226
|
});
|
|
2213
2227
|
const observable = new import_client_protocol2.AuthenticatingInvitation({
|
|
2214
2228
|
initialInvitation: invitation,
|
|
@@ -2424,7 +2438,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2424
2438
|
async admit(request, guestProfile) {
|
|
2425
2439
|
(0, import_invariant8.invariant)(this._spaceKey, void 0, {
|
|
2426
2440
|
F: __dxlog_file9,
|
|
2427
|
-
L:
|
|
2441
|
+
L: 47,
|
|
2428
2442
|
S: this,
|
|
2429
2443
|
A: [
|
|
2430
2444
|
"this._spaceKey",
|
|
@@ -2434,7 +2448,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2434
2448
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2435
2449
|
(0, import_invariant8.invariant)(space, void 0, {
|
|
2436
2450
|
F: __dxlog_file9,
|
|
2437
|
-
L:
|
|
2451
|
+
L: 49,
|
|
2438
2452
|
S: this,
|
|
2439
2453
|
A: [
|
|
2440
2454
|
"space",
|
|
@@ -2443,7 +2457,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2443
2457
|
});
|
|
2444
2458
|
(0, import_invariant8.invariant)(request.space, void 0, {
|
|
2445
2459
|
F: __dxlog_file9,
|
|
2446
|
-
L:
|
|
2460
|
+
L: 51,
|
|
2447
2461
|
S: this,
|
|
2448
2462
|
A: [
|
|
2449
2463
|
"request.space",
|
|
@@ -2456,14 +2470,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2456
2470
|
guest: deviceKey
|
|
2457
2471
|
}, {
|
|
2458
2472
|
F: __dxlog_file9,
|
|
2459
|
-
L:
|
|
2473
|
+
L: 54,
|
|
2460
2474
|
S: this,
|
|
2461
2475
|
C: (f, a) => f(...a)
|
|
2462
2476
|
});
|
|
2463
2477
|
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2464
2478
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2465
2479
|
F: __dxlog_file9,
|
|
2466
|
-
L:
|
|
2480
|
+
L: 65,
|
|
2467
2481
|
S: this,
|
|
2468
2482
|
A: [
|
|
2469
2483
|
"credentials[0].credential",
|
|
@@ -2473,7 +2487,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2473
2487
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2474
2488
|
(0, import_invariant8.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2475
2489
|
F: __dxlog_file9,
|
|
2476
|
-
L:
|
|
2490
|
+
L: 67,
|
|
2477
2491
|
S: this,
|
|
2478
2492
|
A: [
|
|
2479
2493
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2489,6 +2503,11 @@ var SpaceInvitationProtocol = class {
|
|
|
2489
2503
|
}
|
|
2490
2504
|
};
|
|
2491
2505
|
}
|
|
2506
|
+
checkInvitation(invitation) {
|
|
2507
|
+
if (invitation.spaceKey && this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
2508
|
+
return new import_protocols6.AlreadyJoinedError("Already joined space.");
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2492
2511
|
createIntroduction() {
|
|
2493
2512
|
return {
|
|
2494
2513
|
profile: this._signingContext.getProfile()
|
|
@@ -2509,7 +2528,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2509
2528
|
async accept(response) {
|
|
2510
2529
|
(0, import_invariant8.invariant)(response.space, void 0, {
|
|
2511
2530
|
F: __dxlog_file9,
|
|
2512
|
-
L:
|
|
2531
|
+
L: 108,
|
|
2513
2532
|
S: this,
|
|
2514
2533
|
A: [
|
|
2515
2534
|
"response.space",
|
|
@@ -2520,7 +2539,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2520
2539
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2521
2540
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2522
2541
|
F: __dxlog_file9,
|
|
2523
|
-
L:
|
|
2542
|
+
L: 111,
|
|
2524
2543
|
S: this,
|
|
2525
2544
|
A: [
|
|
2526
2545
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2529,13 +2548,16 @@ var SpaceInvitationProtocol = class {
|
|
|
2529
2548
|
});
|
|
2530
2549
|
(0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2531
2550
|
F: __dxlog_file9,
|
|
2532
|
-
L:
|
|
2551
|
+
L: 112,
|
|
2533
2552
|
S: this,
|
|
2534
2553
|
A: [
|
|
2535
2554
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
2536
2555
|
""
|
|
2537
2556
|
]
|
|
2538
2557
|
});
|
|
2558
|
+
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
2559
|
+
throw new import_protocols6.AlreadyJoinedError("Already joined space.");
|
|
2560
|
+
}
|
|
2539
2561
|
await this._spaceManager.acceptSpace({
|
|
2540
2562
|
spaceKey: assertion.spaceKey,
|
|
2541
2563
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -2558,7 +2580,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
2558
2580
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2559
2581
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2560
2582
|
}
|
|
2561
|
-
var ClientRpcServer = class
|
|
2583
|
+
var ClientRpcServer = class {
|
|
2562
2584
|
constructor(params) {
|
|
2563
2585
|
this._handlerCache = /* @__PURE__ */ new Map();
|
|
2564
2586
|
this._callMetrics = new import_tracing3.MapCounter();
|
|
@@ -2649,7 +2671,7 @@ var getPlatform = () => {
|
|
|
2649
2671
|
};
|
|
2650
2672
|
}
|
|
2651
2673
|
};
|
|
2652
|
-
var DXOS_VERSION = "0.3.11-main.
|
|
2674
|
+
var DXOS_VERSION = "0.3.11-main.d8b8a39";
|
|
2653
2675
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2654
2676
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2655
2677
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2659,7 +2681,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2659
2681
|
client: {
|
|
2660
2682
|
version: DXOS_VERSION,
|
|
2661
2683
|
storage: {
|
|
2662
|
-
version:
|
|
2684
|
+
version: import_protocols7.STORAGE_VERSION
|
|
2663
2685
|
}
|
|
2664
2686
|
}
|
|
2665
2687
|
};
|
|
@@ -3018,10 +3040,10 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
3018
3040
|
constructor(_params) {
|
|
3019
3041
|
super({
|
|
3020
3042
|
requested: {
|
|
3021
|
-
NotarizationService:
|
|
3043
|
+
NotarizationService: import_protocols9.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3022
3044
|
},
|
|
3023
3045
|
exposed: {
|
|
3024
|
-
NotarizationService:
|
|
3046
|
+
NotarizationService: import_protocols9.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3025
3047
|
}
|
|
3026
3048
|
});
|
|
3027
3049
|
this._params = _params;
|
|
@@ -3056,7 +3078,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3056
3078
|
}
|
|
3057
3079
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3058
3080
|
var ENABLE_FEED_PURGE = false;
|
|
3059
|
-
var DataSpace = class
|
|
3081
|
+
var DataSpace = class {
|
|
3060
3082
|
constructor(params) {
|
|
3061
3083
|
this._ctx = new import_context6.Context();
|
|
3062
3084
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
@@ -3181,7 +3203,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3181
3203
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3182
3204
|
await this.initializeDataPipeline();
|
|
3183
3205
|
} catch (err) {
|
|
3184
|
-
if (err instanceof
|
|
3206
|
+
if (err instanceof import_protocols8.CancelledError) {
|
|
3185
3207
|
(0, import_log9.log)("data pipeline initialization cancelled", err, {
|
|
3186
3208
|
F: __dxlog_file12,
|
|
3187
3209
|
L: 236,
|
|
@@ -3214,7 +3236,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3214
3236
|
}
|
|
3215
3237
|
async initializeDataPipeline() {
|
|
3216
3238
|
if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
|
|
3217
|
-
throw new
|
|
3239
|
+
throw new import_protocols8.SystemError("Invalid operation");
|
|
3218
3240
|
}
|
|
3219
3241
|
this._state = import_services7.SpaceState.INITIALIZING;
|
|
3220
3242
|
(0, import_log9.log)("new state", {
|
|
@@ -3521,7 +3543,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3521
3543
|
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
3522
3544
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3523
3545
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3524
|
-
var DataSpaceManager = class
|
|
3546
|
+
var DataSpaceManager = class {
|
|
3525
3547
|
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
|
|
3526
3548
|
this._spaceManager = _spaceManager;
|
|
3527
3549
|
this._metadataStore = _metadataStore;
|
|
@@ -3547,7 +3569,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3547
3569
|
S: this,
|
|
3548
3570
|
C: (f, a) => f(...a)
|
|
3549
3571
|
});
|
|
3550
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3572
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
|
|
3551
3573
|
id: this._instanceId
|
|
3552
3574
|
}), {
|
|
3553
3575
|
F: __dxlog_file13,
|
|
@@ -3593,7 +3615,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3593
3615
|
space.initializeDataPipelineAsync();
|
|
3594
3616
|
}
|
|
3595
3617
|
}
|
|
3596
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3618
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
|
|
3597
3619
|
id: this._instanceId
|
|
3598
3620
|
}), {
|
|
3599
3621
|
F: __dxlog_file13,
|
|
@@ -3863,7 +3885,7 @@ var SpacesServiceImpl = class {
|
|
|
3863
3885
|
}
|
|
3864
3886
|
async updateSpace({ spaceKey, state }) {
|
|
3865
3887
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3866
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3888
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3867
3889
|
if (state) {
|
|
3868
3890
|
switch (state) {
|
|
3869
3891
|
case import_services9.SpaceState.ACTIVE:
|
|
@@ -3873,7 +3895,7 @@ var SpacesServiceImpl = class {
|
|
|
3873
3895
|
await space.deactivate();
|
|
3874
3896
|
break;
|
|
3875
3897
|
default:
|
|
3876
|
-
throw new
|
|
3898
|
+
throw new import_protocols11.ApiError("Invalid space state");
|
|
3877
3899
|
}
|
|
3878
3900
|
}
|
|
3879
3901
|
}
|
|
@@ -3928,14 +3950,14 @@ var SpacesServiceImpl = class {
|
|
|
3928
3950
|
}
|
|
3929
3951
|
async postMessage({ spaceKey, channel, message }) {
|
|
3930
3952
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3931
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3953
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3932
3954
|
await space.postMessage(getChannelId(channel), message);
|
|
3933
3955
|
}
|
|
3934
3956
|
subscribeMessages({ spaceKey, channel }) {
|
|
3935
3957
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
3936
3958
|
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3937
3959
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3938
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3960
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3939
3961
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
3940
3962
|
next(message);
|
|
3941
3963
|
});
|
|
@@ -3945,7 +3967,7 @@ var SpacesServiceImpl = class {
|
|
|
3945
3967
|
}
|
|
3946
3968
|
queryCredentials({ spaceKey, noTail }) {
|
|
3947
3969
|
return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
|
|
3948
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3970
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3949
3971
|
const processor = {
|
|
3950
3972
|
processCredential: async (credential) => {
|
|
3951
3973
|
next(credential);
|
|
@@ -3961,7 +3983,7 @@ var SpacesServiceImpl = class {
|
|
|
3961
3983
|
});
|
|
3962
3984
|
}
|
|
3963
3985
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3964
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3986
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3965
3987
|
for (const credential of credentials ?? []) {
|
|
3966
3988
|
if (credential.proof) {
|
|
3967
3989
|
await space.controlPipeline.writer.write({
|
|
@@ -4012,14 +4034,14 @@ var SpacesServiceImpl = class {
|
|
|
4012
4034
|
}
|
|
4013
4035
|
async createEpoch({ spaceKey }) {
|
|
4014
4036
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4015
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4037
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
4016
4038
|
await space.createEpoch();
|
|
4017
4039
|
}
|
|
4018
4040
|
_serializeSpace(space) {
|
|
4019
4041
|
return {
|
|
4020
4042
|
spaceKey: space.key,
|
|
4021
4043
|
state: space.state,
|
|
4022
|
-
error: space.error ? (0,
|
|
4044
|
+
error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
|
|
4023
4045
|
pipeline: {
|
|
4024
4046
|
currentEpoch: space.dataPipeline.currentEpoch,
|
|
4025
4047
|
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
@@ -4068,7 +4090,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4068
4090
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4069
4091
|
}
|
|
4070
4092
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4071
|
-
var ServiceContext = class
|
|
4093
|
+
var ServiceContext = class {
|
|
4072
4094
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
4073
4095
|
this.storage = storage;
|
|
4074
4096
|
this.networkManager = networkManager;
|
|
@@ -4113,7 +4135,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4113
4135
|
S: this,
|
|
4114
4136
|
C: (f, a) => f(...a)
|
|
4115
4137
|
});
|
|
4116
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
4138
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
|
|
4117
4139
|
id: this._instanceId
|
|
4118
4140
|
}), {
|
|
4119
4141
|
F: __dxlog_file15,
|
|
@@ -4129,7 +4151,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4129
4151
|
if (this.identityManager.identity) {
|
|
4130
4152
|
await this._initialize(ctx);
|
|
4131
4153
|
}
|
|
4132
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
4154
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
|
|
4133
4155
|
id: this._instanceId
|
|
4134
4156
|
}), {
|
|
4135
4157
|
F: __dxlog_file15,
|
|
@@ -4203,8 +4225,8 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4203
4225
|
}
|
|
4204
4226
|
async _checkStorageVersion() {
|
|
4205
4227
|
await this.metadataStore.load();
|
|
4206
|
-
if (this.metadataStore.version !==
|
|
4207
|
-
throw new
|
|
4228
|
+
if (this.metadataStore.version !== import_protocols12.STORAGE_VERSION) {
|
|
4229
|
+
throw new import_protocols12.InvalidStorageVersionError(import_protocols12.STORAGE_VERSION, this.metadataStore.version);
|
|
4208
4230
|
}
|
|
4209
4231
|
}
|
|
4210
4232
|
// Called when identity is created.
|
|
@@ -4391,16 +4413,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
|
4391
4413
|
var createStorageObjects = (config) => {
|
|
4392
4414
|
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4393
4415
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4394
|
-
throw new
|
|
4416
|
+
throw new import_protocols13.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4395
4417
|
}
|
|
4396
4418
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4397
|
-
throw new
|
|
4419
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4398
4420
|
}
|
|
4399
4421
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4400
|
-
throw new
|
|
4422
|
+
throw new import_protocols13.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4401
4423
|
}
|
|
4402
4424
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4403
|
-
throw new
|
|
4425
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4404
4426
|
}
|
|
4405
4427
|
return {
|
|
4406
4428
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -4682,7 +4704,7 @@ var createGenesisMutationFromTypedObject = (obj) => {
|
|
|
4682
4704
|
}
|
|
4683
4705
|
};
|
|
4684
4706
|
};
|
|
4685
|
-
var ClientServicesHost = class
|
|
4707
|
+
var ClientServicesHost = class {
|
|
4686
4708
|
constructor({
|
|
4687
4709
|
config,
|
|
4688
4710
|
modelFactory = createDefaultModelFactory(),
|
|
@@ -4826,7 +4848,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4826
4848
|
return;
|
|
4827
4849
|
}
|
|
4828
4850
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
4829
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
4851
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
4830
4852
|
id: traceId
|
|
4831
4853
|
}), {
|
|
4832
4854
|
F: __dxlog_file17,
|
|
@@ -4884,7 +4906,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4884
4906
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4885
4907
|
this._serviceRegistry.setServices({
|
|
4886
4908
|
SystemService: this._systemService,
|
|
4887
|
-
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
4909
|
+
IdentityService: new IdentityServiceImpl((params, useAutomerge) => this._createIdentity(params, useAutomerge), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
4888
4910
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4889
4911
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4890
4912
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -4925,7 +4947,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4925
4947
|
S: this,
|
|
4926
4948
|
C: (f, a) => f(...a)
|
|
4927
4949
|
});
|
|
4928
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
4950
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
4929
4951
|
id: traceId
|
|
4930
4952
|
}), {
|
|
4931
4953
|
F: __dxlog_file17,
|
|
@@ -4966,7 +4988,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4966
4988
|
}
|
|
4967
4989
|
async reset() {
|
|
4968
4990
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
4969
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
4991
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
4970
4992
|
id: traceId
|
|
4971
4993
|
}), {
|
|
4972
4994
|
F: __dxlog_file17,
|
|
@@ -4988,7 +5010,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4988
5010
|
S: this,
|
|
4989
5011
|
C: (f, a) => f(...a)
|
|
4990
5012
|
});
|
|
4991
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5013
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
4992
5014
|
id: traceId
|
|
4993
5015
|
}), {
|
|
4994
5016
|
F: __dxlog_file17,
|
|
@@ -4998,25 +5020,44 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4998
5020
|
});
|
|
4999
5021
|
await this._callbacks?.onReset?.();
|
|
5000
5022
|
}
|
|
5001
|
-
async _createIdentity(params) {
|
|
5023
|
+
async _createIdentity(params, useAutomerge) {
|
|
5002
5024
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5003
5025
|
await this._serviceContext.initialized.wait();
|
|
5004
5026
|
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
5005
5027
|
const obj = new import_client_protocol5.Properties(void 0, {
|
|
5006
|
-
automerge:
|
|
5028
|
+
automerge: useAutomerge
|
|
5007
5029
|
});
|
|
5008
5030
|
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5031
|
+
if (!useAutomerge) {
|
|
5032
|
+
await this._serviceRegistry.services.DataService.write({
|
|
5033
|
+
spaceKey: space.key,
|
|
5034
|
+
batch: {
|
|
5035
|
+
objects: [
|
|
5036
|
+
createGenesisMutationFromTypedObject(obj)
|
|
5037
|
+
]
|
|
5038
|
+
}
|
|
5039
|
+
});
|
|
5040
|
+
await this._serviceRegistry.services.DataService.flush({
|
|
5041
|
+
spaceKey: space.key
|
|
5042
|
+
});
|
|
5043
|
+
} else {
|
|
5044
|
+
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5045
|
+
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5046
|
+
F: __dxlog_file17,
|
|
5047
|
+
L: 375,
|
|
5048
|
+
S: this,
|
|
5049
|
+
A: [
|
|
5050
|
+
"automergeIndex",
|
|
5051
|
+
""
|
|
5014
5052
|
]
|
|
5015
|
-
}
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5053
|
+
});
|
|
5054
|
+
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5055
|
+
await document.whenReady();
|
|
5056
|
+
document.change((doc) => {
|
|
5057
|
+
doc.objects ??= {};
|
|
5058
|
+
doc.objects[obj[import_echo_schema.base]._id] = (0, import_echo_schema.getRawDoc)(obj).handle.docSync();
|
|
5059
|
+
});
|
|
5060
|
+
}
|
|
5020
5061
|
return identity;
|
|
5021
5062
|
}
|
|
5022
5063
|
};
|
|
@@ -5071,4 +5112,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5071
5112
|
subscribeToSpaces,
|
|
5072
5113
|
subscribeToSwarmInfo
|
|
5073
5114
|
});
|
|
5074
|
-
//# sourceMappingURL=chunk-
|
|
5115
|
+
//# sourceMappingURL=chunk-H5EXDUBC.cjs.map
|