@dxos/client-services 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b
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-27A4ATQX.mjs → chunk-O46EJ5BJ.mjs} +172 -123
- package/dist/lib/browser/chunk-O46EJ5BJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-7FKXMJDD.cjs → chunk-WFDMSV4I.cjs} +202 -153
- package/dist/lib/node/chunk-WFDMSV4I.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-HGN7FHFK.mjs → chunk-UWR5XM7L.mjs} +172 -123
- package/dist/lib/node-esm/chunk-UWR5XM7L.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts +1 -0
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +9 -2
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +3 -0
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- 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/version.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -38
- package/src/packlets/agents/edge-agent-service.ts +1 -1
- package/src/packlets/devices/devices-service.ts +1 -1
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/devtools/feeds.ts +1 -1
- package/src/packlets/devtools/keys.ts +1 -1
- package/src/packlets/devtools/metadata.ts +1 -1
- package/src/packlets/devtools/network.ts +1 -1
- package/src/packlets/devtools/spaces.ts +1 -1
- package/src/packlets/identity/contacts-service.ts +1 -1
- package/src/packlets/identity/identity-service.ts +1 -1
- package/src/packlets/invitations/invitations-handler.ts +15 -6
- package/src/packlets/invitations/invitations-manager.ts +1 -1
- package/src/packlets/invitations/invitations-service.ts +1 -1
- package/src/packlets/invitations/space-invitation-protocol.ts +2 -3
- package/src/packlets/invitations/utils.ts +7 -0
- package/src/packlets/logging/logging-service.ts +1 -1
- package/src/packlets/network/network-service.ts +39 -1
- package/src/packlets/services/service-context.ts +1 -0
- package/src/packlets/spaces/data-space-manager.ts +1 -1
- package/src/packlets/spaces/notarization-plugin.ts +32 -17
- package/src/packlets/spaces/spaces-service.ts +1 -1
- package/src/packlets/system/system-service.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-27A4ATQX.mjs.map +0 -7
- package/dist/lib/node/chunk-7FKXMJDD.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-HGN7FHFK.mjs.map +0 -7
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_WFDMSV4I_exports = {};
|
|
30
|
+
__export(chunk_WFDMSV4I_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -72,24 +72,24 @@ __export(chunk_7FKXMJDD_exports, {
|
|
|
72
72
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
73
73
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
74
74
|
});
|
|
75
|
-
module.exports = __toCommonJS(
|
|
75
|
+
module.exports = __toCommonJS(chunk_WFDMSV4I_exports);
|
|
76
76
|
var import_async = require("@dxos/async");
|
|
77
|
-
var
|
|
77
|
+
var import_stream = require("@dxos/codec-protobuf/stream");
|
|
78
78
|
var import_feed_store = require("@dxos/feed-store");
|
|
79
79
|
var import_keys = require("@dxos/keys");
|
|
80
80
|
var import_log = require("@dxos/log");
|
|
81
81
|
var import_util = require("@dxos/util");
|
|
82
|
-
var
|
|
82
|
+
var import_stream2 = require("@dxos/codec-protobuf/stream");
|
|
83
83
|
var import_context = require("@dxos/context");
|
|
84
84
|
var import_keys2 = require("@dxos/keys");
|
|
85
|
-
var
|
|
85
|
+
var import_stream3 = require("@dxos/codec-protobuf/stream");
|
|
86
86
|
var import_async2 = require("@dxos/async");
|
|
87
|
-
var
|
|
87
|
+
var import_stream4 = require("@dxos/codec-protobuf/stream");
|
|
88
88
|
var import_async3 = require("@dxos/async");
|
|
89
|
-
var
|
|
90
|
-
var
|
|
89
|
+
var import_stream5 = require("@dxos/codec-protobuf/stream");
|
|
90
|
+
var import_stream6 = require("@dxos/codec-protobuf/stream");
|
|
91
91
|
var import_async4 = require("@dxos/async");
|
|
92
|
-
var
|
|
92
|
+
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
93
93
|
var import_credentials = require("@dxos/credentials");
|
|
94
94
|
var import_invariant = require("@dxos/invariant");
|
|
95
95
|
var import_protocols = require("@dxos/protocols");
|
|
@@ -184,7 +184,7 @@ var import_debug2 = require("@dxos/debug");
|
|
|
184
184
|
var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
185
185
|
var import_timeframe3 = require("@dxos/timeframe");
|
|
186
186
|
var import_async12 = require("@dxos/async");
|
|
187
|
-
var
|
|
187
|
+
var import_stream7 = require("@dxos/codec-protobuf/stream");
|
|
188
188
|
var import_credentials13 = require("@dxos/credentials");
|
|
189
189
|
var import_debug3 = require("@dxos/debug");
|
|
190
190
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
@@ -208,7 +208,7 @@ var import_timeframe4 = require("@dxos/timeframe");
|
|
|
208
208
|
var import_tracing7 = require("@dxos/tracing");
|
|
209
209
|
var import_util8 = require("@dxos/util");
|
|
210
210
|
var import_async14 = require("@dxos/async");
|
|
211
|
-
var
|
|
211
|
+
var import_stream8 = require("@dxos/codec-protobuf/stream");
|
|
212
212
|
var import_context9 = require("@dxos/context");
|
|
213
213
|
var import_credentials16 = require("@dxos/credentials");
|
|
214
214
|
var import_invariant10 = require("@dxos/invariant");
|
|
@@ -270,7 +270,7 @@ var import_keys13 = require("@dxos/keys");
|
|
|
270
270
|
var import_log17 = require("@dxos/log");
|
|
271
271
|
var import_invitations5 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
272
272
|
var import_util11 = require("@dxos/util");
|
|
273
|
-
var
|
|
273
|
+
var import_stream9 = require("@dxos/codec-protobuf/stream");
|
|
274
274
|
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
275
275
|
var import_tracing9 = require("@dxos/tracing");
|
|
276
276
|
var import_credentials18 = require("@dxos/credentials");
|
|
@@ -293,7 +293,7 @@ var import_credentials21 = require("@dxos/protocols/proto/dxos/halo/credentials"
|
|
|
293
293
|
var import_invariant19 = require("@dxos/invariant");
|
|
294
294
|
var import_lock_file = require("@dxos/lock-file");
|
|
295
295
|
var import_log20 = require("@dxos/log");
|
|
296
|
-
var
|
|
296
|
+
var import_codec_protobuf2 = require("@dxos/codec-protobuf");
|
|
297
297
|
var import_debug4 = require("@dxos/debug");
|
|
298
298
|
var import_rpc = require("@dxos/rpc");
|
|
299
299
|
var import_tracing10 = require("@dxos/tracing");
|
|
@@ -305,7 +305,7 @@ var import_log21 = require("@dxos/log");
|
|
|
305
305
|
var import_protocols14 = require("@dxos/protocols");
|
|
306
306
|
var import_services19 = require("@dxos/protocols/proto/dxos/client/services");
|
|
307
307
|
var import_metadata2 = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
308
|
-
var
|
|
308
|
+
var import_stream10 = require("@dxos/codec-protobuf/stream");
|
|
309
309
|
var import_protocols15 = require("@dxos/protocols");
|
|
310
310
|
var import_services20 = require("@dxos/protocols/proto/dxos/client/services");
|
|
311
311
|
var import_async22 = require("@dxos/async");
|
|
@@ -360,26 +360,26 @@ var import_services22 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
360
360
|
var import_tracing12 = require("@dxos/tracing");
|
|
361
361
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
362
362
|
var import_async24 = require("@dxos/async");
|
|
363
|
-
var
|
|
363
|
+
var import_stream11 = require("@dxos/codec-protobuf/stream");
|
|
364
364
|
var import_invariant25 = require("@dxos/invariant");
|
|
365
365
|
var import_services23 = require("@dxos/protocols/proto/dxos/client/services");
|
|
366
366
|
var import_async25 = require("@dxos/async");
|
|
367
|
-
var
|
|
367
|
+
var import_stream12 = require("@dxos/codec-protobuf/stream");
|
|
368
368
|
var import_keys20 = require("@dxos/keys");
|
|
369
369
|
var import_util15 = require("@dxos/util");
|
|
370
370
|
var import_async26 = require("@dxos/async");
|
|
371
|
-
var
|
|
371
|
+
var import_stream13 = require("@dxos/codec-protobuf/stream");
|
|
372
372
|
var import_keys21 = require("@dxos/keys");
|
|
373
373
|
var import_log26 = require("@dxos/log");
|
|
374
374
|
var import_services24 = require("@dxos/protocols/proto/dxos/client/services");
|
|
375
375
|
var import_util16 = require("@dxos/util");
|
|
376
|
-
var
|
|
377
|
-
var
|
|
376
|
+
var import_stream14 = require("@dxos/codec-protobuf/stream");
|
|
377
|
+
var import_stream15 = require("@dxos/codec-protobuf/stream");
|
|
378
378
|
var import_services25 = require("@dxos/protocols/proto/dxos/client/services");
|
|
379
379
|
var import_util17 = require("@dxos/util");
|
|
380
380
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
|
|
381
381
|
var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
|
|
382
|
-
return new
|
|
382
|
+
return new import_stream.Stream(({ next }) => {
|
|
383
383
|
const subscriptions = new import_async.EventSubscriptions();
|
|
384
384
|
const feedMap = new import_util.ComplexMap(import_keys.PublicKey.hash);
|
|
385
385
|
const update = () => {
|
|
@@ -438,7 +438,7 @@ var findFeedOwner = (spaceManager, feedKey) => {
|
|
|
438
438
|
};
|
|
439
439
|
};
|
|
440
440
|
var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
441
|
-
return new
|
|
441
|
+
return new import_stream.Stream(({ next }) => {
|
|
442
442
|
if (!feedKey) {
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
@@ -482,7 +482,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
482
482
|
});
|
|
483
483
|
};
|
|
484
484
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
485
|
-
var subscribeToNetworkStatus = ({ signalManager }) => new
|
|
485
|
+
var subscribeToNetworkStatus = ({ signalManager }) => new import_stream2.Stream(({ next, close }) => {
|
|
486
486
|
const update = () => {
|
|
487
487
|
try {
|
|
488
488
|
const status = signalManager.getStatus?.();
|
|
@@ -496,7 +496,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => new import_codec_protobuf2
|
|
|
496
496
|
signalManager.statusChanged?.on(() => update());
|
|
497
497
|
update();
|
|
498
498
|
});
|
|
499
|
-
var subscribeToSignal = ({ signalManager }) => new
|
|
499
|
+
var subscribeToSignal = ({ signalManager }) => new import_stream2.Stream(({ next }) => {
|
|
500
500
|
const ctx = new import_context.Context(void 0, {
|
|
501
501
|
F: __dxlog_file2,
|
|
502
502
|
L: 36
|
|
@@ -531,7 +531,7 @@ var subscribeToSignal = ({ signalManager }) => new import_codec_protobuf2.Stream
|
|
|
531
531
|
return ctx.dispose();
|
|
532
532
|
};
|
|
533
533
|
});
|
|
534
|
-
var subscribeToNetworkTopics = ({ networkManager }) => new
|
|
534
|
+
var subscribeToNetworkTopics = ({ networkManager }) => new import_stream2.Stream(({ next, close }) => {
|
|
535
535
|
const update = () => {
|
|
536
536
|
try {
|
|
537
537
|
const topics = networkManager.topics;
|
|
@@ -549,7 +549,7 @@ var subscribeToNetworkTopics = ({ networkManager }) => new import_codec_protobuf
|
|
|
549
549
|
networkManager.topicsUpdated.on(update);
|
|
550
550
|
update();
|
|
551
551
|
});
|
|
552
|
-
var subscribeToSwarmInfo = ({ networkManager }) => new
|
|
552
|
+
var subscribeToSwarmInfo = ({ networkManager }) => new import_stream2.Stream(({ next }) => {
|
|
553
553
|
const update = () => {
|
|
554
554
|
const info = networkManager.connectionLog?.swarms;
|
|
555
555
|
if (info) {
|
|
@@ -574,7 +574,7 @@ var getNetworkPeers = ({ networkManager }, request) => {
|
|
|
574
574
|
};
|
|
575
575
|
};
|
|
576
576
|
var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
577
|
-
return new
|
|
577
|
+
return new import_stream3.Stream(({ next }) => {
|
|
578
578
|
let unsubscribe;
|
|
579
579
|
const update = async () => {
|
|
580
580
|
const spaces = [
|
|
@@ -606,7 +606,7 @@ var subscribeToSpaces = (context, { spaceKeys = [] }) => {
|
|
|
606
606
|
};
|
|
607
607
|
});
|
|
608
608
|
};
|
|
609
|
-
var subscribeToKeyringKeys = ({ keyring }) => new
|
|
609
|
+
var subscribeToKeyringKeys = ({ keyring }) => new import_stream5.Stream(({ next, ctx }) => {
|
|
610
610
|
const update = async () => {
|
|
611
611
|
next({
|
|
612
612
|
keys: await keyring.list()
|
|
@@ -615,7 +615,7 @@ var subscribeToKeyringKeys = ({ keyring }) => new import_codec_protobuf5.Stream(
|
|
|
615
615
|
keyring.keysUpdate.on(ctx, update);
|
|
616
616
|
(0, import_async3.scheduleTask)(ctx, update);
|
|
617
617
|
});
|
|
618
|
-
var subscribeToMetadata = ({ context }) => new
|
|
618
|
+
var subscribeToMetadata = ({ context }) => new import_stream6.Stream(({ next, ctx }) => {
|
|
619
619
|
context.metadataStore.update.on(ctx, (data) => next({
|
|
620
620
|
metadata: data
|
|
621
621
|
}));
|
|
@@ -633,7 +633,7 @@ var DevtoolsServiceImpl = class {
|
|
|
633
633
|
this.params = params;
|
|
634
634
|
}
|
|
635
635
|
events(request) {
|
|
636
|
-
return new
|
|
636
|
+
return new import_stream4.Stream(({ next }) => {
|
|
637
637
|
this.params.events.ready.on(() => {
|
|
638
638
|
next({
|
|
639
639
|
ready: {}
|
|
@@ -735,7 +735,7 @@ var DevtoolsServiceImpl = class {
|
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
var DXOS_VERSION = "0.7.5-main.
|
|
738
|
+
var DXOS_VERSION = "0.7.5-main.e9bb01b";
|
|
739
739
|
var getPlatform = () => {
|
|
740
740
|
if (process.browser) {
|
|
741
741
|
if (typeof window !== "undefined") {
|
|
@@ -788,7 +788,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
788
788
|
"'SystemService is not available.'"
|
|
789
789
|
]
|
|
790
790
|
});
|
|
791
|
-
diagnostics.metrics = await (0,
|
|
791
|
+
diagnostics.metrics = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.LoggingService.queryMetrics({}), {
|
|
792
792
|
timeout: DEFAULT_TIMEOUT
|
|
793
793
|
}).catch(() => void 0);
|
|
794
794
|
})(),
|
|
@@ -803,14 +803,14 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
803
803
|
spaceKey: identity.space.key,
|
|
804
804
|
profile: identity.profileDocument
|
|
805
805
|
};
|
|
806
|
-
const { devices } = await (0,
|
|
806
|
+
const { devices } = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.DevicesService.queryDevices(), {
|
|
807
807
|
timeout: DEFAULT_TIMEOUT
|
|
808
808
|
}).catch(() => void 0) ?? {};
|
|
809
809
|
diagnostics.devices = devices;
|
|
810
810
|
if (serviceContext.dataSpaceManager) {
|
|
811
811
|
diagnostics.spaces = await Promise.all(Array.from(serviceContext.dataSpaceManager.spaces.values()).map((space) => getSpaceStats(space)) ?? []);
|
|
812
812
|
}
|
|
813
|
-
const { feeds = [] } = await (0,
|
|
813
|
+
const { feeds = [] } = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.DevtoolsHost.subscribeToFeeds({}), {
|
|
814
814
|
timeout: DEFAULT_TIMEOUT
|
|
815
815
|
}).catch(() => void 0) ?? {};
|
|
816
816
|
diagnostics.feeds = feeds.map(({ feedKey, bytes, length }) => ({
|
|
@@ -818,7 +818,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
818
818
|
bytes,
|
|
819
819
|
length
|
|
820
820
|
}));
|
|
821
|
-
const status = await (0,
|
|
821
|
+
const status = await (0, import_codec_protobuf.getFirstStreamValue)(clientServices.NetworkService.queryStatus(), {
|
|
822
822
|
timeout: DEFAULT_TIMEOUT
|
|
823
823
|
}).catch(() => void 0);
|
|
824
824
|
diagnostics.networkStatus = status;
|
|
@@ -1633,6 +1633,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1633
1633
|
this._processedCredentials = new import_util5.ComplexSet(import_keys5.PublicKey.hash);
|
|
1634
1634
|
this._processCredentialsTriggers = new import_util5.ComplexMap(import_keys5.PublicKey.hash);
|
|
1635
1635
|
this._activeEdgePollingIntervalHandle = void 0;
|
|
1636
|
+
this._activeEdgePollingEnabled = false;
|
|
1636
1637
|
this._spaceId = params.spaceId;
|
|
1637
1638
|
this._activeEdgePollingInterval = params.activeEdgePollingInterval ?? DEFAULT_ACTIVE_EDGE_POLLING_INTERVAL;
|
|
1638
1639
|
if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
|
|
@@ -1640,15 +1641,6 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1640
1641
|
}
|
|
1641
1642
|
}
|
|
1642
1643
|
setActiveEdgePollingEnabled(enabled) {
|
|
1643
|
-
(0, import_invariant5.invariant)(this.isOpen, void 0, {
|
|
1644
|
-
F: __dxlog_file7,
|
|
1645
|
-
L: 109,
|
|
1646
|
-
S: this,
|
|
1647
|
-
A: [
|
|
1648
|
-
"this.isOpen",
|
|
1649
|
-
""
|
|
1650
|
-
]
|
|
1651
|
-
});
|
|
1652
1644
|
const client = this._edgeClient;
|
|
1653
1645
|
(0, import_invariant5.invariant)(client, void 0, {
|
|
1654
1646
|
F: __dxlog_file7,
|
|
@@ -1659,30 +1651,30 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1659
1651
|
""
|
|
1660
1652
|
]
|
|
1661
1653
|
});
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1670
|
-
this._activeEdgePollingIntervalHandle = void 0;
|
|
1654
|
+
this._activeEdgePollingEnabled = enabled;
|
|
1655
|
+
if (this.isOpen) {
|
|
1656
|
+
if (enabled && !this._activeEdgePollingIntervalHandle) {
|
|
1657
|
+
this._startPeriodicEdgePolling(client);
|
|
1658
|
+
} else if (!enabled && this._activeEdgePollingIntervalHandle) {
|
|
1659
|
+
this._stopPeriodicEdgePolling();
|
|
1660
|
+
}
|
|
1671
1661
|
}
|
|
1672
1662
|
}
|
|
1673
1663
|
get hasWriter() {
|
|
1674
1664
|
return !!this._writer;
|
|
1675
1665
|
}
|
|
1676
1666
|
async _open() {
|
|
1677
|
-
if (this._edgeClient
|
|
1678
|
-
|
|
1667
|
+
if (this._edgeClient) {
|
|
1668
|
+
if (this._activeEdgePollingEnabled) {
|
|
1669
|
+
this._startPeriodicEdgePolling(this._edgeClient);
|
|
1670
|
+
}
|
|
1671
|
+
if (this._writer) {
|
|
1672
|
+
this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
|
|
1673
|
+
}
|
|
1679
1674
|
}
|
|
1680
1675
|
}
|
|
1681
1676
|
async _close() {
|
|
1682
|
-
|
|
1683
|
-
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1684
|
-
this._activeEdgePollingIntervalHandle = void 0;
|
|
1685
|
-
}
|
|
1677
|
+
this._stopPeriodicEdgePolling();
|
|
1686
1678
|
await this._ctx.dispose();
|
|
1687
1679
|
}
|
|
1688
1680
|
/**
|
|
@@ -1860,10 +1852,23 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1860
1852
|
]
|
|
1861
1853
|
});
|
|
1862
1854
|
this._writer = writer;
|
|
1863
|
-
if (this._edgeClient) {
|
|
1855
|
+
if (this._edgeClient && this.isOpen) {
|
|
1864
1856
|
this._notarizePendingEdgeCredentials(this._edgeClient, writer);
|
|
1865
1857
|
}
|
|
1866
1858
|
}
|
|
1859
|
+
_startPeriodicEdgePolling(client) {
|
|
1860
|
+
this._activeEdgePollingIntervalHandle = setInterval(() => {
|
|
1861
|
+
if (this._writer) {
|
|
1862
|
+
this._notarizePendingEdgeCredentials(client, this._writer);
|
|
1863
|
+
}
|
|
1864
|
+
}, this._activeEdgePollingInterval);
|
|
1865
|
+
}
|
|
1866
|
+
_stopPeriodicEdgePolling() {
|
|
1867
|
+
if (this._activeEdgePollingIntervalHandle) {
|
|
1868
|
+
clearInterval(this._activeEdgePollingIntervalHandle);
|
|
1869
|
+
this._activeEdgePollingIntervalHandle = void 0;
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1867
1872
|
/**
|
|
1868
1873
|
* The method is used only for adding agent feeds to spaces.
|
|
1869
1874
|
* When an agent is created we can admit them into all the existing spaces. In case the operation fails
|
|
@@ -1882,7 +1887,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1882
1887
|
if (!credentials.length) {
|
|
1883
1888
|
(0, import_log5.log)("edge did not return credentials for notarization", void 0, {
|
|
1884
1889
|
F: __dxlog_file7,
|
|
1885
|
-
L:
|
|
1890
|
+
L: 311,
|
|
1886
1891
|
S: this,
|
|
1887
1892
|
C: (f, a) => f(...a)
|
|
1888
1893
|
});
|
|
@@ -1892,7 +1897,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1892
1897
|
count: credentials.length
|
|
1893
1898
|
}, {
|
|
1894
1899
|
F: __dxlog_file7,
|
|
1895
|
-
L:
|
|
1900
|
+
L: 315,
|
|
1896
1901
|
S: this,
|
|
1897
1902
|
C: (f, a) => f(...a)
|
|
1898
1903
|
});
|
|
@@ -1905,7 +1910,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1905
1910
|
count: decodedCredentials.length
|
|
1906
1911
|
}, {
|
|
1907
1912
|
F: __dxlog_file7,
|
|
1908
|
-
L:
|
|
1913
|
+
L: 324,
|
|
1909
1914
|
S: this,
|
|
1910
1915
|
C: (f, a) => f(...a)
|
|
1911
1916
|
});
|
|
@@ -1933,7 +1938,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1933
1938
|
for (const credential of credentials) {
|
|
1934
1939
|
(0, import_invariant5.invariant)(credential.id, "Credential must have an id", {
|
|
1935
1940
|
F: __dxlog_file7,
|
|
1936
|
-
L:
|
|
1941
|
+
L: 350,
|
|
1937
1942
|
S: this,
|
|
1938
1943
|
A: [
|
|
1939
1944
|
"credential.id",
|
|
@@ -1957,7 +1962,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1957
1962
|
peer: extension.localPeerId
|
|
1958
1963
|
}, {
|
|
1959
1964
|
F: __dxlog_file7,
|
|
1960
|
-
L:
|
|
1965
|
+
L: 365,
|
|
1961
1966
|
S: this,
|
|
1962
1967
|
C: (f, a) => f(...a)
|
|
1963
1968
|
});
|
|
@@ -1969,7 +1974,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1969
1974
|
peer: extension.localPeerId
|
|
1970
1975
|
}, {
|
|
1971
1976
|
F: __dxlog_file7,
|
|
1972
|
-
L:
|
|
1977
|
+
L: 370,
|
|
1973
1978
|
S: this,
|
|
1974
1979
|
C: (f, a) => f(...a)
|
|
1975
1980
|
});
|
|
@@ -1986,7 +1991,7 @@ var NotarizationPlugin = class extends import_context6.Resource {
|
|
|
1986
1991
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1987
1992
|
}, {
|
|
1988
1993
|
F: __dxlog_file7,
|
|
1989
|
-
L:
|
|
1994
|
+
L: 382,
|
|
1990
1995
|
S: this,
|
|
1991
1996
|
C: (f, a) => f(...a)
|
|
1992
1997
|
});
|
|
@@ -2002,7 +2007,7 @@ var handleEdgeError = (error) => {
|
|
|
2002
2007
|
if (!(error instanceof import_protocols4.EdgeCallFailedError) || error.errorData) {
|
|
2003
2008
|
import_log5.log.catch(error, void 0, {
|
|
2004
2009
|
F: __dxlog_file7,
|
|
2005
|
-
L:
|
|
2010
|
+
L: 396,
|
|
2006
2011
|
S: void 0,
|
|
2007
2012
|
C: (f, a) => f(...a)
|
|
2008
2013
|
});
|
|
@@ -2011,7 +2016,7 @@ var handleEdgeError = (error) => {
|
|
|
2011
2016
|
reason: error.reason
|
|
2012
2017
|
}, {
|
|
2013
2018
|
F: __dxlog_file7,
|
|
2014
|
-
L:
|
|
2019
|
+
L: 398,
|
|
2015
2020
|
S: void 0,
|
|
2016
2021
|
C: (f, a) => f(...a)
|
|
2017
2022
|
});
|
|
@@ -2779,7 +2784,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2779
2784
|
guestKeypair: invitation.guestKey ? {
|
|
2780
2785
|
publicKey: invitation.guestKey
|
|
2781
2786
|
} : void 0,
|
|
2782
|
-
lifetime: invitation.expiresOn ? invitation.expiresOn.getTime() - Date.now() : void 0,
|
|
2787
|
+
lifetime: invitation.expiresOn ? (invitation.expiresOn.getTime() - Date.now()) / 1e3 : void 0,
|
|
2783
2788
|
multiUse: invitation.multiUse,
|
|
2784
2789
|
delegationCredentialId: credentialId,
|
|
2785
2790
|
persistent: false
|
|
@@ -2871,7 +2876,7 @@ var SpacesServiceImpl = class {
|
|
|
2871
2876
|
await (0, import_feed_store4.writeMessages)(space.controlPipeline.writer, credentials);
|
|
2872
2877
|
}
|
|
2873
2878
|
querySpaces() {
|
|
2874
|
-
return new
|
|
2879
|
+
return new import_stream7.Stream(({ next, ctx }) => {
|
|
2875
2880
|
const scheduler = new import_async12.UpdateScheduler(ctx, async () => {
|
|
2876
2881
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2877
2882
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
@@ -2931,7 +2936,7 @@ var SpacesServiceImpl = class {
|
|
|
2931
2936
|
await space.postMessage(getChannelId(channel), message);
|
|
2932
2937
|
}
|
|
2933
2938
|
subscribeMessages({ spaceKey, channel }) {
|
|
2934
|
-
return new
|
|
2939
|
+
return new import_stream7.Stream(({ ctx, next }) => {
|
|
2935
2940
|
(0, import_async12.scheduleTask)(ctx, async () => {
|
|
2936
2941
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2937
2942
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
@@ -2943,7 +2948,7 @@ var SpacesServiceImpl = class {
|
|
|
2943
2948
|
});
|
|
2944
2949
|
}
|
|
2945
2950
|
queryCredentials({ spaceKey, noTail }) {
|
|
2946
|
-
return new
|
|
2951
|
+
return new import_stream7.Stream(({ ctx, next, close }) => {
|
|
2947
2952
|
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
2948
2953
|
const processor = {
|
|
2949
2954
|
processCredential: async (credential) => {
|
|
@@ -3901,7 +3906,7 @@ var IdentityServiceImpl = class extends import_context9.Resource {
|
|
|
3901
3906
|
await identity.updateDefaultSpace(space.id);
|
|
3902
3907
|
}
|
|
3903
3908
|
queryIdentity() {
|
|
3904
|
-
return new
|
|
3909
|
+
return new import_stream8.Stream(({ next }) => {
|
|
3905
3910
|
const emitNext = () => next({
|
|
3906
3911
|
identity: this._getIdentity()
|
|
3907
3912
|
});
|
|
@@ -4784,6 +4789,12 @@ var DeviceInvitationProtocol = class {
|
|
|
4784
4789
|
var stateToString = (state) => {
|
|
4785
4790
|
return Object.entries(import_services13.Invitation.State).find(([key, val]) => val === state)?.[0] ?? "unknown";
|
|
4786
4791
|
};
|
|
4792
|
+
var computeExpirationTime = (invitation) => {
|
|
4793
|
+
if (!invitation.lifetime) {
|
|
4794
|
+
return;
|
|
4795
|
+
}
|
|
4796
|
+
return new Date((invitation.created?.getTime() ?? Date.now()) + invitation.lifetime * 1e3);
|
|
4797
|
+
};
|
|
4787
4798
|
var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
4788
4799
|
let guard;
|
|
4789
4800
|
return (0, import_context11.cancelWithContext)(ctx, (async () => {
|
|
@@ -5760,18 +5771,19 @@ var InvitationsHandler = class {
|
|
|
5760
5771
|
});
|
|
5761
5772
|
return extension;
|
|
5762
5773
|
};
|
|
5763
|
-
|
|
5764
|
-
|
|
5774
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
5775
|
+
if (expiresOn) {
|
|
5776
|
+
if (expiresOn.getTime() < Date.now()) {
|
|
5765
5777
|
import_log12.log.warn("invitation has already expired", void 0, {
|
|
5766
5778
|
F: __dxlog_file21,
|
|
5767
|
-
L:
|
|
5779
|
+
L: 194,
|
|
5768
5780
|
S: this,
|
|
5769
5781
|
C: (f, a) => f(...a)
|
|
5770
5782
|
});
|
|
5771
5783
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5772
5784
|
void ctx.dispose().catch((err) => import_log12.log.catch(err, void 0, {
|
|
5773
5785
|
F: __dxlog_file21,
|
|
5774
|
-
L:
|
|
5786
|
+
L: 196,
|
|
5775
5787
|
S: this,
|
|
5776
5788
|
C: (f, a) => f(...a)
|
|
5777
5789
|
}));
|
|
@@ -5782,7 +5794,7 @@ var InvitationsHandler = class {
|
|
|
5782
5794
|
guardedState.set(null, import_services11.Invitation.State.EXPIRED);
|
|
5783
5795
|
metrics.increment("dxos.invitation.expired");
|
|
5784
5796
|
await ctx.dispose();
|
|
5785
|
-
},
|
|
5797
|
+
}, expiresOn.getTime() - Date.now());
|
|
5786
5798
|
}
|
|
5787
5799
|
let swarmConnection;
|
|
5788
5800
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
@@ -5798,7 +5810,7 @@ var InvitationsHandler = class {
|
|
|
5798
5810
|
type: invitation.type
|
|
5799
5811
|
}, {
|
|
5800
5812
|
F: __dxlog_file21,
|
|
5801
|
-
L:
|
|
5813
|
+
L: 227,
|
|
5802
5814
|
S: this,
|
|
5803
5815
|
C: (f, a) => f(...a)
|
|
5804
5816
|
});
|
|
@@ -5806,7 +5818,7 @@ var InvitationsHandler = class {
|
|
|
5806
5818
|
if (deviceProfile) {
|
|
5807
5819
|
(0, import_invariant12.invariant)(invitation.kind === import_services11.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5808
5820
|
F: __dxlog_file21,
|
|
5809
|
-
L:
|
|
5821
|
+
L: 236,
|
|
5810
5822
|
S: this,
|
|
5811
5823
|
A: [
|
|
5812
5824
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5824,7 +5836,7 @@ var InvitationsHandler = class {
|
|
|
5824
5836
|
triedPeers: triedPeersIds.size
|
|
5825
5837
|
}, {
|
|
5826
5838
|
F: __dxlog_file21,
|
|
5827
|
-
L:
|
|
5839
|
+
L: 244,
|
|
5828
5840
|
S: this,
|
|
5829
5841
|
C: (f, a) => f(...a)
|
|
5830
5842
|
});
|
|
@@ -5851,7 +5863,7 @@ var InvitationsHandler = class {
|
|
|
5851
5863
|
currentState: guardedState.current.state
|
|
5852
5864
|
}, {
|
|
5853
5865
|
F: __dxlog_file21,
|
|
5854
|
-
L:
|
|
5866
|
+
L: 272,
|
|
5855
5867
|
S: this,
|
|
5856
5868
|
C: (f, a) => f(...a)
|
|
5857
5869
|
});
|
|
@@ -5869,7 +5881,7 @@ var InvitationsHandler = class {
|
|
|
5869
5881
|
id: traceId
|
|
5870
5882
|
}), {
|
|
5871
5883
|
F: __dxlog_file21,
|
|
5872
|
-
L:
|
|
5884
|
+
L: 284,
|
|
5873
5885
|
S: this,
|
|
5874
5886
|
C: (f, a) => f(...a)
|
|
5875
5887
|
});
|
|
@@ -5881,7 +5893,7 @@ var InvitationsHandler = class {
|
|
|
5881
5893
|
...protocol.toJSON()
|
|
5882
5894
|
}, {
|
|
5883
5895
|
F: __dxlog_file21,
|
|
5884
|
-
L:
|
|
5896
|
+
L: 295,
|
|
5885
5897
|
S: this,
|
|
5886
5898
|
C: (f, a) => f(...a)
|
|
5887
5899
|
});
|
|
@@ -5891,7 +5903,7 @@ var InvitationsHandler = class {
|
|
|
5891
5903
|
...protocol.toJSON()
|
|
5892
5904
|
}, {
|
|
5893
5905
|
F: __dxlog_file21,
|
|
5894
|
-
L:
|
|
5906
|
+
L: 299,
|
|
5895
5907
|
S: this,
|
|
5896
5908
|
C: (f, a) => f(...a)
|
|
5897
5909
|
});
|
|
@@ -5905,7 +5917,7 @@ var InvitationsHandler = class {
|
|
|
5905
5917
|
authMethod: introductionResponse.authMethod
|
|
5906
5918
|
}, {
|
|
5907
5919
|
F: __dxlog_file21,
|
|
5908
|
-
L:
|
|
5920
|
+
L: 307,
|
|
5909
5921
|
S: this,
|
|
5910
5922
|
C: (f, a) => f(...a)
|
|
5911
5923
|
});
|
|
@@ -5927,7 +5939,7 @@ var InvitationsHandler = class {
|
|
|
5927
5939
|
...protocol.toJSON()
|
|
5928
5940
|
}, {
|
|
5929
5941
|
F: __dxlog_file21,
|
|
5930
|
-
L:
|
|
5942
|
+
L: 337,
|
|
5931
5943
|
S: this,
|
|
5932
5944
|
C: (f, a) => f(...a)
|
|
5933
5945
|
});
|
|
@@ -5940,7 +5952,7 @@ var InvitationsHandler = class {
|
|
|
5940
5952
|
...protocol.toJSON()
|
|
5941
5953
|
}, {
|
|
5942
5954
|
F: __dxlog_file21,
|
|
5943
|
-
L:
|
|
5955
|
+
L: 351,
|
|
5944
5956
|
S: this,
|
|
5945
5957
|
C: (f, a) => f(...a)
|
|
5946
5958
|
});
|
|
@@ -5953,7 +5965,7 @@ var InvitationsHandler = class {
|
|
|
5953
5965
|
id: traceId
|
|
5954
5966
|
}), {
|
|
5955
5967
|
F: __dxlog_file21,
|
|
5956
|
-
L:
|
|
5968
|
+
L: 360,
|
|
5957
5969
|
S: this,
|
|
5958
5970
|
C: (f, a) => f(...a)
|
|
5959
5971
|
});
|
|
@@ -5963,7 +5975,7 @@ var InvitationsHandler = class {
|
|
|
5963
5975
|
...protocol.toJSON()
|
|
5964
5976
|
}, {
|
|
5965
5977
|
F: __dxlog_file21,
|
|
5966
|
-
L:
|
|
5978
|
+
L: 363,
|
|
5967
5979
|
S: this,
|
|
5968
5980
|
C: (f, a) => f(...a)
|
|
5969
5981
|
});
|
|
@@ -5971,7 +5983,7 @@ var InvitationsHandler = class {
|
|
|
5971
5983
|
} else {
|
|
5972
5984
|
import_log12.log.verbose("auth failed", err, {
|
|
5973
5985
|
F: __dxlog_file21,
|
|
5974
|
-
L:
|
|
5986
|
+
L: 366,
|
|
5975
5987
|
S: this,
|
|
5976
5988
|
C: (f, a) => f(...a)
|
|
5977
5989
|
});
|
|
@@ -5983,7 +5995,7 @@ var InvitationsHandler = class {
|
|
|
5983
5995
|
error: err
|
|
5984
5996
|
}), {
|
|
5985
5997
|
F: __dxlog_file21,
|
|
5986
|
-
L:
|
|
5998
|
+
L: 370,
|
|
5987
5999
|
S: this,
|
|
5988
6000
|
C: (f, a) => f(...a)
|
|
5989
6001
|
});
|
|
@@ -5999,7 +6011,7 @@ var InvitationsHandler = class {
|
|
|
5999
6011
|
...protocol.toJSON()
|
|
6000
6012
|
}, {
|
|
6001
6013
|
F: __dxlog_file21,
|
|
6002
|
-
L:
|
|
6014
|
+
L: 379,
|
|
6003
6015
|
S: this,
|
|
6004
6016
|
C: (f, a) => f(...a)
|
|
6005
6017
|
});
|
|
@@ -6007,7 +6019,7 @@ var InvitationsHandler = class {
|
|
|
6007
6019
|
} else {
|
|
6008
6020
|
import_log12.log.verbose("auth failed", err, {
|
|
6009
6021
|
F: __dxlog_file21,
|
|
6010
|
-
L:
|
|
6022
|
+
L: 382,
|
|
6011
6023
|
S: this,
|
|
6012
6024
|
C: (f, a) => f(...a)
|
|
6013
6025
|
});
|
|
@@ -6024,7 +6036,7 @@ var InvitationsHandler = class {
|
|
|
6024
6036
|
...protocol.toJSON()
|
|
6025
6037
|
}, {
|
|
6026
6038
|
F: __dxlog_file21,
|
|
6027
|
-
L:
|
|
6039
|
+
L: 394,
|
|
6028
6040
|
S: this,
|
|
6029
6041
|
C: (f, a) => f(...a)
|
|
6030
6042
|
});
|
|
@@ -6037,14 +6049,14 @@ var InvitationsHandler = class {
|
|
|
6037
6049
|
});
|
|
6038
6050
|
edgeInvitationHandler.handle(ctx, guardedState, protocol, deviceProfile);
|
|
6039
6051
|
(0, import_async15.scheduleTask)(ctx, async () => {
|
|
6040
|
-
const error =
|
|
6052
|
+
const error = checkInvitation(protocol, invitation);
|
|
6041
6053
|
if (error) {
|
|
6042
6054
|
stream.error(error);
|
|
6043
6055
|
await ctx.dispose();
|
|
6044
6056
|
} else {
|
|
6045
6057
|
(0, import_invariant12.invariant)(invitation.swarmKey, void 0, {
|
|
6046
6058
|
F: __dxlog_file21,
|
|
6047
|
-
L:
|
|
6059
|
+
L: 406,
|
|
6048
6060
|
S: this,
|
|
6049
6061
|
A: [
|
|
6050
6062
|
"invitation.swarmKey",
|
|
@@ -6088,7 +6100,7 @@ var InvitationsHandler = class {
|
|
|
6088
6100
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6089
6101
|
(0, import_log12.log)("guest waiting for authentication code...", void 0, {
|
|
6090
6102
|
F: __dxlog_file21,
|
|
6091
|
-
L:
|
|
6103
|
+
L: 458,
|
|
6092
6104
|
S: this,
|
|
6093
6105
|
C: (f, a) => f(...a)
|
|
6094
6106
|
});
|
|
@@ -6096,7 +6108,7 @@ var InvitationsHandler = class {
|
|
|
6096
6108
|
const authCode = await authenticated.wait(options);
|
|
6097
6109
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6098
6110
|
F: __dxlog_file21,
|
|
6099
|
-
L:
|
|
6111
|
+
L: 462,
|
|
6100
6112
|
S: this,
|
|
6101
6113
|
C: (f, a) => f(...a)
|
|
6102
6114
|
});
|
|
@@ -6115,7 +6127,7 @@ var InvitationsHandler = class {
|
|
|
6115
6127
|
attempt
|
|
6116
6128
|
}, {
|
|
6117
6129
|
F: __dxlog_file21,
|
|
6118
|
-
L:
|
|
6130
|
+
L: 473,
|
|
6119
6131
|
S: this,
|
|
6120
6132
|
C: (f, a) => f(...a)
|
|
6121
6133
|
});
|
|
@@ -6133,7 +6145,7 @@ var InvitationsHandler = class {
|
|
|
6133
6145
|
}
|
|
6134
6146
|
(0, import_log12.log)("sending authentication request", void 0, {
|
|
6135
6147
|
F: __dxlog_file21,
|
|
6136
|
-
L:
|
|
6148
|
+
L: 492,
|
|
6137
6149
|
S: this,
|
|
6138
6150
|
C: (f, a) => f(...a)
|
|
6139
6151
|
});
|
|
@@ -6146,6 +6158,13 @@ var InvitationsHandler = class {
|
|
|
6146
6158
|
}
|
|
6147
6159
|
}
|
|
6148
6160
|
};
|
|
6161
|
+
var checkInvitation = (protocol, invitation) => {
|
|
6162
|
+
const expiresOn = (0, import_client_protocol5.getExpirationTime)(invitation);
|
|
6163
|
+
if (expiresOn && expiresOn.getTime() < Date.now()) {
|
|
6164
|
+
return new import_protocols9.InvalidInvitationError("Invitation already expired.");
|
|
6165
|
+
}
|
|
6166
|
+
return protocol.checkInvitation(invitation);
|
|
6167
|
+
};
|
|
6149
6168
|
var createAdmissionKeypair = () => {
|
|
6150
6169
|
const keypair = (0, import_crypto.createKeyPair)();
|
|
6151
6170
|
return {
|
|
@@ -6162,7 +6181,7 @@ var InvitationsServiceImpl = class {
|
|
|
6162
6181
|
return {};
|
|
6163
6182
|
}
|
|
6164
6183
|
createInvitation(options) {
|
|
6165
|
-
return new
|
|
6184
|
+
return new import_stream9.Stream(({ next, close }) => {
|
|
6166
6185
|
void this._invitationsManager.createInvitation(options).then((invitation) => {
|
|
6167
6186
|
import_tracing9.trace.metrics.increment("dxos.invitation.created");
|
|
6168
6187
|
invitation.subscribe(next, close, close);
|
|
@@ -6171,7 +6190,7 @@ var InvitationsServiceImpl = class {
|
|
|
6171
6190
|
}
|
|
6172
6191
|
acceptInvitation(request) {
|
|
6173
6192
|
const invitation = this._invitationsManager.acceptInvitation(request);
|
|
6174
|
-
return new
|
|
6193
|
+
return new import_stream9.Stream(({ next, close }) => {
|
|
6175
6194
|
invitation.subscribe(next, close, close);
|
|
6176
6195
|
});
|
|
6177
6196
|
}
|
|
@@ -6182,7 +6201,7 @@ var InvitationsServiceImpl = class {
|
|
|
6182
6201
|
return this._invitationsManager.cancelInvitation(request);
|
|
6183
6202
|
}
|
|
6184
6203
|
queryInvitations() {
|
|
6185
|
-
return new
|
|
6204
|
+
return new import_stream9.Stream(({ next, ctx }) => {
|
|
6186
6205
|
this._invitationsManager.invitationCreated.on(ctx, (invitation) => {
|
|
6187
6206
|
next({
|
|
6188
6207
|
action: import_services16.QueryInvitationsResponse.Action.ADDED,
|
|
@@ -6280,7 +6299,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6280
6299
|
getInvitationContext() {
|
|
6281
6300
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6282
6301
|
F: __dxlog_file22,
|
|
6283
|
-
L:
|
|
6302
|
+
L: 65,
|
|
6284
6303
|
S: this,
|
|
6285
6304
|
A: [
|
|
6286
6305
|
"this._spaceKey",
|
|
@@ -6290,7 +6309,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6290
6309
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6291
6310
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6292
6311
|
F: __dxlog_file22,
|
|
6293
|
-
L:
|
|
6312
|
+
L: 67,
|
|
6294
6313
|
S: this,
|
|
6295
6314
|
A: [
|
|
6296
6315
|
"space",
|
|
@@ -6306,7 +6325,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6306
6325
|
async admit(invitation, request, guestProfile) {
|
|
6307
6326
|
(0, import_invariant17.invariant)(this._spaceKey && request.space, void 0, {
|
|
6308
6327
|
F: __dxlog_file22,
|
|
6309
|
-
L:
|
|
6328
|
+
L: 80,
|
|
6310
6329
|
S: this,
|
|
6311
6330
|
A: [
|
|
6312
6331
|
"this._spaceKey && request.space",
|
|
@@ -6318,7 +6337,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6318
6337
|
guest: request.space.deviceKey
|
|
6319
6338
|
}, {
|
|
6320
6339
|
F: __dxlog_file22,
|
|
6321
|
-
L:
|
|
6340
|
+
L: 81,
|
|
6322
6341
|
S: this,
|
|
6323
6342
|
C: (f, a) => f(...a)
|
|
6324
6343
|
});
|
|
@@ -6340,7 +6359,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6340
6359
|
async delegate(invitation) {
|
|
6341
6360
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6342
6361
|
F: __dxlog_file22,
|
|
6343
|
-
L:
|
|
6362
|
+
L: 101,
|
|
6344
6363
|
S: this,
|
|
6345
6364
|
A: [
|
|
6346
6365
|
"this._spaceKey",
|
|
@@ -6350,7 +6369,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6350
6369
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6351
6370
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6352
6371
|
F: __dxlog_file22,
|
|
6353
|
-
L:
|
|
6372
|
+
L: 103,
|
|
6354
6373
|
S: this,
|
|
6355
6374
|
A: [
|
|
6356
6375
|
"space",
|
|
@@ -6360,7 +6379,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6360
6379
|
if (invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
6361
6380
|
(0, import_invariant17.invariant)(invitation.guestKeypair?.publicKey, void 0, {
|
|
6362
6381
|
F: __dxlog_file22,
|
|
6363
|
-
L:
|
|
6382
|
+
L: 105,
|
|
6364
6383
|
S: this,
|
|
6365
6384
|
A: [
|
|
6366
6385
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -6373,7 +6392,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6373
6392
|
id: invitation.invitationId
|
|
6374
6393
|
}, {
|
|
6375
6394
|
F: __dxlog_file22,
|
|
6376
|
-
L:
|
|
6395
|
+
L: 108,
|
|
6377
6396
|
S: this,
|
|
6378
6397
|
C: (f, a) => f(...a)
|
|
6379
6398
|
});
|
|
@@ -6382,13 +6401,13 @@ var SpaceInvitationProtocol = class {
|
|
|
6382
6401
|
authMethod: invitation.authMethod,
|
|
6383
6402
|
swarmKey: invitation.swarmKey,
|
|
6384
6403
|
role: invitation.role ?? import_credentials19.SpaceMember.Role.ADMIN,
|
|
6385
|
-
expiresOn:
|
|
6404
|
+
expiresOn: computeExpirationTime(invitation),
|
|
6386
6405
|
multiUse: invitation.multiUse ?? false,
|
|
6387
6406
|
guestKey: invitation.authMethod === import_services17.Invitation.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
6388
6407
|
});
|
|
6389
6408
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6390
6409
|
F: __dxlog_file22,
|
|
6391
|
-
L:
|
|
6410
|
+
L: 126,
|
|
6392
6411
|
S: this,
|
|
6393
6412
|
A: [
|
|
6394
6413
|
"credential.credential",
|
|
@@ -6403,7 +6422,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6403
6422
|
async cancelDelegation(invitation) {
|
|
6404
6423
|
(0, import_invariant17.invariant)(this._spaceKey, void 0, {
|
|
6405
6424
|
F: __dxlog_file22,
|
|
6406
|
-
L:
|
|
6425
|
+
L: 132,
|
|
6407
6426
|
S: this,
|
|
6408
6427
|
A: [
|
|
6409
6428
|
"this._spaceKey",
|
|
@@ -6412,7 +6431,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6412
6431
|
});
|
|
6413
6432
|
(0, import_invariant17.invariant)(invitation.type === import_services17.Invitation.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
6414
6433
|
F: __dxlog_file22,
|
|
6415
|
-
L:
|
|
6434
|
+
L: 133,
|
|
6416
6435
|
S: this,
|
|
6417
6436
|
A: [
|
|
6418
6437
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -6422,7 +6441,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6422
6441
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
6423
6442
|
(0, import_invariant17.invariant)(space, void 0, {
|
|
6424
6443
|
F: __dxlog_file22,
|
|
6425
|
-
L:
|
|
6444
|
+
L: 135,
|
|
6426
6445
|
S: this,
|
|
6427
6446
|
A: [
|
|
6428
6447
|
"space",
|
|
@@ -6434,14 +6453,14 @@ var SpaceInvitationProtocol = class {
|
|
|
6434
6453
|
id: invitation.invitationId
|
|
6435
6454
|
}, {
|
|
6436
6455
|
F: __dxlog_file22,
|
|
6437
|
-
L:
|
|
6456
|
+
L: 137,
|
|
6438
6457
|
S: this,
|
|
6439
6458
|
C: (f, a) => f(...a)
|
|
6440
6459
|
});
|
|
6441
6460
|
const credential = await (0, import_credentials18.createCancelDelegatedSpaceInvitationCredential)(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
6442
6461
|
(0, import_invariant17.invariant)(credential.credential, void 0, {
|
|
6443
6462
|
F: __dxlog_file22,
|
|
6444
|
-
L:
|
|
6463
|
+
L: 144,
|
|
6445
6464
|
S: this,
|
|
6446
6465
|
A: [
|
|
6447
6466
|
"credential.credential",
|
|
@@ -6480,7 +6499,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6480
6499
|
async accept(response) {
|
|
6481
6500
|
(0, import_invariant17.invariant)(response.space, void 0, {
|
|
6482
6501
|
F: __dxlog_file22,
|
|
6483
|
-
L:
|
|
6502
|
+
L: 179,
|
|
6484
6503
|
S: this,
|
|
6485
6504
|
A: [
|
|
6486
6505
|
"response.space",
|
|
@@ -6491,7 +6510,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6491
6510
|
const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
|
|
6492
6511
|
(0, import_invariant17.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6493
6512
|
F: __dxlog_file22,
|
|
6494
|
-
L:
|
|
6513
|
+
L: 182,
|
|
6495
6514
|
S: this,
|
|
6496
6515
|
A: [
|
|
6497
6516
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -6500,7 +6519,7 @@ var SpaceInvitationProtocol = class {
|
|
|
6500
6519
|
});
|
|
6501
6520
|
(0, import_invariant17.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
6502
6521
|
F: __dxlog_file22,
|
|
6503
|
-
L:
|
|
6522
|
+
L: 183,
|
|
6504
6523
|
S: this,
|
|
6505
6524
|
A: [
|
|
6506
6525
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -6724,7 +6743,7 @@ var InvitationsManager = class {
|
|
|
6724
6743
|
}
|
|
6725
6744
|
}
|
|
6726
6745
|
_createInvitation(protocol, _options) {
|
|
6727
|
-
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
|
|
6746
|
+
const { invitationId = import_keys14.PublicKey.random().toHex(), type = import_services18.Invitation.Type.INTERACTIVE, authMethod = import_services18.Invitation.AuthMethod.SHARED_SECRET, state = import_services18.Invitation.State.INIT, timeout = import_client_protocol6.INVITATION_TIMEOUT, swarmKey = import_keys14.PublicKey.random(), persistent = _options?.authMethod !== import_services18.Invitation.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = import_credentials21.SpaceMember.Role.ADMIN, lifetime = 86400 * 7, multiUse = false, ...options } = _options ?? {};
|
|
6728
6747
|
const authCode = options?.authCode ?? (authMethod === import_services18.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials20.generatePasscode)(import_client_protocol6.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6729
6748
|
return {
|
|
6730
6749
|
invitationId,
|
|
@@ -6963,7 +6982,7 @@ var ClientRpcServer = class {
|
|
|
6963
6982
|
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
6964
6983
|
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
6965
6984
|
if (this._handleStream) {
|
|
6966
|
-
return
|
|
6985
|
+
return import_codec_protobuf2.Stream.map(import_codec_protobuf2.Stream.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
|
|
6967
6986
|
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
6968
6987
|
return data;
|
|
6969
6988
|
});
|
|
@@ -7229,7 +7248,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7229
7248
|
this._edgeConnection = _edgeConnection;
|
|
7230
7249
|
}
|
|
7231
7250
|
queryEdgeStatus() {
|
|
7232
|
-
return new
|
|
7251
|
+
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7233
7252
|
next({
|
|
7234
7253
|
status: import_services20.QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
|
|
7235
7254
|
});
|
|
@@ -7250,7 +7269,7 @@ var EdgeAgentServiceImpl = class {
|
|
|
7250
7269
|
return (await this._agentManagerProvider()).createAgent();
|
|
7251
7270
|
}
|
|
7252
7271
|
queryAgentStatus() {
|
|
7253
|
-
return new
|
|
7272
|
+
return new import_stream10.Stream(({ ctx, next }) => {
|
|
7254
7273
|
next({
|
|
7255
7274
|
status: import_services20.QueryAgentStatusResponse.AgentStatus.UNKNOWN
|
|
7256
7275
|
});
|
|
@@ -7498,7 +7517,8 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7498
7517
|
this.recoveryManager = new EdgeIdentityRecoveryManager(this.keyring, this._edgeHttpClient, () => this.identityManager.identity, this._acceptIdentity.bind(this));
|
|
7499
7518
|
this.echoHost = new import_echo_pipeline4.EchoHost({
|
|
7500
7519
|
kv: this.level,
|
|
7501
|
-
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex()
|
|
7520
|
+
peerIdProvider: () => this.identityManager.identity?.deviceKey?.toHex(),
|
|
7521
|
+
getSpaceKeyByRootDocumentId: (documentId) => this.spaceManager.findSpaceByRootDocumentId(documentId)?.key
|
|
7502
7522
|
});
|
|
7503
7523
|
this._meshReplicator = new import_echo_pipeline4.MeshEchoReplicator();
|
|
7504
7524
|
this.invitations = new InvitationsHandler(this.networkManager, this._edgeHttpClient, _runtimeParams?.invitationConnectionDefaultParams);
|
|
@@ -7517,7 +7537,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7517
7537
|
await this._checkStorageVersion();
|
|
7518
7538
|
(0, import_log22.log)("opening...", void 0, {
|
|
7519
7539
|
F: __dxlog_file27,
|
|
7520
|
-
L:
|
|
7540
|
+
L: 199,
|
|
7521
7541
|
S: this,
|
|
7522
7542
|
C: (f, a) => f(...a)
|
|
7523
7543
|
});
|
|
@@ -7525,7 +7545,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7525
7545
|
id: this._instanceId
|
|
7526
7546
|
}), {
|
|
7527
7547
|
F: __dxlog_file27,
|
|
7528
|
-
L:
|
|
7548
|
+
L: 200,
|
|
7529
7549
|
S: this,
|
|
7530
7550
|
C: (f, a) => f(...a)
|
|
7531
7551
|
});
|
|
@@ -7552,7 +7572,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7552
7572
|
count: loadedInvitations.invitations?.length
|
|
7553
7573
|
}, {
|
|
7554
7574
|
F: __dxlog_file27,
|
|
7555
|
-
L:
|
|
7575
|
+
L: 228,
|
|
7556
7576
|
S: this,
|
|
7557
7577
|
C: (f, a) => f(...a)
|
|
7558
7578
|
});
|
|
@@ -7560,13 +7580,13 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7560
7580
|
id: this._instanceId
|
|
7561
7581
|
}), {
|
|
7562
7582
|
F: __dxlog_file27,
|
|
7563
|
-
L:
|
|
7583
|
+
L: 230,
|
|
7564
7584
|
S: this,
|
|
7565
7585
|
C: (f, a) => f(...a)
|
|
7566
7586
|
});
|
|
7567
7587
|
(0, import_log22.log)("opened", void 0, {
|
|
7568
7588
|
F: __dxlog_file27,
|
|
7569
|
-
L:
|
|
7589
|
+
L: 231,
|
|
7570
7590
|
S: this,
|
|
7571
7591
|
C: (f, a) => f(...a)
|
|
7572
7592
|
});
|
|
@@ -7574,7 +7594,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7574
7594
|
async _close(ctx) {
|
|
7575
7595
|
(0, import_log22.log)("closing...", void 0, {
|
|
7576
7596
|
F: __dxlog_file27,
|
|
7577
|
-
L:
|
|
7597
|
+
L: 235,
|
|
7578
7598
|
S: this,
|
|
7579
7599
|
C: (f, a) => f(...a)
|
|
7580
7600
|
});
|
|
@@ -7593,7 +7613,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7593
7613
|
await this._edgeConnection?.close();
|
|
7594
7614
|
(0, import_log22.log)("closed", void 0, {
|
|
7595
7615
|
F: __dxlog_file27,
|
|
7596
|
-
L:
|
|
7616
|
+
L: 251,
|
|
7597
7617
|
S: this,
|
|
7598
7618
|
C: (f, a) => f(...a)
|
|
7599
7619
|
});
|
|
@@ -7604,7 +7624,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7604
7624
|
await identity.joinNetwork();
|
|
7605
7625
|
await this._initialize(new import_context16.Context(void 0, {
|
|
7606
7626
|
F: __dxlog_file27,
|
|
7607
|
-
L:
|
|
7627
|
+
L: 258
|
|
7608
7628
|
}));
|
|
7609
7629
|
return identity;
|
|
7610
7630
|
}
|
|
@@ -7615,7 +7635,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7615
7635
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
7616
7636
|
(0, import_invariant21.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
7617
7637
|
F: __dxlog_file27,
|
|
7618
|
-
L:
|
|
7638
|
+
L: 267,
|
|
7619
7639
|
S: this,
|
|
7620
7640
|
A: [
|
|
7621
7641
|
"factory",
|
|
@@ -7641,7 +7661,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7641
7661
|
await this.identityManager.acceptIdentity(identity, identityRecord, params.deviceProfile);
|
|
7642
7662
|
await this._initialize(new import_context16.Context(void 0, {
|
|
7643
7663
|
F: __dxlog_file27,
|
|
7644
|
-
L:
|
|
7664
|
+
L: 286
|
|
7645
7665
|
}));
|
|
7646
7666
|
return identity;
|
|
7647
7667
|
}
|
|
@@ -7655,7 +7675,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7655
7675
|
async _initialize(ctx) {
|
|
7656
7676
|
(0, import_log22.log)("initializing spaces...", void 0, {
|
|
7657
7677
|
F: __dxlog_file27,
|
|
7658
|
-
L:
|
|
7678
|
+
L: 301,
|
|
7659
7679
|
S: this,
|
|
7660
7680
|
C: (f, a) => f(...a)
|
|
7661
7681
|
});
|
|
@@ -7694,7 +7714,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7694
7714
|
this._handlerFactories.set(import_services21.Invitation.Kind.SPACE, (invitation) => {
|
|
7695
7715
|
(0, import_invariant21.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
7696
7716
|
F: __dxlog_file27,
|
|
7697
|
-
L:
|
|
7717
|
+
L: 339,
|
|
7698
7718
|
S: this,
|
|
7699
7719
|
A: [
|
|
7700
7720
|
"this.dataSpaceManager",
|
|
@@ -7718,7 +7738,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7718
7738
|
details: assertion
|
|
7719
7739
|
}, {
|
|
7720
7740
|
F: __dxlog_file27,
|
|
7721
|
-
L:
|
|
7741
|
+
L: 355,
|
|
7722
7742
|
S: this,
|
|
7723
7743
|
C: (f, a) => f(...a)
|
|
7724
7744
|
});
|
|
@@ -7729,7 +7749,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7729
7749
|
details: assertion
|
|
7730
7750
|
}, {
|
|
7731
7751
|
F: __dxlog_file27,
|
|
7732
|
-
L:
|
|
7752
|
+
L: 359,
|
|
7733
7753
|
S: this,
|
|
7734
7754
|
C: (f, a) => f(...a)
|
|
7735
7755
|
});
|
|
@@ -7740,7 +7760,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7740
7760
|
details: assertion
|
|
7741
7761
|
}, {
|
|
7742
7762
|
F: __dxlog_file27,
|
|
7743
|
-
L:
|
|
7763
|
+
L: 364,
|
|
7744
7764
|
S: this,
|
|
7745
7765
|
C: (f, a) => f(...a)
|
|
7746
7766
|
});
|
|
@@ -7751,7 +7771,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7751
7771
|
} catch (err) {
|
|
7752
7772
|
import_log22.log.catch(err, void 0, {
|
|
7753
7773
|
F: __dxlog_file27,
|
|
7754
|
-
L:
|
|
7774
|
+
L: 370,
|
|
7755
7775
|
S: this,
|
|
7756
7776
|
C: (f, a) => f(...a)
|
|
7757
7777
|
});
|
|
@@ -7772,7 +7792,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7772
7792
|
swarms: this.networkManager.topics
|
|
7773
7793
|
}, {
|
|
7774
7794
|
F: __dxlog_file27,
|
|
7775
|
-
L:
|
|
7795
|
+
L: 384,
|
|
7776
7796
|
S: this,
|
|
7777
7797
|
C: (f, a) => f(...a)
|
|
7778
7798
|
});
|
|
@@ -7786,7 +7806,7 @@ var ServiceContext = class extends import_context16.Resource {
|
|
|
7786
7806
|
});
|
|
7787
7807
|
(0, import_invariant21.invariant)(identity.deviceCredentialChain, void 0, {
|
|
7788
7808
|
F: __dxlog_file27,
|
|
7789
|
-
L:
|
|
7809
|
+
L: 403,
|
|
7790
7810
|
S: this,
|
|
7791
7811
|
A: [
|
|
7792
7812
|
"identity.deviceCredentialChain",
|
|
@@ -8062,7 +8082,7 @@ var DevicesServiceImpl = class {
|
|
|
8062
8082
|
return this._identityManager.updateDeviceProfile(profile);
|
|
8063
8083
|
}
|
|
8064
8084
|
queryDevices() {
|
|
8065
|
-
return new
|
|
8085
|
+
return new import_stream11.Stream(({ next }) => {
|
|
8066
8086
|
const update = () => {
|
|
8067
8087
|
const deviceKeys = this._identityManager.identity?.authorizedDeviceKeys;
|
|
8068
8088
|
if (!deviceKeys) {
|
|
@@ -8184,7 +8204,7 @@ var ContactsServiceImpl = class {
|
|
|
8184
8204
|
}
|
|
8185
8205
|
queryContacts() {
|
|
8186
8206
|
const subscribedSpaceKeySet = new import_util15.ComplexSet(import_keys20.PublicKey.hash);
|
|
8187
|
-
return new
|
|
8207
|
+
return new import_stream12.Stream(({ next, ctx }) => {
|
|
8188
8208
|
const pushUpdateTask = new import_async25.UpdateScheduler(ctx, async () => {
|
|
8189
8209
|
const contacts = await this.getContacts();
|
|
8190
8210
|
next(contacts);
|
|
@@ -8253,7 +8273,7 @@ var LoggingServiceImpl = class {
|
|
|
8253
8273
|
stats: (0, import_util16.numericalValues)(events, "duration")
|
|
8254
8274
|
};
|
|
8255
8275
|
};
|
|
8256
|
-
return new
|
|
8276
|
+
return new import_stream13.Stream(({ next }) => {
|
|
8257
8277
|
const update = () => {
|
|
8258
8278
|
const metrics2 = {
|
|
8259
8279
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -8275,7 +8295,7 @@ var LoggingServiceImpl = class {
|
|
|
8275
8295
|
});
|
|
8276
8296
|
}
|
|
8277
8297
|
queryLogs(request) {
|
|
8278
|
-
return new
|
|
8298
|
+
return new import_stream13.Stream(({ ctx, next }) => {
|
|
8279
8299
|
const handler = (entry2) => {
|
|
8280
8300
|
if (LOG_PROCESSING > 0) {
|
|
8281
8301
|
return;
|
|
@@ -8335,7 +8355,7 @@ var NetworkServiceImpl = class {
|
|
|
8335
8355
|
this.signalManager = signalManager;
|
|
8336
8356
|
}
|
|
8337
8357
|
queryStatus() {
|
|
8338
|
-
return new
|
|
8358
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8339
8359
|
const update = () => {
|
|
8340
8360
|
next({
|
|
8341
8361
|
swarm: this.networkManager.connectionState,
|
|
@@ -8358,6 +8378,35 @@ var NetworkServiceImpl = class {
|
|
|
8358
8378
|
async updateConfig(request) {
|
|
8359
8379
|
await this.networkManager.setConnectionState(request.swarm);
|
|
8360
8380
|
}
|
|
8381
|
+
async joinSwarm(request) {
|
|
8382
|
+
return this.signalManager.join(request);
|
|
8383
|
+
}
|
|
8384
|
+
async leaveSwarm(request) {
|
|
8385
|
+
return this.signalManager.leave(request);
|
|
8386
|
+
}
|
|
8387
|
+
subscribeSwarmState(request) {
|
|
8388
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8389
|
+
const unsubscribe = this.signalManager.swarmState?.on((state) => {
|
|
8390
|
+
if (request.topic.equals(state.swarmKey)) {
|
|
8391
|
+
next(state);
|
|
8392
|
+
}
|
|
8393
|
+
});
|
|
8394
|
+
return unsubscribe;
|
|
8395
|
+
});
|
|
8396
|
+
}
|
|
8397
|
+
async sendMessage(message) {
|
|
8398
|
+
return this.signalManager.sendMessage(message);
|
|
8399
|
+
}
|
|
8400
|
+
subscribeMessages(peer) {
|
|
8401
|
+
return new import_stream14.Stream(({ next }) => {
|
|
8402
|
+
const unsubscribe = this.signalManager.onMessage.on((message) => {
|
|
8403
|
+
if (message.recipient.peerKey === peer.peerKey) {
|
|
8404
|
+
next(message);
|
|
8405
|
+
}
|
|
8406
|
+
});
|
|
8407
|
+
return unsubscribe;
|
|
8408
|
+
});
|
|
8409
|
+
}
|
|
8361
8410
|
};
|
|
8362
8411
|
var SystemServiceImpl = class {
|
|
8363
8412
|
constructor({ config, statusUpdate, getDiagnostics, onUpdateStatus, getCurrentStatus, onReset }) {
|
|
@@ -8392,7 +8441,7 @@ var SystemServiceImpl = class {
|
|
|
8392
8441
|
}
|
|
8393
8442
|
// TODO(burdon): Standardize interval option in stream request?
|
|
8394
8443
|
queryStatus({ interval = 3e3 } = {}) {
|
|
8395
|
-
return new
|
|
8444
|
+
return new import_stream15.Stream(({ next }) => {
|
|
8396
8445
|
const update = () => {
|
|
8397
8446
|
next({
|
|
8398
8447
|
status: this._getCurrentStatus()
|
|
@@ -8858,4 +8907,4 @@ ClientServicesHost = _ts_decorate11([
|
|
|
8858
8907
|
subscribeToSpaces,
|
|
8859
8908
|
subscribeToSwarmInfo
|
|
8860
8909
|
});
|
|
8861
|
-
//# sourceMappingURL=chunk-
|
|
8910
|
+
//# sourceMappingURL=chunk-WFDMSV4I.cjs.map
|