@dxos/client-services 0.6.9 → 0.6.10-main.48c066e
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-67XXCVHL.mjs → chunk-ADTM2VNF.mjs} +623 -584
- package/dist/lib/browser/chunk-ADTM2VNF.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-WTK4Q3EG.cjs → chunk-4Y7QCEWZ.cjs} +669 -630
- package/dist/lib/node/chunk-4Y7QCEWZ.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/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.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/identity/authenticator.ts +1 -1
- package/src/packlets/invitations/invitation-guest-extenstion.ts +2 -1
- package/src/packlets/invitations/invitation-host-extension.ts +2 -1
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +4 -5
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.ts +1 -1
- package/src/packlets/testing/test-builder.ts +3 -10
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-67XXCVHL.mjs.map +0 -7
- package/dist/lib/node/chunk-WTK4Q3EG.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.48c066e";
|
|
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
|
|
662
|
-
import { schema } from "@dxos/protocols";
|
|
663
|
-
var
|
|
697
|
+
import { log as log3 } from "@dxos/log";
|
|
698
|
+
import { schema } from "@dxos/protocols/proto";
|
|
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,8 +1828,9 @@ 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
|
|
1796
|
-
import { InvalidInvitationExtensionRoleError
|
|
1831
|
+
import { log as log8 } from "@dxos/log";
|
|
1832
|
+
import { InvalidInvitationExtensionRoleError } from "@dxos/protocols";
|
|
1833
|
+
import { schema as schema2 } from "@dxos/protocols/proto";
|
|
1797
1834
|
import { InvitationOptions } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1798
1835
|
import { RpcExtension } from "@dxos/teleport";
|
|
1799
1836
|
|
|
@@ -1817,7 +1854,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1817
1854
|
};
|
|
1818
1855
|
|
|
1819
1856
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
1820
|
-
var
|
|
1857
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1821
1858
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1822
1859
|
var InvitationGuestExtension = class extends RpcExtension {
|
|
1823
1860
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1832,8 +1869,8 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1832
1869
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1833
1870
|
this._callbacks = _callbacks;
|
|
1834
1871
|
this._ctx = new Context4(void 0, {
|
|
1835
|
-
F:
|
|
1836
|
-
L:
|
|
1872
|
+
F: __dxlog_file11,
|
|
1873
|
+
L: 34
|
|
1837
1874
|
});
|
|
1838
1875
|
this._remoteOptionsTrigger = new Trigger4();
|
|
1839
1876
|
this._invitationFlowLock = null;
|
|
@@ -1846,8 +1883,8 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1846
1883
|
InvitationHostService: {
|
|
1847
1884
|
options: async (options) => {
|
|
1848
1885
|
invariant6(!this._remoteOptions, "Remote options already set.", {
|
|
1849
|
-
F:
|
|
1850
|
-
L:
|
|
1886
|
+
F: __dxlog_file11,
|
|
1887
|
+
L: 64,
|
|
1851
1888
|
S: this,
|
|
1852
1889
|
A: [
|
|
1853
1890
|
"!this._remoteOptions",
|
|
@@ -1872,34 +1909,34 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1872
1909
|
async onOpen(context) {
|
|
1873
1910
|
await super.onOpen(context);
|
|
1874
1911
|
try {
|
|
1875
|
-
|
|
1876
|
-
F:
|
|
1877
|
-
L:
|
|
1912
|
+
log8("guest acquire lock", void 0, {
|
|
1913
|
+
F: __dxlog_file11,
|
|
1914
|
+
L: 85,
|
|
1878
1915
|
S: this,
|
|
1879
1916
|
C: (f, a) => f(...a)
|
|
1880
1917
|
});
|
|
1881
1918
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1882
|
-
|
|
1883
|
-
F:
|
|
1884
|
-
L:
|
|
1919
|
+
log8("guest lock acquired", void 0, {
|
|
1920
|
+
F: __dxlog_file11,
|
|
1921
|
+
L: 87,
|
|
1885
1922
|
S: this,
|
|
1886
1923
|
C: (f, a) => f(...a)
|
|
1887
1924
|
});
|
|
1888
1925
|
await cancelWithContext2(this._ctx, this.rpc.InvitationHostService.options({
|
|
1889
1926
|
role: InvitationOptions.Role.GUEST
|
|
1890
1927
|
}));
|
|
1891
|
-
|
|
1892
|
-
F:
|
|
1893
|
-
L:
|
|
1928
|
+
log8("options sent", void 0, {
|
|
1929
|
+
F: __dxlog_file11,
|
|
1930
|
+
L: 92,
|
|
1894
1931
|
S: this,
|
|
1895
1932
|
C: (f, a) => f(...a)
|
|
1896
1933
|
});
|
|
1897
1934
|
await cancelWithContext2(this._ctx, this._remoteOptionsTrigger.wait({
|
|
1898
1935
|
timeout: OPTIONS_TIMEOUT
|
|
1899
1936
|
}));
|
|
1900
|
-
|
|
1901
|
-
F:
|
|
1902
|
-
L:
|
|
1937
|
+
log8("options received", void 0, {
|
|
1938
|
+
F: __dxlog_file11,
|
|
1939
|
+
L: 94,
|
|
1903
1940
|
S: this,
|
|
1904
1941
|
C: (f, a) => f(...a)
|
|
1905
1942
|
});
|
|
@@ -1931,9 +1968,9 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1931
1968
|
if (this._invitationFlowLock != null) {
|
|
1932
1969
|
this._invitationFlowLock.release();
|
|
1933
1970
|
this._invitationFlowLock = null;
|
|
1934
|
-
|
|
1935
|
-
F:
|
|
1936
|
-
L:
|
|
1971
|
+
log8("invitation flow lock released", void 0, {
|
|
1972
|
+
F: __dxlog_file11,
|
|
1973
|
+
L: 127,
|
|
1937
1974
|
S: this,
|
|
1938
1975
|
C: (f, a) => f(...a)
|
|
1939
1976
|
});
|
|
@@ -1947,12 +1984,13 @@ import { cancelWithContext as cancelWithContext3, Context as Context5 } from "@d
|
|
|
1947
1984
|
import { randomBytes, verify } from "@dxos/crypto";
|
|
1948
1985
|
import { invariant as invariant7, InvariantViolation } from "@dxos/invariant";
|
|
1949
1986
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1950
|
-
import { log as
|
|
1951
|
-
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2,
|
|
1987
|
+
import { log as log9 } from "@dxos/log";
|
|
1988
|
+
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace3 } from "@dxos/protocols";
|
|
1989
|
+
import { schema as schema3 } from "@dxos/protocols/proto";
|
|
1952
1990
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1953
1991
|
import { AuthenticationResponse, InvitationOptions as InvitationOptions2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1954
1992
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1955
|
-
var
|
|
1993
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
1956
1994
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
1957
1995
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1958
1996
|
var InvitationHostExtension = class extends RpcExtension2 {
|
|
@@ -1968,8 +2006,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1968
2006
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1969
2007
|
this._callbacks = _callbacks;
|
|
1970
2008
|
this._ctx = new Context5(void 0, {
|
|
1971
|
-
F:
|
|
1972
|
-
L:
|
|
2009
|
+
F: __dxlog_file12,
|
|
2010
|
+
L: 53
|
|
1973
2011
|
});
|
|
1974
2012
|
this._remoteOptionsTrigger = new Trigger5();
|
|
1975
2013
|
this._challenge = void 0;
|
|
@@ -1989,8 +2027,8 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1989
2027
|
InvitationHostService: {
|
|
1990
2028
|
options: async (options) => {
|
|
1991
2029
|
invariant7(!this._remoteOptions, "Remote options already set.", {
|
|
1992
|
-
F:
|
|
1993
|
-
L:
|
|
2030
|
+
F: __dxlog_file12,
|
|
2031
|
+
L: 102,
|
|
1994
2032
|
S: this,
|
|
1995
2033
|
A: [
|
|
1996
2034
|
"!this._remoteOptions",
|
|
@@ -2003,23 +2041,23 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2003
2041
|
introduce: async (request) => {
|
|
2004
2042
|
const { profile, invitationId } = request;
|
|
2005
2043
|
const traceId = PublicKey5.random().toHex();
|
|
2006
|
-
|
|
2044
|
+
log9.trace("dxos.sdk.invitation-handler.host.introduce", trace3.begin({
|
|
2007
2045
|
id: traceId
|
|
2008
2046
|
}), {
|
|
2009
|
-
F:
|
|
2010
|
-
L:
|
|
2047
|
+
F: __dxlog_file12,
|
|
2048
|
+
L: 111,
|
|
2011
2049
|
S: this,
|
|
2012
2050
|
C: (f, a) => f(...a)
|
|
2013
2051
|
});
|
|
2014
2052
|
const invitation = this._requireActiveInvitation();
|
|
2015
2053
|
this._assertInvitationState(Invitation3.State.CONNECTED);
|
|
2016
2054
|
if (invitationId !== invitation?.invitationId) {
|
|
2017
|
-
|
|
2055
|
+
log9.warn("incorrect invitationId", {
|
|
2018
2056
|
expected: invitation.invitationId,
|
|
2019
2057
|
actual: invitationId
|
|
2020
2058
|
}, {
|
|
2021
|
-
F:
|
|
2022
|
-
L:
|
|
2059
|
+
F: __dxlog_file12,
|
|
2060
|
+
L: 117,
|
|
2023
2061
|
S: this,
|
|
2024
2062
|
C: (f, a) => f(...a)
|
|
2025
2063
|
});
|
|
@@ -2029,22 +2067,22 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2029
2067
|
authMethod: Invitation3.AuthMethod.NONE
|
|
2030
2068
|
};
|
|
2031
2069
|
}
|
|
2032
|
-
|
|
2070
|
+
log9("guest introduced themselves", {
|
|
2033
2071
|
guestProfile: profile
|
|
2034
2072
|
}, {
|
|
2035
|
-
F:
|
|
2036
|
-
L:
|
|
2073
|
+
F: __dxlog_file12,
|
|
2074
|
+
L: 126,
|
|
2037
2075
|
S: this,
|
|
2038
2076
|
C: (f, a) => f(...a)
|
|
2039
2077
|
});
|
|
2040
2078
|
this.guestProfile = profile;
|
|
2041
2079
|
this._callbacks.onStateUpdate(Invitation3.State.READY_FOR_AUTHENTICATION);
|
|
2042
2080
|
this._challenge = invitation.authMethod === Invitation3.AuthMethod.KNOWN_PUBLIC_KEY ? randomBytes(32) : void 0;
|
|
2043
|
-
|
|
2081
|
+
log9.trace("dxos.sdk.invitation-handler.host.introduce", trace3.end({
|
|
2044
2082
|
id: traceId
|
|
2045
2083
|
}), {
|
|
2046
|
-
F:
|
|
2047
|
-
L:
|
|
2084
|
+
F: __dxlog_file12,
|
|
2085
|
+
L: 133,
|
|
2048
2086
|
S: this,
|
|
2049
2087
|
C: (f, a) => f(...a)
|
|
2050
2088
|
});
|
|
@@ -2055,20 +2093,20 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2055
2093
|
},
|
|
2056
2094
|
authenticate: async ({ authCode: code, signedChallenge }) => {
|
|
2057
2095
|
const traceId = PublicKey5.random().toHex();
|
|
2058
|
-
|
|
2096
|
+
log9.trace("dxos.sdk.invitation-handler.host.authenticate", trace3.begin({
|
|
2059
2097
|
id: traceId
|
|
2060
2098
|
}), {
|
|
2061
|
-
F:
|
|
2062
|
-
L:
|
|
2099
|
+
F: __dxlog_file12,
|
|
2100
|
+
L: 142,
|
|
2063
2101
|
S: this,
|
|
2064
2102
|
C: (f, a) => f(...a)
|
|
2065
2103
|
});
|
|
2066
2104
|
const invitation = this._requireActiveInvitation();
|
|
2067
|
-
|
|
2105
|
+
log9("received authentication request", {
|
|
2068
2106
|
authCode: code
|
|
2069
2107
|
}, {
|
|
2070
|
-
F:
|
|
2071
|
-
L:
|
|
2108
|
+
F: __dxlog_file12,
|
|
2109
|
+
L: 145,
|
|
2072
2110
|
S: this,
|
|
2073
2111
|
C: (f, a) => f(...a)
|
|
2074
2112
|
});
|
|
@@ -2080,9 +2118,9 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2080
2118
|
this._callbacks.onStateUpdate(Invitation3.State.AUTHENTICATING);
|
|
2081
2119
|
switch (invitation.authMethod) {
|
|
2082
2120
|
case Invitation3.AuthMethod.NONE: {
|
|
2083
|
-
|
|
2084
|
-
F:
|
|
2085
|
-
L:
|
|
2121
|
+
log9("authentication not required", void 0, {
|
|
2122
|
+
F: __dxlog_file12,
|
|
2123
|
+
L: 153,
|
|
2086
2124
|
S: this,
|
|
2087
2125
|
C: (f, a) => f(...a)
|
|
2088
2126
|
});
|
|
@@ -2116,11 +2154,11 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2116
2154
|
break;
|
|
2117
2155
|
}
|
|
2118
2156
|
default: {
|
|
2119
|
-
|
|
2157
|
+
log9.error("invalid authentication method", {
|
|
2120
2158
|
authMethod: invitation.authMethod
|
|
2121
2159
|
}, {
|
|
2122
|
-
F:
|
|
2123
|
-
L:
|
|
2160
|
+
F: __dxlog_file12,
|
|
2161
|
+
L: 191,
|
|
2124
2162
|
S: this,
|
|
2125
2163
|
C: (f, a) => f(...a)
|
|
2126
2164
|
});
|
|
@@ -2138,14 +2176,14 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2138
2176
|
status
|
|
2139
2177
|
};
|
|
2140
2178
|
}
|
|
2141
|
-
|
|
2179
|
+
log9.trace("dxos.sdk.invitation-handler.host.authenticate", trace3.end({
|
|
2142
2180
|
id: traceId,
|
|
2143
2181
|
data: {
|
|
2144
2182
|
status
|
|
2145
2183
|
}
|
|
2146
2184
|
}), {
|
|
2147
|
-
F:
|
|
2148
|
-
L:
|
|
2185
|
+
F: __dxlog_file12,
|
|
2186
|
+
L: 203,
|
|
2149
2187
|
S: this,
|
|
2150
2188
|
C: (f, a) => f(...a)
|
|
2151
2189
|
});
|
|
@@ -2155,11 +2193,11 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2155
2193
|
},
|
|
2156
2194
|
admit: async (request) => {
|
|
2157
2195
|
const traceId = PublicKey5.random().toHex();
|
|
2158
|
-
|
|
2196
|
+
log9.trace("dxos.sdk.invitation-handler.host.admit", trace3.begin({
|
|
2159
2197
|
id: traceId
|
|
2160
2198
|
}), {
|
|
2161
|
-
F:
|
|
2162
|
-
L:
|
|
2199
|
+
F: __dxlog_file12,
|
|
2200
|
+
L: 209,
|
|
2163
2201
|
S: this,
|
|
2164
2202
|
C: (f, a) => f(...a)
|
|
2165
2203
|
});
|
|
@@ -2172,11 +2210,11 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2172
2210
|
}
|
|
2173
2211
|
}
|
|
2174
2212
|
const response = await this._callbacks.admit(request);
|
|
2175
|
-
|
|
2213
|
+
log9.trace("dxos.sdk.invitation-handler.host.admit", trace3.end({
|
|
2176
2214
|
id: traceId
|
|
2177
2215
|
}), {
|
|
2178
|
-
F:
|
|
2179
|
-
L:
|
|
2216
|
+
F: __dxlog_file12,
|
|
2217
|
+
L: 223,
|
|
2180
2218
|
S: this,
|
|
2181
2219
|
C: (f, a) => f(...a)
|
|
2182
2220
|
});
|
|
@@ -2192,16 +2230,16 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2192
2230
|
async onOpen(context) {
|
|
2193
2231
|
await super.onOpen(context);
|
|
2194
2232
|
try {
|
|
2195
|
-
|
|
2196
|
-
F:
|
|
2197
|
-
L:
|
|
2233
|
+
log9("host acquire lock", void 0, {
|
|
2234
|
+
F: __dxlog_file12,
|
|
2235
|
+
L: 238,
|
|
2198
2236
|
S: this,
|
|
2199
2237
|
C: (f, a) => f(...a)
|
|
2200
2238
|
});
|
|
2201
2239
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2202
|
-
|
|
2203
|
-
F:
|
|
2204
|
-
L:
|
|
2240
|
+
log9("host lock acquired", void 0, {
|
|
2241
|
+
F: __dxlog_file12,
|
|
2242
|
+
L: 240,
|
|
2205
2243
|
S: this,
|
|
2206
2244
|
C: (f, a) => f(...a)
|
|
2207
2245
|
});
|
|
@@ -2210,18 +2248,18 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2210
2248
|
await this.rpc.InvitationHostService.options({
|
|
2211
2249
|
role: InvitationOptions2.Role.HOST
|
|
2212
2250
|
});
|
|
2213
|
-
|
|
2214
|
-
F:
|
|
2215
|
-
L:
|
|
2251
|
+
log9("options sent", void 0, {
|
|
2252
|
+
F: __dxlog_file12,
|
|
2253
|
+
L: 244,
|
|
2216
2254
|
S: this,
|
|
2217
2255
|
C: (f, a) => f(...a)
|
|
2218
2256
|
});
|
|
2219
2257
|
await cancelWithContext3(this._ctx, this._remoteOptionsTrigger.wait({
|
|
2220
2258
|
timeout: OPTIONS_TIMEOUT2
|
|
2221
2259
|
}));
|
|
2222
|
-
|
|
2223
|
-
F:
|
|
2224
|
-
L:
|
|
2260
|
+
log9("options received", void 0, {
|
|
2261
|
+
F: __dxlog_file12,
|
|
2262
|
+
L: 246,
|
|
2225
2263
|
S: this,
|
|
2226
2264
|
C: (f, a) => f(...a)
|
|
2227
2265
|
});
|
|
@@ -2273,9 +2311,9 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2273
2311
|
if (this._invitationFlowLock != null) {
|
|
2274
2312
|
this._invitationFlowLock?.release();
|
|
2275
2313
|
this._invitationFlowLock = null;
|
|
2276
|
-
|
|
2277
|
-
F:
|
|
2278
|
-
L:
|
|
2314
|
+
log9("invitation flow lock released", void 0, {
|
|
2315
|
+
F: __dxlog_file12,
|
|
2316
|
+
L: 301,
|
|
2279
2317
|
S: this,
|
|
2280
2318
|
C: (f, a) => f(...a)
|
|
2281
2319
|
});
|
|
@@ -2287,10 +2325,10 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
|
|
|
2287
2325
|
// packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts
|
|
2288
2326
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2289
2327
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2290
|
-
import { log as
|
|
2328
|
+
import { log as log10 } from "@dxos/log";
|
|
2291
2329
|
import { InvitationOptions as InvitationOptions3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
2292
2330
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2293
|
-
var
|
|
2331
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2294
2332
|
var InvitationTopology = class {
|
|
2295
2333
|
constructor(_role) {
|
|
2296
2334
|
this._role = _role;
|
|
@@ -2298,7 +2336,7 @@ var InvitationTopology = class {
|
|
|
2298
2336
|
}
|
|
2299
2337
|
init(controller) {
|
|
2300
2338
|
invariant8(!this._controller, "Already initialized.", {
|
|
2301
|
-
F:
|
|
2339
|
+
F: __dxlog_file13,
|
|
2302
2340
|
L: 42,
|
|
2303
2341
|
S: this,
|
|
2304
2342
|
A: [
|
|
@@ -2310,7 +2348,7 @@ var InvitationTopology = class {
|
|
|
2310
2348
|
}
|
|
2311
2349
|
update() {
|
|
2312
2350
|
invariant8(this._controller, "Not initialized.", {
|
|
2313
|
-
F:
|
|
2351
|
+
F: __dxlog_file13,
|
|
2314
2352
|
L: 47,
|
|
2315
2353
|
S: this,
|
|
2316
2354
|
A: [
|
|
@@ -2329,11 +2367,11 @@ var InvitationTopology = class {
|
|
|
2329
2367
|
const firstUnknownPeer = candidates.find((peerId) => !this._seenPeers.has(peerId));
|
|
2330
2368
|
this._seenPeers = new ComplexSet2(PublicKey6.hash, allPeers.filter((peerId) => this._seenPeers.has(peerId)));
|
|
2331
2369
|
if (firstUnknownPeer != null) {
|
|
2332
|
-
|
|
2370
|
+
log10("invitation connect", {
|
|
2333
2371
|
ownPeerId,
|
|
2334
2372
|
remotePeerId: firstUnknownPeer
|
|
2335
2373
|
}, {
|
|
2336
|
-
F:
|
|
2374
|
+
F: __dxlog_file13,
|
|
2337
2375
|
L: 69,
|
|
2338
2376
|
S: this,
|
|
2339
2377
|
C: (f, a) => f(...a)
|
|
@@ -2344,7 +2382,7 @@ var InvitationTopology = class {
|
|
|
2344
2382
|
}
|
|
2345
2383
|
async onOffer(peer) {
|
|
2346
2384
|
invariant8(this._controller, "Not initialized.", {
|
|
2347
|
-
F:
|
|
2385
|
+
F: __dxlog_file13,
|
|
2348
2386
|
L: 76,
|
|
2349
2387
|
S: this,
|
|
2350
2388
|
A: [
|
|
@@ -2363,7 +2401,7 @@ var InvitationTopology = class {
|
|
|
2363
2401
|
};
|
|
2364
2402
|
|
|
2365
2403
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
2366
|
-
var
|
|
2404
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2367
2405
|
var metrics = _trace.metrics;
|
|
2368
2406
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2369
2407
|
var InvitationsHandler = class {
|
|
@@ -2390,7 +2428,7 @@ var InvitationsHandler = class {
|
|
|
2390
2428
|
try {
|
|
2391
2429
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2392
2430
|
invariant9(deviceKey, void 0, {
|
|
2393
|
-
F:
|
|
2431
|
+
F: __dxlog_file14,
|
|
2394
2432
|
L: 94,
|
|
2395
2433
|
S: this,
|
|
2396
2434
|
A: [
|
|
@@ -2416,18 +2454,18 @@ var InvitationsHandler = class {
|
|
|
2416
2454
|
scheduleTask3(connectionCtx, async () => {
|
|
2417
2455
|
const traceId = PublicKey7.random().toHex();
|
|
2418
2456
|
try {
|
|
2419
|
-
|
|
2457
|
+
log11.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.begin({
|
|
2420
2458
|
id: traceId
|
|
2421
2459
|
}), {
|
|
2422
|
-
F:
|
|
2460
|
+
F: __dxlog_file14,
|
|
2423
2461
|
L: 119,
|
|
2424
2462
|
S: this,
|
|
2425
2463
|
C: (f, a) => f(...a)
|
|
2426
2464
|
});
|
|
2427
|
-
|
|
2465
|
+
log11("connected", {
|
|
2428
2466
|
...protocol.toJSON()
|
|
2429
2467
|
}, {
|
|
2430
|
-
F:
|
|
2468
|
+
F: __dxlog_file14,
|
|
2431
2469
|
L: 120,
|
|
2432
2470
|
S: this,
|
|
2433
2471
|
C: (f, a) => f(...a)
|
|
@@ -2435,21 +2473,21 @@ var InvitationsHandler = class {
|
|
|
2435
2473
|
const deviceKey = await extension.completedTrigger.wait({
|
|
2436
2474
|
timeout: invitation.timeout
|
|
2437
2475
|
});
|
|
2438
|
-
|
|
2476
|
+
log11("admitted guest", {
|
|
2439
2477
|
guest: deviceKey,
|
|
2440
2478
|
...protocol.toJSON()
|
|
2441
2479
|
}, {
|
|
2442
|
-
F:
|
|
2480
|
+
F: __dxlog_file14,
|
|
2443
2481
|
L: 122,
|
|
2444
2482
|
S: this,
|
|
2445
2483
|
C: (f, a) => f(...a)
|
|
2446
2484
|
});
|
|
2447
2485
|
guardedState.set(extension, Invitation4.State.SUCCESS);
|
|
2448
2486
|
metrics.increment("dxos.invitation.success");
|
|
2449
|
-
|
|
2487
|
+
log11.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.end({
|
|
2450
2488
|
id: traceId
|
|
2451
2489
|
}), {
|
|
2452
|
-
F:
|
|
2490
|
+
F: __dxlog_file14,
|
|
2453
2491
|
L: 125,
|
|
2454
2492
|
S: this,
|
|
2455
2493
|
C: (f, a) => f(...a)
|
|
@@ -2462,10 +2500,10 @@ var InvitationsHandler = class {
|
|
|
2462
2500
|
if (err instanceof TimeoutError) {
|
|
2463
2501
|
if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
|
|
2464
2502
|
metrics.increment("dxos.invitation.timeout");
|
|
2465
|
-
|
|
2503
|
+
log11("timeout", {
|
|
2466
2504
|
...protocol.toJSON()
|
|
2467
2505
|
}, {
|
|
2468
|
-
F:
|
|
2506
|
+
F: __dxlog_file14,
|
|
2469
2507
|
L: 135,
|
|
2470
2508
|
S: this,
|
|
2471
2509
|
C: (f, a) => f(...a)
|
|
@@ -2474,19 +2512,19 @@ var InvitationsHandler = class {
|
|
|
2474
2512
|
} else {
|
|
2475
2513
|
if (guardedState.error(extension, err)) {
|
|
2476
2514
|
metrics.increment("dxos.invitation.failed");
|
|
2477
|
-
|
|
2478
|
-
F:
|
|
2515
|
+
log11.error("failed", err, {
|
|
2516
|
+
F: __dxlog_file14,
|
|
2479
2517
|
L: 140,
|
|
2480
2518
|
S: this,
|
|
2481
2519
|
C: (f, a) => f(...a)
|
|
2482
2520
|
});
|
|
2483
2521
|
}
|
|
2484
2522
|
}
|
|
2485
|
-
|
|
2523
|
+
log11.trace("dxos.sdk.invitations-handler.host.onOpen", trace4.error({
|
|
2486
2524
|
id: traceId,
|
|
2487
2525
|
error: err
|
|
2488
2526
|
}), {
|
|
2489
|
-
F:
|
|
2527
|
+
F: __dxlog_file14,
|
|
2490
2528
|
L: 143,
|
|
2491
2529
|
S: this,
|
|
2492
2530
|
C: (f, a) => f(...a)
|
|
@@ -2497,10 +2535,10 @@ var InvitationsHandler = class {
|
|
|
2497
2535
|
},
|
|
2498
2536
|
onError: (err) => {
|
|
2499
2537
|
if (err instanceof InvalidInvitationExtensionRoleError3) {
|
|
2500
|
-
|
|
2538
|
+
log11("invalid role", {
|
|
2501
2539
|
...err.context
|
|
2502
2540
|
}, {
|
|
2503
|
-
F:
|
|
2541
|
+
F: __dxlog_file14,
|
|
2504
2542
|
L: 151,
|
|
2505
2543
|
S: this,
|
|
2506
2544
|
C: (f, a) => f(...a)
|
|
@@ -2510,10 +2548,10 @@ var InvitationsHandler = class {
|
|
|
2510
2548
|
if (err instanceof TimeoutError) {
|
|
2511
2549
|
if (guardedState.set(extension, Invitation4.State.TIMEOUT)) {
|
|
2512
2550
|
metrics.increment("dxos.invitation.timeout");
|
|
2513
|
-
|
|
2551
|
+
log11("timeout", {
|
|
2514
2552
|
err
|
|
2515
2553
|
}, {
|
|
2516
|
-
F:
|
|
2554
|
+
F: __dxlog_file14,
|
|
2517
2555
|
L: 157,
|
|
2518
2556
|
S: this,
|
|
2519
2557
|
C: (f, a) => f(...a)
|
|
@@ -2522,8 +2560,8 @@ var InvitationsHandler = class {
|
|
|
2522
2560
|
} else {
|
|
2523
2561
|
if (guardedState.error(extension, err)) {
|
|
2524
2562
|
metrics.increment("dxos.invitation.failed");
|
|
2525
|
-
|
|
2526
|
-
F:
|
|
2563
|
+
log11.error("failed", err, {
|
|
2564
|
+
F: __dxlog_file14,
|
|
2527
2565
|
L: 162,
|
|
2528
2566
|
S: this,
|
|
2529
2567
|
C: (f, a) => f(...a)
|
|
@@ -2536,8 +2574,8 @@ var InvitationsHandler = class {
|
|
|
2536
2574
|
};
|
|
2537
2575
|
if (invitation.lifetime && invitation.created) {
|
|
2538
2576
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2539
|
-
|
|
2540
|
-
F:
|
|
2577
|
+
log11.warn("invitation has already expired", void 0, {
|
|
2578
|
+
F: __dxlog_file14,
|
|
2541
2579
|
L: 173,
|
|
2542
2580
|
S: this,
|
|
2543
2581
|
C: (f, a) => f(...a)
|
|
@@ -2561,7 +2599,7 @@ var InvitationsHandler = class {
|
|
|
2561
2599
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
2562
2600
|
if (deviceProfile) {
|
|
2563
2601
|
invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2564
|
-
F:
|
|
2602
|
+
F: __dxlog_file14,
|
|
2565
2603
|
L: 207,
|
|
2566
2604
|
S: this,
|
|
2567
2605
|
A: [
|
|
@@ -2574,12 +2612,12 @@ var InvitationsHandler = class {
|
|
|
2574
2612
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2575
2613
|
const shouldCancelInvitationFlow = (extension) => {
|
|
2576
2614
|
const isLockedByAnotherConnection = guardedState.mutex.isLocked() && !extension.hasFlowLock();
|
|
2577
|
-
|
|
2615
|
+
log11("should cancel invitation flow", {
|
|
2578
2616
|
isLockedByAnotherConnection,
|
|
2579
2617
|
invitationType: Invitation4.Type.DELEGATED,
|
|
2580
2618
|
triedPeers: triedPeersIds.size
|
|
2581
2619
|
}, {
|
|
2582
|
-
F:
|
|
2620
|
+
F: __dxlog_file14,
|
|
2583
2621
|
L: 215,
|
|
2584
2622
|
S: this,
|
|
2585
2623
|
C: (f, a) => f(...a)
|
|
@@ -2602,11 +2640,11 @@ var InvitationsHandler = class {
|
|
|
2602
2640
|
return;
|
|
2603
2641
|
}
|
|
2604
2642
|
connectionCtx.onDispose(async () => {
|
|
2605
|
-
|
|
2643
|
+
log11("extension disposed", {
|
|
2606
2644
|
admitted,
|
|
2607
2645
|
currentState: guardedState.current.state
|
|
2608
2646
|
}, {
|
|
2609
|
-
F:
|
|
2647
|
+
F: __dxlog_file14,
|
|
2610
2648
|
L: 243,
|
|
2611
2649
|
S: this,
|
|
2612
2650
|
C: (f, a) => f(...a)
|
|
@@ -2621,10 +2659,10 @@ var InvitationsHandler = class {
|
|
|
2621
2659
|
scheduleTask3(connectionCtx, async () => {
|
|
2622
2660
|
const traceId = PublicKey7.random().toHex();
|
|
2623
2661
|
try {
|
|
2624
|
-
|
|
2662
|
+
log11.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.begin({
|
|
2625
2663
|
id: traceId
|
|
2626
2664
|
}), {
|
|
2627
|
-
F:
|
|
2665
|
+
F: __dxlog_file14,
|
|
2628
2666
|
L: 255,
|
|
2629
2667
|
S: this,
|
|
2630
2668
|
C: (f, a) => f(...a)
|
|
@@ -2633,19 +2671,19 @@ var InvitationsHandler = class {
|
|
|
2633
2671
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2634
2672
|
extensionCtx.close();
|
|
2635
2673
|
}, timeout);
|
|
2636
|
-
|
|
2674
|
+
log11("connected", {
|
|
2637
2675
|
...protocol.toJSON()
|
|
2638
2676
|
}, {
|
|
2639
|
-
F:
|
|
2677
|
+
F: __dxlog_file14,
|
|
2640
2678
|
L: 266,
|
|
2641
2679
|
S: this,
|
|
2642
2680
|
C: (f, a) => f(...a)
|
|
2643
2681
|
});
|
|
2644
2682
|
guardedState.set(extension, Invitation4.State.CONNECTED);
|
|
2645
|
-
|
|
2683
|
+
log11("introduce", {
|
|
2646
2684
|
...protocol.toJSON()
|
|
2647
2685
|
}, {
|
|
2648
|
-
F:
|
|
2686
|
+
F: __dxlog_file14,
|
|
2649
2687
|
L: 270,
|
|
2650
2688
|
S: this,
|
|
2651
2689
|
C: (f, a) => f(...a)
|
|
@@ -2654,11 +2692,11 @@ var InvitationsHandler = class {
|
|
|
2654
2692
|
invitationId: invitation.invitationId,
|
|
2655
2693
|
...protocol.createIntroduction()
|
|
2656
2694
|
});
|
|
2657
|
-
|
|
2695
|
+
log11("introduce response", {
|
|
2658
2696
|
...protocol.toJSON(),
|
|
2659
2697
|
response: introductionResponse
|
|
2660
2698
|
}, {
|
|
2661
|
-
F:
|
|
2699
|
+
F: __dxlog_file14,
|
|
2662
2700
|
L: 275,
|
|
2663
2701
|
S: this,
|
|
2664
2702
|
C: (f, a) => f(...a)
|
|
@@ -2676,10 +2714,10 @@ var InvitationsHandler = class {
|
|
|
2676
2714
|
break;
|
|
2677
2715
|
}
|
|
2678
2716
|
}
|
|
2679
|
-
|
|
2717
|
+
log11("request admission", {
|
|
2680
2718
|
...protocol.toJSON()
|
|
2681
2719
|
}, {
|
|
2682
|
-
F:
|
|
2720
|
+
F: __dxlog_file14,
|
|
2683
2721
|
L: 301,
|
|
2684
2722
|
S: this,
|
|
2685
2723
|
C: (f, a) => f(...a)
|
|
@@ -2688,10 +2726,10 @@ var InvitationsHandler = class {
|
|
|
2688
2726
|
const admissionResponse = await extension.rpc.InvitationHostService.admit(admissionRequest);
|
|
2689
2727
|
admitted = true;
|
|
2690
2728
|
const result = await protocol.accept(admissionResponse, admissionRequest);
|
|
2691
|
-
|
|
2729
|
+
log11("admitted by host", {
|
|
2692
2730
|
...protocol.toJSON()
|
|
2693
2731
|
}, {
|
|
2694
|
-
F:
|
|
2732
|
+
F: __dxlog_file14,
|
|
2695
2733
|
L: 312,
|
|
2696
2734
|
S: this,
|
|
2697
2735
|
C: (f, a) => f(...a)
|
|
@@ -2701,28 +2739,28 @@ var InvitationsHandler = class {
|
|
|
2701
2739
|
...result,
|
|
2702
2740
|
state: Invitation4.State.SUCCESS
|
|
2703
2741
|
});
|
|
2704
|
-
|
|
2742
|
+
log11.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.end({
|
|
2705
2743
|
id: traceId
|
|
2706
2744
|
}), {
|
|
2707
|
-
F:
|
|
2745
|
+
F: __dxlog_file14,
|
|
2708
2746
|
L: 318,
|
|
2709
2747
|
S: this,
|
|
2710
2748
|
C: (f, a) => f(...a)
|
|
2711
2749
|
});
|
|
2712
2750
|
} catch (err) {
|
|
2713
2751
|
if (err instanceof TimeoutError) {
|
|
2714
|
-
|
|
2752
|
+
log11("timeout", {
|
|
2715
2753
|
...protocol.toJSON()
|
|
2716
2754
|
}, {
|
|
2717
|
-
F:
|
|
2755
|
+
F: __dxlog_file14,
|
|
2718
2756
|
L: 321,
|
|
2719
2757
|
S: this,
|
|
2720
2758
|
C: (f, a) => f(...a)
|
|
2721
2759
|
});
|
|
2722
2760
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2723
2761
|
} else {
|
|
2724
|
-
|
|
2725
|
-
F:
|
|
2762
|
+
log11("auth failed", err, {
|
|
2763
|
+
F: __dxlog_file14,
|
|
2726
2764
|
L: 324,
|
|
2727
2765
|
S: this,
|
|
2728
2766
|
C: (f, a) => f(...a)
|
|
@@ -2730,11 +2768,11 @@ var InvitationsHandler = class {
|
|
|
2730
2768
|
guardedState.error(extension, err);
|
|
2731
2769
|
}
|
|
2732
2770
|
extensionCtx.close(err);
|
|
2733
|
-
|
|
2771
|
+
log11.trace("dxos.sdk.invitations-handler.guest.onOpen", trace4.error({
|
|
2734
2772
|
id: traceId,
|
|
2735
2773
|
error: err
|
|
2736
2774
|
}), {
|
|
2737
|
-
F:
|
|
2775
|
+
F: __dxlog_file14,
|
|
2738
2776
|
L: 328,
|
|
2739
2777
|
S: this,
|
|
2740
2778
|
C: (f, a) => f(...a)
|
|
@@ -2747,18 +2785,18 @@ var InvitationsHandler = class {
|
|
|
2747
2785
|
return;
|
|
2748
2786
|
}
|
|
2749
2787
|
if (err instanceof TimeoutError) {
|
|
2750
|
-
|
|
2788
|
+
log11("timeout", {
|
|
2751
2789
|
...protocol.toJSON()
|
|
2752
2790
|
}, {
|
|
2753
|
-
F:
|
|
2791
|
+
F: __dxlog_file14,
|
|
2754
2792
|
L: 337,
|
|
2755
2793
|
S: this,
|
|
2756
2794
|
C: (f, a) => f(...a)
|
|
2757
2795
|
});
|
|
2758
2796
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2759
2797
|
} else {
|
|
2760
|
-
|
|
2761
|
-
F:
|
|
2798
|
+
log11("auth failed", err, {
|
|
2799
|
+
F: __dxlog_file14,
|
|
2762
2800
|
L: 340,
|
|
2763
2801
|
S: this,
|
|
2764
2802
|
C: (f, a) => f(...a)
|
|
@@ -2776,7 +2814,7 @@ var InvitationsHandler = class {
|
|
|
2776
2814
|
await ctx.dispose();
|
|
2777
2815
|
} else {
|
|
2778
2816
|
invariant9(invitation.swarmKey, void 0, {
|
|
2779
|
-
F:
|
|
2817
|
+
F: __dxlog_file14,
|
|
2780
2818
|
L: 355,
|
|
2781
2819
|
S: this,
|
|
2782
2820
|
A: [
|
|
@@ -2878,23 +2916,23 @@ var InvitationsHandler = class {
|
|
|
2878
2916
|
}
|
|
2879
2917
|
_logStateUpdate(invitation, actor, newState) {
|
|
2880
2918
|
if (this._isNotTerminal(newState)) {
|
|
2881
|
-
|
|
2919
|
+
log11("invitation state update", {
|
|
2882
2920
|
actor: actor?.constructor.name,
|
|
2883
2921
|
newState: stateToString(newState),
|
|
2884
2922
|
oldState: stateToString(invitation.state)
|
|
2885
2923
|
}, {
|
|
2886
|
-
F:
|
|
2924
|
+
F: __dxlog_file14,
|
|
2887
2925
|
L: 460,
|
|
2888
2926
|
S: this,
|
|
2889
2927
|
C: (f, a) => f(...a)
|
|
2890
2928
|
});
|
|
2891
2929
|
} else {
|
|
2892
|
-
|
|
2930
|
+
log11.info("invitation state update", {
|
|
2893
2931
|
actor: actor?.constructor.name,
|
|
2894
2932
|
newState: stateToString(newState),
|
|
2895
2933
|
oldState: stateToString(invitation.state)
|
|
2896
2934
|
}, {
|
|
2897
|
-
F:
|
|
2935
|
+
F: __dxlog_file14,
|
|
2898
2936
|
L: 466,
|
|
2899
2937
|
S: this,
|
|
2900
2938
|
C: (f, a) => f(...a)
|
|
@@ -2912,16 +2950,16 @@ var InvitationsHandler = class {
|
|
|
2912
2950
|
}
|
|
2913
2951
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2914
2952
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2915
|
-
|
|
2916
|
-
F:
|
|
2953
|
+
log11("guest waiting for authentication code...", void 0, {
|
|
2954
|
+
F: __dxlog_file14,
|
|
2917
2955
|
L: 491,
|
|
2918
2956
|
S: this,
|
|
2919
2957
|
C: (f, a) => f(...a)
|
|
2920
2958
|
});
|
|
2921
2959
|
setState(Invitation4.State.READY_FOR_AUTHENTICATION);
|
|
2922
2960
|
const authCode = await authenticated.wait(options);
|
|
2923
|
-
|
|
2924
|
-
F:
|
|
2961
|
+
log11("sending authentication request", void 0, {
|
|
2962
|
+
F: __dxlog_file14,
|
|
2925
2963
|
L: 495,
|
|
2926
2964
|
S: this,
|
|
2927
2965
|
C: (f, a) => f(...a)
|
|
@@ -2937,10 +2975,10 @@ var InvitationsHandler = class {
|
|
|
2937
2975
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
2938
2976
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
2939
2977
|
} else {
|
|
2940
|
-
|
|
2978
|
+
log11("retrying invalid code", {
|
|
2941
2979
|
attempt
|
|
2942
2980
|
}, {
|
|
2943
|
-
F:
|
|
2981
|
+
F: __dxlog_file14,
|
|
2944
2982
|
L: 506,
|
|
2945
2983
|
S: this,
|
|
2946
2984
|
C: (f, a) => f(...a)
|
|
@@ -2957,8 +2995,8 @@ var InvitationsHandler = class {
|
|
|
2957
2995
|
if (introductionResponse.challenge == null) {
|
|
2958
2996
|
throw new Error("challenge missing in the introduction");
|
|
2959
2997
|
}
|
|
2960
|
-
|
|
2961
|
-
F:
|
|
2998
|
+
log11("sending authentication request", void 0, {
|
|
2999
|
+
F: __dxlog_file14,
|
|
2962
3000
|
L: 525,
|
|
2963
3001
|
S: this,
|
|
2964
3002
|
C: (f, a) => f(...a)
|
|
@@ -3082,11 +3120,11 @@ var InvitationsServiceImpl = class {
|
|
|
3082
3120
|
import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
3083
3121
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
3084
3122
|
import { invariant as invariant10 } from "@dxos/invariant";
|
|
3085
|
-
import { log as
|
|
3123
|
+
import { log as log12 } from "@dxos/log";
|
|
3086
3124
|
import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
|
|
3087
3125
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3088
3126
|
import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3089
|
-
var
|
|
3127
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3090
3128
|
var SpaceInvitationProtocol = class {
|
|
3091
3129
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3092
3130
|
this._spaceManager = _spaceManager;
|
|
@@ -3121,7 +3159,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3121
3159
|
}
|
|
3122
3160
|
async admit(invitation, request, guestProfile) {
|
|
3123
3161
|
invariant10(this._spaceKey && request.space, void 0, {
|
|
3124
|
-
F:
|
|
3162
|
+
F: __dxlog_file15,
|
|
3125
3163
|
L: 74,
|
|
3126
3164
|
S: this,
|
|
3127
3165
|
A: [
|
|
@@ -3129,11 +3167,11 @@ var SpaceInvitationProtocol = class {
|
|
|
3129
3167
|
""
|
|
3130
3168
|
]
|
|
3131
3169
|
});
|
|
3132
|
-
|
|
3170
|
+
log12("writing guest credentials", {
|
|
3133
3171
|
host: this._signingContext.deviceKey,
|
|
3134
3172
|
guest: request.space.deviceKey
|
|
3135
3173
|
}, {
|
|
3136
|
-
F:
|
|
3174
|
+
F: __dxlog_file15,
|
|
3137
3175
|
L: 75,
|
|
3138
3176
|
S: this,
|
|
3139
3177
|
C: (f, a) => f(...a)
|
|
@@ -3155,7 +3193,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3155
3193
|
}
|
|
3156
3194
|
async delegate(invitation) {
|
|
3157
3195
|
invariant10(this._spaceKey, void 0, {
|
|
3158
|
-
F:
|
|
3196
|
+
F: __dxlog_file15,
|
|
3159
3197
|
L: 95,
|
|
3160
3198
|
S: this,
|
|
3161
3199
|
A: [
|
|
@@ -3165,7 +3203,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3165
3203
|
});
|
|
3166
3204
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3167
3205
|
invariant10(space, void 0, {
|
|
3168
|
-
F:
|
|
3206
|
+
F: __dxlog_file15,
|
|
3169
3207
|
L: 97,
|
|
3170
3208
|
S: this,
|
|
3171
3209
|
A: [
|
|
@@ -3175,7 +3213,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3175
3213
|
});
|
|
3176
3214
|
if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3177
3215
|
invariant10(invitation.guestKeypair?.publicKey, void 0, {
|
|
3178
|
-
F:
|
|
3216
|
+
F: __dxlog_file15,
|
|
3179
3217
|
L: 99,
|
|
3180
3218
|
S: this,
|
|
3181
3219
|
A: [
|
|
@@ -3184,11 +3222,11 @@ var SpaceInvitationProtocol = class {
|
|
|
3184
3222
|
]
|
|
3185
3223
|
});
|
|
3186
3224
|
}
|
|
3187
|
-
|
|
3225
|
+
log12("writing delegate space invitation", {
|
|
3188
3226
|
host: this._signingContext.deviceKey,
|
|
3189
3227
|
id: invitation.invitationId
|
|
3190
3228
|
}, {
|
|
3191
|
-
F:
|
|
3229
|
+
F: __dxlog_file15,
|
|
3192
3230
|
L: 102,
|
|
3193
3231
|
S: this,
|
|
3194
3232
|
C: (f, a) => f(...a)
|
|
@@ -3203,7 +3241,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3203
3241
|
guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3204
3242
|
});
|
|
3205
3243
|
invariant10(credential.credential, void 0, {
|
|
3206
|
-
F:
|
|
3244
|
+
F: __dxlog_file15,
|
|
3207
3245
|
L: 122,
|
|
3208
3246
|
S: this,
|
|
3209
3247
|
A: [
|
|
@@ -3218,7 +3256,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3218
3256
|
}
|
|
3219
3257
|
async cancelDelegation(invitation) {
|
|
3220
3258
|
invariant10(this._spaceKey, void 0, {
|
|
3221
|
-
F:
|
|
3259
|
+
F: __dxlog_file15,
|
|
3222
3260
|
L: 128,
|
|
3223
3261
|
S: this,
|
|
3224
3262
|
A: [
|
|
@@ -3227,7 +3265,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3227
3265
|
]
|
|
3228
3266
|
});
|
|
3229
3267
|
invariant10(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3230
|
-
F:
|
|
3268
|
+
F: __dxlog_file15,
|
|
3231
3269
|
L: 129,
|
|
3232
3270
|
S: this,
|
|
3233
3271
|
A: [
|
|
@@ -3237,7 +3275,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3237
3275
|
});
|
|
3238
3276
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3239
3277
|
invariant10(space, void 0, {
|
|
3240
|
-
F:
|
|
3278
|
+
F: __dxlog_file15,
|
|
3241
3279
|
L: 131,
|
|
3242
3280
|
S: this,
|
|
3243
3281
|
A: [
|
|
@@ -3245,18 +3283,18 @@ var SpaceInvitationProtocol = class {
|
|
|
3245
3283
|
""
|
|
3246
3284
|
]
|
|
3247
3285
|
});
|
|
3248
|
-
|
|
3286
|
+
log12("cancelling delegated space invitation", {
|
|
3249
3287
|
host: this._signingContext.deviceKey,
|
|
3250
3288
|
id: invitation.invitationId
|
|
3251
3289
|
}, {
|
|
3252
|
-
F:
|
|
3290
|
+
F: __dxlog_file15,
|
|
3253
3291
|
L: 133,
|
|
3254
3292
|
S: this,
|
|
3255
3293
|
C: (f, a) => f(...a)
|
|
3256
3294
|
});
|
|
3257
3295
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3258
3296
|
invariant10(credential.credential, void 0, {
|
|
3259
|
-
F:
|
|
3297
|
+
F: __dxlog_file15,
|
|
3260
3298
|
L: 140,
|
|
3261
3299
|
S: this,
|
|
3262
3300
|
A: [
|
|
@@ -3295,7 +3333,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3295
3333
|
}
|
|
3296
3334
|
async accept(response) {
|
|
3297
3335
|
invariant10(response.space, void 0, {
|
|
3298
|
-
F:
|
|
3336
|
+
F: __dxlog_file15,
|
|
3299
3337
|
L: 175,
|
|
3300
3338
|
S: this,
|
|
3301
3339
|
A: [
|
|
@@ -3306,7 +3344,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3306
3344
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3307
3345
|
const assertion = getCredentialAssertion2(credential);
|
|
3308
3346
|
invariant10(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3309
|
-
F:
|
|
3347
|
+
F: __dxlog_file15,
|
|
3310
3348
|
L: 178,
|
|
3311
3349
|
S: this,
|
|
3312
3350
|
A: [
|
|
@@ -3315,7 +3353,7 @@ var SpaceInvitationProtocol = class {
|
|
|
3315
3353
|
]
|
|
3316
3354
|
});
|
|
3317
3355
|
invariant10(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3318
|
-
F:
|
|
3356
|
+
F: __dxlog_file15,
|
|
3319
3357
|
L: 179,
|
|
3320
3358
|
S: this,
|
|
3321
3359
|
A: [
|
|
@@ -3347,10 +3385,10 @@ import { generatePasscode } from "@dxos/credentials";
|
|
|
3347
3385
|
import { hasInvitationExpired } from "@dxos/echo-pipeline";
|
|
3348
3386
|
import { invariant as invariant11 } from "@dxos/invariant";
|
|
3349
3387
|
import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
3350
|
-
import { log as
|
|
3388
|
+
import { log as log13 } from "@dxos/log";
|
|
3351
3389
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3352
3390
|
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3353
|
-
var
|
|
3391
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3354
3392
|
var InvitationsManager = class {
|
|
3355
3393
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3356
3394
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3392,8 +3430,8 @@ var InvitationsManager = class {
|
|
|
3392
3430
|
try {
|
|
3393
3431
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3394
3432
|
} catch (err) {
|
|
3395
|
-
|
|
3396
|
-
F:
|
|
3433
|
+
log13.catch(err, void 0, {
|
|
3434
|
+
F: __dxlog_file16,
|
|
3397
3435
|
L: 82,
|
|
3398
3436
|
S: this,
|
|
3399
3437
|
C: (f, a) => f(...a)
|
|
@@ -3416,7 +3454,7 @@ var InvitationsManager = class {
|
|
|
3416
3454
|
const freshInvitations = persistentInvitations.filter((invitation) => !hasInvitationExpired(invitation));
|
|
3417
3455
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3418
3456
|
invariant11(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3419
|
-
F:
|
|
3457
|
+
F: __dxlog_file16,
|
|
3420
3458
|
L: 103,
|
|
3421
3459
|
S: this,
|
|
3422
3460
|
A: [
|
|
@@ -3434,8 +3472,8 @@ var InvitationsManager = class {
|
|
|
3434
3472
|
invitations: cInvitations.map((invitation) => invitation.get())
|
|
3435
3473
|
};
|
|
3436
3474
|
} catch (err) {
|
|
3437
|
-
|
|
3438
|
-
F:
|
|
3475
|
+
log13.catch(err, void 0, {
|
|
3476
|
+
F: __dxlog_file16,
|
|
3439
3477
|
L: 110,
|
|
3440
3478
|
S: this,
|
|
3441
3479
|
C: (f, a) => f(...a)
|
|
@@ -3466,14 +3504,14 @@ var InvitationsManager = class {
|
|
|
3466
3504
|
return invitation;
|
|
3467
3505
|
}
|
|
3468
3506
|
async authenticate({ invitationId, authCode }) {
|
|
3469
|
-
|
|
3470
|
-
F:
|
|
3507
|
+
log13("authenticating...", void 0, {
|
|
3508
|
+
F: __dxlog_file16,
|
|
3471
3509
|
L: 140,
|
|
3472
3510
|
S: this,
|
|
3473
3511
|
C: (f, a) => f(...a)
|
|
3474
3512
|
});
|
|
3475
3513
|
invariant11(invitationId, void 0, {
|
|
3476
|
-
F:
|
|
3514
|
+
F: __dxlog_file16,
|
|
3477
3515
|
L: 141,
|
|
3478
3516
|
S: this,
|
|
3479
3517
|
A: [
|
|
@@ -3483,10 +3521,10 @@ var InvitationsManager = class {
|
|
|
3483
3521
|
});
|
|
3484
3522
|
const observable = this._acceptInvitations.get(invitationId);
|
|
3485
3523
|
if (!observable) {
|
|
3486
|
-
|
|
3524
|
+
log13.warn("invalid invitation", {
|
|
3487
3525
|
invitationId
|
|
3488
3526
|
}, {
|
|
3489
|
-
F:
|
|
3527
|
+
F: __dxlog_file16,
|
|
3490
3528
|
L: 144,
|
|
3491
3529
|
S: this,
|
|
3492
3530
|
C: (f, a) => f(...a)
|
|
@@ -3496,16 +3534,16 @@ var InvitationsManager = class {
|
|
|
3496
3534
|
}
|
|
3497
3535
|
}
|
|
3498
3536
|
async cancelInvitation({ invitationId }) {
|
|
3499
|
-
|
|
3537
|
+
log13("cancelInvitation...", {
|
|
3500
3538
|
invitationId
|
|
3501
3539
|
}, {
|
|
3502
|
-
F:
|
|
3540
|
+
F: __dxlog_file16,
|
|
3503
3541
|
L: 151,
|
|
3504
3542
|
S: this,
|
|
3505
3543
|
C: (f, a) => f(...a)
|
|
3506
3544
|
});
|
|
3507
3545
|
invariant11(invitationId, void 0, {
|
|
3508
|
-
F:
|
|
3546
|
+
F: __dxlog_file16,
|
|
3509
3547
|
L: 152,
|
|
3510
3548
|
S: this,
|
|
3511
3549
|
A: [
|
|
@@ -3580,14 +3618,14 @@ var InvitationsManager = class {
|
|
|
3580
3618
|
void ctx.dispose();
|
|
3581
3619
|
}
|
|
3582
3620
|
}, {
|
|
3583
|
-
F:
|
|
3621
|
+
F: __dxlog_file16,
|
|
3584
3622
|
L: 234
|
|
3585
3623
|
});
|
|
3586
3624
|
ctx.onDispose(() => {
|
|
3587
|
-
|
|
3625
|
+
log13("complete", {
|
|
3588
3626
|
...handler.toJSON()
|
|
3589
3627
|
}, {
|
|
3590
|
-
F:
|
|
3628
|
+
F: __dxlog_file16,
|
|
3591
3629
|
L: 241,
|
|
3592
3630
|
S: this,
|
|
3593
3631
|
C: (f, a) => f(...a)
|
|
@@ -3617,10 +3655,10 @@ var InvitationsManager = class {
|
|
|
3617
3655
|
const ctx = new Context6({
|
|
3618
3656
|
onError: (err) => {
|
|
3619
3657
|
if (err instanceof TimeoutError2) {
|
|
3620
|
-
|
|
3658
|
+
log13("timeout", {
|
|
3621
3659
|
...handler.toJSON()
|
|
3622
3660
|
}, {
|
|
3623
|
-
F:
|
|
3661
|
+
F: __dxlog_file16,
|
|
3624
3662
|
L: 261,
|
|
3625
3663
|
S: this,
|
|
3626
3664
|
C: (f, a) => f(...a)
|
|
@@ -3630,8 +3668,8 @@ var InvitationsManager = class {
|
|
|
3630
3668
|
state: Invitation6.State.TIMEOUT
|
|
3631
3669
|
});
|
|
3632
3670
|
} else {
|
|
3633
|
-
|
|
3634
|
-
F:
|
|
3671
|
+
log13.warn("auth failed", err, {
|
|
3672
|
+
F: __dxlog_file16,
|
|
3635
3673
|
L: 264,
|
|
3636
3674
|
S: this,
|
|
3637
3675
|
C: (f, a) => f(...a)
|
|
@@ -3644,14 +3682,14 @@ var InvitationsManager = class {
|
|
|
3644
3682
|
void ctx.dispose();
|
|
3645
3683
|
}
|
|
3646
3684
|
}, {
|
|
3647
|
-
F:
|
|
3685
|
+
F: __dxlog_file16,
|
|
3648
3686
|
L: 258
|
|
3649
3687
|
});
|
|
3650
3688
|
ctx.onDispose(() => {
|
|
3651
|
-
|
|
3689
|
+
log13("complete", {
|
|
3652
3690
|
...handler.toJSON()
|
|
3653
3691
|
}, {
|
|
3654
|
-
F:
|
|
3692
|
+
F: __dxlog_file16,
|
|
3655
3693
|
L: 271,
|
|
3656
3694
|
S: this,
|
|
3657
3695
|
C: (f, a) => f(...a)
|
|
@@ -3695,8 +3733,8 @@ var InvitationsManager = class {
|
|
|
3695
3733
|
try {
|
|
3696
3734
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3697
3735
|
} catch (err) {
|
|
3698
|
-
|
|
3699
|
-
F:
|
|
3736
|
+
log13.catch(err, void 0, {
|
|
3737
|
+
F: __dxlog_file16,
|
|
3700
3738
|
L: 307,
|
|
3701
3739
|
S: this,
|
|
3702
3740
|
C: (f, a) => f(...a)
|
|
@@ -3713,7 +3751,7 @@ var InvitationsManager = class {
|
|
|
3713
3751
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
3714
3752
|
import { asyncTimeout as asyncTimeout2, Trigger as Trigger7 } from "@dxos/async";
|
|
3715
3753
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
3716
|
-
import { log as
|
|
3754
|
+
import { log as log14, logInfo } from "@dxos/log";
|
|
3717
3755
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
3718
3756
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3719
3757
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3724,7 +3762,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
3724
3762
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3725
3763
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3726
3764
|
}
|
|
3727
|
-
var
|
|
3765
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
|
|
3728
3766
|
var Message;
|
|
3729
3767
|
(function(Message2) {
|
|
3730
3768
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -3746,29 +3784,29 @@ var Lock = class {
|
|
|
3746
3784
|
message: "acquiring"
|
|
3747
3785
|
});
|
|
3748
3786
|
try {
|
|
3749
|
-
|
|
3750
|
-
F:
|
|
3787
|
+
log14("aquiring lock...", void 0, {
|
|
3788
|
+
F: __dxlog_file17,
|
|
3751
3789
|
L: 42,
|
|
3752
3790
|
S: this,
|
|
3753
3791
|
C: (f, a) => f(...a)
|
|
3754
3792
|
});
|
|
3755
3793
|
await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
|
|
3756
|
-
|
|
3757
|
-
F:
|
|
3794
|
+
log14("acquired lock", void 0, {
|
|
3795
|
+
F: __dxlog_file17,
|
|
3758
3796
|
L: 44,
|
|
3759
3797
|
S: this,
|
|
3760
3798
|
C: (f, a) => f(...a)
|
|
3761
3799
|
});
|
|
3762
3800
|
} catch {
|
|
3763
|
-
|
|
3764
|
-
F:
|
|
3801
|
+
log14("stealing lock...", void 0, {
|
|
3802
|
+
F: __dxlog_file17,
|
|
3765
3803
|
L: 46,
|
|
3766
3804
|
S: this,
|
|
3767
3805
|
C: (f, a) => f(...a)
|
|
3768
3806
|
});
|
|
3769
3807
|
await this._requestLock(true);
|
|
3770
|
-
|
|
3771
|
-
F:
|
|
3808
|
+
log14("stolen lock", void 0, {
|
|
3809
|
+
F: __dxlog_file17,
|
|
3772
3810
|
L: 48,
|
|
3773
3811
|
S: this,
|
|
3774
3812
|
C: (f, a) => f(...a)
|
|
@@ -3784,10 +3822,10 @@ var Lock = class {
|
|
|
3784
3822
|
}
|
|
3785
3823
|
}
|
|
3786
3824
|
async _requestLock(steal = false) {
|
|
3787
|
-
|
|
3825
|
+
log14("requesting lock...", {
|
|
3788
3826
|
steal
|
|
3789
3827
|
}, {
|
|
3790
|
-
F:
|
|
3828
|
+
F: __dxlog_file17,
|
|
3791
3829
|
L: 63,
|
|
3792
3830
|
S: this,
|
|
3793
3831
|
C: (f, a) => f(...a)
|
|
@@ -3800,15 +3838,15 @@ var Lock = class {
|
|
|
3800
3838
|
acquired.wake();
|
|
3801
3839
|
this._releaseTrigger = new Trigger7();
|
|
3802
3840
|
await this._releaseTrigger.wait();
|
|
3803
|
-
|
|
3804
|
-
F:
|
|
3841
|
+
log14("releasing lock...", void 0, {
|
|
3842
|
+
F: __dxlog_file17,
|
|
3805
3843
|
L: 72,
|
|
3806
3844
|
S: this,
|
|
3807
3845
|
C: (f, a) => f(...a)
|
|
3808
3846
|
});
|
|
3809
3847
|
await this._onRelease?.();
|
|
3810
|
-
|
|
3811
|
-
F:
|
|
3848
|
+
log14("released lock", void 0, {
|
|
3849
|
+
F: __dxlog_file17,
|
|
3812
3850
|
L: 74,
|
|
3813
3851
|
S: this,
|
|
3814
3852
|
C: (f, a) => f(...a)
|
|
@@ -3817,10 +3855,10 @@ var Lock = class {
|
|
|
3817
3855
|
await this._onRelease?.();
|
|
3818
3856
|
});
|
|
3819
3857
|
await acquired.wait();
|
|
3820
|
-
|
|
3858
|
+
log14("recieved lock", {
|
|
3821
3859
|
steal
|
|
3822
3860
|
}, {
|
|
3823
|
-
F:
|
|
3861
|
+
F: __dxlog_file17,
|
|
3824
3862
|
L: 81,
|
|
3825
3863
|
S: this,
|
|
3826
3864
|
C: (f, a) => f(...a)
|
|
@@ -3921,7 +3959,7 @@ import { Event as Event4, Mutex as Mutex2, scheduleMicroTask } from "@dxos/async
|
|
|
3921
3959
|
import { Resource as Resource2 } from "@dxos/context";
|
|
3922
3960
|
import { invariant as invariant12 } from "@dxos/invariant";
|
|
3923
3961
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
3924
|
-
import { log as
|
|
3962
|
+
import { log as log15 } from "@dxos/log";
|
|
3925
3963
|
import { EdgeService } from "@dxos/protocols";
|
|
3926
3964
|
import { buf } from "@dxos/protocols/buf";
|
|
3927
3965
|
import { MessageSchema as RouterMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
@@ -3989,7 +4027,7 @@ function _using_ctx() {
|
|
|
3989
4027
|
}
|
|
3990
4028
|
};
|
|
3991
4029
|
}
|
|
3992
|
-
var
|
|
4030
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/edge-feed-replicator.ts";
|
|
3993
4031
|
var EdgeFeedReplicator = class extends Resource2 {
|
|
3994
4032
|
constructor({ messenger, spaceId }) {
|
|
3995
4033
|
super();
|
|
@@ -4018,11 +4056,11 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4018
4056
|
}
|
|
4019
4057
|
const [spaceId] = rest;
|
|
4020
4058
|
if (spaceId !== this._spaceId) {
|
|
4021
|
-
|
|
4059
|
+
log15("spaceID mismatch", {
|
|
4022
4060
|
spaceId,
|
|
4023
4061
|
_spaceId: this._spaceId
|
|
4024
4062
|
}, {
|
|
4025
|
-
F:
|
|
4063
|
+
F: __dxlog_file18,
|
|
4026
4064
|
L: 62,
|
|
4027
4065
|
S: this,
|
|
4028
4066
|
C: (f, a) => f(...a)
|
|
@@ -4030,11 +4068,11 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4030
4068
|
return;
|
|
4031
4069
|
}
|
|
4032
4070
|
const payload = decodeCbor(message.payload.value);
|
|
4033
|
-
|
|
4071
|
+
log15.info("recv", {
|
|
4034
4072
|
from: message.source,
|
|
4035
4073
|
payload
|
|
4036
4074
|
}, {
|
|
4037
|
-
F:
|
|
4075
|
+
F: __dxlog_file18,
|
|
4038
4076
|
L: 67,
|
|
4039
4077
|
S: this,
|
|
4040
4078
|
C: (f, a) => f(...a)
|
|
@@ -4055,10 +4093,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4055
4093
|
this._remoteLength.clear();
|
|
4056
4094
|
}
|
|
4057
4095
|
async addFeed(feed) {
|
|
4058
|
-
|
|
4096
|
+
log15.info("addFeed", {
|
|
4059
4097
|
key: feed.key
|
|
4060
4098
|
}, {
|
|
4061
|
-
F:
|
|
4099
|
+
F: __dxlog_file18,
|
|
4062
4100
|
L: 89,
|
|
4063
4101
|
S: this,
|
|
4064
4102
|
C: (f, a) => f(...a)
|
|
@@ -4073,7 +4111,7 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4073
4111
|
}
|
|
4074
4112
|
async _replicateFeed(feed) {
|
|
4075
4113
|
invariant12(this._connectionCtx, void 0, {
|
|
4076
|
-
F:
|
|
4114
|
+
F: __dxlog_file18,
|
|
4077
4115
|
L: 102,
|
|
4078
4116
|
S: this,
|
|
4079
4117
|
A: [
|
|
@@ -4090,16 +4128,16 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4090
4128
|
});
|
|
4091
4129
|
}
|
|
4092
4130
|
async _sendMessage(message) {
|
|
4093
|
-
|
|
4131
|
+
log15.info("sending message", {
|
|
4094
4132
|
message
|
|
4095
4133
|
}, {
|
|
4096
|
-
F:
|
|
4134
|
+
F: __dxlog_file18,
|
|
4097
4135
|
L: 115,
|
|
4098
4136
|
S: this,
|
|
4099
4137
|
C: (f, a) => f(...a)
|
|
4100
4138
|
});
|
|
4101
4139
|
invariant12(message.feedKey, void 0, {
|
|
4102
|
-
F:
|
|
4140
|
+
F: __dxlog_file18,
|
|
4103
4141
|
L: 117,
|
|
4104
4142
|
S: this,
|
|
4105
4143
|
A: [
|
|
@@ -4110,8 +4148,8 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4110
4148
|
const payloadValue = bufferToArray(encodeCbor(message));
|
|
4111
4149
|
await this._messenger.send(buf.create(RouterMessageSchema, {
|
|
4112
4150
|
source: {
|
|
4113
|
-
identityKey: this._messenger.identityKey
|
|
4114
|
-
peerKey: this._messenger.
|
|
4151
|
+
identityKey: this._messenger.identityKey,
|
|
4152
|
+
peerKey: this._messenger.peerKey
|
|
4115
4153
|
},
|
|
4116
4154
|
serviceId: `${EdgeService.FEED_REPLICATOR}:${this._spaceId}`,
|
|
4117
4155
|
payload: {
|
|
@@ -4120,10 +4158,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4120
4158
|
}));
|
|
4121
4159
|
}
|
|
4122
4160
|
_onMessage(message) {
|
|
4123
|
-
|
|
4161
|
+
log15.info("received message", {
|
|
4124
4162
|
message
|
|
4125
4163
|
}, {
|
|
4126
|
-
F:
|
|
4164
|
+
F: __dxlog_file18,
|
|
4127
4165
|
L: 133,
|
|
4128
4166
|
S: this,
|
|
4129
4167
|
C: (f, a) => f(...a)
|
|
@@ -4136,10 +4174,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4136
4174
|
const feedKey = PublicKey9.fromHex(message.feedKey);
|
|
4137
4175
|
const feed = this._feeds.get(feedKey);
|
|
4138
4176
|
if (!feed) {
|
|
4139
|
-
|
|
4177
|
+
log15.warn("Feed not found", {
|
|
4140
4178
|
feedKey
|
|
4141
4179
|
}, {
|
|
4142
|
-
F:
|
|
4180
|
+
F: __dxlog_file18,
|
|
4143
4181
|
L: 141,
|
|
4144
4182
|
S: this,
|
|
4145
4183
|
C: (f, a) => f(...a)
|
|
@@ -4171,10 +4209,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4171
4209
|
const feedKey = PublicKey9.fromHex(message.feedKey);
|
|
4172
4210
|
const feed = this._feeds.get(feedKey);
|
|
4173
4211
|
if (!feed) {
|
|
4174
|
-
|
|
4212
|
+
log15.warn("Feed not found", {
|
|
4175
4213
|
feedKey
|
|
4176
4214
|
}, {
|
|
4177
|
-
F:
|
|
4215
|
+
F: __dxlog_file18,
|
|
4178
4216
|
L: 166,
|
|
4179
4217
|
S: this,
|
|
4180
4218
|
C: (f, a) => f(...a)
|
|
@@ -4185,10 +4223,10 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4185
4223
|
break;
|
|
4186
4224
|
}
|
|
4187
4225
|
default: {
|
|
4188
|
-
|
|
4226
|
+
log15.warn("Unknown message", {
|
|
4189
4227
|
...message
|
|
4190
4228
|
}, {
|
|
4191
|
-
F:
|
|
4229
|
+
F: __dxlog_file18,
|
|
4192
4230
|
L: 175,
|
|
4193
4231
|
S: this,
|
|
4194
4232
|
C: (f, a) => f(...a)
|
|
@@ -4198,12 +4236,12 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4198
4236
|
});
|
|
4199
4237
|
}
|
|
4200
4238
|
async _pushBlocks(feed, from, to) {
|
|
4201
|
-
|
|
4239
|
+
log15.info("pushing blocks", {
|
|
4202
4240
|
feed: feed.key.toHex(),
|
|
4203
4241
|
from,
|
|
4204
4242
|
to
|
|
4205
4243
|
}, {
|
|
4206
|
-
F:
|
|
4244
|
+
F: __dxlog_file18,
|
|
4207
4245
|
L: 182,
|
|
4208
4246
|
S: this,
|
|
4209
4247
|
C: (f, a) => f(...a)
|
|
@@ -4213,7 +4251,7 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4213
4251
|
valueEncoding: "binary"
|
|
4214
4252
|
});
|
|
4215
4253
|
invariant12(data instanceof Uint8Array, void 0, {
|
|
4216
|
-
F:
|
|
4254
|
+
F: __dxlog_file18,
|
|
4217
4255
|
L: 187,
|
|
4218
4256
|
S: this,
|
|
4219
4257
|
A: [
|
|
@@ -4237,11 +4275,11 @@ var EdgeFeedReplicator = class extends Resource2 {
|
|
|
4237
4275
|
this._remoteLength.set(feed.key, to);
|
|
4238
4276
|
}
|
|
4239
4277
|
async _integrateBlocks(feed, blocks) {
|
|
4240
|
-
|
|
4278
|
+
log15.info("integrating blocks", {
|
|
4241
4279
|
feed: feed.key.toHex(),
|
|
4242
4280
|
blocks: blocks.length
|
|
4243
4281
|
}, {
|
|
4244
|
-
F:
|
|
4282
|
+
F: __dxlog_file18,
|
|
4245
4283
|
L: 208,
|
|
4246
4284
|
S: this,
|
|
4247
4285
|
C: (f, a) => f(...a)
|
|
@@ -4295,7 +4333,7 @@ import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
|
4295
4333
|
import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
|
|
4296
4334
|
import { failedInvariant } from "@dxos/invariant";
|
|
4297
4335
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4298
|
-
import { log as
|
|
4336
|
+
import { log as log18 } from "@dxos/log";
|
|
4299
4337
|
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
4300
4338
|
import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4301
4339
|
import { AdmittedFeed as AdmittedFeed3, SpaceMember as SpaceMember4 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -4353,9 +4391,9 @@ import { convertLegacyReferences, convertLegacySpaceRootDoc, findInlineObjectOfT
|
|
|
4353
4391
|
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
4354
4392
|
import { TYPE_PROPERTIES } from "@dxos/echo-schema";
|
|
4355
4393
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
4356
|
-
import { log as
|
|
4394
|
+
import { log as log16 } from "@dxos/log";
|
|
4357
4395
|
import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
4358
|
-
var
|
|
4396
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
4359
4397
|
var LOAD_DOC_TIMEOUT = 1e4;
|
|
4360
4398
|
var runEpochMigration = async (ctx, context) => {
|
|
4361
4399
|
switch (context.migration) {
|
|
@@ -4380,8 +4418,8 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4380
4418
|
};
|
|
4381
4419
|
}
|
|
4382
4420
|
case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
4383
|
-
|
|
4384
|
-
F:
|
|
4421
|
+
log16.info("Fragmenting", void 0, {
|
|
4422
|
+
F: __dxlog_file19,
|
|
4385
4423
|
L: 64,
|
|
4386
4424
|
S: void 0,
|
|
4387
4425
|
C: (f, a) => f(...a)
|
|
@@ -4394,7 +4432,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4394
4432
|
const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
|
|
4395
4433
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
4396
4434
|
invariant13(properties, "Properties not found", {
|
|
4397
|
-
F:
|
|
4435
|
+
F: __dxlog_file19,
|
|
4398
4436
|
L: 75,
|
|
4399
4437
|
S: void 0,
|
|
4400
4438
|
A: [
|
|
@@ -4409,7 +4447,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4409
4447
|
])
|
|
4410
4448
|
});
|
|
4411
4449
|
invariant13(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
4412
|
-
F:
|
|
4450
|
+
F: __dxlog_file19,
|
|
4413
4451
|
L: 82,
|
|
4414
4452
|
S: void 0,
|
|
4415
4453
|
A: [
|
|
@@ -4450,7 +4488,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4450
4488
|
timeout: LOAD_DOC_TIMEOUT
|
|
4451
4489
|
});
|
|
4452
4490
|
invariant13(rootHandle.docSync(), "Root doc not found", {
|
|
4453
|
-
F:
|
|
4491
|
+
F: __dxlog_file19,
|
|
4454
4492
|
L: 115,
|
|
4455
4493
|
S: void 0,
|
|
4456
4494
|
A: [
|
|
@@ -4465,7 +4503,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4465
4503
|
timeout: LOAD_DOC_TIMEOUT
|
|
4466
4504
|
});
|
|
4467
4505
|
invariant13(handle.docSync(), void 0, {
|
|
4468
|
-
F:
|
|
4506
|
+
F: __dxlog_file19,
|
|
4469
4507
|
L: 122,
|
|
4470
4508
|
S: void 0,
|
|
4471
4509
|
A: [
|
|
@@ -4480,12 +4518,12 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4480
4518
|
});
|
|
4481
4519
|
newRootContent.links[id] = newHandle.url;
|
|
4482
4520
|
} catch (err) {
|
|
4483
|
-
|
|
4521
|
+
log16.warn("Failed to migrate reference", {
|
|
4484
4522
|
id,
|
|
4485
4523
|
url,
|
|
4486
4524
|
error: err
|
|
4487
4525
|
}, {
|
|
4488
|
-
F:
|
|
4526
|
+
F: __dxlog_file19,
|
|
4489
4527
|
L: 128,
|
|
4490
4528
|
S: void 0,
|
|
4491
4529
|
C: (f, a) => f(...a)
|
|
@@ -4504,7 +4542,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
4504
4542
|
}
|
|
4505
4543
|
case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
4506
4544
|
invariant13(context.newAutomergeRoot, void 0, {
|
|
4507
|
-
F:
|
|
4545
|
+
F: __dxlog_file19,
|
|
4508
4546
|
L: 143,
|
|
4509
4547
|
S: void 0,
|
|
4510
4548
|
A: [
|
|
@@ -4526,11 +4564,11 @@ import { DeferredTask, Event as Event6, scheduleTask as scheduleTask4, sleep as
|
|
|
4526
4564
|
import { Context as Context7, rejectOnDispose } from "@dxos/context";
|
|
4527
4565
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4528
4566
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4529
|
-
import { log as
|
|
4530
|
-
import { schema as schema4 } from "@dxos/protocols";
|
|
4567
|
+
import { log as log17 } from "@dxos/log";
|
|
4568
|
+
import { schema as schema4 } from "@dxos/protocols/proto";
|
|
4531
4569
|
import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
|
|
4532
4570
|
import { ComplexMap as ComplexMap3, ComplexSet as ComplexSet4, entry } from "@dxos/util";
|
|
4533
|
-
var
|
|
4571
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
4534
4572
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
4535
4573
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
4536
4574
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -4538,7 +4576,7 @@ var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
|
4538
4576
|
var NotarizationPlugin = class {
|
|
4539
4577
|
constructor() {
|
|
4540
4578
|
this._ctx = new Context7(void 0, {
|
|
4541
|
-
F:
|
|
4579
|
+
F: __dxlog_file20,
|
|
4542
4580
|
L: 62
|
|
4543
4581
|
});
|
|
4544
4582
|
this._extensionOpened = new Event6();
|
|
@@ -4558,16 +4596,16 @@ var NotarizationPlugin = class {
|
|
|
4558
4596
|
* Request credentials to be notarized.
|
|
4559
4597
|
*/
|
|
4560
4598
|
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
4561
|
-
|
|
4599
|
+
log17("notarize", {
|
|
4562
4600
|
credentials
|
|
4563
4601
|
}, {
|
|
4564
|
-
F:
|
|
4602
|
+
F: __dxlog_file20,
|
|
4565
4603
|
L: 90,
|
|
4566
4604
|
S: this,
|
|
4567
4605
|
C: (f, a) => f(...a)
|
|
4568
4606
|
});
|
|
4569
4607
|
invariant14(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
4570
|
-
F:
|
|
4608
|
+
F: __dxlog_file20,
|
|
4571
4609
|
L: 91,
|
|
4572
4610
|
S: this,
|
|
4573
4611
|
A: [
|
|
@@ -4578,10 +4616,10 @@ var NotarizationPlugin = class {
|
|
|
4578
4616
|
const errors = new Trigger8();
|
|
4579
4617
|
const ctx = this._ctx.derive({
|
|
4580
4618
|
onError: (err) => {
|
|
4581
|
-
|
|
4619
|
+
log17.warn("Notarization error", {
|
|
4582
4620
|
err
|
|
4583
4621
|
}, {
|
|
4584
|
-
F:
|
|
4622
|
+
F: __dxlog_file20,
|
|
4585
4623
|
L: 99,
|
|
4586
4624
|
S: this,
|
|
4587
4625
|
C: (f, a) => f(...a)
|
|
@@ -4593,11 +4631,11 @@ var NotarizationPlugin = class {
|
|
|
4593
4631
|
opCtx?.onDispose(() => ctx.dispose());
|
|
4594
4632
|
if (timeout !== 0) {
|
|
4595
4633
|
scheduleTask4(ctx, () => {
|
|
4596
|
-
|
|
4634
|
+
log17.warn("Notarization timeout", {
|
|
4597
4635
|
timeout,
|
|
4598
4636
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
4599
4637
|
}, {
|
|
4600
|
-
F:
|
|
4638
|
+
F: __dxlog_file20,
|
|
4601
4639
|
L: 111,
|
|
4602
4640
|
S: this,
|
|
4603
4641
|
C: (f, a) => f(...a)
|
|
@@ -4617,10 +4655,10 @@ var NotarizationPlugin = class {
|
|
|
4617
4655
|
...this._extensions
|
|
4618
4656
|
].find((peer2) => !peersTried.has(peer2));
|
|
4619
4657
|
if (!peer) {
|
|
4620
|
-
|
|
4658
|
+
log17.info("Exhausted all peers to notarize with", {
|
|
4621
4659
|
retryIn: retryTimeout
|
|
4622
4660
|
}, {
|
|
4623
|
-
F:
|
|
4661
|
+
F: __dxlog_file20,
|
|
4624
4662
|
L: 136,
|
|
4625
4663
|
S: this,
|
|
4626
4664
|
C: (f, a) => f(...a)
|
|
@@ -4630,11 +4668,11 @@ var NotarizationPlugin = class {
|
|
|
4630
4668
|
return;
|
|
4631
4669
|
}
|
|
4632
4670
|
peersTried.add(peer);
|
|
4633
|
-
|
|
4671
|
+
log17("try notarizing", {
|
|
4634
4672
|
peer: peer.localPeerId,
|
|
4635
4673
|
credentialId: credentials.map((credential) => credential.id)
|
|
4636
4674
|
}, {
|
|
4637
|
-
F:
|
|
4675
|
+
F: __dxlog_file20,
|
|
4638
4676
|
L: 143,
|
|
4639
4677
|
S: this,
|
|
4640
4678
|
C: (f, a) => f(...a)
|
|
@@ -4642,8 +4680,8 @@ var NotarizationPlugin = class {
|
|
|
4642
4680
|
await peer.rpc.NotarizationService.notarize({
|
|
4643
4681
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4644
4682
|
});
|
|
4645
|
-
|
|
4646
|
-
F:
|
|
4683
|
+
log17("success", void 0, {
|
|
4684
|
+
F: __dxlog_file20,
|
|
4647
4685
|
L: 147,
|
|
4648
4686
|
S: this,
|
|
4649
4687
|
C: (f, a) => f(...a)
|
|
@@ -4651,8 +4689,8 @@ var NotarizationPlugin = class {
|
|
|
4651
4689
|
await sleep2(successDelay);
|
|
4652
4690
|
} catch (err) {
|
|
4653
4691
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4654
|
-
|
|
4655
|
-
F:
|
|
4692
|
+
log17.info("error notarizing (recoverable)", err, {
|
|
4693
|
+
F: __dxlog_file20,
|
|
4656
4694
|
L: 151,
|
|
4657
4695
|
S: this,
|
|
4658
4696
|
C: (f, a) => f(...a)
|
|
@@ -4669,8 +4707,8 @@ var NotarizationPlugin = class {
|
|
|
4669
4707
|
allNotarized,
|
|
4670
4708
|
errors.wait()
|
|
4671
4709
|
]);
|
|
4672
|
-
|
|
4673
|
-
F:
|
|
4710
|
+
log17("done", void 0, {
|
|
4711
|
+
F: __dxlog_file20,
|
|
4674
4712
|
L: 162,
|
|
4675
4713
|
S: this,
|
|
4676
4714
|
C: (f, a) => f(...a)
|
|
@@ -4692,7 +4730,7 @@ var NotarizationPlugin = class {
|
|
|
4692
4730
|
}
|
|
4693
4731
|
setWriter(writer) {
|
|
4694
4732
|
invariant14(!this._writer, "Writer already set.", {
|
|
4695
|
-
F:
|
|
4733
|
+
F: __dxlog_file20,
|
|
4696
4734
|
L: 181,
|
|
4697
4735
|
S: this,
|
|
4698
4736
|
A: [
|
|
@@ -4717,7 +4755,7 @@ var NotarizationPlugin = class {
|
|
|
4717
4755
|
}
|
|
4718
4756
|
for (const credential of request.credentials ?? []) {
|
|
4719
4757
|
invariant14(credential.id, "Credential must have an id", {
|
|
4720
|
-
F:
|
|
4758
|
+
F: __dxlog_file20,
|
|
4721
4759
|
L: 200,
|
|
4722
4760
|
S: this,
|
|
4723
4761
|
A: [
|
|
@@ -4734,10 +4772,10 @@ var NotarizationPlugin = class {
|
|
|
4734
4772
|
createExtension() {
|
|
4735
4773
|
const extension = new NotarizationTeleportExtension({
|
|
4736
4774
|
onOpen: async () => {
|
|
4737
|
-
|
|
4775
|
+
log17("extension opened", {
|
|
4738
4776
|
peer: extension.localPeerId
|
|
4739
4777
|
}, {
|
|
4740
|
-
F:
|
|
4778
|
+
F: __dxlog_file20,
|
|
4741
4779
|
L: 211,
|
|
4742
4780
|
S: this,
|
|
4743
4781
|
C: (f, a) => f(...a)
|
|
@@ -4746,10 +4784,10 @@ var NotarizationPlugin = class {
|
|
|
4746
4784
|
this._extensionOpened.emit();
|
|
4747
4785
|
},
|
|
4748
4786
|
onClose: async () => {
|
|
4749
|
-
|
|
4787
|
+
log17("extension closed", {
|
|
4750
4788
|
peer: extension.localPeerId
|
|
4751
4789
|
}, {
|
|
4752
|
-
F:
|
|
4790
|
+
F: __dxlog_file20,
|
|
4753
4791
|
L: 216,
|
|
4754
4792
|
S: this,
|
|
4755
4793
|
C: (f, a) => f(...a)
|
|
@@ -4866,11 +4904,11 @@ function _using_ctx2() {
|
|
|
4866
4904
|
}
|
|
4867
4905
|
};
|
|
4868
4906
|
}
|
|
4869
|
-
var
|
|
4907
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4870
4908
|
var DataSpace = class {
|
|
4871
4909
|
constructor(params) {
|
|
4872
4910
|
this._ctx = new Context8(void 0, {
|
|
4873
|
-
F:
|
|
4911
|
+
F: __dxlog_file21,
|
|
4874
4912
|
L: 89
|
|
4875
4913
|
});
|
|
4876
4914
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
@@ -4915,10 +4953,10 @@ var DataSpace = class {
|
|
|
4915
4953
|
});
|
|
4916
4954
|
}
|
|
4917
4955
|
this._state = params.initialState;
|
|
4918
|
-
|
|
4956
|
+
log18("new state", {
|
|
4919
4957
|
state: SpaceState2[this._state]
|
|
4920
4958
|
}, {
|
|
4921
|
-
F:
|
|
4959
|
+
F: __dxlog_file21,
|
|
4922
4960
|
L: 159,
|
|
4923
4961
|
S: this,
|
|
4924
4962
|
C: (f, a) => f(...a)
|
|
@@ -4977,15 +5015,15 @@ var DataSpace = class {
|
|
|
4977
5015
|
this.inner.protocol.feedAdded.append(this._onFeedAdded);
|
|
4978
5016
|
}
|
|
4979
5017
|
await this._inner.open(new Context8(void 0, {
|
|
4980
|
-
F:
|
|
5018
|
+
F: __dxlog_file21,
|
|
4981
5019
|
L: 233
|
|
4982
5020
|
}));
|
|
4983
5021
|
await this._edgeFeedReplicator?.open();
|
|
4984
5022
|
this._state = SpaceState2.SPACE_CONTROL_ONLY;
|
|
4985
|
-
|
|
5023
|
+
log18("new state", {
|
|
4986
5024
|
state: SpaceState2[this._state]
|
|
4987
5025
|
}, {
|
|
4988
|
-
F:
|
|
5026
|
+
F: __dxlog_file21,
|
|
4989
5027
|
L: 238,
|
|
4990
5028
|
S: this,
|
|
4991
5029
|
C: (f, a) => f(...a)
|
|
@@ -5002,17 +5040,17 @@ var DataSpace = class {
|
|
|
5002
5040
|
await this._callbacks.beforeClose?.();
|
|
5003
5041
|
await this.preClose.callSerial();
|
|
5004
5042
|
this._state = SpaceState2.SPACE_CLOSED;
|
|
5005
|
-
|
|
5043
|
+
log18("new state", {
|
|
5006
5044
|
state: SpaceState2[this._state]
|
|
5007
5045
|
}, {
|
|
5008
|
-
F:
|
|
5046
|
+
F: __dxlog_file21,
|
|
5009
5047
|
L: 257,
|
|
5010
5048
|
S: this,
|
|
5011
5049
|
C: (f, a) => f(...a)
|
|
5012
5050
|
});
|
|
5013
5051
|
await this._ctx.dispose();
|
|
5014
5052
|
this._ctx = new Context8(void 0, {
|
|
5015
|
-
F:
|
|
5053
|
+
F: __dxlog_file21,
|
|
5016
5054
|
L: 259
|
|
5017
5055
|
});
|
|
5018
5056
|
if (this._edgeFeedReplicator) {
|
|
@@ -5044,25 +5082,25 @@ var DataSpace = class {
|
|
|
5044
5082
|
await this.initializeDataPipeline();
|
|
5045
5083
|
} catch (err) {
|
|
5046
5084
|
if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
|
|
5047
|
-
|
|
5048
|
-
F:
|
|
5085
|
+
log18("data pipeline initialization cancelled", err, {
|
|
5086
|
+
F: __dxlog_file21,
|
|
5049
5087
|
L: 297,
|
|
5050
5088
|
S: this,
|
|
5051
5089
|
C: (f, a) => f(...a)
|
|
5052
5090
|
});
|
|
5053
5091
|
return;
|
|
5054
5092
|
}
|
|
5055
|
-
|
|
5056
|
-
F:
|
|
5093
|
+
log18.error("Error initializing data pipeline", err, {
|
|
5094
|
+
F: __dxlog_file21,
|
|
5057
5095
|
L: 301,
|
|
5058
5096
|
S: this,
|
|
5059
5097
|
C: (f, a) => f(...a)
|
|
5060
5098
|
});
|
|
5061
5099
|
this._state = SpaceState2.SPACE_ERROR;
|
|
5062
|
-
|
|
5100
|
+
log18("new state", {
|
|
5063
5101
|
state: SpaceState2[this._state]
|
|
5064
5102
|
}, {
|
|
5065
|
-
F:
|
|
5103
|
+
F: __dxlog_file21,
|
|
5066
5104
|
L: 303,
|
|
5067
5105
|
S: this,
|
|
5068
5106
|
C: (f, a) => f(...a)
|
|
@@ -5079,10 +5117,10 @@ var DataSpace = class {
|
|
|
5079
5117
|
throw new SystemError("Invalid operation");
|
|
5080
5118
|
}
|
|
5081
5119
|
this._state = SpaceState2.SPACE_INITIALIZING;
|
|
5082
|
-
|
|
5120
|
+
log18("new state", {
|
|
5083
5121
|
state: SpaceState2[this._state]
|
|
5084
5122
|
}, {
|
|
5085
|
-
F:
|
|
5123
|
+
F: __dxlog_file21,
|
|
5086
5124
|
L: 319,
|
|
5087
5125
|
S: this,
|
|
5088
5126
|
C: (f, a) => f(...a)
|
|
@@ -5096,10 +5134,10 @@ var DataSpace = class {
|
|
|
5096
5134
|
async _enterReadyState() {
|
|
5097
5135
|
await this._callbacks.beforeReady?.();
|
|
5098
5136
|
this._state = SpaceState2.SPACE_READY;
|
|
5099
|
-
|
|
5137
|
+
log18("new state", {
|
|
5100
5138
|
state: SpaceState2[this._state]
|
|
5101
5139
|
}, {
|
|
5102
|
-
F:
|
|
5140
|
+
F: __dxlog_file21,
|
|
5103
5141
|
L: 338,
|
|
5104
5142
|
S: this,
|
|
5105
5143
|
C: (f, a) => f(...a)
|
|
@@ -5114,8 +5152,8 @@ var DataSpace = class {
|
|
|
5114
5152
|
});
|
|
5115
5153
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
5116
5154
|
await this._createWritableFeeds();
|
|
5117
|
-
|
|
5118
|
-
F:
|
|
5155
|
+
log18("writable feeds created", void 0, {
|
|
5156
|
+
F: __dxlog_file21,
|
|
5119
5157
|
L: 354,
|
|
5120
5158
|
S: this,
|
|
5121
5159
|
C: (f, a) => f(...a)
|
|
@@ -5174,11 +5212,11 @@ var DataSpace = class {
|
|
|
5174
5212
|
}
|
|
5175
5213
|
}
|
|
5176
5214
|
_onNewAutomergeRoot(rootUrl) {
|
|
5177
|
-
|
|
5215
|
+
log18("loading automerge root doc for space", {
|
|
5178
5216
|
space: this.key,
|
|
5179
5217
|
rootUrl
|
|
5180
5218
|
}, {
|
|
5181
|
-
F:
|
|
5219
|
+
F: __dxlog_file21,
|
|
5182
5220
|
L: 420,
|
|
5183
5221
|
S: this,
|
|
5184
5222
|
C: (f, a) => f(...a)
|
|
@@ -5225,12 +5263,12 @@ var DataSpace = class {
|
|
|
5225
5263
|
if (err instanceof ContextDisposedError3) {
|
|
5226
5264
|
return;
|
|
5227
5265
|
}
|
|
5228
|
-
|
|
5266
|
+
log18.warn("error loading automerge root doc", {
|
|
5229
5267
|
space: this.key,
|
|
5230
5268
|
rootUrl,
|
|
5231
5269
|
err
|
|
5232
5270
|
}, {
|
|
5233
|
-
F:
|
|
5271
|
+
F: __dxlog_file21,
|
|
5234
5272
|
L: 463,
|
|
5235
5273
|
S: this,
|
|
5236
5274
|
C: (f, a) => f(...a)
|
|
@@ -5317,10 +5355,10 @@ var DataSpace = class {
|
|
|
5317
5355
|
await this._close();
|
|
5318
5356
|
}
|
|
5319
5357
|
this._state = SpaceState2.SPACE_INACTIVE;
|
|
5320
|
-
|
|
5358
|
+
log18("new state", {
|
|
5321
5359
|
state: SpaceState2[this._state]
|
|
5322
5360
|
}, {
|
|
5323
|
-
F:
|
|
5361
|
+
F: __dxlog_file21,
|
|
5324
5362
|
L: 545,
|
|
5325
5363
|
S: this,
|
|
5326
5364
|
C: (f, a) => f(...a)
|
|
@@ -5389,7 +5427,7 @@ import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference }
|
|
|
5389
5427
|
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
5390
5428
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
5391
5429
|
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
5392
|
-
import { log as
|
|
5430
|
+
import { log as log19 } from "@dxos/log";
|
|
5393
5431
|
import { AlreadyJoinedError as AlreadyJoinedError3, trace as Trace2 } from "@dxos/protocols";
|
|
5394
5432
|
import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5395
5433
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
@@ -5478,7 +5516,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5478
5516
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5479
5517
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5480
5518
|
}
|
|
5481
|
-
var
|
|
5519
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
5482
5520
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
5483
5521
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
5484
5522
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -5533,45 +5571,45 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5533
5571
|
return this._spaces;
|
|
5534
5572
|
}
|
|
5535
5573
|
async _open() {
|
|
5536
|
-
|
|
5537
|
-
F:
|
|
5574
|
+
log19("open", void 0, {
|
|
5575
|
+
F: __dxlog_file22,
|
|
5538
5576
|
L: 192,
|
|
5539
5577
|
S: this,
|
|
5540
5578
|
C: (f, a) => f(...a)
|
|
5541
5579
|
});
|
|
5542
|
-
|
|
5580
|
+
log19.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
5543
5581
|
id: this._instanceId
|
|
5544
5582
|
}), {
|
|
5545
|
-
F:
|
|
5583
|
+
F: __dxlog_file22,
|
|
5546
5584
|
L: 193,
|
|
5547
5585
|
S: this,
|
|
5548
5586
|
C: (f, a) => f(...a)
|
|
5549
5587
|
});
|
|
5550
|
-
|
|
5588
|
+
log19("metadata loaded", {
|
|
5551
5589
|
spaces: this._metadataStore.spaces.length
|
|
5552
5590
|
}, {
|
|
5553
|
-
F:
|
|
5591
|
+
F: __dxlog_file22,
|
|
5554
5592
|
L: 194,
|
|
5555
5593
|
S: this,
|
|
5556
5594
|
C: (f, a) => f(...a)
|
|
5557
5595
|
});
|
|
5558
5596
|
await forEachAsync(this._metadataStore.spaces, async (spaceMetadata) => {
|
|
5559
5597
|
try {
|
|
5560
|
-
|
|
5598
|
+
log19("load space", {
|
|
5561
5599
|
spaceMetadata
|
|
5562
5600
|
}, {
|
|
5563
|
-
F:
|
|
5601
|
+
F: __dxlog_file22,
|
|
5564
5602
|
L: 198,
|
|
5565
5603
|
S: this,
|
|
5566
5604
|
C: (f, a) => f(...a)
|
|
5567
5605
|
});
|
|
5568
5606
|
await this._constructSpace(spaceMetadata);
|
|
5569
5607
|
} catch (err) {
|
|
5570
|
-
|
|
5608
|
+
log19.error("Error loading space", {
|
|
5571
5609
|
spaceMetadata,
|
|
5572
5610
|
err
|
|
5573
5611
|
}, {
|
|
5574
|
-
F:
|
|
5612
|
+
F: __dxlog_file22,
|
|
5575
5613
|
L: 201,
|
|
5576
5614
|
S: this,
|
|
5577
5615
|
C: (f, a) => f(...a)
|
|
@@ -5579,18 +5617,18 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5579
5617
|
}
|
|
5580
5618
|
});
|
|
5581
5619
|
this.updated.emit();
|
|
5582
|
-
|
|
5620
|
+
log19.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
5583
5621
|
id: this._instanceId
|
|
5584
5622
|
}), {
|
|
5585
|
-
F:
|
|
5623
|
+
F: __dxlog_file22,
|
|
5586
5624
|
L: 207,
|
|
5587
5625
|
S: this,
|
|
5588
5626
|
C: (f, a) => f(...a)
|
|
5589
5627
|
});
|
|
5590
5628
|
}
|
|
5591
5629
|
async _close() {
|
|
5592
|
-
|
|
5593
|
-
F:
|
|
5630
|
+
log19("close", void 0, {
|
|
5631
|
+
F: __dxlog_file22,
|
|
5594
5632
|
L: 212,
|
|
5595
5633
|
S: this,
|
|
5596
5634
|
C: (f, a) => f(...a)
|
|
@@ -5605,7 +5643,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5605
5643
|
*/
|
|
5606
5644
|
async createSpace() {
|
|
5607
5645
|
invariant15(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
5608
|
-
F:
|
|
5646
|
+
F: __dxlog_file22,
|
|
5609
5647
|
L: 224,
|
|
5610
5648
|
S: this,
|
|
5611
5649
|
A: [
|
|
@@ -5623,10 +5661,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5623
5661
|
dataFeedKey,
|
|
5624
5662
|
state: SpaceState3.SPACE_ACTIVE
|
|
5625
5663
|
};
|
|
5626
|
-
|
|
5664
|
+
log19("creating space...", {
|
|
5627
5665
|
spaceKey
|
|
5628
5666
|
}, {
|
|
5629
|
-
F:
|
|
5667
|
+
F: __dxlog_file22,
|
|
5630
5668
|
L: 236,
|
|
5631
5669
|
S: this,
|
|
5632
5670
|
C: (f, a) => f(...a)
|
|
@@ -5638,7 +5676,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5638
5676
|
await this._metadataStore.addSpace(metadata);
|
|
5639
5677
|
const memberCredential = credentials[1];
|
|
5640
5678
|
invariant15(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5641
|
-
F:
|
|
5679
|
+
F: __dxlog_file22,
|
|
5642
5680
|
L: 246,
|
|
5643
5681
|
S: this,
|
|
5644
5682
|
A: [
|
|
@@ -5666,11 +5704,11 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5666
5704
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5667
5705
|
}
|
|
5668
5706
|
default:
|
|
5669
|
-
|
|
5707
|
+
log19.warn("unknown space version", {
|
|
5670
5708
|
version: space.databaseRoot.getVersion(),
|
|
5671
5709
|
spaceId: space.id
|
|
5672
5710
|
}, {
|
|
5673
|
-
F:
|
|
5711
|
+
F: __dxlog_file22,
|
|
5674
5712
|
L: 271,
|
|
5675
5713
|
S: this,
|
|
5676
5714
|
C: (f, a) => f(...a)
|
|
@@ -5705,7 +5743,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5705
5743
|
async _getSpaceRootDocument(space) {
|
|
5706
5744
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5707
5745
|
invariant15(automergeIndex, void 0, {
|
|
5708
|
-
F:
|
|
5746
|
+
F: __dxlog_file22,
|
|
5709
5747
|
L: 304,
|
|
5710
5748
|
S: this,
|
|
5711
5749
|
A: [
|
|
@@ -5719,16 +5757,16 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5719
5757
|
}
|
|
5720
5758
|
// TODO(burdon): Rename join space.
|
|
5721
5759
|
async acceptSpace(opts) {
|
|
5722
|
-
|
|
5760
|
+
log19("accept space", {
|
|
5723
5761
|
opts
|
|
5724
5762
|
}, {
|
|
5725
|
-
F:
|
|
5763
|
+
F: __dxlog_file22,
|
|
5726
5764
|
L: 313,
|
|
5727
5765
|
S: this,
|
|
5728
5766
|
C: (f, a) => f(...a)
|
|
5729
5767
|
});
|
|
5730
5768
|
invariant15(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
5731
|
-
F:
|
|
5769
|
+
F: __dxlog_file22,
|
|
5732
5770
|
L: 314,
|
|
5733
5771
|
S: this,
|
|
5734
5772
|
A: [
|
|
@@ -5737,7 +5775,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5737
5775
|
]
|
|
5738
5776
|
});
|
|
5739
5777
|
invariant15(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5740
|
-
F:
|
|
5778
|
+
F: __dxlog_file22,
|
|
5741
5779
|
L: 315,
|
|
5742
5780
|
S: this,
|
|
5743
5781
|
A: [
|
|
@@ -5761,7 +5799,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5761
5799
|
async admitMember(options) {
|
|
5762
5800
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5763
5801
|
invariant15(space, void 0, {
|
|
5764
|
-
F:
|
|
5802
|
+
F: __dxlog_file22,
|
|
5765
5803
|
L: 335,
|
|
5766
5804
|
S: this,
|
|
5767
5805
|
A: [
|
|
@@ -5774,7 +5812,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5774
5812
|
}
|
|
5775
5813
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5776
5814
|
invariant15(credentials[0].credential, void 0, {
|
|
5777
|
-
F:
|
|
5815
|
+
F: __dxlog_file22,
|
|
5778
5816
|
L: 354,
|
|
5779
5817
|
S: this,
|
|
5780
5818
|
A: [
|
|
@@ -5784,7 +5822,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5784
5822
|
});
|
|
5785
5823
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5786
5824
|
invariant15(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5787
|
-
F:
|
|
5825
|
+
F: __dxlog_file22,
|
|
5788
5826
|
L: 356,
|
|
5789
5827
|
S: this,
|
|
5790
5828
|
A: [
|
|
@@ -5820,10 +5858,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5820
5858
|
});
|
|
5821
5859
|
}
|
|
5822
5860
|
async _constructSpace(metadata) {
|
|
5823
|
-
|
|
5861
|
+
log19("construct space", {
|
|
5824
5862
|
metadata
|
|
5825
5863
|
}, {
|
|
5826
|
-
F:
|
|
5864
|
+
F: __dxlog_file22,
|
|
5827
5865
|
L: 392,
|
|
5828
5866
|
S: this,
|
|
5829
5867
|
C: (f, a) => f(...a)
|
|
@@ -5864,10 +5902,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5864
5902
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
5865
5903
|
await this._connectEchoMeshReplicator(space, session);
|
|
5866
5904
|
} catch (err) {
|
|
5867
|
-
|
|
5905
|
+
log19.warn("error on authorized connection", {
|
|
5868
5906
|
err
|
|
5869
5907
|
}, {
|
|
5870
|
-
F:
|
|
5908
|
+
F: __dxlog_file22,
|
|
5871
5909
|
L: 434,
|
|
5872
5910
|
S: this,
|
|
5873
5911
|
C: (f, a) => f(...a)
|
|
@@ -5876,8 +5914,8 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5876
5914
|
}
|
|
5877
5915
|
}),
|
|
5878
5916
|
onAuthFailure: () => {
|
|
5879
|
-
|
|
5880
|
-
F:
|
|
5917
|
+
log19.warn("auth failure", void 0, {
|
|
5918
|
+
F: __dxlog_file22,
|
|
5881
5919
|
L: 439,
|
|
5882
5920
|
S: this,
|
|
5883
5921
|
C: (f, a) => f(...a)
|
|
@@ -5907,21 +5945,21 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5907
5945
|
signingContext: this._signingContext,
|
|
5908
5946
|
callbacks: {
|
|
5909
5947
|
beforeReady: async () => {
|
|
5910
|
-
|
|
5948
|
+
log19("before space ready", {
|
|
5911
5949
|
space: space.key
|
|
5912
5950
|
}, {
|
|
5913
|
-
F:
|
|
5951
|
+
F: __dxlog_file22,
|
|
5914
5952
|
L: 466,
|
|
5915
5953
|
S: this,
|
|
5916
5954
|
C: (f, a) => f(...a)
|
|
5917
5955
|
});
|
|
5918
5956
|
},
|
|
5919
5957
|
afterReady: async () => {
|
|
5920
|
-
|
|
5958
|
+
log19("after space ready", {
|
|
5921
5959
|
space: space.key,
|
|
5922
5960
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
5923
5961
|
}, {
|
|
5924
|
-
F:
|
|
5962
|
+
F: __dxlog_file22,
|
|
5925
5963
|
L: 469,
|
|
5926
5964
|
S: this,
|
|
5927
5965
|
C: (f, a) => f(...a)
|
|
@@ -5937,10 +5975,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5937
5975
|
}
|
|
5938
5976
|
},
|
|
5939
5977
|
beforeClose: async () => {
|
|
5940
|
-
|
|
5978
|
+
log19("before space close", {
|
|
5941
5979
|
space: space.key
|
|
5942
5980
|
}, {
|
|
5943
|
-
F:
|
|
5981
|
+
F: __dxlog_file22,
|
|
5944
5982
|
L: 477,
|
|
5945
5983
|
S: this,
|
|
5946
5984
|
C: (f, a) => f(...a)
|
|
@@ -5971,10 +6009,10 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5971
6009
|
async _connectEchoMeshReplicator(space, session) {
|
|
5972
6010
|
const replicator = this._meshReplicator;
|
|
5973
6011
|
if (!replicator) {
|
|
5974
|
-
|
|
6012
|
+
log19.warn("p2p automerge replication disabled", {
|
|
5975
6013
|
space: space.key
|
|
5976
6014
|
}, {
|
|
5977
|
-
F:
|
|
6015
|
+
F: __dxlog_file22,
|
|
5978
6016
|
L: 508,
|
|
5979
6017
|
S: this,
|
|
5980
6018
|
C: (f, a) => f(...a)
|
|
@@ -5998,16 +6036,16 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
5998
6036
|
return (s && member.role === SpaceMember6.Role.REMOVED !== (s.authStatus === AuthStatus.FAILURE)) ?? false;
|
|
5999
6037
|
});
|
|
6000
6038
|
sessionsToClose.forEach((session) => {
|
|
6001
|
-
void session.close().catch(
|
|
6039
|
+
void session.close().catch(log19.error);
|
|
6002
6040
|
});
|
|
6003
6041
|
closedSessions += sessionsToClose.length;
|
|
6004
6042
|
}
|
|
6005
|
-
|
|
6043
|
+
log19("processed member role changes", {
|
|
6006
6044
|
roleChangeCount: memberInfo.length,
|
|
6007
6045
|
peersOnline: presence.getPeersOnline().length,
|
|
6008
6046
|
closedSessions
|
|
6009
6047
|
}, {
|
|
6010
|
-
F:
|
|
6048
|
+
F: __dxlog_file22,
|
|
6011
6049
|
L: 534,
|
|
6012
6050
|
S: this,
|
|
6013
6051
|
C: (f, a) => f(...a)
|
|
@@ -6019,15 +6057,15 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
6019
6057
|
if (role === SpaceMember6.Role.REMOVED) {
|
|
6020
6058
|
const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
|
|
6021
6059
|
if (session != null) {
|
|
6022
|
-
|
|
6060
|
+
log19("closing a session with a removed peer", {
|
|
6023
6061
|
peerId: peerState.peerId
|
|
6024
6062
|
}, {
|
|
6025
|
-
F:
|
|
6063
|
+
F: __dxlog_file22,
|
|
6026
6064
|
L: 548,
|
|
6027
6065
|
S: this,
|
|
6028
6066
|
C: (f, a) => f(...a)
|
|
6029
6067
|
});
|
|
6030
|
-
void session.close().catch(
|
|
6068
|
+
void session.close().catch(log19.error);
|
|
6031
6069
|
}
|
|
6032
6070
|
}
|
|
6033
6071
|
}
|
|
@@ -6090,11 +6128,11 @@ import { createAdmissionCredentials as createAdmissionCredentials2, getCredentia
|
|
|
6090
6128
|
import { raise as raise2 } from "@dxos/debug";
|
|
6091
6129
|
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
6092
6130
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
6093
|
-
import { log as
|
|
6131
|
+
import { log as log20 } from "@dxos/log";
|
|
6094
6132
|
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
6095
6133
|
import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6096
6134
|
import { trace as trace8 } from "@dxos/tracing";
|
|
6097
|
-
var
|
|
6135
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
6098
6136
|
var SpacesServiceImpl = class {
|
|
6099
6137
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
6100
6138
|
this._identityManager = _identityManager;
|
|
@@ -6138,7 +6176,7 @@ var SpacesServiceImpl = class {
|
|
|
6138
6176
|
}
|
|
6139
6177
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
6140
6178
|
invariant16(credentials[0].credential, void 0, {
|
|
6141
|
-
F:
|
|
6179
|
+
F: __dxlog_file23,
|
|
6142
6180
|
L: 102,
|
|
6143
6181
|
S: this,
|
|
6144
6182
|
A: [
|
|
@@ -6148,7 +6186,7 @@ var SpacesServiceImpl = class {
|
|
|
6148
6186
|
});
|
|
6149
6187
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
6150
6188
|
invariant16(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
6151
|
-
F:
|
|
6189
|
+
F: __dxlog_file23,
|
|
6152
6190
|
L: 104,
|
|
6153
6191
|
S: this,
|
|
6154
6192
|
A: [
|
|
@@ -6163,10 +6201,10 @@ var SpacesServiceImpl = class {
|
|
|
6163
6201
|
const scheduler = new UpdateScheduler(ctx, async () => {
|
|
6164
6202
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
6165
6203
|
const spaces = Array.from(dataSpaceManager.spaces.values()).map((space) => this._serializeSpace(space));
|
|
6166
|
-
|
|
6204
|
+
log20("update", () => ({
|
|
6167
6205
|
ids: spaces.map((space) => space.id)
|
|
6168
6206
|
}), {
|
|
6169
|
-
F:
|
|
6207
|
+
F: __dxlog_file23,
|
|
6170
6208
|
L: 115,
|
|
6171
6209
|
S: this,
|
|
6172
6210
|
C: (f, a) => f(...a)
|
|
@@ -6258,7 +6296,7 @@ var SpacesServiceImpl = class {
|
|
|
6258
6296
|
});
|
|
6259
6297
|
} else {
|
|
6260
6298
|
invariant16(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
6261
|
-
F:
|
|
6299
|
+
F: __dxlog_file23,
|
|
6262
6300
|
L: 213,
|
|
6263
6301
|
S: this,
|
|
6264
6302
|
A: [
|
|
@@ -6267,7 +6305,7 @@ var SpacesServiceImpl = class {
|
|
|
6267
6305
|
]
|
|
6268
6306
|
});
|
|
6269
6307
|
invariant16(this._identityManager.identity, "Identity is not available", {
|
|
6270
|
-
F:
|
|
6308
|
+
F: __dxlog_file23,
|
|
6271
6309
|
L: 214,
|
|
6272
6310
|
S: this,
|
|
6273
6311
|
A: [
|
|
@@ -6277,7 +6315,7 @@ var SpacesServiceImpl = class {
|
|
|
6277
6315
|
});
|
|
6278
6316
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
6279
6317
|
invariant16(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
6280
|
-
F:
|
|
6318
|
+
F: __dxlog_file23,
|
|
6281
6319
|
L: 216,
|
|
6282
6320
|
S: this,
|
|
6283
6321
|
A: [
|
|
@@ -6327,7 +6365,7 @@ var SpacesServiceImpl = class {
|
|
|
6327
6365
|
async _joinByAdmission({ credential }) {
|
|
6328
6366
|
const assertion = getCredentialAssertion4(credential);
|
|
6329
6367
|
invariant16(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
6330
|
-
F:
|
|
6368
|
+
F: __dxlog_file23,
|
|
6331
6369
|
L: 250,
|
|
6332
6370
|
S: this,
|
|
6333
6371
|
A: [
|
|
@@ -6337,7 +6375,7 @@ var SpacesServiceImpl = class {
|
|
|
6337
6375
|
});
|
|
6338
6376
|
const myIdentity = this._identityManager.identity;
|
|
6339
6377
|
invariant16(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
6340
|
-
F:
|
|
6378
|
+
F: __dxlog_file23,
|
|
6341
6379
|
L: 252,
|
|
6342
6380
|
S: this,
|
|
6343
6381
|
A: [
|
|
@@ -6434,7 +6472,7 @@ import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
|
6434
6472
|
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6435
6473
|
import { Keyring } from "@dxos/keyring";
|
|
6436
6474
|
import { PublicKey as PublicKey13 } from "@dxos/keys";
|
|
6437
|
-
import { log as
|
|
6475
|
+
import { log as log21 } from "@dxos/log";
|
|
6438
6476
|
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace9 } from "@dxos/protocols";
|
|
6439
6477
|
import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6440
6478
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
@@ -6450,7 +6488,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
6450
6488
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6451
6489
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6452
6490
|
}
|
|
6453
|
-
var
|
|
6491
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
6454
6492
|
var ServiceContext = class extends Resource5 {
|
|
6455
6493
|
constructor(storage, level, networkManager, signalManager, _edgeConnection, _runtimeParams, _edgeFeatures) {
|
|
6456
6494
|
super();
|
|
@@ -6489,19 +6527,19 @@ var ServiceContext = class extends Resource5 {
|
|
|
6489
6527
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams, {
|
|
6490
6528
|
onIdentityConstruction: (identity) => {
|
|
6491
6529
|
if (this._edgeConnection) {
|
|
6492
|
-
|
|
6530
|
+
log21.info("Setting identity on edge connection", {
|
|
6493
6531
|
identity: identity.identityKey.toHex(),
|
|
6494
|
-
oldIdentity: this._edgeConnection.identityKey
|
|
6532
|
+
oldIdentity: this._edgeConnection.identityKey,
|
|
6495
6533
|
swarms: this.networkManager.topics
|
|
6496
6534
|
}, {
|
|
6497
|
-
F:
|
|
6535
|
+
F: __dxlog_file24,
|
|
6498
6536
|
L: 128,
|
|
6499
6537
|
S: this,
|
|
6500
6538
|
C: (f, a) => f(...a)
|
|
6501
6539
|
});
|
|
6502
6540
|
this._edgeConnection.setIdentity({
|
|
6503
|
-
|
|
6504
|
-
identityKey: identity.identityKey
|
|
6541
|
+
peerKey: identity.deviceKey.toHex(),
|
|
6542
|
+
identityKey: identity.identityKey.toHex()
|
|
6505
6543
|
});
|
|
6506
6544
|
this.networkManager.setPeerInfo({
|
|
6507
6545
|
identityKey: identity.identityKey.toHex(),
|
|
@@ -6528,16 +6566,16 @@ var ServiceContext = class extends Resource5 {
|
|
|
6528
6566
|
}
|
|
6529
6567
|
async _open(ctx) {
|
|
6530
6568
|
await this._checkStorageVersion();
|
|
6531
|
-
|
|
6532
|
-
F:
|
|
6569
|
+
log21("opening...", void 0, {
|
|
6570
|
+
F: __dxlog_file24,
|
|
6533
6571
|
L: 186,
|
|
6534
6572
|
S: this,
|
|
6535
6573
|
C: (f, a) => f(...a)
|
|
6536
6574
|
});
|
|
6537
|
-
|
|
6575
|
+
log21.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
6538
6576
|
id: this._instanceId
|
|
6539
6577
|
}), {
|
|
6540
|
-
F:
|
|
6578
|
+
F: __dxlog_file24,
|
|
6541
6579
|
L: 187,
|
|
6542
6580
|
S: this,
|
|
6543
6581
|
C: (f, a) => f(...a)
|
|
@@ -6559,32 +6597,32 @@ var ServiceContext = class extends Resource5 {
|
|
|
6559
6597
|
await this._initialize(ctx);
|
|
6560
6598
|
}
|
|
6561
6599
|
const loadedInvitations = await this.invitationsManager.loadPersistentInvitations();
|
|
6562
|
-
|
|
6600
|
+
log21("loaded persistent invitations", {
|
|
6563
6601
|
count: loadedInvitations.invitations?.length
|
|
6564
6602
|
}, {
|
|
6565
|
-
F:
|
|
6603
|
+
F: __dxlog_file24,
|
|
6566
6604
|
L: 210,
|
|
6567
6605
|
S: this,
|
|
6568
6606
|
C: (f, a) => f(...a)
|
|
6569
6607
|
});
|
|
6570
|
-
|
|
6608
|
+
log21.trace("dxos.sdk.service-context.open", trace9.end({
|
|
6571
6609
|
id: this._instanceId
|
|
6572
6610
|
}), {
|
|
6573
|
-
F:
|
|
6611
|
+
F: __dxlog_file24,
|
|
6574
6612
|
L: 212,
|
|
6575
6613
|
S: this,
|
|
6576
6614
|
C: (f, a) => f(...a)
|
|
6577
6615
|
});
|
|
6578
|
-
|
|
6579
|
-
F:
|
|
6616
|
+
log21("opened", void 0, {
|
|
6617
|
+
F: __dxlog_file24,
|
|
6580
6618
|
L: 213,
|
|
6581
6619
|
S: this,
|
|
6582
6620
|
C: (f, a) => f(...a)
|
|
6583
6621
|
});
|
|
6584
6622
|
}
|
|
6585
6623
|
async _close(ctx) {
|
|
6586
|
-
|
|
6587
|
-
F:
|
|
6624
|
+
log21("closing...", void 0, {
|
|
6625
|
+
F: __dxlog_file24,
|
|
6588
6626
|
L: 217,
|
|
6589
6627
|
S: this,
|
|
6590
6628
|
C: (f, a) => f(...a)
|
|
@@ -6601,8 +6639,8 @@ var ServiceContext = class extends Resource5 {
|
|
|
6601
6639
|
await this.networkManager.close();
|
|
6602
6640
|
await this.signalManager.close();
|
|
6603
6641
|
await this._edgeConnection?.close();
|
|
6604
|
-
|
|
6605
|
-
F:
|
|
6642
|
+
log21("closed", void 0, {
|
|
6643
|
+
F: __dxlog_file24,
|
|
6606
6644
|
L: 232,
|
|
6607
6645
|
S: this,
|
|
6608
6646
|
C: (f, a) => f(...a)
|
|
@@ -6611,7 +6649,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6611
6649
|
async createIdentity(params = {}) {
|
|
6612
6650
|
const identity = await this.identityManager.createIdentity(params);
|
|
6613
6651
|
await this._initialize(new Context9(void 0, {
|
|
6614
|
-
F:
|
|
6652
|
+
F: __dxlog_file24,
|
|
6615
6653
|
L: 237
|
|
6616
6654
|
}));
|
|
6617
6655
|
return identity;
|
|
@@ -6619,7 +6657,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6619
6657
|
getInvitationHandler(invitation) {
|
|
6620
6658
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
6621
6659
|
invariant17(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
6622
|
-
F:
|
|
6660
|
+
F: __dxlog_file24,
|
|
6623
6661
|
L: 243,
|
|
6624
6662
|
S: this,
|
|
6625
6663
|
A: [
|
|
@@ -6640,7 +6678,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6640
6678
|
async _acceptIdentity(params) {
|
|
6641
6679
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
6642
6680
|
await this._initialize(new Context9(void 0, {
|
|
6643
|
-
F:
|
|
6681
|
+
F: __dxlog_file24,
|
|
6644
6682
|
L: 259
|
|
6645
6683
|
}));
|
|
6646
6684
|
return identity;
|
|
@@ -6653,8 +6691,8 @@ var ServiceContext = class extends Resource5 {
|
|
|
6653
6691
|
}
|
|
6654
6692
|
// Called when identity is created.
|
|
6655
6693
|
async _initialize(ctx) {
|
|
6656
|
-
|
|
6657
|
-
F:
|
|
6694
|
+
log21("initializing spaces...", void 0, {
|
|
6695
|
+
F: __dxlog_file24,
|
|
6658
6696
|
L: 274,
|
|
6659
6697
|
S: this,
|
|
6660
6698
|
C: (f, a) => f(...a)
|
|
@@ -6690,7 +6728,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6690
6728
|
await this.dataSpaceManager.open();
|
|
6691
6729
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
6692
6730
|
invariant17(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
6693
|
-
F:
|
|
6731
|
+
F: __dxlog_file24,
|
|
6694
6732
|
L: 303,
|
|
6695
6733
|
S: this,
|
|
6696
6734
|
A: [
|
|
@@ -6711,10 +6749,10 @@ var ServiceContext = class extends Resource5 {
|
|
|
6711
6749
|
return;
|
|
6712
6750
|
}
|
|
6713
6751
|
if (!this.dataSpaceManager) {
|
|
6714
|
-
|
|
6752
|
+
log21("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
6715
6753
|
details: assertion
|
|
6716
6754
|
}, {
|
|
6717
|
-
F:
|
|
6755
|
+
F: __dxlog_file24,
|
|
6718
6756
|
L: 319,
|
|
6719
6757
|
S: this,
|
|
6720
6758
|
C: (f, a) => f(...a)
|
|
@@ -6722,10 +6760,10 @@ var ServiceContext = class extends Resource5 {
|
|
|
6722
6760
|
return;
|
|
6723
6761
|
}
|
|
6724
6762
|
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
6725
|
-
|
|
6763
|
+
log21("space already exists, ignoring space admission", {
|
|
6726
6764
|
details: assertion
|
|
6727
6765
|
}, {
|
|
6728
|
-
F:
|
|
6766
|
+
F: __dxlog_file24,
|
|
6729
6767
|
L: 323,
|
|
6730
6768
|
S: this,
|
|
6731
6769
|
C: (f, a) => f(...a)
|
|
@@ -6733,10 +6771,10 @@ var ServiceContext = class extends Resource5 {
|
|
|
6733
6771
|
return;
|
|
6734
6772
|
}
|
|
6735
6773
|
try {
|
|
6736
|
-
|
|
6774
|
+
log21("accepting space recorded in halo", {
|
|
6737
6775
|
details: assertion
|
|
6738
6776
|
}, {
|
|
6739
|
-
F:
|
|
6777
|
+
F: __dxlog_file24,
|
|
6740
6778
|
L: 328,
|
|
6741
6779
|
S: this,
|
|
6742
6780
|
C: (f, a) => f(...a)
|
|
@@ -6746,8 +6784,8 @@ var ServiceContext = class extends Resource5 {
|
|
|
6746
6784
|
genesisFeedKey: assertion.genesisFeedKey
|
|
6747
6785
|
});
|
|
6748
6786
|
} catch (err) {
|
|
6749
|
-
|
|
6750
|
-
F:
|
|
6787
|
+
log21.catch(err, void 0, {
|
|
6788
|
+
F: __dxlog_file24,
|
|
6751
6789
|
L: 334,
|
|
6752
6790
|
S: this,
|
|
6753
6791
|
C: (f, a) => f(...a)
|
|
@@ -6870,10 +6908,10 @@ var createLevel = async (config) => {
|
|
|
6870
6908
|
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
6871
6909
|
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
6872
6910
|
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6873
|
-
import { log as
|
|
6911
|
+
import { log as log22 } from "@dxos/log";
|
|
6874
6912
|
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
6875
6913
|
import { arrayToBuffer as arrayToBuffer2 } from "@dxos/util";
|
|
6876
|
-
var
|
|
6914
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6877
6915
|
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
6878
6916
|
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
6879
6917
|
var exportProfileData = async ({ storage, level }) => {
|
|
@@ -6886,10 +6924,10 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6886
6924
|
{
|
|
6887
6925
|
const directory = await storage.createDirectory();
|
|
6888
6926
|
const files = await directory.list();
|
|
6889
|
-
|
|
6927
|
+
log22.info("begin exporting files", {
|
|
6890
6928
|
count: files.length
|
|
6891
6929
|
}, {
|
|
6892
|
-
F:
|
|
6930
|
+
F: __dxlog_file25,
|
|
6893
6931
|
L: 30,
|
|
6894
6932
|
S: void 0,
|
|
6895
6933
|
C: (f, a) => f(...a)
|
|
@@ -6904,18 +6942,18 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6904
6942
|
value: data
|
|
6905
6943
|
});
|
|
6906
6944
|
}
|
|
6907
|
-
|
|
6945
|
+
log22.info("done exporting files", {
|
|
6908
6946
|
count: files.length
|
|
6909
6947
|
}, {
|
|
6910
|
-
F:
|
|
6948
|
+
F: __dxlog_file25,
|
|
6911
6949
|
L: 41,
|
|
6912
6950
|
S: void 0,
|
|
6913
6951
|
C: (f, a) => f(...a)
|
|
6914
6952
|
});
|
|
6915
6953
|
}
|
|
6916
6954
|
{
|
|
6917
|
-
|
|
6918
|
-
F:
|
|
6955
|
+
log22.info("begin exporting kv pairs", void 0, {
|
|
6956
|
+
F: __dxlog_file25,
|
|
6919
6957
|
L: 45,
|
|
6920
6958
|
S: void 0,
|
|
6921
6959
|
C: (f, a) => f(...a)
|
|
@@ -6933,10 +6971,10 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6933
6971
|
});
|
|
6934
6972
|
count++;
|
|
6935
6973
|
}
|
|
6936
|
-
|
|
6974
|
+
log22.info("done exporting kv pairs", {
|
|
6937
6975
|
count
|
|
6938
6976
|
}, {
|
|
6939
|
-
F:
|
|
6977
|
+
F: __dxlog_file25,
|
|
6940
6978
|
L: 56,
|
|
6941
6979
|
S: void 0,
|
|
6942
6980
|
C: (f, a) => f(...a)
|
|
@@ -6952,7 +6990,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6952
6990
|
case ProfileArchiveEntryType.FILE: {
|
|
6953
6991
|
const directory = await storage.createDirectory();
|
|
6954
6992
|
invariant18(typeof entry2.key === "string", "Invalid key type", {
|
|
6955
|
-
F:
|
|
6993
|
+
F: __dxlog_file25,
|
|
6956
6994
|
L: 79,
|
|
6957
6995
|
S: void 0,
|
|
6958
6996
|
A: [
|
|
@@ -6962,7 +7000,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6962
7000
|
});
|
|
6963
7001
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
6964
7002
|
invariant18(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6965
|
-
F:
|
|
7003
|
+
F: __dxlog_file25,
|
|
6966
7004
|
L: 81,
|
|
6967
7005
|
S: void 0,
|
|
6968
7006
|
A: [
|
|
@@ -6976,7 +7014,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6976
7014
|
}
|
|
6977
7015
|
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
6978
7016
|
invariant18(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6979
|
-
F:
|
|
7017
|
+
F: __dxlog_file25,
|
|
6980
7018
|
L: 87,
|
|
6981
7019
|
S: void 0,
|
|
6982
7020
|
A: [
|
|
@@ -6985,7 +7023,7 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6985
7023
|
]
|
|
6986
7024
|
});
|
|
6987
7025
|
invariant18(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6988
|
-
F:
|
|
7026
|
+
F: __dxlog_file25,
|
|
6989
7027
|
L: 88,
|
|
6990
7028
|
S: void 0,
|
|
6991
7029
|
A: [
|
|
@@ -7005,20 +7043,20 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
7005
7043
|
if (++count % 1e3 === 0) {
|
|
7006
7044
|
await batch.write();
|
|
7007
7045
|
batch = level.batch();
|
|
7008
|
-
|
|
7046
|
+
log22.info("importing", {
|
|
7009
7047
|
count,
|
|
7010
7048
|
total: archive.storage.length,
|
|
7011
7049
|
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
7012
7050
|
}, {
|
|
7013
|
-
F:
|
|
7051
|
+
F: __dxlog_file25,
|
|
7014
7052
|
L: 101,
|
|
7015
7053
|
S: void 0,
|
|
7016
7054
|
C: (f, a) => f(...a)
|
|
7017
7055
|
});
|
|
7018
7056
|
}
|
|
7019
7057
|
}
|
|
7020
|
-
|
|
7021
|
-
F:
|
|
7058
|
+
log22.info("committing changes..", void 0, {
|
|
7059
|
+
F: __dxlog_file25,
|
|
7022
7060
|
L: 109,
|
|
7023
7061
|
S: void 0,
|
|
7024
7062
|
C: (f, a) => f(...a)
|
|
@@ -7033,7 +7071,7 @@ import { Context as Context10 } from "@dxos/context";
|
|
|
7033
7071
|
import { EdgeClient } from "@dxos/edge-client";
|
|
7034
7072
|
import { invariant as invariant20 } from "@dxos/invariant";
|
|
7035
7073
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
7036
|
-
import { log as
|
|
7074
|
+
import { log as log24 } from "@dxos/log";
|
|
7037
7075
|
import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
|
|
7038
7076
|
import { SwarmNetworkManager, createIceProvider, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
7039
7077
|
import { trace as trace10 } from "@dxos/protocols";
|
|
@@ -7046,7 +7084,7 @@ import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
|
7046
7084
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
7047
7085
|
import { invariant as invariant19 } from "@dxos/invariant";
|
|
7048
7086
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7049
|
-
var
|
|
7087
|
+
var __dxlog_file26 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
7050
7088
|
var DevicesServiceImpl = class {
|
|
7051
7089
|
constructor(_identityManager) {
|
|
7052
7090
|
this._identityManager = _identityManager;
|
|
@@ -7064,7 +7102,7 @@ var DevicesServiceImpl = class {
|
|
|
7064
7102
|
});
|
|
7065
7103
|
} else {
|
|
7066
7104
|
invariant19(this._identityManager.identity?.presence, "presence not present", {
|
|
7067
|
-
F:
|
|
7105
|
+
F: __dxlog_file26,
|
|
7068
7106
|
L: 32,
|
|
7069
7107
|
S: this,
|
|
7070
7108
|
A: [
|
|
@@ -7210,7 +7248,7 @@ var ContactsServiceImpl = class {
|
|
|
7210
7248
|
import { Event as Event9 } from "@dxos/async";
|
|
7211
7249
|
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
7212
7250
|
import { PublicKey as PublicKey16 } from "@dxos/keys";
|
|
7213
|
-
import { getContextFromEntry, log as
|
|
7251
|
+
import { getContextFromEntry, log as log23 } from "@dxos/log";
|
|
7214
7252
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
7215
7253
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
7216
7254
|
var LoggingServiceImpl = class {
|
|
@@ -7223,11 +7261,11 @@ var LoggingServiceImpl = class {
|
|
|
7223
7261
|
};
|
|
7224
7262
|
}
|
|
7225
7263
|
async open() {
|
|
7226
|
-
|
|
7264
|
+
log23.runtimeConfig.processors.push(this._logProcessor);
|
|
7227
7265
|
}
|
|
7228
7266
|
async close() {
|
|
7229
|
-
const index =
|
|
7230
|
-
|
|
7267
|
+
const index = log23.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
7268
|
+
log23.runtimeConfig.processors.splice(index, 1);
|
|
7231
7269
|
}
|
|
7232
7270
|
async controlMetrics({ reset, record }) {
|
|
7233
7271
|
if (reset) {
|
|
@@ -7431,7 +7469,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
7431
7469
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7432
7470
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7433
7471
|
}
|
|
7434
|
-
var
|
|
7472
|
+
var __dxlog_file27 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
7435
7473
|
var ClientServicesHost = class {
|
|
7436
7474
|
constructor({
|
|
7437
7475
|
config,
|
|
@@ -7469,7 +7507,7 @@ var ClientServicesHost = class {
|
|
|
7469
7507
|
onAcquire: () => {
|
|
7470
7508
|
if (!this._opening) {
|
|
7471
7509
|
void this.open(new Context10(void 0, {
|
|
7472
|
-
F:
|
|
7510
|
+
F: __dxlog_file27,
|
|
7473
7511
|
L: 132
|
|
7474
7512
|
}));
|
|
7475
7513
|
}
|
|
@@ -7527,7 +7565,7 @@ var ClientServicesHost = class {
|
|
|
7527
7565
|
*/
|
|
7528
7566
|
initialize({ config, ...options }) {
|
|
7529
7567
|
invariant20(!this._open, "service host is open", {
|
|
7530
|
-
F:
|
|
7568
|
+
F: __dxlog_file27,
|
|
7531
7569
|
L: 198,
|
|
7532
7570
|
S: this,
|
|
7533
7571
|
A: [
|
|
@@ -7535,15 +7573,15 @@ var ClientServicesHost = class {
|
|
|
7535
7573
|
"'service host is open'"
|
|
7536
7574
|
]
|
|
7537
7575
|
});
|
|
7538
|
-
|
|
7539
|
-
F:
|
|
7576
|
+
log24("initializing...", void 0, {
|
|
7577
|
+
F: __dxlog_file27,
|
|
7540
7578
|
L: 199,
|
|
7541
7579
|
S: this,
|
|
7542
7580
|
C: (f, a) => f(...a)
|
|
7543
7581
|
});
|
|
7544
7582
|
if (config) {
|
|
7545
7583
|
invariant20(!this._config, "config already set", {
|
|
7546
|
-
F:
|
|
7584
|
+
F: __dxlog_file27,
|
|
7547
7585
|
L: 202,
|
|
7548
7586
|
S: this,
|
|
7549
7587
|
A: [
|
|
@@ -7557,8 +7595,8 @@ var ClientServicesHost = class {
|
|
|
7557
7595
|
}
|
|
7558
7596
|
}
|
|
7559
7597
|
if (!options.signalManager) {
|
|
7560
|
-
|
|
7561
|
-
F:
|
|
7598
|
+
log24.warn("running signaling without telemetry metadata.", void 0, {
|
|
7599
|
+
F: __dxlog_file27,
|
|
7562
7600
|
L: 210,
|
|
7563
7601
|
S: this,
|
|
7564
7602
|
C: (f, a) => f(...a)
|
|
@@ -7566,7 +7604,8 @@ var ClientServicesHost = class {
|
|
|
7566
7604
|
}
|
|
7567
7605
|
const edgeEndpoint = config?.get("runtime.services.edge.url");
|
|
7568
7606
|
if (edgeEndpoint) {
|
|
7569
|
-
|
|
7607
|
+
const randomKey = PublicKey17.random().toHex();
|
|
7608
|
+
this._edgeConnection = new EdgeClient(randomKey, randomKey, {
|
|
7570
7609
|
socketEndpoint: edgeEndpoint
|
|
7571
7610
|
});
|
|
7572
7611
|
}
|
|
@@ -7577,8 +7616,8 @@ var ClientServicesHost = class {
|
|
|
7577
7616
|
}) : new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
7578
7617
|
this._signalManager = signalManager;
|
|
7579
7618
|
invariant20(!this._networkManager, "network manager already set", {
|
|
7580
|
-
F:
|
|
7581
|
-
L:
|
|
7619
|
+
F: __dxlog_file27,
|
|
7620
|
+
L: 232,
|
|
7582
7621
|
S: this,
|
|
7583
7622
|
A: [
|
|
7584
7623
|
"!this._networkManager",
|
|
@@ -7590,13 +7629,13 @@ var ClientServicesHost = class {
|
|
|
7590
7629
|
transportFactory,
|
|
7591
7630
|
signalManager,
|
|
7592
7631
|
peerInfo: this._edgeConnection ? {
|
|
7593
|
-
identityKey: this._edgeConnection.identityKey
|
|
7594
|
-
peerKey: this._edgeConnection.
|
|
7632
|
+
identityKey: this._edgeConnection.identityKey,
|
|
7633
|
+
peerKey: this._edgeConnection.peerKey
|
|
7595
7634
|
} : void 0
|
|
7596
7635
|
});
|
|
7597
|
-
|
|
7598
|
-
F:
|
|
7599
|
-
L:
|
|
7636
|
+
log24("initialized", void 0, {
|
|
7637
|
+
F: __dxlog_file27,
|
|
7638
|
+
L: 245,
|
|
7600
7639
|
S: this,
|
|
7601
7640
|
C: (f, a) => f(...a)
|
|
7602
7641
|
});
|
|
@@ -7606,17 +7645,17 @@ var ClientServicesHost = class {
|
|
|
7606
7645
|
return;
|
|
7607
7646
|
}
|
|
7608
7647
|
const traceId = PublicKey17.random().toHex();
|
|
7609
|
-
|
|
7648
|
+
log24.trace("dxos.client-services.host.open", trace10.begin({
|
|
7610
7649
|
id: traceId
|
|
7611
7650
|
}), {
|
|
7612
|
-
F:
|
|
7613
|
-
L:
|
|
7651
|
+
F: __dxlog_file27,
|
|
7652
|
+
L: 256,
|
|
7614
7653
|
S: this,
|
|
7615
7654
|
C: (f, a) => f(...a)
|
|
7616
7655
|
});
|
|
7617
7656
|
invariant20(this._config, "config not set", {
|
|
7618
|
-
F:
|
|
7619
|
-
L:
|
|
7657
|
+
F: __dxlog_file27,
|
|
7658
|
+
L: 258,
|
|
7620
7659
|
S: this,
|
|
7621
7660
|
A: [
|
|
7622
7661
|
"this._config",
|
|
@@ -7624,8 +7663,8 @@ var ClientServicesHost = class {
|
|
|
7624
7663
|
]
|
|
7625
7664
|
});
|
|
7626
7665
|
invariant20(this._storage, "storage not set", {
|
|
7627
|
-
F:
|
|
7628
|
-
L:
|
|
7666
|
+
F: __dxlog_file27,
|
|
7667
|
+
L: 259,
|
|
7629
7668
|
S: this,
|
|
7630
7669
|
A: [
|
|
7631
7670
|
"this._storage",
|
|
@@ -7633,8 +7672,8 @@ var ClientServicesHost = class {
|
|
|
7633
7672
|
]
|
|
7634
7673
|
});
|
|
7635
7674
|
invariant20(this._signalManager, "signal manager not set", {
|
|
7636
|
-
F:
|
|
7637
|
-
L:
|
|
7675
|
+
F: __dxlog_file27,
|
|
7676
|
+
L: 260,
|
|
7638
7677
|
S: this,
|
|
7639
7678
|
A: [
|
|
7640
7679
|
"this._signalManager",
|
|
@@ -7642,8 +7681,8 @@ var ClientServicesHost = class {
|
|
|
7642
7681
|
]
|
|
7643
7682
|
});
|
|
7644
7683
|
invariant20(this._networkManager, "network manager not set", {
|
|
7645
|
-
F:
|
|
7646
|
-
L:
|
|
7684
|
+
F: __dxlog_file27,
|
|
7685
|
+
L: 261,
|
|
7647
7686
|
S: this,
|
|
7648
7687
|
A: [
|
|
7649
7688
|
"this._networkManager",
|
|
@@ -7651,11 +7690,11 @@ var ClientServicesHost = class {
|
|
|
7651
7690
|
]
|
|
7652
7691
|
});
|
|
7653
7692
|
this._opening = true;
|
|
7654
|
-
|
|
7693
|
+
log24("opening...", {
|
|
7655
7694
|
lockKey: this._resourceLock?.lockKey
|
|
7656
7695
|
}, {
|
|
7657
|
-
F:
|
|
7658
|
-
L:
|
|
7696
|
+
F: __dxlog_file27,
|
|
7697
|
+
L: 264,
|
|
7659
7698
|
S: this,
|
|
7660
7699
|
C: (f, a) => f(...a)
|
|
7661
7700
|
});
|
|
@@ -7707,19 +7746,19 @@ var ClientServicesHost = class {
|
|
|
7707
7746
|
this._open = true;
|
|
7708
7747
|
this._statusUpdate.emit();
|
|
7709
7748
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
7710
|
-
|
|
7749
|
+
log24("opened", {
|
|
7711
7750
|
deviceKey
|
|
7712
7751
|
}, {
|
|
7713
|
-
F:
|
|
7714
|
-
L:
|
|
7752
|
+
F: __dxlog_file27,
|
|
7753
|
+
L: 352,
|
|
7715
7754
|
S: this,
|
|
7716
7755
|
C: (f, a) => f(...a)
|
|
7717
7756
|
});
|
|
7718
|
-
|
|
7757
|
+
log24.trace("dxos.client-services.host.open", trace10.end({
|
|
7719
7758
|
id: traceId
|
|
7720
7759
|
}), {
|
|
7721
|
-
F:
|
|
7722
|
-
L:
|
|
7760
|
+
F: __dxlog_file27,
|
|
7761
|
+
L: 353,
|
|
7723
7762
|
S: this,
|
|
7724
7763
|
C: (f, a) => f(...a)
|
|
7725
7764
|
});
|
|
@@ -7729,11 +7768,11 @@ var ClientServicesHost = class {
|
|
|
7729
7768
|
return;
|
|
7730
7769
|
}
|
|
7731
7770
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
7732
|
-
|
|
7771
|
+
log24("closing...", {
|
|
7733
7772
|
deviceKey
|
|
7734
7773
|
}, {
|
|
7735
|
-
F:
|
|
7736
|
-
L:
|
|
7774
|
+
F: __dxlog_file27,
|
|
7775
|
+
L: 364,
|
|
7737
7776
|
S: this,
|
|
7738
7777
|
C: (f, a) => f(...a)
|
|
7739
7778
|
});
|
|
@@ -7747,44 +7786,44 @@ var ClientServicesHost = class {
|
|
|
7747
7786
|
await this._level?.close();
|
|
7748
7787
|
this._open = false;
|
|
7749
7788
|
this._statusUpdate.emit();
|
|
7750
|
-
|
|
7789
|
+
log24("closed", {
|
|
7751
7790
|
deviceKey
|
|
7752
7791
|
}, {
|
|
7753
|
-
F:
|
|
7754
|
-
L:
|
|
7792
|
+
F: __dxlog_file27,
|
|
7793
|
+
L: 373,
|
|
7755
7794
|
S: this,
|
|
7756
7795
|
C: (f, a) => f(...a)
|
|
7757
7796
|
});
|
|
7758
7797
|
}
|
|
7759
7798
|
async reset() {
|
|
7760
7799
|
const traceId = PublicKey17.random().toHex();
|
|
7761
|
-
|
|
7800
|
+
log24.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
7762
7801
|
id: traceId
|
|
7763
7802
|
}), {
|
|
7764
|
-
F:
|
|
7765
|
-
L:
|
|
7803
|
+
F: __dxlog_file27,
|
|
7804
|
+
L: 378,
|
|
7766
7805
|
S: this,
|
|
7767
7806
|
C: (f, a) => f(...a)
|
|
7768
7807
|
});
|
|
7769
|
-
|
|
7770
|
-
F:
|
|
7771
|
-
L:
|
|
7808
|
+
log24.info("resetting...", void 0, {
|
|
7809
|
+
F: __dxlog_file27,
|
|
7810
|
+
L: 380,
|
|
7772
7811
|
S: this,
|
|
7773
7812
|
C: (f, a) => f(...a)
|
|
7774
7813
|
});
|
|
7775
7814
|
await this._serviceContext?.close();
|
|
7776
7815
|
await this._storage.reset();
|
|
7777
|
-
|
|
7778
|
-
F:
|
|
7779
|
-
L:
|
|
7816
|
+
log24.info("reset", void 0, {
|
|
7817
|
+
F: __dxlog_file27,
|
|
7818
|
+
L: 383,
|
|
7780
7819
|
S: this,
|
|
7781
7820
|
C: (f, a) => f(...a)
|
|
7782
7821
|
});
|
|
7783
|
-
|
|
7822
|
+
log24.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
7784
7823
|
id: traceId
|
|
7785
7824
|
}), {
|
|
7786
|
-
F:
|
|
7787
|
-
L:
|
|
7825
|
+
F: __dxlog_file27,
|
|
7826
|
+
L: 384,
|
|
7788
7827
|
S: this,
|
|
7789
7828
|
C: (f, a) => f(...a)
|
|
7790
7829
|
});
|
|
@@ -7858,4 +7897,4 @@ export {
|
|
|
7858
7897
|
importProfileData,
|
|
7859
7898
|
ClientServicesHost
|
|
7860
7899
|
};
|
|
7861
|
-
//# sourceMappingURL=chunk-
|
|
7900
|
+
//# sourceMappingURL=chunk-ADTM2VNF.mjs.map
|