@dxos/client-services 0.4.10-main.d4b5989 → 0.4.10-main.d51f2c2
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-NVWVJTJQ.mjs → chunk-XFMDHPOR.mjs} +879 -628
- package/dist/lib/browser/chunk-XFMDHPOR.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -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-TDMSEYNL.cjs → chunk-55TN3KPR.cjs} +842 -678
- package/dist/lib/node/chunk-55TN3KPR.cjs.map +7 -0
- package/dist/lib/node/index.cjs +48 -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/invitation-extension.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -2
- 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/invitation-extension.ts +28 -1
- package/src/packlets/invitations/invitations-handler.ts +73 -32
- 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-NVWVJTJQ.mjs.map +0 -7
- package/dist/lib/node/chunk-TDMSEYNL.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_55TN3KPR_exports = {};
|
|
30
|
+
__export(chunk_55TN3KPR_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,
|
|
@@ -46,11 +48,14 @@ __export(chunk_TDMSEYNL_exports, {
|
|
|
46
48
|
SpaceInvitationProtocol: () => SpaceInvitationProtocol,
|
|
47
49
|
SpacesServiceImpl: () => SpacesServiceImpl,
|
|
48
50
|
TrustedKeySetAuthVerifier: () => TrustedKeySetAuthVerifier,
|
|
51
|
+
createAdmissionKeypair: () => createAdmissionKeypair,
|
|
49
52
|
createAuthProvider: () => createAuthProvider,
|
|
53
|
+
createCollectDiagnosticsBroadcastHandler: () => createCollectDiagnosticsBroadcastHandler,
|
|
54
|
+
createCollectDiagnosticsBroadcastSender: () => createCollectDiagnosticsBroadcastSender,
|
|
50
55
|
createDiagnostics: () => createDiagnostics,
|
|
56
|
+
createLevel: () => createLevel,
|
|
51
57
|
createStorageObjects: () => createStorageObjects,
|
|
52
58
|
getNetworkPeers: () => getNetworkPeers,
|
|
53
|
-
invitationExpired: () => invitationExpired,
|
|
54
59
|
isLocked: () => isLocked,
|
|
55
60
|
subscribeToFeedBlocks: () => subscribeToFeedBlocks,
|
|
56
61
|
subscribeToFeeds: () => subscribeToFeeds,
|
|
@@ -60,7 +65,7 @@ __export(chunk_TDMSEYNL_exports, {
|
|
|
60
65
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
66
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
67
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
68
|
+
module.exports = __toCommonJS(chunk_55TN3KPR_exports);
|
|
64
69
|
var import_async = require("@dxos/async");
|
|
65
70
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
71
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -115,6 +120,7 @@ var import_async7 = require("@dxos/async");
|
|
|
115
120
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
116
121
|
var import_context4 = require("@dxos/context");
|
|
117
122
|
var import_credentials7 = require("@dxos/credentials");
|
|
123
|
+
var import_crypto = require("@dxos/crypto");
|
|
118
124
|
var import_invariant5 = require("@dxos/invariant");
|
|
119
125
|
var import_keys5 = require("@dxos/keys");
|
|
120
126
|
var import_log4 = require("@dxos/log");
|
|
@@ -124,6 +130,7 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
124
130
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
125
131
|
var import_async8 = require("@dxos/async");
|
|
126
132
|
var import_context5 = require("@dxos/context");
|
|
133
|
+
var import_crypto2 = require("@dxos/crypto");
|
|
127
134
|
var import_invariant6 = require("@dxos/invariant");
|
|
128
135
|
var import_keys6 = require("@dxos/keys");
|
|
129
136
|
var import_log5 = require("@dxos/log");
|
|
@@ -134,6 +141,7 @@ var import_teleport = require("@dxos/teleport");
|
|
|
134
141
|
var import_async9 = require("@dxos/async");
|
|
135
142
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
136
143
|
var import_context6 = require("@dxos/context");
|
|
144
|
+
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
137
145
|
var import_invariant7 = require("@dxos/invariant");
|
|
138
146
|
var import_log6 = require("@dxos/log");
|
|
139
147
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
@@ -147,117 +155,127 @@ var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
|
147
155
|
var import_debug2 = require("@dxos/debug");
|
|
148
156
|
var import_rpc = require("@dxos/rpc");
|
|
149
157
|
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
158
|
var import_async10 = require("@dxos/async");
|
|
158
159
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
159
160
|
var import_context7 = require("@dxos/context");
|
|
160
161
|
var import_debug3 = require("@dxos/debug");
|
|
161
162
|
var import_echo_db = require("@dxos/echo-db");
|
|
162
|
-
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
163
163
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
164
|
-
var
|
|
164
|
+
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
165
|
+
var import_invariant9 = require("@dxos/invariant");
|
|
165
166
|
var import_keys7 = require("@dxos/keys");
|
|
166
167
|
var import_log8 = require("@dxos/log");
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
var
|
|
168
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
169
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
170
|
+
var import_credentials9 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
170
171
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
171
|
-
var
|
|
172
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
172
173
|
var import_util4 = require("@dxos/util");
|
|
173
174
|
var import_async11 = require("@dxos/async");
|
|
174
|
-
var
|
|
175
|
+
var import_credentials10 = require("@dxos/credentials");
|
|
175
176
|
var import_async12 = require("@dxos/async");
|
|
176
177
|
var import_context8 = require("@dxos/context");
|
|
177
|
-
var
|
|
178
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
178
179
|
var import_keys8 = require("@dxos/keys");
|
|
179
180
|
var import_log9 = require("@dxos/log");
|
|
180
|
-
var
|
|
181
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
181
182
|
var import_teleport2 = require("@dxos/teleport");
|
|
182
183
|
var import_util5 = require("@dxos/util");
|
|
183
184
|
var import_async13 = require("@dxos/async");
|
|
184
185
|
var import_context9 = require("@dxos/context");
|
|
185
|
-
var
|
|
186
|
-
var
|
|
186
|
+
var import_credentials11 = require("@dxos/credentials");
|
|
187
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
187
188
|
var import_keys9 = require("@dxos/keys");
|
|
188
189
|
var import_log10 = require("@dxos/log");
|
|
189
|
-
var
|
|
190
|
-
var
|
|
190
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
191
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
191
192
|
var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
|
|
192
193
|
var import_util6 = require("@dxos/util");
|
|
193
|
-
var
|
|
194
|
+
var import_credentials12 = require("@dxos/credentials");
|
|
194
195
|
var import_debug4 = require("@dxos/debug");
|
|
195
|
-
var
|
|
196
|
+
var import_credentials13 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
196
197
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
197
198
|
var import_async14 = require("@dxos/async");
|
|
198
|
-
var
|
|
199
|
+
var import_codec_protobuf10 = require("@dxos/codec-protobuf");
|
|
199
200
|
var import_debug5 = require("@dxos/debug");
|
|
200
|
-
var
|
|
201
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
201
202
|
var import_log11 = require("@dxos/log");
|
|
202
|
-
var
|
|
203
|
-
var
|
|
203
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
204
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
204
205
|
var import_async15 = require("@dxos/async");
|
|
205
206
|
var import_context10 = require("@dxos/context");
|
|
206
|
-
var
|
|
207
|
+
var import_credentials14 = require("@dxos/credentials");
|
|
207
208
|
var import_debug6 = require("@dxos/debug");
|
|
208
|
-
var
|
|
209
|
+
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
209
210
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
210
211
|
var import_indexing = require("@dxos/indexing");
|
|
211
|
-
var
|
|
212
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
212
213
|
var import_keyring = require("@dxos/keyring");
|
|
213
214
|
var import_keys10 = require("@dxos/keys");
|
|
214
215
|
var import_log12 = require("@dxos/log");
|
|
215
|
-
var
|
|
216
|
-
var
|
|
216
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
217
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
217
218
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
218
|
-
var
|
|
219
|
+
var import_tracing5 = require("@dxos/tracing");
|
|
219
220
|
var import_util7 = require("@dxos/util");
|
|
220
221
|
var import_automerge = require("@dxos/automerge/automerge");
|
|
221
222
|
var import_debug7 = require("@dxos/debug");
|
|
223
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
224
|
+
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
225
|
+
var import_credentials15 = require("@dxos/credentials");
|
|
226
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
222
227
|
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");
|
|
228
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
229
|
+
var import_tracing6 = require("@dxos/tracing");
|
|
230
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
231
|
+
var import_config = require("@dxos/config");
|
|
232
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
233
|
+
var import_tracing7 = require("@dxos/tracing");
|
|
230
234
|
var import_util8 = require("@dxos/util");
|
|
231
235
|
var import_async16 = require("@dxos/async");
|
|
232
|
-
var
|
|
236
|
+
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
233
237
|
var import_context11 = require("@dxos/context");
|
|
234
|
-
var
|
|
238
|
+
var import_echo_pipeline5 = require("@dxos/echo-pipeline");
|
|
235
239
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
236
240
|
var import_indexing2 = require("@dxos/indexing");
|
|
237
|
-
var
|
|
241
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
238
242
|
var import_keys11 = require("@dxos/keys");
|
|
239
|
-
var
|
|
243
|
+
var import_log13 = require("@dxos/log");
|
|
240
244
|
var import_messaging = require("@dxos/messaging");
|
|
241
245
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
242
|
-
var
|
|
243
|
-
var
|
|
244
|
-
var
|
|
246
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
247
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
248
|
+
var import_tracing8 = require("@dxos/tracing");
|
|
245
249
|
var import_util9 = require("@dxos/util");
|
|
246
250
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
247
251
|
var import_async17 = require("@dxos/async");
|
|
248
252
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
253
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
254
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
249
255
|
var import_invariant17 = require("@dxos/invariant");
|
|
250
|
-
var
|
|
256
|
+
var import_lock_file = require("@dxos/lock-file");
|
|
257
|
+
var import_log14 = require("@dxos/log");
|
|
251
258
|
var import_async18 = require("@dxos/async");
|
|
252
259
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
253
260
|
var import_keys12 = require("@dxos/keys");
|
|
254
261
|
var import_log15 = require("@dxos/log");
|
|
255
|
-
var
|
|
262
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
256
263
|
var import_util10 = require("@dxos/util");
|
|
257
264
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
258
|
-
var
|
|
259
|
-
var
|
|
265
|
+
var import_protocols15 = require("@dxos/protocols");
|
|
266
|
+
var import_config2 = require("@dxos/protocols/proto/dxos/config");
|
|
267
|
+
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
268
|
+
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
269
|
+
var import_config3 = require("@dxos/protocols/proto/dxos/config");
|
|
260
270
|
var import_util11 = require("@dxos/util");
|
|
271
|
+
var import_level = require("level");
|
|
272
|
+
var import_node_path = __toESM(require("node:path"));
|
|
273
|
+
var import_keys13 = require("@dxos/keys");
|
|
274
|
+
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
275
|
+
var import_services17 = require("@dxos/protocols/proto/dxos/client/services");
|
|
276
|
+
var import_util12 = require("@dxos/util");
|
|
277
|
+
var import_keys14 = require("@dxos/keys");
|
|
278
|
+
var import_util13 = require("@dxos/util");
|
|
261
279
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
262
280
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
263
281
|
const subscriptions = new import_async.EventSubscriptions();
|
|
@@ -1470,6 +1488,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1470
1488
|
this._callbacks = _callbacks;
|
|
1471
1489
|
this._ctx = new import_context5.Context();
|
|
1472
1490
|
this._remoteOptionsTrigger = new import_async8.Trigger();
|
|
1491
|
+
this._challenge = void 0;
|
|
1473
1492
|
this.invitation = void 0;
|
|
1474
1493
|
this.guestProfile = void 0;
|
|
1475
1494
|
this.authenticationPassed = false;
|
|
@@ -1484,7 +1503,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1484
1503
|
options: async (options) => {
|
|
1485
1504
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1486
1505
|
F: __dxlog_file6,
|
|
1487
|
-
L:
|
|
1506
|
+
L: 90,
|
|
1488
1507
|
S: this,
|
|
1489
1508
|
A: [
|
|
1490
1509
|
"!this._remoteOptions",
|
|
@@ -1501,7 +1520,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1501
1520
|
id: traceId
|
|
1502
1521
|
}), {
|
|
1503
1522
|
F: __dxlog_file6,
|
|
1504
|
-
L:
|
|
1523
|
+
L: 99,
|
|
1505
1524
|
S: this,
|
|
1506
1525
|
C: (f, a) => f(...a)
|
|
1507
1526
|
});
|
|
@@ -1511,7 +1530,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1511
1530
|
invitationId
|
|
1512
1531
|
}, {
|
|
1513
1532
|
F: __dxlog_file6,
|
|
1514
|
-
L:
|
|
1533
|
+
L: 103,
|
|
1515
1534
|
S: this,
|
|
1516
1535
|
C: (f, a) => f(...a)
|
|
1517
1536
|
});
|
|
@@ -1525,7 +1544,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1525
1544
|
guestProfile: profile
|
|
1526
1545
|
}, {
|
|
1527
1546
|
F: __dxlog_file6,
|
|
1528
|
-
L:
|
|
1547
|
+
L: 112,
|
|
1529
1548
|
S: this,
|
|
1530
1549
|
C: (f, a) => f(...a)
|
|
1531
1550
|
});
|
|
@@ -1534,25 +1553,27 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1534
1553
|
...this.invitation,
|
|
1535
1554
|
state: import_services4.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1536
1555
|
});
|
|
1556
|
+
this._challenge = this.invitation.authMethod === import_services4.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? (0, import_crypto2.randomBytes)(32) : void 0;
|
|
1537
1557
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1538
1558
|
id: traceId
|
|
1539
1559
|
}), {
|
|
1540
1560
|
F: __dxlog_file6,
|
|
1541
|
-
L:
|
|
1561
|
+
L: 122,
|
|
1542
1562
|
S: this,
|
|
1543
1563
|
C: (f, a) => f(...a)
|
|
1544
1564
|
});
|
|
1545
1565
|
return {
|
|
1546
|
-
authMethod: this.invitation.authMethod
|
|
1566
|
+
authMethod: this.invitation.authMethod,
|
|
1567
|
+
challenge: this._challenge
|
|
1547
1568
|
};
|
|
1548
1569
|
},
|
|
1549
|
-
authenticate: async ({ authCode: code }) => {
|
|
1570
|
+
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
1550
1571
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1551
1572
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.begin({
|
|
1552
1573
|
id: traceId
|
|
1553
1574
|
}), {
|
|
1554
1575
|
F: __dxlog_file6,
|
|
1555
|
-
L:
|
|
1576
|
+
L: 131,
|
|
1556
1577
|
S: this,
|
|
1557
1578
|
C: (f, a) => f(...a)
|
|
1558
1579
|
});
|
|
@@ -1560,14 +1581,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1560
1581
|
authCode: code
|
|
1561
1582
|
}, {
|
|
1562
1583
|
F: __dxlog_file6,
|
|
1563
|
-
L:
|
|
1584
|
+
L: 132,
|
|
1564
1585
|
S: this,
|
|
1565
1586
|
C: (f, a) => f(...a)
|
|
1566
1587
|
});
|
|
1567
1588
|
let status = import_invitations2.AuthenticationResponse.Status.OK;
|
|
1568
1589
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1569
1590
|
F: __dxlog_file6,
|
|
1570
|
-
L:
|
|
1591
|
+
L: 135,
|
|
1571
1592
|
S: this,
|
|
1572
1593
|
A: [
|
|
1573
1594
|
"this.invitation",
|
|
@@ -1578,7 +1599,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1578
1599
|
case import_services4.Invitation.AuthMethod.NONE: {
|
|
1579
1600
|
(0, import_log5.log)("authentication not required", void 0, {
|
|
1580
1601
|
F: __dxlog_file6,
|
|
1581
|
-
L:
|
|
1602
|
+
L: 138,
|
|
1582
1603
|
S: this,
|
|
1583
1604
|
C: (f, a) => f(...a)
|
|
1584
1605
|
});
|
|
@@ -1598,12 +1619,25 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1598
1619
|
}
|
|
1599
1620
|
break;
|
|
1600
1621
|
}
|
|
1622
|
+
case import_services4.Invitation.AuthMethod.KNOWN_PUBLIC_KEY: {
|
|
1623
|
+
if (!this.invitation.guestKeypair) {
|
|
1624
|
+
status = import_invitations2.AuthenticationResponse.Status.INTERNAL_ERROR;
|
|
1625
|
+
break;
|
|
1626
|
+
}
|
|
1627
|
+
const isSignatureValid = this._challenge && (0, import_crypto2.verify)(this._challenge, Buffer.from(signedChallenge ?? []), this.invitation.guestKeypair.publicKey.asBuffer());
|
|
1628
|
+
if (isSignatureValid) {
|
|
1629
|
+
this.authenticationPassed = true;
|
|
1630
|
+
} else {
|
|
1631
|
+
status = import_invitations2.AuthenticationResponse.Status.INVALID_SIGNATURE;
|
|
1632
|
+
}
|
|
1633
|
+
break;
|
|
1634
|
+
}
|
|
1601
1635
|
default: {
|
|
1602
1636
|
import_log5.log.error("invalid authentication method", {
|
|
1603
1637
|
authMethod: this.invitation.authMethod
|
|
1604
1638
|
}, {
|
|
1605
1639
|
F: __dxlog_file6,
|
|
1606
|
-
L:
|
|
1640
|
+
L: 176,
|
|
1607
1641
|
S: this,
|
|
1608
1642
|
C: (f, a) => f(...a)
|
|
1609
1643
|
});
|
|
@@ -1618,7 +1652,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1618
1652
|
}
|
|
1619
1653
|
}), {
|
|
1620
1654
|
F: __dxlog_file6,
|
|
1621
|
-
L:
|
|
1655
|
+
L: 182,
|
|
1622
1656
|
S: this,
|
|
1623
1657
|
C: (f, a) => f(...a)
|
|
1624
1658
|
});
|
|
@@ -1632,14 +1666,14 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1632
1666
|
id: traceId
|
|
1633
1667
|
}), {
|
|
1634
1668
|
F: __dxlog_file6,
|
|
1635
|
-
L:
|
|
1669
|
+
L: 188,
|
|
1636
1670
|
S: this,
|
|
1637
1671
|
C: (f, a) => f(...a)
|
|
1638
1672
|
});
|
|
1639
1673
|
try {
|
|
1640
1674
|
(0, import_invariant6.invariant)(this.invitation, "Invitation is not set.", {
|
|
1641
1675
|
F: __dxlog_file6,
|
|
1642
|
-
L:
|
|
1676
|
+
L: 191,
|
|
1643
1677
|
S: this,
|
|
1644
1678
|
A: [
|
|
1645
1679
|
"this.invitation",
|
|
@@ -1654,7 +1688,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1654
1688
|
id: traceId
|
|
1655
1689
|
}), {
|
|
1656
1690
|
F: __dxlog_file6,
|
|
1657
|
-
L:
|
|
1691
|
+
L: 199,
|
|
1658
1692
|
S: this,
|
|
1659
1693
|
C: (f, a) => f(...a)
|
|
1660
1694
|
});
|
|
@@ -1711,7 +1745,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1711
1745
|
options: async (options) => {
|
|
1712
1746
|
(0, import_invariant6.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1713
1747
|
F: __dxlog_file6,
|
|
1714
|
-
L:
|
|
1748
|
+
L: 266,
|
|
1715
1749
|
S: this,
|
|
1716
1750
|
A: [
|
|
1717
1751
|
"!this._remoteOptions",
|
|
@@ -1738,7 +1772,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1738
1772
|
try {
|
|
1739
1773
|
(0, import_log5.log)("begin options", void 0, {
|
|
1740
1774
|
F: __dxlog_file6,
|
|
1741
|
-
L:
|
|
1775
|
+
L: 287,
|
|
1742
1776
|
S: this,
|
|
1743
1777
|
C: (f, a) => f(...a)
|
|
1744
1778
|
});
|
|
@@ -1750,7 +1784,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1750
1784
|
}));
|
|
1751
1785
|
(0, import_log5.log)("end options", void 0, {
|
|
1752
1786
|
F: __dxlog_file6,
|
|
1753
|
-
L:
|
|
1787
|
+
L: 290,
|
|
1754
1788
|
S: this,
|
|
1755
1789
|
C: (f, a) => f(...a)
|
|
1756
1790
|
});
|
|
@@ -1764,7 +1798,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1764
1798
|
} catch (err) {
|
|
1765
1799
|
(0, import_log5.log)("openError", err, {
|
|
1766
1800
|
F: __dxlog_file6,
|
|
1767
|
-
L:
|
|
1801
|
+
L: 300,
|
|
1768
1802
|
S: this,
|
|
1769
1803
|
C: (f, a) => f(...a)
|
|
1770
1804
|
});
|
|
@@ -1774,7 +1808,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1774
1808
|
async onClose() {
|
|
1775
1809
|
(0, import_log5.log)("onClose", void 0, {
|
|
1776
1810
|
F: __dxlog_file6,
|
|
1777
|
-
L:
|
|
1811
|
+
L: 306,
|
|
1778
1812
|
S: this,
|
|
1779
1813
|
C: (f, a) => f(...a)
|
|
1780
1814
|
});
|
|
@@ -1791,11 +1825,11 @@ var InvitationsHandler = class {
|
|
|
1791
1825
|
this._networkManager = _networkManager;
|
|
1792
1826
|
}
|
|
1793
1827
|
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 =
|
|
1828
|
+
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 = options?.authMethod !== import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, lifetime = 86400, multiUse = false } = options ?? {};
|
|
1795
1829
|
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1796
1830
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1797
1831
|
F: __dxlog_file7,
|
|
1798
|
-
L:
|
|
1832
|
+
L: 87,
|
|
1799
1833
|
S: this,
|
|
1800
1834
|
A: [
|
|
1801
1835
|
"protocol",
|
|
@@ -1810,9 +1844,11 @@ var InvitationsHandler = class {
|
|
|
1810
1844
|
swarmKey,
|
|
1811
1845
|
authCode,
|
|
1812
1846
|
timeout,
|
|
1813
|
-
persistent,
|
|
1847
|
+
persistent: persistent && type !== import_services3.Invitation.Type.DELEGATED,
|
|
1848
|
+
guestKeypair: guestKeypair ?? (authMethod === import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? createAdmissionKeypair() : void 0),
|
|
1814
1849
|
created,
|
|
1815
1850
|
lifetime,
|
|
1851
|
+
multiUse,
|
|
1816
1852
|
...protocol.getInvitationContext()
|
|
1817
1853
|
};
|
|
1818
1854
|
const stream = new import_async7.PushStream();
|
|
@@ -1827,7 +1863,7 @@ var InvitationsHandler = class {
|
|
|
1827
1863
|
...protocol.toJSON()
|
|
1828
1864
|
}, {
|
|
1829
1865
|
F: __dxlog_file7,
|
|
1830
|
-
L:
|
|
1866
|
+
L: 115,
|
|
1831
1867
|
S: this,
|
|
1832
1868
|
C: (f, a) => f(...a)
|
|
1833
1869
|
});
|
|
@@ -1852,7 +1888,7 @@ var InvitationsHandler = class {
|
|
|
1852
1888
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1853
1889
|
(0, import_invariant5.invariant)(deviceKey, void 0, {
|
|
1854
1890
|
F: __dxlog_file7,
|
|
1855
|
-
L:
|
|
1891
|
+
L: 136,
|
|
1856
1892
|
S: this,
|
|
1857
1893
|
A: [
|
|
1858
1894
|
"deviceKey",
|
|
@@ -1875,7 +1911,7 @@ var InvitationsHandler = class {
|
|
|
1875
1911
|
id: traceId
|
|
1876
1912
|
}), {
|
|
1877
1913
|
F: __dxlog_file7,
|
|
1878
|
-
L:
|
|
1914
|
+
L: 154,
|
|
1879
1915
|
S: this,
|
|
1880
1916
|
C: (f, a) => f(...a)
|
|
1881
1917
|
});
|
|
@@ -1883,7 +1919,7 @@ var InvitationsHandler = class {
|
|
|
1883
1919
|
...protocol.toJSON()
|
|
1884
1920
|
}, {
|
|
1885
1921
|
F: __dxlog_file7,
|
|
1886
|
-
L:
|
|
1922
|
+
L: 155,
|
|
1887
1923
|
S: this,
|
|
1888
1924
|
C: (f, a) => f(...a)
|
|
1889
1925
|
});
|
|
@@ -1899,7 +1935,7 @@ var InvitationsHandler = class {
|
|
|
1899
1935
|
...protocol.toJSON()
|
|
1900
1936
|
}, {
|
|
1901
1937
|
F: __dxlog_file7,
|
|
1902
|
-
L:
|
|
1938
|
+
L: 158,
|
|
1903
1939
|
S: this,
|
|
1904
1940
|
C: (f, a) => f(...a)
|
|
1905
1941
|
});
|
|
@@ -1911,7 +1947,7 @@ var InvitationsHandler = class {
|
|
|
1911
1947
|
id: traceId
|
|
1912
1948
|
}), {
|
|
1913
1949
|
F: __dxlog_file7,
|
|
1914
|
-
L:
|
|
1950
|
+
L: 160,
|
|
1915
1951
|
S: this,
|
|
1916
1952
|
C: (f, a) => f(...a)
|
|
1917
1953
|
});
|
|
@@ -1921,7 +1957,7 @@ var InvitationsHandler = class {
|
|
|
1921
1957
|
...protocol.toJSON()
|
|
1922
1958
|
}, {
|
|
1923
1959
|
F: __dxlog_file7,
|
|
1924
|
-
L:
|
|
1960
|
+
L: 163,
|
|
1925
1961
|
S: this,
|
|
1926
1962
|
C: (f, a) => f(...a)
|
|
1927
1963
|
});
|
|
@@ -1932,7 +1968,7 @@ var InvitationsHandler = class {
|
|
|
1932
1968
|
} else {
|
|
1933
1969
|
import_log4.log.error("failed", err, {
|
|
1934
1970
|
F: __dxlog_file7,
|
|
1935
|
-
L:
|
|
1971
|
+
L: 166,
|
|
1936
1972
|
S: this,
|
|
1937
1973
|
C: (f, a) => f(...a)
|
|
1938
1974
|
});
|
|
@@ -1943,12 +1979,12 @@ var InvitationsHandler = class {
|
|
|
1943
1979
|
error: err
|
|
1944
1980
|
}), {
|
|
1945
1981
|
F: __dxlog_file7,
|
|
1946
|
-
L:
|
|
1982
|
+
L: 169,
|
|
1947
1983
|
S: this,
|
|
1948
1984
|
C: (f, a) => f(...a)
|
|
1949
1985
|
});
|
|
1950
1986
|
} finally {
|
|
1951
|
-
if (
|
|
1987
|
+
if (!multiUse) {
|
|
1952
1988
|
await swarmConnection.close();
|
|
1953
1989
|
await ctx.dispose();
|
|
1954
1990
|
}
|
|
@@ -1964,7 +2000,7 @@ var InvitationsHandler = class {
|
|
|
1964
2000
|
...protocol.toJSON()
|
|
1965
2001
|
}, {
|
|
1966
2002
|
F: __dxlog_file7,
|
|
1967
|
-
L:
|
|
2003
|
+
L: 184,
|
|
1968
2004
|
S: this,
|
|
1969
2005
|
C: (f, a) => f(...a)
|
|
1970
2006
|
});
|
|
@@ -1975,7 +2011,7 @@ var InvitationsHandler = class {
|
|
|
1975
2011
|
} else {
|
|
1976
2012
|
import_log4.log.error("failed", err, {
|
|
1977
2013
|
F: __dxlog_file7,
|
|
1978
|
-
L:
|
|
2014
|
+
L: 187,
|
|
1979
2015
|
S: this,
|
|
1980
2016
|
C: (f, a) => f(...a)
|
|
1981
2017
|
});
|
|
@@ -1989,7 +2025,7 @@ var InvitationsHandler = class {
|
|
|
1989
2025
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
1990
2026
|
import_log4.log.warn("invitation has already expired", void 0, {
|
|
1991
2027
|
F: __dxlog_file7,
|
|
1992
|
-
L:
|
|
2028
|
+
L: 198,
|
|
1993
2029
|
S: this,
|
|
1994
2030
|
C: (f, a) => f(...a)
|
|
1995
2031
|
});
|
|
@@ -2040,7 +2076,7 @@ var InvitationsHandler = class {
|
|
|
2040
2076
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
2041
2077
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
2042
2078
|
F: __dxlog_file7,
|
|
2043
|
-
L:
|
|
2079
|
+
L: 252,
|
|
2044
2080
|
S: this,
|
|
2045
2081
|
A: [
|
|
2046
2082
|
"protocol",
|
|
@@ -2050,7 +2086,7 @@ var InvitationsHandler = class {
|
|
|
2050
2086
|
if (deviceProfile) {
|
|
2051
2087
|
(0, import_invariant5.invariant)(invitation.kind === import_services3.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2052
2088
|
F: __dxlog_file7,
|
|
2053
|
-
L:
|
|
2089
|
+
L: 256,
|
|
2054
2090
|
S: this,
|
|
2055
2091
|
A: [
|
|
2056
2092
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2065,7 +2101,7 @@ var InvitationsHandler = class {
|
|
|
2065
2101
|
const setState = (newData) => {
|
|
2066
2102
|
(0, import_invariant5.invariant)(newData.state !== void 0, void 0, {
|
|
2067
2103
|
F: __dxlog_file7,
|
|
2068
|
-
L:
|
|
2104
|
+
L: 267,
|
|
2069
2105
|
S: this,
|
|
2070
2106
|
A: [
|
|
2071
2107
|
"newData.state !== undefined",
|
|
@@ -2085,7 +2121,7 @@ var InvitationsHandler = class {
|
|
|
2085
2121
|
...protocol.toJSON()
|
|
2086
2122
|
}, {
|
|
2087
2123
|
F: __dxlog_file7,
|
|
2088
|
-
L:
|
|
2124
|
+
L: 275,
|
|
2089
2125
|
S: this,
|
|
2090
2126
|
C: (f, a) => f(...a)
|
|
2091
2127
|
});
|
|
@@ -2095,7 +2131,7 @@ var InvitationsHandler = class {
|
|
|
2095
2131
|
} else {
|
|
2096
2132
|
import_log4.log.warn("auth failed", err, {
|
|
2097
2133
|
F: __dxlog_file7,
|
|
2098
|
-
L:
|
|
2134
|
+
L: 278,
|
|
2099
2135
|
S: this,
|
|
2100
2136
|
C: (f, a) => f(...a)
|
|
2101
2137
|
});
|
|
@@ -2109,7 +2145,7 @@ var InvitationsHandler = class {
|
|
|
2109
2145
|
...protocol.toJSON()
|
|
2110
2146
|
}, {
|
|
2111
2147
|
F: __dxlog_file7,
|
|
2112
|
-
L:
|
|
2148
|
+
L: 286,
|
|
2113
2149
|
S: this,
|
|
2114
2150
|
C: (f, a) => f(...a)
|
|
2115
2151
|
});
|
|
@@ -2124,7 +2160,7 @@ var InvitationsHandler = class {
|
|
|
2124
2160
|
currentState
|
|
2125
2161
|
}, {
|
|
2126
2162
|
F: __dxlog_file7,
|
|
2127
|
-
L:
|
|
2163
|
+
L: 296,
|
|
2128
2164
|
S: this,
|
|
2129
2165
|
C: (f, a) => f(...a)
|
|
2130
2166
|
});
|
|
@@ -2139,7 +2175,7 @@ var InvitationsHandler = class {
|
|
|
2139
2175
|
id: traceId
|
|
2140
2176
|
}), {
|
|
2141
2177
|
F: __dxlog_file7,
|
|
2142
|
-
L:
|
|
2178
|
+
L: 305,
|
|
2143
2179
|
S: this,
|
|
2144
2180
|
C: (f, a) => f(...a)
|
|
2145
2181
|
});
|
|
@@ -2151,7 +2187,7 @@ var InvitationsHandler = class {
|
|
|
2151
2187
|
...protocol.toJSON()
|
|
2152
2188
|
}, {
|
|
2153
2189
|
F: __dxlog_file7,
|
|
2154
|
-
L:
|
|
2190
|
+
L: 313,
|
|
2155
2191
|
S: this,
|
|
2156
2192
|
C: (f, a) => f(...a)
|
|
2157
2193
|
});
|
|
@@ -2162,7 +2198,7 @@ var InvitationsHandler = class {
|
|
|
2162
2198
|
...protocol.toJSON()
|
|
2163
2199
|
}, {
|
|
2164
2200
|
F: __dxlog_file7,
|
|
2165
|
-
L:
|
|
2201
|
+
L: 317,
|
|
2166
2202
|
S: this,
|
|
2167
2203
|
C: (f, a) => f(...a)
|
|
2168
2204
|
});
|
|
@@ -2172,62 +2208,28 @@ var InvitationsHandler = class {
|
|
|
2172
2208
|
response: introductionResponse
|
|
2173
2209
|
}, {
|
|
2174
2210
|
F: __dxlog_file7,
|
|
2175
|
-
L:
|
|
2211
|
+
L: 321,
|
|
2176
2212
|
S: this,
|
|
2177
2213
|
C: (f, a) => f(...a)
|
|
2178
2214
|
});
|
|
2179
2215
|
invitation.authMethod = introductionResponse.authMethod;
|
|
2180
2216
|
if (isAuthenticationRequired(invitation)) {
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2190
|
-
});
|
|
2191
|
-
const authCode = await authenticated.wait({
|
|
2192
|
-
timeout
|
|
2193
|
-
});
|
|
2194
|
-
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2195
|
-
F: __dxlog_file7,
|
|
2196
|
-
L: 325,
|
|
2197
|
-
S: this,
|
|
2198
|
-
C: (f, a) => f(...a)
|
|
2199
|
-
});
|
|
2200
|
-
setState({
|
|
2201
|
-
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2202
|
-
});
|
|
2203
|
-
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2204
|
-
authCode
|
|
2205
|
-
});
|
|
2206
|
-
if (response.status === void 0 || response.status === import_invitations.AuthenticationResponse.Status.OK) {
|
|
2217
|
+
switch (invitation.authMethod) {
|
|
2218
|
+
case import_services3.Invitation.AuthMethod.SHARED_SECRET:
|
|
2219
|
+
await this._handleGuestOtpAuth(extension, setState, authenticated, {
|
|
2220
|
+
timeout
|
|
2221
|
+
});
|
|
2222
|
+
break;
|
|
2223
|
+
case import_services3.Invitation.AuthMethod.KNOWN_PUBLIC_KEY:
|
|
2224
|
+
await this._handleGuestKpkAuth(extension, setState, invitation, introductionResponse);
|
|
2207
2225
|
break;
|
|
2208
|
-
}
|
|
2209
|
-
if (response.status === import_invitations.AuthenticationResponse.Status.INVALID_OTP) {
|
|
2210
|
-
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2211
|
-
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2212
|
-
} else {
|
|
2213
|
-
(0, import_log4.log)("retrying invalid code", {
|
|
2214
|
-
attempt
|
|
2215
|
-
}, {
|
|
2216
|
-
F: __dxlog_file7,
|
|
2217
|
-
L: 336,
|
|
2218
|
-
S: this,
|
|
2219
|
-
C: (f, a) => f(...a)
|
|
2220
|
-
});
|
|
2221
|
-
authenticated.reset();
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
2226
|
}
|
|
2225
2227
|
}
|
|
2226
2228
|
(0, import_log4.log)("request admission", {
|
|
2227
2229
|
...protocol.toJSON()
|
|
2228
2230
|
}, {
|
|
2229
2231
|
F: __dxlog_file7,
|
|
2230
|
-
L:
|
|
2232
|
+
L: 337,
|
|
2231
2233
|
S: this,
|
|
2232
2234
|
C: (f, a) => f(...a)
|
|
2233
2235
|
});
|
|
@@ -2239,7 +2241,7 @@ var InvitationsHandler = class {
|
|
|
2239
2241
|
...protocol.toJSON()
|
|
2240
2242
|
}, {
|
|
2241
2243
|
F: __dxlog_file7,
|
|
2242
|
-
L:
|
|
2244
|
+
L: 348,
|
|
2243
2245
|
S: this,
|
|
2244
2246
|
C: (f, a) => f(...a)
|
|
2245
2247
|
});
|
|
@@ -2252,7 +2254,7 @@ var InvitationsHandler = class {
|
|
|
2252
2254
|
id: traceId
|
|
2253
2255
|
}), {
|
|
2254
2256
|
F: __dxlog_file7,
|
|
2255
|
-
L:
|
|
2257
|
+
L: 350,
|
|
2256
2258
|
S: this,
|
|
2257
2259
|
C: (f, a) => f(...a)
|
|
2258
2260
|
});
|
|
@@ -2262,7 +2264,7 @@ var InvitationsHandler = class {
|
|
|
2262
2264
|
...protocol.toJSON()
|
|
2263
2265
|
}, {
|
|
2264
2266
|
F: __dxlog_file7,
|
|
2265
|
-
L:
|
|
2267
|
+
L: 353,
|
|
2266
2268
|
S: this,
|
|
2267
2269
|
C: (f, a) => f(...a)
|
|
2268
2270
|
});
|
|
@@ -2272,7 +2274,7 @@ var InvitationsHandler = class {
|
|
|
2272
2274
|
} else {
|
|
2273
2275
|
(0, import_log4.log)("auth failed", err, {
|
|
2274
2276
|
F: __dxlog_file7,
|
|
2275
|
-
L:
|
|
2277
|
+
L: 356,
|
|
2276
2278
|
S: this,
|
|
2277
2279
|
C: (f, a) => f(...a)
|
|
2278
2280
|
});
|
|
@@ -2283,7 +2285,7 @@ var InvitationsHandler = class {
|
|
|
2283
2285
|
error: err
|
|
2284
2286
|
}), {
|
|
2285
2287
|
F: __dxlog_file7,
|
|
2286
|
-
L:
|
|
2288
|
+
L: 359,
|
|
2287
2289
|
S: this,
|
|
2288
2290
|
C: (f, a) => f(...a)
|
|
2289
2291
|
});
|
|
@@ -2301,7 +2303,7 @@ var InvitationsHandler = class {
|
|
|
2301
2303
|
...protocol.toJSON()
|
|
2302
2304
|
}, {
|
|
2303
2305
|
F: __dxlog_file7,
|
|
2304
|
-
L:
|
|
2306
|
+
L: 370,
|
|
2305
2307
|
S: this,
|
|
2306
2308
|
C: (f, a) => f(...a)
|
|
2307
2309
|
});
|
|
@@ -2311,7 +2313,7 @@ var InvitationsHandler = class {
|
|
|
2311
2313
|
} else {
|
|
2312
2314
|
(0, import_log4.log)("auth failed", err, {
|
|
2313
2315
|
F: __dxlog_file7,
|
|
2314
|
-
L:
|
|
2316
|
+
L: 373,
|
|
2315
2317
|
S: this,
|
|
2316
2318
|
C: (f, a) => f(...a)
|
|
2317
2319
|
});
|
|
@@ -2328,7 +2330,7 @@ var InvitationsHandler = class {
|
|
|
2328
2330
|
} else {
|
|
2329
2331
|
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2330
2332
|
F: __dxlog_file7,
|
|
2331
|
-
L:
|
|
2333
|
+
L: 387,
|
|
2332
2334
|
S: this,
|
|
2333
2335
|
A: [
|
|
2334
2336
|
"invitation.swarmKey",
|
|
@@ -2366,9 +2368,81 @@ var InvitationsHandler = class {
|
|
|
2366
2368
|
});
|
|
2367
2369
|
return observable;
|
|
2368
2370
|
}
|
|
2371
|
+
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2372
|
+
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2373
|
+
(0, import_log4.log)("guest waiting for authentication code...", void 0, {
|
|
2374
|
+
F: __dxlog_file7,
|
|
2375
|
+
L: 427,
|
|
2376
|
+
S: this,
|
|
2377
|
+
C: (f, a) => f(...a)
|
|
2378
|
+
});
|
|
2379
|
+
setState({
|
|
2380
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2381
|
+
});
|
|
2382
|
+
const authCode = await authenticated.wait(options);
|
|
2383
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2384
|
+
F: __dxlog_file7,
|
|
2385
|
+
L: 431,
|
|
2386
|
+
S: this,
|
|
2387
|
+
C: (f, a) => f(...a)
|
|
2388
|
+
});
|
|
2389
|
+
setState({
|
|
2390
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2391
|
+
});
|
|
2392
|
+
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2393
|
+
authCode
|
|
2394
|
+
});
|
|
2395
|
+
if (response.status === void 0 || response.status === import_invitations.AuthenticationResponse.Status.OK) {
|
|
2396
|
+
break;
|
|
2397
|
+
}
|
|
2398
|
+
if (response.status === import_invitations.AuthenticationResponse.Status.INVALID_OTP) {
|
|
2399
|
+
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2400
|
+
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2401
|
+
} else {
|
|
2402
|
+
(0, import_log4.log)("retrying invalid code", {
|
|
2403
|
+
attempt
|
|
2404
|
+
}, {
|
|
2405
|
+
F: __dxlog_file7,
|
|
2406
|
+
L: 442,
|
|
2407
|
+
S: this,
|
|
2408
|
+
C: (f, a) => f(...a)
|
|
2409
|
+
});
|
|
2410
|
+
authenticated.reset();
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
async _handleGuestKpkAuth(extension, setState, invitation, introductionResponse) {
|
|
2416
|
+
if (invitation.guestKeypair?.privateKey == null) {
|
|
2417
|
+
throw new Error("keypair missing in the invitation");
|
|
2418
|
+
}
|
|
2419
|
+
if (introductionResponse.challenge == null) {
|
|
2420
|
+
throw new Error("challenge missing in the introduction");
|
|
2421
|
+
}
|
|
2422
|
+
(0, import_log4.log)("sending authentication request", void 0, {
|
|
2423
|
+
F: __dxlog_file7,
|
|
2424
|
+
L: 461,
|
|
2425
|
+
S: this,
|
|
2426
|
+
C: (f, a) => f(...a)
|
|
2427
|
+
});
|
|
2428
|
+
setState({
|
|
2429
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2430
|
+
});
|
|
2431
|
+
const signature = (0, import_crypto.sign)(Buffer.from(introductionResponse.challenge), invitation.guestKeypair.privateKey);
|
|
2432
|
+
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2433
|
+
signedChallenge: signature
|
|
2434
|
+
});
|
|
2435
|
+
if (response.status !== import_invitations.AuthenticationResponse.Status.OK) {
|
|
2436
|
+
throw new Error(`Authentication failed with code: ${response.status}`);
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2369
2439
|
};
|
|
2370
|
-
var
|
|
2371
|
-
|
|
2440
|
+
var createAdmissionKeypair = () => {
|
|
2441
|
+
const keypair = (0, import_crypto.createKeyPair)();
|
|
2442
|
+
return {
|
|
2443
|
+
publicKey: import_keys5.PublicKey.from(keypair.publicKey),
|
|
2444
|
+
privateKey: keypair.secretKey
|
|
2445
|
+
};
|
|
2372
2446
|
};
|
|
2373
2447
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
2374
2448
|
var InvitationsServiceImpl = class {
|
|
@@ -2425,7 +2499,7 @@ var InvitationsServiceImpl = class {
|
|
|
2425
2499
|
await this._metadataStore.removeInvitation(invitation.get().invitationId);
|
|
2426
2500
|
}
|
|
2427
2501
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2428
|
-
if (invitation.get().
|
|
2502
|
+
if (!invitation.get().multiUse) {
|
|
2429
2503
|
this._removedCreated.emit(invitation.get());
|
|
2430
2504
|
}
|
|
2431
2505
|
});
|
|
@@ -2433,7 +2507,7 @@ var InvitationsServiceImpl = class {
|
|
|
2433
2507
|
}
|
|
2434
2508
|
async loadPersistentInvitations() {
|
|
2435
2509
|
const persistentInvitations = this._metadataStore.getInvitations();
|
|
2436
|
-
const freshInvitations = persistentInvitations.filter(async (invitation) => !
|
|
2510
|
+
const freshInvitations = persistentInvitations.filter(async (invitation) => !(0, import_echo_pipeline.hasInvitationExpired)(invitation));
|
|
2437
2511
|
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
2438
2512
|
(0, import_invariant7.invariant)(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
2439
2513
|
F: __dxlog_file8,
|
|
@@ -2486,7 +2560,7 @@ var InvitationsServiceImpl = class {
|
|
|
2486
2560
|
}, () => {
|
|
2487
2561
|
close();
|
|
2488
2562
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2489
|
-
if (invitation.get().
|
|
2563
|
+
if (!invitation.get().multiUse) {
|
|
2490
2564
|
this._removedAccepted.emit(invitation.get());
|
|
2491
2565
|
}
|
|
2492
2566
|
});
|
|
@@ -2859,176 +2933,41 @@ _ts_decorate3([
|
|
|
2859
2933
|
ClientRpcServer = _ts_decorate3([
|
|
2860
2934
|
import_tracing3.trace.resource()
|
|
2861
2935
|
], ClientRpcServer);
|
|
2862
|
-
var
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
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.d4b5989";
|
|
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);
|
|
2936
|
+
var AutomergeSpaceState = class {
|
|
2937
|
+
constructor(_onNewRoot) {
|
|
2938
|
+
this._onNewRoot = _onNewRoot;
|
|
2939
|
+
this.rootUrl = void 0;
|
|
2940
|
+
this.lastEpoch = void 0;
|
|
2941
|
+
this.onNewEpoch = new import_async11.Event();
|
|
2942
|
+
this._isProcessingRootDocs = false;
|
|
2917
2943
|
}
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2944
|
+
async processCredential(credential) {
|
|
2945
|
+
if (!(0, import_credentials10.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
2946
|
+
return;
|
|
2947
|
+
}
|
|
2948
|
+
this.lastEpoch = credential;
|
|
2949
|
+
if (credential.subject.assertion.automergeRoot) {
|
|
2950
|
+
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
2951
|
+
if (this._isProcessingRootDocs) {
|
|
2952
|
+
this._onNewRoot(this.rootUrl);
|
|
2925
2953
|
}
|
|
2926
|
-
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
2927
2954
|
}
|
|
2928
|
-
|
|
2929
|
-
file,
|
|
2930
|
-
count
|
|
2931
|
-
}));
|
|
2955
|
+
this.onNewEpoch.emit(credential);
|
|
2932
2956
|
}
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
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)) ?? []);
|
|
2957
|
+
startProcessingRootDocs() {
|
|
2958
|
+
if (this._isProcessingRootDocs) {
|
|
2959
|
+
return;
|
|
2946
2960
|
}
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
}
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
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;
|
|
2961
|
+
if (this.rootUrl) {
|
|
2962
|
+
this._onNewRoot(this.rootUrl);
|
|
2963
|
+
}
|
|
2964
|
+
this._isProcessingRootDocs = true;
|
|
2965
|
+
}
|
|
2966
|
+
async ensureEpochInitialized() {
|
|
2967
|
+
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
2960
2968
|
}
|
|
2961
|
-
diagnostics.config = config.values;
|
|
2962
|
-
return diagnostics;
|
|
2963
2969
|
};
|
|
2964
|
-
var
|
|
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
|
-
var AutomergeSpaceState = class {
|
|
2998
|
-
constructor(_onNewRoot) {
|
|
2999
|
-
this._onNewRoot = _onNewRoot;
|
|
3000
|
-
this.rootUrl = void 0;
|
|
3001
|
-
this.lastEpoch = void 0;
|
|
3002
|
-
this.onNewEpoch = new import_async11.Event();
|
|
3003
|
-
this._isProcessingRootDocs = false;
|
|
3004
|
-
}
|
|
3005
|
-
async processCredential(credential) {
|
|
3006
|
-
if (!(0, import_credentials11.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
|
|
3007
|
-
return;
|
|
3008
|
-
}
|
|
3009
|
-
this.lastEpoch = credential;
|
|
3010
|
-
if (credential.subject.assertion.automergeRoot) {
|
|
3011
|
-
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
3012
|
-
if (this._isProcessingRootDocs) {
|
|
3013
|
-
this._onNewRoot(this.rootUrl);
|
|
3014
|
-
}
|
|
3015
|
-
}
|
|
3016
|
-
this.onNewEpoch.emit(credential);
|
|
3017
|
-
}
|
|
3018
|
-
startProcessingRootDocs() {
|
|
3019
|
-
if (this._isProcessingRootDocs) {
|
|
3020
|
-
return;
|
|
3021
|
-
}
|
|
3022
|
-
if (this.rootUrl) {
|
|
3023
|
-
this._onNewRoot(this.rootUrl);
|
|
3024
|
-
}
|
|
3025
|
-
this._isProcessingRootDocs = true;
|
|
3026
|
-
}
|
|
3027
|
-
async ensureEpochInitialized() {
|
|
3028
|
-
await this.onNewEpoch.waitForCondition(() => !!this.lastEpoch);
|
|
3029
|
-
}
|
|
3030
|
-
};
|
|
3031
|
-
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
2970
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3032
2971
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3033
2972
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3034
2973
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -3056,13 +2995,13 @@ var NotarizationPlugin = class {
|
|
|
3056
2995
|
(0, import_log9.log)("notarize", {
|
|
3057
2996
|
credentials
|
|
3058
2997
|
}, {
|
|
3059
|
-
F:
|
|
2998
|
+
F: __dxlog_file10,
|
|
3060
2999
|
L: 90,
|
|
3061
3000
|
S: this,
|
|
3062
3001
|
C: (f, a) => f(...a)
|
|
3063
3002
|
});
|
|
3064
|
-
(0,
|
|
3065
|
-
F:
|
|
3003
|
+
(0, import_invariant10.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3004
|
+
F: __dxlog_file10,
|
|
3066
3005
|
L: 91,
|
|
3067
3006
|
S: this,
|
|
3068
3007
|
A: [
|
|
@@ -3076,7 +3015,7 @@ var NotarizationPlugin = class {
|
|
|
3076
3015
|
import_log9.log.warn("Notarization error", {
|
|
3077
3016
|
err
|
|
3078
3017
|
}, {
|
|
3079
|
-
F:
|
|
3018
|
+
F: __dxlog_file10,
|
|
3080
3019
|
L: 99,
|
|
3081
3020
|
S: this,
|
|
3082
3021
|
C: (f, a) => f(...a)
|
|
@@ -3092,7 +3031,7 @@ var NotarizationPlugin = class {
|
|
|
3092
3031
|
timeout,
|
|
3093
3032
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3094
3033
|
}, {
|
|
3095
|
-
F:
|
|
3034
|
+
F: __dxlog_file10,
|
|
3096
3035
|
L: 111,
|
|
3097
3036
|
S: this,
|
|
3098
3037
|
C: (f, a) => f(...a)
|
|
@@ -3115,7 +3054,7 @@ var NotarizationPlugin = class {
|
|
|
3115
3054
|
import_log9.log.info("Exhausted all peers to notarize with", {
|
|
3116
3055
|
retryIn: retryTimeout
|
|
3117
3056
|
}, {
|
|
3118
|
-
F:
|
|
3057
|
+
F: __dxlog_file10,
|
|
3119
3058
|
L: 136,
|
|
3120
3059
|
S: this,
|
|
3121
3060
|
C: (f, a) => f(...a)
|
|
@@ -3129,7 +3068,7 @@ var NotarizationPlugin = class {
|
|
|
3129
3068
|
peer: peer.localPeerId,
|
|
3130
3069
|
credentialId: credentials.map((credential) => credential.id)
|
|
3131
3070
|
}, {
|
|
3132
|
-
F:
|
|
3071
|
+
F: __dxlog_file10,
|
|
3133
3072
|
L: 143,
|
|
3134
3073
|
S: this,
|
|
3135
3074
|
C: (f, a) => f(...a)
|
|
@@ -3138,7 +3077,7 @@ var NotarizationPlugin = class {
|
|
|
3138
3077
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
3139
3078
|
});
|
|
3140
3079
|
(0, import_log9.log)("success", void 0, {
|
|
3141
|
-
F:
|
|
3080
|
+
F: __dxlog_file10,
|
|
3142
3081
|
L: 147,
|
|
3143
3082
|
S: this,
|
|
3144
3083
|
C: (f, a) => f(...a)
|
|
@@ -3147,7 +3086,7 @@ var NotarizationPlugin = class {
|
|
|
3147
3086
|
} catch (err) {
|
|
3148
3087
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
3149
3088
|
import_log9.log.info("error notarizing (recoverable)", err, {
|
|
3150
|
-
F:
|
|
3089
|
+
F: __dxlog_file10,
|
|
3151
3090
|
L: 151,
|
|
3152
3091
|
S: this,
|
|
3153
3092
|
C: (f, a) => f(...a)
|
|
@@ -3165,7 +3104,7 @@ var NotarizationPlugin = class {
|
|
|
3165
3104
|
errors.wait()
|
|
3166
3105
|
]);
|
|
3167
3106
|
(0, import_log9.log)("done", void 0, {
|
|
3168
|
-
F:
|
|
3107
|
+
F: __dxlog_file10,
|
|
3169
3108
|
L: 162,
|
|
3170
3109
|
S: this,
|
|
3171
3110
|
C: (f, a) => f(...a)
|
|
@@ -3186,8 +3125,8 @@ var NotarizationPlugin = class {
|
|
|
3186
3125
|
this._processCredentialsTriggers.delete(credential.id);
|
|
3187
3126
|
}
|
|
3188
3127
|
setWriter(writer) {
|
|
3189
|
-
(0,
|
|
3190
|
-
F:
|
|
3128
|
+
(0, import_invariant10.invariant)(!this._writer, "Writer already set.", {
|
|
3129
|
+
F: __dxlog_file10,
|
|
3191
3130
|
L: 181,
|
|
3192
3131
|
S: this,
|
|
3193
3132
|
A: [
|
|
@@ -3211,8 +3150,8 @@ var NotarizationPlugin = class {
|
|
|
3211
3150
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
3212
3151
|
}
|
|
3213
3152
|
for (const credential of request.credentials ?? []) {
|
|
3214
|
-
(0,
|
|
3215
|
-
F:
|
|
3153
|
+
(0, import_invariant10.invariant)(credential.id, "Credential must have an id", {
|
|
3154
|
+
F: __dxlog_file10,
|
|
3216
3155
|
L: 200,
|
|
3217
3156
|
S: this,
|
|
3218
3157
|
A: [
|
|
@@ -3232,7 +3171,7 @@ var NotarizationPlugin = class {
|
|
|
3232
3171
|
(0, import_log9.log)("extension opened", {
|
|
3233
3172
|
peer: extension.localPeerId
|
|
3234
3173
|
}, {
|
|
3235
|
-
F:
|
|
3174
|
+
F: __dxlog_file10,
|
|
3236
3175
|
L: 211,
|
|
3237
3176
|
S: this,
|
|
3238
3177
|
C: (f, a) => f(...a)
|
|
@@ -3244,7 +3183,7 @@ var NotarizationPlugin = class {
|
|
|
3244
3183
|
(0, import_log9.log)("extension closed", {
|
|
3245
3184
|
peer: extension.localPeerId
|
|
3246
3185
|
}, {
|
|
3247
|
-
F:
|
|
3186
|
+
F: __dxlog_file10,
|
|
3248
3187
|
L: 216,
|
|
3249
3188
|
S: this,
|
|
3250
3189
|
C: (f, a) => f(...a)
|
|
@@ -3260,10 +3199,10 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
3260
3199
|
constructor(_params) {
|
|
3261
3200
|
super({
|
|
3262
3201
|
requested: {
|
|
3263
|
-
NotarizationService:
|
|
3202
|
+
NotarizationService: import_protocols8.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3264
3203
|
},
|
|
3265
3204
|
exposed: {
|
|
3266
|
-
NotarizationService:
|
|
3205
|
+
NotarizationService: import_protocols8.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3267
3206
|
}
|
|
3268
3207
|
});
|
|
3269
3208
|
this._params = _params;
|
|
@@ -3296,14 +3235,14 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3296
3235
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3297
3236
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3298
3237
|
}
|
|
3299
|
-
var
|
|
3238
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3300
3239
|
var DataSpace = class {
|
|
3301
3240
|
constructor(params) {
|
|
3302
3241
|
this._ctx = new import_context7.Context();
|
|
3303
3242
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3304
3243
|
this._cache = void 0;
|
|
3305
3244
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3306
|
-
this._state =
|
|
3245
|
+
this._state = import_services7.SpaceState.CLOSED;
|
|
3307
3246
|
this.error = void 0;
|
|
3308
3247
|
this.stateUpdate = new import_async10.Event();
|
|
3309
3248
|
this.metrics = {};
|
|
@@ -3325,9 +3264,9 @@ var DataSpace = class {
|
|
|
3325
3264
|
this._cache = params.cache;
|
|
3326
3265
|
this._state = params.initialState;
|
|
3327
3266
|
(0, import_log8.log)("new state", {
|
|
3328
|
-
state:
|
|
3267
|
+
state: import_services7.SpaceState[this._state]
|
|
3329
3268
|
}, {
|
|
3330
|
-
F:
|
|
3269
|
+
F: __dxlog_file11,
|
|
3331
3270
|
L: 140,
|
|
3332
3271
|
S: this,
|
|
3333
3272
|
C: (f, a) => f(...a)
|
|
@@ -3373,11 +3312,11 @@ var DataSpace = class {
|
|
|
3373
3312
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3374
3313
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3375
3314
|
await this._inner.open(new import_context7.Context());
|
|
3376
|
-
this._state =
|
|
3315
|
+
this._state = import_services7.SpaceState.CONTROL_ONLY;
|
|
3377
3316
|
(0, import_log8.log)("new state", {
|
|
3378
|
-
state:
|
|
3317
|
+
state: import_services7.SpaceState[this._state]
|
|
3379
3318
|
}, {
|
|
3380
|
-
F:
|
|
3319
|
+
F: __dxlog_file11,
|
|
3381
3320
|
L: 198,
|
|
3382
3321
|
S: this,
|
|
3383
3322
|
C: (f, a) => f(...a)
|
|
@@ -3391,11 +3330,11 @@ var DataSpace = class {
|
|
|
3391
3330
|
}
|
|
3392
3331
|
async _close() {
|
|
3393
3332
|
await this._callbacks.beforeClose?.();
|
|
3394
|
-
this._state =
|
|
3333
|
+
this._state = import_services7.SpaceState.CLOSED;
|
|
3395
3334
|
(0, import_log8.log)("new state", {
|
|
3396
|
-
state:
|
|
3335
|
+
state: import_services7.SpaceState[this._state]
|
|
3397
3336
|
}, {
|
|
3398
|
-
F:
|
|
3337
|
+
F: __dxlog_file11,
|
|
3399
3338
|
L: 212,
|
|
3400
3339
|
S: this,
|
|
3401
3340
|
C: (f, a) => f(...a)
|
|
@@ -3425,9 +3364,9 @@ var DataSpace = class {
|
|
|
3425
3364
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3426
3365
|
await this.initializeDataPipeline();
|
|
3427
3366
|
} catch (err) {
|
|
3428
|
-
if (err instanceof
|
|
3367
|
+
if (err instanceof import_protocols7.CancelledError || err instanceof import_context7.ContextDisposedError) {
|
|
3429
3368
|
(0, import_log8.log)("data pipeline initialization cancelled", err, {
|
|
3430
|
-
F:
|
|
3369
|
+
F: __dxlog_file11,
|
|
3431
3370
|
L: 245,
|
|
3432
3371
|
S: this,
|
|
3433
3372
|
C: (f, a) => f(...a)
|
|
@@ -3435,16 +3374,16 @@ var DataSpace = class {
|
|
|
3435
3374
|
return;
|
|
3436
3375
|
}
|
|
3437
3376
|
import_log8.log.error("Error initializing data pipeline", err, {
|
|
3438
|
-
F:
|
|
3377
|
+
F: __dxlog_file11,
|
|
3439
3378
|
L: 249,
|
|
3440
3379
|
S: this,
|
|
3441
3380
|
C: (f, a) => f(...a)
|
|
3442
3381
|
});
|
|
3443
|
-
this._state =
|
|
3382
|
+
this._state = import_services7.SpaceState.ERROR;
|
|
3444
3383
|
(0, import_log8.log)("new state", {
|
|
3445
|
-
state:
|
|
3384
|
+
state: import_services7.SpaceState[this._state]
|
|
3446
3385
|
}, {
|
|
3447
|
-
F:
|
|
3386
|
+
F: __dxlog_file11,
|
|
3448
3387
|
L: 251,
|
|
3449
3388
|
S: this,
|
|
3450
3389
|
C: (f, a) => f(...a)
|
|
@@ -3457,14 +3396,14 @@ var DataSpace = class {
|
|
|
3457
3396
|
});
|
|
3458
3397
|
}
|
|
3459
3398
|
async initializeDataPipeline() {
|
|
3460
|
-
if (this._state !==
|
|
3461
|
-
throw new
|
|
3399
|
+
if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
|
|
3400
|
+
throw new import_protocols7.SystemError("Invalid operation");
|
|
3462
3401
|
}
|
|
3463
|
-
this._state =
|
|
3402
|
+
this._state = import_services7.SpaceState.INITIALIZING;
|
|
3464
3403
|
(0, import_log8.log)("new state", {
|
|
3465
|
-
state:
|
|
3404
|
+
state: import_services7.SpaceState[this._state]
|
|
3466
3405
|
}, {
|
|
3467
|
-
F:
|
|
3406
|
+
F: __dxlog_file11,
|
|
3468
3407
|
L: 267,
|
|
3469
3408
|
S: this,
|
|
3470
3409
|
C: (f, a) => f(...a)
|
|
@@ -3474,17 +3413,17 @@ var DataSpace = class {
|
|
|
3474
3413
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
3475
3414
|
await (0, import_context7.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
|
|
3476
3415
|
(0, import_log8.log)("data pipeline ready", void 0, {
|
|
3477
|
-
F:
|
|
3416
|
+
F: __dxlog_file11,
|
|
3478
3417
|
L: 279,
|
|
3479
3418
|
S: this,
|
|
3480
3419
|
C: (f, a) => f(...a)
|
|
3481
3420
|
});
|
|
3482
3421
|
await this._callbacks.beforeReady?.();
|
|
3483
|
-
this._state =
|
|
3422
|
+
this._state = import_services7.SpaceState.READY;
|
|
3484
3423
|
(0, import_log8.log)("new state", {
|
|
3485
|
-
state:
|
|
3424
|
+
state: import_services7.SpaceState[this._state]
|
|
3486
3425
|
}, {
|
|
3487
|
-
F:
|
|
3426
|
+
F: __dxlog_file11,
|
|
3488
3427
|
L: 283,
|
|
3489
3428
|
S: this,
|
|
3490
3429
|
C: (f, a) => f(...a)
|
|
@@ -3500,14 +3439,14 @@ var DataSpace = class {
|
|
|
3500
3439
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
3501
3440
|
await this._createWritableFeeds();
|
|
3502
3441
|
(0, import_log8.log)("writable feeds created", void 0, {
|
|
3503
|
-
F:
|
|
3442
|
+
F: __dxlog_file11,
|
|
3504
3443
|
L: 299,
|
|
3505
3444
|
S: this,
|
|
3506
3445
|
C: (f, a) => f(...a)
|
|
3507
3446
|
});
|
|
3508
3447
|
this.stateUpdate.emit();
|
|
3509
3448
|
if (!this.notarizationPlugin.hasWriter) {
|
|
3510
|
-
this.notarizationPlugin.setWriter((0,
|
|
3449
|
+
this.notarizationPlugin.setWriter((0, import_echo_pipeline2.createMappedFeedWriter)((credential) => ({
|
|
3511
3450
|
credential: {
|
|
3512
3451
|
credential
|
|
3513
3452
|
}
|
|
@@ -3528,7 +3467,7 @@ var DataSpace = class {
|
|
|
3528
3467
|
spaceKey: this.key,
|
|
3529
3468
|
deviceKey: this._signingContext.deviceKey,
|
|
3530
3469
|
identityKey: this._signingContext.identityKey,
|
|
3531
|
-
designation:
|
|
3470
|
+
designation: import_credentials9.AdmittedFeed.Designation.CONTROL
|
|
3532
3471
|
}
|
|
3533
3472
|
}));
|
|
3534
3473
|
}
|
|
@@ -3545,7 +3484,7 @@ var DataSpace = class {
|
|
|
3545
3484
|
spaceKey: this.key,
|
|
3546
3485
|
deviceKey: this._signingContext.deviceKey,
|
|
3547
3486
|
identityKey: this._signingContext.identityKey,
|
|
3548
|
-
designation:
|
|
3487
|
+
designation: import_credentials9.AdmittedFeed.Designation.DATA
|
|
3549
3488
|
}
|
|
3550
3489
|
}));
|
|
3551
3490
|
}
|
|
@@ -3563,7 +3502,7 @@ var DataSpace = class {
|
|
|
3563
3502
|
space: this.key,
|
|
3564
3503
|
rootUrl
|
|
3565
3504
|
}, {
|
|
3566
|
-
F:
|
|
3505
|
+
F: __dxlog_file11,
|
|
3567
3506
|
L: 365,
|
|
3568
3507
|
S: this,
|
|
3569
3508
|
C: (f, a) => f(...a)
|
|
@@ -3578,7 +3517,7 @@ var DataSpace = class {
|
|
|
3578
3517
|
if (this._ctx.disposed) {
|
|
3579
3518
|
return;
|
|
3580
3519
|
}
|
|
3581
|
-
const doc = handle.docSync() ?? (0,
|
|
3520
|
+
const doc = handle.docSync() ?? (0, import_invariant9.failedInvariant)();
|
|
3582
3521
|
if (!doc.access?.spaceKey) {
|
|
3583
3522
|
handle.change((doc2) => {
|
|
3584
3523
|
doc2.access = {
|
|
@@ -3595,7 +3534,7 @@ var DataSpace = class {
|
|
|
3595
3534
|
rootUrl,
|
|
3596
3535
|
err
|
|
3597
3536
|
}, {
|
|
3598
|
-
F:
|
|
3537
|
+
F: __dxlog_file11,
|
|
3599
3538
|
L: 388,
|
|
3600
3539
|
S: this,
|
|
3601
3540
|
C: (f, a) => f(...a)
|
|
@@ -3622,7 +3561,7 @@ var DataSpace = class {
|
|
|
3622
3561
|
let epoch;
|
|
3623
3562
|
switch (options?.migration) {
|
|
3624
3563
|
case void 0:
|
|
3625
|
-
case
|
|
3564
|
+
case import_services7.CreateEpochRequest.Migration.NONE:
|
|
3626
3565
|
{
|
|
3627
3566
|
epoch = {
|
|
3628
3567
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
@@ -3632,7 +3571,7 @@ var DataSpace = class {
|
|
|
3632
3571
|
};
|
|
3633
3572
|
}
|
|
3634
3573
|
break;
|
|
3635
|
-
case
|
|
3574
|
+
case import_services7.CreateEpochRequest.Migration.INIT_AUTOMERGE:
|
|
3636
3575
|
{
|
|
3637
3576
|
const document = this._automergeHost.repo.create();
|
|
3638
3577
|
epoch = {
|
|
@@ -3643,14 +3582,14 @@ var DataSpace = class {
|
|
|
3643
3582
|
};
|
|
3644
3583
|
}
|
|
3645
3584
|
break;
|
|
3646
|
-
case
|
|
3585
|
+
case import_services7.CreateEpochRequest.Migration.PRUNE_AUTOMERGE_ROOT_HISTORY:
|
|
3647
3586
|
{
|
|
3648
3587
|
const currentRootUrl = this._automergeSpaceState.rootUrl;
|
|
3649
3588
|
const rootHandle = this._automergeHost.repo.find(currentRootUrl);
|
|
3650
3589
|
await (0, import_context7.cancelWithContext)(this._ctx, (0, import_async10.asyncTimeout)(rootHandle.whenReady(), 1e4));
|
|
3651
3590
|
const newRoot = this._automergeHost.repo.create(rootHandle.docSync());
|
|
3652
|
-
(0,
|
|
3653
|
-
F:
|
|
3591
|
+
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3592
|
+
F: __dxlog_file11,
|
|
3654
3593
|
L: 438,
|
|
3655
3594
|
S: this,
|
|
3656
3595
|
A: [
|
|
@@ -3666,10 +3605,10 @@ var DataSpace = class {
|
|
|
3666
3605
|
};
|
|
3667
3606
|
}
|
|
3668
3607
|
break;
|
|
3669
|
-
case
|
|
3608
|
+
case import_services7.CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
|
|
3670
3609
|
{
|
|
3671
3610
|
import_log8.log.info("Fragmenting", void 0, {
|
|
3672
|
-
F:
|
|
3611
|
+
F: __dxlog_file11,
|
|
3673
3612
|
L: 450,
|
|
3674
3613
|
S: this,
|
|
3675
3614
|
C: (f, a) => f(...a)
|
|
@@ -3680,8 +3619,8 @@ var DataSpace = class {
|
|
|
3680
3619
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3681
3620
|
const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_db.TYPE_PROPERTIES);
|
|
3682
3621
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3683
|
-
(0,
|
|
3684
|
-
F:
|
|
3622
|
+
(0, import_invariant9.invariant)(properties, "Properties not found", {
|
|
3623
|
+
F: __dxlog_file11,
|
|
3685
3624
|
L: 460,
|
|
3686
3625
|
S: this,
|
|
3687
3626
|
A: [
|
|
@@ -3696,8 +3635,8 @@ var DataSpace = class {
|
|
|
3696
3635
|
])
|
|
3697
3636
|
};
|
|
3698
3637
|
const newRoot = this._automergeHost.repo.create(newSpaceDoc);
|
|
3699
|
-
(0,
|
|
3700
|
-
F:
|
|
3638
|
+
(0, import_invariant9.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3639
|
+
F: __dxlog_file11,
|
|
3701
3640
|
L: 465,
|
|
3702
3641
|
S: this,
|
|
3703
3642
|
A: [
|
|
@@ -3705,7 +3644,7 @@ var DataSpace = class {
|
|
|
3705
3644
|
""
|
|
3706
3645
|
]
|
|
3707
3646
|
});
|
|
3708
|
-
const docLoader = new
|
|
3647
|
+
const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
|
|
3709
3648
|
await docLoader.loadSpaceRootDocHandle(this._ctx, {
|
|
3710
3649
|
rootUrl: newRoot.url
|
|
3711
3650
|
});
|
|
@@ -3749,24 +3688,24 @@ var DataSpace = class {
|
|
|
3749
3688
|
]));
|
|
3750
3689
|
}
|
|
3751
3690
|
async activate() {
|
|
3752
|
-
if (this._state !==
|
|
3691
|
+
if (this._state !== import_services7.SpaceState.INACTIVE) {
|
|
3753
3692
|
return;
|
|
3754
3693
|
}
|
|
3755
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3694
|
+
await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.ACTIVE);
|
|
3756
3695
|
await this._open();
|
|
3757
3696
|
this.initializeDataPipelineAsync();
|
|
3758
3697
|
}
|
|
3759
3698
|
async deactivate() {
|
|
3760
|
-
if (this._state ===
|
|
3699
|
+
if (this._state === import_services7.SpaceState.INACTIVE) {
|
|
3761
3700
|
return;
|
|
3762
3701
|
}
|
|
3763
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3702
|
+
await this._metadataStore.setSpaceState(this.key, import_services7.SpaceState.INACTIVE);
|
|
3764
3703
|
await this._close();
|
|
3765
|
-
this._state =
|
|
3704
|
+
this._state = import_services7.SpaceState.INACTIVE;
|
|
3766
3705
|
(0, import_log8.log)("new state", {
|
|
3767
|
-
state:
|
|
3706
|
+
state: import_services7.SpaceState[this._state]
|
|
3768
3707
|
}, {
|
|
3769
|
-
F:
|
|
3708
|
+
F: __dxlog_file11,
|
|
3770
3709
|
L: 531,
|
|
3771
3710
|
S: this,
|
|
3772
3711
|
C: (f, a) => f(...a)
|
|
@@ -3775,18 +3714,18 @@ var DataSpace = class {
|
|
|
3775
3714
|
}
|
|
3776
3715
|
};
|
|
3777
3716
|
_ts_decorate4([
|
|
3778
|
-
|
|
3717
|
+
import_tracing4.trace.info()
|
|
3779
3718
|
], DataSpace.prototype, "_inner", void 0);
|
|
3780
3719
|
_ts_decorate4([
|
|
3781
|
-
|
|
3720
|
+
import_tracing4.trace.info()
|
|
3782
3721
|
], DataSpace.prototype, "key", null);
|
|
3783
3722
|
_ts_decorate4([
|
|
3784
|
-
|
|
3785
|
-
enum:
|
|
3723
|
+
import_tracing4.trace.info({
|
|
3724
|
+
enum: import_services7.SpaceState
|
|
3786
3725
|
})
|
|
3787
3726
|
], DataSpace.prototype, "state", null);
|
|
3788
3727
|
_ts_decorate4([
|
|
3789
|
-
|
|
3728
|
+
import_tracing4.trace.info({
|
|
3790
3729
|
depth: null
|
|
3791
3730
|
})
|
|
3792
3731
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
@@ -3797,12 +3736,12 @@ _ts_decorate4([
|
|
|
3797
3736
|
import_async10.synchronized
|
|
3798
3737
|
], DataSpace.prototype, "close", null);
|
|
3799
3738
|
_ts_decorate4([
|
|
3800
|
-
|
|
3739
|
+
import_tracing4.trace.span({
|
|
3801
3740
|
showInBrowserTimeline: true
|
|
3802
3741
|
})
|
|
3803
3742
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
3804
3743
|
_ts_decorate4([
|
|
3805
|
-
|
|
3744
|
+
import_tracing4.trace.span({
|
|
3806
3745
|
showInBrowserTimeline: true
|
|
3807
3746
|
})
|
|
3808
3747
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
@@ -3817,11 +3756,11 @@ _ts_decorate4([
|
|
|
3817
3756
|
], DataSpace.prototype, "deactivate", null);
|
|
3818
3757
|
DataSpace = _ts_decorate4([
|
|
3819
3758
|
(0, import_async10.trackLeaks)("open", "close"),
|
|
3820
|
-
|
|
3759
|
+
import_tracing4.trace.resource()
|
|
3821
3760
|
], DataSpace);
|
|
3822
3761
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
3823
3762
|
const credentials = [
|
|
3824
|
-
await (0,
|
|
3763
|
+
await (0, import_credentials12.createCredential)({
|
|
3825
3764
|
signer: keyring,
|
|
3826
3765
|
issuer: space.key,
|
|
3827
3766
|
subject: space.key,
|
|
@@ -3830,14 +3769,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3830
3769
|
spaceKey: space.key
|
|
3831
3770
|
}
|
|
3832
3771
|
}),
|
|
3833
|
-
await (0,
|
|
3772
|
+
await (0, import_credentials12.createCredential)({
|
|
3834
3773
|
signer: keyring,
|
|
3835
3774
|
issuer: space.key,
|
|
3836
3775
|
subject: signingContext.identityKey,
|
|
3837
3776
|
assertion: {
|
|
3838
3777
|
"@type": "dxos.halo.credentials.SpaceMember",
|
|
3839
3778
|
spaceKey: space.key,
|
|
3840
|
-
role:
|
|
3779
|
+
role: import_credentials13.SpaceMember.Role.ADMIN,
|
|
3841
3780
|
profile: signingContext.getProfile(),
|
|
3842
3781
|
genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
|
|
3843
3782
|
}
|
|
@@ -3849,7 +3788,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3849
3788
|
spaceKey: space.key,
|
|
3850
3789
|
identityKey: signingContext.identityKey,
|
|
3851
3790
|
deviceKey: signingContext.deviceKey,
|
|
3852
|
-
designation:
|
|
3791
|
+
designation: import_credentials13.AdmittedFeed.Designation.CONTROL
|
|
3853
3792
|
}
|
|
3854
3793
|
}),
|
|
3855
3794
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -3859,7 +3798,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
3859
3798
|
spaceKey: space.key,
|
|
3860
3799
|
identityKey: signingContext.identityKey,
|
|
3861
3800
|
deviceKey: signingContext.deviceKey,
|
|
3862
|
-
designation:
|
|
3801
|
+
designation: import_credentials13.AdmittedFeed.Designation.DATA
|
|
3863
3802
|
}
|
|
3864
3803
|
}),
|
|
3865
3804
|
await signingContext.credentialSigner.createCredential({
|
|
@@ -3893,7 +3832,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3893
3832
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3894
3833
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3895
3834
|
}
|
|
3896
|
-
var
|
|
3835
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
3897
3836
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3898
3837
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3899
3838
|
var DataSpaceManager = class {
|
|
@@ -3919,15 +3858,15 @@ var DataSpaceManager = class {
|
|
|
3919
3858
|
}
|
|
3920
3859
|
async open() {
|
|
3921
3860
|
(0, import_log10.log)("open", void 0, {
|
|
3922
|
-
F:
|
|
3861
|
+
F: __dxlog_file12,
|
|
3923
3862
|
L: 98,
|
|
3924
3863
|
S: this,
|
|
3925
3864
|
C: (f, a) => f(...a)
|
|
3926
3865
|
});
|
|
3927
|
-
import_log10.log.trace("dxos.echo.data-space-manager.open",
|
|
3866
|
+
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols9.trace.begin({
|
|
3928
3867
|
id: this._instanceId
|
|
3929
3868
|
}), {
|
|
3930
|
-
F:
|
|
3869
|
+
F: __dxlog_file12,
|
|
3931
3870
|
L: 99,
|
|
3932
3871
|
S: this,
|
|
3933
3872
|
C: (f, a) => f(...a)
|
|
@@ -3935,7 +3874,7 @@ var DataSpaceManager = class {
|
|
|
3935
3874
|
(0, import_log10.log)("metadata loaded", {
|
|
3936
3875
|
spaces: this._metadataStore.spaces.length
|
|
3937
3876
|
}, {
|
|
3938
|
-
F:
|
|
3877
|
+
F: __dxlog_file12,
|
|
3939
3878
|
L: 100,
|
|
3940
3879
|
S: this,
|
|
3941
3880
|
C: (f, a) => f(...a)
|
|
@@ -3945,7 +3884,7 @@ var DataSpaceManager = class {
|
|
|
3945
3884
|
(0, import_log10.log)("load space", {
|
|
3946
3885
|
spaceMetadata
|
|
3947
3886
|
}, {
|
|
3948
|
-
F:
|
|
3887
|
+
F: __dxlog_file12,
|
|
3949
3888
|
L: 104,
|
|
3950
3889
|
S: this,
|
|
3951
3890
|
C: (f, a) => f(...a)
|
|
@@ -3956,7 +3895,7 @@ var DataSpaceManager = class {
|
|
|
3956
3895
|
spaceMetadata,
|
|
3957
3896
|
err
|
|
3958
3897
|
}, {
|
|
3959
|
-
F:
|
|
3898
|
+
F: __dxlog_file12,
|
|
3960
3899
|
L: 107,
|
|
3961
3900
|
S: this,
|
|
3962
3901
|
C: (f, a) => f(...a)
|
|
@@ -3966,14 +3905,14 @@ var DataSpaceManager = class {
|
|
|
3966
3905
|
this._isOpen = true;
|
|
3967
3906
|
this.updated.emit();
|
|
3968
3907
|
for (const space of this._spaces.values()) {
|
|
3969
|
-
if (space.state !==
|
|
3908
|
+
if (space.state !== import_services8.SpaceState.INACTIVE) {
|
|
3970
3909
|
space.initializeDataPipelineAsync();
|
|
3971
3910
|
}
|
|
3972
3911
|
}
|
|
3973
|
-
import_log10.log.trace("dxos.echo.data-space-manager.open",
|
|
3912
|
+
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols9.trace.end({
|
|
3974
3913
|
id: this._instanceId
|
|
3975
3914
|
}), {
|
|
3976
|
-
F:
|
|
3915
|
+
F: __dxlog_file12,
|
|
3977
3916
|
L: 120,
|
|
3978
3917
|
S: this,
|
|
3979
3918
|
C: (f, a) => f(...a)
|
|
@@ -3981,7 +3920,7 @@ var DataSpaceManager = class {
|
|
|
3981
3920
|
}
|
|
3982
3921
|
async close() {
|
|
3983
3922
|
(0, import_log10.log)("close", void 0, {
|
|
3984
|
-
F:
|
|
3923
|
+
F: __dxlog_file12,
|
|
3985
3924
|
L: 125,
|
|
3986
3925
|
S: this,
|
|
3987
3926
|
C: (f, a) => f(...a)
|
|
@@ -3996,8 +3935,8 @@ var DataSpaceManager = class {
|
|
|
3996
3935
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
3997
3936
|
*/
|
|
3998
3937
|
async createSpace() {
|
|
3999
|
-
(0,
|
|
4000
|
-
F:
|
|
3938
|
+
(0, import_invariant11.invariant)(this._isOpen, "Not open.", {
|
|
3939
|
+
F: __dxlog_file12,
|
|
4001
3940
|
L: 138,
|
|
4002
3941
|
S: this,
|
|
4003
3942
|
A: [
|
|
@@ -4013,12 +3952,12 @@ var DataSpaceManager = class {
|
|
|
4013
3952
|
genesisFeedKey: controlFeedKey,
|
|
4014
3953
|
controlFeedKey,
|
|
4015
3954
|
dataFeedKey,
|
|
4016
|
-
state:
|
|
3955
|
+
state: import_services8.SpaceState.ACTIVE
|
|
4017
3956
|
};
|
|
4018
3957
|
(0, import_log10.log)("creating space...", {
|
|
4019
3958
|
spaceKey
|
|
4020
3959
|
}, {
|
|
4021
|
-
F:
|
|
3960
|
+
F: __dxlog_file12,
|
|
4022
3961
|
L: 150,
|
|
4023
3962
|
S: this,
|
|
4024
3963
|
C: (f, a) => f(...a)
|
|
@@ -4033,8 +3972,8 @@ var DataSpaceManager = class {
|
|
|
4033
3972
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
|
|
4034
3973
|
await this._metadataStore.addSpace(metadata);
|
|
4035
3974
|
const memberCredential = credentials[1];
|
|
4036
|
-
(0,
|
|
4037
|
-
F:
|
|
3975
|
+
(0, import_invariant11.invariant)((0, import_credentials11.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3976
|
+
F: __dxlog_file12,
|
|
4038
3977
|
L: 163,
|
|
4039
3978
|
S: this,
|
|
4040
3979
|
A: [
|
|
@@ -4052,13 +3991,13 @@ var DataSpaceManager = class {
|
|
|
4052
3991
|
(0, import_log10.log)("accept space", {
|
|
4053
3992
|
opts
|
|
4054
3993
|
}, {
|
|
4055
|
-
F:
|
|
3994
|
+
F: __dxlog_file12,
|
|
4056
3995
|
L: 175,
|
|
4057
3996
|
S: this,
|
|
4058
3997
|
C: (f, a) => f(...a)
|
|
4059
3998
|
});
|
|
4060
|
-
(0,
|
|
4061
|
-
F:
|
|
3999
|
+
(0, import_invariant11.invariant)(this._isOpen, "Not open.", {
|
|
4000
|
+
F: __dxlog_file12,
|
|
4062
4001
|
L: 176,
|
|
4063
4002
|
S: this,
|
|
4064
4003
|
A: [
|
|
@@ -4066,8 +4005,8 @@ var DataSpaceManager = class {
|
|
|
4066
4005
|
"'Not open.'"
|
|
4067
4006
|
]
|
|
4068
4007
|
});
|
|
4069
|
-
(0,
|
|
4070
|
-
F:
|
|
4008
|
+
(0, import_invariant11.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
4009
|
+
F: __dxlog_file12,
|
|
4071
4010
|
L: 177,
|
|
4072
4011
|
S: this,
|
|
4073
4012
|
A: [
|
|
@@ -4095,14 +4034,14 @@ var DataSpaceManager = class {
|
|
|
4095
4034
|
async waitUntilSpaceReady(spaceKey) {
|
|
4096
4035
|
await (0, import_context9.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
4097
4036
|
const space = this._spaces.get(spaceKey);
|
|
4098
|
-
return !!space && space.state ===
|
|
4037
|
+
return !!space && space.state === import_services8.SpaceState.READY;
|
|
4099
4038
|
}));
|
|
4100
4039
|
}
|
|
4101
4040
|
async _constructSpace(metadata) {
|
|
4102
4041
|
(0, import_log10.log)("construct space", {
|
|
4103
4042
|
metadata
|
|
4104
4043
|
}, {
|
|
4105
|
-
F:
|
|
4044
|
+
F: __dxlog_file12,
|
|
4106
4045
|
L: 210,
|
|
4107
4046
|
S: this,
|
|
4108
4047
|
C: (f, a) => f(...a)
|
|
@@ -4140,7 +4079,7 @@ var DataSpaceManager = class {
|
|
|
4140
4079
|
},
|
|
4141
4080
|
onAuthFailure: () => {
|
|
4142
4081
|
import_log10.log.warn("auth failure", void 0, {
|
|
4143
|
-
F:
|
|
4082
|
+
F: __dxlog_file12,
|
|
4144
4083
|
L: 247,
|
|
4145
4084
|
S: this,
|
|
4146
4085
|
C: (f, a) => f(...a)
|
|
@@ -4152,7 +4091,7 @@ var DataSpaceManager = class {
|
|
|
4152
4091
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
4153
4092
|
const dataSpace = new DataSpace({
|
|
4154
4093
|
inner: space,
|
|
4155
|
-
initialState: metadata.state ===
|
|
4094
|
+
initialState: metadata.state === import_services8.SpaceState.INACTIVE ? import_services8.SpaceState.INACTIVE : import_services8.SpaceState.CLOSED,
|
|
4156
4095
|
metadataStore: this._metadataStore,
|
|
4157
4096
|
gossip,
|
|
4158
4097
|
presence,
|
|
@@ -4164,7 +4103,7 @@ var DataSpaceManager = class {
|
|
|
4164
4103
|
(0, import_log10.log)("before space ready", {
|
|
4165
4104
|
space: space.key
|
|
4166
4105
|
}, {
|
|
4167
|
-
F:
|
|
4106
|
+
F: __dxlog_file12,
|
|
4168
4107
|
L: 265,
|
|
4169
4108
|
S: this,
|
|
4170
4109
|
C: (f, a) => f(...a)
|
|
@@ -4175,7 +4114,7 @@ var DataSpaceManager = class {
|
|
|
4175
4114
|
space: space.key,
|
|
4176
4115
|
open: this._isOpen
|
|
4177
4116
|
}, {
|
|
4178
|
-
F:
|
|
4117
|
+
F: __dxlog_file12,
|
|
4179
4118
|
L: 268,
|
|
4180
4119
|
S: this,
|
|
4181
4120
|
C: (f, a) => f(...a)
|
|
@@ -4188,7 +4127,7 @@ var DataSpaceManager = class {
|
|
|
4188
4127
|
(0, import_log10.log)("before space close", {
|
|
4189
4128
|
space: space.key
|
|
4190
4129
|
}, {
|
|
4191
|
-
F:
|
|
4130
|
+
F: __dxlog_file12,
|
|
4192
4131
|
L: 274,
|
|
4193
4132
|
S: this,
|
|
4194
4133
|
C: (f, a) => f(...a)
|
|
@@ -4198,7 +4137,7 @@ var DataSpaceManager = class {
|
|
|
4198
4137
|
cache: metadata.cache,
|
|
4199
4138
|
automergeHost: this._automergeHost
|
|
4200
4139
|
});
|
|
4201
|
-
if (metadata.state !==
|
|
4140
|
+
if (metadata.state !== import_services8.SpaceState.INACTIVE) {
|
|
4202
4141
|
await dataSpace.open();
|
|
4203
4142
|
}
|
|
4204
4143
|
if (metadata.controlTimeframe) {
|
|
@@ -4223,7 +4162,7 @@ _ts_decorate5([
|
|
|
4223
4162
|
DataSpaceManager = _ts_decorate5([
|
|
4224
4163
|
(0, import_async13.trackLeaks)("open", "close")
|
|
4225
4164
|
], DataSpaceManager);
|
|
4226
|
-
var
|
|
4165
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
4227
4166
|
var SpacesServiceImpl = class {
|
|
4228
4167
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
4229
4168
|
this._identityManager = _identityManager;
|
|
@@ -4240,29 +4179,29 @@ var SpacesServiceImpl = class {
|
|
|
4240
4179
|
}
|
|
4241
4180
|
async updateSpace({ spaceKey, state }) {
|
|
4242
4181
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4243
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4182
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4244
4183
|
if (state) {
|
|
4245
4184
|
switch (state) {
|
|
4246
|
-
case
|
|
4185
|
+
case import_services9.SpaceState.ACTIVE:
|
|
4247
4186
|
await space.activate();
|
|
4248
4187
|
break;
|
|
4249
|
-
case
|
|
4188
|
+
case import_services9.SpaceState.INACTIVE:
|
|
4250
4189
|
await space.deactivate();
|
|
4251
4190
|
break;
|
|
4252
4191
|
default:
|
|
4253
|
-
throw new
|
|
4192
|
+
throw new import_protocols10.ApiError("Invalid space state");
|
|
4254
4193
|
}
|
|
4255
4194
|
}
|
|
4256
4195
|
}
|
|
4257
4196
|
querySpaces() {
|
|
4258
|
-
return new
|
|
4197
|
+
return new import_codec_protobuf10.Stream(({ next, ctx }) => {
|
|
4259
4198
|
const scheduler = new import_async14.UpdateScheduler(ctx, async () => {
|
|
4260
4199
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4261
4200
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
4262
4201
|
(0, import_log11.log)("update", {
|
|
4263
4202
|
spaces
|
|
4264
4203
|
}, {
|
|
4265
|
-
F:
|
|
4204
|
+
F: __dxlog_file13,
|
|
4266
4205
|
L: 77,
|
|
4267
4206
|
S: this,
|
|
4268
4207
|
C: (f, a) => f(...a)
|
|
@@ -4302,14 +4241,14 @@ var SpacesServiceImpl = class {
|
|
|
4302
4241
|
}
|
|
4303
4242
|
async postMessage({ spaceKey, channel, message }) {
|
|
4304
4243
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4305
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4244
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4306
4245
|
await space.postMessage(getChannelId(channel), message);
|
|
4307
4246
|
}
|
|
4308
4247
|
subscribeMessages({ spaceKey, channel }) {
|
|
4309
|
-
return new
|
|
4248
|
+
return new import_codec_protobuf10.Stream(({ ctx, next }) => {
|
|
4310
4249
|
(0, import_async14.scheduleTask)(ctx, async () => {
|
|
4311
4250
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4312
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4251
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4313
4252
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
4314
4253
|
next(message);
|
|
4315
4254
|
});
|
|
@@ -4318,8 +4257,8 @@ var SpacesServiceImpl = class {
|
|
|
4318
4257
|
});
|
|
4319
4258
|
}
|
|
4320
4259
|
queryCredentials({ spaceKey, noTail }) {
|
|
4321
|
-
return new
|
|
4322
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4260
|
+
return new import_codec_protobuf10.Stream(({ ctx, next, close }) => {
|
|
4261
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4323
4262
|
const processor = {
|
|
4324
4263
|
processCredential: async (credential) => {
|
|
4325
4264
|
next(credential);
|
|
@@ -4335,7 +4274,7 @@ var SpacesServiceImpl = class {
|
|
|
4335
4274
|
});
|
|
4336
4275
|
}
|
|
4337
4276
|
async writeCredentials({ spaceKey, credentials }) {
|
|
4338
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4277
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4339
4278
|
for (const credential of credentials ?? []) {
|
|
4340
4279
|
if (credential.proof) {
|
|
4341
4280
|
await space.controlPipeline.writer.write({
|
|
@@ -4344,8 +4283,8 @@ var SpacesServiceImpl = class {
|
|
|
4344
4283
|
}
|
|
4345
4284
|
});
|
|
4346
4285
|
} else {
|
|
4347
|
-
(0,
|
|
4348
|
-
F:
|
|
4286
|
+
(0, import_invariant12.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
4287
|
+
F: __dxlog_file13,
|
|
4349
4288
|
L: 164,
|
|
4350
4289
|
S: this,
|
|
4351
4290
|
A: [
|
|
@@ -4353,8 +4292,8 @@ var SpacesServiceImpl = class {
|
|
|
4353
4292
|
"'Id on unsigned credentials is not allowed'"
|
|
4354
4293
|
]
|
|
4355
4294
|
});
|
|
4356
|
-
(0,
|
|
4357
|
-
F:
|
|
4295
|
+
(0, import_invariant12.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
4296
|
+
F: __dxlog_file13,
|
|
4358
4297
|
L: 165,
|
|
4359
4298
|
S: this,
|
|
4360
4299
|
A: [
|
|
@@ -4363,8 +4302,8 @@ var SpacesServiceImpl = class {
|
|
|
4363
4302
|
]
|
|
4364
4303
|
});
|
|
4365
4304
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
4366
|
-
(0,
|
|
4367
|
-
F:
|
|
4305
|
+
(0, import_invariant12.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
4306
|
+
F: __dxlog_file13,
|
|
4368
4307
|
L: 167,
|
|
4369
4308
|
S: this,
|
|
4370
4309
|
A: [
|
|
@@ -4386,7 +4325,7 @@ var SpacesServiceImpl = class {
|
|
|
4386
4325
|
}
|
|
4387
4326
|
async createEpoch({ spaceKey, migration }) {
|
|
4388
4327
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4389
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new
|
|
4328
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols10.SpaceNotFoundError(spaceKey));
|
|
4390
4329
|
await space.createEpoch({
|
|
4391
4330
|
migration
|
|
4392
4331
|
});
|
|
@@ -4395,7 +4334,7 @@ var SpacesServiceImpl = class {
|
|
|
4395
4334
|
return {
|
|
4396
4335
|
spaceKey: space.key,
|
|
4397
4336
|
state: space.state,
|
|
4398
|
-
error: space.error ? (0,
|
|
4337
|
+
error: space.error ? (0, import_protocols10.encodeError)(space.error) : void 0,
|
|
4399
4338
|
pipeline: {
|
|
4400
4339
|
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
4401
4340
|
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
@@ -4420,7 +4359,7 @@ var SpacesServiceImpl = class {
|
|
|
4420
4359
|
identityKey: member.key,
|
|
4421
4360
|
profile: member.profile ?? {}
|
|
4422
4361
|
},
|
|
4423
|
-
presence: member.removed ?
|
|
4362
|
+
presence: member.removed ? import_services9.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE,
|
|
4424
4363
|
peerStates: peers
|
|
4425
4364
|
};
|
|
4426
4365
|
}),
|
|
@@ -4431,7 +4370,7 @@ var SpacesServiceImpl = class {
|
|
|
4431
4370
|
}
|
|
4432
4371
|
};
|
|
4433
4372
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
4434
|
-
var
|
|
4373
|
+
var createSelectedDocumentsIterator = (automergeHost) => (
|
|
4435
4374
|
/**
|
|
4436
4375
|
* Get object data blobs from Automerge Repo by ids.
|
|
4437
4376
|
* @param ids
|
|
@@ -4439,22 +4378,22 @@ var createLoadDocuments = (automergeHost) => (
|
|
|
4439
4378
|
// TODO(mykola): Unload automerge handles after usage.
|
|
4440
4379
|
async function* loadDocuments(ids) {
|
|
4441
4380
|
for (const id of ids) {
|
|
4442
|
-
const { documentId, objectId } =
|
|
4381
|
+
const { documentId, objectId } = import_protocols12.idCodec.decode(id);
|
|
4443
4382
|
const handle = automergeHost.repo.find(documentId);
|
|
4444
4383
|
await (0, import_debug7.warnAfterTimeout)(5e3, "to long to load doc", () => handle.whenReady());
|
|
4445
4384
|
const doc = handle.docSync();
|
|
4446
4385
|
const hash = (0, import_automerge.getHeads)(doc).join("");
|
|
4447
|
-
yield [
|
|
4386
|
+
yield doc.objects?.[objectId] ? [
|
|
4448
4387
|
{
|
|
4449
4388
|
id,
|
|
4450
4389
|
object: doc.objects[objectId],
|
|
4451
4390
|
currentHash: hash
|
|
4452
4391
|
}
|
|
4453
|
-
];
|
|
4392
|
+
] : [];
|
|
4454
4393
|
}
|
|
4455
4394
|
}
|
|
4456
4395
|
);
|
|
4457
|
-
var
|
|
4396
|
+
var createDocumentsIterator = (automergeHost) => (
|
|
4458
4397
|
/**
|
|
4459
4398
|
* Recursively get all object data blobs from Automerge Repo.
|
|
4460
4399
|
* @param ids
|
|
@@ -4472,12 +4411,12 @@ var createGetAllDocuments = (automergeHost) => (
|
|
|
4472
4411
|
if (doc.objects) {
|
|
4473
4412
|
yield Object.entries(doc.objects).map(([objectId, object]) => {
|
|
4474
4413
|
return {
|
|
4475
|
-
id:
|
|
4414
|
+
id: import_protocols12.idCodec.encode({
|
|
4476
4415
|
documentId: handle.documentId,
|
|
4477
4416
|
objectId
|
|
4478
4417
|
}),
|
|
4479
4418
|
object,
|
|
4480
|
-
currentHash: heads.
|
|
4419
|
+
currentHash: heads.join("")
|
|
4481
4420
|
};
|
|
4482
4421
|
});
|
|
4483
4422
|
}
|
|
@@ -4515,18 +4454,20 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4515
4454
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4516
4455
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4517
4456
|
}
|
|
4518
|
-
var
|
|
4519
|
-
var ServiceContext = class {
|
|
4520
|
-
constructor(storage, networkManager, signalManager, _runtimeParams) {
|
|
4457
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4458
|
+
var ServiceContext = class extends import_context10.Resource {
|
|
4459
|
+
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
4460
|
+
super();
|
|
4521
4461
|
this.storage = storage;
|
|
4462
|
+
this.level = level;
|
|
4522
4463
|
this.networkManager = networkManager;
|
|
4523
4464
|
this.signalManager = signalManager;
|
|
4524
4465
|
this._runtimeParams = _runtimeParams;
|
|
4525
4466
|
this.initialized = new import_async15.Trigger();
|
|
4526
4467
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4527
4468
|
this._instanceId = import_keys10.PublicKey.random().toHex();
|
|
4528
|
-
this.metadataStore = new
|
|
4529
|
-
this.snapshotStore = new
|
|
4469
|
+
this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
|
|
4470
|
+
this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
|
|
4530
4471
|
this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
|
|
4531
4472
|
this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
|
|
4532
4473
|
this.feedStore = new import_feed_store4.FeedStore({
|
|
@@ -4534,12 +4475,12 @@ var ServiceContext = class {
|
|
|
4534
4475
|
root: storage.createDirectory("feeds"),
|
|
4535
4476
|
signer: this.keyring,
|
|
4536
4477
|
hypercore: {
|
|
4537
|
-
valueEncoding:
|
|
4478
|
+
valueEncoding: import_echo_pipeline4.valueEncoding,
|
|
4538
4479
|
stats: true
|
|
4539
4480
|
}
|
|
4540
4481
|
})
|
|
4541
4482
|
});
|
|
4542
|
-
this.spaceManager = new
|
|
4483
|
+
this.spaceManager = new import_echo_pipeline4.SpaceManager({
|
|
4543
4484
|
feedStore: this.feedStore,
|
|
4544
4485
|
networkManager: this.networkManager,
|
|
4545
4486
|
blobStore: this.blobStore,
|
|
@@ -4548,10 +4489,11 @@ var ServiceContext = class {
|
|
|
4548
4489
|
});
|
|
4549
4490
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4550
4491
|
this.indexMetadata = new import_indexing.IndexMetadataStore({
|
|
4551
|
-
|
|
4492
|
+
db: level.sublevel("index-metadata")
|
|
4552
4493
|
});
|
|
4553
|
-
this.automergeHost = new
|
|
4494
|
+
this.automergeHost = new import_echo_pipeline4.AutomergeHost({
|
|
4554
4495
|
directory: storage.createDirectory("automerge"),
|
|
4496
|
+
db: level.sublevel("automerge"),
|
|
4555
4497
|
metadata: this.indexMetadata
|
|
4556
4498
|
});
|
|
4557
4499
|
this.indexer = new import_indexing.Indexer({
|
|
@@ -4559,55 +4501,56 @@ var ServiceContext = class {
|
|
|
4559
4501
|
directory: storage.createDirectory("index-store")
|
|
4560
4502
|
}),
|
|
4561
4503
|
metadataStore: this.indexMetadata,
|
|
4562
|
-
loadDocuments:
|
|
4563
|
-
getAllDocuments:
|
|
4504
|
+
loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
|
|
4505
|
+
getAllDocuments: createDocumentsIterator(this.automergeHost)
|
|
4564
4506
|
});
|
|
4565
4507
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4566
|
-
this._handlerFactories.set(
|
|
4508
|
+
this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug6.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4567
4509
|
}
|
|
4568
|
-
async
|
|
4510
|
+
async _open(ctx) {
|
|
4569
4511
|
await this._checkStorageVersion();
|
|
4570
4512
|
(0, import_log12.log)("opening...", void 0, {
|
|
4571
|
-
F:
|
|
4572
|
-
L:
|
|
4513
|
+
F: __dxlog_file14,
|
|
4514
|
+
L: 157,
|
|
4573
4515
|
S: this,
|
|
4574
4516
|
C: (f, a) => f(...a)
|
|
4575
4517
|
});
|
|
4576
|
-
import_log12.log.trace("dxos.sdk.service-context.open",
|
|
4518
|
+
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.begin({
|
|
4577
4519
|
id: this._instanceId
|
|
4578
4520
|
}), {
|
|
4579
|
-
F:
|
|
4580
|
-
L:
|
|
4521
|
+
F: __dxlog_file14,
|
|
4522
|
+
L: 158,
|
|
4581
4523
|
S: this,
|
|
4582
4524
|
C: (f, a) => f(...a)
|
|
4583
4525
|
});
|
|
4584
4526
|
await this.signalManager.open();
|
|
4585
4527
|
await this.networkManager.open();
|
|
4528
|
+
await this.automergeHost.open();
|
|
4586
4529
|
await this.metadataStore.load();
|
|
4587
4530
|
await this.spaceManager.open();
|
|
4588
4531
|
await this.identityManager.open(ctx);
|
|
4589
4532
|
if (this.identityManager.identity) {
|
|
4590
4533
|
await this._initialize(ctx);
|
|
4591
4534
|
}
|
|
4592
|
-
import_log12.log.trace("dxos.sdk.service-context.open",
|
|
4535
|
+
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols11.trace.end({
|
|
4593
4536
|
id: this._instanceId
|
|
4594
4537
|
}), {
|
|
4595
|
-
F:
|
|
4596
|
-
L:
|
|
4538
|
+
F: __dxlog_file14,
|
|
4539
|
+
L: 169,
|
|
4597
4540
|
S: this,
|
|
4598
4541
|
C: (f, a) => f(...a)
|
|
4599
4542
|
});
|
|
4600
4543
|
(0, import_log12.log)("opened", void 0, {
|
|
4601
|
-
F:
|
|
4602
|
-
L:
|
|
4544
|
+
F: __dxlog_file14,
|
|
4545
|
+
L: 170,
|
|
4603
4546
|
S: this,
|
|
4604
4547
|
C: (f, a) => f(...a)
|
|
4605
4548
|
});
|
|
4606
4549
|
}
|
|
4607
|
-
async
|
|
4550
|
+
async _close() {
|
|
4608
4551
|
(0, import_log12.log)("closing...", void 0, {
|
|
4609
|
-
F:
|
|
4610
|
-
L:
|
|
4552
|
+
F: __dxlog_file14,
|
|
4553
|
+
L: 174,
|
|
4611
4554
|
S: this,
|
|
4612
4555
|
C: (f, a) => f(...a)
|
|
4613
4556
|
});
|
|
@@ -4624,8 +4567,8 @@ var ServiceContext = class {
|
|
|
4624
4567
|
await this.metadataStore.close();
|
|
4625
4568
|
await this.indexer.destroy();
|
|
4626
4569
|
(0, import_log12.log)("closed", void 0, {
|
|
4627
|
-
F:
|
|
4628
|
-
L:
|
|
4570
|
+
F: __dxlog_file14,
|
|
4571
|
+
L: 187,
|
|
4629
4572
|
S: this,
|
|
4630
4573
|
C: (f, a) => f(...a)
|
|
4631
4574
|
});
|
|
@@ -4637,9 +4580,9 @@ var ServiceContext = class {
|
|
|
4637
4580
|
}
|
|
4638
4581
|
getInvitationHandler(invitation) {
|
|
4639
4582
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4640
|
-
(0,
|
|
4641
|
-
F:
|
|
4642
|
-
L:
|
|
4583
|
+
(0, import_invariant13.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4584
|
+
F: __dxlog_file14,
|
|
4585
|
+
L: 198,
|
|
4643
4586
|
S: this,
|
|
4644
4587
|
A: [
|
|
4645
4588
|
"factory",
|
|
@@ -4663,15 +4606,15 @@ var ServiceContext = class {
|
|
|
4663
4606
|
}
|
|
4664
4607
|
async _checkStorageVersion() {
|
|
4665
4608
|
await this.metadataStore.load();
|
|
4666
|
-
if (this.metadataStore.version !==
|
|
4667
|
-
throw new
|
|
4609
|
+
if (this.metadataStore.version !== import_protocols11.STORAGE_VERSION) {
|
|
4610
|
+
throw new import_protocols11.InvalidStorageVersionError(import_protocols11.STORAGE_VERSION, this.metadataStore.version);
|
|
4668
4611
|
}
|
|
4669
4612
|
}
|
|
4670
4613
|
// Called when identity is created.
|
|
4671
4614
|
async _initialize(ctx) {
|
|
4672
4615
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
4673
|
-
F:
|
|
4674
|
-
L:
|
|
4616
|
+
F: __dxlog_file14,
|
|
4617
|
+
L: 229,
|
|
4675
4618
|
S: this,
|
|
4676
4619
|
C: (f, a) => f(...a)
|
|
4677
4620
|
});
|
|
@@ -4691,10 +4634,10 @@ var ServiceContext = class {
|
|
|
4691
4634
|
};
|
|
4692
4635
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
|
|
4693
4636
|
await this.dataSpaceManager.open();
|
|
4694
|
-
this._handlerFactories.set(
|
|
4695
|
-
(0,
|
|
4696
|
-
F:
|
|
4697
|
-
L:
|
|
4637
|
+
this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
|
|
4638
|
+
(0, import_invariant13.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4639
|
+
F: __dxlog_file14,
|
|
4640
|
+
L: 253,
|
|
4698
4641
|
S: this,
|
|
4699
4642
|
A: [
|
|
4700
4643
|
"this.dataSpaceManager",
|
|
@@ -4706,7 +4649,7 @@ var ServiceContext = class {
|
|
|
4706
4649
|
this.initialized.wake();
|
|
4707
4650
|
this._deviceSpaceSync = {
|
|
4708
4651
|
processCredential: async (credential) => {
|
|
4709
|
-
const assertion = (0,
|
|
4652
|
+
const assertion = (0, import_credentials14.getCredentialAssertion)(credential);
|
|
4710
4653
|
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
4711
4654
|
return;
|
|
4712
4655
|
}
|
|
@@ -4717,8 +4660,8 @@ var ServiceContext = class {
|
|
|
4717
4660
|
(0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
4718
4661
|
details: assertion
|
|
4719
4662
|
}, {
|
|
4720
|
-
F:
|
|
4721
|
-
L:
|
|
4663
|
+
F: __dxlog_file14,
|
|
4664
|
+
L: 269,
|
|
4722
4665
|
S: this,
|
|
4723
4666
|
C: (f, a) => f(...a)
|
|
4724
4667
|
});
|
|
@@ -4728,8 +4671,8 @@ var ServiceContext = class {
|
|
|
4728
4671
|
(0, import_log12.log)("space already exists, ignoring space admission", {
|
|
4729
4672
|
details: assertion
|
|
4730
4673
|
}, {
|
|
4731
|
-
F:
|
|
4732
|
-
L:
|
|
4674
|
+
F: __dxlog_file14,
|
|
4675
|
+
L: 273,
|
|
4733
4676
|
S: this,
|
|
4734
4677
|
C: (f, a) => f(...a)
|
|
4735
4678
|
});
|
|
@@ -4739,8 +4682,8 @@ var ServiceContext = class {
|
|
|
4739
4682
|
(0, import_log12.log)("accepting space recorded in halo", {
|
|
4740
4683
|
details: assertion
|
|
4741
4684
|
}, {
|
|
4742
|
-
F:
|
|
4743
|
-
L:
|
|
4685
|
+
F: __dxlog_file14,
|
|
4686
|
+
L: 278,
|
|
4744
4687
|
S: this,
|
|
4745
4688
|
C: (f, a) => f(...a)
|
|
4746
4689
|
});
|
|
@@ -4750,8 +4693,8 @@ var ServiceContext = class {
|
|
|
4750
4693
|
});
|
|
4751
4694
|
} catch (err) {
|
|
4752
4695
|
import_log12.log.catch(err, void 0, {
|
|
4753
|
-
F:
|
|
4754
|
-
L:
|
|
4696
|
+
F: __dxlog_file14,
|
|
4697
|
+
L: 284,
|
|
4755
4698
|
S: this,
|
|
4756
4699
|
C: (f, a) => f(...a)
|
|
4757
4700
|
});
|
|
@@ -4762,14 +4705,14 @@ var ServiceContext = class {
|
|
|
4762
4705
|
}
|
|
4763
4706
|
};
|
|
4764
4707
|
_ts_decorate6([
|
|
4765
|
-
|
|
4766
|
-
], ServiceContext.prototype, "
|
|
4708
|
+
import_tracing5.trace.span()
|
|
4709
|
+
], ServiceContext.prototype, "_open", null);
|
|
4767
4710
|
_ts_decorate6([
|
|
4768
|
-
|
|
4711
|
+
import_tracing5.trace.span()
|
|
4769
4712
|
], ServiceContext.prototype, "_initialize", null);
|
|
4770
4713
|
ServiceContext = _ts_decorate6([
|
|
4771
4714
|
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4772
|
-
|
|
4715
|
+
import_tracing5.trace.resource()
|
|
4773
4716
|
], ServiceContext);
|
|
4774
4717
|
var ServiceRegistry = class {
|
|
4775
4718
|
// prettier-ignore
|
|
@@ -4793,103 +4736,155 @@ var ServiceRegistry = class {
|
|
|
4793
4736
|
delete this._handlers[name];
|
|
4794
4737
|
}
|
|
4795
4738
|
};
|
|
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
|
-
});
|
|
4739
|
+
var DXOS_VERSION = "0.4.10-main.d51f2c2";
|
|
4740
|
+
var getPlatform = () => {
|
|
4741
|
+
if (process.browser) {
|
|
4742
|
+
if (typeof window !== "undefined") {
|
|
4743
|
+
const { userAgent } = window.navigator;
|
|
4744
|
+
return {
|
|
4745
|
+
type: import_services12.Platform.PLATFORM_TYPE.BROWSER,
|
|
4746
|
+
userAgent,
|
|
4747
|
+
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
4748
|
+
};
|
|
4749
|
+
} else {
|
|
4750
|
+
return {
|
|
4751
|
+
type: import_services12.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
4752
|
+
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
4753
|
+
};
|
|
4754
|
+
}
|
|
4755
|
+
} else {
|
|
4756
|
+
const { platform: platform2, version, arch } = process;
|
|
4757
|
+
return {
|
|
4758
|
+
type: import_services12.Platform.PLATFORM_TYPE.NODE,
|
|
4759
|
+
platform: platform2,
|
|
4760
|
+
arch,
|
|
4761
|
+
runtime: version,
|
|
4762
|
+
uptime: Math.floor(process.uptime()),
|
|
4763
|
+
memory: process.memoryUsage()
|
|
4764
|
+
};
|
|
4831
4765
|
}
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4766
|
+
};
|
|
4767
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
4768
|
+
var DEFAULT_TIMEOUT = 1e3;
|
|
4769
|
+
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
4770
|
+
const diagnostics = {
|
|
4771
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4772
|
+
platform: getPlatform(),
|
|
4773
|
+
client: {
|
|
4774
|
+
version: DXOS_VERSION,
|
|
4775
|
+
storage: {
|
|
4776
|
+
version: import_protocols13.STORAGE_VERSION
|
|
4777
|
+
}
|
|
4778
|
+
},
|
|
4779
|
+
trace: import_tracing6.TRACE_PROCESSOR.getDiagnostics()
|
|
4780
|
+
};
|
|
4781
|
+
{
|
|
4782
|
+
(0, import_invariant14.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
4783
|
+
F: __dxlog_file15,
|
|
4784
|
+
L: 108,
|
|
4785
|
+
S: void 0,
|
|
4838
4786
|
A: [
|
|
4839
|
-
"
|
|
4840
|
-
"'
|
|
4787
|
+
"clientServices.LoggingService",
|
|
4788
|
+
"'SystemService is not available.'"
|
|
4841
4789
|
]
|
|
4842
4790
|
});
|
|
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.");
|
|
4791
|
+
diagnostics.metrics = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
|
|
4792
|
+
timeout: DEFAULT_TIMEOUT
|
|
4793
|
+
}).catch(() => void 0);
|
|
4855
4794
|
}
|
|
4856
|
-
if (
|
|
4857
|
-
|
|
4795
|
+
if (typeof navigator !== "undefined" && navigator.storage) {
|
|
4796
|
+
const map = /* @__PURE__ */ new Map();
|
|
4797
|
+
const dir = await navigator.storage.getDirectory();
|
|
4798
|
+
for await (const filename of dir?.keys()) {
|
|
4799
|
+
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
4800
|
+
if (idx === -1) {
|
|
4801
|
+
continue;
|
|
4802
|
+
}
|
|
4803
|
+
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
4804
|
+
}
|
|
4805
|
+
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
4806
|
+
file,
|
|
4807
|
+
count
|
|
4808
|
+
}));
|
|
4858
4809
|
}
|
|
4859
|
-
|
|
4860
|
-
|
|
4810
|
+
const identity = serviceContext.identityManager.identity;
|
|
4811
|
+
if (identity) {
|
|
4812
|
+
diagnostics.identity = {
|
|
4813
|
+
identityKey: identity.identityKey,
|
|
4814
|
+
spaceKey: identity.space.key,
|
|
4815
|
+
profile: identity.profileDocument
|
|
4816
|
+
};
|
|
4817
|
+
const { devices } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
4818
|
+
timeout: DEFAULT_TIMEOUT
|
|
4819
|
+
}).catch(() => void 0) ?? {};
|
|
4820
|
+
diagnostics.devices = devices;
|
|
4821
|
+
if (serviceContext.dataSpaceManager) {
|
|
4822
|
+
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
4823
|
+
}
|
|
4824
|
+
const { feeds = [] } = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
|
|
4825
|
+
timeout: DEFAULT_TIMEOUT
|
|
4826
|
+
}).catch(() => void 0) ?? {};
|
|
4827
|
+
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
4828
|
+
feedKey,
|
|
4829
|
+
bytes,
|
|
4830
|
+
length
|
|
4831
|
+
}));
|
|
4832
|
+
const status = await (0, import_codec_protobuf11.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
4833
|
+
timeout: DEFAULT_TIMEOUT
|
|
4834
|
+
}).catch(() => void 0);
|
|
4835
|
+
diagnostics.networkStatus = status;
|
|
4836
|
+
diagnostics.swarms = serviceContext.networkManager.connectionLog?.swarms;
|
|
4861
4837
|
}
|
|
4862
|
-
|
|
4863
|
-
|
|
4838
|
+
diagnostics.config = config.values;
|
|
4839
|
+
return diagnostics;
|
|
4840
|
+
};
|
|
4841
|
+
var getSpaceStats = async (space) => {
|
|
4842
|
+
const stats = {
|
|
4843
|
+
key: space.key,
|
|
4844
|
+
metrics: space.metrics,
|
|
4845
|
+
epochs: space.inner.spaceState.credentials.filter((0, import_credentials15.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
|
|
4846
|
+
...credential.subject.assertion,
|
|
4847
|
+
id: credential.id
|
|
4848
|
+
})),
|
|
4849
|
+
members: Array.from(space.inner.spaceState.members.values()).map((member) => ({
|
|
4850
|
+
identity: {
|
|
4851
|
+
identityKey: member.key,
|
|
4852
|
+
profile: {
|
|
4853
|
+
displayName: member.assertion.profile?.displayName
|
|
4854
|
+
}
|
|
4855
|
+
},
|
|
4856
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE
|
|
4857
|
+
})),
|
|
4858
|
+
pipeline: {
|
|
4859
|
+
// TODO(burdon): Pick properties from credentials if needed.
|
|
4860
|
+
currentEpoch: space.automergeSpaceState.lastEpoch,
|
|
4861
|
+
appliedEpoch: space.automergeSpaceState.lastEpoch,
|
|
4862
|
+
controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
|
|
4863
|
+
currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
|
|
4864
|
+
targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
|
|
4865
|
+
totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe
|
|
4866
|
+
}
|
|
4867
|
+
};
|
|
4868
|
+
if (stats.metrics) {
|
|
4869
|
+
const { open, ready } = stats.metrics;
|
|
4870
|
+
stats.metrics.startupTime = open && ready && ready.getTime() - open.getTime();
|
|
4864
4871
|
}
|
|
4872
|
+
return stats;
|
|
4873
|
+
};
|
|
4874
|
+
var createCollectDiagnosticsBroadcastSender = () => {
|
|
4865
4875
|
return {
|
|
4866
|
-
|
|
4867
|
-
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
4868
|
-
root: `${dataRoot}/`
|
|
4869
|
-
})
|
|
4876
|
+
broadcastDiagnosticsRequest: async () => void 0
|
|
4870
4877
|
};
|
|
4871
4878
|
};
|
|
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
|
-
}
|
|
4879
|
+
var createCollectDiagnosticsBroadcastHandler = (_) => {
|
|
4880
|
+
return {
|
|
4881
|
+
start: () => {
|
|
4882
|
+
},
|
|
4883
|
+
stop: () => {
|
|
4884
|
+
}
|
|
4885
|
+
};
|
|
4891
4886
|
};
|
|
4892
|
-
var
|
|
4887
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4893
4888
|
var DevicesServiceImpl = class {
|
|
4894
4889
|
constructor(_identityManager) {
|
|
4895
4890
|
this._identityManager = _identityManager;
|
|
@@ -4906,8 +4901,8 @@ var DevicesServiceImpl = class {
|
|
|
4906
4901
|
devices: []
|
|
4907
4902
|
});
|
|
4908
4903
|
} else {
|
|
4909
|
-
(0,
|
|
4910
|
-
F:
|
|
4904
|
+
(0, import_invariant16.invariant)(this._identityManager.identity?.presence, "presence not present", {
|
|
4905
|
+
F: __dxlog_file16,
|
|
4911
4906
|
L: 32,
|
|
4912
4907
|
S: this,
|
|
4913
4908
|
A: [
|
|
@@ -4922,9 +4917,9 @@ var DevicesServiceImpl = class {
|
|
|
4922
4917
|
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
4923
4918
|
return {
|
|
4924
4919
|
deviceKey: key,
|
|
4925
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
4920
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services15.DeviceKind.CURRENT : import_services15.DeviceKind.TRUSTED,
|
|
4926
4921
|
profile,
|
|
4927
|
-
presence: isMe ?
|
|
4922
|
+
presence: isMe ? import_services15.Device.PresenceState.ONLINE : peerState ? import_services15.Device.PresenceState.ONLINE : import_services15.Device.PresenceState.OFFLINE
|
|
4928
4923
|
};
|
|
4929
4924
|
})
|
|
4930
4925
|
});
|
|
@@ -4965,6 +4960,60 @@ var DevicesServiceImpl = class {
|
|
|
4965
4960
|
});
|
|
4966
4961
|
}
|
|
4967
4962
|
};
|
|
4963
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
4964
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4965
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4966
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
4967
|
+
else
|
|
4968
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
4969
|
+
if (d = decorators[i])
|
|
4970
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4971
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4972
|
+
}
|
|
4973
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
4974
|
+
var Lock = class {
|
|
4975
|
+
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
4976
|
+
this._lockPath = lockPath;
|
|
4977
|
+
this._onAcquire = onAcquire;
|
|
4978
|
+
this._onRelease = onRelease;
|
|
4979
|
+
}
|
|
4980
|
+
get lockKey() {
|
|
4981
|
+
return this._lockPath;
|
|
4982
|
+
}
|
|
4983
|
+
async acquire() {
|
|
4984
|
+
(0, import_log14.log)("acquiring lock...", void 0, {
|
|
4985
|
+
F: __dxlog_file17,
|
|
4986
|
+
L: 32,
|
|
4987
|
+
S: this,
|
|
4988
|
+
C: (f, a) => f(...a)
|
|
4989
|
+
});
|
|
4990
|
+
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
4991
|
+
await this._onAcquire?.();
|
|
4992
|
+
(0, import_log14.log)("acquired lock", void 0, {
|
|
4993
|
+
F: __dxlog_file17,
|
|
4994
|
+
L: 37,
|
|
4995
|
+
S: this,
|
|
4996
|
+
C: (f, a) => f(...a)
|
|
4997
|
+
});
|
|
4998
|
+
}
|
|
4999
|
+
async release() {
|
|
5000
|
+
await this._onRelease?.();
|
|
5001
|
+
(0, import_invariant17.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
5002
|
+
F: __dxlog_file17,
|
|
5003
|
+
L: 42,
|
|
5004
|
+
S: this,
|
|
5005
|
+
A: [
|
|
5006
|
+
"this._fileHandle",
|
|
5007
|
+
"'Lock is not acquired'"
|
|
5008
|
+
]
|
|
5009
|
+
});
|
|
5010
|
+
await import_lock_file.LockFile.release(this._fileHandle);
|
|
5011
|
+
}
|
|
5012
|
+
};
|
|
5013
|
+
_ts_decorate7([
|
|
5014
|
+
import_log14.logInfo
|
|
5015
|
+
], Lock.prototype, "lockKey", null);
|
|
5016
|
+
var isLocked = (lockPath) => import_lock_file.LockFile.isLocked(lockPath);
|
|
4968
5017
|
var LoggingServiceImpl = class {
|
|
4969
5018
|
constructor() {
|
|
4970
5019
|
this._logs = new import_async18.Event();
|
|
@@ -5064,18 +5113,18 @@ var LoggingServiceImpl = class {
|
|
|
5064
5113
|
});
|
|
5065
5114
|
}
|
|
5066
5115
|
};
|
|
5067
|
-
var matchFilter = (filter, level,
|
|
5116
|
+
var matchFilter = (filter, level, path2, options) => {
|
|
5068
5117
|
switch (options) {
|
|
5069
|
-
case
|
|
5070
|
-
return level >= filter.level && (!filter.pattern ||
|
|
5071
|
-
case
|
|
5072
|
-
return level === filter.level && (!filter.pattern ||
|
|
5118
|
+
case import_services16.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
5119
|
+
return level >= filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5120
|
+
case import_services16.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
5121
|
+
return level === filter.level && (!filter.pattern || path2.includes(filter.pattern));
|
|
5073
5122
|
}
|
|
5074
5123
|
};
|
|
5075
5124
|
var shouldLog = (entry2, request) => {
|
|
5076
|
-
const options = request.options ??
|
|
5125
|
+
const options = request.options ?? import_services16.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
5077
5126
|
if (request.filters === void 0) {
|
|
5078
|
-
return options ===
|
|
5127
|
+
return options === import_services16.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
5079
5128
|
} else {
|
|
5080
5129
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
5081
5130
|
}
|
|
@@ -5111,6 +5160,63 @@ var NetworkServiceImpl = class {
|
|
|
5111
5160
|
await this.networkManager.setConnectionState(request.swarm);
|
|
5112
5161
|
}
|
|
5113
5162
|
};
|
|
5163
|
+
var getRootPath = (config) => {
|
|
5164
|
+
const { dataRoot = (0, import_util11.isNode)() ? import_client_protocol5.DX_DATA : "dxos/storage" } = config ?? {};
|
|
5165
|
+
return `${dataRoot}/`;
|
|
5166
|
+
};
|
|
5167
|
+
var isPersistent = (config) => {
|
|
5168
|
+
const { persistent = false } = config ?? {};
|
|
5169
|
+
return config.dataStore !== void 0 && config.dataStore !== import_config3.Runtime.Client.Storage.StorageDriver.RAM || persistent;
|
|
5170
|
+
};
|
|
5171
|
+
var StorageDriver = import_config2.Runtime.Client.Storage.StorageDriver;
|
|
5172
|
+
var createStorageObjects = (config) => {
|
|
5173
|
+
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
5174
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
5175
|
+
throw new import_protocols15.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
5176
|
+
}
|
|
5177
|
+
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
5178
|
+
throw new import_protocols15.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
5179
|
+
}
|
|
5180
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
5181
|
+
throw new import_protocols15.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
5182
|
+
}
|
|
5183
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
5184
|
+
throw new import_protocols15.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
5185
|
+
}
|
|
5186
|
+
return {
|
|
5187
|
+
storage: (0, import_random_access_storage.createStorage)({
|
|
5188
|
+
type: persistent ? toStorageType(dataStore) : import_random_access_storage.StorageType.RAM,
|
|
5189
|
+
root: getRootPath(config)
|
|
5190
|
+
})
|
|
5191
|
+
};
|
|
5192
|
+
};
|
|
5193
|
+
var toStorageType = (type) => {
|
|
5194
|
+
switch (type) {
|
|
5195
|
+
case void 0:
|
|
5196
|
+
return void 0;
|
|
5197
|
+
case StorageDriver.RAM:
|
|
5198
|
+
return import_random_access_storage.StorageType.RAM;
|
|
5199
|
+
case StorageDriver.CHROME:
|
|
5200
|
+
return import_random_access_storage.StorageType.CHROME;
|
|
5201
|
+
case StorageDriver.FIREFOX:
|
|
5202
|
+
return import_random_access_storage.StorageType.FIREFOX;
|
|
5203
|
+
case StorageDriver.IDB:
|
|
5204
|
+
return import_random_access_storage.StorageType.IDB;
|
|
5205
|
+
case StorageDriver.NODE:
|
|
5206
|
+
return import_random_access_storage.StorageType.NODE;
|
|
5207
|
+
case StorageDriver.WEBFS:
|
|
5208
|
+
return import_random_access_storage.StorageType.WEBFS;
|
|
5209
|
+
default:
|
|
5210
|
+
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
5211
|
+
}
|
|
5212
|
+
};
|
|
5213
|
+
var createLevel = async (config) => {
|
|
5214
|
+
const persistent = isPersistent(config);
|
|
5215
|
+
const storagePath = persistent ? import_node_path.default.join(getRootPath(config), "level") : `/tmp/dxos-${import_keys13.PublicKey.random().toHex()}`;
|
|
5216
|
+
const level = new import_level.Level(storagePath);
|
|
5217
|
+
await level.open();
|
|
5218
|
+
return level;
|
|
5219
|
+
};
|
|
5114
5220
|
var SystemServiceImpl = class {
|
|
5115
5221
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
5116
5222
|
this._config = config;
|
|
@@ -5130,9 +5236,9 @@ var SystemServiceImpl = class {
|
|
|
5130
5236
|
const diagnostics = await this._getDiagnostics();
|
|
5131
5237
|
return {
|
|
5132
5238
|
timestamp: /* @__PURE__ */ new Date(),
|
|
5133
|
-
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0,
|
|
5134
|
-
truncate: keys ===
|
|
5135
|
-
humanize: keys ===
|
|
5239
|
+
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util12.jsonKeyReplacer)({
|
|
5240
|
+
truncate: keys === import_services17.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
5241
|
+
humanize: keys === import_services17.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
5136
5242
|
})))
|
|
5137
5243
|
};
|
|
5138
5244
|
}
|
|
@@ -5180,16 +5286,18 @@ var ClientServicesHost = class {
|
|
|
5180
5286
|
transportFactory,
|
|
5181
5287
|
signalManager,
|
|
5182
5288
|
storage,
|
|
5289
|
+
level,
|
|
5183
5290
|
// TODO(wittjosiah): Turn this on by default.
|
|
5184
5291
|
lockKey,
|
|
5185
5292
|
callbacks,
|
|
5186
5293
|
runtimeParams
|
|
5187
5294
|
} = {}) {
|
|
5188
|
-
this._tracingService =
|
|
5295
|
+
this._tracingService = import_tracing8.TRACE_PROCESSOR.createTraceSender();
|
|
5189
5296
|
this._statusUpdate = new import_async16.Event();
|
|
5190
5297
|
this._opening = false;
|
|
5191
5298
|
this._open = false;
|
|
5192
5299
|
this._storage = storage;
|
|
5300
|
+
this._level = level;
|
|
5193
5301
|
this._callbacks = callbacks;
|
|
5194
5302
|
this._runtimeParams = runtimeParams;
|
|
5195
5303
|
if (config) {
|
|
@@ -5213,14 +5321,14 @@ var ClientServicesHost = class {
|
|
|
5213
5321
|
this._systemService = new SystemServiceImpl({
|
|
5214
5322
|
config: () => this._config,
|
|
5215
5323
|
statusUpdate: this._statusUpdate,
|
|
5216
|
-
getCurrentStatus: () => this.isOpen ?
|
|
5324
|
+
getCurrentStatus: () => this.isOpen ? import_services14.SystemStatus.ACTIVE : import_services14.SystemStatus.INACTIVE,
|
|
5217
5325
|
getDiagnostics: () => {
|
|
5218
5326
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
5219
5327
|
},
|
|
5220
5328
|
onUpdateStatus: async (status) => {
|
|
5221
|
-
if (!this.isOpen && status ===
|
|
5329
|
+
if (!this.isOpen && status === import_services14.SystemStatus.ACTIVE) {
|
|
5222
5330
|
await this._resourceLock?.acquire();
|
|
5223
|
-
} else if (this.isOpen && status ===
|
|
5331
|
+
} else if (this.isOpen && status === import_services14.SystemStatus.INACTIVE) {
|
|
5224
5332
|
await this._resourceLock?.release();
|
|
5225
5333
|
}
|
|
5226
5334
|
},
|
|
@@ -5228,8 +5336,9 @@ var ClientServicesHost = class {
|
|
|
5228
5336
|
await this.reset();
|
|
5229
5337
|
}
|
|
5230
5338
|
});
|
|
5339
|
+
this.diagnosticsBroadcastHandler = createCollectDiagnosticsBroadcastHandler(this._systemService);
|
|
5231
5340
|
this._loggingService = new LoggingServiceImpl();
|
|
5232
|
-
this._serviceRegistry = new ServiceRegistry(
|
|
5341
|
+
this._serviceRegistry = new ServiceRegistry(import_client_protocol4.clientServiceBundle, {
|
|
5233
5342
|
SystemService: this._systemService,
|
|
5234
5343
|
TracingService: this._tracingService
|
|
5235
5344
|
});
|
|
@@ -5258,25 +5367,25 @@ var ClientServicesHost = class {
|
|
|
5258
5367
|
* Can only be called once.
|
|
5259
5368
|
*/
|
|
5260
5369
|
initialize({ config, ...options }) {
|
|
5261
|
-
(0,
|
|
5370
|
+
(0, import_invariant15.invariant)(!this._open, "service host is open", {
|
|
5262
5371
|
F: __dxlog_file18,
|
|
5263
|
-
L:
|
|
5372
|
+
L: 197,
|
|
5264
5373
|
S: this,
|
|
5265
5374
|
A: [
|
|
5266
5375
|
"!this._open",
|
|
5267
5376
|
"'service host is open'"
|
|
5268
5377
|
]
|
|
5269
5378
|
});
|
|
5270
|
-
(0,
|
|
5379
|
+
(0, import_log13.log)("initializing...", void 0, {
|
|
5271
5380
|
F: __dxlog_file18,
|
|
5272
|
-
L:
|
|
5381
|
+
L: 198,
|
|
5273
5382
|
S: this,
|
|
5274
5383
|
C: (f, a) => f(...a)
|
|
5275
5384
|
});
|
|
5276
5385
|
if (config) {
|
|
5277
|
-
(0,
|
|
5386
|
+
(0, import_invariant15.invariant)(!this._config, "config already set", {
|
|
5278
5387
|
F: __dxlog_file18,
|
|
5279
|
-
L:
|
|
5388
|
+
L: 201,
|
|
5280
5389
|
S: this,
|
|
5281
5390
|
A: [
|
|
5282
5391
|
"!this._config",
|
|
@@ -5289,9 +5398,9 @@ var ClientServicesHost = class {
|
|
|
5289
5398
|
}
|
|
5290
5399
|
}
|
|
5291
5400
|
if (!options.signalManager) {
|
|
5292
|
-
|
|
5401
|
+
import_log13.log.warn("running signaling without telemetry metadata.", void 0, {
|
|
5293
5402
|
F: __dxlog_file18,
|
|
5294
|
-
L:
|
|
5403
|
+
L: 209,
|
|
5295
5404
|
S: this,
|
|
5296
5405
|
C: (f, a) => f(...a)
|
|
5297
5406
|
});
|
|
@@ -5300,9 +5409,9 @@ var ClientServicesHost = class {
|
|
|
5300
5409
|
iceServers: this._config?.get("runtime.services.ice")
|
|
5301
5410
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
5302
5411
|
this._signalManager = signalManager;
|
|
5303
|
-
(0,
|
|
5412
|
+
(0, import_invariant15.invariant)(!this._networkManager, "network manager already set", {
|
|
5304
5413
|
F: __dxlog_file18,
|
|
5305
|
-
L:
|
|
5414
|
+
L: 220,
|
|
5306
5415
|
S: this,
|
|
5307
5416
|
A: [
|
|
5308
5417
|
"!this._networkManager",
|
|
@@ -5314,9 +5423,9 @@ var ClientServicesHost = class {
|
|
|
5314
5423
|
transportFactory,
|
|
5315
5424
|
signalManager
|
|
5316
5425
|
});
|
|
5317
|
-
(0,
|
|
5426
|
+
(0, import_log13.log)("initialized", void 0, {
|
|
5318
5427
|
F: __dxlog_file18,
|
|
5319
|
-
L:
|
|
5428
|
+
L: 227,
|
|
5320
5429
|
S: this,
|
|
5321
5430
|
C: (f, a) => f(...a)
|
|
5322
5431
|
});
|
|
@@ -5326,44 +5435,44 @@ var ClientServicesHost = class {
|
|
|
5326
5435
|
return;
|
|
5327
5436
|
}
|
|
5328
5437
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5329
|
-
|
|
5438
|
+
import_log13.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
5330
5439
|
id: traceId
|
|
5331
5440
|
}), {
|
|
5332
5441
|
F: __dxlog_file18,
|
|
5333
|
-
L:
|
|
5442
|
+
L: 238,
|
|
5334
5443
|
S: this,
|
|
5335
5444
|
C: (f, a) => f(...a)
|
|
5336
5445
|
});
|
|
5337
|
-
(0,
|
|
5446
|
+
(0, import_invariant15.invariant)(this._config, "config not set", {
|
|
5338
5447
|
F: __dxlog_file18,
|
|
5339
|
-
L:
|
|
5448
|
+
L: 240,
|
|
5340
5449
|
S: this,
|
|
5341
5450
|
A: [
|
|
5342
5451
|
"this._config",
|
|
5343
5452
|
"'config not set'"
|
|
5344
5453
|
]
|
|
5345
5454
|
});
|
|
5346
|
-
(0,
|
|
5455
|
+
(0, import_invariant15.invariant)(this._storage, "storage not set", {
|
|
5347
5456
|
F: __dxlog_file18,
|
|
5348
|
-
L:
|
|
5457
|
+
L: 241,
|
|
5349
5458
|
S: this,
|
|
5350
5459
|
A: [
|
|
5351
5460
|
"this._storage",
|
|
5352
5461
|
"'storage not set'"
|
|
5353
5462
|
]
|
|
5354
5463
|
});
|
|
5355
|
-
(0,
|
|
5464
|
+
(0, import_invariant15.invariant)(this._signalManager, "signal manager not set", {
|
|
5356
5465
|
F: __dxlog_file18,
|
|
5357
|
-
L:
|
|
5466
|
+
L: 242,
|
|
5358
5467
|
S: this,
|
|
5359
5468
|
A: [
|
|
5360
5469
|
"this._signalManager",
|
|
5361
5470
|
"'signal manager not set'"
|
|
5362
5471
|
]
|
|
5363
5472
|
});
|
|
5364
|
-
(0,
|
|
5473
|
+
(0, import_invariant15.invariant)(this._networkManager, "network manager not set", {
|
|
5365
5474
|
F: __dxlog_file18,
|
|
5366
|
-
L:
|
|
5475
|
+
L: 243,
|
|
5367
5476
|
S: this,
|
|
5368
5477
|
A: [
|
|
5369
5478
|
"this._networkManager",
|
|
@@ -5371,17 +5480,21 @@ var ClientServicesHost = class {
|
|
|
5371
5480
|
]
|
|
5372
5481
|
});
|
|
5373
5482
|
this._opening = true;
|
|
5374
|
-
(0,
|
|
5483
|
+
(0, import_log13.log)("opening...", {
|
|
5375
5484
|
lockKey: this._resourceLock?.lockKey
|
|
5376
5485
|
}, {
|
|
5377
5486
|
F: __dxlog_file18,
|
|
5378
|
-
L:
|
|
5487
|
+
L: 246,
|
|
5379
5488
|
S: this,
|
|
5380
5489
|
C: (f, a) => f(...a)
|
|
5381
5490
|
});
|
|
5491
|
+
if (!this._level) {
|
|
5492
|
+
this._level = await createLevel(this._config.get("runtime.client.storage", {}));
|
|
5493
|
+
}
|
|
5494
|
+
await this._level.open();
|
|
5382
5495
|
await this._resourceLock?.acquire();
|
|
5383
5496
|
await this._loggingService.open();
|
|
5384
|
-
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5497
|
+
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
5385
5498
|
this._serviceRegistry.setServices({
|
|
5386
5499
|
SystemService: this._systemService,
|
|
5387
5500
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
@@ -5391,7 +5504,7 @@ var ClientServicesHost = class {
|
|
|
5391
5504
|
await this._serviceContext.initialized.wait();
|
|
5392
5505
|
return this._serviceContext.dataSpaceManager;
|
|
5393
5506
|
}),
|
|
5394
|
-
DataService: new
|
|
5507
|
+
DataService: new import_echo_pipeline5.DataServiceImpl(this._serviceContext.automergeHost),
|
|
5395
5508
|
IndexService: new import_indexing2.IndexServiceImpl({
|
|
5396
5509
|
indexer: this._serviceContext.indexer,
|
|
5397
5510
|
automergeHost: this._serviceContext.automergeHost
|
|
@@ -5407,9 +5520,9 @@ var ClientServicesHost = class {
|
|
|
5407
5520
|
})
|
|
5408
5521
|
});
|
|
5409
5522
|
await this._serviceContext.open(ctx);
|
|
5410
|
-
(0,
|
|
5523
|
+
(0, import_invariant15.invariant)(this.serviceRegistry.services.InvitationsService, void 0, {
|
|
5411
5524
|
F: __dxlog_file18,
|
|
5412
|
-
L:
|
|
5525
|
+
L: 314,
|
|
5413
5526
|
S: this,
|
|
5414
5527
|
A: [
|
|
5415
5528
|
"this.serviceRegistry.services.InvitationsService",
|
|
@@ -5417,11 +5530,11 @@ var ClientServicesHost = class {
|
|
|
5417
5530
|
]
|
|
5418
5531
|
});
|
|
5419
5532
|
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
5420
|
-
(0,
|
|
5533
|
+
(0, import_log13.log)("loaded persistent invitations", {
|
|
5421
5534
|
count: loadedInvitations.invitations?.length
|
|
5422
5535
|
}, {
|
|
5423
5536
|
F: __dxlog_file18,
|
|
5424
|
-
L:
|
|
5537
|
+
L: 317,
|
|
5425
5538
|
S: this,
|
|
5426
5539
|
C: (f, a) => f(...a)
|
|
5427
5540
|
});
|
|
@@ -5430,28 +5543,29 @@ var ClientServicesHost = class {
|
|
|
5430
5543
|
this._devtoolsProxy = new import_websocket_rpc.WebsocketRpcClient({
|
|
5431
5544
|
url: devtoolsProxy,
|
|
5432
5545
|
requested: {},
|
|
5433
|
-
exposed:
|
|
5546
|
+
exposed: import_client_protocol4.clientServiceBundle,
|
|
5434
5547
|
handlers: this.services
|
|
5435
5548
|
});
|
|
5436
5549
|
void this._devtoolsProxy.open();
|
|
5437
5550
|
}
|
|
5551
|
+
this.diagnosticsBroadcastHandler.start();
|
|
5438
5552
|
this._opening = false;
|
|
5439
5553
|
this._open = true;
|
|
5440
5554
|
this._statusUpdate.emit();
|
|
5441
5555
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
5442
|
-
(0,
|
|
5556
|
+
(0, import_log13.log)("opened", {
|
|
5443
5557
|
deviceKey
|
|
5444
5558
|
}, {
|
|
5445
5559
|
F: __dxlog_file18,
|
|
5446
|
-
L:
|
|
5560
|
+
L: 335,
|
|
5447
5561
|
S: this,
|
|
5448
5562
|
C: (f, a) => f(...a)
|
|
5449
5563
|
});
|
|
5450
|
-
|
|
5564
|
+
import_log13.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
5451
5565
|
id: traceId
|
|
5452
5566
|
}), {
|
|
5453
5567
|
F: __dxlog_file18,
|
|
5454
|
-
L:
|
|
5568
|
+
L: 336,
|
|
5455
5569
|
S: this,
|
|
5456
5570
|
C: (f, a) => f(...a)
|
|
5457
5571
|
});
|
|
@@ -5461,60 +5575,62 @@ var ClientServicesHost = class {
|
|
|
5461
5575
|
return;
|
|
5462
5576
|
}
|
|
5463
5577
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
5464
|
-
(0,
|
|
5578
|
+
(0, import_log13.log)("closing...", {
|
|
5465
5579
|
deviceKey
|
|
5466
5580
|
}, {
|
|
5467
5581
|
F: __dxlog_file18,
|
|
5468
|
-
L:
|
|
5582
|
+
L: 347,
|
|
5469
5583
|
S: this,
|
|
5470
5584
|
C: (f, a) => f(...a)
|
|
5471
5585
|
});
|
|
5586
|
+
this.diagnosticsBroadcastHandler.stop();
|
|
5472
5587
|
await this._devtoolsProxy?.close();
|
|
5473
5588
|
this._serviceRegistry.setServices({
|
|
5474
5589
|
SystemService: this._systemService
|
|
5475
5590
|
});
|
|
5476
5591
|
await this._loggingService.close();
|
|
5477
5592
|
await this._serviceContext.close();
|
|
5593
|
+
await this._level?.close();
|
|
5478
5594
|
this._open = false;
|
|
5479
5595
|
this._statusUpdate.emit();
|
|
5480
|
-
(0,
|
|
5596
|
+
(0, import_log13.log)("closed", {
|
|
5481
5597
|
deviceKey
|
|
5482
5598
|
}, {
|
|
5483
5599
|
F: __dxlog_file18,
|
|
5484
|
-
L:
|
|
5600
|
+
L: 356,
|
|
5485
5601
|
S: this,
|
|
5486
5602
|
C: (f, a) => f(...a)
|
|
5487
5603
|
});
|
|
5488
5604
|
}
|
|
5489
5605
|
async reset() {
|
|
5490
5606
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
5491
|
-
|
|
5607
|
+
import_log13.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
5492
5608
|
id: traceId
|
|
5493
5609
|
}), {
|
|
5494
5610
|
F: __dxlog_file18,
|
|
5495
|
-
L:
|
|
5611
|
+
L: 361,
|
|
5496
5612
|
S: this,
|
|
5497
5613
|
C: (f, a) => f(...a)
|
|
5498
5614
|
});
|
|
5499
|
-
(0,
|
|
5615
|
+
(0, import_log13.log)("resetting...", void 0, {
|
|
5500
5616
|
F: __dxlog_file18,
|
|
5501
|
-
L:
|
|
5617
|
+
L: 363,
|
|
5502
5618
|
S: this,
|
|
5503
5619
|
C: (f, a) => f(...a)
|
|
5504
5620
|
});
|
|
5505
5621
|
await this._serviceContext?.close();
|
|
5506
5622
|
await this._storage.reset();
|
|
5507
|
-
(0,
|
|
5623
|
+
(0, import_log13.log)("reset", void 0, {
|
|
5508
5624
|
F: __dxlog_file18,
|
|
5509
|
-
L:
|
|
5625
|
+
L: 366,
|
|
5510
5626
|
S: this,
|
|
5511
5627
|
C: (f, a) => f(...a)
|
|
5512
5628
|
});
|
|
5513
|
-
|
|
5629
|
+
import_log13.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
5514
5630
|
id: traceId
|
|
5515
5631
|
}), {
|
|
5516
5632
|
F: __dxlog_file18,
|
|
5517
|
-
L:
|
|
5633
|
+
L: 367,
|
|
5518
5634
|
S: this,
|
|
5519
5635
|
C: (f, a) => f(...a)
|
|
5520
5636
|
});
|
|
@@ -5524,12 +5640,10 @@ var ClientServicesHost = class {
|
|
|
5524
5640
|
const identity = await this._serviceContext.createIdentity(params);
|
|
5525
5641
|
await this._serviceContext.initialized.wait();
|
|
5526
5642
|
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
5643
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5530
|
-
(0,
|
|
5644
|
+
(0, import_invariant15.invariant)(automergeIndex, void 0, {
|
|
5531
5645
|
F: __dxlog_file18,
|
|
5532
|
-
L:
|
|
5646
|
+
L: 379,
|
|
5533
5647
|
S: this,
|
|
5534
5648
|
A: [
|
|
5535
5649
|
"automergeIndex",
|
|
@@ -5538,41 +5652,88 @@ var ClientServicesHost = class {
|
|
|
5538
5652
|
});
|
|
5539
5653
|
const document = await this._serviceContext.automergeHost.repo.find(automergeIndex);
|
|
5540
5654
|
await document.whenReady();
|
|
5655
|
+
const properties = {
|
|
5656
|
+
system: {
|
|
5657
|
+
type: (0, import_echo_pipeline5.encodeReference)((0, import_echo_schema.getTypeReference)(import_client_protocol4.Properties))
|
|
5658
|
+
},
|
|
5659
|
+
data: {
|
|
5660
|
+
[import_client_protocol4.defaultKey]: identity.identityKey.toHex()
|
|
5661
|
+
},
|
|
5662
|
+
meta: {
|
|
5663
|
+
keys: []
|
|
5664
|
+
}
|
|
5665
|
+
};
|
|
5666
|
+
const propertiesId = import_keys11.PublicKey.random().toHex();
|
|
5541
5667
|
document.change((doc) => {
|
|
5542
5668
|
(0, import_util9.assignDeep)(doc, [
|
|
5543
5669
|
"objects",
|
|
5544
|
-
|
|
5545
|
-
],
|
|
5670
|
+
propertiesId
|
|
5671
|
+
], properties);
|
|
5546
5672
|
});
|
|
5673
|
+
await this._serviceContext.automergeHost.repo.flush();
|
|
5547
5674
|
return identity;
|
|
5548
5675
|
}
|
|
5549
5676
|
};
|
|
5550
5677
|
_ts_decorate8([
|
|
5551
|
-
|
|
5678
|
+
import_tracing8.trace.info()
|
|
5552
5679
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
5553
5680
|
_ts_decorate8([
|
|
5554
|
-
|
|
5681
|
+
import_tracing8.trace.info()
|
|
5555
5682
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
5556
5683
|
_ts_decorate8([
|
|
5557
5684
|
import_async16.synchronized,
|
|
5558
|
-
|
|
5685
|
+
import_tracing8.trace.span()
|
|
5559
5686
|
], ClientServicesHost.prototype, "open", null);
|
|
5560
5687
|
_ts_decorate8([
|
|
5561
5688
|
import_async16.synchronized,
|
|
5562
|
-
|
|
5689
|
+
import_tracing8.trace.span()
|
|
5563
5690
|
], ClientServicesHost.prototype, "close", null);
|
|
5564
5691
|
ClientServicesHost = _ts_decorate8([
|
|
5565
|
-
|
|
5692
|
+
import_tracing8.trace.resource()
|
|
5566
5693
|
], ClientServicesHost);
|
|
5694
|
+
var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
|
|
5695
|
+
var DiagnosticsCollector = class {
|
|
5696
|
+
static {
|
|
5697
|
+
this.broadcastSender = createCollectDiagnosticsBroadcastSender();
|
|
5698
|
+
}
|
|
5699
|
+
static async collect(config = findConfigs(), services = findSystemServiceProvider(), options = {}) {
|
|
5700
|
+
const serviceDiagnostics = await services?.services?.SystemService?.getDiagnostics({
|
|
5701
|
+
keys: options.humanize ? import_services13.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE : options.truncate ? import_services13.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE : void 0
|
|
5702
|
+
});
|
|
5703
|
+
const clientDiagnostics = {
|
|
5704
|
+
config,
|
|
5705
|
+
trace: import_tracing7.TRACE_PROCESSOR.getDiagnostics()
|
|
5706
|
+
};
|
|
5707
|
+
const diagnostics = serviceDiagnostics != null ? {
|
|
5708
|
+
client: clientDiagnostics,
|
|
5709
|
+
services: serviceDiagnostics
|
|
5710
|
+
} : {
|
|
5711
|
+
client: clientDiagnostics,
|
|
5712
|
+
broadcast: await this.broadcastSender.broadcastDiagnosticsRequest()
|
|
5713
|
+
};
|
|
5714
|
+
return JSON.parse(JSON.stringify(diagnostics, (0, import_util8.jsonKeyReplacer)(options)));
|
|
5715
|
+
}
|
|
5716
|
+
};
|
|
5717
|
+
var findSystemServiceProvider = () => {
|
|
5718
|
+
const serviceProviders = import_tracing7.TRACE_PROCESSOR.findByAnnotation(ClientServicesProviderResource);
|
|
5719
|
+
const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
|
|
5720
|
+
return providerResource?.instance?.deref() ?? null;
|
|
5721
|
+
};
|
|
5722
|
+
var findConfigs = () => {
|
|
5723
|
+
const configs = import_tracing7.TRACE_PROCESSOR.findByAnnotation(import_config.ConfigResource);
|
|
5724
|
+
return configs.map((r) => r.instance.deref()).filter(import_util8.nonNullable);
|
|
5725
|
+
};
|
|
5567
5726
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5568
5727
|
0 && (module.exports = {
|
|
5569
5728
|
ClientRpcServer,
|
|
5570
5729
|
ClientServicesHost,
|
|
5730
|
+
ClientServicesProviderResource,
|
|
5571
5731
|
DataSpace,
|
|
5572
5732
|
DataSpaceManager,
|
|
5573
5733
|
DeviceInvitationProtocol,
|
|
5574
5734
|
DevtoolsHostEvents,
|
|
5575
5735
|
DevtoolsServiceImpl,
|
|
5736
|
+
DiagnosticsCollector,
|
|
5576
5737
|
Identity,
|
|
5577
5738
|
IdentityManager,
|
|
5578
5739
|
IdentityServiceImpl,
|
|
@@ -5584,11 +5745,14 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5584
5745
|
SpaceInvitationProtocol,
|
|
5585
5746
|
SpacesServiceImpl,
|
|
5586
5747
|
TrustedKeySetAuthVerifier,
|
|
5748
|
+
createAdmissionKeypair,
|
|
5587
5749
|
createAuthProvider,
|
|
5750
|
+
createCollectDiagnosticsBroadcastHandler,
|
|
5751
|
+
createCollectDiagnosticsBroadcastSender,
|
|
5588
5752
|
createDiagnostics,
|
|
5753
|
+
createLevel,
|
|
5589
5754
|
createStorageObjects,
|
|
5590
5755
|
getNetworkPeers,
|
|
5591
|
-
invitationExpired,
|
|
5592
5756
|
isLocked,
|
|
5593
5757
|
subscribeToFeedBlocks,
|
|
5594
5758
|
subscribeToFeeds,
|
|
@@ -5598,4 +5762,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5598
5762
|
subscribeToSpaces,
|
|
5599
5763
|
subscribeToSwarmInfo
|
|
5600
5764
|
});
|
|
5601
|
-
//# sourceMappingURL=chunk-
|
|
5765
|
+
//# sourceMappingURL=chunk-55TN3KPR.cjs.map
|