@dxos/client-services 0.4.7-main.731b147 → 0.4.7-main.772b4a3
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-XPIRHRIB.mjs → chunk-KGSDIFCK.mjs} +227 -146
- package/dist/lib/browser/chunk-KGSDIFCK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -2
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -2
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-BIYZDTFF.cjs → chunk-3ZHY4PXC.cjs} +216 -135
- package/dist/lib/node/chunk-3ZHY4PXC.cjs.map +7 -0
- package/dist/lib/node/index.cjs +40 -38
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +11 -9
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devices/devices-service.d.ts +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +8 -2
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +5 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +1 -0
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +7 -3
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +4 -2
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shared-worker-connection.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.test.ts +8 -4
- package/src/packlets/devices/devices-service.ts +47 -11
- package/src/packlets/identity/identity-manager.ts +48 -6
- package/src/packlets/identity/identity.ts +9 -1
- package/src/packlets/logging/logging-service.ts +9 -2
- package/src/packlets/services/automerge-host.test.ts +1 -1
- package/src/packlets/services/service-context.ts +24 -4
- package/src/packlets/services/service-host.ts +8 -3
- package/src/packlets/spaces/data-space-manager.ts +18 -3
- package/src/packlets/spaces/spaces-service.ts +1 -3
- package/src/packlets/testing/test-builder.ts +1 -1
- package/src/packlets/vault/shared-worker-connection.ts +2 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-XPIRHRIB.mjs.map +0 -7
- package/dist/lib/node/chunk-BIYZDTFF.cjs.map +0 -7
|
@@ -483,17 +483,18 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
483
483
|
}
|
|
484
484
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
485
485
|
var Identity = class {
|
|
486
|
-
constructor({ space, signer, identityKey, deviceKey }) {
|
|
486
|
+
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
487
487
|
this.stateUpdate = new Event();
|
|
488
488
|
this.space = space;
|
|
489
489
|
this._signer = signer;
|
|
490
|
+
this._presence = presence;
|
|
490
491
|
this.identityKey = identityKey;
|
|
491
492
|
this.deviceKey = deviceKey;
|
|
492
493
|
log2.trace("dxos.halo.device", {
|
|
493
494
|
deviceKey
|
|
494
495
|
}, {
|
|
495
496
|
F: __dxlog_file2,
|
|
496
|
-
L:
|
|
497
|
+
L: 67,
|
|
497
498
|
S: this,
|
|
498
499
|
C: (f, a) => f(...a)
|
|
499
500
|
});
|
|
@@ -551,6 +552,9 @@ var Identity = class {
|
|
|
551
552
|
get deviceCredentialChain() {
|
|
552
553
|
return this._deviceStateMachine.deviceCredentialChain;
|
|
553
554
|
}
|
|
555
|
+
get presence() {
|
|
556
|
+
return this._presence;
|
|
557
|
+
}
|
|
554
558
|
/**
|
|
555
559
|
* Issues credentials as identity.
|
|
556
560
|
* Requires identity to be ready.
|
|
@@ -558,7 +562,7 @@ var Identity = class {
|
|
|
558
562
|
getIdentityCredentialSigner() {
|
|
559
563
|
invariant(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
560
564
|
F: __dxlog_file2,
|
|
561
|
-
L:
|
|
565
|
+
L: 144,
|
|
562
566
|
S: this,
|
|
563
567
|
A: [
|
|
564
568
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -582,7 +586,7 @@ var Identity = class {
|
|
|
582
586
|
dataFeedKey
|
|
583
587
|
}, {
|
|
584
588
|
F: __dxlog_file2,
|
|
585
|
-
L:
|
|
589
|
+
L: 160,
|
|
586
590
|
S: this,
|
|
587
591
|
C: (f, a) => f(...a)
|
|
588
592
|
});
|
|
@@ -642,8 +646,9 @@ import { invariant as invariant2 } from "@dxos/invariant";
|
|
|
642
646
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
643
647
|
import { log as log3 } from "@dxos/log";
|
|
644
648
|
import { trace as trace2 } from "@dxos/protocols";
|
|
645
|
-
import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
|
|
649
|
+
import { Device, DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
|
|
646
650
|
import { AdmittedFeed as AdmittedFeed2, DeviceType } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
651
|
+
import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
|
|
647
652
|
import { Timeframe } from "@dxos/timeframe";
|
|
648
653
|
import { trace as Trace } from "@dxos/tracing";
|
|
649
654
|
import { isNode, deferFunction } from "@dxos/util";
|
|
@@ -658,15 +663,20 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
658
663
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
659
664
|
}
|
|
660
665
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
666
|
+
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
667
|
+
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
661
668
|
var IdentityManager = class {
|
|
662
669
|
// TODO(burdon): IdentityManagerParams.
|
|
663
670
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
664
|
-
constructor(_metadataStore, _keyring, _feedStore, _spaceManager) {
|
|
671
|
+
constructor(_metadataStore, _keyring, _feedStore, _spaceManager, params) {
|
|
665
672
|
this._metadataStore = _metadataStore;
|
|
666
673
|
this._keyring = _keyring;
|
|
667
674
|
this._feedStore = _feedStore;
|
|
668
675
|
this._spaceManager = _spaceManager;
|
|
669
676
|
this.stateUpdate = new Event2();
|
|
677
|
+
const { devicePresenceAnnounceInterval = DEVICE_PRESENCE_ANNOUNCE_INTERVAL, devicePresenceOfflineTimeout = DEVICE_PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
678
|
+
this._devicePresenceAnnounceInterval = devicePresenceAnnounceInterval;
|
|
679
|
+
this._devicePresenceOfflineTimeout = devicePresenceOfflineTimeout;
|
|
670
680
|
}
|
|
671
681
|
get identity() {
|
|
672
682
|
return this._identity;
|
|
@@ -677,7 +687,7 @@ var IdentityManager = class {
|
|
|
677
687
|
id: traceId
|
|
678
688
|
}), {
|
|
679
689
|
F: __dxlog_file3,
|
|
680
|
-
L:
|
|
690
|
+
L: 104,
|
|
681
691
|
S: this,
|
|
682
692
|
C: (f, a) => f(...a)
|
|
683
693
|
});
|
|
@@ -686,7 +696,7 @@ var IdentityManager = class {
|
|
|
686
696
|
identityRecord
|
|
687
697
|
}, {
|
|
688
698
|
F: __dxlog_file3,
|
|
689
|
-
L:
|
|
699
|
+
L: 107,
|
|
690
700
|
S: this,
|
|
691
701
|
C: (f, a) => f(...a)
|
|
692
702
|
});
|
|
@@ -699,7 +709,7 @@ var IdentityManager = class {
|
|
|
699
709
|
displayName: this._identity.profileDocument?.displayName
|
|
700
710
|
}, {
|
|
701
711
|
F: __dxlog_file3,
|
|
702
|
-
L:
|
|
712
|
+
L: 112,
|
|
703
713
|
S: this,
|
|
704
714
|
C: (f, a) => f(...a)
|
|
705
715
|
});
|
|
@@ -709,7 +719,7 @@ var IdentityManager = class {
|
|
|
709
719
|
id: traceId
|
|
710
720
|
}), {
|
|
711
721
|
F: __dxlog_file3,
|
|
712
|
-
L:
|
|
722
|
+
L: 119,
|
|
713
723
|
S: this,
|
|
714
724
|
C: (f, a) => f(...a)
|
|
715
725
|
});
|
|
@@ -720,7 +730,7 @@ var IdentityManager = class {
|
|
|
720
730
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
721
731
|
invariant2(!this._identity, "Identity already exists.", {
|
|
722
732
|
F: __dxlog_file3,
|
|
723
|
-
L:
|
|
733
|
+
L: 128,
|
|
724
734
|
S: this,
|
|
725
735
|
A: [
|
|
726
736
|
"!this._identity",
|
|
@@ -729,7 +739,7 @@ var IdentityManager = class {
|
|
|
729
739
|
});
|
|
730
740
|
log3("creating identity...", void 0, {
|
|
731
741
|
F: __dxlog_file3,
|
|
732
|
-
L:
|
|
742
|
+
L: 129,
|
|
733
743
|
S: this,
|
|
734
744
|
C: (f, a) => f(...a)
|
|
735
745
|
});
|
|
@@ -750,7 +760,7 @@ var IdentityManager = class {
|
|
|
750
760
|
const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
751
761
|
invariant2(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
752
762
|
F: __dxlog_file3,
|
|
753
|
-
L:
|
|
763
|
+
L: 148,
|
|
754
764
|
S: this,
|
|
755
765
|
A: [
|
|
756
766
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -759,7 +769,7 @@ var IdentityManager = class {
|
|
|
759
769
|
});
|
|
760
770
|
invariant2(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
761
771
|
F: __dxlog_file3,
|
|
762
|
-
L:
|
|
772
|
+
L: 149,
|
|
763
773
|
S: this,
|
|
764
774
|
A: [
|
|
765
775
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -798,7 +808,7 @@ var IdentityManager = class {
|
|
|
798
808
|
displayName: this._identity.profileDocument?.displayName
|
|
799
809
|
}, {
|
|
800
810
|
F: __dxlog_file3,
|
|
801
|
-
L:
|
|
811
|
+
L: 191,
|
|
802
812
|
S: this,
|
|
803
813
|
C: (f, a) => f(...a)
|
|
804
814
|
});
|
|
@@ -809,7 +819,7 @@ var IdentityManager = class {
|
|
|
809
819
|
profile: identity.profileDocument
|
|
810
820
|
}, {
|
|
811
821
|
F: __dxlog_file3,
|
|
812
|
-
L:
|
|
822
|
+
L: 197,
|
|
813
823
|
S: this,
|
|
814
824
|
C: (f, a) => f(...a)
|
|
815
825
|
});
|
|
@@ -846,13 +856,13 @@ var IdentityManager = class {
|
|
|
846
856
|
params
|
|
847
857
|
}, {
|
|
848
858
|
F: __dxlog_file3,
|
|
849
|
-
L:
|
|
859
|
+
L: 235,
|
|
850
860
|
S: this,
|
|
851
861
|
C: (f, a) => f(...a)
|
|
852
862
|
});
|
|
853
863
|
invariant2(!this._identity, "Identity already exists.", {
|
|
854
864
|
F: __dxlog_file3,
|
|
855
|
-
L:
|
|
865
|
+
L: 236,
|
|
856
866
|
S: this,
|
|
857
867
|
A: [
|
|
858
868
|
"!this._identity",
|
|
@@ -880,7 +890,7 @@ var IdentityManager = class {
|
|
|
880
890
|
displayName: this._identity.profileDocument?.displayName
|
|
881
891
|
}, {
|
|
882
892
|
F: __dxlog_file3,
|
|
883
|
-
L:
|
|
893
|
+
L: 255,
|
|
884
894
|
S: this,
|
|
885
895
|
C: (f, a) => f(...a)
|
|
886
896
|
});
|
|
@@ -894,7 +904,7 @@ var IdentityManager = class {
|
|
|
894
904
|
deviceKey: identity.deviceKey
|
|
895
905
|
}, {
|
|
896
906
|
F: __dxlog_file3,
|
|
897
|
-
L:
|
|
907
|
+
L: 265,
|
|
898
908
|
S: this,
|
|
899
909
|
C: (f, a) => f(...a)
|
|
900
910
|
});
|
|
@@ -906,7 +916,7 @@ var IdentityManager = class {
|
|
|
906
916
|
async updateProfile(profile) {
|
|
907
917
|
invariant2(this._identity, "Identity not initialized.", {
|
|
908
918
|
F: __dxlog_file3,
|
|
909
|
-
L:
|
|
919
|
+
L: 273,
|
|
910
920
|
S: this,
|
|
911
921
|
A: [
|
|
912
922
|
"this._identity",
|
|
@@ -937,7 +947,7 @@ var IdentityManager = class {
|
|
|
937
947
|
async updateDeviceProfile(profile) {
|
|
938
948
|
invariant2(this._identity, "Identity not initialized.", {
|
|
939
949
|
F: __dxlog_file3,
|
|
940
|
-
L:
|
|
950
|
+
L: 290,
|
|
941
951
|
S: this,
|
|
942
952
|
A: [
|
|
943
953
|
"this._identity",
|
|
@@ -966,13 +976,14 @@ var IdentityManager = class {
|
|
|
966
976
|
return {
|
|
967
977
|
deviceKey: this._identity.deviceKey,
|
|
968
978
|
kind: DeviceKind.CURRENT,
|
|
979
|
+
presence: Device.PresenceState.ONLINE,
|
|
969
980
|
profile
|
|
970
981
|
};
|
|
971
982
|
}
|
|
972
983
|
async _constructIdentity(identityRecord) {
|
|
973
984
|
invariant2(!this._identity, void 0, {
|
|
974
985
|
F: __dxlog_file3,
|
|
975
|
-
L:
|
|
986
|
+
L: 316,
|
|
976
987
|
S: this,
|
|
977
988
|
A: [
|
|
978
989
|
"!this._identity",
|
|
@@ -983,13 +994,22 @@ var IdentityManager = class {
|
|
|
983
994
|
identityRecord
|
|
984
995
|
}, {
|
|
985
996
|
F: __dxlog_file3,
|
|
986
|
-
L:
|
|
997
|
+
L: 317,
|
|
987
998
|
S: this,
|
|
988
999
|
C: (f, a) => f(...a)
|
|
989
1000
|
});
|
|
1001
|
+
const gossip = new Gossip({
|
|
1002
|
+
localPeerId: identityRecord.deviceKey
|
|
1003
|
+
});
|
|
1004
|
+
const presence = new Presence({
|
|
1005
|
+
announceInterval: this._devicePresenceAnnounceInterval,
|
|
1006
|
+
offlineTimeout: this._devicePresenceOfflineTimeout,
|
|
1007
|
+
identityKey: identityRecord.deviceKey,
|
|
1008
|
+
gossip
|
|
1009
|
+
});
|
|
990
1010
|
invariant2(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
991
1011
|
F: __dxlog_file3,
|
|
992
|
-
L:
|
|
1012
|
+
L: 330,
|
|
993
1013
|
S: this,
|
|
994
1014
|
A: [
|
|
995
1015
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -1001,7 +1021,7 @@ var IdentityManager = class {
|
|
|
1001
1021
|
});
|
|
1002
1022
|
invariant2(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1003
1023
|
F: __dxlog_file3,
|
|
1004
|
-
L:
|
|
1024
|
+
L: 334,
|
|
1005
1025
|
S: this,
|
|
1006
1026
|
A: [
|
|
1007
1027
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -1019,12 +1039,14 @@ var IdentityManager = class {
|
|
|
1019
1039
|
credentialProvider: createAuthProvider(createCredentialSignerWithKey2(this._keyring, identityRecord.deviceKey)),
|
|
1020
1040
|
credentialAuthenticator: deferFunction(() => identity.authVerifier.verifier)
|
|
1021
1041
|
},
|
|
1042
|
+
gossip,
|
|
1022
1043
|
identityKey: identityRecord.identityKey
|
|
1023
1044
|
});
|
|
1024
1045
|
await space.setControlFeed(controlFeed);
|
|
1025
|
-
space.setDataFeed(dataFeed);
|
|
1046
|
+
void space.setDataFeed(dataFeed);
|
|
1026
1047
|
const identity = new Identity({
|
|
1027
1048
|
space,
|
|
1049
|
+
presence,
|
|
1028
1050
|
signer: this._keyring,
|
|
1029
1051
|
identityKey: identityRecord.identityKey,
|
|
1030
1052
|
deviceKey: identityRecord.deviceKey
|
|
@@ -1033,7 +1055,7 @@ var IdentityManager = class {
|
|
|
1033
1055
|
identityKey: identityRecord.identityKey
|
|
1034
1056
|
}, {
|
|
1035
1057
|
F: __dxlog_file3,
|
|
1036
|
-
L:
|
|
1058
|
+
L: 360,
|
|
1037
1059
|
S: this,
|
|
1038
1060
|
C: (f, a) => f(...a)
|
|
1039
1061
|
});
|
|
@@ -1043,19 +1065,22 @@ var IdentityManager = class {
|
|
|
1043
1065
|
identity.stateUpdate.on(() => this.stateUpdate.emit());
|
|
1044
1066
|
return identity;
|
|
1045
1067
|
}
|
|
1046
|
-
async _constructSpace({ spaceRecord, swarmIdentity, identityKey }) {
|
|
1068
|
+
async _constructSpace({ spaceRecord, swarmIdentity, identityKey, gossip }) {
|
|
1047
1069
|
return this._spaceManager.constructSpace({
|
|
1048
1070
|
metadata: {
|
|
1049
1071
|
key: spaceRecord.key,
|
|
1050
1072
|
genesisFeedKey: spaceRecord.genesisFeedKey
|
|
1051
1073
|
},
|
|
1052
1074
|
swarmIdentity,
|
|
1053
|
-
onAuthorizedConnection: () => {
|
|
1075
|
+
onAuthorizedConnection: (session) => {
|
|
1076
|
+
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
1077
|
+
remotePeerId: session.remotePeerId
|
|
1078
|
+
}));
|
|
1054
1079
|
},
|
|
1055
1080
|
onAuthFailure: () => {
|
|
1056
1081
|
log3.warn("auth failure", void 0, {
|
|
1057
1082
|
F: __dxlog_file3,
|
|
1058
|
-
L:
|
|
1083
|
+
L: 385,
|
|
1059
1084
|
S: this,
|
|
1060
1085
|
C: (f, a) => f(...a)
|
|
1061
1086
|
});
|
|
@@ -2646,7 +2671,7 @@ var getPlatform = () => {
|
|
|
2646
2671
|
};
|
|
2647
2672
|
|
|
2648
2673
|
// packages/sdk/client-services/src/version.ts
|
|
2649
|
-
var DXOS_VERSION = "0.4.7-main.
|
|
2674
|
+
var DXOS_VERSION = "0.4.7-main.772b4a3";
|
|
2650
2675
|
|
|
2651
2676
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2652
2677
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
@@ -3574,7 +3599,7 @@ import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
|
3574
3599
|
import { log as log11 } from "@dxos/log";
|
|
3575
3600
|
import { trace as trace7 } from "@dxos/protocols";
|
|
3576
3601
|
import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3577
|
-
import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
|
|
3602
|
+
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
3578
3603
|
import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
|
|
3579
3604
|
|
|
3580
3605
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
@@ -3662,7 +3687,7 @@ var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
3662
3687
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
3663
3688
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
3664
3689
|
var DataSpaceManager = class {
|
|
3665
|
-
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost) {
|
|
3690
|
+
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore, _automergeHost, params) {
|
|
3666
3691
|
this._spaceManager = _spaceManager;
|
|
3667
3692
|
this._metadataStore = _metadataStore;
|
|
3668
3693
|
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
@@ -3675,6 +3700,9 @@ var DataSpaceManager = class {
|
|
|
3675
3700
|
this._spaces = new ComplexMap3(PublicKey9.hash);
|
|
3676
3701
|
this._isOpen = false;
|
|
3677
3702
|
this._instanceId = PublicKey9.random().toHex();
|
|
3703
|
+
const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
|
|
3704
|
+
this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
|
|
3705
|
+
this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
|
|
3678
3706
|
}
|
|
3679
3707
|
// TODO(burdon): Remove.
|
|
3680
3708
|
get spaces() {
|
|
@@ -3683,7 +3711,7 @@ var DataSpaceManager = class {
|
|
|
3683
3711
|
async open() {
|
|
3684
3712
|
log11("open", void 0, {
|
|
3685
3713
|
F: __dxlog_file13,
|
|
3686
|
-
L:
|
|
3714
|
+
L: 105,
|
|
3687
3715
|
S: this,
|
|
3688
3716
|
C: (f, a) => f(...a)
|
|
3689
3717
|
});
|
|
@@ -3691,7 +3719,7 @@ var DataSpaceManager = class {
|
|
|
3691
3719
|
id: this._instanceId
|
|
3692
3720
|
}), {
|
|
3693
3721
|
F: __dxlog_file13,
|
|
3694
|
-
L:
|
|
3722
|
+
L: 106,
|
|
3695
3723
|
S: this,
|
|
3696
3724
|
C: (f, a) => f(...a)
|
|
3697
3725
|
});
|
|
@@ -3699,7 +3727,7 @@ var DataSpaceManager = class {
|
|
|
3699
3727
|
spaces: this._metadataStore.spaces.length
|
|
3700
3728
|
}, {
|
|
3701
3729
|
F: __dxlog_file13,
|
|
3702
|
-
L:
|
|
3730
|
+
L: 107,
|
|
3703
3731
|
S: this,
|
|
3704
3732
|
C: (f, a) => f(...a)
|
|
3705
3733
|
});
|
|
@@ -3709,7 +3737,7 @@ var DataSpaceManager = class {
|
|
|
3709
3737
|
spaceMetadata
|
|
3710
3738
|
}, {
|
|
3711
3739
|
F: __dxlog_file13,
|
|
3712
|
-
L:
|
|
3740
|
+
L: 111,
|
|
3713
3741
|
S: this,
|
|
3714
3742
|
C: (f, a) => f(...a)
|
|
3715
3743
|
});
|
|
@@ -3720,7 +3748,7 @@ var DataSpaceManager = class {
|
|
|
3720
3748
|
err
|
|
3721
3749
|
}, {
|
|
3722
3750
|
F: __dxlog_file13,
|
|
3723
|
-
L:
|
|
3751
|
+
L: 114,
|
|
3724
3752
|
S: this,
|
|
3725
3753
|
C: (f, a) => f(...a)
|
|
3726
3754
|
});
|
|
@@ -3737,7 +3765,7 @@ var DataSpaceManager = class {
|
|
|
3737
3765
|
id: this._instanceId
|
|
3738
3766
|
}), {
|
|
3739
3767
|
F: __dxlog_file13,
|
|
3740
|
-
L:
|
|
3768
|
+
L: 127,
|
|
3741
3769
|
S: this,
|
|
3742
3770
|
C: (f, a) => f(...a)
|
|
3743
3771
|
});
|
|
@@ -3745,7 +3773,7 @@ var DataSpaceManager = class {
|
|
|
3745
3773
|
async close() {
|
|
3746
3774
|
log11("close", void 0, {
|
|
3747
3775
|
F: __dxlog_file13,
|
|
3748
|
-
L:
|
|
3776
|
+
L: 132,
|
|
3749
3777
|
S: this,
|
|
3750
3778
|
C: (f, a) => f(...a)
|
|
3751
3779
|
});
|
|
@@ -3761,7 +3789,7 @@ var DataSpaceManager = class {
|
|
|
3761
3789
|
async createSpace() {
|
|
3762
3790
|
invariant11(this._isOpen, "Not open.", {
|
|
3763
3791
|
F: __dxlog_file13,
|
|
3764
|
-
L:
|
|
3792
|
+
L: 145,
|
|
3765
3793
|
S: this,
|
|
3766
3794
|
A: [
|
|
3767
3795
|
"this._isOpen",
|
|
@@ -3782,7 +3810,7 @@ var DataSpaceManager = class {
|
|
|
3782
3810
|
spaceKey
|
|
3783
3811
|
}, {
|
|
3784
3812
|
F: __dxlog_file13,
|
|
3785
|
-
L:
|
|
3813
|
+
L: 157,
|
|
3786
3814
|
S: this,
|
|
3787
3815
|
C: (f, a) => f(...a)
|
|
3788
3816
|
});
|
|
@@ -3798,7 +3826,7 @@ var DataSpaceManager = class {
|
|
|
3798
3826
|
const memberCredential = credentials[1];
|
|
3799
3827
|
invariant11(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3800
3828
|
F: __dxlog_file13,
|
|
3801
|
-
L:
|
|
3829
|
+
L: 170,
|
|
3802
3830
|
S: this,
|
|
3803
3831
|
A: [
|
|
3804
3832
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3816,13 +3844,13 @@ var DataSpaceManager = class {
|
|
|
3816
3844
|
opts
|
|
3817
3845
|
}, {
|
|
3818
3846
|
F: __dxlog_file13,
|
|
3819
|
-
L:
|
|
3847
|
+
L: 182,
|
|
3820
3848
|
S: this,
|
|
3821
3849
|
C: (f, a) => f(...a)
|
|
3822
3850
|
});
|
|
3823
3851
|
invariant11(this._isOpen, "Not open.", {
|
|
3824
3852
|
F: __dxlog_file13,
|
|
3825
|
-
L:
|
|
3853
|
+
L: 183,
|
|
3826
3854
|
S: this,
|
|
3827
3855
|
A: [
|
|
3828
3856
|
"this._isOpen",
|
|
@@ -3831,7 +3859,7 @@ var DataSpaceManager = class {
|
|
|
3831
3859
|
});
|
|
3832
3860
|
invariant11(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3833
3861
|
F: __dxlog_file13,
|
|
3834
|
-
L:
|
|
3862
|
+
L: 184,
|
|
3835
3863
|
S: this,
|
|
3836
3864
|
A: [
|
|
3837
3865
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -3866,16 +3894,16 @@ var DataSpaceManager = class {
|
|
|
3866
3894
|
metadata
|
|
3867
3895
|
}, {
|
|
3868
3896
|
F: __dxlog_file13,
|
|
3869
|
-
L:
|
|
3897
|
+
L: 217,
|
|
3870
3898
|
S: this,
|
|
3871
3899
|
C: (f, a) => f(...a)
|
|
3872
3900
|
});
|
|
3873
|
-
const gossip = new
|
|
3901
|
+
const gossip = new Gossip2({
|
|
3874
3902
|
localPeerId: this._signingContext.deviceKey
|
|
3875
3903
|
});
|
|
3876
|
-
const presence = new
|
|
3877
|
-
announceInterval:
|
|
3878
|
-
offlineTimeout:
|
|
3904
|
+
const presence = new Presence2({
|
|
3905
|
+
announceInterval: this._spaceMemberPresenceAnnounceInterval,
|
|
3906
|
+
offlineTimeout: this._spaceMemberPresenceOfflineTimeout,
|
|
3879
3907
|
identityKey: this._signingContext.identityKey,
|
|
3880
3908
|
gossip
|
|
3881
3909
|
});
|
|
@@ -3904,7 +3932,7 @@ var DataSpaceManager = class {
|
|
|
3904
3932
|
onAuthFailure: () => {
|
|
3905
3933
|
log11.warn("auth failure", void 0, {
|
|
3906
3934
|
F: __dxlog_file13,
|
|
3907
|
-
L:
|
|
3935
|
+
L: 254,
|
|
3908
3936
|
S: this,
|
|
3909
3937
|
C: (f, a) => f(...a)
|
|
3910
3938
|
});
|
|
@@ -3928,7 +3956,7 @@ var DataSpaceManager = class {
|
|
|
3928
3956
|
space: space.key
|
|
3929
3957
|
}, {
|
|
3930
3958
|
F: __dxlog_file13,
|
|
3931
|
-
L:
|
|
3959
|
+
L: 272,
|
|
3932
3960
|
S: this,
|
|
3933
3961
|
C: (f, a) => f(...a)
|
|
3934
3962
|
});
|
|
@@ -3940,7 +3968,7 @@ var DataSpaceManager = class {
|
|
|
3940
3968
|
open: this._isOpen
|
|
3941
3969
|
}, {
|
|
3942
3970
|
F: __dxlog_file13,
|
|
3943
|
-
L:
|
|
3971
|
+
L: 279,
|
|
3944
3972
|
S: this,
|
|
3945
3973
|
C: (f, a) => f(...a)
|
|
3946
3974
|
});
|
|
@@ -3953,7 +3981,7 @@ var DataSpaceManager = class {
|
|
|
3953
3981
|
space: space.key
|
|
3954
3982
|
}, {
|
|
3955
3983
|
F: __dxlog_file13,
|
|
3956
|
-
L:
|
|
3984
|
+
L: 285,
|
|
3957
3985
|
S: this,
|
|
3958
3986
|
C: (f, a) => f(...a)
|
|
3959
3987
|
});
|
|
@@ -4197,9 +4225,7 @@ var SpacesServiceImpl = class {
|
|
|
4197
4225
|
return {
|
|
4198
4226
|
identity: {
|
|
4199
4227
|
identityKey: member.key,
|
|
4200
|
-
profile: {
|
|
4201
|
-
displayName: member.profile?.displayName
|
|
4202
|
-
}
|
|
4228
|
+
profile: member.profile ?? {}
|
|
4203
4229
|
},
|
|
4204
4230
|
presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
|
|
4205
4231
|
peerStates: peers
|
|
@@ -4219,6 +4245,7 @@ import { Context as Context9 } from "@dxos/context";
|
|
|
4219
4245
|
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4220
4246
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
4221
4247
|
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from "@dxos/echo-pipeline";
|
|
4248
|
+
import { IndexMetadataStore } from "@dxos/echo-schema";
|
|
4222
4249
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
4223
4250
|
import { invariant as invariant13 } from "@dxos/invariant";
|
|
4224
4251
|
import { Keyring } from "@dxos/keyring";
|
|
@@ -4241,16 +4268,20 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4241
4268
|
}
|
|
4242
4269
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
4243
4270
|
var ServiceContext = class {
|
|
4244
|
-
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
4271
|
+
constructor(storage, networkManager, signalManager, modelFactory, _runtimeParams) {
|
|
4245
4272
|
this.storage = storage;
|
|
4246
4273
|
this.networkManager = networkManager;
|
|
4247
4274
|
this.signalManager = signalManager;
|
|
4248
4275
|
this.modelFactory = modelFactory;
|
|
4276
|
+
this._runtimeParams = _runtimeParams;
|
|
4249
4277
|
this.initialized = new Trigger5();
|
|
4250
4278
|
this.dataServiceSubscriptions = new DataServiceSubscriptions();
|
|
4251
4279
|
this._handlerFactories = /* @__PURE__ */ new Map();
|
|
4252
4280
|
this._instanceId = PublicKey10.random().toHex();
|
|
4253
4281
|
this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
|
|
4282
|
+
this.indexMetadata = new IndexMetadataStore({
|
|
4283
|
+
directory: storage.createDirectory("index-metadata")
|
|
4284
|
+
});
|
|
4254
4285
|
this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
|
|
4255
4286
|
this.blobStore = new BlobStore(storage.createDirectory("blobs"));
|
|
4256
4287
|
this.keyring = new Keyring(storage.createDirectory("keyring"));
|
|
@@ -4272,8 +4303,11 @@ var ServiceContext = class {
|
|
|
4272
4303
|
modelFactory: this.modelFactory,
|
|
4273
4304
|
snapshotStore: this.snapshotStore
|
|
4274
4305
|
});
|
|
4275
|
-
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4276
|
-
this.automergeHost = new AutomergeHost(
|
|
4306
|
+
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager, this._runtimeParams);
|
|
4307
|
+
this.automergeHost = new AutomergeHost({
|
|
4308
|
+
directory: storage.createDirectory("automerge"),
|
|
4309
|
+
metadata: this.indexMetadata
|
|
4310
|
+
});
|
|
4277
4311
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4278
4312
|
this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined2(), this._acceptIdentity.bind(this)));
|
|
4279
4313
|
}
|
|
@@ -4281,7 +4315,7 @@ var ServiceContext = class {
|
|
|
4281
4315
|
await this._checkStorageVersion();
|
|
4282
4316
|
log13("opening...", void 0, {
|
|
4283
4317
|
F: __dxlog_file15,
|
|
4284
|
-
L:
|
|
4318
|
+
L: 152,
|
|
4285
4319
|
S: this,
|
|
4286
4320
|
C: (f, a) => f(...a)
|
|
4287
4321
|
});
|
|
@@ -4289,7 +4323,7 @@ var ServiceContext = class {
|
|
|
4289
4323
|
id: this._instanceId
|
|
4290
4324
|
}), {
|
|
4291
4325
|
F: __dxlog_file15,
|
|
4292
|
-
L:
|
|
4326
|
+
L: 153,
|
|
4293
4327
|
S: this,
|
|
4294
4328
|
C: (f, a) => f(...a)
|
|
4295
4329
|
});
|
|
@@ -4305,13 +4339,13 @@ var ServiceContext = class {
|
|
|
4305
4339
|
id: this._instanceId
|
|
4306
4340
|
}), {
|
|
4307
4341
|
F: __dxlog_file15,
|
|
4308
|
-
L:
|
|
4342
|
+
L: 163,
|
|
4309
4343
|
S: this,
|
|
4310
4344
|
C: (f, a) => f(...a)
|
|
4311
4345
|
});
|
|
4312
4346
|
log13("opened", void 0, {
|
|
4313
4347
|
F: __dxlog_file15,
|
|
4314
|
-
L:
|
|
4348
|
+
L: 164,
|
|
4315
4349
|
S: this,
|
|
4316
4350
|
C: (f, a) => f(...a)
|
|
4317
4351
|
});
|
|
@@ -4319,7 +4353,7 @@ var ServiceContext = class {
|
|
|
4319
4353
|
async close() {
|
|
4320
4354
|
log13("closing...", void 0, {
|
|
4321
4355
|
F: __dxlog_file15,
|
|
4322
|
-
L:
|
|
4356
|
+
L: 168,
|
|
4323
4357
|
S: this,
|
|
4324
4358
|
C: (f, a) => f(...a)
|
|
4325
4359
|
});
|
|
@@ -4337,7 +4371,7 @@ var ServiceContext = class {
|
|
|
4337
4371
|
await this.metadataStore.close();
|
|
4338
4372
|
log13("closed", void 0, {
|
|
4339
4373
|
F: __dxlog_file15,
|
|
4340
|
-
L:
|
|
4374
|
+
L: 181,
|
|
4341
4375
|
S: this,
|
|
4342
4376
|
C: (f, a) => f(...a)
|
|
4343
4377
|
});
|
|
@@ -4351,7 +4385,7 @@ var ServiceContext = class {
|
|
|
4351
4385
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4352
4386
|
invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4353
4387
|
F: __dxlog_file15,
|
|
4354
|
-
L:
|
|
4388
|
+
L: 192,
|
|
4355
4389
|
S: this,
|
|
4356
4390
|
A: [
|
|
4357
4391
|
"factory",
|
|
@@ -4383,7 +4417,7 @@ var ServiceContext = class {
|
|
|
4383
4417
|
async _initialize(ctx) {
|
|
4384
4418
|
log13("initializing spaces...", void 0, {
|
|
4385
4419
|
F: __dxlog_file15,
|
|
4386
|
-
L:
|
|
4420
|
+
L: 223,
|
|
4387
4421
|
S: this,
|
|
4388
4422
|
C: (f, a) => f(...a)
|
|
4389
4423
|
});
|
|
@@ -4401,12 +4435,12 @@ var ServiceContext = class {
|
|
|
4401
4435
|
});
|
|
4402
4436
|
}
|
|
4403
4437
|
};
|
|
4404
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4438
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost, this._runtimeParams);
|
|
4405
4439
|
await this.dataSpaceManager.open();
|
|
4406
4440
|
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4407
4441
|
invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4408
4442
|
F: __dxlog_file15,
|
|
4409
|
-
L:
|
|
4443
|
+
L: 248,
|
|
4410
4444
|
S: this,
|
|
4411
4445
|
A: [
|
|
4412
4446
|
"this.dataSpaceManager",
|
|
@@ -4430,7 +4464,7 @@ var ServiceContext = class {
|
|
|
4430
4464
|
details: assertion
|
|
4431
4465
|
}, {
|
|
4432
4466
|
F: __dxlog_file15,
|
|
4433
|
-
L:
|
|
4467
|
+
L: 264,
|
|
4434
4468
|
S: this,
|
|
4435
4469
|
C: (f, a) => f(...a)
|
|
4436
4470
|
});
|
|
@@ -4441,7 +4475,7 @@ var ServiceContext = class {
|
|
|
4441
4475
|
details: assertion
|
|
4442
4476
|
}, {
|
|
4443
4477
|
F: __dxlog_file15,
|
|
4444
|
-
L:
|
|
4478
|
+
L: 268,
|
|
4445
4479
|
S: this,
|
|
4446
4480
|
C: (f, a) => f(...a)
|
|
4447
4481
|
});
|
|
@@ -4452,7 +4486,7 @@ var ServiceContext = class {
|
|
|
4452
4486
|
details: assertion
|
|
4453
4487
|
}, {
|
|
4454
4488
|
F: __dxlog_file15,
|
|
4455
|
-
L:
|
|
4489
|
+
L: 273,
|
|
4456
4490
|
S: this,
|
|
4457
4491
|
C: (f, a) => f(...a)
|
|
4458
4492
|
});
|
|
@@ -4463,7 +4497,7 @@ var ServiceContext = class {
|
|
|
4463
4497
|
} catch (err) {
|
|
4464
4498
|
log13.catch(err, void 0, {
|
|
4465
4499
|
F: __dxlog_file15,
|
|
4466
|
-
L:
|
|
4500
|
+
L: 279,
|
|
4467
4501
|
S: this,
|
|
4468
4502
|
C: (f, a) => f(...a)
|
|
4469
4503
|
});
|
|
@@ -4687,9 +4721,9 @@ import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protoc
|
|
|
4687
4721
|
import { Context as Context10 } from "@dxos/context";
|
|
4688
4722
|
import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
|
|
4689
4723
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
4690
|
-
import {
|
|
4691
|
-
import { invariant as
|
|
4692
|
-
import { PublicKey as
|
|
4724
|
+
import { getRawDoc, getAutomergeObjectCore } from "@dxos/echo-schema";
|
|
4725
|
+
import { invariant as invariant15 } from "@dxos/invariant";
|
|
4726
|
+
import { PublicKey as PublicKey12 } from "@dxos/keys";
|
|
4693
4727
|
import { log as log16 } from "@dxos/log";
|
|
4694
4728
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
4695
4729
|
import { ModelFactory } from "@dxos/model-factory";
|
|
@@ -4704,7 +4738,9 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
|
4704
4738
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
4705
4739
|
import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
4706
4740
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
4707
|
-
import {
|
|
4741
|
+
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4742
|
+
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4743
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
4708
4744
|
var DevicesServiceImpl = class {
|
|
4709
4745
|
constructor(_identityManager) {
|
|
4710
4746
|
this._identityManager = _identityManager;
|
|
@@ -4721,22 +4757,58 @@ var DevicesServiceImpl = class {
|
|
|
4721
4757
|
devices: []
|
|
4722
4758
|
});
|
|
4723
4759
|
} else {
|
|
4760
|
+
invariant14(this._identityManager.identity?.presence, "presence not present", {
|
|
4761
|
+
F: __dxlog_file17,
|
|
4762
|
+
L: 32,
|
|
4763
|
+
S: this,
|
|
4764
|
+
A: [
|
|
4765
|
+
"this._identityManager.identity?.presence",
|
|
4766
|
+
"'presence not present'"
|
|
4767
|
+
]
|
|
4768
|
+
});
|
|
4769
|
+
const peers = this._identityManager.identity.presence.getPeersOnline();
|
|
4724
4770
|
next({
|
|
4725
|
-
devices: Array.from(deviceKeys.entries()).map(([key, profile]) =>
|
|
4726
|
-
deviceKey
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4771
|
+
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
4772
|
+
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
4773
|
+
const peerState = peers.find((peer) => peer.identityKey.equals(key));
|
|
4774
|
+
return {
|
|
4775
|
+
deviceKey: key,
|
|
4776
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind2.CURRENT : DeviceKind2.TRUSTED,
|
|
4777
|
+
profile,
|
|
4778
|
+
presence: isMe ? Device2.PresenceState.ONLINE : peerState ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE
|
|
4779
|
+
};
|
|
4780
|
+
})
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
};
|
|
4784
|
+
let identitySubscribed = false;
|
|
4785
|
+
let presenceSubscribed = false;
|
|
4786
|
+
const subscribeIdentity = () => {
|
|
4787
|
+
if (!identitySubscribed) {
|
|
4788
|
+
this._identityManager.identity?.stateUpdate.on(() => {
|
|
4789
|
+
update();
|
|
4790
|
+
});
|
|
4791
|
+
identitySubscribed = true;
|
|
4792
|
+
}
|
|
4793
|
+
};
|
|
4794
|
+
const subscribePresence = () => {
|
|
4795
|
+
if (!presenceSubscribed) {
|
|
4796
|
+
this._identityManager.identity?.presence?.updated.on(() => {
|
|
4797
|
+
update();
|
|
4730
4798
|
});
|
|
4799
|
+
presenceSubscribed = true;
|
|
4731
4800
|
}
|
|
4732
4801
|
};
|
|
4733
4802
|
const subscriptions = new EventSubscriptions3();
|
|
4803
|
+
if (this._identityManager.identity) {
|
|
4804
|
+
subscribeIdentity();
|
|
4805
|
+
subscribePresence();
|
|
4806
|
+
}
|
|
4734
4807
|
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
4735
4808
|
update();
|
|
4736
4809
|
if (this._identityManager.identity) {
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
}));
|
|
4810
|
+
subscribeIdentity();
|
|
4811
|
+
subscribePresence();
|
|
4740
4812
|
}
|
|
4741
4813
|
}));
|
|
4742
4814
|
update();
|
|
@@ -4748,13 +4820,15 @@ var DevicesServiceImpl = class {
|
|
|
4748
4820
|
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
4749
4821
|
import { Event as Event7 } from "@dxos/async";
|
|
4750
4822
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
4823
|
+
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4751
4824
|
import { getContextFromEntry, log as log15 } from "@dxos/log";
|
|
4752
4825
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
4753
|
-
import { jsonify, numericalValues, tracer } from "@dxos/util";
|
|
4826
|
+
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
4754
4827
|
var LoggingServiceImpl = class {
|
|
4755
4828
|
constructor() {
|
|
4756
4829
|
this._logs = new Event7();
|
|
4757
|
-
this._started =
|
|
4830
|
+
this._started = Date.now();
|
|
4831
|
+
this._sessionId = PublicKey11.random().toHex();
|
|
4758
4832
|
this._logProcessor = (_config, entry2) => {
|
|
4759
4833
|
this._logs.emit(entry2);
|
|
4760
4834
|
};
|
|
@@ -4830,7 +4904,12 @@ var LoggingServiceImpl = class {
|
|
|
4830
4904
|
meta: {
|
|
4831
4905
|
// TODO(dmaretskyi): Fix proto.
|
|
4832
4906
|
file: entry2.meta?.F ?? "",
|
|
4833
|
-
line: entry2.meta?.L ?? 0
|
|
4907
|
+
line: entry2.meta?.L ?? 0,
|
|
4908
|
+
scope: {
|
|
4909
|
+
hostSessionId: this._sessionId,
|
|
4910
|
+
uptimeSeconds: (Date.now() - this._started) / 1e3,
|
|
4911
|
+
name: getDebugName(entry2.meta?.S)
|
|
4912
|
+
}
|
|
4834
4913
|
}
|
|
4835
4914
|
};
|
|
4836
4915
|
try {
|
|
@@ -4963,7 +5042,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
4963
5042
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4964
5043
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4965
5044
|
}
|
|
4966
|
-
var
|
|
5045
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
4967
5046
|
var createDefaultModelFactory = () => {
|
|
4968
5047
|
return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
|
|
4969
5048
|
};
|
|
@@ -4976,7 +5055,8 @@ var ClientServicesHost = class {
|
|
|
4976
5055
|
storage,
|
|
4977
5056
|
// TODO(wittjosiah): Turn this on by default.
|
|
4978
5057
|
lockKey,
|
|
4979
|
-
callbacks
|
|
5058
|
+
callbacks,
|
|
5059
|
+
runtimeParams
|
|
4980
5060
|
} = {}) {
|
|
4981
5061
|
this._tracingService = TRACE_PROCESSOR2.createTraceSender();
|
|
4982
5062
|
this._statusUpdate = new Event8();
|
|
@@ -4985,6 +5065,7 @@ var ClientServicesHost = class {
|
|
|
4985
5065
|
this._storage = storage;
|
|
4986
5066
|
this._modelFactory = modelFactory;
|
|
4987
5067
|
this._callbacks = callbacks;
|
|
5068
|
+
this._runtimeParams = runtimeParams;
|
|
4988
5069
|
if (config) {
|
|
4989
5070
|
this.initialize({
|
|
4990
5071
|
config,
|
|
@@ -5051,9 +5132,9 @@ var ClientServicesHost = class {
|
|
|
5051
5132
|
* Can only be called once.
|
|
5052
5133
|
*/
|
|
5053
5134
|
initialize({ config, ...options }) {
|
|
5054
|
-
|
|
5055
|
-
F:
|
|
5056
|
-
L:
|
|
5135
|
+
invariant15(!this._open, "service host is open", {
|
|
5136
|
+
F: __dxlog_file18,
|
|
5137
|
+
L: 190,
|
|
5057
5138
|
S: this,
|
|
5058
5139
|
A: [
|
|
5059
5140
|
"!this._open",
|
|
@@ -5061,15 +5142,15 @@ var ClientServicesHost = class {
|
|
|
5061
5142
|
]
|
|
5062
5143
|
});
|
|
5063
5144
|
log16("initializing...", void 0, {
|
|
5064
|
-
F:
|
|
5065
|
-
L:
|
|
5145
|
+
F: __dxlog_file18,
|
|
5146
|
+
L: 191,
|
|
5066
5147
|
S: this,
|
|
5067
5148
|
C: (f, a) => f(...a)
|
|
5068
5149
|
});
|
|
5069
5150
|
if (config) {
|
|
5070
|
-
|
|
5071
|
-
F:
|
|
5072
|
-
L:
|
|
5151
|
+
invariant15(!this._config, "config already set", {
|
|
5152
|
+
F: __dxlog_file18,
|
|
5153
|
+
L: 194,
|
|
5073
5154
|
S: this,
|
|
5074
5155
|
A: [
|
|
5075
5156
|
"!this._config",
|
|
@@ -5085,9 +5166,9 @@ var ClientServicesHost = class {
|
|
|
5085
5166
|
iceServers: this._config?.get("runtime.services.ice")
|
|
5086
5167
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
5087
5168
|
this._signalManager = signalManager;
|
|
5088
|
-
|
|
5089
|
-
F:
|
|
5090
|
-
L:
|
|
5169
|
+
invariant15(!this._networkManager, "network manager already set", {
|
|
5170
|
+
F: __dxlog_file18,
|
|
5171
|
+
L: 210,
|
|
5091
5172
|
S: this,
|
|
5092
5173
|
A: [
|
|
5093
5174
|
"!this._networkManager",
|
|
@@ -5100,8 +5181,8 @@ var ClientServicesHost = class {
|
|
|
5100
5181
|
signalManager
|
|
5101
5182
|
});
|
|
5102
5183
|
log16("initialized", void 0, {
|
|
5103
|
-
F:
|
|
5104
|
-
L:
|
|
5184
|
+
F: __dxlog_file18,
|
|
5185
|
+
L: 217,
|
|
5105
5186
|
S: this,
|
|
5106
5187
|
C: (f, a) => f(...a)
|
|
5107
5188
|
});
|
|
@@ -5110,45 +5191,45 @@ var ClientServicesHost = class {
|
|
|
5110
5191
|
if (this._open) {
|
|
5111
5192
|
return;
|
|
5112
5193
|
}
|
|
5113
|
-
const traceId =
|
|
5194
|
+
const traceId = PublicKey12.random().toHex();
|
|
5114
5195
|
log16.trace("dxos.client-services.host.open", trace9.begin({
|
|
5115
5196
|
id: traceId
|
|
5116
5197
|
}), {
|
|
5117
|
-
F:
|
|
5118
|
-
L:
|
|
5198
|
+
F: __dxlog_file18,
|
|
5199
|
+
L: 228,
|
|
5119
5200
|
S: this,
|
|
5120
5201
|
C: (f, a) => f(...a)
|
|
5121
5202
|
});
|
|
5122
|
-
|
|
5123
|
-
F:
|
|
5124
|
-
L:
|
|
5203
|
+
invariant15(this._config, "config not set", {
|
|
5204
|
+
F: __dxlog_file18,
|
|
5205
|
+
L: 230,
|
|
5125
5206
|
S: this,
|
|
5126
5207
|
A: [
|
|
5127
5208
|
"this._config",
|
|
5128
5209
|
"'config not set'"
|
|
5129
5210
|
]
|
|
5130
5211
|
});
|
|
5131
|
-
|
|
5132
|
-
F:
|
|
5133
|
-
L:
|
|
5212
|
+
invariant15(this._storage, "storage not set", {
|
|
5213
|
+
F: __dxlog_file18,
|
|
5214
|
+
L: 231,
|
|
5134
5215
|
S: this,
|
|
5135
5216
|
A: [
|
|
5136
5217
|
"this._storage",
|
|
5137
5218
|
"'storage not set'"
|
|
5138
5219
|
]
|
|
5139
5220
|
});
|
|
5140
|
-
|
|
5141
|
-
F:
|
|
5142
|
-
L:
|
|
5221
|
+
invariant15(this._signalManager, "signal manager not set", {
|
|
5222
|
+
F: __dxlog_file18,
|
|
5223
|
+
L: 232,
|
|
5143
5224
|
S: this,
|
|
5144
5225
|
A: [
|
|
5145
5226
|
"this._signalManager",
|
|
5146
5227
|
"'signal manager not set'"
|
|
5147
5228
|
]
|
|
5148
5229
|
});
|
|
5149
|
-
|
|
5150
|
-
F:
|
|
5151
|
-
L:
|
|
5230
|
+
invariant15(this._networkManager, "network manager not set", {
|
|
5231
|
+
F: __dxlog_file18,
|
|
5232
|
+
L: 233,
|
|
5152
5233
|
S: this,
|
|
5153
5234
|
A: [
|
|
5154
5235
|
"this._networkManager",
|
|
@@ -5159,14 +5240,14 @@ var ClientServicesHost = class {
|
|
|
5159
5240
|
log16("opening...", {
|
|
5160
5241
|
lockKey: this._resourceLock?.lockKey
|
|
5161
5242
|
}, {
|
|
5162
|
-
F:
|
|
5163
|
-
L:
|
|
5243
|
+
F: __dxlog_file18,
|
|
5244
|
+
L: 236,
|
|
5164
5245
|
S: this,
|
|
5165
5246
|
C: (f, a) => f(...a)
|
|
5166
5247
|
});
|
|
5167
5248
|
await this._resourceLock?.acquire();
|
|
5168
5249
|
await this._loggingService.open();
|
|
5169
|
-
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
5250
|
+
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory, this._runtimeParams);
|
|
5170
5251
|
this._serviceRegistry.setServices({
|
|
5171
5252
|
SystemService: this._systemService,
|
|
5172
5253
|
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring, (profile) => this._serviceContext.broadcastProfileUpdate(profile)),
|
|
@@ -5205,16 +5286,16 @@ var ClientServicesHost = class {
|
|
|
5205
5286
|
log16("opened", {
|
|
5206
5287
|
deviceKey
|
|
5207
5288
|
}, {
|
|
5208
|
-
F:
|
|
5209
|
-
L:
|
|
5289
|
+
F: __dxlog_file18,
|
|
5290
|
+
L: 310,
|
|
5210
5291
|
S: this,
|
|
5211
5292
|
C: (f, a) => f(...a)
|
|
5212
5293
|
});
|
|
5213
5294
|
log16.trace("dxos.client-services.host.open", trace9.end({
|
|
5214
5295
|
id: traceId
|
|
5215
5296
|
}), {
|
|
5216
|
-
F:
|
|
5217
|
-
L:
|
|
5297
|
+
F: __dxlog_file18,
|
|
5298
|
+
L: 311,
|
|
5218
5299
|
S: this,
|
|
5219
5300
|
C: (f, a) => f(...a)
|
|
5220
5301
|
});
|
|
@@ -5227,8 +5308,8 @@ var ClientServicesHost = class {
|
|
|
5227
5308
|
log16("closing...", {
|
|
5228
5309
|
deviceKey
|
|
5229
5310
|
}, {
|
|
5230
|
-
F:
|
|
5231
|
-
L:
|
|
5311
|
+
F: __dxlog_file18,
|
|
5312
|
+
L: 322,
|
|
5232
5313
|
S: this,
|
|
5233
5314
|
C: (f, a) => f(...a)
|
|
5234
5315
|
});
|
|
@@ -5243,41 +5324,41 @@ var ClientServicesHost = class {
|
|
|
5243
5324
|
log16("closed", {
|
|
5244
5325
|
deviceKey
|
|
5245
5326
|
}, {
|
|
5246
|
-
F:
|
|
5247
|
-
L:
|
|
5327
|
+
F: __dxlog_file18,
|
|
5328
|
+
L: 329,
|
|
5248
5329
|
S: this,
|
|
5249
5330
|
C: (f, a) => f(...a)
|
|
5250
5331
|
});
|
|
5251
5332
|
}
|
|
5252
5333
|
async reset() {
|
|
5253
|
-
const traceId =
|
|
5334
|
+
const traceId = PublicKey12.random().toHex();
|
|
5254
5335
|
log16.trace("dxos.sdk.client-services-host.reset", trace9.begin({
|
|
5255
5336
|
id: traceId
|
|
5256
5337
|
}), {
|
|
5257
|
-
F:
|
|
5258
|
-
L:
|
|
5338
|
+
F: __dxlog_file18,
|
|
5339
|
+
L: 334,
|
|
5259
5340
|
S: this,
|
|
5260
5341
|
C: (f, a) => f(...a)
|
|
5261
5342
|
});
|
|
5262
5343
|
log16("resetting...", void 0, {
|
|
5263
|
-
F:
|
|
5264
|
-
L:
|
|
5344
|
+
F: __dxlog_file18,
|
|
5345
|
+
L: 336,
|
|
5265
5346
|
S: this,
|
|
5266
5347
|
C: (f, a) => f(...a)
|
|
5267
5348
|
});
|
|
5268
5349
|
await this._serviceContext?.close();
|
|
5269
5350
|
await this._storage.reset();
|
|
5270
5351
|
log16("reset", void 0, {
|
|
5271
|
-
F:
|
|
5272
|
-
L:
|
|
5352
|
+
F: __dxlog_file18,
|
|
5353
|
+
L: 339,
|
|
5273
5354
|
S: this,
|
|
5274
5355
|
C: (f, a) => f(...a)
|
|
5275
5356
|
});
|
|
5276
5357
|
log16.trace("dxos.sdk.client-services-host.reset", trace9.end({
|
|
5277
5358
|
id: traceId
|
|
5278
5359
|
}), {
|
|
5279
|
-
F:
|
|
5280
|
-
L:
|
|
5360
|
+
F: __dxlog_file18,
|
|
5361
|
+
L: 340,
|
|
5281
5362
|
S: this,
|
|
5282
5363
|
C: (f, a) => f(...a)
|
|
5283
5364
|
});
|
|
@@ -5290,9 +5371,9 @@ var ClientServicesHost = class {
|
|
|
5290
5371
|
const obj = new Properties(void 0);
|
|
5291
5372
|
obj[defaultKey] = identity.identityKey.toHex();
|
|
5292
5373
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5293
|
-
|
|
5294
|
-
F:
|
|
5295
|
-
L:
|
|
5374
|
+
invariant15(automergeIndex, void 0, {
|
|
5375
|
+
F: __dxlog_file18,
|
|
5376
|
+
L: 355,
|
|
5296
5377
|
S: this,
|
|
5297
5378
|
A: [
|
|
5298
5379
|
"automergeIndex",
|
|
@@ -5304,7 +5385,7 @@ var ClientServicesHost = class {
|
|
|
5304
5385
|
document.change((doc) => {
|
|
5305
5386
|
assignDeep(doc, [
|
|
5306
5387
|
"objects",
|
|
5307
|
-
obj
|
|
5388
|
+
getAutomergeObjectCore(obj).id
|
|
5308
5389
|
], getRawDoc(obj).handle.docSync());
|
|
5309
5390
|
});
|
|
5310
5391
|
return identity;
|
|
@@ -5362,4 +5443,4 @@ export {
|
|
|
5362
5443
|
createDefaultModelFactory,
|
|
5363
5444
|
ClientServicesHost
|
|
5364
5445
|
};
|
|
5365
|
-
//# sourceMappingURL=chunk-
|
|
5446
|
+
//# sourceMappingURL=chunk-KGSDIFCK.mjs.map
|