@dxos/client-services 0.1.55 → 0.1.56-main.09ca29d
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-XSZIBW37.mjs → chunk-FD4L7N4K.mjs} +677 -293
- package/dist/lib/browser/chunk-FD4L7N4K.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +50 -33
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +12 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +729 -330
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +691 -300
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +33 -33
- package/src/packlets/identity/authenticator.test.ts +2 -2
- package/src/packlets/identity/identity-manager.ts +1 -2
- package/src/packlets/identity/identity-service.ts +1 -2
- package/src/packlets/identity/identity.ts +1 -2
- package/src/packlets/invitations/device-invitation-protocol.ts +1 -2
- package/src/packlets/invitations/invitation-extension.ts +1 -2
- package/src/packlets/invitations/invitations-handler.ts +1 -2
- package/src/packlets/invitations/invitations-service.ts +1 -2
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -2
- package/src/packlets/locks/node.ts +1 -1
- package/src/packlets/services/service-context.ts +1 -2
- package/src/packlets/services/service-host.ts +1 -2
- package/src/packlets/spaces/data-space-manager.ts +2 -3
- package/src/packlets/spaces/notarization-plugin.ts +1 -2
- package/src/packlets/spaces/spaces-service.ts +18 -12
- package/src/packlets/testing/invitation-utils.ts +1 -2
- package/src/packlets/vault/shell-runtime.ts +1 -2
- package/src/packlets/vault/worker-session.ts +1 -2
- package/dist/lib/browser/chunk-XSZIBW37.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// packages/sdk/client-services/src/index.ts
|
|
@@ -420,7 +410,7 @@ var import_context2 = require("@dxos/context");
|
|
|
420
410
|
var import_credentials = require("@dxos/credentials");
|
|
421
411
|
var import_log = require("@dxos/log");
|
|
422
412
|
var import_protocols = require("@dxos/protocols");
|
|
423
|
-
var __dxlog_file = "/
|
|
413
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
424
414
|
var Credential = import_protocols.schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
425
415
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
426
416
|
const credential = await signer.createCredential({
|
|
@@ -531,15 +521,15 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
531
521
|
};
|
|
532
522
|
|
|
533
523
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
534
|
-
var import_tiny_invariant = __toESM(require("tiny-invariant"));
|
|
535
524
|
var import_async5 = require("@dxos/async");
|
|
536
525
|
var import_client_protocol = require("@dxos/client-protocol");
|
|
537
526
|
var import_credentials2 = require("@dxos/credentials");
|
|
538
527
|
var import_debug = require("@dxos/debug");
|
|
539
528
|
var import_feed_store2 = require("@dxos/feed-store");
|
|
529
|
+
var import_invariant = require("@dxos/invariant");
|
|
540
530
|
var import_log2 = require("@dxos/log");
|
|
541
531
|
var import_credentials3 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
542
|
-
var __dxlog_file2 = "/
|
|
532
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
543
533
|
var Identity = class {
|
|
544
534
|
constructor({ space, signer, identityKey, deviceKey }) {
|
|
545
535
|
this.stateUpdate = new import_async5.Event();
|
|
@@ -614,7 +604,15 @@ var Identity = class {
|
|
|
614
604
|
* Requires identity to be ready.
|
|
615
605
|
*/
|
|
616
606
|
getIdentityCredentialSigner() {
|
|
617
|
-
(0,
|
|
607
|
+
(0, import_invariant.invariant)(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
608
|
+
F: __dxlog_file2,
|
|
609
|
+
L: 134,
|
|
610
|
+
S: this,
|
|
611
|
+
A: [
|
|
612
|
+
"this._deviceStateMachine.deviceCredentialChain",
|
|
613
|
+
"'Device credential chain is not ready.'"
|
|
614
|
+
]
|
|
615
|
+
});
|
|
618
616
|
return (0, import_credentials2.createCredentialSignerWithChain)(this._signer, this._deviceStateMachine.deviceCredentialChain, this.deviceKey);
|
|
619
617
|
}
|
|
620
618
|
/**
|
|
@@ -632,7 +630,7 @@ var Identity = class {
|
|
|
632
630
|
dataFeedKey
|
|
633
631
|
}, {
|
|
634
632
|
F: __dxlog_file2,
|
|
635
|
-
L:
|
|
633
|
+
L: 150,
|
|
636
634
|
S: this,
|
|
637
635
|
C: (f, a) => f(...a)
|
|
638
636
|
});
|
|
@@ -675,15 +673,15 @@ var Identity = class {
|
|
|
675
673
|
};
|
|
676
674
|
|
|
677
675
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
678
|
-
var import_tiny_invariant2 = __toESM(require("tiny-invariant"));
|
|
679
676
|
var import_async6 = require("@dxos/async");
|
|
680
677
|
var import_credentials4 = require("@dxos/credentials");
|
|
678
|
+
var import_invariant2 = require("@dxos/invariant");
|
|
681
679
|
var import_keys4 = require("@dxos/keys");
|
|
682
680
|
var import_log3 = require("@dxos/log");
|
|
683
681
|
var import_protocols2 = require("@dxos/protocols");
|
|
684
682
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
685
683
|
var import_util2 = require("@dxos/util");
|
|
686
|
-
var __dxlog_file3 = "/
|
|
684
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
687
685
|
var IdentityManager = class {
|
|
688
686
|
// TODO(burdon): IdentityManagerParams.
|
|
689
687
|
// TODO(dmaretskyi): Perhaps this should take/generate the peerKey outside of an initialized identity.
|
|
@@ -704,7 +702,7 @@ var IdentityManager = class {
|
|
|
704
702
|
id: traceId
|
|
705
703
|
}), {
|
|
706
704
|
F: __dxlog_file3,
|
|
707
|
-
L:
|
|
705
|
+
L: 69,
|
|
708
706
|
S: this,
|
|
709
707
|
C: (f, a) => f(...a)
|
|
710
708
|
});
|
|
@@ -714,7 +712,7 @@ var IdentityManager = class {
|
|
|
714
712
|
identityRecord
|
|
715
713
|
}, {
|
|
716
714
|
F: __dxlog_file3,
|
|
717
|
-
L:
|
|
715
|
+
L: 73,
|
|
718
716
|
S: this,
|
|
719
717
|
C: (f, a) => f(...a)
|
|
720
718
|
});
|
|
@@ -727,7 +725,7 @@ var IdentityManager = class {
|
|
|
727
725
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
728
726
|
}, {
|
|
729
727
|
F: __dxlog_file3,
|
|
730
|
-
L:
|
|
728
|
+
L: 78,
|
|
731
729
|
S: this,
|
|
732
730
|
C: (f, a) => f(...a)
|
|
733
731
|
});
|
|
@@ -737,7 +735,7 @@ var IdentityManager = class {
|
|
|
737
735
|
id: traceId
|
|
738
736
|
}), {
|
|
739
737
|
F: __dxlog_file3,
|
|
740
|
-
L:
|
|
738
|
+
L: 84,
|
|
741
739
|
S: this,
|
|
742
740
|
C: (f, a) => f(...a)
|
|
743
741
|
});
|
|
@@ -748,10 +746,18 @@ var IdentityManager = class {
|
|
|
748
746
|
}
|
|
749
747
|
async createIdentity({ displayName } = {}) {
|
|
750
748
|
var _a;
|
|
751
|
-
(0,
|
|
749
|
+
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
750
|
+
F: __dxlog_file3,
|
|
751
|
+
L: 92,
|
|
752
|
+
S: this,
|
|
753
|
+
A: [
|
|
754
|
+
"!this._identity",
|
|
755
|
+
"'Identity already exists.'"
|
|
756
|
+
]
|
|
757
|
+
});
|
|
752
758
|
(0, import_log3.log)("creating identity...", void 0, {
|
|
753
759
|
F: __dxlog_file3,
|
|
754
|
-
L:
|
|
760
|
+
L: 93,
|
|
755
761
|
S: this,
|
|
756
762
|
C: (f, a) => f(...a)
|
|
757
763
|
});
|
|
@@ -770,8 +776,24 @@ var IdentityManager = class {
|
|
|
770
776
|
await identity.open();
|
|
771
777
|
{
|
|
772
778
|
const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
773
|
-
(0,
|
|
774
|
-
|
|
779
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
780
|
+
F: __dxlog_file3,
|
|
781
|
+
L: 112,
|
|
782
|
+
S: this,
|
|
783
|
+
A: [
|
|
784
|
+
"identityRecord.haloSpace.genesisFeedKey",
|
|
785
|
+
"'Genesis feed key is required.'"
|
|
786
|
+
]
|
|
787
|
+
});
|
|
788
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
789
|
+
F: __dxlog_file3,
|
|
790
|
+
L: 113,
|
|
791
|
+
S: this,
|
|
792
|
+
A: [
|
|
793
|
+
"identityRecord.haloSpace.dataFeedKey",
|
|
794
|
+
"'Data feed key is required.'"
|
|
795
|
+
]
|
|
796
|
+
});
|
|
775
797
|
const credentials = [
|
|
776
798
|
// Space genesis.
|
|
777
799
|
...await generator.createSpaceGenesis(identityRecord.haloSpace.key, identityRecord.haloSpace.genesisFeedKey),
|
|
@@ -800,7 +822,7 @@ var IdentityManager = class {
|
|
|
800
822
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
801
823
|
}, {
|
|
802
824
|
F: __dxlog_file3,
|
|
803
|
-
L:
|
|
825
|
+
L: 148,
|
|
804
826
|
S: this,
|
|
805
827
|
C: (f, a) => f(...a)
|
|
806
828
|
});
|
|
@@ -810,7 +832,7 @@ var IdentityManager = class {
|
|
|
810
832
|
deviceKey: identity.deviceKey
|
|
811
833
|
}, {
|
|
812
834
|
F: __dxlog_file3,
|
|
813
|
-
L:
|
|
835
|
+
L: 154,
|
|
814
836
|
S: this,
|
|
815
837
|
C: (f, a) => f(...a)
|
|
816
838
|
});
|
|
@@ -825,11 +847,19 @@ var IdentityManager = class {
|
|
|
825
847
|
params
|
|
826
848
|
}, {
|
|
827
849
|
F: __dxlog_file3,
|
|
828
|
-
L:
|
|
850
|
+
L: 162,
|
|
829
851
|
S: this,
|
|
830
852
|
C: (f, a) => f(...a)
|
|
831
853
|
});
|
|
832
|
-
(0,
|
|
854
|
+
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
855
|
+
F: __dxlog_file3,
|
|
856
|
+
L: 163,
|
|
857
|
+
S: this,
|
|
858
|
+
A: [
|
|
859
|
+
"!this._identity",
|
|
860
|
+
"'Identity already exists.'"
|
|
861
|
+
]
|
|
862
|
+
});
|
|
833
863
|
const identityRecord = {
|
|
834
864
|
identityKey: params.identityKey,
|
|
835
865
|
deviceKey: params.deviceKey,
|
|
@@ -851,7 +881,7 @@ var IdentityManager = class {
|
|
|
851
881
|
displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
|
|
852
882
|
}, {
|
|
853
883
|
F: __dxlog_file3,
|
|
854
|
-
L:
|
|
884
|
+
L: 182,
|
|
855
885
|
S: this,
|
|
856
886
|
C: (f, a) => f(...a)
|
|
857
887
|
});
|
|
@@ -861,27 +891,51 @@ var IdentityManager = class {
|
|
|
861
891
|
deviceKey: identity.deviceKey
|
|
862
892
|
}, {
|
|
863
893
|
F: __dxlog_file3,
|
|
864
|
-
L:
|
|
894
|
+
L: 188,
|
|
865
895
|
S: this,
|
|
866
896
|
C: (f, a) => f(...a)
|
|
867
897
|
});
|
|
868
898
|
return identity;
|
|
869
899
|
}
|
|
870
900
|
async _constructIdentity(identityRecord) {
|
|
871
|
-
(0,
|
|
901
|
+
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
902
|
+
F: __dxlog_file3,
|
|
903
|
+
L: 193,
|
|
904
|
+
S: this,
|
|
905
|
+
A: [
|
|
906
|
+
"!this._identity",
|
|
907
|
+
""
|
|
908
|
+
]
|
|
909
|
+
});
|
|
872
910
|
(0, import_log3.log)("constructing identity", {
|
|
873
911
|
identityRecord
|
|
874
912
|
}, {
|
|
875
913
|
F: __dxlog_file3,
|
|
876
|
-
L:
|
|
914
|
+
L: 194,
|
|
877
915
|
S: this,
|
|
878
916
|
C: (f, a) => f(...a)
|
|
879
917
|
});
|
|
880
|
-
(0,
|
|
918
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
919
|
+
F: __dxlog_file3,
|
|
920
|
+
L: 197,
|
|
921
|
+
S: this,
|
|
922
|
+
A: [
|
|
923
|
+
"identityRecord.haloSpace.controlFeedKey",
|
|
924
|
+
""
|
|
925
|
+
]
|
|
926
|
+
});
|
|
881
927
|
const controlFeed = await this._feedStore.openFeed(identityRecord.haloSpace.controlFeedKey, {
|
|
882
928
|
writable: true
|
|
883
929
|
});
|
|
884
|
-
(0,
|
|
930
|
+
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
931
|
+
F: __dxlog_file3,
|
|
932
|
+
L: 201,
|
|
933
|
+
S: this,
|
|
934
|
+
A: [
|
|
935
|
+
"identityRecord.haloSpace.dataFeedKey",
|
|
936
|
+
""
|
|
937
|
+
]
|
|
938
|
+
});
|
|
885
939
|
const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
|
|
886
940
|
writable: true,
|
|
887
941
|
sparse: true
|
|
@@ -907,7 +961,7 @@ var IdentityManager = class {
|
|
|
907
961
|
identityKey: identityRecord.identityKey
|
|
908
962
|
}, {
|
|
909
963
|
F: __dxlog_file3,
|
|
910
|
-
L:
|
|
964
|
+
L: 225,
|
|
911
965
|
S: this,
|
|
912
966
|
C: (f, a) => f(...a)
|
|
913
967
|
});
|
|
@@ -928,7 +982,7 @@ var IdentityManager = class {
|
|
|
928
982
|
onAuthFailure: () => {
|
|
929
983
|
import_log3.log.warn("auth failure", void 0, {
|
|
930
984
|
F: __dxlog_file3,
|
|
931
|
-
L:
|
|
985
|
+
L: 244,
|
|
932
986
|
S: this,
|
|
933
987
|
C: (f, a) => f(...a)
|
|
934
988
|
});
|
|
@@ -939,10 +993,11 @@ var IdentityManager = class {
|
|
|
939
993
|
};
|
|
940
994
|
|
|
941
995
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
942
|
-
var import_tiny_invariant3 = __toESM(require("tiny-invariant"));
|
|
943
996
|
var import_codec_protobuf7 = require("@dxos/codec-protobuf");
|
|
944
997
|
var import_credentials6 = require("@dxos/credentials");
|
|
945
998
|
var import_debug2 = require("@dxos/debug");
|
|
999
|
+
var import_invariant3 = require("@dxos/invariant");
|
|
1000
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
946
1001
|
var IdentityServiceImpl = class {
|
|
947
1002
|
// TODO(wittjosiah): Remove dependency on service context.
|
|
948
1003
|
constructor(_serviceContext) {
|
|
@@ -975,7 +1030,15 @@ var IdentityServiceImpl = class {
|
|
|
975
1030
|
};
|
|
976
1031
|
}
|
|
977
1032
|
async signPresentation({ presentation, nonce }) {
|
|
978
|
-
(0,
|
|
1033
|
+
(0, import_invariant3.invariant)(this._serviceContext.identityManager.identity, "Identity not initialized.", {
|
|
1034
|
+
F: __dxlog_file4,
|
|
1035
|
+
L: 56,
|
|
1036
|
+
S: this,
|
|
1037
|
+
A: [
|
|
1038
|
+
"this._serviceContext.identityManager.identity",
|
|
1039
|
+
"'Identity not initialized.'"
|
|
1040
|
+
]
|
|
1041
|
+
});
|
|
979
1042
|
return await (0, import_credentials6.signPresentation)({
|
|
980
1043
|
presentation,
|
|
981
1044
|
signer: this._serviceContext.keyring,
|
|
@@ -987,8 +1050,9 @@ var IdentityServiceImpl = class {
|
|
|
987
1050
|
};
|
|
988
1051
|
|
|
989
1052
|
// packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts
|
|
990
|
-
var
|
|
1053
|
+
var import_invariant4 = require("@dxos/invariant");
|
|
991
1054
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
1055
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
992
1056
|
var DeviceInvitationProtocol = class {
|
|
993
1057
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
994
1058
|
this._keyring = _keyring;
|
|
@@ -1004,7 +1068,15 @@ var DeviceInvitationProtocol = class {
|
|
|
1004
1068
|
};
|
|
1005
1069
|
}
|
|
1006
1070
|
async admit(request) {
|
|
1007
|
-
(0,
|
|
1071
|
+
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1072
|
+
F: __dxlog_file5,
|
|
1073
|
+
L: 31,
|
|
1074
|
+
S: this,
|
|
1075
|
+
A: [
|
|
1076
|
+
"request.device",
|
|
1077
|
+
""
|
|
1078
|
+
]
|
|
1079
|
+
});
|
|
1008
1080
|
const identity = this._getIdentity();
|
|
1009
1081
|
await identity.admitDevice(request.device);
|
|
1010
1082
|
return {
|
|
@@ -1032,9 +1104,25 @@ var DeviceInvitationProtocol = class {
|
|
|
1032
1104
|
};
|
|
1033
1105
|
}
|
|
1034
1106
|
async accept(response, request) {
|
|
1035
|
-
(0,
|
|
1107
|
+
(0, import_invariant4.invariant)(response.device, void 0, {
|
|
1108
|
+
F: __dxlog_file5,
|
|
1109
|
+
L: 64,
|
|
1110
|
+
S: this,
|
|
1111
|
+
A: [
|
|
1112
|
+
"response.device",
|
|
1113
|
+
""
|
|
1114
|
+
]
|
|
1115
|
+
});
|
|
1036
1116
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1037
|
-
(0,
|
|
1117
|
+
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1118
|
+
F: __dxlog_file5,
|
|
1119
|
+
L: 67,
|
|
1120
|
+
S: this,
|
|
1121
|
+
A: [
|
|
1122
|
+
"request.device",
|
|
1123
|
+
""
|
|
1124
|
+
]
|
|
1125
|
+
});
|
|
1038
1126
|
const { deviceKey, controlFeedKey, dataFeedKey } = request.device;
|
|
1039
1127
|
await this._acceptIdentity({
|
|
1040
1128
|
identityKey,
|
|
@@ -1052,12 +1140,12 @@ var DeviceInvitationProtocol = class {
|
|
|
1052
1140
|
};
|
|
1053
1141
|
|
|
1054
1142
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1055
|
-
var import_tiny_invariant6 = __toESM(require("tiny-invariant"));
|
|
1056
1143
|
var import_async8 = require("@dxos/async");
|
|
1057
1144
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
1058
1145
|
var import_context4 = require("@dxos/context");
|
|
1059
1146
|
var import_credentials7 = require("@dxos/credentials");
|
|
1060
1147
|
var import_errors2 = require("@dxos/errors");
|
|
1148
|
+
var import_invariant6 = require("@dxos/invariant");
|
|
1061
1149
|
var import_keys6 = require("@dxos/keys");
|
|
1062
1150
|
var import_log5 = require("@dxos/log");
|
|
1063
1151
|
var import_network_manager = require("@dxos/network-manager");
|
|
@@ -1066,17 +1154,17 @@ var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
1066
1154
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1067
1155
|
|
|
1068
1156
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1069
|
-
var import_tiny_invariant5 = __toESM(require("tiny-invariant"));
|
|
1070
1157
|
var import_async7 = require("@dxos/async");
|
|
1071
1158
|
var import_context3 = require("@dxos/context");
|
|
1072
1159
|
var import_errors = require("@dxos/errors");
|
|
1160
|
+
var import_invariant5 = require("@dxos/invariant");
|
|
1073
1161
|
var import_keys5 = require("@dxos/keys");
|
|
1074
1162
|
var import_log4 = require("@dxos/log");
|
|
1075
1163
|
var import_protocols3 = require("@dxos/protocols");
|
|
1076
1164
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1077
1165
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
1078
1166
|
var import_teleport = require("@dxos/teleport");
|
|
1079
|
-
var
|
|
1167
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts";
|
|
1080
1168
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1081
1169
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1082
1170
|
var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
@@ -1104,7 +1192,15 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1104
1192
|
// Perhaps in the future we will have more complex logic here.
|
|
1105
1193
|
InvitationHostService: {
|
|
1106
1194
|
options: async (options) => {
|
|
1107
|
-
(0,
|
|
1195
|
+
(0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1196
|
+
F: __dxlog_file6,
|
|
1197
|
+
L: 88,
|
|
1198
|
+
S: this,
|
|
1199
|
+
A: [
|
|
1200
|
+
"!this._remoteOptions",
|
|
1201
|
+
"'Remote options already set.'"
|
|
1202
|
+
]
|
|
1203
|
+
});
|
|
1108
1204
|
this._remoteOptions = options;
|
|
1109
1205
|
this._remoteOptionsTrigger.wake();
|
|
1110
1206
|
},
|
|
@@ -1114,8 +1210,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1114
1210
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
|
|
1115
1211
|
id: traceId
|
|
1116
1212
|
}), {
|
|
1117
|
-
F:
|
|
1118
|
-
L:
|
|
1213
|
+
F: __dxlog_file6,
|
|
1214
|
+
L: 97,
|
|
1119
1215
|
S: this,
|
|
1120
1216
|
C: (f, a) => f(...a)
|
|
1121
1217
|
});
|
|
@@ -1124,8 +1220,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1124
1220
|
import_log4.log.warn("invitation not found", {
|
|
1125
1221
|
invitationId
|
|
1126
1222
|
}, {
|
|
1127
|
-
F:
|
|
1128
|
-
L:
|
|
1223
|
+
F: __dxlog_file6,
|
|
1224
|
+
L: 101,
|
|
1129
1225
|
S: this,
|
|
1130
1226
|
C: (f, a) => f(...a)
|
|
1131
1227
|
});
|
|
@@ -1138,8 +1234,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1138
1234
|
(0, import_log4.log)("guest introduced itself", {
|
|
1139
1235
|
guestProfile: profile
|
|
1140
1236
|
}, {
|
|
1141
|
-
F:
|
|
1142
|
-
L:
|
|
1237
|
+
F: __dxlog_file6,
|
|
1238
|
+
L: 110,
|
|
1143
1239
|
S: this,
|
|
1144
1240
|
C: (f, a) => f(...a)
|
|
1145
1241
|
});
|
|
@@ -1151,8 +1247,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1151
1247
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
|
|
1152
1248
|
id: traceId
|
|
1153
1249
|
}), {
|
|
1154
|
-
F:
|
|
1155
|
-
L:
|
|
1250
|
+
F: __dxlog_file6,
|
|
1251
|
+
L: 117,
|
|
1156
1252
|
S: this,
|
|
1157
1253
|
C: (f, a) => f(...a)
|
|
1158
1254
|
});
|
|
@@ -1166,26 +1262,34 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1166
1262
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
|
|
1167
1263
|
id: traceId
|
|
1168
1264
|
}), {
|
|
1169
|
-
F:
|
|
1170
|
-
L:
|
|
1265
|
+
F: __dxlog_file6,
|
|
1266
|
+
L: 126,
|
|
1171
1267
|
S: this,
|
|
1172
1268
|
C: (f, a) => f(...a)
|
|
1173
1269
|
});
|
|
1174
1270
|
(0, import_log4.log)("received authentication request", {
|
|
1175
1271
|
authCode: code
|
|
1176
1272
|
}, {
|
|
1177
|
-
F:
|
|
1178
|
-
L:
|
|
1273
|
+
F: __dxlog_file6,
|
|
1274
|
+
L: 127,
|
|
1179
1275
|
S: this,
|
|
1180
1276
|
C: (f, a) => f(...a)
|
|
1181
1277
|
});
|
|
1182
1278
|
let status = import_invitations.AuthenticationResponse.Status.OK;
|
|
1183
|
-
(0,
|
|
1279
|
+
(0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
|
|
1280
|
+
F: __dxlog_file6,
|
|
1281
|
+
L: 130,
|
|
1282
|
+
S: this,
|
|
1283
|
+
A: [
|
|
1284
|
+
"this.invitation",
|
|
1285
|
+
"'Invitation is not set.'"
|
|
1286
|
+
]
|
|
1287
|
+
});
|
|
1184
1288
|
switch (this.invitation.authMethod) {
|
|
1185
1289
|
case import_services2.Invitation.AuthMethod.NONE: {
|
|
1186
1290
|
(0, import_log4.log)("authentication not required", void 0, {
|
|
1187
|
-
F:
|
|
1188
|
-
L:
|
|
1291
|
+
F: __dxlog_file6,
|
|
1292
|
+
L: 133,
|
|
1189
1293
|
S: this,
|
|
1190
1294
|
C: (f, a) => f(...a)
|
|
1191
1295
|
});
|
|
@@ -1209,8 +1313,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1209
1313
|
import_log4.log.error("invalid authentication method", {
|
|
1210
1314
|
authMethod: this.invitation.authMethod
|
|
1211
1315
|
}, {
|
|
1212
|
-
F:
|
|
1213
|
-
L:
|
|
1316
|
+
F: __dxlog_file6,
|
|
1317
|
+
L: 151,
|
|
1214
1318
|
S: this,
|
|
1215
1319
|
C: (f, a) => f(...a)
|
|
1216
1320
|
});
|
|
@@ -1224,8 +1328,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1224
1328
|
status
|
|
1225
1329
|
}
|
|
1226
1330
|
}), {
|
|
1227
|
-
F:
|
|
1228
|
-
L:
|
|
1331
|
+
F: __dxlog_file6,
|
|
1332
|
+
L: 157,
|
|
1229
1333
|
S: this,
|
|
1230
1334
|
C: (f, a) => f(...a)
|
|
1231
1335
|
});
|
|
@@ -1238,13 +1342,21 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1238
1342
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
|
|
1239
1343
|
id: traceId
|
|
1240
1344
|
}), {
|
|
1241
|
-
F:
|
|
1242
|
-
L:
|
|
1345
|
+
F: __dxlog_file6,
|
|
1346
|
+
L: 163,
|
|
1243
1347
|
S: this,
|
|
1244
1348
|
C: (f, a) => f(...a)
|
|
1245
1349
|
});
|
|
1246
1350
|
try {
|
|
1247
|
-
(0,
|
|
1351
|
+
(0, import_invariant5.invariant)(this.invitation, "Invitation is not set.", {
|
|
1352
|
+
F: __dxlog_file6,
|
|
1353
|
+
L: 166,
|
|
1354
|
+
S: this,
|
|
1355
|
+
A: [
|
|
1356
|
+
"this.invitation",
|
|
1357
|
+
"'Invitation is not set.'"
|
|
1358
|
+
]
|
|
1359
|
+
});
|
|
1248
1360
|
if (isAuthenticationRequired(this.invitation) && !this.authenticationPassed) {
|
|
1249
1361
|
throw new Error("Not authenticated");
|
|
1250
1362
|
}
|
|
@@ -1252,8 +1364,8 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1252
1364
|
import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
|
|
1253
1365
|
id: traceId
|
|
1254
1366
|
}), {
|
|
1255
|
-
F:
|
|
1256
|
-
L:
|
|
1367
|
+
F: __dxlog_file6,
|
|
1368
|
+
L: 174,
|
|
1257
1369
|
S: this,
|
|
1258
1370
|
C: (f, a) => f(...a)
|
|
1259
1371
|
});
|
|
@@ -1309,7 +1421,15 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1309
1421
|
return {
|
|
1310
1422
|
InvitationHostService: {
|
|
1311
1423
|
options: async (options) => {
|
|
1312
|
-
(0,
|
|
1424
|
+
(0, import_invariant5.invariant)(!this._remoteOptions, "Remote options already set.", {
|
|
1425
|
+
F: __dxlog_file6,
|
|
1426
|
+
L: 241,
|
|
1427
|
+
S: this,
|
|
1428
|
+
A: [
|
|
1429
|
+
"!this._remoteOptions",
|
|
1430
|
+
"'Remote options already set.'"
|
|
1431
|
+
]
|
|
1432
|
+
});
|
|
1313
1433
|
this._remoteOptions = options;
|
|
1314
1434
|
this._remoteOptionsTrigger.wake();
|
|
1315
1435
|
},
|
|
@@ -1330,8 +1450,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1330
1450
|
await super.onOpen(context);
|
|
1331
1451
|
try {
|
|
1332
1452
|
(0, import_log4.log)("begin options", void 0, {
|
|
1333
|
-
F:
|
|
1334
|
-
L:
|
|
1453
|
+
F: __dxlog_file6,
|
|
1454
|
+
L: 262,
|
|
1335
1455
|
S: this,
|
|
1336
1456
|
C: (f, a) => f(...a)
|
|
1337
1457
|
});
|
|
@@ -1342,8 +1462,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1342
1462
|
timeout: OPTIONS_TIMEOUT
|
|
1343
1463
|
}));
|
|
1344
1464
|
(0, import_log4.log)("end options", void 0, {
|
|
1345
|
-
F:
|
|
1346
|
-
L:
|
|
1465
|
+
F: __dxlog_file6,
|
|
1466
|
+
L: 265,
|
|
1347
1467
|
S: this,
|
|
1348
1468
|
C: (f, a) => f(...a)
|
|
1349
1469
|
});
|
|
@@ -1356,8 +1476,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1356
1476
|
this._callbacks.onOpen(this._ctx);
|
|
1357
1477
|
} catch (err) {
|
|
1358
1478
|
(0, import_log4.log)("openError", err, {
|
|
1359
|
-
F:
|
|
1360
|
-
L:
|
|
1479
|
+
F: __dxlog_file6,
|
|
1480
|
+
L: 275,
|
|
1361
1481
|
S: this,
|
|
1362
1482
|
C: (f, a) => f(...a)
|
|
1363
1483
|
});
|
|
@@ -1366,8 +1486,8 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1366
1486
|
}
|
|
1367
1487
|
async onClose() {
|
|
1368
1488
|
(0, import_log4.log)("onClose", void 0, {
|
|
1369
|
-
F:
|
|
1370
|
-
L:
|
|
1489
|
+
F: __dxlog_file6,
|
|
1490
|
+
L: 281,
|
|
1371
1491
|
S: this,
|
|
1372
1492
|
C: (f, a) => f(...a)
|
|
1373
1493
|
});
|
|
@@ -1377,7 +1497,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1377
1497
|
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services2.Invitation.AuthMethod.NONE;
|
|
1378
1498
|
|
|
1379
1499
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1380
|
-
var
|
|
1500
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
1381
1501
|
var InvitationsHandler = class {
|
|
1382
1502
|
/**
|
|
1383
1503
|
* @internal
|
|
@@ -1389,7 +1509,15 @@ var InvitationsHandler = class {
|
|
|
1389
1509
|
var _a;
|
|
1390
1510
|
const { invitationId = import_keys6.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys6.PublicKey.random() } = options != null ? options : {};
|
|
1391
1511
|
const authCode = (_a = options == null ? void 0 : options.authCode) != null ? _a : authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0;
|
|
1392
|
-
(0,
|
|
1512
|
+
(0, import_invariant6.invariant)(protocol, void 0, {
|
|
1513
|
+
F: __dxlog_file7,
|
|
1514
|
+
L: 76,
|
|
1515
|
+
S: this,
|
|
1516
|
+
A: [
|
|
1517
|
+
"protocol",
|
|
1518
|
+
""
|
|
1519
|
+
]
|
|
1520
|
+
});
|
|
1393
1521
|
const invitation = {
|
|
1394
1522
|
invitationId,
|
|
1395
1523
|
type,
|
|
@@ -1411,8 +1539,8 @@ var InvitationsHandler = class {
|
|
|
1411
1539
|
(0, import_log5.log)("complete", {
|
|
1412
1540
|
...protocol.toJSON()
|
|
1413
1541
|
}, {
|
|
1414
|
-
F:
|
|
1415
|
-
L:
|
|
1542
|
+
F: __dxlog_file7,
|
|
1543
|
+
L: 98,
|
|
1416
1544
|
S: this,
|
|
1417
1545
|
C: (f, a) => f(...a)
|
|
1418
1546
|
});
|
|
@@ -1436,7 +1564,15 @@ var InvitationsHandler = class {
|
|
|
1436
1564
|
var _a2, _b, _c;
|
|
1437
1565
|
try {
|
|
1438
1566
|
const deviceKey = (_c = (_a2 = admissionRequest.device) == null ? void 0 : _a2.deviceKey) != null ? _c : (_b = admissionRequest.space) == null ? void 0 : _b.deviceKey;
|
|
1439
|
-
(0,
|
|
1567
|
+
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
1568
|
+
F: __dxlog_file7,
|
|
1569
|
+
L: 119,
|
|
1570
|
+
S: this,
|
|
1571
|
+
A: [
|
|
1572
|
+
"deviceKey",
|
|
1573
|
+
""
|
|
1574
|
+
]
|
|
1575
|
+
});
|
|
1440
1576
|
const admissionResponse = await protocol.admit(admissionRequest, extension.guestProfile);
|
|
1441
1577
|
extension.completedTrigger.wake(deviceKey);
|
|
1442
1578
|
return admissionResponse;
|
|
@@ -1452,16 +1588,16 @@ var InvitationsHandler = class {
|
|
|
1452
1588
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1453
1589
|
id: traceId
|
|
1454
1590
|
}), {
|
|
1455
|
-
F:
|
|
1456
|
-
L:
|
|
1591
|
+
F: __dxlog_file7,
|
|
1592
|
+
L: 137,
|
|
1457
1593
|
S: this,
|
|
1458
1594
|
C: (f, a) => f(...a)
|
|
1459
1595
|
});
|
|
1460
1596
|
(0, import_log5.log)("connected", {
|
|
1461
1597
|
...protocol.toJSON()
|
|
1462
1598
|
}, {
|
|
1463
|
-
F:
|
|
1464
|
-
L:
|
|
1599
|
+
F: __dxlog_file7,
|
|
1600
|
+
L: 138,
|
|
1465
1601
|
S: this,
|
|
1466
1602
|
C: (f, a) => f(...a)
|
|
1467
1603
|
});
|
|
@@ -1476,8 +1612,8 @@ var InvitationsHandler = class {
|
|
|
1476
1612
|
guest: deviceKey,
|
|
1477
1613
|
...protocol.toJSON()
|
|
1478
1614
|
}, {
|
|
1479
|
-
F:
|
|
1480
|
-
L:
|
|
1615
|
+
F: __dxlog_file7,
|
|
1616
|
+
L: 141,
|
|
1481
1617
|
S: this,
|
|
1482
1618
|
C: (f, a) => f(...a)
|
|
1483
1619
|
});
|
|
@@ -1488,8 +1624,8 @@ var InvitationsHandler = class {
|
|
|
1488
1624
|
import_log5.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1489
1625
|
id: traceId
|
|
1490
1626
|
}), {
|
|
1491
|
-
F:
|
|
1492
|
-
L:
|
|
1627
|
+
F: __dxlog_file7,
|
|
1628
|
+
L: 143,
|
|
1493
1629
|
S: this,
|
|
1494
1630
|
C: (f, a) => f(...a)
|
|
1495
1631
|
});
|
|
@@ -1498,8 +1634,8 @@ var InvitationsHandler = class {
|
|
|
1498
1634
|
(0, import_log5.log)("timeout", {
|
|
1499
1635
|
...protocol.toJSON()
|
|
1500
1636
|
}, {
|
|
1501
|
-
F:
|
|
1502
|
-
L:
|
|
1637
|
+
F: __dxlog_file7,
|
|
1638
|
+
L: 146,
|
|
1503
1639
|
S: this,
|
|
1504
1640
|
C: (f, a) => f(...a)
|
|
1505
1641
|
});
|
|
@@ -1509,8 +1645,8 @@ var InvitationsHandler = class {
|
|
|
1509
1645
|
});
|
|
1510
1646
|
} else {
|
|
1511
1647
|
import_log5.log.error("failed", err, {
|
|
1512
|
-
F:
|
|
1513
|
-
L:
|
|
1648
|
+
F: __dxlog_file7,
|
|
1649
|
+
L: 149,
|
|
1514
1650
|
S: this,
|
|
1515
1651
|
C: (f, a) => f(...a)
|
|
1516
1652
|
});
|
|
@@ -1520,8 +1656,8 @@ var InvitationsHandler = class {
|
|
|
1520
1656
|
id: traceId,
|
|
1521
1657
|
error: err
|
|
1522
1658
|
}), {
|
|
1523
|
-
F:
|
|
1524
|
-
L:
|
|
1659
|
+
F: __dxlog_file7,
|
|
1660
|
+
L: 152,
|
|
1525
1661
|
S: this,
|
|
1526
1662
|
C: (f, a) => f(...a)
|
|
1527
1663
|
});
|
|
@@ -1541,8 +1677,8 @@ var InvitationsHandler = class {
|
|
|
1541
1677
|
(0, import_log5.log)("timeout", {
|
|
1542
1678
|
...protocol.toJSON()
|
|
1543
1679
|
}, {
|
|
1544
|
-
F:
|
|
1545
|
-
L:
|
|
1680
|
+
F: __dxlog_file7,
|
|
1681
|
+
L: 167,
|
|
1546
1682
|
S: this,
|
|
1547
1683
|
C: (f, a) => f(...a)
|
|
1548
1684
|
});
|
|
@@ -1552,8 +1688,8 @@ var InvitationsHandler = class {
|
|
|
1552
1688
|
});
|
|
1553
1689
|
} else {
|
|
1554
1690
|
import_log5.log.error("failed", err, {
|
|
1555
|
-
F:
|
|
1556
|
-
L:
|
|
1691
|
+
F: __dxlog_file7,
|
|
1692
|
+
L: 170,
|
|
1557
1693
|
S: this,
|
|
1558
1694
|
C: (f, a) => f(...a)
|
|
1559
1695
|
});
|
|
@@ -1595,13 +1731,29 @@ var InvitationsHandler = class {
|
|
|
1595
1731
|
}
|
|
1596
1732
|
acceptInvitation(protocol, invitation) {
|
|
1597
1733
|
const { timeout = import_client_protocol2.INVITATION_TIMEOUT } = invitation;
|
|
1598
|
-
(0,
|
|
1734
|
+
(0, import_invariant6.invariant)(protocol, void 0, {
|
|
1735
|
+
F: __dxlog_file7,
|
|
1736
|
+
L: 210,
|
|
1737
|
+
S: this,
|
|
1738
|
+
A: [
|
|
1739
|
+
"protocol",
|
|
1740
|
+
""
|
|
1741
|
+
]
|
|
1742
|
+
});
|
|
1599
1743
|
const authenticated = new import_async8.Trigger();
|
|
1600
1744
|
let admitted = false;
|
|
1601
1745
|
let currentState;
|
|
1602
1746
|
const stream = new import_async8.PushStream();
|
|
1603
1747
|
const setState = (newData) => {
|
|
1604
|
-
(0,
|
|
1748
|
+
(0, import_invariant6.invariant)(newData.state !== void 0, void 0, {
|
|
1749
|
+
F: __dxlog_file7,
|
|
1750
|
+
L: 221,
|
|
1751
|
+
S: this,
|
|
1752
|
+
A: [
|
|
1753
|
+
"newData.state !== undefined",
|
|
1754
|
+
""
|
|
1755
|
+
]
|
|
1756
|
+
});
|
|
1605
1757
|
currentState = newData.state;
|
|
1606
1758
|
stream.next({
|
|
1607
1759
|
...invitation,
|
|
@@ -1614,8 +1766,8 @@ var InvitationsHandler = class {
|
|
|
1614
1766
|
(0, import_log5.log)("timeout", {
|
|
1615
1767
|
...protocol.toJSON()
|
|
1616
1768
|
}, {
|
|
1617
|
-
F:
|
|
1618
|
-
L:
|
|
1769
|
+
F: __dxlog_file7,
|
|
1770
|
+
L: 229,
|
|
1619
1771
|
S: this,
|
|
1620
1772
|
C: (f, a) => f(...a)
|
|
1621
1773
|
});
|
|
@@ -1624,8 +1776,8 @@ var InvitationsHandler = class {
|
|
|
1624
1776
|
});
|
|
1625
1777
|
} else {
|
|
1626
1778
|
import_log5.log.warn("auth failed", err, {
|
|
1627
|
-
F:
|
|
1628
|
-
L:
|
|
1779
|
+
F: __dxlog_file7,
|
|
1780
|
+
L: 232,
|
|
1629
1781
|
S: this,
|
|
1630
1782
|
C: (f, a) => f(...a)
|
|
1631
1783
|
});
|
|
@@ -1638,8 +1790,8 @@ var InvitationsHandler = class {
|
|
|
1638
1790
|
(0, import_log5.log)("complete", {
|
|
1639
1791
|
...protocol.toJSON()
|
|
1640
1792
|
}, {
|
|
1641
|
-
F:
|
|
1642
|
-
L:
|
|
1793
|
+
F: __dxlog_file7,
|
|
1794
|
+
L: 240,
|
|
1643
1795
|
S: this,
|
|
1644
1796
|
C: (f, a) => f(...a)
|
|
1645
1797
|
});
|
|
@@ -1653,8 +1805,8 @@ var InvitationsHandler = class {
|
|
|
1653
1805
|
(0, import_log5.log)("extension disposed", {
|
|
1654
1806
|
currentState
|
|
1655
1807
|
}, {
|
|
1656
|
-
F:
|
|
1657
|
-
L:
|
|
1808
|
+
F: __dxlog_file7,
|
|
1809
|
+
L: 250,
|
|
1658
1810
|
S: this,
|
|
1659
1811
|
C: (f, a) => f(...a)
|
|
1660
1812
|
});
|
|
@@ -1668,8 +1820,8 @@ var InvitationsHandler = class {
|
|
|
1668
1820
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
1669
1821
|
id: traceId
|
|
1670
1822
|
}), {
|
|
1671
|
-
F:
|
|
1672
|
-
L:
|
|
1823
|
+
F: __dxlog_file7,
|
|
1824
|
+
L: 259,
|
|
1673
1825
|
S: this,
|
|
1674
1826
|
C: (f, a) => f(...a)
|
|
1675
1827
|
});
|
|
@@ -1680,8 +1832,8 @@ var InvitationsHandler = class {
|
|
|
1680
1832
|
(0, import_log5.log)("connected", {
|
|
1681
1833
|
...protocol.toJSON()
|
|
1682
1834
|
}, {
|
|
1683
|
-
F:
|
|
1684
|
-
L:
|
|
1835
|
+
F: __dxlog_file7,
|
|
1836
|
+
L: 267,
|
|
1685
1837
|
S: this,
|
|
1686
1838
|
C: (f, a) => f(...a)
|
|
1687
1839
|
});
|
|
@@ -1691,8 +1843,8 @@ var InvitationsHandler = class {
|
|
|
1691
1843
|
(0, import_log5.log)("introduce", {
|
|
1692
1844
|
...protocol.toJSON()
|
|
1693
1845
|
}, {
|
|
1694
|
-
F:
|
|
1695
|
-
L:
|
|
1846
|
+
F: __dxlog_file7,
|
|
1847
|
+
L: 271,
|
|
1696
1848
|
S: this,
|
|
1697
1849
|
C: (f, a) => f(...a)
|
|
1698
1850
|
});
|
|
@@ -1701,8 +1853,8 @@ var InvitationsHandler = class {
|
|
|
1701
1853
|
...protocol.toJSON(),
|
|
1702
1854
|
response: introductionResponse
|
|
1703
1855
|
}, {
|
|
1704
|
-
F:
|
|
1705
|
-
L:
|
|
1856
|
+
F: __dxlog_file7,
|
|
1857
|
+
L: 275,
|
|
1706
1858
|
S: this,
|
|
1707
1859
|
C: (f, a) => f(...a)
|
|
1708
1860
|
});
|
|
@@ -1713,8 +1865,8 @@ var InvitationsHandler = class {
|
|
|
1713
1865
|
if (isAuthenticationRequired(invitation)) {
|
|
1714
1866
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1715
1867
|
(0, import_log5.log)("guest waiting for authentication code...", void 0, {
|
|
1716
|
-
F:
|
|
1717
|
-
L:
|
|
1868
|
+
F: __dxlog_file7,
|
|
1869
|
+
L: 284,
|
|
1718
1870
|
S: this,
|
|
1719
1871
|
C: (f, a) => f(...a)
|
|
1720
1872
|
});
|
|
@@ -1725,8 +1877,8 @@ var InvitationsHandler = class {
|
|
|
1725
1877
|
timeout
|
|
1726
1878
|
});
|
|
1727
1879
|
(0, import_log5.log)("sending authentication request", void 0, {
|
|
1728
|
-
F:
|
|
1729
|
-
L:
|
|
1880
|
+
F: __dxlog_file7,
|
|
1881
|
+
L: 288,
|
|
1730
1882
|
S: this,
|
|
1731
1883
|
C: (f, a) => f(...a)
|
|
1732
1884
|
});
|
|
@@ -1746,8 +1898,8 @@ var InvitationsHandler = class {
|
|
|
1746
1898
|
(0, import_log5.log)("retrying invalid code", {
|
|
1747
1899
|
attempt
|
|
1748
1900
|
}, {
|
|
1749
|
-
F:
|
|
1750
|
-
L:
|
|
1901
|
+
F: __dxlog_file7,
|
|
1902
|
+
L: 299,
|
|
1751
1903
|
S: this,
|
|
1752
1904
|
C: (f, a) => f(...a)
|
|
1753
1905
|
});
|
|
@@ -1763,8 +1915,8 @@ var InvitationsHandler = class {
|
|
|
1763
1915
|
(0, import_log5.log)("request admission", {
|
|
1764
1916
|
...protocol.toJSON()
|
|
1765
1917
|
}, {
|
|
1766
|
-
F:
|
|
1767
|
-
L:
|
|
1918
|
+
F: __dxlog_file7,
|
|
1919
|
+
L: 310,
|
|
1768
1920
|
S: this,
|
|
1769
1921
|
C: (f, a) => f(...a)
|
|
1770
1922
|
});
|
|
@@ -1775,8 +1927,8 @@ var InvitationsHandler = class {
|
|
|
1775
1927
|
(0, import_log5.log)("admitted by host", {
|
|
1776
1928
|
...protocol.toJSON()
|
|
1777
1929
|
}, {
|
|
1778
|
-
F:
|
|
1779
|
-
L:
|
|
1930
|
+
F: __dxlog_file7,
|
|
1931
|
+
L: 321,
|
|
1780
1932
|
S: this,
|
|
1781
1933
|
C: (f, a) => f(...a)
|
|
1782
1934
|
});
|
|
@@ -1787,8 +1939,8 @@ var InvitationsHandler = class {
|
|
|
1787
1939
|
import_log5.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
1788
1940
|
id: traceId
|
|
1789
1941
|
}), {
|
|
1790
|
-
F:
|
|
1791
|
-
L:
|
|
1942
|
+
F: __dxlog_file7,
|
|
1943
|
+
L: 323,
|
|
1792
1944
|
S: this,
|
|
1793
1945
|
C: (f, a) => f(...a)
|
|
1794
1946
|
});
|
|
@@ -1797,8 +1949,8 @@ var InvitationsHandler = class {
|
|
|
1797
1949
|
(0, import_log5.log)("timeout", {
|
|
1798
1950
|
...protocol.toJSON()
|
|
1799
1951
|
}, {
|
|
1800
|
-
F:
|
|
1801
|
-
L:
|
|
1952
|
+
F: __dxlog_file7,
|
|
1953
|
+
L: 326,
|
|
1802
1954
|
S: this,
|
|
1803
1955
|
C: (f, a) => f(...a)
|
|
1804
1956
|
});
|
|
@@ -1807,8 +1959,8 @@ var InvitationsHandler = class {
|
|
|
1807
1959
|
});
|
|
1808
1960
|
} else {
|
|
1809
1961
|
(0, import_log5.log)("auth failed", err, {
|
|
1810
|
-
F:
|
|
1811
|
-
L:
|
|
1962
|
+
F: __dxlog_file7,
|
|
1963
|
+
L: 329,
|
|
1812
1964
|
S: this,
|
|
1813
1965
|
C: (f, a) => f(...a)
|
|
1814
1966
|
});
|
|
@@ -1818,8 +1970,8 @@ var InvitationsHandler = class {
|
|
|
1818
1970
|
id: traceId,
|
|
1819
1971
|
error: err
|
|
1820
1972
|
}), {
|
|
1821
|
-
F:
|
|
1822
|
-
L:
|
|
1973
|
+
F: __dxlog_file7,
|
|
1974
|
+
L: 332,
|
|
1823
1975
|
S: this,
|
|
1824
1976
|
C: (f, a) => f(...a)
|
|
1825
1977
|
});
|
|
@@ -1836,8 +1988,8 @@ var InvitationsHandler = class {
|
|
|
1836
1988
|
(0, import_log5.log)("timeout", {
|
|
1837
1989
|
...protocol.toJSON()
|
|
1838
1990
|
}, {
|
|
1839
|
-
F:
|
|
1840
|
-
L:
|
|
1991
|
+
F: __dxlog_file7,
|
|
1992
|
+
L: 343,
|
|
1841
1993
|
S: this,
|
|
1842
1994
|
C: (f, a) => f(...a)
|
|
1843
1995
|
});
|
|
@@ -1846,8 +1998,8 @@ var InvitationsHandler = class {
|
|
|
1846
1998
|
});
|
|
1847
1999
|
} else {
|
|
1848
2000
|
(0, import_log5.log)("auth failed", err, {
|
|
1849
|
-
F:
|
|
1850
|
-
L:
|
|
2001
|
+
F: __dxlog_file7,
|
|
2002
|
+
L: 346,
|
|
1851
2003
|
S: this,
|
|
1852
2004
|
C: (f, a) => f(...a)
|
|
1853
2005
|
});
|
|
@@ -1858,7 +2010,15 @@ var InvitationsHandler = class {
|
|
|
1858
2010
|
return extension;
|
|
1859
2011
|
};
|
|
1860
2012
|
(0, import_async8.scheduleTask)(ctx, async () => {
|
|
1861
|
-
(0,
|
|
2013
|
+
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2014
|
+
F: __dxlog_file7,
|
|
2015
|
+
L: 356,
|
|
2016
|
+
S: this,
|
|
2017
|
+
A: [
|
|
2018
|
+
"invitation.swarmKey",
|
|
2019
|
+
""
|
|
2020
|
+
]
|
|
2021
|
+
});
|
|
1862
2022
|
const topic = invitation.swarmKey;
|
|
1863
2023
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
1864
2024
|
topic,
|
|
@@ -1891,12 +2051,12 @@ var InvitationsHandler = class {
|
|
|
1891
2051
|
};
|
|
1892
2052
|
|
|
1893
2053
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
1894
|
-
var import_tiny_invariant7 = __toESM(require("tiny-invariant"));
|
|
1895
2054
|
var import_async9 = require("@dxos/async");
|
|
1896
2055
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
2056
|
+
var import_invariant7 = require("@dxos/invariant");
|
|
1897
2057
|
var import_log6 = require("@dxos/log");
|
|
1898
2058
|
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
1899
|
-
var
|
|
2059
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
1900
2060
|
var InvitationsServiceImpl = class {
|
|
1901
2061
|
constructor(_invitationsHandler, _getHandler) {
|
|
1902
2062
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -1958,19 +2118,27 @@ var InvitationsServiceImpl = class {
|
|
|
1958
2118
|
}
|
|
1959
2119
|
async authenticate({ invitationId, authCode }) {
|
|
1960
2120
|
(0, import_log6.log)("authenticating...", void 0, {
|
|
1961
|
-
F:
|
|
1962
|
-
L:
|
|
2121
|
+
F: __dxlog_file8,
|
|
2122
|
+
L: 102,
|
|
1963
2123
|
S: this,
|
|
1964
2124
|
C: (f, a) => f(...a)
|
|
1965
2125
|
});
|
|
1966
|
-
(0,
|
|
2126
|
+
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2127
|
+
F: __dxlog_file8,
|
|
2128
|
+
L: 103,
|
|
2129
|
+
S: this,
|
|
2130
|
+
A: [
|
|
2131
|
+
"invitationId",
|
|
2132
|
+
""
|
|
2133
|
+
]
|
|
2134
|
+
});
|
|
1967
2135
|
const observable = this._acceptInvitations.get(invitationId);
|
|
1968
2136
|
if (!observable) {
|
|
1969
2137
|
import_log6.log.warn("invalid invitation", {
|
|
1970
2138
|
invitationId
|
|
1971
2139
|
}, {
|
|
1972
|
-
F:
|
|
1973
|
-
L:
|
|
2140
|
+
F: __dxlog_file8,
|
|
2141
|
+
L: 106,
|
|
1974
2142
|
S: this,
|
|
1975
2143
|
C: (f, a) => f(...a)
|
|
1976
2144
|
});
|
|
@@ -1980,12 +2148,20 @@ var InvitationsServiceImpl = class {
|
|
|
1980
2148
|
}
|
|
1981
2149
|
async cancelInvitation({ invitationId }) {
|
|
1982
2150
|
(0, import_log6.log)("deleting...", void 0, {
|
|
1983
|
-
F:
|
|
1984
|
-
L:
|
|
2151
|
+
F: __dxlog_file8,
|
|
2152
|
+
L: 113,
|
|
1985
2153
|
S: this,
|
|
1986
2154
|
C: (f, a) => f(...a)
|
|
1987
2155
|
});
|
|
1988
|
-
(0,
|
|
2156
|
+
(0, import_invariant7.invariant)(invitationId, void 0, {
|
|
2157
|
+
F: __dxlog_file8,
|
|
2158
|
+
L: 114,
|
|
2159
|
+
S: this,
|
|
2160
|
+
A: [
|
|
2161
|
+
"invitationId",
|
|
2162
|
+
""
|
|
2163
|
+
]
|
|
2164
|
+
});
|
|
1989
2165
|
const created = this._createInvitations.get(invitationId);
|
|
1990
2166
|
const accepted = this._acceptInvitations.get(invitationId);
|
|
1991
2167
|
if (created) {
|
|
@@ -2000,8 +2176,8 @@ var InvitationsServiceImpl = class {
|
|
|
2000
2176
|
import_log6.log.warn("invalid invitation", {
|
|
2001
2177
|
invitationId
|
|
2002
2178
|
}, {
|
|
2003
|
-
F:
|
|
2004
|
-
L:
|
|
2179
|
+
F: __dxlog_file8,
|
|
2180
|
+
L: 126,
|
|
2005
2181
|
S: this,
|
|
2006
2182
|
C: (f, a) => f(...a)
|
|
2007
2183
|
});
|
|
@@ -2060,12 +2236,12 @@ var InvitationsServiceImpl = class {
|
|
|
2060
2236
|
};
|
|
2061
2237
|
|
|
2062
2238
|
// packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
|
|
2063
|
-
var import_tiny_invariant8 = __toESM(require("tiny-invariant"));
|
|
2064
2239
|
var import_credentials8 = require("@dxos/credentials");
|
|
2065
2240
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
2241
|
+
var import_invariant8 = require("@dxos/invariant");
|
|
2066
2242
|
var import_log7 = require("@dxos/log");
|
|
2067
2243
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
2068
|
-
var
|
|
2244
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2069
2245
|
var SpaceInvitationProtocol = class {
|
|
2070
2246
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
2071
2247
|
this._spaceManager = _spaceManager;
|
|
@@ -2087,24 +2263,64 @@ var SpaceInvitationProtocol = class {
|
|
|
2087
2263
|
}
|
|
2088
2264
|
async admit(request, guestProfile) {
|
|
2089
2265
|
var _a;
|
|
2090
|
-
(0,
|
|
2266
|
+
(0, import_invariant8.invariant)(this._spaceKey, void 0, {
|
|
2267
|
+
F: __dxlog_file9,
|
|
2268
|
+
L: 42,
|
|
2269
|
+
S: this,
|
|
2270
|
+
A: [
|
|
2271
|
+
"this._spaceKey",
|
|
2272
|
+
""
|
|
2273
|
+
]
|
|
2274
|
+
});
|
|
2091
2275
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2092
|
-
(0,
|
|
2093
|
-
|
|
2276
|
+
(0, import_invariant8.invariant)(space, void 0, {
|
|
2277
|
+
F: __dxlog_file9,
|
|
2278
|
+
L: 44,
|
|
2279
|
+
S: this,
|
|
2280
|
+
A: [
|
|
2281
|
+
"space",
|
|
2282
|
+
""
|
|
2283
|
+
]
|
|
2284
|
+
});
|
|
2285
|
+
(0, import_invariant8.invariant)(request.space, void 0, {
|
|
2286
|
+
F: __dxlog_file9,
|
|
2287
|
+
L: 46,
|
|
2288
|
+
S: this,
|
|
2289
|
+
A: [
|
|
2290
|
+
"request.space",
|
|
2291
|
+
""
|
|
2292
|
+
]
|
|
2293
|
+
});
|
|
2094
2294
|
const { identityKey, deviceKey } = request.space;
|
|
2095
2295
|
(0, import_log7.log)("writing guest credentials", {
|
|
2096
2296
|
host: this._signingContext.deviceKey,
|
|
2097
2297
|
guest: deviceKey
|
|
2098
2298
|
}, {
|
|
2099
|
-
F:
|
|
2100
|
-
L:
|
|
2299
|
+
F: __dxlog_file9,
|
|
2300
|
+
L: 49,
|
|
2101
2301
|
S: this,
|
|
2102
2302
|
C: (f, a) => f(...a)
|
|
2103
2303
|
});
|
|
2104
2304
|
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2105
|
-
(0,
|
|
2305
|
+
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2306
|
+
F: __dxlog_file9,
|
|
2307
|
+
L: 60,
|
|
2308
|
+
S: this,
|
|
2309
|
+
A: [
|
|
2310
|
+
"credentials[0].credential",
|
|
2311
|
+
""
|
|
2312
|
+
]
|
|
2313
|
+
});
|
|
2106
2314
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2107
|
-
(0,
|
|
2315
|
+
(0, import_invariant8.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2316
|
+
F: __dxlog_file9,
|
|
2317
|
+
L: 62,
|
|
2318
|
+
S: this,
|
|
2319
|
+
A: [
|
|
2320
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
2321
|
+
""
|
|
2322
|
+
]
|
|
2323
|
+
});
|
|
2108
2324
|
await (0, import_feed_store3.writeMessages)(space.inner.controlPipeline.writer, credentials);
|
|
2109
2325
|
return {
|
|
2110
2326
|
space: {
|
|
@@ -2132,11 +2348,35 @@ var SpaceInvitationProtocol = class {
|
|
|
2132
2348
|
};
|
|
2133
2349
|
}
|
|
2134
2350
|
async accept(response) {
|
|
2135
|
-
(0,
|
|
2351
|
+
(0, import_invariant8.invariant)(response.space, void 0, {
|
|
2352
|
+
F: __dxlog_file9,
|
|
2353
|
+
L: 97,
|
|
2354
|
+
S: this,
|
|
2355
|
+
A: [
|
|
2356
|
+
"response.space",
|
|
2357
|
+
""
|
|
2358
|
+
]
|
|
2359
|
+
});
|
|
2136
2360
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
2137
2361
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2138
|
-
(0,
|
|
2139
|
-
|
|
2362
|
+
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2363
|
+
F: __dxlog_file9,
|
|
2364
|
+
L: 100,
|
|
2365
|
+
S: this,
|
|
2366
|
+
A: [
|
|
2367
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
2368
|
+
"'Invalid credential'"
|
|
2369
|
+
]
|
|
2370
|
+
});
|
|
2371
|
+
(0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2372
|
+
F: __dxlog_file9,
|
|
2373
|
+
L: 101,
|
|
2374
|
+
S: this,
|
|
2375
|
+
A: [
|
|
2376
|
+
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
2377
|
+
""
|
|
2378
|
+
]
|
|
2379
|
+
});
|
|
2140
2380
|
await this._spaceManager.acceptSpace({
|
|
2141
2381
|
spaceKey: assertion.spaceKey,
|
|
2142
2382
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -2204,12 +2444,12 @@ var ClientRpcServer = class {
|
|
|
2204
2444
|
};
|
|
2205
2445
|
|
|
2206
2446
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
2207
|
-
var import_tiny_invariant11 = __toESM(require("tiny-invariant"));
|
|
2208
2447
|
var import_async14 = require("@dxos/async");
|
|
2209
2448
|
var import_credentials13 = require("@dxos/credentials");
|
|
2210
2449
|
var import_debug7 = require("@dxos/debug");
|
|
2211
2450
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
2212
2451
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
2452
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
2213
2453
|
var import_keyring = require("@dxos/keyring");
|
|
2214
2454
|
var import_keys10 = require("@dxos/keys");
|
|
2215
2455
|
var import_log12 = require("@dxos/log");
|
|
@@ -2218,10 +2458,10 @@ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
|
2218
2458
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
2219
2459
|
|
|
2220
2460
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2221
|
-
var import_tiny_invariant10 = __toESM(require("tiny-invariant"));
|
|
2222
2461
|
var import_async12 = require("@dxos/async");
|
|
2223
2462
|
var import_context7 = require("@dxos/context");
|
|
2224
2463
|
var import_credentials12 = require("@dxos/credentials");
|
|
2464
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
2225
2465
|
var import_keys9 = require("@dxos/keys");
|
|
2226
2466
|
var import_log10 = require("@dxos/log");
|
|
2227
2467
|
var import_protocols6 = require("@dxos/protocols");
|
|
@@ -2244,15 +2484,15 @@ var import_timeframe = require("@dxos/timeframe");
|
|
|
2244
2484
|
var import_util4 = require("@dxos/util");
|
|
2245
2485
|
|
|
2246
2486
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2247
|
-
var import_tiny_invariant9 = __toESM(require("tiny-invariant"));
|
|
2248
2487
|
var import_async10 = require("@dxos/async");
|
|
2249
2488
|
var import_context5 = require("@dxos/context");
|
|
2489
|
+
var import_invariant9 = require("@dxos/invariant");
|
|
2250
2490
|
var import_keys7 = require("@dxos/keys");
|
|
2251
2491
|
var import_log8 = require("@dxos/log");
|
|
2252
2492
|
var import_protocols5 = require("@dxos/protocols");
|
|
2253
2493
|
var import_teleport2 = require("@dxos/teleport");
|
|
2254
2494
|
var import_util3 = require("@dxos/util");
|
|
2255
|
-
var
|
|
2495
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
2256
2496
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
2257
2497
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
2258
2498
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
@@ -2280,20 +2520,28 @@ var NotarizationPlugin = class {
|
|
|
2280
2520
|
(0, import_log8.log)("notarize", {
|
|
2281
2521
|
credentials
|
|
2282
2522
|
}, {
|
|
2283
|
-
F:
|
|
2284
|
-
L:
|
|
2523
|
+
F: __dxlog_file10,
|
|
2524
|
+
L: 90,
|
|
2285
2525
|
S: this,
|
|
2286
2526
|
C: (f, a) => f(...a)
|
|
2287
2527
|
});
|
|
2288
|
-
(0,
|
|
2528
|
+
(0, import_invariant9.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
2529
|
+
F: __dxlog_file10,
|
|
2530
|
+
L: 91,
|
|
2531
|
+
S: this,
|
|
2532
|
+
A: [
|
|
2533
|
+
"credentials.every((credential) => credential.id)",
|
|
2534
|
+
"'Credentials must have an id'"
|
|
2535
|
+
]
|
|
2536
|
+
});
|
|
2289
2537
|
const errors = new import_async10.Trigger();
|
|
2290
2538
|
const ctx = this._ctx.derive({
|
|
2291
2539
|
onError: (err) => {
|
|
2292
2540
|
import_log8.log.warn("Notarization error", {
|
|
2293
2541
|
err
|
|
2294
2542
|
}, {
|
|
2295
|
-
F:
|
|
2296
|
-
L:
|
|
2543
|
+
F: __dxlog_file10,
|
|
2544
|
+
L: 99,
|
|
2297
2545
|
S: this,
|
|
2298
2546
|
C: (f, a) => f(...a)
|
|
2299
2547
|
});
|
|
@@ -2308,8 +2556,8 @@ var NotarizationPlugin = class {
|
|
|
2308
2556
|
timeout,
|
|
2309
2557
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
2310
2558
|
}, {
|
|
2311
|
-
F:
|
|
2312
|
-
L:
|
|
2559
|
+
F: __dxlog_file10,
|
|
2560
|
+
L: 111,
|
|
2313
2561
|
S: this,
|
|
2314
2562
|
C: (f, a) => f(...a)
|
|
2315
2563
|
});
|
|
@@ -2331,8 +2579,8 @@ var NotarizationPlugin = class {
|
|
|
2331
2579
|
import_log8.log.warn("Exhausted all peers to notarize with", {
|
|
2332
2580
|
retryIn: retryTimeout
|
|
2333
2581
|
}, {
|
|
2334
|
-
F:
|
|
2335
|
-
L:
|
|
2582
|
+
F: __dxlog_file10,
|
|
2583
|
+
L: 136,
|
|
2336
2584
|
S: this,
|
|
2337
2585
|
C: (f, a) => f(...a)
|
|
2338
2586
|
});
|
|
@@ -2345,8 +2593,8 @@ var NotarizationPlugin = class {
|
|
|
2345
2593
|
peer: peer.localPeerId,
|
|
2346
2594
|
credentialId: credentials.map((credential) => credential.id)
|
|
2347
2595
|
}, {
|
|
2348
|
-
F:
|
|
2349
|
-
L:
|
|
2596
|
+
F: __dxlog_file10,
|
|
2597
|
+
L: 143,
|
|
2350
2598
|
S: this,
|
|
2351
2599
|
C: (f, a) => f(...a)
|
|
2352
2600
|
});
|
|
@@ -2354,8 +2602,8 @@ var NotarizationPlugin = class {
|
|
|
2354
2602
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
2355
2603
|
});
|
|
2356
2604
|
(0, import_log8.log)("success", void 0, {
|
|
2357
|
-
F:
|
|
2358
|
-
L:
|
|
2605
|
+
F: __dxlog_file10,
|
|
2606
|
+
L: 147,
|
|
2359
2607
|
S: this,
|
|
2360
2608
|
C: (f, a) => f(...a)
|
|
2361
2609
|
});
|
|
@@ -2363,8 +2611,8 @@ var NotarizationPlugin = class {
|
|
|
2363
2611
|
} catch (err) {
|
|
2364
2612
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
2365
2613
|
import_log8.log.warn("error notarizing (recoverable)", err, {
|
|
2366
|
-
F:
|
|
2367
|
-
L:
|
|
2614
|
+
F: __dxlog_file10,
|
|
2615
|
+
L: 151,
|
|
2368
2616
|
S: this,
|
|
2369
2617
|
C: (f, a) => f(...a)
|
|
2370
2618
|
});
|
|
@@ -2381,8 +2629,8 @@ var NotarizationPlugin = class {
|
|
|
2381
2629
|
errors.wait()
|
|
2382
2630
|
]);
|
|
2383
2631
|
(0, import_log8.log)("done", void 0, {
|
|
2384
|
-
F:
|
|
2385
|
-
L:
|
|
2632
|
+
F: __dxlog_file10,
|
|
2633
|
+
L: 162,
|
|
2386
2634
|
S: this,
|
|
2387
2635
|
C: (f, a) => f(...a)
|
|
2388
2636
|
});
|
|
@@ -2403,7 +2651,15 @@ var NotarizationPlugin = class {
|
|
|
2403
2651
|
this._processCredentialsTriggers.delete(credential.id);
|
|
2404
2652
|
}
|
|
2405
2653
|
setWriter(writer) {
|
|
2406
|
-
(0,
|
|
2654
|
+
(0, import_invariant9.invariant)(!this._writer, "Writer already set.", {
|
|
2655
|
+
F: __dxlog_file10,
|
|
2656
|
+
L: 181,
|
|
2657
|
+
S: this,
|
|
2658
|
+
A: [
|
|
2659
|
+
"!this._writer",
|
|
2660
|
+
"'Writer already set.'"
|
|
2661
|
+
]
|
|
2662
|
+
});
|
|
2407
2663
|
this._writer = writer;
|
|
2408
2664
|
}
|
|
2409
2665
|
async _waitUntilProcessed(id) {
|
|
@@ -2421,7 +2677,15 @@ var NotarizationPlugin = class {
|
|
|
2421
2677
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
2422
2678
|
}
|
|
2423
2679
|
for (const credential of (_a = request.credentials) != null ? _a : []) {
|
|
2424
|
-
(0,
|
|
2680
|
+
(0, import_invariant9.invariant)(credential.id, "Credential must have an id", {
|
|
2681
|
+
F: __dxlog_file10,
|
|
2682
|
+
L: 200,
|
|
2683
|
+
S: this,
|
|
2684
|
+
A: [
|
|
2685
|
+
"credential.id",
|
|
2686
|
+
"'Credential must have an id'"
|
|
2687
|
+
]
|
|
2688
|
+
});
|
|
2425
2689
|
if (this._processedCredentials.has(credential.id)) {
|
|
2426
2690
|
continue;
|
|
2427
2691
|
}
|
|
@@ -2434,8 +2698,8 @@ var NotarizationPlugin = class {
|
|
|
2434
2698
|
(0, import_log8.log)("extension opened", {
|
|
2435
2699
|
peer: extension.localPeerId
|
|
2436
2700
|
}, {
|
|
2437
|
-
F:
|
|
2438
|
-
L:
|
|
2701
|
+
F: __dxlog_file10,
|
|
2702
|
+
L: 211,
|
|
2439
2703
|
S: this,
|
|
2440
2704
|
C: (f, a) => f(...a)
|
|
2441
2705
|
});
|
|
@@ -2446,8 +2710,8 @@ var NotarizationPlugin = class {
|
|
|
2446
2710
|
(0, import_log8.log)("extension closed", {
|
|
2447
2711
|
peer: extension.localPeerId
|
|
2448
2712
|
}, {
|
|
2449
|
-
F:
|
|
2450
|
-
L:
|
|
2713
|
+
F: __dxlog_file10,
|
|
2714
|
+
L: 216,
|
|
2451
2715
|
S: this,
|
|
2452
2716
|
C: (f, a) => f(...a)
|
|
2453
2717
|
});
|
|
@@ -2500,7 +2764,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
2500
2764
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2501
2765
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2502
2766
|
}
|
|
2503
|
-
var
|
|
2767
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
2504
2768
|
var DataSpace = class DataSpace2 {
|
|
2505
2769
|
constructor(params) {
|
|
2506
2770
|
this._ctx = new import_context6.Context();
|
|
@@ -2599,7 +2863,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2599
2863
|
} catch (err) {
|
|
2600
2864
|
if (err instanceof import_errors3.CancelledError) {
|
|
2601
2865
|
(0, import_log9.log)("data pipeline initialization cancelled", err, {
|
|
2602
|
-
F:
|
|
2866
|
+
F: __dxlog_file11,
|
|
2603
2867
|
L: 193,
|
|
2604
2868
|
S: this,
|
|
2605
2869
|
C: (f, a) => f(...a)
|
|
@@ -2607,7 +2871,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2607
2871
|
return;
|
|
2608
2872
|
}
|
|
2609
2873
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
2610
|
-
F:
|
|
2874
|
+
F: __dxlog_file11,
|
|
2611
2875
|
L: 197,
|
|
2612
2876
|
S: this,
|
|
2613
2877
|
C: (f, a) => f(...a)
|
|
@@ -2633,7 +2897,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2633
2897
|
this.metrics.controlPipelineReady = new Date();
|
|
2634
2898
|
await this._createWritableFeeds();
|
|
2635
2899
|
(0, import_log9.log)("writable feeds created", void 0, {
|
|
2636
|
-
F:
|
|
2900
|
+
F: __dxlog_file11,
|
|
2637
2901
|
L: 221,
|
|
2638
2902
|
S: this,
|
|
2639
2903
|
C: (f, a) => f(...a)
|
|
@@ -2650,7 +2914,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2650
2914
|
this.metrics.dataPipelineOpen = new Date();
|
|
2651
2915
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
2652
2916
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
2653
|
-
F:
|
|
2917
|
+
F: __dxlog_file11,
|
|
2654
2918
|
L: 242,
|
|
2655
2919
|
S: this,
|
|
2656
2920
|
C: (f, a) => f(...a)
|
|
@@ -2661,7 +2925,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2661
2925
|
});
|
|
2662
2926
|
this.metrics.dataPipelineReady = new Date();
|
|
2663
2927
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
2664
|
-
F:
|
|
2928
|
+
F: __dxlog_file11,
|
|
2665
2929
|
L: 251,
|
|
2666
2930
|
S: this,
|
|
2667
2931
|
C: (f, a) => f(...a)
|
|
@@ -2860,7 +3124,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
2860
3124
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2861
3125
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2862
3126
|
}
|
|
2863
|
-
var
|
|
3127
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
2864
3128
|
var DataSpaceManager = class DataSpaceManager2 {
|
|
2865
3129
|
constructor(_spaceManager, _metadataStore, _dataServiceSubscriptions, _keyring, _signingContext, _feedStore) {
|
|
2866
3130
|
this._spaceManager = _spaceManager;
|
|
@@ -2881,16 +3145,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2881
3145
|
}
|
|
2882
3146
|
async open() {
|
|
2883
3147
|
(0, import_log10.log)("open", void 0, {
|
|
2884
|
-
F:
|
|
2885
|
-
L:
|
|
3148
|
+
F: __dxlog_file12,
|
|
3149
|
+
L: 79,
|
|
2886
3150
|
S: this,
|
|
2887
3151
|
C: (f, a) => f(...a)
|
|
2888
3152
|
});
|
|
2889
3153
|
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.begin({
|
|
2890
3154
|
id: this._instanceId
|
|
2891
3155
|
}), {
|
|
2892
|
-
F:
|
|
2893
|
-
L:
|
|
3156
|
+
F: __dxlog_file12,
|
|
3157
|
+
L: 80,
|
|
2894
3158
|
S: this,
|
|
2895
3159
|
C: (f, a) => f(...a)
|
|
2896
3160
|
});
|
|
@@ -2898,8 +3162,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2898
3162
|
(0, import_log10.log)("metadata loaded", {
|
|
2899
3163
|
spaces: this._metadataStore.spaces.length
|
|
2900
3164
|
}, {
|
|
2901
|
-
F:
|
|
2902
|
-
L:
|
|
3165
|
+
F: __dxlog_file12,
|
|
3166
|
+
L: 82,
|
|
2903
3167
|
S: this,
|
|
2904
3168
|
C: (f, a) => f(...a)
|
|
2905
3169
|
});
|
|
@@ -2908,8 +3172,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2908
3172
|
(0, import_log10.log)("load space", {
|
|
2909
3173
|
spaceMetadata
|
|
2910
3174
|
}, {
|
|
2911
|
-
F:
|
|
2912
|
-
L:
|
|
3175
|
+
F: __dxlog_file12,
|
|
3176
|
+
L: 86,
|
|
2913
3177
|
S: this,
|
|
2914
3178
|
C: (f, a) => f(...a)
|
|
2915
3179
|
});
|
|
@@ -2922,8 +3186,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2922
3186
|
spaceMetadata,
|
|
2923
3187
|
err
|
|
2924
3188
|
}, {
|
|
2925
|
-
F:
|
|
2926
|
-
L:
|
|
3189
|
+
F: __dxlog_file12,
|
|
3190
|
+
L: 92,
|
|
2927
3191
|
S: this,
|
|
2928
3192
|
C: (f, a) => f(...a)
|
|
2929
3193
|
});
|
|
@@ -2934,16 +3198,16 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2934
3198
|
import_log10.log.trace("dxos.echo.data-space-manager.open", import_protocols6.trace.end({
|
|
2935
3199
|
id: this._instanceId
|
|
2936
3200
|
}), {
|
|
2937
|
-
F:
|
|
2938
|
-
L:
|
|
3201
|
+
F: __dxlog_file12,
|
|
3202
|
+
L: 98,
|
|
2939
3203
|
S: this,
|
|
2940
3204
|
C: (f, a) => f(...a)
|
|
2941
3205
|
});
|
|
2942
3206
|
}
|
|
2943
3207
|
async close() {
|
|
2944
3208
|
(0, import_log10.log)("close", void 0, {
|
|
2945
|
-
F:
|
|
2946
|
-
L:
|
|
3209
|
+
F: __dxlog_file12,
|
|
3210
|
+
L: 103,
|
|
2947
3211
|
S: this,
|
|
2948
3212
|
C: (f, a) => f(...a)
|
|
2949
3213
|
});
|
|
@@ -2957,7 +3221,15 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2957
3221
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
2958
3222
|
*/
|
|
2959
3223
|
async createSpace() {
|
|
2960
|
-
(0,
|
|
3224
|
+
(0, import_invariant10.invariant)(this._isOpen, "Not open.", {
|
|
3225
|
+
F: __dxlog_file12,
|
|
3226
|
+
L: 116,
|
|
3227
|
+
S: this,
|
|
3228
|
+
A: [
|
|
3229
|
+
"this._isOpen",
|
|
3230
|
+
"'Not open.'"
|
|
3231
|
+
]
|
|
3232
|
+
});
|
|
2961
3233
|
const spaceKey = await this._keyring.createKey();
|
|
2962
3234
|
const controlFeedKey = await this._keyring.createKey();
|
|
2963
3235
|
const dataFeedKey = await this._keyring.createKey();
|
|
@@ -2971,8 +3243,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2971
3243
|
(0, import_log10.log)("creating space...", {
|
|
2972
3244
|
spaceKey
|
|
2973
3245
|
}, {
|
|
2974
|
-
F:
|
|
2975
|
-
L:
|
|
3246
|
+
F: __dxlog_file12,
|
|
3247
|
+
L: 128,
|
|
2976
3248
|
S: this,
|
|
2977
3249
|
C: (f, a) => f(...a)
|
|
2978
3250
|
});
|
|
@@ -2980,7 +3252,15 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2980
3252
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
|
|
2981
3253
|
await this._metadataStore.addSpace(metadata);
|
|
2982
3254
|
const memberCredential = credentials[1];
|
|
2983
|
-
(0,
|
|
3255
|
+
(0, import_invariant10.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3256
|
+
F: __dxlog_file12,
|
|
3257
|
+
L: 135,
|
|
3258
|
+
S: this,
|
|
3259
|
+
A: [
|
|
3260
|
+
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3261
|
+
""
|
|
3262
|
+
]
|
|
3263
|
+
});
|
|
2984
3264
|
await this._signingContext.recordCredential(memberCredential);
|
|
2985
3265
|
await space.initializeDataPipeline();
|
|
2986
3266
|
this.updated.emit();
|
|
@@ -2991,13 +3271,29 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2991
3271
|
(0, import_log10.log)("accept space", {
|
|
2992
3272
|
opts
|
|
2993
3273
|
}, {
|
|
2994
|
-
F:
|
|
2995
|
-
L:
|
|
3274
|
+
F: __dxlog_file12,
|
|
3275
|
+
L: 147,
|
|
2996
3276
|
S: this,
|
|
2997
3277
|
C: (f, a) => f(...a)
|
|
2998
3278
|
});
|
|
2999
|
-
(0,
|
|
3000
|
-
|
|
3279
|
+
(0, import_invariant10.invariant)(this._isOpen, "Not open.", {
|
|
3280
|
+
F: __dxlog_file12,
|
|
3281
|
+
L: 148,
|
|
3282
|
+
S: this,
|
|
3283
|
+
A: [
|
|
3284
|
+
"this._isOpen",
|
|
3285
|
+
"'Not open.'"
|
|
3286
|
+
]
|
|
3287
|
+
});
|
|
3288
|
+
(0, import_invariant10.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3289
|
+
F: __dxlog_file12,
|
|
3290
|
+
L: 149,
|
|
3291
|
+
S: this,
|
|
3292
|
+
A: [
|
|
3293
|
+
"!this._spaces.has(opts.spaceKey)",
|
|
3294
|
+
"'Space already exists.'"
|
|
3295
|
+
]
|
|
3296
|
+
});
|
|
3001
3297
|
const metadata = {
|
|
3002
3298
|
key: opts.spaceKey,
|
|
3003
3299
|
genesisFeedKey: opts.genesisFeedKey,
|
|
@@ -3025,8 +3321,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3025
3321
|
(0, import_log10.log)("construct space", {
|
|
3026
3322
|
metadata
|
|
3027
3323
|
}, {
|
|
3028
|
-
F:
|
|
3029
|
-
L:
|
|
3324
|
+
F: __dxlog_file12,
|
|
3325
|
+
L: 182,
|
|
3030
3326
|
S: this,
|
|
3031
3327
|
C: (f, a) => f(...a)
|
|
3032
3328
|
});
|
|
@@ -3034,7 +3330,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3034
3330
|
localPeerId: this._signingContext.deviceKey
|
|
3035
3331
|
});
|
|
3036
3332
|
const presence = new import_teleport_extension_gossip.Presence({
|
|
3037
|
-
announceInterval:
|
|
3333
|
+
announceInterval: 1e3,
|
|
3038
3334
|
offlineTimeout: 5e3,
|
|
3039
3335
|
identityKey: this._signingContext.identityKey,
|
|
3040
3336
|
gossip
|
|
@@ -3061,8 +3357,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3061
3357
|
},
|
|
3062
3358
|
onAuthFailure: () => {
|
|
3063
3359
|
import_log10.log.warn("auth failure", void 0, {
|
|
3064
|
-
F:
|
|
3065
|
-
L:
|
|
3360
|
+
F: __dxlog_file12,
|
|
3361
|
+
L: 213,
|
|
3066
3362
|
S: this,
|
|
3067
3363
|
C: (f, a) => f(...a)
|
|
3068
3364
|
});
|
|
@@ -3085,8 +3381,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3085
3381
|
(0, import_log10.log)("before space ready", {
|
|
3086
3382
|
space: space.key
|
|
3087
3383
|
}, {
|
|
3088
|
-
F:
|
|
3089
|
-
L:
|
|
3384
|
+
F: __dxlog_file12,
|
|
3385
|
+
L: 231,
|
|
3090
3386
|
S: this,
|
|
3091
3387
|
C: (f, a) => f(...a)
|
|
3092
3388
|
});
|
|
@@ -3097,8 +3393,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3097
3393
|
space: space.key,
|
|
3098
3394
|
open: this._isOpen
|
|
3099
3395
|
}, {
|
|
3100
|
-
F:
|
|
3101
|
-
L:
|
|
3396
|
+
F: __dxlog_file12,
|
|
3397
|
+
L: 238,
|
|
3102
3398
|
S: this,
|
|
3103
3399
|
C: (f, a) => f(...a)
|
|
3104
3400
|
});
|
|
@@ -3110,8 +3406,8 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
3110
3406
|
(0, import_log10.log)("before space close", {
|
|
3111
3407
|
space: space.key
|
|
3112
3408
|
}, {
|
|
3113
|
-
F:
|
|
3114
|
-
L:
|
|
3409
|
+
F: __dxlog_file12,
|
|
3410
|
+
L: 244,
|
|
3115
3411
|
S: this,
|
|
3116
3412
|
C: (f, a) => f(...a)
|
|
3117
3413
|
});
|
|
@@ -3159,7 +3455,7 @@ var import_log11 = require("@dxos/log");
|
|
|
3159
3455
|
var import_protocols7 = require("@dxos/protocols");
|
|
3160
3456
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
3161
3457
|
var import_util6 = require("@dxos/util");
|
|
3162
|
-
var
|
|
3458
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
3163
3459
|
var SpacesServiceImpl = class {
|
|
3164
3460
|
constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
|
|
3165
3461
|
this._identityManager = _identityManager;
|
|
@@ -3200,7 +3496,7 @@ var SpacesServiceImpl = class {
|
|
|
3200
3496
|
(0, import_log11.log)("update", {
|
|
3201
3497
|
spaces
|
|
3202
3498
|
}, {
|
|
3203
|
-
F:
|
|
3499
|
+
F: __dxlog_file13,
|
|
3204
3500
|
L: 78,
|
|
3205
3501
|
S: this,
|
|
3206
3502
|
C: (f, a) => f(...a)
|
|
@@ -3311,14 +3607,20 @@ var SpacesServiceImpl = class {
|
|
|
3311
3607
|
},
|
|
3312
3608
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
3313
3609
|
var _a2, _b2, _c2;
|
|
3610
|
+
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
3611
|
+
const isMe = (_a2 = this._identityManager.identity) == null ? void 0 : _a2.identityKey.equals(member.key);
|
|
3612
|
+
if (isMe) {
|
|
3613
|
+
peers.push(space.presence.getLocalState());
|
|
3614
|
+
}
|
|
3314
3615
|
return {
|
|
3315
3616
|
identity: {
|
|
3316
3617
|
identityKey: member.key,
|
|
3317
3618
|
profile: {
|
|
3318
|
-
displayName: (
|
|
3619
|
+
displayName: (_c2 = (_b2 = member.assertion.profile) == null ? void 0 : _b2.displayName) != null ? _c2 : (0, import_util6.humanize)(member.key)
|
|
3319
3620
|
}
|
|
3320
3621
|
},
|
|
3321
|
-
presence:
|
|
3622
|
+
presence: isMe || peers.length > 0 ? import_services8.SpaceMember.PresenceState.ONLINE : import_services8.SpaceMember.PresenceState.OFFLINE,
|
|
3623
|
+
peerStates: peers
|
|
3322
3624
|
};
|
|
3323
3625
|
}),
|
|
3324
3626
|
creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
|
|
@@ -3330,7 +3632,7 @@ var SpacesServiceImpl = class {
|
|
|
3330
3632
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
3331
3633
|
|
|
3332
3634
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
3333
|
-
var
|
|
3635
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
3334
3636
|
var ServiceContext = class {
|
|
3335
3637
|
// prettier-ignore
|
|
3336
3638
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
@@ -3374,15 +3676,15 @@ var ServiceContext = class {
|
|
|
3374
3676
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.begin({
|
|
3375
3677
|
id: this._instanceId
|
|
3376
3678
|
}), {
|
|
3377
|
-
F:
|
|
3378
|
-
L:
|
|
3679
|
+
F: __dxlog_file14,
|
|
3680
|
+
L: 125,
|
|
3379
3681
|
S: this,
|
|
3380
3682
|
C: (f, a) => f(...a)
|
|
3381
3683
|
});
|
|
3382
3684
|
await this._checkStorageVersion();
|
|
3383
3685
|
(0, import_log12.log)("opening...", void 0, {
|
|
3384
|
-
F:
|
|
3385
|
-
L:
|
|
3686
|
+
F: __dxlog_file14,
|
|
3687
|
+
L: 129,
|
|
3386
3688
|
S: this,
|
|
3387
3689
|
C: (f, a) => f(...a)
|
|
3388
3690
|
});
|
|
@@ -3394,16 +3696,16 @@ var ServiceContext = class {
|
|
|
3394
3696
|
await this._initialize();
|
|
3395
3697
|
}
|
|
3396
3698
|
(0, import_log12.log)("opened", void 0, {
|
|
3397
|
-
F:
|
|
3398
|
-
L:
|
|
3699
|
+
F: __dxlog_file14,
|
|
3700
|
+
L: 137,
|
|
3399
3701
|
S: this,
|
|
3400
3702
|
C: (f, a) => f(...a)
|
|
3401
3703
|
});
|
|
3402
3704
|
import_log12.log.trace("dxos.sdk.service-context.open", import_protocols8.trace.end({
|
|
3403
3705
|
id: this._instanceId
|
|
3404
3706
|
}), {
|
|
3405
|
-
F:
|
|
3406
|
-
L:
|
|
3707
|
+
F: __dxlog_file14,
|
|
3708
|
+
L: 138,
|
|
3407
3709
|
S: this,
|
|
3408
3710
|
C: (f, a) => f(...a)
|
|
3409
3711
|
});
|
|
@@ -3411,8 +3713,8 @@ var ServiceContext = class {
|
|
|
3411
3713
|
async close() {
|
|
3412
3714
|
var _a;
|
|
3413
3715
|
(0, import_log12.log)("closing...", void 0, {
|
|
3414
|
-
F:
|
|
3415
|
-
L:
|
|
3716
|
+
F: __dxlog_file14,
|
|
3717
|
+
L: 142,
|
|
3416
3718
|
S: this,
|
|
3417
3719
|
C: (f, a) => f(...a)
|
|
3418
3720
|
});
|
|
@@ -3427,8 +3729,8 @@ var ServiceContext = class {
|
|
|
3427
3729
|
await this.signalManager.close();
|
|
3428
3730
|
this.dataServiceSubscriptions.clear();
|
|
3429
3731
|
(0, import_log12.log)("closed", void 0, {
|
|
3430
|
-
F:
|
|
3431
|
-
L:
|
|
3732
|
+
F: __dxlog_file14,
|
|
3733
|
+
L: 153,
|
|
3432
3734
|
S: this,
|
|
3433
3735
|
C: (f, a) => f(...a)
|
|
3434
3736
|
});
|
|
@@ -3440,7 +3742,15 @@ var ServiceContext = class {
|
|
|
3440
3742
|
}
|
|
3441
3743
|
getInvitationHandler(invitation) {
|
|
3442
3744
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3443
|
-
(0,
|
|
3745
|
+
(0, import_invariant11.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
3746
|
+
F: __dxlog_file14,
|
|
3747
|
+
L: 165,
|
|
3748
|
+
S: this,
|
|
3749
|
+
A: [
|
|
3750
|
+
"factory",
|
|
3751
|
+
"`Unknown invitation kind: ${invitation.kind}`"
|
|
3752
|
+
]
|
|
3753
|
+
});
|
|
3444
3754
|
return factory(invitation);
|
|
3445
3755
|
}
|
|
3446
3756
|
async _acceptIdentity(params) {
|
|
@@ -3458,8 +3768,8 @@ var ServiceContext = class {
|
|
|
3458
3768
|
async _initialize() {
|
|
3459
3769
|
var _a;
|
|
3460
3770
|
(0, import_log12.log)("initializing spaces...", void 0, {
|
|
3461
|
-
F:
|
|
3462
|
-
L:
|
|
3771
|
+
F: __dxlog_file14,
|
|
3772
|
+
L: 186,
|
|
3463
3773
|
S: this,
|
|
3464
3774
|
C: (f, a) => f(...a)
|
|
3465
3775
|
});
|
|
@@ -3480,7 +3790,15 @@ var ServiceContext = class {
|
|
|
3480
3790
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
3481
3791
|
await this.dataSpaceManager.open();
|
|
3482
3792
|
this._handlerFactories.set(import_services9.Invitation.Kind.SPACE, (invitation) => {
|
|
3483
|
-
(0,
|
|
3793
|
+
(0, import_invariant11.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
3794
|
+
F: __dxlog_file14,
|
|
3795
|
+
L: 209,
|
|
3796
|
+
S: this,
|
|
3797
|
+
A: [
|
|
3798
|
+
"this.dataSpaceManager",
|
|
3799
|
+
"'dataSpaceManager not initialized yet'"
|
|
3800
|
+
]
|
|
3801
|
+
});
|
|
3484
3802
|
return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
|
|
3485
3803
|
});
|
|
3486
3804
|
this.initialized.wake();
|
|
@@ -3497,8 +3815,8 @@ var ServiceContext = class {
|
|
|
3497
3815
|
(0, import_log12.log)("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
3498
3816
|
details: assertion
|
|
3499
3817
|
}, {
|
|
3500
|
-
F:
|
|
3501
|
-
L:
|
|
3818
|
+
F: __dxlog_file14,
|
|
3819
|
+
L: 225,
|
|
3502
3820
|
S: this,
|
|
3503
3821
|
C: (f, a) => f(...a)
|
|
3504
3822
|
});
|
|
@@ -3508,8 +3826,8 @@ var ServiceContext = class {
|
|
|
3508
3826
|
(0, import_log12.log)("space already exists, ignoring space admission", {
|
|
3509
3827
|
details: assertion
|
|
3510
3828
|
}, {
|
|
3511
|
-
F:
|
|
3512
|
-
L:
|
|
3829
|
+
F: __dxlog_file14,
|
|
3830
|
+
L: 229,
|
|
3513
3831
|
S: this,
|
|
3514
3832
|
C: (f, a) => f(...a)
|
|
3515
3833
|
});
|
|
@@ -3519,8 +3837,8 @@ var ServiceContext = class {
|
|
|
3519
3837
|
(0, import_log12.log)("accepting space recorded in halo", {
|
|
3520
3838
|
details: assertion
|
|
3521
3839
|
}, {
|
|
3522
|
-
F:
|
|
3523
|
-
L:
|
|
3840
|
+
F: __dxlog_file14,
|
|
3841
|
+
L: 234,
|
|
3524
3842
|
S: this,
|
|
3525
3843
|
C: (f, a) => f(...a)
|
|
3526
3844
|
});
|
|
@@ -3530,8 +3848,8 @@ var ServiceContext = class {
|
|
|
3530
3848
|
});
|
|
3531
3849
|
} catch (err) {
|
|
3532
3850
|
import_log12.log.catch(err, void 0, {
|
|
3533
|
-
F:
|
|
3534
|
-
L:
|
|
3851
|
+
F: __dxlog_file14,
|
|
3852
|
+
L: 240,
|
|
3535
3853
|
S: this,
|
|
3536
3854
|
C: (f, a) => f(...a)
|
|
3537
3855
|
});
|
|
@@ -3543,11 +3861,11 @@ var ServiceContext = class {
|
|
|
3543
3861
|
};
|
|
3544
3862
|
|
|
3545
3863
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3546
|
-
var import_tiny_invariant13 = __toESM(require("tiny-invariant"));
|
|
3547
3864
|
var import_async17 = require("@dxos/async");
|
|
3548
3865
|
var import_client_protocol5 = require("@dxos/client-protocol");
|
|
3549
3866
|
var import_document_model = require("@dxos/document-model");
|
|
3550
3867
|
var import_echo_pipeline4 = require("@dxos/echo-pipeline");
|
|
3868
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
3551
3869
|
var import_keys11 = require("@dxos/keys");
|
|
3552
3870
|
var import_log15 = require("@dxos/log");
|
|
3553
3871
|
var import_messaging = require("@dxos/messaging");
|
|
@@ -3605,7 +3923,7 @@ var DevicesServiceImpl = class {
|
|
|
3605
3923
|
};
|
|
3606
3924
|
|
|
3607
3925
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
3608
|
-
var
|
|
3926
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
3609
3927
|
var import_lock_file = require("@dxos/lock-file");
|
|
3610
3928
|
var import_log13 = require("@dxos/log");
|
|
3611
3929
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
@@ -3618,7 +3936,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
3618
3936
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3619
3937
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3620
3938
|
}
|
|
3621
|
-
var
|
|
3939
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/node.ts";
|
|
3622
3940
|
var Lock = class {
|
|
3623
3941
|
constructor({ lockKey: lockPath, onAcquire, onRelease }) {
|
|
3624
3942
|
this._lockPath = lockPath;
|
|
@@ -3631,7 +3949,7 @@ var Lock = class {
|
|
|
3631
3949
|
async acquire() {
|
|
3632
3950
|
var _a;
|
|
3633
3951
|
(0, import_log13.log)("acquiring lock...", void 0, {
|
|
3634
|
-
F:
|
|
3952
|
+
F: __dxlog_file15,
|
|
3635
3953
|
L: 32,
|
|
3636
3954
|
S: this,
|
|
3637
3955
|
C: (f, a) => f(...a)
|
|
@@ -3639,7 +3957,7 @@ var Lock = class {
|
|
|
3639
3957
|
this._fileHandle = await import_lock_file.LockFile.acquire(this._lockPath);
|
|
3640
3958
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3641
3959
|
(0, import_log13.log)("acquired lock", void 0, {
|
|
3642
|
-
F:
|
|
3960
|
+
F: __dxlog_file15,
|
|
3643
3961
|
L: 37,
|
|
3644
3962
|
S: this,
|
|
3645
3963
|
C: (f, a) => f(...a)
|
|
@@ -3648,7 +3966,15 @@ var Lock = class {
|
|
|
3648
3966
|
async release() {
|
|
3649
3967
|
var _a;
|
|
3650
3968
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3651
|
-
(0,
|
|
3969
|
+
(0, import_invariant12.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
3970
|
+
F: __dxlog_file15,
|
|
3971
|
+
L: 42,
|
|
3972
|
+
S: this,
|
|
3973
|
+
A: [
|
|
3974
|
+
"this._fileHandle",
|
|
3975
|
+
"'Lock is not acquired'"
|
|
3976
|
+
]
|
|
3977
|
+
});
|
|
3652
3978
|
await import_lock_file.LockFile.release(this._fileHandle);
|
|
3653
3979
|
}
|
|
3654
3980
|
};
|
|
@@ -3928,7 +4254,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
3928
4254
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3929
4255
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3930
4256
|
}
|
|
3931
|
-
var
|
|
4257
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
3932
4258
|
var createDefaultModelFactory = () => {
|
|
3933
4259
|
return new import_model_factory.ModelFactory().registerModel(import_document_model.DocumentModel).registerModel(import_text_model.TextModel);
|
|
3934
4260
|
};
|
|
@@ -4009,9 +4335,25 @@ var ClientServicesHost = class {
|
|
|
4009
4335
|
*/
|
|
4010
4336
|
initialize({ config, ...options }) {
|
|
4011
4337
|
var _a, _b, _c;
|
|
4012
|
-
(0,
|
|
4338
|
+
(0, import_invariant13.invariant)(!this._open, "service host is open", {
|
|
4339
|
+
F: __dxlog_file16,
|
|
4340
|
+
L: 167,
|
|
4341
|
+
S: this,
|
|
4342
|
+
A: [
|
|
4343
|
+
"!this._open",
|
|
4344
|
+
"'service host is open'"
|
|
4345
|
+
]
|
|
4346
|
+
});
|
|
4013
4347
|
if (config) {
|
|
4014
|
-
(0,
|
|
4348
|
+
(0, import_invariant13.invariant)(!this._config, "config already set", {
|
|
4349
|
+
F: __dxlog_file16,
|
|
4350
|
+
L: 170,
|
|
4351
|
+
S: this,
|
|
4352
|
+
A: [
|
|
4353
|
+
"!this._config",
|
|
4354
|
+
"'config already set'"
|
|
4355
|
+
]
|
|
4356
|
+
});
|
|
4015
4357
|
this._config = config;
|
|
4016
4358
|
if (!this._storage) {
|
|
4017
4359
|
this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
|
|
@@ -4021,7 +4363,15 @@ var ClientServicesHost = class {
|
|
|
4021
4363
|
iceServers: (_a = this._config) == null ? void 0 : _a.get("runtime.services.ice")
|
|
4022
4364
|
}), signalManager = new import_messaging.WebsocketSignalManager((_c = (_b = this._config) == null ? void 0 : _b.get("runtime.services.signaling")) != null ? _c : []) } = options;
|
|
4023
4365
|
this._signalManager = signalManager;
|
|
4024
|
-
(0,
|
|
4366
|
+
(0, import_invariant13.invariant)(!this._networkManager, "network manager already set", {
|
|
4367
|
+
F: __dxlog_file16,
|
|
4368
|
+
L: 187,
|
|
4369
|
+
S: this,
|
|
4370
|
+
A: [
|
|
4371
|
+
"!this._networkManager",
|
|
4372
|
+
"'network manager already set'"
|
|
4373
|
+
]
|
|
4374
|
+
});
|
|
4025
4375
|
this._networkManager = new import_network_manager2.NetworkManager({
|
|
4026
4376
|
log: connectionLog,
|
|
4027
4377
|
transportFactory,
|
|
@@ -4037,21 +4387,53 @@ var ClientServicesHost = class {
|
|
|
4037
4387
|
import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.begin({
|
|
4038
4388
|
id: traceId
|
|
4039
4389
|
}), {
|
|
4040
|
-
F:
|
|
4041
|
-
L:
|
|
4390
|
+
F: __dxlog_file16,
|
|
4391
|
+
L: 202,
|
|
4042
4392
|
S: this,
|
|
4043
4393
|
C: (f, a) => f(...a)
|
|
4044
4394
|
});
|
|
4045
|
-
(0,
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4395
|
+
(0, import_invariant13.invariant)(this._config, "config not set", {
|
|
4396
|
+
F: __dxlog_file16,
|
|
4397
|
+
L: 204,
|
|
4398
|
+
S: this,
|
|
4399
|
+
A: [
|
|
4400
|
+
"this._config",
|
|
4401
|
+
"'config not set'"
|
|
4402
|
+
]
|
|
4403
|
+
});
|
|
4404
|
+
(0, import_invariant13.invariant)(this._storage, "storage not set", {
|
|
4405
|
+
F: __dxlog_file16,
|
|
4406
|
+
L: 205,
|
|
4407
|
+
S: this,
|
|
4408
|
+
A: [
|
|
4409
|
+
"this._storage",
|
|
4410
|
+
"'storage not set'"
|
|
4411
|
+
]
|
|
4412
|
+
});
|
|
4413
|
+
(0, import_invariant13.invariant)(this._signalManager, "signal manager not set", {
|
|
4414
|
+
F: __dxlog_file16,
|
|
4415
|
+
L: 206,
|
|
4416
|
+
S: this,
|
|
4417
|
+
A: [
|
|
4418
|
+
"this._signalManager",
|
|
4419
|
+
"'signal manager not set'"
|
|
4420
|
+
]
|
|
4421
|
+
});
|
|
4422
|
+
(0, import_invariant13.invariant)(this._networkManager, "network manager not set", {
|
|
4423
|
+
F: __dxlog_file16,
|
|
4424
|
+
L: 207,
|
|
4425
|
+
S: this,
|
|
4426
|
+
A: [
|
|
4427
|
+
"this._networkManager",
|
|
4428
|
+
"'network manager not set'"
|
|
4429
|
+
]
|
|
4430
|
+
});
|
|
4049
4431
|
this._opening = true;
|
|
4050
4432
|
(0, import_log15.log)("opening...", {
|
|
4051
4433
|
lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
|
|
4052
4434
|
}, {
|
|
4053
|
-
F:
|
|
4054
|
-
L:
|
|
4435
|
+
F: __dxlog_file16,
|
|
4436
|
+
L: 210,
|
|
4055
4437
|
S: this,
|
|
4056
4438
|
C: (f, a) => f(...a)
|
|
4057
4439
|
});
|
|
@@ -4085,16 +4467,16 @@ var ClientServicesHost = class {
|
|
|
4085
4467
|
(0, import_log15.log)("opened", {
|
|
4086
4468
|
deviceKey
|
|
4087
4469
|
}, {
|
|
4088
|
-
F:
|
|
4089
|
-
L:
|
|
4470
|
+
F: __dxlog_file16,
|
|
4471
|
+
L: 265,
|
|
4090
4472
|
S: this,
|
|
4091
4473
|
C: (f, a) => f(...a)
|
|
4092
4474
|
});
|
|
4093
4475
|
import_log15.log.trace("dxos.sdk.client-services-host.open", import_protocols9.trace.end({
|
|
4094
4476
|
id: traceId
|
|
4095
4477
|
}), {
|
|
4096
|
-
F:
|
|
4097
|
-
L:
|
|
4478
|
+
F: __dxlog_file16,
|
|
4479
|
+
L: 266,
|
|
4098
4480
|
S: this,
|
|
4099
4481
|
C: (f, a) => f(...a)
|
|
4100
4482
|
});
|
|
@@ -4108,8 +4490,8 @@ var ClientServicesHost = class {
|
|
|
4108
4490
|
(0, import_log15.log)("closing...", {
|
|
4109
4491
|
deviceKey
|
|
4110
4492
|
}, {
|
|
4111
|
-
F:
|
|
4112
|
-
L:
|
|
4493
|
+
F: __dxlog_file16,
|
|
4494
|
+
L: 276,
|
|
4113
4495
|
S: this,
|
|
4114
4496
|
C: (f, a) => f(...a)
|
|
4115
4497
|
});
|
|
@@ -4123,8 +4505,8 @@ var ClientServicesHost = class {
|
|
|
4123
4505
|
(0, import_log15.log)("closed", {
|
|
4124
4506
|
deviceKey
|
|
4125
4507
|
}, {
|
|
4126
|
-
F:
|
|
4127
|
-
L:
|
|
4508
|
+
F: __dxlog_file16,
|
|
4509
|
+
L: 282,
|
|
4128
4510
|
S: this,
|
|
4129
4511
|
C: (f, a) => f(...a)
|
|
4130
4512
|
});
|
|
@@ -4135,30 +4517,30 @@ var ClientServicesHost = class {
|
|
|
4135
4517
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.begin({
|
|
4136
4518
|
id: traceId
|
|
4137
4519
|
}), {
|
|
4138
|
-
F:
|
|
4139
|
-
L:
|
|
4520
|
+
F: __dxlog_file16,
|
|
4521
|
+
L: 287,
|
|
4140
4522
|
S: this,
|
|
4141
4523
|
C: (f, a) => f(...a)
|
|
4142
4524
|
});
|
|
4143
4525
|
(0, import_log15.log)("resetting...", void 0, {
|
|
4144
|
-
F:
|
|
4145
|
-
L:
|
|
4526
|
+
F: __dxlog_file16,
|
|
4527
|
+
L: 289,
|
|
4146
4528
|
S: this,
|
|
4147
4529
|
C: (f, a) => f(...a)
|
|
4148
4530
|
});
|
|
4149
4531
|
await ((_a = this._serviceContext) == null ? void 0 : _a.close());
|
|
4150
4532
|
await this._storage.reset();
|
|
4151
4533
|
(0, import_log15.log)("reset", void 0, {
|
|
4152
|
-
F:
|
|
4153
|
-
L:
|
|
4534
|
+
F: __dxlog_file16,
|
|
4535
|
+
L: 292,
|
|
4154
4536
|
S: this,
|
|
4155
4537
|
C: (f, a) => f(...a)
|
|
4156
4538
|
});
|
|
4157
4539
|
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols9.trace.end({
|
|
4158
4540
|
id: traceId
|
|
4159
4541
|
}), {
|
|
4160
|
-
F:
|
|
4161
|
-
L:
|
|
4542
|
+
F: __dxlog_file16,
|
|
4543
|
+
L: 293,
|
|
4162
4544
|
S: this,
|
|
4163
4545
|
C: (f, a) => f(...a)
|
|
4164
4546
|
});
|
|
@@ -4181,11 +4563,12 @@ var import_network_manager3 = require("@dxos/network-manager");
|
|
|
4181
4563
|
var import_util9 = require("@dxos/util");
|
|
4182
4564
|
|
|
4183
4565
|
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
4184
|
-
var import_tiny_invariant14 = __toESM(require("tiny-invariant"));
|
|
4185
4566
|
var import_async18 = require("@dxos/async");
|
|
4186
4567
|
var import_client_protocol6 = require("@dxos/client-protocol");
|
|
4568
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
4187
4569
|
var import_iframe = require("@dxos/protocols/proto/dxos/iframe");
|
|
4188
4570
|
var import_rpc2 = require("@dxos/rpc");
|
|
4571
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/shell-runtime.ts";
|
|
4189
4572
|
var ShellRuntimeImpl = class {
|
|
4190
4573
|
constructor(_port) {
|
|
4191
4574
|
this._port = _port;
|
|
@@ -4211,7 +4594,15 @@ var ShellRuntimeImpl = class {
|
|
|
4211
4594
|
});
|
|
4212
4595
|
}
|
|
4213
4596
|
async setAppContext(context) {
|
|
4214
|
-
(0,
|
|
4597
|
+
(0, import_invariant14.invariant)(this._appRpc, "runtime not open", {
|
|
4598
|
+
F: __dxlog_file17,
|
|
4599
|
+
L: 44,
|
|
4600
|
+
S: this,
|
|
4601
|
+
A: [
|
|
4602
|
+
"this._appRpc",
|
|
4603
|
+
"'runtime not open'"
|
|
4604
|
+
]
|
|
4605
|
+
});
|
|
4215
4606
|
await this._appRpc.rpc.AppService.setContext(context);
|
|
4216
4607
|
}
|
|
4217
4608
|
async open() {
|
|
@@ -4250,7 +4641,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4250
4641
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4251
4642
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4252
4643
|
}
|
|
4253
|
-
var
|
|
4644
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts";
|
|
4254
4645
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
4255
4646
|
var IFrameHostRuntime = class {
|
|
4256
4647
|
constructor({ config, origin, appPort, shellPort }) {
|
|
@@ -4272,7 +4663,7 @@ var IFrameHostRuntime = class {
|
|
|
4272
4663
|
async start() {
|
|
4273
4664
|
var _a;
|
|
4274
4665
|
(0, import_log16.log)("starting...", void 0, {
|
|
4275
|
-
F:
|
|
4666
|
+
F: __dxlog_file18,
|
|
4276
4667
|
L: 70,
|
|
4277
4668
|
S: this,
|
|
4278
4669
|
C: (f, a) => f(...a)
|
|
@@ -4321,7 +4712,7 @@ var IFrameHostRuntime = class {
|
|
|
4321
4712
|
]);
|
|
4322
4713
|
this._ready.wake(void 0);
|
|
4323
4714
|
(0, import_log16.log)("started", void 0, {
|
|
4324
|
-
F:
|
|
4715
|
+
F: __dxlog_file18,
|
|
4325
4716
|
L: 113,
|
|
4326
4717
|
S: this,
|
|
4327
4718
|
C: (f, a) => f(...a)
|
|
@@ -4329,7 +4720,7 @@ var IFrameHostRuntime = class {
|
|
|
4329
4720
|
} catch (err) {
|
|
4330
4721
|
this._ready.wake(err);
|
|
4331
4722
|
import_log16.log.catch(err, void 0, {
|
|
4332
|
-
F:
|
|
4723
|
+
F: __dxlog_file18,
|
|
4333
4724
|
L: 116,
|
|
4334
4725
|
S: this,
|
|
4335
4726
|
C: (f, a) => f(...a)
|
|
@@ -4339,7 +4730,7 @@ var IFrameHostRuntime = class {
|
|
|
4339
4730
|
async stop() {
|
|
4340
4731
|
var _a;
|
|
4341
4732
|
(0, import_log16.log)("stopping...", void 0, {
|
|
4342
|
-
F:
|
|
4733
|
+
F: __dxlog_file18,
|
|
4343
4734
|
L: 121,
|
|
4344
4735
|
S: this,
|
|
4345
4736
|
C: (f, a) => f(...a)
|
|
@@ -4348,7 +4739,7 @@ var IFrameHostRuntime = class {
|
|
|
4348
4739
|
await this._clientServices.close();
|
|
4349
4740
|
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
4350
4741
|
(0, import_log16.log)("stopped", void 0, {
|
|
4351
|
-
F:
|
|
4742
|
+
F: __dxlog_file18,
|
|
4352
4743
|
L: 125,
|
|
4353
4744
|
S: this,
|
|
4354
4745
|
C: (f, a) => f(...a)
|
|
@@ -4367,7 +4758,7 @@ var import_log17 = require("@dxos/log");
|
|
|
4367
4758
|
var import_network_manager4 = require("@dxos/network-manager");
|
|
4368
4759
|
var import_rpc3 = require("@dxos/rpc");
|
|
4369
4760
|
var import_util10 = require("@dxos/util");
|
|
4370
|
-
var
|
|
4761
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts";
|
|
4371
4762
|
var IFrameProxyRuntime = class {
|
|
4372
4763
|
constructor({ config, systemPort, shellPort }) {
|
|
4373
4764
|
this._id = String(Math.floor(Math.random() * 1e6));
|
|
@@ -4416,7 +4807,7 @@ var IFrameProxyRuntime = class {
|
|
|
4416
4807
|
});
|
|
4417
4808
|
} catch (err) {
|
|
4418
4809
|
import_log17.log.catch(err, void 0, {
|
|
4419
|
-
F:
|
|
4810
|
+
F: __dxlog_file19,
|
|
4420
4811
|
L: 85,
|
|
4421
4812
|
S: this,
|
|
4422
4813
|
C: (f, a) => f(...a)
|
|
@@ -4444,9 +4835,9 @@ var import_messaging3 = require("@dxos/messaging");
|
|
|
4444
4835
|
var import_network_manager5 = require("@dxos/network-manager");
|
|
4445
4836
|
|
|
4446
4837
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
4447
|
-
var import_tiny_invariant15 = __toESM(require("tiny-invariant"));
|
|
4448
4838
|
var import_async21 = require("@dxos/async");
|
|
4449
4839
|
var import_client_protocol9 = require("@dxos/client-protocol");
|
|
4840
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
4450
4841
|
var import_log18 = require("@dxos/log");
|
|
4451
4842
|
var import_rpc4 = require("@dxos/rpc");
|
|
4452
4843
|
var import_util11 = require("@dxos/util");
|
|
@@ -4460,12 +4851,20 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
4460
4851
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4461
4852
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4462
4853
|
}
|
|
4463
|
-
var
|
|
4854
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-session.ts";
|
|
4464
4855
|
var WorkerSession = class {
|
|
4465
4856
|
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
|
|
4466
4857
|
this._startTrigger = new import_async21.Trigger();
|
|
4467
4858
|
this.onClose = new import_util11.Callback();
|
|
4468
|
-
(0,
|
|
4859
|
+
(0, import_invariant15.invariant)(serviceHost, void 0, {
|
|
4860
|
+
F: __dxlog_file20,
|
|
4861
|
+
L: 49,
|
|
4862
|
+
S: this,
|
|
4863
|
+
A: [
|
|
4864
|
+
"serviceHost",
|
|
4865
|
+
""
|
|
4866
|
+
]
|
|
4867
|
+
});
|
|
4469
4868
|
this._serviceHost = serviceHost;
|
|
4470
4869
|
const middleware = {
|
|
4471
4870
|
handleCall: async (method, params, handler) => {
|
|
@@ -4513,8 +4912,8 @@ var WorkerSession = class {
|
|
|
4513
4912
|
await this.close();
|
|
4514
4913
|
} catch (err) {
|
|
4515
4914
|
import_log18.log.catch(err, void 0, {
|
|
4516
|
-
F:
|
|
4517
|
-
L:
|
|
4915
|
+
F: __dxlog_file20,
|
|
4916
|
+
L: 98,
|
|
4518
4917
|
S: this,
|
|
4519
4918
|
C: (f, a) => f(...a)
|
|
4520
4919
|
});
|
|
@@ -4530,8 +4929,8 @@ var WorkerSession = class {
|
|
|
4530
4929
|
}
|
|
4531
4930
|
async open() {
|
|
4532
4931
|
import_log18.log.info("opening...", void 0, {
|
|
4533
|
-
F:
|
|
4534
|
-
L:
|
|
4932
|
+
F: __dxlog_file20,
|
|
4933
|
+
L: 112,
|
|
4535
4934
|
S: this,
|
|
4536
4935
|
C: (f, a) => f(...a)
|
|
4537
4936
|
});
|
|
@@ -4547,16 +4946,16 @@ var WorkerSession = class {
|
|
|
4547
4946
|
void this._afterLockReleases(this.lockKey, () => this.close());
|
|
4548
4947
|
}
|
|
4549
4948
|
import_log18.log.info("opened", void 0, {
|
|
4550
|
-
F:
|
|
4551
|
-
L:
|
|
4949
|
+
F: __dxlog_file20,
|
|
4950
|
+
L: 119,
|
|
4552
4951
|
S: this,
|
|
4553
4952
|
C: (f, a) => f(...a)
|
|
4554
4953
|
});
|
|
4555
4954
|
}
|
|
4556
4955
|
async close() {
|
|
4557
4956
|
import_log18.log.info("closing...", void 0, {
|
|
4558
|
-
F:
|
|
4559
|
-
L:
|
|
4957
|
+
F: __dxlog_file20,
|
|
4958
|
+
L: 123,
|
|
4560
4959
|
S: this,
|
|
4561
4960
|
C: (f, a) => f(...a)
|
|
4562
4961
|
});
|
|
@@ -4564,8 +4963,8 @@ var WorkerSession = class {
|
|
|
4564
4963
|
await this.onClose.callIfSet();
|
|
4565
4964
|
} catch (err) {
|
|
4566
4965
|
import_log18.log.catch(err, void 0, {
|
|
4567
|
-
F:
|
|
4568
|
-
L:
|
|
4966
|
+
F: __dxlog_file20,
|
|
4967
|
+
L: 127,
|
|
4569
4968
|
S: this,
|
|
4570
4969
|
C: (f, a) => f(...a)
|
|
4571
4970
|
});
|
|
@@ -4575,8 +4974,8 @@ var WorkerSession = class {
|
|
|
4575
4974
|
this._iframeRpc.close()
|
|
4576
4975
|
]);
|
|
4577
4976
|
import_log18.log.info("closed", void 0, {
|
|
4578
|
-
F:
|
|
4579
|
-
L:
|
|
4977
|
+
F: __dxlog_file20,
|
|
4978
|
+
L: 131,
|
|
4580
4979
|
S: this,
|
|
4581
4980
|
C: (f, a) => f(...a)
|
|
4582
4981
|
});
|
|
@@ -4586,8 +4985,8 @@ var WorkerSession = class {
|
|
|
4586
4985
|
await (0, import_async21.asyncTimeout)(this._shellClientRpc.open(), 1e3);
|
|
4587
4986
|
} catch (e) {
|
|
4588
4987
|
import_log18.log.info("No shell connected.", void 0, {
|
|
4589
|
-
F:
|
|
4590
|
-
L:
|
|
4988
|
+
F: __dxlog_file20,
|
|
4989
|
+
L: 138,
|
|
4591
4990
|
S: this,
|
|
4592
4991
|
C: (f, a) => f(...a)
|
|
4593
4992
|
});
|
|
@@ -4606,7 +5005,7 @@ _ts_decorate6([
|
|
|
4606
5005
|
], WorkerSession.prototype, "lockKey", void 0);
|
|
4607
5006
|
|
|
4608
5007
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
4609
|
-
var
|
|
5008
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/vault/worker-runtime.ts";
|
|
4610
5009
|
var WorkerRuntime = class {
|
|
4611
5010
|
// prettier-ignore
|
|
4612
5011
|
constructor(_configProvider) {
|
|
@@ -4627,7 +5026,7 @@ var WorkerRuntime = class {
|
|
|
4627
5026
|
}
|
|
4628
5027
|
async start() {
|
|
4629
5028
|
(0, import_log19.log)("starting...", void 0, {
|
|
4630
|
-
F:
|
|
5029
|
+
F: __dxlog_file21,
|
|
4631
5030
|
L: 48,
|
|
4632
5031
|
S: this,
|
|
4633
5032
|
C: (f, a) => f(...a)
|
|
@@ -4643,7 +5042,7 @@ var WorkerRuntime = class {
|
|
|
4643
5042
|
await this._clientServices.open();
|
|
4644
5043
|
this._ready.wake(void 0);
|
|
4645
5044
|
(0, import_log19.log)("started", void 0, {
|
|
4646
|
-
F:
|
|
5045
|
+
F: __dxlog_file21,
|
|
4647
5046
|
L: 62,
|
|
4648
5047
|
S: this,
|
|
4649
5048
|
C: (f, a) => f(...a)
|
|
@@ -4651,7 +5050,7 @@ var WorkerRuntime = class {
|
|
|
4651
5050
|
} catch (err) {
|
|
4652
5051
|
this._ready.wake(err);
|
|
4653
5052
|
import_log19.log.catch(err, void 0, {
|
|
4654
|
-
F:
|
|
5053
|
+
F: __dxlog_file21,
|
|
4655
5054
|
L: 65,
|
|
4656
5055
|
S: this,
|
|
4657
5056
|
C: (f, a) => f(...a)
|
|
@@ -4685,7 +5084,7 @@ var WorkerRuntime = class {
|
|
|
4685
5084
|
*/
|
|
4686
5085
|
_reconnectWebrtc() {
|
|
4687
5086
|
(0, import_log19.log)("reconnecting webrtc...", void 0, {
|
|
4688
|
-
F:
|
|
5087
|
+
F: __dxlog_file21,
|
|
4689
5088
|
L: 102,
|
|
4690
5089
|
S: this,
|
|
4691
5090
|
C: (f, a) => f(...a)
|