@dxos/client-services 0.6.14-main.f49f251 → 0.6.14-staging.3e2eaca
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-Z3SSMM5X.mjs → chunk-GQWG2754.mjs} +169 -142
- package/dist/lib/browser/chunk-GQWG2754.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +9 -2
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-ZORMUE2S.cjs → chunk-4SK56Z44.cjs} +177 -150
- package/dist/lib/node/chunk-4SK56Z44.cjs.map +7 -0
- package/dist/lib/node/index.cjs +47 -47
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +16 -9
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/{chunk-4NBD4YSD.mjs → chunk-POX3HG6I.mjs} +169 -142
- package/dist/lib/node-esm/chunk-POX3HG6I.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +9 -2
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/packlets/devices/devices-service.d.ts +3 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +1 -0
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +1 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +38 -38
- package/src/packlets/devices/devices-service.ts +18 -7
- package/src/packlets/identity/identity.test.ts +16 -5
- package/src/packlets/invitations/edge-invitation-handler.ts +6 -3
- package/src/packlets/invitations/invitation-guest-extenstion.ts +5 -5
- package/src/packlets/invitations/invitation-host-extension.ts +7 -10
- package/src/packlets/invitations/invitations-handler.test.ts +3 -6
- package/src/packlets/invitations/invitations-handler.ts +34 -28
- package/src/packlets/invitations/invitations-manager.ts +5 -3
- package/src/packlets/invitations/invitations-service.ts +5 -1
- package/src/packlets/services/service-context.ts +2 -2
- package/src/packlets/services/service-host.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.test.ts +12 -7
- package/src/packlets/spaces/edge-feed-replicator.ts +9 -5
- package/src/packlets/testing/invitation-utils.ts +7 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-Z3SSMM5X.mjs.map +0 -7
- package/dist/lib/node/chunk-ZORMUE2S.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-4NBD4YSD.mjs.map +0 -7
|
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
397
397
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
398
398
|
|
|
399
399
|
// packages/sdk/client-services/src/version.ts
|
|
400
|
-
var DXOS_VERSION = "0.6.14-
|
|
400
|
+
var DXOS_VERSION = "0.6.14-staging.3e2eaca";
|
|
401
401
|
|
|
402
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
403
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -831,7 +831,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
831
831
|
S: this,
|
|
832
832
|
C: (f, a) => f(...a)
|
|
833
833
|
});
|
|
834
|
-
this._ctx.onDispose(this._messenger.
|
|
834
|
+
this._ctx.onDispose(this._messenger.onMessage((message) => {
|
|
835
835
|
if (!message.serviceId) {
|
|
836
836
|
return;
|
|
837
837
|
}
|
|
@@ -865,10 +865,12 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
865
865
|
});
|
|
866
866
|
this._onMessage(payload);
|
|
867
867
|
}));
|
|
868
|
-
this.
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
868
|
+
this._ctx.onDispose(this._messenger.onReconnected(() => {
|
|
869
|
+
scheduleMicroTask(this._ctx, () => this._handleReconnect());
|
|
870
|
+
}));
|
|
871
|
+
}
|
|
872
|
+
async _handleReconnect() {
|
|
873
|
+
await this._resetConnection();
|
|
872
874
|
if (this._messenger.isConnected) {
|
|
873
875
|
this._startReplication();
|
|
874
876
|
}
|
|
@@ -876,7 +878,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
876
878
|
async _close() {
|
|
877
879
|
log3("close", void 0, {
|
|
878
880
|
F: __dxlog_file5,
|
|
879
|
-
L:
|
|
881
|
+
L: 95,
|
|
880
882
|
S: this,
|
|
881
883
|
C: (f, a) => f(...a)
|
|
882
884
|
});
|
|
@@ -888,7 +890,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
888
890
|
this._connectionCtx = connectionCtx;
|
|
889
891
|
log3("connection context created", void 0, {
|
|
890
892
|
F: __dxlog_file5,
|
|
891
|
-
L:
|
|
893
|
+
L: 103,
|
|
892
894
|
S: this,
|
|
893
895
|
C: (f, a) => f(...a)
|
|
894
896
|
});
|
|
@@ -901,7 +903,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
901
903
|
async _resetConnection() {
|
|
902
904
|
log3("resetConnection", void 0, {
|
|
903
905
|
F: __dxlog_file5,
|
|
904
|
-
L:
|
|
906
|
+
L: 112,
|
|
905
907
|
S: this,
|
|
906
908
|
C: (f, a) => f(...a)
|
|
907
909
|
});
|
|
@@ -917,7 +919,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
917
919
|
hasConnectionCtx: !!this._connectionCtx
|
|
918
920
|
}, {
|
|
919
921
|
F: __dxlog_file5,
|
|
920
|
-
L:
|
|
922
|
+
L: 120,
|
|
921
923
|
S: this,
|
|
922
924
|
C: (f, a) => f(...a)
|
|
923
925
|
});
|
|
@@ -934,7 +936,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
934
936
|
key: feed.key
|
|
935
937
|
}, {
|
|
936
938
|
F: __dxlog_file5,
|
|
937
|
-
L:
|
|
939
|
+
L: 133,
|
|
938
940
|
S: this,
|
|
939
941
|
C: (f, a) => f(...a)
|
|
940
942
|
});
|
|
@@ -950,7 +952,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
950
952
|
if (!this._connectionCtx) {
|
|
951
953
|
log3.info("message dropped because connection was disposed", void 0, {
|
|
952
954
|
F: __dxlog_file5,
|
|
953
|
-
L:
|
|
955
|
+
L: 146,
|
|
954
956
|
S: this,
|
|
955
957
|
C: (f, a) => f(...a)
|
|
956
958
|
});
|
|
@@ -964,13 +966,13 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
964
966
|
};
|
|
965
967
|
log3.info("sending message", logPayload, {
|
|
966
968
|
F: __dxlog_file5,
|
|
967
|
-
L:
|
|
969
|
+
L: 152,
|
|
968
970
|
S: this,
|
|
969
971
|
C: (f, a) => f(...a)
|
|
970
972
|
});
|
|
971
973
|
invariant2(message.feedKey, void 0, {
|
|
972
974
|
F: __dxlog_file5,
|
|
973
|
-
L:
|
|
975
|
+
L: 154,
|
|
974
976
|
S: this,
|
|
975
977
|
A: [
|
|
976
978
|
"message.feedKey",
|
|
@@ -982,7 +984,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
982
984
|
type: message.type
|
|
983
985
|
}, {
|
|
984
986
|
F: __dxlog_file5,
|
|
985
|
-
L:
|
|
987
|
+
L: 157,
|
|
986
988
|
S: this,
|
|
987
989
|
C: (f, a) => f(...a)
|
|
988
990
|
});
|
|
@@ -1001,7 +1003,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1001
1003
|
if (!this._connectionCtx) {
|
|
1002
1004
|
log3.warn("received message after connection context was disposed", void 0, {
|
|
1003
1005
|
F: __dxlog_file5,
|
|
1004
|
-
L:
|
|
1006
|
+
L: 172,
|
|
1005
1007
|
S: this,
|
|
1006
1008
|
C: (f, a) => f(...a)
|
|
1007
1009
|
});
|
|
@@ -1016,7 +1018,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1016
1018
|
message
|
|
1017
1019
|
}, {
|
|
1018
1020
|
F: __dxlog_file5,
|
|
1019
|
-
L:
|
|
1021
|
+
L: 178,
|
|
1020
1022
|
S: this,
|
|
1021
1023
|
C: (f, a) => f(...a)
|
|
1022
1024
|
});
|
|
@@ -1027,7 +1029,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1027
1029
|
feedKey
|
|
1028
1030
|
}, {
|
|
1029
1031
|
F: __dxlog_file5,
|
|
1030
|
-
L:
|
|
1032
|
+
L: 183,
|
|
1031
1033
|
S: this,
|
|
1032
1034
|
C: (f, a) => f(...a)
|
|
1033
1035
|
});
|
|
@@ -1060,7 +1062,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1060
1062
|
blocks: message.blocks.map((b) => b.index)
|
|
1061
1063
|
}, {
|
|
1062
1064
|
F: __dxlog_file5,
|
|
1063
|
-
L:
|
|
1065
|
+
L: 205,
|
|
1064
1066
|
S: this,
|
|
1065
1067
|
C: (f, a) => f(...a)
|
|
1066
1068
|
});
|
|
@@ -1071,7 +1073,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1071
1073
|
feedKey
|
|
1072
1074
|
}, {
|
|
1073
1075
|
F: __dxlog_file5,
|
|
1074
|
-
L:
|
|
1076
|
+
L: 210,
|
|
1075
1077
|
S: this,
|
|
1076
1078
|
C: (f, a) => f(...a)
|
|
1077
1079
|
});
|
|
@@ -1085,7 +1087,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1085
1087
|
...message
|
|
1086
1088
|
}, {
|
|
1087
1089
|
F: __dxlog_file5,
|
|
1088
|
-
L:
|
|
1090
|
+
L: 219,
|
|
1089
1091
|
S: this,
|
|
1090
1092
|
C: (f, a) => f(...a)
|
|
1091
1093
|
});
|
|
@@ -1100,7 +1102,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1100
1102
|
to
|
|
1101
1103
|
}, {
|
|
1102
1104
|
F: __dxlog_file5,
|
|
1103
|
-
L:
|
|
1105
|
+
L: 226,
|
|
1104
1106
|
S: this,
|
|
1105
1107
|
C: (f, a) => f(...a)
|
|
1106
1108
|
});
|
|
@@ -1110,7 +1112,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1110
1112
|
});
|
|
1111
1113
|
invariant2(data instanceof Uint8Array, void 0, {
|
|
1112
1114
|
F: __dxlog_file5,
|
|
1113
|
-
L:
|
|
1115
|
+
L: 231,
|
|
1114
1116
|
S: this,
|
|
1115
1117
|
A: [
|
|
1116
1118
|
"data instanceof Uint8Array",
|
|
@@ -1138,7 +1140,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1138
1140
|
blocks: blocks.length
|
|
1139
1141
|
}, {
|
|
1140
1142
|
F: __dxlog_file5,
|
|
1141
|
-
L:
|
|
1143
|
+
L: 252,
|
|
1142
1144
|
S: this,
|
|
1143
1145
|
C: (f, a) => f(...a)
|
|
1144
1146
|
});
|
|
@@ -1160,7 +1162,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1160
1162
|
if (!this._remoteLength.has(feed.key)) {
|
|
1161
1163
|
log3("blocks not pushed because remote length is unknown", void 0, {
|
|
1162
1164
|
F: __dxlog_file5,
|
|
1163
|
-
L:
|
|
1165
|
+
L: 273,
|
|
1164
1166
|
S: this,
|
|
1165
1167
|
C: (f, a) => f(...a)
|
|
1166
1168
|
});
|
|
@@ -1185,7 +1187,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1185
1187
|
if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
|
|
1186
1188
|
log3("resetting on reconnect", void 0, {
|
|
1187
1189
|
F: __dxlog_file5,
|
|
1188
|
-
L:
|
|
1190
|
+
L: 290,
|
|
1189
1191
|
S: this,
|
|
1190
1192
|
C: (f, a) => f(...a)
|
|
1191
1193
|
});
|
|
@@ -1196,7 +1198,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1196
1198
|
}
|
|
1197
1199
|
}, {
|
|
1198
1200
|
F: __dxlog_file5,
|
|
1199
|
-
L:
|
|
1201
|
+
L: 284
|
|
1200
1202
|
});
|
|
1201
1203
|
return connectionCtx;
|
|
1202
1204
|
}
|
|
@@ -4759,6 +4761,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
4759
4761
|
|
|
4760
4762
|
// packages/sdk/client-services/src/packlets/invitations/edge-invitation-handler.ts
|
|
4761
4763
|
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/edge-invitation-handler.ts";
|
|
4764
|
+
var MAX_RETRIES_PER_INVITATION = 5;
|
|
4762
4765
|
var DEFAULT_REQUEST_RETRY_INTERVAL_MS = 3e3;
|
|
4763
4766
|
var DEFAULT_REQUEST_RETRY_JITTER_MS = 500;
|
|
4764
4767
|
var EdgeInvitationHandler = class {
|
|
@@ -4772,7 +4775,7 @@ var EdgeInvitationHandler = class {
|
|
|
4772
4775
|
if (!this._client) {
|
|
4773
4776
|
log13("edge disabled", void 0, {
|
|
4774
4777
|
F: __dxlog_file16,
|
|
4775
|
-
L:
|
|
4778
|
+
L: 66,
|
|
4776
4779
|
S: this,
|
|
4777
4780
|
C: (f, a) => f(...a)
|
|
4778
4781
|
});
|
|
@@ -4786,7 +4789,7 @@ var EdgeInvitationHandler = class {
|
|
|
4786
4789
|
invitation
|
|
4787
4790
|
}, {
|
|
4788
4791
|
F: __dxlog_file16,
|
|
4789
|
-
L:
|
|
4792
|
+
L: 80,
|
|
4790
4793
|
S: this,
|
|
4791
4794
|
C: (f, a) => f(...a)
|
|
4792
4795
|
});
|
|
@@ -4796,7 +4799,9 @@ var EdgeInvitationHandler = class {
|
|
|
4796
4799
|
this._flowLock?.release();
|
|
4797
4800
|
this._flowLock = void 0;
|
|
4798
4801
|
});
|
|
4802
|
+
let requestCount = 0;
|
|
4799
4803
|
const tryHandleInvitation = async () => {
|
|
4804
|
+
requestCount++;
|
|
4800
4805
|
const admissionRequest = await protocol.createAdmissionRequest(deviceProfile);
|
|
4801
4806
|
if (admissionRequest.space) {
|
|
4802
4807
|
try {
|
|
@@ -4809,19 +4814,19 @@ var EdgeInvitationHandler = class {
|
|
|
4809
4814
|
after: error.retryAfterMs ?? this._calculateNextRetryMs()
|
|
4810
4815
|
}, {
|
|
4811
4816
|
F: __dxlog_file16,
|
|
4812
|
-
L:
|
|
4817
|
+
L: 98,
|
|
4813
4818
|
S: this,
|
|
4814
4819
|
C: (f, a) => f(...a)
|
|
4815
4820
|
});
|
|
4816
|
-
if (error.isRetryable) {
|
|
4821
|
+
if (error.isRetryable && requestCount < MAX_RETRIES_PER_INVITATION) {
|
|
4817
4822
|
scheduleTask5(ctx, tryHandleInvitation, error.retryAfterMs ?? this._calculateNextRetryMs());
|
|
4818
4823
|
}
|
|
4819
|
-
} else {
|
|
4824
|
+
} else if (requestCount < MAX_RETRIES_PER_INVITATION) {
|
|
4820
4825
|
log13.info("failed to handle invitation with edge", {
|
|
4821
4826
|
error
|
|
4822
4827
|
}, {
|
|
4823
4828
|
F: __dxlog_file16,
|
|
4824
|
-
L:
|
|
4829
|
+
L: 107,
|
|
4825
4830
|
S: this,
|
|
4826
4831
|
C: (f, a) => f(...a)
|
|
4827
4832
|
});
|
|
@@ -4836,14 +4841,14 @@ var EdgeInvitationHandler = class {
|
|
|
4836
4841
|
try {
|
|
4837
4842
|
log13("edge invitation flow", void 0, {
|
|
4838
4843
|
F: __dxlog_file16,
|
|
4839
|
-
L:
|
|
4844
|
+
L: 123,
|
|
4840
4845
|
S: this,
|
|
4841
4846
|
C: (f, a) => f(...a)
|
|
4842
4847
|
});
|
|
4843
4848
|
this._flowLock = await tryAcquireBeforeContextDisposed(ctx, guardedState.mutex);
|
|
4844
|
-
log13("edge invitation flow acquired the lock", void 0, {
|
|
4849
|
+
log13.verbose("edge invitation flow acquired the lock", void 0, {
|
|
4845
4850
|
F: __dxlog_file16,
|
|
4846
|
-
L:
|
|
4851
|
+
L: 125,
|
|
4847
4852
|
S: this,
|
|
4848
4853
|
C: (f, a) => f(...a)
|
|
4849
4854
|
});
|
|
@@ -4876,7 +4881,7 @@ var EdgeInvitationHandler = class {
|
|
|
4876
4881
|
async _joinSpaceByInvitation(guardedState, spaceId, request) {
|
|
4877
4882
|
invariant11(this._client, void 0, {
|
|
4878
4883
|
F: __dxlog_file16,
|
|
4879
|
-
L:
|
|
4884
|
+
L: 160,
|
|
4880
4885
|
S: this,
|
|
4881
4886
|
A: [
|
|
4882
4887
|
"this._client",
|
|
@@ -4974,14 +4979,14 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4974
4979
|
async onOpen(context) {
|
|
4975
4980
|
await super.onOpen(context);
|
|
4976
4981
|
try {
|
|
4977
|
-
log14("guest acquire lock", void 0, {
|
|
4982
|
+
log14.verbose("guest acquire lock", void 0, {
|
|
4978
4983
|
F: __dxlog_file17,
|
|
4979
4984
|
L: 89,
|
|
4980
4985
|
S: this,
|
|
4981
4986
|
C: (f, a) => f(...a)
|
|
4982
4987
|
});
|
|
4983
4988
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
4984
|
-
log14("guest lock acquired", void 0, {
|
|
4989
|
+
log14.verbose("guest lock acquired", void 0, {
|
|
4985
4990
|
F: __dxlog_file17,
|
|
4986
4991
|
L: 91,
|
|
4987
4992
|
S: this,
|
|
@@ -4990,7 +4995,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4990
4995
|
await cancelWithContext4(this._ctx, this.rpc.InvitationHostService.options({
|
|
4991
4996
|
role: InvitationOptions.Role.GUEST
|
|
4992
4997
|
}));
|
|
4993
|
-
log14("options sent", void 0, {
|
|
4998
|
+
log14.verbose("options sent", void 0, {
|
|
4994
4999
|
F: __dxlog_file17,
|
|
4995
5000
|
L: 96,
|
|
4996
5001
|
S: this,
|
|
@@ -4999,7 +5004,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4999
5004
|
await cancelWithContext4(this._ctx, this._remoteOptionsTrigger.wait({
|
|
5000
5005
|
timeout: OPTIONS_TIMEOUT
|
|
5001
5006
|
}));
|
|
5002
|
-
log14("options received", void 0, {
|
|
5007
|
+
log14.verbose("options received", void 0, {
|
|
5003
5008
|
F: __dxlog_file17,
|
|
5004
5009
|
L: 98,
|
|
5005
5010
|
S: this,
|
|
@@ -5033,7 +5038,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
5033
5038
|
if (this._invitationFlowLock != null) {
|
|
5034
5039
|
this._invitationFlowLock.release();
|
|
5035
5040
|
this._invitationFlowLock = null;
|
|
5036
|
-
log14("invitation flow lock released", void 0, {
|
|
5041
|
+
log14.verbose("invitation flow lock released", void 0, {
|
|
5037
5042
|
F: __dxlog_file17,
|
|
5038
5043
|
L: 131,
|
|
5039
5044
|
S: this,
|
|
@@ -5132,7 +5137,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5132
5137
|
authMethod: Invitation5.AuthMethod.NONE
|
|
5133
5138
|
};
|
|
5134
5139
|
}
|
|
5135
|
-
log15("guest introduced themselves", {
|
|
5140
|
+
log15.verbose("guest introduced themselves", {
|
|
5136
5141
|
guestProfile: profile
|
|
5137
5142
|
}, {
|
|
5138
5143
|
F: __dxlog_file18,
|
|
@@ -5167,7 +5172,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5167
5172
|
C: (f, a) => f(...a)
|
|
5168
5173
|
});
|
|
5169
5174
|
const invitation = this._requireActiveInvitation();
|
|
5170
|
-
log15("received authentication request", {
|
|
5175
|
+
log15.verbose("received authentication request", {
|
|
5171
5176
|
authCode: code
|
|
5172
5177
|
}, {
|
|
5173
5178
|
F: __dxlog_file18,
|
|
@@ -5295,41 +5300,39 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5295
5300
|
async onOpen(context) {
|
|
5296
5301
|
await super.onOpen(context);
|
|
5297
5302
|
try {
|
|
5298
|
-
log15("host acquire lock", void 0, {
|
|
5303
|
+
log15.verbose("host acquire lock", void 0, {
|
|
5299
5304
|
F: __dxlog_file18,
|
|
5300
5305
|
L: 239,
|
|
5301
5306
|
S: this,
|
|
5302
5307
|
C: (f, a) => f(...a)
|
|
5303
5308
|
});
|
|
5304
5309
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
5305
|
-
log15("host lock acquired", void 0, {
|
|
5310
|
+
log15.verbose("host lock acquired", void 0, {
|
|
5306
5311
|
F: __dxlog_file18,
|
|
5307
5312
|
L: 241,
|
|
5308
5313
|
S: this,
|
|
5309
5314
|
C: (f, a) => f(...a)
|
|
5310
5315
|
});
|
|
5311
|
-
const lastState = this._requireActiveInvitation().state;
|
|
5312
5316
|
this._callbacks.onStateUpdate(Invitation5.State.CONNECTING);
|
|
5313
5317
|
await this.rpc.InvitationHostService.options({
|
|
5314
5318
|
role: InvitationOptions2.Role.HOST
|
|
5315
5319
|
});
|
|
5316
|
-
log15("options sent", void 0, {
|
|
5320
|
+
log15.verbose("options sent", void 0, {
|
|
5317
5321
|
F: __dxlog_file18,
|
|
5318
|
-
L:
|
|
5322
|
+
L: 244,
|
|
5319
5323
|
S: this,
|
|
5320
5324
|
C: (f, a) => f(...a)
|
|
5321
5325
|
});
|
|
5322
5326
|
await cancelWithContext5(this._ctx, this._remoteOptionsTrigger.wait({
|
|
5323
5327
|
timeout: OPTIONS_TIMEOUT2
|
|
5324
5328
|
}));
|
|
5325
|
-
log15("options received", void 0, {
|
|
5329
|
+
log15.verbose("options received", void 0, {
|
|
5326
5330
|
F: __dxlog_file18,
|
|
5327
|
-
L:
|
|
5331
|
+
L: 246,
|
|
5328
5332
|
S: this,
|
|
5329
5333
|
C: (f, a) => f(...a)
|
|
5330
5334
|
});
|
|
5331
5335
|
if (this._remoteOptions?.role !== InvitationOptions2.Role.GUEST) {
|
|
5332
|
-
this._callbacks.onStateUpdate(lastState);
|
|
5333
5336
|
throw new InvalidInvitationExtensionRoleError2(void 0, {
|
|
5334
5337
|
expected: InvitationOptions2.Role.GUEST,
|
|
5335
5338
|
remoteOptions: this._remoteOptions,
|
|
@@ -5376,9 +5379,9 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
5376
5379
|
if (this._invitationFlowLock != null) {
|
|
5377
5380
|
this._invitationFlowLock?.release();
|
|
5378
5381
|
this._invitationFlowLock = null;
|
|
5379
|
-
log15("invitation flow lock released", void 0, {
|
|
5382
|
+
log15.verbose("invitation flow lock released", void 0, {
|
|
5380
5383
|
F: __dxlog_file18,
|
|
5381
|
-
L:
|
|
5384
|
+
L: 299,
|
|
5382
5385
|
S: this,
|
|
5383
5386
|
C: (f, a) => f(...a)
|
|
5384
5387
|
});
|
|
@@ -5586,7 +5589,7 @@ var InvitationsHandler = class {
|
|
|
5586
5589
|
S: this,
|
|
5587
5590
|
C: (f, a) => f(...a)
|
|
5588
5591
|
});
|
|
5589
|
-
metrics.increment("dxos.invitation.
|
|
5592
|
+
metrics.increment("dxos.invitation.host");
|
|
5590
5593
|
const guardedState = createGuardedInvitationState(ctx, invitation, stream);
|
|
5591
5594
|
const createExtension = () => {
|
|
5592
5595
|
const extension = new InvitationHostExtension(guardedState.mutex, {
|
|
@@ -5594,7 +5597,9 @@ var InvitationsHandler = class {
|
|
|
5594
5597
|
return ctx.disposed ? null : guardedState.current;
|
|
5595
5598
|
},
|
|
5596
5599
|
onStateUpdate: (newState) => {
|
|
5597
|
-
|
|
5600
|
+
if (newState !== Invitation7.State.ERROR && newState !== Invitation7.State.TIMEOUT) {
|
|
5601
|
+
guardedState.set(extension, newState);
|
|
5602
|
+
}
|
|
5598
5603
|
return guardedState.current;
|
|
5599
5604
|
},
|
|
5600
5605
|
admit: async (admissionRequest) => {
|
|
@@ -5604,14 +5609,14 @@ var InvitationsHandler = class {
|
|
|
5604
5609
|
...protocol.toJSON()
|
|
5605
5610
|
}, {
|
|
5606
5611
|
F: __dxlog_file21,
|
|
5607
|
-
L:
|
|
5612
|
+
L: 107,
|
|
5608
5613
|
S: this,
|
|
5609
5614
|
C: (f, a) => f(...a)
|
|
5610
5615
|
});
|
|
5611
5616
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
5612
5617
|
invariant15(deviceKey, void 0, {
|
|
5613
5618
|
F: __dxlog_file21,
|
|
5614
|
-
L:
|
|
5619
|
+
L: 112,
|
|
5615
5620
|
S: this,
|
|
5616
5621
|
A: [
|
|
5617
5622
|
"deviceKey",
|
|
@@ -5630,7 +5635,7 @@ var InvitationsHandler = class {
|
|
|
5630
5635
|
let admitted = false;
|
|
5631
5636
|
connectionCtx.onDispose(() => {
|
|
5632
5637
|
if (!admitted) {
|
|
5633
|
-
guardedState.
|
|
5638
|
+
guardedState.set(extension, Invitation7.State.CONNECTING);
|
|
5634
5639
|
}
|
|
5635
5640
|
});
|
|
5636
5641
|
scheduleTask7(connectionCtx, async () => {
|
|
@@ -5640,27 +5645,27 @@ var InvitationsHandler = class {
|
|
|
5640
5645
|
id: traceId
|
|
5641
5646
|
}), {
|
|
5642
5647
|
F: __dxlog_file21,
|
|
5643
|
-
L:
|
|
5648
|
+
L: 137,
|
|
5644
5649
|
S: this,
|
|
5645
5650
|
C: (f, a) => f(...a)
|
|
5646
5651
|
});
|
|
5647
|
-
log18("connected", {
|
|
5652
|
+
log18.verbose("connected", {
|
|
5648
5653
|
...protocol.toJSON()
|
|
5649
5654
|
}, {
|
|
5650
5655
|
F: __dxlog_file21,
|
|
5651
|
-
L:
|
|
5656
|
+
L: 138,
|
|
5652
5657
|
S: this,
|
|
5653
5658
|
C: (f, a) => f(...a)
|
|
5654
5659
|
});
|
|
5655
5660
|
const deviceKey = await extension.completedTrigger.wait({
|
|
5656
5661
|
timeout: invitation.timeout
|
|
5657
5662
|
});
|
|
5658
|
-
log18("admitted guest", {
|
|
5663
|
+
log18.verbose("admitted guest", {
|
|
5659
5664
|
guest: deviceKey,
|
|
5660
5665
|
...protocol.toJSON()
|
|
5661
5666
|
}, {
|
|
5662
5667
|
F: __dxlog_file21,
|
|
5663
|
-
L:
|
|
5668
|
+
L: 140,
|
|
5664
5669
|
S: this,
|
|
5665
5670
|
C: (f, a) => f(...a)
|
|
5666
5671
|
});
|
|
@@ -5670,7 +5675,7 @@ var InvitationsHandler = class {
|
|
|
5670
5675
|
id: traceId
|
|
5671
5676
|
}), {
|
|
5672
5677
|
F: __dxlog_file21,
|
|
5673
|
-
L:
|
|
5678
|
+
L: 143,
|
|
5674
5679
|
S: this,
|
|
5675
5680
|
C: (f, a) => f(...a)
|
|
5676
5681
|
});
|
|
@@ -5679,24 +5684,25 @@ var InvitationsHandler = class {
|
|
|
5679
5684
|
await ctx.dispose();
|
|
5680
5685
|
}
|
|
5681
5686
|
} catch (err) {
|
|
5687
|
+
const stateChanged = guardedState.set(extension, Invitation7.State.CONNECTING);
|
|
5682
5688
|
if (err instanceof TimeoutError2) {
|
|
5683
|
-
if (
|
|
5689
|
+
if (stateChanged) {
|
|
5684
5690
|
metrics.increment("dxos.invitation.timeout");
|
|
5685
|
-
log18("timeout", {
|
|
5691
|
+
log18.verbose("timeout", {
|
|
5686
5692
|
...protocol.toJSON()
|
|
5687
5693
|
}, {
|
|
5688
5694
|
F: __dxlog_file21,
|
|
5689
|
-
L:
|
|
5695
|
+
L: 154,
|
|
5690
5696
|
S: this,
|
|
5691
5697
|
C: (f, a) => f(...a)
|
|
5692
5698
|
});
|
|
5693
5699
|
}
|
|
5694
5700
|
} else {
|
|
5695
|
-
if (
|
|
5701
|
+
if (stateChanged) {
|
|
5696
5702
|
metrics.increment("dxos.invitation.failed");
|
|
5697
5703
|
log18.error("failed", err, {
|
|
5698
5704
|
F: __dxlog_file21,
|
|
5699
|
-
L:
|
|
5705
|
+
L: 159,
|
|
5700
5706
|
S: this,
|
|
5701
5707
|
C: (f, a) => f(...a)
|
|
5702
5708
|
});
|
|
@@ -5707,7 +5713,7 @@ var InvitationsHandler = class {
|
|
|
5707
5713
|
error: err
|
|
5708
5714
|
}), {
|
|
5709
5715
|
F: __dxlog_file21,
|
|
5710
|
-
L:
|
|
5716
|
+
L: 162,
|
|
5711
5717
|
S: this,
|
|
5712
5718
|
C: (f, a) => f(...a)
|
|
5713
5719
|
});
|
|
@@ -5716,35 +5722,36 @@ var InvitationsHandler = class {
|
|
|
5716
5722
|
});
|
|
5717
5723
|
},
|
|
5718
5724
|
onError: (err) => {
|
|
5725
|
+
const stateChanged = guardedState.set(extension, Invitation7.State.CONNECTING);
|
|
5719
5726
|
if (err instanceof InvalidInvitationExtensionRoleError3) {
|
|
5720
5727
|
log18("invalid role", {
|
|
5721
5728
|
...err.context
|
|
5722
5729
|
}, {
|
|
5723
5730
|
F: __dxlog_file21,
|
|
5724
|
-
L:
|
|
5731
|
+
L: 171,
|
|
5725
5732
|
S: this,
|
|
5726
5733
|
C: (f, a) => f(...a)
|
|
5727
5734
|
});
|
|
5728
5735
|
return;
|
|
5729
5736
|
}
|
|
5730
5737
|
if (err instanceof TimeoutError2) {
|
|
5731
|
-
if (
|
|
5738
|
+
if (stateChanged) {
|
|
5732
5739
|
metrics.increment("dxos.invitation.timeout");
|
|
5733
|
-
log18("timeout", {
|
|
5740
|
+
log18.verbose("timeout", {
|
|
5734
5741
|
err
|
|
5735
5742
|
}, {
|
|
5736
5743
|
F: __dxlog_file21,
|
|
5737
|
-
L:
|
|
5744
|
+
L: 177,
|
|
5738
5745
|
S: this,
|
|
5739
5746
|
C: (f, a) => f(...a)
|
|
5740
5747
|
});
|
|
5741
5748
|
}
|
|
5742
5749
|
} else {
|
|
5743
|
-
if (
|
|
5750
|
+
if (stateChanged) {
|
|
5744
5751
|
metrics.increment("dxos.invitation.failed");
|
|
5745
5752
|
log18.error("failed", err, {
|
|
5746
5753
|
F: __dxlog_file21,
|
|
5747
|
-
L:
|
|
5754
|
+
L: 182,
|
|
5748
5755
|
S: this,
|
|
5749
5756
|
C: (f, a) => f(...a)
|
|
5750
5757
|
});
|
|
@@ -5758,18 +5765,25 @@ var InvitationsHandler = class {
|
|
|
5758
5765
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
5759
5766
|
log18.warn("invitation has already expired", void 0, {
|
|
5760
5767
|
F: __dxlog_file21,
|
|
5761
|
-
L:
|
|
5768
|
+
L: 193,
|
|
5762
5769
|
S: this,
|
|
5763
5770
|
C: (f, a) => f(...a)
|
|
5764
5771
|
});
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
}
|
|
5772
|
+
guardedState.set(null, Invitation7.State.EXPIRED);
|
|
5773
|
+
void ctx.dispose().catch((err) => log18.catch(err, void 0, {
|
|
5774
|
+
F: __dxlog_file21,
|
|
5775
|
+
L: 195,
|
|
5776
|
+
S: this,
|
|
5777
|
+
C: (f, a) => f(...a)
|
|
5778
|
+
}));
|
|
5779
|
+
return;
|
|
5772
5780
|
}
|
|
5781
|
+
scheduleTask7(ctx, async () => {
|
|
5782
|
+
await swarmConnection.close();
|
|
5783
|
+
guardedState.set(null, Invitation7.State.EXPIRED);
|
|
5784
|
+
metrics.increment("dxos.invitation.expired");
|
|
5785
|
+
await ctx.dispose();
|
|
5786
|
+
}, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
|
|
5773
5787
|
}
|
|
5774
5788
|
let swarmConnection;
|
|
5775
5789
|
scheduleTask7(ctx, async () => {
|
|
@@ -5785,7 +5799,7 @@ var InvitationsHandler = class {
|
|
|
5785
5799
|
type: invitation.type
|
|
5786
5800
|
}, {
|
|
5787
5801
|
F: __dxlog_file21,
|
|
5788
|
-
L:
|
|
5802
|
+
L: 226,
|
|
5789
5803
|
S: this,
|
|
5790
5804
|
C: (f, a) => f(...a)
|
|
5791
5805
|
});
|
|
@@ -5793,7 +5807,7 @@ var InvitationsHandler = class {
|
|
|
5793
5807
|
if (deviceProfile) {
|
|
5794
5808
|
invariant15(invitation.kind === Invitation7.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
5795
5809
|
F: __dxlog_file21,
|
|
5796
|
-
L:
|
|
5810
|
+
L: 235,
|
|
5797
5811
|
S: this,
|
|
5798
5812
|
A: [
|
|
5799
5813
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -5811,7 +5825,7 @@ var InvitationsHandler = class {
|
|
|
5811
5825
|
triedPeers: triedPeersIds.size
|
|
5812
5826
|
}, {
|
|
5813
5827
|
F: __dxlog_file21,
|
|
5814
|
-
L:
|
|
5828
|
+
L: 243,
|
|
5815
5829
|
S: this,
|
|
5816
5830
|
C: (f, a) => f(...a)
|
|
5817
5831
|
});
|
|
@@ -5833,12 +5847,12 @@ var InvitationsHandler = class {
|
|
|
5833
5847
|
return;
|
|
5834
5848
|
}
|
|
5835
5849
|
connectionCtx.onDispose(async () => {
|
|
5836
|
-
log18("extension disposed", {
|
|
5850
|
+
log18.verbose("extension disposed", {
|
|
5837
5851
|
admitted,
|
|
5838
5852
|
currentState: guardedState.current.state
|
|
5839
5853
|
}, {
|
|
5840
5854
|
F: __dxlog_file21,
|
|
5841
|
-
L:
|
|
5855
|
+
L: 271,
|
|
5842
5856
|
S: this,
|
|
5843
5857
|
C: (f, a) => f(...a)
|
|
5844
5858
|
});
|
|
@@ -5856,7 +5870,7 @@ var InvitationsHandler = class {
|
|
|
5856
5870
|
id: traceId
|
|
5857
5871
|
}), {
|
|
5858
5872
|
F: __dxlog_file21,
|
|
5859
|
-
L:
|
|
5873
|
+
L: 283,
|
|
5860
5874
|
S: this,
|
|
5861
5875
|
C: (f, a) => f(...a)
|
|
5862
5876
|
});
|
|
@@ -5868,7 +5882,7 @@ var InvitationsHandler = class {
|
|
|
5868
5882
|
...protocol.toJSON()
|
|
5869
5883
|
}, {
|
|
5870
5884
|
F: __dxlog_file21,
|
|
5871
|
-
L:
|
|
5885
|
+
L: 294,
|
|
5872
5886
|
S: this,
|
|
5873
5887
|
C: (f, a) => f(...a)
|
|
5874
5888
|
});
|
|
@@ -5878,7 +5892,7 @@ var InvitationsHandler = class {
|
|
|
5878
5892
|
...protocol.toJSON()
|
|
5879
5893
|
}, {
|
|
5880
5894
|
F: __dxlog_file21,
|
|
5881
|
-
L:
|
|
5895
|
+
L: 298,
|
|
5882
5896
|
S: this,
|
|
5883
5897
|
C: (f, a) => f(...a)
|
|
5884
5898
|
});
|
|
@@ -5892,7 +5906,7 @@ var InvitationsHandler = class {
|
|
|
5892
5906
|
authMethod: introductionResponse.authMethod
|
|
5893
5907
|
}, {
|
|
5894
5908
|
F: __dxlog_file21,
|
|
5895
|
-
L:
|
|
5909
|
+
L: 306,
|
|
5896
5910
|
S: this,
|
|
5897
5911
|
C: (f, a) => f(...a)
|
|
5898
5912
|
});
|
|
@@ -5914,7 +5928,7 @@ var InvitationsHandler = class {
|
|
|
5914
5928
|
...protocol.toJSON()
|
|
5915
5929
|
}, {
|
|
5916
5930
|
F: __dxlog_file21,
|
|
5917
|
-
L:
|
|
5931
|
+
L: 336,
|
|
5918
5932
|
S: this,
|
|
5919
5933
|
C: (f, a) => f(...a)
|
|
5920
5934
|
});
|
|
@@ -5927,7 +5941,7 @@ var InvitationsHandler = class {
|
|
|
5927
5941
|
...protocol.toJSON()
|
|
5928
5942
|
}, {
|
|
5929
5943
|
F: __dxlog_file21,
|
|
5930
|
-
L:
|
|
5944
|
+
L: 350,
|
|
5931
5945
|
S: this,
|
|
5932
5946
|
C: (f, a) => f(...a)
|
|
5933
5947
|
});
|
|
@@ -5940,25 +5954,25 @@ var InvitationsHandler = class {
|
|
|
5940
5954
|
id: traceId
|
|
5941
5955
|
}), {
|
|
5942
5956
|
F: __dxlog_file21,
|
|
5943
|
-
L:
|
|
5957
|
+
L: 359,
|
|
5944
5958
|
S: this,
|
|
5945
5959
|
C: (f, a) => f(...a)
|
|
5946
5960
|
});
|
|
5947
5961
|
} catch (err) {
|
|
5948
5962
|
if (err instanceof TimeoutError2) {
|
|
5949
|
-
log18("timeout", {
|
|
5963
|
+
log18.verbose("timeout", {
|
|
5950
5964
|
...protocol.toJSON()
|
|
5951
5965
|
}, {
|
|
5952
5966
|
F: __dxlog_file21,
|
|
5953
|
-
L:
|
|
5967
|
+
L: 362,
|
|
5954
5968
|
S: this,
|
|
5955
5969
|
C: (f, a) => f(...a)
|
|
5956
5970
|
});
|
|
5957
5971
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
5958
5972
|
} else {
|
|
5959
|
-
log18("auth failed", err, {
|
|
5973
|
+
log18.verbose("auth failed", err, {
|
|
5960
5974
|
F: __dxlog_file21,
|
|
5961
|
-
L:
|
|
5975
|
+
L: 365,
|
|
5962
5976
|
S: this,
|
|
5963
5977
|
C: (f, a) => f(...a)
|
|
5964
5978
|
});
|
|
@@ -5970,7 +5984,7 @@ var InvitationsHandler = class {
|
|
|
5970
5984
|
error: err
|
|
5971
5985
|
}), {
|
|
5972
5986
|
F: __dxlog_file21,
|
|
5973
|
-
L:
|
|
5987
|
+
L: 369,
|
|
5974
5988
|
S: this,
|
|
5975
5989
|
C: (f, a) => f(...a)
|
|
5976
5990
|
});
|
|
@@ -5982,19 +5996,19 @@ var InvitationsHandler = class {
|
|
|
5982
5996
|
return;
|
|
5983
5997
|
}
|
|
5984
5998
|
if (err instanceof TimeoutError2) {
|
|
5985
|
-
log18("timeout", {
|
|
5999
|
+
log18.verbose("timeout", {
|
|
5986
6000
|
...protocol.toJSON()
|
|
5987
6001
|
}, {
|
|
5988
6002
|
F: __dxlog_file21,
|
|
5989
|
-
L:
|
|
6003
|
+
L: 378,
|
|
5990
6004
|
S: this,
|
|
5991
6005
|
C: (f, a) => f(...a)
|
|
5992
6006
|
});
|
|
5993
6007
|
guardedState.set(extension, Invitation7.State.TIMEOUT);
|
|
5994
6008
|
} else {
|
|
5995
|
-
log18("auth failed", err, {
|
|
6009
|
+
log18.verbose("auth failed", err, {
|
|
5996
6010
|
F: __dxlog_file21,
|
|
5997
|
-
L:
|
|
6011
|
+
L: 381,
|
|
5998
6012
|
S: this,
|
|
5999
6013
|
C: (f, a) => f(...a)
|
|
6000
6014
|
});
|
|
@@ -6011,7 +6025,7 @@ var InvitationsHandler = class {
|
|
|
6011
6025
|
...protocol.toJSON()
|
|
6012
6026
|
}, {
|
|
6013
6027
|
F: __dxlog_file21,
|
|
6014
|
-
L:
|
|
6028
|
+
L: 393,
|
|
6015
6029
|
S: this,
|
|
6016
6030
|
C: (f, a) => f(...a)
|
|
6017
6031
|
});
|
|
@@ -6031,7 +6045,7 @@ var InvitationsHandler = class {
|
|
|
6031
6045
|
} else {
|
|
6032
6046
|
invariant15(invitation.swarmKey, void 0, {
|
|
6033
6047
|
F: __dxlog_file21,
|
|
6034
|
-
L:
|
|
6048
|
+
L: 405,
|
|
6035
6049
|
S: this,
|
|
6036
6050
|
A: [
|
|
6037
6051
|
"invitation.swarmKey",
|
|
@@ -6075,7 +6089,7 @@ var InvitationsHandler = class {
|
|
|
6075
6089
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
6076
6090
|
log18("guest waiting for authentication code...", void 0, {
|
|
6077
6091
|
F: __dxlog_file21,
|
|
6078
|
-
L:
|
|
6092
|
+
L: 457,
|
|
6079
6093
|
S: this,
|
|
6080
6094
|
C: (f, a) => f(...a)
|
|
6081
6095
|
});
|
|
@@ -6083,7 +6097,7 @@ var InvitationsHandler = class {
|
|
|
6083
6097
|
const authCode = await authenticated.wait(options);
|
|
6084
6098
|
log18("sending authentication request", void 0, {
|
|
6085
6099
|
F: __dxlog_file21,
|
|
6086
|
-
L:
|
|
6100
|
+
L: 461,
|
|
6087
6101
|
S: this,
|
|
6088
6102
|
C: (f, a) => f(...a)
|
|
6089
6103
|
});
|
|
@@ -6102,7 +6116,7 @@ var InvitationsHandler = class {
|
|
|
6102
6116
|
attempt
|
|
6103
6117
|
}, {
|
|
6104
6118
|
F: __dxlog_file21,
|
|
6105
|
-
L:
|
|
6119
|
+
L: 472,
|
|
6106
6120
|
S: this,
|
|
6107
6121
|
C: (f, a) => f(...a)
|
|
6108
6122
|
});
|
|
@@ -6120,7 +6134,7 @@ var InvitationsHandler = class {
|
|
|
6120
6134
|
}
|
|
6121
6135
|
log18("sending authentication request", void 0, {
|
|
6122
6136
|
F: __dxlog_file21,
|
|
6123
|
-
L:
|
|
6137
|
+
L: 491,
|
|
6124
6138
|
S: this,
|
|
6125
6139
|
C: (f, a) => f(...a)
|
|
6126
6140
|
});
|
|
@@ -6144,6 +6158,7 @@ var createAdmissionKeypair = () => {
|
|
|
6144
6158
|
// packages/sdk/client-services/src/packlets/invitations/invitations-service.ts
|
|
6145
6159
|
import { Stream as Stream9 } from "@dxos/codec-protobuf";
|
|
6146
6160
|
import { QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
6161
|
+
import { trace as trace8 } from "@dxos/tracing";
|
|
6147
6162
|
var InvitationsServiceImpl = class {
|
|
6148
6163
|
constructor(_invitationsManager) {
|
|
6149
6164
|
this._invitationsManager = _invitationsManager;
|
|
@@ -6154,7 +6169,10 @@ var InvitationsServiceImpl = class {
|
|
|
6154
6169
|
}
|
|
6155
6170
|
createInvitation(options) {
|
|
6156
6171
|
return new Stream9(({ next, close }) => {
|
|
6157
|
-
void this._invitationsManager.createInvitation(options).then((invitation) =>
|
|
6172
|
+
void this._invitationsManager.createInvitation(options).then((invitation) => {
|
|
6173
|
+
trace8.metrics.increment("dxos.invitation.created");
|
|
6174
|
+
invitation.subscribe(next, close, close);
|
|
6175
|
+
}).catch(close);
|
|
6158
6176
|
});
|
|
6159
6177
|
}
|
|
6160
6178
|
acceptInvitation(request) {
|
|
@@ -6732,8 +6750,8 @@ var InvitationsManager = class {
|
|
|
6732
6750
|
this._persistentInvitationsLoadedEvent.once(ctx, () => callback());
|
|
6733
6751
|
}
|
|
6734
6752
|
}
|
|
6735
|
-
_createInvitation(protocol,
|
|
6736
|
-
const { invitationId = PublicKey12.random().toHex(), type = Invitation9.Type.INTERACTIVE, authMethod = Invitation9.AuthMethod.SHARED_SECRET, state = Invitation9.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey12.random(), persistent =
|
|
6753
|
+
_createInvitation(protocol, _options) {
|
|
6754
|
+
const { invitationId = PublicKey12.random().toHex(), type = Invitation9.Type.INTERACTIVE, authMethod = Invitation9.AuthMethod.SHARED_SECRET, state = Invitation9.State.INIT, timeout = INVITATION_TIMEOUT2, swarmKey = PublicKey12.random(), persistent = _options?.authMethod !== Invitation9.AuthMethod.KNOWN_PUBLIC_KEY, created = /* @__PURE__ */ new Date(), guestKeypair = void 0, role = SpaceMember7.Role.ADMIN, lifetime = 86400, multiUse = false, ...options } = _options ?? {};
|
|
6737
6755
|
const authCode = options?.authCode ?? (authMethod === Invitation9.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
6738
6756
|
return {
|
|
6739
6757
|
invitationId,
|
|
@@ -6750,6 +6768,7 @@ var InvitationsManager = class {
|
|
|
6750
6768
|
role,
|
|
6751
6769
|
multiUse,
|
|
6752
6770
|
delegationCredentialId: options?.delegationCredentialId,
|
|
6771
|
+
...options,
|
|
6753
6772
|
...protocol.getInvitationContext()
|
|
6754
6773
|
};
|
|
6755
6774
|
}
|
|
@@ -6762,14 +6781,14 @@ var InvitationsManager = class {
|
|
|
6762
6781
|
}
|
|
6763
6782
|
}, {
|
|
6764
6783
|
F: __dxlog_file23,
|
|
6765
|
-
L:
|
|
6784
|
+
L: 236
|
|
6766
6785
|
});
|
|
6767
6786
|
ctx.onDispose(() => {
|
|
6768
6787
|
log20("complete", {
|
|
6769
6788
|
...handler.toJSON()
|
|
6770
6789
|
}, {
|
|
6771
6790
|
F: __dxlog_file23,
|
|
6772
|
-
L:
|
|
6791
|
+
L: 243,
|
|
6773
6792
|
S: this,
|
|
6774
6793
|
C: (f, a) => f(...a)
|
|
6775
6794
|
});
|
|
@@ -6802,7 +6821,7 @@ var InvitationsManager = class {
|
|
|
6802
6821
|
...handler.toJSON()
|
|
6803
6822
|
}, {
|
|
6804
6823
|
F: __dxlog_file23,
|
|
6805
|
-
L:
|
|
6824
|
+
L: 263,
|
|
6806
6825
|
S: this,
|
|
6807
6826
|
C: (f, a) => f(...a)
|
|
6808
6827
|
});
|
|
@@ -6813,7 +6832,7 @@ var InvitationsManager = class {
|
|
|
6813
6832
|
} else {
|
|
6814
6833
|
log20.warn("auth failed", err, {
|
|
6815
6834
|
F: __dxlog_file23,
|
|
6816
|
-
L:
|
|
6835
|
+
L: 266,
|
|
6817
6836
|
S: this,
|
|
6818
6837
|
C: (f, a) => f(...a)
|
|
6819
6838
|
});
|
|
@@ -6826,14 +6845,14 @@ var InvitationsManager = class {
|
|
|
6826
6845
|
}
|
|
6827
6846
|
}, {
|
|
6828
6847
|
F: __dxlog_file23,
|
|
6829
|
-
L:
|
|
6848
|
+
L: 260
|
|
6830
6849
|
});
|
|
6831
6850
|
ctx.onDispose(() => {
|
|
6832
6851
|
log20("complete", {
|
|
6833
6852
|
...handler.toJSON()
|
|
6834
6853
|
}, {
|
|
6835
6854
|
F: __dxlog_file23,
|
|
6836
|
-
L:
|
|
6855
|
+
L: 273,
|
|
6837
6856
|
S: this,
|
|
6838
6857
|
C: (f, a) => f(...a)
|
|
6839
6858
|
});
|
|
@@ -6878,7 +6897,7 @@ var InvitationsManager = class {
|
|
|
6878
6897
|
} catch (err) {
|
|
6879
6898
|
log20.catch(err, void 0, {
|
|
6880
6899
|
F: __dxlog_file23,
|
|
6881
|
-
L:
|
|
6900
|
+
L: 309,
|
|
6882
6901
|
S: this,
|
|
6883
6902
|
C: (f, a) => f(...a)
|
|
6884
6903
|
});
|
|
@@ -6950,7 +6969,7 @@ var isLocked = (lockPath) => LockFile.isLocked(lockPath);
|
|
|
6950
6969
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
6951
6970
|
import { raise as raise2 } from "@dxos/debug";
|
|
6952
6971
|
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
6953
|
-
import { MapCounter, trace as
|
|
6972
|
+
import { MapCounter, trace as trace9 } from "@dxos/tracing";
|
|
6954
6973
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
6955
6974
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6956
6975
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -7014,13 +7033,13 @@ var ClientRpcServer = class {
|
|
|
7014
7033
|
}
|
|
7015
7034
|
};
|
|
7016
7035
|
_ts_decorate8([
|
|
7017
|
-
|
|
7036
|
+
trace9.metricsCounter()
|
|
7018
7037
|
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
7019
7038
|
_ts_decorate8([
|
|
7020
|
-
|
|
7039
|
+
trace9.info()
|
|
7021
7040
|
], ClientRpcServer.prototype, "_services", null);
|
|
7022
7041
|
ClientRpcServer = _ts_decorate8([
|
|
7023
|
-
|
|
7042
|
+
trace9.resource()
|
|
7024
7043
|
], ClientRpcServer);
|
|
7025
7044
|
|
|
7026
7045
|
// packages/sdk/client-services/src/packlets/agents/edge-agent-manager.ts
|
|
@@ -7295,7 +7314,7 @@ import { invariant as invariant21 } from "@dxos/invariant";
|
|
|
7295
7314
|
import { Keyring } from "@dxos/keyring";
|
|
7296
7315
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
7297
7316
|
import { log as log24 } from "@dxos/log";
|
|
7298
|
-
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as
|
|
7317
|
+
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace10 } from "@dxos/protocols";
|
|
7299
7318
|
import { Invitation as Invitation10 } from "@dxos/protocols/proto/dxos/client/services";
|
|
7300
7319
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
7301
7320
|
import { trace as Trace3 } from "@dxos/tracing";
|
|
@@ -7553,7 +7572,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7553
7572
|
S: this,
|
|
7554
7573
|
C: (f, a) => f(...a)
|
|
7555
7574
|
});
|
|
7556
|
-
log24.trace("dxos.sdk.service-context.open",
|
|
7575
|
+
log24.trace("dxos.sdk.service-context.open", trace10.begin({
|
|
7557
7576
|
id: this._instanceId
|
|
7558
7577
|
}), {
|
|
7559
7578
|
F: __dxlog_file27,
|
|
@@ -7588,7 +7607,7 @@ var ServiceContext = class extends Resource7 {
|
|
|
7588
7607
|
S: this,
|
|
7589
7608
|
C: (f, a) => f(...a)
|
|
7590
7609
|
});
|
|
7591
|
-
log24.trace("dxos.sdk.service-context.open",
|
|
7610
|
+
log24.trace("dxos.sdk.service-context.open", trace10.end({
|
|
7592
7611
|
id: this._instanceId
|
|
7593
7612
|
}), {
|
|
7594
7613
|
F: __dxlog_file27,
|
|
@@ -7808,8 +7827,8 @@ var ServiceContext = class extends Resource7 {
|
|
|
7808
7827
|
S: this,
|
|
7809
7828
|
C: (f, a) => f(...a)
|
|
7810
7829
|
});
|
|
7811
|
-
if (params?.deviceCredential) {
|
|
7812
|
-
edgeIdentity = await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, {
|
|
7830
|
+
if (params?.deviceCredential || Boolean(globalThis?.DEVICE_INVITE_INTEROP)) {
|
|
7831
|
+
edgeIdentity = await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, params?.deviceCredential && {
|
|
7813
7832
|
credential: params.deviceCredential
|
|
7814
7833
|
}, []);
|
|
7815
7834
|
} else {
|
|
@@ -8121,7 +8140,7 @@ import { PublicKey as PublicKey19 } from "@dxos/keys";
|
|
|
8121
8140
|
import { log as log27 } from "@dxos/log";
|
|
8122
8141
|
import { EdgeSignalManager, WebsocketSignalManager } from "@dxos/messaging";
|
|
8123
8142
|
import { SwarmNetworkManager, createIceProvider, createRtcTransportFactory } from "@dxos/network-manager";
|
|
8124
|
-
import { trace as
|
|
8143
|
+
import { trace as trace11 } from "@dxos/protocols";
|
|
8125
8144
|
import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
|
|
8126
8145
|
import { TRACE_PROCESSOR as TRACE_PROCESSOR3, trace as Trace4 } from "@dxos/tracing";
|
|
8127
8146
|
import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
@@ -8133,8 +8152,9 @@ import { invariant as invariant23 } from "@dxos/invariant";
|
|
|
8133
8152
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
8134
8153
|
var __dxlog_file29 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
8135
8154
|
var DevicesServiceImpl = class {
|
|
8136
|
-
constructor(_identityManager) {
|
|
8155
|
+
constructor(_identityManager, _edgeConnection) {
|
|
8137
8156
|
this._identityManager = _identityManager;
|
|
8157
|
+
this._edgeConnection = _edgeConnection;
|
|
8138
8158
|
}
|
|
8139
8159
|
async updateDevice(profile) {
|
|
8140
8160
|
return this._identityManager.updateDeviceProfile(profile);
|
|
@@ -8150,7 +8170,7 @@ var DevicesServiceImpl = class {
|
|
|
8150
8170
|
} else {
|
|
8151
8171
|
invariant23(this._identityManager.identity?.presence, "presence not present", {
|
|
8152
8172
|
F: __dxlog_file29,
|
|
8153
|
-
L:
|
|
8173
|
+
L: 36,
|
|
8154
8174
|
S: this,
|
|
8155
8175
|
A: [
|
|
8156
8176
|
"this._identityManager.identity?.presence",
|
|
@@ -8161,12 +8181,19 @@ var DevicesServiceImpl = class {
|
|
|
8161
8181
|
next({
|
|
8162
8182
|
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => {
|
|
8163
8183
|
const isMe = this._identityManager.identity?.deviceKey.equals(key);
|
|
8164
|
-
|
|
8184
|
+
let presence;
|
|
8185
|
+
if (isMe) {
|
|
8186
|
+
presence = Device2.PresenceState.ONLINE;
|
|
8187
|
+
} else if (profile.os?.toUpperCase() === "EDGE") {
|
|
8188
|
+
presence = this._edgeConnection?.isConnected ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
|
|
8189
|
+
} else {
|
|
8190
|
+
presence = peers.some((peer) => peer.identityKey.equals(key)) ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
|
|
8191
|
+
}
|
|
8165
8192
|
return {
|
|
8166
8193
|
deviceKey: key,
|
|
8167
8194
|
kind: this._identityManager.identity?.deviceKey.equals(key) ? DeviceKind2.CURRENT : DeviceKind2.TRUSTED,
|
|
8168
8195
|
profile,
|
|
8169
|
-
presence
|
|
8196
|
+
presence
|
|
8170
8197
|
};
|
|
8171
8198
|
})
|
|
8172
8199
|
});
|
|
@@ -8690,7 +8717,7 @@ var ClientServicesHost = class {
|
|
|
8690
8717
|
return;
|
|
8691
8718
|
}
|
|
8692
8719
|
const traceId = PublicKey19.random().toHex();
|
|
8693
|
-
log27.trace("dxos.client-services.host.open",
|
|
8720
|
+
log27.trace("dxos.client-services.host.open", trace11.begin({
|
|
8694
8721
|
id: traceId
|
|
8695
8722
|
}), {
|
|
8696
8723
|
F: __dxlog_file30,
|
|
@@ -8764,7 +8791,7 @@ var ClientServicesHost = class {
|
|
|
8764
8791
|
IdentityService: identityService,
|
|
8765
8792
|
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
8766
8793
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
8767
|
-
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
8794
|
+
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager, this._edgeConnection),
|
|
8768
8795
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
8769
8796
|
DataService: this._serviceContext.echoHost.dataService,
|
|
8770
8797
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
@@ -8804,7 +8831,7 @@ var ClientServicesHost = class {
|
|
|
8804
8831
|
S: this,
|
|
8805
8832
|
C: (f, a) => f(...a)
|
|
8806
8833
|
});
|
|
8807
|
-
log27.trace("dxos.client-services.host.open",
|
|
8834
|
+
log27.trace("dxos.client-services.host.open", trace11.end({
|
|
8808
8835
|
id: traceId
|
|
8809
8836
|
}), {
|
|
8810
8837
|
F: __dxlog_file30,
|
|
@@ -8847,7 +8874,7 @@ var ClientServicesHost = class {
|
|
|
8847
8874
|
}
|
|
8848
8875
|
async reset() {
|
|
8849
8876
|
const traceId = PublicKey19.random().toHex();
|
|
8850
|
-
log27.trace("dxos.sdk.client-services-host.reset",
|
|
8877
|
+
log27.trace("dxos.sdk.client-services-host.reset", trace11.begin({
|
|
8851
8878
|
id: traceId
|
|
8852
8879
|
}), {
|
|
8853
8880
|
F: __dxlog_file30,
|
|
@@ -8871,7 +8898,7 @@ var ClientServicesHost = class {
|
|
|
8871
8898
|
S: this,
|
|
8872
8899
|
C: (f, a) => f(...a)
|
|
8873
8900
|
});
|
|
8874
|
-
log27.trace("dxos.sdk.client-services-host.reset",
|
|
8901
|
+
log27.trace("dxos.sdk.client-services-host.reset", trace11.end({
|
|
8875
8902
|
id: traceId
|
|
8876
8903
|
}), {
|
|
8877
8904
|
F: __dxlog_file30,
|
|
@@ -8953,4 +8980,4 @@ export {
|
|
|
8953
8980
|
importProfileData,
|
|
8954
8981
|
ClientServicesHost
|
|
8955
8982
|
};
|
|
8956
|
-
//# sourceMappingURL=chunk-
|
|
8983
|
+
//# sourceMappingURL=chunk-POX3HG6I.mjs.map
|