@dxos/client-services 0.4.10-main.826d4ee → 0.4.10-main.8583d5a
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-3JVGDOFN.mjs → chunk-ZBQ4LQQX.mjs} +751 -561
- package/dist/lib/browser/chunk-ZBQ4LQQX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -3
- 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 +3 -3
- package/dist/lib/node/{chunk-IGZXOIKB.cjs → chunk-HMAV5VTX.cjs} +696 -594
- package/dist/lib/node/chunk-HMAV5VTX.cjs.map +7 -0
- package/dist/lib/node/index.cjs +46 -38
- 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 +15 -9
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts +5 -0
- package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -0
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts +5 -0
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -0
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts +15 -0
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -0
- package/dist/types/src/packlets/{services → diagnostics}/diagnostics.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -0
- package/dist/types/src/packlets/diagnostics/index.d.ts +4 -0
- package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -0
- package/dist/types/src/packlets/indexing/util.d.ts +2 -2
- package/dist/types/src/packlets/indexing/util.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +0 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/index.d.ts +1 -1
- package/dist/types/src/packlets/services/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +7 -5
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +5 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/util.d.ts +1 -0
- package/dist/types/src/packlets/services/util.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/level.d.ts +4 -0
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -0
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/util.d.ts +4 -0
- package/dist/types/src/packlets/storage/util.d.ts.map +1 -0
- package/dist/types/src/packlets/system/system-service.d.ts +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +5 -2
- 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 -34
- package/src/index.ts +1 -0
- package/src/packlets/devices/devices-service.test.ts +1 -1
- package/src/packlets/diagnostics/browser-diagnostics-broadcast.ts +94 -0
- package/src/packlets/diagnostics/diagnostics-broadcast.ts +20 -0
- package/src/packlets/diagnostics/diagnostics-collector.ts +65 -0
- package/src/packlets/{services → diagnostics}/diagnostics.ts +2 -2
- package/src/packlets/diagnostics/index.ts +7 -0
- package/src/packlets/identity/identity-service.test.ts +1 -1
- package/src/packlets/indexing/util.ts +4 -4
- package/src/packlets/invitations/device-invitation-protocol.test.ts +1 -1
- package/src/packlets/invitations/invitations-handler.ts +5 -12
- package/src/packlets/invitations/invitations-service.ts +5 -5
- package/src/packlets/network/network-service.test.ts +1 -1
- package/src/packlets/services/automerge-host.test.ts +9 -3
- package/src/packlets/services/index.ts +1 -1
- package/src/packlets/services/service-context.test.ts +9 -6
- package/src/packlets/services/service-context.ts +15 -8
- package/src/packlets/services/service-host.ts +49 -9
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/services/util.ts +2 -0
- package/src/packlets/spaces/data-space-manager.test.ts +4 -4
- package/src/packlets/spaces/spaces-service.test.ts +1 -1
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/level.ts +19 -0
- package/src/packlets/storage/storage.ts +3 -9
- package/src/packlets/storage/util.ts +19 -0
- package/src/packlets/system/system-service.ts +1 -1
- package/src/packlets/testing/test-builder.ts +23 -5
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-3JVGDOFN.mjs.map +0 -7
- package/dist/lib/node/chunk-IGZXOIKB.cjs.map +0 -7
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +0 -1
|
@@ -26,15 +26,17 @@ 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_HMAV5VTX_exports = {};
|
|
30
|
+
__export(chunk_HMAV5VTX_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
|
+
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
33
34
|
DataSpace: () => DataSpace,
|
|
34
35
|
DataSpaceManager: () => DataSpaceManager,
|
|
35
36
|
DeviceInvitationProtocol: () => DeviceInvitationProtocol,
|
|
36
37
|
DevtoolsHostEvents: () => DevtoolsHostEvents,
|
|
37
38
|
DevtoolsServiceImpl: () => DevtoolsServiceImpl,
|
|
39
|
+
DiagnosticsCollector: () => DiagnosticsCollector,
|
|
38
40
|
Identity: () => Identity,
|
|
39
41
|
IdentityManager: () => IdentityManager,
|
|
40
42
|
IdentityServiceImpl: () => IdentityServiceImpl,
|
|
@@ -47,10 +49,12 @@ __export(chunk_IGZXOIKB_exports, {
|
|
|
47
49
|
SpacesServiceImpl: () => SpacesServiceImpl,
|
|
48
50
|
TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
|
|
49
51
|
createAuthProvider: () => createAuthProvider,
|
|
52
|
+
createCollectDiagnosticsBroadcastHandler: () => createCollectDiagnosticsBroadcastHandler,
|
|
53
|
+
createCollectDiagnosticsBroadcastSender: () => createCollectDiagnosticsBroadcastSender,
|
|
50
54
|
createDiagnostics: () => createDiagnostics,
|
|
55
|
+
createLevel: () => createLevel,
|
|
51
56
|
createStorageObjects: () => createStorageObjects,
|
|
52
57
|
getNetworkPeers: () => getNetworkPeers,
|
|
53
|
-
invitationExpired: () => invitationExpired,
|
|
54
58
|
isLocked: () => isLocked,
|
|
55
59
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
56
60
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -60,7 +64,7 @@ __export(chunk_IGZXOIKB_exports, {
|
|
|
60
64
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
65
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
66
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
67
|
+
module.exports = __toCommonJS(chunk_HMAV5VTX_exports);
|
|
64
68
|
var import_async = require("@dxos/async");
|
|
65
69
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
70
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -134,6 +138,7 @@ var import_teleport = require("@dxos/teleport");
|
|
|
134
138
|
var import_async9 = require("@dxos/async");
|
|
135
139
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
136
140
|
var import_context6 = require("@dxos/context");
|
|
141
|
+
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
137
142
|
var import_invariant7 = require("@dxos/invariant");
|
|
138
143
|
var import_log6 = require("@dxos/log");
|
|
139
144
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -147,117 +152,127 @@ var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
|
147
152
|
var import_debug2 = require("@dxos/debug");
|
|
148
153
|
var import_rpc = require("@dxos/rpc");
|
|
149
154
|
var import_tracing3 = require("@dxos/tracing");
|
|
150
|
-
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
151
|
-
var import_credentials9 = require("@dxos/credentials");
|
|
152
|
-
var import_invariant9 = require("@dxos/invariant");
|
|
153
|
-
var import_protocols7 = require("@dxos/protocols");
|
|
154
|
-
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
155
|
-
var import_tracing4 = require("@dxos/tracing");
|
|
156
|
-
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
157
155
|
var import_async10 = require("@dxos/async");
|
|
158
156
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
159
157
|
var import_context7 = require("@dxos/context");
|
|
160
158
|
var import_debug3 = require("@dxos/debug");
|
|
161
159
|
var import_echo_db = require("@dxos/echo-db");
|
|
162
|
-
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
163
160
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
164
|
-
var
|
|
161
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
162
|
+
var import_invariant9 = require("@dxos/invariant");
|
|
165
163
|
var import_keys7 = require("@dxos/keys");
|
|
166
164
|
var import_log8 = require("@dxos/log");
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
var
|
|
165
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
166
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
167
|
+
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
170
168
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
171
|
-
var
|
|
169
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
172
170
|
var import_util4 = require("@dxos/util");
|
|
173
171
|
var import_async11 = require("@dxos/async");
|
|
174
|
-
var
|
|
172
|
+
var import_credentials10 = require("@dxos/credentials");
|
|
175
173
|
var import_async12 = require("@dxos/async");
|
|
176
174
|
var import_context8 = require("@dxos/context");
|
|
177
|
-
var
|
|
175
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
178
176
|
var import_keys8 = require("@dxos/keys");
|
|
179
177
|
var import_log9 = require("@dxos/log");
|
|
180
|
-
var
|
|
178
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
181
179
|
var import_teleport2 = require("@dxos/teleport");
|
|
182
180
|
var import_util5 = require("@dxos/util");
|
|
183
181
|
var import_async13 = require("@dxos/async");
|
|
184
182
|
var import_context9 = require("@dxos/context");
|
|
185
|
-
var
|
|
186
|
-
var
|
|
183
|
+
var import_credentials11 = require("@dxos/credentials");
|
|
184
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
187
185
|
var import_keys9 = require("@dxos/keys");
|
|
188
186
|
var import_log10 = require("@dxos/log");
|
|
189
|
-
var
|
|
190
|
-
var
|
|
187
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
188
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
191
189
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
192
190
|
var import_util6 = require("@dxos/util");
|
|
193
|
-
var
|
|
191
|
+
var import_credentials12 = require("@dxos/credentials");
|
|
194
192
|
var import_debug4 = require("@dxos/debug");
|
|
195
|
-
var
|
|
193
|
+
var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
196
194
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
197
195
|
var import_async14 = require("@dxos/async");
|
|
198
|
-
var
|
|
196
|
+
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
199
197
|
var import_debug5 = require("@dxos/debug");
|
|
200
|
-
var
|
|
198
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
201
199
|
var import_log11 = require("@dxos/log");
|
|
202
|
-
var
|
|
203
|
-
var
|
|
200
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
201
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
204
202
|
var import_async15 = require("@dxos/async");
|
|
205
203
|
var import_context10 = require("@dxos/context");
|
|
206
|
-
var
|
|
204
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
207
205
|
var import_debug6 = require("@dxos/debug");
|
|
208
|
-
var
|
|
206
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
209
207
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
210
208
|
var import_indexing = require("@dxos/indexing");
|
|
211
|
-
var
|
|
209
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
212
210
|
var import_keyring = require("@dxos/keyring");
|
|
213
211
|
var import_keys10 = require("@dxos/keys");
|
|
214
212
|
var import_log12 = require("@dxos/log");
|
|
215
|
-
var
|
|
216
|
-
var
|
|
213
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
214
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
217
215
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
218
|
-
var
|
|
216
|
+
var import_tracing5 = require("@dxos/tracing");
|
|
219
217
|
var import_util7 = require("@dxos/util");
|
|
220
218
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
221
219
|
var import_debug7 = require("@dxos/debug");
|
|
220
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
221
|
+
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
222
|
+
var import_credentials15 = require("@dxos/credentials");
|
|
223
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
222
224
|
var import_protocols13 = require("@dxos/protocols");
|
|
223
|
-
var
|
|
224
|
-
var
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
var
|
|
228
|
-
var
|
|
229
|
-
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
225
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
226
|
+
var import_tracing6 = require("@dxos/tracing");
|
|
227
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
228
|
+
var import_config = require("@dxos/config");
|
|
229
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
230
|
+
var import_tracing7 = require("@dxos/tracing");
|
|
230
231
|
var import_util8 = require("@dxos/util");
|
|
231
232
|
var import_async16 = require("@dxos/async");
|
|
232
|
-
var
|
|
233
|
+
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
233
234
|
var import_context11 = require("@dxos/context");
|
|
234
|
-
var
|
|
235
|
-
var
|
|
235
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
236
|
+
var E = __toESM(require("@dxos/echo-schema"));
|
|
236
237
|
var import_indexing2 = require("@dxos/indexing");
|
|
237
|
-
var
|
|
238
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
238
239
|
var import_keys11 = require("@dxos/keys");
|
|
239
|
-
var
|
|
240
|
+
var import_log13 = require("@dxos/log");
|
|
240
241
|
var import_messaging = require("@dxos/messaging");
|
|
241
242
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
242
|
-
var
|
|
243
|
-
var
|
|
244
|
-
var
|
|
243
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
244
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
245
|
+
var import_tracing8 = require("@dxos/tracing");
|
|
245
246
|
var import_util9 = require("@dxos/util");
|
|
246
247
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
247
248
|
var import_async17 = require("@dxos/async");
|
|
248
249
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
250
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
251
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
252
|
var import_invariant17 = require("@dxos/invariant");
|
|
250
|
-
var
|
|
253
|
+
var import_lock_file = require("@dxos/lock-file");
|
|
254
|
+
var import_log14 = require("@dxos/log");
|
|
251
255
|
var import_async18 = require("@dxos/async");
|
|
252
256
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
253
257
|
var import_keys12 = require("@dxos/keys");
|
|
254
258
|
var import_log15 = require("@dxos/log");
|
|
255
|
-
var
|
|
259
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
256
260
|
var import_util10 = require("@dxos/util");
|
|
257
261
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
258
|
-
var
|
|
259
|
-
var
|
|
262
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
263
|
+
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
264
|
+
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
265
|
+
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
266
|
+
var import_config3 = require("@dxos/protocols/proto/dxos/config");
|
|
260
267
|
var import_util11 = require("@dxos/util");
|
|
268
|
+
var import_level = require("level");
|
|
269
|
+
var import_node_path = __toESM(require("node:path"));
|
|
270
|
+
var import_keys13 = require("@dxos/keys");
|
|
271
|
+
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
272
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
273
|
+
var import_util12 = require("@dxos/util");
|
|
274
|
+
var import_keys14 = require("@dxos/keys");
|
|
275
|
+
var import_util13 = require("@dxos/util");
|
|
261
276
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
262
277
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
263
278
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -1791,11 +1806,11 @@ var InvitationsHandler = class {
|
|
|
1791
1806
|
this._networkManager = _networkManager;
|
|
1792
1807
|
}
|
|
1793
1808
|
createInvitation(protocol, options) {
|
|
1794
|
-
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400 } = options ?? {};
|
|
1809
|
+
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random(), persistent = true, created = /* @__PURE__ */ new Date(), lifetime = 86400, multiUse = false } = options ?? {};
|
|
1795
1810
|
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1796
1811
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1797
1812
|
F: __dxlog_file7,
|
|
1798
|
-
L:
|
|
1813
|
+
L: 85,
|
|
1799
1814
|
S: this,
|
|
1800
1815
|
A: [
|
|
1801
1816
|
"protocol",
|
|
@@ -1810,9 +1825,10 @@ var InvitationsHandler = class {
|
|
|
1810
1825
|
swarmKey,
|
|
1811
1826
|
authCode,
|
|
1812
1827
|
timeout,
|
|
1813
|
-
persistent,
|
|
1828
|
+
persistent: persistent && type !== import_services3.Invitation.Type.OFFLINE,
|
|
1814
1829
|
created,
|
|
1815
1830
|
lifetime,
|
|
1831
|
+
multiUse,
|
|
1816
1832
|
...protocol.getInvitationContext()
|
|
1817
1833
|
};
|
|
1818
1834
|
const stream = new import_async7.PushStream();
|
|
@@ -1827,7 +1843,7 @@ var InvitationsHandler = class {
|
|
|
1827
1843
|
...protocol.toJSON()
|
|
1828
1844
|
}, {
|
|
1829
1845
|
F: __dxlog_file7,
|
|
1830
|
-
L:
|
|
1846
|
+
L: 111,
|
|
1831
1847
|
S: this,
|
|
1832
1848
|
C: (f, a) => f(...a)
|
|
1833
1849
|
});
|
|
@@ -1852,7 +1868,7 @@ var InvitationsHandler = class {
|
|
|
1852
1868
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1853
1869
|
(0, import_invariant5.invariant)(deviceKey, void 0, {
|
|
1854
1870
|
F: __dxlog_file7,
|
|
1855
|
-
L:
|
|
1871
|
+
L: 132,
|
|
1856
1872
|
S: this,
|
|
1857
1873
|
A: [
|
|
1858
1874
|
"deviceKey",
|
|
@@ -1875,7 +1891,7 @@ var InvitationsHandler = class {
|
|
|
1875
1891
|
id: traceId
|
|
1876
1892
|
}), {
|
|
1877
1893
|
F: __dxlog_file7,
|
|
1878
|
-
L:
|
|
1894
|
+
L: 150,
|
|
1879
1895
|
S: this,
|
|
1880
1896
|
C: (f, a) => f(...a)
|
|
1881
1897
|
});
|
|
@@ -1883,7 +1899,7 @@ var InvitationsHandler = class {
|
|
|
1883
1899
|
...protocol.toJSON()
|
|
1884
1900
|
}, {
|
|
1885
1901
|
F: __dxlog_file7,
|
|
1886
|
-
L:
|
|
1902
|
+
L: 151,
|
|
1887
1903
|
S: this,
|
|
1888
1904
|
C: (f, a) => f(...a)
|
|
1889
1905
|
});
|
|
@@ -1899,7 +1915,7 @@ var InvitationsHandler = class {
|
|
|
1899
1915
|
...protocol.toJSON()
|
|
1900
1916
|
}, {
|
|
1901
1917
|
F: __dxlog_file7,
|
|
1902
|
-
L:
|
|
1918
|
+
L: 154,
|
|
1903
1919
|
S: this,
|
|
1904
1920
|
C: (f, a) => f(...a)
|
|
1905
1921
|
});
|
|
@@ -1911,7 +1927,7 @@ var InvitationsHandler = class {
|
|
|
1911
1927
|
id: traceId
|
|
1912
1928
|
}), {
|
|
1913
1929
|
F: __dxlog_file7,
|
|
1914
|
-
L:
|
|
1930
|
+
L: 156,
|
|
1915
1931
|
S: this,
|
|
1916
1932
|
C: (f, a) => f(...a)
|
|
1917
1933
|
});
|
|
@@ -1921,7 +1937,7 @@ var InvitationsHandler = class {
|
|
|
1921
1937
|
...protocol.toJSON()
|
|
1922
1938
|
}, {
|
|
1923
1939
|
F: __dxlog_file7,
|
|
1924
|
-
L:
|
|
1940
|
+
L: 159,
|
|
1925
1941
|
S: this,
|
|
1926
1942
|
C: (f, a) => f(...a)
|
|
1927
1943
|
});
|
|
@@ -1932,7 +1948,7 @@ var InvitationsHandler = class {
|
|
|
1932
1948
|
} else {
|
|
1933
1949
|
import_log4.log.error("failed", err, {
|
|
1934
1950
|
F: __dxlog_file7,
|
|
1935
|
-
L:
|
|
1951
|
+
L: 162,
|
|
1936
1952
|
S: this,
|
|
1937
1953
|
C: (f, a) => f(...a)
|
|
1938
1954
|
});
|
|
@@ -1943,12 +1959,12 @@ var InvitationsHandler = class {
|
|
|
1943
1959
|
error: err
|
|
1944
1960
|
}), {
|
|
1945
1961
|
F: __dxlog_file7,
|
|
1946
|
-
L:
|
|
1962
|
+
L: 165,
|
|
1947
1963
|
S: this,
|
|
1948
1964
|
C: (f, a) => f(...a)
|
|
1949
1965
|
});
|
|
1950
1966
|
} finally {
|
|
1951
|
-
if (
|
|
1967
|
+
if (!multiUse) {
|
|
1952
1968
|
await swarmConnection.close();
|
|
1953
1969
|
await ctx.dispose();
|
|
1954
1970
|
}
|
|
@@ -1964,7 +1980,7 @@ var InvitationsHandler = class {
|
|
|
1964
1980
|
...protocol.toJSON()
|
|
1965
1981
|
}, {
|
|
1966
1982
|
F: __dxlog_file7,
|
|
1967
|
-
L:
|
|
1983
|
+
L: 180,
|
|
1968
1984
|
S: this,
|
|
1969
1985
|
C: (f, a) => f(...a)
|
|
1970
1986
|
});
|
|
@@ -1975,7 +1991,7 @@ var InvitationsHandler = class {
|
|
|
1975
1991
|
} else {
|
|
1976
1992
|
import_log4.log.error("failed", err, {
|
|
1977
1993
|
F: __dxlog_file7,
|
|
1978
|
-
L:
|
|
1994
|
+
L: 183,
|
|
1979
1995
|
S: this,
|
|
1980
1996
|
C: (f, a) => f(...a)
|
|
1981
1997
|
});
|
|
@@ -1989,7 +2005,7 @@ var InvitationsHandler = class {
|
|
|
1989
2005
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
1990
2006
|
import_log4.log.warn("invitation has already expired", void 0, {
|
|
1991
2007
|
F: __dxlog_file7,
|
|
1992
|
-
L:
|
|
2008
|
+
L: 194,
|
|
1993
2009
|
S: this,
|
|
1994
2010
|
C: (f, a) => f(...a)
|
|
1995
2011
|
});
|
|
@@ -2040,7 +2056,7 @@ var InvitationsHandler = class {
|
|
|
2040
2056
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2041
2057
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
2042
2058
|
F: __dxlog_file7,
|
|
2043
|
-
L:
|
|
2059
|
+
L: 248,
|
|
2044
2060
|
S: this,
|
|
2045
2061
|
A: [
|
|
2046
2062
|
"protocol",
|
|
@@ -2050,7 +2066,7 @@ var InvitationsHandler = class {
|
|
|
2050
2066
|
if (deviceProfile) {
|
|
2051
2067
|
(0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2052
2068
|
F: __dxlog_file7,
|
|
2053
|
-
L:
|
|
2069
|
+
L: 252,
|
|
2054
2070
|
S: this,
|
|
2055
2071
|
A: [
|
|
2056
2072
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2065,7 +2081,7 @@ var InvitationsHandler = class {
|
|
|
2065
2081
|
const setState = (newData) => {
|
|
2066
2082
|
(0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
|
|
2067
2083
|
F: __dxlog_file7,
|
|
2068
|
-
L:
|
|
2084
|
+
L: 263,
|
|
2069
2085
|
S: this,
|
|
2070
2086
|
A: [
|
|
2071
2087
|
"newData.state !== undefined",
|
|
@@ -2085,7 +2101,7 @@ var InvitationsHandler = class {
|
|
|
2085
2101
|
...protocol.toJSON()
|
|
2086
2102
|
}, {
|
|
2087
2103
|
F: __dxlog_file7,
|
|
2088
|
-
L:
|
|
2104
|
+
L: 271,
|
|
2089
2105
|
S: this,
|
|
2090
2106
|
C: (f, a) => f(...a)
|
|
2091
2107
|
});
|
|
@@ -2095,7 +2111,7 @@ var InvitationsHandler = class {
|
|
|
2095
2111
|
} else {
|
|
2096
2112
|
import_log4.log.warn("auth failed", err, {
|
|
2097
2113
|
F: __dxlog_file7,
|
|
2098
|
-
L:
|
|
2114
|
+
L: 274,
|
|
2099
2115
|
S: this,
|
|
2100
2116
|
C: (f, a) => f(...a)
|
|
2101
2117
|
});
|
|
@@ -2109,7 +2125,7 @@ var InvitationsHandler = class {
|
|
|
2109
2125
|
...protocol.toJSON()
|
|
2110
2126
|
}, {
|
|
2111
2127
|
F: __dxlog_file7,
|
|
2112
|
-
L:
|
|
2128
|
+
L: 282,
|
|
2113
2129
|
S: this,
|
|
2114
2130
|
C: (f, a) => f(...a)
|
|
2115
2131
|
});
|
|
@@ -2124,7 +2140,7 @@ var InvitationsHandler = class {
|
|
|
2124
2140
|
currentState
|
|
2125
2141
|
}, {
|
|
2126
2142
|
F: __dxlog_file7,
|
|
2127
|
-
L:
|
|
2143
|
+
L: 292,
|
|
2128
2144
|
S: this,
|
|
2129
2145
|
C: (f, a) => f(...a)
|
|
2130
2146
|
});
|
|
@@ -2139,7 +2155,7 @@ var InvitationsHandler = class {
|
|
|
2139
2155
|
id: traceId
|
|
2140
2156
|
}), {
|
|
2141
2157
|
F: __dxlog_file7,
|
|
2142
|
-
L:
|
|
2158
|
+
L: 301,
|
|
2143
2159
|
S: this,
|
|
2144
2160
|
C: (f, a) => f(...a)
|
|
2145
2161
|
});
|
|
@@ -2151,7 +2167,7 @@ var InvitationsHandler = class {
|
|
|
2151
2167
|
...protocol.toJSON()
|
|
2152
2168
|
}, {
|
|
2153
2169
|
F: __dxlog_file7,
|
|
2154
|
-
L:
|
|
2170
|
+
L: 309,
|
|
2155
2171
|
S: this,
|
|
2156
2172
|
C: (f, a) => f(...a)
|
|
2157
2173
|
});
|
|
@@ -2162,7 +2178,7 @@ var InvitationsHandler = class {
|
|
|
2162
2178
|
...protocol.toJSON()
|
|
2163
2179
|
}, {
|
|
2164
2180
|
F: __dxlog_file7,
|
|
2165
|
-
L:
|
|
2181
|
+
L: 313,
|
|
2166
2182
|
S: this,
|
|
2167
2183
|
C: (f, a) => f(...a)
|
|
2168
2184
|
});
|
|
@@ -2172,7 +2188,7 @@ var InvitationsHandler = class {
|
|
|
2172
2188
|
response: introductionResponse
|
|
2173
2189
|
}, {
|
|
2174
2190
|
F: __dxlog_file7,
|
|
2175
|
-
L:
|
|
2191
|
+
L: 317,
|
|
2176
2192
|
S: this,
|
|
2177
2193
|
C: (f, a) => f(...a)
|
|
2178
2194
|
});
|
|
@@ -2181,7 +2197,7 @@ var InvitationsHandler = class {
|
|
|
2181
2197
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2182
2198
|
(0, import_log4.log)("guest waiting for authentication code...", void 0, {
|
|
2183
2199
|
F: __dxlog_file7,
|
|
2184
|
-
L:
|
|
2200
|
+
L: 323,
|
|
2185
2201
|
S: this,
|
|
2186
2202
|
C: (f, a) => f(...a)
|
|
2187
2203
|
});
|
|
@@ -2193,7 +2209,7 @@ var InvitationsHandler = class {
|
|
|
2193
2209
|
});
|
|
2194
2210
|
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2195
2211
|
F: __dxlog_file7,
|
|
2196
|
-
L:
|
|
2212
|
+
L: 327,
|
|
2197
2213
|
S: this,
|
|
2198
2214
|
C: (f, a) => f(...a)
|
|
2199
2215
|
});
|
|
@@ -2214,7 +2230,7 @@ var InvitationsHandler = class {
|
|
|
2214
2230
|
attempt
|
|
2215
2231
|
}, {
|
|
2216
2232
|
F: __dxlog_file7,
|
|
2217
|
-
L:
|
|
2233
|
+
L: 338,
|
|
2218
2234
|
S: this,
|
|
2219
2235
|
C: (f, a) => f(...a)
|
|
2220
2236
|
});
|
|
@@ -2227,7 +2243,7 @@ var InvitationsHandler = class {
|
|
|
2227
2243
|
...protocol.toJSON()
|
|
2228
2244
|
}, {
|
|
2229
2245
|
F: __dxlog_file7,
|
|
2230
|
-
L:
|
|
2246
|
+
L: 346,
|
|
2231
2247
|
S: this,
|
|
2232
2248
|
C: (f, a) => f(...a)
|
|
2233
2249
|
});
|
|
@@ -2239,7 +2255,7 @@ var InvitationsHandler = class {
|
|
|
2239
2255
|
...protocol.toJSON()
|
|
2240
2256
|
}, {
|
|
2241
2257
|
F: __dxlog_file7,
|
|
2242
|
-
L:
|
|
2258
|
+
L: 357,
|
|
2243
2259
|
S: this,
|
|
2244
2260
|
C: (f, a) => f(...a)
|
|
2245
2261
|
});
|
|
@@ -2252,7 +2268,7 @@ var InvitationsHandler = class {
|
|
|
2252
2268
|
id: traceId
|
|
2253
2269
|
}), {
|
|
2254
2270
|
F: __dxlog_file7,
|
|
2255
|
-
L:
|
|
2271
|
+
L: 359,
|
|
2256
2272
|
S: this,
|
|
2257
2273
|
C: (f, a) => f(...a)
|
|
2258
2274
|
});
|
|
@@ -2262,7 +2278,7 @@ var InvitationsHandler = class {
|
|
|
2262
2278
|
...protocol.toJSON()
|
|
2263
2279
|
}, {
|
|
2264
2280
|
F: __dxlog_file7,
|
|
2265
|
-
L:
|
|
2281
|
+
L: 362,
|
|
2266
2282
|
S: this,
|
|
2267
2283
|
C: (f, a) => f(...a)
|
|
2268
2284
|
});
|
|
@@ -2272,7 +2288,7 @@ var InvitationsHandler = class {
|
|
|
2272
2288
|
} else {
|
|
2273
2289
|
(0, import_log4.log)("auth failed", err, {
|
|
2274
2290
|
F: __dxlog_file7,
|
|
2275
|
-
L:
|
|
2291
|
+
L: 365,
|
|
2276
2292
|
S: this,
|
|
2277
2293
|
C: (f, a) => f(...a)
|
|
2278
2294
|
});
|
|
@@ -2283,7 +2299,7 @@ var InvitationsHandler = class {
|
|
|
2283
2299
|
error: err
|
|
2284
2300
|
}), {
|
|
2285
2301
|
F: __dxlog_file7,
|
|
2286
|
-
L:
|
|
2302
|
+
L: 368,
|
|
2287
2303
|
S: this,
|
|
2288
2304
|
C: (f, a) => f(...a)
|
|
2289
2305
|
});
|
|
@@ -2301,7 +2317,7 @@ var InvitationsHandler = class {
|
|
|
2301
2317
|
...protocol.toJSON()
|
|
2302
2318
|
}, {
|
|
2303
2319
|
F: __dxlog_file7,
|
|
2304
|
-
L:
|
|
2320
|
+
L: 379,
|
|
2305
2321
|
S: this,
|
|
2306
2322
|
C: (f, a) => f(...a)
|
|
2307
2323
|
});
|
|
@@ -2311,7 +2327,7 @@ var InvitationsHandler = class {
|
|
|
2311
2327
|
} else {
|
|
2312
2328
|
(0, import_log4.log)("auth failed", err, {
|
|
2313
2329
|
F: __dxlog_file7,
|
|
2314
|
-
L:
|
|
2330
|
+
L: 382,
|
|
2315
2331
|
S: this,
|
|
2316
2332
|
C: (f, a) => f(...a)
|
|
2317
2333
|
});
|
|
@@ -2328,7 +2344,7 @@ var InvitationsHandler = class {
|
|
|
2328
2344
|
} else {
|
|
2329
2345
|
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2330
2346
|
F: __dxlog_file7,
|
|
2331
|
-
L:
|
|
2347
|
+
L: 396,
|
|
2332
2348
|
S: this,
|
|
2333
2349
|
A: [
|
|
2334
2350
|
"invitation.swarmKey",
|
|
@@ -2367,9 +2383,6 @@ var InvitationsHandler = class {
|
|
|
2367
2383
|
return observable;
|
|
2368
2384
|
}
|
|
2369
2385
|
};
|
|
2370
|
-
var invitationExpired = (invitation) => {
|
|
2371
|
-
return invitation.created && invitation.lifetime && invitation.lifetime !== 0 && invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now();
|
|
2372
|
-
};
|
|
2373
2386
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
2374
2387
|
var InvitationsServiceImpl = class {
|
|
2375
2388
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
@@ -2425,7 +2438,7 @@ var InvitationsServiceImpl = class {
|
|
|
2425
2438
|
await this._metadataStore.removeInvitation(invitation.get().invitationId);
|
|
2426
2439
|
}
|
|
2427
2440
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2428
|
-
if (invitation.get().
|
|
2441
|
+
if (!invitation.get().multiUse) {
|
|
2429
2442
|
this._removedCreated.emit(invitation.get());
|
|
2430
2443
|
}
|
|
2431
2444
|
});
|
|
@@ -2433,7 +2446,7 @@ var InvitationsServiceImpl = class {
|
|
|
2433
2446
|
}
|
|
2434
2447
|
async loadPersistentInvitations() {
|
|
2435
2448
|
const persistentInvitations = this._metadataStore.getInvitations();
|
|
2436
|
-
const freshInvitations = persistentInvitations.filter(async (invitation) => !
|
|
2449
|
+
const freshInvitations = persistentInvitations.filter(async (invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
2437
2450
|
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
2438
2451
|
(0, import_invariant7.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2439
2452
|
F: __dxlog_file8,
|
|
@@ -2486,7 +2499,7 @@ var InvitationsServiceImpl = class {
|
|
|
2486
2499
|
}, () => {
|
|
2487
2500
|
close();
|
|
2488
2501
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2489
|
-
if (invitation.get().
|
|
2502
|
+
if (!invitation.get().multiUse) {
|
|
2490
2503
|
this._removedAccepted.emit(invitation.get());
|
|
2491
2504
|
}
|
|
2492
2505
|
});
|
|
@@ -2859,141 +2872,6 @@ _ts_decorate3([
|
|
|
2859
2872
|
ClientRpcServer = _ts_decorate3([
|
|
2860
2873
|
import_tracing3.trace.resource()
|
|
2861
2874
|
], ClientRpcServer);
|
|
2862
|
-
var getPlatform = () => {
|
|
2863
|
-
if (process.browser) {
|
|
2864
|
-
if (typeof window !== "undefined") {
|
|
2865
|
-
const { userAgent } = window.navigator;
|
|
2866
|
-
return {
|
|
2867
|
-
type: import_services8.Platform.PLATFORM_TYPE.BROWSER,
|
|
2868
|
-
userAgent,
|
|
2869
|
-
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
2870
|
-
};
|
|
2871
|
-
} else {
|
|
2872
|
-
return {
|
|
2873
|
-
type: import_services8.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
2874
|
-
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
2875
|
-
};
|
|
2876
|
-
}
|
|
2877
|
-
} else {
|
|
2878
|
-
const { platform: platform2, version, arch } = process;
|
|
2879
|
-
return {
|
|
2880
|
-
type: import_services8.Platform.PLATFORM_TYPE.NODE,
|
|
2881
|
-
platform: platform2,
|
|
2882
|
-
arch,
|
|
2883
|
-
runtime: version,
|
|
2884
|
-
uptime: Math.floor(process.uptime()),
|
|
2885
|
-
memory: process.memoryUsage()
|
|
2886
|
-
};
|
|
2887
|
-
}
|
|
2888
|
-
};
|
|
2889
|
-
var DXOS_VERSION = "0.4.10-main.826d4ee";
|
|
2890
|
-
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2891
|
-
var DEFAULT_TIMEOUT = 1e3;
|
|
2892
|
-
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
2893
|
-
const diagnostics = {
|
|
2894
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2895
|
-
platform: getPlatform(),
|
|
2896
|
-
client: {
|
|
2897
|
-
version: DXOS_VERSION,
|
|
2898
|
-
storage: {
|
|
2899
|
-
version: import_protocols7.STORAGE_VERSION
|
|
2900
|
-
}
|
|
2901
|
-
},
|
|
2902
|
-
trace: import_tracing4.TRACE_PROCESSOR.getDiagnostics()
|
|
2903
|
-
};
|
|
2904
|
-
{
|
|
2905
|
-
(0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
2906
|
-
F: __dxlog_file10,
|
|
2907
|
-
L: 108,
|
|
2908
|
-
S: void 0,
|
|
2909
|
-
A: [
|
|
2910
|
-
"clientServices.LoggingService",
|
|
2911
|
-
"'SystemService is not available.'"
|
|
2912
|
-
]
|
|
2913
|
-
});
|
|
2914
|
-
diagnostics.metrics = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
|
|
2915
|
-
timeout: DEFAULT_TIMEOUT
|
|
2916
|
-
}).catch(() => void 0);
|
|
2917
|
-
}
|
|
2918
|
-
if (typeof navigator !== "undefined" && navigator.storage) {
|
|
2919
|
-
const map = /* @__PURE__ */ new Map();
|
|
2920
|
-
const dir = await navigator.storage.getDirectory();
|
|
2921
|
-
for await (const filename of dir?.keys()) {
|
|
2922
|
-
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
2923
|
-
if (idx === -1) {
|
|
2924
|
-
continue;
|
|
2925
|
-
}
|
|
2926
|
-
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
2927
|
-
}
|
|
2928
|
-
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
2929
|
-
file,
|
|
2930
|
-
count
|
|
2931
|
-
}));
|
|
2932
|
-
}
|
|
2933
|
-
const identity = serviceContext.identityManager.identity;
|
|
2934
|
-
if (identity) {
|
|
2935
|
-
diagnostics.identity = {
|
|
2936
|
-
identityKey: identity.identityKey,
|
|
2937
|
-
spaceKey: identity.space.key,
|
|
2938
|
-
profile: identity.profileDocument
|
|
2939
|
-
};
|
|
2940
|
-
const { devices } = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
2941
|
-
timeout: DEFAULT_TIMEOUT
|
|
2942
|
-
}).catch(() => void 0) ?? {};
|
|
2943
|
-
diagnostics.devices = devices;
|
|
2944
|
-
if (serviceContext.dataSpaceManager) {
|
|
2945
|
-
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
2946
|
-
}
|
|
2947
|
-
const { feeds = [] } = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
|
|
2948
|
-
timeout: DEFAULT_TIMEOUT
|
|
2949
|
-
}).catch(() => void 0) ?? {};
|
|
2950
|
-
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
2951
|
-
feedKey,
|
|
2952
|
-
bytes,
|
|
2953
|
-
length
|
|
2954
|
-
}));
|
|
2955
|
-
const status = await (0, import_codec_protobuf10.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
2956
|
-
timeout: DEFAULT_TIMEOUT
|
|
2957
|
-
}).catch(() => void 0);
|
|
2958
|
-
diagnostics.networkStatus = status;
|
|
2959
|
-
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
2960
|
-
}
|
|
2961
|
-
diagnostics.config = config.values;
|
|
2962
|
-
return diagnostics;
|
|
2963
|
-
};
|
|
2964
|
-
var getSpaceStats = async (space) => {
|
|
2965
|
-
const stats = {
|
|
2966
|
-
key: space.key,
|
|
2967
|
-
metrics: space.metrics,
|
|
2968
|
-
epochs: space.inner.spaceState.credentials.filter((0, import_credentials9.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
|
|
2969
|
-
...credential.subject.assertion,
|
|
2970
|
-
id: credential.id
|
|
2971
|
-
})),
|
|
2972
|
-
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
2973
|
-
identity: {
|
|
2974
|
-
identityKey: member.key,
|
|
2975
|
-
profile: {
|
|
2976
|
-
displayName: member.assertion.profile?.displayName
|
|
2977
|
-
}
|
|
2978
|
-
},
|
|
2979
|
-
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE
|
|
2980
|
-
})),
|
|
2981
|
-
pipeline: {
|
|
2982
|
-
// TODO(burdon): Pick properties from credentials if needed.
|
|
2983
|
-
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
2984
|
-
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
2985
|
-
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
2986
|
-
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
2987
|
-
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
2988
|
-
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
|
|
2989
|
-
}
|
|
2990
|
-
};
|
|
2991
|
-
if (stats.metrics) {
|
|
2992
|
-
const { open, ready } = stats.metrics;
|
|
2993
|
-
stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
|
|
2994
|
-
}
|
|
2995
|
-
return stats;
|
|
2996
|
-
};
|
|
2997
2875
|
var AutomergeSpaceState = class {
|
|
2998
2876
|
constructor(_onNewRoot) {
|
|
2999
2877
|
this._onNewRoot = _onNewRoot;
|
|
@@ -3003,7 +2881,7 @@ var AutomergeSpaceState = class {
|
|
|
3003
2881
|
this._isProcessingRootDocs = false;
|
|
3004
2882
|
}
|
|
3005
2883
|
async processCredential(credential) {
|
|
3006
|
-
if (!(0,
|
|
2884
|
+
if (!(0, import_credentials10.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
3007
2885
|
return;
|
|
3008
2886
|
}
|
|
3009
2887
|
this.lastEpoch = credential;
|
|
@@ -3028,7 +2906,7 @@ var AutomergeSpaceState = class {
|
|
|
3028
2906
|
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3029
2907
|
}
|
|
3030
2908
|
};
|
|
3031
|
-
var
|
|
2909
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3032
2910
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3033
2911
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3034
2912
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -3056,13 +2934,13 @@ var NotarizationPlugin = class {
|
|
|
3056
2934
|
(0, import_log9.log)("notarize", {
|
|
3057
2935
|
credentials
|
|
3058
2936
|
}, {
|
|
3059
|
-
F:
|
|
2937
|
+
F: __dxlog_file10,
|
|
3060
2938
|
L: 90,
|
|
3061
2939
|
S: this,
|
|
3062
2940
|
C: (f, a) => f(...a)
|
|
3063
2941
|
});
|
|
3064
|
-
(0,
|
|
3065
|
-
F:
|
|
2942
|
+
(0, import_invariant10.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
2943
|
+
F: __dxlog_file10,
|
|
3066
2944
|
L: 91,
|
|
3067
2945
|
S: this,
|
|
3068
2946
|
A: [
|
|
@@ -3076,7 +2954,7 @@ var NotarizationPlugin = class {
|
|
|
3076
2954
|
import_log9.log.warn("Notarization error", {
|
|
3077
2955
|
err
|
|
3078
2956
|
}, {
|
|
3079
|
-
F:
|
|
2957
|
+
F: __dxlog_file10,
|
|
3080
2958
|
L: 99,
|
|
3081
2959
|
S: this,
|
|
3082
2960
|
C: (f, a) => f(...a)
|
|
@@ -3092,7 +2970,7 @@ var NotarizationPlugin = class {
|
|
|
3092
2970
|
timeout,
|
|
3093
2971
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3094
2972
|
}, {
|
|
3095
|
-
F:
|
|
2973
|
+
F: __dxlog_file10,
|
|
3096
2974
|
L: 111,
|
|
3097
2975
|
S: this,
|
|
3098
2976
|
C: (f, a) => f(...a)
|
|
@@ -3115,7 +2993,7 @@ var NotarizationPlugin = class {
|
|
|
3115
2993
|
import_log9.log.info("Exhausted all peers to notarize with", {
|
|
3116
2994
|
retryIn: retryTimeout
|
|
3117
2995
|
}, {
|
|
3118
|
-
F:
|
|
2996
|
+
F: __dxlog_file10,
|
|
3119
2997
|
L: 136,
|
|
3120
2998
|
S: this,
|
|
3121
2999
|
C: (f, a) => f(...a)
|
|
@@ -3129,7 +3007,7 @@ var NotarizationPlugin = class {
|
|
|
3129
3007
|
peer: peer.localPeerId,
|
|
3130
3008
|
credentialId: credentials.map((credential) => credential.id)
|
|
3131
3009
|
}, {
|
|
3132
|
-
F:
|
|
3010
|
+
F: __dxlog_file10,
|
|
3133
3011
|
L: 143,
|
|
3134
3012
|
S: this,
|
|
3135
3013
|
C: (f, a) => f(...a)
|
|
@@ -3138,7 +3016,7 @@ var NotarizationPlugin = class {
|
|
|
3138
3016
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
3139
3017
|
});
|
|
3140
3018
|
(0, import_log9.log)("success", void 0, {
|
|
3141
|
-
F:
|
|
3019
|
+
F: __dxlog_file10,
|
|
3142
3020
|
L: 147,
|
|
3143
3021
|
S: this,
|
|
3144
3022
|
C: (f, a) => f(...a)
|
|
@@ -3147,7 +3025,7 @@ var NotarizationPlugin = class {
|
|
|
3147
3025
|
} catch (err) {
|
|
3148
3026
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
3149
3027
|
import_log9.log.info("error notarizing (recoverable)", err, {
|
|
3150
|
-
F:
|
|
3028
|
+
F: __dxlog_file10,
|
|
3151
3029
|
L: 151,
|
|
3152
3030
|
S: this,
|
|
3153
3031
|
C: (f, a) => f(...a)
|
|
@@ -3165,7 +3043,7 @@ var NotarizationPlugin = class {
|
|
|
3165
3043
|
errors.wait()
|
|
3166
3044
|
]);
|
|
3167
3045
|
(0, import_log9.log)("done", void 0, {
|
|
3168
|
-
F:
|
|
3046
|
+
F: __dxlog_file10,
|
|
3169
3047
|
L: 162,
|
|
3170
3048
|
S: this,
|
|
3171
3049
|
C: (f, a) => f(...a)
|
|
@@ -3186,8 +3064,8 @@ var NotarizationPlugin = class {
|
|
|
3186
3064
|
this._processCredentialsTriggers.delete(credential.id);
|
|
3187
3065
|
}
|
|
3188
3066
|
setWriter(writer) {
|
|
3189
|
-
(0,
|
|
3190
|
-
F:
|
|
3067
|
+
(0, import_invariant10.invariant)(!this._writer, "Writer already set.", {
|
|
3068
|
+
F: __dxlog_file10,
|
|
3191
3069
|
L: 181,
|
|
3192
3070
|
S: this,
|
|
3193
3071
|
A: [
|
|
@@ -3211,8 +3089,8 @@ var NotarizationPlugin = class {
|
|
|
3211
3089
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
3212
3090
|
}
|
|
3213
3091
|
for (const credential of request.credentials ?? []) {
|
|
3214
|
-
(0,
|
|
3215
|
-
F:
|
|
3092
|
+
(0, import_invariant10.invariant)(credential.id, "Credential must have an id", {
|
|
3093
|
+
F: __dxlog_file10,
|
|
3216
3094
|
L: 200,
|
|
3217
3095
|
S: this,
|
|
3218
3096
|
A: [
|
|
@@ -3232,7 +3110,7 @@ var NotarizationPlugin = class {
|
|
|
3232
3110
|
(0, import_log9.log)("extension opened", {
|
|
3233
3111
|
peer: extension.localPeerId
|
|
3234
3112
|
}, {
|
|
3235
|
-
F:
|
|
3113
|
+
F: __dxlog_file10,
|
|
3236
3114
|
L: 211,
|
|
3237
3115
|
S: this,
|
|
3238
3116
|
C: (f, a) => f(...a)
|
|
@@ -3244,7 +3122,7 @@ var NotarizationPlugin = class {
|
|
|
3244
3122
|
(0, import_log9.log)("extension closed", {
|
|
3245
3123
|
peer: extension.localPeerId
|
|
3246
3124
|
}, {
|
|
3247
|
-
F:
|
|
3125
|
+
F: __dxlog_file10,
|
|
3248
3126
|
L: 216,
|
|
3249
3127
|
S: this,
|
|
3250
3128
|
C: (f, a) => f(...a)
|
|
@@ -3260,10 +3138,10 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
3260
3138
|
constructor(_params) {
|
|
3261
3139
|
super({
|
|
3262
3140
|
requested: {
|
|
3263
|
-
NotarizationService:
|
|
3141
|
+
NotarizationService: import_protocols8.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3264
3142
|
},
|
|
3265
3143
|
exposed: {
|
|
3266
|
-
NotarizationService:
|
|
3144
|
+
NotarizationService: import_protocols8.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3267
3145
|
}
|
|
3268
3146
|
});
|
|
3269
3147
|
this._params = _params;
|
|
@@ -3296,14 +3174,14 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3296
3174
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3297
3175
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3298
3176
|
}
|
|
3299
|
-
var
|
|
3177
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3300
3178
|
var DataSpace = class {
|
|
3301
3179
|
constructor(params) {
|
|
3302
3180
|
this._ctx = new import_context7.Context();
|
|
3303
3181
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3304
3182
|
this._cache = void 0;
|
|
3305
3183
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3306
|
-
this._state =
|
|
3184
|
+
this._state = import_services7.SpaceState.CLOSED;
|
|
3307
3185
|
this.error = void 0;
|
|
3308
3186
|
this.stateUpdate = new import_async10.Event();
|
|
3309
3187
|
this.metrics = {};
|
|
@@ -3325,9 +3203,9 @@ var DataSpace = class {
|
|
|
3325
3203
|
this._cache = params.cache;
|
|
3326
3204
|
this._state = params.initialState;
|
|
3327
3205
|
(0, import_log8.log)("new state", {
|
|
3328
|
-
state:
|
|
3206
|
+
state: import_services7.SpaceState[this._state]
|
|
3329
3207
|
}, {
|
|
3330
|
-
F:
|
|
3208
|
+
F: __dxlog_file11,
|
|
3331
3209
|
L: 140,
|
|
3332
3210
|
S: this,
|
|
3333
3211
|
C: (f, a) => f(...a)
|
|
@@ -3373,11 +3251,11 @@ var DataSpace = class {
|
|
|
3373
3251
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3374
3252
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3375
3253
|
await this._inner.open(new import_context7.Context());
|
|
3376
|
-
this._state =
|
|
3254
|
+
this._state = import_services7.SpaceState.CONTROL_ONLY;
|
|
3377
3255
|
(0, import_log8.log)("new state", {
|
|
3378
|
-
state:
|
|
3256
|
+
state: import_services7.SpaceState[this._state]
|
|
3379
3257
|
}, {
|
|
3380
|
-
F:
|
|
3258
|
+
F: __dxlog_file11,
|
|
3381
3259
|
L: 198,
|
|
3382
3260
|
S: this,
|
|
3383
3261
|
C: (f, a) => f(...a)
|
|
@@ -3391,11 +3269,11 @@ var DataSpace = class {
|
|
|
3391
3269
|
}
|
|
3392
3270
|
async _close() {
|
|
3393
3271
|
await this._callbacks.beforeClose?.();
|
|
3394
|
-
this._state =
|
|
3272
|
+
this._state = import_services7.SpaceState.CLOSED;
|
|
3395
3273
|
(0, import_log8.log)("new state", {
|
|
3396
|
-
state:
|
|
3274
|
+
state: import_services7.SpaceState[this._state]
|
|
3397
3275
|
}, {
|
|
3398
|
-
F:
|
|
3276
|
+
F: __dxlog_file11,
|
|
3399
3277
|
L: 212,
|
|
3400
3278
|
S: this,
|
|
3401
3279
|
C: (f, a) => f(...a)
|
|
@@ -3425,9 +3303,9 @@ var DataSpace = class {
|
|
|
3425
3303
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3426
3304
|
await this.initializeDataPipeline();
|
|
3427
3305
|
} catch (err) {
|
|
3428
|
-
if (err instanceof
|
|
3306
|
+
if (err instanceof import_protocols7.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3429
3307
|
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3430
|
-
F:
|
|
3308
|
+
F: __dxlog_file11,
|
|
3431
3309
|
L: 245,
|
|
3432
3310
|
S: this,
|
|
3433
3311
|
C: (f, a) => f(...a)
|
|
@@ -3435,16 +3313,16 @@ var DataSpace = class {
|
|
|
3435
3313
|
return;
|
|
3436
3314
|
}
|
|
3437
3315
|
import_log8.log.error("Error initializing data pipeline", err, {
|
|
3438
|
-
F:
|
|
3316
|
+
F: __dxlog_file11,
|
|
3439
3317
|
L: 249,
|
|
3440
3318
|
S: this,
|
|
3441
3319
|
C: (f, a) => f(...a)
|
|
3442
3320
|
});
|
|
3443
|
-
this._state =
|
|
3321
|
+
this._state = import_services7.SpaceState.ERROR;
|
|
3444
3322
|
(0, import_log8.log)("new state", {
|
|
3445
|
-
state:
|
|
3323
|
+
state: import_services7.SpaceState[this._state]
|
|
3446
3324
|
}, {
|
|
3447
|
-
F:
|
|
3325
|
+
F: __dxlog_file11,
|
|
3448
3326
|
L: 251,
|
|
3449
3327
|
S: this,
|
|
3450
3328
|
C: (f, a) => f(...a)
|
|
@@ -3457,14 +3335,14 @@ var DataSpace = class {
|
|
|
3457
3335
|
});
|
|
3458
3336
|
}
|
|
3459
3337
|
async initializeDataPipeline() {
|
|
3460
|
-
if (this._state !==
|
|
3461
|
-
throw new
|
|
3338
|
+
if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
|
|
3339
|
+
throw new import_protocols7.SystemError("Invalid operation");
|
|
3462
3340
|
}
|
|
3463
|
-
this._state =
|
|
3341
|
+
this._state = import_services7.SpaceState.INITIALIZING;
|
|
3464
3342
|
(0, import_log8.log)("new state", {
|
|
3465
|
-
state:
|
|
3343
|
+
state: import_services7.SpaceState[this._state]
|
|
3466
3344
|
}, {
|
|
3467
|
-
F:
|
|
3345
|
+
F: __dxlog_file11,
|
|
3468
3346
|
L: 267,
|
|
3469
3347
|
S: this,
|
|
3470
3348
|
C: (f, a) => f(...a)
|
|
@@ -3474,17 +3352,17 @@ var DataSpace = class {
|
|
|
3474
3352
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
3475
3353
|
await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3476
3354
|
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3477
|
-
F:
|
|
3355
|
+
F: __dxlog_file11,
|
|
3478
3356
|
L: 279,
|
|
3479
3357
|
S: this,
|
|
3480
3358
|
C: (f, a) => f(...a)
|
|
3481
3359
|
});
|
|
3482
3360
|
await this._callbacks.beforeReady?.();
|
|
3483
|
-
this._state =
|
|
3361
|
+
this._state = import_services7.SpaceState.READY;
|
|
3484
3362
|
(0, import_log8.log)("new state", {
|
|
3485
|
-
state:
|
|
3363
|
+
state: import_services7.SpaceState[this._state]
|
|
3486
3364
|
}, {
|
|
3487
|
-
F:
|
|
3365
|
+
F: __dxlog_file11,
|
|
3488
3366
|
L: 283,
|
|
3489
3367
|
S: this,
|
|
3490
3368
|
C: (f, a) => f(...a)
|
|
@@ -3500,14 +3378,14 @@ var DataSpace = class {
|
|
|
3500
3378
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
3501
3379
|
await this._createWritableFeeds();
|
|
3502
3380
|
(0, import_log8.log)("writable feeds created", void 0, {
|
|
3503
|
-
F:
|
|
3381
|
+
F: __dxlog_file11,
|
|
3504
3382
|
L: 299,
|
|
3505
3383
|
S: this,
|
|
3506
3384
|
C: (f, a) => f(...a)
|
|
3507
3385
|
});
|
|
3508
3386
|
this.stateUpdate.emit();
|
|
3509
3387
|
if (!this.notarizationPlugin.hasWriter) {
|
|
3510
|
-
this.notarizationPlugin.setWriter((0,
|
|
3388
|
+
this.notarizationPlugin.setWriter((0, import_echo_pipeline2.createMappedFeedWriter)((credential) => ({
|
|
3511
3389
|
credential: {
|
|
3512
3390
|
credential
|
|
3513
3391
|
}
|
|
@@ -3528,7 +3406,7 @@ var DataSpace = class {
|
|
|
3528
3406
|
spaceKey: this.key,
|
|
3529
3407
|
deviceKey: this._signingContext.deviceKey,
|
|
3530
3408
|
identityKey: this._signingContext.identityKey,
|
|
3531
|
-
designation:
|
|
3409
|
+
designation: import_credentials9.AdmittedFeed.Designation.CONTROL
|
|
3532
3410
|
}
|
|
3533
3411
|
}));
|
|
3534
3412
|
}
|
|
@@ -3545,7 +3423,7 @@ var DataSpace = class {
|
|
|
3545
3423
|
spaceKey: this.key,
|
|
3546
3424
|
deviceKey: this._signingContext.deviceKey,
|
|
3547
3425
|
identityKey: this._signingContext.identityKey,
|
|
3548
|
-
designation:
|
|
3426
|
+
designation: import_credentials9.AdmittedFeed.Designation.DATA
|
|
3549
3427
|
}
|
|
3550
3428
|
}));
|
|
3551
3429
|
}
|
|
@@ -3563,7 +3441,7 @@ var DataSpace = class {
|
|
|
3563
3441
|
space: this.key,
|
|
3564
3442
|
rootUrl
|
|
3565
3443
|
}, {
|
|
3566
|
-
F:
|
|
3444
|
+
F: __dxlog_file11,
|
|
3567
3445
|
L: 365,
|
|
3568
3446
|
S: this,
|
|
3569
3447
|
C: (f, a) => f(...a)
|
|
@@ -3578,7 +3456,7 @@ var DataSpace = class {
|
|
|
3578
3456
|
if (this._ctx.disposed) {
|
|
3579
3457
|
return;
|
|
3580
3458
|
}
|
|
3581
|
-
const doc = handle.docSync() ?? (0,
|
|
3459
|
+
const doc = handle.docSync() ?? (0, import_invariant9.failedInvariant)();
|
|
3582
3460
|
if (!doc.access?.spaceKey) {
|
|
3583
3461
|
handle.change((doc2) => {
|
|
3584
3462
|
doc2.access = {
|
|
@@ -3595,7 +3473,7 @@ var DataSpace = class {
|
|
|
3595
3473
|
rootUrl,
|
|
3596
3474
|
err
|
|
3597
3475
|
}, {
|
|
3598
|
-
F:
|
|
3476
|
+
F: __dxlog_file11,
|
|
3599
3477
|
L: 388,
|
|
3600
3478
|
S: this,
|
|
3601
3479
|
C: (f, a) => f(...a)
|
|
@@ -3622,7 +3500,7 @@ var DataSpace = class {
|
|
|
3622
3500
|
let epoch;
|
|
3623
3501
|
switch (options?.migration) {
|
|
3624
3502
|
case void 0:
|
|
3625
|
-
case
|
|
3503
|
+
case import_services7.CreateEpochRequest.Migration.NONE:
|
|
3626
3504
|
{
|
|
3627
3505
|
epoch = {
|
|
3628
3506
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
@@ -3632,7 +3510,7 @@ var DataSpace = class {
|
|
|
3632
3510
|
};
|
|
3633
3511
|
}
|
|
3634
3512
|
break;
|
|
3635
|
-
case
|
|
3513
|
+
case import_services7.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
3636
3514
|
{
|
|
3637
3515
|
const document = this._automergeHost.repo.create();
|
|
3638
3516
|
epoch = {
|
|
@@ -3643,14 +3521,14 @@ var DataSpace = class {
|
|
|
3643
3521
|
};
|
|
3644
3522
|
}
|
|
3645
3523
|
break;
|
|
3646
|
-
case
|
|
3524
|
+
case import_services7.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
3647
3525
|
{
|
|
3648
3526
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3649
3527
|
const rootHandle = this._automergeHost.repo.find(currentRootUrl);
|
|
3650
3528
|
await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3651
3529
|
const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
|
|
3652
|
-
(0,
|
|
3653
|
-
F:
|
|
3530
|
+
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3531
|
+
F: __dxlog_file11,
|
|
3654
3532
|
L: 438,
|
|
3655
3533
|
S: this,
|
|
3656
3534
|
A: [
|
|
@@ -3666,10 +3544,10 @@ var DataSpace = class {
|
|
|
3666
3544
|
};
|
|
3667
3545
|
}
|
|
3668
3546
|
break;
|
|
3669
|
-
case
|
|
3547
|
+
case import_services7.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
3670
3548
|
{
|
|
3671
3549
|
import_log8.log.info("Fragmenting", void 0, {
|
|
3672
|
-
F:
|
|
3550
|
+
F: __dxlog_file11,
|
|
3673
3551
|
L: 450,
|
|
3674
3552
|
S: this,
|
|
3675
3553
|
C: (f, a) => f(...a)
|
|
@@ -3680,8 +3558,8 @@ var DataSpace = class {
|
|
|
3680
3558
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3681
3559
|
const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_db.TYPE_PROPERTIES);
|
|
3682
3560
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3683
|
-
(0,
|
|
3684
|
-
F:
|
|
3561
|
+
(0, import_invariant9.invariant)(properties, "Properties not found", {
|
|
3562
|
+
F: __dxlog_file11,
|
|
3685
3563
|
L: 460,
|
|
3686
3564
|
S: this,
|
|
3687
3565
|
A: [
|
|
@@ -3696,8 +3574,8 @@ var DataSpace = class {
|
|
|
3696
3574
|
])
|
|
3697
3575
|
};
|
|
3698
3576
|
const newRoot = this._automergeHost.repo.create(newSpaceDoc);
|
|
3699
|
-
(0,
|
|
3700
|
-
F:
|
|
3577
|
+
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3578
|
+
F: __dxlog_file11,
|
|
3701
3579
|
L: 465,
|
|
3702
3580
|
S: this,
|
|
3703
3581
|
A: [
|
|
@@ -3705,7 +3583,7 @@ var DataSpace = class {
|
|
|
3705
3583
|
""
|
|
3706
3584
|
]
|
|
3707
3585
|
});
|
|
3708
|
-
const docLoader = new
|
|
3586
|
+
const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
|
|
3709
3587
|
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
3710
3588
|
rootUrl: newRoot.url
|
|
3711
3589
|
});
|
|
@@ -3749,24 +3627,24 @@ var DataSpace = class {
|
|
|
3749
3627
|
]));
|
|
3750
3628
|
}
|
|
3751
3629
|
async activate() {
|
|
3752
|
-
if (this._state !==
|
|
3630
|
+
if (this._state !== import_services7.SpaceState.INACTIVE) {
|
|
3753
3631
|
return;
|
|
3754
3632
|
}
|
|
3755
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3633
|
+
await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.ACTIVE);
|
|
3756
3634
|
await this._open();
|
|
3757
3635
|
this.initializeDataPipelineAsync();
|
|
3758
3636
|
}
|
|
3759
3637
|
async deactivate() {
|
|
3760
|
-
if (this._state ===
|
|
3638
|
+
if (this._state === import_services7.SpaceState.INACTIVE) {
|
|
3761
3639
|
return;
|
|
3762
3640
|
}
|
|
3763
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3641
|
+
await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
|
|
3764
3642
|
await this._close();
|
|
3765
|
-
this._state =
|
|
3643
|
+
this._state = import_services7.SpaceState.INACTIVE;
|
|
3766
3644
|
(0, import_log8.log)("new state", {
|
|
3767
|
-
state:
|
|
3645
|
+
state: import_services7.SpaceState[this._state]
|
|
3768
3646
|
}, {
|
|
3769
|
-
F:
|
|
3647
|
+
F: __dxlog_file11,
|
|
3770
3648
|
L: 531,
|
|
3771
3649
|
S: this,
|
|
3772
3650
|
C: (f, a) => f(...a)
|
|
@@ -3775,18 +3653,18 @@ var DataSpace = class {
|
|
|
3775
3653
|
}
|
|
3776
3654
|
};
|
|
3777
3655
|
_ts_decorate4([
|
|
3778
|
-
|
|
3656
|
+
import_tracing4.trace.info()
|
|
3779
3657
|
], DataSpace.prototype, "_inner", void 0);
|
|
3780
3658
|
_ts_decorate4([
|
|
3781
|
-
|
|
3659
|
+
import_tracing4.trace.info()
|
|
3782
3660
|
], DataSpace.prototype, "key", null);
|
|
3783
3661
|
_ts_decorate4([
|
|
3784
|
-
|
|
3785
|
-
enum:
|
|
3662
|
+
import_tracing4.trace.info({
|
|
3663
|
+
enum: import_services7.SpaceState
|
|
3786
3664
|
})
|
|
3787
3665
|
], DataSpace.prototype, "state", null);
|
|
3788
3666
|
_ts_decorate4([
|
|
3789
|
-
|
|
3667
|
+
import_tracing4.trace.info({
|
|
3790
3668
|
depth: null
|
|
3791
3669
|
})
|
|
3792
3670
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
@@ -3797,12 +3675,12 @@ _ts_decorate4([
|
|
|
3797
3675
|
import_async10.synchronized
|
|
3798
3676
|
], DataSpace.prototype, "close", null);
|
|
3799
3677
|
_ts_decorate4([
|
|
3800
|
-
|
|
3678
|
+
import_tracing4.trace.span({
|
|
3801
3679
|
showInBrowserTimeline: true
|
|
3802
3680
|
})
|
|
3803
3681
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
3804
3682
|
_ts_decorate4([
|
|
3805
|
-
|
|
3683
|
+
import_tracing4.trace.span({
|
|
3806
3684
|
showInBrowserTimeline: true
|
|
3807
3685
|
})
|
|
3808
3686
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
@@ -3817,11 +3695,11 @@ _ts_decorate4([
|
|
|
3817
3695
|
], DataSpace.prototype, "deactivate", null);
|
|
3818
3696
|
DataSpace = _ts_decorate4([
|
|
3819
3697
|
(0, import_async10.trackLeaks)("open", "close"),
|
|
3820
|
-
|
|
3698
|
+
import_tracing4.trace.resource()
|
|
3821
3699
|
], DataSpace);
|
|
3822
3700
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
3823
3701
|
const credentials = [
|
|
3824
|
-
await (0,
|
|
3702
|
+
await (0, import_credentials12.createCredential)({
|
|
3825
3703
|
signer: keyring,
|
|
3826
3704
|
issuer: space.key,
|
|
3827
3705
|
subject: space.key,
|
|
@@ -3830,14 +3708,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3830
3708
|
spaceKey: space.key
|
|
3831
3709
|
}
|
|
3832
3710
|
}),
|
|
3833
|
-
await (0,
|
|
3711
|
+
await (0, import_credentials12.createCredential)({
|
|
3834
3712
|
signer: keyring,
|
|
3835
3713
|
issuer: space.key,
|
|
3836
3714
|
subject: signingContext.identityKey,
|
|
3837
3715
|
assertion: {
|
|
3838
3716
|
"@type": "dxos.halo.credentials.SpaceMember",
|
|
3839
3717
|
spaceKey: space.key,
|
|
3840
|
-
role:
|
|
3718
|
+
role: import_credentials13.SpaceMember.Role.ADMIN,
|
|
3841
3719
|
profile: signingContext.getProfile(),
|
|
3842
3720
|
genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
|
|
3843
3721
|
}
|
|
@@ -3849,7 +3727,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3849
3727
|
spaceKey: space.key,
|
|
3850
3728
|
identityKey: signingContext.identityKey,
|
|
3851
3729
|
deviceKey: signingContext.deviceKey,
|
|
3852
|
-
designation:
|
|
3730
|
+
designation: import_credentials13.AdmittedFeed.Designation.CONTROL
|
|
3853
3731
|
}
|
|
3854
3732
|
}),
|
|
3855
3733
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -3859,7 +3737,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3859
3737
|
spaceKey: space.key,
|
|
3860
3738
|
identityKey: signingContext.identityKey,
|
|
3861
3739
|
deviceKey: signingContext.deviceKey,
|
|
3862
|
-
designation:
|
|
3740
|
+
designation: import_credentials13.AdmittedFeed.Designation.DATA
|
|
3863
3741
|
}
|
|
3864
3742
|
}),
|
|
3865
3743
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -3893,7 +3771,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3893
3771
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3894
3772
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3895
3773
|
}
|
|
3896
|
-
var
|
|
3774
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
3897
3775
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3898
3776
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3899
3777
|
var DataSpaceManager = class {
|
|
@@ -3919,15 +3797,15 @@ var DataSpaceManager = class {
|
|
|
3919
3797
|
}
|
|
3920
3798
|
async open() {
|
|
3921
3799
|
(0, import_log10.log)("open", void 0, {
|
|
3922
|
-
F:
|
|
3800
|
+
F: __dxlog_file12,
|
|
3923
3801
|
L: 98,
|
|
3924
3802
|
S: this,
|
|
3925
3803
|
C: (f, a) => f(...a)
|
|
3926
3804
|
});
|
|
3927
|
-
import_log10.log.trace("dxos.echo.data-space-manager.open",
|
|
3805
|
+
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols9.trace.begin({
|
|
3928
3806
|
id: this._instanceId
|
|
3929
3807
|
}), {
|
|
3930
|
-
F:
|
|
3808
|
+
F: __dxlog_file12,
|
|
3931
3809
|
L: 99,
|
|
3932
3810
|
S: this,
|
|
3933
3811
|
C: (f, a) => f(...a)
|
|
@@ -3935,7 +3813,7 @@ var DataSpaceManager = class {
|
|
|
3935
3813
|
(0, import_log10.log)("metadata loaded", {
|
|
3936
3814
|
spaces: this._metadataStore.spaces.length
|
|
3937
3815
|
}, {
|
|
3938
|
-
F:
|
|
3816
|
+
F: __dxlog_file12,
|
|
3939
3817
|
L: 100,
|
|
3940
3818
|
S: this,
|
|
3941
3819
|
C: (f, a) => f(...a)
|
|
@@ -3945,7 +3823,7 @@ var DataSpaceManager = class {
|
|
|
3945
3823
|
(0, import_log10.log)("load space", {
|
|
3946
3824
|
spaceMetadata
|
|
3947
3825
|
}, {
|
|
3948
|
-
F:
|
|
3826
|
+
F: __dxlog_file12,
|
|
3949
3827
|
L: 104,
|
|
3950
3828
|
S: this,
|
|
3951
3829
|
C: (f, a) => f(...a)
|
|
@@ -3956,7 +3834,7 @@ var DataSpaceManager = class {
|
|
|
3956
3834
|
spaceMetadata,
|
|
3957
3835
|
err
|
|
3958
3836
|
}, {
|
|
3959
|
-
F:
|
|
3837
|
+
F: __dxlog_file12,
|
|
3960
3838
|
L: 107,
|
|
3961
3839
|
S: this,
|
|
3962
3840
|
C: (f, a) => f(...a)
|
|
@@ -3966,14 +3844,14 @@ var DataSpaceManager = class {
|
|
|
3966
3844
|
this._isOpen = true;
|
|
3967
3845
|
this.updated.emit();
|
|
3968
3846
|
for (const space of this._spaces.values()) {
|
|
3969
|
-
if (space.state !==
|
|
3847
|
+
if (space.state !== import_services8.SpaceState.INACTIVE) {
|
|
3970
3848
|
space.initializeDataPipelineAsync();
|
|
3971
3849
|
}
|
|
3972
3850
|
}
|
|
3973
|
-
import_log10.log.trace("dxos.echo.data-space-manager.open",
|
|
3851
|
+
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols9.trace.end({
|
|
3974
3852
|
id: this._instanceId
|
|
3975
3853
|
}), {
|
|
3976
|
-
F:
|
|
3854
|
+
F: __dxlog_file12,
|
|
3977
3855
|
L: 120,
|
|
3978
3856
|
S: this,
|
|
3979
3857
|
C: (f, a) => f(...a)
|
|
@@ -3981,7 +3859,7 @@ var DataSpaceManager = class {
|
|
|
3981
3859
|
}
|
|
3982
3860
|
async close() {
|
|
3983
3861
|
(0, import_log10.log)("close", void 0, {
|
|
3984
|
-
F:
|
|
3862
|
+
F: __dxlog_file12,
|
|
3985
3863
|
L: 125,
|
|
3986
3864
|
S: this,
|
|
3987
3865
|
C: (f, a) => f(...a)
|
|
@@ -3996,8 +3874,8 @@ var DataSpaceManager = class {
|
|
|
3996
3874
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
3997
3875
|
*/
|
|
3998
3876
|
async createSpace() {
|
|
3999
|
-
(0,
|
|
4000
|
-
F:
|
|
3877
|
+
(0, import_invariant11.invariant)(this._isOpen, "Not open.", {
|
|
3878
|
+
F: __dxlog_file12,
|
|
4001
3879
|
L: 138,
|
|
4002
3880
|
S: this,
|
|
4003
3881
|
A: [
|
|
@@ -4013,12 +3891,12 @@ var DataSpaceManager = class {
|
|
|
4013
3891
|
genesisFeedKey: controlFeedKey,
|
|
4014
3892
|
controlFeedKey,
|
|
4015
3893
|
dataFeedKey,
|
|
4016
|
-
state:
|
|
3894
|
+
state: import_services8.SpaceState.ACTIVE
|
|
4017
3895
|
};
|
|
4018
3896
|
(0, import_log10.log)("creating space...", {
|
|
4019
3897
|
spaceKey
|
|
4020
3898
|
}, {
|
|
4021
|
-
F:
|
|
3899
|
+
F: __dxlog_file12,
|
|
4022
3900
|
L: 150,
|
|
4023
3901
|
S: this,
|
|
4024
3902
|
C: (f, a) => f(...a)
|
|
@@ -4033,8 +3911,8 @@ var DataSpaceManager = class {
|
|
|
4033
3911
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
|
|
4034
3912
|
await this._metadataStore.addSpace(metadata);
|
|
4035
3913
|
const memberCredential = credentials[1];
|
|
4036
|
-
(0,
|
|
4037
|
-
F:
|
|
3914
|
+
(0, import_invariant11.invariant)((0, import_credentials11.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3915
|
+
F: __dxlog_file12,
|
|
4038
3916
|
L: 163,
|
|
4039
3917
|
S: this,
|
|
4040
3918
|
A: [
|
|
@@ -4052,13 +3930,13 @@ var DataSpaceManager = class {
|
|
|
4052
3930
|
(0, import_log10.log)("accept space", {
|
|
4053
3931
|
opts
|
|
4054
3932
|
}, {
|
|
4055
|
-
F:
|
|
3933
|
+
F: __dxlog_file12,
|
|
4056
3934
|
L: 175,
|
|
4057
3935
|
S: this,
|
|
4058
3936
|
C: (f, a) => f(...a)
|
|
4059
3937
|
});
|
|
4060
|
-
(0,
|
|
4061
|
-
F:
|
|
3938
|
+
(0, import_invariant11.invariant)(this._isOpen, "Not open.", {
|
|
3939
|
+
F: __dxlog_file12,
|
|
4062
3940
|
L: 176,
|
|
4063
3941
|
S: this,
|
|
4064
3942
|
A: [
|
|
@@ -4066,8 +3944,8 @@ var DataSpaceManager = class {
|
|
|
4066
3944
|
"'Not open.'"
|
|
4067
3945
|
]
|
|
4068
3946
|
});
|
|
4069
|
-
(0,
|
|
4070
|
-
F:
|
|
3947
|
+
(0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3948
|
+
F: __dxlog_file12,
|
|
4071
3949
|
L: 177,
|
|
4072
3950
|
S: this,
|
|
4073
3951
|
A: [
|
|
@@ -4095,14 +3973,14 @@ var DataSpaceManager = class {
|
|
|
4095
3973
|
async waitUntilSpaceReady(spaceKey) {
|
|
4096
3974
|
await (0, import_context9.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
4097
3975
|
const space = this._spaces.get(spaceKey);
|
|
4098
|
-
return !!space && space.state ===
|
|
3976
|
+
return !!space && space.state === import_services8.SpaceState.READY;
|
|
4099
3977
|
}));
|
|
4100
3978
|
}
|
|
4101
3979
|
async _constructSpace(metadata) {
|
|
4102
3980
|
(0, import_log10.log)("construct space", {
|
|
4103
3981
|
metadata
|
|
4104
3982
|
}, {
|
|
4105
|
-
F:
|
|
3983
|
+
F: __dxlog_file12,
|
|
4106
3984
|
L: 210,
|
|
4107
3985
|
S: this,
|
|
4108
3986
|
C: (f, a) => f(...a)
|
|
@@ -4140,7 +4018,7 @@ var DataSpaceManager = class {
|
|
|
4140
4018
|
},
|
|
4141
4019
|
onAuthFailure: () => {
|
|
4142
4020
|
import_log10.log.warn("auth failure", void 0, {
|
|
4143
|
-
F:
|
|
4021
|
+
F: __dxlog_file12,
|
|
4144
4022
|
L: 247,
|
|
4145
4023
|
S: this,
|
|
4146
4024
|
C: (f, a) => f(...a)
|
|
@@ -4152,7 +4030,7 @@ var DataSpaceManager = class {
|
|
|
4152
4030
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
4153
4031
|
const dataSpace = new DataSpace({
|
|
4154
4032
|
inner: space,
|
|
4155
|
-
initialState: metadata.state ===
|
|
4033
|
+
initialState: metadata.state === import_services8.SpaceState.INACTIVE ? import_services8.SpaceState.INACTIVE : import_services8.SpaceState.CLOSED,
|
|
4156
4034
|
metadataStore: this._metadataStore,
|
|
4157
4035
|
gossip,
|
|
4158
4036
|
presence,
|
|
@@ -4164,7 +4042,7 @@ var DataSpaceManager = class {
|
|
|
4164
4042
|
(0, import_log10.log)("before space ready", {
|
|
4165
4043
|
space: space.key
|
|
4166
4044
|
}, {
|
|
4167
|
-
F:
|
|
4045
|
+
F: __dxlog_file12,
|
|
4168
4046
|
L: 265,
|
|
4169
4047
|
S: this,
|
|
4170
4048
|
C: (f, a) => f(...a)
|
|
@@ -4175,7 +4053,7 @@ var DataSpaceManager = class {
|
|
|
4175
4053
|
space: space.key,
|
|
4176
4054
|
open: this._isOpen
|
|
4177
4055
|
}, {
|
|
4178
|
-
F:
|
|
4056
|
+
F: __dxlog_file12,
|
|
4179
4057
|
L: 268,
|
|
4180
4058
|
S: this,
|
|
4181
4059
|
C: (f, a) => f(...a)
|
|
@@ -4188,7 +4066,7 @@ var DataSpaceManager = class {
|
|
|
4188
4066
|
(0, import_log10.log)("before space close", {
|
|
4189
4067
|
space: space.key
|
|
4190
4068
|
}, {
|
|
4191
|
-
F:
|
|
4069
|
+
F: __dxlog_file12,
|
|
4192
4070
|
L: 274,
|
|
4193
4071
|
S: this,
|
|
4194
4072
|
C: (f, a) => f(...a)
|
|
@@ -4198,7 +4076,7 @@ var DataSpaceManager = class {
|
|
|
4198
4076
|
cache: metadata.cache,
|
|
4199
4077
|
automergeHost: this._automergeHost
|
|
4200
4078
|
});
|
|
4201
|
-
if (metadata.state !==
|
|
4079
|
+
if (metadata.state !== import_services8.SpaceState.INACTIVE) {
|
|
4202
4080
|
await dataSpace.open();
|
|
4203
4081
|
}
|
|
4204
4082
|
if (metadata.controlTimeframe) {
|
|
@@ -4223,7 +4101,7 @@ _ts_decorate5([
|
|
|
4223
4101
|
DataSpaceManager = _ts_decorate5([
|
|
4224
4102
|
(0, import_async13.trackLeaks)("open", "close")
|
|
4225
4103
|
], DataSpaceManager);
|
|
4226
|
-
var
|
|
4104
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
4227
4105
|
var SpacesServiceImpl = class {
|
|
4228
4106
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
4229
4107
|
this._identityManager = _identityManager;
|
|
@@ -4240,29 +4118,29 @@ var SpacesServiceImpl = class {
|
|
|
4240
4118
|
}
|
|
4241
4119
|
async updateSpace({ spaceKey, state }) {
|
|
4242
4120
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4243
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4121
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4244
4122
|
if (state) {
|
|
4245
4123
|
switch (state) {
|
|
4246
|
-
case
|
|
4124
|
+
case import_services9.SpaceState.ACTIVE:
|
|
4247
4125
|
await space.activate();
|
|
4248
4126
|
break;
|
|
4249
|
-
case
|
|
4127
|
+
case import_services9.SpaceState.INACTIVE:
|
|
4250
4128
|
await space.deactivate();
|
|
4251
4129
|
break;
|
|
4252
4130
|
default:
|
|
4253
|
-
throw new
|
|
4131
|
+
throw new import_protocols10.ApiError("Invalid space state");
|
|
4254
4132
|
}
|
|
4255
4133
|
}
|
|
4256
4134
|
}
|
|
4257
4135
|
querySpaces() {
|
|
4258
|
-
return new
|
|
4136
|
+
return new import_codec_protobuf10.Stream(({ next, ctx }) => {
|
|
4259
4137
|
const scheduler = new import_async14.UpdateScheduler(ctx, async () => {
|
|
4260
4138
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4261
4139
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
4262
4140
|
(0, import_log11.log)("update", {
|
|
4263
4141
|
spaces
|
|
4264
4142
|
}, {
|
|
4265
|
-
F:
|
|
4143
|
+
F: __dxlog_file13,
|
|
4266
4144
|
L: 77,
|
|
4267
4145
|
S: this,
|
|
4268
4146
|
C: (f, a) => f(...a)
|
|
@@ -4302,14 +4180,14 @@ var SpacesServiceImpl = class {
|
|
|
4302
4180
|
}
|
|
4303
4181
|
async postMessage({ spaceKey, channel, message }) {
|
|
4304
4182
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4305
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4183
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4306
4184
|
await space.postMessage(getChannelId(channel), message);
|
|
4307
4185
|
}
|
|
4308
4186
|
subscribeMessages({ spaceKey, channel }) {
|
|
4309
|
-
return new
|
|
4187
|
+
return new import_codec_protobuf10.Stream(({ ctx, next }) => {
|
|
4310
4188
|
(0, import_async14.scheduleTask)(ctx, async () => {
|
|
4311
4189
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4312
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4190
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4313
4191
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
4314
4192
|
next(message);
|
|
4315
4193
|
});
|
|
@@ -4318,8 +4196,8 @@ var SpacesServiceImpl = class {
|
|
|
4318
4196
|
});
|
|
4319
4197
|
}
|
|
4320
4198
|
queryCredentials({ spaceKey, noTail }) {
|
|
4321
|
-
return new
|
|
4322
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4199
|
+
return new import_codec_protobuf10.Stream(({ ctx, next, close }) => {
|
|
4200
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4323
4201
|
const processor = {
|
|
4324
4202
|
processCredential: async (credential) => {
|
|
4325
4203
|
next(credential);
|
|
@@ -4335,7 +4213,7 @@ var SpacesServiceImpl = class {
|
|
|
4335
4213
|
});
|
|
4336
4214
|
}
|
|
4337
4215
|
async writeCredentials({ spaceKey, credentials }) {
|
|
4338
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4216
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4339
4217
|
for (const credential of credentials ?? []) {
|
|
4340
4218
|
if (credential.proof) {
|
|
4341
4219
|
await space.controlPipeline.writer.write({
|
|
@@ -4344,8 +4222,8 @@ var SpacesServiceImpl = class {
|
|
|
4344
4222
|
}
|
|
4345
4223
|
});
|
|
4346
4224
|
} else {
|
|
4347
|
-
(0,
|
|
4348
|
-
F:
|
|
4225
|
+
(0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
4226
|
+
F: __dxlog_file13,
|
|
4349
4227
|
L: 164,
|
|
4350
4228
|
S: this,
|
|
4351
4229
|
A: [
|
|
@@ -4353,8 +4231,8 @@ var SpacesServiceImpl = class {
|
|
|
4353
4231
|
"'Id on unsigned credentials is not allowed'"
|
|
4354
4232
|
]
|
|
4355
4233
|
});
|
|
4356
|
-
(0,
|
|
4357
|
-
F:
|
|
4234
|
+
(0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
4235
|
+
F: __dxlog_file13,
|
|
4358
4236
|
L: 165,
|
|
4359
4237
|
S: this,
|
|
4360
4238
|
A: [
|
|
@@ -4363,8 +4241,8 @@ var SpacesServiceImpl = class {
|
|
|
4363
4241
|
]
|
|
4364
4242
|
});
|
|
4365
4243
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
4366
|
-
(0,
|
|
4367
|
-
F:
|
|
4244
|
+
(0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
4245
|
+
F: __dxlog_file13,
|
|
4368
4246
|
L: 167,
|
|
4369
4247
|
S: this,
|
|
4370
4248
|
A: [
|
|
@@ -4386,7 +4264,7 @@ var SpacesServiceImpl = class {
|
|
|
4386
4264
|
}
|
|
4387
4265
|
async createEpoch({ spaceKey, migration }) {
|
|
4388
4266
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4389
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4267
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4390
4268
|
await space.createEpoch({
|
|
4391
4269
|
migration
|
|
4392
4270
|
});
|
|
@@ -4395,7 +4273,7 @@ var SpacesServiceImpl = class {
|
|
|
4395
4273
|
return {
|
|
4396
4274
|
spaceKey: space.key,
|
|
4397
4275
|
state: space.state,
|
|
4398
|
-
error: space.error ? (0,
|
|
4276
|
+
error: space.error ? (0, import_protocols10.encodeError)(space.error) : void 0,
|
|
4399
4277
|
pipeline: {
|
|
4400
4278
|
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
4401
4279
|
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
@@ -4420,7 +4298,7 @@ var SpacesServiceImpl = class {
|
|
|
4420
4298
|
identityKey: member.key,
|
|
4421
4299
|
profile: member.profile ?? {}
|
|
4422
4300
|
},
|
|
4423
|
-
presence: member.removed ?
|
|
4301
|
+
presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
|
|
4424
4302
|
peerStates: peers
|
|
4425
4303
|
};
|
|
4426
4304
|
}),
|
|
@@ -4431,7 +4309,7 @@ var SpacesServiceImpl = class {
|
|
|
4431
4309
|
}
|
|
4432
4310
|
};
|
|
4433
4311
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4434
|
-
var
|
|
4312
|
+
var createSelectedDocumentsIterator = (automergeHost) => (
|
|
4435
4313
|
/**
|
|
4436
4314
|
* Get object data blobs from Automerge Repo by ids.
|
|
4437
4315
|
* @param ids
|
|
@@ -4439,22 +4317,22 @@ var createLoadDocuments = (automergeHost) => (
|
|
|
4439
4317
|
// TODO(mykola): Unload automerge handles after usage.
|
|
4440
4318
|
async function* loadDocuments(ids) {
|
|
4441
4319
|
for (const id of ids) {
|
|
4442
|
-
const { documentId, objectId } =
|
|
4320
|
+
const { documentId, objectId } = import_protocols12.idCodec.decode(id);
|
|
4443
4321
|
const handle = automergeHost.repo.find(documentId);
|
|
4444
4322
|
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4445
4323
|
const doc = handle.docSync();
|
|
4446
4324
|
const hash = (0, import_automerge.getHeads)(doc).join("");
|
|
4447
|
-
yield [
|
|
4325
|
+
yield doc.objects?.[objectId] ? [
|
|
4448
4326
|
{
|
|
4449
4327
|
id,
|
|
4450
4328
|
object: doc.objects[objectId],
|
|
4451
4329
|
currentHash: hash
|
|
4452
4330
|
}
|
|
4453
|
-
];
|
|
4331
|
+
] : [];
|
|
4454
4332
|
}
|
|
4455
4333
|
}
|
|
4456
4334
|
);
|
|
4457
|
-
var
|
|
4335
|
+
var createDocumentsIterator = (automergeHost) => (
|
|
4458
4336
|
/**
|
|
4459
4337
|
* Recursively get all object data blobs from Automerge Repo.
|
|
4460
4338
|
* @param ids
|
|
@@ -4472,12 +4350,12 @@ var createGetAllDocuments = (automergeHost) => (
|
|
|
4472
4350
|
if (doc.objects) {
|
|
4473
4351
|
yield Object.entries(doc.objects).map(([objectId, object]) => {
|
|
4474
4352
|
return {
|
|
4475
|
-
id:
|
|
4353
|
+
id: import_protocols12.idCodec.encode({
|
|
4476
4354
|
documentId: handle.documentId,
|
|
4477
4355
|
objectId
|
|
4478
4356
|
}),
|
|
4479
4357
|
object,
|
|
4480
|
-
currentHash: heads.
|
|
4358
|
+
currentHash: heads.join("")
|
|
4481
4359
|
};
|
|
4482
4360
|
});
|
|
4483
4361
|
}
|
|
@@ -4515,18 +4393,20 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4515
4393
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4516
4394
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4517
4395
|
}
|
|
4518
|
-
var
|
|
4519
|
-
var ServiceContext = class {
|
|
4520
|
-
constructor(storage, networkManager, signalManager, _runtimeParams) {
|
|
4396
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4397
|
+
var ServiceContext = class extends import_context10.Resource {
|
|
4398
|
+
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
4399
|
+
super();
|
|
4521
4400
|
this.storage = storage;
|
|
4401
|
+
this.level = level;
|
|
4522
4402
|
this.networkManager = networkManager;
|
|
4523
4403
|
this.signalManager = signalManager;
|
|
4524
4404
|
this._runtimeParams = _runtimeParams;
|
|
4525
4405
|
this.initialized = new import_async15.Trigger();
|
|
4526
4406
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4527
4407
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
4528
|
-
this.metadataStore = new
|
|
4529
|
-
this.snapshotStore = new
|
|
4408
|
+
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
4409
|
+
this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4530
4410
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
4531
4411
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
4532
4412
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
@@ -4534,12 +4414,12 @@ var ServiceContext = class {
|
|
|
4534
4414
|
root: storage.createDirectory("feeds"),
|
|
4535
4415
|
signer: this.keyring,
|
|
4536
4416
|
hypercore: {
|
|
4537
|
-
valueEncoding:
|
|
4417
|
+
valueEncoding: import_echo_pipeline4.valueEncoding,
|
|
4538
4418
|
stats: true
|
|
4539
4419
|
}
|
|
4540
4420
|
})
|
|
4541
4421
|
});
|
|
4542
|
-
this.spaceManager = new
|
|
4422
|
+
this.spaceManager = new import_echo_pipeline4.SpaceManager({
|
|
4543
4423
|
feedStore: this.feedStore,
|
|
4544
4424
|
networkManager: this.networkManager,
|
|
4545
4425
|
blobStore: this.blobStore,
|
|
@@ -4548,10 +4428,11 @@ var ServiceContext = class {
|
|
|
4548
4428
|
});
|
|
4549
4429
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4550
4430
|
this.indexMetadata = new import_indexing.IndexMetadataStore({
|
|
4551
|
-
|
|
4431
|
+
db: level.sublevel("index-metadata")
|
|
4552
4432
|
});
|
|
4553
|
-
this.automergeHost = new
|
|
4433
|
+
this.automergeHost = new import_echo_pipeline4.AutomergeHost({
|
|
4554
4434
|
directory: storage.createDirectory("automerge"),
|
|
4435
|
+
db: level.sublevel("automerge"),
|
|
4555
4436
|
metadata: this.indexMetadata
|
|
4556
4437
|
});
|
|
4557
4438
|
this.indexer = new import_indexing.Indexer({
|
|
@@ -4559,55 +4440,56 @@ var ServiceContext = class {
|
|
|
4559
4440
|
directory: storage.createDirectory("index-store")
|
|
4560
4441
|
}),
|
|
4561
4442
|
metadataStore: this.indexMetadata,
|
|
4562
|
-
loadDocuments:
|
|
4563
|
-
getAllDocuments:
|
|
4443
|
+
loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
|
|
4444
|
+
getAllDocuments: createDocumentsIterator(this.automergeHost)
|
|
4564
4445
|
});
|
|
4565
4446
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4566
|
-
this._handlerFactories.set(
|
|
4447
|
+
this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4567
4448
|
}
|
|
4568
|
-
async
|
|
4449
|
+
async _open(ctx) {
|
|
4569
4450
|
await this._checkStorageVersion();
|
|
4570
4451
|
(0, import_log12.log)("opening...", void 0, {
|
|
4571
|
-
F:
|
|
4572
|
-
L:
|
|
4452
|
+
F: __dxlog_file14,
|
|
4453
|
+
L: 157,
|
|
4573
4454
|
S: this,
|
|
4574
4455
|
C: (f, a) => f(...a)
|
|
4575
4456
|
});
|
|
4576
|
-
import_log12.log.trace("dxos.sdk.service-context.open",
|
|
4457
|
+
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.begin({
|
|
4577
4458
|
id: this._instanceId
|
|
4578
4459
|
}), {
|
|
4579
|
-
F:
|
|
4580
|
-
L:
|
|
4460
|
+
F: __dxlog_file14,
|
|
4461
|
+
L: 158,
|
|
4581
4462
|
S: this,
|
|
4582
4463
|
C: (f, a) => f(...a)
|
|
4583
4464
|
});
|
|
4584
4465
|
await this.signalManager.open();
|
|
4585
4466
|
await this.networkManager.open();
|
|
4467
|
+
await this.automergeHost.open();
|
|
4586
4468
|
await this.metadataStore.load();
|
|
4587
4469
|
await this.spaceManager.open();
|
|
4588
4470
|
await this.identityManager.open(ctx);
|
|
4589
4471
|
if (this.identityManager.identity) {
|
|
4590
4472
|
await this._initialize(ctx);
|
|
4591
4473
|
}
|
|
4592
|
-
import_log12.log.trace("dxos.sdk.service-context.open",
|
|
4474
|
+
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.end({
|
|
4593
4475
|
id: this._instanceId
|
|
4594
4476
|
}), {
|
|
4595
|
-
F:
|
|
4596
|
-
L:
|
|
4477
|
+
F: __dxlog_file14,
|
|
4478
|
+
L: 169,
|
|
4597
4479
|
S: this,
|
|
4598
4480
|
C: (f, a) => f(...a)
|
|
4599
4481
|
});
|
|
4600
4482
|
(0, import_log12.log)("opened", void 0, {
|
|
4601
|
-
F:
|
|
4602
|
-
L:
|
|
4483
|
+
F: __dxlog_file14,
|
|
4484
|
+
L: 170,
|
|
4603
4485
|
S: this,
|
|
4604
4486
|
C: (f, a) => f(...a)
|
|
4605
4487
|
});
|
|
4606
4488
|
}
|
|
4607
|
-
async
|
|
4489
|
+
async _close() {
|
|
4608
4490
|
(0, import_log12.log)("closing...", void 0, {
|
|
4609
|
-
F:
|
|
4610
|
-
L:
|
|
4491
|
+
F: __dxlog_file14,
|
|
4492
|
+
L: 174,
|
|
4611
4493
|
S: this,
|
|
4612
4494
|
C: (f, a) => f(...a)
|
|
4613
4495
|
});
|
|
@@ -4624,8 +4506,8 @@ var ServiceContext = class {
|
|
|
4624
4506
|
await this.metadataStore.close();
|
|
4625
4507
|
await this.indexer.destroy();
|
|
4626
4508
|
(0, import_log12.log)("closed", void 0, {
|
|
4627
|
-
F:
|
|
4628
|
-
L:
|
|
4509
|
+
F: __dxlog_file14,
|
|
4510
|
+
L: 187,
|
|
4629
4511
|
S: this,
|
|
4630
4512
|
C: (f, a) => f(...a)
|
|
4631
4513
|
});
|
|
@@ -4637,9 +4519,9 @@ var ServiceContext = class {
|
|
|
4637
4519
|
}
|
|
4638
4520
|
getInvitationHandler(invitation) {
|
|
4639
4521
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4640
|
-
(0,
|
|
4641
|
-
F:
|
|
4642
|
-
L:
|
|
4522
|
+
(0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4523
|
+
F: __dxlog_file14,
|
|
4524
|
+
L: 198,
|
|
4643
4525
|
S: this,
|
|
4644
4526
|
A: [
|
|
4645
4527
|
"factory",
|
|
@@ -4663,15 +4545,15 @@ var ServiceContext = class {
|
|
|
4663
4545
|
}
|
|
4664
4546
|
async _checkStorageVersion() {
|
|
4665
4547
|
await this.metadataStore.load();
|
|
4666
|
-
if (this.metadataStore.version !==
|
|
4667
|
-
throw new
|
|
4548
|
+
if (this.metadataStore.version !== import_protocols11.STORAGE_VERSION) {
|
|
4549
|
+
throw new import_protocols11.InvalidStorageVersionError(import_protocols11.STORAGE_VERSION, this.metadataStore.version);
|
|
4668
4550
|
}
|
|
4669
4551
|
}
|
|
4670
4552
|
// Called when identity is created.
|
|
4671
4553
|
async _initialize(ctx) {
|
|
4672
4554
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4673
|
-
F:
|
|
4674
|
-
L:
|
|
4555
|
+
F: __dxlog_file14,
|
|
4556
|
+
L: 229,
|
|
4675
4557
|
S: this,
|
|
4676
4558
|
C: (f, a) => f(...a)
|
|
4677
4559
|
});
|
|
@@ -4691,10 +4573,10 @@ var ServiceContext = class {
|
|
|
4691
4573
|
};
|
|
4692
4574
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
|
|
4693
4575
|
await this.dataSpaceManager.open();
|
|
4694
|
-
this._handlerFactories.set(
|
|
4695
|
-
(0,
|
|
4696
|
-
F:
|
|
4697
|
-
L:
|
|
4576
|
+
this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
|
|
4577
|
+
(0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4578
|
+
F: __dxlog_file14,
|
|
4579
|
+
L: 253,
|
|
4698
4580
|
S: this,
|
|
4699
4581
|
A: [
|
|
4700
4582
|
"this.dataSpaceManager",
|
|
@@ -4706,7 +4588,7 @@ var ServiceContext = class {
|
|
|
4706
4588
|
this.initialized.wake();
|
|
4707
4589
|
this._deviceSpaceSync = {
|
|
4708
4590
|
processCredential: async (credential) => {
|
|
4709
|
-
const assertion = (0,
|
|
4591
|
+
const assertion = (0, import_credentials14.getCredentialAssertion)(credential);
|
|
4710
4592
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
4711
4593
|
return;
|
|
4712
4594
|
}
|
|
@@ -4717,8 +4599,8 @@ var ServiceContext = class {
|
|
|
4717
4599
|
(0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
4718
4600
|
details: assertion
|
|
4719
4601
|
}, {
|
|
4720
|
-
F:
|
|
4721
|
-
L:
|
|
4602
|
+
F: __dxlog_file14,
|
|
4603
|
+
L: 269,
|
|
4722
4604
|
S: this,
|
|
4723
4605
|
C: (f, a) => f(...a)
|
|
4724
4606
|
});
|
|
@@ -4728,8 +4610,8 @@ var ServiceContext = class {
|
|
|
4728
4610
|
(0, import_log12.log)("space already exists, ignoring space admission", {
|
|
4729
4611
|
details: assertion
|
|
4730
4612
|
}, {
|
|
4731
|
-
F:
|
|
4732
|
-
L:
|
|
4613
|
+
F: __dxlog_file14,
|
|
4614
|
+
L: 273,
|
|
4733
4615
|
S: this,
|
|
4734
4616
|
C: (f, a) => f(...a)
|
|
4735
4617
|
});
|
|
@@ -4739,8 +4621,8 @@ var ServiceContext = class {
|
|
|
4739
4621
|
(0, import_log12.log)("accepting space recorded in halo", {
|
|
4740
4622
|
details: assertion
|
|
4741
4623
|
}, {
|
|
4742
|
-
F:
|
|
4743
|
-
L:
|
|
4624
|
+
F: __dxlog_file14,
|
|
4625
|
+
L: 278,
|
|
4744
4626
|
S: this,
|
|
4745
4627
|
C: (f, a) => f(...a)
|
|
4746
4628
|
});
|
|
@@ -4750,8 +4632,8 @@ var ServiceContext = class {
|
|
|
4750
4632
|
});
|
|
4751
4633
|
} catch (err) {
|
|
4752
4634
|
import_log12.log.catch(err, void 0, {
|
|
4753
|
-
F:
|
|
4754
|
-
L:
|
|
4635
|
+
F: __dxlog_file14,
|
|
4636
|
+
L: 284,
|
|
4755
4637
|
S: this,
|
|
4756
4638
|
C: (f, a) => f(...a)
|
|
4757
4639
|
});
|
|
@@ -4762,14 +4644,14 @@ var ServiceContext = class {
|
|
|
4762
4644
|
}
|
|
4763
4645
|
};
|
|
4764
4646
|
_ts_decorate6([
|
|
4765
|
-
|
|
4766
|
-
], ServiceContext.prototype, "
|
|
4647
|
+
import_tracing5.trace.span()
|
|
4648
|
+
], ServiceContext.prototype, "_open", null);
|
|
4767
4649
|
_ts_decorate6([
|
|
4768
|
-
|
|
4650
|
+
import_tracing5.trace.span()
|
|
4769
4651
|
], ServiceContext.prototype, "_initialize", null);
|
|
4770
4652
|
ServiceContext = _ts_decorate6([
|
|
4771
4653
|
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4772
|
-
|
|
4654
|
+
import_tracing5.trace.resource()
|
|
4773
4655
|
], ServiceContext);
|
|
4774
4656
|
var ServiceRegistry = class {
|
|
4775
4657
|
// prettier-ignore
|
|
@@ -4793,103 +4675,155 @@ var ServiceRegistry = class {
|
|
|
4793
4675
|
delete this._handlers[name];
|
|
4794
4676
|
}
|
|
4795
4677
|
};
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
if (
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
}
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
}
|
|
4813
|
-
|
|
4814
|
-
return
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
});
|
|
4823
|
-
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4824
|
-
await this._onAcquire?.();
|
|
4825
|
-
(0, import_log13.log)("acquired lock", void 0, {
|
|
4826
|
-
F: __dxlog_file16,
|
|
4827
|
-
L: 37,
|
|
4828
|
-
S: this,
|
|
4829
|
-
C: (f, a) => f(...a)
|
|
4830
|
-
});
|
|
4678
|
+
var DXOS_VERSION = "0.4.10-main.8583d5a";
|
|
4679
|
+
var getPlatform = () => {
|
|
4680
|
+
if (process.browser) {
|
|
4681
|
+
if (typeof window !== "undefined") {
|
|
4682
|
+
const { userAgent } = window.navigator;
|
|
4683
|
+
return {
|
|
4684
|
+
type: import_services12.Platform.PLATFORM_TYPE.BROWSER,
|
|
4685
|
+
userAgent,
|
|
4686
|
+
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
4687
|
+
};
|
|
4688
|
+
} else {
|
|
4689
|
+
return {
|
|
4690
|
+
type: import_services12.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
4691
|
+
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
4692
|
+
};
|
|
4693
|
+
}
|
|
4694
|
+
} else {
|
|
4695
|
+
const { platform: platform2, version, arch } = process;
|
|
4696
|
+
return {
|
|
4697
|
+
type: import_services12.Platform.PLATFORM_TYPE.NODE,
|
|
4698
|
+
platform: platform2,
|
|
4699
|
+
arch,
|
|
4700
|
+
runtime: version,
|
|
4701
|
+
uptime: Math.floor(process.uptime()),
|
|
4702
|
+
memory: process.memoryUsage()
|
|
4703
|
+
};
|
|
4831
4704
|
}
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4705
|
+
};
|
|
4706
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
4707
|
+
var DEFAULT_TIMEOUT = 1e3;
|
|
4708
|
+
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
4709
|
+
const diagnostics = {
|
|
4710
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4711
|
+
platform: getPlatform(),
|
|
4712
|
+
client: {
|
|
4713
|
+
version: DXOS_VERSION,
|
|
4714
|
+
storage: {
|
|
4715
|
+
version: import_protocols13.STORAGE_VERSION
|
|
4716
|
+
}
|
|
4717
|
+
},
|
|
4718
|
+
trace: import_tracing6.TRACE_PROCESSOR.getDiagnostics()
|
|
4719
|
+
};
|
|
4720
|
+
{
|
|
4721
|
+
(0, import_invariant14.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
4722
|
+
F: __dxlog_file15,
|
|
4723
|
+
L: 108,
|
|
4724
|
+
S: void 0,
|
|
4838
4725
|
A: [
|
|
4839
|
-
"
|
|
4840
|
-
"'
|
|
4726
|
+
"clientServices.LoggingService",
|
|
4727
|
+
"'SystemService is not available.'"
|
|
4841
4728
|
]
|
|
4842
4729
|
});
|
|
4843
|
-
await
|
|
4844
|
-
|
|
4845
|
-
};
|
|
4846
|
-
_ts_decorate7([
|
|
4847
|
-
import_log13.logInfo
|
|
4848
|
-
], Lock.prototype, "lockKey", null);
|
|
4849
|
-
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
4850
|
-
var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
4851
|
-
var createStorageObjects = (config) => {
|
|
4852
|
-
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4853
|
-
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4854
|
-
throw new import_protocols14.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4730
|
+
diagnostics.metrics = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
|
|
4731
|
+
timeout: DEFAULT_TIMEOUT
|
|
4732
|
+
}).catch(() => void 0);
|
|
4855
4733
|
}
|
|
4856
|
-
if (
|
|
4857
|
-
|
|
4734
|
+
if (typeof navigator !== "undefined" && navigator.storage) {
|
|
4735
|
+
const map = /* @__PURE__ */ new Map();
|
|
4736
|
+
const dir = await navigator.storage.getDirectory();
|
|
4737
|
+
for await (const filename of dir?.keys()) {
|
|
4738
|
+
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
4739
|
+
if (idx === -1) {
|
|
4740
|
+
continue;
|
|
4741
|
+
}
|
|
4742
|
+
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
4743
|
+
}
|
|
4744
|
+
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
4745
|
+
file,
|
|
4746
|
+
count
|
|
4747
|
+
}));
|
|
4858
4748
|
}
|
|
4859
|
-
|
|
4860
|
-
|
|
4749
|
+
const identity = serviceContext.identityManager.identity;
|
|
4750
|
+
if (identity) {
|
|
4751
|
+
diagnostics.identity = {
|
|
4752
|
+
identityKey: identity.identityKey,
|
|
4753
|
+
spaceKey: identity.space.key,
|
|
4754
|
+
profile: identity.profileDocument
|
|
4755
|
+
};
|
|
4756
|
+
const { devices } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
4757
|
+
timeout: DEFAULT_TIMEOUT
|
|
4758
|
+
}).catch(() => void 0) ?? {};
|
|
4759
|
+
diagnostics.devices = devices;
|
|
4760
|
+
if (serviceContext.dataSpaceManager) {
|
|
4761
|
+
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
4762
|
+
}
|
|
4763
|
+
const { feeds = [] } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
|
|
4764
|
+
timeout: DEFAULT_TIMEOUT
|
|
4765
|
+
}).catch(() => void 0) ?? {};
|
|
4766
|
+
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
4767
|
+
feedKey,
|
|
4768
|
+
bytes,
|
|
4769
|
+
length
|
|
4770
|
+
}));
|
|
4771
|
+
const status = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
4772
|
+
timeout: DEFAULT_TIMEOUT
|
|
4773
|
+
}).catch(() => void 0);
|
|
4774
|
+
diagnostics.networkStatus = status;
|
|
4775
|
+
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
4861
4776
|
}
|
|
4862
|
-
|
|
4863
|
-
|
|
4777
|
+
diagnostics.config = config.values;
|
|
4778
|
+
return diagnostics;
|
|
4779
|
+
};
|
|
4780
|
+
var getSpaceStats = async (space) => {
|
|
4781
|
+
const stats = {
|
|
4782
|
+
key: space.key,
|
|
4783
|
+
metrics: space.metrics,
|
|
4784
|
+
epochs: space.inner.spaceState.credentials.filter((0, import_credentials15.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
|
|
4785
|
+
...credential.subject.assertion,
|
|
4786
|
+
id: credential.id
|
|
4787
|
+
})),
|
|
4788
|
+
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
4789
|
+
identity: {
|
|
4790
|
+
identityKey: member.key,
|
|
4791
|
+
profile: {
|
|
4792
|
+
displayName: member.assertion.profile?.displayName
|
|
4793
|
+
}
|
|
4794
|
+
},
|
|
4795
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE
|
|
4796
|
+
})),
|
|
4797
|
+
pipeline: {
|
|
4798
|
+
// TODO(burdon): Pick properties from credentials if needed.
|
|
4799
|
+
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
4800
|
+
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
4801
|
+
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
4802
|
+
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
4803
|
+
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
4804
|
+
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
|
|
4805
|
+
}
|
|
4806
|
+
};
|
|
4807
|
+
if (stats.metrics) {
|
|
4808
|
+
const { open, ready } = stats.metrics;
|
|
4809
|
+
stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
|
|
4864
4810
|
}
|
|
4811
|
+
return stats;
|
|
4812
|
+
};
|
|
4813
|
+
var createCollectDiagnosticsBroadcastSender = () => {
|
|
4865
4814
|
return {
|
|
4866
|
-
|
|
4867
|
-
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
4868
|
-
root: `${dataRoot}/`
|
|
4869
|
-
})
|
|
4815
|
+
broadcastDiagnosticsRequest: async () => void 0
|
|
4870
4816
|
};
|
|
4871
4817
|
};
|
|
4872
|
-
var
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
return import_random_access_storage.StorageType.CHROME;
|
|
4880
|
-
case StorageDriver.FIREFOX:
|
|
4881
|
-
return import_random_access_storage.StorageType.FIREFOX;
|
|
4882
|
-
case StorageDriver.IDB:
|
|
4883
|
-
return import_random_access_storage.StorageType.IDB;
|
|
4884
|
-
case StorageDriver.NODE:
|
|
4885
|
-
return import_random_access_storage.StorageType.NODE;
|
|
4886
|
-
case StorageDriver.WEBFS:
|
|
4887
|
-
return import_random_access_storage.StorageType.WEBFS;
|
|
4888
|
-
default:
|
|
4889
|
-
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
4890
|
-
}
|
|
4818
|
+
var createCollectDiagnosticsBroadcastHandler = (_) => {
|
|
4819
|
+
return {
|
|
4820
|
+
start: () => {
|
|
4821
|
+
},
|
|
4822
|
+
stop: () => {
|
|
4823
|
+
}
|
|
4824
|
+
};
|
|
4891
4825
|
};
|
|
4892
|
-
var
|
|
4826
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4893
4827
|
var DevicesServiceImpl = class {
|
|
4894
4828
|
constructor(_identityManager) {
|
|
4895
4829
|
this._identityManager = _identityManager;
|
|
@@ -4906,8 +4840,8 @@ var DevicesServiceImpl = class {
|
|
|
4906
4840
|
devices: []
|
|
4907
4841
|
});
|
|
4908
4842
|
} else {
|
|
4909
|
-
(0,
|
|
4910
|
-
F:
|
|
4843
|
+
(0, import_invariant16.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
4844
|
+
F: __dxlog_file16,
|
|
4911
4845
|
L: 32,
|
|
4912
4846
|
S: this,
|
|
4913
4847
|
A: [
|
|
@@ -4922,9 +4856,9 @@ var DevicesServiceImpl = class {
|
|
|
4922
4856
|
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
4923
4857
|
return {
|
|
4924
4858
|
deviceKey: key,
|
|
4925
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
4859
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services15.DeviceKind.CURRENT : import_services15.DeviceKind.TRUSTED,
|
|
4926
4860
|
profile,
|
|
4927
|
-
presence: isMe ?
|
|
4861
|
+
presence: isMe ? import_services15.Device.PresenceState.ONLINE : peerState ? import_services15.Device.PresenceState.ONLINE : import_services15.Device.PresenceState.OFFLINE
|
|
4928
4862
|
};
|
|
4929
4863
|
})
|
|
4930
4864
|
});
|
|
@@ -4965,6 +4899,60 @@ var DevicesServiceImpl = class {
|
|
|
4965
4899
|
});
|
|
4966
4900
|
}
|
|
4967
4901
|
};
|
|
4902
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
4903
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4904
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4905
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4906
|
+
else
|
|
4907
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4908
|
+
if (d = decorators[i])
|
|
4909
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4910
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4911
|
+
}
|
|
4912
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
4913
|
+
var Lock = class {
|
|
4914
|
+
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
4915
|
+
this._lockPath = lockPath;
|
|
4916
|
+
this._onAcquire = onAcquire;
|
|
4917
|
+
this._onRelease = onRelease;
|
|
4918
|
+
}
|
|
4919
|
+
get lockKey() {
|
|
4920
|
+
return this._lockPath;
|
|
4921
|
+
}
|
|
4922
|
+
async acquire() {
|
|
4923
|
+
(0, import_log14.log)("acquiring lock...", void 0, {
|
|
4924
|
+
F: __dxlog_file17,
|
|
4925
|
+
L: 32,
|
|
4926
|
+
S: this,
|
|
4927
|
+
C: (f, a) => f(...a)
|
|
4928
|
+
});
|
|
4929
|
+
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4930
|
+
await this._onAcquire?.();
|
|
4931
|
+
(0, import_log14.log)("acquired lock", void 0, {
|
|
4932
|
+
F: __dxlog_file17,
|
|
4933
|
+
L: 37,
|
|
4934
|
+
S: this,
|
|
4935
|
+
C: (f, a) => f(...a)
|
|
4936
|
+
});
|
|
4937
|
+
}
|
|
4938
|
+
async release() {
|
|
4939
|
+
await this._onRelease?.();
|
|
4940
|
+
(0, import_invariant17.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4941
|
+
F: __dxlog_file17,
|
|
4942
|
+
L: 42,
|
|
4943
|
+
S: this,
|
|
4944
|
+
A: [
|
|
4945
|
+
"this._fileHandle",
|
|
4946
|
+
"'Lock is not acquired'"
|
|
4947
|
+
]
|
|
4948
|
+
});
|
|
4949
|
+
await import_lock_file.LockFile.release(this._fileHandle);
|
|
4950
|
+
}
|
|
4951
|
+
};
|
|
4952
|
+
_ts_decorate7([
|
|
4953
|
+
import_log14.logInfo
|
|
4954
|
+
], Lock.prototype, "lockKey", null);
|
|
4955
|
+
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
4968
4956
|
var LoggingServiceImpl = class {
|
|
4969
4957
|
constructor() {
|
|
4970
4958
|
this._logs = new import_async18.Event();
|
|
@@ -5064,18 +5052,18 @@ var LoggingServiceImpl = class {
|
|
|
5064
5052
|
});
|
|
5065
5053
|
}
|
|
5066
5054
|
};
|
|
5067
|
-
var matchFilter = (filter, level,
|
|
5055
|
+
var matchFilter = (filter, level, path2, options) => {
|
|
5068
5056
|
switch (options) {
|
|
5069
|
-
case
|
|
5070
|
-
return level >= filter.level && (!filter.pattern ||
|
|
5071
|
-
case
|
|
5072
|
-
return level === filter.level && (!filter.pattern ||
|
|
5057
|
+
case import_services16.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
5058
|
+
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5059
|
+
case import_services16.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
5060
|
+
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5073
5061
|
}
|
|
5074
5062
|
};
|
|
5075
5063
|
var shouldLog = (entry2, request) => {
|
|
5076
|
-
const options = request.options ??
|
|
5064
|
+
const options = request.options ?? import_services16.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
5077
5065
|
if (request.filters === void 0) {
|
|
5078
|
-
return options ===
|
|
5066
|
+
return options === import_services16.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
5079
5067
|
} else {
|
|
5080
5068
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
5081
5069
|
}
|
|
@@ -5111,6 +5099,63 @@ var NetworkServiceImpl = class {
|
|
|
5111
5099
|
await this.networkManager.setConnectionState(request.swarm);
|
|
5112
5100
|
}
|
|
5113
5101
|
};
|
|
5102
|
+
var getRootPath = (config) => {
|
|
5103
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol5.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5104
|
+
return `${dataRoot}/`;
|
|
5105
|
+
};
|
|
5106
|
+
var isPersistent = (config) => {
|
|
5107
|
+
const { persistent = false } = config ?? {};
|
|
5108
|
+
return config.dataStore !== void 0 && config.dataStore !== import_config3.Runtime.Client.Storage.StorageDriver.RAM || persistent;
|
|
5109
|
+
};
|
|
5110
|
+
var StorageDriver = import_config2.Runtime.Client.Storage.StorageDriver;
|
|
5111
|
+
var createStorageObjects = (config) => {
|
|
5112
|
+
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
5113
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
5114
|
+
throw new import_protocols15.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
5115
|
+
}
|
|
5116
|
+
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
5117
|
+
throw new import_protocols15.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
5118
|
+
}
|
|
5119
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
5120
|
+
throw new import_protocols15.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
5121
|
+
}
|
|
5122
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
5123
|
+
throw new import_protocols15.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
5124
|
+
}
|
|
5125
|
+
return {
|
|
5126
|
+
storage: (0, import_random_access_storage.createStorage)({
|
|
5127
|
+
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
5128
|
+
root: getRootPath(config)
|
|
5129
|
+
})
|
|
5130
|
+
};
|
|
5131
|
+
};
|
|
5132
|
+
var toStorageType = (type) => {
|
|
5133
|
+
switch (type) {
|
|
5134
|
+
case void 0:
|
|
5135
|
+
return void 0;
|
|
5136
|
+
case StorageDriver.RAM:
|
|
5137
|
+
return import_random_access_storage.StorageType.RAM;
|
|
5138
|
+
case StorageDriver.CHROME:
|
|
5139
|
+
return import_random_access_storage.StorageType.CHROME;
|
|
5140
|
+
case StorageDriver.FIREFOX:
|
|
5141
|
+
return import_random_access_storage.StorageType.FIREFOX;
|
|
5142
|
+
case StorageDriver.IDB:
|
|
5143
|
+
return import_random_access_storage.StorageType.IDB;
|
|
5144
|
+
case StorageDriver.NODE:
|
|
5145
|
+
return import_random_access_storage.StorageType.NODE;
|
|
5146
|
+
case StorageDriver.WEBFS:
|
|
5147
|
+
return import_random_access_storage.StorageType.WEBFS;
|
|
5148
|
+
default:
|
|
5149
|
+
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
5150
|
+
}
|
|
5151
|
+
};
|
|
5152
|
+
var createLevel = async (config) => {
|
|
5153
|
+
const persistent = isPersistent(config);
|
|
5154
|
+
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys13.PublicKey.random().toHex()}`;
|
|
5155
|
+
const level = new import_level.Level(storagePath);
|
|
5156
|
+
await level.open();
|
|
5157
|
+
return level;
|
|
5158
|
+
};
|
|
5114
5159
|
var SystemServiceImpl = class {
|
|
5115
5160
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
5116
5161
|
this._config = config;
|
|
@@ -5130,9 +5175,9 @@ var SystemServiceImpl = class {
|
|
|
5130
5175
|
const diagnostics = await this._getDiagnostics();
|
|
5131
5176
|
return {
|
|
5132
5177
|
timestamp: /* @__PURE__ */ new Date(),
|
|
5133
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
5134
|
-
truncate: keys ===
|
|
5135
|
-
humanize: keys ===
|
|
5178
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util12.jsonKeyReplacer)({
|
|
5179
|
+
truncate: keys === import_services17.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
5180
|
+
humanize: keys === import_services17.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
5136
5181
|
})))
|
|
5137
5182
|
};
|
|
5138
5183
|
}
|
|
@@ -5180,16 +5225,18 @@ var ClientServicesHost = class {
|
|
|
5180
5225
|
transportFactory,
|
|
5181
5226
|
signalManager,
|
|
5182
5227
|
storage,
|
|
5228
|
+
level,
|
|
5183
5229
|
// TODO(wittjosiah): Turn this on by default.
|
|
5184
5230
|
lockKey,
|
|
5185
5231
|
callbacks,
|
|
5186
5232
|
runtimeParams
|
|
5187
5233
|
} = {}) {
|
|
5188
|
-
this._tracingService =
|
|
5234
|
+
this._tracingService = import_tracing8.TRACE_PROCESSOR.createTraceSender();
|
|
5189
5235
|
this._statusUpdate = new import_async16.Event();
|
|
5190
5236
|
this._opening = false;
|
|
5191
5237
|
this._open = false;
|
|
5192
5238
|
this._storage = storage;
|
|
5239
|
+
this._level = level;
|
|
5193
5240
|
this._callbacks = callbacks;
|
|
5194
5241
|
this._runtimeParams = runtimeParams;
|
|
5195
5242
|
if (config) {
|
|
@@ -5213,14 +5260,14 @@ var ClientServicesHost = class {
|
|
|
5213
5260
|
this._systemService = new SystemServiceImpl({
|
|
5214
5261
|
config: () => this._config,
|
|
5215
5262
|
statusUpdate: this._statusUpdate,
|
|
5216
|
-
getCurrentStatus: () => this.isOpen ?
|
|
5263
|
+
getCurrentStatus: () => this.isOpen ? import_services14.SystemStatus.ACTIVE : import_services14.SystemStatus.INACTIVE,
|
|
5217
5264
|
getDiagnostics: () => {
|
|
5218
5265
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
5219
5266
|
},
|
|
5220
5267
|
onUpdateStatus: async (status) => {
|
|
5221
|
-
if (!this.isOpen && status ===
|
|
5268
|
+
if (!this.isOpen && status === import_services14.SystemStatus.ACTIVE) {
|
|
5222
5269
|
await this._resourceLock?.acquire();
|
|
5223
|
-
} else if (this.isOpen && status ===
|
|
5270
|
+
} else if (this.isOpen && status === import_services14.SystemStatus.INACTIVE) {
|
|
5224
5271
|
await this._resourceLock?.release();
|
|
5225
5272
|
}
|
|
5226
5273
|
},
|
|
@@ -5228,8 +5275,9 @@ var ClientServicesHost = class {
|
|
|
5228
5275
|
await this.reset();
|
|
5229
5276
|
}
|
|
5230
5277
|
});
|
|
5278
|
+
this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
|
|
5231
5279
|
this._loggingService = new LoggingServiceImpl();
|
|
5232
|
-
this._serviceRegistry = new ServiceRegistry(
|
|
5280
|
+
this._serviceRegistry = new ServiceRegistry(import_client_protocol4.clientServiceBundle, {
|
|
5233
5281
|
SystemService: this._systemService,
|
|
5234
5282
|
TracingService: this._tracingService
|
|
5235
5283
|
});
|
|
@@ -5258,25 +5306,25 @@ var ClientServicesHost = class {
|
|
|
5258
5306
|
* Can only be called once.
|
|
5259
5307
|
*/
|
|
5260
5308
|
initialize({ config, ...options }) {
|
|
5261
|
-
(0,
|
|
5309
|
+
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
5262
5310
|
F: __dxlog_file18,
|
|
5263
|
-
L:
|
|
5311
|
+
L: 197,
|
|
5264
5312
|
S: this,
|
|
5265
5313
|
A: [
|
|
5266
5314
|
"!this._open",
|
|
5267
5315
|
"'service host is open'"
|
|
5268
5316
|
]
|
|
5269
5317
|
});
|
|
5270
|
-
(0,
|
|
5318
|
+
(0, import_log13.log)("initializing...", void 0, {
|
|
5271
5319
|
F: __dxlog_file18,
|
|
5272
|
-
L:
|
|
5320
|
+
L: 198,
|
|
5273
5321
|
S: this,
|
|
5274
5322
|
C: (f, a) => f(...a)
|
|
5275
5323
|
});
|
|
5276
5324
|
if (config) {
|
|
5277
|
-
(0,
|
|
5325
|
+
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
5278
5326
|
F: __dxlog_file18,
|
|
5279
|
-
L:
|
|
5327
|
+
L: 201,
|
|
5280
5328
|
S: this,
|
|
5281
5329
|
A: [
|
|
5282
5330
|
"!this._config",
|
|
@@ -5289,9 +5337,9 @@ var ClientServicesHost = class {
|
|
|
5289
5337
|
}
|
|
5290
5338
|
}
|
|
5291
5339
|
if (!options.signalManager) {
|
|
5292
|
-
|
|
5340
|
+
import_log13.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
5293
5341
|
F: __dxlog_file18,
|
|
5294
|
-
L:
|
|
5342
|
+
L: 209,
|
|
5295
5343
|
S: this,
|
|
5296
5344
|
C: (f, a) => f(...a)
|
|
5297
5345
|
});
|
|
@@ -5300,9 +5348,9 @@ var ClientServicesHost = class {
|
|
|
5300
5348
|
iceServers: this._config?.get("runtime.services.ice")
|
|
5301
5349
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
5302
5350
|
this._signalManager = signalManager;
|
|
5303
|
-
(0,
|
|
5351
|
+
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
5304
5352
|
F: __dxlog_file18,
|
|
5305
|
-
L:
|
|
5353
|
+
L: 220,
|
|
5306
5354
|
S: this,
|
|
5307
5355
|
A: [
|
|
5308
5356
|
"!this._networkManager",
|
|
@@ -5314,9 +5362,9 @@ var ClientServicesHost = class {
|
|
|
5314
5362
|
transportFactory,
|
|
5315
5363
|
signalManager
|
|
5316
5364
|
});
|
|
5317
|
-
(0,
|
|
5365
|
+
(0, import_log13.log)("initialized", void 0, {
|
|
5318
5366
|
F: __dxlog_file18,
|
|
5319
|
-
L:
|
|
5367
|
+
L: 227,
|
|
5320
5368
|
S: this,
|
|
5321
5369
|
C: (f, a) => f(...a)
|
|
5322
5370
|
});
|
|
@@ -5326,44 +5374,44 @@ var ClientServicesHost = class {
|
|
|
5326
5374
|
return;
|
|
5327
5375
|
}
|
|
5328
5376
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5329
|
-
|
|
5377
|
+
import_log13.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
5330
5378
|
id: traceId
|
|
5331
5379
|
}), {
|
|
5332
5380
|
F: __dxlog_file18,
|
|
5333
|
-
L:
|
|
5381
|
+
L: 238,
|
|
5334
5382
|
S: this,
|
|
5335
5383
|
C: (f, a) => f(...a)
|
|
5336
5384
|
});
|
|
5337
|
-
(0,
|
|
5385
|
+
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
5338
5386
|
F: __dxlog_file18,
|
|
5339
|
-
L:
|
|
5387
|
+
L: 240,
|
|
5340
5388
|
S: this,
|
|
5341
5389
|
A: [
|
|
5342
5390
|
"this._config",
|
|
5343
5391
|
"'config not set'"
|
|
5344
5392
|
]
|
|
5345
5393
|
});
|
|
5346
|
-
(0,
|
|
5394
|
+
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
5347
5395
|
F: __dxlog_file18,
|
|
5348
|
-
L:
|
|
5396
|
+
L: 241,
|
|
5349
5397
|
S: this,
|
|
5350
5398
|
A: [
|
|
5351
5399
|
"this._storage",
|
|
5352
5400
|
"'storage not set'"
|
|
5353
5401
|
]
|
|
5354
5402
|
});
|
|
5355
|
-
(0,
|
|
5403
|
+
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
5356
5404
|
F: __dxlog_file18,
|
|
5357
|
-
L:
|
|
5405
|
+
L: 242,
|
|
5358
5406
|
S: this,
|
|
5359
5407
|
A: [
|
|
5360
5408
|
"this._signalManager",
|
|
5361
5409
|
"'signal manager not set'"
|
|
5362
5410
|
]
|
|
5363
5411
|
});
|
|
5364
|
-
(0,
|
|
5412
|
+
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
5365
5413
|
F: __dxlog_file18,
|
|
5366
|
-
L:
|
|
5414
|
+
L: 243,
|
|
5367
5415
|
S: this,
|
|
5368
5416
|
A: [
|
|
5369
5417
|
"this._networkManager",
|
|
@@ -5371,17 +5419,21 @@ var ClientServicesHost = class {
|
|
|
5371
5419
|
]
|
|
5372
5420
|
});
|
|
5373
5421
|
this._opening = true;
|
|
5374
|
-
(0,
|
|
5422
|
+
(0, import_log13.log)("opening...", {
|
|
5375
5423
|
lockKey: this._resourceLock?.lockKey
|
|
5376
5424
|
}, {
|
|
5377
5425
|
F: __dxlog_file18,
|
|
5378
|
-
L:
|
|
5426
|
+
L: 246,
|
|
5379
5427
|
S: this,
|
|
5380
5428
|
C: (f, a) => f(...a)
|
|
5381
5429
|
});
|
|
5430
|
+
if (!this._level) {
|
|
5431
|
+
this._level = await createLevel(this._config.get("runtime.client.storage", {}));
|
|
5432
|
+
}
|
|
5433
|
+
await this._level.open();
|
|
5382
5434
|
await this._resourceLock?.acquire();
|
|
5383
5435
|
await this._loggingService.open();
|
|
5384
|
-
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5436
|
+
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5385
5437
|
this._serviceRegistry.setServices({
|
|
5386
5438
|
SystemService: this._systemService,
|
|
5387
5439
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
@@ -5391,7 +5443,7 @@ var ClientServicesHost = class {
|
|
|
5391
5443
|
await this._serviceContext.initialized.wait();
|
|
5392
5444
|
return this._serviceContext.dataSpaceManager;
|
|
5393
5445
|
}),
|
|
5394
|
-
DataService: new
|
|
5446
|
+
DataService: new import_echo_pipeline5.DataServiceImpl(this._serviceContext.automergeHost),
|
|
5395
5447
|
IndexService: new import_indexing2.IndexServiceImpl({
|
|
5396
5448
|
indexer: this._serviceContext.indexer,
|
|
5397
5449
|
automergeHost: this._serviceContext.automergeHost
|
|
@@ -5407,9 +5459,9 @@ var ClientServicesHost = class {
|
|
|
5407
5459
|
})
|
|
5408
5460
|
});
|
|
5409
5461
|
await this._serviceContext.open(ctx);
|
|
5410
|
-
(0,
|
|
5462
|
+
(0, import_invariant15.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5411
5463
|
F: __dxlog_file18,
|
|
5412
|
-
L:
|
|
5464
|
+
L: 314,
|
|
5413
5465
|
S: this,
|
|
5414
5466
|
A: [
|
|
5415
5467
|
"this.serviceRegistry.services.InvitationsService",
|
|
@@ -5417,11 +5469,11 @@ var ClientServicesHost = class {
|
|
|
5417
5469
|
]
|
|
5418
5470
|
});
|
|
5419
5471
|
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
5420
|
-
(0,
|
|
5472
|
+
(0, import_log13.log)("loaded persistent invitations", {
|
|
5421
5473
|
count: loadedInvitations.invitations?.length
|
|
5422
5474
|
}, {
|
|
5423
5475
|
F: __dxlog_file18,
|
|
5424
|
-
L:
|
|
5476
|
+
L: 317,
|
|
5425
5477
|
S: this,
|
|
5426
5478
|
C: (f, a) => f(...a)
|
|
5427
5479
|
});
|
|
@@ -5430,28 +5482,29 @@ var ClientServicesHost = class {
|
|
|
5430
5482
|
this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
|
|
5431
5483
|
url: devtoolsProxy,
|
|
5432
5484
|
requested: {},
|
|
5433
|
-
exposed:
|
|
5485
|
+
exposed: import_client_protocol4.clientServiceBundle,
|
|
5434
5486
|
handlers: this.services
|
|
5435
5487
|
});
|
|
5436
5488
|
void this._devtoolsProxy.open();
|
|
5437
5489
|
}
|
|
5490
|
+
this.diagnosticsBroadcastHandler.start();
|
|
5438
5491
|
this._opening = false;
|
|
5439
5492
|
this._open = true;
|
|
5440
5493
|
this._statusUpdate.emit();
|
|
5441
5494
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
5442
|
-
(0,
|
|
5495
|
+
(0, import_log13.log)("opened", {
|
|
5443
5496
|
deviceKey
|
|
5444
5497
|
}, {
|
|
5445
5498
|
F: __dxlog_file18,
|
|
5446
|
-
L:
|
|
5499
|
+
L: 335,
|
|
5447
5500
|
S: this,
|
|
5448
5501
|
C: (f, a) => f(...a)
|
|
5449
5502
|
});
|
|
5450
|
-
|
|
5503
|
+
import_log13.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
5451
5504
|
id: traceId
|
|
5452
5505
|
}), {
|
|
5453
5506
|
F: __dxlog_file18,
|
|
5454
|
-
L:
|
|
5507
|
+
L: 336,
|
|
5455
5508
|
S: this,
|
|
5456
5509
|
C: (f, a) => f(...a)
|
|
5457
5510
|
});
|
|
@@ -5461,60 +5514,62 @@ var ClientServicesHost = class {
|
|
|
5461
5514
|
return;
|
|
5462
5515
|
}
|
|
5463
5516
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
5464
|
-
(0,
|
|
5517
|
+
(0, import_log13.log)("closing...", {
|
|
5465
5518
|
deviceKey
|
|
5466
5519
|
}, {
|
|
5467
5520
|
F: __dxlog_file18,
|
|
5468
|
-
L:
|
|
5521
|
+
L: 347,
|
|
5469
5522
|
S: this,
|
|
5470
5523
|
C: (f, a) => f(...a)
|
|
5471
5524
|
});
|
|
5525
|
+
this.diagnosticsBroadcastHandler.stop();
|
|
5472
5526
|
await this._devtoolsProxy?.close();
|
|
5473
5527
|
this._serviceRegistry.setServices({
|
|
5474
5528
|
SystemService: this._systemService
|
|
5475
5529
|
});
|
|
5476
5530
|
await this._loggingService.close();
|
|
5477
5531
|
await this._serviceContext.close();
|
|
5532
|
+
await this._level?.close();
|
|
5478
5533
|
this._open = false;
|
|
5479
5534
|
this._statusUpdate.emit();
|
|
5480
|
-
(0,
|
|
5535
|
+
(0, import_log13.log)("closed", {
|
|
5481
5536
|
deviceKey
|
|
5482
5537
|
}, {
|
|
5483
5538
|
F: __dxlog_file18,
|
|
5484
|
-
L:
|
|
5539
|
+
L: 356,
|
|
5485
5540
|
S: this,
|
|
5486
5541
|
C: (f, a) => f(...a)
|
|
5487
5542
|
});
|
|
5488
5543
|
}
|
|
5489
5544
|
async reset() {
|
|
5490
5545
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5491
|
-
|
|
5546
|
+
import_log13.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
5492
5547
|
id: traceId
|
|
5493
5548
|
}), {
|
|
5494
5549
|
F: __dxlog_file18,
|
|
5495
|
-
L:
|
|
5550
|
+
L: 361,
|
|
5496
5551
|
S: this,
|
|
5497
5552
|
C: (f, a) => f(...a)
|
|
5498
5553
|
});
|
|
5499
|
-
(0,
|
|
5554
|
+
(0, import_log13.log)("resetting...", void 0, {
|
|
5500
5555
|
F: __dxlog_file18,
|
|
5501
|
-
L:
|
|
5556
|
+
L: 363,
|
|
5502
5557
|
S: this,
|
|
5503
5558
|
C: (f, a) => f(...a)
|
|
5504
5559
|
});
|
|
5505
5560
|
await this._serviceContext?.close();
|
|
5506
5561
|
await this._storage.reset();
|
|
5507
|
-
(0,
|
|
5562
|
+
(0, import_log13.log)("reset", void 0, {
|
|
5508
5563
|
F: __dxlog_file18,
|
|
5509
|
-
L:
|
|
5564
|
+
L: 366,
|
|
5510
5565
|
S: this,
|
|
5511
5566
|
C: (f, a) => f(...a)
|
|
5512
5567
|
});
|
|
5513
|
-
|
|
5568
|
+
import_log13.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
5514
5569
|
id: traceId
|
|
5515
5570
|
}), {
|
|
5516
5571
|
F: __dxlog_file18,
|
|
5517
|
-
L:
|
|
5572
|
+
L: 367,
|
|
5518
5573
|
S: this,
|
|
5519
5574
|
C: (f, a) => f(...a)
|
|
5520
5575
|
});
|
|
@@ -5524,12 +5579,10 @@ var ClientServicesHost = class {
|
|
|
5524
5579
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5525
5580
|
await this._serviceContext.initialized.wait();
|
|
5526
5581
|
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
5527
|
-
const obj = new import_client_protocol5.Properties(void 0);
|
|
5528
|
-
obj[import_client_protocol5.defaultKey] = identity.identityKey.toHex();
|
|
5529
5582
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5530
|
-
(0,
|
|
5583
|
+
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5531
5584
|
F: __dxlog_file18,
|
|
5532
|
-
L:
|
|
5585
|
+
L: 379,
|
|
5533
5586
|
S: this,
|
|
5534
5587
|
A: [
|
|
5535
5588
|
"automergeIndex",
|
|
@@ -5538,41 +5591,88 @@ var ClientServicesHost = class {
|
|
|
5538
5591
|
});
|
|
5539
5592
|
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5540
5593
|
await document.whenReady();
|
|
5594
|
+
const properties = {
|
|
5595
|
+
system: {
|
|
5596
|
+
type: (0, import_echo_pipeline5.encodeReference)(E.getTypeReference(import_client_protocol4.Properties))
|
|
5597
|
+
},
|
|
5598
|
+
data: {
|
|
5599
|
+
[import_client_protocol4.defaultKey]: identity.identityKey.toHex()
|
|
5600
|
+
},
|
|
5601
|
+
meta: {
|
|
5602
|
+
keys: []
|
|
5603
|
+
}
|
|
5604
|
+
};
|
|
5605
|
+
const propertiesId = import_keys11.PublicKey.random().toHex();
|
|
5541
5606
|
document.change((doc) => {
|
|
5542
5607
|
(0, import_util9.assignDeep)(doc, [
|
|
5543
5608
|
"objects",
|
|
5544
|
-
|
|
5545
|
-
],
|
|
5609
|
+
propertiesId
|
|
5610
|
+
], properties);
|
|
5546
5611
|
});
|
|
5612
|
+
await this._serviceContext.automergeHost.repo.flush();
|
|
5547
5613
|
return identity;
|
|
5548
5614
|
}
|
|
5549
5615
|
};
|
|
5550
5616
|
_ts_decorate8([
|
|
5551
|
-
|
|
5617
|
+
import_tracing8.trace.info()
|
|
5552
5618
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
5553
5619
|
_ts_decorate8([
|
|
5554
|
-
|
|
5620
|
+
import_tracing8.trace.info()
|
|
5555
5621
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
5556
5622
|
_ts_decorate8([
|
|
5557
5623
|
import_async16.synchronized,
|
|
5558
|
-
|
|
5624
|
+
import_tracing8.trace.span()
|
|
5559
5625
|
], ClientServicesHost.prototype, "open", null);
|
|
5560
5626
|
_ts_decorate8([
|
|
5561
5627
|
import_async16.synchronized,
|
|
5562
|
-
|
|
5628
|
+
import_tracing8.trace.span()
|
|
5563
5629
|
], ClientServicesHost.prototype, "close", null);
|
|
5564
5630
|
ClientServicesHost = _ts_decorate8([
|
|
5565
|
-
|
|
5631
|
+
import_tracing8.trace.resource()
|
|
5566
5632
|
], ClientServicesHost);
|
|
5633
|
+
var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
|
|
5634
|
+
var DiagnosticsCollector = class {
|
|
5635
|
+
static {
|
|
5636
|
+
this.broadcastSender = createCollectDiagnosticsBroadcastSender();
|
|
5637
|
+
}
|
|
5638
|
+
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
5639
|
+
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
5640
|
+
keys: options.humanize ? import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
5641
|
+
});
|
|
5642
|
+
const clientDiagnostics = {
|
|
5643
|
+
config,
|
|
5644
|
+
trace: import_tracing7.TRACE_PROCESSOR.getDiagnostics()
|
|
5645
|
+
};
|
|
5646
|
+
const diagnostics = serviceDiagnostics != null ? {
|
|
5647
|
+
client: clientDiagnostics,
|
|
5648
|
+
services: serviceDiagnostics
|
|
5649
|
+
} : {
|
|
5650
|
+
client: clientDiagnostics,
|
|
5651
|
+
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
5652
|
+
};
|
|
5653
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util8.jsonKeyReplacer)(options)));
|
|
5654
|
+
}
|
|
5655
|
+
};
|
|
5656
|
+
var findSystemServiceProvider = () => {
|
|
5657
|
+
const serviceProviders = import_tracing7.TRACE_PROCESSOR.findByAnnotation(ClientServicesProviderResource);
|
|
5658
|
+
const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
|
|
5659
|
+
return providerResource?.instance?.deref() ?? null;
|
|
5660
|
+
};
|
|
5661
|
+
var findConfigs = () => {
|
|
5662
|
+
const configs = import_tracing7.TRACE_PROCESSOR.findByAnnotation(import_config.ConfigResource);
|
|
5663
|
+
return configs.map((r) => r.instance.deref()).filter(import_util8.nonNullable);
|
|
5664
|
+
};
|
|
5567
5665
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5568
5666
|
0 && (module.exports = {
|
|
5569
5667
|
ClientRpcServer,
|
|
5570
5668
|
ClientServicesHost,
|
|
5669
|
+
ClientServicesProviderResource,
|
|
5571
5670
|
DataSpace,
|
|
5572
5671
|
DataSpaceManager,
|
|
5573
5672
|
DeviceInvitationProtocol,
|
|
5574
5673
|
DevtoolsHostEvents,
|
|
5575
5674
|
DevtoolsServiceImpl,
|
|
5675
|
+
DiagnosticsCollector,
|
|
5576
5676
|
Identity,
|
|
5577
5677
|
IdentityManager,
|
|
5578
5678
|
IdentityServiceImpl,
|
|
@@ -5585,10 +5685,12 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5585
5685
|
SpacesServiceImpl,
|
|
5586
5686
|
TrustedKeySetAuthVerifier,
|
|
5587
5687
|
createAuthProvider,
|
|
5688
|
+
createCollectDiagnosticsBroadcastHandler,
|
|
5689
|
+
createCollectDiagnosticsBroadcastSender,
|
|
5588
5690
|
createDiagnostics,
|
|
5691
|
+
createLevel,
|
|
5589
5692
|
createStorageObjects,
|
|
5590
5693
|
getNetworkPeers,
|
|
5591
|
-
invitationExpired,
|
|
5592
5694
|
isLocked,
|
|
5593
5695
|
subscribeToFeedBlocks,
|
|
5594
5696
|
subscribeToFeeds,
|
|
@@ -5598,4 +5700,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5598
5700
|
subscribeToSpaces,
|
|
5599
5701
|
subscribeToSwarmInfo
|
|
5600
5702
|
});
|
|
5601
|
-
//# sourceMappingURL=chunk-
|
|
5703
|
+
//# sourceMappingURL=chunk-HMAV5VTX.cjs.map
|