@dxos/client-services 0.1.30-next.7c60cd3 → 0.1.30
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-JLLUQQXD.mjs → chunk-DFO3FW2W.mjs} +949 -1150
- package/dist/lib/browser/chunk-DFO3FW2W.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -41
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +221 -50
- package/dist/lib/browser/packlets/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +837 -1062
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +2937 -2719
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/invitations/device-invitations-handler.d.ts +1 -2
- package/dist/types/src/packlets/invitations/device-invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitations-service.d.ts +1 -1
- package/dist/types/src/packlets/invitations/device-invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/index.d.ts +0 -6
- package/dist/types/src/packlets/invitations/index.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +2 -3
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts +2 -4
- package/dist/types/src/packlets/invitations/space-invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitations-service.d.ts +2 -3
- package/dist/types/src/packlets/invitations/space-invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +22 -0
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -0
- package/dist/types/src/packlets/services/index.d.ts +2 -3
- package/dist/types/src/packlets/services/index.d.ts.map +1 -1
- package/dist/types/src/packlets/services/local-client-services.d.ts +3 -2
- package/dist/types/src/packlets/services/local-client-services.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +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 +22 -8
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-registry.d.ts +3 -1
- package/dist/types/src/packlets/services/service-registry.d.ts.map +1 -1
- package/dist/types/src/packlets/services/utils.d.ts +7 -0
- package/dist/types/src/packlets/services/utils.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +8 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/index.d.ts +2 -0
- package/dist/types/src/packlets/spaces/index.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 +4 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +2 -2
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/host-test-builder.d.ts +43 -0
- package/dist/types/src/packlets/testing/host-test-builder.d.ts.map +1 -0
- package/dist/types/src/packlets/testing/index.d.ts +1 -0
- package/dist/types/src/packlets/testing/index.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +32 -34
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/tests/client-services.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/client-services.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/client.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/client.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/halo-credentials.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/halo-credentials.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/halo-persistent.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/halo-persistent.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/halo-profile.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/halo-profile.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/shared-worker.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/shared-worker.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/spaces-invitations.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/spaces-invitations.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/spaces.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/spaces.test.d.ts.map +1 -0
- package/dist/types/src/packlets/tests/text.test.d.ts +2 -0
- package/dist/types/src/packlets/tests/text.test.d.ts.map +1 -0
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts +0 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-proxy-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/index.d.ts +0 -2
- package/dist/types/src/packlets/vault/index.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-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-session.d.ts +4 -4
- package/dist/types/src/packlets/vault/worker-session.d.ts.map +1 -1
- package/package.json +31 -30
- package/src/packlets/invitations/device-invitations-handler.ts +10 -9
- package/src/packlets/invitations/device-invitations-service.test.ts +1 -1
- package/src/packlets/invitations/device-invitations-service.ts +1 -1
- package/src/packlets/invitations/index.ts +0 -6
- package/src/packlets/invitations/invitations-service.ts +7 -2
- package/src/packlets/invitations/space-invitations-handler.test.ts +3 -3
- package/src/packlets/invitations/space-invitations-handler.ts +11 -11
- package/src/packlets/invitations/space-invitations-service.test.ts +1 -1
- package/src/packlets/invitations/space-invitations-service.ts +2 -3
- package/src/packlets/services/client-rpc-server.ts +91 -0
- package/src/packlets/services/index.ts +2 -3
- package/src/packlets/services/local-client-services.ts +5 -1
- package/src/packlets/services/service-context.test.ts +4 -4
- package/src/packlets/services/service-context.ts +1 -1
- package/src/packlets/services/service-host.ts +52 -19
- package/src/packlets/services/service-registry.test.ts +2 -2
- package/src/packlets/services/service-registry.ts +9 -1
- package/src/packlets/services/utils.ts +53 -0
- package/src/packlets/spaces/data-space-manager.test.ts +64 -4
- package/src/packlets/spaces/data-space-manager.ts +11 -7
- package/src/packlets/spaces/data-space.ts +13 -1
- package/src/packlets/spaces/index.ts +2 -0
- package/src/packlets/spaces/notarization-plugin.ts +9 -2
- package/src/packlets/spaces/spaces-service.ts +25 -0
- package/src/packlets/system/system-service.ts +3 -3
- package/src/packlets/testing/host-test-builder.ts +163 -0
- package/src/packlets/testing/index.ts +1 -0
- package/src/packlets/testing/invitation-utils.ts +1 -2
- package/src/packlets/testing/test-builder.ts +156 -138
- package/src/packlets/tests/client-services.test.ts +252 -0
- package/src/packlets/tests/client.test.ts +143 -0
- package/src/packlets/tests/halo-credentials.test.ts +94 -0
- package/src/packlets/tests/halo-persistent.test.ts +53 -0
- package/src/packlets/tests/halo-profile.test.ts +74 -0
- package/src/packlets/tests/shared-worker.test.ts +93 -0
- package/src/packlets/tests/spaces-invitations.test.ts +64 -0
- package/src/packlets/tests/spaces.test.ts +136 -0
- package/src/packlets/tests/text.test.ts +206 -0
- package/src/packlets/vault/iframe-host-runtime.ts +26 -34
- package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
- package/src/packlets/vault/index.ts +0 -2
- package/src/packlets/vault/shell-runtime.ts +1 -2
- package/src/packlets/vault/worker-runtime.ts +5 -15
- package/src/packlets/vault/worker-session.ts +39 -23
- package/dist/lib/browser/chunk-JLLUQQXD.mjs.map +0 -7
- package/dist/types/src/packlets/invitations/device-invitations-proxy.d.ts +0 -8
- package/dist/types/src/packlets/invitations/device-invitations-proxy.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/encoder.d.ts +0 -9
- package/dist/types/src/packlets/invitations/encoder.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/encoder.test.d.ts +0 -2
- package/dist/types/src/packlets/invitations/encoder.test.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +0 -56
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/invitations-proxy.d.ts +0 -18
- package/dist/types/src/packlets/invitations/invitations-proxy.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/invitations.d.ts +0 -55
- package/dist/types/src/packlets/invitations/invitations.d.ts.map +0 -1
- package/dist/types/src/packlets/invitations/space-invitations-proxy.d.ts +0 -11
- package/dist/types/src/packlets/invitations/space-invitations-proxy.d.ts.map +0 -1
- package/dist/types/src/packlets/services/service-definitions.d.ts +0 -30
- package/dist/types/src/packlets/services/service-definitions.d.ts.map +0 -1
- package/dist/types/src/packlets/services/service-proxy.d.ts +0 -17
- package/dist/types/src/packlets/services/service-proxy.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/services.d.ts +0 -21
- package/dist/types/src/packlets/vault/services.d.ts.map +0 -1
- package/dist/types/src/packlets/vault/shell-controller.d.ts +0 -18
- package/dist/types/src/packlets/vault/shell-controller.d.ts.map +0 -1
- package/src/packlets/invitations/device-invitations-proxy.ts +0 -14
- package/src/packlets/invitations/encoder.test.ts +0 -23
- package/src/packlets/invitations/encoder.ts +0 -26
- package/src/packlets/invitations/invitations-handler.ts +0 -68
- package/src/packlets/invitations/invitations-proxy.ts +0 -159
- package/src/packlets/invitations/invitations.ts +0 -113
- package/src/packlets/invitations/space-invitations-proxy.ts +0 -16
- package/src/packlets/services/service-definitions.ts +0 -68
- package/src/packlets/services/service-proxy.ts +0 -54
- package/src/packlets/vault/services.ts +0 -42
- package/src/packlets/vault/shell-controller.ts +0 -56
|
@@ -804,79 +804,17 @@ var IdentityServiceImpl = class {
|
|
|
804
804
|
}
|
|
805
805
|
};
|
|
806
806
|
|
|
807
|
-
// packages/sdk/client-services/src/packlets/invitations/encoder.ts
|
|
808
|
-
import base from "base-x";
|
|
809
|
-
import { schema as schema2 } from "@dxos/protocols";
|
|
810
|
-
var base62 = base("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
811
|
-
var codec = schema2.getCodecForType("dxos.client.services.Invitation");
|
|
812
|
-
var InvitationEncoder = class {
|
|
813
|
-
static decode(text) {
|
|
814
|
-
return codec.decode(base62.decode(text));
|
|
815
|
-
}
|
|
816
|
-
static encode(invitation) {
|
|
817
|
-
return base62.encode(codec.encode(invitation));
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
|
|
821
|
-
// packages/sdk/client-services/src/packlets/invitations/invitations.ts
|
|
822
|
-
import assert4 from "@dxos/node-std/assert";
|
|
823
|
-
import { CancellableObservableProvider } from "@dxos/async";
|
|
824
|
-
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
825
|
-
var AUTHENTICATION_CODE_LENGTH = 6;
|
|
826
|
-
var INVITATION_TIMEOUT = 3 * 6e4;
|
|
827
|
-
var ON_CLOSE_DELAY = 1e3;
|
|
828
|
-
var InvitationObservableProvider = class extends CancellableObservableProvider {
|
|
829
|
-
get invitation() {
|
|
830
|
-
return this._invitation;
|
|
831
|
-
}
|
|
832
|
-
setInvitation(invitation) {
|
|
833
|
-
this._invitation = invitation;
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
var AuthenticatingInvitationProvider = class extends InvitationObservableProvider {
|
|
837
|
-
// prettier-ignore
|
|
838
|
-
constructor(_actions) {
|
|
839
|
-
super(() => this._actions.onCancel());
|
|
840
|
-
this._actions = _actions;
|
|
841
|
-
}
|
|
842
|
-
async authenticate(authenticationCode) {
|
|
843
|
-
return this._actions.onAuthenticate(authenticationCode);
|
|
844
|
-
}
|
|
845
|
-
};
|
|
846
|
-
var wrapObservable = async (observable) => {
|
|
847
|
-
return new Promise((resolve, reject) => {
|
|
848
|
-
const unsubscribe = observable.subscribe({
|
|
849
|
-
onSuccess: (invitation) => {
|
|
850
|
-
assert4(invitation.state === Invitation.State.SUCCESS);
|
|
851
|
-
unsubscribe();
|
|
852
|
-
resolve(invitation);
|
|
853
|
-
},
|
|
854
|
-
onError: (err) => {
|
|
855
|
-
unsubscribe();
|
|
856
|
-
reject(err);
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
});
|
|
860
|
-
};
|
|
861
|
-
|
|
862
|
-
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
863
|
-
var AbstractInvitationsHandler = class {
|
|
864
|
-
// prettier-ignore
|
|
865
|
-
constructor(_networkManager) {
|
|
866
|
-
this._networkManager = _networkManager;
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
|
|
870
807
|
// packages/sdk/client-services/src/packlets/invitations/device-invitations-handler.ts
|
|
871
|
-
import
|
|
808
|
+
import assert4 from "@dxos/node-std/assert";
|
|
872
809
|
import { scheduleTask, sleep, Trigger as Trigger2 } from "@dxos/async";
|
|
810
|
+
import { AbstractInvitationsHandler, AuthenticatingInvitationProvider, AUTHENTICATION_CODE_LENGTH, InvitationObservableProvider, INVITATION_TIMEOUT, ON_CLOSE_DELAY } from "@dxos/client";
|
|
873
811
|
import { Context as Context3 } from "@dxos/context";
|
|
874
812
|
import { generatePasscode } from "@dxos/credentials";
|
|
875
813
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
876
814
|
import { log as log4 } from "@dxos/log";
|
|
877
815
|
import { createTeleportProtocolFactory, StarTopology } from "@dxos/network-manager";
|
|
878
|
-
import { schema as
|
|
879
|
-
import { Invitation
|
|
816
|
+
import { schema as schema2 } from "@dxos/protocols";
|
|
817
|
+
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
880
818
|
import { AuthenticationResponse } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
881
819
|
import { RpcExtension } from "@dxos/teleport";
|
|
882
820
|
var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
@@ -890,7 +828,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
890
828
|
*/
|
|
891
829
|
createInvitation(context, options) {
|
|
892
830
|
const { type, timeout = INVITATION_TIMEOUT, swarmKey } = options != null ? options : {};
|
|
893
|
-
|
|
831
|
+
assert4(type !== Invitation.Type.OFFLINE);
|
|
894
832
|
const identity = this._params.getIdentity();
|
|
895
833
|
const invitation = {
|
|
896
834
|
type,
|
|
@@ -916,7 +854,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
916
854
|
host: identity.deviceKey
|
|
917
855
|
}, {
|
|
918
856
|
file: "device-invitations-handler.ts",
|
|
919
|
-
line:
|
|
857
|
+
line: 92,
|
|
920
858
|
scope: this,
|
|
921
859
|
callSite: (f, a) => f(...a)
|
|
922
860
|
});
|
|
@@ -932,7 +870,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
932
870
|
authenticationCode: code
|
|
933
871
|
}, {
|
|
934
872
|
file: "device-invitations-handler.ts",
|
|
935
|
-
line:
|
|
873
|
+
line: 106,
|
|
936
874
|
scope: this,
|
|
937
875
|
callSite: (f, a) => f(...a)
|
|
938
876
|
});
|
|
@@ -944,7 +882,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
944
882
|
// TODO(burdon): Not used: controlFeedKey, dataFeedKey.
|
|
945
883
|
presentAdmissionCredentials: async (credentials) => {
|
|
946
884
|
try {
|
|
947
|
-
if (invitation.type !==
|
|
885
|
+
if (invitation.type !== Invitation.Type.INTERACTIVE_TESTING) {
|
|
948
886
|
if (invitation.authenticationCode === void 0 || invitation.authenticationCode !== authenticationCode) {
|
|
949
887
|
throw new Error(`invalid authentication code: ${authenticationCode}`);
|
|
950
888
|
}
|
|
@@ -954,7 +892,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
954
892
|
guest: credentials.deviceKey
|
|
955
893
|
}, {
|
|
956
894
|
file: "device-invitations-handler.ts",
|
|
957
|
-
line:
|
|
895
|
+
line: 121,
|
|
958
896
|
scope: this,
|
|
959
897
|
callSite: (f, a) => f(...a)
|
|
960
898
|
});
|
|
@@ -973,7 +911,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
973
911
|
host: identity.deviceKey
|
|
974
912
|
}, {
|
|
975
913
|
file: "device-invitations-handler.ts",
|
|
976
|
-
line:
|
|
914
|
+
line: 137,
|
|
977
915
|
scope: this,
|
|
978
916
|
callSite: (f, a) => f(...a)
|
|
979
917
|
});
|
|
@@ -986,7 +924,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
986
924
|
guest: deviceKey
|
|
987
925
|
}, {
|
|
988
926
|
file: "device-invitations-handler.ts",
|
|
989
|
-
line:
|
|
927
|
+
line: 140,
|
|
990
928
|
scope: this,
|
|
991
929
|
callSite: (f, a) => f(...a)
|
|
992
930
|
});
|
|
@@ -995,7 +933,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
995
933
|
if (!observable.cancelled) {
|
|
996
934
|
log4.error("failed", err, {
|
|
997
935
|
file: "device-invitations-handler.ts",
|
|
998
|
-
line:
|
|
936
|
+
line: 144,
|
|
999
937
|
scope: this,
|
|
1000
938
|
callSite: (f, a) => f(...a)
|
|
1001
939
|
});
|
|
@@ -1060,22 +998,22 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1060
998
|
}
|
|
1061
999
|
log4("connected", {}, {
|
|
1062
1000
|
file: "device-invitations-handler.ts",
|
|
1063
|
-
line:
|
|
1001
|
+
line: 215,
|
|
1064
1002
|
scope: this,
|
|
1065
1003
|
callSite: (f, a) => f(...a)
|
|
1066
1004
|
});
|
|
1067
1005
|
(_b = (_a = observable.callback).onConnected) == null ? void 0 : _b.call(_a, invitation);
|
|
1068
1006
|
log4("sending admission request", {}, {
|
|
1069
1007
|
file: "device-invitations-handler.ts",
|
|
1070
|
-
line:
|
|
1008
|
+
line: 219,
|
|
1071
1009
|
scope: this,
|
|
1072
1010
|
callSite: (f, a) => f(...a)
|
|
1073
1011
|
});
|
|
1074
1012
|
const { identityKey, haloSpaceKey, genesisFeedKey } = await extension.rpc.HaloHostService.requestAdmission();
|
|
1075
|
-
if (invitation.type === void 0 || invitation.type ===
|
|
1013
|
+
if (invitation.type === void 0 || invitation.type === Invitation.Type.INTERACTIVE) {
|
|
1076
1014
|
log4("guest waiting for authentication code...", {}, {
|
|
1077
1015
|
file: "device-invitations-handler.ts",
|
|
1078
|
-
line:
|
|
1016
|
+
line: 226,
|
|
1079
1017
|
scope: this,
|
|
1080
1018
|
callSite: (f, a) => f(...a)
|
|
1081
1019
|
});
|
|
@@ -1085,7 +1023,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1085
1023
|
});
|
|
1086
1024
|
log4("sending authentication request", {}, {
|
|
1087
1025
|
file: "device-invitations-handler.ts",
|
|
1088
|
-
line:
|
|
1026
|
+
line: 229,
|
|
1089
1027
|
scope: this,
|
|
1090
1028
|
callSite: (f, a) => f(...a)
|
|
1091
1029
|
});
|
|
@@ -1103,7 +1041,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1103
1041
|
dataFeedKey
|
|
1104
1042
|
}, {
|
|
1105
1043
|
file: "device-invitations-handler.ts",
|
|
1106
|
-
line:
|
|
1044
|
+
line: 238,
|
|
1107
1045
|
scope: this,
|
|
1108
1046
|
callSite: (f, a) => f(...a)
|
|
1109
1047
|
});
|
|
@@ -1125,7 +1063,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1125
1063
|
identityKey
|
|
1126
1064
|
}, {
|
|
1127
1065
|
file: "device-invitations-handler.ts",
|
|
1128
|
-
line:
|
|
1066
|
+
line: 257,
|
|
1129
1067
|
scope: this,
|
|
1130
1068
|
callSite: (f, a) => f(...a)
|
|
1131
1069
|
});
|
|
@@ -1134,7 +1072,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1134
1072
|
if (!observable.cancelled) {
|
|
1135
1073
|
log4.warn("auth failed", err, {
|
|
1136
1074
|
file: "device-invitations-handler.ts",
|
|
1137
|
-
line:
|
|
1075
|
+
line: 261,
|
|
1138
1076
|
scope: this,
|
|
1139
1077
|
callSite: (f, a) => f(...a)
|
|
1140
1078
|
});
|
|
@@ -1150,7 +1088,7 @@ var DeviceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1150
1088
|
};
|
|
1151
1089
|
scheduleTask(ctx, async () => {
|
|
1152
1090
|
var _a, _b;
|
|
1153
|
-
|
|
1091
|
+
assert4(invitation.swarmKey);
|
|
1154
1092
|
const topic = invitation.swarmKey;
|
|
1155
1093
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
1156
1094
|
topic,
|
|
@@ -1173,7 +1111,7 @@ var HostHaloInvitationExtension = class extends RpcExtension {
|
|
|
1173
1111
|
constructor(_callbacks) {
|
|
1174
1112
|
super({
|
|
1175
1113
|
exposed: {
|
|
1176
|
-
HaloHostService:
|
|
1114
|
+
HaloHostService: schema2.getService("dxos.halo.invitations.HaloHostService")
|
|
1177
1115
|
}
|
|
1178
1116
|
});
|
|
1179
1117
|
this._callbacks = _callbacks;
|
|
@@ -1205,7 +1143,7 @@ var GuestHaloInvitationExtension = class extends RpcExtension {
|
|
|
1205
1143
|
constructor(_callbacks) {
|
|
1206
1144
|
super({
|
|
1207
1145
|
requested: {
|
|
1208
|
-
HaloHostService:
|
|
1146
|
+
HaloHostService: schema2.getService("dxos.halo.invitations.HaloHostService")
|
|
1209
1147
|
}
|
|
1210
1148
|
});
|
|
1211
1149
|
this._callbacks = _callbacks;
|
|
@@ -1219,152 +1157,11 @@ var GuestHaloInvitationExtension = class extends RpcExtension {
|
|
|
1219
1157
|
}
|
|
1220
1158
|
};
|
|
1221
1159
|
|
|
1222
|
-
// packages/sdk/client-services/src/packlets/invitations/invitations-proxy.ts
|
|
1223
|
-
import assert6 from "@dxos/node-std/assert";
|
|
1224
|
-
import { observableError } from "@dxos/async";
|
|
1225
|
-
import { log as log5 } from "@dxos/log";
|
|
1226
|
-
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1227
|
-
var AbstractInvitationsProxy = class {
|
|
1228
|
-
// prettier-ignore
|
|
1229
|
-
constructor(_invitationsService) {
|
|
1230
|
-
this._invitationsService = _invitationsService;
|
|
1231
|
-
}
|
|
1232
|
-
createInvitation(context, options) {
|
|
1233
|
-
let invitationId;
|
|
1234
|
-
const observable = new InvitationObservableProvider(async () => {
|
|
1235
|
-
if (invitationId) {
|
|
1236
|
-
await this._invitationsService.cancelInvitation({
|
|
1237
|
-
invitationId
|
|
1238
|
-
});
|
|
1239
|
-
}
|
|
1240
|
-
});
|
|
1241
|
-
const invitation = {
|
|
1242
|
-
...this.getInvitationOptions(context),
|
|
1243
|
-
...options
|
|
1244
|
-
};
|
|
1245
|
-
const stream = this._invitationsService.createInvitation(invitation);
|
|
1246
|
-
stream.subscribe((invitation2) => {
|
|
1247
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1248
|
-
observable.setInvitation(invitation2);
|
|
1249
|
-
switch (invitation2.state) {
|
|
1250
|
-
case Invitation3.State.CONNECTING: {
|
|
1251
|
-
assert6(invitation2.invitationId);
|
|
1252
|
-
invitationId = invitation2.invitationId;
|
|
1253
|
-
(_b = (_a = observable.callback).onConnecting) == null ? void 0 : _b.call(_a, invitation2);
|
|
1254
|
-
break;
|
|
1255
|
-
}
|
|
1256
|
-
case Invitation3.State.CONNECTED: {
|
|
1257
|
-
(_d = (_c = observable.callback).onConnected) == null ? void 0 : _d.call(_c, invitation2);
|
|
1258
|
-
break;
|
|
1259
|
-
}
|
|
1260
|
-
case Invitation3.State.AUTHENTICATING: {
|
|
1261
|
-
(_f = (_e = observable.callback).onAuthenticating) == null ? void 0 : _f.call(_e, invitation2);
|
|
1262
|
-
break;
|
|
1263
|
-
}
|
|
1264
|
-
case Invitation3.State.SUCCESS: {
|
|
1265
|
-
(_h = (_g = observable.callback).onSuccess) == null ? void 0 : _h.call(_g, invitation2);
|
|
1266
|
-
break;
|
|
1267
|
-
}
|
|
1268
|
-
case Invitation3.State.CANCELLED: {
|
|
1269
|
-
(_j = (_i = observable.callback).onCancelled) == null ? void 0 : _j.call(_i);
|
|
1270
|
-
break;
|
|
1271
|
-
}
|
|
1272
|
-
default: {
|
|
1273
|
-
log5.error(`Invalid state: ${invitation2.state}`, {}, {
|
|
1274
|
-
file: "invitations-proxy.ts",
|
|
1275
|
-
line: 81,
|
|
1276
|
-
scope: this,
|
|
1277
|
-
callSite: (f, a) => f(...a)
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
}, (err) => {
|
|
1282
|
-
if (err) {
|
|
1283
|
-
observableError(observable, err);
|
|
1284
|
-
}
|
|
1285
|
-
});
|
|
1286
|
-
return observable;
|
|
1287
|
-
}
|
|
1288
|
-
acceptInvitation(invitation, options) {
|
|
1289
|
-
assert6(invitation && invitation.swarmKey);
|
|
1290
|
-
const observable = new AuthenticatingInvitationProvider({
|
|
1291
|
-
onCancel: async () => {
|
|
1292
|
-
var _a;
|
|
1293
|
-
const invitationId = (_a = observable.invitation) == null ? void 0 : _a.invitationId;
|
|
1294
|
-
assert6(invitationId);
|
|
1295
|
-
await this._invitationsService.cancelInvitation({
|
|
1296
|
-
invitationId
|
|
1297
|
-
});
|
|
1298
|
-
},
|
|
1299
|
-
onAuthenticate: async (authenticationCode) => {
|
|
1300
|
-
var _a;
|
|
1301
|
-
const invitationId = (_a = observable.invitation) == null ? void 0 : _a.invitationId;
|
|
1302
|
-
assert6(invitationId);
|
|
1303
|
-
await this._invitationsService.authenticate({
|
|
1304
|
-
invitationId,
|
|
1305
|
-
authenticationCode
|
|
1306
|
-
});
|
|
1307
|
-
}
|
|
1308
|
-
});
|
|
1309
|
-
const stream = this._invitationsService.acceptInvitation({
|
|
1310
|
-
...invitation,
|
|
1311
|
-
...options
|
|
1312
|
-
});
|
|
1313
|
-
stream.subscribe((invitation2) => {
|
|
1314
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1315
|
-
assert6(invitation2.invitationId);
|
|
1316
|
-
observable.setInvitation(invitation2);
|
|
1317
|
-
switch (invitation2.state) {
|
|
1318
|
-
case Invitation3.State.CONNECTING: {
|
|
1319
|
-
(_b = (_a = observable.callback).onConnecting) == null ? void 0 : _b.call(_a, invitation2);
|
|
1320
|
-
break;
|
|
1321
|
-
}
|
|
1322
|
-
case Invitation3.State.CONNECTED: {
|
|
1323
|
-
(_d = (_c = observable.callback).onConnected) == null ? void 0 : _d.call(_c, invitation2);
|
|
1324
|
-
break;
|
|
1325
|
-
}
|
|
1326
|
-
case Invitation3.State.AUTHENTICATING: {
|
|
1327
|
-
(_f = (_e = observable.callback).onAuthenticating) == null ? void 0 : _f.call(_e, invitation2);
|
|
1328
|
-
break;
|
|
1329
|
-
}
|
|
1330
|
-
case Invitation3.State.SUCCESS: {
|
|
1331
|
-
(_h = (_g = observable.callback).onSuccess) == null ? void 0 : _h.call(_g, invitation2);
|
|
1332
|
-
break;
|
|
1333
|
-
}
|
|
1334
|
-
case Invitation3.State.CANCELLED: {
|
|
1335
|
-
(_j = (_i = observable.callback).onCancelled) == null ? void 0 : _j.call(_i);
|
|
1336
|
-
break;
|
|
1337
|
-
}
|
|
1338
|
-
default: {
|
|
1339
|
-
log5.error(`Invalid state: ${invitation2.state}`, {}, {
|
|
1340
|
-
file: "invitations-proxy.ts",
|
|
1341
|
-
line: 146,
|
|
1342
|
-
scope: this,
|
|
1343
|
-
callSite: (f, a) => f(...a)
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
}, (err) => {
|
|
1348
|
-
if (err) {
|
|
1349
|
-
observableError(observable, err);
|
|
1350
|
-
}
|
|
1351
|
-
});
|
|
1352
|
-
return observable;
|
|
1353
|
-
}
|
|
1354
|
-
};
|
|
1355
|
-
|
|
1356
|
-
// packages/sdk/client-services/src/packlets/invitations/device-invitations-proxy.ts
|
|
1357
|
-
var DeviceInvitationsProxy = class extends AbstractInvitationsProxy {
|
|
1358
|
-
getInvitationOptions() {
|
|
1359
|
-
return {};
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
1160
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
1364
|
-
import
|
|
1161
|
+
import assert5 from "@dxos/node-std/assert";
|
|
1365
1162
|
import { Stream as Stream7 } from "@dxos/codec-protobuf";
|
|
1366
|
-
import { log as
|
|
1367
|
-
import { Invitation as
|
|
1163
|
+
import { log as log5 } from "@dxos/log";
|
|
1164
|
+
import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1368
1165
|
var AbstractInvitationsService = class {
|
|
1369
1166
|
// prettier-ignore
|
|
1370
1167
|
constructor(_identityManager, _getInvitationsHandler) {
|
|
@@ -1384,9 +1181,9 @@ var AbstractInvitationsService = class {
|
|
|
1384
1181
|
return new Stream7(({ next, close }) => {
|
|
1385
1182
|
const invitationsHandler = this._getInvitationsHandler();
|
|
1386
1183
|
const context = this.getContext(invitation);
|
|
1387
|
-
|
|
1184
|
+
log5("stream opened", this.getLoggingContext(), {
|
|
1388
1185
|
file: "invitations-service.ts",
|
|
1389
|
-
line:
|
|
1186
|
+
line: 48,
|
|
1390
1187
|
scope: this,
|
|
1391
1188
|
callSite: (f, a) => f(...a)
|
|
1392
1189
|
});
|
|
@@ -1399,60 +1196,60 @@ var AbstractInvitationsService = class {
|
|
|
1399
1196
|
});
|
|
1400
1197
|
observable.subscribe({
|
|
1401
1198
|
onConnecting: (invitation2) => {
|
|
1402
|
-
|
|
1199
|
+
assert5(invitation2.invitationId);
|
|
1403
1200
|
invitationId = invitation2.invitationId;
|
|
1404
1201
|
this._createInvitations.set(invitation2.invitationId, observable);
|
|
1405
|
-
invitation2.state =
|
|
1202
|
+
invitation2.state = Invitation2.State.CONNECTING;
|
|
1406
1203
|
next(invitation2);
|
|
1407
1204
|
},
|
|
1408
1205
|
onConnected: (invitation2) => {
|
|
1409
|
-
|
|
1410
|
-
invitation2.state =
|
|
1206
|
+
assert5(invitation2.invitationId);
|
|
1207
|
+
invitation2.state = Invitation2.State.CONNECTED;
|
|
1411
1208
|
next(invitation2);
|
|
1412
1209
|
},
|
|
1413
1210
|
onAuthenticating: (invitation2) => {
|
|
1414
|
-
|
|
1415
|
-
invitation2.state =
|
|
1211
|
+
assert5(invitation2.invitationId);
|
|
1212
|
+
invitation2.state = Invitation2.State.AUTHENTICATING;
|
|
1416
1213
|
next(invitation2);
|
|
1417
1214
|
},
|
|
1418
1215
|
onSuccess: (invitation2) => {
|
|
1419
|
-
|
|
1420
|
-
invitation2.state =
|
|
1216
|
+
assert5(invitation2.invitationId);
|
|
1217
|
+
invitation2.state = Invitation2.State.SUCCESS;
|
|
1421
1218
|
next(invitation2);
|
|
1422
1219
|
close();
|
|
1423
1220
|
},
|
|
1424
1221
|
onCancelled: () => {
|
|
1425
|
-
|
|
1222
|
+
assert5(invitationId);
|
|
1426
1223
|
invitation.invitationId = invitationId;
|
|
1427
|
-
invitation.state =
|
|
1224
|
+
invitation.state = Invitation2.State.CANCELLED;
|
|
1428
1225
|
next(invitation);
|
|
1429
1226
|
close();
|
|
1430
1227
|
},
|
|
1431
1228
|
onTimeout: (err) => {
|
|
1432
|
-
invitation.state =
|
|
1229
|
+
invitation.state = Invitation2.State.TIMEOUT;
|
|
1433
1230
|
close(err);
|
|
1434
1231
|
},
|
|
1435
1232
|
onError: (err) => {
|
|
1436
|
-
invitation.state =
|
|
1233
|
+
invitation.state = Invitation2.State.ERROR;
|
|
1437
1234
|
close(err);
|
|
1438
1235
|
}
|
|
1439
1236
|
});
|
|
1440
1237
|
return (err) => {
|
|
1441
1238
|
const context2 = this.getLoggingContext();
|
|
1442
1239
|
if (err) {
|
|
1443
|
-
|
|
1240
|
+
log5.warn("stream closed", {
|
|
1444
1241
|
...context2,
|
|
1445
1242
|
err
|
|
1446
1243
|
}, {
|
|
1447
1244
|
file: "invitations-service.ts",
|
|
1448
|
-
line:
|
|
1245
|
+
line: 97,
|
|
1449
1246
|
scope: this,
|
|
1450
1247
|
callSite: (f, a) => f(...a)
|
|
1451
1248
|
});
|
|
1452
1249
|
} else {
|
|
1453
|
-
|
|
1250
|
+
log5("stream closed", context2, {
|
|
1454
1251
|
file: "invitations-service.ts",
|
|
1455
|
-
line:
|
|
1252
|
+
line: 99,
|
|
1456
1253
|
scope: this,
|
|
1457
1254
|
callSite: (f, a) => f(...a)
|
|
1458
1255
|
});
|
|
@@ -1463,9 +1260,9 @@ var AbstractInvitationsService = class {
|
|
|
1463
1260
|
}
|
|
1464
1261
|
acceptInvitation(invitation, options) {
|
|
1465
1262
|
return new Stream7(({ next, close }) => {
|
|
1466
|
-
|
|
1263
|
+
log5("stream opened", this.getLoggingContext(), {
|
|
1467
1264
|
file: "invitations-service.ts",
|
|
1468
|
-
line:
|
|
1265
|
+
line: 109,
|
|
1469
1266
|
scope: this,
|
|
1470
1267
|
callSite: (f, a) => f(...a)
|
|
1471
1268
|
});
|
|
@@ -1474,59 +1271,59 @@ var AbstractInvitationsService = class {
|
|
|
1474
1271
|
const observable = invitationsHandler.acceptInvitation(invitation, options);
|
|
1475
1272
|
observable.subscribe({
|
|
1476
1273
|
onConnecting: (invitation2) => {
|
|
1477
|
-
|
|
1274
|
+
assert5(invitation2.invitationId);
|
|
1478
1275
|
invitationId = invitation2.invitationId;
|
|
1479
1276
|
this._acceptInvitations.set(invitation2.invitationId, observable);
|
|
1480
|
-
invitation2.state =
|
|
1277
|
+
invitation2.state = Invitation2.State.CONNECTING;
|
|
1481
1278
|
next(invitation2);
|
|
1482
1279
|
},
|
|
1483
1280
|
onConnected: (invitation2) => {
|
|
1484
|
-
|
|
1485
|
-
invitation2.state =
|
|
1281
|
+
assert5(invitation2.invitationId);
|
|
1282
|
+
invitation2.state = Invitation2.State.CONNECTED;
|
|
1486
1283
|
next(invitation2);
|
|
1487
1284
|
},
|
|
1488
1285
|
onAuthenticating: (invitation2) => {
|
|
1489
|
-
|
|
1490
|
-
invitation2.state =
|
|
1286
|
+
assert5(invitation2.invitationId);
|
|
1287
|
+
invitation2.state = Invitation2.State.AUTHENTICATING;
|
|
1491
1288
|
next(invitation2);
|
|
1492
1289
|
},
|
|
1493
1290
|
onSuccess: (invitation2) => {
|
|
1494
|
-
invitation2.state =
|
|
1291
|
+
invitation2.state = Invitation2.State.SUCCESS;
|
|
1495
1292
|
next(invitation2);
|
|
1496
1293
|
close();
|
|
1497
1294
|
},
|
|
1498
1295
|
onCancelled: () => {
|
|
1499
|
-
|
|
1296
|
+
assert5(invitationId);
|
|
1500
1297
|
invitation.invitationId = invitationId;
|
|
1501
|
-
invitation.state =
|
|
1298
|
+
invitation.state = Invitation2.State.CANCELLED;
|
|
1502
1299
|
next(invitation);
|
|
1503
1300
|
close();
|
|
1504
1301
|
},
|
|
1505
1302
|
onTimeout: (err) => {
|
|
1506
|
-
invitation.state =
|
|
1303
|
+
invitation.state = Invitation2.State.TIMEOUT;
|
|
1507
1304
|
close(err);
|
|
1508
1305
|
},
|
|
1509
1306
|
onError: (err) => {
|
|
1510
|
-
invitation.state =
|
|
1307
|
+
invitation.state = Invitation2.State.ERROR;
|
|
1511
1308
|
close(err);
|
|
1512
1309
|
}
|
|
1513
1310
|
});
|
|
1514
1311
|
return (err) => {
|
|
1515
1312
|
const context = this.getLoggingContext();
|
|
1516
1313
|
if (err) {
|
|
1517
|
-
|
|
1314
|
+
log5.warn("stream closed", {
|
|
1518
1315
|
...context,
|
|
1519
1316
|
err
|
|
1520
1317
|
}, {
|
|
1521
1318
|
file: "invitations-service.ts",
|
|
1522
|
-
line:
|
|
1319
|
+
line: 157,
|
|
1523
1320
|
scope: this,
|
|
1524
1321
|
callSite: (f, a) => f(...a)
|
|
1525
1322
|
});
|
|
1526
1323
|
} else {
|
|
1527
|
-
|
|
1324
|
+
log5("stream closed", context, {
|
|
1528
1325
|
file: "invitations-service.ts",
|
|
1529
|
-
line:
|
|
1326
|
+
line: 159,
|
|
1530
1327
|
scope: this,
|
|
1531
1328
|
callSite: (f, a) => f(...a)
|
|
1532
1329
|
});
|
|
@@ -1536,20 +1333,20 @@ var AbstractInvitationsService = class {
|
|
|
1536
1333
|
});
|
|
1537
1334
|
}
|
|
1538
1335
|
async authenticate({ invitationId, authenticationCode }) {
|
|
1539
|
-
|
|
1336
|
+
log5("authenticating...", {}, {
|
|
1540
1337
|
file: "invitations-service.ts",
|
|
1541
|
-
line:
|
|
1338
|
+
line: 168,
|
|
1542
1339
|
scope: this,
|
|
1543
1340
|
callSite: (f, a) => f(...a)
|
|
1544
1341
|
});
|
|
1545
|
-
|
|
1342
|
+
assert5(invitationId);
|
|
1546
1343
|
const observable = this._acceptInvitations.get(invitationId);
|
|
1547
1344
|
if (!observable) {
|
|
1548
|
-
|
|
1345
|
+
log5.warn("invalid invitation", {
|
|
1549
1346
|
invitationId
|
|
1550
1347
|
}, {
|
|
1551
1348
|
file: "invitations-service.ts",
|
|
1552
|
-
line:
|
|
1349
|
+
line: 172,
|
|
1553
1350
|
scope: this,
|
|
1554
1351
|
callSite: (f, a) => f(...a)
|
|
1555
1352
|
});
|
|
@@ -1559,20 +1356,20 @@ var AbstractInvitationsService = class {
|
|
|
1559
1356
|
}
|
|
1560
1357
|
async cancelInvitation(invitation) {
|
|
1561
1358
|
var _a;
|
|
1562
|
-
|
|
1359
|
+
log5("cancelling...", {}, {
|
|
1563
1360
|
file: "invitations-service.ts",
|
|
1564
|
-
line:
|
|
1361
|
+
line: 179,
|
|
1565
1362
|
scope: this,
|
|
1566
1363
|
callSite: (f, a) => f(...a)
|
|
1567
1364
|
});
|
|
1568
|
-
|
|
1365
|
+
assert5(invitation.invitationId);
|
|
1569
1366
|
const observable = (_a = this._createInvitations.get(invitation.invitationId)) != null ? _a : this._acceptInvitations.get(invitation.invitationId);
|
|
1570
1367
|
if (!observable) {
|
|
1571
|
-
|
|
1368
|
+
log5.warn("invalid invitation", {
|
|
1572
1369
|
invitationId: invitation.invitationId
|
|
1573
1370
|
}, {
|
|
1574
1371
|
file: "invitations-service.ts",
|
|
1575
|
-
line:
|
|
1372
|
+
line: 184,
|
|
1576
1373
|
scope: this,
|
|
1577
1374
|
callSite: (f, a) => f(...a)
|
|
1578
1375
|
});
|
|
@@ -1594,20 +1391,21 @@ var DeviceInvitationsServiceImpl = class extends AbstractInvitationsService {
|
|
|
1594
1391
|
};
|
|
1595
1392
|
|
|
1596
1393
|
// packages/sdk/client-services/src/packlets/invitations/space-invitations-handler.ts
|
|
1597
|
-
import
|
|
1394
|
+
import assert6 from "@dxos/node-std/assert";
|
|
1598
1395
|
import { scheduleTask as scheduleTask2, sleep as sleep2, Trigger as Trigger3 } from "@dxos/async";
|
|
1396
|
+
import { AuthenticatingInvitationProvider as AuthenticatingInvitationProvider2, AUTHENTICATION_CODE_LENGTH as AUTHENTICATION_CODE_LENGTH2, InvitationObservableProvider as InvitationObservableProvider2, INVITATION_TIMEOUT as INVITATION_TIMEOUT2, ON_CLOSE_DELAY as ON_CLOSE_DELAY2, AbstractInvitationsHandler as AbstractInvitationsHandler2 } from "@dxos/client";
|
|
1599
1397
|
import { Context as Context4 } from "@dxos/context";
|
|
1600
1398
|
import { createAdmissionCredentials, generatePasscode as generatePasscode2, getCredentialAssertion } from "@dxos/credentials";
|
|
1601
1399
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
1602
1400
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1603
|
-
import { log as
|
|
1401
|
+
import { log as log6 } from "@dxos/log";
|
|
1604
1402
|
import { createTeleportProtocolFactory as createTeleportProtocolFactory2, StarTopology as StarTopology2 } from "@dxos/network-manager";
|
|
1605
|
-
import { schema as
|
|
1606
|
-
import { Invitation as
|
|
1403
|
+
import { schema as schema3 } from "@dxos/protocols";
|
|
1404
|
+
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1607
1405
|
import { AuthenticationResponse as AuthenticationResponse2, AuthMethod } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1608
1406
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1609
1407
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1610
|
-
var SpaceInvitationsHandler = class extends
|
|
1408
|
+
var SpaceInvitationsHandler = class extends AbstractInvitationsHandler2 {
|
|
1611
1409
|
constructor(networkManager, _spaceManager, _signingContext, _keyring) {
|
|
1612
1410
|
super(networkManager);
|
|
1613
1411
|
this._spaceManager = _spaceManager;
|
|
@@ -1620,16 +1418,16 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1620
1418
|
createInvitation(space, options) {
|
|
1621
1419
|
var _a;
|
|
1622
1420
|
let swarmConnection;
|
|
1623
|
-
const { type, timeout =
|
|
1624
|
-
|
|
1625
|
-
|
|
1421
|
+
const { type, timeout = INVITATION_TIMEOUT2, swarmKey } = options != null ? options : {};
|
|
1422
|
+
assert6(type !== Invitation3.Type.OFFLINE);
|
|
1423
|
+
assert6(space);
|
|
1626
1424
|
const invitation = {
|
|
1627
1425
|
type,
|
|
1628
1426
|
invitationId: PublicKey4.random().toHex(),
|
|
1629
1427
|
swarmKey: swarmKey != null ? swarmKey : PublicKey4.random(),
|
|
1630
1428
|
spaceKey: space.key,
|
|
1631
1429
|
authMethod: (_a = options == null ? void 0 : options.authMethod) != null ? _a : AuthMethod.SHARED_SECRET,
|
|
1632
|
-
authenticationCode: generatePasscode2(
|
|
1430
|
+
authenticationCode: generatePasscode2(AUTHENTICATION_CODE_LENGTH2)
|
|
1633
1431
|
// TODO(dmaretskyi): Don't generate if authMethod === NONE .
|
|
1634
1432
|
};
|
|
1635
1433
|
const ctx = new Context4({
|
|
@@ -1638,7 +1436,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1638
1436
|
observable.callback.onError(err);
|
|
1639
1437
|
}
|
|
1640
1438
|
});
|
|
1641
|
-
const observable = new
|
|
1439
|
+
const observable = new InvitationObservableProvider2(async () => {
|
|
1642
1440
|
await (swarmConnection == null ? void 0 : swarmConnection.close());
|
|
1643
1441
|
});
|
|
1644
1442
|
let authenticationPassed = false;
|
|
@@ -1649,7 +1447,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1649
1447
|
const hostInvitationExtension = new HostSpaceInvitationExtension({
|
|
1650
1448
|
introduce: async ({ profile }) => {
|
|
1651
1449
|
var _a2, _b;
|
|
1652
|
-
|
|
1450
|
+
log6("guest introduced itself", {
|
|
1653
1451
|
guestProfile: profile,
|
|
1654
1452
|
host: this._signingContext.deviceKey,
|
|
1655
1453
|
spaceKey: space.key
|
|
@@ -1662,12 +1460,12 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1662
1460
|
guestProfile = profile;
|
|
1663
1461
|
(_b = (_a2 = observable.callback).onAuthenticating) == null ? void 0 : _b.call(_a2, invitation);
|
|
1664
1462
|
return {
|
|
1665
|
-
spaceKey: type ===
|
|
1463
|
+
spaceKey: type === Invitation3.Type.INTERACTIVE_TESTING || type === Invitation3.Type.MULTIUSE_TESTING ? space.key : void 0,
|
|
1666
1464
|
authMethod: invitation.authMethod
|
|
1667
1465
|
};
|
|
1668
1466
|
},
|
|
1669
1467
|
authenticate: async ({ authenticationCode: code }) => {
|
|
1670
|
-
|
|
1468
|
+
log6("received authentication request", {
|
|
1671
1469
|
authenticationCode: code
|
|
1672
1470
|
}, {
|
|
1673
1471
|
file: "space-invitations-handler.ts",
|
|
@@ -1678,7 +1476,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1678
1476
|
let status = AuthenticationResponse2.Status.OK;
|
|
1679
1477
|
switch (invitation.authMethod) {
|
|
1680
1478
|
case AuthMethod.NONE: {
|
|
1681
|
-
|
|
1479
|
+
log6("authentication not required", {}, {
|
|
1682
1480
|
file: "space-invitations-handler.ts",
|
|
1683
1481
|
line: 128,
|
|
1684
1482
|
scope: this,
|
|
@@ -1701,7 +1499,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1701
1499
|
break;
|
|
1702
1500
|
}
|
|
1703
1501
|
default: {
|
|
1704
|
-
|
|
1502
|
+
log6.error("invalid authentication method", {
|
|
1705
1503
|
authMethod: invitation.authMethod
|
|
1706
1504
|
}, {
|
|
1707
1505
|
file: "space-invitations-handler.ts",
|
|
@@ -1722,7 +1520,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1722
1520
|
if (isAuthenticationRequired(invitation) && !authenticationPassed) {
|
|
1723
1521
|
throw new Error("Not authenticated");
|
|
1724
1522
|
}
|
|
1725
|
-
|
|
1523
|
+
log6("writing guest credentials", {
|
|
1726
1524
|
host: this._signingContext.deviceKey,
|
|
1727
1525
|
guest: deviceKey
|
|
1728
1526
|
}, {
|
|
@@ -1732,9 +1530,9 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1732
1530
|
callSite: (f, a) => f(...a)
|
|
1733
1531
|
});
|
|
1734
1532
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
1735
|
-
|
|
1533
|
+
assert6(credentials[0].credential);
|
|
1736
1534
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
1737
|
-
|
|
1535
|
+
assert6(getCredentialAssertion(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
|
|
1738
1536
|
await writeMessages2(space.inner.controlPipeline.writer, credentials);
|
|
1739
1537
|
complete.wake(deviceKey);
|
|
1740
1538
|
return {
|
|
@@ -1749,7 +1547,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1749
1547
|
scheduleTask2(ctx, async () => {
|
|
1750
1548
|
var _a2, _b;
|
|
1751
1549
|
try {
|
|
1752
|
-
|
|
1550
|
+
log6("connected", {
|
|
1753
1551
|
host: this._signingContext.deviceKey
|
|
1754
1552
|
}, {
|
|
1755
1553
|
file: "space-invitations-handler.ts",
|
|
@@ -1761,7 +1559,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1761
1559
|
const deviceKey = await complete.wait({
|
|
1762
1560
|
timeout
|
|
1763
1561
|
});
|
|
1764
|
-
|
|
1562
|
+
log6("admitted guest", {
|
|
1765
1563
|
host: this._signingContext.deviceKey,
|
|
1766
1564
|
guest: deviceKey
|
|
1767
1565
|
}, {
|
|
@@ -1773,7 +1571,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1773
1571
|
observable.callback.onSuccess(invitation);
|
|
1774
1572
|
} catch (err) {
|
|
1775
1573
|
if (!observable.cancelled) {
|
|
1776
|
-
|
|
1574
|
+
log6.error("failed", err, {
|
|
1777
1575
|
file: "space-invitations-handler.ts",
|
|
1778
1576
|
line: 198,
|
|
1779
1577
|
scope: this,
|
|
@@ -1782,8 +1580,8 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1782
1580
|
observable.callback.onError(err);
|
|
1783
1581
|
}
|
|
1784
1582
|
} finally {
|
|
1785
|
-
if (type !==
|
|
1786
|
-
await sleep2(
|
|
1583
|
+
if (type !== Invitation3.Type.MULTIUSE_TESTING) {
|
|
1584
|
+
await sleep2(ON_CLOSE_DELAY2);
|
|
1787
1585
|
await ctx.dispose();
|
|
1788
1586
|
}
|
|
1789
1587
|
}
|
|
@@ -1814,7 +1612,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1814
1612
|
* which then writes the guest's credentials to the space.
|
|
1815
1613
|
*/
|
|
1816
1614
|
acceptInvitation(invitation, options) {
|
|
1817
|
-
const { timeout =
|
|
1615
|
+
const { timeout = INVITATION_TIMEOUT2 } = options != null ? options : {};
|
|
1818
1616
|
const ctx = new Context4({
|
|
1819
1617
|
onError: (err) => {
|
|
1820
1618
|
void ctx.dispose();
|
|
@@ -1822,7 +1620,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1822
1620
|
}
|
|
1823
1621
|
});
|
|
1824
1622
|
const authenticated = new Trigger3();
|
|
1825
|
-
const observable = new
|
|
1623
|
+
const observable = new AuthenticatingInvitationProvider2({
|
|
1826
1624
|
onCancel: async () => {
|
|
1827
1625
|
await ctx.dispose();
|
|
1828
1626
|
},
|
|
@@ -1841,7 +1639,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1841
1639
|
if (++connectionCount > 1) {
|
|
1842
1640
|
throw new Error(`multiple connections detected: ${connectionCount}`);
|
|
1843
1641
|
}
|
|
1844
|
-
|
|
1642
|
+
log6("connected", {
|
|
1845
1643
|
guest: this._signingContext.deviceKey
|
|
1846
1644
|
}, {
|
|
1847
1645
|
file: "space-invitations-handler.ts",
|
|
@@ -1850,7 +1648,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1850
1648
|
callSite: (f, a) => f(...a)
|
|
1851
1649
|
});
|
|
1852
1650
|
(_b = (_a = observable.callback).onConnected) == null ? void 0 : _b.call(_a, invitation);
|
|
1853
|
-
|
|
1651
|
+
log6("introduce", {
|
|
1854
1652
|
guest: this._signingContext.deviceKey
|
|
1855
1653
|
}, {
|
|
1856
1654
|
file: "space-invitations-handler.ts",
|
|
@@ -1861,7 +1659,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1861
1659
|
const introductionResponse = await extension.rpc.SpaceHostService.introduce({
|
|
1862
1660
|
profile: this._signingContext.profile
|
|
1863
1661
|
});
|
|
1864
|
-
|
|
1662
|
+
log6("introduce response", {
|
|
1865
1663
|
guest: this._signingContext.deviceKey,
|
|
1866
1664
|
response: introductionResponse
|
|
1867
1665
|
}, {
|
|
@@ -1877,7 +1675,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1877
1675
|
if (isAuthenticationRequired(invitation)) {
|
|
1878
1676
|
(_d = (_c = observable.callback).onAuthenticating) == null ? void 0 : _d.call(_c, invitation);
|
|
1879
1677
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1880
|
-
|
|
1678
|
+
log6("guest waiting for authentication code...", {}, {
|
|
1881
1679
|
file: "space-invitations-handler.ts",
|
|
1882
1680
|
line: 293,
|
|
1883
1681
|
scope: this,
|
|
@@ -1887,7 +1685,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1887
1685
|
const authenticationCode = await authenticated.wait({
|
|
1888
1686
|
timeout
|
|
1889
1687
|
});
|
|
1890
|
-
|
|
1688
|
+
log6("sending authentication request", {}, {
|
|
1891
1689
|
file: "space-invitations-handler.ts",
|
|
1892
1690
|
line: 297,
|
|
1893
1691
|
scope: this,
|
|
@@ -1903,7 +1701,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1903
1701
|
if (attempt === MAX_OTP_ATTEMPTS) {
|
|
1904
1702
|
throw new Error(`Maximum retry attempts: ${MAX_OTP_ATTEMPTS}`);
|
|
1905
1703
|
} else {
|
|
1906
|
-
|
|
1704
|
+
log6("retrying invalid code", {
|
|
1907
1705
|
attempt
|
|
1908
1706
|
}, {
|
|
1909
1707
|
file: "space-invitations-handler.ts",
|
|
@@ -1918,7 +1716,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1918
1716
|
}
|
|
1919
1717
|
const controlFeedKey = await this._keyring.createKey();
|
|
1920
1718
|
const dataFeedKey = await this._keyring.createKey();
|
|
1921
|
-
|
|
1719
|
+
log6("request admission", {
|
|
1922
1720
|
guest: this._signingContext.deviceKey
|
|
1923
1721
|
}, {
|
|
1924
1722
|
file: "space-invitations-handler.ts",
|
|
@@ -1933,14 +1731,14 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1933
1731
|
dataFeedKey
|
|
1934
1732
|
});
|
|
1935
1733
|
const assertion = getCredentialAssertion(credential);
|
|
1936
|
-
|
|
1937
|
-
|
|
1734
|
+
assert6(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential");
|
|
1735
|
+
assert6(credential.subject.id.equals(this._signingContext.identityKey));
|
|
1938
1736
|
const space = await this._spaceManager.acceptSpace({
|
|
1939
1737
|
spaceKey: assertion.spaceKey,
|
|
1940
1738
|
genesisFeedKey: assertion.genesisFeedKey
|
|
1941
1739
|
});
|
|
1942
1740
|
await this._signingContext.recordCredential(credential);
|
|
1943
|
-
|
|
1741
|
+
log6("admitted by host", {
|
|
1944
1742
|
guest: this._signingContext.deviceKey,
|
|
1945
1743
|
spaceKey: space.key
|
|
1946
1744
|
}, {
|
|
@@ -1952,7 +1750,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1952
1750
|
complete.wake();
|
|
1953
1751
|
} catch (err) {
|
|
1954
1752
|
if (!observable.cancelled) {
|
|
1955
|
-
|
|
1753
|
+
log6.warn("auth failed", err, {
|
|
1956
1754
|
file: "space-invitations-handler.ts",
|
|
1957
1755
|
line: 344,
|
|
1958
1756
|
scope: this,
|
|
@@ -1970,7 +1768,7 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1970
1768
|
};
|
|
1971
1769
|
scheduleTask2(ctx, async () => {
|
|
1972
1770
|
var _a, _b;
|
|
1973
|
-
|
|
1771
|
+
assert6(invitation.swarmKey);
|
|
1974
1772
|
const topic = invitation.swarmKey;
|
|
1975
1773
|
const swarmConnection = await this._networkManager.joinSwarm({
|
|
1976
1774
|
topic,
|
|
@@ -1989,12 +1787,12 @@ var SpaceInvitationsHandler = class extends AbstractInvitationsHandler {
|
|
|
1989
1787
|
return observable;
|
|
1990
1788
|
}
|
|
1991
1789
|
};
|
|
1992
|
-
var isAuthenticationRequired = (invitation) => invitation.authMethod !== AuthMethod.NONE && invitation.type !==
|
|
1790
|
+
var isAuthenticationRequired = (invitation) => invitation.authMethod !== AuthMethod.NONE && invitation.type !== Invitation3.Type.INTERACTIVE_TESTING && invitation.type !== Invitation3.Type.MULTIUSE_TESTING;
|
|
1993
1791
|
var HostSpaceInvitationExtension = class extends RpcExtension2 {
|
|
1994
1792
|
constructor(_callbacks) {
|
|
1995
1793
|
super({
|
|
1996
1794
|
exposed: {
|
|
1997
|
-
SpaceHostService:
|
|
1795
|
+
SpaceHostService: schema3.getService("dxos.halo.invitations.SpaceHostService")
|
|
1998
1796
|
}
|
|
1999
1797
|
});
|
|
2000
1798
|
this._callbacks = _callbacks;
|
|
@@ -2025,7 +1823,7 @@ var GuestSpaceInvitationExtension = class extends RpcExtension2 {
|
|
|
2025
1823
|
constructor(_callbacks) {
|
|
2026
1824
|
super({
|
|
2027
1825
|
requested: {
|
|
2028
|
-
SpaceHostService:
|
|
1826
|
+
SpaceHostService: schema3.getService("dxos.halo.invitations.SpaceHostService")
|
|
2029
1827
|
}
|
|
2030
1828
|
});
|
|
2031
1829
|
this._callbacks = _callbacks;
|
|
@@ -2039,17 +1837,8 @@ var GuestSpaceInvitationExtension = class extends RpcExtension2 {
|
|
|
2039
1837
|
}
|
|
2040
1838
|
};
|
|
2041
1839
|
|
|
2042
|
-
// packages/sdk/client-services/src/packlets/invitations/space-invitations-proxy.ts
|
|
2043
|
-
var SpaceInvitationsProxy = class extends AbstractInvitationsProxy {
|
|
2044
|
-
getInvitationOptions(context) {
|
|
2045
|
-
return {
|
|
2046
|
-
spaceKey: context
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
};
|
|
2050
|
-
|
|
2051
1840
|
// packages/sdk/client-services/src/packlets/invitations/space-invitations-service.ts
|
|
2052
|
-
import
|
|
1841
|
+
import assert7 from "@dxos/node-std/assert";
|
|
2053
1842
|
var SpaceInvitationsServiceImpl = class extends AbstractInvitationsService {
|
|
2054
1843
|
// prettier-ignore
|
|
2055
1844
|
constructor(identityManager, invitationsHandler, _getSpaceManager) {
|
|
@@ -2058,88 +1847,312 @@ var SpaceInvitationsServiceImpl = class extends AbstractInvitationsService {
|
|
|
2058
1847
|
this._getSpaceManager = _getSpaceManager;
|
|
2059
1848
|
}
|
|
2060
1849
|
getContext(invitation) {
|
|
2061
|
-
|
|
1850
|
+
assert7(invitation.spaceKey);
|
|
2062
1851
|
const spaceManager = this._getSpaceManager();
|
|
2063
1852
|
const space = spaceManager.spaces.get(invitation.spaceKey);
|
|
2064
|
-
|
|
1853
|
+
assert7(space);
|
|
2065
1854
|
return space;
|
|
2066
1855
|
}
|
|
2067
1856
|
};
|
|
2068
1857
|
|
|
2069
|
-
// packages/sdk/client-services/src/packlets/
|
|
2070
|
-
import {
|
|
2071
|
-
import {
|
|
2072
|
-
import {
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
1858
|
+
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
1859
|
+
import { InvalidConfigError } from "@dxos/errors";
|
|
1860
|
+
import { Runtime } from "@dxos/protocols/proto/dxos/config";
|
|
1861
|
+
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
1862
|
+
var StorageDriver = Runtime.Client.Storage.StorageDriver;
|
|
1863
|
+
var createStorageObjects = (config) => {
|
|
1864
|
+
const { path = "dxos/storage", storageType, keyStorage, persistent = false } = config != null ? config : {};
|
|
1865
|
+
if (persistent && storageType === StorageDriver.RAM) {
|
|
1866
|
+
throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
1867
|
+
}
|
|
1868
|
+
if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
|
|
1869
|
+
throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
1870
|
+
}
|
|
1871
|
+
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
1872
|
+
throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
1873
|
+
}
|
|
1874
|
+
if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
|
|
1875
|
+
throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
1876
|
+
}
|
|
1877
|
+
return {
|
|
1878
|
+
storage: createStorage({
|
|
1879
|
+
type: persistent ? toStorageType(storageType) : StorageType.RAM,
|
|
1880
|
+
root: `${path}/`
|
|
1881
|
+
})
|
|
1882
|
+
};
|
|
1883
|
+
};
|
|
1884
|
+
var toStorageType = (type) => {
|
|
1885
|
+
switch (type) {
|
|
1886
|
+
case void 0:
|
|
1887
|
+
return void 0;
|
|
1888
|
+
case StorageDriver.RAM:
|
|
1889
|
+
return StorageType.RAM;
|
|
1890
|
+
case StorageDriver.CHROME:
|
|
1891
|
+
return StorageType.CHROME;
|
|
1892
|
+
case StorageDriver.FIREFOX:
|
|
1893
|
+
return StorageType.FIREFOX;
|
|
1894
|
+
case StorageDriver.IDB:
|
|
1895
|
+
return StorageType.IDB;
|
|
1896
|
+
case StorageDriver.NODE:
|
|
1897
|
+
return StorageType.NODE;
|
|
1898
|
+
default:
|
|
1899
|
+
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
1900
|
+
}
|
|
1901
|
+
};
|
|
2097
1902
|
|
|
2098
|
-
// packages/sdk/client-services/src/packlets/
|
|
2099
|
-
import
|
|
2100
|
-
import {
|
|
2101
|
-
import {
|
|
2102
|
-
import {
|
|
2103
|
-
import {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
this.
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
this.
|
|
2115
|
-
|
|
1903
|
+
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
1904
|
+
import assert8 from "@dxos/node-std/assert";
|
|
1905
|
+
import { Event as Event3 } from "@dxos/async";
|
|
1906
|
+
import { appServiceBundle, shellServiceBundle } from "@dxos/client";
|
|
1907
|
+
import { ShellLayout } from "@dxos/protocols/proto/dxos/iframe";
|
|
1908
|
+
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
1909
|
+
var ShellRuntimeImpl = class {
|
|
1910
|
+
constructor(_port) {
|
|
1911
|
+
this._port = _port;
|
|
1912
|
+
this.layoutUpdate = new Event3();
|
|
1913
|
+
this._layout = ShellLayout.DEFAULT;
|
|
1914
|
+
}
|
|
1915
|
+
get layout() {
|
|
1916
|
+
return this._layout;
|
|
1917
|
+
}
|
|
1918
|
+
get invitationCode() {
|
|
1919
|
+
return this._invitationCode;
|
|
1920
|
+
}
|
|
1921
|
+
get spaceKey() {
|
|
1922
|
+
return this._spaceKey;
|
|
1923
|
+
}
|
|
1924
|
+
setLayout(layout, options = {}) {
|
|
1925
|
+
this._layout = layout;
|
|
1926
|
+
this._invitationCode = options.invitationCode;
|
|
1927
|
+
this._spaceKey = options.spaceKey;
|
|
1928
|
+
this.layoutUpdate.emit({
|
|
1929
|
+
layout,
|
|
1930
|
+
...options
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
async setAppContext(context) {
|
|
1934
|
+
assert8(this._appRpc, "runtime not open");
|
|
1935
|
+
await this._appRpc.rpc.AppService.setContext(context);
|
|
2116
1936
|
}
|
|
2117
1937
|
async open() {
|
|
1938
|
+
this._appRpc = createProtoRpcPeer({
|
|
1939
|
+
requested: appServiceBundle,
|
|
1940
|
+
exposed: shellServiceBundle,
|
|
1941
|
+
handlers: {
|
|
1942
|
+
ShellService: {
|
|
1943
|
+
setLayout: async (request) => {
|
|
1944
|
+
this._layout = request.layout;
|
|
1945
|
+
this._invitationCode = request.invitationCode;
|
|
1946
|
+
this._spaceKey = request.spaceKey;
|
|
1947
|
+
this.layoutUpdate.emit(request);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
},
|
|
1951
|
+
port: this._port
|
|
1952
|
+
});
|
|
1953
|
+
await this._appRpc.open();
|
|
2118
1954
|
}
|
|
2119
1955
|
async close() {
|
|
2120
|
-
|
|
1956
|
+
var _a;
|
|
1957
|
+
await ((_a = this._appRpc) == null ? void 0 : _a.close());
|
|
1958
|
+
this._appRpc = void 0;
|
|
2121
1959
|
}
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
1960
|
+
};
|
|
1961
|
+
var MemoryShellRuntime = class {
|
|
1962
|
+
constructor({ layout, invitationCode, spaceKey } = {}) {
|
|
1963
|
+
this.layoutUpdate = new Event3();
|
|
1964
|
+
this.contextUpdate = new Event3();
|
|
1965
|
+
this._layout = layout != null ? layout : ShellLayout.DEFAULT;
|
|
1966
|
+
this._invitationCode = invitationCode;
|
|
1967
|
+
this._spaceKey = spaceKey;
|
|
1968
|
+
}
|
|
1969
|
+
get layout() {
|
|
1970
|
+
return this._layout;
|
|
1971
|
+
}
|
|
1972
|
+
get invitationCode() {
|
|
1973
|
+
return this._invitationCode;
|
|
1974
|
+
}
|
|
1975
|
+
get spaceKey() {
|
|
1976
|
+
return this._spaceKey;
|
|
1977
|
+
}
|
|
1978
|
+
setLayout(layout, options = {}) {
|
|
1979
|
+
this._layout = layout;
|
|
1980
|
+
this._invitationCode = options.invitationCode;
|
|
1981
|
+
this._spaceKey = options.spaceKey;
|
|
1982
|
+
this.layoutUpdate.emit({
|
|
1983
|
+
layout,
|
|
1984
|
+
...options
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
async setAppContext(context) {
|
|
1988
|
+
this.contextUpdate.emit(context);
|
|
1989
|
+
}
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
1993
|
+
import { Trigger as Trigger9 } from "@dxos/async";
|
|
1994
|
+
import { log as log16, logInfo as logInfo2 } from "@dxos/log";
|
|
1995
|
+
import { MemorySignalManager as MemorySignalManager3, MemorySignalManagerContext as MemorySignalManagerContext3, WebsocketSignalManager as WebsocketSignalManager3 } from "@dxos/messaging";
|
|
1996
|
+
import { createWebRTCTransportFactory as createWebRTCTransportFactory2, NetworkManager as NetworkManager3 } from "@dxos/network-manager";
|
|
1997
|
+
import { getAsyncValue } from "@dxos/util";
|
|
1998
|
+
|
|
1999
|
+
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
2000
|
+
import assert12 from "@dxos/node-std/assert";
|
|
2001
|
+
import { Event as Event6 } from "@dxos/async";
|
|
2002
|
+
import { clientServiceBundle, createDefaultModelFactory } from "@dxos/client";
|
|
2003
|
+
import { raise as raise3 } from "@dxos/debug";
|
|
2004
|
+
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
2005
|
+
import { log as log14 } from "@dxos/log";
|
|
2006
|
+
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
2007
|
+
|
|
2008
|
+
// packages/sdk/client-services/src/packlets/deprecated/tracing.ts
|
|
2009
|
+
var TracingServiceImpl = class {
|
|
2010
|
+
constructor(_config) {
|
|
2011
|
+
this._config = _config;
|
|
2012
|
+
}
|
|
2013
|
+
async setTracingOptions() {
|
|
2014
|
+
throw new Error("Tracing not available.");
|
|
2015
|
+
}
|
|
2016
|
+
subscribeToRpcTrace() {
|
|
2017
|
+
throw new Error("Tracing not available.");
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
|
|
2021
|
+
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
2022
|
+
import { EventSubscriptions as EventSubscriptions2 } from "@dxos/async";
|
|
2023
|
+
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
2024
|
+
import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
|
|
2025
|
+
var DevicesServiceImpl = class {
|
|
2026
|
+
constructor(_identityManager) {
|
|
2027
|
+
this._identityManager = _identityManager;
|
|
2028
|
+
}
|
|
2029
|
+
updateDevice(request) {
|
|
2030
|
+
throw new Error("Method not implemented.");
|
|
2031
|
+
}
|
|
2032
|
+
queryDevices() {
|
|
2033
|
+
return new Stream8(({ next }) => {
|
|
2034
|
+
const update = () => {
|
|
2035
|
+
var _a;
|
|
2036
|
+
const deviceKeys = (_a = this._identityManager.identity) == null ? void 0 : _a.authorizedDeviceKeys;
|
|
2037
|
+
if (!deviceKeys) {
|
|
2038
|
+
next({
|
|
2039
|
+
devices: []
|
|
2040
|
+
});
|
|
2041
|
+
} else {
|
|
2042
|
+
next({
|
|
2043
|
+
devices: Array.from(deviceKeys.values()).map((key) => {
|
|
2044
|
+
var _a2;
|
|
2045
|
+
return {
|
|
2046
|
+
deviceKey: key,
|
|
2047
|
+
kind: ((_a2 = this._identityManager.identity) == null ? void 0 : _a2.deviceKey.equals(key)) ? DeviceKind.CURRENT : DeviceKind.TRUSTED
|
|
2048
|
+
};
|
|
2049
|
+
})
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
const subscriptions = new EventSubscriptions2();
|
|
2054
|
+
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
2055
|
+
update();
|
|
2056
|
+
if (this._identityManager.identity) {
|
|
2057
|
+
subscriptions.add(this._identityManager.identity.stateUpdate.on(() => {
|
|
2058
|
+
update();
|
|
2059
|
+
}));
|
|
2060
|
+
}
|
|
2061
|
+
}));
|
|
2062
|
+
update();
|
|
2063
|
+
return () => subscriptions.clear();
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2066
|
+
};
|
|
2067
|
+
|
|
2068
|
+
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
2069
|
+
import { Stream as Stream9 } from "@dxos/codec-protobuf";
|
|
2070
|
+
var NetworkServiceImpl = class {
|
|
2071
|
+
constructor(networkManager) {
|
|
2072
|
+
this.networkManager = networkManager;
|
|
2073
|
+
}
|
|
2074
|
+
subscribeToNetworkStatus() {
|
|
2075
|
+
return new Stream9(({ next }) => {
|
|
2076
|
+
const unsubscribe = this.networkManager.connectionStateChanged.on((state) => next({
|
|
2077
|
+
state
|
|
2078
|
+
}));
|
|
2079
|
+
next({
|
|
2080
|
+
state: this.networkManager.connectionState
|
|
2081
|
+
});
|
|
2082
|
+
return unsubscribe;
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
async setNetworkOptions(request) {
|
|
2086
|
+
await this.networkManager.setConnectionState(request.state);
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
|
|
2090
|
+
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
2091
|
+
import assert10 from "@dxos/node-std/assert";
|
|
2092
|
+
import { Event as Event5, synchronized, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
2093
|
+
import { Context as Context7 } from "@dxos/context";
|
|
2094
|
+
import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
2095
|
+
import { spaceGenesis, SnapshotManager } from "@dxos/echo-pipeline";
|
|
2096
|
+
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
2097
|
+
import { log as log8 } from "@dxos/log";
|
|
2098
|
+
import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
|
|
2099
|
+
import { ComplexMap as ComplexMap3, deferFunction as deferFunction2 } from "@dxos/util";
|
|
2100
|
+
|
|
2101
|
+
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
2102
|
+
import { trackLeaks } from "@dxos/async";
|
|
2103
|
+
import { Context as Context6 } from "@dxos/context";
|
|
2104
|
+
import { timed } from "@dxos/debug";
|
|
2105
|
+
import { DataPipelineControllerImpl, createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
2106
|
+
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2107
|
+
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2108
|
+
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2109
|
+
|
|
2110
|
+
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
2111
|
+
import assert9 from "@dxos/node-std/assert";
|
|
2112
|
+
import { DeferredTask, Event as Event4, scheduleTask as scheduleTask3, sleep as sleep3, TimeoutError, Trigger as Trigger4 } from "@dxos/async";
|
|
2113
|
+
import { Context as Context5 } from "@dxos/context";
|
|
2114
|
+
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
2115
|
+
import { log as log7 } from "@dxos/log";
|
|
2116
|
+
import { schema as schema4 } from "@dxos/protocols";
|
|
2117
|
+
import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
|
|
2118
|
+
import { ComplexMap as ComplexMap2, ComplexSet, entry } from "@dxos/util";
|
|
2119
|
+
var RETRY_TIMEOUT = 1e3;
|
|
2120
|
+
var SUCCESS_DELAY = 1e3;
|
|
2121
|
+
var NOTARIZE_TIMEOUT = 1e4;
|
|
2122
|
+
var NotarizationPlugin = class {
|
|
2123
|
+
constructor() {
|
|
2124
|
+
this._ctx = new Context5();
|
|
2125
|
+
this._extensionOpened = new Event4();
|
|
2126
|
+
this._extensions = /* @__PURE__ */ new Set();
|
|
2127
|
+
this._processedCredentials = new ComplexSet(PublicKey5.hash);
|
|
2128
|
+
this._processCredentialsTriggers = new ComplexMap2(PublicKey5.hash);
|
|
2129
|
+
}
|
|
2130
|
+
async open() {
|
|
2131
|
+
}
|
|
2132
|
+
async close() {
|
|
2133
|
+
await this._ctx.dispose();
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Request credentials to be notarized.
|
|
2137
|
+
*/
|
|
2138
|
+
async notarize(credentials) {
|
|
2139
|
+
log7("notarize", {
|
|
2140
|
+
credentials
|
|
2128
2141
|
}, {
|
|
2129
2142
|
file: "notarization-plugin.ts",
|
|
2130
|
-
line:
|
|
2143
|
+
line: 50,
|
|
2131
2144
|
scope: this,
|
|
2132
2145
|
callSite: (f, a) => f(...a)
|
|
2133
2146
|
});
|
|
2134
|
-
|
|
2147
|
+
assert9(credentials.every((credential) => credential.id), "Credentials must have an id");
|
|
2135
2148
|
const errors = new Trigger4();
|
|
2136
2149
|
const ctx = this._ctx.derive({
|
|
2137
2150
|
onError: (err) => {
|
|
2138
|
-
|
|
2151
|
+
log7.warn("Notarization error", {
|
|
2139
2152
|
err
|
|
2140
2153
|
}, {
|
|
2141
2154
|
file: "notarization-plugin.ts",
|
|
2142
|
-
line:
|
|
2155
|
+
line: 59,
|
|
2143
2156
|
scope: this,
|
|
2144
2157
|
callSite: (f, a) => f(...a)
|
|
2145
2158
|
});
|
|
@@ -2148,9 +2161,9 @@ var NotarizationPlugin = class {
|
|
|
2148
2161
|
}
|
|
2149
2162
|
});
|
|
2150
2163
|
scheduleTask3(ctx, () => {
|
|
2151
|
-
|
|
2164
|
+
log7.warn("Notarization timeout", {}, {
|
|
2152
2165
|
file: "notarization-plugin.ts",
|
|
2153
|
-
line:
|
|
2166
|
+
line: 67,
|
|
2154
2167
|
scope: this,
|
|
2155
2168
|
callSite: (f, a) => f(...a)
|
|
2156
2169
|
});
|
|
@@ -2162,9 +2175,9 @@ var NotarizationPlugin = class {
|
|
|
2162
2175
|
const notarizeTask = new DeferredTask(ctx, async () => {
|
|
2163
2176
|
try {
|
|
2164
2177
|
if (this._extensions.size === 0) {
|
|
2165
|
-
|
|
2178
|
+
log7.warn("No peers to notarize with", {}, {
|
|
2166
2179
|
file: "notarization-plugin.ts",
|
|
2167
|
-
line:
|
|
2180
|
+
line: 82,
|
|
2168
2181
|
scope: this,
|
|
2169
2182
|
callSite: (f, a) => f(...a)
|
|
2170
2183
|
});
|
|
@@ -2174,11 +2187,11 @@ var NotarizationPlugin = class {
|
|
|
2174
2187
|
...this._extensions
|
|
2175
2188
|
].find((peer2) => !peersTried.has(peer2));
|
|
2176
2189
|
if (!peer) {
|
|
2177
|
-
|
|
2190
|
+
log7.warn("Exhausted all peers to notarize with", {
|
|
2178
2191
|
retryIn: RETRY_TIMEOUT
|
|
2179
2192
|
}, {
|
|
2180
2193
|
file: "notarization-plugin.ts",
|
|
2181
|
-
line:
|
|
2194
|
+
line: 89,
|
|
2182
2195
|
scope: this,
|
|
2183
2196
|
callSite: (f, a) => f(...a)
|
|
2184
2197
|
});
|
|
@@ -2187,28 +2200,29 @@ var NotarizationPlugin = class {
|
|
|
2187
2200
|
return;
|
|
2188
2201
|
}
|
|
2189
2202
|
peersTried.add(peer);
|
|
2190
|
-
|
|
2203
|
+
log7("try notarizing", {
|
|
2191
2204
|
peer: peer.localPeerId,
|
|
2192
2205
|
credentialId: credentials.map((credential) => credential.id)
|
|
2193
2206
|
}, {
|
|
2194
2207
|
file: "notarization-plugin.ts",
|
|
2195
|
-
line:
|
|
2208
|
+
line: 96,
|
|
2196
2209
|
scope: this,
|
|
2197
2210
|
callSite: (f, a) => f(...a)
|
|
2198
2211
|
});
|
|
2199
2212
|
await peer.rpc.NotarizationService.notarize({
|
|
2200
2213
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
2201
2214
|
});
|
|
2202
|
-
|
|
2215
|
+
log7("success", {}, {
|
|
2203
2216
|
file: "notarization-plugin.ts",
|
|
2204
|
-
line:
|
|
2217
|
+
line: 100,
|
|
2205
2218
|
scope: this,
|
|
2206
2219
|
callSite: (f, a) => f(...a)
|
|
2207
2220
|
});
|
|
2221
|
+
await sleep3(SUCCESS_DELAY);
|
|
2208
2222
|
} catch (err) {
|
|
2209
|
-
|
|
2223
|
+
log7.warn("error notarizing (recoverable)", err, {
|
|
2210
2224
|
file: "notarization-plugin.ts",
|
|
2211
|
-
line:
|
|
2225
|
+
line: 103,
|
|
2212
2226
|
scope: this,
|
|
2213
2227
|
callSite: (f, a) => f(...a)
|
|
2214
2228
|
});
|
|
@@ -2222,9 +2236,9 @@ var NotarizationPlugin = class {
|
|
|
2222
2236
|
allNotarized,
|
|
2223
2237
|
errors.wait()
|
|
2224
2238
|
]);
|
|
2225
|
-
|
|
2239
|
+
log7("done", {}, {
|
|
2226
2240
|
file: "notarization-plugin.ts",
|
|
2227
|
-
line:
|
|
2241
|
+
line: 114,
|
|
2228
2242
|
scope: this,
|
|
2229
2243
|
callSite: (f, a) => f(...a)
|
|
2230
2244
|
});
|
|
@@ -2245,7 +2259,7 @@ var NotarizationPlugin = class {
|
|
|
2245
2259
|
this._processCredentialsTriggers.delete(credential.id);
|
|
2246
2260
|
}
|
|
2247
2261
|
setWriter(writer) {
|
|
2248
|
-
|
|
2262
|
+
assert9(!this._writer, "Writer already set.");
|
|
2249
2263
|
this._writer = writer;
|
|
2250
2264
|
}
|
|
2251
2265
|
async _waitUntilProcessed(id) {
|
|
@@ -2263,7 +2277,7 @@ var NotarizationPlugin = class {
|
|
|
2263
2277
|
throw new Error("Writer not set");
|
|
2264
2278
|
}
|
|
2265
2279
|
for (const credential of (_a = request.credentials) != null ? _a : []) {
|
|
2266
|
-
|
|
2280
|
+
assert9(credential.id, "Credential must have an id");
|
|
2267
2281
|
if (this._processedCredentials.has(credential.id)) {
|
|
2268
2282
|
continue;
|
|
2269
2283
|
}
|
|
@@ -2273,11 +2287,11 @@ var NotarizationPlugin = class {
|
|
|
2273
2287
|
createExtension() {
|
|
2274
2288
|
const extension = new NotarizationTeleportExtension({
|
|
2275
2289
|
onOpen: async () => {
|
|
2276
|
-
|
|
2290
|
+
log7("extension opened", {
|
|
2277
2291
|
peer: extension.localPeerId
|
|
2278
2292
|
}, {
|
|
2279
2293
|
file: "notarization-plugin.ts",
|
|
2280
|
-
line:
|
|
2294
|
+
line: 163,
|
|
2281
2295
|
scope: this,
|
|
2282
2296
|
callSite: (f, a) => f(...a)
|
|
2283
2297
|
});
|
|
@@ -2285,11 +2299,11 @@ var NotarizationPlugin = class {
|
|
|
2285
2299
|
this._extensionOpened.emit();
|
|
2286
2300
|
},
|
|
2287
2301
|
onClose: async () => {
|
|
2288
|
-
|
|
2302
|
+
log7("extension closed", {
|
|
2289
2303
|
peer: extension.localPeerId
|
|
2290
2304
|
}, {
|
|
2291
2305
|
file: "notarization-plugin.ts",
|
|
2292
|
-
line:
|
|
2306
|
+
line: 168,
|
|
2293
2307
|
scope: this,
|
|
2294
2308
|
callSite: (f, a) => f(...a)
|
|
2295
2309
|
});
|
|
@@ -2304,10 +2318,10 @@ var NotarizationTeleportExtension = class extends RpcExtension3 {
|
|
|
2304
2318
|
constructor(_params) {
|
|
2305
2319
|
super({
|
|
2306
2320
|
requested: {
|
|
2307
|
-
NotarizationService:
|
|
2321
|
+
NotarizationService: schema4.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
2308
2322
|
},
|
|
2309
2323
|
exposed: {
|
|
2310
|
-
NotarizationService:
|
|
2324
|
+
NotarizationService: schema4.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
2311
2325
|
}
|
|
2312
2326
|
});
|
|
2313
2327
|
this._params = _params;
|
|
@@ -2348,6 +2362,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2348
2362
|
constructor(params) {
|
|
2349
2363
|
this._ctx = new Context6();
|
|
2350
2364
|
this._inner = params.inner;
|
|
2365
|
+
this._gossip = params.gossip;
|
|
2351
2366
|
this._presence = params.presence;
|
|
2352
2367
|
this._keyring = params.keyring;
|
|
2353
2368
|
this._feedStore = params.feedStore;
|
|
@@ -2404,6 +2419,12 @@ var DataSpace = class DataSpace2 {
|
|
|
2404
2419
|
await this.notarizationPlugin.close();
|
|
2405
2420
|
await this._presence.destroy();
|
|
2406
2421
|
}
|
|
2422
|
+
async postMessage(channel, message) {
|
|
2423
|
+
return this._gossip.postMessage(channel, message);
|
|
2424
|
+
}
|
|
2425
|
+
listen(channel, callback) {
|
|
2426
|
+
return this._gossip.listen(channel, callback);
|
|
2427
|
+
}
|
|
2407
2428
|
async initializeDataPipeline() {
|
|
2408
2429
|
await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
2409
2430
|
timeout: CONTROL_PIPELINE_READY_TIMEFRAME
|
|
@@ -2486,7 +2507,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2486
2507
|
this._feedStore = _feedStore;
|
|
2487
2508
|
this._snapshotStore = _snapshotStore;
|
|
2488
2509
|
this._ctx = new Context7();
|
|
2489
|
-
this.updated = new
|
|
2510
|
+
this.updated = new Event5();
|
|
2490
2511
|
this._spaces = new ComplexMap3(PublicKey7.hash);
|
|
2491
2512
|
}
|
|
2492
2513
|
// TODO(burdon): Remove.
|
|
@@ -2495,7 +2516,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2495
2516
|
}
|
|
2496
2517
|
async open() {
|
|
2497
2518
|
await this._metadataStore.load();
|
|
2498
|
-
|
|
2519
|
+
log8("metadata loaded", {
|
|
2499
2520
|
spaces: this._metadataStore.spaces.length
|
|
2500
2521
|
}, {
|
|
2501
2522
|
file: "data-space-manager.ts",
|
|
@@ -2504,7 +2525,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2504
2525
|
callSite: (f, a) => f(...a)
|
|
2505
2526
|
});
|
|
2506
2527
|
for (const spaceMetadata of this._metadataStore.spaces) {
|
|
2507
|
-
|
|
2528
|
+
log8("load space", {
|
|
2508
2529
|
spaceMetadata
|
|
2509
2530
|
}, {
|
|
2510
2531
|
file: "data-space-manager.ts",
|
|
@@ -2515,7 +2536,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2515
2536
|
const space = await this._constructSpace(spaceMetadata);
|
|
2516
2537
|
await space.initializeDataPipeline();
|
|
2517
2538
|
if (spaceMetadata.dataTimeframe) {
|
|
2518
|
-
|
|
2539
|
+
log8("waiting for latest timeframe", {
|
|
2519
2540
|
spaceMetadata
|
|
2520
2541
|
}, {
|
|
2521
2542
|
file: "data-space-manager.ts",
|
|
@@ -2550,7 +2571,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2550
2571
|
controlFeedKey,
|
|
2551
2572
|
dataFeedKey
|
|
2552
2573
|
};
|
|
2553
|
-
|
|
2574
|
+
log8("creating space...", {
|
|
2554
2575
|
spaceKey
|
|
2555
2576
|
}, {
|
|
2556
2577
|
file: "data-space-manager.ts",
|
|
@@ -2562,7 +2583,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2562
2583
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner);
|
|
2563
2584
|
await this._metadataStore.addSpace(metadata);
|
|
2564
2585
|
const memberCredential = credentials[1];
|
|
2565
|
-
|
|
2586
|
+
assert10(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember");
|
|
2566
2587
|
await this._signingContext.recordCredential(memberCredential);
|
|
2567
2588
|
await space.initializeDataPipeline();
|
|
2568
2589
|
this._dataServiceSubscriptions.registerSpace(space.key, space.dataPipelineController.databaseBackend.createDataServiceHost());
|
|
@@ -2571,7 +2592,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2571
2592
|
}
|
|
2572
2593
|
// TODO(burdon): Rename join space.
|
|
2573
2594
|
async acceptSpace(opts) {
|
|
2574
|
-
|
|
2595
|
+
assert10(!this._spaces.has(opts.spaceKey), "Space already exists.");
|
|
2575
2596
|
const metadata = {
|
|
2576
2597
|
key: opts.spaceKey,
|
|
2577
2598
|
genesisFeedKey: opts.genesisFeedKey
|
|
@@ -2584,11 +2605,14 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2584
2605
|
return space;
|
|
2585
2606
|
}
|
|
2586
2607
|
async _constructSpace(metadata) {
|
|
2608
|
+
const gossip = new Gossip({
|
|
2609
|
+
localPeerId: this._signingContext.deviceKey
|
|
2610
|
+
});
|
|
2587
2611
|
const presence = new Presence({
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2612
|
+
announceInterval: 500,
|
|
2613
|
+
offlineTimeout: 5e3,
|
|
2614
|
+
identityKey: this._signingContext.identityKey,
|
|
2615
|
+
gossip
|
|
2592
2616
|
});
|
|
2593
2617
|
const snapshotManager = new SnapshotManager(this._snapshotStore);
|
|
2594
2618
|
const controlFeed = metadata.controlFeedKey && await this._feedStore.openFeed(metadata.controlFeedKey, {
|
|
@@ -2605,7 +2629,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2605
2629
|
credentialAuthenticator: deferFunction2(() => dataSpace.authVerifier.verifier)
|
|
2606
2630
|
},
|
|
2607
2631
|
onNetworkConnection: (session) => {
|
|
2608
|
-
session.addExtension("dxos.mesh.teleport.
|
|
2632
|
+
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
2609
2633
|
remotePeerId: session.remotePeerId
|
|
2610
2634
|
}));
|
|
2611
2635
|
session.addExtension("dxos.mesh.teleport.objectsync", snapshotManager.objectSync.createExtension());
|
|
@@ -2619,6 +2643,7 @@ var DataSpaceManager = class DataSpaceManager2 {
|
|
|
2619
2643
|
modelFactory: this._modelFactory,
|
|
2620
2644
|
metadataStore: this._metadataStore,
|
|
2621
2645
|
snapshotManager,
|
|
2646
|
+
gossip,
|
|
2622
2647
|
presence,
|
|
2623
2648
|
memberKey: this._signingContext.identityKey,
|
|
2624
2649
|
keyring: this._keyring,
|
|
@@ -2647,484 +2672,28 @@ DataSpaceManager = __decorate2([
|
|
|
2647
2672
|
trackLeaks2("open", "close")
|
|
2648
2673
|
], DataSpaceManager);
|
|
2649
2674
|
|
|
2650
|
-
// packages/sdk/client-services/src/packlets/
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
this.
|
|
2661
|
-
this.
|
|
2662
|
-
this.
|
|
2663
|
-
|
|
2664
|
-
root: storage.createDirectory("feeds"),
|
|
2665
|
-
signer: this.keyring,
|
|
2666
|
-
hypercore: {
|
|
2667
|
-
valueEncoding
|
|
2668
|
-
}
|
|
2669
|
-
})
|
|
2670
|
-
});
|
|
2671
|
-
this.spaceManager = new SpaceManager({
|
|
2672
|
-
feedStore: this.feedStore,
|
|
2673
|
-
networkManager: this.networkManager
|
|
2674
|
-
});
|
|
2675
|
-
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
2676
|
-
this.deviceInvitations = new DeviceInvitationsHandler({
|
|
2677
|
-
networkManager: this.networkManager,
|
|
2678
|
-
getIdentity: () => {
|
|
2679
|
-
var _a;
|
|
2680
|
-
return (_a = this.identityManager.identity) != null ? _a : failUndefined2();
|
|
2681
|
-
},
|
|
2682
|
-
acceptIdentity: this._acceptIdentity.bind(this),
|
|
2683
|
-
keyring: this.keyring
|
|
2684
|
-
});
|
|
2675
|
+
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
2676
|
+
import { EventSubscriptions as EventSubscriptions3, scheduleTask as scheduleTask4 } from "@dxos/async";
|
|
2677
|
+
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
2678
|
+
import { raise, todo as todo2 } from "@dxos/debug";
|
|
2679
|
+
import { SpaceNotFoundError } from "@dxos/echo-pipeline";
|
|
2680
|
+
import { log as log9 } from "@dxos/log";
|
|
2681
|
+
import { SpaceMember, SpaceStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
2682
|
+
import { humanize } from "@dxos/util";
|
|
2683
|
+
var SpacesServiceImpl = class {
|
|
2684
|
+
constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
|
|
2685
|
+
this._identityManager = _identityManager;
|
|
2686
|
+
this._spaceManager = _spaceManager;
|
|
2687
|
+
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
2688
|
+
this._getDataSpaceManager = _getDataSpaceManager;
|
|
2685
2689
|
}
|
|
2686
|
-
async
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
line: 94,
|
|
2690
|
-
scope: this,
|
|
2691
|
-
callSite: (f, a) => f(...a)
|
|
2692
|
-
});
|
|
2693
|
-
await this.networkManager.open();
|
|
2694
|
-
await this.spaceManager.open();
|
|
2695
|
-
await this.identityManager.open();
|
|
2696
|
-
if (this.identityManager.identity) {
|
|
2697
|
-
await this._initialize();
|
|
2690
|
+
async createSpace() {
|
|
2691
|
+
if (!this._identityManager.identity) {
|
|
2692
|
+
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/halo");
|
|
2698
2693
|
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
scope: this,
|
|
2703
|
-
callSite: (f, a) => f(...a)
|
|
2704
|
-
});
|
|
2705
|
-
}
|
|
2706
|
-
async close() {
|
|
2707
|
-
var _a, _b;
|
|
2708
|
-
log10("closing...", {}, {
|
|
2709
|
-
file: "service-context.ts",
|
|
2710
|
-
line: 105,
|
|
2711
|
-
scope: this,
|
|
2712
|
-
callSite: (f, a) => f(...a)
|
|
2713
|
-
});
|
|
2714
|
-
await ((_a = this._deviceSpaceSync) == null ? void 0 : _a.close());
|
|
2715
|
-
await ((_b = this.dataSpaceManager) == null ? void 0 : _b.close());
|
|
2716
|
-
await this.identityManager.close();
|
|
2717
|
-
await this.spaceManager.close();
|
|
2718
|
-
await this.feedStore.close();
|
|
2719
|
-
await this.networkManager.close();
|
|
2720
|
-
this.dataServiceSubscriptions.clear();
|
|
2721
|
-
log10("closed", {}, {
|
|
2722
|
-
file: "service-context.ts",
|
|
2723
|
-
line: 113,
|
|
2724
|
-
scope: this,
|
|
2725
|
-
callSite: (f, a) => f(...a)
|
|
2726
|
-
});
|
|
2727
|
-
}
|
|
2728
|
-
async reset() {
|
|
2729
|
-
log10("resetting...", {}, {
|
|
2730
|
-
file: "service-context.ts",
|
|
2731
|
-
line: 117,
|
|
2732
|
-
scope: this,
|
|
2733
|
-
callSite: (f, a) => f(...a)
|
|
2734
|
-
});
|
|
2735
|
-
await this.close();
|
|
2736
|
-
await this.storage.reset();
|
|
2737
|
-
log10("reset", {}, {
|
|
2738
|
-
file: "service-context.ts",
|
|
2739
|
-
line: 120,
|
|
2740
|
-
scope: this,
|
|
2741
|
-
callSite: (f, a) => f(...a)
|
|
2742
|
-
});
|
|
2743
|
-
}
|
|
2744
|
-
async createIdentity(params = {}) {
|
|
2745
|
-
const identity = await this.identityManager.createIdentity(params);
|
|
2746
|
-
await this._initialize();
|
|
2747
|
-
return identity;
|
|
2748
|
-
}
|
|
2749
|
-
async _acceptIdentity(params) {
|
|
2750
|
-
const identity = await this.identityManager.acceptIdentity(params);
|
|
2751
|
-
await this._initialize();
|
|
2752
|
-
return identity;
|
|
2753
|
-
}
|
|
2754
|
-
// Called when identity is created.
|
|
2755
|
-
async _initialize() {
|
|
2756
|
-
var _a;
|
|
2757
|
-
log10("initializing spaces...", {}, {
|
|
2758
|
-
file: "service-context.ts",
|
|
2759
|
-
line: 139,
|
|
2760
|
-
scope: this,
|
|
2761
|
-
callSite: (f, a) => f(...a)
|
|
2762
|
-
});
|
|
2763
|
-
const identity = (_a = this.identityManager.identity) != null ? _a : failUndefined2();
|
|
2764
|
-
const signingContext = {
|
|
2765
|
-
credentialSigner: identity.getIdentityCredentialSigner(),
|
|
2766
|
-
identityKey: identity.identityKey,
|
|
2767
|
-
deviceKey: identity.deviceKey,
|
|
2768
|
-
profile: identity.profileDocument,
|
|
2769
|
-
recordCredential: async (credential) => {
|
|
2770
|
-
await identity.controlPipeline.writer.write({
|
|
2771
|
-
credential: {
|
|
2772
|
-
credential
|
|
2773
|
-
}
|
|
2774
|
-
});
|
|
2775
|
-
}
|
|
2776
|
-
};
|
|
2777
|
-
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.modelFactory, this.feedStore, this.snapshotStore);
|
|
2778
|
-
await this.dataSpaceManager.open();
|
|
2779
|
-
this.spaceInvitations = new SpaceInvitationsHandler(this.networkManager, this.dataSpaceManager, signingContext, this.keyring);
|
|
2780
|
-
this.initialized.wake();
|
|
2781
|
-
this._deviceSpaceSync = identity.space.spaceState.registerProcessor({
|
|
2782
|
-
process: async (credential) => {
|
|
2783
|
-
const assertion = getCredentialAssertion3(credential);
|
|
2784
|
-
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
2785
|
-
return;
|
|
2786
|
-
}
|
|
2787
|
-
if (assertion.spaceKey.equals(identity.space.key)) {
|
|
2788
|
-
return;
|
|
2789
|
-
}
|
|
2790
|
-
if (!this.dataSpaceManager) {
|
|
2791
|
-
log10("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
2792
|
-
details: assertion
|
|
2793
|
-
}, {
|
|
2794
|
-
file: "service-context.ts",
|
|
2795
|
-
line: 182,
|
|
2796
|
-
scope: this,
|
|
2797
|
-
callSite: (f, a) => f(...a)
|
|
2798
|
-
});
|
|
2799
|
-
return;
|
|
2800
|
-
}
|
|
2801
|
-
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
2802
|
-
log10("space already exists, ignoring space admission", {
|
|
2803
|
-
details: assertion
|
|
2804
|
-
}, {
|
|
2805
|
-
file: "service-context.ts",
|
|
2806
|
-
line: 186,
|
|
2807
|
-
scope: this,
|
|
2808
|
-
callSite: (f, a) => f(...a)
|
|
2809
|
-
});
|
|
2810
|
-
return;
|
|
2811
|
-
}
|
|
2812
|
-
try {
|
|
2813
|
-
log10("accepting space recorded in halo", {
|
|
2814
|
-
details: assertion
|
|
2815
|
-
}, {
|
|
2816
|
-
file: "service-context.ts",
|
|
2817
|
-
line: 191,
|
|
2818
|
-
scope: this,
|
|
2819
|
-
callSite: (f, a) => f(...a)
|
|
2820
|
-
});
|
|
2821
|
-
await this.dataSpaceManager.acceptSpace({
|
|
2822
|
-
spaceKey: assertion.spaceKey,
|
|
2823
|
-
genesisFeedKey: assertion.genesisFeedKey
|
|
2824
|
-
});
|
|
2825
|
-
} catch (err) {
|
|
2826
|
-
log10.catch(err, {}, {
|
|
2827
|
-
file: "service-context.ts",
|
|
2828
|
-
line: 197,
|
|
2829
|
-
scope: this,
|
|
2830
|
-
callSite: (f, a) => f(...a)
|
|
2831
|
-
});
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
|
-
});
|
|
2835
|
-
await this._deviceSpaceSync.open();
|
|
2836
|
-
}
|
|
2837
|
-
};
|
|
2838
|
-
|
|
2839
|
-
// packages/sdk/client-services/src/packlets/services/service-definitions.ts
|
|
2840
|
-
import { schema as schema6 } from "@dxos/protocols";
|
|
2841
|
-
import { createServiceBundle } from "@dxos/rpc";
|
|
2842
|
-
var clientServiceBundle = createServiceBundle({
|
|
2843
|
-
SystemService: schema6.getService("dxos.client.services.SystemService"),
|
|
2844
|
-
IdentityService: schema6.getService("dxos.client.services.IdentityService"),
|
|
2845
|
-
DeviceInvitationsService: schema6.getService("dxos.client.services.DeviceInvitationsService"),
|
|
2846
|
-
DevicesService: schema6.getService("dxos.client.services.DevicesService"),
|
|
2847
|
-
SpaceInvitationsService: schema6.getService("dxos.client.services.SpaceInvitationsService"),
|
|
2848
|
-
SpacesService: schema6.getService("dxos.client.services.SpacesService"),
|
|
2849
|
-
DataService: schema6.getService("dxos.echo.service.DataService"),
|
|
2850
|
-
NetworkService: schema6.getService("dxos.client.services.NetworkService"),
|
|
2851
|
-
// TODO(burdon): Deprecated.
|
|
2852
|
-
DevtoolsHost: schema6.getService("dxos.devtools.host.DevtoolsHost"),
|
|
2853
|
-
TracingService: schema6.getService("dxos.devtools.host.TracingService")
|
|
2854
|
-
});
|
|
2855
|
-
|
|
2856
|
-
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
2857
|
-
import { InvalidConfigError } from "@dxos/errors";
|
|
2858
|
-
import { Runtime } from "@dxos/protocols/proto/dxos/config";
|
|
2859
|
-
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
2860
|
-
var StorageDriver = Runtime.Client.Storage.StorageDriver;
|
|
2861
|
-
var createStorageObjects = (config) => {
|
|
2862
|
-
const { path = "dxos/storage", storageType, keyStorage, persistent = false } = config != null ? config : {};
|
|
2863
|
-
if (persistent && storageType === StorageDriver.RAM) {
|
|
2864
|
-
throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
2865
|
-
}
|
|
2866
|
-
if (!persistent && storageType !== void 0 && storageType !== StorageDriver.RAM) {
|
|
2867
|
-
throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
2868
|
-
}
|
|
2869
|
-
if (persistent && keyStorage === StorageDriver.RAM) {
|
|
2870
|
-
throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
2871
|
-
}
|
|
2872
|
-
if (!persistent && keyStorage !== StorageDriver.RAM && keyStorage !== void 0) {
|
|
2873
|
-
throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
2874
|
-
}
|
|
2875
|
-
return {
|
|
2876
|
-
storage: createStorage({
|
|
2877
|
-
type: persistent ? toStorageType(storageType) : StorageType.RAM,
|
|
2878
|
-
root: `${path}/`
|
|
2879
|
-
})
|
|
2880
|
-
};
|
|
2881
|
-
};
|
|
2882
|
-
var toStorageType = (type) => {
|
|
2883
|
-
switch (type) {
|
|
2884
|
-
case void 0:
|
|
2885
|
-
return void 0;
|
|
2886
|
-
case StorageDriver.RAM:
|
|
2887
|
-
return StorageType.RAM;
|
|
2888
|
-
case StorageDriver.CHROME:
|
|
2889
|
-
return StorageType.CHROME;
|
|
2890
|
-
case StorageDriver.FIREFOX:
|
|
2891
|
-
return StorageType.FIREFOX;
|
|
2892
|
-
case StorageDriver.IDB:
|
|
2893
|
-
return StorageType.IDB;
|
|
2894
|
-
case StorageDriver.NODE:
|
|
2895
|
-
return StorageType.NODE;
|
|
2896
|
-
default:
|
|
2897
|
-
throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
|
|
2898
|
-
}
|
|
2899
|
-
};
|
|
2900
|
-
|
|
2901
|
-
// packages/sdk/client-services/src/packlets/vault/services.ts
|
|
2902
|
-
import { schema as schema7 } from "@dxos/protocols";
|
|
2903
|
-
var iframeServiceBundle = {
|
|
2904
|
-
IframeService: schema7.getService("dxos.iframe.IframeService"),
|
|
2905
|
-
BridgeService: schema7.getService("dxos.mesh.bridge.BridgeService")
|
|
2906
|
-
};
|
|
2907
|
-
var workerServiceBundle = {
|
|
2908
|
-
WorkerService: schema7.getService("dxos.iframe.WorkerService")
|
|
2909
|
-
};
|
|
2910
|
-
var appServiceBundle = {
|
|
2911
|
-
AppService: schema7.getService("dxos.iframe.AppService")
|
|
2912
|
-
};
|
|
2913
|
-
var shellServiceBundle = {
|
|
2914
|
-
ShellService: schema7.getService("dxos.iframe.ShellService")
|
|
2915
|
-
};
|
|
2916
|
-
|
|
2917
|
-
// packages/sdk/client-services/src/packlets/vault/shell-runtime.ts
|
|
2918
|
-
import assert12 from "@dxos/node-std/assert";
|
|
2919
|
-
import { Event as Event5 } from "@dxos/async";
|
|
2920
|
-
import { ShellLayout } from "@dxos/protocols/proto/dxos/iframe";
|
|
2921
|
-
import { createProtoRpcPeer } from "@dxos/rpc";
|
|
2922
|
-
var ShellRuntimeImpl = class {
|
|
2923
|
-
constructor(_port) {
|
|
2924
|
-
this._port = _port;
|
|
2925
|
-
this.layoutUpdate = new Event5();
|
|
2926
|
-
this._layout = ShellLayout.DEFAULT;
|
|
2927
|
-
}
|
|
2928
|
-
get layout() {
|
|
2929
|
-
return this._layout;
|
|
2930
|
-
}
|
|
2931
|
-
get invitationCode() {
|
|
2932
|
-
return this._invitationCode;
|
|
2933
|
-
}
|
|
2934
|
-
get spaceKey() {
|
|
2935
|
-
return this._spaceKey;
|
|
2936
|
-
}
|
|
2937
|
-
setLayout(layout, options = {}) {
|
|
2938
|
-
this._layout = layout;
|
|
2939
|
-
this._invitationCode = options.invitationCode;
|
|
2940
|
-
this._spaceKey = options.spaceKey;
|
|
2941
|
-
this.layoutUpdate.emit({
|
|
2942
|
-
layout,
|
|
2943
|
-
...options
|
|
2944
|
-
});
|
|
2945
|
-
}
|
|
2946
|
-
async setAppContext(context) {
|
|
2947
|
-
assert12(this._appRpc, "runtime not open");
|
|
2948
|
-
await this._appRpc.rpc.AppService.setContext(context);
|
|
2949
|
-
}
|
|
2950
|
-
async open() {
|
|
2951
|
-
this._appRpc = createProtoRpcPeer({
|
|
2952
|
-
requested: appServiceBundle,
|
|
2953
|
-
exposed: shellServiceBundle,
|
|
2954
|
-
handlers: {
|
|
2955
|
-
ShellService: {
|
|
2956
|
-
setLayout: async (request) => {
|
|
2957
|
-
this._layout = request.layout;
|
|
2958
|
-
this._invitationCode = request.invitationCode;
|
|
2959
|
-
this._spaceKey = request.spaceKey;
|
|
2960
|
-
this.layoutUpdate.emit(request);
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
},
|
|
2964
|
-
port: this._port
|
|
2965
|
-
});
|
|
2966
|
-
await this._appRpc.open();
|
|
2967
|
-
}
|
|
2968
|
-
async close() {
|
|
2969
|
-
var _a;
|
|
2970
|
-
await ((_a = this._appRpc) == null ? void 0 : _a.close());
|
|
2971
|
-
this._appRpc = void 0;
|
|
2972
|
-
}
|
|
2973
|
-
};
|
|
2974
|
-
var MemoryShellRuntime = class {
|
|
2975
|
-
constructor({ layout, invitationCode, spaceKey } = {}) {
|
|
2976
|
-
this.layoutUpdate = new Event5();
|
|
2977
|
-
this.contextUpdate = new Event5();
|
|
2978
|
-
this._layout = layout != null ? layout : ShellLayout.DEFAULT;
|
|
2979
|
-
this._invitationCode = invitationCode;
|
|
2980
|
-
this._spaceKey = spaceKey;
|
|
2981
|
-
}
|
|
2982
|
-
get layout() {
|
|
2983
|
-
return this._layout;
|
|
2984
|
-
}
|
|
2985
|
-
get invitationCode() {
|
|
2986
|
-
return this._invitationCode;
|
|
2987
|
-
}
|
|
2988
|
-
get spaceKey() {
|
|
2989
|
-
return this._spaceKey;
|
|
2990
|
-
}
|
|
2991
|
-
setLayout(layout, options = {}) {
|
|
2992
|
-
this._layout = layout;
|
|
2993
|
-
this._invitationCode = options.invitationCode;
|
|
2994
|
-
this._spaceKey = options.spaceKey;
|
|
2995
|
-
this.layoutUpdate.emit({
|
|
2996
|
-
layout,
|
|
2997
|
-
...options
|
|
2998
|
-
});
|
|
2999
|
-
}
|
|
3000
|
-
async setAppContext(context) {
|
|
3001
|
-
this.contextUpdate.emit(context);
|
|
3002
|
-
}
|
|
3003
|
-
};
|
|
3004
|
-
|
|
3005
|
-
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3006
|
-
import { Trigger as Trigger9 } from "@dxos/async";
|
|
3007
|
-
import { log as log17, logInfo as logInfo2 } from "@dxos/log";
|
|
3008
|
-
import { MemorySignalManager as MemorySignalManager2, MemorySignalManagerContext as MemorySignalManagerContext2, WebsocketSignalManager as WebsocketSignalManager2 } from "@dxos/messaging";
|
|
3009
|
-
import { createWebRTCTransportFactory, NetworkManager as NetworkManager2 } from "@dxos/network-manager";
|
|
3010
|
-
import { createProtoRpcPeer as createProtoRpcPeer6 } from "@dxos/rpc";
|
|
3011
|
-
import { getAsyncValue } from "@dxos/util";
|
|
3012
|
-
|
|
3013
|
-
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3014
|
-
import assert14 from "@dxos/node-std/assert";
|
|
3015
|
-
import { Event as Event7 } from "@dxos/async";
|
|
3016
|
-
import { raise as raise2 } from "@dxos/debug";
|
|
3017
|
-
import { DocumentModel } from "@dxos/document-model";
|
|
3018
|
-
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
3019
|
-
import { log as log16 } from "@dxos/log";
|
|
3020
|
-
import { ModelFactory } from "@dxos/model-factory";
|
|
3021
|
-
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
3022
|
-
import { TextModel } from "@dxos/text-model";
|
|
3023
|
-
|
|
3024
|
-
// packages/sdk/client-services/src/packlets/deprecated/tracing.ts
|
|
3025
|
-
var TracingServiceImpl = class {
|
|
3026
|
-
constructor(_config) {
|
|
3027
|
-
this._config = _config;
|
|
3028
|
-
}
|
|
3029
|
-
async setTracingOptions() {
|
|
3030
|
-
throw new Error("Tracing not available.");
|
|
3031
|
-
}
|
|
3032
|
-
subscribeToRpcTrace() {
|
|
3033
|
-
throw new Error("Tracing not available.");
|
|
3034
|
-
}
|
|
3035
|
-
};
|
|
3036
|
-
|
|
3037
|
-
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
3038
|
-
import { EventSubscriptions as EventSubscriptions2 } from "@dxos/async";
|
|
3039
|
-
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
3040
|
-
import { DeviceKind } from "@dxos/protocols/proto/dxos/client/services";
|
|
3041
|
-
var DevicesServiceImpl = class {
|
|
3042
|
-
constructor(_identityManager) {
|
|
3043
|
-
this._identityManager = _identityManager;
|
|
3044
|
-
}
|
|
3045
|
-
updateDevice(request) {
|
|
3046
|
-
throw new Error("Method not implemented.");
|
|
3047
|
-
}
|
|
3048
|
-
queryDevices() {
|
|
3049
|
-
return new Stream8(({ next }) => {
|
|
3050
|
-
const update = () => {
|
|
3051
|
-
var _a;
|
|
3052
|
-
const deviceKeys = (_a = this._identityManager.identity) == null ? void 0 : _a.authorizedDeviceKeys;
|
|
3053
|
-
if (!deviceKeys) {
|
|
3054
|
-
next({
|
|
3055
|
-
devices: []
|
|
3056
|
-
});
|
|
3057
|
-
} else {
|
|
3058
|
-
next({
|
|
3059
|
-
devices: Array.from(deviceKeys.values()).map((key) => {
|
|
3060
|
-
var _a2;
|
|
3061
|
-
return {
|
|
3062
|
-
deviceKey: key,
|
|
3063
|
-
kind: ((_a2 = this._identityManager.identity) == null ? void 0 : _a2.deviceKey.equals(key)) ? DeviceKind.CURRENT : DeviceKind.TRUSTED
|
|
3064
|
-
};
|
|
3065
|
-
})
|
|
3066
|
-
});
|
|
3067
|
-
}
|
|
3068
|
-
};
|
|
3069
|
-
const subscriptions = new EventSubscriptions2();
|
|
3070
|
-
subscriptions.add(this._identityManager.stateUpdate.on(() => {
|
|
3071
|
-
update();
|
|
3072
|
-
if (this._identityManager.identity) {
|
|
3073
|
-
subscriptions.add(this._identityManager.identity.stateUpdate.on(() => {
|
|
3074
|
-
update();
|
|
3075
|
-
}));
|
|
3076
|
-
}
|
|
3077
|
-
}));
|
|
3078
|
-
update();
|
|
3079
|
-
return () => subscriptions.clear();
|
|
3080
|
-
});
|
|
3081
|
-
}
|
|
3082
|
-
};
|
|
3083
|
-
|
|
3084
|
-
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
3085
|
-
import { Stream as Stream9 } from "@dxos/codec-protobuf";
|
|
3086
|
-
var NetworkServiceImpl = class {
|
|
3087
|
-
constructor(networkManager) {
|
|
3088
|
-
this.networkManager = networkManager;
|
|
3089
|
-
}
|
|
3090
|
-
subscribeToNetworkStatus() {
|
|
3091
|
-
return new Stream9(({ next }) => {
|
|
3092
|
-
const unsubscribe = this.networkManager.connectionStateChanged.on((state) => next({
|
|
3093
|
-
state
|
|
3094
|
-
}));
|
|
3095
|
-
next({
|
|
3096
|
-
state: this.networkManager.connectionState
|
|
3097
|
-
});
|
|
3098
|
-
return unsubscribe;
|
|
3099
|
-
});
|
|
3100
|
-
}
|
|
3101
|
-
async setNetworkOptions(request) {
|
|
3102
|
-
await this.networkManager.setConnectionState(request.state);
|
|
3103
|
-
}
|
|
3104
|
-
};
|
|
3105
|
-
|
|
3106
|
-
// packages/sdk/client-services/src/packlets/spaces/spaces-service.ts
|
|
3107
|
-
import { EventSubscriptions as EventSubscriptions3, scheduleTask as scheduleTask4 } from "@dxos/async";
|
|
3108
|
-
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
3109
|
-
import { raise, todo as todo2 } from "@dxos/debug";
|
|
3110
|
-
import { SpaceNotFoundError } from "@dxos/echo-pipeline";
|
|
3111
|
-
import { log as log11 } from "@dxos/log";
|
|
3112
|
-
import { SpaceMember, SpaceStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
3113
|
-
import { humanize } from "@dxos/util";
|
|
3114
|
-
var SpacesServiceImpl = class {
|
|
3115
|
-
constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
|
|
3116
|
-
this._identityManager = _identityManager;
|
|
3117
|
-
this._spaceManager = _spaceManager;
|
|
3118
|
-
this._dataServiceSubscriptions = _dataServiceSubscriptions;
|
|
3119
|
-
this._getDataSpaceManager = _getDataSpaceManager;
|
|
3120
|
-
}
|
|
3121
|
-
async createSpace() {
|
|
3122
|
-
if (!this._identityManager.identity) {
|
|
3123
|
-
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/halo");
|
|
3124
|
-
}
|
|
3125
|
-
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3126
|
-
const space = await dataSpaceManager.createSpace();
|
|
3127
|
-
return this._transformSpace(space);
|
|
2694
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2695
|
+
const space = await dataSpaceManager.createSpace();
|
|
2696
|
+
return this._transformSpace(space);
|
|
3128
2697
|
}
|
|
3129
2698
|
async updateSpace(request) {
|
|
3130
2699
|
todo2();
|
|
@@ -3134,11 +2703,11 @@ var SpacesServiceImpl = class {
|
|
|
3134
2703
|
const onUpdate = async () => {
|
|
3135
2704
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3136
2705
|
const spaces = Array.from(dataSpaceManager.spaces.values()).filter((space) => this._dataServiceSubscriptions.getDataService(space.key)).map((space) => this._transformSpace(space));
|
|
3137
|
-
|
|
2706
|
+
log9("update", {
|
|
3138
2707
|
spaces
|
|
3139
2708
|
}, {
|
|
3140
2709
|
file: "spaces-service.ts",
|
|
3141
|
-
line:
|
|
2710
|
+
line: 62,
|
|
3142
2711
|
scope: this,
|
|
3143
2712
|
callSite: (f, a) => f(...a)
|
|
3144
2713
|
});
|
|
@@ -3176,6 +2745,25 @@ var SpacesServiceImpl = class {
|
|
|
3176
2745
|
}
|
|
3177
2746
|
});
|
|
3178
2747
|
}
|
|
2748
|
+
async postMessage({ spaceKey, channel, message }) {
|
|
2749
|
+
var _a;
|
|
2750
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2751
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : raise(new SpaceNotFoundError(spaceKey));
|
|
2752
|
+
await space.postMessage(getChannelId(channel), message);
|
|
2753
|
+
}
|
|
2754
|
+
subscribeMessages({ spaceKey, channel }) {
|
|
2755
|
+
return new Stream10(({ ctx, next }) => {
|
|
2756
|
+
scheduleTask4(ctx, async () => {
|
|
2757
|
+
var _a;
|
|
2758
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2759
|
+
const space = (_a = dataSpaceManager.spaces.get(spaceKey)) != null ? _a : raise(new SpaceNotFoundError(spaceKey));
|
|
2760
|
+
const handle = space.listen(getChannelId(channel), (message) => {
|
|
2761
|
+
next(message);
|
|
2762
|
+
});
|
|
2763
|
+
ctx.onDispose(() => handle.unsubscribe());
|
|
2764
|
+
});
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
3179
2767
|
queryCredentials({ spaceKey }) {
|
|
3180
2768
|
return new Stream10(({ ctx, next }) => {
|
|
3181
2769
|
var _a;
|
|
@@ -3219,6 +2807,7 @@ var SpacesServiceImpl = class {
|
|
|
3219
2807
|
};
|
|
3220
2808
|
}
|
|
3221
2809
|
};
|
|
2810
|
+
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
3222
2811
|
|
|
3223
2812
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
3224
2813
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
@@ -3231,7 +2820,8 @@ var SystemServiceImpl = class {
|
|
|
3231
2820
|
this._onReset = onReset;
|
|
3232
2821
|
}
|
|
3233
2822
|
async getConfig() {
|
|
3234
|
-
|
|
2823
|
+
var _a, _b;
|
|
2824
|
+
return (_b = (_a = this._config) == null ? void 0 : _a.values) != null ? _b : {};
|
|
3235
2825
|
}
|
|
3236
2826
|
async updateStatus({ status }) {
|
|
3237
2827
|
await this._onUpdateStatus(status);
|
|
@@ -3258,6 +2848,7 @@ var SystemServiceImpl = class {
|
|
|
3258
2848
|
};
|
|
3259
2849
|
|
|
3260
2850
|
// packages/sdk/client-services/src/packlets/vault/iframe-proxy-runtime.ts
|
|
2851
|
+
import { iframeServiceBundle, workerServiceBundle } from "@dxos/client";
|
|
3261
2852
|
import { WebRTCTransportService } from "@dxos/network-manager";
|
|
3262
2853
|
import { createProtoRpcPeer as createProtoRpcPeer2 } from "@dxos/rpc";
|
|
3263
2854
|
var IFrameProxyRuntime = class {
|
|
@@ -3305,72 +2896,9 @@ var IFrameProxyRuntime = class {
|
|
|
3305
2896
|
}
|
|
3306
2897
|
};
|
|
3307
2898
|
|
|
3308
|
-
// packages/sdk/client-services/src/packlets/vault/shell-controller.ts
|
|
3309
|
-
import { Event as Event6 } from "@dxos/async";
|
|
3310
|
-
import { log as log12 } from "@dxos/log";
|
|
3311
|
-
import { ShellDisplay } from "@dxos/protocols/proto/dxos/iframe";
|
|
3312
|
-
import { createProtoRpcPeer as createProtoRpcPeer3 } from "@dxos/rpc";
|
|
3313
|
-
var ShellController = class {
|
|
3314
|
-
constructor(_port) {
|
|
3315
|
-
this._port = _port;
|
|
3316
|
-
this.contextUpdate = new Event6();
|
|
3317
|
-
this._display = ShellDisplay.NONE;
|
|
3318
|
-
}
|
|
3319
|
-
get display() {
|
|
3320
|
-
return this._display;
|
|
3321
|
-
}
|
|
3322
|
-
async setLayout(layout, options = {}) {
|
|
3323
|
-
var _a;
|
|
3324
|
-
log12("set layout", {
|
|
3325
|
-
layout,
|
|
3326
|
-
...options
|
|
3327
|
-
}, {
|
|
3328
|
-
file: "shell-controller.ts",
|
|
3329
|
-
line: 27,
|
|
3330
|
-
scope: this,
|
|
3331
|
-
callSite: (f, a) => f(...a)
|
|
3332
|
-
});
|
|
3333
|
-
this._display = ShellDisplay.FULLSCREEN;
|
|
3334
|
-
this.contextUpdate.emit({
|
|
3335
|
-
display: this._display
|
|
3336
|
-
});
|
|
3337
|
-
await ((_a = this._shellRpc) == null ? void 0 : _a.rpc.ShellService.setLayout({
|
|
3338
|
-
layout,
|
|
3339
|
-
...options
|
|
3340
|
-
}));
|
|
3341
|
-
}
|
|
3342
|
-
async open() {
|
|
3343
|
-
this._shellRpc = createProtoRpcPeer3({
|
|
3344
|
-
requested: shellServiceBundle,
|
|
3345
|
-
exposed: appServiceBundle,
|
|
3346
|
-
handlers: {
|
|
3347
|
-
AppService: {
|
|
3348
|
-
setContext: async (request) => {
|
|
3349
|
-
log12("set context", request, {
|
|
3350
|
-
file: "shell-controller.ts",
|
|
3351
|
-
line: 40,
|
|
3352
|
-
scope: this,
|
|
3353
|
-
callSite: (f, a) => f(...a)
|
|
3354
|
-
});
|
|
3355
|
-
this._display = request.display;
|
|
3356
|
-
this.contextUpdate.emit(request);
|
|
3357
|
-
}
|
|
3358
|
-
}
|
|
3359
|
-
},
|
|
3360
|
-
port: this._port
|
|
3361
|
-
});
|
|
3362
|
-
await this._shellRpc.open();
|
|
3363
|
-
}
|
|
3364
|
-
async close() {
|
|
3365
|
-
var _a;
|
|
3366
|
-
await ((_a = this._shellRpc) == null ? void 0 : _a.close());
|
|
3367
|
-
this._shellRpc = void 0;
|
|
3368
|
-
}
|
|
3369
|
-
};
|
|
3370
|
-
|
|
3371
2899
|
// packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
|
|
3372
|
-
import { asyncTimeout, Trigger as
|
|
3373
|
-
import { log as
|
|
2900
|
+
import { asyncTimeout, Trigger as Trigger5 } from "@dxos/async";
|
|
2901
|
+
import { log as log10 } from "@dxos/log";
|
|
3374
2902
|
var Message;
|
|
3375
2903
|
(function(Message2) {
|
|
3376
2904
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -3378,7 +2906,7 @@ var Message;
|
|
|
3378
2906
|
var VaultResourceLock = class {
|
|
3379
2907
|
constructor({ lockKey, onAcquire, onRelease }) {
|
|
3380
2908
|
this._broadcastChannel = new BroadcastChannel("vault-resource-lock");
|
|
3381
|
-
this._releaseTrigger = new
|
|
2909
|
+
this._releaseTrigger = new Trigger5();
|
|
3382
2910
|
this._lockKey = lockKey;
|
|
3383
2911
|
this._onAcquire = onAcquire;
|
|
3384
2912
|
this._onRelease = onRelease;
|
|
@@ -3403,7 +2931,7 @@ var VaultResourceLock = class {
|
|
|
3403
2931
|
}
|
|
3404
2932
|
}
|
|
3405
2933
|
async _requestLock(steal = false) {
|
|
3406
|
-
|
|
2934
|
+
log10("requesting lock...", {
|
|
3407
2935
|
steal
|
|
3408
2936
|
}, {
|
|
3409
2937
|
file: "vault-resource-lock.ts",
|
|
@@ -3411,23 +2939,23 @@ var VaultResourceLock = class {
|
|
|
3411
2939
|
scope: this,
|
|
3412
2940
|
callSite: (f, a) => f(...a)
|
|
3413
2941
|
});
|
|
3414
|
-
const acquired = new
|
|
2942
|
+
const acquired = new Trigger5();
|
|
3415
2943
|
void navigator.locks.request(this._lockKey, {
|
|
3416
2944
|
steal
|
|
3417
2945
|
}, async () => {
|
|
3418
2946
|
var _a, _b;
|
|
3419
2947
|
await ((_a = this._onAcquire) == null ? void 0 : _a.call(this));
|
|
3420
2948
|
acquired.wake();
|
|
3421
|
-
this._releaseTrigger = new
|
|
2949
|
+
this._releaseTrigger = new Trigger5();
|
|
3422
2950
|
await this._releaseTrigger.wait();
|
|
3423
|
-
|
|
2951
|
+
log10("releasing lock...", {}, {
|
|
3424
2952
|
file: "vault-resource-lock.ts",
|
|
3425
2953
|
line: 65,
|
|
3426
2954
|
scope: this,
|
|
3427
2955
|
callSite: (f, a) => f(...a)
|
|
3428
2956
|
});
|
|
3429
2957
|
await ((_b = this._onRelease) == null ? void 0 : _b.call(this));
|
|
3430
|
-
|
|
2958
|
+
log10("released lock", {}, {
|
|
3431
2959
|
file: "vault-resource-lock.ts",
|
|
3432
2960
|
line: 67,
|
|
3433
2961
|
scope: this,
|
|
@@ -3438,7 +2966,7 @@ var VaultResourceLock = class {
|
|
|
3438
2966
|
await ((_a = this._onRelease) == null ? void 0 : _a.call(this));
|
|
3439
2967
|
});
|
|
3440
2968
|
await acquired.wait();
|
|
3441
|
-
|
|
2969
|
+
log10("recieved lock", {
|
|
3442
2970
|
steal
|
|
3443
2971
|
}, {
|
|
3444
2972
|
file: "vault-resource-lock.ts",
|
|
@@ -3450,17 +2978,73 @@ var VaultResourceLock = class {
|
|
|
3450
2978
|
};
|
|
3451
2979
|
|
|
3452
2980
|
// packages/sdk/client-services/src/packlets/vault/worker-runtime.ts
|
|
3453
|
-
import { Trigger as
|
|
3454
|
-
import { log as
|
|
2981
|
+
import { Trigger as Trigger7 } from "@dxos/async";
|
|
2982
|
+
import { log as log12 } from "@dxos/log";
|
|
3455
2983
|
import { MemorySignalManager, MemorySignalManagerContext, WebsocketSignalManager } from "@dxos/messaging";
|
|
3456
2984
|
import { NetworkManager, WebRTCTransportProxyFactory } from "@dxos/network-manager";
|
|
3457
2985
|
|
|
3458
2986
|
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
3459
|
-
import
|
|
3460
|
-
import { asyncTimeout as asyncTimeout2, Trigger as
|
|
3461
|
-
import {
|
|
3462
|
-
import {
|
|
2987
|
+
import assert11 from "@dxos/node-std/assert";
|
|
2988
|
+
import { asyncTimeout as asyncTimeout2, Trigger as Trigger6 } from "@dxos/async";
|
|
2989
|
+
import { iframeServiceBundle as iframeServiceBundle2, workerServiceBundle as workerServiceBundle2 } from "@dxos/client";
|
|
2990
|
+
import { log as log11, logInfo } from "@dxos/log";
|
|
2991
|
+
import { createProtoRpcPeer as createProtoRpcPeer3 } from "@dxos/rpc";
|
|
3463
2992
|
import { Callback } from "@dxos/util";
|
|
2993
|
+
|
|
2994
|
+
// packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
|
|
2995
|
+
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
2996
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
2997
|
+
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
2998
|
+
var ClientRpcServer = class {
|
|
2999
|
+
constructor(params) {
|
|
3000
|
+
this._handlerCache = /* @__PURE__ */ new Map();
|
|
3001
|
+
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
3002
|
+
this._handleCall = handleCall;
|
|
3003
|
+
this._handleStream = handleStream;
|
|
3004
|
+
this._serviceRegistry = serviceRegistry;
|
|
3005
|
+
this._rpcPeer = new RpcPeer({
|
|
3006
|
+
...rpcOptions,
|
|
3007
|
+
callHandler: (method, params2) => {
|
|
3008
|
+
const [serviceName, methodName] = parseMethodName(method);
|
|
3009
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
|
|
3010
|
+
if (this._handleCall) {
|
|
3011
|
+
return this._handleCall(methodName, params2, handler);
|
|
3012
|
+
} else {
|
|
3013
|
+
return handler(methodName, params2);
|
|
3014
|
+
}
|
|
3015
|
+
},
|
|
3016
|
+
streamHandler: (method, params2) => {
|
|
3017
|
+
const [serviceName, methodName] = parseMethodName(method);
|
|
3018
|
+
const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
|
|
3019
|
+
if (this._handleStream) {
|
|
3020
|
+
return Stream12.unwrapPromise(this._handleStream(methodName, params2, handler));
|
|
3021
|
+
} else {
|
|
3022
|
+
return handler(methodName, params2);
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
async open() {
|
|
3028
|
+
await this._rpcPeer.open();
|
|
3029
|
+
}
|
|
3030
|
+
async close() {
|
|
3031
|
+
await this._rpcPeer.close();
|
|
3032
|
+
}
|
|
3033
|
+
_getServiceHandler(serviceName) {
|
|
3034
|
+
var _a;
|
|
3035
|
+
if (!this._handlerCache.has(serviceName)) {
|
|
3036
|
+
const [key, descriptor] = (_a = Object.entries(this._serviceRegistry.descriptors).find(([key2, descriptor2]) => descriptor2.name === serviceName)) != null ? _a : raise2(new Error(`Service not available: ${serviceName}`));
|
|
3037
|
+
const service = this._serviceRegistry.services[key];
|
|
3038
|
+
if (!service) {
|
|
3039
|
+
throw new Error(`Service not available: ${serviceName}`);
|
|
3040
|
+
}
|
|
3041
|
+
this._handlerCache.set(serviceName, descriptor.createServer(service));
|
|
3042
|
+
}
|
|
3043
|
+
return this._handlerCache.get(serviceName);
|
|
3044
|
+
}
|
|
3045
|
+
};
|
|
3046
|
+
|
|
3047
|
+
// packages/sdk/client-services/src/packlets/vault/worker-session.ts
|
|
3464
3048
|
var __decorate3 = function(decorators, target, key, desc) {
|
|
3465
3049
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3466
3050
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -3472,40 +3056,48 @@ var __decorate3 = function(decorators, target, key, desc) {
|
|
|
3472
3056
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3473
3057
|
};
|
|
3474
3058
|
var WorkerSession = class {
|
|
3475
|
-
constructor({
|
|
3059
|
+
constructor({ serviceHost, systemPort, appPort, shellPort, readySignal, options = {
|
|
3476
3060
|
heartbeatInterval: 1e3
|
|
3477
3061
|
} }) {
|
|
3478
|
-
this._startTrigger = new
|
|
3062
|
+
this._startTrigger = new Trigger6();
|
|
3479
3063
|
this.onClose = new Callback();
|
|
3480
|
-
|
|
3481
|
-
|
|
3064
|
+
assert11(options);
|
|
3065
|
+
assert11(serviceHost);
|
|
3482
3066
|
this._options = options;
|
|
3483
|
-
this.
|
|
3484
|
-
const
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3067
|
+
this._serviceHost = serviceHost;
|
|
3068
|
+
const middleware = {
|
|
3069
|
+
handleCall: async (method, params, handler) => {
|
|
3070
|
+
const error = await readySignal.wait({
|
|
3071
|
+
timeout: 3e3
|
|
3072
|
+
});
|
|
3073
|
+
if (error) {
|
|
3074
|
+
throw error;
|
|
3075
|
+
}
|
|
3076
|
+
return handler(method, params);
|
|
3077
|
+
},
|
|
3078
|
+
handleStream: async (method, params, handler) => {
|
|
3079
|
+
const error = await readySignal.wait({
|
|
3080
|
+
timeout: 3e3
|
|
3081
|
+
});
|
|
3082
|
+
if (error) {
|
|
3083
|
+
throw error;
|
|
3084
|
+
}
|
|
3085
|
+
return handler(method, params);
|
|
3086
|
+
}
|
|
3495
3087
|
};
|
|
3496
|
-
this._clientRpc =
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
});
|
|
3501
|
-
this._shellClientRpc =
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
});
|
|
3506
|
-
this._iframeRpc =
|
|
3507
|
-
requested:
|
|
3508
|
-
exposed:
|
|
3088
|
+
this._clientRpc = new ClientRpcServer({
|
|
3089
|
+
serviceRegistry: this._serviceHost.serviceRegistry,
|
|
3090
|
+
port: appPort,
|
|
3091
|
+
...middleware
|
|
3092
|
+
});
|
|
3093
|
+
this._shellClientRpc = new ClientRpcServer({
|
|
3094
|
+
serviceRegistry: this._serviceHost.serviceRegistry,
|
|
3095
|
+
port: shellPort,
|
|
3096
|
+
...middleware
|
|
3097
|
+
});
|
|
3098
|
+
this._iframeRpc = createProtoRpcPeer3({
|
|
3099
|
+
requested: iframeServiceBundle2,
|
|
3100
|
+
exposed: workerServiceBundle2,
|
|
3509
3101
|
handlers: {
|
|
3510
3102
|
WorkerService: {
|
|
3511
3103
|
start: async (request) => {
|
|
@@ -3517,9 +3109,9 @@ var WorkerSession = class {
|
|
|
3517
3109
|
try {
|
|
3518
3110
|
await this.close();
|
|
3519
3111
|
} catch (err) {
|
|
3520
|
-
|
|
3112
|
+
log11.catch(err, {}, {
|
|
3521
3113
|
file: "worker-session.ts",
|
|
3522
|
-
line:
|
|
3114
|
+
line: 107,
|
|
3523
3115
|
scope: this,
|
|
3524
3116
|
callSite: (f, a) => f(...a)
|
|
3525
3117
|
});
|
|
@@ -3535,9 +3127,9 @@ var WorkerSession = class {
|
|
|
3535
3127
|
this.bridgeService = this._iframeRpc.rpc.BridgeService;
|
|
3536
3128
|
}
|
|
3537
3129
|
async open() {
|
|
3538
|
-
|
|
3130
|
+
log11.info("opening..", {}, {
|
|
3539
3131
|
file: "worker-session.ts",
|
|
3540
|
-
line:
|
|
3132
|
+
line: 121,
|
|
3541
3133
|
scope: this,
|
|
3542
3134
|
callSite: (f, a) => f(...a)
|
|
3543
3135
|
});
|
|
@@ -3553,20 +3145,20 @@ var WorkerSession = class {
|
|
|
3553
3145
|
try {
|
|
3554
3146
|
await this._iframeRpc.rpc.IframeService.heartbeat();
|
|
3555
3147
|
} catch (err1) {
|
|
3556
|
-
|
|
3148
|
+
log11.warn("Heartbeat failed", {
|
|
3557
3149
|
err: err1
|
|
3558
3150
|
}, {
|
|
3559
3151
|
file: "worker-session.ts",
|
|
3560
|
-
line:
|
|
3152
|
+
line: 133,
|
|
3561
3153
|
scope: this,
|
|
3562
3154
|
callSite: (f, a) => f(...a)
|
|
3563
3155
|
});
|
|
3564
3156
|
try {
|
|
3565
3157
|
await this.close();
|
|
3566
3158
|
} catch (err) {
|
|
3567
|
-
|
|
3159
|
+
log11.catch(err, {}, {
|
|
3568
3160
|
file: "worker-session.ts",
|
|
3569
|
-
line:
|
|
3161
|
+
line: 137,
|
|
3570
3162
|
scope: this,
|
|
3571
3163
|
callSite: (f, a) => f(...a)
|
|
3572
3164
|
});
|
|
@@ -3575,18 +3167,18 @@ var WorkerSession = class {
|
|
|
3575
3167
|
}, this._options.heartbeatInterval);
|
|
3576
3168
|
}
|
|
3577
3169
|
async close() {
|
|
3578
|
-
|
|
3170
|
+
log11.info("closing..", {}, {
|
|
3579
3171
|
file: "worker-session.ts",
|
|
3580
|
-
line:
|
|
3172
|
+
line: 144,
|
|
3581
3173
|
scope: this,
|
|
3582
3174
|
callSite: (f, a) => f(...a)
|
|
3583
3175
|
});
|
|
3584
3176
|
try {
|
|
3585
3177
|
await this.onClose.callIfSet();
|
|
3586
3178
|
} catch (err) {
|
|
3587
|
-
|
|
3179
|
+
log11.catch(err, {}, {
|
|
3588
3180
|
file: "worker-session.ts",
|
|
3589
|
-
line:
|
|
3181
|
+
line: 148,
|
|
3590
3182
|
scope: this,
|
|
3591
3183
|
callSite: (f, a) => f(...a)
|
|
3592
3184
|
});
|
|
@@ -3603,9 +3195,9 @@ var WorkerSession = class {
|
|
|
3603
3195
|
try {
|
|
3604
3196
|
await asyncTimeout2(this._shellClientRpc.open(), 1e3);
|
|
3605
3197
|
} catch (e) {
|
|
3606
|
-
|
|
3198
|
+
log11.info("No shell connected.", {}, {
|
|
3607
3199
|
file: "worker-session.ts",
|
|
3608
|
-
line:
|
|
3200
|
+
line: 162,
|
|
3609
3201
|
scope: this,
|
|
3610
3202
|
callSite: (f, a) => f(...a)
|
|
3611
3203
|
});
|
|
@@ -3622,20 +3214,21 @@ var WorkerRuntime = class {
|
|
|
3622
3214
|
constructor(_configProvider) {
|
|
3623
3215
|
this._configProvider = _configProvider;
|
|
3624
3216
|
this._transportFactory = new WebRTCTransportProxyFactory();
|
|
3625
|
-
this._ready = new
|
|
3217
|
+
this._ready = new Trigger7();
|
|
3626
3218
|
this.sessions = /* @__PURE__ */ new Set();
|
|
3219
|
+
this._clientServices = new ClientServicesHost();
|
|
3627
3220
|
}
|
|
3628
3221
|
async start() {
|
|
3629
|
-
|
|
3222
|
+
log12("starting...", {}, {
|
|
3630
3223
|
file: "worker-runtime.ts",
|
|
3631
|
-
line:
|
|
3224
|
+
line: 44,
|
|
3632
3225
|
scope: this,
|
|
3633
3226
|
callSite: (f, a) => f(...a)
|
|
3634
3227
|
});
|
|
3635
3228
|
try {
|
|
3636
3229
|
this._config = await this._configProvider();
|
|
3637
3230
|
const signalServer = this._config.get("runtime.services.signal.server");
|
|
3638
|
-
this._clientServices
|
|
3231
|
+
this._clientServices.initialize({
|
|
3639
3232
|
config: this._config,
|
|
3640
3233
|
networkManager: new NetworkManager({
|
|
3641
3234
|
log: true,
|
|
@@ -3647,17 +3240,17 @@ var WorkerRuntime = class {
|
|
|
3647
3240
|
});
|
|
3648
3241
|
await this._clientServices.open();
|
|
3649
3242
|
this._ready.wake(void 0);
|
|
3650
|
-
|
|
3243
|
+
log12("started", {}, {
|
|
3651
3244
|
file: "worker-runtime.ts",
|
|
3652
|
-
line:
|
|
3245
|
+
line: 61,
|
|
3653
3246
|
scope: this,
|
|
3654
3247
|
callSite: (f, a) => f(...a)
|
|
3655
3248
|
});
|
|
3656
3249
|
} catch (err) {
|
|
3657
3250
|
this._ready.wake(err);
|
|
3658
|
-
|
|
3251
|
+
log12.catch(err, {}, {
|
|
3659
3252
|
file: "worker-runtime.ts",
|
|
3660
|
-
line:
|
|
3253
|
+
line: 64,
|
|
3661
3254
|
scope: this,
|
|
3662
3255
|
callSite: (f, a) => f(...a)
|
|
3663
3256
|
});
|
|
@@ -3671,17 +3264,7 @@ var WorkerRuntime = class {
|
|
|
3671
3264
|
*/
|
|
3672
3265
|
async createSession({ appPort, systemPort, shellPort }) {
|
|
3673
3266
|
const session = new WorkerSession({
|
|
3674
|
-
|
|
3675
|
-
const error = await this._ready.wait();
|
|
3676
|
-
if (error) {
|
|
3677
|
-
throw error;
|
|
3678
|
-
}
|
|
3679
|
-
const service = find(this._clientServices.services);
|
|
3680
|
-
if (!service) {
|
|
3681
|
-
throw new Error("Service not found");
|
|
3682
|
-
}
|
|
3683
|
-
return service;
|
|
3684
|
-
},
|
|
3267
|
+
serviceHost: this._clientServices,
|
|
3685
3268
|
appPort,
|
|
3686
3269
|
systemPort,
|
|
3687
3270
|
shellPort,
|
|
@@ -3716,10 +3299,206 @@ var WorkerRuntime = class {
|
|
|
3716
3299
|
}
|
|
3717
3300
|
};
|
|
3718
3301
|
|
|
3302
|
+
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
3303
|
+
import { Trigger as Trigger8 } from "@dxos/async";
|
|
3304
|
+
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
3305
|
+
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
3306
|
+
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
|
|
3307
|
+
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3308
|
+
import { Keyring } from "@dxos/keyring";
|
|
3309
|
+
import { log as log13 } from "@dxos/log";
|
|
3310
|
+
var ServiceContext = class {
|
|
3311
|
+
// prettier-ignore
|
|
3312
|
+
constructor(storage, networkManager, modelFactory) {
|
|
3313
|
+
this.storage = storage;
|
|
3314
|
+
this.networkManager = networkManager;
|
|
3315
|
+
this.modelFactory = modelFactory;
|
|
3316
|
+
this.initialized = new Trigger8();
|
|
3317
|
+
this.dataServiceSubscriptions = new DataServiceSubscriptions();
|
|
3318
|
+
this.metadataStore = new MetadataStore(storage.createDirectory("metadata"));
|
|
3319
|
+
this.snapshotStore = new SnapshotStore(storage.createDirectory("snapshots"));
|
|
3320
|
+
this.keyring = new Keyring(storage.createDirectory("keyring"));
|
|
3321
|
+
this.feedStore = new FeedStore({
|
|
3322
|
+
factory: new FeedFactory({
|
|
3323
|
+
root: storage.createDirectory("feeds"),
|
|
3324
|
+
signer: this.keyring,
|
|
3325
|
+
hypercore: {
|
|
3326
|
+
valueEncoding
|
|
3327
|
+
}
|
|
3328
|
+
})
|
|
3329
|
+
});
|
|
3330
|
+
this.spaceManager = new SpaceManager({
|
|
3331
|
+
feedStore: this.feedStore,
|
|
3332
|
+
networkManager: this.networkManager
|
|
3333
|
+
});
|
|
3334
|
+
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
3335
|
+
this.deviceInvitations = new DeviceInvitationsHandler({
|
|
3336
|
+
networkManager: this.networkManager,
|
|
3337
|
+
getIdentity: () => {
|
|
3338
|
+
var _a;
|
|
3339
|
+
return (_a = this.identityManager.identity) != null ? _a : failUndefined2();
|
|
3340
|
+
},
|
|
3341
|
+
acceptIdentity: this._acceptIdentity.bind(this),
|
|
3342
|
+
keyring: this.keyring
|
|
3343
|
+
});
|
|
3344
|
+
}
|
|
3345
|
+
async open() {
|
|
3346
|
+
log13("opening...", {}, {
|
|
3347
|
+
file: "service-context.ts",
|
|
3348
|
+
line: 94,
|
|
3349
|
+
scope: this,
|
|
3350
|
+
callSite: (f, a) => f(...a)
|
|
3351
|
+
});
|
|
3352
|
+
await this.networkManager.open();
|
|
3353
|
+
await this.spaceManager.open();
|
|
3354
|
+
await this.identityManager.open();
|
|
3355
|
+
if (this.identityManager.identity) {
|
|
3356
|
+
await this._initialize();
|
|
3357
|
+
}
|
|
3358
|
+
log13("opened", {}, {
|
|
3359
|
+
file: "service-context.ts",
|
|
3360
|
+
line: 101,
|
|
3361
|
+
scope: this,
|
|
3362
|
+
callSite: (f, a) => f(...a)
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
async close() {
|
|
3366
|
+
var _a, _b;
|
|
3367
|
+
log13("closing...", {}, {
|
|
3368
|
+
file: "service-context.ts",
|
|
3369
|
+
line: 105,
|
|
3370
|
+
scope: this,
|
|
3371
|
+
callSite: (f, a) => f(...a)
|
|
3372
|
+
});
|
|
3373
|
+
await ((_a = this._deviceSpaceSync) == null ? void 0 : _a.close());
|
|
3374
|
+
await ((_b = this.dataSpaceManager) == null ? void 0 : _b.close());
|
|
3375
|
+
await this.identityManager.close();
|
|
3376
|
+
await this.spaceManager.close();
|
|
3377
|
+
await this.feedStore.close();
|
|
3378
|
+
await this.networkManager.close();
|
|
3379
|
+
this.dataServiceSubscriptions.clear();
|
|
3380
|
+
log13("closed", {}, {
|
|
3381
|
+
file: "service-context.ts",
|
|
3382
|
+
line: 113,
|
|
3383
|
+
scope: this,
|
|
3384
|
+
callSite: (f, a) => f(...a)
|
|
3385
|
+
});
|
|
3386
|
+
}
|
|
3387
|
+
async reset() {
|
|
3388
|
+
log13("resetting...", {}, {
|
|
3389
|
+
file: "service-context.ts",
|
|
3390
|
+
line: 117,
|
|
3391
|
+
scope: this,
|
|
3392
|
+
callSite: (f, a) => f(...a)
|
|
3393
|
+
});
|
|
3394
|
+
await this.close();
|
|
3395
|
+
await this.storage.reset();
|
|
3396
|
+
log13("reset", {}, {
|
|
3397
|
+
file: "service-context.ts",
|
|
3398
|
+
line: 120,
|
|
3399
|
+
scope: this,
|
|
3400
|
+
callSite: (f, a) => f(...a)
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
async createIdentity(params = {}) {
|
|
3404
|
+
const identity = await this.identityManager.createIdentity(params);
|
|
3405
|
+
await this._initialize();
|
|
3406
|
+
return identity;
|
|
3407
|
+
}
|
|
3408
|
+
async _acceptIdentity(params) {
|
|
3409
|
+
const identity = await this.identityManager.acceptIdentity(params);
|
|
3410
|
+
await this._initialize();
|
|
3411
|
+
return identity;
|
|
3412
|
+
}
|
|
3413
|
+
// Called when identity is created.
|
|
3414
|
+
async _initialize() {
|
|
3415
|
+
var _a;
|
|
3416
|
+
log13("initializing spaces...", {}, {
|
|
3417
|
+
file: "service-context.ts",
|
|
3418
|
+
line: 139,
|
|
3419
|
+
scope: this,
|
|
3420
|
+
callSite: (f, a) => f(...a)
|
|
3421
|
+
});
|
|
3422
|
+
const identity = (_a = this.identityManager.identity) != null ? _a : failUndefined2();
|
|
3423
|
+
const signingContext = {
|
|
3424
|
+
credentialSigner: identity.getIdentityCredentialSigner(),
|
|
3425
|
+
identityKey: identity.identityKey,
|
|
3426
|
+
deviceKey: identity.deviceKey,
|
|
3427
|
+
profile: identity.profileDocument,
|
|
3428
|
+
recordCredential: async (credential) => {
|
|
3429
|
+
await identity.controlPipeline.writer.write({
|
|
3430
|
+
credential: {
|
|
3431
|
+
credential
|
|
3432
|
+
}
|
|
3433
|
+
});
|
|
3434
|
+
}
|
|
3435
|
+
};
|
|
3436
|
+
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.modelFactory, this.feedStore, this.snapshotStore);
|
|
3437
|
+
await this.dataSpaceManager.open();
|
|
3438
|
+
this.spaceInvitations = new SpaceInvitationsHandler(this.networkManager, this.dataSpaceManager, signingContext, this.keyring);
|
|
3439
|
+
this.initialized.wake();
|
|
3440
|
+
this._deviceSpaceSync = identity.space.spaceState.registerProcessor({
|
|
3441
|
+
process: async (credential) => {
|
|
3442
|
+
const assertion = getCredentialAssertion3(credential);
|
|
3443
|
+
if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
|
|
3444
|
+
return;
|
|
3445
|
+
}
|
|
3446
|
+
if (assertion.spaceKey.equals(identity.space.key)) {
|
|
3447
|
+
return;
|
|
3448
|
+
}
|
|
3449
|
+
if (!this.dataSpaceManager) {
|
|
3450
|
+
log13("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
3451
|
+
details: assertion
|
|
3452
|
+
}, {
|
|
3453
|
+
file: "service-context.ts",
|
|
3454
|
+
line: 182,
|
|
3455
|
+
scope: this,
|
|
3456
|
+
callSite: (f, a) => f(...a)
|
|
3457
|
+
});
|
|
3458
|
+
return;
|
|
3459
|
+
}
|
|
3460
|
+
if (this.dataSpaceManager.spaces.has(assertion.spaceKey)) {
|
|
3461
|
+
log13("space already exists, ignoring space admission", {
|
|
3462
|
+
details: assertion
|
|
3463
|
+
}, {
|
|
3464
|
+
file: "service-context.ts",
|
|
3465
|
+
line: 186,
|
|
3466
|
+
scope: this,
|
|
3467
|
+
callSite: (f, a) => f(...a)
|
|
3468
|
+
});
|
|
3469
|
+
return;
|
|
3470
|
+
}
|
|
3471
|
+
try {
|
|
3472
|
+
log13("accepting space recorded in halo", {
|
|
3473
|
+
details: assertion
|
|
3474
|
+
}, {
|
|
3475
|
+
file: "service-context.ts",
|
|
3476
|
+
line: 191,
|
|
3477
|
+
scope: this,
|
|
3478
|
+
callSite: (f, a) => f(...a)
|
|
3479
|
+
});
|
|
3480
|
+
await this.dataSpaceManager.acceptSpace({
|
|
3481
|
+
spaceKey: assertion.spaceKey,
|
|
3482
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
3483
|
+
});
|
|
3484
|
+
} catch (err) {
|
|
3485
|
+
log13.catch(err, {}, {
|
|
3486
|
+
file: "service-context.ts",
|
|
3487
|
+
line: 197,
|
|
3488
|
+
scope: this,
|
|
3489
|
+
callSite: (f, a) => f(...a)
|
|
3490
|
+
});
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
await this._deviceSpaceSync.open();
|
|
3495
|
+
}
|
|
3496
|
+
};
|
|
3497
|
+
|
|
3719
3498
|
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
3720
3499
|
var ServiceRegistry = class {
|
|
3721
3500
|
// prettier-ignore
|
|
3722
|
-
constructor(_serviceBundle, _handlers) {
|
|
3501
|
+
constructor(_serviceBundle, _handlers = {}) {
|
|
3723
3502
|
this._serviceBundle = _serviceBundle;
|
|
3724
3503
|
this._handlers = _handlers;
|
|
3725
3504
|
}
|
|
@@ -3732,28 +3511,35 @@ var ServiceRegistry = class {
|
|
|
3732
3511
|
setServices(services) {
|
|
3733
3512
|
this._handlers = services;
|
|
3734
3513
|
}
|
|
3514
|
+
addService(name, service) {
|
|
3515
|
+
this._handlers[name] = service;
|
|
3516
|
+
}
|
|
3517
|
+
removeService(name) {
|
|
3518
|
+
delete this._handlers[name];
|
|
3519
|
+
}
|
|
3735
3520
|
};
|
|
3736
3521
|
|
|
3737
3522
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
3738
|
-
var createDefaultModelFactory = () => {
|
|
3739
|
-
return new ModelFactory().registerModel(DocumentModel).registerModel(TextModel);
|
|
3740
|
-
};
|
|
3741
3523
|
var ClientServicesHost = class {
|
|
3742
3524
|
constructor({
|
|
3743
3525
|
config,
|
|
3744
3526
|
modelFactory = createDefaultModelFactory(),
|
|
3745
3527
|
// TODO(burdon): Create ApolloLink abstraction (see Client).
|
|
3746
3528
|
networkManager,
|
|
3747
|
-
storage
|
|
3529
|
+
storage,
|
|
3748
3530
|
// TODO(wittjosiah): Turn this on by default.
|
|
3749
3531
|
lockKey
|
|
3750
|
-
}) {
|
|
3751
|
-
this._statusUpdate = new
|
|
3532
|
+
} = {}) {
|
|
3533
|
+
this._statusUpdate = new Event6();
|
|
3752
3534
|
this._open = false;
|
|
3753
|
-
this._config = config;
|
|
3754
|
-
this._modelFactory = modelFactory;
|
|
3755
|
-
this._networkManager = networkManager;
|
|
3756
3535
|
this._storage = storage;
|
|
3536
|
+
this._modelFactory = modelFactory;
|
|
3537
|
+
if (config) {
|
|
3538
|
+
this.initialize({
|
|
3539
|
+
config,
|
|
3540
|
+
networkManager
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3757
3543
|
this._resourceLock = lockKey ? new VaultResourceLock({
|
|
3758
3544
|
lockKey,
|
|
3759
3545
|
onAcquire: () => this.open(),
|
|
@@ -3772,7 +3558,7 @@ var ClientServicesHost = class {
|
|
|
3772
3558
|
}
|
|
3773
3559
|
},
|
|
3774
3560
|
onReset: async () => {
|
|
3775
|
-
|
|
3561
|
+
assert12(this._serviceContext, "service host is closed");
|
|
3776
3562
|
await this._serviceContext.reset();
|
|
3777
3563
|
}
|
|
3778
3564
|
});
|
|
@@ -3783,20 +3569,45 @@ var ClientServicesHost = class {
|
|
|
3783
3569
|
get isOpen() {
|
|
3784
3570
|
return this._open;
|
|
3785
3571
|
}
|
|
3572
|
+
get serviceRegistry() {
|
|
3573
|
+
return this._serviceRegistry;
|
|
3574
|
+
}
|
|
3786
3575
|
get descriptors() {
|
|
3787
3576
|
return this._serviceRegistry.descriptors;
|
|
3788
3577
|
}
|
|
3789
3578
|
get services() {
|
|
3790
3579
|
return this._serviceRegistry.services;
|
|
3791
3580
|
}
|
|
3581
|
+
/**
|
|
3582
|
+
* Initialize the service host with the config.
|
|
3583
|
+
* Config can also be provided in the constructor.
|
|
3584
|
+
* Can only be called once.
|
|
3585
|
+
*/
|
|
3586
|
+
initialize({ config, networkManager }) {
|
|
3587
|
+
assert12(!this._open, "service host is open");
|
|
3588
|
+
if (config) {
|
|
3589
|
+
assert12(!this._config, "config already set");
|
|
3590
|
+
this._config = config;
|
|
3591
|
+
if (!this._storage) {
|
|
3592
|
+
this._storage = createStorageObjects(config.get("runtime.client.storage", {})).storage;
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
if (networkManager) {
|
|
3596
|
+
assert12(!this._networkManager, "network manager already set");
|
|
3597
|
+
this._networkManager = networkManager;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3792
3600
|
async open() {
|
|
3793
3601
|
var _a, _b;
|
|
3794
3602
|
if (this._open) {
|
|
3795
3603
|
return;
|
|
3796
3604
|
}
|
|
3797
|
-
|
|
3605
|
+
assert12(this._config, "config not set");
|
|
3606
|
+
assert12(this._storage, "storage not set");
|
|
3607
|
+
assert12(this._networkManager, "network manager not set");
|
|
3608
|
+
log14("opening...", {}, {
|
|
3798
3609
|
file: "service-host.ts",
|
|
3799
|
-
line:
|
|
3610
|
+
line: 166,
|
|
3800
3611
|
scope: this,
|
|
3801
3612
|
callSite: (f, a) => f(...a)
|
|
3802
3613
|
});
|
|
@@ -3809,10 +3620,10 @@ var ClientServicesHost = class {
|
|
|
3809
3620
|
DeviceInvitationsService: new DeviceInvitationsServiceImpl(this._serviceContext.identityManager, this._serviceContext.deviceInvitations),
|
|
3810
3621
|
SpaceInvitationsService: new SpaceInvitationsServiceImpl(this._serviceContext.identityManager, () => {
|
|
3811
3622
|
var _a2;
|
|
3812
|
-
return (_a2 = this._serviceContext.spaceInvitations) != null ? _a2 :
|
|
3623
|
+
return (_a2 = this._serviceContext.spaceInvitations) != null ? _a2 : raise3(new Error("SpaceInvitations not initialized"));
|
|
3813
3624
|
}, () => {
|
|
3814
3625
|
var _a2;
|
|
3815
|
-
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 :
|
|
3626
|
+
return (_a2 = this._serviceContext.dataSpaceManager) != null ? _a2 : raise3(new Error("SpaceManager not initialized"));
|
|
3816
3627
|
}),
|
|
3817
3628
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
3818
3629
|
await this._serviceContext.initialized.wait();
|
|
@@ -3832,11 +3643,11 @@ var ClientServicesHost = class {
|
|
|
3832
3643
|
this._open = true;
|
|
3833
3644
|
this._statusUpdate.emit();
|
|
3834
3645
|
const deviceKey = (_b = this._serviceContext.identityManager.identity) == null ? void 0 : _b.deviceKey;
|
|
3835
|
-
|
|
3646
|
+
log14("opened", {
|
|
3836
3647
|
deviceKey
|
|
3837
3648
|
}, {
|
|
3838
3649
|
file: "service-host.ts",
|
|
3839
|
-
line:
|
|
3650
|
+
line: 219,
|
|
3840
3651
|
scope: this,
|
|
3841
3652
|
callSite: (f, a) => f(...a)
|
|
3842
3653
|
});
|
|
@@ -3847,11 +3658,11 @@ var ClientServicesHost = class {
|
|
|
3847
3658
|
return;
|
|
3848
3659
|
}
|
|
3849
3660
|
const deviceKey = (_a = this._serviceContext.identityManager.identity) == null ? void 0 : _a.deviceKey;
|
|
3850
|
-
|
|
3661
|
+
log14("closing...", {
|
|
3851
3662
|
deviceKey
|
|
3852
3663
|
}, {
|
|
3853
3664
|
file: "service-host.ts",
|
|
3854
|
-
line:
|
|
3665
|
+
line: 228,
|
|
3855
3666
|
scope: this,
|
|
3856
3667
|
callSite: (f, a) => f(...a)
|
|
3857
3668
|
});
|
|
@@ -3861,49 +3672,17 @@ var ClientServicesHost = class {
|
|
|
3861
3672
|
await this._serviceContext.close();
|
|
3862
3673
|
this._open = false;
|
|
3863
3674
|
this._statusUpdate.emit();
|
|
3864
|
-
|
|
3675
|
+
log14("closed", {
|
|
3865
3676
|
deviceKey
|
|
3866
3677
|
}, {
|
|
3867
3678
|
file: "service-host.ts",
|
|
3868
|
-
line:
|
|
3679
|
+
line: 233,
|
|
3869
3680
|
scope: this,
|
|
3870
3681
|
callSite: (f, a) => f(...a)
|
|
3871
3682
|
});
|
|
3872
3683
|
}
|
|
3873
3684
|
};
|
|
3874
3685
|
|
|
3875
|
-
// packages/sdk/client-services/src/packlets/services/service-proxy.ts
|
|
3876
|
-
import { asyncTimeout as asyncTimeout3 } from "@dxos/async";
|
|
3877
|
-
import { RemoteServiceConnectionTimeout } from "@dxos/errors";
|
|
3878
|
-
import { createProtoRpcPeer as createProtoRpcPeer5 } from "@dxos/rpc";
|
|
3879
|
-
var ClientServicesProxy = class {
|
|
3880
|
-
// prettier-ignore
|
|
3881
|
-
constructor(port, _timeout = 3e4) {
|
|
3882
|
-
this._timeout = _timeout;
|
|
3883
|
-
this._proxy = createProtoRpcPeer5({
|
|
3884
|
-
requested: clientServiceBundle,
|
|
3885
|
-
exposed: {},
|
|
3886
|
-
handlers: {},
|
|
3887
|
-
port
|
|
3888
|
-
});
|
|
3889
|
-
}
|
|
3890
|
-
get proxy() {
|
|
3891
|
-
return this._proxy;
|
|
3892
|
-
}
|
|
3893
|
-
get descriptors() {
|
|
3894
|
-
return clientServiceBundle;
|
|
3895
|
-
}
|
|
3896
|
-
get services() {
|
|
3897
|
-
return this._proxy.rpc;
|
|
3898
|
-
}
|
|
3899
|
-
async open() {
|
|
3900
|
-
await asyncTimeout3(this._proxy.open(), this._timeout, new RemoteServiceConnectionTimeout());
|
|
3901
|
-
}
|
|
3902
|
-
async close() {
|
|
3903
|
-
await this._proxy.close();
|
|
3904
|
-
}
|
|
3905
|
-
};
|
|
3906
|
-
|
|
3907
3686
|
// packages/sdk/client-services/src/packlets/services/local-client-services.ts
|
|
3908
3687
|
var LocalClientServices = class {
|
|
3909
3688
|
constructor(params) {
|
|
@@ -3915,6 +3694,9 @@ var LocalClientServices = class {
|
|
|
3915
3694
|
get services() {
|
|
3916
3695
|
return this._host.services;
|
|
3917
3696
|
}
|
|
3697
|
+
get host() {
|
|
3698
|
+
return this._host;
|
|
3699
|
+
}
|
|
3918
3700
|
async open() {
|
|
3919
3701
|
await this._host.open();
|
|
3920
3702
|
}
|
|
@@ -3923,6 +3705,43 @@ var LocalClientServices = class {
|
|
|
3923
3705
|
}
|
|
3924
3706
|
};
|
|
3925
3707
|
|
|
3708
|
+
// packages/sdk/client-services/src/packlets/services/utils.ts
|
|
3709
|
+
import { Config } from "@dxos/config";
|
|
3710
|
+
import { log as log15 } from "@dxos/log";
|
|
3711
|
+
import { MemorySignalManager as MemorySignalManager2, MemorySignalManagerContext as MemorySignalManagerContext2, WebsocketSignalManager as WebsocketSignalManager2 } from "@dxos/messaging";
|
|
3712
|
+
import { createWebRTCTransportFactory, MemoryTransportFactory, NetworkManager as NetworkManager2 } from "@dxos/network-manager";
|
|
3713
|
+
var fromHost = (config = new Config()) => {
|
|
3714
|
+
return new LocalClientServices({
|
|
3715
|
+
config,
|
|
3716
|
+
networkManager: createNetworkManager(config)
|
|
3717
|
+
});
|
|
3718
|
+
};
|
|
3719
|
+
var createNetworkManager = (config, options = {}) => {
|
|
3720
|
+
const signalServer = config.get("runtime.services.signal.server");
|
|
3721
|
+
if (signalServer) {
|
|
3722
|
+
const { log: log1 = true, signalManager = new WebsocketSignalManager2([
|
|
3723
|
+
signalServer
|
|
3724
|
+
]), transportFactory = createWebRTCTransportFactory({
|
|
3725
|
+
iceServers: config.get("runtime.services.ice")
|
|
3726
|
+
}) } = options;
|
|
3727
|
+
return new NetworkManager2({
|
|
3728
|
+
log: log1,
|
|
3729
|
+
signalManager,
|
|
3730
|
+
transportFactory
|
|
3731
|
+
});
|
|
3732
|
+
}
|
|
3733
|
+
log15.warn("P2P network is not configured.", {}, {
|
|
3734
|
+
file: "utils.ts",
|
|
3735
|
+
line: 48,
|
|
3736
|
+
scope: void 0,
|
|
3737
|
+
callSite: (f, a) => f(...a)
|
|
3738
|
+
});
|
|
3739
|
+
return new NetworkManager2({
|
|
3740
|
+
signalManager: new MemorySignalManager2(new MemorySignalManagerContext2()),
|
|
3741
|
+
transportFactory: MemoryTransportFactory
|
|
3742
|
+
});
|
|
3743
|
+
};
|
|
3744
|
+
|
|
3926
3745
|
// packages/sdk/client-services/src/packlets/vault/iframe-host-runtime.ts
|
|
3927
3746
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
3928
3747
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -3937,22 +3756,11 @@ var __decorate4 = function(decorators, target, key, desc) {
|
|
|
3937
3756
|
var LOCK_KEY = "DXOS_RESOURCE_LOCK";
|
|
3938
3757
|
var IFrameHostRuntime = class {
|
|
3939
3758
|
constructor({ configProvider, appPort, shellPort }) {
|
|
3940
|
-
this._transportFactory =
|
|
3759
|
+
this._transportFactory = createWebRTCTransportFactory2();
|
|
3941
3760
|
this._ready = new Trigger9();
|
|
3942
3761
|
this._configProvider = configProvider;
|
|
3943
3762
|
this._appPort = appPort;
|
|
3944
3763
|
this._shellPort = shellPort;
|
|
3945
|
-
this._getService = async (find) => {
|
|
3946
|
-
const error = await this._ready.wait();
|
|
3947
|
-
if (error) {
|
|
3948
|
-
throw error;
|
|
3949
|
-
}
|
|
3950
|
-
const service = await find(this._clientServices.services);
|
|
3951
|
-
if (!service) {
|
|
3952
|
-
throw new Error("Service not found");
|
|
3953
|
-
}
|
|
3954
|
-
return service;
|
|
3955
|
-
};
|
|
3956
3764
|
if (this._shellPort) {
|
|
3957
3765
|
this._shellRuntime = new ShellRuntimeImpl(this._shellPort);
|
|
3958
3766
|
}
|
|
@@ -3965,9 +3773,9 @@ var IFrameHostRuntime = class {
|
|
|
3965
3773
|
}
|
|
3966
3774
|
async start() {
|
|
3967
3775
|
var _a;
|
|
3968
|
-
|
|
3776
|
+
log16("starting...", {}, {
|
|
3969
3777
|
file: "iframe-host-runtime.ts",
|
|
3970
|
-
line:
|
|
3778
|
+
line: 67,
|
|
3971
3779
|
scope: this,
|
|
3972
3780
|
callSite: (f, a) => f(...a)
|
|
3973
3781
|
});
|
|
@@ -3977,29 +3785,38 @@ var IFrameHostRuntime = class {
|
|
|
3977
3785
|
this._clientServices = new LocalClientServices({
|
|
3978
3786
|
lockKey: LOCK_KEY,
|
|
3979
3787
|
config: this._config,
|
|
3980
|
-
networkManager: new
|
|
3788
|
+
networkManager: new NetworkManager3({
|
|
3981
3789
|
log: true,
|
|
3982
|
-
signalManager: signalServer ? new
|
|
3790
|
+
signalManager: signalServer ? new WebsocketSignalManager3([
|
|
3983
3791
|
signalServer
|
|
3984
|
-
]) : new
|
|
3792
|
+
]) : new MemorySignalManager3(new MemorySignalManagerContext3()),
|
|
3985
3793
|
transportFactory: this._transportFactory
|
|
3986
3794
|
})
|
|
3987
3795
|
});
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
SpaceInvitationsService: async () => await this._getService((services) => services.SpaceInvitationsService),
|
|
3998
|
-
SpacesService: async () => await this._getService((services) => services.SpacesService),
|
|
3999
|
-
SystemService: async () => await this._getService((services) => services.SystemService),
|
|
4000
|
-
TracingService: async () => await this._getService((services) => services.TracingService)
|
|
3796
|
+
const middleware = {
|
|
3797
|
+
handleCall: async (method, params, handler) => {
|
|
3798
|
+
const error = await this._ready.wait({
|
|
3799
|
+
timeout: 3e3
|
|
3800
|
+
});
|
|
3801
|
+
if (error) {
|
|
3802
|
+
throw error;
|
|
3803
|
+
}
|
|
3804
|
+
return handler(method, params);
|
|
4001
3805
|
},
|
|
4002
|
-
|
|
3806
|
+
handleStream: async (method, params, handler) => {
|
|
3807
|
+
const error = await this._ready.wait({
|
|
3808
|
+
timeout: 3e3
|
|
3809
|
+
});
|
|
3810
|
+
if (error) {
|
|
3811
|
+
throw error;
|
|
3812
|
+
}
|
|
3813
|
+
return handler(method, params);
|
|
3814
|
+
}
|
|
3815
|
+
};
|
|
3816
|
+
this._clientRpc = new ClientRpcServer({
|
|
3817
|
+
serviceRegistry: this._clientServices.host.serviceRegistry,
|
|
3818
|
+
port: this._appPort,
|
|
3819
|
+
...middleware
|
|
4003
3820
|
});
|
|
4004
3821
|
await Promise.all([
|
|
4005
3822
|
this._clientServices.open(),
|
|
@@ -4007,17 +3824,17 @@ var IFrameHostRuntime = class {
|
|
|
4007
3824
|
(_a = this._shellRuntime) == null ? void 0 : _a.open()
|
|
4008
3825
|
]);
|
|
4009
3826
|
this._ready.wake(void 0);
|
|
4010
|
-
|
|
3827
|
+
log16("started", {}, {
|
|
4011
3828
|
file: "iframe-host-runtime.ts",
|
|
4012
|
-
line:
|
|
3829
|
+
line: 110,
|
|
4013
3830
|
scope: this,
|
|
4014
3831
|
callSite: (f, a) => f(...a)
|
|
4015
3832
|
});
|
|
4016
3833
|
} catch (err) {
|
|
4017
3834
|
this._ready.wake(err);
|
|
4018
|
-
|
|
3835
|
+
log16.catch(err, {}, {
|
|
4019
3836
|
file: "iframe-host-runtime.ts",
|
|
4020
|
-
line:
|
|
3837
|
+
line: 113,
|
|
4021
3838
|
scope: this,
|
|
4022
3839
|
callSite: (f, a) => f(...a)
|
|
4023
3840
|
});
|
|
@@ -4025,18 +3842,18 @@ var IFrameHostRuntime = class {
|
|
|
4025
3842
|
}
|
|
4026
3843
|
async stop() {
|
|
4027
3844
|
var _a;
|
|
4028
|
-
|
|
3845
|
+
log16("stopping...", {}, {
|
|
4029
3846
|
file: "iframe-host-runtime.ts",
|
|
4030
|
-
line:
|
|
3847
|
+
line: 118,
|
|
4031
3848
|
scope: this,
|
|
4032
3849
|
callSite: (f, a) => f(...a)
|
|
4033
3850
|
});
|
|
4034
3851
|
await this._clientRpc.close();
|
|
4035
3852
|
await this._clientServices.close();
|
|
4036
3853
|
await ((_a = this._shellRuntime) == null ? void 0 : _a.close());
|
|
4037
|
-
|
|
3854
|
+
log16("stopped", {}, {
|
|
4038
3855
|
file: "iframe-host-runtime.ts",
|
|
4039
|
-
line:
|
|
3856
|
+
line: 122,
|
|
4040
3857
|
scope: this,
|
|
4041
3858
|
callSite: (f, a) => f(...a)
|
|
4042
3859
|
});
|
|
@@ -4062,41 +3879,23 @@ export {
|
|
|
4062
3879
|
Identity,
|
|
4063
3880
|
IdentityManager,
|
|
4064
3881
|
IdentityServiceImpl,
|
|
4065
|
-
InvitationEncoder,
|
|
4066
|
-
AUTHENTICATION_CODE_LENGTH,
|
|
4067
|
-
INVITATION_TIMEOUT,
|
|
4068
|
-
ON_CLOSE_DELAY,
|
|
4069
|
-
InvitationObservableProvider,
|
|
4070
|
-
AuthenticatingInvitationProvider,
|
|
4071
|
-
wrapObservable,
|
|
4072
|
-
AbstractInvitationsHandler,
|
|
4073
3882
|
DeviceInvitationsHandler,
|
|
4074
|
-
AbstractInvitationsProxy,
|
|
4075
|
-
DeviceInvitationsProxy,
|
|
4076
3883
|
AbstractInvitationsService,
|
|
4077
3884
|
DeviceInvitationsServiceImpl,
|
|
4078
3885
|
SpaceInvitationsHandler,
|
|
4079
|
-
SpaceInvitationsProxy,
|
|
4080
3886
|
SpaceInvitationsServiceImpl,
|
|
4081
|
-
ServiceContext,
|
|
4082
|
-
clientServiceBundle,
|
|
4083
3887
|
createStorageObjects,
|
|
4084
|
-
iframeServiceBundle,
|
|
4085
|
-
workerServiceBundle,
|
|
4086
|
-
appServiceBundle,
|
|
4087
|
-
shellServiceBundle,
|
|
4088
3888
|
ShellRuntimeImpl,
|
|
4089
3889
|
MemoryShellRuntime,
|
|
4090
3890
|
IFrameHostRuntime,
|
|
4091
3891
|
IFrameProxyRuntime,
|
|
4092
|
-
ShellController,
|
|
4093
3892
|
VaultResourceLock,
|
|
4094
3893
|
WorkerSession,
|
|
4095
3894
|
WorkerRuntime,
|
|
3895
|
+
ServiceContext,
|
|
4096
3896
|
ServiceRegistry,
|
|
4097
|
-
createDefaultModelFactory,
|
|
4098
3897
|
ClientServicesHost,
|
|
4099
|
-
|
|
4100
|
-
|
|
3898
|
+
LocalClientServices,
|
|
3899
|
+
fromHost
|
|
4101
3900
|
};
|
|
4102
|
-
//# sourceMappingURL=chunk-
|
|
3901
|
+
//# sourceMappingURL=chunk-DFO3FW2W.mjs.map
|