@dxos/client-services 0.6.9-staging.8e43e2a → 0.6.10-main.bbdfaa4
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-JKQYZPHA.mjs → chunk-DJUFNLVB.mjs} +592 -555
- package/dist/lib/browser/chunk-DJUFNLVB.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 +7 -8
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-HRG7HZ3L.cjs → chunk-JZHOBYSS.cjs} +582 -545
- package/dist/lib/node/chunk-JZHOBYSS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +13 -14
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/feeds.d.ts +3 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +2 -4
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/devtools/feeds.ts +37 -4
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +4 -5
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -2
- package/src/packlets/testing/test-builder.ts +3 -10
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-JKQYZPHA.mjs.map +0 -7
- package/dist/lib/node/chunk-HRG7HZ3L.cjs.map +0 -7
|
@@ -12,8 +12,10 @@ import { EventSubscriptions } from "@dxos/async";
|
|
|
12
12
|
import { Stream } from "@dxos/codec-protobuf";
|
|
13
13
|
import { FeedIterator } from "@dxos/feed-store";
|
|
14
14
|
import { PublicKey } from "@dxos/keys";
|
|
15
|
+
import { log } from "@dxos/log";
|
|
15
16
|
import { ComplexMap } from "@dxos/util";
|
|
16
|
-
var
|
|
17
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/feeds.ts";
|
|
18
|
+
var subscribeToFeeds = ({ feedStore, spaceManager }, { feedKeys }) => {
|
|
17
19
|
return new Stream(({ next }) => {
|
|
18
20
|
const subscriptions = new EventSubscriptions();
|
|
19
21
|
const feedMap = new ComplexMap(PublicKey.hash);
|
|
@@ -21,17 +23,23 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
21
23
|
const { feeds } = feedStore;
|
|
22
24
|
feeds.filter((feed) => !feedKeys?.length || feedKeys.some((feedKey) => feedKey.equals(feed.key))).forEach((feed) => {
|
|
23
25
|
if (!feedMap.has(feed.key)) {
|
|
24
|
-
feedMap.set(feed.key,
|
|
26
|
+
feedMap.set(feed.key, {
|
|
27
|
+
feed
|
|
28
|
+
});
|
|
25
29
|
feed.on("close", update);
|
|
26
30
|
subscriptions.add(() => feed.off("close", update));
|
|
27
31
|
}
|
|
32
|
+
if (!feedMap.get(feed.key)?.owner) {
|
|
33
|
+
feedMap.get(feed.key).owner = findFeedOwner(spaceManager, feed.key);
|
|
34
|
+
}
|
|
28
35
|
});
|
|
29
36
|
next({
|
|
30
|
-
feeds: Array.from(feedMap.values()).map((feed) => ({
|
|
37
|
+
feeds: Array.from(feedMap.values()).map(({ feed, owner }) => ({
|
|
31
38
|
feedKey: feed.key,
|
|
32
39
|
length: feed.properties.length,
|
|
33
40
|
bytes: feed.core.byteLength,
|
|
34
|
-
downloaded: feed.core.bitfield?.data.toBuffer() ?? new Uint8Array()
|
|
41
|
+
downloaded: feed.core.bitfield?.data.toBuffer() ?? new Uint8Array(),
|
|
42
|
+
owner
|
|
35
43
|
}))
|
|
36
44
|
});
|
|
37
45
|
};
|
|
@@ -42,6 +50,30 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
|
42
50
|
};
|
|
43
51
|
});
|
|
44
52
|
};
|
|
53
|
+
var findFeedOwner = (spaceManager, feedKey) => {
|
|
54
|
+
const feedInfo = [
|
|
55
|
+
...spaceManager.spaces.values()
|
|
56
|
+
].flatMap((space) => [
|
|
57
|
+
...space.spaceState.feeds.values()
|
|
58
|
+
]).find((feed) => feed.key.equals(feedKey));
|
|
59
|
+
log.info("feeds", {
|
|
60
|
+
feedInfo,
|
|
61
|
+
key: feedKey.truncate(),
|
|
62
|
+
allSpaces: spaceManager.spaces.size
|
|
63
|
+
}, {
|
|
64
|
+
F: __dxlog_file,
|
|
65
|
+
L: 75,
|
|
66
|
+
S: void 0,
|
|
67
|
+
C: (f, a) => f(...a)
|
|
68
|
+
});
|
|
69
|
+
if (!feedInfo) {
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
identity: feedInfo.assertion.identityKey,
|
|
74
|
+
device: feedInfo.assertion.deviceKey
|
|
75
|
+
};
|
|
76
|
+
};
|
|
45
77
|
var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
46
78
|
return new Stream(({ next }) => {
|
|
47
79
|
if (!feedKey) {
|
|
@@ -54,6 +86,12 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
54
86
|
return;
|
|
55
87
|
}
|
|
56
88
|
const update = async () => {
|
|
89
|
+
if (!feed.properties.length) {
|
|
90
|
+
next({
|
|
91
|
+
blocks: []
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
57
95
|
const iterator = new FeedIterator(feed);
|
|
58
96
|
await iterator.open();
|
|
59
97
|
const blocks = [];
|
|
@@ -85,7 +123,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
85
123
|
import { Stream as Stream2 } from "@dxos/codec-protobuf";
|
|
86
124
|
import { Context } from "@dxos/context";
|
|
87
125
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
88
|
-
var
|
|
126
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
89
127
|
var subscribeToNetworkStatus = ({ signalManager }) => new Stream2(({ next, close }) => {
|
|
90
128
|
const update = () => {
|
|
91
129
|
try {
|
|
@@ -102,7 +140,7 @@ var subscribeToNetworkStatus = ({ signalManager }) => new Stream2(({ next, close
|
|
|
102
140
|
});
|
|
103
141
|
var subscribeToSignal = ({ signalManager }) => new Stream2(({ next }) => {
|
|
104
142
|
const ctx = new Context(void 0, {
|
|
105
|
-
F:
|
|
143
|
+
F: __dxlog_file2,
|
|
106
144
|
L: 36
|
|
107
145
|
});
|
|
108
146
|
signalManager.onMessage.on(ctx, (message) => {
|
|
@@ -312,9 +350,7 @@ var DevtoolsServiceImpl = class {
|
|
|
312
350
|
throw new Error();
|
|
313
351
|
}
|
|
314
352
|
subscribeToFeeds(request) {
|
|
315
|
-
return subscribeToFeeds(
|
|
316
|
-
feedStore: this.params.context.feedStore
|
|
317
|
-
}, request);
|
|
353
|
+
return subscribeToFeeds(this.params.context, request);
|
|
318
354
|
}
|
|
319
355
|
subscribeToFeedBlocks(request) {
|
|
320
356
|
return subscribeToFeedBlocks({
|
|
@@ -368,7 +404,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
368
404
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
369
405
|
|
|
370
406
|
// packages/sdk/client-services/src/version.ts
|
|
371
|
-
var DXOS_VERSION = "0.6.
|
|
407
|
+
var DXOS_VERSION = "0.6.10-main.bbdfaa4";
|
|
372
408
|
|
|
373
409
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
374
410
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -401,7 +437,7 @@ var getPlatform = () => {
|
|
|
401
437
|
};
|
|
402
438
|
|
|
403
439
|
// packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
|
|
404
|
-
var
|
|
440
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
405
441
|
var DEFAULT_TIMEOUT = 1e3;
|
|
406
442
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
407
443
|
const diagnostics = {
|
|
@@ -418,7 +454,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
418
454
|
await Promise.all([
|
|
419
455
|
(async () => {
|
|
420
456
|
invariant(clientServices.LoggingService, "SystemService is not available.", {
|
|
421
|
-
F:
|
|
457
|
+
F: __dxlog_file3,
|
|
422
458
|
L: 110,
|
|
423
459
|
S: void 0,
|
|
424
460
|
A: [
|
|
@@ -522,8 +558,8 @@ var getStorageDiagnostics = async () => {
|
|
|
522
558
|
|
|
523
559
|
// packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts
|
|
524
560
|
import { Trigger } from "@dxos/async";
|
|
525
|
-
import { log } from "@dxos/log";
|
|
526
|
-
var
|
|
561
|
+
import { log as log2 } from "@dxos/log";
|
|
562
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts";
|
|
527
563
|
var CHANNEL_NAME = "dxos.diagnostics.broadcast";
|
|
528
564
|
var MessageType;
|
|
529
565
|
(function(MessageType2) {
|
|
@@ -591,8 +627,8 @@ var createCollectDiagnosticsBroadcastHandler = (systemService) => {
|
|
|
591
627
|
});
|
|
592
628
|
}
|
|
593
629
|
} catch (error) {
|
|
594
|
-
|
|
595
|
-
F:
|
|
630
|
+
log2.catch(error, void 0, {
|
|
631
|
+
F: __dxlog_file4,
|
|
596
632
|
L: 77,
|
|
597
633
|
S: void 0,
|
|
598
634
|
C: (f, a) => f(...a)
|
|
@@ -658,9 +694,9 @@ var findConfigs = () => {
|
|
|
658
694
|
import { Trigger as Trigger2 } from "@dxos/async";
|
|
659
695
|
import { Context as Context2 } from "@dxos/context";
|
|
660
696
|
import { verifyCredential } from "@dxos/credentials";
|
|
661
|
-
import { log as
|
|
697
|
+
import { log as log3 } from "@dxos/log";
|
|
662
698
|
import { schema } from "@dxos/protocols";
|
|
663
|
-
var
|
|
699
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
664
700
|
var Credential = schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
665
701
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
666
702
|
const credential = await signer.createCredential({
|
|
@@ -676,7 +712,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
676
712
|
constructor(_params) {
|
|
677
713
|
this._params = _params;
|
|
678
714
|
this._ctx = new Context2(void 0, {
|
|
679
|
-
F:
|
|
715
|
+
F: __dxlog_file5,
|
|
680
716
|
L: 45
|
|
681
717
|
});
|
|
682
718
|
}
|
|
@@ -686,20 +722,20 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
686
722
|
get verifier() {
|
|
687
723
|
return async (nonce, auth) => {
|
|
688
724
|
const credential = Credential.decode(auth);
|
|
689
|
-
|
|
725
|
+
log3("authenticating...", {
|
|
690
726
|
credential
|
|
691
727
|
}, {
|
|
692
|
-
F:
|
|
728
|
+
F: __dxlog_file5,
|
|
693
729
|
L: 56,
|
|
694
730
|
S: this,
|
|
695
731
|
C: (f, a) => f(...a)
|
|
696
732
|
});
|
|
697
733
|
const result = await verifyCredential(credential);
|
|
698
734
|
if (result.kind === "fail") {
|
|
699
|
-
|
|
735
|
+
log3("Invalid credential", {
|
|
700
736
|
result
|
|
701
737
|
}, {
|
|
702
|
-
F:
|
|
738
|
+
F: __dxlog_file5,
|
|
703
739
|
L: 60,
|
|
704
740
|
S: this,
|
|
705
741
|
C: (f, a) => f(...a)
|
|
@@ -707,11 +743,11 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
707
743
|
return false;
|
|
708
744
|
}
|
|
709
745
|
if (!credential.proof.nonce || !Buffer.from(nonce).equals(credential.proof.nonce)) {
|
|
710
|
-
|
|
746
|
+
log3("Invalid nonce", {
|
|
711
747
|
nonce,
|
|
712
748
|
credential
|
|
713
749
|
}, {
|
|
714
|
-
F:
|
|
750
|
+
F: __dxlog_file5,
|
|
715
751
|
L: 65,
|
|
716
752
|
S: this,
|
|
717
753
|
C: (f, a) => f(...a)
|
|
@@ -719,10 +755,10 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
719
755
|
return false;
|
|
720
756
|
}
|
|
721
757
|
if (this._isTrustedKey(credential.issuer)) {
|
|
722
|
-
|
|
758
|
+
log3("key is not currently in trusted set, waiting...", {
|
|
723
759
|
key: credential.issuer
|
|
724
760
|
}, {
|
|
725
|
-
F:
|
|
761
|
+
F: __dxlog_file5,
|
|
726
762
|
L: 70,
|
|
727
763
|
S: this,
|
|
728
764
|
C: (f, a) => f(...a)
|
|
@@ -735,20 +771,20 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
735
771
|
});
|
|
736
772
|
const clear = this._params.update.on(this._ctx, () => {
|
|
737
773
|
if (this._isTrustedKey(credential.issuer)) {
|
|
738
|
-
|
|
774
|
+
log3("auth success", {
|
|
739
775
|
key: credential.issuer
|
|
740
776
|
}, {
|
|
741
|
-
F:
|
|
777
|
+
F: __dxlog_file5,
|
|
742
778
|
L: 81,
|
|
743
779
|
S: this,
|
|
744
780
|
C: (f, a) => f(...a)
|
|
745
781
|
});
|
|
746
782
|
trigger.wake(true);
|
|
747
783
|
} else {
|
|
748
|
-
|
|
784
|
+
log3("key is not currently in trusted set, waiting...", {
|
|
749
785
|
key: credential.issuer
|
|
750
786
|
}, {
|
|
751
|
-
F:
|
|
787
|
+
F: __dxlog_file5,
|
|
752
788
|
L: 84,
|
|
753
789
|
S: this,
|
|
754
790
|
C: (f, a) => f(...a)
|
|
@@ -779,7 +815,7 @@ import { DeviceStateMachine, createCredentialSignerWithKey, createCredentialSign
|
|
|
779
815
|
import { writeMessages } from "@dxos/feed-store";
|
|
780
816
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
781
817
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
782
|
-
import { log as
|
|
818
|
+
import { log as log5 } from "@dxos/log";
|
|
783
819
|
import { AdmittedFeed } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
784
820
|
import { Timeframe } from "@dxos/timeframe";
|
|
785
821
|
import { trace } from "@dxos/tracing";
|
|
@@ -788,8 +824,8 @@ import { ComplexSet } from "@dxos/util";
|
|
|
788
824
|
// packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts
|
|
789
825
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
790
826
|
import { SpaceId } from "@dxos/keys";
|
|
791
|
-
import { log as
|
|
792
|
-
var
|
|
827
|
+
import { log as log4 } from "@dxos/log";
|
|
828
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
793
829
|
var DefaultSpaceStateMachine = class {
|
|
794
830
|
constructor(_params) {
|
|
795
831
|
this._params = _params;
|
|
@@ -802,11 +838,11 @@ var DefaultSpaceStateMachine = class {
|
|
|
802
838
|
switch (assertion["@type"]) {
|
|
803
839
|
case "dxos.halo.credentials.DefaultSpace": {
|
|
804
840
|
if (!credential.subject.id.equals(this._params.identityKey)) {
|
|
805
|
-
|
|
841
|
+
log4.warn("Invalid default space credential", {
|
|
806
842
|
expectedIdentity: this._params.identityKey,
|
|
807
843
|
credential
|
|
808
844
|
}, {
|
|
809
|
-
F:
|
|
845
|
+
F: __dxlog_file6,
|
|
810
846
|
L: 32,
|
|
811
847
|
S: this,
|
|
812
848
|
C: (f, a) => f(...a)
|
|
@@ -814,10 +850,10 @@ var DefaultSpaceStateMachine = class {
|
|
|
814
850
|
return;
|
|
815
851
|
}
|
|
816
852
|
if (!SpaceId.isValid(assertion.spaceId)) {
|
|
817
|
-
|
|
853
|
+
log4.warn("Invalid default space id", {
|
|
818
854
|
id: assertion.spaceId
|
|
819
855
|
}, {
|
|
820
|
-
F:
|
|
856
|
+
F: __dxlog_file6,
|
|
821
857
|
L: 36,
|
|
822
858
|
S: this,
|
|
823
859
|
C: (f, a) => f(...a)
|
|
@@ -842,7 +878,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
842
878
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
843
879
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
844
880
|
}
|
|
845
|
-
var
|
|
881
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
846
882
|
var Identity = class {
|
|
847
883
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
848
884
|
this.stateUpdate = new Event();
|
|
@@ -851,10 +887,10 @@ var Identity = class {
|
|
|
851
887
|
this._presence = presence;
|
|
852
888
|
this.identityKey = identityKey;
|
|
853
889
|
this.deviceKey = deviceKey;
|
|
854
|
-
|
|
890
|
+
log5.trace("dxos.halo.device", {
|
|
855
891
|
deviceKey
|
|
856
892
|
}, {
|
|
857
|
-
F:
|
|
893
|
+
F: __dxlog_file7,
|
|
858
894
|
L: 70,
|
|
859
895
|
S: this,
|
|
860
896
|
C: (f, a) => f(...a)
|
|
@@ -933,7 +969,7 @@ var Identity = class {
|
|
|
933
969
|
*/
|
|
934
970
|
getIdentityCredentialSigner() {
|
|
935
971
|
invariant2(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
936
|
-
F:
|
|
972
|
+
F: __dxlog_file7,
|
|
937
973
|
L: 159,
|
|
938
974
|
S: this,
|
|
939
975
|
A: [
|
|
@@ -970,14 +1006,14 @@ var Identity = class {
|
|
|
970
1006
|
]));
|
|
971
1007
|
}
|
|
972
1008
|
async admitDevice({ deviceKey, controlFeedKey, dataFeedKey }) {
|
|
973
|
-
|
|
1009
|
+
log5("Admitting device:", {
|
|
974
1010
|
identityKey: this.identityKey,
|
|
975
1011
|
hostDevice: this.deviceKey,
|
|
976
1012
|
deviceKey,
|
|
977
1013
|
controlFeedKey,
|
|
978
1014
|
dataFeedKey
|
|
979
1015
|
}, {
|
|
980
|
-
F:
|
|
1016
|
+
F: __dxlog_file7,
|
|
981
1017
|
L: 184,
|
|
982
1018
|
S: this,
|
|
983
1019
|
C: (f, a) => f(...a)
|
|
@@ -1036,7 +1072,7 @@ import { Context as Context3 } from "@dxos/context";
|
|
|
1036
1072
|
import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
|
|
1037
1073
|
import { invariant as invariant3 } from "@dxos/invariant";
|
|
1038
1074
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1039
|
-
import { log as
|
|
1075
|
+
import { log as log6 } from "@dxos/log";
|
|
1040
1076
|
import { trace as trace2 } from "@dxos/protocols";
|
|
1041
1077
|
import { Device, DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
|
|
1042
1078
|
import { AdmittedFeed as AdmittedFeed2, DeviceType } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -1054,7 +1090,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
1054
1090
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1055
1091
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1056
1092
|
}
|
|
1057
|
-
var
|
|
1093
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1058
1094
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1059
1095
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1060
1096
|
var IdentityManager = class {
|
|
@@ -1076,19 +1112,19 @@ var IdentityManager = class {
|
|
|
1076
1112
|
}
|
|
1077
1113
|
async open(ctx) {
|
|
1078
1114
|
const traceId = PublicKey4.random().toHex();
|
|
1079
|
-
|
|
1115
|
+
log6.trace("dxos.halo.identity-manager.open", trace2.begin({
|
|
1080
1116
|
id: traceId
|
|
1081
1117
|
}), {
|
|
1082
|
-
F:
|
|
1118
|
+
F: __dxlog_file8,
|
|
1083
1119
|
L: 107,
|
|
1084
1120
|
S: this,
|
|
1085
1121
|
C: (f, a) => f(...a)
|
|
1086
1122
|
});
|
|
1087
1123
|
const identityRecord = this._metadataStore.getIdentityRecord();
|
|
1088
|
-
|
|
1124
|
+
log6("identity record", {
|
|
1089
1125
|
identityRecord
|
|
1090
1126
|
}, {
|
|
1091
|
-
F:
|
|
1127
|
+
F: __dxlog_file8,
|
|
1092
1128
|
L: 110,
|
|
1093
1129
|
S: this,
|
|
1094
1130
|
C: (f, a) => f(...a)
|
|
@@ -1097,21 +1133,21 @@ var IdentityManager = class {
|
|
|
1097
1133
|
this._identity = await this._constructIdentity(identityRecord);
|
|
1098
1134
|
await this._identity.open(ctx);
|
|
1099
1135
|
await this._identity.ready();
|
|
1100
|
-
|
|
1136
|
+
log6.trace("dxos.halo.identity", {
|
|
1101
1137
|
identityKey: identityRecord.identityKey,
|
|
1102
1138
|
displayName: this._identity.profileDocument?.displayName
|
|
1103
1139
|
}, {
|
|
1104
|
-
F:
|
|
1140
|
+
F: __dxlog_file8,
|
|
1105
1141
|
L: 115,
|
|
1106
1142
|
S: this,
|
|
1107
1143
|
C: (f, a) => f(...a)
|
|
1108
1144
|
});
|
|
1109
1145
|
this.stateUpdate.emit();
|
|
1110
1146
|
}
|
|
1111
|
-
|
|
1147
|
+
log6.trace("dxos.halo.identity-manager.open", trace2.end({
|
|
1112
1148
|
id: traceId
|
|
1113
1149
|
}), {
|
|
1114
|
-
F:
|
|
1150
|
+
F: __dxlog_file8,
|
|
1115
1151
|
L: 122,
|
|
1116
1152
|
S: this,
|
|
1117
1153
|
C: (f, a) => f(...a)
|
|
@@ -1119,13 +1155,13 @@ var IdentityManager = class {
|
|
|
1119
1155
|
}
|
|
1120
1156
|
async close() {
|
|
1121
1157
|
await this._identity?.close(new Context3(void 0, {
|
|
1122
|
-
F:
|
|
1158
|
+
F: __dxlog_file8,
|
|
1123
1159
|
L: 126
|
|
1124
1160
|
}));
|
|
1125
1161
|
}
|
|
1126
1162
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1127
1163
|
invariant3(!this._identity, "Identity already exists.", {
|
|
1128
|
-
F:
|
|
1164
|
+
F: __dxlog_file8,
|
|
1129
1165
|
L: 131,
|
|
1130
1166
|
S: this,
|
|
1131
1167
|
A: [
|
|
@@ -1133,8 +1169,8 @@ var IdentityManager = class {
|
|
|
1133
1169
|
"'Identity already exists.'"
|
|
1134
1170
|
]
|
|
1135
1171
|
});
|
|
1136
|
-
|
|
1137
|
-
F:
|
|
1172
|
+
log6("creating identity...", void 0, {
|
|
1173
|
+
F: __dxlog_file8,
|
|
1138
1174
|
L: 132,
|
|
1139
1175
|
S: this,
|
|
1140
1176
|
C: (f, a) => f(...a)
|
|
@@ -1152,13 +1188,13 @@ var IdentityManager = class {
|
|
|
1152
1188
|
};
|
|
1153
1189
|
const identity = await this._constructIdentity(identityRecord);
|
|
1154
1190
|
await identity.open(new Context3(void 0, {
|
|
1155
|
-
F:
|
|
1191
|
+
F: __dxlog_file8,
|
|
1156
1192
|
L: 147
|
|
1157
1193
|
}));
|
|
1158
1194
|
{
|
|
1159
1195
|
const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1160
1196
|
invariant3(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1161
|
-
F:
|
|
1197
|
+
F: __dxlog_file8,
|
|
1162
1198
|
L: 151,
|
|
1163
1199
|
S: this,
|
|
1164
1200
|
A: [
|
|
@@ -1167,7 +1203,7 @@ var IdentityManager = class {
|
|
|
1167
1203
|
]
|
|
1168
1204
|
});
|
|
1169
1205
|
invariant3(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1170
|
-
F:
|
|
1206
|
+
F: __dxlog_file8,
|
|
1171
1207
|
L: 152,
|
|
1172
1208
|
S: this,
|
|
1173
1209
|
A: [
|
|
@@ -1202,22 +1238,22 @@ var IdentityManager = class {
|
|
|
1202
1238
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1203
1239
|
this._identity = identity;
|
|
1204
1240
|
await this._identity.ready();
|
|
1205
|
-
|
|
1241
|
+
log6.trace("dxos.halo.identity", {
|
|
1206
1242
|
identityKey: identityRecord.identityKey,
|
|
1207
1243
|
displayName: this._identity.profileDocument?.displayName
|
|
1208
1244
|
}, {
|
|
1209
|
-
F:
|
|
1245
|
+
F: __dxlog_file8,
|
|
1210
1246
|
L: 194,
|
|
1211
1247
|
S: this,
|
|
1212
1248
|
C: (f, a) => f(...a)
|
|
1213
1249
|
});
|
|
1214
1250
|
this.stateUpdate.emit();
|
|
1215
|
-
|
|
1251
|
+
log6("created identity", {
|
|
1216
1252
|
identityKey: identity.identityKey,
|
|
1217
1253
|
deviceKey: identity.deviceKey,
|
|
1218
1254
|
profile: identity.profileDocument
|
|
1219
1255
|
}, {
|
|
1220
|
-
F:
|
|
1256
|
+
F: __dxlog_file8,
|
|
1221
1257
|
L: 200,
|
|
1222
1258
|
S: this,
|
|
1223
1259
|
C: (f, a) => f(...a)
|
|
@@ -1251,16 +1287,16 @@ var IdentityManager = class {
|
|
|
1251
1287
|
* Accept an existing identity. Expects its device key to be authorized (now or later).
|
|
1252
1288
|
*/
|
|
1253
1289
|
async acceptIdentity(params) {
|
|
1254
|
-
|
|
1290
|
+
log6("accepting identity", {
|
|
1255
1291
|
params
|
|
1256
1292
|
}, {
|
|
1257
|
-
F:
|
|
1293
|
+
F: __dxlog_file8,
|
|
1258
1294
|
L: 238,
|
|
1259
1295
|
S: this,
|
|
1260
1296
|
C: (f, a) => f(...a)
|
|
1261
1297
|
});
|
|
1262
1298
|
invariant3(!this._identity, "Identity already exists.", {
|
|
1263
|
-
F:
|
|
1299
|
+
F: __dxlog_file8,
|
|
1264
1300
|
L: 239,
|
|
1265
1301
|
S: this,
|
|
1266
1302
|
A: [
|
|
@@ -1281,17 +1317,17 @@ var IdentityManager = class {
|
|
|
1281
1317
|
};
|
|
1282
1318
|
const identity = await this._constructIdentity(identityRecord);
|
|
1283
1319
|
await identity.open(new Context3(void 0, {
|
|
1284
|
-
F:
|
|
1320
|
+
F: __dxlog_file8,
|
|
1285
1321
|
L: 254
|
|
1286
1322
|
}));
|
|
1287
1323
|
this._identity = identity;
|
|
1288
1324
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1289
1325
|
await this._identity.ready();
|
|
1290
|
-
|
|
1326
|
+
log6.trace("dxos.halo.identity", {
|
|
1291
1327
|
identityKey: identityRecord.identityKey,
|
|
1292
1328
|
displayName: this._identity.profileDocument?.displayName
|
|
1293
1329
|
}, {
|
|
1294
|
-
F:
|
|
1330
|
+
F: __dxlog_file8,
|
|
1295
1331
|
L: 258,
|
|
1296
1332
|
S: this,
|
|
1297
1333
|
C: (f, a) => f(...a)
|
|
@@ -1301,11 +1337,11 @@ var IdentityManager = class {
|
|
|
1301
1337
|
...params.deviceProfile
|
|
1302
1338
|
});
|
|
1303
1339
|
this.stateUpdate.emit();
|
|
1304
|
-
|
|
1340
|
+
log6("accepted identity", {
|
|
1305
1341
|
identityKey: identity.identityKey,
|
|
1306
1342
|
deviceKey: identity.deviceKey
|
|
1307
1343
|
}, {
|
|
1308
|
-
F:
|
|
1344
|
+
F: __dxlog_file8,
|
|
1309
1345
|
L: 268,
|
|
1310
1346
|
S: this,
|
|
1311
1347
|
C: (f, a) => f(...a)
|
|
@@ -1317,7 +1353,7 @@ var IdentityManager = class {
|
|
|
1317
1353
|
*/
|
|
1318
1354
|
async updateProfile(profile) {
|
|
1319
1355
|
invariant3(this._identity, "Identity not initialized.", {
|
|
1320
|
-
F:
|
|
1356
|
+
F: __dxlog_file8,
|
|
1321
1357
|
L: 276,
|
|
1322
1358
|
S: this,
|
|
1323
1359
|
A: [
|
|
@@ -1348,7 +1384,7 @@ var IdentityManager = class {
|
|
|
1348
1384
|
}
|
|
1349
1385
|
async updateDeviceProfile(profile) {
|
|
1350
1386
|
invariant3(this._identity, "Identity not initialized.", {
|
|
1351
|
-
F:
|
|
1387
|
+
F: __dxlog_file8,
|
|
1352
1388
|
L: 293,
|
|
1353
1389
|
S: this,
|
|
1354
1390
|
A: [
|
|
@@ -1384,7 +1420,7 @@ var IdentityManager = class {
|
|
|
1384
1420
|
}
|
|
1385
1421
|
async _constructIdentity(identityRecord) {
|
|
1386
1422
|
invariant3(!this._identity, void 0, {
|
|
1387
|
-
F:
|
|
1423
|
+
F: __dxlog_file8,
|
|
1388
1424
|
L: 319,
|
|
1389
1425
|
S: this,
|
|
1390
1426
|
A: [
|
|
@@ -1392,10 +1428,10 @@ var IdentityManager = class {
|
|
|
1392
1428
|
""
|
|
1393
1429
|
]
|
|
1394
1430
|
});
|
|
1395
|
-
|
|
1431
|
+
log6("constructing identity", {
|
|
1396
1432
|
identityRecord
|
|
1397
1433
|
}, {
|
|
1398
|
-
F:
|
|
1434
|
+
F: __dxlog_file8,
|
|
1399
1435
|
L: 320,
|
|
1400
1436
|
S: this,
|
|
1401
1437
|
C: (f, a) => f(...a)
|
|
@@ -1410,7 +1446,7 @@ var IdentityManager = class {
|
|
|
1410
1446
|
gossip
|
|
1411
1447
|
});
|
|
1412
1448
|
invariant3(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1413
|
-
F:
|
|
1449
|
+
F: __dxlog_file8,
|
|
1414
1450
|
L: 333,
|
|
1415
1451
|
S: this,
|
|
1416
1452
|
A: [
|
|
@@ -1422,7 +1458,7 @@ var IdentityManager = class {
|
|
|
1422
1458
|
writable: true
|
|
1423
1459
|
});
|
|
1424
1460
|
invariant3(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1425
|
-
F:
|
|
1461
|
+
F: __dxlog_file8,
|
|
1426
1462
|
L: 337,
|
|
1427
1463
|
S: this,
|
|
1428
1464
|
A: [
|
|
@@ -1454,10 +1490,10 @@ var IdentityManager = class {
|
|
|
1454
1490
|
identityKey: identityRecord.identityKey,
|
|
1455
1491
|
deviceKey: identityRecord.deviceKey
|
|
1456
1492
|
});
|
|
1457
|
-
|
|
1493
|
+
log6("done", {
|
|
1458
1494
|
identityKey: identityRecord.identityKey
|
|
1459
1495
|
}, {
|
|
1460
|
-
F:
|
|
1496
|
+
F: __dxlog_file8,
|
|
1461
1497
|
L: 364,
|
|
1462
1498
|
S: this,
|
|
1463
1499
|
C: (f, a) => f(...a)
|
|
@@ -1482,8 +1518,8 @@ var IdentityManager = class {
|
|
|
1482
1518
|
}));
|
|
1483
1519
|
},
|
|
1484
1520
|
onAuthFailure: () => {
|
|
1485
|
-
|
|
1486
|
-
F:
|
|
1521
|
+
log6.warn("auth failure", void 0, {
|
|
1522
|
+
F: __dxlog_file8,
|
|
1487
1523
|
L: 390,
|
|
1488
1524
|
S: this,
|
|
1489
1525
|
C: (f, a) => f(...a)
|
|
@@ -1513,10 +1549,10 @@ import { Resource } from "@dxos/context";
|
|
|
1513
1549
|
import { signPresentation } from "@dxos/credentials";
|
|
1514
1550
|
import { todo } from "@dxos/debug";
|
|
1515
1551
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1516
|
-
import { log as
|
|
1552
|
+
import { log as log7 } from "@dxos/log";
|
|
1517
1553
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
1518
1554
|
import { safeAwaitAll } from "@dxos/util";
|
|
1519
|
-
var
|
|
1555
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1520
1556
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1521
1557
|
var IdentityServiceImpl = class extends Resource {
|
|
1522
1558
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1546,7 +1582,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1546
1582
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1547
1583
|
const identity = this._identityManager.identity;
|
|
1548
1584
|
invariant4(identity, void 0, {
|
|
1549
|
-
F:
|
|
1585
|
+
F: __dxlog_file9,
|
|
1550
1586
|
L: 59,
|
|
1551
1587
|
S: this,
|
|
1552
1588
|
A: [
|
|
@@ -1580,7 +1616,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1580
1616
|
}
|
|
1581
1617
|
async updateProfile(profile) {
|
|
1582
1618
|
invariant4(this._identityManager.identity, "Identity not initialized.", {
|
|
1583
|
-
F:
|
|
1619
|
+
F: __dxlog_file9,
|
|
1584
1620
|
L: 89,
|
|
1585
1621
|
S: this,
|
|
1586
1622
|
A: [
|
|
@@ -1595,7 +1631,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1595
1631
|
// TODO(burdon): Rename createPresentation?
|
|
1596
1632
|
async signPresentation({ presentation, nonce }) {
|
|
1597
1633
|
invariant4(this._identityManager.identity, "Identity not initialized.", {
|
|
1598
|
-
F:
|
|
1634
|
+
F: __dxlog_file9,
|
|
1599
1635
|
L: 97,
|
|
1600
1636
|
S: this,
|
|
1601
1637
|
A: [
|
|
@@ -1627,10 +1663,10 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1627
1663
|
}
|
|
1628
1664
|
if (await dataSpaceManager.isDefaultSpace(space)) {
|
|
1629
1665
|
if (foundDefaultSpace) {
|
|
1630
|
-
|
|
1666
|
+
log7.warn("Multiple default spaces found. Using the first one.", {
|
|
1631
1667
|
duplicate: space.id
|
|
1632
1668
|
}, {
|
|
1633
|
-
F:
|
|
1669
|
+
F: __dxlog_file9,
|
|
1634
1670
|
L: 130,
|
|
1635
1671
|
S: this,
|
|
1636
1672
|
C: (f, a) => f(...a)
|
|
@@ -1643,8 +1679,8 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1643
1679
|
recordedDefaultSpaceTrigger.wake();
|
|
1644
1680
|
}
|
|
1645
1681
|
}, (err) => {
|
|
1646
|
-
|
|
1647
|
-
F:
|
|
1682
|
+
log7.catch(err, void 0, {
|
|
1683
|
+
F: __dxlog_file9,
|
|
1648
1684
|
L: 141,
|
|
1649
1685
|
S: this,
|
|
1650
1686
|
C: (f, a) => f(...a)
|
|
@@ -1665,7 +1701,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1665
1701
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1666
1702
|
import { AlreadyJoinedError } from "@dxos/protocols";
|
|
1667
1703
|
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
1668
|
-
var
|
|
1704
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1669
1705
|
var DeviceInvitationProtocol = class {
|
|
1670
1706
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1671
1707
|
this._keyring = _keyring;
|
|
@@ -1691,7 +1727,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1691
1727
|
}
|
|
1692
1728
|
async admit(_, request) {
|
|
1693
1729
|
invariant5(request.device, void 0, {
|
|
1694
|
-
F:
|
|
1730
|
+
F: __dxlog_file10,
|
|
1695
1731
|
L: 50,
|
|
1696
1732
|
S: this,
|
|
1697
1733
|
A: [
|
|
@@ -1737,7 +1773,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1737
1773
|
}
|
|
1738
1774
|
async accept(response, request) {
|
|
1739
1775
|
invariant5(response.device, void 0, {
|
|
1740
|
-
F:
|
|
1776
|
+
F: __dxlog_file10,
|
|
1741
1777
|
L: 95,
|
|
1742
1778
|
S: this,
|
|
1743
1779
|
A: [
|
|
@@ -1747,7 +1783,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1747
1783
|
});
|
|
1748
1784
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1749
1785
|
invariant5(request.device, void 0, {
|
|
1750
|
-
F:
|
|
1786
|
+
F: __dxlog_file10,
|
|
1751
1787
|
L: 98,
|
|
1752
1788
|
S: this,
|
|
1753
1789
|
A: [
|
|
@@ -1779,7 +1815,7 @@ import { ContextDisposedError as ContextDisposedError2 } from "@dxos/context";
|
|
|
1779
1815
|
import { createKeyPair, sign } from "@dxos/crypto";
|
|
1780
1816
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
1781
1817
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
1782
|
-
import { log as
|
|
1818
|
+
import { log as log11 } from "@dxos/log";
|
|
1783
1819
|
import { createTeleportProtocolFactory } from "@dxos/network-manager";
|
|
1784
1820
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace4 } from "@dxos/protocols";
|
|
1785
1821
|
import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -1792,7 +1828,7 @@ import { ComplexSet as ComplexSet3 } from "@dxos/util";
|
|
|
1792
1828
|
import { Trigger as Trigger4 } from "@dxos/async";
|
|
1793
1829
|
import { cancelWithContext as cancelWithContext2, Context as Context4 } from "@dxos/context";
|
|
1794
1830
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1795
|
-
import { log as
|
|
1831
|
+
import { log as log8 } from "@dxos/log";
|
|
1796
1832
|
import { InvalidInvitationExtensionRoleError, schema as schema2 } from "@dxos/protocols";
|
|
1797
1833
|
import { InvitationOptions } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1798
1834
|
import { RpcExtension } from "@dxos/teleport";
|
|
@@ -1817,7 +1853,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1817
1853
|
};
|
|
1818
1854
|
|
|
1819
1855
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
1820
|
-
var
|
|
1856
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1821
1857
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1822
1858
|
var InvitationGuestExtension = class extends RpcExtension {
|
|
1823
1859
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1832,7 +1868,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1832
1868
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1833
1869
|
this._callbacks = _callbacks;
|
|
1834
1870
|
this._ctx = new Context4(void 0, {
|
|
1835
|
-
F:
|
|
1871
|
+
F: __dxlog_file11,
|
|
1836
1872
|
L: 33
|
|
1837
1873
|
});
|
|
1838
1874
|
this._remoteOptionsTrigger = new Trigger4();
|
|
@@ -1846,7 +1882,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1846
1882
|
InvitationHostService: {
|
|
1847
1883
|
options: async (options) => {
|
|
1848
1884
|
invariant6(!this._remoteOptions, "Remote options already set.", {
|
|
1849
|
-
F:
|
|
1885
|
+
F: __dxlog_file11,
|
|
1850
1886
|
L: 63,
|
|
1851
1887
|
S: this,
|
|
1852
1888
|
A: [
|
|
@@ -1872,15 +1908,15 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1872
1908
|
async onOpen(context) {
|
|
1873
1909
|
await super.onOpen(context);
|
|
1874
1910
|
try {
|
|
1875
|
-
|
|
1876
|
-
F:
|
|
1911
|
+
log8("guest acquire lock", void 0, {
|
|
1912
|
+
F: __dxlog_file11,
|
|
1877
1913
|
L: 84,
|
|
1878
1914
|
S: this,
|
|
1879
1915
|
C: (f, a) => f(...a)
|
|
1880
1916
|
});
|
|
1881
1917
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1882
|
-
|
|
1883
|
-
F:
|
|
1918
|
+
log8("guest lock acquired", void 0, {
|
|
1919
|
+
F: __dxlog_file11,
|
|
1884
1920
|
L: 86,
|
|
1885
1921
|
S: this,
|
|
1886
1922
|
C: (f, a) => f(...a)
|
|
@@ -1888,8 +1924,8 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1888
1924
|
await cancelWithContext2(this._ctx, this.rpc.InvitationHostService.options({
|
|
1889
1925
|
role: InvitationOptions.Role.GUEST
|
|
1890
1926
|
}));
|
|
1891
|
-
|
|
1892
|
-
F:
|
|
1927
|
+
log8("options sent", void 0, {
|
|
1928
|
+
F: __dxlog_file11,
|
|
1893
1929
|
L: 91,
|
|
1894
1930
|
S: this,
|
|
1895
1931
|
C: (f, a) => f(...a)
|
|
@@ -1897,8 +1933,8 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1897
1933
|
await cancelWithContext2(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1898
1934
|
timeout: OPTIONS_TIMEOUT
|
|
1899
1935
|
}));
|
|
1900
|
-
|
|
1901
|
-
F:
|
|
1936
|
+
log8("options received", void 0, {
|
|
1937
|
+
F: __dxlog_file11,
|
|
1902
1938
|
L: 93,
|
|
1903
1939
|
S: this,
|
|
1904
1940
|
C: (f, a) => f(...a)
|
|
@@ -1931,8 +1967,8 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1931
1967
|
if (this._invitationFlowLock != null) {
|
|
1932
1968
|
this._invitationFlowLock.release();
|
|
1933
1969
|
this._invitationFlowLock = null;
|
|
1934
|
-
|
|
1935
|
-
F:
|
|
1970
|
+
log8("invitation flow lock released", void 0, {
|
|
1971
|
+
F: __dxlog_file11,
|
|
1936
1972
|
L: 126,
|
|
1937
1973
|
S: this,
|
|
1938
1974
|
C: (f, a) => f(...a)
|
|
@@ -1947,12 +1983,12 @@ import { cancelWithContext as cancelWithContext3, Context as Context5 } from "@d
|
|
|
1947
1983
|
import { randomBytes, verify } from "@dxos/crypto";
|
|
1948
1984
|
import { invariant as invariant7, InvariantViolation } from "@dxos/invariant";
|
|
1949
1985
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1950
|
-
import { log as
|
|
1986
|
+
import { log as log9 } from "@dxos/log";
|
|
1951
1987
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, schema as schema3, trace as trace3 } from "@dxos/protocols";
|
|
1952
1988
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1953
1989
|
import { AuthenticationResponse, InvitationOptions as InvitationOptions2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1954
1990
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1955
|
-
var
|
|
1991
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
1956
1992
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
1957
1993
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1958
1994
|
var InvitationHostExtension = class extends RpcExtension2 {
|
|
@@ -1968,7 +2004,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1968
2004
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1969
2005
|
this._callbacks = _callbacks;
|
|
1970
2006
|
this._ctx = new Context5(void 0, {
|
|
1971
|
-
F:
|
|
2007
|
+
F: __dxlog_file12,
|
|
1972
2008
|
L: 52
|
|
1973
2009
|
});
|
|
1974
2010
|
this._remoteOptionsTrigger = new Trigger5();
|
|
@@ -1989,7 +2025,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1989
2025
|
InvitationHostService: {
|
|
1990
2026
|
options: async (options) => {
|
|
1991
2027
|
invariant7(!this._remoteOptions, "Remote options already set.", {
|
|
1992
|
-
F:
|
|
2028
|
+
F: __dxlog_file12,
|
|
1993
2029
|
L: 101,
|
|
1994
2030
|
S: this,
|
|
1995
2031
|
A: [
|
|
@@ -2003,10 +2039,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2003
2039
|
introduce: async (request) => {
|
|
2004
2040
|
const { profile, invitationId } = request;
|
|
2005
2041
|
const traceId = PublicKey5.random().toHex();
|
|
2006
|
-
|
|
2042
|
+
log9.trace("dxos.sdk.invitation-handler.host.introduce", trace3.begin({
|
|
2007
2043
|
id: traceId
|
|
2008
2044
|
}), {
|
|
2009
|
-
F:
|
|
2045
|
+
F: __dxlog_file12,
|
|
2010
2046
|
L: 110,
|
|
2011
2047
|
S: this,
|
|
2012
2048
|
C: (f, a) => f(...a)
|
|
@@ -2014,11 +2050,11 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2014
2050
|
const invitation = this._requireActiveInvitation();
|
|
2015
2051
|
this._assertInvitationState(Invitation3.State.CONNECTED);
|
|
2016
2052
|
if (invitationId !== invitation?.invitationId) {
|
|
2017
|
-
|
|
2053
|
+
log9.warn("incorrect invitationId", {
|
|
2018
2054
|
expected: invitation.invitationId,
|
|
2019
2055
|
actual: invitationId
|
|
2020
2056
|
}, {
|
|
2021
|
-
F:
|
|
2057
|
+
F: __dxlog_file12,
|
|
2022
2058
|
L: 116,
|
|
2023
2059
|
S: this,
|
|
2024
2060
|
C: (f, a) => f(...a)
|
|
@@ -2029,10 +2065,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2029
2065
|
authMethod: Invitation3.AuthMethod.NONE
|
|
2030
2066
|
};
|
|
2031
2067
|
}
|
|
2032
|
-
|
|
2068
|
+
log9("guest introduced themselves", {
|
|
2033
2069
|
guestProfile: profile
|
|
2034
2070
|
}, {
|
|
2035
|
-
F:
|
|
2071
|
+
F: __dxlog_file12,
|
|
2036
2072
|
L: 125,
|
|
2037
2073
|
S: this,
|
|
2038
2074
|
C: (f, a) => f(...a)
|
|
@@ -2040,10 +2076,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2040
2076
|
this.guestProfile = profile;
|
|
2041
2077
|
this._callbacks.onStateUpdate(Invitation3.State.READY_FOR_AUTHENTICATION);
|
|
2042
2078
|
this._challenge = invitation.authMethod === Invitation3.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
|
|
2043
|
-
|
|
2079
|
+
log9.trace("dxos.sdk.invitation-handler.host.introduce", trace3.end({
|
|
2044
2080
|
id: traceId
|
|
2045
2081
|
}), {
|
|
2046
|
-
F:
|
|
2082
|
+
F: __dxlog_file12,
|
|
2047
2083
|
L: 132,
|
|
2048
2084
|
S: this,
|
|
2049
2085
|
C: (f, a) => f(...a)
|
|
@@ -2055,19 +2091,19 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2055
2091
|
},
|
|
2056
2092
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2057
2093
|
const traceId = PublicKey5.random().toHex();
|
|
2058
|
-
|
|
2094
|
+
log9.trace("dxos.sdk.invitation-handler.host.authenticate", trace3.begin({
|
|
2059
2095
|
id: traceId
|
|
2060
2096
|
}), {
|
|
2061
|
-
F:
|
|
2097
|
+
F: __dxlog_file12,
|
|
2062
2098
|
L: 141,
|
|
2063
2099
|
S: this,
|
|
2064
2100
|
C: (f, a) => f(...a)
|
|
2065
2101
|
});
|
|
2066
2102
|
const invitation = this._requireActiveInvitation();
|
|
2067
|
-
|
|
2103
|
+
log9("received authentication request", {
|
|
2068
2104
|
authCode: code
|
|
2069
2105
|
}, {
|
|
2070
|
-
F:
|
|
2106
|
+
F: __dxlog_file12,
|
|
2071
2107
|
L: 144,
|
|
2072
2108
|
S: this,
|
|
2073
2109
|
C: (f, a) => f(...a)
|
|
@@ -2080,8 +2116,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2080
2116
|
this._callbacks.onStateUpdate(Invitation3.State.AUTHENTICATING);
|
|
2081
2117
|
switch (invitation.authMethod) {
|
|
2082
2118
|
case Invitation3.AuthMethod.NONE: {
|
|
2083
|
-
|
|
2084
|
-
F:
|
|
2119
|
+
log9("authentication not required", void 0, {
|
|
2120
|
+
F: __dxlog_file12,
|
|
2085
2121
|
L: 152,
|
|
2086
2122
|
S: this,
|
|
2087
2123
|
C: (f, a) => f(...a)
|
|
@@ -2116,10 +2152,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2116
2152
|
break;
|
|
2117
2153
|
}
|
|
2118
2154
|
default: {
|
|
2119
|
-
|
|
2155
|
+
log9.error("invalid authentication method", {
|
|
2120
2156
|
authMethod: invitation.authMethod
|
|
2121
2157
|
}, {
|
|
2122
|
-
F:
|
|
2158
|
+
F: __dxlog_file12,
|
|
2123
2159
|
L: 190,
|
|
2124
2160
|
S: this,
|
|
2125
2161
|
C: (f, a) => f(...a)
|
|
@@ -2138,13 +2174,13 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2138
2174
|
status
|
|
2139
2175
|
};
|
|
2140
2176
|
}
|
|
2141
|
-
|
|
2177
|
+
log9.trace("dxos.sdk.invitation-handler.host.authenticate", trace3.end({
|
|
2142
2178
|
id: traceId,
|
|
2143
2179
|
data: {
|
|
2144
2180
|
status
|
|
2145
2181
|
}
|
|
2146
2182
|
}), {
|
|
2147
|
-
F:
|
|
2183
|
+
F: __dxlog_file12,
|
|
2148
2184
|
L: 202,
|
|
2149
2185
|
S: this,
|
|
2150
2186
|
C: (f, a) => f(...a)
|
|
@@ -2155,10 +2191,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2155
2191
|
},
|
|
2156
2192
|
admit: async (request) => {
|
|
2157
2193
|
const traceId = PublicKey5.random().toHex();
|
|
2158
|
-
|
|
2194
|
+
log9.trace("dxos.sdk.invitation-handler.host.admit", trace3.begin({
|
|
2159
2195
|
id: traceId
|
|
2160
2196
|
}), {
|
|
2161
|
-
F:
|
|
2197
|
+
F: __dxlog_file12,
|
|
2162
2198
|
L: 208,
|
|
2163
2199
|
S: this,
|
|
2164
2200
|
C: (f, a) => f(...a)
|
|
@@ -2172,10 +2208,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2172
2208
|
}
|
|
2173
2209
|
}
|
|
2174
2210
|
const response = await this._callbacks.admit(request);
|
|
2175
|
-
|
|
2211
|
+
log9.trace("dxos.sdk.invitation-handler.host.admit", trace3.end({
|
|
2176
2212
|
id: traceId
|
|
2177
2213
|
}), {
|
|
2178
|
-
F:
|
|
2214
|
+
F: __dxlog_file12,
|
|
2179
2215
|
L: 222,
|
|
2180
2216
|
S: this,
|
|
2181
2217
|
C: (f, a) => f(...a)
|
|
@@ -2192,15 +2228,15 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2192
2228
|
async onOpen(context) {
|
|
2193
2229
|
await super.onOpen(context);
|
|
2194
2230
|
try {
|
|
2195
|
-
|
|
2196
|
-
F:
|
|
2231
|
+
log9("host acquire lock", void 0, {
|
|
2232
|
+
F: __dxlog_file12,
|
|
2197
2233
|
L: 237,
|
|
2198
2234
|
S: this,
|
|
2199
2235
|
C: (f, a) => f(...a)
|
|
2200
2236
|
});
|
|
2201
2237
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2202
|
-
|
|
2203
|
-
F:
|
|
2238
|
+
log9("host lock acquired", void 0, {
|
|
2239
|
+
F: __dxlog_file12,
|
|
2204
2240
|
L: 239,
|
|
2205
2241
|
S: this,
|
|
2206
2242
|
C: (f, a) => f(...a)
|
|
@@ -2210,8 +2246,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2210
2246
|
await this.rpc.InvitationHostService.options({
|
|
2211
2247
|
role: InvitationOptions2.Role.HOST
|
|
2212
2248
|
});
|
|
2213
|
-
|
|
2214
|
-
F:
|
|
2249
|
+
log9("options sent", void 0, {
|
|
2250
|
+
F: __dxlog_file12,
|
|
2215
2251
|
L: 243,
|
|
2216
2252
|
S: this,
|
|
2217
2253
|
C: (f, a) => f(...a)
|
|
@@ -2219,8 +2255,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2219
2255
|
await cancelWithContext3(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2220
2256
|
timeout: OPTIONS_TIMEOUT2
|
|
2221
2257
|
}));
|
|
2222
|
-
|
|
2223
|
-
F:
|
|
2258
|
+
log9("options received", void 0, {
|
|
2259
|
+
F: __dxlog_file12,
|
|
2224
2260
|
L: 245,
|
|
2225
2261
|
S: this,
|
|
2226
2262
|
C: (f, a) => f(...a)
|
|
@@ -2273,8 +2309,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2273
2309
|
if (this._invitationFlowLock != null) {
|
|
2274
2310
|
this._invitationFlowLock?.release();
|
|
2275
2311
|
this._invitationFlowLock = null;
|
|
2276
|
-
|
|
2277
|
-
F:
|
|
2312
|
+
log9("invitation flow lock released", void 0, {
|
|
2313
|
+
F: __dxlog_file12,
|
|
2278
2314
|
L: 300,
|
|
2279
2315
|
S: this,
|
|
2280
2316
|
C: (f, a) => f(...a)
|
|
@@ -2287,10 +2323,10 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
|
|
|
2287
2323
|
// packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts
|
|
2288
2324
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2289
2325
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2290
|
-
import { log as
|
|
2326
|
+
import { log as log10 } from "@dxos/log";
|
|
2291
2327
|
import { InvitationOptions as InvitationOptions3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
2292
2328
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2293
|
-
var
|
|
2329
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2294
2330
|
var InvitationTopology = class {
|
|
2295
2331
|
constructor(_role) {
|
|
2296
2332
|
this._role = _role;
|
|
@@ -2298,7 +2334,7 @@ var InvitationTopology = class {
|
|
|
2298
2334
|
}
|
|
2299
2335
|
init(controller) {
|
|
2300
2336
|
invariant8(!this._controller, "Already initialized.", {
|
|
2301
|
-
F:
|
|
2337
|
+
F: __dxlog_file13,
|
|
2302
2338
|
L: 42,
|
|
2303
2339
|
S: this,
|
|
2304
2340
|
A: [
|
|
@@ -2310,7 +2346,7 @@ var InvitationTopology = class {
|
|
|
2310
2346
|
}
|
|
2311
2347
|
update() {
|
|
2312
2348
|
invariant8(this._controller, "Not initialized.", {
|
|
2313
|
-
F:
|
|
2349
|
+
F: __dxlog_file13,
|
|
2314
2350
|
L: 47,
|
|
2315
2351
|
S: this,
|
|
2316
2352
|
A: [
|
|
@@ -2329,11 +2365,11 @@ var InvitationTopology = class {
|
|
|
2329
2365
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2330
2366
|
this._seenPeers = new ComplexSet2(PublicKey6.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2331
2367
|
if (firstUnknownPeer != null) {
|
|
2332
|
-
|
|
2368
|
+
log10("invitation connect", {
|
|
2333
2369
|
ownPeerId,
|
|
2334
2370
|
remotePeerId: firstUnknownPeer
|
|
2335
2371
|
}, {
|
|
2336
|
-
F:
|
|
2372
|
+
F: __dxlog_file13,
|
|
2337
2373
|
L: 69,
|
|
2338
2374
|
S: this,
|
|
2339
2375
|
C: (f, a) => f(...a)
|
|
@@ -2344,7 +2380,7 @@ var InvitationTopology = class {
|
|
|
2344
2380
|
}
|
|
2345
2381
|
async onOffer(peer) {
|
|
2346
2382
|
invariant8(this._controller, "Not initialized.", {
|
|
2347
|
-
F:
|
|
2383
|
+
F: __dxlog_file13,
|
|
2348
2384
|
L: 76,
|
|
2349
2385
|
S: this,
|
|
2350
2386
|
A: [
|
|
@@ -2363,7 +2399,7 @@ var InvitationTopology = class {
|
|
|
2363
2399
|
};
|
|
2364
2400
|
|
|
2365
2401
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
2366
|
-
var
|
|
2402
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2367
2403
|
var metrics = _trace.metrics;
|
|
2368
2404
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2369
2405
|
var InvitationsHandler = class {
|
|
@@ -2390,7 +2426,7 @@ var InvitationsHandler = class {
|
|
|
2390
2426
|
try {
|
|
2391
2427
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2392
2428
|
invariant9(deviceKey, void 0, {
|
|
2393
|
-
F:
|
|
2429
|
+
F: __dxlog_file14,
|
|
2394
2430
|
L: 94,
|
|
2395
2431
|
S: this,
|
|
2396
2432
|
A: [
|
|
@@ -2416,18 +2452,18 @@ var InvitationsHandler = class {
|
|
|
2416
2452
|
scheduleTask3(connectionCtx, async () => {
|
|
2417
2453
|
const traceId = PublicKey7.random().toHex();
|
|
2418
2454
|
try {
|
|
2419
|
-
|
|
2455
|
+
log11.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.begin({
|
|
2420
2456
|
id: traceId
|
|
2421
2457
|
}), {
|
|
2422
|
-
F:
|
|
2458
|
+
F: __dxlog_file14,
|
|
2423
2459
|
L: 119,
|
|
2424
2460
|
S: this,
|
|
2425
2461
|
C: (f, a) => f(...a)
|
|
2426
2462
|
});
|
|
2427
|
-
|
|
2463
|
+
log11("connected", {
|
|
2428
2464
|
...protocol.toJSON()
|
|
2429
2465
|
}, {
|
|
2430
|
-
F:
|
|
2466
|
+
F: __dxlog_file14,
|
|
2431
2467
|
L: 120,
|
|
2432
2468
|
S: this,
|
|
2433
2469
|
C: (f, a) => f(...a)
|
|
@@ -2435,21 +2471,21 @@ var InvitationsHandler = class {
|
|
|
2435
2471
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2436
2472
|
timeout: invitation.timeout
|
|
2437
2473
|
});
|
|
2438
|
-
|
|
2474
|
+
log11("admitted guest", {
|
|
2439
2475
|
guest: deviceKey,
|
|
2440
2476
|
...protocol.toJSON()
|
|
2441
2477
|
}, {
|
|
2442
|
-
F:
|
|
2478
|
+
F: __dxlog_file14,
|
|
2443
2479
|
L: 122,
|
|
2444
2480
|
S: this,
|
|
2445
2481
|
C: (f, a) => f(...a)
|
|
2446
2482
|
});
|
|
2447
2483
|
guardedState.set(extension, Invitation4.State.SUCCESS);
|
|
2448
2484
|
metrics.increment("dxos.invitation.success");
|
|
2449
|
-
|
|
2485
|
+
log11.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.end({
|
|
2450
2486
|
id: traceId
|
|
2451
2487
|
}), {
|
|
2452
|
-
F:
|
|
2488
|
+
F: __dxlog_file14,
|
|
2453
2489
|
L: 125,
|
|
2454
2490
|
S: this,
|
|
2455
2491
|
C: (f, a) => f(...a)
|
|
@@ -2462,10 +2498,10 @@ var InvitationsHandler = class {
|
|
|
2462
2498
|
if (err instanceof TimeoutError) {
|
|
2463
2499
|
if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
|
|
2464
2500
|
metrics.increment("dxos.invitation.timeout");
|
|
2465
|
-
|
|
2501
|
+
log11("timeout", {
|
|
2466
2502
|
...protocol.toJSON()
|
|
2467
2503
|
}, {
|
|
2468
|
-
F:
|
|
2504
|
+
F: __dxlog_file14,
|
|
2469
2505
|
L: 135,
|
|
2470
2506
|
S: this,
|
|
2471
2507
|
C: (f, a) => f(...a)
|
|
@@ -2474,19 +2510,19 @@ var InvitationsHandler = class {
|
|
|
2474
2510
|
} else {
|
|
2475
2511
|
if (guardedState.error(extension, err)) {
|
|
2476
2512
|
metrics.increment("dxos.invitation.failed");
|
|
2477
|
-
|
|
2478
|
-
F:
|
|
2513
|
+
log11.error("failed", err, {
|
|
2514
|
+
F: __dxlog_file14,
|
|
2479
2515
|
L: 140,
|
|
2480
2516
|
S: this,
|
|
2481
2517
|
C: (f, a) => f(...a)
|
|
2482
2518
|
});
|
|
2483
2519
|
}
|
|
2484
2520
|
}
|
|
2485
|
-
|
|
2521
|
+
log11.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.error({
|
|
2486
2522
|
id: traceId,
|
|
2487
2523
|
error: err
|
|
2488
2524
|
}), {
|
|
2489
|
-
F:
|
|
2525
|
+
F: __dxlog_file14,
|
|
2490
2526
|
L: 143,
|
|
2491
2527
|
S: this,
|
|
2492
2528
|
C: (f, a) => f(...a)
|
|
@@ -2497,10 +2533,10 @@ var InvitationsHandler = class {
|
|
|
2497
2533
|
},
|
|
2498
2534
|
onError: (err) => {
|
|
2499
2535
|
if (err instanceof InvalidInvitationExtensionRoleError3) {
|
|
2500
|
-
|
|
2536
|
+
log11("invalid role", {
|
|
2501
2537
|
...err.context
|
|
2502
2538
|
}, {
|
|
2503
|
-
F:
|
|
2539
|
+
F: __dxlog_file14,
|
|
2504
2540
|
L: 151,
|
|
2505
2541
|
S: this,
|
|
2506
2542
|
C: (f, a) => f(...a)
|
|
@@ -2510,10 +2546,10 @@ var InvitationsHandler = class {
|
|
|
2510
2546
|
if (err instanceof TimeoutError) {
|
|
2511
2547
|
if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
|
|
2512
2548
|
metrics.increment("dxos.invitation.timeout");
|
|
2513
|
-
|
|
2549
|
+
log11("timeout", {
|
|
2514
2550
|
err
|
|
2515
2551
|
}, {
|
|
2516
|
-
F:
|
|
2552
|
+
F: __dxlog_file14,
|
|
2517
2553
|
L: 157,
|
|
2518
2554
|
S: this,
|
|
2519
2555
|
C: (f, a) => f(...a)
|
|
@@ -2522,8 +2558,8 @@ var InvitationsHandler = class {
|
|
|
2522
2558
|
} else {
|
|
2523
2559
|
if (guardedState.error(extension, err)) {
|
|
2524
2560
|
metrics.increment("dxos.invitation.failed");
|
|
2525
|
-
|
|
2526
|
-
F:
|
|
2561
|
+
log11.error("failed", err, {
|
|
2562
|
+
F: __dxlog_file14,
|
|
2527
2563
|
L: 162,
|
|
2528
2564
|
S: this,
|
|
2529
2565
|
C: (f, a) => f(...a)
|
|
@@ -2536,8 +2572,8 @@ var InvitationsHandler = class {
|
|
|
2536
2572
|
};
|
|
2537
2573
|
if (invitation.lifetime && invitation.created) {
|
|
2538
2574
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2539
|
-
|
|
2540
|
-
F:
|
|
2575
|
+
log11.warn("invitation has already expired", void 0, {
|
|
2576
|
+
F: __dxlog_file14,
|
|
2541
2577
|
L: 173,
|
|
2542
2578
|
S: this,
|
|
2543
2579
|
C: (f, a) => f(...a)
|
|
@@ -2561,7 +2597,7 @@ var InvitationsHandler = class {
|
|
|
2561
2597
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
2562
2598
|
if (deviceProfile) {
|
|
2563
2599
|
invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2564
|
-
F:
|
|
2600
|
+
F: __dxlog_file14,
|
|
2565
2601
|
L: 207,
|
|
2566
2602
|
S: this,
|
|
2567
2603
|
A: [
|
|
@@ -2574,12 +2610,12 @@ var InvitationsHandler = class {
|
|
|
2574
2610
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2575
2611
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2576
2612
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2577
|
-
|
|
2613
|
+
log11("should cancel invitation flow", {
|
|
2578
2614
|
isLockedByAnotherConnection,
|
|
2579
2615
|
invitationType: Invitation4.Type.DELEGATED,
|
|
2580
2616
|
triedPeers: triedPeersIds.size
|
|
2581
2617
|
}, {
|
|
2582
|
-
F:
|
|
2618
|
+
F: __dxlog_file14,
|
|
2583
2619
|
L: 215,
|
|
2584
2620
|
S: this,
|
|
2585
2621
|
C: (f, a) => f(...a)
|
|
@@ -2602,11 +2638,11 @@ var InvitationsHandler = class {
|
|
|
2602
2638
|
return;
|
|
2603
2639
|
}
|
|
2604
2640
|
connectionCtx.onDispose(async () => {
|
|
2605
|
-
|
|
2641
|
+
log11("extension disposed", {
|
|
2606
2642
|
admitted,
|
|
2607
2643
|
currentState: guardedState.current.state
|
|
2608
2644
|
}, {
|
|
2609
|
-
F:
|
|
2645
|
+
F: __dxlog_file14,
|
|
2610
2646
|
L: 243,
|
|
2611
2647
|
S: this,
|
|
2612
2648
|
C: (f, a) => f(...a)
|
|
@@ -2621,10 +2657,10 @@ var InvitationsHandler = class {
|
|
|
2621
2657
|
scheduleTask3(connectionCtx, async () => {
|
|
2622
2658
|
const traceId = PublicKey7.random().toHex();
|
|
2623
2659
|
try {
|
|
2624
|
-
|
|
2660
|
+
log11.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.begin({
|
|
2625
2661
|
id: traceId
|
|
2626
2662
|
}), {
|
|
2627
|
-
F:
|
|
2663
|
+
F: __dxlog_file14,
|
|
2628
2664
|
L: 255,
|
|
2629
2665
|
S: this,
|
|
2630
2666
|
C: (f, a) => f(...a)
|
|
@@ -2633,19 +2669,19 @@ var InvitationsHandler = class {
|
|
|
2633
2669
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2634
2670
|
extensionCtx.close();
|
|
2635
2671
|
}, timeout);
|
|
2636
|
-
|
|
2672
|
+
log11("connected", {
|
|
2637
2673
|
...protocol.toJSON()
|
|
2638
2674
|
}, {
|
|
2639
|
-
F:
|
|
2675
|
+
F: __dxlog_file14,
|
|
2640
2676
|
L: 266,
|
|
2641
2677
|
S: this,
|
|
2642
2678
|
C: (f, a) => f(...a)
|
|
2643
2679
|
});
|
|
2644
2680
|
guardedState.set(extension, Invitation4.State.CONNECTED);
|
|
2645
|
-
|
|
2681
|
+
log11("introduce", {
|
|
2646
2682
|
...protocol.toJSON()
|
|
2647
2683
|
}, {
|
|
2648
|
-
F:
|
|
2684
|
+
F: __dxlog_file14,
|
|
2649
2685
|
L: 270,
|
|
2650
2686
|
S: this,
|
|
2651
2687
|
C: (f, a) => f(...a)
|
|
@@ -2654,11 +2690,11 @@ var InvitationsHandler = class {
|
|
|
2654
2690
|
invitationId: invitation.invitationId,
|
|
2655
2691
|
...protocol.createIntroduction()
|
|
2656
2692
|
});
|
|
2657
|
-
|
|
2693
|
+
log11("introduce response", {
|
|
2658
2694
|
...protocol.toJSON(),
|
|
2659
2695
|
response: introductionResponse
|
|
2660
2696
|
}, {
|
|
2661
|
-
F:
|
|
2697
|
+
F: __dxlog_file14,
|
|
2662
2698
|
L: 275,
|
|
2663
2699
|
S: this,
|
|
2664
2700
|
C: (f, a) => f(...a)
|
|
@@ -2676,10 +2712,10 @@ var InvitationsHandler = class {
|
|
|
2676
2712
|
break;
|
|
2677
2713
|
}
|
|
2678
2714
|
}
|
|
2679
|
-
|
|
2715
|
+
log11("request admission", {
|
|
2680
2716
|
...protocol.toJSON()
|
|
2681
2717
|
}, {
|
|
2682
|
-
F:
|
|
2718
|
+
F: __dxlog_file14,
|
|
2683
2719
|
L: 301,
|
|
2684
2720
|
S: this,
|
|
2685
2721
|
C: (f, a) => f(...a)
|
|
@@ -2688,10 +2724,10 @@ var InvitationsHandler = class {
|
|
|
2688
2724
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2689
2725
|
admitted = true;
|
|
2690
2726
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2691
|
-
|
|
2727
|
+
log11("admitted by host", {
|
|
2692
2728
|
...protocol.toJSON()
|
|
2693
2729
|
}, {
|
|
2694
|
-
F:
|
|
2730
|
+
F: __dxlog_file14,
|
|
2695
2731
|
L: 312,
|
|
2696
2732
|
S: this,
|
|
2697
2733
|
C: (f, a) => f(...a)
|
|
@@ -2701,28 +2737,28 @@ var InvitationsHandler = class {
|
|
|
2701
2737
|
...result,
|
|
2702
2738
|
state: Invitation4.State.SUCCESS
|
|
2703
2739
|
});
|
|
2704
|
-
|
|
2740
|
+
log11.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.end({
|
|
2705
2741
|
id: traceId
|
|
2706
2742
|
}), {
|
|
2707
|
-
F:
|
|
2743
|
+
F: __dxlog_file14,
|
|
2708
2744
|
L: 318,
|
|
2709
2745
|
S: this,
|
|
2710
2746
|
C: (f, a) => f(...a)
|
|
2711
2747
|
});
|
|
2712
2748
|
} catch (err) {
|
|
2713
2749
|
if (err instanceof TimeoutError) {
|
|
2714
|
-
|
|
2750
|
+
log11("timeout", {
|
|
2715
2751
|
...protocol.toJSON()
|
|
2716
2752
|
}, {
|
|
2717
|
-
F:
|
|
2753
|
+
F: __dxlog_file14,
|
|
2718
2754
|
L: 321,
|
|
2719
2755
|
S: this,
|
|
2720
2756
|
C: (f, a) => f(...a)
|
|
2721
2757
|
});
|
|
2722
2758
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2723
2759
|
} else {
|
|
2724
|
-
|
|
2725
|
-
F:
|
|
2760
|
+
log11("auth failed", err, {
|
|
2761
|
+
F: __dxlog_file14,
|
|
2726
2762
|
L: 324,
|
|
2727
2763
|
S: this,
|
|
2728
2764
|
C: (f, a) => f(...a)
|
|
@@ -2730,11 +2766,11 @@ var InvitationsHandler = class {
|
|
|
2730
2766
|
guardedState.error(extension, err);
|
|
2731
2767
|
}
|
|
2732
2768
|
extensionCtx.close(err);
|
|
2733
|
-
|
|
2769
|
+
log11.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.error({
|
|
2734
2770
|
id: traceId,
|
|
2735
2771
|
error: err
|
|
2736
2772
|
}), {
|
|
2737
|
-
F:
|
|
2773
|
+
F: __dxlog_file14,
|
|
2738
2774
|
L: 328,
|
|
2739
2775
|
S: this,
|
|
2740
2776
|
C: (f, a) => f(...a)
|
|
@@ -2747,18 +2783,18 @@ var InvitationsHandler = class {
|
|
|
2747
2783
|
return;
|
|
2748
2784
|
}
|
|
2749
2785
|
if (err instanceof TimeoutError) {
|
|
2750
|
-
|
|
2786
|
+
log11("timeout", {
|
|
2751
2787
|
...protocol.toJSON()
|
|
2752
2788
|
}, {
|
|
2753
|
-
F:
|
|
2789
|
+
F: __dxlog_file14,
|
|
2754
2790
|
L: 337,
|
|
2755
2791
|
S: this,
|
|
2756
2792
|
C: (f, a) => f(...a)
|
|
2757
2793
|
});
|
|
2758
2794
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2759
2795
|
} else {
|
|
2760
|
-
|
|
2761
|
-
F:
|
|
2796
|
+
log11("auth failed", err, {
|
|
2797
|
+
F: __dxlog_file14,
|
|
2762
2798
|
L: 340,
|
|
2763
2799
|
S: this,
|
|
2764
2800
|
C: (f, a) => f(...a)
|
|
@@ -2776,7 +2812,7 @@ var InvitationsHandler = class {
|
|
|
2776
2812
|
await ctx.dispose();
|
|
2777
2813
|
} else {
|
|
2778
2814
|
invariant9(invitation.swarmKey, void 0, {
|
|
2779
|
-
F:
|
|
2815
|
+
F: __dxlog_file14,
|
|
2780
2816
|
L: 355,
|
|
2781
2817
|
S: this,
|
|
2782
2818
|
A: [
|
|
@@ -2878,23 +2914,23 @@ var InvitationsHandler = class {
|
|
|
2878
2914
|
}
|
|
2879
2915
|
_logStateUpdate(invitation, actor, newState) {
|
|
2880
2916
|
if (this._isNotTerminal(newState)) {
|
|
2881
|
-
|
|
2917
|
+
log11("invitation state update", {
|
|
2882
2918
|
actor: actor?.constructor.name,
|
|
2883
2919
|
newState: stateToString(newState),
|
|
2884
2920
|
oldState: stateToString(invitation.state)
|
|
2885
2921
|
}, {
|
|
2886
|
-
F:
|
|
2922
|
+
F: __dxlog_file14,
|
|
2887
2923
|
L: 460,
|
|
2888
2924
|
S: this,
|
|
2889
2925
|
C: (f, a) => f(...a)
|
|
2890
2926
|
});
|
|
2891
2927
|
} else {
|
|
2892
|
-
|
|
2928
|
+
log11.info("invitation state update", {
|
|
2893
2929
|
actor: actor?.constructor.name,
|
|
2894
2930
|
newState: stateToString(newState),
|
|
2895
2931
|
oldState: stateToString(invitation.state)
|
|
2896
2932
|
}, {
|
|
2897
|
-
F:
|
|
2933
|
+
F: __dxlog_file14,
|
|
2898
2934
|
L: 466,
|
|
2899
2935
|
S: this,
|
|
2900
2936
|
C: (f, a) => f(...a)
|
|
@@ -2912,16 +2948,16 @@ var InvitationsHandler = class {
|
|
|
2912
2948
|
}
|
|
2913
2949
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2914
2950
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2915
|
-
|
|
2916
|
-
F:
|
|
2951
|
+
log11("guest waiting for authentication code...", void 0, {
|
|
2952
|
+
F: __dxlog_file14,
|
|
2917
2953
|
L: 491,
|
|
2918
2954
|
S: this,
|
|
2919
2955
|
C: (f, a) => f(...a)
|
|
2920
2956
|
});
|
|
2921
2957
|
setState(Invitation4.State.READY_FOR_AUTHENTICATION);
|
|
2922
2958
|
const authCode = await authenticated.wait(options);
|
|
2923
|
-
|
|
2924
|
-
F:
|
|
2959
|
+
log11("sending authentication request", void 0, {
|
|
2960
|
+
F: __dxlog_file14,
|
|
2925
2961
|
L: 495,
|
|
2926
2962
|
S: this,
|
|
2927
2963
|
C: (f, a) => f(...a)
|
|
@@ -2937,10 +2973,10 @@ var InvitationsHandler = class {
|
|
|
2937
2973
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2938
2974
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2939
2975
|
} else {
|
|
2940
|
-
|
|
2976
|
+
log11("retrying invalid code", {
|
|
2941
2977
|
attempt
|
|
2942
2978
|
}, {
|
|
2943
|
-
F:
|
|
2979
|
+
F: __dxlog_file14,
|
|
2944
2980
|
L: 506,
|
|
2945
2981
|
S: this,
|
|
2946
2982
|
C: (f, a) => f(...a)
|
|
@@ -2957,8 +2993,8 @@ var InvitationsHandler = class {
|
|
|
2957
2993
|
if (introductionResponse.challenge == null) {
|
|
2958
2994
|
throw new Error("challenge missing in the introduction");
|
|
2959
2995
|
}
|
|
2960
|
-
|
|
2961
|
-
F:
|
|
2996
|
+
log11("sending authentication request", void 0, {
|
|
2997
|
+
F: __dxlog_file14,
|
|
2962
2998
|
L: 525,
|
|
2963
2999
|
S: this,
|
|
2964
3000
|
C: (f, a) => f(...a)
|
|
@@ -3082,11 +3118,11 @@ var InvitationsServiceImpl = class {
|
|
|
3082
3118
|
import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
3083
3119
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
3084
3120
|
import { invariant as invariant10 } from "@dxos/invariant";
|
|
3085
|
-
import { log as
|
|
3121
|
+
import { log as log12 } from "@dxos/log";
|
|
3086
3122
|
import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
|
|
3087
3123
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3088
3124
|
import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3089
|
-
var
|
|
3125
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3090
3126
|
var SpaceInvitationProtocol = class {
|
|
3091
3127
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3092
3128
|
this._spaceManager = _spaceManager;
|
|
@@ -3121,7 +3157,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3121
3157
|
}
|
|
3122
3158
|
async admit(invitation, request, guestProfile) {
|
|
3123
3159
|
invariant10(this._spaceKey && request.space, void 0, {
|
|
3124
|
-
F:
|
|
3160
|
+
F: __dxlog_file15,
|
|
3125
3161
|
L: 74,
|
|
3126
3162
|
S: this,
|
|
3127
3163
|
A: [
|
|
@@ -3129,11 +3165,11 @@ var SpaceInvitationProtocol = class {
|
|
|
3129
3165
|
""
|
|
3130
3166
|
]
|
|
3131
3167
|
});
|
|
3132
|
-
|
|
3168
|
+
log12("writing guest credentials", {
|
|
3133
3169
|
host: this._signingContext.deviceKey,
|
|
3134
3170
|
guest: request.space.deviceKey
|
|
3135
3171
|
}, {
|
|
3136
|
-
F:
|
|
3172
|
+
F: __dxlog_file15,
|
|
3137
3173
|
L: 75,
|
|
3138
3174
|
S: this,
|
|
3139
3175
|
C: (f, a) => f(...a)
|
|
@@ -3155,7 +3191,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3155
3191
|
}
|
|
3156
3192
|
async delegate(invitation) {
|
|
3157
3193
|
invariant10(this._spaceKey, void 0, {
|
|
3158
|
-
F:
|
|
3194
|
+
F: __dxlog_file15,
|
|
3159
3195
|
L: 95,
|
|
3160
3196
|
S: this,
|
|
3161
3197
|
A: [
|
|
@@ -3165,7 +3201,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3165
3201
|
});
|
|
3166
3202
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3167
3203
|
invariant10(space, void 0, {
|
|
3168
|
-
F:
|
|
3204
|
+
F: __dxlog_file15,
|
|
3169
3205
|
L: 97,
|
|
3170
3206
|
S: this,
|
|
3171
3207
|
A: [
|
|
@@ -3175,7 +3211,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3175
3211
|
});
|
|
3176
3212
|
if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3177
3213
|
invariant10(invitation.guestKeypair?.publicKey, void 0, {
|
|
3178
|
-
F:
|
|
3214
|
+
F: __dxlog_file15,
|
|
3179
3215
|
L: 99,
|
|
3180
3216
|
S: this,
|
|
3181
3217
|
A: [
|
|
@@ -3184,11 +3220,11 @@ var SpaceInvitationProtocol = class {
|
|
|
3184
3220
|
]
|
|
3185
3221
|
});
|
|
3186
3222
|
}
|
|
3187
|
-
|
|
3223
|
+
log12("writing delegate space invitation", {
|
|
3188
3224
|
host: this._signingContext.deviceKey,
|
|
3189
3225
|
id: invitation.invitationId
|
|
3190
3226
|
}, {
|
|
3191
|
-
F:
|
|
3227
|
+
F: __dxlog_file15,
|
|
3192
3228
|
L: 102,
|
|
3193
3229
|
S: this,
|
|
3194
3230
|
C: (f, a) => f(...a)
|
|
@@ -3203,7 +3239,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3203
3239
|
guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3204
3240
|
});
|
|
3205
3241
|
invariant10(credential.credential, void 0, {
|
|
3206
|
-
F:
|
|
3242
|
+
F: __dxlog_file15,
|
|
3207
3243
|
L: 122,
|
|
3208
3244
|
S: this,
|
|
3209
3245
|
A: [
|
|
@@ -3218,7 +3254,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3218
3254
|
}
|
|
3219
3255
|
async cancelDelegation(invitation) {
|
|
3220
3256
|
invariant10(this._spaceKey, void 0, {
|
|
3221
|
-
F:
|
|
3257
|
+
F: __dxlog_file15,
|
|
3222
3258
|
L: 128,
|
|
3223
3259
|
S: this,
|
|
3224
3260
|
A: [
|
|
@@ -3227,7 +3263,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3227
3263
|
]
|
|
3228
3264
|
});
|
|
3229
3265
|
invariant10(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3230
|
-
F:
|
|
3266
|
+
F: __dxlog_file15,
|
|
3231
3267
|
L: 129,
|
|
3232
3268
|
S: this,
|
|
3233
3269
|
A: [
|
|
@@ -3237,7 +3273,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3237
3273
|
});
|
|
3238
3274
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3239
3275
|
invariant10(space, void 0, {
|
|
3240
|
-
F:
|
|
3276
|
+
F: __dxlog_file15,
|
|
3241
3277
|
L: 131,
|
|
3242
3278
|
S: this,
|
|
3243
3279
|
A: [
|
|
@@ -3245,18 +3281,18 @@ var SpaceInvitationProtocol = class {
|
|
|
3245
3281
|
""
|
|
3246
3282
|
]
|
|
3247
3283
|
});
|
|
3248
|
-
|
|
3284
|
+
log12("cancelling delegated space invitation", {
|
|
3249
3285
|
host: this._signingContext.deviceKey,
|
|
3250
3286
|
id: invitation.invitationId
|
|
3251
3287
|
}, {
|
|
3252
|
-
F:
|
|
3288
|
+
F: __dxlog_file15,
|
|
3253
3289
|
L: 133,
|
|
3254
3290
|
S: this,
|
|
3255
3291
|
C: (f, a) => f(...a)
|
|
3256
3292
|
});
|
|
3257
3293
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3258
3294
|
invariant10(credential.credential, void 0, {
|
|
3259
|
-
F:
|
|
3295
|
+
F: __dxlog_file15,
|
|
3260
3296
|
L: 140,
|
|
3261
3297
|
S: this,
|
|
3262
3298
|
A: [
|
|
@@ -3295,7 +3331,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3295
3331
|
}
|
|
3296
3332
|
async accept(response) {
|
|
3297
3333
|
invariant10(response.space, void 0, {
|
|
3298
|
-
F:
|
|
3334
|
+
F: __dxlog_file15,
|
|
3299
3335
|
L: 175,
|
|
3300
3336
|
S: this,
|
|
3301
3337
|
A: [
|
|
@@ -3306,7 +3342,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3306
3342
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3307
3343
|
const assertion = getCredentialAssertion2(credential);
|
|
3308
3344
|
invariant10(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3309
|
-
F:
|
|
3345
|
+
F: __dxlog_file15,
|
|
3310
3346
|
L: 178,
|
|
3311
3347
|
S: this,
|
|
3312
3348
|
A: [
|
|
@@ -3315,7 +3351,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3315
3351
|
]
|
|
3316
3352
|
});
|
|
3317
3353
|
invariant10(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3318
|
-
F:
|
|
3354
|
+
F: __dxlog_file15,
|
|
3319
3355
|
L: 179,
|
|
3320
3356
|
S: this,
|
|
3321
3357
|
A: [
|
|
@@ -3347,10 +3383,10 @@ import { generatePasscode } from "@dxos/credentials";
|
|
|
3347
3383
|
import { hasInvitationExpired } from "@dxos/echo-pipeline";
|
|
3348
3384
|
import { invariant as invariant11 } from "@dxos/invariant";
|
|
3349
3385
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
3350
|
-
import { log as
|
|
3386
|
+
import { log as log13 } from "@dxos/log";
|
|
3351
3387
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3352
3388
|
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3353
|
-
var
|
|
3389
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3354
3390
|
var InvitationsManager = class {
|
|
3355
3391
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3356
3392
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3392,8 +3428,8 @@ var InvitationsManager = class {
|
|
|
3392
3428
|
try {
|
|
3393
3429
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3394
3430
|
} catch (err) {
|
|
3395
|
-
|
|
3396
|
-
F:
|
|
3431
|
+
log13.catch(err, void 0, {
|
|
3432
|
+
F: __dxlog_file16,
|
|
3397
3433
|
L: 82,
|
|
3398
3434
|
S: this,
|
|
3399
3435
|
C: (f, a) => f(...a)
|
|
@@ -3416,7 +3452,7 @@ var InvitationsManager = class {
|
|
|
3416
3452
|
const freshInvitations = persistentInvitations.filter((invitation) => !hasInvitationExpired(invitation));
|
|
3417
3453
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3418
3454
|
invariant11(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3419
|
-
F:
|
|
3455
|
+
F: __dxlog_file16,
|
|
3420
3456
|
L: 103,
|
|
3421
3457
|
S: this,
|
|
3422
3458
|
A: [
|
|
@@ -3434,8 +3470,8 @@ var InvitationsManager = class {
|
|
|
3434
3470
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3435
3471
|
};
|
|
3436
3472
|
} catch (err) {
|
|
3437
|
-
|
|
3438
|
-
F:
|
|
3473
|
+
log13.catch(err, void 0, {
|
|
3474
|
+
F: __dxlog_file16,
|
|
3439
3475
|
L: 110,
|
|
3440
3476
|
S: this,
|
|
3441
3477
|
C: (f, a) => f(...a)
|
|
@@ -3466,14 +3502,14 @@ var InvitationsManager = class {
|
|
|
3466
3502
|
return invitation;
|
|
3467
3503
|
}
|
|
3468
3504
|
async authenticate({ invitationId, authCode }) {
|
|
3469
|
-
|
|
3470
|
-
F:
|
|
3505
|
+
log13("authenticating...", void 0, {
|
|
3506
|
+
F: __dxlog_file16,
|
|
3471
3507
|
L: 140,
|
|
3472
3508
|
S: this,
|
|
3473
3509
|
C: (f, a) => f(...a)
|
|
3474
3510
|
});
|
|
3475
3511
|
invariant11(invitationId, void 0, {
|
|
3476
|
-
F:
|
|
3512
|
+
F: __dxlog_file16,
|
|
3477
3513
|
L: 141,
|
|
3478
3514
|
S: this,
|
|
3479
3515
|
A: [
|
|
@@ -3483,10 +3519,10 @@ var InvitationsManager = class {
|
|
|
3483
3519
|
});
|
|
3484
3520
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3485
3521
|
if (!observable) {
|
|
3486
|
-
|
|
3522
|
+
log13.warn("invalid invitation", {
|
|
3487
3523
|
invitationId
|
|
3488
3524
|
}, {
|
|
3489
|
-
F:
|
|
3525
|
+
F: __dxlog_file16,
|
|
3490
3526
|
L: 144,
|
|
3491
3527
|
S: this,
|
|
3492
3528
|
C: (f, a) => f(...a)
|
|
@@ -3496,16 +3532,16 @@ var InvitationsManager = class {
|
|
|
3496
3532
|
}
|
|
3497
3533
|
}
|
|
3498
3534
|
async cancelInvitation({ invitationId }) {
|
|
3499
|
-
|
|
3535
|
+
log13("cancelInvitation...", {
|
|
3500
3536
|
invitationId
|
|
3501
3537
|
}, {
|
|
3502
|
-
F:
|
|
3538
|
+
F: __dxlog_file16,
|
|
3503
3539
|
L: 151,
|
|
3504
3540
|
S: this,
|
|
3505
3541
|
C: (f, a) => f(...a)
|
|
3506
3542
|
});
|
|
3507
3543
|
invariant11(invitationId, void 0, {
|
|
3508
|
-
F:
|
|
3544
|
+
F: __dxlog_file16,
|
|
3509
3545
|
L: 152,
|
|
3510
3546
|
S: this,
|
|
3511
3547
|
A: [
|
|
@@ -3580,14 +3616,14 @@ var InvitationsManager = class {
|
|
|
3580
3616
|
void ctx.dispose();
|
|
3581
3617
|
}
|
|
3582
3618
|
}, {
|
|
3583
|
-
F:
|
|
3619
|
+
F: __dxlog_file16,
|
|
3584
3620
|
L: 234
|
|
3585
3621
|
});
|
|
3586
3622
|
ctx.onDispose(() => {
|
|
3587
|
-
|
|
3623
|
+
log13("complete", {
|
|
3588
3624
|
...handler.toJSON()
|
|
3589
3625
|
}, {
|
|
3590
|
-
F:
|
|
3626
|
+
F: __dxlog_file16,
|
|
3591
3627
|
L: 241,
|
|
3592
3628
|
S: this,
|
|
3593
3629
|
C: (f, a) => f(...a)
|
|
@@ -3617,10 +3653,10 @@ var InvitationsManager = class {
|
|
|
3617
3653
|
const ctx = new Context6({
|
|
3618
3654
|
onError: (err) => {
|
|
3619
3655
|
if (err instanceof TimeoutError2) {
|
|
3620
|
-
|
|
3656
|
+
log13("timeout", {
|
|
3621
3657
|
...handler.toJSON()
|
|
3622
3658
|
}, {
|
|
3623
|
-
F:
|
|
3659
|
+
F: __dxlog_file16,
|
|
3624
3660
|
L: 261,
|
|
3625
3661
|
S: this,
|
|
3626
3662
|
C: (f, a) => f(...a)
|
|
@@ -3630,8 +3666,8 @@ var InvitationsManager = class {
|
|
|
3630
3666
|
state: Invitation6.State.TIMEOUT
|
|
3631
3667
|
});
|
|
3632
3668
|
} else {
|
|
3633
|
-
|
|
3634
|
-
F:
|
|
3669
|
+
log13.warn("auth failed", err, {
|
|
3670
|
+
F: __dxlog_file16,
|
|
3635
3671
|
L: 264,
|
|
3636
3672
|
S: this,
|
|
3637
3673
|
C: (f, a) => f(...a)
|
|
@@ -3644,14 +3680,14 @@ var InvitationsManager = class {
|
|
|
3644
3680
|
void ctx.dispose();
|
|
3645
3681
|
}
|
|
3646
3682
|
}, {
|
|
3647
|
-
F:
|
|
3683
|
+
F: __dxlog_file16,
|
|
3648
3684
|
L: 258
|
|
3649
3685
|
});
|
|
3650
3686
|
ctx.onDispose(() => {
|
|
3651
|
-
|
|
3687
|
+
log13("complete", {
|
|
3652
3688
|
...handler.toJSON()
|
|
3653
3689
|
}, {
|
|
3654
|
-
F:
|
|
3690
|
+
F: __dxlog_file16,
|
|
3655
3691
|
L: 271,
|
|
3656
3692
|
S: this,
|
|
3657
3693
|
C: (f, a) => f(...a)
|
|
@@ -3695,8 +3731,8 @@ var InvitationsManager = class {
|
|
|
3695
3731
|
try {
|
|
3696
3732
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3697
3733
|
} catch (err) {
|
|
3698
|
-
|
|
3699
|
-
F:
|
|
3734
|
+
log13.catch(err, void 0, {
|
|
3735
|
+
F: __dxlog_file16,
|
|
3700
3736
|
L: 307,
|
|
3701
3737
|
S: this,
|
|
3702
3738
|
C: (f, a) => f(...a)
|
|
@@ -3713,7 +3749,7 @@ var InvitationsManager = class {
|
|
|
3713
3749
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
3714
3750
|
import { asyncTimeout as asyncTimeout2, Trigger as Trigger7 } from "@dxos/async";
|
|
3715
3751
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
3716
|
-
import { log as
|
|
3752
|
+
import { log as log14, logInfo } from "@dxos/log";
|
|
3717
3753
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
3718
3754
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3719
3755
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3724,7 +3760,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
3724
3760
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3725
3761
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3726
3762
|
}
|
|
3727
|
-
var
|
|
3763
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
|
|
3728
3764
|
var Message;
|
|
3729
3765
|
(function(Message2) {
|
|
3730
3766
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -3746,29 +3782,29 @@ var Lock = class {
|
|
|
3746
3782
|
message: "acquiring"
|
|
3747
3783
|
});
|
|
3748
3784
|
try {
|
|
3749
|
-
|
|
3750
|
-
F:
|
|
3785
|
+
log14("aquiring lock...", void 0, {
|
|
3786
|
+
F: __dxlog_file17,
|
|
3751
3787
|
L: 42,
|
|
3752
3788
|
S: this,
|
|
3753
3789
|
C: (f, a) => f(...a)
|
|
3754
3790
|
});
|
|
3755
3791
|
await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
|
|
3756
|
-
|
|
3757
|
-
F:
|
|
3792
|
+
log14("acquired lock", void 0, {
|
|
3793
|
+
F: __dxlog_file17,
|
|
3758
3794
|
L: 44,
|
|
3759
3795
|
S: this,
|
|
3760
3796
|
C: (f, a) => f(...a)
|
|
3761
3797
|
});
|
|
3762
3798
|
} catch {
|
|
3763
|
-
|
|
3764
|
-
F:
|
|
3799
|
+
log14("stealing lock...", void 0, {
|
|
3800
|
+
F: __dxlog_file17,
|
|
3765
3801
|
L: 46,
|
|
3766
3802
|
S: this,
|
|
3767
3803
|
C: (f, a) => f(...a)
|
|
3768
3804
|
});
|
|
3769
3805
|
await this._requestLock(true);
|
|
3770
|
-
|
|
3771
|
-
F:
|
|
3806
|
+
log14("stolen lock", void 0, {
|
|
3807
|
+
F: __dxlog_file17,
|
|
3772
3808
|
L: 48,
|
|
3773
3809
|
S: this,
|
|
3774
3810
|
C: (f, a) => f(...a)
|
|
@@ -3784,10 +3820,10 @@ var Lock = class {
|
|
|
3784
3820
|
}
|
|
3785
3821
|
}
|
|
3786
3822
|
async _requestLock(steal = false) {
|
|
3787
|
-
|
|
3823
|
+
log14("requesting lock...", {
|
|
3788
3824
|
steal
|
|
3789
3825
|
}, {
|
|
3790
|
-
F:
|
|
3826
|
+
F: __dxlog_file17,
|
|
3791
3827
|
L: 63,
|
|
3792
3828
|
S: this,
|
|
3793
3829
|
C: (f, a) => f(...a)
|
|
@@ -3800,15 +3836,15 @@ var Lock = class {
|
|
|
3800
3836
|
acquired.wake();
|
|
3801
3837
|
this._releaseTrigger = new Trigger7();
|
|
3802
3838
|
await this._releaseTrigger.wait();
|
|
3803
|
-
|
|
3804
|
-
F:
|
|
3839
|
+
log14("releasing lock...", void 0, {
|
|
3840
|
+
F: __dxlog_file17,
|
|
3805
3841
|
L: 72,
|
|
3806
3842
|
S: this,
|
|
3807
3843
|
C: (f, a) => f(...a)
|
|
3808
3844
|
});
|
|
3809
3845
|
await this._onRelease?.();
|
|
3810
|
-
|
|
3811
|
-
F:
|
|
3846
|
+
log14("released lock", void 0, {
|
|
3847
|
+
F: __dxlog_file17,
|
|
3812
3848
|
L: 74,
|
|
3813
3849
|
S: this,
|
|
3814
3850
|
C: (f, a) => f(...a)
|
|
@@ -3817,10 +3853,10 @@ var Lock = class {
|
|
|
3817
3853
|
await this._onRelease?.();
|
|
3818
3854
|
});
|
|
3819
3855
|
await acquired.wait();
|
|
3820
|
-
|
|
3856
|
+
log14("recieved lock", {
|
|
3821
3857
|
steal
|
|
3822
3858
|
}, {
|
|
3823
|
-
F:
|
|
3859
|
+
F: __dxlog_file17,
|
|
3824
3860
|
L: 81,
|
|
3825
3861
|
S: this,
|
|
3826
3862
|
C: (f, a) => f(...a)
|
|
@@ -3921,7 +3957,7 @@ import { Event as Event4, Mutex as Mutex2, scheduleMicroTask } from "@dxos/async
|
|
|
3921
3957
|
import { Resource as Resource2 } from "@dxos/context";
|
|
3922
3958
|
import { invariant as invariant12 } from "@dxos/invariant";
|
|
3923
3959
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
3924
|
-
import { log as
|
|
3960
|
+
import { log as log15 } from "@dxos/log";
|
|
3925
3961
|
import { EdgeService } from "@dxos/protocols";
|
|
3926
3962
|
import { buf } from "@dxos/protocols/buf";
|
|
3927
3963
|
import { MessageSchema as RouterMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
@@ -3989,7 +4025,7 @@ function _using_ctx() {
|
|
|
3989
4025
|
}
|
|
3990
4026
|
};
|
|
3991
4027
|
}
|
|
3992
|
-
var
|
|
4028
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/edge-feed-replicator.ts";
|
|
3993
4029
|
var EdgeFeedReplicator = class extends Resource2 {
|
|
3994
4030
|
constructor({ messenger, spaceId }) {
|
|
3995
4031
|
super();
|
|
@@ -4018,11 +4054,11 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4018
4054
|
}
|
|
4019
4055
|
const [spaceId] = rest;
|
|
4020
4056
|
if (spaceId !== this._spaceId) {
|
|
4021
|
-
|
|
4057
|
+
log15("spaceID mismatch", {
|
|
4022
4058
|
spaceId,
|
|
4023
4059
|
_spaceId: this._spaceId
|
|
4024
4060
|
}, {
|
|
4025
|
-
F:
|
|
4061
|
+
F: __dxlog_file18,
|
|
4026
4062
|
L: 62,
|
|
4027
4063
|
S: this,
|
|
4028
4064
|
C: (f, a) => f(...a)
|
|
@@ -4030,11 +4066,11 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4030
4066
|
return;
|
|
4031
4067
|
}
|
|
4032
4068
|
const payload = decodeCbor(message.payload.value);
|
|
4033
|
-
|
|
4069
|
+
log15.info("recv", {
|
|
4034
4070
|
from: message.source,
|
|
4035
4071
|
payload
|
|
4036
4072
|
}, {
|
|
4037
|
-
F:
|
|
4073
|
+
F: __dxlog_file18,
|
|
4038
4074
|
L: 67,
|
|
4039
4075
|
S: this,
|
|
4040
4076
|
C: (f, a) => f(...a)
|
|
@@ -4055,10 +4091,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4055
4091
|
this._remoteLength.clear();
|
|
4056
4092
|
}
|
|
4057
4093
|
async addFeed(feed) {
|
|
4058
|
-
|
|
4094
|
+
log15.info("addFeed", {
|
|
4059
4095
|
key: feed.key
|
|
4060
4096
|
}, {
|
|
4061
|
-
F:
|
|
4097
|
+
F: __dxlog_file18,
|
|
4062
4098
|
L: 89,
|
|
4063
4099
|
S: this,
|
|
4064
4100
|
C: (f, a) => f(...a)
|
|
@@ -4073,7 +4109,7 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4073
4109
|
}
|
|
4074
4110
|
async _replicateFeed(feed) {
|
|
4075
4111
|
invariant12(this._connectionCtx, void 0, {
|
|
4076
|
-
F:
|
|
4112
|
+
F: __dxlog_file18,
|
|
4077
4113
|
L: 102,
|
|
4078
4114
|
S: this,
|
|
4079
4115
|
A: [
|
|
@@ -4090,16 +4126,16 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4090
4126
|
});
|
|
4091
4127
|
}
|
|
4092
4128
|
async _sendMessage(message) {
|
|
4093
|
-
|
|
4129
|
+
log15.info("sending message", {
|
|
4094
4130
|
message
|
|
4095
4131
|
}, {
|
|
4096
|
-
F:
|
|
4132
|
+
F: __dxlog_file18,
|
|
4097
4133
|
L: 115,
|
|
4098
4134
|
S: this,
|
|
4099
4135
|
C: (f, a) => f(...a)
|
|
4100
4136
|
});
|
|
4101
4137
|
invariant12(message.feedKey, void 0, {
|
|
4102
|
-
F:
|
|
4138
|
+
F: __dxlog_file18,
|
|
4103
4139
|
L: 117,
|
|
4104
4140
|
S: this,
|
|
4105
4141
|
A: [
|
|
@@ -4110,8 +4146,8 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4110
4146
|
const payloadValue = bufferToArray(encodeCbor(message));
|
|
4111
4147
|
await this._messenger.send(buf.create(RouterMessageSchema, {
|
|
4112
4148
|
source: {
|
|
4113
|
-
identityKey: this._messenger.identityKey
|
|
4114
|
-
peerKey: this._messenger.
|
|
4149
|
+
identityKey: this._messenger.identityKey,
|
|
4150
|
+
peerKey: this._messenger.peerKey
|
|
4115
4151
|
},
|
|
4116
4152
|
serviceId: `${EdgeService.FEED_REPLICATOR}:${this._spaceId}`,
|
|
4117
4153
|
payload: {
|
|
@@ -4120,10 +4156,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4120
4156
|
}));
|
|
4121
4157
|
}
|
|
4122
4158
|
_onMessage(message) {
|
|
4123
|
-
|
|
4159
|
+
log15.info("received message", {
|
|
4124
4160
|
message
|
|
4125
4161
|
}, {
|
|
4126
|
-
F:
|
|
4162
|
+
F: __dxlog_file18,
|
|
4127
4163
|
L: 133,
|
|
4128
4164
|
S: this,
|
|
4129
4165
|
C: (f, a) => f(...a)
|
|
@@ -4136,10 +4172,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4136
4172
|
const feedKey = PublicKey9.fromHex(message.feedKey);
|
|
4137
4173
|
const feed = this._feeds.get(feedKey);
|
|
4138
4174
|
if (!feed) {
|
|
4139
|
-
|
|
4175
|
+
log15.warn("Feed not found", {
|
|
4140
4176
|
feedKey
|
|
4141
4177
|
}, {
|
|
4142
|
-
F:
|
|
4178
|
+
F: __dxlog_file18,
|
|
4143
4179
|
L: 141,
|
|
4144
4180
|
S: this,
|
|
4145
4181
|
C: (f, a) => f(...a)
|
|
@@ -4171,10 +4207,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4171
4207
|
const feedKey = PublicKey9.fromHex(message.feedKey);
|
|
4172
4208
|
const feed = this._feeds.get(feedKey);
|
|
4173
4209
|
if (!feed) {
|
|
4174
|
-
|
|
4210
|
+
log15.warn("Feed not found", {
|
|
4175
4211
|
feedKey
|
|
4176
4212
|
}, {
|
|
4177
|
-
F:
|
|
4213
|
+
F: __dxlog_file18,
|
|
4178
4214
|
L: 166,
|
|
4179
4215
|
S: this,
|
|
4180
4216
|
C: (f, a) => f(...a)
|
|
@@ -4185,10 +4221,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4185
4221
|
break;
|
|
4186
4222
|
}
|
|
4187
4223
|
default: {
|
|
4188
|
-
|
|
4224
|
+
log15.warn("Unknown message", {
|
|
4189
4225
|
...message
|
|
4190
4226
|
}, {
|
|
4191
|
-
F:
|
|
4227
|
+
F: __dxlog_file18,
|
|
4192
4228
|
L: 175,
|
|
4193
4229
|
S: this,
|
|
4194
4230
|
C: (f, a) => f(...a)
|
|
@@ -4198,12 +4234,12 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4198
4234
|
});
|
|
4199
4235
|
}
|
|
4200
4236
|
async _pushBlocks(feed, from, to) {
|
|
4201
|
-
|
|
4237
|
+
log15.info("pushing blocks", {
|
|
4202
4238
|
feed: feed.key.toHex(),
|
|
4203
4239
|
from,
|
|
4204
4240
|
to
|
|
4205
4241
|
}, {
|
|
4206
|
-
F:
|
|
4242
|
+
F: __dxlog_file18,
|
|
4207
4243
|
L: 182,
|
|
4208
4244
|
S: this,
|
|
4209
4245
|
C: (f, a) => f(...a)
|
|
@@ -4213,7 +4249,7 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4213
4249
|
valueEncoding: "binary"
|
|
4214
4250
|
});
|
|
4215
4251
|
invariant12(data instanceof Uint8Array, void 0, {
|
|
4216
|
-
F:
|
|
4252
|
+
F: __dxlog_file18,
|
|
4217
4253
|
L: 187,
|
|
4218
4254
|
S: this,
|
|
4219
4255
|
A: [
|
|
@@ -4237,11 +4273,11 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4237
4273
|
this._remoteLength.set(feed.key, to);
|
|
4238
4274
|
}
|
|
4239
4275
|
async _integrateBlocks(feed, blocks) {
|
|
4240
|
-
|
|
4276
|
+
log15.info("integrating blocks", {
|
|
4241
4277
|
feed: feed.key.toHex(),
|
|
4242
4278
|
blocks: blocks.length
|
|
4243
4279
|
}, {
|
|
4244
|
-
F:
|
|
4280
|
+
F: __dxlog_file18,
|
|
4245
4281
|
L: 208,
|
|
4246
4282
|
S: this,
|
|
4247
4283
|
C: (f, a) => f(...a)
|
|
@@ -4295,7 +4331,7 @@ import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
|
4295
4331
|
import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
|
|
4296
4332
|
import { failedInvariant } from "@dxos/invariant";
|
|
4297
4333
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4298
|
-
import { log as
|
|
4334
|
+
import { log as log18 } from "@dxos/log";
|
|
4299
4335
|
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
4300
4336
|
import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4301
4337
|
import { AdmittedFeed as AdmittedFeed3, SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -4353,9 +4389,9 @@ import { convertLegacyReferences, convertLegacySpaceRootDoc, findInlineObjectOfT
|
|
|
4353
4389
|
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
4354
4390
|
import { TYPE_PROPERTIES } from "@dxos/echo-schema";
|
|
4355
4391
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
4356
|
-
import { log as
|
|
4392
|
+
import { log as log16 } from "@dxos/log";
|
|
4357
4393
|
import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
4358
|
-
var
|
|
4394
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
4359
4395
|
var LOAD_DOC_TIMEOUT = 1e4;
|
|
4360
4396
|
var runEpochMigration = async (ctx, context) => {
|
|
4361
4397
|
switch (context.migration) {
|
|
@@ -4380,8 +4416,8 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4380
4416
|
};
|
|
4381
4417
|
}
|
|
4382
4418
|
case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
4383
|
-
|
|
4384
|
-
F:
|
|
4419
|
+
log16.info("Fragmenting", void 0, {
|
|
4420
|
+
F: __dxlog_file19,
|
|
4385
4421
|
L: 64,
|
|
4386
4422
|
S: void 0,
|
|
4387
4423
|
C: (f, a) => f(...a)
|
|
@@ -4394,7 +4430,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4394
4430
|
const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
|
|
4395
4431
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4396
4432
|
invariant13(properties, "Properties not found", {
|
|
4397
|
-
F:
|
|
4433
|
+
F: __dxlog_file19,
|
|
4398
4434
|
L: 75,
|
|
4399
4435
|
S: void 0,
|
|
4400
4436
|
A: [
|
|
@@ -4409,7 +4445,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4409
4445
|
])
|
|
4410
4446
|
});
|
|
4411
4447
|
invariant13(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4412
|
-
F:
|
|
4448
|
+
F: __dxlog_file19,
|
|
4413
4449
|
L: 82,
|
|
4414
4450
|
S: void 0,
|
|
4415
4451
|
A: [
|
|
@@ -4450,7 +4486,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4450
4486
|
timeout: LOAD_DOC_TIMEOUT
|
|
4451
4487
|
});
|
|
4452
4488
|
invariant13(rootHandle.docSync(), "Root doc not found", {
|
|
4453
|
-
F:
|
|
4489
|
+
F: __dxlog_file19,
|
|
4454
4490
|
L: 115,
|
|
4455
4491
|
S: void 0,
|
|
4456
4492
|
A: [
|
|
@@ -4465,7 +4501,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4465
4501
|
timeout: LOAD_DOC_TIMEOUT
|
|
4466
4502
|
});
|
|
4467
4503
|
invariant13(handle.docSync(), void 0, {
|
|
4468
|
-
F:
|
|
4504
|
+
F: __dxlog_file19,
|
|
4469
4505
|
L: 122,
|
|
4470
4506
|
S: void 0,
|
|
4471
4507
|
A: [
|
|
@@ -4480,12 +4516,12 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4480
4516
|
});
|
|
4481
4517
|
newRootContent.links[id] = newHandle.url;
|
|
4482
4518
|
} catch (err) {
|
|
4483
|
-
|
|
4519
|
+
log16.warn("Failed to migrate reference", {
|
|
4484
4520
|
id,
|
|
4485
4521
|
url,
|
|
4486
4522
|
error: err
|
|
4487
4523
|
}, {
|
|
4488
|
-
F:
|
|
4524
|
+
F: __dxlog_file19,
|
|
4489
4525
|
L: 128,
|
|
4490
4526
|
S: void 0,
|
|
4491
4527
|
C: (f, a) => f(...a)
|
|
@@ -4504,7 +4540,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4504
4540
|
}
|
|
4505
4541
|
case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
4506
4542
|
invariant13(context.newAutomergeRoot, void 0, {
|
|
4507
|
-
F:
|
|
4543
|
+
F: __dxlog_file19,
|
|
4508
4544
|
L: 143,
|
|
4509
4545
|
S: void 0,
|
|
4510
4546
|
A: [
|
|
@@ -4526,11 +4562,11 @@ import { DeferredTask, Event as Event6, scheduleTask as scheduleTask4, sleep as
|
|
|
4526
4562
|
import { Context as Context7, rejectOnDispose } from "@dxos/context";
|
|
4527
4563
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4528
4564
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4529
|
-
import { log as
|
|
4565
|
+
import { log as log17 } from "@dxos/log";
|
|
4530
4566
|
import { schema as schema4 } from "@dxos/protocols";
|
|
4531
4567
|
import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
|
|
4532
4568
|
import { ComplexMap as ComplexMap3, ComplexSet as ComplexSet4, entry } from "@dxos/util";
|
|
4533
|
-
var
|
|
4569
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
4534
4570
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
4535
4571
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
4536
4572
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -4538,7 +4574,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
4538
4574
|
var NotarizationPlugin = class {
|
|
4539
4575
|
constructor() {
|
|
4540
4576
|
this._ctx = new Context7(void 0, {
|
|
4541
|
-
F:
|
|
4577
|
+
F: __dxlog_file20,
|
|
4542
4578
|
L: 62
|
|
4543
4579
|
});
|
|
4544
4580
|
this._extensionOpened = new Event6();
|
|
@@ -4558,16 +4594,16 @@ var NotarizationPlugin = class {
|
|
|
4558
4594
|
* Request credentials to be notarized.
|
|
4559
4595
|
*/
|
|
4560
4596
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
4561
|
-
|
|
4597
|
+
log17("notarize", {
|
|
4562
4598
|
credentials
|
|
4563
4599
|
}, {
|
|
4564
|
-
F:
|
|
4600
|
+
F: __dxlog_file20,
|
|
4565
4601
|
L: 90,
|
|
4566
4602
|
S: this,
|
|
4567
4603
|
C: (f, a) => f(...a)
|
|
4568
4604
|
});
|
|
4569
4605
|
invariant14(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
4570
|
-
F:
|
|
4606
|
+
F: __dxlog_file20,
|
|
4571
4607
|
L: 91,
|
|
4572
4608
|
S: this,
|
|
4573
4609
|
A: [
|
|
@@ -4578,10 +4614,10 @@ var NotarizationPlugin = class {
|
|
|
4578
4614
|
const errors = new Trigger8();
|
|
4579
4615
|
const ctx = this._ctx.derive({
|
|
4580
4616
|
onError: (err) => {
|
|
4581
|
-
|
|
4617
|
+
log17.warn("Notarization error", {
|
|
4582
4618
|
err
|
|
4583
4619
|
}, {
|
|
4584
|
-
F:
|
|
4620
|
+
F: __dxlog_file20,
|
|
4585
4621
|
L: 99,
|
|
4586
4622
|
S: this,
|
|
4587
4623
|
C: (f, a) => f(...a)
|
|
@@ -4593,11 +4629,11 @@ var NotarizationPlugin = class {
|
|
|
4593
4629
|
opCtx?.onDispose(() => ctx.dispose());
|
|
4594
4630
|
if (timeout !== 0) {
|
|
4595
4631
|
scheduleTask4(ctx, () => {
|
|
4596
|
-
|
|
4632
|
+
log17.warn("Notarization timeout", {
|
|
4597
4633
|
timeout,
|
|
4598
4634
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
4599
4635
|
}, {
|
|
4600
|
-
F:
|
|
4636
|
+
F: __dxlog_file20,
|
|
4601
4637
|
L: 111,
|
|
4602
4638
|
S: this,
|
|
4603
4639
|
C: (f, a) => f(...a)
|
|
@@ -4617,10 +4653,10 @@ var NotarizationPlugin = class {
|
|
|
4617
4653
|
...this._extensions
|
|
4618
4654
|
].find((peer2) => !peersTried.has(peer2));
|
|
4619
4655
|
if (!peer) {
|
|
4620
|
-
|
|
4656
|
+
log17.info("Exhausted all peers to notarize with", {
|
|
4621
4657
|
retryIn: retryTimeout
|
|
4622
4658
|
}, {
|
|
4623
|
-
F:
|
|
4659
|
+
F: __dxlog_file20,
|
|
4624
4660
|
L: 136,
|
|
4625
4661
|
S: this,
|
|
4626
4662
|
C: (f, a) => f(...a)
|
|
@@ -4630,11 +4666,11 @@ var NotarizationPlugin = class {
|
|
|
4630
4666
|
return;
|
|
4631
4667
|
}
|
|
4632
4668
|
peersTried.add(peer);
|
|
4633
|
-
|
|
4669
|
+
log17("try notarizing", {
|
|
4634
4670
|
peer: peer.localPeerId,
|
|
4635
4671
|
credentialId: credentials.map((credential) => credential.id)
|
|
4636
4672
|
}, {
|
|
4637
|
-
F:
|
|
4673
|
+
F: __dxlog_file20,
|
|
4638
4674
|
L: 143,
|
|
4639
4675
|
S: this,
|
|
4640
4676
|
C: (f, a) => f(...a)
|
|
@@ -4642,8 +4678,8 @@ var NotarizationPlugin = class {
|
|
|
4642
4678
|
await peer.rpc.NotarizationService.notarize({
|
|
4643
4679
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4644
4680
|
});
|
|
4645
|
-
|
|
4646
|
-
F:
|
|
4681
|
+
log17("success", void 0, {
|
|
4682
|
+
F: __dxlog_file20,
|
|
4647
4683
|
L: 147,
|
|
4648
4684
|
S: this,
|
|
4649
4685
|
C: (f, a) => f(...a)
|
|
@@ -4651,8 +4687,8 @@ var NotarizationPlugin = class {
|
|
|
4651
4687
|
await sleep2(successDelay);
|
|
4652
4688
|
} catch (err) {
|
|
4653
4689
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4654
|
-
|
|
4655
|
-
F:
|
|
4690
|
+
log17.info("error notarizing (recoverable)", err, {
|
|
4691
|
+
F: __dxlog_file20,
|
|
4656
4692
|
L: 151,
|
|
4657
4693
|
S: this,
|
|
4658
4694
|
C: (f, a) => f(...a)
|
|
@@ -4669,8 +4705,8 @@ var NotarizationPlugin = class {
|
|
|
4669
4705
|
allNotarized,
|
|
4670
4706
|
errors.wait()
|
|
4671
4707
|
]);
|
|
4672
|
-
|
|
4673
|
-
F:
|
|
4708
|
+
log17("done", void 0, {
|
|
4709
|
+
F: __dxlog_file20,
|
|
4674
4710
|
L: 162,
|
|
4675
4711
|
S: this,
|
|
4676
4712
|
C: (f, a) => f(...a)
|
|
@@ -4692,7 +4728,7 @@ var NotarizationPlugin = class {
|
|
|
4692
4728
|
}
|
|
4693
4729
|
setWriter(writer) {
|
|
4694
4730
|
invariant14(!this._writer, "Writer already set.", {
|
|
4695
|
-
F:
|
|
4731
|
+
F: __dxlog_file20,
|
|
4696
4732
|
L: 181,
|
|
4697
4733
|
S: this,
|
|
4698
4734
|
A: [
|
|
@@ -4717,7 +4753,7 @@ var NotarizationPlugin = class {
|
|
|
4717
4753
|
}
|
|
4718
4754
|
for (const credential of request.credentials ?? []) {
|
|
4719
4755
|
invariant14(credential.id, "Credential must have an id", {
|
|
4720
|
-
F:
|
|
4756
|
+
F: __dxlog_file20,
|
|
4721
4757
|
L: 200,
|
|
4722
4758
|
S: this,
|
|
4723
4759
|
A: [
|
|
@@ -4734,10 +4770,10 @@ var NotarizationPlugin = class {
|
|
|
4734
4770
|
createExtension() {
|
|
4735
4771
|
const extension = new NotarizationTeleportExtension({
|
|
4736
4772
|
onOpen: async () => {
|
|
4737
|
-
|
|
4773
|
+
log17("extension opened", {
|
|
4738
4774
|
peer: extension.localPeerId
|
|
4739
4775
|
}, {
|
|
4740
|
-
F:
|
|
4776
|
+
F: __dxlog_file20,
|
|
4741
4777
|
L: 211,
|
|
4742
4778
|
S: this,
|
|
4743
4779
|
C: (f, a) => f(...a)
|
|
@@ -4746,10 +4782,10 @@ var NotarizationPlugin = class {
|
|
|
4746
4782
|
this._extensionOpened.emit();
|
|
4747
4783
|
},
|
|
4748
4784
|
onClose: async () => {
|
|
4749
|
-
|
|
4785
|
+
log17("extension closed", {
|
|
4750
4786
|
peer: extension.localPeerId
|
|
4751
4787
|
}, {
|
|
4752
|
-
F:
|
|
4788
|
+
F: __dxlog_file20,
|
|
4753
4789
|
L: 216,
|
|
4754
4790
|
S: this,
|
|
4755
4791
|
C: (f, a) => f(...a)
|
|
@@ -4866,11 +4902,11 @@ function _using_ctx2() {
|
|
|
4866
4902
|
}
|
|
4867
4903
|
};
|
|
4868
4904
|
}
|
|
4869
|
-
var
|
|
4905
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4870
4906
|
var DataSpace = class {
|
|
4871
4907
|
constructor(params) {
|
|
4872
4908
|
this._ctx = new Context8(void 0, {
|
|
4873
|
-
F:
|
|
4909
|
+
F: __dxlog_file21,
|
|
4874
4910
|
L: 89
|
|
4875
4911
|
});
|
|
4876
4912
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
@@ -4915,10 +4951,10 @@ var DataSpace = class {
|
|
|
4915
4951
|
});
|
|
4916
4952
|
}
|
|
4917
4953
|
this._state = params.initialState;
|
|
4918
|
-
|
|
4954
|
+
log18("new state", {
|
|
4919
4955
|
state: SpaceState2[this._state]
|
|
4920
4956
|
}, {
|
|
4921
|
-
F:
|
|
4957
|
+
F: __dxlog_file21,
|
|
4922
4958
|
L: 159,
|
|
4923
4959
|
S: this,
|
|
4924
4960
|
C: (f, a) => f(...a)
|
|
@@ -4977,15 +5013,15 @@ var DataSpace = class {
|
|
|
4977
5013
|
this.inner.protocol.feedAdded.append(this._onFeedAdded);
|
|
4978
5014
|
}
|
|
4979
5015
|
await this._inner.open(new Context8(void 0, {
|
|
4980
|
-
F:
|
|
5016
|
+
F: __dxlog_file21,
|
|
4981
5017
|
L: 233
|
|
4982
5018
|
}));
|
|
4983
5019
|
await this._edgeFeedReplicator?.open();
|
|
4984
5020
|
this._state = SpaceState2.SPACE_CONTROL_ONLY;
|
|
4985
|
-
|
|
5021
|
+
log18("new state", {
|
|
4986
5022
|
state: SpaceState2[this._state]
|
|
4987
5023
|
}, {
|
|
4988
|
-
F:
|
|
5024
|
+
F: __dxlog_file21,
|
|
4989
5025
|
L: 238,
|
|
4990
5026
|
S: this,
|
|
4991
5027
|
C: (f, a) => f(...a)
|
|
@@ -5002,17 +5038,17 @@ var DataSpace = class {
|
|
|
5002
5038
|
await this._callbacks.beforeClose?.();
|
|
5003
5039
|
await this.preClose.callSerial();
|
|
5004
5040
|
this._state = SpaceState2.SPACE_CLOSED;
|
|
5005
|
-
|
|
5041
|
+
log18("new state", {
|
|
5006
5042
|
state: SpaceState2[this._state]
|
|
5007
5043
|
}, {
|
|
5008
|
-
F:
|
|
5044
|
+
F: __dxlog_file21,
|
|
5009
5045
|
L: 257,
|
|
5010
5046
|
S: this,
|
|
5011
5047
|
C: (f, a) => f(...a)
|
|
5012
5048
|
});
|
|
5013
5049
|
await this._ctx.dispose();
|
|
5014
5050
|
this._ctx = new Context8(void 0, {
|
|
5015
|
-
F:
|
|
5051
|
+
F: __dxlog_file21,
|
|
5016
5052
|
L: 259
|
|
5017
5053
|
});
|
|
5018
5054
|
if (this._edgeFeedReplicator) {
|
|
@@ -5044,25 +5080,25 @@ var DataSpace = class {
|
|
|
5044
5080
|
await this.initializeDataPipeline();
|
|
5045
5081
|
} catch (err) {
|
|
5046
5082
|
if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
|
|
5047
|
-
|
|
5048
|
-
F:
|
|
5083
|
+
log18("data pipeline initialization cancelled", err, {
|
|
5084
|
+
F: __dxlog_file21,
|
|
5049
5085
|
L: 297,
|
|
5050
5086
|
S: this,
|
|
5051
5087
|
C: (f, a) => f(...a)
|
|
5052
5088
|
});
|
|
5053
5089
|
return;
|
|
5054
5090
|
}
|
|
5055
|
-
|
|
5056
|
-
F:
|
|
5091
|
+
log18.error("Error initializing data pipeline", err, {
|
|
5092
|
+
F: __dxlog_file21,
|
|
5057
5093
|
L: 301,
|
|
5058
5094
|
S: this,
|
|
5059
5095
|
C: (f, a) => f(...a)
|
|
5060
5096
|
});
|
|
5061
5097
|
this._state = SpaceState2.SPACE_ERROR;
|
|
5062
|
-
|
|
5098
|
+
log18("new state", {
|
|
5063
5099
|
state: SpaceState2[this._state]
|
|
5064
5100
|
}, {
|
|
5065
|
-
F:
|
|
5101
|
+
F: __dxlog_file21,
|
|
5066
5102
|
L: 303,
|
|
5067
5103
|
S: this,
|
|
5068
5104
|
C: (f, a) => f(...a)
|
|
@@ -5079,10 +5115,10 @@ var DataSpace = class {
|
|
|
5079
5115
|
throw new SystemError("Invalid operation");
|
|
5080
5116
|
}
|
|
5081
5117
|
this._state = SpaceState2.SPACE_INITIALIZING;
|
|
5082
|
-
|
|
5118
|
+
log18("new state", {
|
|
5083
5119
|
state: SpaceState2[this._state]
|
|
5084
5120
|
}, {
|
|
5085
|
-
F:
|
|
5121
|
+
F: __dxlog_file21,
|
|
5086
5122
|
L: 319,
|
|
5087
5123
|
S: this,
|
|
5088
5124
|
C: (f, a) => f(...a)
|
|
@@ -5096,10 +5132,10 @@ var DataSpace = class {
|
|
|
5096
5132
|
async _enterReadyState() {
|
|
5097
5133
|
await this._callbacks.beforeReady?.();
|
|
5098
5134
|
this._state = SpaceState2.SPACE_READY;
|
|
5099
|
-
|
|
5135
|
+
log18("new state", {
|
|
5100
5136
|
state: SpaceState2[this._state]
|
|
5101
5137
|
}, {
|
|
5102
|
-
F:
|
|
5138
|
+
F: __dxlog_file21,
|
|
5103
5139
|
L: 338,
|
|
5104
5140
|
S: this,
|
|
5105
5141
|
C: (f, a) => f(...a)
|
|
@@ -5114,8 +5150,8 @@ var DataSpace = class {
|
|
|
5114
5150
|
});
|
|
5115
5151
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
5116
5152
|
await this._createWritableFeeds();
|
|
5117
|
-
|
|
5118
|
-
F:
|
|
5153
|
+
log18("writable feeds created", void 0, {
|
|
5154
|
+
F: __dxlog_file21,
|
|
5119
5155
|
L: 354,
|
|
5120
5156
|
S: this,
|
|
5121
5157
|
C: (f, a) => f(...a)
|
|
@@ -5174,11 +5210,11 @@ var DataSpace = class {
|
|
|
5174
5210
|
}
|
|
5175
5211
|
}
|
|
5176
5212
|
_onNewAutomergeRoot(rootUrl) {
|
|
5177
|
-
|
|
5213
|
+
log18("loading automerge root doc for space", {
|
|
5178
5214
|
space: this.key,
|
|
5179
5215
|
rootUrl
|
|
5180
5216
|
}, {
|
|
5181
|
-
F:
|
|
5217
|
+
F: __dxlog_file21,
|
|
5182
5218
|
L: 420,
|
|
5183
5219
|
S: this,
|
|
5184
5220
|
C: (f, a) => f(...a)
|
|
@@ -5225,12 +5261,12 @@ var DataSpace = class {
|
|
|
5225
5261
|
if (err instanceof ContextDisposedError3) {
|
|
5226
5262
|
return;
|
|
5227
5263
|
}
|
|
5228
|
-
|
|
5264
|
+
log18.warn("error loading automerge root doc", {
|
|
5229
5265
|
space: this.key,
|
|
5230
5266
|
rootUrl,
|
|
5231
5267
|
err
|
|
5232
5268
|
}, {
|
|
5233
|
-
F:
|
|
5269
|
+
F: __dxlog_file21,
|
|
5234
5270
|
L: 463,
|
|
5235
5271
|
S: this,
|
|
5236
5272
|
C: (f, a) => f(...a)
|
|
@@ -5317,10 +5353,10 @@ var DataSpace = class {
|
|
|
5317
5353
|
await this._close();
|
|
5318
5354
|
}
|
|
5319
5355
|
this._state = SpaceState2.SPACE_INACTIVE;
|
|
5320
|
-
|
|
5356
|
+
log18("new state", {
|
|
5321
5357
|
state: SpaceState2[this._state]
|
|
5322
5358
|
}, {
|
|
5323
|
-
F:
|
|
5359
|
+
F: __dxlog_file21,
|
|
5324
5360
|
L: 545,
|
|
5325
5361
|
S: this,
|
|
5326
5362
|
C: (f, a) => f(...a)
|
|
@@ -5389,7 +5425,7 @@ import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference }
|
|
|
5389
5425
|
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
5390
5426
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
5391
5427
|
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
5392
|
-
import { log as
|
|
5428
|
+
import { log as log19 } from "@dxos/log";
|
|
5393
5429
|
import { AlreadyJoinedError as AlreadyJoinedError3, trace as Trace2 } from "@dxos/protocols";
|
|
5394
5430
|
import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5395
5431
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -5478,7 +5514,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5478
5514
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5479
5515
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5480
5516
|
}
|
|
5481
|
-
var
|
|
5517
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
5482
5518
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
5483
5519
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
5484
5520
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -5533,45 +5569,45 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5533
5569
|
return this._spaces;
|
|
5534
5570
|
}
|
|
5535
5571
|
async _open() {
|
|
5536
|
-
|
|
5537
|
-
F:
|
|
5572
|
+
log19("open", void 0, {
|
|
5573
|
+
F: __dxlog_file22,
|
|
5538
5574
|
L: 192,
|
|
5539
5575
|
S: this,
|
|
5540
5576
|
C: (f, a) => f(...a)
|
|
5541
5577
|
});
|
|
5542
|
-
|
|
5578
|
+
log19.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
5543
5579
|
id: this._instanceId
|
|
5544
5580
|
}), {
|
|
5545
|
-
F:
|
|
5581
|
+
F: __dxlog_file22,
|
|
5546
5582
|
L: 193,
|
|
5547
5583
|
S: this,
|
|
5548
5584
|
C: (f, a) => f(...a)
|
|
5549
5585
|
});
|
|
5550
|
-
|
|
5586
|
+
log19("metadata loaded", {
|
|
5551
5587
|
spaces: this._metadataStore.spaces.length
|
|
5552
5588
|
}, {
|
|
5553
|
-
F:
|
|
5589
|
+
F: __dxlog_file22,
|
|
5554
5590
|
L: 194,
|
|
5555
5591
|
S: this,
|
|
5556
5592
|
C: (f, a) => f(...a)
|
|
5557
5593
|
});
|
|
5558
5594
|
await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
5559
5595
|
try {
|
|
5560
|
-
|
|
5596
|
+
log19("load space", {
|
|
5561
5597
|
spaceMetadata
|
|
5562
5598
|
}, {
|
|
5563
|
-
F:
|
|
5599
|
+
F: __dxlog_file22,
|
|
5564
5600
|
L: 198,
|
|
5565
5601
|
S: this,
|
|
5566
5602
|
C: (f, a) => f(...a)
|
|
5567
5603
|
});
|
|
5568
5604
|
await this._constructSpace(spaceMetadata);
|
|
5569
5605
|
} catch (err) {
|
|
5570
|
-
|
|
5606
|
+
log19.error("Error loading space", {
|
|
5571
5607
|
spaceMetadata,
|
|
5572
5608
|
err
|
|
5573
5609
|
}, {
|
|
5574
|
-
F:
|
|
5610
|
+
F: __dxlog_file22,
|
|
5575
5611
|
L: 201,
|
|
5576
5612
|
S: this,
|
|
5577
5613
|
C: (f, a) => f(...a)
|
|
@@ -5579,18 +5615,18 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5579
5615
|
}
|
|
5580
5616
|
});
|
|
5581
5617
|
this.updated.emit();
|
|
5582
|
-
|
|
5618
|
+
log19.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
5583
5619
|
id: this._instanceId
|
|
5584
5620
|
}), {
|
|
5585
|
-
F:
|
|
5621
|
+
F: __dxlog_file22,
|
|
5586
5622
|
L: 207,
|
|
5587
5623
|
S: this,
|
|
5588
5624
|
C: (f, a) => f(...a)
|
|
5589
5625
|
});
|
|
5590
5626
|
}
|
|
5591
5627
|
async _close() {
|
|
5592
|
-
|
|
5593
|
-
F:
|
|
5628
|
+
log19("close", void 0, {
|
|
5629
|
+
F: __dxlog_file22,
|
|
5594
5630
|
L: 212,
|
|
5595
5631
|
S: this,
|
|
5596
5632
|
C: (f, a) => f(...a)
|
|
@@ -5605,7 +5641,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5605
5641
|
*/
|
|
5606
5642
|
async createSpace() {
|
|
5607
5643
|
invariant15(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
5608
|
-
F:
|
|
5644
|
+
F: __dxlog_file22,
|
|
5609
5645
|
L: 224,
|
|
5610
5646
|
S: this,
|
|
5611
5647
|
A: [
|
|
@@ -5623,10 +5659,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5623
5659
|
dataFeedKey,
|
|
5624
5660
|
state: SpaceState3.SPACE_ACTIVE
|
|
5625
5661
|
};
|
|
5626
|
-
|
|
5662
|
+
log19("creating space...", {
|
|
5627
5663
|
spaceKey
|
|
5628
5664
|
}, {
|
|
5629
|
-
F:
|
|
5665
|
+
F: __dxlog_file22,
|
|
5630
5666
|
L: 236,
|
|
5631
5667
|
S: this,
|
|
5632
5668
|
C: (f, a) => f(...a)
|
|
@@ -5638,7 +5674,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5638
5674
|
await this._metadataStore.addSpace(metadata);
|
|
5639
5675
|
const memberCredential = credentials[1];
|
|
5640
5676
|
invariant15(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5641
|
-
F:
|
|
5677
|
+
F: __dxlog_file22,
|
|
5642
5678
|
L: 246,
|
|
5643
5679
|
S: this,
|
|
5644
5680
|
A: [
|
|
@@ -5666,11 +5702,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5666
5702
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5667
5703
|
}
|
|
5668
5704
|
default:
|
|
5669
|
-
|
|
5705
|
+
log19.warn("unknown space version", {
|
|
5670
5706
|
version: space.databaseRoot.getVersion(),
|
|
5671
5707
|
spaceId: space.id
|
|
5672
5708
|
}, {
|
|
5673
|
-
F:
|
|
5709
|
+
F: __dxlog_file22,
|
|
5674
5710
|
L: 271,
|
|
5675
5711
|
S: this,
|
|
5676
5712
|
C: (f, a) => f(...a)
|
|
@@ -5705,7 +5741,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5705
5741
|
async _getSpaceRootDocument(space) {
|
|
5706
5742
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5707
5743
|
invariant15(automergeIndex, void 0, {
|
|
5708
|
-
F:
|
|
5744
|
+
F: __dxlog_file22,
|
|
5709
5745
|
L: 304,
|
|
5710
5746
|
S: this,
|
|
5711
5747
|
A: [
|
|
@@ -5719,16 +5755,16 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5719
5755
|
}
|
|
5720
5756
|
// TODO(burdon): Rename join space.
|
|
5721
5757
|
async acceptSpace(opts) {
|
|
5722
|
-
|
|
5758
|
+
log19("accept space", {
|
|
5723
5759
|
opts
|
|
5724
5760
|
}, {
|
|
5725
|
-
F:
|
|
5761
|
+
F: __dxlog_file22,
|
|
5726
5762
|
L: 313,
|
|
5727
5763
|
S: this,
|
|
5728
5764
|
C: (f, a) => f(...a)
|
|
5729
5765
|
});
|
|
5730
5766
|
invariant15(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
5731
|
-
F:
|
|
5767
|
+
F: __dxlog_file22,
|
|
5732
5768
|
L: 314,
|
|
5733
5769
|
S: this,
|
|
5734
5770
|
A: [
|
|
@@ -5737,7 +5773,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5737
5773
|
]
|
|
5738
5774
|
});
|
|
5739
5775
|
invariant15(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5740
|
-
F:
|
|
5776
|
+
F: __dxlog_file22,
|
|
5741
5777
|
L: 315,
|
|
5742
5778
|
S: this,
|
|
5743
5779
|
A: [
|
|
@@ -5761,7 +5797,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5761
5797
|
async admitMember(options) {
|
|
5762
5798
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5763
5799
|
invariant15(space, void 0, {
|
|
5764
|
-
F:
|
|
5800
|
+
F: __dxlog_file22,
|
|
5765
5801
|
L: 335,
|
|
5766
5802
|
S: this,
|
|
5767
5803
|
A: [
|
|
@@ -5774,7 +5810,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5774
5810
|
}
|
|
5775
5811
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5776
5812
|
invariant15(credentials[0].credential, void 0, {
|
|
5777
|
-
F:
|
|
5813
|
+
F: __dxlog_file22,
|
|
5778
5814
|
L: 354,
|
|
5779
5815
|
S: this,
|
|
5780
5816
|
A: [
|
|
@@ -5784,7 +5820,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5784
5820
|
});
|
|
5785
5821
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5786
5822
|
invariant15(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5787
|
-
F:
|
|
5823
|
+
F: __dxlog_file22,
|
|
5788
5824
|
L: 356,
|
|
5789
5825
|
S: this,
|
|
5790
5826
|
A: [
|
|
@@ -5820,10 +5856,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5820
5856
|
});
|
|
5821
5857
|
}
|
|
5822
5858
|
async _constructSpace(metadata) {
|
|
5823
|
-
|
|
5859
|
+
log19("construct space", {
|
|
5824
5860
|
metadata
|
|
5825
5861
|
}, {
|
|
5826
|
-
F:
|
|
5862
|
+
F: __dxlog_file22,
|
|
5827
5863
|
L: 392,
|
|
5828
5864
|
S: this,
|
|
5829
5865
|
C: (f, a) => f(...a)
|
|
@@ -5864,10 +5900,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5864
5900
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
5865
5901
|
await this._connectEchoMeshReplicator(space, session);
|
|
5866
5902
|
} catch (err) {
|
|
5867
|
-
|
|
5903
|
+
log19.warn("error on authorized connection", {
|
|
5868
5904
|
err
|
|
5869
5905
|
}, {
|
|
5870
|
-
F:
|
|
5906
|
+
F: __dxlog_file22,
|
|
5871
5907
|
L: 434,
|
|
5872
5908
|
S: this,
|
|
5873
5909
|
C: (f, a) => f(...a)
|
|
@@ -5876,8 +5912,8 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5876
5912
|
}
|
|
5877
5913
|
}),
|
|
5878
5914
|
onAuthFailure: () => {
|
|
5879
|
-
|
|
5880
|
-
F:
|
|
5915
|
+
log19.warn("auth failure", void 0, {
|
|
5916
|
+
F: __dxlog_file22,
|
|
5881
5917
|
L: 439,
|
|
5882
5918
|
S: this,
|
|
5883
5919
|
C: (f, a) => f(...a)
|
|
@@ -5907,21 +5943,21 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5907
5943
|
signingContext: this._signingContext,
|
|
5908
5944
|
callbacks: {
|
|
5909
5945
|
beforeReady: async () => {
|
|
5910
|
-
|
|
5946
|
+
log19("before space ready", {
|
|
5911
5947
|
space: space.key
|
|
5912
5948
|
}, {
|
|
5913
|
-
F:
|
|
5949
|
+
F: __dxlog_file22,
|
|
5914
5950
|
L: 466,
|
|
5915
5951
|
S: this,
|
|
5916
5952
|
C: (f, a) => f(...a)
|
|
5917
5953
|
});
|
|
5918
5954
|
},
|
|
5919
5955
|
afterReady: async () => {
|
|
5920
|
-
|
|
5956
|
+
log19("after space ready", {
|
|
5921
5957
|
space: space.key,
|
|
5922
5958
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
5923
5959
|
}, {
|
|
5924
|
-
F:
|
|
5960
|
+
F: __dxlog_file22,
|
|
5925
5961
|
L: 469,
|
|
5926
5962
|
S: this,
|
|
5927
5963
|
C: (f, a) => f(...a)
|
|
@@ -5937,10 +5973,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5937
5973
|
}
|
|
5938
5974
|
},
|
|
5939
5975
|
beforeClose: async () => {
|
|
5940
|
-
|
|
5976
|
+
log19("before space close", {
|
|
5941
5977
|
space: space.key
|
|
5942
5978
|
}, {
|
|
5943
|
-
F:
|
|
5979
|
+
F: __dxlog_file22,
|
|
5944
5980
|
L: 477,
|
|
5945
5981
|
S: this,
|
|
5946
5982
|
C: (f, a) => f(...a)
|
|
@@ -5971,10 +6007,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5971
6007
|
async _connectEchoMeshReplicator(space, session) {
|
|
5972
6008
|
const replicator = this._meshReplicator;
|
|
5973
6009
|
if (!replicator) {
|
|
5974
|
-
|
|
6010
|
+
log19.warn("p2p automerge replication disabled", {
|
|
5975
6011
|
space: space.key
|
|
5976
6012
|
}, {
|
|
5977
|
-
F:
|
|
6013
|
+
F: __dxlog_file22,
|
|
5978
6014
|
L: 508,
|
|
5979
6015
|
S: this,
|
|
5980
6016
|
C: (f, a) => f(...a)
|
|
@@ -5998,16 +6034,16 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5998
6034
|
return (s && member.role === SpaceMember6.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
|
|
5999
6035
|
});
|
|
6000
6036
|
sessionsToClose.forEach((session) => {
|
|
6001
|
-
void session.close().catch(
|
|
6037
|
+
void session.close().catch(log19.error);
|
|
6002
6038
|
});
|
|
6003
6039
|
closedSessions += sessionsToClose.length;
|
|
6004
6040
|
}
|
|
6005
|
-
|
|
6041
|
+
log19("processed member role changes", {
|
|
6006
6042
|
roleChangeCount: memberInfo.length,
|
|
6007
6043
|
peersOnline: presence.getPeersOnline().length,
|
|
6008
6044
|
closedSessions
|
|
6009
6045
|
}, {
|
|
6010
|
-
F:
|
|
6046
|
+
F: __dxlog_file22,
|
|
6011
6047
|
L: 534,
|
|
6012
6048
|
S: this,
|
|
6013
6049
|
C: (f, a) => f(...a)
|
|
@@ -6019,15 +6055,15 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
6019
6055
|
if (role === SpaceMember6.Role.REMOVED) {
|
|
6020
6056
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
6021
6057
|
if (session != null) {
|
|
6022
|
-
|
|
6058
|
+
log19("closing a session with a removed peer", {
|
|
6023
6059
|
peerId: peerState.peerId
|
|
6024
6060
|
}, {
|
|
6025
|
-
F:
|
|
6061
|
+
F: __dxlog_file22,
|
|
6026
6062
|
L: 548,
|
|
6027
6063
|
S: this,
|
|
6028
6064
|
C: (f, a) => f(...a)
|
|
6029
6065
|
});
|
|
6030
|
-
void session.close().catch(
|
|
6066
|
+
void session.close().catch(log19.error);
|
|
6031
6067
|
}
|
|
6032
6068
|
}
|
|
6033
6069
|
}
|
|
@@ -6090,11 +6126,11 @@ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentia
|
|
|
6090
6126
|
import { raise as raise2 } from "@dxos/debug";
|
|
6091
6127
|
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
6092
6128
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
6093
|
-
import { log as
|
|
6129
|
+
import { log as log20 } from "@dxos/log";
|
|
6094
6130
|
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
6095
6131
|
import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6096
6132
|
import { trace as trace8 } from "@dxos/tracing";
|
|
6097
|
-
var
|
|
6133
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
6098
6134
|
var SpacesServiceImpl = class {
|
|
6099
6135
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
6100
6136
|
this._identityManager = _identityManager;
|
|
@@ -6138,7 +6174,7 @@ var SpacesServiceImpl = class {
|
|
|
6138
6174
|
}
|
|
6139
6175
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
6140
6176
|
invariant16(credentials[0].credential, void 0, {
|
|
6141
|
-
F:
|
|
6177
|
+
F: __dxlog_file23,
|
|
6142
6178
|
L: 102,
|
|
6143
6179
|
S: this,
|
|
6144
6180
|
A: [
|
|
@@ -6148,7 +6184,7 @@ var SpacesServiceImpl = class {
|
|
|
6148
6184
|
});
|
|
6149
6185
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
6150
6186
|
invariant16(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
6151
|
-
F:
|
|
6187
|
+
F: __dxlog_file23,
|
|
6152
6188
|
L: 104,
|
|
6153
6189
|
S: this,
|
|
6154
6190
|
A: [
|
|
@@ -6163,10 +6199,10 @@ var SpacesServiceImpl = class {
|
|
|
6163
6199
|
const scheduler = new UpdateScheduler(ctx, async () => {
|
|
6164
6200
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6165
6201
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
6166
|
-
|
|
6202
|
+
log20("update", () => ({
|
|
6167
6203
|
ids: spaces.map((space) => space.id)
|
|
6168
6204
|
}), {
|
|
6169
|
-
F:
|
|
6205
|
+
F: __dxlog_file23,
|
|
6170
6206
|
L: 115,
|
|
6171
6207
|
S: this,
|
|
6172
6208
|
C: (f, a) => f(...a)
|
|
@@ -6258,7 +6294,7 @@ var SpacesServiceImpl = class {
|
|
|
6258
6294
|
});
|
|
6259
6295
|
} else {
|
|
6260
6296
|
invariant16(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
6261
|
-
F:
|
|
6297
|
+
F: __dxlog_file23,
|
|
6262
6298
|
L: 213,
|
|
6263
6299
|
S: this,
|
|
6264
6300
|
A: [
|
|
@@ -6267,7 +6303,7 @@ var SpacesServiceImpl = class {
|
|
|
6267
6303
|
]
|
|
6268
6304
|
});
|
|
6269
6305
|
invariant16(this._identityManager.identity, "Identity is not available", {
|
|
6270
|
-
F:
|
|
6306
|
+
F: __dxlog_file23,
|
|
6271
6307
|
L: 214,
|
|
6272
6308
|
S: this,
|
|
6273
6309
|
A: [
|
|
@@ -6277,7 +6313,7 @@ var SpacesServiceImpl = class {
|
|
|
6277
6313
|
});
|
|
6278
6314
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
6279
6315
|
invariant16(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
6280
|
-
F:
|
|
6316
|
+
F: __dxlog_file23,
|
|
6281
6317
|
L: 216,
|
|
6282
6318
|
S: this,
|
|
6283
6319
|
A: [
|
|
@@ -6327,7 +6363,7 @@ var SpacesServiceImpl = class {
|
|
|
6327
6363
|
async _joinByAdmission({ credential }) {
|
|
6328
6364
|
const assertion = getCredentialAssertion4(credential);
|
|
6329
6365
|
invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6330
|
-
F:
|
|
6366
|
+
F: __dxlog_file23,
|
|
6331
6367
|
L: 250,
|
|
6332
6368
|
S: this,
|
|
6333
6369
|
A: [
|
|
@@ -6337,7 +6373,7 @@ var SpacesServiceImpl = class {
|
|
|
6337
6373
|
});
|
|
6338
6374
|
const myIdentity = this._identityManager.identity;
|
|
6339
6375
|
invariant16(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
6340
|
-
F:
|
|
6376
|
+
F: __dxlog_file23,
|
|
6341
6377
|
L: 252,
|
|
6342
6378
|
S: this,
|
|
6343
6379
|
A: [
|
|
@@ -6434,7 +6470,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
|
6434
6470
|
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6435
6471
|
import { Keyring } from "@dxos/keyring";
|
|
6436
6472
|
import { PublicKey as PublicKey13 } from "@dxos/keys";
|
|
6437
|
-
import { log as
|
|
6473
|
+
import { log as log21 } from "@dxos/log";
|
|
6438
6474
|
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
|
|
6439
6475
|
import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6440
6476
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
@@ -6450,7 +6486,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
6450
6486
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6451
6487
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6452
6488
|
}
|
|
6453
|
-
var
|
|
6489
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
6454
6490
|
var ServiceContext = class extends Resource5 {
|
|
6455
6491
|
constructor(storage, level, networkManager, signalManager, _edgeConnection, _runtimeParams, _edgeFeatures) {
|
|
6456
6492
|
super();
|
|
@@ -6489,19 +6525,19 @@ var ServiceContext = class extends Resource5 {
|
|
|
6489
6525
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams, {
|
|
6490
6526
|
onIdentityConstruction: (identity) => {
|
|
6491
6527
|
if (this._edgeConnection) {
|
|
6492
|
-
|
|
6528
|
+
log21.info("Setting identity on edge connection", {
|
|
6493
6529
|
identity: identity.identityKey.toHex(),
|
|
6494
|
-
oldIdentity: this._edgeConnection.identityKey
|
|
6530
|
+
oldIdentity: this._edgeConnection.identityKey,
|
|
6495
6531
|
swarms: this.networkManager.topics
|
|
6496
6532
|
}, {
|
|
6497
|
-
F:
|
|
6533
|
+
F: __dxlog_file24,
|
|
6498
6534
|
L: 128,
|
|
6499
6535
|
S: this,
|
|
6500
6536
|
C: (f, a) => f(...a)
|
|
6501
6537
|
});
|
|
6502
6538
|
this._edgeConnection.setIdentity({
|
|
6503
|
-
|
|
6504
|
-
identityKey: identity.identityKey
|
|
6539
|
+
peerKey: identity.deviceKey.toHex(),
|
|
6540
|
+
identityKey: identity.identityKey.toHex()
|
|
6505
6541
|
});
|
|
6506
6542
|
this.networkManager.setPeerInfo({
|
|
6507
6543
|
identityKey: identity.identityKey.toHex(),
|
|
@@ -6528,16 +6564,16 @@ var ServiceContext = class extends Resource5 {
|
|
|
6528
6564
|
}
|
|
6529
6565
|
async _open(ctx) {
|
|
6530
6566
|
await this._checkStorageVersion();
|
|
6531
|
-
|
|
6532
|
-
F:
|
|
6567
|
+
log21("opening...", void 0, {
|
|
6568
|
+
F: __dxlog_file24,
|
|
6533
6569
|
L: 186,
|
|
6534
6570
|
S: this,
|
|
6535
6571
|
C: (f, a) => f(...a)
|
|
6536
6572
|
});
|
|
6537
|
-
|
|
6573
|
+
log21.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
6538
6574
|
id: this._instanceId
|
|
6539
6575
|
}), {
|
|
6540
|
-
F:
|
|
6576
|
+
F: __dxlog_file24,
|
|
6541
6577
|
L: 187,
|
|
6542
6578
|
S: this,
|
|
6543
6579
|
C: (f, a) => f(...a)
|
|
@@ -6559,32 +6595,32 @@ var ServiceContext = class extends Resource5 {
|
|
|
6559
6595
|
await this._initialize(ctx);
|
|
6560
6596
|
}
|
|
6561
6597
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
6562
|
-
|
|
6598
|
+
log21("loaded persistent invitations", {
|
|
6563
6599
|
count: loadedInvitations.invitations?.length
|
|
6564
6600
|
}, {
|
|
6565
|
-
F:
|
|
6601
|
+
F: __dxlog_file24,
|
|
6566
6602
|
L: 210,
|
|
6567
6603
|
S: this,
|
|
6568
6604
|
C: (f, a) => f(...a)
|
|
6569
6605
|
});
|
|
6570
|
-
|
|
6606
|
+
log21.trace("dxos.sdk.service-context.open", trace9.end({
|
|
6571
6607
|
id: this._instanceId
|
|
6572
6608
|
}), {
|
|
6573
|
-
F:
|
|
6609
|
+
F: __dxlog_file24,
|
|
6574
6610
|
L: 212,
|
|
6575
6611
|
S: this,
|
|
6576
6612
|
C: (f, a) => f(...a)
|
|
6577
6613
|
});
|
|
6578
|
-
|
|
6579
|
-
F:
|
|
6614
|
+
log21("opened", void 0, {
|
|
6615
|
+
F: __dxlog_file24,
|
|
6580
6616
|
L: 213,
|
|
6581
6617
|
S: this,
|
|
6582
6618
|
C: (f, a) => f(...a)
|
|
6583
6619
|
});
|
|
6584
6620
|
}
|
|
6585
6621
|
async _close(ctx) {
|
|
6586
|
-
|
|
6587
|
-
F:
|
|
6622
|
+
log21("closing...", void 0, {
|
|
6623
|
+
F: __dxlog_file24,
|
|
6588
6624
|
L: 217,
|
|
6589
6625
|
S: this,
|
|
6590
6626
|
C: (f, a) => f(...a)
|
|
@@ -6601,8 +6637,8 @@ var ServiceContext = class extends Resource5 {
|
|
|
6601
6637
|
await this.networkManager.close();
|
|
6602
6638
|
await this.signalManager.close();
|
|
6603
6639
|
await this._edgeConnection?.close();
|
|
6604
|
-
|
|
6605
|
-
F:
|
|
6640
|
+
log21("closed", void 0, {
|
|
6641
|
+
F: __dxlog_file24,
|
|
6606
6642
|
L: 232,
|
|
6607
6643
|
S: this,
|
|
6608
6644
|
C: (f, a) => f(...a)
|
|
@@ -6611,7 +6647,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6611
6647
|
async createIdentity(params = {}) {
|
|
6612
6648
|
const identity = await this.identityManager.createIdentity(params);
|
|
6613
6649
|
await this._initialize(new Context9(void 0, {
|
|
6614
|
-
F:
|
|
6650
|
+
F: __dxlog_file24,
|
|
6615
6651
|
L: 237
|
|
6616
6652
|
}));
|
|
6617
6653
|
return identity;
|
|
@@ -6619,7 +6655,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6619
6655
|
getInvitationHandler(invitation) {
|
|
6620
6656
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
6621
6657
|
invariant17(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
6622
|
-
F:
|
|
6658
|
+
F: __dxlog_file24,
|
|
6623
6659
|
L: 243,
|
|
6624
6660
|
S: this,
|
|
6625
6661
|
A: [
|
|
@@ -6640,7 +6676,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6640
6676
|
async _acceptIdentity(params) {
|
|
6641
6677
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
6642
6678
|
await this._initialize(new Context9(void 0, {
|
|
6643
|
-
F:
|
|
6679
|
+
F: __dxlog_file24,
|
|
6644
6680
|
L: 259
|
|
6645
6681
|
}));
|
|
6646
6682
|
return identity;
|
|
@@ -6653,8 +6689,8 @@ var ServiceContext = class extends Resource5 {
|
|
|
6653
6689
|
}
|
|
6654
6690
|
// Called when identity is created.
|
|
6655
6691
|
async _initialize(ctx) {
|
|
6656
|
-
|
|
6657
|
-
F:
|
|
6692
|
+
log21("initializing spaces...", void 0, {
|
|
6693
|
+
F: __dxlog_file24,
|
|
6658
6694
|
L: 274,
|
|
6659
6695
|
S: this,
|
|
6660
6696
|
C: (f, a) => f(...a)
|
|
@@ -6690,7 +6726,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6690
6726
|
await this.dataSpaceManager.open();
|
|
6691
6727
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
6692
6728
|
invariant17(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
6693
|
-
F:
|
|
6729
|
+
F: __dxlog_file24,
|
|
6694
6730
|
L: 303,
|
|
6695
6731
|
S: this,
|
|
6696
6732
|
A: [
|
|
@@ -6711,10 +6747,10 @@ var ServiceContext = class extends Resource5 {
|
|
|
6711
6747
|
return;
|
|
6712
6748
|
}
|
|
6713
6749
|
if (!this.dataSpaceManager) {
|
|
6714
|
-
|
|
6750
|
+
log21("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
6715
6751
|
details: assertion
|
|
6716
6752
|
}, {
|
|
6717
|
-
F:
|
|
6753
|
+
F: __dxlog_file24,
|
|
6718
6754
|
L: 319,
|
|
6719
6755
|
S: this,
|
|
6720
6756
|
C: (f, a) => f(...a)
|
|
@@ -6722,10 +6758,10 @@ var ServiceContext = class extends Resource5 {
|
|
|
6722
6758
|
return;
|
|
6723
6759
|
}
|
|
6724
6760
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
6725
|
-
|
|
6761
|
+
log21("space already exists, ignoring space admission", {
|
|
6726
6762
|
details: assertion
|
|
6727
6763
|
}, {
|
|
6728
|
-
F:
|
|
6764
|
+
F: __dxlog_file24,
|
|
6729
6765
|
L: 323,
|
|
6730
6766
|
S: this,
|
|
6731
6767
|
C: (f, a) => f(...a)
|
|
@@ -6733,10 +6769,10 @@ var ServiceContext = class extends Resource5 {
|
|
|
6733
6769
|
return;
|
|
6734
6770
|
}
|
|
6735
6771
|
try {
|
|
6736
|
-
|
|
6772
|
+
log21("accepting space recorded in halo", {
|
|
6737
6773
|
details: assertion
|
|
6738
6774
|
}, {
|
|
6739
|
-
F:
|
|
6775
|
+
F: __dxlog_file24,
|
|
6740
6776
|
L: 328,
|
|
6741
6777
|
S: this,
|
|
6742
6778
|
C: (f, a) => f(...a)
|
|
@@ -6746,8 +6782,8 @@ var ServiceContext = class extends Resource5 {
|
|
|
6746
6782
|
genesisFeedKey: assertion.genesisFeedKey
|
|
6747
6783
|
});
|
|
6748
6784
|
} catch (err) {
|
|
6749
|
-
|
|
6750
|
-
F:
|
|
6785
|
+
log21.catch(err, void 0, {
|
|
6786
|
+
F: __dxlog_file24,
|
|
6751
6787
|
L: 334,
|
|
6752
6788
|
S: this,
|
|
6753
6789
|
C: (f, a) => f(...a)
|
|
@@ -6870,10 +6906,10 @@ var createLevel = async (config) => {
|
|
|
6870
6906
|
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
6871
6907
|
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
6872
6908
|
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6873
|
-
import { log as
|
|
6909
|
+
import { log as log22 } from "@dxos/log";
|
|
6874
6910
|
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
6875
6911
|
import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
|
|
6876
|
-
var
|
|
6912
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6877
6913
|
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
6878
6914
|
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
6879
6915
|
var exportProfileData = async ({ storage, level }) => {
|
|
@@ -6886,10 +6922,10 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6886
6922
|
{
|
|
6887
6923
|
const directory = await storage.createDirectory();
|
|
6888
6924
|
const files = await directory.list();
|
|
6889
|
-
|
|
6925
|
+
log22.info("begin exporting files", {
|
|
6890
6926
|
count: files.length
|
|
6891
6927
|
}, {
|
|
6892
|
-
F:
|
|
6928
|
+
F: __dxlog_file25,
|
|
6893
6929
|
L: 30,
|
|
6894
6930
|
S: void 0,
|
|
6895
6931
|
C: (f, a) => f(...a)
|
|
@@ -6904,18 +6940,18 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6904
6940
|
value: data
|
|
6905
6941
|
});
|
|
6906
6942
|
}
|
|
6907
|
-
|
|
6943
|
+
log22.info("done exporting files", {
|
|
6908
6944
|
count: files.length
|
|
6909
6945
|
}, {
|
|
6910
|
-
F:
|
|
6946
|
+
F: __dxlog_file25,
|
|
6911
6947
|
L: 41,
|
|
6912
6948
|
S: void 0,
|
|
6913
6949
|
C: (f, a) => f(...a)
|
|
6914
6950
|
});
|
|
6915
6951
|
}
|
|
6916
6952
|
{
|
|
6917
|
-
|
|
6918
|
-
F:
|
|
6953
|
+
log22.info("begin exporting kv pairs", void 0, {
|
|
6954
|
+
F: __dxlog_file25,
|
|
6919
6955
|
L: 45,
|
|
6920
6956
|
S: void 0,
|
|
6921
6957
|
C: (f, a) => f(...a)
|
|
@@ -6933,10 +6969,10 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6933
6969
|
});
|
|
6934
6970
|
count++;
|
|
6935
6971
|
}
|
|
6936
|
-
|
|
6972
|
+
log22.info("done exporting kv pairs", {
|
|
6937
6973
|
count
|
|
6938
6974
|
}, {
|
|
6939
|
-
F:
|
|
6975
|
+
F: __dxlog_file25,
|
|
6940
6976
|
L: 56,
|
|
6941
6977
|
S: void 0,
|
|
6942
6978
|
C: (f, a) => f(...a)
|
|
@@ -6952,7 +6988,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6952
6988
|
case ProfileArchiveEntryType.FILE: {
|
|
6953
6989
|
const directory = await storage.createDirectory();
|
|
6954
6990
|
invariant18(typeof entry2.key === "string", "Invalid key type", {
|
|
6955
|
-
F:
|
|
6991
|
+
F: __dxlog_file25,
|
|
6956
6992
|
L: 79,
|
|
6957
6993
|
S: void 0,
|
|
6958
6994
|
A: [
|
|
@@ -6962,7 +6998,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6962
6998
|
});
|
|
6963
6999
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
6964
7000
|
invariant18(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6965
|
-
F:
|
|
7001
|
+
F: __dxlog_file25,
|
|
6966
7002
|
L: 81,
|
|
6967
7003
|
S: void 0,
|
|
6968
7004
|
A: [
|
|
@@ -6976,7 +7012,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6976
7012
|
}
|
|
6977
7013
|
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
6978
7014
|
invariant18(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6979
|
-
F:
|
|
7015
|
+
F: __dxlog_file25,
|
|
6980
7016
|
L: 87,
|
|
6981
7017
|
S: void 0,
|
|
6982
7018
|
A: [
|
|
@@ -6985,7 +7021,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6985
7021
|
]
|
|
6986
7022
|
});
|
|
6987
7023
|
invariant18(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6988
|
-
F:
|
|
7024
|
+
F: __dxlog_file25,
|
|
6989
7025
|
L: 88,
|
|
6990
7026
|
S: void 0,
|
|
6991
7027
|
A: [
|
|
@@ -7005,20 +7041,20 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
7005
7041
|
if (++count % 1e3 === 0) {
|
|
7006
7042
|
await batch.write();
|
|
7007
7043
|
batch = level.batch();
|
|
7008
|
-
|
|
7044
|
+
log22.info("importing", {
|
|
7009
7045
|
count,
|
|
7010
7046
|
total: archive.storage.length,
|
|
7011
7047
|
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
7012
7048
|
}, {
|
|
7013
|
-
F:
|
|
7049
|
+
F: __dxlog_file25,
|
|
7014
7050
|
L: 101,
|
|
7015
7051
|
S: void 0,
|
|
7016
7052
|
C: (f, a) => f(...a)
|
|
7017
7053
|
});
|
|
7018
7054
|
}
|
|
7019
7055
|
}
|
|
7020
|
-
|
|
7021
|
-
F:
|
|
7056
|
+
log22.info("committing changes..", void 0, {
|
|
7057
|
+
F: __dxlog_file25,
|
|
7022
7058
|
L: 109,
|
|
7023
7059
|
S: void 0,
|
|
7024
7060
|
C: (f, a) => f(...a)
|
|
@@ -7033,7 +7069,7 @@ import { Context as Context10 } from "@dxos/context";
|
|
|
7033
7069
|
import { EdgeClient } from "@dxos/edge-client";
|
|
7034
7070
|
import { invariant as invariant20 } from "@dxos/invariant";
|
|
7035
7071
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
7036
|
-
import { log as
|
|
7072
|
+
import { log as log24 } from "@dxos/log";
|
|
7037
7073
|
import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
|
|
7038
7074
|
import { SwarmNetworkManager, createIceProvider, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
7039
7075
|
import { trace as trace10 } from "@dxos/protocols";
|
|
@@ -7046,7 +7082,7 @@ import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
|
7046
7082
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
7047
7083
|
import { invariant as invariant19 } from "@dxos/invariant";
|
|
7048
7084
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7049
|
-
var
|
|
7085
|
+
var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
7050
7086
|
var DevicesServiceImpl = class {
|
|
7051
7087
|
constructor(_identityManager) {
|
|
7052
7088
|
this._identityManager = _identityManager;
|
|
@@ -7064,7 +7100,7 @@ var DevicesServiceImpl = class {
|
|
|
7064
7100
|
});
|
|
7065
7101
|
} else {
|
|
7066
7102
|
invariant19(this._identityManager.identity?.presence, "presence not present", {
|
|
7067
|
-
F:
|
|
7103
|
+
F: __dxlog_file26,
|
|
7068
7104
|
L: 32,
|
|
7069
7105
|
S: this,
|
|
7070
7106
|
A: [
|
|
@@ -7210,7 +7246,7 @@ var ContactsServiceImpl = class {
|
|
|
7210
7246
|
import { Event as Event9 } from "@dxos/async";
|
|
7211
7247
|
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
7212
7248
|
import { PublicKey as PublicKey16 } from "@dxos/keys";
|
|
7213
|
-
import { getContextFromEntry, log as
|
|
7249
|
+
import { getContextFromEntry, log as log23 } from "@dxos/log";
|
|
7214
7250
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
7215
7251
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
7216
7252
|
var LoggingServiceImpl = class {
|
|
@@ -7223,11 +7259,11 @@ var LoggingServiceImpl = class {
|
|
|
7223
7259
|
};
|
|
7224
7260
|
}
|
|
7225
7261
|
async open() {
|
|
7226
|
-
|
|
7262
|
+
log23.runtimeConfig.processors.push(this._logProcessor);
|
|
7227
7263
|
}
|
|
7228
7264
|
async close() {
|
|
7229
|
-
const index =
|
|
7230
|
-
|
|
7265
|
+
const index = log23.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
7266
|
+
log23.runtimeConfig.processors.splice(index, 1);
|
|
7231
7267
|
}
|
|
7232
7268
|
async controlMetrics({ reset, record }) {
|
|
7233
7269
|
if (reset) {
|
|
@@ -7431,7 +7467,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
7431
7467
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7432
7468
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7433
7469
|
}
|
|
7434
|
-
var
|
|
7470
|
+
var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
7435
7471
|
var ClientServicesHost = class {
|
|
7436
7472
|
constructor({
|
|
7437
7473
|
config,
|
|
@@ -7469,7 +7505,7 @@ var ClientServicesHost = class {
|
|
|
7469
7505
|
onAcquire: () => {
|
|
7470
7506
|
if (!this._opening) {
|
|
7471
7507
|
void this.open(new Context10(void 0, {
|
|
7472
|
-
F:
|
|
7508
|
+
F: __dxlog_file27,
|
|
7473
7509
|
L: 132
|
|
7474
7510
|
}));
|
|
7475
7511
|
}
|
|
@@ -7527,7 +7563,7 @@ var ClientServicesHost = class {
|
|
|
7527
7563
|
*/
|
|
7528
7564
|
initialize({ config, ...options }) {
|
|
7529
7565
|
invariant20(!this._open, "service host is open", {
|
|
7530
|
-
F:
|
|
7566
|
+
F: __dxlog_file27,
|
|
7531
7567
|
L: 198,
|
|
7532
7568
|
S: this,
|
|
7533
7569
|
A: [
|
|
@@ -7535,15 +7571,15 @@ var ClientServicesHost = class {
|
|
|
7535
7571
|
"'service host is open'"
|
|
7536
7572
|
]
|
|
7537
7573
|
});
|
|
7538
|
-
|
|
7539
|
-
F:
|
|
7574
|
+
log24("initializing...", void 0, {
|
|
7575
|
+
F: __dxlog_file27,
|
|
7540
7576
|
L: 199,
|
|
7541
7577
|
S: this,
|
|
7542
7578
|
C: (f, a) => f(...a)
|
|
7543
7579
|
});
|
|
7544
7580
|
if (config) {
|
|
7545
7581
|
invariant20(!this._config, "config already set", {
|
|
7546
|
-
F:
|
|
7582
|
+
F: __dxlog_file27,
|
|
7547
7583
|
L: 202,
|
|
7548
7584
|
S: this,
|
|
7549
7585
|
A: [
|
|
@@ -7557,8 +7593,8 @@ var ClientServicesHost = class {
|
|
|
7557
7593
|
}
|
|
7558
7594
|
}
|
|
7559
7595
|
if (!options.signalManager) {
|
|
7560
|
-
|
|
7561
|
-
F:
|
|
7596
|
+
log24.warn("running signaling without telemetry metadata.", void 0, {
|
|
7597
|
+
F: __dxlog_file27,
|
|
7562
7598
|
L: 210,
|
|
7563
7599
|
S: this,
|
|
7564
7600
|
C: (f, a) => f(...a)
|
|
@@ -7566,7 +7602,8 @@ var ClientServicesHost = class {
|
|
|
7566
7602
|
}
|
|
7567
7603
|
const edgeEndpoint = config?.get("runtime.services.edge.url");
|
|
7568
7604
|
if (edgeEndpoint) {
|
|
7569
|
-
|
|
7605
|
+
const randomKey = PublicKey17.random().toHex();
|
|
7606
|
+
this._edgeConnection = new EdgeClient(randomKey, randomKey, {
|
|
7570
7607
|
socketEndpoint: edgeEndpoint
|
|
7571
7608
|
});
|
|
7572
7609
|
}
|
|
@@ -7577,8 +7614,8 @@ var ClientServicesHost = class {
|
|
|
7577
7614
|
}) : new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
7578
7615
|
this._signalManager = signalManager;
|
|
7579
7616
|
invariant20(!this._networkManager, "network manager already set", {
|
|
7580
|
-
F:
|
|
7581
|
-
L:
|
|
7617
|
+
F: __dxlog_file27,
|
|
7618
|
+
L: 232,
|
|
7582
7619
|
S: this,
|
|
7583
7620
|
A: [
|
|
7584
7621
|
"!this._networkManager",
|
|
@@ -7590,13 +7627,13 @@ var ClientServicesHost = class {
|
|
|
7590
7627
|
transportFactory,
|
|
7591
7628
|
signalManager,
|
|
7592
7629
|
peerInfo: this._edgeConnection ? {
|
|
7593
|
-
identityKey: this._edgeConnection.identityKey
|
|
7594
|
-
peerKey: this._edgeConnection.
|
|
7630
|
+
identityKey: this._edgeConnection.identityKey,
|
|
7631
|
+
peerKey: this._edgeConnection.peerKey
|
|
7595
7632
|
} : void 0
|
|
7596
7633
|
});
|
|
7597
|
-
|
|
7598
|
-
F:
|
|
7599
|
-
L:
|
|
7634
|
+
log24("initialized", void 0, {
|
|
7635
|
+
F: __dxlog_file27,
|
|
7636
|
+
L: 245,
|
|
7600
7637
|
S: this,
|
|
7601
7638
|
C: (f, a) => f(...a)
|
|
7602
7639
|
});
|
|
@@ -7606,17 +7643,17 @@ var ClientServicesHost = class {
|
|
|
7606
7643
|
return;
|
|
7607
7644
|
}
|
|
7608
7645
|
const traceId = PublicKey17.random().toHex();
|
|
7609
|
-
|
|
7646
|
+
log24.trace("dxos.client-services.host.open", trace10.begin({
|
|
7610
7647
|
id: traceId
|
|
7611
7648
|
}), {
|
|
7612
|
-
F:
|
|
7613
|
-
L:
|
|
7649
|
+
F: __dxlog_file27,
|
|
7650
|
+
L: 256,
|
|
7614
7651
|
S: this,
|
|
7615
7652
|
C: (f, a) => f(...a)
|
|
7616
7653
|
});
|
|
7617
7654
|
invariant20(this._config, "config not set", {
|
|
7618
|
-
F:
|
|
7619
|
-
L:
|
|
7655
|
+
F: __dxlog_file27,
|
|
7656
|
+
L: 258,
|
|
7620
7657
|
S: this,
|
|
7621
7658
|
A: [
|
|
7622
7659
|
"this._config",
|
|
@@ -7624,8 +7661,8 @@ var ClientServicesHost = class {
|
|
|
7624
7661
|
]
|
|
7625
7662
|
});
|
|
7626
7663
|
invariant20(this._storage, "storage not set", {
|
|
7627
|
-
F:
|
|
7628
|
-
L:
|
|
7664
|
+
F: __dxlog_file27,
|
|
7665
|
+
L: 259,
|
|
7629
7666
|
S: this,
|
|
7630
7667
|
A: [
|
|
7631
7668
|
"this._storage",
|
|
@@ -7633,8 +7670,8 @@ var ClientServicesHost = class {
|
|
|
7633
7670
|
]
|
|
7634
7671
|
});
|
|
7635
7672
|
invariant20(this._signalManager, "signal manager not set", {
|
|
7636
|
-
F:
|
|
7637
|
-
L:
|
|
7673
|
+
F: __dxlog_file27,
|
|
7674
|
+
L: 260,
|
|
7638
7675
|
S: this,
|
|
7639
7676
|
A: [
|
|
7640
7677
|
"this._signalManager",
|
|
@@ -7642,8 +7679,8 @@ var ClientServicesHost = class {
|
|
|
7642
7679
|
]
|
|
7643
7680
|
});
|
|
7644
7681
|
invariant20(this._networkManager, "network manager not set", {
|
|
7645
|
-
F:
|
|
7646
|
-
L:
|
|
7682
|
+
F: __dxlog_file27,
|
|
7683
|
+
L: 261,
|
|
7647
7684
|
S: this,
|
|
7648
7685
|
A: [
|
|
7649
7686
|
"this._networkManager",
|
|
@@ -7651,11 +7688,11 @@ var ClientServicesHost = class {
|
|
|
7651
7688
|
]
|
|
7652
7689
|
});
|
|
7653
7690
|
this._opening = true;
|
|
7654
|
-
|
|
7691
|
+
log24("opening...", {
|
|
7655
7692
|
lockKey: this._resourceLock?.lockKey
|
|
7656
7693
|
}, {
|
|
7657
|
-
F:
|
|
7658
|
-
L:
|
|
7694
|
+
F: __dxlog_file27,
|
|
7695
|
+
L: 264,
|
|
7659
7696
|
S: this,
|
|
7660
7697
|
C: (f, a) => f(...a)
|
|
7661
7698
|
});
|
|
@@ -7707,19 +7744,19 @@ var ClientServicesHost = class {
|
|
|
7707
7744
|
this._open = true;
|
|
7708
7745
|
this._statusUpdate.emit();
|
|
7709
7746
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
7710
|
-
|
|
7747
|
+
log24("opened", {
|
|
7711
7748
|
deviceKey
|
|
7712
7749
|
}, {
|
|
7713
|
-
F:
|
|
7714
|
-
L:
|
|
7750
|
+
F: __dxlog_file27,
|
|
7751
|
+
L: 352,
|
|
7715
7752
|
S: this,
|
|
7716
7753
|
C: (f, a) => f(...a)
|
|
7717
7754
|
});
|
|
7718
|
-
|
|
7755
|
+
log24.trace("dxos.client-services.host.open", trace10.end({
|
|
7719
7756
|
id: traceId
|
|
7720
7757
|
}), {
|
|
7721
|
-
F:
|
|
7722
|
-
L:
|
|
7758
|
+
F: __dxlog_file27,
|
|
7759
|
+
L: 353,
|
|
7723
7760
|
S: this,
|
|
7724
7761
|
C: (f, a) => f(...a)
|
|
7725
7762
|
});
|
|
@@ -7729,11 +7766,11 @@ var ClientServicesHost = class {
|
|
|
7729
7766
|
return;
|
|
7730
7767
|
}
|
|
7731
7768
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
7732
|
-
|
|
7769
|
+
log24("closing...", {
|
|
7733
7770
|
deviceKey
|
|
7734
7771
|
}, {
|
|
7735
|
-
F:
|
|
7736
|
-
L:
|
|
7772
|
+
F: __dxlog_file27,
|
|
7773
|
+
L: 364,
|
|
7737
7774
|
S: this,
|
|
7738
7775
|
C: (f, a) => f(...a)
|
|
7739
7776
|
});
|
|
@@ -7747,44 +7784,44 @@ var ClientServicesHost = class {
|
|
|
7747
7784
|
await this._level?.close();
|
|
7748
7785
|
this._open = false;
|
|
7749
7786
|
this._statusUpdate.emit();
|
|
7750
|
-
|
|
7787
|
+
log24("closed", {
|
|
7751
7788
|
deviceKey
|
|
7752
7789
|
}, {
|
|
7753
|
-
F:
|
|
7754
|
-
L:
|
|
7790
|
+
F: __dxlog_file27,
|
|
7791
|
+
L: 373,
|
|
7755
7792
|
S: this,
|
|
7756
7793
|
C: (f, a) => f(...a)
|
|
7757
7794
|
});
|
|
7758
7795
|
}
|
|
7759
7796
|
async reset() {
|
|
7760
7797
|
const traceId = PublicKey17.random().toHex();
|
|
7761
|
-
|
|
7798
|
+
log24.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
7762
7799
|
id: traceId
|
|
7763
7800
|
}), {
|
|
7764
|
-
F:
|
|
7765
|
-
L:
|
|
7801
|
+
F: __dxlog_file27,
|
|
7802
|
+
L: 378,
|
|
7766
7803
|
S: this,
|
|
7767
7804
|
C: (f, a) => f(...a)
|
|
7768
7805
|
});
|
|
7769
|
-
|
|
7770
|
-
F:
|
|
7771
|
-
L:
|
|
7806
|
+
log24.info("resetting...", void 0, {
|
|
7807
|
+
F: __dxlog_file27,
|
|
7808
|
+
L: 380,
|
|
7772
7809
|
S: this,
|
|
7773
7810
|
C: (f, a) => f(...a)
|
|
7774
7811
|
});
|
|
7775
7812
|
await this._serviceContext?.close();
|
|
7776
7813
|
await this._storage.reset();
|
|
7777
|
-
|
|
7778
|
-
F:
|
|
7779
|
-
L:
|
|
7814
|
+
log24.info("reset", void 0, {
|
|
7815
|
+
F: __dxlog_file27,
|
|
7816
|
+
L: 383,
|
|
7780
7817
|
S: this,
|
|
7781
7818
|
C: (f, a) => f(...a)
|
|
7782
7819
|
});
|
|
7783
|
-
|
|
7820
|
+
log24.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
7784
7821
|
id: traceId
|
|
7785
7822
|
}), {
|
|
7786
|
-
F:
|
|
7787
|
-
L:
|
|
7823
|
+
F: __dxlog_file27,
|
|
7824
|
+
L: 384,
|
|
7788
7825
|
S: this,
|
|
7789
7826
|
C: (f, a) => f(...a)
|
|
7790
7827
|
});
|
|
@@ -7858,4 +7895,4 @@ export {
|
|
|
7858
7895
|
importProfileData,
|
|
7859
7896
|
ClientServicesHost
|
|
7860
7897
|
};
|
|
7861
|
-
//# sourceMappingURL=chunk-
|
|
7898
|
+
//# sourceMappingURL=chunk-DJUFNLVB.mjs.map
|