@dxos/client-services 0.5.9-main.b06c86b → 0.5.9-main.b78d4f4
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-2JCI5YEM.mjs → chunk-SPEYMJJE.mjs} +780 -432
- package/dist/lib/browser/chunk-SPEYMJJE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -2
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +10 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-HRQTR7UW.cjs → chunk-DDCTAJOJ.cjs} +792 -444
- package/dist/lib/node/chunk-DDCTAJOJ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -42
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +17 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +10 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +4 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
- package/src/packlets/services/service-host.ts +12 -4
- package/src/packlets/spaces/data-space-manager.ts +55 -2
- package/src/packlets/spaces/spaces-service.ts +38 -0
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +97 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-2JCI5YEM.mjs.map +0 -7
- package/dist/lib/node/chunk-HRQTR7UW.cjs.map +0 -7
|
@@ -85,6 +85,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
85
85
|
import { Stream as Stream2 } from "@dxos/codec-protobuf";
|
|
86
86
|
import { Context } from "@dxos/context";
|
|
87
87
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
88
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
88
89
|
var subscribeToNetworkStatus = ({ signalManager }) => new Stream2(({ next, close }) => {
|
|
89
90
|
const update = () => {
|
|
90
91
|
try {
|
|
@@ -100,7 +101,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new Stream2(({ next, close
|
|
|
100
101
|
update();
|
|
101
102
|
});
|
|
102
103
|
var subscribeToSignal = ({ signalManager }) => new Stream2(({ next }) => {
|
|
103
|
-
const ctx = new Context(
|
|
104
|
+
const ctx = new Context(void 0, {
|
|
105
|
+
F: __dxlog_file,
|
|
106
|
+
L: 36
|
|
107
|
+
});
|
|
104
108
|
signalManager.onMessage.on(ctx, (message) => {
|
|
105
109
|
next({
|
|
106
110
|
message: {
|
|
@@ -355,7 +359,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
355
359
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
356
360
|
|
|
357
361
|
// packages/sdk/client-services/src/version.ts
|
|
358
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
362
|
+
var DXOS_VERSION = "0.5.9-main.b78d4f4";
|
|
359
363
|
|
|
360
364
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
361
365
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -388,7 +392,7 @@ var getPlatform = () => {
|
|
|
388
392
|
};
|
|
389
393
|
|
|
390
394
|
// packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
|
|
391
|
-
var
|
|
395
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
392
396
|
var DEFAULT_TIMEOUT = 1e3;
|
|
393
397
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
394
398
|
const diagnostics = {
|
|
@@ -405,7 +409,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
405
409
|
await Promise.all([
|
|
406
410
|
(async () => {
|
|
407
411
|
invariant(clientServices.LoggingService, "SystemService is not available.", {
|
|
408
|
-
F:
|
|
412
|
+
F: __dxlog_file2,
|
|
409
413
|
L: 110,
|
|
410
414
|
S: void 0,
|
|
411
415
|
A: [
|
|
@@ -510,7 +514,7 @@ var getStorageDiagnostics = async () => {
|
|
|
510
514
|
// packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts
|
|
511
515
|
import { Trigger } from "@dxos/async";
|
|
512
516
|
import { log } from "@dxos/log";
|
|
513
|
-
var
|
|
517
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts";
|
|
514
518
|
var CHANNEL_NAME = "dxos.diagnostics.broadcast";
|
|
515
519
|
var MessageType;
|
|
516
520
|
(function(MessageType2) {
|
|
@@ -579,7 +583,7 @@ var createCollectDiagnosticsBroadcastHandler = (systemService) => {
|
|
|
579
583
|
}
|
|
580
584
|
} catch (error) {
|
|
581
585
|
log.catch(error, void 0, {
|
|
582
|
-
F:
|
|
586
|
+
F: __dxlog_file3,
|
|
583
587
|
L: 77,
|
|
584
588
|
S: void 0,
|
|
585
589
|
C: (f, a) => f(...a)
|
|
@@ -687,7 +691,7 @@ import { Context as Context2 } from "@dxos/context";
|
|
|
687
691
|
import { verifyCredential } from "@dxos/credentials";
|
|
688
692
|
import { log as log2 } from "@dxos/log";
|
|
689
693
|
import { schema } from "@dxos/protocols";
|
|
690
|
-
var
|
|
694
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
691
695
|
var Credential = schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
692
696
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
693
697
|
const credential = await signer.createCredential({
|
|
@@ -702,7 +706,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
702
706
|
var TrustedKeySetAuthVerifier = class {
|
|
703
707
|
constructor(_params) {
|
|
704
708
|
this._params = _params;
|
|
705
|
-
this._ctx = new Context2(
|
|
709
|
+
this._ctx = new Context2(void 0, {
|
|
710
|
+
F: __dxlog_file4,
|
|
711
|
+
L: 45
|
|
712
|
+
});
|
|
706
713
|
}
|
|
707
714
|
async close() {
|
|
708
715
|
await this._ctx.dispose();
|
|
@@ -713,7 +720,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
713
720
|
log2("authenticating...", {
|
|
714
721
|
credential
|
|
715
722
|
}, {
|
|
716
|
-
F:
|
|
723
|
+
F: __dxlog_file4,
|
|
717
724
|
L: 56,
|
|
718
725
|
S: this,
|
|
719
726
|
C: (f, a) => f(...a)
|
|
@@ -723,7 +730,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
723
730
|
log2("Invalid credential", {
|
|
724
731
|
result
|
|
725
732
|
}, {
|
|
726
|
-
F:
|
|
733
|
+
F: __dxlog_file4,
|
|
727
734
|
L: 60,
|
|
728
735
|
S: this,
|
|
729
736
|
C: (f, a) => f(...a)
|
|
@@ -735,7 +742,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
735
742
|
nonce,
|
|
736
743
|
credential
|
|
737
744
|
}, {
|
|
738
|
-
F:
|
|
745
|
+
F: __dxlog_file4,
|
|
739
746
|
L: 65,
|
|
740
747
|
S: this,
|
|
741
748
|
C: (f, a) => f(...a)
|
|
@@ -746,7 +753,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
746
753
|
log2("key is not currently in trusted set, waiting...", {
|
|
747
754
|
key: credential.issuer
|
|
748
755
|
}, {
|
|
749
|
-
F:
|
|
756
|
+
F: __dxlog_file4,
|
|
750
757
|
L: 70,
|
|
751
758
|
S: this,
|
|
752
759
|
C: (f, a) => f(...a)
|
|
@@ -762,7 +769,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
762
769
|
log2("auth success", {
|
|
763
770
|
key: credential.issuer
|
|
764
771
|
}, {
|
|
765
|
-
F:
|
|
772
|
+
F: __dxlog_file4,
|
|
766
773
|
L: 81,
|
|
767
774
|
S: this,
|
|
768
775
|
C: (f, a) => f(...a)
|
|
@@ -772,7 +779,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
772
779
|
log2("key is not currently in trusted set, waiting...", {
|
|
773
780
|
key: credential.issuer
|
|
774
781
|
}, {
|
|
775
|
-
F:
|
|
782
|
+
F: __dxlog_file4,
|
|
776
783
|
L: 84,
|
|
777
784
|
S: this,
|
|
778
785
|
C: (f, a) => f(...a)
|
|
@@ -813,7 +820,7 @@ import { ComplexSet } from "@dxos/util";
|
|
|
813
820
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
814
821
|
import { SpaceId } from "@dxos/keys";
|
|
815
822
|
import { log as log3 } from "@dxos/log";
|
|
816
|
-
var
|
|
823
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
817
824
|
var DefaultSpaceStateMachine = class {
|
|
818
825
|
constructor(_params) {
|
|
819
826
|
this._params = _params;
|
|
@@ -830,7 +837,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
830
837
|
expectedIdentity: this._params.identityKey,
|
|
831
838
|
credential
|
|
832
839
|
}, {
|
|
833
|
-
F:
|
|
840
|
+
F: __dxlog_file5,
|
|
834
841
|
L: 32,
|
|
835
842
|
S: this,
|
|
836
843
|
C: (f, a) => f(...a)
|
|
@@ -841,7 +848,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
841
848
|
log3.warn("Invalid default space id", {
|
|
842
849
|
id: assertion.spaceId
|
|
843
850
|
}, {
|
|
844
|
-
F:
|
|
851
|
+
F: __dxlog_file5,
|
|
845
852
|
L: 36,
|
|
846
853
|
S: this,
|
|
847
854
|
C: (f, a) => f(...a)
|
|
@@ -866,7 +873,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
866
873
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
867
874
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
868
875
|
}
|
|
869
|
-
var
|
|
876
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
870
877
|
var Identity = class {
|
|
871
878
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
872
879
|
this.stateUpdate = new Event();
|
|
@@ -878,7 +885,7 @@ var Identity = class {
|
|
|
878
885
|
log4.trace("dxos.halo.device", {
|
|
879
886
|
deviceKey
|
|
880
887
|
}, {
|
|
881
|
-
F:
|
|
888
|
+
F: __dxlog_file6,
|
|
882
889
|
L: 70,
|
|
883
890
|
S: this,
|
|
884
891
|
C: (f, a) => f(...a)
|
|
@@ -957,7 +964,7 @@ var Identity = class {
|
|
|
957
964
|
*/
|
|
958
965
|
getIdentityCredentialSigner() {
|
|
959
966
|
invariant2(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
960
|
-
F:
|
|
967
|
+
F: __dxlog_file6,
|
|
961
968
|
L: 159,
|
|
962
969
|
S: this,
|
|
963
970
|
A: [
|
|
@@ -1001,7 +1008,7 @@ var Identity = class {
|
|
|
1001
1008
|
controlFeedKey,
|
|
1002
1009
|
dataFeedKey
|
|
1003
1010
|
}, {
|
|
1004
|
-
F:
|
|
1011
|
+
F: __dxlog_file6,
|
|
1005
1012
|
L: 184,
|
|
1006
1013
|
S: this,
|
|
1007
1014
|
C: (f, a) => f(...a)
|
|
@@ -1078,7 +1085,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1078
1085
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1079
1086
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1080
1087
|
}
|
|
1081
|
-
var
|
|
1088
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1082
1089
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1083
1090
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1084
1091
|
var IdentityManager = class {
|
|
@@ -1102,7 +1109,7 @@ var IdentityManager = class {
|
|
|
1102
1109
|
log5.trace("dxos.halo.identity-manager.open", trace3.begin({
|
|
1103
1110
|
id: traceId
|
|
1104
1111
|
}), {
|
|
1105
|
-
F:
|
|
1112
|
+
F: __dxlog_file7,
|
|
1106
1113
|
L: 104,
|
|
1107
1114
|
S: this,
|
|
1108
1115
|
C: (f, a) => f(...a)
|
|
@@ -1111,7 +1118,7 @@ var IdentityManager = class {
|
|
|
1111
1118
|
log5("identity record", {
|
|
1112
1119
|
identityRecord
|
|
1113
1120
|
}, {
|
|
1114
|
-
F:
|
|
1121
|
+
F: __dxlog_file7,
|
|
1115
1122
|
L: 107,
|
|
1116
1123
|
S: this,
|
|
1117
1124
|
C: (f, a) => f(...a)
|
|
@@ -1124,7 +1131,7 @@ var IdentityManager = class {
|
|
|
1124
1131
|
identityKey: identityRecord.identityKey,
|
|
1125
1132
|
displayName: this._identity.profileDocument?.displayName
|
|
1126
1133
|
}, {
|
|
1127
|
-
F:
|
|
1134
|
+
F: __dxlog_file7,
|
|
1128
1135
|
L: 112,
|
|
1129
1136
|
S: this,
|
|
1130
1137
|
C: (f, a) => f(...a)
|
|
@@ -1134,18 +1141,21 @@ var IdentityManager = class {
|
|
|
1134
1141
|
log5.trace("dxos.halo.identity-manager.open", trace3.end({
|
|
1135
1142
|
id: traceId
|
|
1136
1143
|
}), {
|
|
1137
|
-
F:
|
|
1144
|
+
F: __dxlog_file7,
|
|
1138
1145
|
L: 119,
|
|
1139
1146
|
S: this,
|
|
1140
1147
|
C: (f, a) => f(...a)
|
|
1141
1148
|
});
|
|
1142
1149
|
}
|
|
1143
1150
|
async close() {
|
|
1144
|
-
await this._identity?.close(new Context3(
|
|
1151
|
+
await this._identity?.close(new Context3(void 0, {
|
|
1152
|
+
F: __dxlog_file7,
|
|
1153
|
+
L: 123
|
|
1154
|
+
}));
|
|
1145
1155
|
}
|
|
1146
1156
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1147
1157
|
invariant3(!this._identity, "Identity already exists.", {
|
|
1148
|
-
F:
|
|
1158
|
+
F: __dxlog_file7,
|
|
1149
1159
|
L: 128,
|
|
1150
1160
|
S: this,
|
|
1151
1161
|
A: [
|
|
@@ -1154,7 +1164,7 @@ var IdentityManager = class {
|
|
|
1154
1164
|
]
|
|
1155
1165
|
});
|
|
1156
1166
|
log5("creating identity...", void 0, {
|
|
1157
|
-
F:
|
|
1167
|
+
F: __dxlog_file7,
|
|
1158
1168
|
L: 129,
|
|
1159
1169
|
S: this,
|
|
1160
1170
|
C: (f, a) => f(...a)
|
|
@@ -1171,11 +1181,14 @@ var IdentityManager = class {
|
|
|
1171
1181
|
}
|
|
1172
1182
|
};
|
|
1173
1183
|
const identity = await this._constructIdentity(identityRecord);
|
|
1174
|
-
await identity.open(new Context3(
|
|
1184
|
+
await identity.open(new Context3(void 0, {
|
|
1185
|
+
F: __dxlog_file7,
|
|
1186
|
+
L: 144
|
|
1187
|
+
}));
|
|
1175
1188
|
{
|
|
1176
1189
|
const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1177
1190
|
invariant3(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1178
|
-
F:
|
|
1191
|
+
F: __dxlog_file7,
|
|
1179
1192
|
L: 148,
|
|
1180
1193
|
S: this,
|
|
1181
1194
|
A: [
|
|
@@ -1184,7 +1197,7 @@ var IdentityManager = class {
|
|
|
1184
1197
|
]
|
|
1185
1198
|
});
|
|
1186
1199
|
invariant3(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1187
|
-
F:
|
|
1200
|
+
F: __dxlog_file7,
|
|
1188
1201
|
L: 149,
|
|
1189
1202
|
S: this,
|
|
1190
1203
|
A: [
|
|
@@ -1223,7 +1236,7 @@ var IdentityManager = class {
|
|
|
1223
1236
|
identityKey: identityRecord.identityKey,
|
|
1224
1237
|
displayName: this._identity.profileDocument?.displayName
|
|
1225
1238
|
}, {
|
|
1226
|
-
F:
|
|
1239
|
+
F: __dxlog_file7,
|
|
1227
1240
|
L: 191,
|
|
1228
1241
|
S: this,
|
|
1229
1242
|
C: (f, a) => f(...a)
|
|
@@ -1234,7 +1247,7 @@ var IdentityManager = class {
|
|
|
1234
1247
|
deviceKey: identity.deviceKey,
|
|
1235
1248
|
profile: identity.profileDocument
|
|
1236
1249
|
}, {
|
|
1237
|
-
F:
|
|
1250
|
+
F: __dxlog_file7,
|
|
1238
1251
|
L: 197,
|
|
1239
1252
|
S: this,
|
|
1240
1253
|
C: (f, a) => f(...a)
|
|
@@ -1271,13 +1284,13 @@ var IdentityManager = class {
|
|
|
1271
1284
|
log5("accepting identity", {
|
|
1272
1285
|
params
|
|
1273
1286
|
}, {
|
|
1274
|
-
F:
|
|
1287
|
+
F: __dxlog_file7,
|
|
1275
1288
|
L: 235,
|
|
1276
1289
|
S: this,
|
|
1277
1290
|
C: (f, a) => f(...a)
|
|
1278
1291
|
});
|
|
1279
1292
|
invariant3(!this._identity, "Identity already exists.", {
|
|
1280
|
-
F:
|
|
1293
|
+
F: __dxlog_file7,
|
|
1281
1294
|
L: 236,
|
|
1282
1295
|
S: this,
|
|
1283
1296
|
A: [
|
|
@@ -1297,7 +1310,10 @@ var IdentityManager = class {
|
|
|
1297
1310
|
}
|
|
1298
1311
|
};
|
|
1299
1312
|
const identity = await this._constructIdentity(identityRecord);
|
|
1300
|
-
await identity.open(new Context3(
|
|
1313
|
+
await identity.open(new Context3(void 0, {
|
|
1314
|
+
F: __dxlog_file7,
|
|
1315
|
+
L: 251
|
|
1316
|
+
}));
|
|
1301
1317
|
this._identity = identity;
|
|
1302
1318
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1303
1319
|
await this._identity.ready();
|
|
@@ -1305,7 +1321,7 @@ var IdentityManager = class {
|
|
|
1305
1321
|
identityKey: identityRecord.identityKey,
|
|
1306
1322
|
displayName: this._identity.profileDocument?.displayName
|
|
1307
1323
|
}, {
|
|
1308
|
-
F:
|
|
1324
|
+
F: __dxlog_file7,
|
|
1309
1325
|
L: 255,
|
|
1310
1326
|
S: this,
|
|
1311
1327
|
C: (f, a) => f(...a)
|
|
@@ -1319,7 +1335,7 @@ var IdentityManager = class {
|
|
|
1319
1335
|
identityKey: identity.identityKey,
|
|
1320
1336
|
deviceKey: identity.deviceKey
|
|
1321
1337
|
}, {
|
|
1322
|
-
F:
|
|
1338
|
+
F: __dxlog_file7,
|
|
1323
1339
|
L: 265,
|
|
1324
1340
|
S: this,
|
|
1325
1341
|
C: (f, a) => f(...a)
|
|
@@ -1331,7 +1347,7 @@ var IdentityManager = class {
|
|
|
1331
1347
|
*/
|
|
1332
1348
|
async updateProfile(profile) {
|
|
1333
1349
|
invariant3(this._identity, "Identity not initialized.", {
|
|
1334
|
-
F:
|
|
1350
|
+
F: __dxlog_file7,
|
|
1335
1351
|
L: 273,
|
|
1336
1352
|
S: this,
|
|
1337
1353
|
A: [
|
|
@@ -1362,7 +1378,7 @@ var IdentityManager = class {
|
|
|
1362
1378
|
}
|
|
1363
1379
|
async updateDeviceProfile(profile) {
|
|
1364
1380
|
invariant3(this._identity, "Identity not initialized.", {
|
|
1365
|
-
F:
|
|
1381
|
+
F: __dxlog_file7,
|
|
1366
1382
|
L: 290,
|
|
1367
1383
|
S: this,
|
|
1368
1384
|
A: [
|
|
@@ -1398,7 +1414,7 @@ var IdentityManager = class {
|
|
|
1398
1414
|
}
|
|
1399
1415
|
async _constructIdentity(identityRecord) {
|
|
1400
1416
|
invariant3(!this._identity, void 0, {
|
|
1401
|
-
F:
|
|
1417
|
+
F: __dxlog_file7,
|
|
1402
1418
|
L: 316,
|
|
1403
1419
|
S: this,
|
|
1404
1420
|
A: [
|
|
@@ -1409,7 +1425,7 @@ var IdentityManager = class {
|
|
|
1409
1425
|
log5("constructing identity", {
|
|
1410
1426
|
identityRecord
|
|
1411
1427
|
}, {
|
|
1412
|
-
F:
|
|
1428
|
+
F: __dxlog_file7,
|
|
1413
1429
|
L: 317,
|
|
1414
1430
|
S: this,
|
|
1415
1431
|
C: (f, a) => f(...a)
|
|
@@ -1424,7 +1440,7 @@ var IdentityManager = class {
|
|
|
1424
1440
|
gossip
|
|
1425
1441
|
});
|
|
1426
1442
|
invariant3(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1427
|
-
F:
|
|
1443
|
+
F: __dxlog_file7,
|
|
1428
1444
|
L: 330,
|
|
1429
1445
|
S: this,
|
|
1430
1446
|
A: [
|
|
@@ -1436,7 +1452,7 @@ var IdentityManager = class {
|
|
|
1436
1452
|
writable: true
|
|
1437
1453
|
});
|
|
1438
1454
|
invariant3(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1439
|
-
F:
|
|
1455
|
+
F: __dxlog_file7,
|
|
1440
1456
|
L: 334,
|
|
1441
1457
|
S: this,
|
|
1442
1458
|
A: [
|
|
@@ -1470,7 +1486,7 @@ var IdentityManager = class {
|
|
|
1470
1486
|
log5("done", {
|
|
1471
1487
|
identityKey: identityRecord.identityKey
|
|
1472
1488
|
}, {
|
|
1473
|
-
F:
|
|
1489
|
+
F: __dxlog_file7,
|
|
1474
1490
|
L: 360,
|
|
1475
1491
|
S: this,
|
|
1476
1492
|
C: (f, a) => f(...a)
|
|
@@ -1495,7 +1511,7 @@ var IdentityManager = class {
|
|
|
1495
1511
|
},
|
|
1496
1512
|
onAuthFailure: () => {
|
|
1497
1513
|
log5.warn("auth failure", void 0, {
|
|
1498
|
-
F:
|
|
1514
|
+
F: __dxlog_file7,
|
|
1499
1515
|
L: 385,
|
|
1500
1516
|
S: this,
|
|
1501
1517
|
C: (f, a) => f(...a)
|
|
@@ -1528,7 +1544,7 @@ import { invariant as invariant4 } from "@dxos/invariant";
|
|
|
1528
1544
|
import { log as log6 } from "@dxos/log";
|
|
1529
1545
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
1530
1546
|
import { safeAwaitAll } from "@dxos/util";
|
|
1531
|
-
var
|
|
1547
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1532
1548
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1533
1549
|
var IdentityServiceImpl = class extends Resource {
|
|
1534
1550
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1558,7 +1574,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1558
1574
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1559
1575
|
const identity = this._identityManager.identity;
|
|
1560
1576
|
invariant4(identity, void 0, {
|
|
1561
|
-
F:
|
|
1577
|
+
F: __dxlog_file8,
|
|
1562
1578
|
L: 59,
|
|
1563
1579
|
S: this,
|
|
1564
1580
|
A: [
|
|
@@ -1592,7 +1608,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1592
1608
|
}
|
|
1593
1609
|
async updateProfile(profile) {
|
|
1594
1610
|
invariant4(this._identityManager.identity, "Identity not initialized.", {
|
|
1595
|
-
F:
|
|
1611
|
+
F: __dxlog_file8,
|
|
1596
1612
|
L: 89,
|
|
1597
1613
|
S: this,
|
|
1598
1614
|
A: [
|
|
@@ -1606,7 +1622,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1606
1622
|
}
|
|
1607
1623
|
async signPresentation({ presentation, nonce }) {
|
|
1608
1624
|
invariant4(this._identityManager.identity, "Identity not initialized.", {
|
|
1609
|
-
F:
|
|
1625
|
+
F: __dxlog_file8,
|
|
1610
1626
|
L: 96,
|
|
1611
1627
|
S: this,
|
|
1612
1628
|
A: [
|
|
@@ -1641,7 +1657,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1641
1657
|
log6.warn("Multiple default spaces found. Using the first one.", {
|
|
1642
1658
|
duplicate: space.id
|
|
1643
1659
|
}, {
|
|
1644
|
-
F:
|
|
1660
|
+
F: __dxlog_file8,
|
|
1645
1661
|
L: 127,
|
|
1646
1662
|
S: this,
|
|
1647
1663
|
C: (f, a) => f(...a)
|
|
@@ -1669,7 +1685,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1669
1685
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1670
1686
|
import { AlreadyJoinedError } from "@dxos/protocols";
|
|
1671
1687
|
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
1672
|
-
var
|
|
1688
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1673
1689
|
var DeviceInvitationProtocol = class {
|
|
1674
1690
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1675
1691
|
this._keyring = _keyring;
|
|
@@ -1695,7 +1711,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1695
1711
|
}
|
|
1696
1712
|
async admit(_, request) {
|
|
1697
1713
|
invariant5(request.device, void 0, {
|
|
1698
|
-
F:
|
|
1714
|
+
F: __dxlog_file9,
|
|
1699
1715
|
L: 50,
|
|
1700
1716
|
S: this,
|
|
1701
1717
|
A: [
|
|
@@ -1741,7 +1757,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1741
1757
|
}
|
|
1742
1758
|
async accept(response, request) {
|
|
1743
1759
|
invariant5(response.device, void 0, {
|
|
1744
|
-
F:
|
|
1760
|
+
F: __dxlog_file9,
|
|
1745
1761
|
L: 95,
|
|
1746
1762
|
S: this,
|
|
1747
1763
|
A: [
|
|
@@ -1751,7 +1767,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1751
1767
|
});
|
|
1752
1768
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1753
1769
|
invariant5(request.device, void 0, {
|
|
1754
|
-
F:
|
|
1770
|
+
F: __dxlog_file9,
|
|
1755
1771
|
L: 98,
|
|
1756
1772
|
S: this,
|
|
1757
1773
|
A: [
|
|
@@ -1820,7 +1836,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1820
1836
|
};
|
|
1821
1837
|
|
|
1822
1838
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
1823
|
-
var
|
|
1839
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1824
1840
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1825
1841
|
var InvitationGuestExtension = class extends RpcExtension {
|
|
1826
1842
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1834,7 +1850,10 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1834
1850
|
});
|
|
1835
1851
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1836
1852
|
this._callbacks = _callbacks;
|
|
1837
|
-
this._ctx = new Context4(
|
|
1853
|
+
this._ctx = new Context4(void 0, {
|
|
1854
|
+
F: __dxlog_file10,
|
|
1855
|
+
L: 33
|
|
1856
|
+
});
|
|
1838
1857
|
this._remoteOptionsTrigger = new Trigger4();
|
|
1839
1858
|
this._invitationFlowLock = null;
|
|
1840
1859
|
}
|
|
@@ -1846,7 +1865,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1846
1865
|
InvitationHostService: {
|
|
1847
1866
|
options: async (options) => {
|
|
1848
1867
|
invariant6(!this._remoteOptions, "Remote options already set.", {
|
|
1849
|
-
F:
|
|
1868
|
+
F: __dxlog_file10,
|
|
1850
1869
|
L: 63,
|
|
1851
1870
|
S: this,
|
|
1852
1871
|
A: [
|
|
@@ -1873,14 +1892,14 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1873
1892
|
await super.onOpen(context);
|
|
1874
1893
|
try {
|
|
1875
1894
|
log7("guest acquire lock", void 0, {
|
|
1876
|
-
F:
|
|
1895
|
+
F: __dxlog_file10,
|
|
1877
1896
|
L: 84,
|
|
1878
1897
|
S: this,
|
|
1879
1898
|
C: (f, a) => f(...a)
|
|
1880
1899
|
});
|
|
1881
1900
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1882
1901
|
log7("guest lock acquired", void 0, {
|
|
1883
|
-
F:
|
|
1902
|
+
F: __dxlog_file10,
|
|
1884
1903
|
L: 86,
|
|
1885
1904
|
S: this,
|
|
1886
1905
|
C: (f, a) => f(...a)
|
|
@@ -1889,7 +1908,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1889
1908
|
role: Options.Role.GUEST
|
|
1890
1909
|
}));
|
|
1891
1910
|
log7("options sent", void 0, {
|
|
1892
|
-
F:
|
|
1911
|
+
F: __dxlog_file10,
|
|
1893
1912
|
L: 88,
|
|
1894
1913
|
S: this,
|
|
1895
1914
|
C: (f, a) => f(...a)
|
|
@@ -1898,7 +1917,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1898
1917
|
timeout: OPTIONS_TIMEOUT
|
|
1899
1918
|
}));
|
|
1900
1919
|
log7("options received", void 0, {
|
|
1901
|
-
F:
|
|
1920
|
+
F: __dxlog_file10,
|
|
1902
1921
|
L: 90,
|
|
1903
1922
|
S: this,
|
|
1904
1923
|
C: (f, a) => f(...a)
|
|
@@ -1932,7 +1951,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1932
1951
|
this._invitationFlowLock.release();
|
|
1933
1952
|
this._invitationFlowLock = null;
|
|
1934
1953
|
log7("invitation flow lock released", void 0, {
|
|
1935
|
-
F:
|
|
1954
|
+
F: __dxlog_file10,
|
|
1936
1955
|
L: 123,
|
|
1937
1956
|
S: this,
|
|
1938
1957
|
C: (f, a) => f(...a)
|
|
@@ -1952,7 +1971,7 @@ import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleEr
|
|
|
1952
1971
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1953
1972
|
import { AuthenticationResponse, Options as Options2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1954
1973
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1955
|
-
var
|
|
1974
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
1956
1975
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
1957
1976
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1958
1977
|
var InvitationHostExtension = class extends RpcExtension2 {
|
|
@@ -1967,7 +1986,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1967
1986
|
});
|
|
1968
1987
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1969
1988
|
this._callbacks = _callbacks;
|
|
1970
|
-
this._ctx = new Context5(
|
|
1989
|
+
this._ctx = new Context5(void 0, {
|
|
1990
|
+
F: __dxlog_file11,
|
|
1991
|
+
L: 52
|
|
1992
|
+
});
|
|
1971
1993
|
this._remoteOptionsTrigger = new Trigger5();
|
|
1972
1994
|
this._challenge = void 0;
|
|
1973
1995
|
this.guestProfile = void 0;
|
|
@@ -1986,7 +2008,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1986
2008
|
InvitationHostService: {
|
|
1987
2009
|
options: async (options) => {
|
|
1988
2010
|
invariant7(!this._remoteOptions, "Remote options already set.", {
|
|
1989
|
-
F:
|
|
2011
|
+
F: __dxlog_file11,
|
|
1990
2012
|
L: 101,
|
|
1991
2013
|
S: this,
|
|
1992
2014
|
A: [
|
|
@@ -2003,7 +2025,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2003
2025
|
log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
|
|
2004
2026
|
id: traceId
|
|
2005
2027
|
}), {
|
|
2006
|
-
F:
|
|
2028
|
+
F: __dxlog_file11,
|
|
2007
2029
|
L: 110,
|
|
2008
2030
|
S: this,
|
|
2009
2031
|
C: (f, a) => f(...a)
|
|
@@ -2015,7 +2037,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2015
2037
|
expected: invitation.invitationId,
|
|
2016
2038
|
actual: invitationId
|
|
2017
2039
|
}, {
|
|
2018
|
-
F:
|
|
2040
|
+
F: __dxlog_file11,
|
|
2019
2041
|
L: 116,
|
|
2020
2042
|
S: this,
|
|
2021
2043
|
C: (f, a) => f(...a)
|
|
@@ -2029,7 +2051,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2029
2051
|
log8("guest introduced themselves", {
|
|
2030
2052
|
guestProfile: profile
|
|
2031
2053
|
}, {
|
|
2032
|
-
F:
|
|
2054
|
+
F: __dxlog_file11,
|
|
2033
2055
|
L: 125,
|
|
2034
2056
|
S: this,
|
|
2035
2057
|
C: (f, a) => f(...a)
|
|
@@ -2040,7 +2062,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2040
2062
|
log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
|
|
2041
2063
|
id: traceId
|
|
2042
2064
|
}), {
|
|
2043
|
-
F:
|
|
2065
|
+
F: __dxlog_file11,
|
|
2044
2066
|
L: 132,
|
|
2045
2067
|
S: this,
|
|
2046
2068
|
C: (f, a) => f(...a)
|
|
@@ -2055,7 +2077,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2055
2077
|
log8.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
|
|
2056
2078
|
id: traceId
|
|
2057
2079
|
}), {
|
|
2058
|
-
F:
|
|
2080
|
+
F: __dxlog_file11,
|
|
2059
2081
|
L: 141,
|
|
2060
2082
|
S: this,
|
|
2061
2083
|
C: (f, a) => f(...a)
|
|
@@ -2064,7 +2086,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2064
2086
|
log8("received authentication request", {
|
|
2065
2087
|
authCode: code
|
|
2066
2088
|
}, {
|
|
2067
|
-
F:
|
|
2089
|
+
F: __dxlog_file11,
|
|
2068
2090
|
L: 144,
|
|
2069
2091
|
S: this,
|
|
2070
2092
|
C: (f, a) => f(...a)
|
|
@@ -2078,7 +2100,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2078
2100
|
switch (invitation.authMethod) {
|
|
2079
2101
|
case Invitation3.AuthMethod.NONE: {
|
|
2080
2102
|
log8("authentication not required", void 0, {
|
|
2081
|
-
F:
|
|
2103
|
+
F: __dxlog_file11,
|
|
2082
2104
|
L: 152,
|
|
2083
2105
|
S: this,
|
|
2084
2106
|
C: (f, a) => f(...a)
|
|
@@ -2116,7 +2138,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2116
2138
|
log8.error("invalid authentication method", {
|
|
2117
2139
|
authMethod: invitation.authMethod
|
|
2118
2140
|
}, {
|
|
2119
|
-
F:
|
|
2141
|
+
F: __dxlog_file11,
|
|
2120
2142
|
L: 190,
|
|
2121
2143
|
S: this,
|
|
2122
2144
|
C: (f, a) => f(...a)
|
|
@@ -2141,7 +2163,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2141
2163
|
status
|
|
2142
2164
|
}
|
|
2143
2165
|
}), {
|
|
2144
|
-
F:
|
|
2166
|
+
F: __dxlog_file11,
|
|
2145
2167
|
L: 202,
|
|
2146
2168
|
S: this,
|
|
2147
2169
|
C: (f, a) => f(...a)
|
|
@@ -2155,7 +2177,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2155
2177
|
log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
|
|
2156
2178
|
id: traceId
|
|
2157
2179
|
}), {
|
|
2158
|
-
F:
|
|
2180
|
+
F: __dxlog_file11,
|
|
2159
2181
|
L: 208,
|
|
2160
2182
|
S: this,
|
|
2161
2183
|
C: (f, a) => f(...a)
|
|
@@ -2172,7 +2194,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2172
2194
|
log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
|
|
2173
2195
|
id: traceId
|
|
2174
2196
|
}), {
|
|
2175
|
-
F:
|
|
2197
|
+
F: __dxlog_file11,
|
|
2176
2198
|
L: 222,
|
|
2177
2199
|
S: this,
|
|
2178
2200
|
C: (f, a) => f(...a)
|
|
@@ -2190,14 +2212,14 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2190
2212
|
await super.onOpen(context);
|
|
2191
2213
|
try {
|
|
2192
2214
|
log8("host acquire lock", void 0, {
|
|
2193
|
-
F:
|
|
2215
|
+
F: __dxlog_file11,
|
|
2194
2216
|
L: 237,
|
|
2195
2217
|
S: this,
|
|
2196
2218
|
C: (f, a) => f(...a)
|
|
2197
2219
|
});
|
|
2198
2220
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2199
2221
|
log8("host lock acquired", void 0, {
|
|
2200
|
-
F:
|
|
2222
|
+
F: __dxlog_file11,
|
|
2201
2223
|
L: 239,
|
|
2202
2224
|
S: this,
|
|
2203
2225
|
C: (f, a) => f(...a)
|
|
@@ -2208,7 +2230,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2208
2230
|
role: Options2.Role.HOST
|
|
2209
2231
|
});
|
|
2210
2232
|
log8("options sent", void 0, {
|
|
2211
|
-
F:
|
|
2233
|
+
F: __dxlog_file11,
|
|
2212
2234
|
L: 243,
|
|
2213
2235
|
S: this,
|
|
2214
2236
|
C: (f, a) => f(...a)
|
|
@@ -2217,7 +2239,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2217
2239
|
timeout: OPTIONS_TIMEOUT2
|
|
2218
2240
|
}));
|
|
2219
2241
|
log8("options received", void 0, {
|
|
2220
|
-
F:
|
|
2242
|
+
F: __dxlog_file11,
|
|
2221
2243
|
L: 245,
|
|
2222
2244
|
S: this,
|
|
2223
2245
|
C: (f, a) => f(...a)
|
|
@@ -2271,7 +2293,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2271
2293
|
this._invitationFlowLock?.release();
|
|
2272
2294
|
this._invitationFlowLock = null;
|
|
2273
2295
|
log8("invitation flow lock released", void 0, {
|
|
2274
|
-
F:
|
|
2296
|
+
F: __dxlog_file11,
|
|
2275
2297
|
L: 300,
|
|
2276
2298
|
S: this,
|
|
2277
2299
|
C: (f, a) => f(...a)
|
|
@@ -2287,7 +2309,7 @@ import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
|
2287
2309
|
import { log as log9 } from "@dxos/log";
|
|
2288
2310
|
import { Options as Options3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
2289
2311
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2290
|
-
var
|
|
2312
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2291
2313
|
var InvitationTopology = class {
|
|
2292
2314
|
constructor(_role) {
|
|
2293
2315
|
this._role = _role;
|
|
@@ -2295,7 +2317,7 @@ var InvitationTopology = class {
|
|
|
2295
2317
|
}
|
|
2296
2318
|
init(controller) {
|
|
2297
2319
|
invariant8(!this._controller, "Already initialized.", {
|
|
2298
|
-
F:
|
|
2320
|
+
F: __dxlog_file12,
|
|
2299
2321
|
L: 42,
|
|
2300
2322
|
S: this,
|
|
2301
2323
|
A: [
|
|
@@ -2307,7 +2329,7 @@ var InvitationTopology = class {
|
|
|
2307
2329
|
}
|
|
2308
2330
|
update() {
|
|
2309
2331
|
invariant8(this._controller, "Not initialized.", {
|
|
2310
|
-
F:
|
|
2332
|
+
F: __dxlog_file12,
|
|
2311
2333
|
L: 47,
|
|
2312
2334
|
S: this,
|
|
2313
2335
|
A: [
|
|
@@ -2330,7 +2352,7 @@ var InvitationTopology = class {
|
|
|
2330
2352
|
ownPeerId,
|
|
2331
2353
|
remotePeerId: firstUnknownPeer
|
|
2332
2354
|
}, {
|
|
2333
|
-
F:
|
|
2355
|
+
F: __dxlog_file12,
|
|
2334
2356
|
L: 69,
|
|
2335
2357
|
S: this,
|
|
2336
2358
|
C: (f, a) => f(...a)
|
|
@@ -2341,7 +2363,7 @@ var InvitationTopology = class {
|
|
|
2341
2363
|
}
|
|
2342
2364
|
async onOffer(peer) {
|
|
2343
2365
|
invariant8(this._controller, "Not initialized.", {
|
|
2344
|
-
F:
|
|
2366
|
+
F: __dxlog_file12,
|
|
2345
2367
|
L: 76,
|
|
2346
2368
|
S: this,
|
|
2347
2369
|
A: [
|
|
@@ -2360,7 +2382,7 @@ var InvitationTopology = class {
|
|
|
2360
2382
|
};
|
|
2361
2383
|
|
|
2362
2384
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
2363
|
-
var
|
|
2385
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2364
2386
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2365
2387
|
var InvitationsHandler = class {
|
|
2366
2388
|
/**
|
|
@@ -2385,7 +2407,7 @@ var InvitationsHandler = class {
|
|
|
2385
2407
|
try {
|
|
2386
2408
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2387
2409
|
invariant9(deviceKey, void 0, {
|
|
2388
|
-
F:
|
|
2410
|
+
F: __dxlog_file13,
|
|
2389
2411
|
L: 90,
|
|
2390
2412
|
S: this,
|
|
2391
2413
|
A: [
|
|
@@ -2414,7 +2436,7 @@ var InvitationsHandler = class {
|
|
|
2414
2436
|
log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
|
|
2415
2437
|
id: traceId
|
|
2416
2438
|
}), {
|
|
2417
|
-
F:
|
|
2439
|
+
F: __dxlog_file13,
|
|
2418
2440
|
L: 115,
|
|
2419
2441
|
S: this,
|
|
2420
2442
|
C: (f, a) => f(...a)
|
|
@@ -2422,7 +2444,7 @@ var InvitationsHandler = class {
|
|
|
2422
2444
|
log10("connected", {
|
|
2423
2445
|
...protocol.toJSON()
|
|
2424
2446
|
}, {
|
|
2425
|
-
F:
|
|
2447
|
+
F: __dxlog_file13,
|
|
2426
2448
|
L: 116,
|
|
2427
2449
|
S: this,
|
|
2428
2450
|
C: (f, a) => f(...a)
|
|
@@ -2434,7 +2456,7 @@ var InvitationsHandler = class {
|
|
|
2434
2456
|
guest: deviceKey,
|
|
2435
2457
|
...protocol.toJSON()
|
|
2436
2458
|
}, {
|
|
2437
|
-
F:
|
|
2459
|
+
F: __dxlog_file13,
|
|
2438
2460
|
L: 118,
|
|
2439
2461
|
S: this,
|
|
2440
2462
|
C: (f, a) => f(...a)
|
|
@@ -2443,7 +2465,7 @@ var InvitationsHandler = class {
|
|
|
2443
2465
|
log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
|
|
2444
2466
|
id: traceId
|
|
2445
2467
|
}), {
|
|
2446
|
-
F:
|
|
2468
|
+
F: __dxlog_file13,
|
|
2447
2469
|
L: 120,
|
|
2448
2470
|
S: this,
|
|
2449
2471
|
C: (f, a) => f(...a)
|
|
@@ -2458,7 +2480,7 @@ var InvitationsHandler = class {
|
|
|
2458
2480
|
log10("timeout", {
|
|
2459
2481
|
...protocol.toJSON()
|
|
2460
2482
|
}, {
|
|
2461
|
-
F:
|
|
2483
|
+
F: __dxlog_file13,
|
|
2462
2484
|
L: 129,
|
|
2463
2485
|
S: this,
|
|
2464
2486
|
C: (f, a) => f(...a)
|
|
@@ -2467,7 +2489,7 @@ var InvitationsHandler = class {
|
|
|
2467
2489
|
} else {
|
|
2468
2490
|
if (guardedState.error(extension, err)) {
|
|
2469
2491
|
log10.error("failed", err, {
|
|
2470
|
-
F:
|
|
2492
|
+
F: __dxlog_file13,
|
|
2471
2493
|
L: 133,
|
|
2472
2494
|
S: this,
|
|
2473
2495
|
C: (f, a) => f(...a)
|
|
@@ -2478,7 +2500,7 @@ var InvitationsHandler = class {
|
|
|
2478
2500
|
id: traceId,
|
|
2479
2501
|
error: err
|
|
2480
2502
|
}), {
|
|
2481
|
-
F:
|
|
2503
|
+
F: __dxlog_file13,
|
|
2482
2504
|
L: 136,
|
|
2483
2505
|
S: this,
|
|
2484
2506
|
C: (f, a) => f(...a)
|
|
@@ -2492,7 +2514,7 @@ var InvitationsHandler = class {
|
|
|
2492
2514
|
log10("invalid role", {
|
|
2493
2515
|
...err.context
|
|
2494
2516
|
}, {
|
|
2495
|
-
F:
|
|
2517
|
+
F: __dxlog_file13,
|
|
2496
2518
|
L: 144,
|
|
2497
2519
|
S: this,
|
|
2498
2520
|
C: (f, a) => f(...a)
|
|
@@ -2504,7 +2526,7 @@ var InvitationsHandler = class {
|
|
|
2504
2526
|
log10("timeout", {
|
|
2505
2527
|
err
|
|
2506
2528
|
}, {
|
|
2507
|
-
F:
|
|
2529
|
+
F: __dxlog_file13,
|
|
2508
2530
|
L: 149,
|
|
2509
2531
|
S: this,
|
|
2510
2532
|
C: (f, a) => f(...a)
|
|
@@ -2513,7 +2535,7 @@ var InvitationsHandler = class {
|
|
|
2513
2535
|
} else {
|
|
2514
2536
|
if (guardedState.error(extension, err)) {
|
|
2515
2537
|
log10.error("failed", err, {
|
|
2516
|
-
F:
|
|
2538
|
+
F: __dxlog_file13,
|
|
2517
2539
|
L: 153,
|
|
2518
2540
|
S: this,
|
|
2519
2541
|
C: (f, a) => f(...a)
|
|
@@ -2527,7 +2549,7 @@ var InvitationsHandler = class {
|
|
|
2527
2549
|
if (invitation.lifetime && invitation.created) {
|
|
2528
2550
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2529
2551
|
log10.warn("invitation has already expired", void 0, {
|
|
2530
|
-
F:
|
|
2552
|
+
F: __dxlog_file13,
|
|
2531
2553
|
L: 164,
|
|
2532
2554
|
S: this,
|
|
2533
2555
|
C: (f, a) => f(...a)
|
|
@@ -2550,7 +2572,7 @@ var InvitationsHandler = class {
|
|
|
2550
2572
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
2551
2573
|
if (deviceProfile) {
|
|
2552
2574
|
invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2553
|
-
F:
|
|
2575
|
+
F: __dxlog_file13,
|
|
2554
2576
|
L: 197,
|
|
2555
2577
|
S: this,
|
|
2556
2578
|
A: [
|
|
@@ -2568,7 +2590,7 @@ var InvitationsHandler = class {
|
|
|
2568
2590
|
invitationType: Invitation4.Type.DELEGATED,
|
|
2569
2591
|
triedPeers: triedPeersIds.size
|
|
2570
2592
|
}, {
|
|
2571
|
-
F:
|
|
2593
|
+
F: __dxlog_file13,
|
|
2572
2594
|
L: 205,
|
|
2573
2595
|
S: this,
|
|
2574
2596
|
C: (f, a) => f(...a)
|
|
@@ -2595,7 +2617,7 @@ var InvitationsHandler = class {
|
|
|
2595
2617
|
admitted,
|
|
2596
2618
|
currentState: guardedState.current.state
|
|
2597
2619
|
}, {
|
|
2598
|
-
F:
|
|
2620
|
+
F: __dxlog_file13,
|
|
2599
2621
|
L: 233,
|
|
2600
2622
|
S: this,
|
|
2601
2623
|
C: (f, a) => f(...a)
|
|
@@ -2613,7 +2635,7 @@ var InvitationsHandler = class {
|
|
|
2613
2635
|
log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
|
|
2614
2636
|
id: traceId
|
|
2615
2637
|
}), {
|
|
2616
|
-
F:
|
|
2638
|
+
F: __dxlog_file13,
|
|
2617
2639
|
L: 245,
|
|
2618
2640
|
S: this,
|
|
2619
2641
|
C: (f, a) => f(...a)
|
|
@@ -2625,7 +2647,7 @@ var InvitationsHandler = class {
|
|
|
2625
2647
|
log10("connected", {
|
|
2626
2648
|
...protocol.toJSON()
|
|
2627
2649
|
}, {
|
|
2628
|
-
F:
|
|
2650
|
+
F: __dxlog_file13,
|
|
2629
2651
|
L: 256,
|
|
2630
2652
|
S: this,
|
|
2631
2653
|
C: (f, a) => f(...a)
|
|
@@ -2634,7 +2656,7 @@ var InvitationsHandler = class {
|
|
|
2634
2656
|
log10("introduce", {
|
|
2635
2657
|
...protocol.toJSON()
|
|
2636
2658
|
}, {
|
|
2637
|
-
F:
|
|
2659
|
+
F: __dxlog_file13,
|
|
2638
2660
|
L: 260,
|
|
2639
2661
|
S: this,
|
|
2640
2662
|
C: (f, a) => f(...a)
|
|
@@ -2647,7 +2669,7 @@ var InvitationsHandler = class {
|
|
|
2647
2669
|
...protocol.toJSON(),
|
|
2648
2670
|
response: introductionResponse
|
|
2649
2671
|
}, {
|
|
2650
|
-
F:
|
|
2672
|
+
F: __dxlog_file13,
|
|
2651
2673
|
L: 265,
|
|
2652
2674
|
S: this,
|
|
2653
2675
|
C: (f, a) => f(...a)
|
|
@@ -2668,7 +2690,7 @@ var InvitationsHandler = class {
|
|
|
2668
2690
|
log10("request admission", {
|
|
2669
2691
|
...protocol.toJSON()
|
|
2670
2692
|
}, {
|
|
2671
|
-
F:
|
|
2693
|
+
F: __dxlog_file13,
|
|
2672
2694
|
L: 291,
|
|
2673
2695
|
S: this,
|
|
2674
2696
|
C: (f, a) => f(...a)
|
|
@@ -2680,7 +2702,7 @@ var InvitationsHandler = class {
|
|
|
2680
2702
|
log10("admitted by host", {
|
|
2681
2703
|
...protocol.toJSON()
|
|
2682
2704
|
}, {
|
|
2683
|
-
F:
|
|
2705
|
+
F: __dxlog_file13,
|
|
2684
2706
|
L: 302,
|
|
2685
2707
|
S: this,
|
|
2686
2708
|
C: (f, a) => f(...a)
|
|
@@ -2693,7 +2715,7 @@ var InvitationsHandler = class {
|
|
|
2693
2715
|
log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
|
|
2694
2716
|
id: traceId
|
|
2695
2717
|
}), {
|
|
2696
|
-
F:
|
|
2718
|
+
F: __dxlog_file13,
|
|
2697
2719
|
L: 308,
|
|
2698
2720
|
S: this,
|
|
2699
2721
|
C: (f, a) => f(...a)
|
|
@@ -2703,7 +2725,7 @@ var InvitationsHandler = class {
|
|
|
2703
2725
|
log10("timeout", {
|
|
2704
2726
|
...protocol.toJSON()
|
|
2705
2727
|
}, {
|
|
2706
|
-
F:
|
|
2728
|
+
F: __dxlog_file13,
|
|
2707
2729
|
L: 311,
|
|
2708
2730
|
S: this,
|
|
2709
2731
|
C: (f, a) => f(...a)
|
|
@@ -2711,7 +2733,7 @@ var InvitationsHandler = class {
|
|
|
2711
2733
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2712
2734
|
} else {
|
|
2713
2735
|
log10("auth failed", err, {
|
|
2714
|
-
F:
|
|
2736
|
+
F: __dxlog_file13,
|
|
2715
2737
|
L: 314,
|
|
2716
2738
|
S: this,
|
|
2717
2739
|
C: (f, a) => f(...a)
|
|
@@ -2723,7 +2745,7 @@ var InvitationsHandler = class {
|
|
|
2723
2745
|
id: traceId,
|
|
2724
2746
|
error: err
|
|
2725
2747
|
}), {
|
|
2726
|
-
F:
|
|
2748
|
+
F: __dxlog_file13,
|
|
2727
2749
|
L: 318,
|
|
2728
2750
|
S: this,
|
|
2729
2751
|
C: (f, a) => f(...a)
|
|
@@ -2739,7 +2761,7 @@ var InvitationsHandler = class {
|
|
|
2739
2761
|
log10("timeout", {
|
|
2740
2762
|
...protocol.toJSON()
|
|
2741
2763
|
}, {
|
|
2742
|
-
F:
|
|
2764
|
+
F: __dxlog_file13,
|
|
2743
2765
|
L: 327,
|
|
2744
2766
|
S: this,
|
|
2745
2767
|
C: (f, a) => f(...a)
|
|
@@ -2747,7 +2769,7 @@ var InvitationsHandler = class {
|
|
|
2747
2769
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2748
2770
|
} else {
|
|
2749
2771
|
log10("auth failed", err, {
|
|
2750
|
-
F:
|
|
2772
|
+
F: __dxlog_file13,
|
|
2751
2773
|
L: 330,
|
|
2752
2774
|
S: this,
|
|
2753
2775
|
C: (f, a) => f(...a)
|
|
@@ -2765,7 +2787,7 @@ var InvitationsHandler = class {
|
|
|
2765
2787
|
await ctx.dispose();
|
|
2766
2788
|
} else {
|
|
2767
2789
|
invariant9(invitation.swarmKey, void 0, {
|
|
2768
|
-
F:
|
|
2790
|
+
F: __dxlog_file13,
|
|
2769
2791
|
L: 345,
|
|
2770
2792
|
S: this,
|
|
2771
2793
|
A: [
|
|
@@ -2865,7 +2887,7 @@ var InvitationsHandler = class {
|
|
|
2865
2887
|
newState: stateToString(newState),
|
|
2866
2888
|
oldState: stateToString(invitation.state)
|
|
2867
2889
|
}, {
|
|
2868
|
-
F:
|
|
2890
|
+
F: __dxlog_file13,
|
|
2869
2891
|
L: 439,
|
|
2870
2892
|
S: this,
|
|
2871
2893
|
C: (f, a) => f(...a)
|
|
@@ -2876,7 +2898,7 @@ var InvitationsHandler = class {
|
|
|
2876
2898
|
newState: stateToString(newState),
|
|
2877
2899
|
oldState: stateToString(invitation.state)
|
|
2878
2900
|
}, {
|
|
2879
|
-
F:
|
|
2901
|
+
F: __dxlog_file13,
|
|
2880
2902
|
L: 445,
|
|
2881
2903
|
S: this,
|
|
2882
2904
|
C: (f, a) => f(...a)
|
|
@@ -2895,7 +2917,7 @@ var InvitationsHandler = class {
|
|
|
2895
2917
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2896
2918
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2897
2919
|
log10("guest waiting for authentication code...", void 0, {
|
|
2898
|
-
F:
|
|
2920
|
+
F: __dxlog_file13,
|
|
2899
2921
|
L: 470,
|
|
2900
2922
|
S: this,
|
|
2901
2923
|
C: (f, a) => f(...a)
|
|
@@ -2903,7 +2925,7 @@ var InvitationsHandler = class {
|
|
|
2903
2925
|
setState(Invitation4.State.READY_FOR_AUTHENTICATION);
|
|
2904
2926
|
const authCode = await authenticated.wait(options);
|
|
2905
2927
|
log10("sending authentication request", void 0, {
|
|
2906
|
-
F:
|
|
2928
|
+
F: __dxlog_file13,
|
|
2907
2929
|
L: 474,
|
|
2908
2930
|
S: this,
|
|
2909
2931
|
C: (f, a) => f(...a)
|
|
@@ -2922,7 +2944,7 @@ var InvitationsHandler = class {
|
|
|
2922
2944
|
log10("retrying invalid code", {
|
|
2923
2945
|
attempt
|
|
2924
2946
|
}, {
|
|
2925
|
-
F:
|
|
2947
|
+
F: __dxlog_file13,
|
|
2926
2948
|
L: 485,
|
|
2927
2949
|
S: this,
|
|
2928
2950
|
C: (f, a) => f(...a)
|
|
@@ -2940,7 +2962,7 @@ var InvitationsHandler = class {
|
|
|
2940
2962
|
throw new Error("challenge missing in the introduction");
|
|
2941
2963
|
}
|
|
2942
2964
|
log10("sending authentication request", void 0, {
|
|
2943
|
-
F:
|
|
2965
|
+
F: __dxlog_file13,
|
|
2944
2966
|
L: 504,
|
|
2945
2967
|
S: this,
|
|
2946
2968
|
C: (f, a) => f(...a)
|
|
@@ -3061,14 +3083,14 @@ var InvitationsServiceImpl = class {
|
|
|
3061
3083
|
};
|
|
3062
3084
|
|
|
3063
3085
|
// packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
|
|
3064
|
-
import {
|
|
3086
|
+
import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
3065
3087
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
3066
3088
|
import { invariant as invariant10 } from "@dxos/invariant";
|
|
3067
3089
|
import { log as log11 } from "@dxos/log";
|
|
3068
3090
|
import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
|
|
3069
3091
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3070
3092
|
import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3071
|
-
var
|
|
3093
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3072
3094
|
var SpaceInvitationProtocol = class {
|
|
3073
3095
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3074
3096
|
this._spaceManager = _spaceManager;
|
|
@@ -3102,79 +3124,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3102
3124
|
};
|
|
3103
3125
|
}
|
|
3104
3126
|
async admit(invitation, request, guestProfile) {
|
|
3105
|
-
invariant10(this._spaceKey, void 0, {
|
|
3106
|
-
F:
|
|
3107
|
-
L:
|
|
3108
|
-
S: this,
|
|
3109
|
-
A: [
|
|
3110
|
-
"this._spaceKey",
|
|
3111
|
-
""
|
|
3112
|
-
]
|
|
3113
|
-
});
|
|
3114
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3115
|
-
invariant10(space, void 0, {
|
|
3116
|
-
F: __dxlog_file13,
|
|
3117
|
-
L: 78,
|
|
3118
|
-
S: this,
|
|
3119
|
-
A: [
|
|
3120
|
-
"space",
|
|
3121
|
-
""
|
|
3122
|
-
]
|
|
3123
|
-
});
|
|
3124
|
-
invariant10(request.space, void 0, {
|
|
3125
|
-
F: __dxlog_file13,
|
|
3126
|
-
L: 80,
|
|
3127
|
+
invariant10(this._spaceKey && request.space, void 0, {
|
|
3128
|
+
F: __dxlog_file14,
|
|
3129
|
+
L: 74,
|
|
3127
3130
|
S: this,
|
|
3128
3131
|
A: [
|
|
3129
|
-
"request.space",
|
|
3132
|
+
"this._spaceKey && request.space",
|
|
3130
3133
|
""
|
|
3131
3134
|
]
|
|
3132
3135
|
});
|
|
3133
|
-
const { identityKey, deviceKey } = request.space;
|
|
3134
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== SpaceMember2.Role.REMOVED) {
|
|
3135
|
-
throw new AlreadyJoinedError2();
|
|
3136
|
-
}
|
|
3137
3136
|
log11("writing guest credentials", {
|
|
3138
3137
|
host: this._signingContext.deviceKey,
|
|
3139
|
-
guest: deviceKey
|
|
3138
|
+
guest: request.space.deviceKey
|
|
3140
3139
|
}, {
|
|
3141
|
-
F:
|
|
3142
|
-
L:
|
|
3140
|
+
F: __dxlog_file14,
|
|
3141
|
+
L: 75,
|
|
3143
3142
|
S: this,
|
|
3144
3143
|
C: (f, a) => f(...a)
|
|
3145
3144
|
});
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
"credentials[0].credential",
|
|
3153
|
-
""
|
|
3154
|
-
]
|
|
3155
|
-
});
|
|
3156
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3157
|
-
invariant10(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3158
|
-
F: __dxlog_file13,
|
|
3159
|
-
L: 103,
|
|
3160
|
-
S: this,
|
|
3161
|
-
A: [
|
|
3162
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3163
|
-
""
|
|
3164
|
-
]
|
|
3145
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3146
|
+
spaceKey: this._spaceKey,
|
|
3147
|
+
identityKey: request.space.identityKey,
|
|
3148
|
+
role: invitation.role ?? SpaceMember2.Role.ADMIN,
|
|
3149
|
+
profile: guestProfile,
|
|
3150
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3165
3151
|
});
|
|
3166
|
-
|
|
3152
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3167
3153
|
return {
|
|
3168
3154
|
space: {
|
|
3169
3155
|
credential: spaceMemberCredential,
|
|
3170
|
-
controlTimeframe: space
|
|
3156
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3171
3157
|
}
|
|
3172
3158
|
};
|
|
3173
3159
|
}
|
|
3174
3160
|
async delegate(invitation) {
|
|
3175
3161
|
invariant10(this._spaceKey, void 0, {
|
|
3176
|
-
F:
|
|
3177
|
-
L:
|
|
3162
|
+
F: __dxlog_file14,
|
|
3163
|
+
L: 95,
|
|
3178
3164
|
S: this,
|
|
3179
3165
|
A: [
|
|
3180
3166
|
"this._spaceKey",
|
|
@@ -3183,8 +3169,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3183
3169
|
});
|
|
3184
3170
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3185
3171
|
invariant10(space, void 0, {
|
|
3186
|
-
F:
|
|
3187
|
-
L:
|
|
3172
|
+
F: __dxlog_file14,
|
|
3173
|
+
L: 97,
|
|
3188
3174
|
S: this,
|
|
3189
3175
|
A: [
|
|
3190
3176
|
"space",
|
|
@@ -3193,8 +3179,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3193
3179
|
});
|
|
3194
3180
|
if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3195
3181
|
invariant10(invitation.guestKeypair?.publicKey, void 0, {
|
|
3196
|
-
F:
|
|
3197
|
-
L:
|
|
3182
|
+
F: __dxlog_file14,
|
|
3183
|
+
L: 99,
|
|
3198
3184
|
S: this,
|
|
3199
3185
|
A: [
|
|
3200
3186
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3206,8 +3192,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3206
3192
|
host: this._signingContext.deviceKey,
|
|
3207
3193
|
id: invitation.invitationId
|
|
3208
3194
|
}, {
|
|
3209
|
-
F:
|
|
3210
|
-
L:
|
|
3195
|
+
F: __dxlog_file14,
|
|
3196
|
+
L: 102,
|
|
3211
3197
|
S: this,
|
|
3212
3198
|
C: (f, a) => f(...a)
|
|
3213
3199
|
});
|
|
@@ -3221,8 +3207,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3221
3207
|
guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3222
3208
|
});
|
|
3223
3209
|
invariant10(credential.credential, void 0, {
|
|
3224
|
-
F:
|
|
3225
|
-
L:
|
|
3210
|
+
F: __dxlog_file14,
|
|
3211
|
+
L: 122,
|
|
3226
3212
|
S: this,
|
|
3227
3213
|
A: [
|
|
3228
3214
|
"credential.credential",
|
|
@@ -3236,8 +3222,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3236
3222
|
}
|
|
3237
3223
|
async cancelDelegation(invitation) {
|
|
3238
3224
|
invariant10(this._spaceKey, void 0, {
|
|
3239
|
-
F:
|
|
3240
|
-
L:
|
|
3225
|
+
F: __dxlog_file14,
|
|
3226
|
+
L: 128,
|
|
3241
3227
|
S: this,
|
|
3242
3228
|
A: [
|
|
3243
3229
|
"this._spaceKey",
|
|
@@ -3245,8 +3231,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3245
3231
|
]
|
|
3246
3232
|
});
|
|
3247
3233
|
invariant10(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3248
|
-
F:
|
|
3249
|
-
L:
|
|
3234
|
+
F: __dxlog_file14,
|
|
3235
|
+
L: 129,
|
|
3250
3236
|
S: this,
|
|
3251
3237
|
A: [
|
|
3252
3238
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3255,8 +3241,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3255
3241
|
});
|
|
3256
3242
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3257
3243
|
invariant10(space, void 0, {
|
|
3258
|
-
F:
|
|
3259
|
-
L:
|
|
3244
|
+
F: __dxlog_file14,
|
|
3245
|
+
L: 131,
|
|
3260
3246
|
S: this,
|
|
3261
3247
|
A: [
|
|
3262
3248
|
"space",
|
|
@@ -3267,15 +3253,15 @@ var SpaceInvitationProtocol = class {
|
|
|
3267
3253
|
host: this._signingContext.deviceKey,
|
|
3268
3254
|
id: invitation.invitationId
|
|
3269
3255
|
}, {
|
|
3270
|
-
F:
|
|
3271
|
-
L:
|
|
3256
|
+
F: __dxlog_file14,
|
|
3257
|
+
L: 133,
|
|
3272
3258
|
S: this,
|
|
3273
3259
|
C: (f, a) => f(...a)
|
|
3274
3260
|
});
|
|
3275
3261
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3276
3262
|
invariant10(credential.credential, void 0, {
|
|
3277
|
-
F:
|
|
3278
|
-
L:
|
|
3263
|
+
F: __dxlog_file14,
|
|
3264
|
+
L: 140,
|
|
3279
3265
|
S: this,
|
|
3280
3266
|
A: [
|
|
3281
3267
|
"credential.credential",
|
|
@@ -3313,8 +3299,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3313
3299
|
}
|
|
3314
3300
|
async accept(response) {
|
|
3315
3301
|
invariant10(response.space, void 0, {
|
|
3316
|
-
F:
|
|
3317
|
-
L:
|
|
3302
|
+
F: __dxlog_file14,
|
|
3303
|
+
L: 175,
|
|
3318
3304
|
S: this,
|
|
3319
3305
|
A: [
|
|
3320
3306
|
"response.space",
|
|
@@ -3324,8 +3310,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3324
3310
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3325
3311
|
const assertion = getCredentialAssertion2(credential);
|
|
3326
3312
|
invariant10(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3327
|
-
F:
|
|
3328
|
-
L:
|
|
3313
|
+
F: __dxlog_file14,
|
|
3314
|
+
L: 178,
|
|
3329
3315
|
S: this,
|
|
3330
3316
|
A: [
|
|
3331
3317
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3333,8 +3319,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3333
3319
|
]
|
|
3334
3320
|
});
|
|
3335
3321
|
invariant10(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3336
|
-
F:
|
|
3337
|
-
L:
|
|
3322
|
+
F: __dxlog_file14,
|
|
3323
|
+
L: 179,
|
|
3338
3324
|
S: this,
|
|
3339
3325
|
A: [
|
|
3340
3326
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3368,7 +3354,7 @@ import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
|
3368
3354
|
import { log as log12 } from "@dxos/log";
|
|
3369
3355
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3370
3356
|
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3371
|
-
var
|
|
3357
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3372
3358
|
var InvitationsManager = class {
|
|
3373
3359
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3374
3360
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3411,7 +3397,7 @@ var InvitationsManager = class {
|
|
|
3411
3397
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3412
3398
|
} catch (err) {
|
|
3413
3399
|
log12.catch(err, void 0, {
|
|
3414
|
-
F:
|
|
3400
|
+
F: __dxlog_file15,
|
|
3415
3401
|
L: 82,
|
|
3416
3402
|
S: this,
|
|
3417
3403
|
C: (f, a) => f(...a)
|
|
@@ -3434,7 +3420,7 @@ var InvitationsManager = class {
|
|
|
3434
3420
|
const freshInvitations = persistentInvitations.filter((invitation) => !hasInvitationExpired(invitation));
|
|
3435
3421
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3436
3422
|
invariant11(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3437
|
-
F:
|
|
3423
|
+
F: __dxlog_file15,
|
|
3438
3424
|
L: 103,
|
|
3439
3425
|
S: this,
|
|
3440
3426
|
A: [
|
|
@@ -3453,7 +3439,7 @@ var InvitationsManager = class {
|
|
|
3453
3439
|
};
|
|
3454
3440
|
} catch (err) {
|
|
3455
3441
|
log12.catch(err, void 0, {
|
|
3456
|
-
F:
|
|
3442
|
+
F: __dxlog_file15,
|
|
3457
3443
|
L: 110,
|
|
3458
3444
|
S: this,
|
|
3459
3445
|
C: (f, a) => f(...a)
|
|
@@ -3485,13 +3471,13 @@ var InvitationsManager = class {
|
|
|
3485
3471
|
}
|
|
3486
3472
|
async authenticate({ invitationId, authCode }) {
|
|
3487
3473
|
log12("authenticating...", void 0, {
|
|
3488
|
-
F:
|
|
3474
|
+
F: __dxlog_file15,
|
|
3489
3475
|
L: 140,
|
|
3490
3476
|
S: this,
|
|
3491
3477
|
C: (f, a) => f(...a)
|
|
3492
3478
|
});
|
|
3493
3479
|
invariant11(invitationId, void 0, {
|
|
3494
|
-
F:
|
|
3480
|
+
F: __dxlog_file15,
|
|
3495
3481
|
L: 141,
|
|
3496
3482
|
S: this,
|
|
3497
3483
|
A: [
|
|
@@ -3504,7 +3490,7 @@ var InvitationsManager = class {
|
|
|
3504
3490
|
log12.warn("invalid invitation", {
|
|
3505
3491
|
invitationId
|
|
3506
3492
|
}, {
|
|
3507
|
-
F:
|
|
3493
|
+
F: __dxlog_file15,
|
|
3508
3494
|
L: 144,
|
|
3509
3495
|
S: this,
|
|
3510
3496
|
C: (f, a) => f(...a)
|
|
@@ -3517,13 +3503,13 @@ var InvitationsManager = class {
|
|
|
3517
3503
|
log12("cancelInvitation...", {
|
|
3518
3504
|
invitationId
|
|
3519
3505
|
}, {
|
|
3520
|
-
F:
|
|
3506
|
+
F: __dxlog_file15,
|
|
3521
3507
|
L: 151,
|
|
3522
3508
|
S: this,
|
|
3523
3509
|
C: (f, a) => f(...a)
|
|
3524
3510
|
});
|
|
3525
3511
|
invariant11(invitationId, void 0, {
|
|
3526
|
-
F:
|
|
3512
|
+
F: __dxlog_file15,
|
|
3527
3513
|
L: 152,
|
|
3528
3514
|
S: this,
|
|
3529
3515
|
A: [
|
|
@@ -3597,12 +3583,15 @@ var InvitationsManager = class {
|
|
|
3597
3583
|
stream.error(err);
|
|
3598
3584
|
void ctx.dispose();
|
|
3599
3585
|
}
|
|
3586
|
+
}, {
|
|
3587
|
+
F: __dxlog_file15,
|
|
3588
|
+
L: 234
|
|
3600
3589
|
});
|
|
3601
3590
|
ctx.onDispose(() => {
|
|
3602
3591
|
log12("complete", {
|
|
3603
3592
|
...handler.toJSON()
|
|
3604
3593
|
}, {
|
|
3605
|
-
F:
|
|
3594
|
+
F: __dxlog_file15,
|
|
3606
3595
|
L: 241,
|
|
3607
3596
|
S: this,
|
|
3608
3597
|
C: (f, a) => f(...a)
|
|
@@ -3635,7 +3624,7 @@ var InvitationsManager = class {
|
|
|
3635
3624
|
log12("timeout", {
|
|
3636
3625
|
...handler.toJSON()
|
|
3637
3626
|
}, {
|
|
3638
|
-
F:
|
|
3627
|
+
F: __dxlog_file15,
|
|
3639
3628
|
L: 261,
|
|
3640
3629
|
S: this,
|
|
3641
3630
|
C: (f, a) => f(...a)
|
|
@@ -3646,7 +3635,7 @@ var InvitationsManager = class {
|
|
|
3646
3635
|
});
|
|
3647
3636
|
} else {
|
|
3648
3637
|
log12.warn("auth failed", err, {
|
|
3649
|
-
F:
|
|
3638
|
+
F: __dxlog_file15,
|
|
3650
3639
|
L: 264,
|
|
3651
3640
|
S: this,
|
|
3652
3641
|
C: (f, a) => f(...a)
|
|
@@ -3658,12 +3647,15 @@ var InvitationsManager = class {
|
|
|
3658
3647
|
}
|
|
3659
3648
|
void ctx.dispose();
|
|
3660
3649
|
}
|
|
3650
|
+
}, {
|
|
3651
|
+
F: __dxlog_file15,
|
|
3652
|
+
L: 258
|
|
3661
3653
|
});
|
|
3662
3654
|
ctx.onDispose(() => {
|
|
3663
3655
|
log12("complete", {
|
|
3664
3656
|
...handler.toJSON()
|
|
3665
3657
|
}, {
|
|
3666
|
-
F:
|
|
3658
|
+
F: __dxlog_file15,
|
|
3667
3659
|
L: 271,
|
|
3668
3660
|
S: this,
|
|
3669
3661
|
C: (f, a) => f(...a)
|
|
@@ -3708,7 +3700,7 @@ var InvitationsManager = class {
|
|
|
3708
3700
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3709
3701
|
} catch (err) {
|
|
3710
3702
|
log12.catch(err, void 0, {
|
|
3711
|
-
F:
|
|
3703
|
+
F: __dxlog_file15,
|
|
3712
3704
|
L: 307,
|
|
3713
3705
|
S: this,
|
|
3714
3706
|
C: (f, a) => f(...a)
|
|
@@ -3795,7 +3787,7 @@ import { invariant as invariant12 } from "@dxos/invariant";
|
|
|
3795
3787
|
import { log as log13 } from "@dxos/log";
|
|
3796
3788
|
import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
3797
3789
|
import { assignDeep } from "@dxos/util";
|
|
3798
|
-
var
|
|
3790
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3799
3791
|
var runEpochMigration = async (ctx, context) => {
|
|
3800
3792
|
switch (context.migration) {
|
|
3801
3793
|
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
@@ -3819,7 +3811,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3819
3811
|
}
|
|
3820
3812
|
case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3821
3813
|
log13.info("Fragmenting", void 0, {
|
|
3822
|
-
F:
|
|
3814
|
+
F: __dxlog_file16,
|
|
3823
3815
|
L: 63,
|
|
3824
3816
|
S: void 0,
|
|
3825
3817
|
C: (f, a) => f(...a)
|
|
@@ -3831,7 +3823,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3831
3823
|
const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
|
|
3832
3824
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3833
3825
|
invariant12(properties, "Properties not found", {
|
|
3834
|
-
F:
|
|
3826
|
+
F: __dxlog_file16,
|
|
3835
3827
|
L: 73,
|
|
3836
3828
|
S: void 0,
|
|
3837
3829
|
A: [
|
|
@@ -3847,7 +3839,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3847
3839
|
};
|
|
3848
3840
|
const newRoot = context.repo.create(newSpaceDoc);
|
|
3849
3841
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3850
|
-
F:
|
|
3842
|
+
F: __dxlog_file16,
|
|
3851
3843
|
L: 78,
|
|
3852
3844
|
S: void 0,
|
|
3853
3845
|
A: [
|
|
@@ -3878,7 +3870,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3878
3870
|
const rootHandle = context.repo.find(currentRootUrl);
|
|
3879
3871
|
await cancelWithContext4(ctx, asyncTimeout2(rootHandle.whenReady(), 1e4));
|
|
3880
3872
|
invariant12(rootHandle.docSync(), "Root doc not found", {
|
|
3881
|
-
F:
|
|
3873
|
+
F: __dxlog_file16,
|
|
3882
3874
|
L: 100,
|
|
3883
3875
|
S: void 0,
|
|
3884
3876
|
A: [
|
|
@@ -3891,7 +3883,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3891
3883
|
const handle = context.repo.find(url);
|
|
3892
3884
|
await cancelWithContext4(ctx, asyncTimeout2(handle.whenReady(), 1e4));
|
|
3893
3885
|
invariant12(handle.docSync(), "Doc not found", {
|
|
3894
|
-
F:
|
|
3886
|
+
F: __dxlog_file16,
|
|
3895
3887
|
L: 107,
|
|
3896
3888
|
S: void 0,
|
|
3897
3889
|
A: [
|
|
@@ -3913,7 +3905,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3913
3905
|
}
|
|
3914
3906
|
case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3915
3907
|
invariant12(context.newAutomergeRoot, void 0, {
|
|
3916
|
-
F:
|
|
3908
|
+
F: __dxlog_file16,
|
|
3917
3909
|
L: 124,
|
|
3918
3910
|
S: void 0,
|
|
3919
3911
|
A: [
|
|
@@ -3939,14 +3931,17 @@ import { log as log14 } from "@dxos/log";
|
|
|
3939
3931
|
import { schema as schema4 } from "@dxos/protocols";
|
|
3940
3932
|
import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
|
|
3941
3933
|
import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet4, entry } from "@dxos/util";
|
|
3942
|
-
var
|
|
3934
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3943
3935
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3944
3936
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3945
3937
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3946
3938
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3947
3939
|
var NotarizationPlugin = class {
|
|
3948
3940
|
constructor() {
|
|
3949
|
-
this._ctx = new Context7(
|
|
3941
|
+
this._ctx = new Context7(void 0, {
|
|
3942
|
+
F: __dxlog_file17,
|
|
3943
|
+
L: 62
|
|
3944
|
+
});
|
|
3950
3945
|
this._extensionOpened = new Event5();
|
|
3951
3946
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3952
3947
|
this._processedCredentials = new ComplexSet4(PublicKey9.hash);
|
|
@@ -3967,13 +3962,13 @@ var NotarizationPlugin = class {
|
|
|
3967
3962
|
log14("notarize", {
|
|
3968
3963
|
credentials
|
|
3969
3964
|
}, {
|
|
3970
|
-
F:
|
|
3965
|
+
F: __dxlog_file17,
|
|
3971
3966
|
L: 90,
|
|
3972
3967
|
S: this,
|
|
3973
3968
|
C: (f, a) => f(...a)
|
|
3974
3969
|
});
|
|
3975
3970
|
invariant13(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3976
|
-
F:
|
|
3971
|
+
F: __dxlog_file17,
|
|
3977
3972
|
L: 91,
|
|
3978
3973
|
S: this,
|
|
3979
3974
|
A: [
|
|
@@ -3987,7 +3982,7 @@ var NotarizationPlugin = class {
|
|
|
3987
3982
|
log14.warn("Notarization error", {
|
|
3988
3983
|
err
|
|
3989
3984
|
}, {
|
|
3990
|
-
F:
|
|
3985
|
+
F: __dxlog_file17,
|
|
3991
3986
|
L: 99,
|
|
3992
3987
|
S: this,
|
|
3993
3988
|
C: (f, a) => f(...a)
|
|
@@ -4003,7 +3998,7 @@ var NotarizationPlugin = class {
|
|
|
4003
3998
|
timeout,
|
|
4004
3999
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
4005
4000
|
}, {
|
|
4006
|
-
F:
|
|
4001
|
+
F: __dxlog_file17,
|
|
4007
4002
|
L: 111,
|
|
4008
4003
|
S: this,
|
|
4009
4004
|
C: (f, a) => f(...a)
|
|
@@ -4026,7 +4021,7 @@ var NotarizationPlugin = class {
|
|
|
4026
4021
|
log14.info("Exhausted all peers to notarize with", {
|
|
4027
4022
|
retryIn: retryTimeout
|
|
4028
4023
|
}, {
|
|
4029
|
-
F:
|
|
4024
|
+
F: __dxlog_file17,
|
|
4030
4025
|
L: 136,
|
|
4031
4026
|
S: this,
|
|
4032
4027
|
C: (f, a) => f(...a)
|
|
@@ -4040,7 +4035,7 @@ var NotarizationPlugin = class {
|
|
|
4040
4035
|
peer: peer.localPeerId,
|
|
4041
4036
|
credentialId: credentials.map((credential) => credential.id)
|
|
4042
4037
|
}, {
|
|
4043
|
-
F:
|
|
4038
|
+
F: __dxlog_file17,
|
|
4044
4039
|
L: 143,
|
|
4045
4040
|
S: this,
|
|
4046
4041
|
C: (f, a) => f(...a)
|
|
@@ -4049,7 +4044,7 @@ var NotarizationPlugin = class {
|
|
|
4049
4044
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4050
4045
|
});
|
|
4051
4046
|
log14("success", void 0, {
|
|
4052
|
-
F:
|
|
4047
|
+
F: __dxlog_file17,
|
|
4053
4048
|
L: 147,
|
|
4054
4049
|
S: this,
|
|
4055
4050
|
C: (f, a) => f(...a)
|
|
@@ -4058,7 +4053,7 @@ var NotarizationPlugin = class {
|
|
|
4058
4053
|
} catch (err) {
|
|
4059
4054
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4060
4055
|
log14.info("error notarizing (recoverable)", err, {
|
|
4061
|
-
F:
|
|
4056
|
+
F: __dxlog_file17,
|
|
4062
4057
|
L: 151,
|
|
4063
4058
|
S: this,
|
|
4064
4059
|
C: (f, a) => f(...a)
|
|
@@ -4076,7 +4071,7 @@ var NotarizationPlugin = class {
|
|
|
4076
4071
|
errors.wait()
|
|
4077
4072
|
]);
|
|
4078
4073
|
log14("done", void 0, {
|
|
4079
|
-
F:
|
|
4074
|
+
F: __dxlog_file17,
|
|
4080
4075
|
L: 162,
|
|
4081
4076
|
S: this,
|
|
4082
4077
|
C: (f, a) => f(...a)
|
|
@@ -4098,7 +4093,7 @@ var NotarizationPlugin = class {
|
|
|
4098
4093
|
}
|
|
4099
4094
|
setWriter(writer) {
|
|
4100
4095
|
invariant13(!this._writer, "Writer already set.", {
|
|
4101
|
-
F:
|
|
4096
|
+
F: __dxlog_file17,
|
|
4102
4097
|
L: 181,
|
|
4103
4098
|
S: this,
|
|
4104
4099
|
A: [
|
|
@@ -4123,7 +4118,7 @@ var NotarizationPlugin = class {
|
|
|
4123
4118
|
}
|
|
4124
4119
|
for (const credential of request.credentials ?? []) {
|
|
4125
4120
|
invariant13(credential.id, "Credential must have an id", {
|
|
4126
|
-
F:
|
|
4121
|
+
F: __dxlog_file17,
|
|
4127
4122
|
L: 200,
|
|
4128
4123
|
S: this,
|
|
4129
4124
|
A: [
|
|
@@ -4143,7 +4138,7 @@ var NotarizationPlugin = class {
|
|
|
4143
4138
|
log14("extension opened", {
|
|
4144
4139
|
peer: extension.localPeerId
|
|
4145
4140
|
}, {
|
|
4146
|
-
F:
|
|
4141
|
+
F: __dxlog_file17,
|
|
4147
4142
|
L: 211,
|
|
4148
4143
|
S: this,
|
|
4149
4144
|
C: (f, a) => f(...a)
|
|
@@ -4155,7 +4150,7 @@ var NotarizationPlugin = class {
|
|
|
4155
4150
|
log14("extension closed", {
|
|
4156
4151
|
peer: extension.localPeerId
|
|
4157
4152
|
}, {
|
|
4158
|
-
F:
|
|
4153
|
+
F: __dxlog_file17,
|
|
4159
4154
|
L: 216,
|
|
4160
4155
|
S: this,
|
|
4161
4156
|
C: (f, a) => f(...a)
|
|
@@ -4272,10 +4267,13 @@ function _using_ctx() {
|
|
|
4272
4267
|
}
|
|
4273
4268
|
};
|
|
4274
4269
|
}
|
|
4275
|
-
var
|
|
4270
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4276
4271
|
var DataSpace = class {
|
|
4277
4272
|
constructor(params) {
|
|
4278
|
-
this._ctx = new Context8(
|
|
4273
|
+
this._ctx = new Context8(void 0, {
|
|
4274
|
+
F: __dxlog_file18,
|
|
4275
|
+
L: 84
|
|
4276
|
+
});
|
|
4279
4277
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4280
4278
|
this._cache = void 0;
|
|
4281
4279
|
// TODO(dmaretskyi): Move into Space?
|
|
@@ -4309,7 +4307,7 @@ var DataSpace = class {
|
|
|
4309
4307
|
log15("new state", {
|
|
4310
4308
|
state: SpaceState2[this._state]
|
|
4311
4309
|
}, {
|
|
4312
|
-
F:
|
|
4310
|
+
F: __dxlog_file18,
|
|
4313
4311
|
L: 146,
|
|
4314
4312
|
S: this,
|
|
4315
4313
|
C: (f, a) => f(...a)
|
|
@@ -4364,12 +4362,15 @@ var DataSpace = class {
|
|
|
4364
4362
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4365
4363
|
await this._automergeSpaceState.open();
|
|
4366
4364
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4367
|
-
await this._inner.open(new Context8(
|
|
4365
|
+
await this._inner.open(new Context8(void 0, {
|
|
4366
|
+
F: __dxlog_file18,
|
|
4367
|
+
L: 215
|
|
4368
|
+
}));
|
|
4368
4369
|
this._state = SpaceState2.CONTROL_ONLY;
|
|
4369
4370
|
log15("new state", {
|
|
4370
4371
|
state: SpaceState2[this._state]
|
|
4371
4372
|
}, {
|
|
4372
|
-
F:
|
|
4373
|
+
F: __dxlog_file18,
|
|
4373
4374
|
L: 217,
|
|
4374
4375
|
S: this,
|
|
4375
4376
|
C: (f, a) => f(...a)
|
|
@@ -4387,13 +4388,16 @@ var DataSpace = class {
|
|
|
4387
4388
|
log15("new state", {
|
|
4388
4389
|
state: SpaceState2[this._state]
|
|
4389
4390
|
}, {
|
|
4390
|
-
F:
|
|
4391
|
+
F: __dxlog_file18,
|
|
4391
4392
|
L: 231,
|
|
4392
4393
|
S: this,
|
|
4393
4394
|
C: (f, a) => f(...a)
|
|
4394
4395
|
});
|
|
4395
4396
|
await this._ctx.dispose();
|
|
4396
|
-
this._ctx = new Context8(
|
|
4397
|
+
this._ctx = new Context8(void 0, {
|
|
4398
|
+
F: __dxlog_file18,
|
|
4399
|
+
L: 233
|
|
4400
|
+
});
|
|
4397
4401
|
await this.authVerifier.close();
|
|
4398
4402
|
await this._inner.close();
|
|
4399
4403
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -4420,7 +4424,7 @@ var DataSpace = class {
|
|
|
4420
4424
|
} catch (err) {
|
|
4421
4425
|
if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
|
|
4422
4426
|
log15("data pipeline initialization cancelled", err, {
|
|
4423
|
-
F:
|
|
4427
|
+
F: __dxlog_file18,
|
|
4424
4428
|
L: 265,
|
|
4425
4429
|
S: this,
|
|
4426
4430
|
C: (f, a) => f(...a)
|
|
@@ -4428,7 +4432,7 @@ var DataSpace = class {
|
|
|
4428
4432
|
return;
|
|
4429
4433
|
}
|
|
4430
4434
|
log15.error("Error initializing data pipeline", err, {
|
|
4431
|
-
F:
|
|
4435
|
+
F: __dxlog_file18,
|
|
4432
4436
|
L: 269,
|
|
4433
4437
|
S: this,
|
|
4434
4438
|
C: (f, a) => f(...a)
|
|
@@ -4437,7 +4441,7 @@ var DataSpace = class {
|
|
|
4437
4441
|
log15("new state", {
|
|
4438
4442
|
state: SpaceState2[this._state]
|
|
4439
4443
|
}, {
|
|
4440
|
-
F:
|
|
4444
|
+
F: __dxlog_file18,
|
|
4441
4445
|
L: 271,
|
|
4442
4446
|
S: this,
|
|
4443
4447
|
C: (f, a) => f(...a)
|
|
@@ -4457,7 +4461,7 @@ var DataSpace = class {
|
|
|
4457
4461
|
log15("new state", {
|
|
4458
4462
|
state: SpaceState2[this._state]
|
|
4459
4463
|
}, {
|
|
4460
|
-
F:
|
|
4464
|
+
F: __dxlog_file18,
|
|
4461
4465
|
L: 287,
|
|
4462
4466
|
S: this,
|
|
4463
4467
|
C: (f, a) => f(...a)
|
|
@@ -4474,7 +4478,7 @@ var DataSpace = class {
|
|
|
4474
4478
|
log15("new state", {
|
|
4475
4479
|
state: SpaceState2[this._state]
|
|
4476
4480
|
}, {
|
|
4477
|
-
F:
|
|
4481
|
+
F: __dxlog_file18,
|
|
4478
4482
|
L: 306,
|
|
4479
4483
|
S: this,
|
|
4480
4484
|
C: (f, a) => f(...a)
|
|
@@ -4490,7 +4494,7 @@ var DataSpace = class {
|
|
|
4490
4494
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4491
4495
|
await this._createWritableFeeds();
|
|
4492
4496
|
log15("writable feeds created", void 0, {
|
|
4493
|
-
F:
|
|
4497
|
+
F: __dxlog_file18,
|
|
4494
4498
|
L: 322,
|
|
4495
4499
|
S: this,
|
|
4496
4500
|
C: (f, a) => f(...a)
|
|
@@ -4553,7 +4557,7 @@ var DataSpace = class {
|
|
|
4553
4557
|
space: this.key,
|
|
4554
4558
|
rootUrl
|
|
4555
4559
|
}, {
|
|
4556
|
-
F:
|
|
4560
|
+
F: __dxlog_file18,
|
|
4557
4561
|
L: 388,
|
|
4558
4562
|
S: this,
|
|
4559
4563
|
C: (f, a) => f(...a)
|
|
@@ -4607,7 +4611,7 @@ var DataSpace = class {
|
|
|
4607
4611
|
rootUrl,
|
|
4608
4612
|
err
|
|
4609
4613
|
}, {
|
|
4610
|
-
F:
|
|
4614
|
+
F: __dxlog_file18,
|
|
4611
4615
|
L: 431,
|
|
4612
4616
|
S: this,
|
|
4613
4617
|
C: (f, a) => f(...a)
|
|
@@ -4693,7 +4697,7 @@ var DataSpace = class {
|
|
|
4693
4697
|
log15("new state", {
|
|
4694
4698
|
state: SpaceState2[this._state]
|
|
4695
4699
|
}, {
|
|
4696
|
-
F:
|
|
4700
|
+
F: __dxlog_file18,
|
|
4697
4701
|
L: 512,
|
|
4698
4702
|
S: this,
|
|
4699
4703
|
C: (f, a) => f(...a)
|
|
@@ -4754,15 +4758,17 @@ DataSpace = _ts_decorate4([
|
|
|
4754
4758
|
import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
4755
4759
|
import { PropertiesType } from "@dxos/client-protocol";
|
|
4756
4760
|
import { Context as Context9, cancelWithContext as cancelWithContext6 } from "@dxos/context";
|
|
4757
|
-
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4761
|
+
import { getCredentialAssertion as getCredentialAssertion3, createAdmissionCredentials } from "@dxos/credentials";
|
|
4758
4762
|
import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2 } from "@dxos/echo-db";
|
|
4759
4763
|
import { AuthStatus } from "@dxos/echo-pipeline";
|
|
4764
|
+
import { CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
4760
4765
|
import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
|
|
4761
4766
|
import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
|
|
4767
|
+
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
4762
4768
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4763
4769
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4764
4770
|
import { log as log16 } from "@dxos/log";
|
|
4765
|
-
import { trace as Trace2 } from "@dxos/protocols";
|
|
4771
|
+
import { trace as Trace2, AlreadyJoinedError as AlreadyJoinedError3 } from "@dxos/protocols";
|
|
4766
4772
|
import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4767
4773
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4768
4774
|
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
@@ -4850,7 +4856,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4850
4856
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4851
4857
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4852
4858
|
}
|
|
4853
|
-
var
|
|
4859
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4854
4860
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4855
4861
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4856
4862
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4864,7 +4870,10 @@ var DataSpaceManager = class {
|
|
|
4864
4870
|
this._echoHost = _echoHost;
|
|
4865
4871
|
this._invitationsManager = _invitationsManager;
|
|
4866
4872
|
this._params = _params;
|
|
4867
|
-
this._ctx = new Context9(
|
|
4873
|
+
this._ctx = new Context9(void 0, {
|
|
4874
|
+
F: __dxlog_file19,
|
|
4875
|
+
L: 104
|
|
4876
|
+
});
|
|
4868
4877
|
this.updated = new Event7();
|
|
4869
4878
|
this._spaces = new ComplexMap3(PublicKey11.hash);
|
|
4870
4879
|
this._isOpen = false;
|
|
@@ -4898,24 +4907,24 @@ var DataSpaceManager = class {
|
|
|
4898
4907
|
}
|
|
4899
4908
|
async open() {
|
|
4900
4909
|
log16("open", void 0, {
|
|
4901
|
-
F:
|
|
4902
|
-
L:
|
|
4910
|
+
F: __dxlog_file19,
|
|
4911
|
+
L: 156,
|
|
4903
4912
|
S: this,
|
|
4904
4913
|
C: (f, a) => f(...a)
|
|
4905
4914
|
});
|
|
4906
4915
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
4907
4916
|
id: this._instanceId
|
|
4908
4917
|
}), {
|
|
4909
|
-
F:
|
|
4910
|
-
L:
|
|
4918
|
+
F: __dxlog_file19,
|
|
4919
|
+
L: 157,
|
|
4911
4920
|
S: this,
|
|
4912
4921
|
C: (f, a) => f(...a)
|
|
4913
4922
|
});
|
|
4914
4923
|
log16("metadata loaded", {
|
|
4915
4924
|
spaces: this._metadataStore.spaces.length
|
|
4916
4925
|
}, {
|
|
4917
|
-
F:
|
|
4918
|
-
L:
|
|
4926
|
+
F: __dxlog_file19,
|
|
4927
|
+
L: 158,
|
|
4919
4928
|
S: this,
|
|
4920
4929
|
C: (f, a) => f(...a)
|
|
4921
4930
|
});
|
|
@@ -4924,8 +4933,8 @@ var DataSpaceManager = class {
|
|
|
4924
4933
|
log16("load space", {
|
|
4925
4934
|
spaceMetadata
|
|
4926
4935
|
}, {
|
|
4927
|
-
F:
|
|
4928
|
-
L:
|
|
4936
|
+
F: __dxlog_file19,
|
|
4937
|
+
L: 162,
|
|
4929
4938
|
S: this,
|
|
4930
4939
|
C: (f, a) => f(...a)
|
|
4931
4940
|
});
|
|
@@ -4935,8 +4944,8 @@ var DataSpaceManager = class {
|
|
|
4935
4944
|
spaceMetadata,
|
|
4936
4945
|
err
|
|
4937
4946
|
}, {
|
|
4938
|
-
F:
|
|
4939
|
-
L:
|
|
4947
|
+
F: __dxlog_file19,
|
|
4948
|
+
L: 165,
|
|
4940
4949
|
S: this,
|
|
4941
4950
|
C: (f, a) => f(...a)
|
|
4942
4951
|
});
|
|
@@ -4947,16 +4956,16 @@ var DataSpaceManager = class {
|
|
|
4947
4956
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
4948
4957
|
id: this._instanceId
|
|
4949
4958
|
}), {
|
|
4950
|
-
F:
|
|
4951
|
-
L:
|
|
4959
|
+
F: __dxlog_file19,
|
|
4960
|
+
L: 172,
|
|
4952
4961
|
S: this,
|
|
4953
4962
|
C: (f, a) => f(...a)
|
|
4954
4963
|
});
|
|
4955
4964
|
}
|
|
4956
4965
|
async close() {
|
|
4957
4966
|
log16("close", void 0, {
|
|
4958
|
-
F:
|
|
4959
|
-
L:
|
|
4967
|
+
F: __dxlog_file19,
|
|
4968
|
+
L: 177,
|
|
4960
4969
|
S: this,
|
|
4961
4970
|
C: (f, a) => f(...a)
|
|
4962
4971
|
});
|
|
@@ -4972,8 +4981,8 @@ var DataSpaceManager = class {
|
|
|
4972
4981
|
*/
|
|
4973
4982
|
async createSpace() {
|
|
4974
4983
|
invariant14(this._isOpen, "Not open.", {
|
|
4975
|
-
F:
|
|
4976
|
-
L:
|
|
4984
|
+
F: __dxlog_file19,
|
|
4985
|
+
L: 191,
|
|
4977
4986
|
S: this,
|
|
4978
4987
|
A: [
|
|
4979
4988
|
"this._isOpen",
|
|
@@ -4993,8 +5002,8 @@ var DataSpaceManager = class {
|
|
|
4993
5002
|
log16("creating space...", {
|
|
4994
5003
|
spaceKey
|
|
4995
5004
|
}, {
|
|
4996
|
-
F:
|
|
4997
|
-
L:
|
|
5005
|
+
F: __dxlog_file19,
|
|
5006
|
+
L: 203,
|
|
4998
5007
|
S: this,
|
|
4999
5008
|
C: (f, a) => f(...a)
|
|
5000
5009
|
});
|
|
@@ -5005,8 +5014,8 @@ var DataSpaceManager = class {
|
|
|
5005
5014
|
await this._metadataStore.addSpace(metadata);
|
|
5006
5015
|
const memberCredential = credentials[1];
|
|
5007
5016
|
invariant14(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5008
|
-
F:
|
|
5009
|
-
L:
|
|
5017
|
+
F: __dxlog_file19,
|
|
5018
|
+
L: 213,
|
|
5010
5019
|
S: this,
|
|
5011
5020
|
A: [
|
|
5012
5021
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -5037,8 +5046,8 @@ var DataSpaceManager = class {
|
|
|
5037
5046
|
version: space.databaseRoot.getVersion(),
|
|
5038
5047
|
spaceId: space.id
|
|
5039
5048
|
}, {
|
|
5040
|
-
F:
|
|
5041
|
-
L:
|
|
5049
|
+
F: __dxlog_file19,
|
|
5050
|
+
L: 238,
|
|
5042
5051
|
S: this,
|
|
5043
5052
|
C: (f, a) => f(...a)
|
|
5044
5053
|
});
|
|
@@ -5072,8 +5081,8 @@ var DataSpaceManager = class {
|
|
|
5072
5081
|
async _getSpaceRootDocument(space) {
|
|
5073
5082
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5074
5083
|
invariant14(automergeIndex, void 0, {
|
|
5075
|
-
F:
|
|
5076
|
-
L:
|
|
5084
|
+
F: __dxlog_file19,
|
|
5085
|
+
L: 271,
|
|
5077
5086
|
S: this,
|
|
5078
5087
|
A: [
|
|
5079
5088
|
"automergeIndex",
|
|
@@ -5089,14 +5098,14 @@ var DataSpaceManager = class {
|
|
|
5089
5098
|
log16("accept space", {
|
|
5090
5099
|
opts
|
|
5091
5100
|
}, {
|
|
5092
|
-
F:
|
|
5093
|
-
L:
|
|
5101
|
+
F: __dxlog_file19,
|
|
5102
|
+
L: 280,
|
|
5094
5103
|
S: this,
|
|
5095
5104
|
C: (f, a) => f(...a)
|
|
5096
5105
|
});
|
|
5097
5106
|
invariant14(this._isOpen, "Not open.", {
|
|
5098
|
-
F:
|
|
5099
|
-
L:
|
|
5107
|
+
F: __dxlog_file19,
|
|
5108
|
+
L: 281,
|
|
5100
5109
|
S: this,
|
|
5101
5110
|
A: [
|
|
5102
5111
|
"this._isOpen",
|
|
@@ -5104,8 +5113,8 @@ var DataSpaceManager = class {
|
|
|
5104
5113
|
]
|
|
5105
5114
|
});
|
|
5106
5115
|
invariant14(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5107
|
-
F:
|
|
5108
|
-
L:
|
|
5116
|
+
F: __dxlog_file19,
|
|
5117
|
+
L: 282,
|
|
5109
5118
|
S: this,
|
|
5110
5119
|
A: [
|
|
5111
5120
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5125,6 +5134,43 @@ var DataSpaceManager = class {
|
|
|
5125
5134
|
this.updated.emit();
|
|
5126
5135
|
return space;
|
|
5127
5136
|
}
|
|
5137
|
+
async admitMember(options) {
|
|
5138
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5139
|
+
invariant14(space, void 0, {
|
|
5140
|
+
F: __dxlog_file19,
|
|
5141
|
+
L: 302,
|
|
5142
|
+
S: this,
|
|
5143
|
+
A: [
|
|
5144
|
+
"space",
|
|
5145
|
+
""
|
|
5146
|
+
]
|
|
5147
|
+
});
|
|
5148
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== SpaceMember6.Role.REMOVED) {
|
|
5149
|
+
throw new AlreadyJoinedError3();
|
|
5150
|
+
}
|
|
5151
|
+
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5152
|
+
invariant14(credentials[0].credential, void 0, {
|
|
5153
|
+
F: __dxlog_file19,
|
|
5154
|
+
L: 321,
|
|
5155
|
+
S: this,
|
|
5156
|
+
A: [
|
|
5157
|
+
"credentials[0].credential",
|
|
5158
|
+
""
|
|
5159
|
+
]
|
|
5160
|
+
});
|
|
5161
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5162
|
+
invariant14(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5163
|
+
F: __dxlog_file19,
|
|
5164
|
+
L: 323,
|
|
5165
|
+
S: this,
|
|
5166
|
+
A: [
|
|
5167
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5168
|
+
""
|
|
5169
|
+
]
|
|
5170
|
+
});
|
|
5171
|
+
await writeMessages3(space.controlPipeline.writer, credentials);
|
|
5172
|
+
return spaceMemberCredential;
|
|
5173
|
+
}
|
|
5128
5174
|
/**
|
|
5129
5175
|
* Wait until the space data pipeline is fully initialized.
|
|
5130
5176
|
* Used by invitation handler.
|
|
@@ -5136,12 +5182,24 @@ var DataSpaceManager = class {
|
|
|
5136
5182
|
return !!space && space.state === SpaceState3.READY;
|
|
5137
5183
|
}));
|
|
5138
5184
|
}
|
|
5185
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5186
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5187
|
+
spaceKey,
|
|
5188
|
+
identityKey: this._signingContext.identityKey,
|
|
5189
|
+
timeout: 15e3,
|
|
5190
|
+
swarmIdentity: {
|
|
5191
|
+
peerKey: this._signingContext.deviceKey,
|
|
5192
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5193
|
+
credentialAuthenticator: async () => true
|
|
5194
|
+
}
|
|
5195
|
+
});
|
|
5196
|
+
}
|
|
5139
5197
|
async _constructSpace(metadata) {
|
|
5140
5198
|
log16("construct space", {
|
|
5141
5199
|
metadata
|
|
5142
5200
|
}, {
|
|
5143
|
-
F:
|
|
5144
|
-
L:
|
|
5201
|
+
F: __dxlog_file19,
|
|
5202
|
+
L: 358,
|
|
5145
5203
|
S: this,
|
|
5146
5204
|
C: (f, a) => f(...a)
|
|
5147
5205
|
});
|
|
@@ -5169,6 +5227,7 @@ var DataSpaceManager = class {
|
|
|
5169
5227
|
credentialAuthenticator: deferFunction2(() => dataSpace.authVerifier.verifier)
|
|
5170
5228
|
},
|
|
5171
5229
|
onAuthorizedConnection: (session) => {
|
|
5230
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialServerExtension(space));
|
|
5172
5231
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5173
5232
|
remotePeerId: session.remotePeerId
|
|
5174
5233
|
}));
|
|
@@ -5178,8 +5237,8 @@ var DataSpaceManager = class {
|
|
|
5178
5237
|
},
|
|
5179
5238
|
onAuthFailure: () => {
|
|
5180
5239
|
log16.warn("auth failure", void 0, {
|
|
5181
|
-
F:
|
|
5182
|
-
L:
|
|
5240
|
+
F: __dxlog_file19,
|
|
5241
|
+
L: 396,
|
|
5183
5242
|
S: this,
|
|
5184
5243
|
C: (f, a) => f(...a)
|
|
5185
5244
|
});
|
|
@@ -5211,8 +5270,8 @@ var DataSpaceManager = class {
|
|
|
5211
5270
|
log16("before space ready", {
|
|
5212
5271
|
space: space.key
|
|
5213
5272
|
}, {
|
|
5214
|
-
F:
|
|
5215
|
-
L:
|
|
5273
|
+
F: __dxlog_file19,
|
|
5274
|
+
L: 423,
|
|
5216
5275
|
S: this,
|
|
5217
5276
|
C: (f, a) => f(...a)
|
|
5218
5277
|
});
|
|
@@ -5222,8 +5281,8 @@ var DataSpaceManager = class {
|
|
|
5222
5281
|
space: space.key,
|
|
5223
5282
|
open: this._isOpen
|
|
5224
5283
|
}, {
|
|
5225
|
-
F:
|
|
5226
|
-
L:
|
|
5284
|
+
F: __dxlog_file19,
|
|
5285
|
+
L: 426,
|
|
5227
5286
|
S: this,
|
|
5228
5287
|
C: (f, a) => f(...a)
|
|
5229
5288
|
});
|
|
@@ -5241,8 +5300,8 @@ var DataSpaceManager = class {
|
|
|
5241
5300
|
log16("before space close", {
|
|
5242
5301
|
space: space.key
|
|
5243
5302
|
}, {
|
|
5244
|
-
F:
|
|
5245
|
-
L:
|
|
5303
|
+
F: __dxlog_file19,
|
|
5304
|
+
L: 434,
|
|
5246
5305
|
S: this,
|
|
5247
5306
|
C: (f, a) => f(...a)
|
|
5248
5307
|
});
|
|
@@ -5282,8 +5341,8 @@ var DataSpaceManager = class {
|
|
|
5282
5341
|
peersOnline: presence.getPeersOnline().length,
|
|
5283
5342
|
closedSessions
|
|
5284
5343
|
}, {
|
|
5285
|
-
F:
|
|
5286
|
-
L:
|
|
5344
|
+
F: __dxlog_file19,
|
|
5345
|
+
L: 470,
|
|
5287
5346
|
S: this,
|
|
5288
5347
|
C: (f, a) => f(...a)
|
|
5289
5348
|
});
|
|
@@ -5297,8 +5356,8 @@ var DataSpaceManager = class {
|
|
|
5297
5356
|
log16("closing a session with a removed peer", {
|
|
5298
5357
|
peerId: peerState.peerId
|
|
5299
5358
|
}, {
|
|
5300
|
-
F:
|
|
5301
|
-
L:
|
|
5359
|
+
F: __dxlog_file19,
|
|
5360
|
+
L: 484,
|
|
5302
5361
|
S: this,
|
|
5303
5362
|
C: (f, a) => f(...a)
|
|
5304
5363
|
});
|
|
@@ -5363,13 +5422,13 @@ import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTas
|
|
|
5363
5422
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
5364
5423
|
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
|
|
5365
5424
|
import { raise as raise2 } from "@dxos/debug";
|
|
5366
|
-
import { writeMessages as
|
|
5425
|
+
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
5367
5426
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
5368
5427
|
import { log as log17 } from "@dxos/log";
|
|
5369
5428
|
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
5370
5429
|
import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5371
5430
|
import { trace as trace8 } from "@dxos/tracing";
|
|
5372
|
-
var
|
|
5431
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5373
5432
|
var SpacesServiceImpl = class {
|
|
5374
5433
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5375
5434
|
this._identityManager = _identityManager;
|
|
@@ -5413,8 +5472,8 @@ var SpacesServiceImpl = class {
|
|
|
5413
5472
|
}
|
|
5414
5473
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5415
5474
|
invariant15(credentials[0].credential, void 0, {
|
|
5416
|
-
F:
|
|
5417
|
-
L:
|
|
5475
|
+
F: __dxlog_file20,
|
|
5476
|
+
L: 102,
|
|
5418
5477
|
S: this,
|
|
5419
5478
|
A: [
|
|
5420
5479
|
"credentials[0].credential",
|
|
@@ -5423,15 +5482,15 @@ var SpacesServiceImpl = class {
|
|
|
5423
5482
|
});
|
|
5424
5483
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5425
5484
|
invariant15(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5426
|
-
F:
|
|
5427
|
-
L:
|
|
5485
|
+
F: __dxlog_file20,
|
|
5486
|
+
L: 104,
|
|
5428
5487
|
S: this,
|
|
5429
5488
|
A: [
|
|
5430
5489
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5431
5490
|
""
|
|
5432
5491
|
]
|
|
5433
5492
|
});
|
|
5434
|
-
await
|
|
5493
|
+
await writeMessages4(space.controlPipeline.writer, credentials);
|
|
5435
5494
|
}
|
|
5436
5495
|
querySpaces() {
|
|
5437
5496
|
return new Stream10(({ next, ctx }) => {
|
|
@@ -5441,8 +5500,8 @@ var SpacesServiceImpl = class {
|
|
|
5441
5500
|
log17("update", {
|
|
5442
5501
|
spaces
|
|
5443
5502
|
}, {
|
|
5444
|
-
F:
|
|
5445
|
-
L:
|
|
5503
|
+
F: __dxlog_file20,
|
|
5504
|
+
L: 115,
|
|
5446
5505
|
S: this,
|
|
5447
5506
|
C: (f, a) => f(...a)
|
|
5448
5507
|
});
|
|
@@ -5533,8 +5592,8 @@ var SpacesServiceImpl = class {
|
|
|
5533
5592
|
});
|
|
5534
5593
|
} else {
|
|
5535
5594
|
invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5536
|
-
F:
|
|
5537
|
-
L:
|
|
5595
|
+
F: __dxlog_file20,
|
|
5596
|
+
L: 213,
|
|
5538
5597
|
S: this,
|
|
5539
5598
|
A: [
|
|
5540
5599
|
"!credential.id",
|
|
@@ -5542,8 +5601,8 @@ var SpacesServiceImpl = class {
|
|
|
5542
5601
|
]
|
|
5543
5602
|
});
|
|
5544
5603
|
invariant15(this._identityManager.identity, "Identity is not available", {
|
|
5545
|
-
F:
|
|
5546
|
-
L:
|
|
5604
|
+
F: __dxlog_file20,
|
|
5605
|
+
L: 214,
|
|
5547
5606
|
S: this,
|
|
5548
5607
|
A: [
|
|
5549
5608
|
"this._identityManager.identity",
|
|
@@ -5552,8 +5611,8 @@ var SpacesServiceImpl = class {
|
|
|
5552
5611
|
});
|
|
5553
5612
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5554
5613
|
invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5555
|
-
F:
|
|
5556
|
-
L:
|
|
5614
|
+
F: __dxlog_file20,
|
|
5615
|
+
L: 216,
|
|
5557
5616
|
S: this,
|
|
5558
5617
|
A: [
|
|
5559
5618
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5583,6 +5642,59 @@ var SpacesServiceImpl = class {
|
|
|
5583
5642
|
epochCredential: credential ?? void 0
|
|
5584
5643
|
};
|
|
5585
5644
|
}
|
|
5645
|
+
async admitContact(request) {
|
|
5646
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5647
|
+
await dataSpaceManager.admitMember({
|
|
5648
|
+
spaceKey: request.spaceKey,
|
|
5649
|
+
identityKey: request.contact.identityKey,
|
|
5650
|
+
role: request.role
|
|
5651
|
+
});
|
|
5652
|
+
}
|
|
5653
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5654
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5655
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5656
|
+
return this._joinByAdmission({
|
|
5657
|
+
credential
|
|
5658
|
+
});
|
|
5659
|
+
}
|
|
5660
|
+
async _joinByAdmission({ credential }) {
|
|
5661
|
+
const assertion = getCredentialAssertion4(credential);
|
|
5662
|
+
invariant15(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5663
|
+
F: __dxlog_file20,
|
|
5664
|
+
L: 250,
|
|
5665
|
+
S: this,
|
|
5666
|
+
A: [
|
|
5667
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5668
|
+
"'Invalid credential'"
|
|
5669
|
+
]
|
|
5670
|
+
});
|
|
5671
|
+
const myIdentity = this._identityManager.identity;
|
|
5672
|
+
invariant15(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5673
|
+
F: __dxlog_file20,
|
|
5674
|
+
L: 252,
|
|
5675
|
+
S: this,
|
|
5676
|
+
A: [
|
|
5677
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5678
|
+
""
|
|
5679
|
+
]
|
|
5680
|
+
});
|
|
5681
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5682
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5683
|
+
if (!dataSpace) {
|
|
5684
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5685
|
+
spaceKey: assertion.spaceKey,
|
|
5686
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5687
|
+
});
|
|
5688
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5689
|
+
credential: {
|
|
5690
|
+
credential
|
|
5691
|
+
}
|
|
5692
|
+
});
|
|
5693
|
+
}
|
|
5694
|
+
return {
|
|
5695
|
+
space: this._serializeSpace(dataSpace)
|
|
5696
|
+
};
|
|
5697
|
+
}
|
|
5586
5698
|
_serializeSpace(space) {
|
|
5587
5699
|
return {
|
|
5588
5700
|
id: space.id,
|
|
@@ -5670,7 +5782,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5670
5782
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5671
5783
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5672
5784
|
}
|
|
5673
|
-
var
|
|
5785
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5674
5786
|
var ServiceContext = class extends Resource3 {
|
|
5675
5787
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5676
5788
|
super();
|
|
@@ -5714,7 +5826,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5714
5826
|
async _open(ctx) {
|
|
5715
5827
|
await this._checkStorageVersion();
|
|
5716
5828
|
log18("opening...", void 0, {
|
|
5717
|
-
F:
|
|
5829
|
+
F: __dxlog_file21,
|
|
5718
5830
|
L: 149,
|
|
5719
5831
|
S: this,
|
|
5720
5832
|
C: (f, a) => f(...a)
|
|
@@ -5722,7 +5834,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5722
5834
|
log18.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
5723
5835
|
id: this._instanceId
|
|
5724
5836
|
}), {
|
|
5725
|
-
F:
|
|
5837
|
+
F: __dxlog_file21,
|
|
5726
5838
|
L: 150,
|
|
5727
5839
|
S: this,
|
|
5728
5840
|
C: (f, a) => f(...a)
|
|
@@ -5740,7 +5852,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5740
5852
|
log18("loaded persistent invitations", {
|
|
5741
5853
|
count: loadedInvitations.invitations?.length
|
|
5742
5854
|
}, {
|
|
5743
|
-
F:
|
|
5855
|
+
F: __dxlog_file21,
|
|
5744
5856
|
L: 163,
|
|
5745
5857
|
S: this,
|
|
5746
5858
|
C: (f, a) => f(...a)
|
|
@@ -5748,13 +5860,13 @@ var ServiceContext = class extends Resource3 {
|
|
|
5748
5860
|
log18.trace("dxos.sdk.service-context.open", trace9.end({
|
|
5749
5861
|
id: this._instanceId
|
|
5750
5862
|
}), {
|
|
5751
|
-
F:
|
|
5863
|
+
F: __dxlog_file21,
|
|
5752
5864
|
L: 165,
|
|
5753
5865
|
S: this,
|
|
5754
5866
|
C: (f, a) => f(...a)
|
|
5755
5867
|
});
|
|
5756
5868
|
log18("opened", void 0, {
|
|
5757
|
-
F:
|
|
5869
|
+
F: __dxlog_file21,
|
|
5758
5870
|
L: 166,
|
|
5759
5871
|
S: this,
|
|
5760
5872
|
C: (f, a) => f(...a)
|
|
@@ -5762,7 +5874,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5762
5874
|
}
|
|
5763
5875
|
async _close(ctx) {
|
|
5764
5876
|
log18("closing...", void 0, {
|
|
5765
|
-
F:
|
|
5877
|
+
F: __dxlog_file21,
|
|
5766
5878
|
L: 170,
|
|
5767
5879
|
S: this,
|
|
5768
5880
|
C: (f, a) => f(...a)
|
|
@@ -5779,7 +5891,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5779
5891
|
await this.networkManager.close();
|
|
5780
5892
|
await this.signalManager.close();
|
|
5781
5893
|
log18("closed", void 0, {
|
|
5782
|
-
F:
|
|
5894
|
+
F: __dxlog_file21,
|
|
5783
5895
|
L: 182,
|
|
5784
5896
|
S: this,
|
|
5785
5897
|
C: (f, a) => f(...a)
|
|
@@ -5787,13 +5899,16 @@ var ServiceContext = class extends Resource3 {
|
|
|
5787
5899
|
}
|
|
5788
5900
|
async createIdentity(params = {}) {
|
|
5789
5901
|
const identity = await this.identityManager.createIdentity(params);
|
|
5790
|
-
await this._initialize(new Context10(
|
|
5902
|
+
await this._initialize(new Context10(void 0, {
|
|
5903
|
+
F: __dxlog_file21,
|
|
5904
|
+
L: 187
|
|
5905
|
+
}));
|
|
5791
5906
|
return identity;
|
|
5792
5907
|
}
|
|
5793
5908
|
getInvitationHandler(invitation) {
|
|
5794
5909
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5795
5910
|
invariant16(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5796
|
-
F:
|
|
5911
|
+
F: __dxlog_file21,
|
|
5797
5912
|
L: 193,
|
|
5798
5913
|
S: this,
|
|
5799
5914
|
A: [
|
|
@@ -5813,7 +5928,10 @@ var ServiceContext = class extends Resource3 {
|
|
|
5813
5928
|
}
|
|
5814
5929
|
async _acceptIdentity(params) {
|
|
5815
5930
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5816
|
-
await this._initialize(new Context10(
|
|
5931
|
+
await this._initialize(new Context10(void 0, {
|
|
5932
|
+
F: __dxlog_file21,
|
|
5933
|
+
L: 209
|
|
5934
|
+
}));
|
|
5817
5935
|
return identity;
|
|
5818
5936
|
}
|
|
5819
5937
|
async _checkStorageVersion() {
|
|
@@ -5825,7 +5943,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5825
5943
|
// Called when identity is created.
|
|
5826
5944
|
async _initialize(ctx) {
|
|
5827
5945
|
log18("initializing spaces...", void 0, {
|
|
5828
|
-
F:
|
|
5946
|
+
F: __dxlog_file21,
|
|
5829
5947
|
L: 224,
|
|
5830
5948
|
S: this,
|
|
5831
5949
|
C: (f, a) => f(...a)
|
|
@@ -5848,7 +5966,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5848
5966
|
await this.dataSpaceManager.open();
|
|
5849
5967
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
5850
5968
|
invariant16(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5851
|
-
F:
|
|
5969
|
+
F: __dxlog_file21,
|
|
5852
5970
|
L: 249,
|
|
5853
5971
|
S: this,
|
|
5854
5972
|
A: [
|
|
@@ -5872,7 +5990,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5872
5990
|
log18("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5873
5991
|
details: assertion
|
|
5874
5992
|
}, {
|
|
5875
|
-
F:
|
|
5993
|
+
F: __dxlog_file21,
|
|
5876
5994
|
L: 265,
|
|
5877
5995
|
S: this,
|
|
5878
5996
|
C: (f, a) => f(...a)
|
|
@@ -5883,7 +6001,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5883
6001
|
log18("space already exists, ignoring space admission", {
|
|
5884
6002
|
details: assertion
|
|
5885
6003
|
}, {
|
|
5886
|
-
F:
|
|
6004
|
+
F: __dxlog_file21,
|
|
5887
6005
|
L: 269,
|
|
5888
6006
|
S: this,
|
|
5889
6007
|
C: (f, a) => f(...a)
|
|
@@ -5894,7 +6012,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5894
6012
|
log18("accepting space recorded in halo", {
|
|
5895
6013
|
details: assertion
|
|
5896
6014
|
}, {
|
|
5897
|
-
F:
|
|
6015
|
+
F: __dxlog_file21,
|
|
5898
6016
|
L: 274,
|
|
5899
6017
|
S: this,
|
|
5900
6018
|
C: (f, a) => f(...a)
|
|
@@ -5905,7 +6023,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5905
6023
|
});
|
|
5906
6024
|
} catch (err) {
|
|
5907
6025
|
log18.catch(err, void 0, {
|
|
5908
|
-
F:
|
|
6026
|
+
F: __dxlog_file21,
|
|
5909
6027
|
L: 280,
|
|
5910
6028
|
S: this,
|
|
5911
6029
|
C: (f, a) => f(...a)
|
|
@@ -5965,7 +6083,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5965
6083
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5966
6084
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5967
6085
|
}
|
|
5968
|
-
var
|
|
6086
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
|
|
5969
6087
|
var Message;
|
|
5970
6088
|
(function(Message2) {
|
|
5971
6089
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -5988,28 +6106,28 @@ var Lock = class {
|
|
|
5988
6106
|
});
|
|
5989
6107
|
try {
|
|
5990
6108
|
log19("aquiring lock...", void 0, {
|
|
5991
|
-
F:
|
|
6109
|
+
F: __dxlog_file22,
|
|
5992
6110
|
L: 42,
|
|
5993
6111
|
S: this,
|
|
5994
6112
|
C: (f, a) => f(...a)
|
|
5995
6113
|
});
|
|
5996
6114
|
await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
|
|
5997
6115
|
log19("acquired lock", void 0, {
|
|
5998
|
-
F:
|
|
6116
|
+
F: __dxlog_file22,
|
|
5999
6117
|
L: 44,
|
|
6000
6118
|
S: this,
|
|
6001
6119
|
C: (f, a) => f(...a)
|
|
6002
6120
|
});
|
|
6003
6121
|
} catch {
|
|
6004
6122
|
log19("stealing lock...", void 0, {
|
|
6005
|
-
F:
|
|
6123
|
+
F: __dxlog_file22,
|
|
6006
6124
|
L: 46,
|
|
6007
6125
|
S: this,
|
|
6008
6126
|
C: (f, a) => f(...a)
|
|
6009
6127
|
});
|
|
6010
6128
|
await this._requestLock(true);
|
|
6011
6129
|
log19("stolen lock", void 0, {
|
|
6012
|
-
F:
|
|
6130
|
+
F: __dxlog_file22,
|
|
6013
6131
|
L: 48,
|
|
6014
6132
|
S: this,
|
|
6015
6133
|
C: (f, a) => f(...a)
|
|
@@ -6028,7 +6146,7 @@ var Lock = class {
|
|
|
6028
6146
|
log19("requesting lock...", {
|
|
6029
6147
|
steal
|
|
6030
6148
|
}, {
|
|
6031
|
-
F:
|
|
6149
|
+
F: __dxlog_file22,
|
|
6032
6150
|
L: 63,
|
|
6033
6151
|
S: this,
|
|
6034
6152
|
C: (f, a) => f(...a)
|
|
@@ -6042,14 +6160,14 @@ var Lock = class {
|
|
|
6042
6160
|
this._releaseTrigger = new Trigger9();
|
|
6043
6161
|
await this._releaseTrigger.wait();
|
|
6044
6162
|
log19("releasing lock...", void 0, {
|
|
6045
|
-
F:
|
|
6163
|
+
F: __dxlog_file22,
|
|
6046
6164
|
L: 72,
|
|
6047
6165
|
S: this,
|
|
6048
6166
|
C: (f, a) => f(...a)
|
|
6049
6167
|
});
|
|
6050
6168
|
await this._onRelease?.();
|
|
6051
6169
|
log19("released lock", void 0, {
|
|
6052
|
-
F:
|
|
6170
|
+
F: __dxlog_file22,
|
|
6053
6171
|
L: 74,
|
|
6054
6172
|
S: this,
|
|
6055
6173
|
C: (f, a) => f(...a)
|
|
@@ -6061,7 +6179,7 @@ var Lock = class {
|
|
|
6061
6179
|
log19("recieved lock", {
|
|
6062
6180
|
steal
|
|
6063
6181
|
}, {
|
|
6064
|
-
F:
|
|
6182
|
+
F: __dxlog_file22,
|
|
6065
6183
|
L: 81,
|
|
6066
6184
|
S: this,
|
|
6067
6185
|
C: (f, a) => f(...a)
|
|
@@ -6149,13 +6267,151 @@ var createLevel = async (config) => {
|
|
|
6149
6267
|
return level;
|
|
6150
6268
|
};
|
|
6151
6269
|
|
|
6270
|
+
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
6271
|
+
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
6272
|
+
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6273
|
+
import { log as log20 } from "@dxos/log";
|
|
6274
|
+
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
6275
|
+
import { arrayToBuffer } from "@dxos/util";
|
|
6276
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6277
|
+
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
6278
|
+
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
6279
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6280
|
+
const archive = {
|
|
6281
|
+
storage: [],
|
|
6282
|
+
meta: {
|
|
6283
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6284
|
+
}
|
|
6285
|
+
};
|
|
6286
|
+
{
|
|
6287
|
+
const directory = await storage.createDirectory();
|
|
6288
|
+
const files = await directory.list();
|
|
6289
|
+
log20.info("begin exporting files", {
|
|
6290
|
+
count: files.length
|
|
6291
|
+
}, {
|
|
6292
|
+
F: __dxlog_file23,
|
|
6293
|
+
L: 30,
|
|
6294
|
+
S: void 0,
|
|
6295
|
+
C: (f, a) => f(...a)
|
|
6296
|
+
});
|
|
6297
|
+
for (const filename of files) {
|
|
6298
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6299
|
+
const { size } = await file.stat();
|
|
6300
|
+
const data = await file.read(0, size);
|
|
6301
|
+
archive.storage.push({
|
|
6302
|
+
type: ProfileArchiveEntryType.FILE,
|
|
6303
|
+
key: filename,
|
|
6304
|
+
value: data
|
|
6305
|
+
});
|
|
6306
|
+
}
|
|
6307
|
+
log20.info("done exporting files", {
|
|
6308
|
+
count: files.length
|
|
6309
|
+
}, {
|
|
6310
|
+
F: __dxlog_file23,
|
|
6311
|
+
L: 41,
|
|
6312
|
+
S: void 0,
|
|
6313
|
+
C: (f, a) => f(...a)
|
|
6314
|
+
});
|
|
6315
|
+
}
|
|
6316
|
+
{
|
|
6317
|
+
log20.info("begin exporting kv pairs", void 0, {
|
|
6318
|
+
F: __dxlog_file23,
|
|
6319
|
+
L: 45,
|
|
6320
|
+
S: void 0,
|
|
6321
|
+
C: (f, a) => f(...a)
|
|
6322
|
+
});
|
|
6323
|
+
const iter = await level.iterator({
|
|
6324
|
+
keyEncoding: "binary",
|
|
6325
|
+
valueEncoding: "binary"
|
|
6326
|
+
});
|
|
6327
|
+
let count = 0;
|
|
6328
|
+
for await (const [key, value] of iter) {
|
|
6329
|
+
archive.storage.push({
|
|
6330
|
+
type: ProfileArchiveEntryType.KEY_VALUE,
|
|
6331
|
+
key,
|
|
6332
|
+
value
|
|
6333
|
+
});
|
|
6334
|
+
count++;
|
|
6335
|
+
}
|
|
6336
|
+
log20.info("done exporting kv pairs", {
|
|
6337
|
+
count
|
|
6338
|
+
}, {
|
|
6339
|
+
F: __dxlog_file23,
|
|
6340
|
+
L: 56,
|
|
6341
|
+
S: void 0,
|
|
6342
|
+
C: (f, a) => f(...a)
|
|
6343
|
+
});
|
|
6344
|
+
}
|
|
6345
|
+
return archive;
|
|
6346
|
+
};
|
|
6347
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6348
|
+
const batch = level.batch();
|
|
6349
|
+
for (const entry2 of archive.storage) {
|
|
6350
|
+
switch (entry2.type) {
|
|
6351
|
+
case ProfileArchiveEntryType.FILE: {
|
|
6352
|
+
const directory = await storage.createDirectory();
|
|
6353
|
+
invariant17(typeof entry2.key === "string", "Invalid key type", {
|
|
6354
|
+
F: __dxlog_file23,
|
|
6355
|
+
L: 78,
|
|
6356
|
+
S: void 0,
|
|
6357
|
+
A: [
|
|
6358
|
+
"typeof entry.key === 'string'",
|
|
6359
|
+
"'Invalid key type'"
|
|
6360
|
+
]
|
|
6361
|
+
});
|
|
6362
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6363
|
+
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6364
|
+
F: __dxlog_file23,
|
|
6365
|
+
L: 80,
|
|
6366
|
+
S: void 0,
|
|
6367
|
+
A: [
|
|
6368
|
+
"entry.value instanceof Uint8Array",
|
|
6369
|
+
"'Invalid value type'"
|
|
6370
|
+
]
|
|
6371
|
+
});
|
|
6372
|
+
await file.write(0, arrayToBuffer(entry2.value));
|
|
6373
|
+
await file.close();
|
|
6374
|
+
break;
|
|
6375
|
+
}
|
|
6376
|
+
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
6377
|
+
invariant17(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6378
|
+
F: __dxlog_file23,
|
|
6379
|
+
L: 86,
|
|
6380
|
+
S: void 0,
|
|
6381
|
+
A: [
|
|
6382
|
+
"entry.key instanceof Uint8Array",
|
|
6383
|
+
"'Invalid key type'"
|
|
6384
|
+
]
|
|
6385
|
+
});
|
|
6386
|
+
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6387
|
+
F: __dxlog_file23,
|
|
6388
|
+
L: 87,
|
|
6389
|
+
S: void 0,
|
|
6390
|
+
A: [
|
|
6391
|
+
"entry.value instanceof Uint8Array",
|
|
6392
|
+
"'Invalid value type'"
|
|
6393
|
+
]
|
|
6394
|
+
});
|
|
6395
|
+
batch.put(entry2.key, entry2.value, {
|
|
6396
|
+
keyEncoding: "binary",
|
|
6397
|
+
valueEncoding: "binary"
|
|
6398
|
+
});
|
|
6399
|
+
break;
|
|
6400
|
+
}
|
|
6401
|
+
default:
|
|
6402
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6405
|
+
await batch.write();
|
|
6406
|
+
};
|
|
6407
|
+
|
|
6152
6408
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
6153
6409
|
import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
|
|
6154
6410
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
6155
6411
|
import { Context as Context11 } from "@dxos/context";
|
|
6156
|
-
import { invariant as
|
|
6157
|
-
import { PublicKey as
|
|
6158
|
-
import { log as
|
|
6412
|
+
import { invariant as invariant19 } from "@dxos/invariant";
|
|
6413
|
+
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
6414
|
+
import { log as log22 } from "@dxos/log";
|
|
6159
6415
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
6160
6416
|
import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
6161
6417
|
import { trace as trace10 } from "@dxos/protocols";
|
|
@@ -6166,9 +6422,9 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
|
6166
6422
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
6167
6423
|
import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
6168
6424
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
6169
|
-
import { invariant as
|
|
6425
|
+
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6170
6426
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6171
|
-
var
|
|
6427
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6172
6428
|
var DevicesServiceImpl = class {
|
|
6173
6429
|
constructor(_identityManager) {
|
|
6174
6430
|
this._identityManager = _identityManager;
|
|
@@ -6185,8 +6441,8 @@ var DevicesServiceImpl = class {
|
|
|
6185
6441
|
devices: []
|
|
6186
6442
|
});
|
|
6187
6443
|
} else {
|
|
6188
|
-
|
|
6189
|
-
F:
|
|
6444
|
+
invariant18(this._identityManager.identity?.presence, "presence not present", {
|
|
6445
|
+
F: __dxlog_file24,
|
|
6190
6446
|
L: 32,
|
|
6191
6447
|
S: this,
|
|
6192
6448
|
A: [
|
|
@@ -6292,28 +6548,111 @@ var findConfigs = () => {
|
|
|
6292
6548
|
return configs.map((r) => r.instance.deref()).filter(nonNullable);
|
|
6293
6549
|
};
|
|
6294
6550
|
|
|
6295
|
-
// packages/sdk/client-services/src/packlets/
|
|
6296
|
-
import {
|
|
6551
|
+
// packages/sdk/client-services/src/packlets/identity/contacts-service.ts
|
|
6552
|
+
import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask7, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
|
|
6297
6553
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
6298
6554
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
6299
|
-
import {
|
|
6555
|
+
import { ComplexMap as ComplexMap4, ComplexSet as ComplexSet6 } from "@dxos/util";
|
|
6556
|
+
var ContactsServiceImpl = class {
|
|
6557
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6558
|
+
this._identityManager = _identityManager;
|
|
6559
|
+
this._spaceManager = _spaceManager;
|
|
6560
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6561
|
+
}
|
|
6562
|
+
async getContacts() {
|
|
6563
|
+
const identity = this._identityManager.identity;
|
|
6564
|
+
if (identity == null) {
|
|
6565
|
+
return {
|
|
6566
|
+
contacts: []
|
|
6567
|
+
};
|
|
6568
|
+
}
|
|
6569
|
+
const contacts = [
|
|
6570
|
+
...this._spaceManager.spaces.values()
|
|
6571
|
+
].flatMap((s) => [
|
|
6572
|
+
...s.spaceState.members.values()
|
|
6573
|
+
].map((m) => [
|
|
6574
|
+
s.key,
|
|
6575
|
+
m
|
|
6576
|
+
])).reduce((acc, v) => {
|
|
6577
|
+
const [spaceKey, memberInfo] = v;
|
|
6578
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6579
|
+
return acc;
|
|
6580
|
+
}
|
|
6581
|
+
const existing = acc.get(memberInfo.key);
|
|
6582
|
+
if (existing != null) {
|
|
6583
|
+
existing.profile ??= memberInfo.profile;
|
|
6584
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6585
|
+
} else {
|
|
6586
|
+
acc.set(memberInfo.key, {
|
|
6587
|
+
identityKey: memberInfo.key,
|
|
6588
|
+
profile: memberInfo.profile,
|
|
6589
|
+
commonSpaces: [
|
|
6590
|
+
spaceKey
|
|
6591
|
+
]
|
|
6592
|
+
});
|
|
6593
|
+
}
|
|
6594
|
+
return acc;
|
|
6595
|
+
}, new ComplexMap4(PublicKey15.hash));
|
|
6596
|
+
return {
|
|
6597
|
+
contacts: [
|
|
6598
|
+
...contacts.values()
|
|
6599
|
+
]
|
|
6600
|
+
};
|
|
6601
|
+
}
|
|
6602
|
+
queryContacts() {
|
|
6603
|
+
const subscribedSpaceKeySet = new ComplexSet6(PublicKey15.hash);
|
|
6604
|
+
return new Stream12(({ next, ctx }) => {
|
|
6605
|
+
const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
|
|
6606
|
+
const contacts = await this.getContacts();
|
|
6607
|
+
next(contacts);
|
|
6608
|
+
}, {
|
|
6609
|
+
maxFrequency: 2
|
|
6610
|
+
});
|
|
6611
|
+
scheduleTask7(ctx, async () => {
|
|
6612
|
+
const subscriptions = new EventSubscriptions4();
|
|
6613
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6614
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6615
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6616
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6617
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6618
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6619
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6623
|
+
pushUpdateTask.trigger();
|
|
6624
|
+
}
|
|
6625
|
+
};
|
|
6626
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6627
|
+
ctx.onDispose(unsubscribe);
|
|
6628
|
+
subscribeToSpaceAndUpdate();
|
|
6629
|
+
});
|
|
6630
|
+
});
|
|
6631
|
+
}
|
|
6632
|
+
};
|
|
6633
|
+
|
|
6634
|
+
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
6635
|
+
import { Event as Event8 } from "@dxos/async";
|
|
6636
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
6637
|
+
import { PublicKey as PublicKey16 } from "@dxos/keys";
|
|
6638
|
+
import { getContextFromEntry, log as log21 } from "@dxos/log";
|
|
6300
6639
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
6301
6640
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
6302
6641
|
var LoggingServiceImpl = class {
|
|
6303
6642
|
constructor() {
|
|
6304
6643
|
this._logs = new Event8();
|
|
6305
6644
|
this._started = Date.now();
|
|
6306
|
-
this._sessionId =
|
|
6645
|
+
this._sessionId = PublicKey16.random().toHex();
|
|
6307
6646
|
this._logProcessor = (_config, entry2) => {
|
|
6308
6647
|
this._logs.emit(entry2);
|
|
6309
6648
|
};
|
|
6310
6649
|
}
|
|
6311
6650
|
async open() {
|
|
6312
|
-
|
|
6651
|
+
log21.runtimeConfig.processors.push(this._logProcessor);
|
|
6313
6652
|
}
|
|
6314
6653
|
async close() {
|
|
6315
|
-
const index =
|
|
6316
|
-
|
|
6654
|
+
const index = log21.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6655
|
+
log21.runtimeConfig.processors.splice(index, 1);
|
|
6317
6656
|
}
|
|
6318
6657
|
async controlMetrics({ reset, record }) {
|
|
6319
6658
|
if (reset) {
|
|
@@ -6339,7 +6678,7 @@ var LoggingServiceImpl = class {
|
|
|
6339
6678
|
stats: numericalValues(events, "duration")
|
|
6340
6679
|
};
|
|
6341
6680
|
};
|
|
6342
|
-
return new
|
|
6681
|
+
return new Stream13(({ next }) => {
|
|
6343
6682
|
const update = () => {
|
|
6344
6683
|
const metrics = {
|
|
6345
6684
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6361,7 +6700,7 @@ var LoggingServiceImpl = class {
|
|
|
6361
6700
|
});
|
|
6362
6701
|
}
|
|
6363
6702
|
queryLogs(request) {
|
|
6364
|
-
return new
|
|
6703
|
+
return new Stream13(({ ctx, next }) => {
|
|
6365
6704
|
const handler = (entry2) => {
|
|
6366
6705
|
if (LOG_PROCESSING > 0) {
|
|
6367
6706
|
return;
|
|
@@ -6417,14 +6756,14 @@ var shouldLog = (entry2, request) => {
|
|
|
6417
6756
|
var LOG_PROCESSING = 0;
|
|
6418
6757
|
|
|
6419
6758
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
6420
|
-
import { Stream as
|
|
6759
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
6421
6760
|
var NetworkServiceImpl = class {
|
|
6422
6761
|
constructor(networkManager, signalManager) {
|
|
6423
6762
|
this.networkManager = networkManager;
|
|
6424
6763
|
this.signalManager = signalManager;
|
|
6425
6764
|
}
|
|
6426
6765
|
queryStatus() {
|
|
6427
|
-
return new
|
|
6766
|
+
return new Stream14(({ next }) => {
|
|
6428
6767
|
const update = () => {
|
|
6429
6768
|
next({
|
|
6430
6769
|
swarm: this.networkManager.connectionState,
|
|
@@ -6450,7 +6789,7 @@ var NetworkServiceImpl = class {
|
|
|
6450
6789
|
};
|
|
6451
6790
|
|
|
6452
6791
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
6453
|
-
import { Stream as
|
|
6792
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf";
|
|
6454
6793
|
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6455
6794
|
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
6456
6795
|
var SystemServiceImpl = class {
|
|
@@ -6486,7 +6825,7 @@ var SystemServiceImpl = class {
|
|
|
6486
6825
|
}
|
|
6487
6826
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6488
6827
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6489
|
-
return new
|
|
6828
|
+
return new Stream15(({ next }) => {
|
|
6490
6829
|
const update = () => {
|
|
6491
6830
|
next({
|
|
6492
6831
|
status: this._getCurrentStatus()
|
|
@@ -6517,7 +6856,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6517
6856
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6518
6857
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6519
6858
|
}
|
|
6520
|
-
var
|
|
6859
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6521
6860
|
var ClientServicesHost = class {
|
|
6522
6861
|
constructor({
|
|
6523
6862
|
config,
|
|
@@ -6550,7 +6889,10 @@ var ClientServicesHost = class {
|
|
|
6550
6889
|
lockKey,
|
|
6551
6890
|
onAcquire: () => {
|
|
6552
6891
|
if (!this._opening) {
|
|
6553
|
-
void this.open(new Context11(
|
|
6892
|
+
void this.open(new Context11(void 0, {
|
|
6893
|
+
F: __dxlog_file25,
|
|
6894
|
+
L: 121
|
|
6895
|
+
}));
|
|
6554
6896
|
}
|
|
6555
6897
|
},
|
|
6556
6898
|
onRelease: () => this.close()
|
|
@@ -6605,25 +6947,25 @@ var ClientServicesHost = class {
|
|
|
6605
6947
|
* Can only be called once.
|
|
6606
6948
|
*/
|
|
6607
6949
|
initialize({ config, ...options }) {
|
|
6608
|
-
|
|
6609
|
-
F:
|
|
6610
|
-
L:
|
|
6950
|
+
invariant19(!this._open, "service host is open", {
|
|
6951
|
+
F: __dxlog_file25,
|
|
6952
|
+
L: 187,
|
|
6611
6953
|
S: this,
|
|
6612
6954
|
A: [
|
|
6613
6955
|
"!this._open",
|
|
6614
6956
|
"'service host is open'"
|
|
6615
6957
|
]
|
|
6616
6958
|
});
|
|
6617
|
-
|
|
6618
|
-
F:
|
|
6619
|
-
L:
|
|
6959
|
+
log22("initializing...", void 0, {
|
|
6960
|
+
F: __dxlog_file25,
|
|
6961
|
+
L: 188,
|
|
6620
6962
|
S: this,
|
|
6621
6963
|
C: (f, a) => f(...a)
|
|
6622
6964
|
});
|
|
6623
6965
|
if (config) {
|
|
6624
|
-
|
|
6625
|
-
F:
|
|
6626
|
-
L:
|
|
6966
|
+
invariant19(!this._config, "config already set", {
|
|
6967
|
+
F: __dxlog_file25,
|
|
6968
|
+
L: 191,
|
|
6627
6969
|
S: this,
|
|
6628
6970
|
A: [
|
|
6629
6971
|
"!this._config",
|
|
@@ -6636,9 +6978,9 @@ var ClientServicesHost = class {
|
|
|
6636
6978
|
}
|
|
6637
6979
|
}
|
|
6638
6980
|
if (!options.signalManager) {
|
|
6639
|
-
|
|
6640
|
-
F:
|
|
6641
|
-
L:
|
|
6981
|
+
log22.warn("running signaling without telemetry metadata.", void 0, {
|
|
6982
|
+
F: __dxlog_file25,
|
|
6983
|
+
L: 199,
|
|
6642
6984
|
S: this,
|
|
6643
6985
|
C: (f, a) => f(...a)
|
|
6644
6986
|
});
|
|
@@ -6647,9 +6989,9 @@ var ClientServicesHost = class {
|
|
|
6647
6989
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6648
6990
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6649
6991
|
this._signalManager = signalManager;
|
|
6650
|
-
|
|
6651
|
-
F:
|
|
6652
|
-
L:
|
|
6992
|
+
invariant19(!this._networkManager, "network manager already set", {
|
|
6993
|
+
F: __dxlog_file25,
|
|
6994
|
+
L: 210,
|
|
6653
6995
|
S: this,
|
|
6654
6996
|
A: [
|
|
6655
6997
|
"!this._networkManager",
|
|
@@ -6661,9 +7003,9 @@ var ClientServicesHost = class {
|
|
|
6661
7003
|
transportFactory,
|
|
6662
7004
|
signalManager
|
|
6663
7005
|
});
|
|
6664
|
-
|
|
6665
|
-
F:
|
|
6666
|
-
L:
|
|
7006
|
+
log22("initialized", void 0, {
|
|
7007
|
+
F: __dxlog_file25,
|
|
7008
|
+
L: 217,
|
|
6667
7009
|
S: this,
|
|
6668
7010
|
C: (f, a) => f(...a)
|
|
6669
7011
|
});
|
|
@@ -6672,45 +7014,45 @@ var ClientServicesHost = class {
|
|
|
6672
7014
|
if (this._open) {
|
|
6673
7015
|
return;
|
|
6674
7016
|
}
|
|
6675
|
-
const traceId =
|
|
6676
|
-
|
|
7017
|
+
const traceId = PublicKey17.random().toHex();
|
|
7018
|
+
log22.trace("dxos.client-services.host.open", trace10.begin({
|
|
6677
7019
|
id: traceId
|
|
6678
7020
|
}), {
|
|
6679
|
-
F:
|
|
6680
|
-
L:
|
|
7021
|
+
F: __dxlog_file25,
|
|
7022
|
+
L: 228,
|
|
6681
7023
|
S: this,
|
|
6682
7024
|
C: (f, a) => f(...a)
|
|
6683
7025
|
});
|
|
6684
|
-
|
|
6685
|
-
F:
|
|
6686
|
-
L:
|
|
7026
|
+
invariant19(this._config, "config not set", {
|
|
7027
|
+
F: __dxlog_file25,
|
|
7028
|
+
L: 230,
|
|
6687
7029
|
S: this,
|
|
6688
7030
|
A: [
|
|
6689
7031
|
"this._config",
|
|
6690
7032
|
"'config not set'"
|
|
6691
7033
|
]
|
|
6692
7034
|
});
|
|
6693
|
-
|
|
6694
|
-
F:
|
|
6695
|
-
L:
|
|
7035
|
+
invariant19(this._storage, "storage not set", {
|
|
7036
|
+
F: __dxlog_file25,
|
|
7037
|
+
L: 231,
|
|
6696
7038
|
S: this,
|
|
6697
7039
|
A: [
|
|
6698
7040
|
"this._storage",
|
|
6699
7041
|
"'storage not set'"
|
|
6700
7042
|
]
|
|
6701
7043
|
});
|
|
6702
|
-
|
|
6703
|
-
F:
|
|
6704
|
-
L:
|
|
7044
|
+
invariant19(this._signalManager, "signal manager not set", {
|
|
7045
|
+
F: __dxlog_file25,
|
|
7046
|
+
L: 232,
|
|
6705
7047
|
S: this,
|
|
6706
7048
|
A: [
|
|
6707
7049
|
"this._signalManager",
|
|
6708
7050
|
"'signal manager not set'"
|
|
6709
7051
|
]
|
|
6710
7052
|
});
|
|
6711
|
-
|
|
6712
|
-
F:
|
|
6713
|
-
L:
|
|
7053
|
+
invariant19(this._networkManager, "network manager not set", {
|
|
7054
|
+
F: __dxlog_file25,
|
|
7055
|
+
L: 233,
|
|
6714
7056
|
S: this,
|
|
6715
7057
|
A: [
|
|
6716
7058
|
"this._networkManager",
|
|
@@ -6718,11 +7060,11 @@ var ClientServicesHost = class {
|
|
|
6718
7060
|
]
|
|
6719
7061
|
});
|
|
6720
7062
|
this._opening = true;
|
|
6721
|
-
|
|
7063
|
+
log22("opening...", {
|
|
6722
7064
|
lockKey: this._resourceLock?.lockKey
|
|
6723
7065
|
}, {
|
|
6724
|
-
F:
|
|
6725
|
-
L:
|
|
7066
|
+
F: __dxlog_file25,
|
|
7067
|
+
L: 236,
|
|
6726
7068
|
S: this,
|
|
6727
7069
|
C: (f, a) => f(...a)
|
|
6728
7070
|
});
|
|
@@ -6733,16 +7075,18 @@ var ClientServicesHost = class {
|
|
|
6733
7075
|
await this._level.open();
|
|
6734
7076
|
await this._loggingService.open();
|
|
6735
7077
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
7078
|
+
const dataSpaceManagerProvider = async () => {
|
|
7079
|
+
await this._serviceContext.initialized.wait();
|
|
7080
|
+
return this._serviceContext.dataSpaceManager;
|
|
7081
|
+
};
|
|
6736
7082
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6737
7083
|
this._serviceRegistry.setServices({
|
|
6738
7084
|
SystemService: this._systemService,
|
|
6739
7085
|
IdentityService: identityService,
|
|
7086
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6740
7087
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6741
7088
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6742
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6743
|
-
await this._serviceContext.initialized.wait();
|
|
6744
|
-
return this._serviceContext.dataSpaceManager;
|
|
6745
|
-
}),
|
|
7089
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6746
7090
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6747
7091
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6748
7092
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6772,19 +7116,19 @@ var ClientServicesHost = class {
|
|
|
6772
7116
|
this._open = true;
|
|
6773
7117
|
this._statusUpdate.emit();
|
|
6774
7118
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6775
|
-
|
|
7119
|
+
log22("opened", {
|
|
6776
7120
|
deviceKey
|
|
6777
7121
|
}, {
|
|
6778
|
-
F:
|
|
6779
|
-
L:
|
|
7122
|
+
F: __dxlog_file25,
|
|
7123
|
+
L: 322,
|
|
6780
7124
|
S: this,
|
|
6781
7125
|
C: (f, a) => f(...a)
|
|
6782
7126
|
});
|
|
6783
|
-
|
|
7127
|
+
log22.trace("dxos.client-services.host.open", trace10.end({
|
|
6784
7128
|
id: traceId
|
|
6785
7129
|
}), {
|
|
6786
|
-
F:
|
|
6787
|
-
L:
|
|
7130
|
+
F: __dxlog_file25,
|
|
7131
|
+
L: 323,
|
|
6788
7132
|
S: this,
|
|
6789
7133
|
C: (f, a) => f(...a)
|
|
6790
7134
|
});
|
|
@@ -6794,11 +7138,11 @@ var ClientServicesHost = class {
|
|
|
6794
7138
|
return;
|
|
6795
7139
|
}
|
|
6796
7140
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6797
|
-
|
|
7141
|
+
log22("closing...", {
|
|
6798
7142
|
deviceKey
|
|
6799
7143
|
}, {
|
|
6800
|
-
F:
|
|
6801
|
-
L:
|
|
7144
|
+
F: __dxlog_file25,
|
|
7145
|
+
L: 334,
|
|
6802
7146
|
S: this,
|
|
6803
7147
|
C: (f, a) => f(...a)
|
|
6804
7148
|
});
|
|
@@ -6812,44 +7156,44 @@ var ClientServicesHost = class {
|
|
|
6812
7156
|
await this._level?.close();
|
|
6813
7157
|
this._open = false;
|
|
6814
7158
|
this._statusUpdate.emit();
|
|
6815
|
-
|
|
7159
|
+
log22("closed", {
|
|
6816
7160
|
deviceKey
|
|
6817
7161
|
}, {
|
|
6818
|
-
F:
|
|
6819
|
-
L:
|
|
7162
|
+
F: __dxlog_file25,
|
|
7163
|
+
L: 343,
|
|
6820
7164
|
S: this,
|
|
6821
7165
|
C: (f, a) => f(...a)
|
|
6822
7166
|
});
|
|
6823
7167
|
}
|
|
6824
7168
|
async reset() {
|
|
6825
|
-
const traceId =
|
|
6826
|
-
|
|
7169
|
+
const traceId = PublicKey17.random().toHex();
|
|
7170
|
+
log22.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
6827
7171
|
id: traceId
|
|
6828
7172
|
}), {
|
|
6829
|
-
F:
|
|
6830
|
-
L:
|
|
7173
|
+
F: __dxlog_file25,
|
|
7174
|
+
L: 348,
|
|
6831
7175
|
S: this,
|
|
6832
7176
|
C: (f, a) => f(...a)
|
|
6833
7177
|
});
|
|
6834
|
-
|
|
6835
|
-
F:
|
|
6836
|
-
L:
|
|
7178
|
+
log22.info("resetting...", void 0, {
|
|
7179
|
+
F: __dxlog_file25,
|
|
7180
|
+
L: 350,
|
|
6837
7181
|
S: this,
|
|
6838
7182
|
C: (f, a) => f(...a)
|
|
6839
7183
|
});
|
|
6840
7184
|
await this._serviceContext?.close();
|
|
6841
7185
|
await this._storage.reset();
|
|
6842
|
-
|
|
6843
|
-
F:
|
|
6844
|
-
L:
|
|
7186
|
+
log22.info("reset", void 0, {
|
|
7187
|
+
F: __dxlog_file25,
|
|
7188
|
+
L: 353,
|
|
6845
7189
|
S: this,
|
|
6846
7190
|
C: (f, a) => f(...a)
|
|
6847
7191
|
});
|
|
6848
|
-
|
|
7192
|
+
log22.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
6849
7193
|
id: traceId
|
|
6850
7194
|
}), {
|
|
6851
|
-
F:
|
|
6852
|
-
L:
|
|
7195
|
+
F: __dxlog_file25,
|
|
7196
|
+
L: 354,
|
|
6853
7197
|
S: this,
|
|
6854
7198
|
C: (f, a) => f(...a)
|
|
6855
7199
|
});
|
|
@@ -6915,8 +7259,12 @@ export {
|
|
|
6915
7259
|
isLocked,
|
|
6916
7260
|
createStorageObjects,
|
|
6917
7261
|
createLevel,
|
|
7262
|
+
encodeProfileArchive,
|
|
7263
|
+
decodeProfileArchive,
|
|
7264
|
+
exportProfileData,
|
|
7265
|
+
importProfileData,
|
|
6918
7266
|
ClientServicesHost,
|
|
6919
7267
|
ClientServicesProviderResource,
|
|
6920
7268
|
DiagnosticsCollector
|
|
6921
7269
|
};
|
|
6922
|
-
//# sourceMappingURL=chunk-
|
|
7270
|
+
//# sourceMappingURL=chunk-SPEYMJJE.mjs.map
|