@dxos/client-services 0.5.9-main.0a0e87d → 0.5.9-main.17d92ec
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-CMZ6YZOX.mjs → chunk-ZMHVORBY.mjs} +1377 -839
- package/dist/lib/browser/chunk-ZMHVORBY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -4
- 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 +11 -5
- package/dist/lib/browser/packlets/testing/index.mjs.map +2 -2
- package/dist/lib/node/{chunk-CA7UVCON.cjs → chunk-GKYO3IUG.cjs} +1510 -975
- package/dist/lib/node/chunk-GKYO3IUG.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -44
- 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 +18 -12
- package/dist/lib/node/packlets/testing/index.cjs.map +2 -2
- package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/identity-service.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.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.map +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +4 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -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 +9 -9
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +23 -0
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +5 -2
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/identity/identity-service.ts +33 -7
- package/src/packlets/invitations/invitations-handler.ts +13 -5
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
- package/src/packlets/services/service-context.ts +1 -4
- package/src/packlets/services/service-host.ts +12 -4
- package/src/packlets/spaces/automerge-space-state.ts +11 -2
- package/src/packlets/spaces/data-space-manager.ts +90 -16
- package/src/packlets/spaces/data-space.ts +76 -148
- package/src/packlets/spaces/epoch-migrations.ts +140 -0
- package/src/packlets/spaces/spaces-service.ts +54 -4
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +97 -0
- package/src/packlets/testing/test-builder.ts +1 -4
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-CMZ6YZOX.mjs.map +0 -7
- package/dist/lib/node/chunk-CA7UVCON.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_GKYO3IUG_exports = {};
|
|
30
|
+
__export(chunk_GKYO3IUG_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -56,8 +56,11 @@ __export(chunk_CA7UVCON_exports, {
|
|
|
56
56
|
createDiagnostics: () => createDiagnostics,
|
|
57
57
|
createLevel: () => createLevel,
|
|
58
58
|
createStorageObjects: () => createStorageObjects,
|
|
59
|
-
|
|
59
|
+
decodeProfileArchive: () => decodeProfileArchive,
|
|
60
|
+
encodeProfileArchive: () => encodeProfileArchive,
|
|
61
|
+
exportProfileData: () => exportProfileData,
|
|
60
62
|
getNetworkPeers: () => getNetworkPeers,
|
|
63
|
+
importProfileData: () => importProfileData,
|
|
61
64
|
isLocked: () => isLocked,
|
|
62
65
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
63
66
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -67,7 +70,7 @@ __export(chunk_CA7UVCON_exports, {
|
|
|
67
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
68
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
69
72
|
});
|
|
70
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_GKYO3IUG_exports);
|
|
71
74
|
var import_async = require("@dxos/async");
|
|
72
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
73
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -127,186 +130,212 @@ var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip"
|
|
|
127
130
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
128
131
|
var import_tracing4 = require("@dxos/tracing");
|
|
129
132
|
var import_util3 = require("@dxos/util");
|
|
133
|
+
var import_async8 = require("@dxos/async");
|
|
130
134
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
131
135
|
var import_context4 = require("@dxos/context");
|
|
132
136
|
var import_credentials8 = require("@dxos/credentials");
|
|
133
137
|
var import_debug2 = require("@dxos/debug");
|
|
134
138
|
var import_invariant4 = require("@dxos/invariant");
|
|
139
|
+
var import_log5 = require("@dxos/log");
|
|
135
140
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
141
|
+
var import_util4 = require("@dxos/util");
|
|
136
142
|
var import_invariant5 = require("@dxos/invariant");
|
|
137
143
|
var import_protocols4 = require("@dxos/protocols");
|
|
138
144
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
139
|
-
var
|
|
145
|
+
var import_async9 = require("@dxos/async");
|
|
140
146
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
141
147
|
var import_context5 = require("@dxos/context");
|
|
142
148
|
var import_crypto = require("@dxos/crypto");
|
|
143
149
|
var import_invariant6 = require("@dxos/invariant");
|
|
144
150
|
var import_keys6 = require("@dxos/keys");
|
|
145
|
-
var
|
|
151
|
+
var import_log6 = require("@dxos/log");
|
|
146
152
|
var import_network_manager = require("@dxos/network-manager");
|
|
147
153
|
var import_protocols5 = require("@dxos/protocols");
|
|
148
154
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
149
155
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
150
156
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
151
|
-
var
|
|
152
|
-
var
|
|
157
|
+
var import_util5 = require("@dxos/util");
|
|
158
|
+
var import_async10 = require("@dxos/async");
|
|
153
159
|
var import_context6 = require("@dxos/context");
|
|
154
160
|
var import_invariant7 = require("@dxos/invariant");
|
|
155
|
-
var
|
|
161
|
+
var import_log7 = require("@dxos/log");
|
|
156
162
|
var import_protocols6 = require("@dxos/protocols");
|
|
157
163
|
var import_invitations3 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
158
164
|
var import_teleport = require("@dxos/teleport");
|
|
159
165
|
var import_context7 = require("@dxos/context");
|
|
160
166
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
161
|
-
var
|
|
167
|
+
var import_async11 = require("@dxos/async");
|
|
162
168
|
var import_context8 = require("@dxos/context");
|
|
163
169
|
var import_crypto2 = require("@dxos/crypto");
|
|
164
170
|
var import_invariant8 = require("@dxos/invariant");
|
|
165
171
|
var import_keys7 = require("@dxos/keys");
|
|
166
|
-
var
|
|
172
|
+
var import_log8 = require("@dxos/log");
|
|
167
173
|
var import_protocols7 = require("@dxos/protocols");
|
|
168
174
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
169
175
|
var import_invitations4 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
170
176
|
var import_teleport2 = require("@dxos/teleport");
|
|
171
177
|
var import_invariant9 = require("@dxos/invariant");
|
|
172
178
|
var import_keys8 = require("@dxos/keys");
|
|
173
|
-
var
|
|
179
|
+
var import_log9 = require("@dxos/log");
|
|
174
180
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
175
|
-
var
|
|
181
|
+
var import_util6 = require("@dxos/util");
|
|
176
182
|
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
177
183
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
178
184
|
var import_credentials9 = require("@dxos/credentials");
|
|
179
185
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
180
186
|
var import_invariant10 = require("@dxos/invariant");
|
|
181
|
-
var
|
|
187
|
+
var import_log10 = require("@dxos/log");
|
|
182
188
|
var import_protocols8 = require("@dxos/protocols");
|
|
183
189
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
184
190
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
185
|
-
var
|
|
191
|
+
var import_async12 = require("@dxos/async");
|
|
186
192
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
187
193
|
var import_context9 = require("@dxos/context");
|
|
188
194
|
var import_credentials11 = require("@dxos/credentials");
|
|
189
195
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
190
196
|
var import_invariant11 = require("@dxos/invariant");
|
|
191
197
|
var import_keys9 = require("@dxos/keys");
|
|
192
|
-
var
|
|
198
|
+
var import_log11 = require("@dxos/log");
|
|
193
199
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
194
200
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
195
|
-
var
|
|
201
|
+
var import_async13 = require("@dxos/async");
|
|
196
202
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
197
203
|
var import_context10 = require("@dxos/context");
|
|
198
204
|
var import_debug3 = require("@dxos/debug");
|
|
199
205
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
200
|
-
var
|
|
206
|
+
var import_echo_protocol = require("@dxos/echo-protocol");
|
|
201
207
|
var import_invariant12 = require("@dxos/invariant");
|
|
202
208
|
var import_keys10 = require("@dxos/keys");
|
|
203
|
-
var
|
|
209
|
+
var import_log12 = require("@dxos/log");
|
|
204
210
|
var import_protocols9 = require("@dxos/protocols");
|
|
205
211
|
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
206
212
|
var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
207
213
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
208
214
|
var import_tracing5 = require("@dxos/tracing");
|
|
209
|
-
var
|
|
210
|
-
var import_async13 = require("@dxos/async");
|
|
211
|
-
var import_credentials14 = require("@dxos/credentials");
|
|
215
|
+
var import_util7 = require("@dxos/util");
|
|
212
216
|
var import_async14 = require("@dxos/async");
|
|
213
217
|
var import_context11 = require("@dxos/context");
|
|
218
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
219
|
+
var import_async15 = require("@dxos/async");
|
|
220
|
+
var import_automerge = require("@dxos/automerge/automerge");
|
|
221
|
+
var import_context12 = require("@dxos/context");
|
|
222
|
+
var import_echo_db = require("@dxos/echo-db");
|
|
223
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
224
|
+
var import_echo_schema = require("@dxos/echo-schema");
|
|
214
225
|
var import_invariant13 = require("@dxos/invariant");
|
|
226
|
+
var import_log13 = require("@dxos/log");
|
|
227
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
228
|
+
var import_util8 = require("@dxos/util");
|
|
229
|
+
var import_async16 = require("@dxos/async");
|
|
230
|
+
var import_context13 = require("@dxos/context");
|
|
231
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
215
232
|
var import_keys11 = require("@dxos/keys");
|
|
216
|
-
var
|
|
233
|
+
var import_log14 = require("@dxos/log");
|
|
217
234
|
var import_protocols10 = require("@dxos/protocols");
|
|
218
235
|
var import_teleport3 = require("@dxos/teleport");
|
|
219
|
-
var
|
|
220
|
-
var
|
|
236
|
+
var import_util9 = require("@dxos/util");
|
|
237
|
+
var import_async17 = require("@dxos/async");
|
|
221
238
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
222
|
-
var
|
|
239
|
+
var import_context14 = require("@dxos/context");
|
|
223
240
|
var import_credentials15 = require("@dxos/credentials");
|
|
224
|
-
var
|
|
225
|
-
var
|
|
241
|
+
var import_echo_db2 = require("@dxos/echo-db");
|
|
242
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
243
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
244
|
+
var import_echo_protocol2 = require("@dxos/echo-protocol");
|
|
226
245
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
227
|
-
var
|
|
246
|
+
var import_feed_store4 = require("@dxos/feed-store");
|
|
247
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
228
248
|
var import_keys12 = require("@dxos/keys");
|
|
229
|
-
var
|
|
249
|
+
var import_log15 = require("@dxos/log");
|
|
230
250
|
var import_protocols11 = require("@dxos/protocols");
|
|
231
|
-
var
|
|
251
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
232
252
|
var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
233
253
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
234
254
|
var import_tracing6 = require("@dxos/tracing");
|
|
235
|
-
var
|
|
255
|
+
var import_util10 = require("@dxos/util");
|
|
236
256
|
var import_credentials17 = require("@dxos/credentials");
|
|
237
257
|
var import_debug4 = require("@dxos/debug");
|
|
238
258
|
var import_credentials18 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
239
259
|
var import_timeframe4 = require("@dxos/timeframe");
|
|
240
|
-
var
|
|
260
|
+
var import_async18 = require("@dxos/async");
|
|
241
261
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
242
262
|
var import_credentials19 = require("@dxos/credentials");
|
|
243
263
|
var import_debug5 = require("@dxos/debug");
|
|
244
|
-
var
|
|
245
|
-
var
|
|
246
|
-
var
|
|
264
|
+
var import_feed_store5 = require("@dxos/feed-store");
|
|
265
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
266
|
+
var import_log16 = require("@dxos/log");
|
|
247
267
|
var import_protocols12 = require("@dxos/protocols");
|
|
248
|
-
var
|
|
268
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
269
|
var import_tracing7 = require("@dxos/tracing");
|
|
250
|
-
var
|
|
251
|
-
var
|
|
270
|
+
var import_async19 = require("@dxos/async");
|
|
271
|
+
var import_context15 = require("@dxos/context");
|
|
252
272
|
var import_credentials20 = require("@dxos/credentials");
|
|
253
273
|
var import_debug6 = require("@dxos/debug");
|
|
254
|
-
var
|
|
255
|
-
var
|
|
256
|
-
var
|
|
257
|
-
var
|
|
274
|
+
var import_echo_db3 = require("@dxos/echo-db");
|
|
275
|
+
var import_echo_pipeline6 = require("@dxos/echo-pipeline");
|
|
276
|
+
var import_feed_store6 = require("@dxos/feed-store");
|
|
277
|
+
var import_invariant17 = require("@dxos/invariant");
|
|
258
278
|
var import_keyring = require("@dxos/keyring");
|
|
259
279
|
var import_keys13 = require("@dxos/keys");
|
|
260
|
-
var
|
|
280
|
+
var import_log17 = require("@dxos/log");
|
|
261
281
|
var import_protocols13 = require("@dxos/protocols");
|
|
262
|
-
var
|
|
282
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
263
283
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
264
284
|
var import_tracing8 = require("@dxos/tracing");
|
|
265
|
-
var
|
|
266
|
-
var
|
|
285
|
+
var import_util11 = require("@dxos/util");
|
|
286
|
+
var import_invariant18 = require("@dxos/invariant");
|
|
267
287
|
var import_lock_file = require("@dxos/lock-file");
|
|
268
|
-
var
|
|
288
|
+
var import_log18 = require("@dxos/log");
|
|
269
289
|
var import_protocols14 = require("@dxos/protocols");
|
|
270
290
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
271
291
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
272
292
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
273
293
|
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
274
|
-
var
|
|
294
|
+
var import_util12 = require("@dxos/util");
|
|
275
295
|
var import_node_path = __toESM(require("node:path"));
|
|
276
296
|
var import_keys14 = require("@dxos/keys");
|
|
277
297
|
var import_kv_store = require("@dxos/kv-store");
|
|
278
|
-
var
|
|
298
|
+
var import_automerge_repo = require("@dxos/automerge/automerge-repo");
|
|
299
|
+
var import_invariant19 = require("@dxos/invariant");
|
|
300
|
+
var import_log19 = require("@dxos/log");
|
|
301
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
302
|
+
var import_util13 = require("@dxos/util");
|
|
303
|
+
var import_async20 = require("@dxos/async");
|
|
279
304
|
var import_client_protocol7 = require("@dxos/client-protocol");
|
|
280
|
-
var
|
|
281
|
-
var
|
|
305
|
+
var import_context16 = require("@dxos/context");
|
|
306
|
+
var import_invariant20 = require("@dxos/invariant");
|
|
282
307
|
var import_keys15 = require("@dxos/keys");
|
|
283
|
-
var
|
|
308
|
+
var import_log20 = require("@dxos/log");
|
|
284
309
|
var import_messaging = require("@dxos/messaging");
|
|
285
310
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
286
|
-
var
|
|
287
|
-
var
|
|
311
|
+
var import_protocols16 = require("@dxos/protocols");
|
|
312
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
288
313
|
var import_tracing9 = require("@dxos/tracing");
|
|
289
314
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
290
|
-
var
|
|
315
|
+
var import_async21 = require("@dxos/async");
|
|
291
316
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
292
|
-
var
|
|
293
|
-
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
294
|
-
var import_config3 = require("@dxos/config");
|
|
317
|
+
var import_invariant21 = require("@dxos/invariant");
|
|
295
318
|
var import_services18 = require("@dxos/protocols/proto/dxos/client/services");
|
|
319
|
+
var import_config3 = require("@dxos/config");
|
|
320
|
+
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
296
321
|
var import_tracing10 = require("@dxos/tracing");
|
|
297
|
-
var
|
|
322
|
+
var import_util14 = require("@dxos/util");
|
|
298
323
|
var import_keys16 = require("@dxos/keys");
|
|
299
|
-
var
|
|
300
|
-
var
|
|
324
|
+
var import_util15 = require("@dxos/util");
|
|
325
|
+
var import_async22 = require("@dxos/async");
|
|
301
326
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
302
327
|
var import_keys17 = require("@dxos/keys");
|
|
303
|
-
var
|
|
304
|
-
var
|
|
305
|
-
var import_util13 = require("@dxos/util");
|
|
328
|
+
var import_util16 = require("@dxos/util");
|
|
329
|
+
var import_async23 = require("@dxos/async");
|
|
306
330
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
307
|
-
var
|
|
331
|
+
var import_keys18 = require("@dxos/keys");
|
|
332
|
+
var import_log21 = require("@dxos/log");
|
|
308
333
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
309
|
-
var
|
|
334
|
+
var import_util17 = require("@dxos/util");
|
|
335
|
+
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
336
|
+
var import_codec_protobuf16 = require("@dxos/codec-protobuf");
|
|
337
|
+
var import_services21 = require("@dxos/protocols/proto/dxos/client/services");
|
|
338
|
+
var import_util18 = require("@dxos/util");
|
|
310
339
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
311
340
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
312
341
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -374,6 +403,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
374
403
|
};
|
|
375
404
|
});
|
|
376
405
|
};
|
|
406
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
377
407
|
var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next, close }) => {
|
|
378
408
|
const update = () => {
|
|
379
409
|
try {
|
|
@@ -389,7 +419,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
389
419
|
update();
|
|
390
420
|
});
|
|
391
421
|
var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream(({ next }) => {
|
|
392
|
-
const ctx = new import_context.Context(
|
|
422
|
+
const ctx = new import_context.Context(void 0, {
|
|
423
|
+
F: __dxlog_file,
|
|
424
|
+
L: 36
|
|
425
|
+
});
|
|
393
426
|
signalManager.onMessage.on(ctx, (message) => {
|
|
394
427
|
next({
|
|
395
428
|
message: {
|
|
@@ -617,7 +650,7 @@ var DevtoolsServiceImpl = class {
|
|
|
617
650
|
});
|
|
618
651
|
}
|
|
619
652
|
};
|
|
620
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
653
|
+
var DXOS_VERSION = "0.5.9-main.17d92ec";
|
|
621
654
|
var getPlatform = () => {
|
|
622
655
|
if (process.browser) {
|
|
623
656
|
if (typeof window !== "undefined") {
|
|
@@ -645,7 +678,7 @@ var getPlatform = () => {
|
|
|
645
678
|
};
|
|
646
679
|
}
|
|
647
680
|
};
|
|
648
|
-
var
|
|
681
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
649
682
|
var DEFAULT_TIMEOUT = 1e3;
|
|
650
683
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
651
684
|
const diagnostics = {
|
|
@@ -662,7 +695,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
662
695
|
await Promise.all([
|
|
663
696
|
(async () => {
|
|
664
697
|
(0, import_invariant.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
665
|
-
F:
|
|
698
|
+
F: __dxlog_file2,
|
|
666
699
|
L: 110,
|
|
667
700
|
S: void 0,
|
|
668
701
|
A: [
|
|
@@ -851,7 +884,7 @@ _ts_decorate([
|
|
|
851
884
|
ClientRpcServer = _ts_decorate([
|
|
852
885
|
import_tracing2.trace.resource()
|
|
853
886
|
], ClientRpcServer);
|
|
854
|
-
var
|
|
887
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
855
888
|
var Credential = import_protocols2.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
856
889
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
857
890
|
const credential = await signer.createCredential({
|
|
@@ -866,7 +899,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
866
899
|
var TrustedKeySetAuthVerifier = class {
|
|
867
900
|
constructor(_params) {
|
|
868
901
|
this._params = _params;
|
|
869
|
-
this._ctx = new import_context2.Context(
|
|
902
|
+
this._ctx = new import_context2.Context(void 0, {
|
|
903
|
+
F: __dxlog_file3,
|
|
904
|
+
L: 45
|
|
905
|
+
});
|
|
870
906
|
}
|
|
871
907
|
async close() {
|
|
872
908
|
await this._ctx.dispose();
|
|
@@ -877,7 +913,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
877
913
|
(0, import_log.log)("authenticating...", {
|
|
878
914
|
credential
|
|
879
915
|
}, {
|
|
880
|
-
F:
|
|
916
|
+
F: __dxlog_file3,
|
|
881
917
|
L: 56,
|
|
882
918
|
S: this,
|
|
883
919
|
C: (f, a) => f(...a)
|
|
@@ -887,7 +923,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
887
923
|
(0, import_log.log)("Invalid credential", {
|
|
888
924
|
result
|
|
889
925
|
}, {
|
|
890
|
-
F:
|
|
926
|
+
F: __dxlog_file3,
|
|
891
927
|
L: 60,
|
|
892
928
|
S: this,
|
|
893
929
|
C: (f, a) => f(...a)
|
|
@@ -899,7 +935,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
899
935
|
nonce,
|
|
900
936
|
credential
|
|
901
937
|
}, {
|
|
902
|
-
F:
|
|
938
|
+
F: __dxlog_file3,
|
|
903
939
|
L: 65,
|
|
904
940
|
S: this,
|
|
905
941
|
C: (f, a) => f(...a)
|
|
@@ -910,7 +946,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
910
946
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
911
947
|
key: credential.issuer
|
|
912
948
|
}, {
|
|
913
|
-
F:
|
|
949
|
+
F: __dxlog_file3,
|
|
914
950
|
L: 70,
|
|
915
951
|
S: this,
|
|
916
952
|
C: (f, a) => f(...a)
|
|
@@ -926,7 +962,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
926
962
|
(0, import_log.log)("auth success", {
|
|
927
963
|
key: credential.issuer
|
|
928
964
|
}, {
|
|
929
|
-
F:
|
|
965
|
+
F: __dxlog_file3,
|
|
930
966
|
L: 81,
|
|
931
967
|
S: this,
|
|
932
968
|
C: (f, a) => f(...a)
|
|
@@ -936,7 +972,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
936
972
|
(0, import_log.log)("key is not currently in trusted set, waiting...", {
|
|
937
973
|
key: credential.issuer
|
|
938
974
|
}, {
|
|
939
|
-
F:
|
|
975
|
+
F: __dxlog_file3,
|
|
940
976
|
L: 84,
|
|
941
977
|
S: this,
|
|
942
978
|
C: (f, a) => f(...a)
|
|
@@ -959,7 +995,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
959
995
|
return deviceSet.has(deviceKey);
|
|
960
996
|
}
|
|
961
997
|
};
|
|
962
|
-
var
|
|
998
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
963
999
|
var DefaultSpaceStateMachine = class {
|
|
964
1000
|
constructor(_params) {
|
|
965
1001
|
this._params = _params;
|
|
@@ -976,7 +1012,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
976
1012
|
expectedIdentity: this._params.identityKey,
|
|
977
1013
|
credential
|
|
978
1014
|
}, {
|
|
979
|
-
F:
|
|
1015
|
+
F: __dxlog_file4,
|
|
980
1016
|
L: 32,
|
|
981
1017
|
S: this,
|
|
982
1018
|
C: (f, a) => f(...a)
|
|
@@ -987,7 +1023,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
987
1023
|
import_log3.log.warn("Invalid default space id", {
|
|
988
1024
|
id: assertion.spaceId
|
|
989
1025
|
}, {
|
|
990
|
-
F:
|
|
1026
|
+
F: __dxlog_file4,
|
|
991
1027
|
L: 36,
|
|
992
1028
|
S: this,
|
|
993
1029
|
C: (f, a) => f(...a)
|
|
@@ -1010,7 +1046,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1010
1046
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1011
1047
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1012
1048
|
}
|
|
1013
|
-
var
|
|
1049
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
1014
1050
|
var Identity = class {
|
|
1015
1051
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
1016
1052
|
this.stateUpdate = new import_async6.Event();
|
|
@@ -1022,7 +1058,7 @@ var Identity = class {
|
|
|
1022
1058
|
import_log2.log.trace("dxos.halo.device", {
|
|
1023
1059
|
deviceKey
|
|
1024
1060
|
}, {
|
|
1025
|
-
F:
|
|
1061
|
+
F: __dxlog_file5,
|
|
1026
1062
|
L: 70,
|
|
1027
1063
|
S: this,
|
|
1028
1064
|
C: (f, a) => f(...a)
|
|
@@ -1101,7 +1137,7 @@ var Identity = class {
|
|
|
1101
1137
|
*/
|
|
1102
1138
|
getIdentityCredentialSigner() {
|
|
1103
1139
|
(0, import_invariant2.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
1104
|
-
F:
|
|
1140
|
+
F: __dxlog_file5,
|
|
1105
1141
|
L: 159,
|
|
1106
1142
|
S: this,
|
|
1107
1143
|
A: [
|
|
@@ -1145,7 +1181,7 @@ var Identity = class {
|
|
|
1145
1181
|
controlFeedKey,
|
|
1146
1182
|
dataFeedKey
|
|
1147
1183
|
}, {
|
|
1148
|
-
F:
|
|
1184
|
+
F: __dxlog_file5,
|
|
1149
1185
|
L: 184,
|
|
1150
1186
|
S: this,
|
|
1151
1187
|
C: (f, a) => f(...a)
|
|
@@ -1206,7 +1242,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1206
1242
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1207
1243
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1208
1244
|
}
|
|
1209
|
-
var
|
|
1245
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1210
1246
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1211
1247
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1212
1248
|
var IdentityManager = class {
|
|
@@ -1230,7 +1266,7 @@ var IdentityManager = class {
|
|
|
1230
1266
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.begin({
|
|
1231
1267
|
id: traceId
|
|
1232
1268
|
}), {
|
|
1233
|
-
F:
|
|
1269
|
+
F: __dxlog_file6,
|
|
1234
1270
|
L: 104,
|
|
1235
1271
|
S: this,
|
|
1236
1272
|
C: (f, a) => f(...a)
|
|
@@ -1239,7 +1275,7 @@ var IdentityManager = class {
|
|
|
1239
1275
|
(0, import_log4.log)("identity record", {
|
|
1240
1276
|
identityRecord
|
|
1241
1277
|
}, {
|
|
1242
|
-
F:
|
|
1278
|
+
F: __dxlog_file6,
|
|
1243
1279
|
L: 107,
|
|
1244
1280
|
S: this,
|
|
1245
1281
|
C: (f, a) => f(...a)
|
|
@@ -1252,7 +1288,7 @@ var IdentityManager = class {
|
|
|
1252
1288
|
identityKey: identityRecord.identityKey,
|
|
1253
1289
|
displayName: this._identity.profileDocument?.displayName
|
|
1254
1290
|
}, {
|
|
1255
|
-
F:
|
|
1291
|
+
F: __dxlog_file6,
|
|
1256
1292
|
L: 112,
|
|
1257
1293
|
S: this,
|
|
1258
1294
|
C: (f, a) => f(...a)
|
|
@@ -1262,18 +1298,21 @@ var IdentityManager = class {
|
|
|
1262
1298
|
import_log4.log.trace("dxos.halo.identity-manager.open", import_protocols3.trace.end({
|
|
1263
1299
|
id: traceId
|
|
1264
1300
|
}), {
|
|
1265
|
-
F:
|
|
1301
|
+
F: __dxlog_file6,
|
|
1266
1302
|
L: 119,
|
|
1267
1303
|
S: this,
|
|
1268
1304
|
C: (f, a) => f(...a)
|
|
1269
1305
|
});
|
|
1270
1306
|
}
|
|
1271
1307
|
async close() {
|
|
1272
|
-
await this._identity?.close(new import_context3.Context(
|
|
1308
|
+
await this._identity?.close(new import_context3.Context(void 0, {
|
|
1309
|
+
F: __dxlog_file6,
|
|
1310
|
+
L: 123
|
|
1311
|
+
}));
|
|
1273
1312
|
}
|
|
1274
1313
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1275
1314
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1276
|
-
F:
|
|
1315
|
+
F: __dxlog_file6,
|
|
1277
1316
|
L: 128,
|
|
1278
1317
|
S: this,
|
|
1279
1318
|
A: [
|
|
@@ -1282,7 +1321,7 @@ var IdentityManager = class {
|
|
|
1282
1321
|
]
|
|
1283
1322
|
});
|
|
1284
1323
|
(0, import_log4.log)("creating identity...", void 0, {
|
|
1285
|
-
F:
|
|
1324
|
+
F: __dxlog_file6,
|
|
1286
1325
|
L: 129,
|
|
1287
1326
|
S: this,
|
|
1288
1327
|
C: (f, a) => f(...a)
|
|
@@ -1299,11 +1338,14 @@ var IdentityManager = class {
|
|
|
1299
1338
|
}
|
|
1300
1339
|
};
|
|
1301
1340
|
const identity = await this._constructIdentity(identityRecord);
|
|
1302
|
-
await identity.open(new import_context3.Context(
|
|
1341
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1342
|
+
F: __dxlog_file6,
|
|
1343
|
+
L: 144
|
|
1344
|
+
}));
|
|
1303
1345
|
{
|
|
1304
1346
|
const generator = new import_credentials6.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1305
1347
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1306
|
-
F:
|
|
1348
|
+
F: __dxlog_file6,
|
|
1307
1349
|
L: 148,
|
|
1308
1350
|
S: this,
|
|
1309
1351
|
A: [
|
|
@@ -1312,7 +1354,7 @@ var IdentityManager = class {
|
|
|
1312
1354
|
]
|
|
1313
1355
|
});
|
|
1314
1356
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1315
|
-
F:
|
|
1357
|
+
F: __dxlog_file6,
|
|
1316
1358
|
L: 149,
|
|
1317
1359
|
S: this,
|
|
1318
1360
|
A: [
|
|
@@ -1351,7 +1393,7 @@ var IdentityManager = class {
|
|
|
1351
1393
|
identityKey: identityRecord.identityKey,
|
|
1352
1394
|
displayName: this._identity.profileDocument?.displayName
|
|
1353
1395
|
}, {
|
|
1354
|
-
F:
|
|
1396
|
+
F: __dxlog_file6,
|
|
1355
1397
|
L: 191,
|
|
1356
1398
|
S: this,
|
|
1357
1399
|
C: (f, a) => f(...a)
|
|
@@ -1362,7 +1404,7 @@ var IdentityManager = class {
|
|
|
1362
1404
|
deviceKey: identity.deviceKey,
|
|
1363
1405
|
profile: identity.profileDocument
|
|
1364
1406
|
}, {
|
|
1365
|
-
F:
|
|
1407
|
+
F: __dxlog_file6,
|
|
1366
1408
|
L: 197,
|
|
1367
1409
|
S: this,
|
|
1368
1410
|
C: (f, a) => f(...a)
|
|
@@ -1399,13 +1441,13 @@ var IdentityManager = class {
|
|
|
1399
1441
|
(0, import_log4.log)("accepting identity", {
|
|
1400
1442
|
params
|
|
1401
1443
|
}, {
|
|
1402
|
-
F:
|
|
1444
|
+
F: __dxlog_file6,
|
|
1403
1445
|
L: 235,
|
|
1404
1446
|
S: this,
|
|
1405
1447
|
C: (f, a) => f(...a)
|
|
1406
1448
|
});
|
|
1407
1449
|
(0, import_invariant3.invariant)(!this._identity, "Identity already exists.", {
|
|
1408
|
-
F:
|
|
1450
|
+
F: __dxlog_file6,
|
|
1409
1451
|
L: 236,
|
|
1410
1452
|
S: this,
|
|
1411
1453
|
A: [
|
|
@@ -1425,7 +1467,10 @@ var IdentityManager = class {
|
|
|
1425
1467
|
}
|
|
1426
1468
|
};
|
|
1427
1469
|
const identity = await this._constructIdentity(identityRecord);
|
|
1428
|
-
await identity.open(new import_context3.Context(
|
|
1470
|
+
await identity.open(new import_context3.Context(void 0, {
|
|
1471
|
+
F: __dxlog_file6,
|
|
1472
|
+
L: 251
|
|
1473
|
+
}));
|
|
1429
1474
|
this._identity = identity;
|
|
1430
1475
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1431
1476
|
await this._identity.ready();
|
|
@@ -1433,7 +1478,7 @@ var IdentityManager = class {
|
|
|
1433
1478
|
identityKey: identityRecord.identityKey,
|
|
1434
1479
|
displayName: this._identity.profileDocument?.displayName
|
|
1435
1480
|
}, {
|
|
1436
|
-
F:
|
|
1481
|
+
F: __dxlog_file6,
|
|
1437
1482
|
L: 255,
|
|
1438
1483
|
S: this,
|
|
1439
1484
|
C: (f, a) => f(...a)
|
|
@@ -1447,7 +1492,7 @@ var IdentityManager = class {
|
|
|
1447
1492
|
identityKey: identity.identityKey,
|
|
1448
1493
|
deviceKey: identity.deviceKey
|
|
1449
1494
|
}, {
|
|
1450
|
-
F:
|
|
1495
|
+
F: __dxlog_file6,
|
|
1451
1496
|
L: 265,
|
|
1452
1497
|
S: this,
|
|
1453
1498
|
C: (f, a) => f(...a)
|
|
@@ -1459,7 +1504,7 @@ var IdentityManager = class {
|
|
|
1459
1504
|
*/
|
|
1460
1505
|
async updateProfile(profile) {
|
|
1461
1506
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1462
|
-
F:
|
|
1507
|
+
F: __dxlog_file6,
|
|
1463
1508
|
L: 273,
|
|
1464
1509
|
S: this,
|
|
1465
1510
|
A: [
|
|
@@ -1490,7 +1535,7 @@ var IdentityManager = class {
|
|
|
1490
1535
|
}
|
|
1491
1536
|
async updateDeviceProfile(profile) {
|
|
1492
1537
|
(0, import_invariant3.invariant)(this._identity, "Identity not initialized.", {
|
|
1493
|
-
F:
|
|
1538
|
+
F: __dxlog_file6,
|
|
1494
1539
|
L: 290,
|
|
1495
1540
|
S: this,
|
|
1496
1541
|
A: [
|
|
@@ -1526,7 +1571,7 @@ var IdentityManager = class {
|
|
|
1526
1571
|
}
|
|
1527
1572
|
async _constructIdentity(identityRecord) {
|
|
1528
1573
|
(0, import_invariant3.invariant)(!this._identity, void 0, {
|
|
1529
|
-
F:
|
|
1574
|
+
F: __dxlog_file6,
|
|
1530
1575
|
L: 316,
|
|
1531
1576
|
S: this,
|
|
1532
1577
|
A: [
|
|
@@ -1537,7 +1582,7 @@ var IdentityManager = class {
|
|
|
1537
1582
|
(0, import_log4.log)("constructing identity", {
|
|
1538
1583
|
identityRecord
|
|
1539
1584
|
}, {
|
|
1540
|
-
F:
|
|
1585
|
+
F: __dxlog_file6,
|
|
1541
1586
|
L: 317,
|
|
1542
1587
|
S: this,
|
|
1543
1588
|
C: (f, a) => f(...a)
|
|
@@ -1552,7 +1597,7 @@ var IdentityManager = class {
|
|
|
1552
1597
|
gossip
|
|
1553
1598
|
});
|
|
1554
1599
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1555
|
-
F:
|
|
1600
|
+
F: __dxlog_file6,
|
|
1556
1601
|
L: 330,
|
|
1557
1602
|
S: this,
|
|
1558
1603
|
A: [
|
|
@@ -1564,7 +1609,7 @@ var IdentityManager = class {
|
|
|
1564
1609
|
writable: true
|
|
1565
1610
|
});
|
|
1566
1611
|
(0, import_invariant3.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1567
|
-
F:
|
|
1612
|
+
F: __dxlog_file6,
|
|
1568
1613
|
L: 334,
|
|
1569
1614
|
S: this,
|
|
1570
1615
|
A: [
|
|
@@ -1598,7 +1643,7 @@ var IdentityManager = class {
|
|
|
1598
1643
|
(0, import_log4.log)("done", {
|
|
1599
1644
|
identityKey: identityRecord.identityKey
|
|
1600
1645
|
}, {
|
|
1601
|
-
F:
|
|
1646
|
+
F: __dxlog_file6,
|
|
1602
1647
|
L: 360,
|
|
1603
1648
|
S: this,
|
|
1604
1649
|
C: (f, a) => f(...a)
|
|
@@ -1623,7 +1668,7 @@ var IdentityManager = class {
|
|
|
1623
1668
|
},
|
|
1624
1669
|
onAuthFailure: () => {
|
|
1625
1670
|
import_log4.log.warn("auth failure", void 0, {
|
|
1626
|
-
F:
|
|
1671
|
+
F: __dxlog_file6,
|
|
1627
1672
|
L: 385,
|
|
1628
1673
|
S: this,
|
|
1629
1674
|
C: (f, a) => f(...a)
|
|
@@ -1645,7 +1690,8 @@ _ts_decorate3([
|
|
|
1645
1690
|
IdentityManager = _ts_decorate3([
|
|
1646
1691
|
import_tracing4.trace.resource()
|
|
1647
1692
|
], IdentityManager);
|
|
1648
|
-
var
|
|
1693
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1694
|
+
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1649
1695
|
var IdentityServiceImpl = class extends import_context4.Resource {
|
|
1650
1696
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
1651
1697
|
super();
|
|
@@ -1674,8 +1720,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1674
1720
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1675
1721
|
const identity = this._identityManager.identity;
|
|
1676
1722
|
(0, import_invariant4.invariant)(identity, void 0, {
|
|
1677
|
-
F:
|
|
1678
|
-
L:
|
|
1723
|
+
F: __dxlog_file7,
|
|
1724
|
+
L: 59,
|
|
1679
1725
|
S: this,
|
|
1680
1726
|
A: [
|
|
1681
1727
|
"identity",
|
|
@@ -1708,8 +1754,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1708
1754
|
}
|
|
1709
1755
|
async updateProfile(profile) {
|
|
1710
1756
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1711
|
-
F:
|
|
1712
|
-
L:
|
|
1757
|
+
F: __dxlog_file7,
|
|
1758
|
+
L: 89,
|
|
1713
1759
|
S: this,
|
|
1714
1760
|
A: [
|
|
1715
1761
|
"this._identityManager.identity",
|
|
@@ -1722,8 +1768,8 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1722
1768
|
}
|
|
1723
1769
|
async signPresentation({ presentation, nonce }) {
|
|
1724
1770
|
(0, import_invariant4.invariant)(this._identityManager.identity, "Identity not initialized.", {
|
|
1725
|
-
F:
|
|
1726
|
-
L:
|
|
1771
|
+
F: __dxlog_file7,
|
|
1772
|
+
L: 96,
|
|
1727
1773
|
S: this,
|
|
1728
1774
|
A: [
|
|
1729
1775
|
"this._identityManager.identity",
|
|
@@ -1739,25 +1785,48 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1739
1785
|
});
|
|
1740
1786
|
}
|
|
1741
1787
|
async _fixIdentityWithoutDefaultSpace(identity) {
|
|
1742
|
-
let
|
|
1788
|
+
let recodedDefaultSpace = false;
|
|
1789
|
+
let foundDefaultSpace = false;
|
|
1743
1790
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1744
|
-
|
|
1791
|
+
const recordedDefaultSpaceTrigger = new import_async8.Trigger();
|
|
1792
|
+
const allProcessed = (0, import_util4.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
|
|
1745
1793
|
if (space.state === import_services4.SpaceState.CLOSED) {
|
|
1746
1794
|
await space.open();
|
|
1747
|
-
|
|
1795
|
+
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services4.SpaceState.REQUIRES_MIGRATION);
|
|
1796
|
+
await Promise.race([
|
|
1797
|
+
space.initializeDataPipeline(),
|
|
1798
|
+
requiresMigration
|
|
1799
|
+
]);
|
|
1748
1800
|
}
|
|
1749
1801
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
1802
|
+
if (foundDefaultSpace) {
|
|
1803
|
+
import_log5.log.warn("Multiple default spaces found. Using the first one.", {
|
|
1804
|
+
duplicate: space.id
|
|
1805
|
+
}, {
|
|
1806
|
+
F: __dxlog_file7,
|
|
1807
|
+
L: 127,
|
|
1808
|
+
S: this,
|
|
1809
|
+
C: (f, a) => f(...a)
|
|
1810
|
+
});
|
|
1811
|
+
return;
|
|
1812
|
+
}
|
|
1813
|
+
foundDefaultSpace = true;
|
|
1750
1814
|
await identity.updateDefaultSpace(space.id);
|
|
1751
|
-
|
|
1752
|
-
|
|
1815
|
+
recodedDefaultSpace = true;
|
|
1816
|
+
recordedDefaultSpaceTrigger.wake();
|
|
1753
1817
|
}
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1818
|
+
});
|
|
1819
|
+
await Promise.race([
|
|
1820
|
+
allProcessed,
|
|
1821
|
+
recordedDefaultSpaceTrigger.wait(),
|
|
1822
|
+
(0, import_async8.sleep)(DEFAULT_SPACE_SEARCH_TIMEOUT)
|
|
1823
|
+
]);
|
|
1824
|
+
if (!recodedDefaultSpace) {
|
|
1756
1825
|
await this._createDefaultSpace(dataSpaceManager);
|
|
1757
1826
|
}
|
|
1758
1827
|
}
|
|
1759
1828
|
};
|
|
1760
|
-
var
|
|
1829
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1761
1830
|
var DeviceInvitationProtocol = class {
|
|
1762
1831
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1763
1832
|
this._keyring = _keyring;
|
|
@@ -1783,7 +1852,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1783
1852
|
}
|
|
1784
1853
|
async admit(_, request) {
|
|
1785
1854
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1786
|
-
F:
|
|
1855
|
+
F: __dxlog_file8,
|
|
1787
1856
|
L: 50,
|
|
1788
1857
|
S: this,
|
|
1789
1858
|
A: [
|
|
@@ -1829,7 +1898,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1829
1898
|
}
|
|
1830
1899
|
async accept(response, request) {
|
|
1831
1900
|
(0, import_invariant5.invariant)(response.device, void 0, {
|
|
1832
|
-
F:
|
|
1901
|
+
F: __dxlog_file8,
|
|
1833
1902
|
L: 95,
|
|
1834
1903
|
S: this,
|
|
1835
1904
|
A: [
|
|
@@ -1839,7 +1908,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1839
1908
|
});
|
|
1840
1909
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1841
1910
|
(0, import_invariant5.invariant)(request.device, void 0, {
|
|
1842
|
-
F:
|
|
1911
|
+
F: __dxlog_file8,
|
|
1843
1912
|
L: 98,
|
|
1844
1913
|
S: this,
|
|
1845
1914
|
A: [
|
|
@@ -1878,7 +1947,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1878
1947
|
return guard;
|
|
1879
1948
|
})());
|
|
1880
1949
|
};
|
|
1881
|
-
var
|
|
1950
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1882
1951
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1883
1952
|
var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
1884
1953
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1892,8 +1961,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1892
1961
|
});
|
|
1893
1962
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1894
1963
|
this._callbacks = _callbacks;
|
|
1895
|
-
this._ctx = new import_context6.Context(
|
|
1896
|
-
|
|
1964
|
+
this._ctx = new import_context6.Context(void 0, {
|
|
1965
|
+
F: __dxlog_file9,
|
|
1966
|
+
L: 33
|
|
1967
|
+
});
|
|
1968
|
+
this._remoteOptionsTrigger = new import_async10.Trigger();
|
|
1897
1969
|
this._invitationFlowLock = null;
|
|
1898
1970
|
}
|
|
1899
1971
|
hasFlowLock() {
|
|
@@ -1904,7 +1976,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1904
1976
|
InvitationHostService: {
|
|
1905
1977
|
options: async (options) => {
|
|
1906
1978
|
(0, import_invariant7.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1907
|
-
F:
|
|
1979
|
+
F: __dxlog_file9,
|
|
1908
1980
|
L: 63,
|
|
1909
1981
|
S: this,
|
|
1910
1982
|
A: [
|
|
@@ -1930,15 +2002,15 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1930
2002
|
async onOpen(context) {
|
|
1931
2003
|
await super.onOpen(context);
|
|
1932
2004
|
try {
|
|
1933
|
-
(0,
|
|
1934
|
-
F:
|
|
2005
|
+
(0, import_log7.log)("guest acquire lock", void 0, {
|
|
2006
|
+
F: __dxlog_file9,
|
|
1935
2007
|
L: 84,
|
|
1936
2008
|
S: this,
|
|
1937
2009
|
C: (f, a) => f(...a)
|
|
1938
2010
|
});
|
|
1939
2011
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1940
|
-
(0,
|
|
1941
|
-
F:
|
|
2012
|
+
(0, import_log7.log)("guest lock acquired", void 0, {
|
|
2013
|
+
F: __dxlog_file9,
|
|
1942
2014
|
L: 86,
|
|
1943
2015
|
S: this,
|
|
1944
2016
|
C: (f, a) => f(...a)
|
|
@@ -1946,8 +2018,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1946
2018
|
await (0, import_context6.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
1947
2019
|
role: import_invitations3.Options.Role.GUEST
|
|
1948
2020
|
}));
|
|
1949
|
-
(0,
|
|
1950
|
-
F:
|
|
2021
|
+
(0, import_log7.log)("options sent", void 0, {
|
|
2022
|
+
F: __dxlog_file9,
|
|
1951
2023
|
L: 88,
|
|
1952
2024
|
S: this,
|
|
1953
2025
|
C: (f, a) => f(...a)
|
|
@@ -1955,8 +2027,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1955
2027
|
await (0, import_context6.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1956
2028
|
timeout: OPTIONS_TIMEOUT
|
|
1957
2029
|
}));
|
|
1958
|
-
(0,
|
|
1959
|
-
F:
|
|
2030
|
+
(0, import_log7.log)("options received", void 0, {
|
|
2031
|
+
F: __dxlog_file9,
|
|
1960
2032
|
L: 90,
|
|
1961
2033
|
S: this,
|
|
1962
2034
|
C: (f, a) => f(...a)
|
|
@@ -1989,8 +2061,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1989
2061
|
if (this._invitationFlowLock != null) {
|
|
1990
2062
|
this._invitationFlowLock.release();
|
|
1991
2063
|
this._invitationFlowLock = null;
|
|
1992
|
-
(0,
|
|
1993
|
-
F:
|
|
2064
|
+
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2065
|
+
F: __dxlog_file9,
|
|
1994
2066
|
L: 123,
|
|
1995
2067
|
S: this,
|
|
1996
2068
|
C: (f, a) => f(...a)
|
|
@@ -1998,7 +2070,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1998
2070
|
}
|
|
1999
2071
|
}
|
|
2000
2072
|
};
|
|
2001
|
-
var
|
|
2073
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
2002
2074
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
2003
2075
|
var MAX_OTP_ATTEMPTS = 3;
|
|
2004
2076
|
var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
@@ -2013,13 +2085,16 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2013
2085
|
});
|
|
2014
2086
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
2015
2087
|
this._callbacks = _callbacks;
|
|
2016
|
-
this._ctx = new import_context8.Context(
|
|
2017
|
-
|
|
2088
|
+
this._ctx = new import_context8.Context(void 0, {
|
|
2089
|
+
F: __dxlog_file10,
|
|
2090
|
+
L: 52
|
|
2091
|
+
});
|
|
2092
|
+
this._remoteOptionsTrigger = new import_async11.Trigger();
|
|
2018
2093
|
this._challenge = void 0;
|
|
2019
2094
|
this.guestProfile = void 0;
|
|
2020
2095
|
this.authenticationPassed = false;
|
|
2021
2096
|
this.authenticationRetry = 0;
|
|
2022
|
-
this.completedTrigger = new
|
|
2097
|
+
this.completedTrigger = new import_async11.Trigger();
|
|
2023
2098
|
this._invitationFlowLock = null;
|
|
2024
2099
|
}
|
|
2025
2100
|
hasFlowLock() {
|
|
@@ -2032,7 +2107,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2032
2107
|
InvitationHostService: {
|
|
2033
2108
|
options: async (options) => {
|
|
2034
2109
|
(0, import_invariant8.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
2035
|
-
F:
|
|
2110
|
+
F: __dxlog_file10,
|
|
2036
2111
|
L: 101,
|
|
2037
2112
|
S: this,
|
|
2038
2113
|
A: [
|
|
@@ -2046,10 +2121,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2046
2121
|
introduce: async (request) => {
|
|
2047
2122
|
const { profile, invitationId } = request;
|
|
2048
2123
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2049
|
-
|
|
2124
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.begin({
|
|
2050
2125
|
id: traceId
|
|
2051
2126
|
}), {
|
|
2052
|
-
F:
|
|
2127
|
+
F: __dxlog_file10,
|
|
2053
2128
|
L: 110,
|
|
2054
2129
|
S: this,
|
|
2055
2130
|
C: (f, a) => f(...a)
|
|
@@ -2057,25 +2132,25 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2057
2132
|
const invitation = this._requireActiveInvitation();
|
|
2058
2133
|
this._assertInvitationState(import_services8.Invitation.State.CONNECTED);
|
|
2059
2134
|
if (invitationId !== invitation?.invitationId) {
|
|
2060
|
-
|
|
2135
|
+
import_log8.log.warn("incorrect invitationId", {
|
|
2061
2136
|
expected: invitation.invitationId,
|
|
2062
2137
|
actual: invitationId
|
|
2063
2138
|
}, {
|
|
2064
|
-
F:
|
|
2139
|
+
F: __dxlog_file10,
|
|
2065
2140
|
L: 116,
|
|
2066
2141
|
S: this,
|
|
2067
2142
|
C: (f, a) => f(...a)
|
|
2068
2143
|
});
|
|
2069
2144
|
this._callbacks.onError(new Error("Incorrect invitationId."));
|
|
2070
|
-
(0,
|
|
2145
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2071
2146
|
return {
|
|
2072
2147
|
authMethod: import_services8.Invitation.AuthMethod.NONE
|
|
2073
2148
|
};
|
|
2074
2149
|
}
|
|
2075
|
-
(0,
|
|
2150
|
+
(0, import_log8.log)("guest introduced themselves", {
|
|
2076
2151
|
guestProfile: profile
|
|
2077
2152
|
}, {
|
|
2078
|
-
F:
|
|
2153
|
+
F: __dxlog_file10,
|
|
2079
2154
|
L: 125,
|
|
2080
2155
|
S: this,
|
|
2081
2156
|
C: (f, a) => f(...a)
|
|
@@ -2083,10 +2158,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2083
2158
|
this.guestProfile = profile;
|
|
2084
2159
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2085
2160
|
this._challenge = invitation.authMethod === import_services8.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
2086
|
-
|
|
2161
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols7.trace.end({
|
|
2087
2162
|
id: traceId
|
|
2088
2163
|
}), {
|
|
2089
|
-
F:
|
|
2164
|
+
F: __dxlog_file10,
|
|
2090
2165
|
L: 132,
|
|
2091
2166
|
S: this,
|
|
2092
2167
|
C: (f, a) => f(...a)
|
|
@@ -2098,19 +2173,19 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2098
2173
|
},
|
|
2099
2174
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2100
2175
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2101
|
-
|
|
2176
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.begin({
|
|
2102
2177
|
id: traceId
|
|
2103
2178
|
}), {
|
|
2104
|
-
F:
|
|
2179
|
+
F: __dxlog_file10,
|
|
2105
2180
|
L: 141,
|
|
2106
2181
|
S: this,
|
|
2107
2182
|
C: (f, a) => f(...a)
|
|
2108
2183
|
});
|
|
2109
2184
|
const invitation = this._requireActiveInvitation();
|
|
2110
|
-
(0,
|
|
2185
|
+
(0, import_log8.log)("received authentication request", {
|
|
2111
2186
|
authCode: code
|
|
2112
2187
|
}, {
|
|
2113
|
-
F:
|
|
2188
|
+
F: __dxlog_file10,
|
|
2114
2189
|
L: 144,
|
|
2115
2190
|
S: this,
|
|
2116
2191
|
C: (f, a) => f(...a)
|
|
@@ -2123,8 +2198,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2123
2198
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.AUTHENTICATING);
|
|
2124
2199
|
switch (invitation.authMethod) {
|
|
2125
2200
|
case import_services8.Invitation.AuthMethod.NONE: {
|
|
2126
|
-
(0,
|
|
2127
|
-
F:
|
|
2201
|
+
(0, import_log8.log)("authentication not required", void 0, {
|
|
2202
|
+
F: __dxlog_file10,
|
|
2128
2203
|
L: 152,
|
|
2129
2204
|
S: this,
|
|
2130
2205
|
C: (f, a) => f(...a)
|
|
@@ -2159,10 +2234,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2159
2234
|
break;
|
|
2160
2235
|
}
|
|
2161
2236
|
default: {
|
|
2162
|
-
|
|
2237
|
+
import_log8.log.error("invalid authentication method", {
|
|
2163
2238
|
authMethod: invitation.authMethod
|
|
2164
2239
|
}, {
|
|
2165
|
-
F:
|
|
2240
|
+
F: __dxlog_file10,
|
|
2166
2241
|
L: 190,
|
|
2167
2242
|
S: this,
|
|
2168
2243
|
C: (f, a) => f(...a)
|
|
@@ -2176,18 +2251,18 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2176
2251
|
import_invitations4.AuthenticationResponse.Status.INVALID_OTP
|
|
2177
2252
|
].includes(status)) {
|
|
2178
2253
|
this._callbacks.onError(new Error(`Authentication failed, with status=${status}`));
|
|
2179
|
-
(0,
|
|
2254
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2180
2255
|
return {
|
|
2181
2256
|
status
|
|
2182
2257
|
};
|
|
2183
2258
|
}
|
|
2184
|
-
|
|
2259
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols7.trace.end({
|
|
2185
2260
|
id: traceId,
|
|
2186
2261
|
data: {
|
|
2187
2262
|
status
|
|
2188
2263
|
}
|
|
2189
2264
|
}), {
|
|
2190
|
-
F:
|
|
2265
|
+
F: __dxlog_file10,
|
|
2191
2266
|
L: 202,
|
|
2192
2267
|
S: this,
|
|
2193
2268
|
C: (f, a) => f(...a)
|
|
@@ -2198,10 +2273,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2198
2273
|
},
|
|
2199
2274
|
admit: async (request) => {
|
|
2200
2275
|
const traceId = import_keys7.PublicKey.random().toHex();
|
|
2201
|
-
|
|
2276
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.begin({
|
|
2202
2277
|
id: traceId
|
|
2203
2278
|
}), {
|
|
2204
|
-
F:
|
|
2279
|
+
F: __dxlog_file10,
|
|
2205
2280
|
L: 208,
|
|
2206
2281
|
S: this,
|
|
2207
2282
|
C: (f, a) => f(...a)
|
|
@@ -2215,10 +2290,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2215
2290
|
}
|
|
2216
2291
|
}
|
|
2217
2292
|
const response = await this._callbacks.admit(request);
|
|
2218
|
-
|
|
2293
|
+
import_log8.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols7.trace.end({
|
|
2219
2294
|
id: traceId
|
|
2220
2295
|
}), {
|
|
2221
|
-
F:
|
|
2296
|
+
F: __dxlog_file10,
|
|
2222
2297
|
L: 222,
|
|
2223
2298
|
S: this,
|
|
2224
2299
|
C: (f, a) => f(...a)
|
|
@@ -2235,15 +2310,15 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2235
2310
|
async onOpen(context) {
|
|
2236
2311
|
await super.onOpen(context);
|
|
2237
2312
|
try {
|
|
2238
|
-
(0,
|
|
2239
|
-
F:
|
|
2313
|
+
(0, import_log8.log)("host acquire lock", void 0, {
|
|
2314
|
+
F: __dxlog_file10,
|
|
2240
2315
|
L: 237,
|
|
2241
2316
|
S: this,
|
|
2242
2317
|
C: (f, a) => f(...a)
|
|
2243
2318
|
});
|
|
2244
2319
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2245
|
-
(0,
|
|
2246
|
-
F:
|
|
2320
|
+
(0, import_log8.log)("host lock acquired", void 0, {
|
|
2321
|
+
F: __dxlog_file10,
|
|
2247
2322
|
L: 239,
|
|
2248
2323
|
S: this,
|
|
2249
2324
|
C: (f, a) => f(...a)
|
|
@@ -2253,8 +2328,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2253
2328
|
await this.rpc.InvitationHostService.options({
|
|
2254
2329
|
role: import_invitations4.Options.Role.HOST
|
|
2255
2330
|
});
|
|
2256
|
-
(0,
|
|
2257
|
-
F:
|
|
2331
|
+
(0, import_log8.log)("options sent", void 0, {
|
|
2332
|
+
F: __dxlog_file10,
|
|
2258
2333
|
L: 243,
|
|
2259
2334
|
S: this,
|
|
2260
2335
|
C: (f, a) => f(...a)
|
|
@@ -2262,8 +2337,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2262
2337
|
await (0, import_context8.cancelWithContext)(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2263
2338
|
timeout: OPTIONS_TIMEOUT2
|
|
2264
2339
|
}));
|
|
2265
|
-
(0,
|
|
2266
|
-
F:
|
|
2340
|
+
(0, import_log8.log)("options received", void 0, {
|
|
2341
|
+
F: __dxlog_file10,
|
|
2267
2342
|
L: 245,
|
|
2268
2343
|
S: this,
|
|
2269
2344
|
C: (f, a) => f(...a)
|
|
@@ -2290,7 +2365,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2290
2365
|
_requireActiveInvitation() {
|
|
2291
2366
|
const invitation = this._callbacks.activeInvitation;
|
|
2292
2367
|
if (invitation == null) {
|
|
2293
|
-
(0,
|
|
2368
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2294
2369
|
throw new Error("Active invitation not found");
|
|
2295
2370
|
}
|
|
2296
2371
|
return invitation;
|
|
@@ -2301,7 +2376,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2301
2376
|
stateOrMany
|
|
2302
2377
|
];
|
|
2303
2378
|
if (!validStates.includes(invitation.state)) {
|
|
2304
|
-
(0,
|
|
2379
|
+
(0, import_async11.scheduleTask)(this._ctx, () => this.close());
|
|
2305
2380
|
throw new import_invariant8.InvariantViolation(`Expected ${stateToString(invitation.state)} to be one of [${validStates.map(stateToString).join(", ")}]`);
|
|
2306
2381
|
}
|
|
2307
2382
|
}
|
|
@@ -2316,8 +2391,8 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2316
2391
|
if (this._invitationFlowLock != null) {
|
|
2317
2392
|
this._invitationFlowLock?.release();
|
|
2318
2393
|
this._invitationFlowLock = null;
|
|
2319
|
-
(0,
|
|
2320
|
-
F:
|
|
2394
|
+
(0, import_log8.log)("invitation flow lock released", void 0, {
|
|
2395
|
+
F: __dxlog_file10,
|
|
2321
2396
|
L: 300,
|
|
2322
2397
|
S: this,
|
|
2323
2398
|
C: (f, a) => f(...a)
|
|
@@ -2326,15 +2401,15 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2326
2401
|
}
|
|
2327
2402
|
};
|
|
2328
2403
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services8.Invitation.AuthMethod.NONE;
|
|
2329
|
-
var
|
|
2404
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2330
2405
|
var InvitationTopology = class {
|
|
2331
2406
|
constructor(_role) {
|
|
2332
2407
|
this._role = _role;
|
|
2333
|
-
this._seenPeers = new
|
|
2408
|
+
this._seenPeers = new import_util6.ComplexSet(import_keys8.PublicKey.hash);
|
|
2334
2409
|
}
|
|
2335
2410
|
init(controller) {
|
|
2336
2411
|
(0, import_invariant9.invariant)(!this._controller, "Already initialized.", {
|
|
2337
|
-
F:
|
|
2412
|
+
F: __dxlog_file11,
|
|
2338
2413
|
L: 42,
|
|
2339
2414
|
S: this,
|
|
2340
2415
|
A: [
|
|
@@ -2346,7 +2421,7 @@ var InvitationTopology = class {
|
|
|
2346
2421
|
}
|
|
2347
2422
|
update() {
|
|
2348
2423
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2349
|
-
F:
|
|
2424
|
+
F: __dxlog_file11,
|
|
2350
2425
|
L: 47,
|
|
2351
2426
|
S: this,
|
|
2352
2427
|
A: [
|
|
@@ -2363,13 +2438,13 @@ var InvitationTopology = class {
|
|
|
2363
2438
|
return;
|
|
2364
2439
|
}
|
|
2365
2440
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2366
|
-
this._seenPeers = new
|
|
2441
|
+
this._seenPeers = new import_util6.ComplexSet(import_keys8.PublicKey.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2367
2442
|
if (firstUnknownPeer != null) {
|
|
2368
|
-
(0,
|
|
2443
|
+
(0, import_log9.log)("invitation connect", {
|
|
2369
2444
|
ownPeerId,
|
|
2370
2445
|
remotePeerId: firstUnknownPeer
|
|
2371
2446
|
}, {
|
|
2372
|
-
F:
|
|
2447
|
+
F: __dxlog_file11,
|
|
2373
2448
|
L: 69,
|
|
2374
2449
|
S: this,
|
|
2375
2450
|
C: (f, a) => f(...a)
|
|
@@ -2380,7 +2455,7 @@ var InvitationTopology = class {
|
|
|
2380
2455
|
}
|
|
2381
2456
|
async onOffer(peer) {
|
|
2382
2457
|
(0, import_invariant9.invariant)(this._controller, "Not initialized.", {
|
|
2383
|
-
F:
|
|
2458
|
+
F: __dxlog_file11,
|
|
2384
2459
|
L: 76,
|
|
2385
2460
|
S: this,
|
|
2386
2461
|
A: [
|
|
@@ -2397,7 +2472,7 @@ var InvitationTopology = class {
|
|
|
2397
2472
|
return `InvitationTopology(${this._role === import_invitations5.Options.Role.GUEST ? "guest" : "host"})`;
|
|
2398
2473
|
}
|
|
2399
2474
|
};
|
|
2400
|
-
var
|
|
2475
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2401
2476
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2402
2477
|
var InvitationsHandler = class {
|
|
2403
2478
|
/**
|
|
@@ -2422,7 +2497,7 @@ var InvitationsHandler = class {
|
|
|
2422
2497
|
try {
|
|
2423
2498
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2424
2499
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2425
|
-
F:
|
|
2500
|
+
F: __dxlog_file12,
|
|
2426
2501
|
L: 90,
|
|
2427
2502
|
S: this,
|
|
2428
2503
|
A: [
|
|
@@ -2445,21 +2520,21 @@ var InvitationsHandler = class {
|
|
|
2445
2520
|
guardedState.error(extension, new import_context5.ContextDisposedError());
|
|
2446
2521
|
}
|
|
2447
2522
|
});
|
|
2448
|
-
(0,
|
|
2523
|
+
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2449
2524
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2450
2525
|
try {
|
|
2451
|
-
|
|
2526
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.begin({
|
|
2452
2527
|
id: traceId
|
|
2453
2528
|
}), {
|
|
2454
|
-
F:
|
|
2529
|
+
F: __dxlog_file12,
|
|
2455
2530
|
L: 115,
|
|
2456
2531
|
S: this,
|
|
2457
2532
|
C: (f, a) => f(...a)
|
|
2458
2533
|
});
|
|
2459
|
-
(0,
|
|
2534
|
+
(0, import_log6.log)("connected", {
|
|
2460
2535
|
...protocol.toJSON()
|
|
2461
2536
|
}, {
|
|
2462
|
-
F:
|
|
2537
|
+
F: __dxlog_file12,
|
|
2463
2538
|
L: 116,
|
|
2464
2539
|
S: this,
|
|
2465
2540
|
C: (f, a) => f(...a)
|
|
@@ -2467,20 +2542,20 @@ var InvitationsHandler = class {
|
|
|
2467
2542
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2468
2543
|
timeout: invitation.timeout
|
|
2469
2544
|
});
|
|
2470
|
-
(0,
|
|
2545
|
+
(0, import_log6.log)("admitted guest", {
|
|
2471
2546
|
guest: deviceKey,
|
|
2472
2547
|
...protocol.toJSON()
|
|
2473
2548
|
}, {
|
|
2474
|
-
F:
|
|
2549
|
+
F: __dxlog_file12,
|
|
2475
2550
|
L: 118,
|
|
2476
2551
|
S: this,
|
|
2477
2552
|
C: (f, a) => f(...a)
|
|
2478
2553
|
});
|
|
2479
2554
|
guardedState.set(extension, import_services6.Invitation.State.SUCCESS);
|
|
2480
|
-
|
|
2555
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2481
2556
|
id: traceId
|
|
2482
2557
|
}), {
|
|
2483
|
-
F:
|
|
2558
|
+
F: __dxlog_file12,
|
|
2484
2559
|
L: 120,
|
|
2485
2560
|
S: this,
|
|
2486
2561
|
C: (f, a) => f(...a)
|
|
@@ -2490,12 +2565,12 @@ var InvitationsHandler = class {
|
|
|
2490
2565
|
await ctx.dispose();
|
|
2491
2566
|
}
|
|
2492
2567
|
} catch (err) {
|
|
2493
|
-
if (err instanceof
|
|
2568
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2494
2569
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2495
|
-
(0,
|
|
2570
|
+
(0, import_log6.log)("timeout", {
|
|
2496
2571
|
...protocol.toJSON()
|
|
2497
2572
|
}, {
|
|
2498
|
-
F:
|
|
2573
|
+
F: __dxlog_file12,
|
|
2499
2574
|
L: 129,
|
|
2500
2575
|
S: this,
|
|
2501
2576
|
C: (f, a) => f(...a)
|
|
@@ -2503,19 +2578,19 @@ var InvitationsHandler = class {
|
|
|
2503
2578
|
}
|
|
2504
2579
|
} else {
|
|
2505
2580
|
if (guardedState.error(extension, err)) {
|
|
2506
|
-
|
|
2507
|
-
F:
|
|
2581
|
+
import_log6.log.error("failed", err, {
|
|
2582
|
+
F: __dxlog_file12,
|
|
2508
2583
|
L: 133,
|
|
2509
2584
|
S: this,
|
|
2510
2585
|
C: (f, a) => f(...a)
|
|
2511
2586
|
});
|
|
2512
2587
|
}
|
|
2513
2588
|
}
|
|
2514
|
-
|
|
2589
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.error({
|
|
2515
2590
|
id: traceId,
|
|
2516
2591
|
error: err
|
|
2517
2592
|
}), {
|
|
2518
|
-
F:
|
|
2593
|
+
F: __dxlog_file12,
|
|
2519
2594
|
L: 136,
|
|
2520
2595
|
S: this,
|
|
2521
2596
|
C: (f, a) => f(...a)
|
|
@@ -2526,22 +2601,22 @@ var InvitationsHandler = class {
|
|
|
2526
2601
|
},
|
|
2527
2602
|
onError: (err) => {
|
|
2528
2603
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2529
|
-
(0,
|
|
2604
|
+
(0, import_log6.log)("invalid role", {
|
|
2530
2605
|
...err.context
|
|
2531
2606
|
}, {
|
|
2532
|
-
F:
|
|
2607
|
+
F: __dxlog_file12,
|
|
2533
2608
|
L: 144,
|
|
2534
2609
|
S: this,
|
|
2535
2610
|
C: (f, a) => f(...a)
|
|
2536
2611
|
});
|
|
2537
2612
|
return;
|
|
2538
2613
|
}
|
|
2539
|
-
if (err instanceof
|
|
2614
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2540
2615
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2541
|
-
(0,
|
|
2616
|
+
(0, import_log6.log)("timeout", {
|
|
2542
2617
|
err
|
|
2543
2618
|
}, {
|
|
2544
|
-
F:
|
|
2619
|
+
F: __dxlog_file12,
|
|
2545
2620
|
L: 149,
|
|
2546
2621
|
S: this,
|
|
2547
2622
|
C: (f, a) => f(...a)
|
|
@@ -2549,8 +2624,8 @@ var InvitationsHandler = class {
|
|
|
2549
2624
|
}
|
|
2550
2625
|
} else {
|
|
2551
2626
|
if (guardedState.error(extension, err)) {
|
|
2552
|
-
|
|
2553
|
-
F:
|
|
2627
|
+
import_log6.log.error("failed", err, {
|
|
2628
|
+
F: __dxlog_file12,
|
|
2554
2629
|
L: 153,
|
|
2555
2630
|
S: this,
|
|
2556
2631
|
C: (f, a) => f(...a)
|
|
@@ -2563,14 +2638,14 @@ var InvitationsHandler = class {
|
|
|
2563
2638
|
};
|
|
2564
2639
|
if (invitation.lifetime && invitation.created) {
|
|
2565
2640
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2566
|
-
|
|
2567
|
-
F:
|
|
2641
|
+
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2642
|
+
F: __dxlog_file12,
|
|
2568
2643
|
L: 164,
|
|
2569
2644
|
S: this,
|
|
2570
2645
|
C: (f, a) => f(...a)
|
|
2571
2646
|
});
|
|
2572
2647
|
} else {
|
|
2573
|
-
(0,
|
|
2648
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2574
2649
|
await swarmConnection.close();
|
|
2575
2650
|
guardedState.set(null, import_services6.Invitation.State.EXPIRED);
|
|
2576
2651
|
await ctx.dispose();
|
|
@@ -2578,7 +2653,7 @@ var InvitationsHandler = class {
|
|
|
2578
2653
|
}
|
|
2579
2654
|
}
|
|
2580
2655
|
let swarmConnection;
|
|
2581
|
-
(0,
|
|
2656
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2582
2657
|
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.Options.Role.HOST, createExtension);
|
|
2583
2658
|
guardedState.set(null, import_services6.Invitation.State.CONNECTING);
|
|
2584
2659
|
});
|
|
@@ -2587,7 +2662,7 @@ var InvitationsHandler = class {
|
|
|
2587
2662
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2588
2663
|
if (deviceProfile) {
|
|
2589
2664
|
(0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2590
|
-
F:
|
|
2665
|
+
F: __dxlog_file12,
|
|
2591
2666
|
L: 197,
|
|
2592
2667
|
S: this,
|
|
2593
2668
|
A: [
|
|
@@ -2596,16 +2671,16 @@ var InvitationsHandler = class {
|
|
|
2596
2671
|
]
|
|
2597
2672
|
});
|
|
2598
2673
|
}
|
|
2599
|
-
const triedPeersIds = new
|
|
2674
|
+
const triedPeersIds = new import_util5.ComplexSet(import_keys6.PublicKey.hash);
|
|
2600
2675
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2601
2676
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2602
2677
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2603
|
-
(0,
|
|
2678
|
+
(0, import_log6.log)("should cancel invitation flow", {
|
|
2604
2679
|
isLockedByAnotherConnection,
|
|
2605
2680
|
invitationType: import_services6.Invitation.Type.DELEGATED,
|
|
2606
2681
|
triedPeers: triedPeersIds.size
|
|
2607
2682
|
}, {
|
|
2608
|
-
F:
|
|
2683
|
+
F: __dxlog_file12,
|
|
2609
2684
|
L: 205,
|
|
2610
2685
|
S: this,
|
|
2611
2686
|
C: (f, a) => f(...a)
|
|
@@ -2628,11 +2703,11 @@ var InvitationsHandler = class {
|
|
|
2628
2703
|
return;
|
|
2629
2704
|
}
|
|
2630
2705
|
connectionCtx.onDispose(async () => {
|
|
2631
|
-
(0,
|
|
2706
|
+
(0, import_log6.log)("extension disposed", {
|
|
2632
2707
|
admitted,
|
|
2633
2708
|
currentState: guardedState.current.state
|
|
2634
2709
|
}, {
|
|
2635
|
-
F:
|
|
2710
|
+
F: __dxlog_file12,
|
|
2636
2711
|
L: 233,
|
|
2637
2712
|
S: this,
|
|
2638
2713
|
C: (f, a) => f(...a)
|
|
@@ -2644,34 +2719,34 @@ var InvitationsHandler = class {
|
|
|
2644
2719
|
}
|
|
2645
2720
|
}
|
|
2646
2721
|
});
|
|
2647
|
-
(0,
|
|
2722
|
+
(0, import_async9.scheduleTask)(connectionCtx, async () => {
|
|
2648
2723
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
2649
2724
|
try {
|
|
2650
|
-
|
|
2725
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.begin({
|
|
2651
2726
|
id: traceId
|
|
2652
2727
|
}), {
|
|
2653
|
-
F:
|
|
2728
|
+
F: __dxlog_file12,
|
|
2654
2729
|
L: 245,
|
|
2655
2730
|
S: this,
|
|
2656
2731
|
C: (f, a) => f(...a)
|
|
2657
2732
|
});
|
|
2658
|
-
(0,
|
|
2733
|
+
(0, import_async9.scheduleTask)(connectionCtx, () => {
|
|
2659
2734
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2660
2735
|
extensionCtx.close();
|
|
2661
2736
|
}, timeout);
|
|
2662
|
-
(0,
|
|
2737
|
+
(0, import_log6.log)("connected", {
|
|
2663
2738
|
...protocol.toJSON()
|
|
2664
2739
|
}, {
|
|
2665
|
-
F:
|
|
2740
|
+
F: __dxlog_file12,
|
|
2666
2741
|
L: 256,
|
|
2667
2742
|
S: this,
|
|
2668
2743
|
C: (f, a) => f(...a)
|
|
2669
2744
|
});
|
|
2670
2745
|
guardedState.set(extension, import_services6.Invitation.State.CONNECTED);
|
|
2671
|
-
(0,
|
|
2746
|
+
(0, import_log6.log)("introduce", {
|
|
2672
2747
|
...protocol.toJSON()
|
|
2673
2748
|
}, {
|
|
2674
|
-
F:
|
|
2749
|
+
F: __dxlog_file12,
|
|
2675
2750
|
L: 260,
|
|
2676
2751
|
S: this,
|
|
2677
2752
|
C: (f, a) => f(...a)
|
|
@@ -2680,11 +2755,11 @@ var InvitationsHandler = class {
|
|
|
2680
2755
|
invitationId: invitation.invitationId,
|
|
2681
2756
|
...protocol.createIntroduction()
|
|
2682
2757
|
});
|
|
2683
|
-
(0,
|
|
2758
|
+
(0, import_log6.log)("introduce response", {
|
|
2684
2759
|
...protocol.toJSON(),
|
|
2685
2760
|
response: introductionResponse
|
|
2686
2761
|
}, {
|
|
2687
|
-
F:
|
|
2762
|
+
F: __dxlog_file12,
|
|
2688
2763
|
L: 265,
|
|
2689
2764
|
S: this,
|
|
2690
2765
|
C: (f, a) => f(...a)
|
|
@@ -2702,10 +2777,10 @@ var InvitationsHandler = class {
|
|
|
2702
2777
|
break;
|
|
2703
2778
|
}
|
|
2704
2779
|
}
|
|
2705
|
-
(0,
|
|
2780
|
+
(0, import_log6.log)("request admission", {
|
|
2706
2781
|
...protocol.toJSON()
|
|
2707
2782
|
}, {
|
|
2708
|
-
F:
|
|
2783
|
+
F: __dxlog_file12,
|
|
2709
2784
|
L: 291,
|
|
2710
2785
|
S: this,
|
|
2711
2786
|
C: (f, a) => f(...a)
|
|
@@ -2714,10 +2789,10 @@ var InvitationsHandler = class {
|
|
|
2714
2789
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2715
2790
|
admitted = true;
|
|
2716
2791
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2717
|
-
(0,
|
|
2792
|
+
(0, import_log6.log)("admitted by host", {
|
|
2718
2793
|
...protocol.toJSON()
|
|
2719
2794
|
}, {
|
|
2720
|
-
F:
|
|
2795
|
+
F: __dxlog_file12,
|
|
2721
2796
|
L: 302,
|
|
2722
2797
|
S: this,
|
|
2723
2798
|
C: (f, a) => f(...a)
|
|
@@ -2727,28 +2802,28 @@ var InvitationsHandler = class {
|
|
|
2727
2802
|
...result,
|
|
2728
2803
|
state: import_services6.Invitation.State.SUCCESS
|
|
2729
2804
|
});
|
|
2730
|
-
|
|
2805
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.end({
|
|
2731
2806
|
id: traceId
|
|
2732
2807
|
}), {
|
|
2733
|
-
F:
|
|
2808
|
+
F: __dxlog_file12,
|
|
2734
2809
|
L: 308,
|
|
2735
2810
|
S: this,
|
|
2736
2811
|
C: (f, a) => f(...a)
|
|
2737
2812
|
});
|
|
2738
2813
|
} catch (err) {
|
|
2739
|
-
if (err instanceof
|
|
2740
|
-
(0,
|
|
2814
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2815
|
+
(0, import_log6.log)("timeout", {
|
|
2741
2816
|
...protocol.toJSON()
|
|
2742
2817
|
}, {
|
|
2743
|
-
F:
|
|
2818
|
+
F: __dxlog_file12,
|
|
2744
2819
|
L: 311,
|
|
2745
2820
|
S: this,
|
|
2746
2821
|
C: (f, a) => f(...a)
|
|
2747
2822
|
});
|
|
2748
2823
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2749
2824
|
} else {
|
|
2750
|
-
(0,
|
|
2751
|
-
F:
|
|
2825
|
+
(0, import_log6.log)("auth failed", err, {
|
|
2826
|
+
F: __dxlog_file12,
|
|
2752
2827
|
L: 314,
|
|
2753
2828
|
S: this,
|
|
2754
2829
|
C: (f, a) => f(...a)
|
|
@@ -2756,11 +2831,11 @@ var InvitationsHandler = class {
|
|
|
2756
2831
|
guardedState.error(extension, err);
|
|
2757
2832
|
}
|
|
2758
2833
|
extensionCtx.close(err);
|
|
2759
|
-
|
|
2834
|
+
import_log6.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols5.trace.error({
|
|
2760
2835
|
id: traceId,
|
|
2761
2836
|
error: err
|
|
2762
2837
|
}), {
|
|
2763
|
-
F:
|
|
2838
|
+
F: __dxlog_file12,
|
|
2764
2839
|
L: 318,
|
|
2765
2840
|
S: this,
|
|
2766
2841
|
C: (f, a) => f(...a)
|
|
@@ -2772,19 +2847,19 @@ var InvitationsHandler = class {
|
|
|
2772
2847
|
if (err instanceof import_protocols5.InvalidInvitationExtensionRoleError) {
|
|
2773
2848
|
return;
|
|
2774
2849
|
}
|
|
2775
|
-
if (err instanceof
|
|
2776
|
-
(0,
|
|
2850
|
+
if (err instanceof import_async9.TimeoutError) {
|
|
2851
|
+
(0, import_log6.log)("timeout", {
|
|
2777
2852
|
...protocol.toJSON()
|
|
2778
2853
|
}, {
|
|
2779
|
-
F:
|
|
2854
|
+
F: __dxlog_file12,
|
|
2780
2855
|
L: 327,
|
|
2781
2856
|
S: this,
|
|
2782
2857
|
C: (f, a) => f(...a)
|
|
2783
2858
|
});
|
|
2784
2859
|
guardedState.set(extension, import_services6.Invitation.State.TIMEOUT);
|
|
2785
2860
|
} else {
|
|
2786
|
-
(0,
|
|
2787
|
-
F:
|
|
2861
|
+
(0, import_log6.log)("auth failed", err, {
|
|
2862
|
+
F: __dxlog_file12,
|
|
2788
2863
|
L: 330,
|
|
2789
2864
|
S: this,
|
|
2790
2865
|
C: (f, a) => f(...a)
|
|
@@ -2795,14 +2870,14 @@ var InvitationsHandler = class {
|
|
|
2795
2870
|
});
|
|
2796
2871
|
return extension;
|
|
2797
2872
|
};
|
|
2798
|
-
(0,
|
|
2873
|
+
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2799
2874
|
const error = protocol.checkInvitation(invitation);
|
|
2800
2875
|
if (error) {
|
|
2801
2876
|
stream.error(error);
|
|
2802
2877
|
await ctx.dispose();
|
|
2803
2878
|
} else {
|
|
2804
2879
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2805
|
-
F:
|
|
2880
|
+
F: __dxlog_file12,
|
|
2806
2881
|
L: 345,
|
|
2807
2882
|
S: this,
|
|
2808
2883
|
A: [
|
|
@@ -2841,7 +2916,7 @@ var InvitationsHandler = class {
|
|
|
2841
2916
|
* invitation flow connections.
|
|
2842
2917
|
*/
|
|
2843
2918
|
_createGuardedState(ctx, invitation, stream) {
|
|
2844
|
-
const mutex = new
|
|
2919
|
+
const mutex = new import_async9.Mutex();
|
|
2845
2920
|
let lastActiveExtension = null;
|
|
2846
2921
|
let currentInvitation = {
|
|
2847
2922
|
...invitation
|
|
@@ -2896,21 +2971,34 @@ var InvitationsHandler = class {
|
|
|
2896
2971
|
};
|
|
2897
2972
|
}
|
|
2898
2973
|
_logStateUpdate(invitation, actor, newState) {
|
|
2899
|
-
(
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2974
|
+
if (this._isNotTerminal(newState)) {
|
|
2975
|
+
(0, import_log6.log)("invitation state update", {
|
|
2976
|
+
actor: actor?.constructor.name,
|
|
2977
|
+
newState: stateToString(newState),
|
|
2978
|
+
oldState: stateToString(invitation.state)
|
|
2979
|
+
}, {
|
|
2980
|
+
F: __dxlog_file12,
|
|
2981
|
+
L: 439,
|
|
2982
|
+
S: this,
|
|
2983
|
+
C: (f, a) => f(...a)
|
|
2984
|
+
});
|
|
2985
|
+
} else {
|
|
2986
|
+
import_log6.log.info("invitation state update", {
|
|
2987
|
+
actor: actor?.constructor.name,
|
|
2988
|
+
newState: stateToString(newState),
|
|
2989
|
+
oldState: stateToString(invitation.state)
|
|
2990
|
+
}, {
|
|
2991
|
+
F: __dxlog_file12,
|
|
2992
|
+
L: 445,
|
|
2993
|
+
S: this,
|
|
2994
|
+
C: (f, a) => f(...a)
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
_isNotTerminal(currentState) {
|
|
2999
|
+
return ![
|
|
3000
|
+
import_services6.Invitation.State.SUCCESS,
|
|
3001
|
+
import_services6.Invitation.State.ERROR,
|
|
2914
3002
|
import_services6.Invitation.State.CANCELLED,
|
|
2915
3003
|
import_services6.Invitation.State.TIMEOUT,
|
|
2916
3004
|
import_services6.Invitation.State.EXPIRED
|
|
@@ -2918,17 +3006,17 @@ var InvitationsHandler = class {
|
|
|
2918
3006
|
}
|
|
2919
3007
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2920
3008
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2921
|
-
(0,
|
|
2922
|
-
F:
|
|
2923
|
-
L:
|
|
3009
|
+
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
3010
|
+
F: __dxlog_file12,
|
|
3011
|
+
L: 470,
|
|
2924
3012
|
S: this,
|
|
2925
3013
|
C: (f, a) => f(...a)
|
|
2926
3014
|
});
|
|
2927
3015
|
setState(import_services6.Invitation.State.READY_FOR_AUTHENTICATION);
|
|
2928
3016
|
const authCode = await authenticated.wait(options);
|
|
2929
|
-
(0,
|
|
2930
|
-
F:
|
|
2931
|
-
L:
|
|
3017
|
+
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3018
|
+
F: __dxlog_file12,
|
|
3019
|
+
L: 474,
|
|
2932
3020
|
S: this,
|
|
2933
3021
|
C: (f, a) => f(...a)
|
|
2934
3022
|
});
|
|
@@ -2943,11 +3031,11 @@ var InvitationsHandler = class {
|
|
|
2943
3031
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2944
3032
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2945
3033
|
} else {
|
|
2946
|
-
(0,
|
|
3034
|
+
(0, import_log6.log)("retrying invalid code", {
|
|
2947
3035
|
attempt
|
|
2948
3036
|
}, {
|
|
2949
|
-
F:
|
|
2950
|
-
L:
|
|
3037
|
+
F: __dxlog_file12,
|
|
3038
|
+
L: 485,
|
|
2951
3039
|
S: this,
|
|
2952
3040
|
C: (f, a) => f(...a)
|
|
2953
3041
|
});
|
|
@@ -2963,9 +3051,9 @@ var InvitationsHandler = class {
|
|
|
2963
3051
|
if (introductionResponse.challenge == null) {
|
|
2964
3052
|
throw new Error("challenge missing in the introduction");
|
|
2965
3053
|
}
|
|
2966
|
-
(0,
|
|
2967
|
-
F:
|
|
2968
|
-
L:
|
|
3054
|
+
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3055
|
+
F: __dxlog_file12,
|
|
3056
|
+
L: 504,
|
|
2969
3057
|
S: this,
|
|
2970
3058
|
C: (f, a) => f(...a)
|
|
2971
3059
|
});
|
|
@@ -3079,7 +3167,7 @@ var InvitationsServiceImpl = class {
|
|
|
3079
3167
|
});
|
|
3080
3168
|
}
|
|
3081
3169
|
};
|
|
3082
|
-
var
|
|
3170
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3083
3171
|
var SpaceInvitationProtocol = class {
|
|
3084
3172
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3085
3173
|
this._spaceManager = _spaceManager;
|
|
@@ -3113,79 +3201,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3113
3201
|
};
|
|
3114
3202
|
}
|
|
3115
3203
|
async admit(invitation, request, guestProfile) {
|
|
3116
|
-
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3117
|
-
F:
|
|
3118
|
-
L:
|
|
3119
|
-
S: this,
|
|
3120
|
-
A: [
|
|
3121
|
-
"this._spaceKey",
|
|
3122
|
-
""
|
|
3123
|
-
]
|
|
3124
|
-
});
|
|
3125
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3126
|
-
(0, import_invariant10.invariant)(space, void 0, {
|
|
3127
|
-
F: __dxlog_file12,
|
|
3128
|
-
L: 78,
|
|
3129
|
-
S: this,
|
|
3130
|
-
A: [
|
|
3131
|
-
"space",
|
|
3132
|
-
""
|
|
3133
|
-
]
|
|
3134
|
-
});
|
|
3135
|
-
(0, import_invariant10.invariant)(request.space, void 0, {
|
|
3136
|
-
F: __dxlog_file12,
|
|
3137
|
-
L: 80,
|
|
3204
|
+
(0, import_invariant10.invariant)(this._spaceKey && request.space, void 0, {
|
|
3205
|
+
F: __dxlog_file13,
|
|
3206
|
+
L: 74,
|
|
3138
3207
|
S: this,
|
|
3139
3208
|
A: [
|
|
3140
|
-
"request.space",
|
|
3209
|
+
"this._spaceKey && request.space",
|
|
3141
3210
|
""
|
|
3142
3211
|
]
|
|
3143
3212
|
});
|
|
3144
|
-
|
|
3145
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== import_credentials10.SpaceMember.Role.REMOVED) {
|
|
3146
|
-
throw new import_protocols8.AlreadyJoinedError();
|
|
3147
|
-
}
|
|
3148
|
-
(0, import_log9.log)("writing guest credentials", {
|
|
3213
|
+
(0, import_log10.log)("writing guest credentials", {
|
|
3149
3214
|
host: this._signingContext.deviceKey,
|
|
3150
|
-
guest: deviceKey
|
|
3215
|
+
guest: request.space.deviceKey
|
|
3151
3216
|
}, {
|
|
3152
|
-
F:
|
|
3153
|
-
L:
|
|
3217
|
+
F: __dxlog_file13,
|
|
3218
|
+
L: 75,
|
|
3154
3219
|
S: this,
|
|
3155
3220
|
C: (f, a) => f(...a)
|
|
3156
3221
|
});
|
|
3157
|
-
const
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
"credentials[0].credential",
|
|
3164
|
-
""
|
|
3165
|
-
]
|
|
3166
|
-
});
|
|
3167
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3168
|
-
(0, import_invariant10.invariant)((0, import_credentials9.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3169
|
-
F: __dxlog_file12,
|
|
3170
|
-
L: 103,
|
|
3171
|
-
S: this,
|
|
3172
|
-
A: [
|
|
3173
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3174
|
-
""
|
|
3175
|
-
]
|
|
3222
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3223
|
+
spaceKey: this._spaceKey,
|
|
3224
|
+
identityKey: request.space.identityKey,
|
|
3225
|
+
role: invitation.role ?? import_credentials10.SpaceMember.Role.ADMIN,
|
|
3226
|
+
profile: guestProfile,
|
|
3227
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3176
3228
|
});
|
|
3177
|
-
|
|
3229
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3178
3230
|
return {
|
|
3179
3231
|
space: {
|
|
3180
3232
|
credential: spaceMemberCredential,
|
|
3181
|
-
controlTimeframe: space
|
|
3233
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3182
3234
|
}
|
|
3183
3235
|
};
|
|
3184
3236
|
}
|
|
3185
3237
|
async delegate(invitation) {
|
|
3186
3238
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3187
|
-
F:
|
|
3188
|
-
L:
|
|
3239
|
+
F: __dxlog_file13,
|
|
3240
|
+
L: 95,
|
|
3189
3241
|
S: this,
|
|
3190
3242
|
A: [
|
|
3191
3243
|
"this._spaceKey",
|
|
@@ -3194,8 +3246,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3194
3246
|
});
|
|
3195
3247
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3196
3248
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3197
|
-
F:
|
|
3198
|
-
L:
|
|
3249
|
+
F: __dxlog_file13,
|
|
3250
|
+
L: 97,
|
|
3199
3251
|
S: this,
|
|
3200
3252
|
A: [
|
|
3201
3253
|
"space",
|
|
@@ -3204,8 +3256,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3204
3256
|
});
|
|
3205
3257
|
if (invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3206
3258
|
(0, import_invariant10.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
3207
|
-
F:
|
|
3208
|
-
L:
|
|
3259
|
+
F: __dxlog_file13,
|
|
3260
|
+
L: 99,
|
|
3209
3261
|
S: this,
|
|
3210
3262
|
A: [
|
|
3211
3263
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3213,12 +3265,12 @@ var SpaceInvitationProtocol = class {
|
|
|
3213
3265
|
]
|
|
3214
3266
|
});
|
|
3215
3267
|
}
|
|
3216
|
-
(0,
|
|
3268
|
+
(0, import_log10.log)("writing delegate space invitation", {
|
|
3217
3269
|
host: this._signingContext.deviceKey,
|
|
3218
3270
|
id: invitation.invitationId
|
|
3219
3271
|
}, {
|
|
3220
|
-
F:
|
|
3221
|
-
L:
|
|
3272
|
+
F: __dxlog_file13,
|
|
3273
|
+
L: 102,
|
|
3222
3274
|
S: this,
|
|
3223
3275
|
C: (f, a) => f(...a)
|
|
3224
3276
|
});
|
|
@@ -3232,8 +3284,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3232
3284
|
guestKey: invitation.authMethod === import_services10.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3233
3285
|
});
|
|
3234
3286
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3235
|
-
F:
|
|
3236
|
-
L:
|
|
3287
|
+
F: __dxlog_file13,
|
|
3288
|
+
L: 122,
|
|
3237
3289
|
S: this,
|
|
3238
3290
|
A: [
|
|
3239
3291
|
"credential.credential",
|
|
@@ -3247,8 +3299,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3247
3299
|
}
|
|
3248
3300
|
async cancelDelegation(invitation) {
|
|
3249
3301
|
(0, import_invariant10.invariant)(this._spaceKey, void 0, {
|
|
3250
|
-
F:
|
|
3251
|
-
L:
|
|
3302
|
+
F: __dxlog_file13,
|
|
3303
|
+
L: 128,
|
|
3252
3304
|
S: this,
|
|
3253
3305
|
A: [
|
|
3254
3306
|
"this._spaceKey",
|
|
@@ -3256,8 +3308,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3256
3308
|
]
|
|
3257
3309
|
});
|
|
3258
3310
|
(0, import_invariant10.invariant)(invitation.type === import_services10.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3259
|
-
F:
|
|
3260
|
-
L:
|
|
3311
|
+
F: __dxlog_file13,
|
|
3312
|
+
L: 129,
|
|
3261
3313
|
S: this,
|
|
3262
3314
|
A: [
|
|
3263
3315
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3266,27 +3318,27 @@ var SpaceInvitationProtocol = class {
|
|
|
3266
3318
|
});
|
|
3267
3319
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3268
3320
|
(0, import_invariant10.invariant)(space, void 0, {
|
|
3269
|
-
F:
|
|
3270
|
-
L:
|
|
3321
|
+
F: __dxlog_file13,
|
|
3322
|
+
L: 131,
|
|
3271
3323
|
S: this,
|
|
3272
3324
|
A: [
|
|
3273
3325
|
"space",
|
|
3274
3326
|
""
|
|
3275
3327
|
]
|
|
3276
3328
|
});
|
|
3277
|
-
(0,
|
|
3329
|
+
(0, import_log10.log)("cancelling delegated space invitation", {
|
|
3278
3330
|
host: this._signingContext.deviceKey,
|
|
3279
3331
|
id: invitation.invitationId
|
|
3280
3332
|
}, {
|
|
3281
|
-
F:
|
|
3282
|
-
L:
|
|
3333
|
+
F: __dxlog_file13,
|
|
3334
|
+
L: 133,
|
|
3283
3335
|
S: this,
|
|
3284
3336
|
C: (f, a) => f(...a)
|
|
3285
3337
|
});
|
|
3286
3338
|
const credential = await (0, import_credentials9.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3287
3339
|
(0, import_invariant10.invariant)(credential.credential, void 0, {
|
|
3288
|
-
F:
|
|
3289
|
-
L:
|
|
3340
|
+
F: __dxlog_file13,
|
|
3341
|
+
L: 140,
|
|
3290
3342
|
S: this,
|
|
3291
3343
|
A: [
|
|
3292
3344
|
"credential.credential",
|
|
@@ -3324,8 +3376,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3324
3376
|
}
|
|
3325
3377
|
async accept(response) {
|
|
3326
3378
|
(0, import_invariant10.invariant)(response.space, void 0, {
|
|
3327
|
-
F:
|
|
3328
|
-
L:
|
|
3379
|
+
F: __dxlog_file13,
|
|
3380
|
+
L: 175,
|
|
3329
3381
|
S: this,
|
|
3330
3382
|
A: [
|
|
3331
3383
|
"response.space",
|
|
@@ -3335,8 +3387,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3335
3387
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3336
3388
|
const assertion = (0, import_credentials9.getCredentialAssertion)(credential);
|
|
3337
3389
|
(0, import_invariant10.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3338
|
-
F:
|
|
3339
|
-
L:
|
|
3390
|
+
F: __dxlog_file13,
|
|
3391
|
+
L: 178,
|
|
3340
3392
|
S: this,
|
|
3341
3393
|
A: [
|
|
3342
3394
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3344,8 +3396,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3344
3396
|
]
|
|
3345
3397
|
});
|
|
3346
3398
|
(0, import_invariant10.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3347
|
-
F:
|
|
3348
|
-
L:
|
|
3399
|
+
F: __dxlog_file13,
|
|
3400
|
+
L: 179,
|
|
3349
3401
|
S: this,
|
|
3350
3402
|
A: [
|
|
3351
3403
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3367,7 +3419,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3367
3419
|
};
|
|
3368
3420
|
}
|
|
3369
3421
|
};
|
|
3370
|
-
var
|
|
3422
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3371
3423
|
var InvitationsManager = class {
|
|
3372
3424
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3373
3425
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3375,12 +3427,12 @@ var InvitationsManager = class {
|
|
|
3375
3427
|
this._metadataStore = _metadataStore;
|
|
3376
3428
|
this._createInvitations = /* @__PURE__ */ new Map();
|
|
3377
3429
|
this._acceptInvitations = /* @__PURE__ */ new Map();
|
|
3378
|
-
this.invitationCreated = new
|
|
3379
|
-
this.invitationAccepted = new
|
|
3380
|
-
this.removedCreated = new
|
|
3381
|
-
this.removedAccepted = new
|
|
3382
|
-
this.saved = new
|
|
3383
|
-
this._persistentInvitationsLoadedEvent = new
|
|
3430
|
+
this.invitationCreated = new import_async12.Event();
|
|
3431
|
+
this.invitationAccepted = new import_async12.Event();
|
|
3432
|
+
this.removedCreated = new import_async12.Event();
|
|
3433
|
+
this.removedAccepted = new import_async12.Event();
|
|
3434
|
+
this.saved = new import_async12.Event();
|
|
3435
|
+
this._persistentInvitationsLoadedEvent = new import_async12.Event();
|
|
3384
3436
|
this._persistentInvitationsLoaded = false;
|
|
3385
3437
|
}
|
|
3386
3438
|
async createInvitation(options) {
|
|
@@ -3409,8 +3461,8 @@ var InvitationsManager = class {
|
|
|
3409
3461
|
try {
|
|
3410
3462
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3411
3463
|
} catch (err) {
|
|
3412
|
-
|
|
3413
|
-
F:
|
|
3464
|
+
import_log11.log.catch(err, void 0, {
|
|
3465
|
+
F: __dxlog_file14,
|
|
3414
3466
|
L: 82,
|
|
3415
3467
|
S: this,
|
|
3416
3468
|
C: (f, a) => f(...a)
|
|
@@ -3433,7 +3485,7 @@ var InvitationsManager = class {
|
|
|
3433
3485
|
const freshInvitations = persistentInvitations.filter((invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
3434
3486
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3435
3487
|
(0, import_invariant11.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3436
|
-
F:
|
|
3488
|
+
F: __dxlog_file14,
|
|
3437
3489
|
L: 103,
|
|
3438
3490
|
S: this,
|
|
3439
3491
|
A: [
|
|
@@ -3451,8 +3503,8 @@ var InvitationsManager = class {
|
|
|
3451
3503
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3452
3504
|
};
|
|
3453
3505
|
} catch (err) {
|
|
3454
|
-
|
|
3455
|
-
F:
|
|
3506
|
+
import_log11.log.catch(err, void 0, {
|
|
3507
|
+
F: __dxlog_file14,
|
|
3456
3508
|
L: 110,
|
|
3457
3509
|
S: this,
|
|
3458
3510
|
C: (f, a) => f(...a)
|
|
@@ -3483,14 +3535,14 @@ var InvitationsManager = class {
|
|
|
3483
3535
|
return invitation;
|
|
3484
3536
|
}
|
|
3485
3537
|
async authenticate({ invitationId, authCode }) {
|
|
3486
|
-
(0,
|
|
3487
|
-
F:
|
|
3538
|
+
(0, import_log11.log)("authenticating...", void 0, {
|
|
3539
|
+
F: __dxlog_file14,
|
|
3488
3540
|
L: 140,
|
|
3489
3541
|
S: this,
|
|
3490
3542
|
C: (f, a) => f(...a)
|
|
3491
3543
|
});
|
|
3492
3544
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3493
|
-
F:
|
|
3545
|
+
F: __dxlog_file14,
|
|
3494
3546
|
L: 141,
|
|
3495
3547
|
S: this,
|
|
3496
3548
|
A: [
|
|
@@ -3500,10 +3552,10 @@ var InvitationsManager = class {
|
|
|
3500
3552
|
});
|
|
3501
3553
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3502
3554
|
if (!observable) {
|
|
3503
|
-
|
|
3555
|
+
import_log11.log.warn("invalid invitation", {
|
|
3504
3556
|
invitationId
|
|
3505
3557
|
}, {
|
|
3506
|
-
F:
|
|
3558
|
+
F: __dxlog_file14,
|
|
3507
3559
|
L: 144,
|
|
3508
3560
|
S: this,
|
|
3509
3561
|
C: (f, a) => f(...a)
|
|
@@ -3513,16 +3565,16 @@ var InvitationsManager = class {
|
|
|
3513
3565
|
}
|
|
3514
3566
|
}
|
|
3515
3567
|
async cancelInvitation({ invitationId }) {
|
|
3516
|
-
(0,
|
|
3568
|
+
(0, import_log11.log)("cancelInvitation...", {
|
|
3517
3569
|
invitationId
|
|
3518
3570
|
}, {
|
|
3519
|
-
F:
|
|
3571
|
+
F: __dxlog_file14,
|
|
3520
3572
|
L: 151,
|
|
3521
3573
|
S: this,
|
|
3522
3574
|
C: (f, a) => f(...a)
|
|
3523
3575
|
});
|
|
3524
3576
|
(0, import_invariant11.invariant)(invitationId, void 0, {
|
|
3525
|
-
F:
|
|
3577
|
+
F: __dxlog_file14,
|
|
3526
3578
|
L: 152,
|
|
3527
3579
|
S: this,
|
|
3528
3580
|
A: [
|
|
@@ -3590,18 +3642,21 @@ var InvitationsManager = class {
|
|
|
3590
3642
|
};
|
|
3591
3643
|
}
|
|
3592
3644
|
_createObservableInvitation(handler, invitation) {
|
|
3593
|
-
const stream = new
|
|
3645
|
+
const stream = new import_async12.PushStream();
|
|
3594
3646
|
const ctx = new import_context9.Context({
|
|
3595
3647
|
onError: (err) => {
|
|
3596
3648
|
stream.error(err);
|
|
3597
3649
|
void ctx.dispose();
|
|
3598
3650
|
}
|
|
3651
|
+
}, {
|
|
3652
|
+
F: __dxlog_file14,
|
|
3653
|
+
L: 234
|
|
3599
3654
|
});
|
|
3600
3655
|
ctx.onDispose(() => {
|
|
3601
|
-
(0,
|
|
3656
|
+
(0, import_log11.log)("complete", {
|
|
3602
3657
|
...handler.toJSON()
|
|
3603
3658
|
}, {
|
|
3604
|
-
F:
|
|
3659
|
+
F: __dxlog_file14,
|
|
3605
3660
|
L: 241,
|
|
3606
3661
|
S: this,
|
|
3607
3662
|
C: (f, a) => f(...a)
|
|
@@ -3626,15 +3681,15 @@ var InvitationsManager = class {
|
|
|
3626
3681
|
};
|
|
3627
3682
|
}
|
|
3628
3683
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
3629
|
-
const otpEnteredTrigger = new
|
|
3630
|
-
const stream = new
|
|
3684
|
+
const otpEnteredTrigger = new import_async12.Trigger();
|
|
3685
|
+
const stream = new import_async12.PushStream();
|
|
3631
3686
|
const ctx = new import_context9.Context({
|
|
3632
3687
|
onError: (err) => {
|
|
3633
|
-
if (err instanceof
|
|
3634
|
-
(0,
|
|
3688
|
+
if (err instanceof import_async12.TimeoutError) {
|
|
3689
|
+
(0, import_log11.log)("timeout", {
|
|
3635
3690
|
...handler.toJSON()
|
|
3636
3691
|
}, {
|
|
3637
|
-
F:
|
|
3692
|
+
F: __dxlog_file14,
|
|
3638
3693
|
L: 261,
|
|
3639
3694
|
S: this,
|
|
3640
3695
|
C: (f, a) => f(...a)
|
|
@@ -3644,8 +3699,8 @@ var InvitationsManager = class {
|
|
|
3644
3699
|
state: import_services11.Invitation.State.TIMEOUT
|
|
3645
3700
|
});
|
|
3646
3701
|
} else {
|
|
3647
|
-
|
|
3648
|
-
F:
|
|
3702
|
+
import_log11.log.warn("auth failed", err, {
|
|
3703
|
+
F: __dxlog_file14,
|
|
3649
3704
|
L: 264,
|
|
3650
3705
|
S: this,
|
|
3651
3706
|
C: (f, a) => f(...a)
|
|
@@ -3657,12 +3712,15 @@ var InvitationsManager = class {
|
|
|
3657
3712
|
}
|
|
3658
3713
|
void ctx.dispose();
|
|
3659
3714
|
}
|
|
3715
|
+
}, {
|
|
3716
|
+
F: __dxlog_file14,
|
|
3717
|
+
L: 258
|
|
3660
3718
|
});
|
|
3661
3719
|
ctx.onDispose(() => {
|
|
3662
|
-
(0,
|
|
3720
|
+
(0, import_log11.log)("complete", {
|
|
3663
3721
|
...handler.toJSON()
|
|
3664
3722
|
}, {
|
|
3665
|
-
F:
|
|
3723
|
+
F: __dxlog_file14,
|
|
3666
3724
|
L: 271,
|
|
3667
3725
|
S: this,
|
|
3668
3726
|
C: (f, a) => f(...a)
|
|
@@ -3706,8 +3764,8 @@ var InvitationsManager = class {
|
|
|
3706
3764
|
try {
|
|
3707
3765
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3708
3766
|
} catch (err) {
|
|
3709
|
-
|
|
3710
|
-
F:
|
|
3767
|
+
import_log11.log.catch(err, void 0, {
|
|
3768
|
+
F: __dxlog_file14,
|
|
3711
3769
|
L: 307,
|
|
3712
3770
|
S: this,
|
|
3713
3771
|
C: (f, a) => f(...a)
|
|
@@ -3720,12 +3778,18 @@ var InvitationsManager = class {
|
|
|
3720
3778
|
}, callback);
|
|
3721
3779
|
}
|
|
3722
3780
|
};
|
|
3723
|
-
var AutomergeSpaceState = class {
|
|
3781
|
+
var AutomergeSpaceState = class extends import_context11.Resource {
|
|
3724
3782
|
constructor(_onNewRoot) {
|
|
3783
|
+
super();
|
|
3725
3784
|
this._onNewRoot = _onNewRoot;
|
|
3726
3785
|
this.rootUrl = void 0;
|
|
3727
3786
|
this.lastEpoch = void 0;
|
|
3728
|
-
this.onNewEpoch = new
|
|
3787
|
+
this.onNewEpoch = new import_async14.Event();
|
|
3788
|
+
this._isProcessingRootDocs = false;
|
|
3789
|
+
}
|
|
3790
|
+
async _open(ctx) {
|
|
3791
|
+
}
|
|
3792
|
+
async _close(ctx) {
|
|
3729
3793
|
this._isProcessingRootDocs = false;
|
|
3730
3794
|
}
|
|
3731
3795
|
async processCredential(credential) {
|
|
@@ -3754,18 +3818,169 @@ var AutomergeSpaceState = class {
|
|
|
3754
3818
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3755
3819
|
}
|
|
3756
3820
|
};
|
|
3757
|
-
var
|
|
3821
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3822
|
+
var runEpochMigration = async (ctx, context) => {
|
|
3823
|
+
switch (context.migration) {
|
|
3824
|
+
case import_services13.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3825
|
+
const document = context.repo.create();
|
|
3826
|
+
await context.repo.flush();
|
|
3827
|
+
return {
|
|
3828
|
+
newRoot: document.url
|
|
3829
|
+
};
|
|
3830
|
+
}
|
|
3831
|
+
case import_services13.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY: {
|
|
3832
|
+
if (!context.currentRoot) {
|
|
3833
|
+
throw new Error("Space does not have an automerge root");
|
|
3834
|
+
}
|
|
3835
|
+
const rootHandle = context.repo.find(context.currentRoot);
|
|
3836
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3837
|
+
const newRoot = context.repo.create(rootHandle.docSync());
|
|
3838
|
+
await context.repo.flush();
|
|
3839
|
+
return {
|
|
3840
|
+
newRoot: newRoot.url
|
|
3841
|
+
};
|
|
3842
|
+
}
|
|
3843
|
+
case import_services13.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3844
|
+
import_log13.log.info("Fragmenting", void 0, {
|
|
3845
|
+
F: __dxlog_file15,
|
|
3846
|
+
L: 63,
|
|
3847
|
+
S: void 0,
|
|
3848
|
+
C: (f, a) => f(...a)
|
|
3849
|
+
});
|
|
3850
|
+
const currentRootUrl = context.currentRoot;
|
|
3851
|
+
const rootHandle = context.repo.find(currentRootUrl);
|
|
3852
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3853
|
+
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3854
|
+
const properties = (0, import_echo_db.findInlineObjectOfType)(rootHandle.docSync(), import_echo_schema.TYPE_PROPERTIES);
|
|
3855
|
+
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3856
|
+
(0, import_invariant13.invariant)(properties, "Properties not found", {
|
|
3857
|
+
F: __dxlog_file15,
|
|
3858
|
+
L: 73,
|
|
3859
|
+
S: void 0,
|
|
3860
|
+
A: [
|
|
3861
|
+
"properties",
|
|
3862
|
+
"'Properties not found'"
|
|
3863
|
+
]
|
|
3864
|
+
});
|
|
3865
|
+
const newSpaceDoc = {
|
|
3866
|
+
...rootHandle.docSync(),
|
|
3867
|
+
objects: Object.fromEntries([
|
|
3868
|
+
properties
|
|
3869
|
+
])
|
|
3870
|
+
};
|
|
3871
|
+
const newRoot = context.repo.create(newSpaceDoc);
|
|
3872
|
+
(0, import_invariant13.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3873
|
+
F: __dxlog_file15,
|
|
3874
|
+
L: 78,
|
|
3875
|
+
S: void 0,
|
|
3876
|
+
A: [
|
|
3877
|
+
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3878
|
+
""
|
|
3879
|
+
]
|
|
3880
|
+
});
|
|
3881
|
+
const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(context.spaceId, context.repo, context.spaceKey);
|
|
3882
|
+
await docLoader.loadSpaceRootDocHandle(ctx, {
|
|
3883
|
+
rootUrl: newRoot.url
|
|
3884
|
+
});
|
|
3885
|
+
otherObjects.forEach(([key, value]) => {
|
|
3886
|
+
const handle = docLoader.createDocumentForObject(key);
|
|
3887
|
+
handle.change((doc) => {
|
|
3888
|
+
(0, import_util8.assignDeep)(doc, [
|
|
3889
|
+
"objects",
|
|
3890
|
+
key
|
|
3891
|
+
], value);
|
|
3892
|
+
});
|
|
3893
|
+
});
|
|
3894
|
+
await context.repo.flush();
|
|
3895
|
+
return {
|
|
3896
|
+
newRoot: newRoot.url
|
|
3897
|
+
};
|
|
3898
|
+
}
|
|
3899
|
+
case import_services13.CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3900
|
+
const currentRootUrl = context.currentRoot;
|
|
3901
|
+
const rootHandle = context.repo.find(currentRootUrl);
|
|
3902
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3903
|
+
(0, import_invariant13.invariant)(rootHandle.docSync(), "Root doc not found", {
|
|
3904
|
+
F: __dxlog_file15,
|
|
3905
|
+
L: 100,
|
|
3906
|
+
S: void 0,
|
|
3907
|
+
A: [
|
|
3908
|
+
"rootHandle.docSync()",
|
|
3909
|
+
"'Root doc not found'"
|
|
3910
|
+
]
|
|
3911
|
+
});
|
|
3912
|
+
const newRootContent = await (0, import_echo_db.convertLegacySpaceRootDoc)(structuredClone(rootHandle.docSync()));
|
|
3913
|
+
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3914
|
+
try {
|
|
3915
|
+
const handle = context.repo.find(url);
|
|
3916
|
+
await (0, import_context12.cancelWithContext)(ctx, (0, import_async15.asyncTimeout)(handle.whenReady(), 1e4));
|
|
3917
|
+
(0, import_invariant13.invariant)(handle.docSync(), "Doc not found", {
|
|
3918
|
+
F: __dxlog_file15,
|
|
3919
|
+
L: 108,
|
|
3920
|
+
S: void 0,
|
|
3921
|
+
A: [
|
|
3922
|
+
"handle.docSync()",
|
|
3923
|
+
"'Doc not found'"
|
|
3924
|
+
]
|
|
3925
|
+
});
|
|
3926
|
+
const newDoc = await (0, import_echo_db.convertLegacyReferences)(structuredClone(handle.docSync()));
|
|
3927
|
+
const migratedDoc = (0, import_echo_db.migrateDocument)(handle.docSync(), newDoc);
|
|
3928
|
+
const newHandle = context.repo.import(import_automerge.next.save(migratedDoc));
|
|
3929
|
+
newRootContent.links[id] = newHandle.url;
|
|
3930
|
+
} catch (err) {
|
|
3931
|
+
import_log13.log.warn("Failed to migrate reference", {
|
|
3932
|
+
id,
|
|
3933
|
+
url,
|
|
3934
|
+
error: err
|
|
3935
|
+
}, {
|
|
3936
|
+
F: __dxlog_file15,
|
|
3937
|
+
L: 114,
|
|
3938
|
+
S: void 0,
|
|
3939
|
+
C: (f, a) => f(...a)
|
|
3940
|
+
});
|
|
3941
|
+
delete newRootContent.links[id];
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
const migratedRoot = (0, import_echo_db.migrateDocument)(rootHandle.docSync(), newRootContent);
|
|
3945
|
+
const newRoot = context.repo.import(import_automerge.next.save(migratedRoot));
|
|
3946
|
+
await context.repo.flush();
|
|
3947
|
+
return {
|
|
3948
|
+
newRoot: newRoot.url
|
|
3949
|
+
};
|
|
3950
|
+
}
|
|
3951
|
+
case import_services13.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3952
|
+
(0, import_invariant13.invariant)(context.newAutomergeRoot, void 0, {
|
|
3953
|
+
F: __dxlog_file15,
|
|
3954
|
+
L: 129,
|
|
3955
|
+
S: void 0,
|
|
3956
|
+
A: [
|
|
3957
|
+
"context.newAutomergeRoot",
|
|
3958
|
+
""
|
|
3959
|
+
]
|
|
3960
|
+
});
|
|
3961
|
+
await context.repo.flush();
|
|
3962
|
+
return {
|
|
3963
|
+
newRoot: context.newAutomergeRoot
|
|
3964
|
+
};
|
|
3965
|
+
}
|
|
3966
|
+
}
|
|
3967
|
+
return {};
|
|
3968
|
+
};
|
|
3969
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3758
3970
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3759
3971
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3760
3972
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3761
3973
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3762
3974
|
var NotarizationPlugin = class {
|
|
3763
3975
|
constructor() {
|
|
3764
|
-
this._ctx = new
|
|
3765
|
-
|
|
3976
|
+
this._ctx = new import_context13.Context(void 0, {
|
|
3977
|
+
F: __dxlog_file16,
|
|
3978
|
+
L: 62
|
|
3979
|
+
});
|
|
3980
|
+
this._extensionOpened = new import_async16.Event();
|
|
3766
3981
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3767
|
-
this._processedCredentials = new
|
|
3768
|
-
this._processCredentialsTriggers = new
|
|
3982
|
+
this._processedCredentials = new import_util9.ComplexSet(import_keys11.PublicKey.hash);
|
|
3983
|
+
this._processCredentialsTriggers = new import_util9.ComplexMap(import_keys11.PublicKey.hash);
|
|
3769
3984
|
}
|
|
3770
3985
|
get hasWriter() {
|
|
3771
3986
|
return !!this._writer;
|
|
@@ -3779,16 +3994,16 @@ var NotarizationPlugin = class {
|
|
|
3779
3994
|
* Request credentials to be notarized.
|
|
3780
3995
|
*/
|
|
3781
3996
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
3782
|
-
(0,
|
|
3997
|
+
(0, import_log14.log)("notarize", {
|
|
3783
3998
|
credentials
|
|
3784
3999
|
}, {
|
|
3785
|
-
F:
|
|
4000
|
+
F: __dxlog_file16,
|
|
3786
4001
|
L: 90,
|
|
3787
4002
|
S: this,
|
|
3788
4003
|
C: (f, a) => f(...a)
|
|
3789
4004
|
});
|
|
3790
|
-
(0,
|
|
3791
|
-
F:
|
|
4005
|
+
(0, import_invariant14.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
4006
|
+
F: __dxlog_file16,
|
|
3792
4007
|
L: 91,
|
|
3793
4008
|
S: this,
|
|
3794
4009
|
A: [
|
|
@@ -3796,13 +4011,13 @@ var NotarizationPlugin = class {
|
|
|
3796
4011
|
"'Credentials must have an id'"
|
|
3797
4012
|
]
|
|
3798
4013
|
});
|
|
3799
|
-
const errors = new
|
|
4014
|
+
const errors = new import_async16.Trigger();
|
|
3800
4015
|
const ctx = this._ctx.derive({
|
|
3801
4016
|
onError: (err) => {
|
|
3802
|
-
|
|
4017
|
+
import_log14.log.warn("Notarization error", {
|
|
3803
4018
|
err
|
|
3804
4019
|
}, {
|
|
3805
|
-
F:
|
|
4020
|
+
F: __dxlog_file16,
|
|
3806
4021
|
L: 99,
|
|
3807
4022
|
S: this,
|
|
3808
4023
|
C: (f, a) => f(...a)
|
|
@@ -3813,23 +4028,23 @@ var NotarizationPlugin = class {
|
|
|
3813
4028
|
});
|
|
3814
4029
|
opCtx?.onDispose(() => ctx.dispose());
|
|
3815
4030
|
if (timeout !== 0) {
|
|
3816
|
-
(0,
|
|
3817
|
-
|
|
4031
|
+
(0, import_async16.scheduleTask)(ctx, () => {
|
|
4032
|
+
import_log14.log.warn("Notarization timeout", {
|
|
3818
4033
|
timeout,
|
|
3819
4034
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3820
4035
|
}, {
|
|
3821
|
-
F:
|
|
4036
|
+
F: __dxlog_file16,
|
|
3822
4037
|
L: 111,
|
|
3823
4038
|
S: this,
|
|
3824
4039
|
C: (f, a) => f(...a)
|
|
3825
4040
|
});
|
|
3826
4041
|
void ctx.dispose();
|
|
3827
|
-
errors.throw(new
|
|
4042
|
+
errors.throw(new import_async16.TimeoutError(timeout, "Notarization timed out"));
|
|
3828
4043
|
}, timeout);
|
|
3829
4044
|
}
|
|
3830
4045
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
3831
4046
|
const peersTried = /* @__PURE__ */ new Set();
|
|
3832
|
-
const notarizeTask = new
|
|
4047
|
+
const notarizeTask = new import_async16.DeferredTask(ctx, async () => {
|
|
3833
4048
|
try {
|
|
3834
4049
|
if (this._extensions.size === 0) {
|
|
3835
4050
|
return;
|
|
@@ -3838,24 +4053,24 @@ var NotarizationPlugin = class {
|
|
|
3838
4053
|
...this._extensions
|
|
3839
4054
|
].find((peer2) => !peersTried.has(peer2));
|
|
3840
4055
|
if (!peer) {
|
|
3841
|
-
|
|
4056
|
+
import_log14.log.info("Exhausted all peers to notarize with", {
|
|
3842
4057
|
retryIn: retryTimeout
|
|
3843
4058
|
}, {
|
|
3844
|
-
F:
|
|
4059
|
+
F: __dxlog_file16,
|
|
3845
4060
|
L: 136,
|
|
3846
4061
|
S: this,
|
|
3847
4062
|
C: (f, a) => f(...a)
|
|
3848
4063
|
});
|
|
3849
4064
|
peersTried.clear();
|
|
3850
|
-
(0,
|
|
4065
|
+
(0, import_async16.scheduleTask)(ctx, () => notarizeTask.schedule(), retryTimeout);
|
|
3851
4066
|
return;
|
|
3852
4067
|
}
|
|
3853
4068
|
peersTried.add(peer);
|
|
3854
|
-
(0,
|
|
4069
|
+
(0, import_log14.log)("try notarizing", {
|
|
3855
4070
|
peer: peer.localPeerId,
|
|
3856
4071
|
credentialId: credentials.map((credential) => credential.id)
|
|
3857
4072
|
}, {
|
|
3858
|
-
F:
|
|
4073
|
+
F: __dxlog_file16,
|
|
3859
4074
|
L: 143,
|
|
3860
4075
|
S: this,
|
|
3861
4076
|
C: (f, a) => f(...a)
|
|
@@ -3863,17 +4078,17 @@ var NotarizationPlugin = class {
|
|
|
3863
4078
|
await peer.rpc.NotarizationService.notarize({
|
|
3864
4079
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
3865
4080
|
});
|
|
3866
|
-
(0,
|
|
3867
|
-
F:
|
|
4081
|
+
(0, import_log14.log)("success", void 0, {
|
|
4082
|
+
F: __dxlog_file16,
|
|
3868
4083
|
L: 147,
|
|
3869
4084
|
S: this,
|
|
3870
4085
|
C: (f, a) => f(...a)
|
|
3871
4086
|
});
|
|
3872
|
-
await (0,
|
|
4087
|
+
await (0, import_async16.sleep)(successDelay);
|
|
3873
4088
|
} catch (err) {
|
|
3874
4089
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
3875
|
-
|
|
3876
|
-
F:
|
|
4090
|
+
import_log14.log.info("error notarizing (recoverable)", err, {
|
|
4091
|
+
F: __dxlog_file16,
|
|
3877
4092
|
L: 151,
|
|
3878
4093
|
S: this,
|
|
3879
4094
|
C: (f, a) => f(...a)
|
|
@@ -3886,12 +4101,12 @@ var NotarizationPlugin = class {
|
|
|
3886
4101
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
3887
4102
|
try {
|
|
3888
4103
|
await Promise.race([
|
|
3889
|
-
(0,
|
|
4104
|
+
(0, import_context13.rejectOnDispose)(ctx),
|
|
3890
4105
|
allNotarized,
|
|
3891
4106
|
errors.wait()
|
|
3892
4107
|
]);
|
|
3893
|
-
(0,
|
|
3894
|
-
F:
|
|
4108
|
+
(0, import_log14.log)("done", void 0, {
|
|
4109
|
+
F: __dxlog_file16,
|
|
3895
4110
|
L: 162,
|
|
3896
4111
|
S: this,
|
|
3897
4112
|
C: (f, a) => f(...a)
|
|
@@ -3912,8 +4127,8 @@ var NotarizationPlugin = class {
|
|
|
3912
4127
|
this._processCredentialsTriggers.delete(credential.id);
|
|
3913
4128
|
}
|
|
3914
4129
|
setWriter(writer) {
|
|
3915
|
-
(0,
|
|
3916
|
-
F:
|
|
4130
|
+
(0, import_invariant14.invariant)(!this._writer, "Writer already set.", {
|
|
4131
|
+
F: __dxlog_file16,
|
|
3917
4132
|
L: 181,
|
|
3918
4133
|
S: this,
|
|
3919
4134
|
A: [
|
|
@@ -3927,7 +4142,7 @@ var NotarizationPlugin = class {
|
|
|
3927
4142
|
if (this._processedCredentials.has(id)) {
|
|
3928
4143
|
return;
|
|
3929
4144
|
}
|
|
3930
|
-
await (0,
|
|
4145
|
+
await (0, import_util9.entry)(this._processCredentialsTriggers, id).orInsert(new import_async16.Trigger()).value.wait();
|
|
3931
4146
|
}
|
|
3932
4147
|
/**
|
|
3933
4148
|
* Requests from other peers to notarize credentials.
|
|
@@ -3937,8 +4152,8 @@ var NotarizationPlugin = class {
|
|
|
3937
4152
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
3938
4153
|
}
|
|
3939
4154
|
for (const credential of request.credentials ?? []) {
|
|
3940
|
-
(0,
|
|
3941
|
-
F:
|
|
4155
|
+
(0, import_invariant14.invariant)(credential.id, "Credential must have an id", {
|
|
4156
|
+
F: __dxlog_file16,
|
|
3942
4157
|
L: 200,
|
|
3943
4158
|
S: this,
|
|
3944
4159
|
A: [
|
|
@@ -3955,10 +4170,10 @@ var NotarizationPlugin = class {
|
|
|
3955
4170
|
createExtension() {
|
|
3956
4171
|
const extension = new NotarizationTeleportExtension({
|
|
3957
4172
|
onOpen: async () => {
|
|
3958
|
-
(0,
|
|
4173
|
+
(0, import_log14.log)("extension opened", {
|
|
3959
4174
|
peer: extension.localPeerId
|
|
3960
4175
|
}, {
|
|
3961
|
-
F:
|
|
4176
|
+
F: __dxlog_file16,
|
|
3962
4177
|
L: 211,
|
|
3963
4178
|
S: this,
|
|
3964
4179
|
C: (f, a) => f(...a)
|
|
@@ -3967,10 +4182,10 @@ var NotarizationPlugin = class {
|
|
|
3967
4182
|
this._extensionOpened.emit();
|
|
3968
4183
|
},
|
|
3969
4184
|
onClose: async () => {
|
|
3970
|
-
(0,
|
|
4185
|
+
(0, import_log14.log)("extension closed", {
|
|
3971
4186
|
peer: extension.localPeerId
|
|
3972
4187
|
}, {
|
|
3973
|
-
F:
|
|
4188
|
+
F: __dxlog_file16,
|
|
3974
4189
|
L: 216,
|
|
3975
4190
|
S: this,
|
|
3976
4191
|
C: (f, a) => f(...a)
|
|
@@ -4022,16 +4237,84 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
4022
4237
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4023
4238
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4024
4239
|
}
|
|
4025
|
-
|
|
4240
|
+
function _using_ctx() {
|
|
4241
|
+
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
4242
|
+
var err = new Error();
|
|
4243
|
+
err.name = "SuppressedError";
|
|
4244
|
+
err.suppressed = suppressed;
|
|
4245
|
+
err.error = error;
|
|
4246
|
+
return err;
|
|
4247
|
+
}, empty = {}, stack = [];
|
|
4248
|
+
function using(isAwait, value) {
|
|
4249
|
+
if (value != null) {
|
|
4250
|
+
if (Object(value) !== value) {
|
|
4251
|
+
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
4252
|
+
}
|
|
4253
|
+
if (isAwait) {
|
|
4254
|
+
var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
|
|
4255
|
+
}
|
|
4256
|
+
if (dispose == null) {
|
|
4257
|
+
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
|
|
4258
|
+
}
|
|
4259
|
+
if (typeof dispose !== "function") {
|
|
4260
|
+
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
|
|
4261
|
+
}
|
|
4262
|
+
stack.push({
|
|
4263
|
+
v: value,
|
|
4264
|
+
d: dispose,
|
|
4265
|
+
a: isAwait
|
|
4266
|
+
});
|
|
4267
|
+
} else if (isAwait) {
|
|
4268
|
+
stack.push({
|
|
4269
|
+
d: value,
|
|
4270
|
+
a: isAwait
|
|
4271
|
+
});
|
|
4272
|
+
}
|
|
4273
|
+
return value;
|
|
4274
|
+
}
|
|
4275
|
+
return {
|
|
4276
|
+
e: empty,
|
|
4277
|
+
u: using.bind(null, false),
|
|
4278
|
+
a: using.bind(null, true),
|
|
4279
|
+
d: function() {
|
|
4280
|
+
var error = this.e;
|
|
4281
|
+
function next() {
|
|
4282
|
+
while (resource = stack.pop()) {
|
|
4283
|
+
try {
|
|
4284
|
+
var resource, disposalResult = resource.d && resource.d.call(resource.v);
|
|
4285
|
+
if (resource.a) {
|
|
4286
|
+
return Promise.resolve(disposalResult).then(next, err);
|
|
4287
|
+
}
|
|
4288
|
+
} catch (e) {
|
|
4289
|
+
return err(e);
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
if (error !== empty)
|
|
4293
|
+
throw error;
|
|
4294
|
+
}
|
|
4295
|
+
function err(e) {
|
|
4296
|
+
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
4297
|
+
return next();
|
|
4298
|
+
}
|
|
4299
|
+
return next();
|
|
4300
|
+
}
|
|
4301
|
+
};
|
|
4302
|
+
}
|
|
4303
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4026
4304
|
var DataSpace = class {
|
|
4027
4305
|
constructor(params) {
|
|
4028
|
-
this._ctx = new import_context10.Context(
|
|
4306
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4307
|
+
F: __dxlog_file17,
|
|
4308
|
+
L: 84
|
|
4309
|
+
});
|
|
4029
4310
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4030
4311
|
this._cache = void 0;
|
|
4031
4312
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4313
|
+
this._epochProcessingMutex = new import_async13.Mutex();
|
|
4032
4314
|
this._state = import_services12.SpaceState.CLOSED;
|
|
4315
|
+
this._databaseRoot = null;
|
|
4033
4316
|
this.error = void 0;
|
|
4034
|
-
this.stateUpdate = new
|
|
4317
|
+
this.stateUpdate = new import_async13.Event();
|
|
4035
4318
|
this.metrics = {};
|
|
4036
4319
|
this._inner = params.inner;
|
|
4037
4320
|
this._inner.stateUpdate.on(this._ctx, () => this.stateUpdate.emit());
|
|
@@ -4044,17 +4327,17 @@ var DataSpace = class {
|
|
|
4044
4327
|
this._callbacks = params.callbacks ?? {};
|
|
4045
4328
|
this._echoHost = params.echoHost;
|
|
4046
4329
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
4047
|
-
trustedKeysProvider: () => new
|
|
4330
|
+
trustedKeysProvider: () => new import_util7.ComplexSet(import_keys10.PublicKey.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== import_credentials13.SpaceMember.Role.REMOVED).map((member) => member.key)),
|
|
4048
4331
|
update: this._inner.stateUpdate,
|
|
4049
4332
|
authTimeout: import_client_protocol4.AUTH_TIMEOUT
|
|
4050
4333
|
});
|
|
4051
4334
|
this._cache = params.cache;
|
|
4052
4335
|
this._state = params.initialState;
|
|
4053
|
-
(0,
|
|
4336
|
+
(0, import_log12.log)("new state", {
|
|
4054
4337
|
state: import_services12.SpaceState[this._state]
|
|
4055
4338
|
}, {
|
|
4056
|
-
F:
|
|
4057
|
-
L:
|
|
4339
|
+
F: __dxlog_file17,
|
|
4340
|
+
L: 146,
|
|
4058
4341
|
S: this,
|
|
4059
4342
|
C: (f, a) => f(...a)
|
|
4060
4343
|
});
|
|
@@ -4087,6 +4370,9 @@ var DataSpace = class {
|
|
|
4087
4370
|
get automergeSpaceState() {
|
|
4088
4371
|
return this._automergeSpaceState;
|
|
4089
4372
|
}
|
|
4373
|
+
get databaseRoot() {
|
|
4374
|
+
return this._databaseRoot;
|
|
4375
|
+
}
|
|
4090
4376
|
get _automergeInfo() {
|
|
4091
4377
|
return {
|
|
4092
4378
|
rootUrl: this._automergeSpaceState.rootUrl,
|
|
@@ -4103,14 +4389,18 @@ var DataSpace = class {
|
|
|
4103
4389
|
await this._gossip.open();
|
|
4104
4390
|
await this._notarizationPlugin.open();
|
|
4105
4391
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4392
|
+
await this._automergeSpaceState.open();
|
|
4106
4393
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4107
|
-
await this._inner.open(new import_context10.Context(
|
|
4394
|
+
await this._inner.open(new import_context10.Context(void 0, {
|
|
4395
|
+
F: __dxlog_file17,
|
|
4396
|
+
L: 215
|
|
4397
|
+
}));
|
|
4108
4398
|
this._state = import_services12.SpaceState.CONTROL_ONLY;
|
|
4109
|
-
(0,
|
|
4399
|
+
(0, import_log12.log)("new state", {
|
|
4110
4400
|
state: import_services12.SpaceState[this._state]
|
|
4111
4401
|
}, {
|
|
4112
|
-
F:
|
|
4113
|
-
L:
|
|
4402
|
+
F: __dxlog_file17,
|
|
4403
|
+
L: 217,
|
|
4114
4404
|
S: this,
|
|
4115
4405
|
C: (f, a) => f(...a)
|
|
4116
4406
|
});
|
|
@@ -4124,19 +4414,23 @@ var DataSpace = class {
|
|
|
4124
4414
|
async _close() {
|
|
4125
4415
|
await this._callbacks.beforeClose?.();
|
|
4126
4416
|
this._state = import_services12.SpaceState.CLOSED;
|
|
4127
|
-
(0,
|
|
4417
|
+
(0, import_log12.log)("new state", {
|
|
4128
4418
|
state: import_services12.SpaceState[this._state]
|
|
4129
4419
|
}, {
|
|
4130
|
-
F:
|
|
4131
|
-
L:
|
|
4420
|
+
F: __dxlog_file17,
|
|
4421
|
+
L: 231,
|
|
4132
4422
|
S: this,
|
|
4133
4423
|
C: (f, a) => f(...a)
|
|
4134
4424
|
});
|
|
4135
4425
|
await this._ctx.dispose();
|
|
4136
|
-
this._ctx = new import_context10.Context(
|
|
4426
|
+
this._ctx = new import_context10.Context(void 0, {
|
|
4427
|
+
F: __dxlog_file17,
|
|
4428
|
+
L: 233
|
|
4429
|
+
});
|
|
4137
4430
|
await this.authVerifier.close();
|
|
4138
4431
|
await this._inner.close();
|
|
4139
4432
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
4433
|
+
await this._automergeSpaceState.close();
|
|
4140
4434
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
4141
4435
|
await this._notarizationPlugin.close();
|
|
4142
4436
|
await this._presence.close();
|
|
@@ -4152,32 +4446,32 @@ var DataSpace = class {
|
|
|
4152
4446
|
* Initialize the data pipeline in a separate task.
|
|
4153
4447
|
*/
|
|
4154
4448
|
initializeDataPipelineAsync() {
|
|
4155
|
-
(0,
|
|
4449
|
+
(0, import_async13.scheduleTask)(this._ctx, async () => {
|
|
4156
4450
|
try {
|
|
4157
4451
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
4158
4452
|
await this.initializeDataPipeline();
|
|
4159
4453
|
} catch (err) {
|
|
4160
4454
|
if (err instanceof import_protocols9.CancelledError || err instanceof import_context10.ContextDisposedError) {
|
|
4161
|
-
(0,
|
|
4162
|
-
F:
|
|
4163
|
-
L:
|
|
4455
|
+
(0, import_log12.log)("data pipeline initialization cancelled", err, {
|
|
4456
|
+
F: __dxlog_file17,
|
|
4457
|
+
L: 265,
|
|
4164
4458
|
S: this,
|
|
4165
4459
|
C: (f, a) => f(...a)
|
|
4166
4460
|
});
|
|
4167
4461
|
return;
|
|
4168
4462
|
}
|
|
4169
|
-
|
|
4170
|
-
F:
|
|
4171
|
-
L:
|
|
4463
|
+
import_log12.log.error("Error initializing data pipeline", err, {
|
|
4464
|
+
F: __dxlog_file17,
|
|
4465
|
+
L: 269,
|
|
4172
4466
|
S: this,
|
|
4173
4467
|
C: (f, a) => f(...a)
|
|
4174
4468
|
});
|
|
4175
4469
|
this._state = import_services12.SpaceState.ERROR;
|
|
4176
|
-
(0,
|
|
4470
|
+
(0, import_log12.log)("new state", {
|
|
4177
4471
|
state: import_services12.SpaceState[this._state]
|
|
4178
4472
|
}, {
|
|
4179
|
-
F:
|
|
4180
|
-
L:
|
|
4473
|
+
F: __dxlog_file17,
|
|
4474
|
+
L: 271,
|
|
4181
4475
|
S: this,
|
|
4182
4476
|
C: (f, a) => f(...a)
|
|
4183
4477
|
});
|
|
@@ -4193,31 +4487,28 @@ var DataSpace = class {
|
|
|
4193
4487
|
throw new import_protocols9.SystemError("Invalid operation");
|
|
4194
4488
|
}
|
|
4195
4489
|
this._state = import_services12.SpaceState.INITIALIZING;
|
|
4196
|
-
(0,
|
|
4490
|
+
(0, import_log12.log)("new state", {
|
|
4197
4491
|
state: import_services12.SpaceState[this._state]
|
|
4198
4492
|
}, {
|
|
4199
|
-
F:
|
|
4200
|
-
L:
|
|
4493
|
+
F: __dxlog_file17,
|
|
4494
|
+
L: 287,
|
|
4201
4495
|
S: this,
|
|
4202
4496
|
C: (f, a) => f(...a)
|
|
4203
4497
|
});
|
|
4204
4498
|
await this._initializeAndReadControlPipeline();
|
|
4205
|
-
await (0,
|
|
4499
|
+
await (0, import_async13.sleep)(1);
|
|
4500
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services12.SpaceState.READY);
|
|
4206
4501
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4207
|
-
await
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
L: 290,
|
|
4211
|
-
S: this,
|
|
4212
|
-
C: (f, a) => f(...a)
|
|
4213
|
-
});
|
|
4502
|
+
await ready;
|
|
4503
|
+
}
|
|
4504
|
+
async _enterReadyState() {
|
|
4214
4505
|
await this._callbacks.beforeReady?.();
|
|
4215
4506
|
this._state = import_services12.SpaceState.READY;
|
|
4216
|
-
(0,
|
|
4507
|
+
(0, import_log12.log)("new state", {
|
|
4217
4508
|
state: import_services12.SpaceState[this._state]
|
|
4218
4509
|
}, {
|
|
4219
|
-
F:
|
|
4220
|
-
L:
|
|
4510
|
+
F: __dxlog_file17,
|
|
4511
|
+
L: 306,
|
|
4221
4512
|
S: this,
|
|
4222
4513
|
C: (f, a) => f(...a)
|
|
4223
4514
|
});
|
|
@@ -4231,9 +4522,9 @@ var DataSpace = class {
|
|
|
4231
4522
|
});
|
|
4232
4523
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4233
4524
|
await this._createWritableFeeds();
|
|
4234
|
-
(0,
|
|
4235
|
-
F:
|
|
4236
|
-
L:
|
|
4525
|
+
(0, import_log12.log)("writable feeds created", void 0, {
|
|
4526
|
+
F: __dxlog_file17,
|
|
4527
|
+
L: 322,
|
|
4237
4528
|
S: this,
|
|
4238
4529
|
C: (f, a) => f(...a)
|
|
4239
4530
|
});
|
|
@@ -4291,57 +4582,66 @@ var DataSpace = class {
|
|
|
4291
4582
|
}
|
|
4292
4583
|
}
|
|
4293
4584
|
_onNewAutomergeRoot(rootUrl) {
|
|
4294
|
-
(0,
|
|
4585
|
+
(0, import_log12.log)("loading automerge root doc for space", {
|
|
4295
4586
|
space: this.key,
|
|
4296
4587
|
rootUrl
|
|
4297
4588
|
}, {
|
|
4298
|
-
F:
|
|
4299
|
-
L:
|
|
4589
|
+
F: __dxlog_file17,
|
|
4590
|
+
L: 388,
|
|
4300
4591
|
S: this,
|
|
4301
4592
|
C: (f, a) => f(...a)
|
|
4302
4593
|
});
|
|
4303
|
-
this._echoHost.replicateDocument(rootUrl);
|
|
4304
4594
|
const handle = this._echoHost.automergeRepo.find(rootUrl);
|
|
4305
4595
|
queueMicrotask(async () => {
|
|
4306
4596
|
try {
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
return;
|
|
4312
|
-
}
|
|
4313
|
-
const doc = handle.docSync() ?? (0, import_invariant12.failedInvariant)();
|
|
4314
|
-
if (!doc.access?.spaceKey) {
|
|
4315
|
-
handle.change((doc2) => {
|
|
4316
|
-
doc2.access = {
|
|
4317
|
-
spaceKey: this.key.toHex()
|
|
4318
|
-
};
|
|
4319
|
-
});
|
|
4320
|
-
}
|
|
4321
|
-
if (!this._echoHost.roots.has(handle.documentId)) {
|
|
4322
|
-
await this._echoHost.openSpaceRoot(handle.url);
|
|
4323
|
-
} else {
|
|
4324
|
-
import_log11.log.warn("echo database root already exists", {
|
|
4325
|
-
space: this.key,
|
|
4326
|
-
rootUrl
|
|
4327
|
-
}, {
|
|
4328
|
-
F: __dxlog_file15,
|
|
4329
|
-
L: 403,
|
|
4330
|
-
S: this,
|
|
4331
|
-
C: (f, a) => f(...a)
|
|
4597
|
+
try {
|
|
4598
|
+
var _usingCtx = _using_ctx();
|
|
4599
|
+
await (0, import_debug3.warnAfterTimeout)(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4600
|
+
await (0, import_context10.cancelWithContext)(this._ctx, handle.whenReady());
|
|
4332
4601
|
});
|
|
4602
|
+
if (this._ctx.disposed) {
|
|
4603
|
+
return;
|
|
4604
|
+
}
|
|
4605
|
+
const _guard = (
|
|
4606
|
+
// Ensure only one root is processed at a time.
|
|
4607
|
+
_usingCtx.u(await this._epochProcessingMutex.acquire())
|
|
4608
|
+
);
|
|
4609
|
+
const doc = handle.docSync() ?? (0, import_invariant12.failedInvariant)();
|
|
4610
|
+
if (!doc.access?.spaceKey) {
|
|
4611
|
+
handle.change((doc2) => {
|
|
4612
|
+
doc2.access = {
|
|
4613
|
+
spaceKey: this.key.toHex()
|
|
4614
|
+
};
|
|
4615
|
+
});
|
|
4616
|
+
}
|
|
4617
|
+
const root = await this._echoHost.openSpaceRoot(handle.url);
|
|
4618
|
+
this._databaseRoot = root;
|
|
4619
|
+
if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
|
|
4620
|
+
if (this._state !== import_services12.SpaceState.REQUIRES_MIGRATION) {
|
|
4621
|
+
this._state = import_services12.SpaceState.REQUIRES_MIGRATION;
|
|
4622
|
+
this.stateUpdate.emit();
|
|
4623
|
+
}
|
|
4624
|
+
} else {
|
|
4625
|
+
if (this._state !== import_services12.SpaceState.READY) {
|
|
4626
|
+
await this._enterReadyState();
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4629
|
+
} catch (_) {
|
|
4630
|
+
_usingCtx.e = _;
|
|
4631
|
+
} finally {
|
|
4632
|
+
_usingCtx.d();
|
|
4333
4633
|
}
|
|
4334
4634
|
} catch (err) {
|
|
4335
4635
|
if (err instanceof import_context10.ContextDisposedError) {
|
|
4336
4636
|
return;
|
|
4337
4637
|
}
|
|
4338
|
-
|
|
4638
|
+
import_log12.log.warn("error loading automerge root doc", {
|
|
4339
4639
|
space: this.key,
|
|
4340
4640
|
rootUrl,
|
|
4341
4641
|
err
|
|
4342
4642
|
}, {
|
|
4343
|
-
F:
|
|
4344
|
-
L:
|
|
4643
|
+
F: __dxlog_file17,
|
|
4644
|
+
L: 431,
|
|
4345
4645
|
S: this,
|
|
4346
4646
|
C: (f, a) => f(...a)
|
|
4347
4647
|
});
|
|
@@ -4364,148 +4664,34 @@ var DataSpace = class {
|
|
|
4364
4664
|
});
|
|
4365
4665
|
}
|
|
4366
4666
|
async createEpoch(options) {
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
case import_services12.CreateEpochRequest.Migration.NONE:
|
|
4371
|
-
{
|
|
4372
|
-
epoch = {
|
|
4373
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4374
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4375
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4376
|
-
automergeRoot: this._automergeSpaceState.lastEpoch?.subject.assertion?.automergeRoot
|
|
4377
|
-
};
|
|
4378
|
-
}
|
|
4379
|
-
break;
|
|
4380
|
-
case import_services12.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
4381
|
-
{
|
|
4382
|
-
const document = this._echoHost.automergeRepo.create();
|
|
4383
|
-
epoch = {
|
|
4384
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4385
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4386
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4387
|
-
automergeRoot: document.url
|
|
4388
|
-
};
|
|
4389
|
-
}
|
|
4390
|
-
break;
|
|
4391
|
-
case import_services12.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
4392
|
-
{
|
|
4393
|
-
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
4394
|
-
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
4395
|
-
await (0, import_context10.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
4396
|
-
const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
|
|
4397
|
-
await this._echoHost.automergeRepo.flush([
|
|
4398
|
-
newRoot.documentId
|
|
4399
|
-
]);
|
|
4400
|
-
(0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4401
|
-
F: __dxlog_file15,
|
|
4402
|
-
L: 460,
|
|
4403
|
-
S: this,
|
|
4404
|
-
A: [
|
|
4405
|
-
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
4406
|
-
""
|
|
4407
|
-
]
|
|
4408
|
-
});
|
|
4409
|
-
epoch = {
|
|
4410
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4411
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4412
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4413
|
-
automergeRoot: newRoot.url
|
|
4414
|
-
};
|
|
4415
|
-
}
|
|
4416
|
-
break;
|
|
4417
|
-
case import_services12.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
4418
|
-
{
|
|
4419
|
-
import_log11.log.info("Fragmenting", void 0, {
|
|
4420
|
-
F: __dxlog_file15,
|
|
4421
|
-
L: 472,
|
|
4422
|
-
S: this,
|
|
4423
|
-
C: (f, a) => f(...a)
|
|
4424
|
-
});
|
|
4425
|
-
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
4426
|
-
const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
|
|
4427
|
-
await (0, import_context10.cancelWithContext)(this._ctx, (0, import_async12.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
4428
|
-
const objects = Object.entries(rootHandle.docSync().objects);
|
|
4429
|
-
const properties = findPropertiesObject(rootHandle.docSync());
|
|
4430
|
-
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4431
|
-
(0, import_invariant12.invariant)(properties, "Properties not found", {
|
|
4432
|
-
F: __dxlog_file15,
|
|
4433
|
-
L: 482,
|
|
4434
|
-
S: this,
|
|
4435
|
-
A: [
|
|
4436
|
-
"properties",
|
|
4437
|
-
"'Properties not found'"
|
|
4438
|
-
]
|
|
4439
|
-
});
|
|
4440
|
-
const newSpaceDoc = {
|
|
4441
|
-
...rootHandle.docSync(),
|
|
4442
|
-
objects: Object.fromEntries([
|
|
4443
|
-
properties
|
|
4444
|
-
])
|
|
4445
|
-
};
|
|
4446
|
-
const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
|
|
4447
|
-
(0, import_invariant12.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4448
|
-
F: __dxlog_file15,
|
|
4449
|
-
L: 487,
|
|
4450
|
-
S: this,
|
|
4451
|
-
A: [
|
|
4452
|
-
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
4453
|
-
""
|
|
4454
|
-
]
|
|
4455
|
-
});
|
|
4456
|
-
const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(await (0, import_echo_pipeline2.createIdFromSpaceKey)(this.key), this._echoHost.automergeRepo, this.key);
|
|
4457
|
-
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
4458
|
-
rootUrl: newRoot.url
|
|
4459
|
-
});
|
|
4460
|
-
otherObjects.forEach(([key, value]) => {
|
|
4461
|
-
const handle = docLoader.createDocumentForObject(key);
|
|
4462
|
-
handle.change((doc) => {
|
|
4463
|
-
(0, import_util6.assignDeep)(doc, [
|
|
4464
|
-
"objects",
|
|
4465
|
-
key
|
|
4466
|
-
], value);
|
|
4467
|
-
});
|
|
4468
|
-
});
|
|
4469
|
-
epoch = {
|
|
4470
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4471
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4472
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4473
|
-
automergeRoot: newRoot.url
|
|
4474
|
-
};
|
|
4475
|
-
}
|
|
4476
|
-
break;
|
|
4477
|
-
case import_services12.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT:
|
|
4478
|
-
{
|
|
4479
|
-
(0, import_invariant12.invariant)(options.newAutomergeRoot, void 0, {
|
|
4480
|
-
F: __dxlog_file15,
|
|
4481
|
-
L: 517,
|
|
4482
|
-
S: this,
|
|
4483
|
-
A: [
|
|
4484
|
-
"options.newAutomergeRoot",
|
|
4485
|
-
""
|
|
4486
|
-
]
|
|
4487
|
-
});
|
|
4488
|
-
epoch = {
|
|
4489
|
-
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4490
|
-
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4491
|
-
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4492
|
-
automergeRoot: options.newAutomergeRoot
|
|
4493
|
-
};
|
|
4494
|
-
}
|
|
4495
|
-
break;
|
|
4496
|
-
}
|
|
4497
|
-
if (!epoch) {
|
|
4498
|
-
return;
|
|
4667
|
+
const ctx = this._ctx.derive();
|
|
4668
|
+
if (!options?.migration) {
|
|
4669
|
+
return null;
|
|
4499
4670
|
}
|
|
4671
|
+
const { newRoot } = await runEpochMigration(ctx, {
|
|
4672
|
+
repo: this._echoHost.automergeRepo,
|
|
4673
|
+
spaceId: this.id,
|
|
4674
|
+
spaceKey: this.key,
|
|
4675
|
+
migration: options.migration,
|
|
4676
|
+
currentRoot: this._automergeSpaceState.rootUrl ?? null,
|
|
4677
|
+
newAutomergeRoot: options.newAutomergeRoot
|
|
4678
|
+
});
|
|
4679
|
+
const epoch = {
|
|
4680
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
4681
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
4682
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new import_timeframe3.Timeframe(),
|
|
4683
|
+
automergeRoot: newRoot ?? this._automergeSpaceState.rootUrl
|
|
4684
|
+
};
|
|
4685
|
+
const credential = await this._signingContext.credentialSigner.createCredential({
|
|
4686
|
+
subject: this.key,
|
|
4687
|
+
assertion: {
|
|
4688
|
+
"@type": "dxos.halo.credentials.Epoch",
|
|
4689
|
+
...epoch
|
|
4690
|
+
}
|
|
4691
|
+
});
|
|
4500
4692
|
const receipt = await this.inner.controlPipeline.writer.write({
|
|
4501
4693
|
credential: {
|
|
4502
|
-
credential
|
|
4503
|
-
subject: this.key,
|
|
4504
|
-
assertion: {
|
|
4505
|
-
"@type": "dxos.halo.credentials.Epoch",
|
|
4506
|
-
...epoch
|
|
4507
|
-
}
|
|
4508
|
-
})
|
|
4694
|
+
credential
|
|
4509
4695
|
}
|
|
4510
4696
|
});
|
|
4511
4697
|
await this.inner.controlPipeline.state.waitUntilTimeframe(new import_timeframe3.Timeframe([
|
|
@@ -4515,6 +4701,7 @@ var DataSpace = class {
|
|
|
4515
4701
|
]
|
|
4516
4702
|
]));
|
|
4517
4703
|
await this._echoHost.updateIndexes();
|
|
4704
|
+
return credential;
|
|
4518
4705
|
}
|
|
4519
4706
|
async activate() {
|
|
4520
4707
|
if (![
|
|
@@ -4536,11 +4723,11 @@ var DataSpace = class {
|
|
|
4536
4723
|
await this._close();
|
|
4537
4724
|
}
|
|
4538
4725
|
this._state = import_services12.SpaceState.INACTIVE;
|
|
4539
|
-
(0,
|
|
4726
|
+
(0, import_log12.log)("new state", {
|
|
4540
4727
|
state: import_services12.SpaceState[this._state]
|
|
4541
4728
|
}, {
|
|
4542
|
-
F:
|
|
4543
|
-
L:
|
|
4729
|
+
F: __dxlog_file17,
|
|
4730
|
+
L: 512,
|
|
4544
4731
|
S: this,
|
|
4545
4732
|
C: (f, a) => f(...a)
|
|
4546
4733
|
});
|
|
@@ -4567,10 +4754,10 @@ _ts_decorate4([
|
|
|
4567
4754
|
})
|
|
4568
4755
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
4569
4756
|
_ts_decorate4([
|
|
4570
|
-
|
|
4757
|
+
import_async13.synchronized
|
|
4571
4758
|
], DataSpace.prototype, "open", null);
|
|
4572
4759
|
_ts_decorate4([
|
|
4573
|
-
|
|
4760
|
+
import_async13.synchronized
|
|
4574
4761
|
], DataSpace.prototype, "close", null);
|
|
4575
4762
|
_ts_decorate4([
|
|
4576
4763
|
import_tracing5.trace.span({
|
|
@@ -4586,27 +4773,15 @@ _ts_decorate4([
|
|
|
4586
4773
|
(0, import_debug3.timed)(1e4)
|
|
4587
4774
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
4588
4775
|
_ts_decorate4([
|
|
4589
|
-
|
|
4776
|
+
import_async13.synchronized
|
|
4590
4777
|
], DataSpace.prototype, "activate", null);
|
|
4591
4778
|
_ts_decorate4([
|
|
4592
|
-
|
|
4779
|
+
import_async13.synchronized
|
|
4593
4780
|
], DataSpace.prototype, "deactivate", null);
|
|
4594
4781
|
DataSpace = _ts_decorate4([
|
|
4595
|
-
(0,
|
|
4782
|
+
(0, import_async13.trackLeaks)("open", "close"),
|
|
4596
4783
|
import_tracing5.trace.resource()
|
|
4597
4784
|
], DataSpace);
|
|
4598
|
-
var findPropertiesObject = (spaceDoc) => {
|
|
4599
|
-
for (const id in spaceDoc.objects ?? {}) {
|
|
4600
|
-
const obj = spaceDoc.objects[id];
|
|
4601
|
-
if (obj.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES) {
|
|
4602
|
-
return [
|
|
4603
|
-
id,
|
|
4604
|
-
obj
|
|
4605
|
-
];
|
|
4606
|
-
}
|
|
4607
|
-
}
|
|
4608
|
-
return void 0;
|
|
4609
|
-
};
|
|
4610
4785
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
4611
4786
|
const credentials = [
|
|
4612
4787
|
await (0, import_credentials17.createCredential)({
|
|
@@ -4681,7 +4856,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4681
4856
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4682
4857
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4683
4858
|
}
|
|
4684
|
-
var
|
|
4859
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4685
4860
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4686
4861
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4687
4862
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4695,9 +4870,12 @@ var DataSpaceManager = class {
|
|
|
4695
4870
|
this._echoHost = _echoHost;
|
|
4696
4871
|
this._invitationsManager = _invitationsManager;
|
|
4697
4872
|
this._params = _params;
|
|
4698
|
-
this._ctx = new
|
|
4699
|
-
|
|
4700
|
-
|
|
4873
|
+
this._ctx = new import_context14.Context(void 0, {
|
|
4874
|
+
F: __dxlog_file18,
|
|
4875
|
+
L: 104
|
|
4876
|
+
});
|
|
4877
|
+
this.updated = new import_async17.Event();
|
|
4878
|
+
this._spaces = new import_util10.ComplexMap(import_keys12.PublicKey.hash);
|
|
4701
4879
|
this._isOpen = false;
|
|
4702
4880
|
this._instanceId = import_keys12.PublicKey.random().toHex();
|
|
4703
4881
|
import_tracing6.trace.diagnostic({
|
|
@@ -4708,10 +4886,10 @@ var DataSpaceManager = class {
|
|
|
4708
4886
|
const rootUrl = space.automergeSpaceState.rootUrl;
|
|
4709
4887
|
const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
|
|
4710
4888
|
const rootDoc = rootHandle?.docSync();
|
|
4711
|
-
const properties = rootDoc &&
|
|
4889
|
+
const properties = rootDoc && (0, import_echo_db2.findInlineObjectOfType)(rootDoc, import_echo_schema2.TYPE_PROPERTIES);
|
|
4712
4890
|
return {
|
|
4713
4891
|
key: space.key.toHex(),
|
|
4714
|
-
state:
|
|
4892
|
+
state: import_services14.SpaceState[space.state],
|
|
4715
4893
|
name: properties?.[1].data.name ?? null,
|
|
4716
4894
|
inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
|
|
4717
4895
|
linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
|
|
@@ -4728,46 +4906,46 @@ var DataSpaceManager = class {
|
|
|
4728
4906
|
return this._spaces;
|
|
4729
4907
|
}
|
|
4730
4908
|
async open() {
|
|
4731
|
-
(0,
|
|
4732
|
-
F:
|
|
4733
|
-
L:
|
|
4909
|
+
(0, import_log15.log)("open", void 0, {
|
|
4910
|
+
F: __dxlog_file18,
|
|
4911
|
+
L: 156,
|
|
4734
4912
|
S: this,
|
|
4735
4913
|
C: (f, a) => f(...a)
|
|
4736
4914
|
});
|
|
4737
|
-
|
|
4915
|
+
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.begin({
|
|
4738
4916
|
id: this._instanceId
|
|
4739
4917
|
}), {
|
|
4740
|
-
F:
|
|
4741
|
-
L:
|
|
4918
|
+
F: __dxlog_file18,
|
|
4919
|
+
L: 157,
|
|
4742
4920
|
S: this,
|
|
4743
4921
|
C: (f, a) => f(...a)
|
|
4744
4922
|
});
|
|
4745
|
-
(0,
|
|
4923
|
+
(0, import_log15.log)("metadata loaded", {
|
|
4746
4924
|
spaces: this._metadataStore.spaces.length
|
|
4747
4925
|
}, {
|
|
4748
|
-
F:
|
|
4749
|
-
L:
|
|
4926
|
+
F: __dxlog_file18,
|
|
4927
|
+
L: 158,
|
|
4750
4928
|
S: this,
|
|
4751
4929
|
C: (f, a) => f(...a)
|
|
4752
4930
|
});
|
|
4753
|
-
await (0,
|
|
4931
|
+
await (0, import_util10.forEachAsync)(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
4754
4932
|
try {
|
|
4755
|
-
(0,
|
|
4933
|
+
(0, import_log15.log)("load space", {
|
|
4756
4934
|
spaceMetadata
|
|
4757
4935
|
}, {
|
|
4758
|
-
F:
|
|
4759
|
-
L:
|
|
4936
|
+
F: __dxlog_file18,
|
|
4937
|
+
L: 162,
|
|
4760
4938
|
S: this,
|
|
4761
4939
|
C: (f, a) => f(...a)
|
|
4762
4940
|
});
|
|
4763
4941
|
await this._constructSpace(spaceMetadata);
|
|
4764
4942
|
} catch (err) {
|
|
4765
|
-
|
|
4943
|
+
import_log15.log.error("Error loading space", {
|
|
4766
4944
|
spaceMetadata,
|
|
4767
4945
|
err
|
|
4768
4946
|
}, {
|
|
4769
|
-
F:
|
|
4770
|
-
L:
|
|
4947
|
+
F: __dxlog_file18,
|
|
4948
|
+
L: 165,
|
|
4771
4949
|
S: this,
|
|
4772
4950
|
C: (f, a) => f(...a)
|
|
4773
4951
|
});
|
|
@@ -4775,19 +4953,19 @@ var DataSpaceManager = class {
|
|
|
4775
4953
|
});
|
|
4776
4954
|
this._isOpen = true;
|
|
4777
4955
|
this.updated.emit();
|
|
4778
|
-
|
|
4956
|
+
import_log15.log.trace("dxos.echo.data-space-manager.open", import_protocols11.trace.end({
|
|
4779
4957
|
id: this._instanceId
|
|
4780
4958
|
}), {
|
|
4781
|
-
F:
|
|
4782
|
-
L:
|
|
4959
|
+
F: __dxlog_file18,
|
|
4960
|
+
L: 172,
|
|
4783
4961
|
S: this,
|
|
4784
4962
|
C: (f, a) => f(...a)
|
|
4785
4963
|
});
|
|
4786
4964
|
}
|
|
4787
4965
|
async close() {
|
|
4788
|
-
(0,
|
|
4789
|
-
F:
|
|
4790
|
-
L:
|
|
4966
|
+
(0, import_log15.log)("close", void 0, {
|
|
4967
|
+
F: __dxlog_file18,
|
|
4968
|
+
L: 177,
|
|
4791
4969
|
S: this,
|
|
4792
4970
|
C: (f, a) => f(...a)
|
|
4793
4971
|
});
|
|
@@ -4801,10 +4979,10 @@ var DataSpaceManager = class {
|
|
|
4801
4979
|
/**
|
|
4802
4980
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
4803
4981
|
*/
|
|
4804
|
-
async createSpace() {
|
|
4805
|
-
(0,
|
|
4806
|
-
F:
|
|
4807
|
-
L:
|
|
4982
|
+
async createSpace() {
|
|
4983
|
+
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
4984
|
+
F: __dxlog_file18,
|
|
4985
|
+
L: 191,
|
|
4808
4986
|
S: this,
|
|
4809
4987
|
A: [
|
|
4810
4988
|
"this._isOpen",
|
|
@@ -4819,13 +4997,13 @@ var DataSpaceManager = class {
|
|
|
4819
4997
|
genesisFeedKey: controlFeedKey,
|
|
4820
4998
|
controlFeedKey,
|
|
4821
4999
|
dataFeedKey,
|
|
4822
|
-
state:
|
|
5000
|
+
state: import_services14.SpaceState.ACTIVE
|
|
4823
5001
|
};
|
|
4824
|
-
(0,
|
|
5002
|
+
(0, import_log15.log)("creating space...", {
|
|
4825
5003
|
spaceKey
|
|
4826
5004
|
}, {
|
|
4827
|
-
F:
|
|
4828
|
-
L:
|
|
5005
|
+
F: __dxlog_file18,
|
|
5006
|
+
L: 203,
|
|
4829
5007
|
S: this,
|
|
4830
5008
|
C: (f, a) => f(...a)
|
|
4831
5009
|
});
|
|
@@ -4835,9 +5013,9 @@ var DataSpaceManager = class {
|
|
|
4835
5013
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
|
|
4836
5014
|
await this._metadataStore.addSpace(metadata);
|
|
4837
5015
|
const memberCredential = credentials[1];
|
|
4838
|
-
(0,
|
|
4839
|
-
F:
|
|
4840
|
-
L:
|
|
5016
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5017
|
+
F: __dxlog_file18,
|
|
5018
|
+
L: 213,
|
|
4841
5019
|
S: this,
|
|
4842
5020
|
A: [
|
|
4843
5021
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -4850,16 +5028,38 @@ var DataSpaceManager = class {
|
|
|
4850
5028
|
return space;
|
|
4851
5029
|
}
|
|
4852
5030
|
async isDefaultSpace(space) {
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
5031
|
+
if (!space.databaseRoot) {
|
|
5032
|
+
return false;
|
|
5033
|
+
}
|
|
5034
|
+
switch (space.databaseRoot.getVersion()) {
|
|
5035
|
+
case import_echo_protocol2.SpaceDocVersion.CURRENT: {
|
|
5036
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(space.databaseRoot.docSync(), import_echo_schema2.TYPE_PROPERTIES) ?? [];
|
|
5037
|
+
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5038
|
+
}
|
|
5039
|
+
case import_echo_protocol2.SpaceDocVersion.LEGACY: {
|
|
5040
|
+
const convertedDoc = await (0, import_echo_db2.convertLegacyReferences)(space.databaseRoot.docSync());
|
|
5041
|
+
const [_, properties] = (0, import_echo_db2.findInlineObjectOfType)(convertedDoc, import_echo_protocol2.LEGACY_TYPE_PROPERTIES) ?? [];
|
|
5042
|
+
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5043
|
+
}
|
|
5044
|
+
default:
|
|
5045
|
+
import_log15.log.warn("unknown space version", {
|
|
5046
|
+
version: space.databaseRoot.getVersion(),
|
|
5047
|
+
spaceId: space.id
|
|
5048
|
+
}, {
|
|
5049
|
+
F: __dxlog_file18,
|
|
5050
|
+
L: 238,
|
|
5051
|
+
S: this,
|
|
5052
|
+
C: (f, a) => f(...a)
|
|
5053
|
+
});
|
|
5054
|
+
return false;
|
|
5055
|
+
}
|
|
4856
5056
|
}
|
|
4857
5057
|
async createDefaultSpace() {
|
|
4858
5058
|
const space = await this.createSpace();
|
|
4859
5059
|
const document = await this._getSpaceRootDocument(space);
|
|
4860
5060
|
const properties = {
|
|
4861
5061
|
system: {
|
|
4862
|
-
type: (0,
|
|
5062
|
+
type: (0, import_echo_protocol2.encodeReference)((0, import_echo_schema2.getTypeReference)(import_client_protocol5.PropertiesType))
|
|
4863
5063
|
},
|
|
4864
5064
|
data: {
|
|
4865
5065
|
[DEFAULT_SPACE_KEY]: this._signingContext.identityKey.toHex()
|
|
@@ -4868,9 +5068,9 @@ var DataSpaceManager = class {
|
|
|
4868
5068
|
keys: []
|
|
4869
5069
|
}
|
|
4870
5070
|
};
|
|
4871
|
-
const propertiesId =
|
|
5071
|
+
const propertiesId = (0, import_echo_schema2.generateEchoId)();
|
|
4872
5072
|
document.change((doc) => {
|
|
4873
|
-
(0,
|
|
5073
|
+
(0, import_util10.assignDeep)(doc, [
|
|
4874
5074
|
"objects",
|
|
4875
5075
|
propertiesId
|
|
4876
5076
|
], properties);
|
|
@@ -4880,9 +5080,9 @@ var DataSpaceManager = class {
|
|
|
4880
5080
|
}
|
|
4881
5081
|
async _getSpaceRootDocument(space) {
|
|
4882
5082
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
4883
|
-
(0,
|
|
4884
|
-
F:
|
|
4885
|
-
L:
|
|
5083
|
+
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5084
|
+
F: __dxlog_file18,
|
|
5085
|
+
L: 271,
|
|
4886
5086
|
S: this,
|
|
4887
5087
|
A: [
|
|
4888
5088
|
"automergeIndex",
|
|
@@ -4895,26 +5095,26 @@ var DataSpaceManager = class {
|
|
|
4895
5095
|
}
|
|
4896
5096
|
// TODO(burdon): Rename join space.
|
|
4897
5097
|
async acceptSpace(opts) {
|
|
4898
|
-
(0,
|
|
5098
|
+
(0, import_log15.log)("accept space", {
|
|
4899
5099
|
opts
|
|
4900
5100
|
}, {
|
|
4901
|
-
F:
|
|
4902
|
-
L:
|
|
5101
|
+
F: __dxlog_file18,
|
|
5102
|
+
L: 280,
|
|
4903
5103
|
S: this,
|
|
4904
5104
|
C: (f, a) => f(...a)
|
|
4905
5105
|
});
|
|
4906
|
-
(0,
|
|
4907
|
-
F:
|
|
4908
|
-
L:
|
|
5106
|
+
(0, import_invariant15.invariant)(this._isOpen, "Not open.", {
|
|
5107
|
+
F: __dxlog_file18,
|
|
5108
|
+
L: 281,
|
|
4909
5109
|
S: this,
|
|
4910
5110
|
A: [
|
|
4911
5111
|
"this._isOpen",
|
|
4912
5112
|
"'Not open.'"
|
|
4913
5113
|
]
|
|
4914
5114
|
});
|
|
4915
|
-
(0,
|
|
4916
|
-
F:
|
|
4917
|
-
L:
|
|
5115
|
+
(0, import_invariant15.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5116
|
+
F: __dxlog_file18,
|
|
5117
|
+
L: 282,
|
|
4918
5118
|
S: this,
|
|
4919
5119
|
A: [
|
|
4920
5120
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -4934,23 +5134,72 @@ var DataSpaceManager = class {
|
|
|
4934
5134
|
this.updated.emit();
|
|
4935
5135
|
return space;
|
|
4936
5136
|
}
|
|
5137
|
+
async admitMember(options) {
|
|
5138
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5139
|
+
(0, import_invariant15.invariant)(space, void 0, {
|
|
5140
|
+
F: __dxlog_file18,
|
|
5141
|
+
L: 302,
|
|
5142
|
+
S: this,
|
|
5143
|
+
A: [
|
|
5144
|
+
"space",
|
|
5145
|
+
""
|
|
5146
|
+
]
|
|
5147
|
+
});
|
|
5148
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5149
|
+
throw new import_protocols11.AlreadyJoinedError();
|
|
5150
|
+
}
|
|
5151
|
+
const credentials = await (0, import_credentials15.createAdmissionCredentials)(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5152
|
+
(0, import_invariant15.invariant)(credentials[0].credential, void 0, {
|
|
5153
|
+
F: __dxlog_file18,
|
|
5154
|
+
L: 321,
|
|
5155
|
+
S: this,
|
|
5156
|
+
A: [
|
|
5157
|
+
"credentials[0].credential",
|
|
5158
|
+
""
|
|
5159
|
+
]
|
|
5160
|
+
});
|
|
5161
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5162
|
+
(0, import_invariant15.invariant)((0, import_credentials15.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5163
|
+
F: __dxlog_file18,
|
|
5164
|
+
L: 323,
|
|
5165
|
+
S: this,
|
|
5166
|
+
A: [
|
|
5167
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5168
|
+
""
|
|
5169
|
+
]
|
|
5170
|
+
});
|
|
5171
|
+
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5172
|
+
return spaceMemberCredential;
|
|
5173
|
+
}
|
|
4937
5174
|
/**
|
|
4938
5175
|
* Wait until the space data pipeline is fully initialized.
|
|
4939
5176
|
* Used by invitation handler.
|
|
4940
5177
|
* TODO(dmaretskyi): Consider removing.
|
|
4941
5178
|
*/
|
|
4942
5179
|
async waitUntilSpaceReady(spaceKey) {
|
|
4943
|
-
await (0,
|
|
5180
|
+
await (0, import_context14.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
4944
5181
|
const space = this._spaces.get(spaceKey);
|
|
4945
|
-
return !!space && space.state ===
|
|
5182
|
+
return !!space && space.state === import_services14.SpaceState.READY;
|
|
4946
5183
|
}));
|
|
4947
5184
|
}
|
|
5185
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5186
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5187
|
+
spaceKey,
|
|
5188
|
+
identityKey: this._signingContext.identityKey,
|
|
5189
|
+
timeout: 15e3,
|
|
5190
|
+
swarmIdentity: {
|
|
5191
|
+
peerKey: this._signingContext.deviceKey,
|
|
5192
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5193
|
+
credentialAuthenticator: async () => true
|
|
5194
|
+
}
|
|
5195
|
+
});
|
|
5196
|
+
}
|
|
4948
5197
|
async _constructSpace(metadata) {
|
|
4949
|
-
(0,
|
|
5198
|
+
(0, import_log15.log)("construct space", {
|
|
4950
5199
|
metadata
|
|
4951
5200
|
}, {
|
|
4952
|
-
F:
|
|
4953
|
-
L:
|
|
5201
|
+
F: __dxlog_file18,
|
|
5202
|
+
L: 358,
|
|
4954
5203
|
S: this,
|
|
4955
5204
|
C: (f, a) => f(...a)
|
|
4956
5205
|
});
|
|
@@ -4975,9 +5224,10 @@ var DataSpaceManager = class {
|
|
|
4975
5224
|
swarmIdentity: {
|
|
4976
5225
|
peerKey: this._signingContext.deviceKey,
|
|
4977
5226
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
4978
|
-
credentialAuthenticator: (0,
|
|
5227
|
+
credentialAuthenticator: (0, import_util10.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
4979
5228
|
},
|
|
4980
5229
|
onAuthorizedConnection: (session) => {
|
|
5230
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new import_echo_pipeline5.CredentialServerExtension(space));
|
|
4981
5231
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
4982
5232
|
remotePeerId: session.remotePeerId
|
|
4983
5233
|
}));
|
|
@@ -4986,15 +5236,15 @@ var DataSpaceManager = class {
|
|
|
4986
5236
|
session.addExtension("dxos.mesh.teleport.automerge", this._echoHost.createReplicationExtension());
|
|
4987
5237
|
},
|
|
4988
5238
|
onAuthFailure: () => {
|
|
4989
|
-
|
|
4990
|
-
F:
|
|
4991
|
-
L:
|
|
5239
|
+
import_log15.log.warn("auth failure", void 0, {
|
|
5240
|
+
F: __dxlog_file18,
|
|
5241
|
+
L: 396,
|
|
4992
5242
|
S: this,
|
|
4993
5243
|
C: (f, a) => f(...a)
|
|
4994
5244
|
});
|
|
4995
5245
|
},
|
|
4996
5246
|
onMemberRolesChanged: async (members) => {
|
|
4997
|
-
if (dataSpace?.state ===
|
|
5247
|
+
if (dataSpace?.state === import_services14.SpaceState.READY) {
|
|
4998
5248
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
4999
5249
|
}
|
|
5000
5250
|
},
|
|
@@ -5007,7 +5257,7 @@ var DataSpaceManager = class {
|
|
|
5007
5257
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
5008
5258
|
const dataSpace = new DataSpace({
|
|
5009
5259
|
inner: space,
|
|
5010
|
-
initialState: metadata.state ===
|
|
5260
|
+
initialState: metadata.state === import_services14.SpaceState.INACTIVE ? import_services14.SpaceState.INACTIVE : import_services14.SpaceState.CLOSED,
|
|
5011
5261
|
metadataStore: this._metadataStore,
|
|
5012
5262
|
gossip,
|
|
5013
5263
|
presence,
|
|
@@ -5017,22 +5267,22 @@ var DataSpaceManager = class {
|
|
|
5017
5267
|
signingContext: this._signingContext,
|
|
5018
5268
|
callbacks: {
|
|
5019
5269
|
beforeReady: async () => {
|
|
5020
|
-
(0,
|
|
5270
|
+
(0, import_log15.log)("before space ready", {
|
|
5021
5271
|
space: space.key
|
|
5022
5272
|
}, {
|
|
5023
|
-
F:
|
|
5024
|
-
L:
|
|
5273
|
+
F: __dxlog_file18,
|
|
5274
|
+
L: 423,
|
|
5025
5275
|
S: this,
|
|
5026
5276
|
C: (f, a) => f(...a)
|
|
5027
5277
|
});
|
|
5028
5278
|
},
|
|
5029
5279
|
afterReady: async () => {
|
|
5030
|
-
(0,
|
|
5280
|
+
(0, import_log15.log)("after space ready", {
|
|
5031
5281
|
space: space.key,
|
|
5032
5282
|
open: this._isOpen
|
|
5033
5283
|
}, {
|
|
5034
|
-
F:
|
|
5035
|
-
L:
|
|
5284
|
+
F: __dxlog_file18,
|
|
5285
|
+
L: 426,
|
|
5036
5286
|
S: this,
|
|
5037
5287
|
C: (f, a) => f(...a)
|
|
5038
5288
|
});
|
|
@@ -5047,11 +5297,11 @@ var DataSpaceManager = class {
|
|
|
5047
5297
|
}
|
|
5048
5298
|
},
|
|
5049
5299
|
beforeClose: async () => {
|
|
5050
|
-
(0,
|
|
5300
|
+
(0, import_log15.log)("before space close", {
|
|
5051
5301
|
space: space.key
|
|
5052
5302
|
}, {
|
|
5053
|
-
F:
|
|
5054
|
-
L:
|
|
5303
|
+
F: __dxlog_file18,
|
|
5304
|
+
L: 434,
|
|
5055
5305
|
S: this,
|
|
5056
5306
|
C: (f, a) => f(...a)
|
|
5057
5307
|
});
|
|
@@ -5060,7 +5310,7 @@ var DataSpaceManager = class {
|
|
|
5060
5310
|
cache: metadata.cache
|
|
5061
5311
|
});
|
|
5062
5312
|
presence.newPeer.on((peerState) => {
|
|
5063
|
-
if (dataSpace.state ===
|
|
5313
|
+
if (dataSpace.state === import_services14.SpaceState.READY) {
|
|
5064
5314
|
this._handleNewPeerConnected(space, peerState);
|
|
5065
5315
|
}
|
|
5066
5316
|
});
|
|
@@ -5079,20 +5329,20 @@ var DataSpaceManager = class {
|
|
|
5079
5329
|
const peers = presence.getPeersByIdentityKey(member.key);
|
|
5080
5330
|
const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
|
|
5081
5331
|
const sessionsToClose = sessions.filter((s) => {
|
|
5082
|
-
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus ===
|
|
5332
|
+
return (s && member.role === import_credentials16.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline4.AuthStatus.FAILURE)) ?? false;
|
|
5083
5333
|
});
|
|
5084
5334
|
sessionsToClose.forEach((session) => {
|
|
5085
|
-
void session.close().catch(
|
|
5335
|
+
void session.close().catch(import_log15.log.error);
|
|
5086
5336
|
});
|
|
5087
5337
|
closedSessions += sessionsToClose.length;
|
|
5088
5338
|
}
|
|
5089
|
-
(0,
|
|
5339
|
+
(0, import_log15.log)("processed member role changes", {
|
|
5090
5340
|
roleChangeCount: memberInfo.length,
|
|
5091
5341
|
peersOnline: presence.getPeersOnline().length,
|
|
5092
5342
|
closedSessions
|
|
5093
5343
|
}, {
|
|
5094
|
-
F:
|
|
5095
|
-
L:
|
|
5344
|
+
F: __dxlog_file18,
|
|
5345
|
+
L: 470,
|
|
5096
5346
|
S: this,
|
|
5097
5347
|
C: (f, a) => f(...a)
|
|
5098
5348
|
});
|
|
@@ -5103,20 +5353,20 @@ var DataSpaceManager = class {
|
|
|
5103
5353
|
if (role === import_credentials16.SpaceMember.Role.REMOVED) {
|
|
5104
5354
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
5105
5355
|
if (session != null) {
|
|
5106
|
-
(0,
|
|
5356
|
+
(0, import_log15.log)("closing a session with a removed peer", {
|
|
5107
5357
|
peerId: peerState.peerId
|
|
5108
5358
|
}, {
|
|
5109
|
-
F:
|
|
5110
|
-
L:
|
|
5359
|
+
F: __dxlog_file18,
|
|
5360
|
+
L: 484,
|
|
5111
5361
|
S: this,
|
|
5112
5362
|
C: (f, a) => f(...a)
|
|
5113
5363
|
});
|
|
5114
|
-
void session.close().catch(
|
|
5364
|
+
void session.close().catch(import_log15.log.error);
|
|
5115
5365
|
}
|
|
5116
5366
|
}
|
|
5117
5367
|
}
|
|
5118
5368
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
5119
|
-
if (dataSpace?.state !==
|
|
5369
|
+
if (dataSpace?.state !== import_services14.SpaceState.READY) {
|
|
5120
5370
|
return;
|
|
5121
5371
|
}
|
|
5122
5372
|
if (isActive) {
|
|
@@ -5133,8 +5383,8 @@ var DataSpaceManager = class {
|
|
|
5133
5383
|
async _createDelegatedInvitations(space, invitations) {
|
|
5134
5384
|
const tasks = invitations.map(([credentialId, invitation]) => {
|
|
5135
5385
|
return this._invitationsManager.createInvitation({
|
|
5136
|
-
type:
|
|
5137
|
-
kind:
|
|
5386
|
+
type: import_services14.Invitation.Type.DELEGATED,
|
|
5387
|
+
kind: import_services14.Invitation.Kind.SPACE,
|
|
5138
5388
|
spaceKey: space.key,
|
|
5139
5389
|
authMethod: invitation.authMethod,
|
|
5140
5390
|
invitationId: invitation.invitationId,
|
|
@@ -5152,21 +5402,21 @@ var DataSpaceManager = class {
|
|
|
5152
5402
|
}
|
|
5153
5403
|
};
|
|
5154
5404
|
_ts_decorate5([
|
|
5155
|
-
|
|
5405
|
+
import_async17.synchronized
|
|
5156
5406
|
], DataSpaceManager.prototype, "open", null);
|
|
5157
5407
|
_ts_decorate5([
|
|
5158
|
-
|
|
5408
|
+
import_async17.synchronized
|
|
5159
5409
|
], DataSpaceManager.prototype, "close", null);
|
|
5160
5410
|
_ts_decorate5([
|
|
5161
|
-
|
|
5411
|
+
import_async17.synchronized
|
|
5162
5412
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
5163
5413
|
_ts_decorate5([
|
|
5164
|
-
|
|
5414
|
+
import_async17.synchronized
|
|
5165
5415
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
5166
5416
|
DataSpaceManager = _ts_decorate5([
|
|
5167
|
-
(0,
|
|
5417
|
+
(0, import_async17.trackLeaks)("open", "close")
|
|
5168
5418
|
], DataSpaceManager);
|
|
5169
|
-
var
|
|
5419
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5170
5420
|
var SpacesServiceImpl = class {
|
|
5171
5421
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5172
5422
|
this._identityManager = _identityManager;
|
|
@@ -5185,10 +5435,10 @@ var SpacesServiceImpl = class {
|
|
|
5185
5435
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5186
5436
|
if (state) {
|
|
5187
5437
|
switch (state) {
|
|
5188
|
-
case
|
|
5438
|
+
case import_services15.SpaceState.ACTIVE:
|
|
5189
5439
|
await space.activate();
|
|
5190
5440
|
break;
|
|
5191
|
-
case
|
|
5441
|
+
case import_services15.SpaceState.INACTIVE:
|
|
5192
5442
|
await space.deactivate();
|
|
5193
5443
|
break;
|
|
5194
5444
|
default:
|
|
@@ -5209,9 +5459,9 @@ var SpacesServiceImpl = class {
|
|
|
5209
5459
|
});
|
|
5210
5460
|
}
|
|
5211
5461
|
const credentials = await (0, import_credentials19.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5212
|
-
(0,
|
|
5213
|
-
F:
|
|
5214
|
-
L:
|
|
5462
|
+
(0, import_invariant16.invariant)(credentials[0].credential, void 0, {
|
|
5463
|
+
F: __dxlog_file19,
|
|
5464
|
+
L: 102,
|
|
5215
5465
|
S: this,
|
|
5216
5466
|
A: [
|
|
5217
5467
|
"credentials[0].credential",
|
|
@@ -5219,27 +5469,27 @@ var SpacesServiceImpl = class {
|
|
|
5219
5469
|
]
|
|
5220
5470
|
});
|
|
5221
5471
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5222
|
-
(0,
|
|
5223
|
-
F:
|
|
5224
|
-
L:
|
|
5472
|
+
(0, import_invariant16.invariant)((0, import_credentials19.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5473
|
+
F: __dxlog_file19,
|
|
5474
|
+
L: 104,
|
|
5225
5475
|
S: this,
|
|
5226
5476
|
A: [
|
|
5227
5477
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5228
5478
|
""
|
|
5229
5479
|
]
|
|
5230
5480
|
});
|
|
5231
|
-
await (0,
|
|
5481
|
+
await (0, import_feed_store5.writeMessages)(space.controlPipeline.writer, credentials);
|
|
5232
5482
|
}
|
|
5233
5483
|
querySpaces() {
|
|
5234
5484
|
return new import_codec_protobuf11.Stream(({ next, ctx }) => {
|
|
5235
|
-
const scheduler = new
|
|
5485
|
+
const scheduler = new import_async18.UpdateScheduler(ctx, async () => {
|
|
5236
5486
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5237
5487
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
5238
|
-
(0,
|
|
5488
|
+
(0, import_log16.log)("update", {
|
|
5239
5489
|
spaces
|
|
5240
5490
|
}, {
|
|
5241
|
-
F:
|
|
5242
|
-
L:
|
|
5491
|
+
F: __dxlog_file19,
|
|
5492
|
+
L: 115,
|
|
5243
5493
|
S: this,
|
|
5244
5494
|
C: (f, a) => f(...a)
|
|
5245
5495
|
});
|
|
@@ -5250,14 +5500,22 @@ var SpacesServiceImpl = class {
|
|
|
5250
5500
|
}, {
|
|
5251
5501
|
maxFrequency: process.env.NODE_ENV === "test" ? void 0 : 2
|
|
5252
5502
|
});
|
|
5253
|
-
(0,
|
|
5503
|
+
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
5254
5504
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5255
|
-
const subscriptions = new
|
|
5505
|
+
const subscriptions = new import_async18.EventSubscriptions();
|
|
5256
5506
|
ctx.onDispose(() => subscriptions.clear());
|
|
5257
5507
|
const subscribeSpaces = () => {
|
|
5258
5508
|
subscriptions.clear();
|
|
5259
5509
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
5260
|
-
|
|
5510
|
+
let lastState;
|
|
5511
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => {
|
|
5512
|
+
if (space.state !== lastState) {
|
|
5513
|
+
scheduler.forceTrigger();
|
|
5514
|
+
} else {
|
|
5515
|
+
scheduler.trigger();
|
|
5516
|
+
}
|
|
5517
|
+
lastState = space.state;
|
|
5518
|
+
}));
|
|
5261
5519
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
5262
5520
|
subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
5263
5521
|
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
@@ -5284,7 +5542,7 @@ var SpacesServiceImpl = class {
|
|
|
5284
5542
|
}
|
|
5285
5543
|
subscribeMessages({ spaceKey, channel }) {
|
|
5286
5544
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
5287
|
-
(0,
|
|
5545
|
+
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
5288
5546
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5289
5547
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5290
5548
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
@@ -5303,7 +5561,7 @@ var SpacesServiceImpl = class {
|
|
|
5303
5561
|
}
|
|
5304
5562
|
};
|
|
5305
5563
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
5306
|
-
(0,
|
|
5564
|
+
(0, import_async18.scheduleTask)(ctx, async () => {
|
|
5307
5565
|
await space.spaceState.addCredentialProcessor(processor);
|
|
5308
5566
|
if (noTail) {
|
|
5309
5567
|
close();
|
|
@@ -5321,18 +5579,18 @@ var SpacesServiceImpl = class {
|
|
|
5321
5579
|
}
|
|
5322
5580
|
});
|
|
5323
5581
|
} else {
|
|
5324
|
-
(0,
|
|
5325
|
-
F:
|
|
5326
|
-
L:
|
|
5582
|
+
(0, import_invariant16.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5583
|
+
F: __dxlog_file19,
|
|
5584
|
+
L: 213,
|
|
5327
5585
|
S: this,
|
|
5328
5586
|
A: [
|
|
5329
5587
|
"!credential.id",
|
|
5330
5588
|
"'Id on unsigned credentials is not allowed'"
|
|
5331
5589
|
]
|
|
5332
5590
|
});
|
|
5333
|
-
(0,
|
|
5334
|
-
F:
|
|
5335
|
-
L:
|
|
5591
|
+
(0, import_invariant16.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
5592
|
+
F: __dxlog_file19,
|
|
5593
|
+
L: 214,
|
|
5336
5594
|
S: this,
|
|
5337
5595
|
A: [
|
|
5338
5596
|
"this._identityManager.identity",
|
|
@@ -5340,9 +5598,9 @@ var SpacesServiceImpl = class {
|
|
|
5340
5598
|
]
|
|
5341
5599
|
});
|
|
5342
5600
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5343
|
-
(0,
|
|
5344
|
-
F:
|
|
5345
|
-
L:
|
|
5601
|
+
(0, import_invariant16.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5602
|
+
F: __dxlog_file19,
|
|
5603
|
+
L: 216,
|
|
5346
5604
|
S: this,
|
|
5347
5605
|
A: [
|
|
5348
5606
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5364,10 +5622,66 @@ var SpacesServiceImpl = class {
|
|
|
5364
5622
|
async createEpoch({ spaceKey, migration, automergeRootUrl }) {
|
|
5365
5623
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5366
5624
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5367
|
-
await space.createEpoch({
|
|
5625
|
+
const credential = await space.createEpoch({
|
|
5368
5626
|
migration,
|
|
5369
5627
|
newAutomergeRoot: automergeRootUrl
|
|
5370
5628
|
});
|
|
5629
|
+
return {
|
|
5630
|
+
epochCredential: credential ?? void 0
|
|
5631
|
+
};
|
|
5632
|
+
}
|
|
5633
|
+
async admitContact(request) {
|
|
5634
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5635
|
+
await dataSpaceManager.admitMember({
|
|
5636
|
+
spaceKey: request.spaceKey,
|
|
5637
|
+
identityKey: request.contact.identityKey,
|
|
5638
|
+
role: request.role
|
|
5639
|
+
});
|
|
5640
|
+
}
|
|
5641
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5642
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5643
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5644
|
+
return this._joinByAdmission({
|
|
5645
|
+
credential
|
|
5646
|
+
});
|
|
5647
|
+
}
|
|
5648
|
+
async _joinByAdmission({ credential }) {
|
|
5649
|
+
const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
|
|
5650
|
+
(0, import_invariant16.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5651
|
+
F: __dxlog_file19,
|
|
5652
|
+
L: 250,
|
|
5653
|
+
S: this,
|
|
5654
|
+
A: [
|
|
5655
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5656
|
+
"'Invalid credential'"
|
|
5657
|
+
]
|
|
5658
|
+
});
|
|
5659
|
+
const myIdentity = this._identityManager.identity;
|
|
5660
|
+
(0, import_invariant16.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5661
|
+
F: __dxlog_file19,
|
|
5662
|
+
L: 252,
|
|
5663
|
+
S: this,
|
|
5664
|
+
A: [
|
|
5665
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5666
|
+
""
|
|
5667
|
+
]
|
|
5668
|
+
});
|
|
5669
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5670
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5671
|
+
if (!dataSpace) {
|
|
5672
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5673
|
+
spaceKey: assertion.spaceKey,
|
|
5674
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5675
|
+
});
|
|
5676
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5677
|
+
credential: {
|
|
5678
|
+
credential
|
|
5679
|
+
}
|
|
5680
|
+
});
|
|
5681
|
+
}
|
|
5682
|
+
return {
|
|
5683
|
+
space: this._serializeSpace(dataSpace)
|
|
5684
|
+
};
|
|
5371
5685
|
}
|
|
5372
5686
|
_serializeSpace(space) {
|
|
5373
5687
|
return {
|
|
@@ -5400,7 +5714,7 @@ var SpacesServiceImpl = class {
|
|
|
5400
5714
|
profile: member.profile ?? {}
|
|
5401
5715
|
},
|
|
5402
5716
|
role: member.role,
|
|
5403
|
-
presence: peers.length > 0 ?
|
|
5717
|
+
presence: peers.length > 0 ? import_services15.SpaceMember.PresenceState.ONLINE : import_services15.SpaceMember.PresenceState.OFFLINE,
|
|
5404
5718
|
peerStates: peers
|
|
5405
5719
|
};
|
|
5406
5720
|
}),
|
|
@@ -5438,8 +5752,8 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5438
5752
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5439
5753
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5440
5754
|
}
|
|
5441
|
-
var
|
|
5442
|
-
var ServiceContext = class extends
|
|
5755
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5756
|
+
var ServiceContext = class extends import_context15.Resource {
|
|
5443
5757
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5444
5758
|
super();
|
|
5445
5759
|
this.storage = storage;
|
|
@@ -5447,24 +5761,24 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5447
5761
|
this.networkManager = networkManager;
|
|
5448
5762
|
this.signalManager = signalManager;
|
|
5449
5763
|
this._runtimeParams = _runtimeParams;
|
|
5450
|
-
this.initialized = new
|
|
5764
|
+
this.initialized = new import_async19.Trigger();
|
|
5451
5765
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
5452
5766
|
this._instanceId = import_keys13.PublicKey.random().toHex();
|
|
5453
|
-
this.metadataStore = new
|
|
5454
|
-
this.snapshotStore = new
|
|
5767
|
+
this.metadataStore = new import_echo_pipeline6.MetadataStore(storage.createDirectory("metadata"));
|
|
5768
|
+
this.snapshotStore = new import_echo_pipeline6.SnapshotStore(storage.createDirectory("snapshots"));
|
|
5455
5769
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
5456
5770
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
5457
|
-
this.feedStore = new
|
|
5458
|
-
factory: new
|
|
5771
|
+
this.feedStore = new import_feed_store6.FeedStore({
|
|
5772
|
+
factory: new import_feed_store6.FeedFactory({
|
|
5459
5773
|
root: storage.createDirectory("feeds"),
|
|
5460
5774
|
signer: this.keyring,
|
|
5461
5775
|
hypercore: {
|
|
5462
|
-
valueEncoding:
|
|
5776
|
+
valueEncoding: import_echo_pipeline6.valueEncoding,
|
|
5463
5777
|
stats: true
|
|
5464
5778
|
}
|
|
5465
5779
|
})
|
|
5466
5780
|
});
|
|
5467
|
-
this.spaceManager = new
|
|
5781
|
+
this.spaceManager = new import_echo_pipeline6.SpaceManager({
|
|
5468
5782
|
feedStore: this.feedStore,
|
|
5469
5783
|
networkManager: this.networkManager,
|
|
5470
5784
|
blobStore: this.blobStore,
|
|
@@ -5472,27 +5786,26 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5472
5786
|
snapshotStore: this.snapshotStore
|
|
5473
5787
|
});
|
|
5474
5788
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
5475
|
-
this.echoHost = new
|
|
5476
|
-
kv: this.level
|
|
5477
|
-
storage: this.storage
|
|
5789
|
+
this.echoHost = new import_echo_db3.EchoHost({
|
|
5790
|
+
kv: this.level
|
|
5478
5791
|
});
|
|
5479
5792
|
this.invitations = new InvitationsHandler(this.networkManager, _runtimeParams?.invitationConnectionDefaultParams);
|
|
5480
5793
|
this.invitationsManager = new InvitationsManager(this.invitations, (invitation) => this.getInvitationHandler(invitation), this.metadataStore);
|
|
5481
|
-
this._handlerFactories.set(
|
|
5794
|
+
this._handlerFactories.set(import_services16.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
5482
5795
|
}
|
|
5483
5796
|
async _open(ctx) {
|
|
5484
5797
|
await this._checkStorageVersion();
|
|
5485
|
-
(0,
|
|
5486
|
-
F:
|
|
5487
|
-
L:
|
|
5798
|
+
(0, import_log17.log)("opening...", void 0, {
|
|
5799
|
+
F: __dxlog_file20,
|
|
5800
|
+
L: 149,
|
|
5488
5801
|
S: this,
|
|
5489
5802
|
C: (f, a) => f(...a)
|
|
5490
5803
|
});
|
|
5491
|
-
|
|
5804
|
+
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.begin({
|
|
5492
5805
|
id: this._instanceId
|
|
5493
5806
|
}), {
|
|
5494
|
-
F:
|
|
5495
|
-
L:
|
|
5807
|
+
F: __dxlog_file20,
|
|
5808
|
+
L: 150,
|
|
5496
5809
|
S: this,
|
|
5497
5810
|
C: (f, a) => f(...a)
|
|
5498
5811
|
});
|
|
@@ -5506,33 +5819,33 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5506
5819
|
await this._initialize(ctx);
|
|
5507
5820
|
}
|
|
5508
5821
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
5509
|
-
(0,
|
|
5822
|
+
(0, import_log17.log)("loaded persistent invitations", {
|
|
5510
5823
|
count: loadedInvitations.invitations?.length
|
|
5511
5824
|
}, {
|
|
5512
|
-
F:
|
|
5513
|
-
L:
|
|
5825
|
+
F: __dxlog_file20,
|
|
5826
|
+
L: 163,
|
|
5514
5827
|
S: this,
|
|
5515
5828
|
C: (f, a) => f(...a)
|
|
5516
5829
|
});
|
|
5517
|
-
|
|
5830
|
+
import_log17.log.trace("dxos.sdk.service-context.open", import_protocols13.trace.end({
|
|
5518
5831
|
id: this._instanceId
|
|
5519
5832
|
}), {
|
|
5520
|
-
F:
|
|
5521
|
-
L:
|
|
5833
|
+
F: __dxlog_file20,
|
|
5834
|
+
L: 165,
|
|
5522
5835
|
S: this,
|
|
5523
5836
|
C: (f, a) => f(...a)
|
|
5524
5837
|
});
|
|
5525
|
-
(0,
|
|
5526
|
-
F:
|
|
5527
|
-
L:
|
|
5838
|
+
(0, import_log17.log)("opened", void 0, {
|
|
5839
|
+
F: __dxlog_file20,
|
|
5840
|
+
L: 166,
|
|
5528
5841
|
S: this,
|
|
5529
5842
|
C: (f, a) => f(...a)
|
|
5530
5843
|
});
|
|
5531
5844
|
}
|
|
5532
5845
|
async _close(ctx) {
|
|
5533
|
-
(0,
|
|
5534
|
-
F:
|
|
5535
|
-
L:
|
|
5846
|
+
(0, import_log17.log)("closing...", void 0, {
|
|
5847
|
+
F: __dxlog_file20,
|
|
5848
|
+
L: 170,
|
|
5536
5849
|
S: this,
|
|
5537
5850
|
C: (f, a) => f(...a)
|
|
5538
5851
|
});
|
|
@@ -5547,23 +5860,26 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5547
5860
|
await this.echoHost.close(ctx);
|
|
5548
5861
|
await this.networkManager.close();
|
|
5549
5862
|
await this.signalManager.close();
|
|
5550
|
-
(0,
|
|
5551
|
-
F:
|
|
5552
|
-
L:
|
|
5863
|
+
(0, import_log17.log)("closed", void 0, {
|
|
5864
|
+
F: __dxlog_file20,
|
|
5865
|
+
L: 182,
|
|
5553
5866
|
S: this,
|
|
5554
5867
|
C: (f, a) => f(...a)
|
|
5555
5868
|
});
|
|
5556
5869
|
}
|
|
5557
5870
|
async createIdentity(params = {}) {
|
|
5558
5871
|
const identity = await this.identityManager.createIdentity(params);
|
|
5559
|
-
await this._initialize(new
|
|
5872
|
+
await this._initialize(new import_context15.Context(void 0, {
|
|
5873
|
+
F: __dxlog_file20,
|
|
5874
|
+
L: 187
|
|
5875
|
+
}));
|
|
5560
5876
|
return identity;
|
|
5561
5877
|
}
|
|
5562
5878
|
getInvitationHandler(invitation) {
|
|
5563
5879
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5564
|
-
(0,
|
|
5565
|
-
F:
|
|
5566
|
-
L:
|
|
5880
|
+
(0, import_invariant17.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5881
|
+
F: __dxlog_file20,
|
|
5882
|
+
L: 193,
|
|
5567
5883
|
S: this,
|
|
5568
5884
|
A: [
|
|
5569
5885
|
"factory",
|
|
@@ -5582,7 +5898,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5582
5898
|
}
|
|
5583
5899
|
async _acceptIdentity(params) {
|
|
5584
5900
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5585
|
-
await this._initialize(new
|
|
5901
|
+
await this._initialize(new import_context15.Context(void 0, {
|
|
5902
|
+
F: __dxlog_file20,
|
|
5903
|
+
L: 209
|
|
5904
|
+
}));
|
|
5586
5905
|
return identity;
|
|
5587
5906
|
}
|
|
5588
5907
|
async _checkStorageVersion() {
|
|
@@ -5593,9 +5912,9 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5593
5912
|
}
|
|
5594
5913
|
// Called when identity is created.
|
|
5595
5914
|
async _initialize(ctx) {
|
|
5596
|
-
(0,
|
|
5597
|
-
F:
|
|
5598
|
-
L:
|
|
5915
|
+
(0, import_log17.log)("initializing spaces...", void 0, {
|
|
5916
|
+
F: __dxlog_file20,
|
|
5917
|
+
L: 224,
|
|
5599
5918
|
S: this,
|
|
5600
5919
|
C: (f, a) => f(...a)
|
|
5601
5920
|
});
|
|
@@ -5615,10 +5934,10 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5615
5934
|
};
|
|
5616
5935
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.echoHost, this.invitationsManager, this._runtimeParams);
|
|
5617
5936
|
await this.dataSpaceManager.open();
|
|
5618
|
-
this._handlerFactories.set(
|
|
5619
|
-
(0,
|
|
5620
|
-
F:
|
|
5621
|
-
L:
|
|
5937
|
+
this._handlerFactories.set(import_services16.Invitation.Kind.SPACE, (invitation) => {
|
|
5938
|
+
(0, import_invariant17.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5939
|
+
F: __dxlog_file20,
|
|
5940
|
+
L: 249,
|
|
5622
5941
|
S: this,
|
|
5623
5942
|
A: [
|
|
5624
5943
|
"this.dataSpaceManager",
|
|
@@ -5638,33 +5957,33 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5638
5957
|
return;
|
|
5639
5958
|
}
|
|
5640
5959
|
if (!this.dataSpaceManager) {
|
|
5641
|
-
(0,
|
|
5960
|
+
(0, import_log17.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5642
5961
|
details: assertion
|
|
5643
5962
|
}, {
|
|
5644
|
-
F:
|
|
5645
|
-
L:
|
|
5963
|
+
F: __dxlog_file20,
|
|
5964
|
+
L: 265,
|
|
5646
5965
|
S: this,
|
|
5647
5966
|
C: (f, a) => f(...a)
|
|
5648
5967
|
});
|
|
5649
5968
|
return;
|
|
5650
5969
|
}
|
|
5651
5970
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
5652
|
-
(0,
|
|
5971
|
+
(0, import_log17.log)("space already exists, ignoring space admission", {
|
|
5653
5972
|
details: assertion
|
|
5654
5973
|
}, {
|
|
5655
|
-
F:
|
|
5656
|
-
L:
|
|
5974
|
+
F: __dxlog_file20,
|
|
5975
|
+
L: 269,
|
|
5657
5976
|
S: this,
|
|
5658
5977
|
C: (f, a) => f(...a)
|
|
5659
5978
|
});
|
|
5660
5979
|
return;
|
|
5661
5980
|
}
|
|
5662
5981
|
try {
|
|
5663
|
-
(0,
|
|
5982
|
+
(0, import_log17.log)("accepting space recorded in halo", {
|
|
5664
5983
|
details: assertion
|
|
5665
5984
|
}, {
|
|
5666
|
-
F:
|
|
5667
|
-
L:
|
|
5985
|
+
F: __dxlog_file20,
|
|
5986
|
+
L: 274,
|
|
5668
5987
|
S: this,
|
|
5669
5988
|
C: (f, a) => f(...a)
|
|
5670
5989
|
});
|
|
@@ -5673,9 +5992,9 @@ var ServiceContext = class extends import_context13.Resource {
|
|
|
5673
5992
|
genesisFeedKey: assertion.genesisFeedKey
|
|
5674
5993
|
});
|
|
5675
5994
|
} catch (err) {
|
|
5676
|
-
|
|
5677
|
-
F:
|
|
5678
|
-
L:
|
|
5995
|
+
import_log17.log.catch(err, void 0, {
|
|
5996
|
+
F: __dxlog_file20,
|
|
5997
|
+
L: 280,
|
|
5679
5998
|
S: this,
|
|
5680
5999
|
C: (f, a) => f(...a)
|
|
5681
6000
|
});
|
|
@@ -5692,7 +6011,7 @@ _ts_decorate6([
|
|
|
5692
6011
|
import_tracing8.trace.span()
|
|
5693
6012
|
], ServiceContext.prototype, "_initialize", null);
|
|
5694
6013
|
ServiceContext = _ts_decorate6([
|
|
5695
|
-
(0,
|
|
6014
|
+
(0, import_util11.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
5696
6015
|
import_tracing8.trace.resource()
|
|
5697
6016
|
], ServiceContext);
|
|
5698
6017
|
var ServiceRegistry = class {
|
|
@@ -5727,7 +6046,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5727
6046
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5728
6047
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5729
6048
|
}
|
|
5730
|
-
var
|
|
6049
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
5731
6050
|
var Lock = class {
|
|
5732
6051
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
5733
6052
|
this._lockPath = lockPath;
|
|
@@ -5738,16 +6057,16 @@ var Lock = class {
|
|
|
5738
6057
|
return this._lockPath;
|
|
5739
6058
|
}
|
|
5740
6059
|
async acquire() {
|
|
5741
|
-
(0,
|
|
5742
|
-
F:
|
|
6060
|
+
(0, import_log18.log)("acquiring lock...", void 0, {
|
|
6061
|
+
F: __dxlog_file21,
|
|
5743
6062
|
L: 32,
|
|
5744
6063
|
S: this,
|
|
5745
6064
|
C: (f, a) => f(...a)
|
|
5746
6065
|
});
|
|
5747
6066
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
5748
6067
|
await this._onAcquire?.();
|
|
5749
|
-
(0,
|
|
5750
|
-
F:
|
|
6068
|
+
(0, import_log18.log)("acquired lock", void 0, {
|
|
6069
|
+
F: __dxlog_file21,
|
|
5751
6070
|
L: 37,
|
|
5752
6071
|
S: this,
|
|
5753
6072
|
C: (f, a) => f(...a)
|
|
@@ -5755,8 +6074,8 @@ var Lock = class {
|
|
|
5755
6074
|
}
|
|
5756
6075
|
async release() {
|
|
5757
6076
|
await this._onRelease?.();
|
|
5758
|
-
(0,
|
|
5759
|
-
F:
|
|
6077
|
+
(0, import_invariant18.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
6078
|
+
F: __dxlog_file21,
|
|
5760
6079
|
L: 42,
|
|
5761
6080
|
S: this,
|
|
5762
6081
|
A: [
|
|
@@ -5768,11 +6087,11 @@ var Lock = class {
|
|
|
5768
6087
|
}
|
|
5769
6088
|
};
|
|
5770
6089
|
_ts_decorate7([
|
|
5771
|
-
|
|
6090
|
+
import_log18.logInfo
|
|
5772
6091
|
], Lock.prototype, "lockKey", null);
|
|
5773
6092
|
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
5774
6093
|
var getRootPath = (config) => {
|
|
5775
|
-
const { dataRoot = (0,
|
|
6094
|
+
const { dataRoot = (0, import_util12.isNode)() ? import_client_protocol6.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5776
6095
|
return `${dataRoot}/`;
|
|
5777
6096
|
};
|
|
5778
6097
|
var isPersistent = (config) => {
|
|
@@ -5828,7 +6147,138 @@ var createLevel = async (config) => {
|
|
|
5828
6147
|
await level.open();
|
|
5829
6148
|
return level;
|
|
5830
6149
|
};
|
|
5831
|
-
var
|
|
6150
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6151
|
+
var encodeProfileArchive = (profile) => import_automerge_repo.cbor.encode(profile);
|
|
6152
|
+
var decodeProfileArchive = (data) => import_automerge_repo.cbor.decode(data);
|
|
6153
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6154
|
+
const archive = {
|
|
6155
|
+
storage: [],
|
|
6156
|
+
meta: {
|
|
6157
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6158
|
+
}
|
|
6159
|
+
};
|
|
6160
|
+
{
|
|
6161
|
+
const directory = await storage.createDirectory();
|
|
6162
|
+
const files = await directory.list();
|
|
6163
|
+
import_log19.log.info("begin exporting files", {
|
|
6164
|
+
count: files.length
|
|
6165
|
+
}, {
|
|
6166
|
+
F: __dxlog_file22,
|
|
6167
|
+
L: 30,
|
|
6168
|
+
S: void 0,
|
|
6169
|
+
C: (f, a) => f(...a)
|
|
6170
|
+
});
|
|
6171
|
+
for (const filename of files) {
|
|
6172
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6173
|
+
const { size } = await file.stat();
|
|
6174
|
+
const data = await file.read(0, size);
|
|
6175
|
+
archive.storage.push({
|
|
6176
|
+
type: import_protocols15.ProfileArchiveEntryType.FILE,
|
|
6177
|
+
key: filename,
|
|
6178
|
+
value: data
|
|
6179
|
+
});
|
|
6180
|
+
}
|
|
6181
|
+
import_log19.log.info("done exporting files", {
|
|
6182
|
+
count: files.length
|
|
6183
|
+
}, {
|
|
6184
|
+
F: __dxlog_file22,
|
|
6185
|
+
L: 41,
|
|
6186
|
+
S: void 0,
|
|
6187
|
+
C: (f, a) => f(...a)
|
|
6188
|
+
});
|
|
6189
|
+
}
|
|
6190
|
+
{
|
|
6191
|
+
import_log19.log.info("begin exporting kv pairs", void 0, {
|
|
6192
|
+
F: __dxlog_file22,
|
|
6193
|
+
L: 45,
|
|
6194
|
+
S: void 0,
|
|
6195
|
+
C: (f, a) => f(...a)
|
|
6196
|
+
});
|
|
6197
|
+
const iter = await level.iterator({
|
|
6198
|
+
keyEncoding: "binary",
|
|
6199
|
+
valueEncoding: "binary"
|
|
6200
|
+
});
|
|
6201
|
+
let count = 0;
|
|
6202
|
+
for await (const [key, value] of iter) {
|
|
6203
|
+
archive.storage.push({
|
|
6204
|
+
type: import_protocols15.ProfileArchiveEntryType.KEY_VALUE,
|
|
6205
|
+
key,
|
|
6206
|
+
value
|
|
6207
|
+
});
|
|
6208
|
+
count++;
|
|
6209
|
+
}
|
|
6210
|
+
import_log19.log.info("done exporting kv pairs", {
|
|
6211
|
+
count
|
|
6212
|
+
}, {
|
|
6213
|
+
F: __dxlog_file22,
|
|
6214
|
+
L: 56,
|
|
6215
|
+
S: void 0,
|
|
6216
|
+
C: (f, a) => f(...a)
|
|
6217
|
+
});
|
|
6218
|
+
}
|
|
6219
|
+
return archive;
|
|
6220
|
+
};
|
|
6221
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6222
|
+
const batch = level.batch();
|
|
6223
|
+
for (const entry2 of archive.storage) {
|
|
6224
|
+
switch (entry2.type) {
|
|
6225
|
+
case import_protocols15.ProfileArchiveEntryType.FILE: {
|
|
6226
|
+
const directory = await storage.createDirectory();
|
|
6227
|
+
(0, import_invariant19.invariant)(typeof entry2.key === "string", "Invalid key type", {
|
|
6228
|
+
F: __dxlog_file22,
|
|
6229
|
+
L: 78,
|
|
6230
|
+
S: void 0,
|
|
6231
|
+
A: [
|
|
6232
|
+
"typeof entry.key === 'string'",
|
|
6233
|
+
"'Invalid key type'"
|
|
6234
|
+
]
|
|
6235
|
+
});
|
|
6236
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6237
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6238
|
+
F: __dxlog_file22,
|
|
6239
|
+
L: 80,
|
|
6240
|
+
S: void 0,
|
|
6241
|
+
A: [
|
|
6242
|
+
"entry.value instanceof Uint8Array",
|
|
6243
|
+
"'Invalid value type'"
|
|
6244
|
+
]
|
|
6245
|
+
});
|
|
6246
|
+
await file.write(0, (0, import_util13.arrayToBuffer)(entry2.value));
|
|
6247
|
+
await file.close();
|
|
6248
|
+
break;
|
|
6249
|
+
}
|
|
6250
|
+
case import_protocols15.ProfileArchiveEntryType.KEY_VALUE: {
|
|
6251
|
+
(0, import_invariant19.invariant)(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6252
|
+
F: __dxlog_file22,
|
|
6253
|
+
L: 86,
|
|
6254
|
+
S: void 0,
|
|
6255
|
+
A: [
|
|
6256
|
+
"entry.key instanceof Uint8Array",
|
|
6257
|
+
"'Invalid key type'"
|
|
6258
|
+
]
|
|
6259
|
+
});
|
|
6260
|
+
(0, import_invariant19.invariant)(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6261
|
+
F: __dxlog_file22,
|
|
6262
|
+
L: 87,
|
|
6263
|
+
S: void 0,
|
|
6264
|
+
A: [
|
|
6265
|
+
"entry.value instanceof Uint8Array",
|
|
6266
|
+
"'Invalid value type'"
|
|
6267
|
+
]
|
|
6268
|
+
});
|
|
6269
|
+
batch.put(entry2.key, entry2.value, {
|
|
6270
|
+
keyEncoding: "binary",
|
|
6271
|
+
valueEncoding: "binary"
|
|
6272
|
+
});
|
|
6273
|
+
break;
|
|
6274
|
+
}
|
|
6275
|
+
default:
|
|
6276
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
await batch.write();
|
|
6280
|
+
};
|
|
6281
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
5832
6282
|
var DevicesServiceImpl = class {
|
|
5833
6283
|
constructor(_identityManager) {
|
|
5834
6284
|
this._identityManager = _identityManager;
|
|
@@ -5845,8 +6295,8 @@ var DevicesServiceImpl = class {
|
|
|
5845
6295
|
devices: []
|
|
5846
6296
|
});
|
|
5847
6297
|
} else {
|
|
5848
|
-
(0,
|
|
5849
|
-
F:
|
|
6298
|
+
(0, import_invariant21.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
6299
|
+
F: __dxlog_file23,
|
|
5850
6300
|
L: 32,
|
|
5851
6301
|
S: this,
|
|
5852
6302
|
A: [
|
|
@@ -5861,9 +6311,9 @@ var DevicesServiceImpl = class {
|
|
|
5861
6311
|
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
5862
6312
|
return {
|
|
5863
6313
|
deviceKey: key,
|
|
5864
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
6314
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services18.DeviceKind.CURRENT : import_services18.DeviceKind.TRUSTED,
|
|
5865
6315
|
profile,
|
|
5866
|
-
presence: isMe ?
|
|
6316
|
+
presence: isMe ? import_services18.Device.PresenceState.ONLINE : peerState ? import_services18.Device.PresenceState.ONLINE : import_services18.Device.PresenceState.OFFLINE
|
|
5867
6317
|
};
|
|
5868
6318
|
})
|
|
5869
6319
|
});
|
|
@@ -5887,7 +6337,7 @@ var DevicesServiceImpl = class {
|
|
|
5887
6337
|
presenceSubscribed = true;
|
|
5888
6338
|
}
|
|
5889
6339
|
};
|
|
5890
|
-
const subscriptions = new
|
|
6340
|
+
const subscriptions = new import_async21.EventSubscriptions();
|
|
5891
6341
|
if (this._identityManager.identity) {
|
|
5892
6342
|
subscribeIdentity();
|
|
5893
6343
|
subscribePresence();
|
|
@@ -5912,7 +6362,7 @@ var DiagnosticsCollector = class {
|
|
|
5912
6362
|
}
|
|
5913
6363
|
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
5914
6364
|
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
5915
|
-
keys: options.humanize ?
|
|
6365
|
+
keys: options.humanize ? import_services19.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services19.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
5916
6366
|
}, {
|
|
5917
6367
|
timeout: GET_DIAGNOSTICS_RPC_TIMEOUT
|
|
5918
6368
|
});
|
|
@@ -5927,7 +6377,7 @@ var DiagnosticsCollector = class {
|
|
|
5927
6377
|
client: clientDiagnostics,
|
|
5928
6378
|
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
5929
6379
|
};
|
|
5930
|
-
return JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6380
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util14.jsonKeyReplacer)(options)));
|
|
5931
6381
|
}
|
|
5932
6382
|
};
|
|
5933
6383
|
var findSystemServiceProvider = () => {
|
|
@@ -5937,35 +6387,112 @@ var findSystemServiceProvider = () => {
|
|
|
5937
6387
|
};
|
|
5938
6388
|
var findConfigs = () => {
|
|
5939
6389
|
const configs = import_tracing10.TRACE_PROCESSOR.findResourcesByAnnotation(import_config3.ConfigResource);
|
|
5940
|
-
return configs.map((r) => r.instance.deref()).filter(
|
|
6390
|
+
return configs.map((r) => r.instance.deref()).filter(import_util14.nonNullable);
|
|
6391
|
+
};
|
|
6392
|
+
var ContactsServiceImpl = class {
|
|
6393
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6394
|
+
this._identityManager = _identityManager;
|
|
6395
|
+
this._spaceManager = _spaceManager;
|
|
6396
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6397
|
+
}
|
|
6398
|
+
async getContacts() {
|
|
6399
|
+
const identity = this._identityManager.identity;
|
|
6400
|
+
if (identity == null) {
|
|
6401
|
+
return {
|
|
6402
|
+
contacts: []
|
|
6403
|
+
};
|
|
6404
|
+
}
|
|
6405
|
+
const contacts = [
|
|
6406
|
+
...this._spaceManager.spaces.values()
|
|
6407
|
+
].flatMap((s) => [
|
|
6408
|
+
...s.spaceState.members.values()
|
|
6409
|
+
].map((m) => [
|
|
6410
|
+
s.key,
|
|
6411
|
+
m
|
|
6412
|
+
])).reduce((acc, v) => {
|
|
6413
|
+
const [spaceKey, memberInfo] = v;
|
|
6414
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6415
|
+
return acc;
|
|
6416
|
+
}
|
|
6417
|
+
const existing = acc.get(memberInfo.key);
|
|
6418
|
+
if (existing != null) {
|
|
6419
|
+
existing.profile ??= memberInfo.profile;
|
|
6420
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6421
|
+
} else {
|
|
6422
|
+
acc.set(memberInfo.key, {
|
|
6423
|
+
identityKey: memberInfo.key,
|
|
6424
|
+
profile: memberInfo.profile,
|
|
6425
|
+
commonSpaces: [
|
|
6426
|
+
spaceKey
|
|
6427
|
+
]
|
|
6428
|
+
});
|
|
6429
|
+
}
|
|
6430
|
+
return acc;
|
|
6431
|
+
}, new import_util16.ComplexMap(import_keys17.PublicKey.hash));
|
|
6432
|
+
return {
|
|
6433
|
+
contacts: [
|
|
6434
|
+
...contacts.values()
|
|
6435
|
+
]
|
|
6436
|
+
};
|
|
6437
|
+
}
|
|
6438
|
+
queryContacts() {
|
|
6439
|
+
const subscribedSpaceKeySet = new import_util16.ComplexSet(import_keys17.PublicKey.hash);
|
|
6440
|
+
return new import_codec_protobuf13.Stream(({ next, ctx }) => {
|
|
6441
|
+
const pushUpdateTask = new import_async22.UpdateScheduler(ctx, async () => {
|
|
6442
|
+
const contacts = await this.getContacts();
|
|
6443
|
+
next(contacts);
|
|
6444
|
+
}, {
|
|
6445
|
+
maxFrequency: 2
|
|
6446
|
+
});
|
|
6447
|
+
(0, import_async22.scheduleTask)(ctx, async () => {
|
|
6448
|
+
const subscriptions = new import_async22.EventSubscriptions();
|
|
6449
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6450
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6451
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6452
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6453
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6454
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6455
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6459
|
+
pushUpdateTask.trigger();
|
|
6460
|
+
}
|
|
6461
|
+
};
|
|
6462
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6463
|
+
ctx.onDispose(unsubscribe);
|
|
6464
|
+
subscribeToSpaceAndUpdate();
|
|
6465
|
+
});
|
|
6466
|
+
});
|
|
6467
|
+
}
|
|
5941
6468
|
};
|
|
5942
6469
|
var LoggingServiceImpl = class {
|
|
5943
6470
|
constructor() {
|
|
5944
|
-
this._logs = new
|
|
6471
|
+
this._logs = new import_async23.Event();
|
|
5945
6472
|
this._started = Date.now();
|
|
5946
|
-
this._sessionId =
|
|
6473
|
+
this._sessionId = import_keys18.PublicKey.random().toHex();
|
|
5947
6474
|
this._logProcessor = (_config, entry2) => {
|
|
5948
6475
|
this._logs.emit(entry2);
|
|
5949
6476
|
};
|
|
5950
6477
|
}
|
|
5951
6478
|
async open() {
|
|
5952
|
-
|
|
6479
|
+
import_log21.log.runtimeConfig.processors.push(this._logProcessor);
|
|
5953
6480
|
}
|
|
5954
6481
|
async close() {
|
|
5955
|
-
const index =
|
|
5956
|
-
|
|
6482
|
+
const index = import_log21.log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6483
|
+
import_log21.log.runtimeConfig.processors.splice(index, 1);
|
|
5957
6484
|
}
|
|
5958
6485
|
async controlMetrics({ reset, record }) {
|
|
5959
6486
|
if (reset) {
|
|
5960
|
-
|
|
6487
|
+
import_util17.tracer.clear();
|
|
5961
6488
|
}
|
|
5962
6489
|
if (record === true) {
|
|
5963
|
-
|
|
6490
|
+
import_util17.tracer.start();
|
|
5964
6491
|
} else if (record === false) {
|
|
5965
|
-
|
|
6492
|
+
import_util17.tracer.stop();
|
|
5966
6493
|
}
|
|
5967
6494
|
return {
|
|
5968
|
-
recording:
|
|
6495
|
+
recording: import_util17.tracer.recording
|
|
5969
6496
|
};
|
|
5970
6497
|
}
|
|
5971
6498
|
/**
|
|
@@ -5973,13 +6500,13 @@ var LoggingServiceImpl = class {
|
|
|
5973
6500
|
*/
|
|
5974
6501
|
queryMetrics({ interval = 5e3 }) {
|
|
5975
6502
|
const getNumericalValues = (key) => {
|
|
5976
|
-
const events =
|
|
6503
|
+
const events = import_util17.tracer.get(key) ?? [];
|
|
5977
6504
|
return {
|
|
5978
6505
|
key,
|
|
5979
|
-
stats: (0,
|
|
6506
|
+
stats: (0, import_util17.numericalValues)(events, "duration")
|
|
5980
6507
|
};
|
|
5981
6508
|
};
|
|
5982
|
-
return new
|
|
6509
|
+
return new import_codec_protobuf14.Stream(({ next }) => {
|
|
5983
6510
|
const update = () => {
|
|
5984
6511
|
const metrics = {
|
|
5985
6512
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6001,7 +6528,7 @@ var LoggingServiceImpl = class {
|
|
|
6001
6528
|
});
|
|
6002
6529
|
}
|
|
6003
6530
|
queryLogs(request) {
|
|
6004
|
-
return new
|
|
6531
|
+
return new import_codec_protobuf14.Stream(({ ctx, next }) => {
|
|
6005
6532
|
const handler = (entry2) => {
|
|
6006
6533
|
if (LOG_PROCESSING > 0) {
|
|
6007
6534
|
return;
|
|
@@ -6014,7 +6541,7 @@ var LoggingServiceImpl = class {
|
|
|
6014
6541
|
}
|
|
6015
6542
|
const record = {
|
|
6016
6543
|
...entry2,
|
|
6017
|
-
context: (0,
|
|
6544
|
+
context: (0, import_util17.jsonify)((0, import_log21.getContextFromEntry)(entry2)),
|
|
6018
6545
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6019
6546
|
meta: {
|
|
6020
6547
|
// TODO(dmaretskyi): Fix proto.
|
|
@@ -6023,7 +6550,7 @@ var LoggingServiceImpl = class {
|
|
|
6023
6550
|
scope: {
|
|
6024
6551
|
hostSessionId: this._sessionId,
|
|
6025
6552
|
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
6026
|
-
name: (0,
|
|
6553
|
+
name: (0, import_util17.getDebugName)(entry2.meta?.S)
|
|
6027
6554
|
}
|
|
6028
6555
|
}
|
|
6029
6556
|
};
|
|
@@ -6040,16 +6567,16 @@ var LoggingServiceImpl = class {
|
|
|
6040
6567
|
};
|
|
6041
6568
|
var matchFilter = (filter, level, path2, options) => {
|
|
6042
6569
|
switch (options) {
|
|
6043
|
-
case
|
|
6570
|
+
case import_services20.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
6044
6571
|
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
6045
|
-
case
|
|
6572
|
+
case import_services20.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
6046
6573
|
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
6047
6574
|
}
|
|
6048
6575
|
};
|
|
6049
6576
|
var shouldLog = (entry2, request) => {
|
|
6050
|
-
const options = request.options ??
|
|
6577
|
+
const options = request.options ?? import_services20.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
6051
6578
|
if (request.filters === void 0) {
|
|
6052
|
-
return options ===
|
|
6579
|
+
return options === import_services20.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
6053
6580
|
} else {
|
|
6054
6581
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
6055
6582
|
}
|
|
@@ -6061,7 +6588,7 @@ var NetworkServiceImpl = class {
|
|
|
6061
6588
|
this.signalManager = signalManager;
|
|
6062
6589
|
}
|
|
6063
6590
|
queryStatus() {
|
|
6064
|
-
return new
|
|
6591
|
+
return new import_codec_protobuf15.Stream(({ next }) => {
|
|
6065
6592
|
const update = () => {
|
|
6066
6593
|
next({
|
|
6067
6594
|
swarm: this.networkManager.connectionState,
|
|
@@ -6104,9 +6631,9 @@ var SystemServiceImpl = class {
|
|
|
6104
6631
|
const diagnostics = await this._getDiagnostics();
|
|
6105
6632
|
return {
|
|
6106
6633
|
timestamp: /* @__PURE__ */ new Date(),
|
|
6107
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
6108
|
-
truncate: keys ===
|
|
6109
|
-
humanize: keys ===
|
|
6634
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util18.jsonKeyReplacer)({
|
|
6635
|
+
truncate: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
6636
|
+
humanize: keys === import_services21.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
6110
6637
|
})))
|
|
6111
6638
|
};
|
|
6112
6639
|
}
|
|
@@ -6118,7 +6645,7 @@ var SystemServiceImpl = class {
|
|
|
6118
6645
|
}
|
|
6119
6646
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6120
6647
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6121
|
-
return new
|
|
6648
|
+
return new import_codec_protobuf16.Stream(({ next }) => {
|
|
6122
6649
|
const update = () => {
|
|
6123
6650
|
next({
|
|
6124
6651
|
status: this._getCurrentStatus()
|
|
@@ -6147,7 +6674,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6147
6674
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6148
6675
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6149
6676
|
}
|
|
6150
|
-
var
|
|
6677
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6151
6678
|
var ClientServicesHost = class {
|
|
6152
6679
|
constructor({
|
|
6153
6680
|
config,
|
|
@@ -6161,7 +6688,7 @@ var ClientServicesHost = class {
|
|
|
6161
6688
|
runtimeParams
|
|
6162
6689
|
} = {}) {
|
|
6163
6690
|
this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
|
|
6164
|
-
this._statusUpdate = new
|
|
6691
|
+
this._statusUpdate = new import_async20.Event();
|
|
6165
6692
|
this._opening = false;
|
|
6166
6693
|
this._open = false;
|
|
6167
6694
|
this._storage = storage;
|
|
@@ -6180,7 +6707,10 @@ var ClientServicesHost = class {
|
|
|
6180
6707
|
lockKey,
|
|
6181
6708
|
onAcquire: () => {
|
|
6182
6709
|
if (!this._opening) {
|
|
6183
|
-
void this.open(new
|
|
6710
|
+
void this.open(new import_context16.Context(void 0, {
|
|
6711
|
+
F: __dxlog_file24,
|
|
6712
|
+
L: 121
|
|
6713
|
+
}));
|
|
6184
6714
|
}
|
|
6185
6715
|
},
|
|
6186
6716
|
onRelease: () => this.close()
|
|
@@ -6189,14 +6719,14 @@ var ClientServicesHost = class {
|
|
|
6189
6719
|
this._systemService = new SystemServiceImpl({
|
|
6190
6720
|
config: () => this._config,
|
|
6191
6721
|
statusUpdate: this._statusUpdate,
|
|
6192
|
-
getCurrentStatus: () => this.isOpen ?
|
|
6722
|
+
getCurrentStatus: () => this.isOpen ? import_services17.SystemStatus.ACTIVE : import_services17.SystemStatus.INACTIVE,
|
|
6193
6723
|
getDiagnostics: () => {
|
|
6194
6724
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
6195
6725
|
},
|
|
6196
6726
|
onUpdateStatus: async (status) => {
|
|
6197
|
-
if (!this.isOpen && status ===
|
|
6727
|
+
if (!this.isOpen && status === import_services17.SystemStatus.ACTIVE) {
|
|
6198
6728
|
await this._resourceLock?.acquire();
|
|
6199
|
-
} else if (this.isOpen && status ===
|
|
6729
|
+
} else if (this.isOpen && status === import_services17.SystemStatus.INACTIVE) {
|
|
6200
6730
|
await this._resourceLock?.release();
|
|
6201
6731
|
}
|
|
6202
6732
|
},
|
|
@@ -6235,25 +6765,25 @@ var ClientServicesHost = class {
|
|
|
6235
6765
|
* Can only be called once.
|
|
6236
6766
|
*/
|
|
6237
6767
|
initialize({ config, ...options }) {
|
|
6238
|
-
(0,
|
|
6239
|
-
F:
|
|
6240
|
-
L:
|
|
6768
|
+
(0, import_invariant20.invariant)(!this._open, "service host is open", {
|
|
6769
|
+
F: __dxlog_file24,
|
|
6770
|
+
L: 187,
|
|
6241
6771
|
S: this,
|
|
6242
6772
|
A: [
|
|
6243
6773
|
"!this._open",
|
|
6244
6774
|
"'service host is open'"
|
|
6245
6775
|
]
|
|
6246
6776
|
});
|
|
6247
|
-
(0,
|
|
6248
|
-
F:
|
|
6249
|
-
L:
|
|
6777
|
+
(0, import_log20.log)("initializing...", void 0, {
|
|
6778
|
+
F: __dxlog_file24,
|
|
6779
|
+
L: 188,
|
|
6250
6780
|
S: this,
|
|
6251
6781
|
C: (f, a) => f(...a)
|
|
6252
6782
|
});
|
|
6253
6783
|
if (config) {
|
|
6254
|
-
(0,
|
|
6255
|
-
F:
|
|
6256
|
-
L:
|
|
6784
|
+
(0, import_invariant20.invariant)(!this._config, "config already set", {
|
|
6785
|
+
F: __dxlog_file24,
|
|
6786
|
+
L: 191,
|
|
6257
6787
|
S: this,
|
|
6258
6788
|
A: [
|
|
6259
6789
|
"!this._config",
|
|
@@ -6266,9 +6796,9 @@ var ClientServicesHost = class {
|
|
|
6266
6796
|
}
|
|
6267
6797
|
}
|
|
6268
6798
|
if (!options.signalManager) {
|
|
6269
|
-
|
|
6270
|
-
F:
|
|
6271
|
-
L:
|
|
6799
|
+
import_log20.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
6800
|
+
F: __dxlog_file24,
|
|
6801
|
+
L: 199,
|
|
6272
6802
|
S: this,
|
|
6273
6803
|
C: (f, a) => f(...a)
|
|
6274
6804
|
});
|
|
@@ -6277,9 +6807,9 @@ var ClientServicesHost = class {
|
|
|
6277
6807
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6278
6808
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6279
6809
|
this._signalManager = signalManager;
|
|
6280
|
-
(0,
|
|
6281
|
-
F:
|
|
6282
|
-
L:
|
|
6810
|
+
(0, import_invariant20.invariant)(!this._networkManager, "network manager already set", {
|
|
6811
|
+
F: __dxlog_file24,
|
|
6812
|
+
L: 210,
|
|
6283
6813
|
S: this,
|
|
6284
6814
|
A: [
|
|
6285
6815
|
"!this._networkManager",
|
|
@@ -6291,9 +6821,9 @@ var ClientServicesHost = class {
|
|
|
6291
6821
|
transportFactory,
|
|
6292
6822
|
signalManager
|
|
6293
6823
|
});
|
|
6294
|
-
(0,
|
|
6295
|
-
F:
|
|
6296
|
-
L:
|
|
6824
|
+
(0, import_log20.log)("initialized", void 0, {
|
|
6825
|
+
F: __dxlog_file24,
|
|
6826
|
+
L: 217,
|
|
6297
6827
|
S: this,
|
|
6298
6828
|
C: (f, a) => f(...a)
|
|
6299
6829
|
});
|
|
@@ -6303,44 +6833,44 @@ var ClientServicesHost = class {
|
|
|
6303
6833
|
return;
|
|
6304
6834
|
}
|
|
6305
6835
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6306
|
-
|
|
6836
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.begin({
|
|
6307
6837
|
id: traceId
|
|
6308
6838
|
}), {
|
|
6309
|
-
F:
|
|
6310
|
-
L:
|
|
6839
|
+
F: __dxlog_file24,
|
|
6840
|
+
L: 228,
|
|
6311
6841
|
S: this,
|
|
6312
6842
|
C: (f, a) => f(...a)
|
|
6313
6843
|
});
|
|
6314
|
-
(0,
|
|
6315
|
-
F:
|
|
6316
|
-
L:
|
|
6844
|
+
(0, import_invariant20.invariant)(this._config, "config not set", {
|
|
6845
|
+
F: __dxlog_file24,
|
|
6846
|
+
L: 230,
|
|
6317
6847
|
S: this,
|
|
6318
6848
|
A: [
|
|
6319
6849
|
"this._config",
|
|
6320
6850
|
"'config not set'"
|
|
6321
6851
|
]
|
|
6322
6852
|
});
|
|
6323
|
-
(0,
|
|
6324
|
-
F:
|
|
6325
|
-
L:
|
|
6853
|
+
(0, import_invariant20.invariant)(this._storage, "storage not set", {
|
|
6854
|
+
F: __dxlog_file24,
|
|
6855
|
+
L: 231,
|
|
6326
6856
|
S: this,
|
|
6327
6857
|
A: [
|
|
6328
6858
|
"this._storage",
|
|
6329
6859
|
"'storage not set'"
|
|
6330
6860
|
]
|
|
6331
6861
|
});
|
|
6332
|
-
(0,
|
|
6333
|
-
F:
|
|
6334
|
-
L:
|
|
6862
|
+
(0, import_invariant20.invariant)(this._signalManager, "signal manager not set", {
|
|
6863
|
+
F: __dxlog_file24,
|
|
6864
|
+
L: 232,
|
|
6335
6865
|
S: this,
|
|
6336
6866
|
A: [
|
|
6337
6867
|
"this._signalManager",
|
|
6338
6868
|
"'signal manager not set'"
|
|
6339
6869
|
]
|
|
6340
6870
|
});
|
|
6341
|
-
(0,
|
|
6342
|
-
F:
|
|
6343
|
-
L:
|
|
6871
|
+
(0, import_invariant20.invariant)(this._networkManager, "network manager not set", {
|
|
6872
|
+
F: __dxlog_file24,
|
|
6873
|
+
L: 233,
|
|
6344
6874
|
S: this,
|
|
6345
6875
|
A: [
|
|
6346
6876
|
"this._networkManager",
|
|
@@ -6348,11 +6878,11 @@ var ClientServicesHost = class {
|
|
|
6348
6878
|
]
|
|
6349
6879
|
});
|
|
6350
6880
|
this._opening = true;
|
|
6351
|
-
(0,
|
|
6881
|
+
(0, import_log20.log)("opening...", {
|
|
6352
6882
|
lockKey: this._resourceLock?.lockKey
|
|
6353
6883
|
}, {
|
|
6354
|
-
F:
|
|
6355
|
-
L:
|
|
6884
|
+
F: __dxlog_file24,
|
|
6885
|
+
L: 236,
|
|
6356
6886
|
S: this,
|
|
6357
6887
|
C: (f, a) => f(...a)
|
|
6358
6888
|
});
|
|
@@ -6363,16 +6893,18 @@ var ClientServicesHost = class {
|
|
|
6363
6893
|
await this._level.open();
|
|
6364
6894
|
await this._loggingService.open();
|
|
6365
6895
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
6896
|
+
const dataSpaceManagerProvider = async () => {
|
|
6897
|
+
await this._serviceContext.initialized.wait();
|
|
6898
|
+
return this._serviceContext.dataSpaceManager;
|
|
6899
|
+
};
|
|
6366
6900
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6367
6901
|
this._serviceRegistry.setServices({
|
|
6368
6902
|
SystemService: this._systemService,
|
|
6369
6903
|
IdentityService: identityService,
|
|
6904
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6370
6905
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6371
6906
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6372
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6373
|
-
await this._serviceContext.initialized.wait();
|
|
6374
|
-
return this._serviceContext.dataSpaceManager;
|
|
6375
|
-
}),
|
|
6907
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6376
6908
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6377
6909
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6378
6910
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6402,19 +6934,19 @@ var ClientServicesHost = class {
|
|
|
6402
6934
|
this._open = true;
|
|
6403
6935
|
this._statusUpdate.emit();
|
|
6404
6936
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6405
|
-
(0,
|
|
6937
|
+
(0, import_log20.log)("opened", {
|
|
6406
6938
|
deviceKey
|
|
6407
6939
|
}, {
|
|
6408
|
-
F:
|
|
6409
|
-
L:
|
|
6940
|
+
F: __dxlog_file24,
|
|
6941
|
+
L: 322,
|
|
6410
6942
|
S: this,
|
|
6411
6943
|
C: (f, a) => f(...a)
|
|
6412
6944
|
});
|
|
6413
|
-
|
|
6945
|
+
import_log20.log.trace("dxos.client-services.host.open", import_protocols16.trace.end({
|
|
6414
6946
|
id: traceId
|
|
6415
6947
|
}), {
|
|
6416
|
-
F:
|
|
6417
|
-
L:
|
|
6948
|
+
F: __dxlog_file24,
|
|
6949
|
+
L: 323,
|
|
6418
6950
|
S: this,
|
|
6419
6951
|
C: (f, a) => f(...a)
|
|
6420
6952
|
});
|
|
@@ -6424,11 +6956,11 @@ var ClientServicesHost = class {
|
|
|
6424
6956
|
return;
|
|
6425
6957
|
}
|
|
6426
6958
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6427
|
-
(0,
|
|
6959
|
+
(0, import_log20.log)("closing...", {
|
|
6428
6960
|
deviceKey
|
|
6429
6961
|
}, {
|
|
6430
|
-
F:
|
|
6431
|
-
L:
|
|
6962
|
+
F: __dxlog_file24,
|
|
6963
|
+
L: 334,
|
|
6432
6964
|
S: this,
|
|
6433
6965
|
C: (f, a) => f(...a)
|
|
6434
6966
|
});
|
|
@@ -6442,44 +6974,44 @@ var ClientServicesHost = class {
|
|
|
6442
6974
|
await this._level?.close();
|
|
6443
6975
|
this._open = false;
|
|
6444
6976
|
this._statusUpdate.emit();
|
|
6445
|
-
(0,
|
|
6977
|
+
(0, import_log20.log)("closed", {
|
|
6446
6978
|
deviceKey
|
|
6447
6979
|
}, {
|
|
6448
|
-
F:
|
|
6449
|
-
L:
|
|
6980
|
+
F: __dxlog_file24,
|
|
6981
|
+
L: 343,
|
|
6450
6982
|
S: this,
|
|
6451
6983
|
C: (f, a) => f(...a)
|
|
6452
6984
|
});
|
|
6453
6985
|
}
|
|
6454
6986
|
async reset() {
|
|
6455
6987
|
const traceId = import_keys15.PublicKey.random().toHex();
|
|
6456
|
-
|
|
6988
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.begin({
|
|
6457
6989
|
id: traceId
|
|
6458
6990
|
}), {
|
|
6459
|
-
F:
|
|
6460
|
-
L:
|
|
6991
|
+
F: __dxlog_file24,
|
|
6992
|
+
L: 348,
|
|
6461
6993
|
S: this,
|
|
6462
6994
|
C: (f, a) => f(...a)
|
|
6463
6995
|
});
|
|
6464
|
-
|
|
6465
|
-
F:
|
|
6466
|
-
L:
|
|
6996
|
+
import_log20.log.info("resetting...", void 0, {
|
|
6997
|
+
F: __dxlog_file24,
|
|
6998
|
+
L: 350,
|
|
6467
6999
|
S: this,
|
|
6468
7000
|
C: (f, a) => f(...a)
|
|
6469
7001
|
});
|
|
6470
7002
|
await this._serviceContext?.close();
|
|
6471
7003
|
await this._storage.reset();
|
|
6472
|
-
|
|
6473
|
-
F:
|
|
6474
|
-
L:
|
|
7004
|
+
import_log20.log.info("reset", void 0, {
|
|
7005
|
+
F: __dxlog_file24,
|
|
7006
|
+
L: 353,
|
|
6475
7007
|
S: this,
|
|
6476
7008
|
C: (f, a) => f(...a)
|
|
6477
7009
|
});
|
|
6478
|
-
|
|
7010
|
+
import_log20.log.trace("dxos.sdk.client-services-host.reset", import_protocols16.trace.end({
|
|
6479
7011
|
id: traceId
|
|
6480
7012
|
}), {
|
|
6481
|
-
F:
|
|
6482
|
-
L:
|
|
7013
|
+
F: __dxlog_file24,
|
|
7014
|
+
L: 354,
|
|
6483
7015
|
S: this,
|
|
6484
7016
|
C: (f, a) => f(...a)
|
|
6485
7017
|
});
|
|
@@ -6498,11 +7030,11 @@ _ts_decorate8([
|
|
|
6498
7030
|
import_tracing9.trace.info()
|
|
6499
7031
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
6500
7032
|
_ts_decorate8([
|
|
6501
|
-
|
|
7033
|
+
import_async20.synchronized,
|
|
6502
7034
|
import_tracing9.trace.span()
|
|
6503
7035
|
], ClientServicesHost.prototype, "open", null);
|
|
6504
7036
|
_ts_decorate8([
|
|
6505
|
-
|
|
7037
|
+
import_async20.synchronized,
|
|
6506
7038
|
import_tracing9.trace.span()
|
|
6507
7039
|
], ClientServicesHost.prototype, "close", null);
|
|
6508
7040
|
ClientServicesHost = _ts_decorate8([
|
|
@@ -6538,8 +7070,11 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6538
7070
|
createDiagnostics,
|
|
6539
7071
|
createLevel,
|
|
6540
7072
|
createStorageObjects,
|
|
6541
|
-
|
|
7073
|
+
decodeProfileArchive,
|
|
7074
|
+
encodeProfileArchive,
|
|
7075
|
+
exportProfileData,
|
|
6542
7076
|
getNetworkPeers,
|
|
7077
|
+
importProfileData,
|
|
6543
7078
|
isLocked,
|
|
6544
7079
|
subscribeToFeedBlocks,
|
|
6545
7080
|
subscribeToFeeds,
|
|
@@ -6549,4 +7084,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
6549
7084
|
subscribeToSpaces,
|
|
6550
7085
|
subscribeToSwarmInfo
|
|
6551
7086
|
});
|
|
6552
|
-
//# sourceMappingURL=chunk-
|
|
7087
|
+
//# sourceMappingURL=chunk-GKYO3IUG.cjs.map
|