@dxos/client-services 0.5.9-next.728078d → 0.5.9-next.912f1ef
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-Q2PH3QCC.mjs → chunk-MD3R7DKE.mjs} +784 -509
- package/dist/lib/browser/chunk-MD3R7DKE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -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-XZHIBOD3.cjs → chunk-377JVXYV.cjs} +812 -539
- package/dist/lib/node/chunk-377JVXYV.cjs.map +7 -0
- package/dist/lib/node/index.cjs +49 -46
- 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/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-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/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +2 -2
- package/dist/types/src/packlets/spaces/epoch-migrations.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/profile-archive.d.ts.map +1 -1
- 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/identity/identity-service.ts +28 -22
- package/src/packlets/invitations/invitations-handler.ts +13 -5
- 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/data-space.ts +3 -1
- package/src/packlets/spaces/epoch-migrations.ts +57 -38
- package/src/packlets/spaces/spaces-service.ts +40 -0
- package/src/packlets/storage/profile-archive.ts +15 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-Q2PH3QCC.mjs.map +0 -7
- package/dist/lib/node/chunk-XZHIBOD3.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-next.
|
|
362
|
+
var DXOS_VERSION = "0.5.9-next.912f1ef";
|
|
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,8 +1657,8 @@ 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:
|
|
1645
|
-
L:
|
|
1660
|
+
F: __dxlog_file8,
|
|
1661
|
+
L: 129,
|
|
1646
1662
|
S: this,
|
|
1647
1663
|
C: (f, a) => f(...a)
|
|
1648
1664
|
});
|
|
@@ -1653,6 +1669,13 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1653
1669
|
recodedDefaultSpace = true;
|
|
1654
1670
|
recordedDefaultSpaceTrigger.wake();
|
|
1655
1671
|
}
|
|
1672
|
+
}, (err) => {
|
|
1673
|
+
log6.catch(err, void 0, {
|
|
1674
|
+
F: __dxlog_file8,
|
|
1675
|
+
L: 140,
|
|
1676
|
+
S: this,
|
|
1677
|
+
C: (f, a) => f(...a)
|
|
1678
|
+
});
|
|
1656
1679
|
});
|
|
1657
1680
|
await Promise.race([
|
|
1658
1681
|
allProcessed,
|
|
@@ -1669,7 +1692,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1669
1692
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1670
1693
|
import { AlreadyJoinedError } from "@dxos/protocols";
|
|
1671
1694
|
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
1672
|
-
var
|
|
1695
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1673
1696
|
var DeviceInvitationProtocol = class {
|
|
1674
1697
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1675
1698
|
this._keyring = _keyring;
|
|
@@ -1695,7 +1718,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1695
1718
|
}
|
|
1696
1719
|
async admit(_, request) {
|
|
1697
1720
|
invariant5(request.device, void 0, {
|
|
1698
|
-
F:
|
|
1721
|
+
F: __dxlog_file9,
|
|
1699
1722
|
L: 50,
|
|
1700
1723
|
S: this,
|
|
1701
1724
|
A: [
|
|
@@ -1741,7 +1764,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1741
1764
|
}
|
|
1742
1765
|
async accept(response, request) {
|
|
1743
1766
|
invariant5(response.device, void 0, {
|
|
1744
|
-
F:
|
|
1767
|
+
F: __dxlog_file9,
|
|
1745
1768
|
L: 95,
|
|
1746
1769
|
S: this,
|
|
1747
1770
|
A: [
|
|
@@ -1751,7 +1774,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1751
1774
|
});
|
|
1752
1775
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1753
1776
|
invariant5(request.device, void 0, {
|
|
1754
|
-
F:
|
|
1777
|
+
F: __dxlog_file9,
|
|
1755
1778
|
L: 98,
|
|
1756
1779
|
S: this,
|
|
1757
1780
|
A: [
|
|
@@ -1820,7 +1843,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1820
1843
|
};
|
|
1821
1844
|
|
|
1822
1845
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
1823
|
-
var
|
|
1846
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1824
1847
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1825
1848
|
var InvitationGuestExtension = class extends RpcExtension {
|
|
1826
1849
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1834,7 +1857,10 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1834
1857
|
});
|
|
1835
1858
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1836
1859
|
this._callbacks = _callbacks;
|
|
1837
|
-
this._ctx = new Context4(
|
|
1860
|
+
this._ctx = new Context4(void 0, {
|
|
1861
|
+
F: __dxlog_file10,
|
|
1862
|
+
L: 33
|
|
1863
|
+
});
|
|
1838
1864
|
this._remoteOptionsTrigger = new Trigger4();
|
|
1839
1865
|
this._invitationFlowLock = null;
|
|
1840
1866
|
}
|
|
@@ -1846,7 +1872,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1846
1872
|
InvitationHostService: {
|
|
1847
1873
|
options: async (options) => {
|
|
1848
1874
|
invariant6(!this._remoteOptions, "Remote options already set.", {
|
|
1849
|
-
F:
|
|
1875
|
+
F: __dxlog_file10,
|
|
1850
1876
|
L: 63,
|
|
1851
1877
|
S: this,
|
|
1852
1878
|
A: [
|
|
@@ -1873,14 +1899,14 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1873
1899
|
await super.onOpen(context);
|
|
1874
1900
|
try {
|
|
1875
1901
|
log7("guest acquire lock", void 0, {
|
|
1876
|
-
F:
|
|
1902
|
+
F: __dxlog_file10,
|
|
1877
1903
|
L: 84,
|
|
1878
1904
|
S: this,
|
|
1879
1905
|
C: (f, a) => f(...a)
|
|
1880
1906
|
});
|
|
1881
1907
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1882
1908
|
log7("guest lock acquired", void 0, {
|
|
1883
|
-
F:
|
|
1909
|
+
F: __dxlog_file10,
|
|
1884
1910
|
L: 86,
|
|
1885
1911
|
S: this,
|
|
1886
1912
|
C: (f, a) => f(...a)
|
|
@@ -1889,7 +1915,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1889
1915
|
role: Options.Role.GUEST
|
|
1890
1916
|
}));
|
|
1891
1917
|
log7("options sent", void 0, {
|
|
1892
|
-
F:
|
|
1918
|
+
F: __dxlog_file10,
|
|
1893
1919
|
L: 88,
|
|
1894
1920
|
S: this,
|
|
1895
1921
|
C: (f, a) => f(...a)
|
|
@@ -1898,7 +1924,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1898
1924
|
timeout: OPTIONS_TIMEOUT
|
|
1899
1925
|
}));
|
|
1900
1926
|
log7("options received", void 0, {
|
|
1901
|
-
F:
|
|
1927
|
+
F: __dxlog_file10,
|
|
1902
1928
|
L: 90,
|
|
1903
1929
|
S: this,
|
|
1904
1930
|
C: (f, a) => f(...a)
|
|
@@ -1932,7 +1958,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1932
1958
|
this._invitationFlowLock.release();
|
|
1933
1959
|
this._invitationFlowLock = null;
|
|
1934
1960
|
log7("invitation flow lock released", void 0, {
|
|
1935
|
-
F:
|
|
1961
|
+
F: __dxlog_file10,
|
|
1936
1962
|
L: 123,
|
|
1937
1963
|
S: this,
|
|
1938
1964
|
C: (f, a) => f(...a)
|
|
@@ -1952,7 +1978,7 @@ import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleEr
|
|
|
1952
1978
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1953
1979
|
import { AuthenticationResponse, Options as Options2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1954
1980
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1955
|
-
var
|
|
1981
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
1956
1982
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
1957
1983
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1958
1984
|
var InvitationHostExtension = class extends RpcExtension2 {
|
|
@@ -1967,7 +1993,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1967
1993
|
});
|
|
1968
1994
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1969
1995
|
this._callbacks = _callbacks;
|
|
1970
|
-
this._ctx = new Context5(
|
|
1996
|
+
this._ctx = new Context5(void 0, {
|
|
1997
|
+
F: __dxlog_file11,
|
|
1998
|
+
L: 52
|
|
1999
|
+
});
|
|
1971
2000
|
this._remoteOptionsTrigger = new Trigger5();
|
|
1972
2001
|
this._challenge = void 0;
|
|
1973
2002
|
this.guestProfile = void 0;
|
|
@@ -1986,7 +2015,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1986
2015
|
InvitationHostService: {
|
|
1987
2016
|
options: async (options) => {
|
|
1988
2017
|
invariant7(!this._remoteOptions, "Remote options already set.", {
|
|
1989
|
-
F:
|
|
2018
|
+
F: __dxlog_file11,
|
|
1990
2019
|
L: 101,
|
|
1991
2020
|
S: this,
|
|
1992
2021
|
A: [
|
|
@@ -2003,7 +2032,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2003
2032
|
log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
|
|
2004
2033
|
id: traceId
|
|
2005
2034
|
}), {
|
|
2006
|
-
F:
|
|
2035
|
+
F: __dxlog_file11,
|
|
2007
2036
|
L: 110,
|
|
2008
2037
|
S: this,
|
|
2009
2038
|
C: (f, a) => f(...a)
|
|
@@ -2015,7 +2044,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2015
2044
|
expected: invitation.invitationId,
|
|
2016
2045
|
actual: invitationId
|
|
2017
2046
|
}, {
|
|
2018
|
-
F:
|
|
2047
|
+
F: __dxlog_file11,
|
|
2019
2048
|
L: 116,
|
|
2020
2049
|
S: this,
|
|
2021
2050
|
C: (f, a) => f(...a)
|
|
@@ -2029,7 +2058,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2029
2058
|
log8("guest introduced themselves", {
|
|
2030
2059
|
guestProfile: profile
|
|
2031
2060
|
}, {
|
|
2032
|
-
F:
|
|
2061
|
+
F: __dxlog_file11,
|
|
2033
2062
|
L: 125,
|
|
2034
2063
|
S: this,
|
|
2035
2064
|
C: (f, a) => f(...a)
|
|
@@ -2040,7 +2069,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2040
2069
|
log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
|
|
2041
2070
|
id: traceId
|
|
2042
2071
|
}), {
|
|
2043
|
-
F:
|
|
2072
|
+
F: __dxlog_file11,
|
|
2044
2073
|
L: 132,
|
|
2045
2074
|
S: this,
|
|
2046
2075
|
C: (f, a) => f(...a)
|
|
@@ -2055,7 +2084,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2055
2084
|
log8.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
|
|
2056
2085
|
id: traceId
|
|
2057
2086
|
}), {
|
|
2058
|
-
F:
|
|
2087
|
+
F: __dxlog_file11,
|
|
2059
2088
|
L: 141,
|
|
2060
2089
|
S: this,
|
|
2061
2090
|
C: (f, a) => f(...a)
|
|
@@ -2064,7 +2093,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2064
2093
|
log8("received authentication request", {
|
|
2065
2094
|
authCode: code
|
|
2066
2095
|
}, {
|
|
2067
|
-
F:
|
|
2096
|
+
F: __dxlog_file11,
|
|
2068
2097
|
L: 144,
|
|
2069
2098
|
S: this,
|
|
2070
2099
|
C: (f, a) => f(...a)
|
|
@@ -2078,7 +2107,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2078
2107
|
switch (invitation.authMethod) {
|
|
2079
2108
|
case Invitation3.AuthMethod.NONE: {
|
|
2080
2109
|
log8("authentication not required", void 0, {
|
|
2081
|
-
F:
|
|
2110
|
+
F: __dxlog_file11,
|
|
2082
2111
|
L: 152,
|
|
2083
2112
|
S: this,
|
|
2084
2113
|
C: (f, a) => f(...a)
|
|
@@ -2116,7 +2145,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2116
2145
|
log8.error("invalid authentication method", {
|
|
2117
2146
|
authMethod: invitation.authMethod
|
|
2118
2147
|
}, {
|
|
2119
|
-
F:
|
|
2148
|
+
F: __dxlog_file11,
|
|
2120
2149
|
L: 190,
|
|
2121
2150
|
S: this,
|
|
2122
2151
|
C: (f, a) => f(...a)
|
|
@@ -2141,7 +2170,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2141
2170
|
status
|
|
2142
2171
|
}
|
|
2143
2172
|
}), {
|
|
2144
|
-
F:
|
|
2173
|
+
F: __dxlog_file11,
|
|
2145
2174
|
L: 202,
|
|
2146
2175
|
S: this,
|
|
2147
2176
|
C: (f, a) => f(...a)
|
|
@@ -2155,7 +2184,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2155
2184
|
log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
|
|
2156
2185
|
id: traceId
|
|
2157
2186
|
}), {
|
|
2158
|
-
F:
|
|
2187
|
+
F: __dxlog_file11,
|
|
2159
2188
|
L: 208,
|
|
2160
2189
|
S: this,
|
|
2161
2190
|
C: (f, a) => f(...a)
|
|
@@ -2172,7 +2201,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2172
2201
|
log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
|
|
2173
2202
|
id: traceId
|
|
2174
2203
|
}), {
|
|
2175
|
-
F:
|
|
2204
|
+
F: __dxlog_file11,
|
|
2176
2205
|
L: 222,
|
|
2177
2206
|
S: this,
|
|
2178
2207
|
C: (f, a) => f(...a)
|
|
@@ -2190,14 +2219,14 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2190
2219
|
await super.onOpen(context);
|
|
2191
2220
|
try {
|
|
2192
2221
|
log8("host acquire lock", void 0, {
|
|
2193
|
-
F:
|
|
2222
|
+
F: __dxlog_file11,
|
|
2194
2223
|
L: 237,
|
|
2195
2224
|
S: this,
|
|
2196
2225
|
C: (f, a) => f(...a)
|
|
2197
2226
|
});
|
|
2198
2227
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2199
2228
|
log8("host lock acquired", void 0, {
|
|
2200
|
-
F:
|
|
2229
|
+
F: __dxlog_file11,
|
|
2201
2230
|
L: 239,
|
|
2202
2231
|
S: this,
|
|
2203
2232
|
C: (f, a) => f(...a)
|
|
@@ -2208,7 +2237,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2208
2237
|
role: Options2.Role.HOST
|
|
2209
2238
|
});
|
|
2210
2239
|
log8("options sent", void 0, {
|
|
2211
|
-
F:
|
|
2240
|
+
F: __dxlog_file11,
|
|
2212
2241
|
L: 243,
|
|
2213
2242
|
S: this,
|
|
2214
2243
|
C: (f, a) => f(...a)
|
|
@@ -2217,7 +2246,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2217
2246
|
timeout: OPTIONS_TIMEOUT2
|
|
2218
2247
|
}));
|
|
2219
2248
|
log8("options received", void 0, {
|
|
2220
|
-
F:
|
|
2249
|
+
F: __dxlog_file11,
|
|
2221
2250
|
L: 245,
|
|
2222
2251
|
S: this,
|
|
2223
2252
|
C: (f, a) => f(...a)
|
|
@@ -2271,7 +2300,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2271
2300
|
this._invitationFlowLock?.release();
|
|
2272
2301
|
this._invitationFlowLock = null;
|
|
2273
2302
|
log8("invitation flow lock released", void 0, {
|
|
2274
|
-
F:
|
|
2303
|
+
F: __dxlog_file11,
|
|
2275
2304
|
L: 300,
|
|
2276
2305
|
S: this,
|
|
2277
2306
|
C: (f, a) => f(...a)
|
|
@@ -2287,7 +2316,7 @@ import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
|
2287
2316
|
import { log as log9 } from "@dxos/log";
|
|
2288
2317
|
import { Options as Options3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
2289
2318
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2290
|
-
var
|
|
2319
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2291
2320
|
var InvitationTopology = class {
|
|
2292
2321
|
constructor(_role) {
|
|
2293
2322
|
this._role = _role;
|
|
@@ -2295,7 +2324,7 @@ var InvitationTopology = class {
|
|
|
2295
2324
|
}
|
|
2296
2325
|
init(controller) {
|
|
2297
2326
|
invariant8(!this._controller, "Already initialized.", {
|
|
2298
|
-
F:
|
|
2327
|
+
F: __dxlog_file12,
|
|
2299
2328
|
L: 42,
|
|
2300
2329
|
S: this,
|
|
2301
2330
|
A: [
|
|
@@ -2307,7 +2336,7 @@ var InvitationTopology = class {
|
|
|
2307
2336
|
}
|
|
2308
2337
|
update() {
|
|
2309
2338
|
invariant8(this._controller, "Not initialized.", {
|
|
2310
|
-
F:
|
|
2339
|
+
F: __dxlog_file12,
|
|
2311
2340
|
L: 47,
|
|
2312
2341
|
S: this,
|
|
2313
2342
|
A: [
|
|
@@ -2330,7 +2359,7 @@ var InvitationTopology = class {
|
|
|
2330
2359
|
ownPeerId,
|
|
2331
2360
|
remotePeerId: firstUnknownPeer
|
|
2332
2361
|
}, {
|
|
2333
|
-
F:
|
|
2362
|
+
F: __dxlog_file12,
|
|
2334
2363
|
L: 69,
|
|
2335
2364
|
S: this,
|
|
2336
2365
|
C: (f, a) => f(...a)
|
|
@@ -2341,7 +2370,7 @@ var InvitationTopology = class {
|
|
|
2341
2370
|
}
|
|
2342
2371
|
async onOffer(peer) {
|
|
2343
2372
|
invariant8(this._controller, "Not initialized.", {
|
|
2344
|
-
F:
|
|
2373
|
+
F: __dxlog_file12,
|
|
2345
2374
|
L: 76,
|
|
2346
2375
|
S: this,
|
|
2347
2376
|
A: [
|
|
@@ -2360,7 +2389,7 @@ var InvitationTopology = class {
|
|
|
2360
2389
|
};
|
|
2361
2390
|
|
|
2362
2391
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
2363
|
-
var
|
|
2392
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2364
2393
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2365
2394
|
var InvitationsHandler = class {
|
|
2366
2395
|
/**
|
|
@@ -2385,7 +2414,7 @@ var InvitationsHandler = class {
|
|
|
2385
2414
|
try {
|
|
2386
2415
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2387
2416
|
invariant9(deviceKey, void 0, {
|
|
2388
|
-
F:
|
|
2417
|
+
F: __dxlog_file13,
|
|
2389
2418
|
L: 90,
|
|
2390
2419
|
S: this,
|
|
2391
2420
|
A: [
|
|
@@ -2414,7 +2443,7 @@ var InvitationsHandler = class {
|
|
|
2414
2443
|
log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
|
|
2415
2444
|
id: traceId
|
|
2416
2445
|
}), {
|
|
2417
|
-
F:
|
|
2446
|
+
F: __dxlog_file13,
|
|
2418
2447
|
L: 115,
|
|
2419
2448
|
S: this,
|
|
2420
2449
|
C: (f, a) => f(...a)
|
|
@@ -2422,7 +2451,7 @@ var InvitationsHandler = class {
|
|
|
2422
2451
|
log10("connected", {
|
|
2423
2452
|
...protocol.toJSON()
|
|
2424
2453
|
}, {
|
|
2425
|
-
F:
|
|
2454
|
+
F: __dxlog_file13,
|
|
2426
2455
|
L: 116,
|
|
2427
2456
|
S: this,
|
|
2428
2457
|
C: (f, a) => f(...a)
|
|
@@ -2434,7 +2463,7 @@ var InvitationsHandler = class {
|
|
|
2434
2463
|
guest: deviceKey,
|
|
2435
2464
|
...protocol.toJSON()
|
|
2436
2465
|
}, {
|
|
2437
|
-
F:
|
|
2466
|
+
F: __dxlog_file13,
|
|
2438
2467
|
L: 118,
|
|
2439
2468
|
S: this,
|
|
2440
2469
|
C: (f, a) => f(...a)
|
|
@@ -2443,7 +2472,7 @@ var InvitationsHandler = class {
|
|
|
2443
2472
|
log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
|
|
2444
2473
|
id: traceId
|
|
2445
2474
|
}), {
|
|
2446
|
-
F:
|
|
2475
|
+
F: __dxlog_file13,
|
|
2447
2476
|
L: 120,
|
|
2448
2477
|
S: this,
|
|
2449
2478
|
C: (f, a) => f(...a)
|
|
@@ -2458,7 +2487,7 @@ var InvitationsHandler = class {
|
|
|
2458
2487
|
log10("timeout", {
|
|
2459
2488
|
...protocol.toJSON()
|
|
2460
2489
|
}, {
|
|
2461
|
-
F:
|
|
2490
|
+
F: __dxlog_file13,
|
|
2462
2491
|
L: 129,
|
|
2463
2492
|
S: this,
|
|
2464
2493
|
C: (f, a) => f(...a)
|
|
@@ -2467,7 +2496,7 @@ var InvitationsHandler = class {
|
|
|
2467
2496
|
} else {
|
|
2468
2497
|
if (guardedState.error(extension, err)) {
|
|
2469
2498
|
log10.error("failed", err, {
|
|
2470
|
-
F:
|
|
2499
|
+
F: __dxlog_file13,
|
|
2471
2500
|
L: 133,
|
|
2472
2501
|
S: this,
|
|
2473
2502
|
C: (f, a) => f(...a)
|
|
@@ -2478,7 +2507,7 @@ var InvitationsHandler = class {
|
|
|
2478
2507
|
id: traceId,
|
|
2479
2508
|
error: err
|
|
2480
2509
|
}), {
|
|
2481
|
-
F:
|
|
2510
|
+
F: __dxlog_file13,
|
|
2482
2511
|
L: 136,
|
|
2483
2512
|
S: this,
|
|
2484
2513
|
C: (f, a) => f(...a)
|
|
@@ -2492,7 +2521,7 @@ var InvitationsHandler = class {
|
|
|
2492
2521
|
log10("invalid role", {
|
|
2493
2522
|
...err.context
|
|
2494
2523
|
}, {
|
|
2495
|
-
F:
|
|
2524
|
+
F: __dxlog_file13,
|
|
2496
2525
|
L: 144,
|
|
2497
2526
|
S: this,
|
|
2498
2527
|
C: (f, a) => f(...a)
|
|
@@ -2504,7 +2533,7 @@ var InvitationsHandler = class {
|
|
|
2504
2533
|
log10("timeout", {
|
|
2505
2534
|
err
|
|
2506
2535
|
}, {
|
|
2507
|
-
F:
|
|
2536
|
+
F: __dxlog_file13,
|
|
2508
2537
|
L: 149,
|
|
2509
2538
|
S: this,
|
|
2510
2539
|
C: (f, a) => f(...a)
|
|
@@ -2513,7 +2542,7 @@ var InvitationsHandler = class {
|
|
|
2513
2542
|
} else {
|
|
2514
2543
|
if (guardedState.error(extension, err)) {
|
|
2515
2544
|
log10.error("failed", err, {
|
|
2516
|
-
F:
|
|
2545
|
+
F: __dxlog_file13,
|
|
2517
2546
|
L: 153,
|
|
2518
2547
|
S: this,
|
|
2519
2548
|
C: (f, a) => f(...a)
|
|
@@ -2527,7 +2556,7 @@ var InvitationsHandler = class {
|
|
|
2527
2556
|
if (invitation.lifetime && invitation.created) {
|
|
2528
2557
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2529
2558
|
log10.warn("invitation has already expired", void 0, {
|
|
2530
|
-
F:
|
|
2559
|
+
F: __dxlog_file13,
|
|
2531
2560
|
L: 164,
|
|
2532
2561
|
S: this,
|
|
2533
2562
|
C: (f, a) => f(...a)
|
|
@@ -2550,7 +2579,7 @@ var InvitationsHandler = class {
|
|
|
2550
2579
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
2551
2580
|
if (deviceProfile) {
|
|
2552
2581
|
invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2553
|
-
F:
|
|
2582
|
+
F: __dxlog_file13,
|
|
2554
2583
|
L: 197,
|
|
2555
2584
|
S: this,
|
|
2556
2585
|
A: [
|
|
@@ -2568,7 +2597,7 @@ var InvitationsHandler = class {
|
|
|
2568
2597
|
invitationType: Invitation4.Type.DELEGATED,
|
|
2569
2598
|
triedPeers: triedPeersIds.size
|
|
2570
2599
|
}, {
|
|
2571
|
-
F:
|
|
2600
|
+
F: __dxlog_file13,
|
|
2572
2601
|
L: 205,
|
|
2573
2602
|
S: this,
|
|
2574
2603
|
C: (f, a) => f(...a)
|
|
@@ -2595,7 +2624,7 @@ var InvitationsHandler = class {
|
|
|
2595
2624
|
admitted,
|
|
2596
2625
|
currentState: guardedState.current.state
|
|
2597
2626
|
}, {
|
|
2598
|
-
F:
|
|
2627
|
+
F: __dxlog_file13,
|
|
2599
2628
|
L: 233,
|
|
2600
2629
|
S: this,
|
|
2601
2630
|
C: (f, a) => f(...a)
|
|
@@ -2613,7 +2642,7 @@ var InvitationsHandler = class {
|
|
|
2613
2642
|
log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
|
|
2614
2643
|
id: traceId
|
|
2615
2644
|
}), {
|
|
2616
|
-
F:
|
|
2645
|
+
F: __dxlog_file13,
|
|
2617
2646
|
L: 245,
|
|
2618
2647
|
S: this,
|
|
2619
2648
|
C: (f, a) => f(...a)
|
|
@@ -2625,7 +2654,7 @@ var InvitationsHandler = class {
|
|
|
2625
2654
|
log10("connected", {
|
|
2626
2655
|
...protocol.toJSON()
|
|
2627
2656
|
}, {
|
|
2628
|
-
F:
|
|
2657
|
+
F: __dxlog_file13,
|
|
2629
2658
|
L: 256,
|
|
2630
2659
|
S: this,
|
|
2631
2660
|
C: (f, a) => f(...a)
|
|
@@ -2634,7 +2663,7 @@ var InvitationsHandler = class {
|
|
|
2634
2663
|
log10("introduce", {
|
|
2635
2664
|
...protocol.toJSON()
|
|
2636
2665
|
}, {
|
|
2637
|
-
F:
|
|
2666
|
+
F: __dxlog_file13,
|
|
2638
2667
|
L: 260,
|
|
2639
2668
|
S: this,
|
|
2640
2669
|
C: (f, a) => f(...a)
|
|
@@ -2647,7 +2676,7 @@ var InvitationsHandler = class {
|
|
|
2647
2676
|
...protocol.toJSON(),
|
|
2648
2677
|
response: introductionResponse
|
|
2649
2678
|
}, {
|
|
2650
|
-
F:
|
|
2679
|
+
F: __dxlog_file13,
|
|
2651
2680
|
L: 265,
|
|
2652
2681
|
S: this,
|
|
2653
2682
|
C: (f, a) => f(...a)
|
|
@@ -2668,7 +2697,7 @@ var InvitationsHandler = class {
|
|
|
2668
2697
|
log10("request admission", {
|
|
2669
2698
|
...protocol.toJSON()
|
|
2670
2699
|
}, {
|
|
2671
|
-
F:
|
|
2700
|
+
F: __dxlog_file13,
|
|
2672
2701
|
L: 291,
|
|
2673
2702
|
S: this,
|
|
2674
2703
|
C: (f, a) => f(...a)
|
|
@@ -2680,7 +2709,7 @@ var InvitationsHandler = class {
|
|
|
2680
2709
|
log10("admitted by host", {
|
|
2681
2710
|
...protocol.toJSON()
|
|
2682
2711
|
}, {
|
|
2683
|
-
F:
|
|
2712
|
+
F: __dxlog_file13,
|
|
2684
2713
|
L: 302,
|
|
2685
2714
|
S: this,
|
|
2686
2715
|
C: (f, a) => f(...a)
|
|
@@ -2693,7 +2722,7 @@ var InvitationsHandler = class {
|
|
|
2693
2722
|
log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
|
|
2694
2723
|
id: traceId
|
|
2695
2724
|
}), {
|
|
2696
|
-
F:
|
|
2725
|
+
F: __dxlog_file13,
|
|
2697
2726
|
L: 308,
|
|
2698
2727
|
S: this,
|
|
2699
2728
|
C: (f, a) => f(...a)
|
|
@@ -2703,7 +2732,7 @@ var InvitationsHandler = class {
|
|
|
2703
2732
|
log10("timeout", {
|
|
2704
2733
|
...protocol.toJSON()
|
|
2705
2734
|
}, {
|
|
2706
|
-
F:
|
|
2735
|
+
F: __dxlog_file13,
|
|
2707
2736
|
L: 311,
|
|
2708
2737
|
S: this,
|
|
2709
2738
|
C: (f, a) => f(...a)
|
|
@@ -2711,7 +2740,7 @@ var InvitationsHandler = class {
|
|
|
2711
2740
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2712
2741
|
} else {
|
|
2713
2742
|
log10("auth failed", err, {
|
|
2714
|
-
F:
|
|
2743
|
+
F: __dxlog_file13,
|
|
2715
2744
|
L: 314,
|
|
2716
2745
|
S: this,
|
|
2717
2746
|
C: (f, a) => f(...a)
|
|
@@ -2723,7 +2752,7 @@ var InvitationsHandler = class {
|
|
|
2723
2752
|
id: traceId,
|
|
2724
2753
|
error: err
|
|
2725
2754
|
}), {
|
|
2726
|
-
F:
|
|
2755
|
+
F: __dxlog_file13,
|
|
2727
2756
|
L: 318,
|
|
2728
2757
|
S: this,
|
|
2729
2758
|
C: (f, a) => f(...a)
|
|
@@ -2739,7 +2768,7 @@ var InvitationsHandler = class {
|
|
|
2739
2768
|
log10("timeout", {
|
|
2740
2769
|
...protocol.toJSON()
|
|
2741
2770
|
}, {
|
|
2742
|
-
F:
|
|
2771
|
+
F: __dxlog_file13,
|
|
2743
2772
|
L: 327,
|
|
2744
2773
|
S: this,
|
|
2745
2774
|
C: (f, a) => f(...a)
|
|
@@ -2747,7 +2776,7 @@ var InvitationsHandler = class {
|
|
|
2747
2776
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2748
2777
|
} else {
|
|
2749
2778
|
log10("auth failed", err, {
|
|
2750
|
-
F:
|
|
2779
|
+
F: __dxlog_file13,
|
|
2751
2780
|
L: 330,
|
|
2752
2781
|
S: this,
|
|
2753
2782
|
C: (f, a) => f(...a)
|
|
@@ -2765,7 +2794,7 @@ var InvitationsHandler = class {
|
|
|
2765
2794
|
await ctx.dispose();
|
|
2766
2795
|
} else {
|
|
2767
2796
|
invariant9(invitation.swarmKey, void 0, {
|
|
2768
|
-
F:
|
|
2797
|
+
F: __dxlog_file13,
|
|
2769
2798
|
L: 345,
|
|
2770
2799
|
S: this,
|
|
2771
2800
|
A: [
|
|
@@ -2859,16 +2888,29 @@ var InvitationsHandler = class {
|
|
|
2859
2888
|
};
|
|
2860
2889
|
}
|
|
2861
2890
|
_logStateUpdate(invitation, actor, newState) {
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2891
|
+
if (this._isNotTerminal(newState)) {
|
|
2892
|
+
log10("invitation state update", {
|
|
2893
|
+
actor: actor?.constructor.name,
|
|
2894
|
+
newState: stateToString(newState),
|
|
2895
|
+
oldState: stateToString(invitation.state)
|
|
2896
|
+
}, {
|
|
2897
|
+
F: __dxlog_file13,
|
|
2898
|
+
L: 439,
|
|
2899
|
+
S: this,
|
|
2900
|
+
C: (f, a) => f(...a)
|
|
2901
|
+
});
|
|
2902
|
+
} else {
|
|
2903
|
+
log10.info("invitation state update", {
|
|
2904
|
+
actor: actor?.constructor.name,
|
|
2905
|
+
newState: stateToString(newState),
|
|
2906
|
+
oldState: stateToString(invitation.state)
|
|
2907
|
+
}, {
|
|
2908
|
+
F: __dxlog_file13,
|
|
2909
|
+
L: 445,
|
|
2910
|
+
S: this,
|
|
2911
|
+
C: (f, a) => f(...a)
|
|
2912
|
+
});
|
|
2913
|
+
}
|
|
2872
2914
|
}
|
|
2873
2915
|
_isNotTerminal(currentState) {
|
|
2874
2916
|
return ![
|
|
@@ -2882,16 +2924,16 @@ var InvitationsHandler = class {
|
|
|
2882
2924
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2883
2925
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2884
2926
|
log10("guest waiting for authentication code...", void 0, {
|
|
2885
|
-
F:
|
|
2886
|
-
L:
|
|
2927
|
+
F: __dxlog_file13,
|
|
2928
|
+
L: 470,
|
|
2887
2929
|
S: this,
|
|
2888
2930
|
C: (f, a) => f(...a)
|
|
2889
2931
|
});
|
|
2890
2932
|
setState(Invitation4.State.READY_FOR_AUTHENTICATION);
|
|
2891
2933
|
const authCode = await authenticated.wait(options);
|
|
2892
2934
|
log10("sending authentication request", void 0, {
|
|
2893
|
-
F:
|
|
2894
|
-
L:
|
|
2935
|
+
F: __dxlog_file13,
|
|
2936
|
+
L: 474,
|
|
2895
2937
|
S: this,
|
|
2896
2938
|
C: (f, a) => f(...a)
|
|
2897
2939
|
});
|
|
@@ -2909,8 +2951,8 @@ var InvitationsHandler = class {
|
|
|
2909
2951
|
log10("retrying invalid code", {
|
|
2910
2952
|
attempt
|
|
2911
2953
|
}, {
|
|
2912
|
-
F:
|
|
2913
|
-
L:
|
|
2954
|
+
F: __dxlog_file13,
|
|
2955
|
+
L: 485,
|
|
2914
2956
|
S: this,
|
|
2915
2957
|
C: (f, a) => f(...a)
|
|
2916
2958
|
});
|
|
@@ -2927,8 +2969,8 @@ var InvitationsHandler = class {
|
|
|
2927
2969
|
throw new Error("challenge missing in the introduction");
|
|
2928
2970
|
}
|
|
2929
2971
|
log10("sending authentication request", void 0, {
|
|
2930
|
-
F:
|
|
2931
|
-
L:
|
|
2972
|
+
F: __dxlog_file13,
|
|
2973
|
+
L: 504,
|
|
2932
2974
|
S: this,
|
|
2933
2975
|
C: (f, a) => f(...a)
|
|
2934
2976
|
});
|
|
@@ -3048,14 +3090,14 @@ var InvitationsServiceImpl = class {
|
|
|
3048
3090
|
};
|
|
3049
3091
|
|
|
3050
3092
|
// packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
|
|
3051
|
-
import {
|
|
3093
|
+
import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
3052
3094
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
3053
3095
|
import { invariant as invariant10 } from "@dxos/invariant";
|
|
3054
3096
|
import { log as log11 } from "@dxos/log";
|
|
3055
3097
|
import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
|
|
3056
3098
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3057
3099
|
import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3058
|
-
var
|
|
3100
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3059
3101
|
var SpaceInvitationProtocol = class {
|
|
3060
3102
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3061
3103
|
this._spaceManager = _spaceManager;
|
|
@@ -3089,79 +3131,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3089
3131
|
};
|
|
3090
3132
|
}
|
|
3091
3133
|
async admit(invitation, request, guestProfile) {
|
|
3092
|
-
invariant10(this._spaceKey, void 0, {
|
|
3093
|
-
F:
|
|
3094
|
-
L:
|
|
3095
|
-
S: this,
|
|
3096
|
-
A: [
|
|
3097
|
-
"this._spaceKey",
|
|
3098
|
-
""
|
|
3099
|
-
]
|
|
3100
|
-
});
|
|
3101
|
-
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3102
|
-
invariant10(space, void 0, {
|
|
3103
|
-
F: __dxlog_file13,
|
|
3104
|
-
L: 78,
|
|
3105
|
-
S: this,
|
|
3106
|
-
A: [
|
|
3107
|
-
"space",
|
|
3108
|
-
""
|
|
3109
|
-
]
|
|
3110
|
-
});
|
|
3111
|
-
invariant10(request.space, void 0, {
|
|
3112
|
-
F: __dxlog_file13,
|
|
3113
|
-
L: 80,
|
|
3134
|
+
invariant10(this._spaceKey && request.space, void 0, {
|
|
3135
|
+
F: __dxlog_file14,
|
|
3136
|
+
L: 74,
|
|
3114
3137
|
S: this,
|
|
3115
3138
|
A: [
|
|
3116
|
-
"request.space",
|
|
3139
|
+
"this._spaceKey && request.space",
|
|
3117
3140
|
""
|
|
3118
3141
|
]
|
|
3119
3142
|
});
|
|
3120
|
-
const { identityKey, deviceKey } = request.space;
|
|
3121
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== SpaceMember2.Role.REMOVED) {
|
|
3122
|
-
throw new AlreadyJoinedError2();
|
|
3123
|
-
}
|
|
3124
3143
|
log11("writing guest credentials", {
|
|
3125
3144
|
host: this._signingContext.deviceKey,
|
|
3126
|
-
guest: deviceKey
|
|
3145
|
+
guest: request.space.deviceKey
|
|
3127
3146
|
}, {
|
|
3128
|
-
F:
|
|
3129
|
-
L:
|
|
3147
|
+
F: __dxlog_file14,
|
|
3148
|
+
L: 75,
|
|
3130
3149
|
S: this,
|
|
3131
3150
|
C: (f, a) => f(...a)
|
|
3132
3151
|
});
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
"credentials[0].credential",
|
|
3140
|
-
""
|
|
3141
|
-
]
|
|
3142
|
-
});
|
|
3143
|
-
const spaceMemberCredential = credentials[0].credential.credential;
|
|
3144
|
-
invariant10(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3145
|
-
F: __dxlog_file13,
|
|
3146
|
-
L: 103,
|
|
3147
|
-
S: this,
|
|
3148
|
-
A: [
|
|
3149
|
-
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
3150
|
-
""
|
|
3151
|
-
]
|
|
3152
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3153
|
+
spaceKey: this._spaceKey,
|
|
3154
|
+
identityKey: request.space.identityKey,
|
|
3155
|
+
role: invitation.role ?? SpaceMember2.Role.ADMIN,
|
|
3156
|
+
profile: guestProfile,
|
|
3157
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3152
3158
|
});
|
|
3153
|
-
|
|
3159
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3154
3160
|
return {
|
|
3155
3161
|
space: {
|
|
3156
3162
|
credential: spaceMemberCredential,
|
|
3157
|
-
controlTimeframe: space
|
|
3163
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3158
3164
|
}
|
|
3159
3165
|
};
|
|
3160
3166
|
}
|
|
3161
3167
|
async delegate(invitation) {
|
|
3162
3168
|
invariant10(this._spaceKey, void 0, {
|
|
3163
|
-
F:
|
|
3164
|
-
L:
|
|
3169
|
+
F: __dxlog_file14,
|
|
3170
|
+
L: 95,
|
|
3165
3171
|
S: this,
|
|
3166
3172
|
A: [
|
|
3167
3173
|
"this._spaceKey",
|
|
@@ -3170,8 +3176,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3170
3176
|
});
|
|
3171
3177
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3172
3178
|
invariant10(space, void 0, {
|
|
3173
|
-
F:
|
|
3174
|
-
L:
|
|
3179
|
+
F: __dxlog_file14,
|
|
3180
|
+
L: 97,
|
|
3175
3181
|
S: this,
|
|
3176
3182
|
A: [
|
|
3177
3183
|
"space",
|
|
@@ -3180,8 +3186,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3180
3186
|
});
|
|
3181
3187
|
if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3182
3188
|
invariant10(invitation.guestKeypair?.publicKey, void 0, {
|
|
3183
|
-
F:
|
|
3184
|
-
L:
|
|
3189
|
+
F: __dxlog_file14,
|
|
3190
|
+
L: 99,
|
|
3185
3191
|
S: this,
|
|
3186
3192
|
A: [
|
|
3187
3193
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3193,8 +3199,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3193
3199
|
host: this._signingContext.deviceKey,
|
|
3194
3200
|
id: invitation.invitationId
|
|
3195
3201
|
}, {
|
|
3196
|
-
F:
|
|
3197
|
-
L:
|
|
3202
|
+
F: __dxlog_file14,
|
|
3203
|
+
L: 102,
|
|
3198
3204
|
S: this,
|
|
3199
3205
|
C: (f, a) => f(...a)
|
|
3200
3206
|
});
|
|
@@ -3208,8 +3214,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3208
3214
|
guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3209
3215
|
});
|
|
3210
3216
|
invariant10(credential.credential, void 0, {
|
|
3211
|
-
F:
|
|
3212
|
-
L:
|
|
3217
|
+
F: __dxlog_file14,
|
|
3218
|
+
L: 122,
|
|
3213
3219
|
S: this,
|
|
3214
3220
|
A: [
|
|
3215
3221
|
"credential.credential",
|
|
@@ -3223,8 +3229,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3223
3229
|
}
|
|
3224
3230
|
async cancelDelegation(invitation) {
|
|
3225
3231
|
invariant10(this._spaceKey, void 0, {
|
|
3226
|
-
F:
|
|
3227
|
-
L:
|
|
3232
|
+
F: __dxlog_file14,
|
|
3233
|
+
L: 128,
|
|
3228
3234
|
S: this,
|
|
3229
3235
|
A: [
|
|
3230
3236
|
"this._spaceKey",
|
|
@@ -3232,8 +3238,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3232
3238
|
]
|
|
3233
3239
|
});
|
|
3234
3240
|
invariant10(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3235
|
-
F:
|
|
3236
|
-
L:
|
|
3241
|
+
F: __dxlog_file14,
|
|
3242
|
+
L: 129,
|
|
3237
3243
|
S: this,
|
|
3238
3244
|
A: [
|
|
3239
3245
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3242,8 +3248,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3242
3248
|
});
|
|
3243
3249
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3244
3250
|
invariant10(space, void 0, {
|
|
3245
|
-
F:
|
|
3246
|
-
L:
|
|
3251
|
+
F: __dxlog_file14,
|
|
3252
|
+
L: 131,
|
|
3247
3253
|
S: this,
|
|
3248
3254
|
A: [
|
|
3249
3255
|
"space",
|
|
@@ -3254,15 +3260,15 @@ var SpaceInvitationProtocol = class {
|
|
|
3254
3260
|
host: this._signingContext.deviceKey,
|
|
3255
3261
|
id: invitation.invitationId
|
|
3256
3262
|
}, {
|
|
3257
|
-
F:
|
|
3258
|
-
L:
|
|
3263
|
+
F: __dxlog_file14,
|
|
3264
|
+
L: 133,
|
|
3259
3265
|
S: this,
|
|
3260
3266
|
C: (f, a) => f(...a)
|
|
3261
3267
|
});
|
|
3262
3268
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3263
3269
|
invariant10(credential.credential, void 0, {
|
|
3264
|
-
F:
|
|
3265
|
-
L:
|
|
3270
|
+
F: __dxlog_file14,
|
|
3271
|
+
L: 140,
|
|
3266
3272
|
S: this,
|
|
3267
3273
|
A: [
|
|
3268
3274
|
"credential.credential",
|
|
@@ -3300,8 +3306,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3300
3306
|
}
|
|
3301
3307
|
async accept(response) {
|
|
3302
3308
|
invariant10(response.space, void 0, {
|
|
3303
|
-
F:
|
|
3304
|
-
L:
|
|
3309
|
+
F: __dxlog_file14,
|
|
3310
|
+
L: 175,
|
|
3305
3311
|
S: this,
|
|
3306
3312
|
A: [
|
|
3307
3313
|
"response.space",
|
|
@@ -3311,8 +3317,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3311
3317
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3312
3318
|
const assertion = getCredentialAssertion2(credential);
|
|
3313
3319
|
invariant10(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3314
|
-
F:
|
|
3315
|
-
L:
|
|
3320
|
+
F: __dxlog_file14,
|
|
3321
|
+
L: 178,
|
|
3316
3322
|
S: this,
|
|
3317
3323
|
A: [
|
|
3318
3324
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3320,8 +3326,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3320
3326
|
]
|
|
3321
3327
|
});
|
|
3322
3328
|
invariant10(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3323
|
-
F:
|
|
3324
|
-
L:
|
|
3329
|
+
F: __dxlog_file14,
|
|
3330
|
+
L: 179,
|
|
3325
3331
|
S: this,
|
|
3326
3332
|
A: [
|
|
3327
3333
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3355,7 +3361,7 @@ import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
|
3355
3361
|
import { log as log12 } from "@dxos/log";
|
|
3356
3362
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3357
3363
|
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3358
|
-
var
|
|
3364
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3359
3365
|
var InvitationsManager = class {
|
|
3360
3366
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3361
3367
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3398,7 +3404,7 @@ var InvitationsManager = class {
|
|
|
3398
3404
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3399
3405
|
} catch (err) {
|
|
3400
3406
|
log12.catch(err, void 0, {
|
|
3401
|
-
F:
|
|
3407
|
+
F: __dxlog_file15,
|
|
3402
3408
|
L: 82,
|
|
3403
3409
|
S: this,
|
|
3404
3410
|
C: (f, a) => f(...a)
|
|
@@ -3421,7 +3427,7 @@ var InvitationsManager = class {
|
|
|
3421
3427
|
const freshInvitations = persistentInvitations.filter((invitation) => !hasInvitationExpired(invitation));
|
|
3422
3428
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3423
3429
|
invariant11(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3424
|
-
F:
|
|
3430
|
+
F: __dxlog_file15,
|
|
3425
3431
|
L: 103,
|
|
3426
3432
|
S: this,
|
|
3427
3433
|
A: [
|
|
@@ -3440,7 +3446,7 @@ var InvitationsManager = class {
|
|
|
3440
3446
|
};
|
|
3441
3447
|
} catch (err) {
|
|
3442
3448
|
log12.catch(err, void 0, {
|
|
3443
|
-
F:
|
|
3449
|
+
F: __dxlog_file15,
|
|
3444
3450
|
L: 110,
|
|
3445
3451
|
S: this,
|
|
3446
3452
|
C: (f, a) => f(...a)
|
|
@@ -3472,13 +3478,13 @@ var InvitationsManager = class {
|
|
|
3472
3478
|
}
|
|
3473
3479
|
async authenticate({ invitationId, authCode }) {
|
|
3474
3480
|
log12("authenticating...", void 0, {
|
|
3475
|
-
F:
|
|
3481
|
+
F: __dxlog_file15,
|
|
3476
3482
|
L: 140,
|
|
3477
3483
|
S: this,
|
|
3478
3484
|
C: (f, a) => f(...a)
|
|
3479
3485
|
});
|
|
3480
3486
|
invariant11(invitationId, void 0, {
|
|
3481
|
-
F:
|
|
3487
|
+
F: __dxlog_file15,
|
|
3482
3488
|
L: 141,
|
|
3483
3489
|
S: this,
|
|
3484
3490
|
A: [
|
|
@@ -3491,7 +3497,7 @@ var InvitationsManager = class {
|
|
|
3491
3497
|
log12.warn("invalid invitation", {
|
|
3492
3498
|
invitationId
|
|
3493
3499
|
}, {
|
|
3494
|
-
F:
|
|
3500
|
+
F: __dxlog_file15,
|
|
3495
3501
|
L: 144,
|
|
3496
3502
|
S: this,
|
|
3497
3503
|
C: (f, a) => f(...a)
|
|
@@ -3504,13 +3510,13 @@ var InvitationsManager = class {
|
|
|
3504
3510
|
log12("cancelInvitation...", {
|
|
3505
3511
|
invitationId
|
|
3506
3512
|
}, {
|
|
3507
|
-
F:
|
|
3513
|
+
F: __dxlog_file15,
|
|
3508
3514
|
L: 151,
|
|
3509
3515
|
S: this,
|
|
3510
3516
|
C: (f, a) => f(...a)
|
|
3511
3517
|
});
|
|
3512
3518
|
invariant11(invitationId, void 0, {
|
|
3513
|
-
F:
|
|
3519
|
+
F: __dxlog_file15,
|
|
3514
3520
|
L: 152,
|
|
3515
3521
|
S: this,
|
|
3516
3522
|
A: [
|
|
@@ -3584,12 +3590,15 @@ var InvitationsManager = class {
|
|
|
3584
3590
|
stream.error(err);
|
|
3585
3591
|
void ctx.dispose();
|
|
3586
3592
|
}
|
|
3593
|
+
}, {
|
|
3594
|
+
F: __dxlog_file15,
|
|
3595
|
+
L: 234
|
|
3587
3596
|
});
|
|
3588
3597
|
ctx.onDispose(() => {
|
|
3589
3598
|
log12("complete", {
|
|
3590
3599
|
...handler.toJSON()
|
|
3591
3600
|
}, {
|
|
3592
|
-
F:
|
|
3601
|
+
F: __dxlog_file15,
|
|
3593
3602
|
L: 241,
|
|
3594
3603
|
S: this,
|
|
3595
3604
|
C: (f, a) => f(...a)
|
|
@@ -3622,7 +3631,7 @@ var InvitationsManager = class {
|
|
|
3622
3631
|
log12("timeout", {
|
|
3623
3632
|
...handler.toJSON()
|
|
3624
3633
|
}, {
|
|
3625
|
-
F:
|
|
3634
|
+
F: __dxlog_file15,
|
|
3626
3635
|
L: 261,
|
|
3627
3636
|
S: this,
|
|
3628
3637
|
C: (f, a) => f(...a)
|
|
@@ -3633,7 +3642,7 @@ var InvitationsManager = class {
|
|
|
3633
3642
|
});
|
|
3634
3643
|
} else {
|
|
3635
3644
|
log12.warn("auth failed", err, {
|
|
3636
|
-
F:
|
|
3645
|
+
F: __dxlog_file15,
|
|
3637
3646
|
L: 264,
|
|
3638
3647
|
S: this,
|
|
3639
3648
|
C: (f, a) => f(...a)
|
|
@@ -3645,12 +3654,15 @@ var InvitationsManager = class {
|
|
|
3645
3654
|
}
|
|
3646
3655
|
void ctx.dispose();
|
|
3647
3656
|
}
|
|
3657
|
+
}, {
|
|
3658
|
+
F: __dxlog_file15,
|
|
3659
|
+
L: 258
|
|
3648
3660
|
});
|
|
3649
3661
|
ctx.onDispose(() => {
|
|
3650
3662
|
log12("complete", {
|
|
3651
3663
|
...handler.toJSON()
|
|
3652
3664
|
}, {
|
|
3653
|
-
F:
|
|
3665
|
+
F: __dxlog_file15,
|
|
3654
3666
|
L: 271,
|
|
3655
3667
|
S: this,
|
|
3656
3668
|
C: (f, a) => f(...a)
|
|
@@ -3695,7 +3707,7 @@ var InvitationsManager = class {
|
|
|
3695
3707
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3696
3708
|
} catch (err) {
|
|
3697
3709
|
log12.catch(err, void 0, {
|
|
3698
|
-
F:
|
|
3710
|
+
F: __dxlog_file15,
|
|
3699
3711
|
L: 307,
|
|
3700
3712
|
S: this,
|
|
3701
3713
|
C: (f, a) => f(...a)
|
|
@@ -3712,10 +3724,10 @@ var InvitationsManager = class {
|
|
|
3712
3724
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
3713
3725
|
import { Event as Event6, Mutex as Mutex2, scheduleTask as scheduleTask5, sleep as sleep3, synchronized, trackLeaks } from "@dxos/async";
|
|
3714
3726
|
import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
3715
|
-
import { Context as Context8, ContextDisposedError as ContextDisposedError3, cancelWithContext as
|
|
3727
|
+
import { Context as Context8, ContextDisposedError as ContextDisposedError3, cancelWithContext as cancelWithContext4 } from "@dxos/context";
|
|
3716
3728
|
import { timed, warnAfterTimeout } from "@dxos/debug";
|
|
3717
3729
|
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
3718
|
-
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
3730
|
+
import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
|
|
3719
3731
|
import { failedInvariant } from "@dxos/invariant";
|
|
3720
3732
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
3721
3733
|
import { log as log15 } from "@dxos/log";
|
|
@@ -3772,22 +3784,19 @@ var AutomergeSpaceState = class extends Resource2 {
|
|
|
3772
3784
|
};
|
|
3773
3785
|
|
|
3774
3786
|
// packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts
|
|
3775
|
-
import { asyncTimeout as asyncTimeout2 } from "@dxos/async";
|
|
3776
|
-
import { next as am } from "@dxos/automerge/automerge";
|
|
3777
|
-
import { cancelWithContext as cancelWithContext4 } from "@dxos/context";
|
|
3778
3787
|
import { convertLegacyReferences, convertLegacySpaceRootDoc, findInlineObjectOfType, migrateDocument } from "@dxos/echo-db";
|
|
3779
|
-
import {
|
|
3788
|
+
import { SpaceDocVersion } from "@dxos/echo-protocol";
|
|
3780
3789
|
import { TYPE_PROPERTIES } from "@dxos/echo-schema";
|
|
3781
3790
|
import { invariant as invariant12 } from "@dxos/invariant";
|
|
3782
3791
|
import { log as log13 } from "@dxos/log";
|
|
3783
3792
|
import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
3784
|
-
|
|
3785
|
-
var
|
|
3793
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3794
|
+
var LOAD_DOC_TIMEOUT = 1e4;
|
|
3786
3795
|
var runEpochMigration = async (ctx, context) => {
|
|
3787
3796
|
switch (context.migration) {
|
|
3788
3797
|
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3789
|
-
const document = context.
|
|
3790
|
-
await context.
|
|
3798
|
+
const document = context.echoHost.createDoc();
|
|
3799
|
+
await context.echoHost.flush();
|
|
3791
3800
|
return {
|
|
3792
3801
|
newRoot: document.url
|
|
3793
3802
|
};
|
|
@@ -3796,77 +3805,88 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3796
3805
|
if (!context.currentRoot) {
|
|
3797
3806
|
throw new Error("Space does not have an automerge root");
|
|
3798
3807
|
}
|
|
3799
|
-
const rootHandle = context.
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3808
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
|
|
3809
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3810
|
+
});
|
|
3811
|
+
const newRoot = context.echoHost.createDoc(rootHandle.docSync());
|
|
3812
|
+
await context.echoHost.flush();
|
|
3803
3813
|
return {
|
|
3804
3814
|
newRoot: newRoot.url
|
|
3805
3815
|
};
|
|
3806
3816
|
}
|
|
3807
3817
|
case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3808
3818
|
log13.info("Fragmenting", void 0, {
|
|
3809
|
-
F:
|
|
3810
|
-
L:
|
|
3819
|
+
F: __dxlog_file16,
|
|
3820
|
+
L: 64,
|
|
3811
3821
|
S: void 0,
|
|
3812
3822
|
C: (f, a) => f(...a)
|
|
3813
3823
|
});
|
|
3814
3824
|
const currentRootUrl = context.currentRoot;
|
|
3815
|
-
const rootHandle = context.
|
|
3816
|
-
|
|
3825
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3826
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3827
|
+
});
|
|
3817
3828
|
const objects = Object.entries(rootHandle.docSync().objects);
|
|
3818
3829
|
const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
|
|
3819
3830
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3820
3831
|
invariant12(properties, "Properties not found", {
|
|
3821
|
-
F:
|
|
3822
|
-
L:
|
|
3832
|
+
F: __dxlog_file16,
|
|
3833
|
+
L: 75,
|
|
3823
3834
|
S: void 0,
|
|
3824
3835
|
A: [
|
|
3825
3836
|
"properties",
|
|
3826
3837
|
"'Properties not found'"
|
|
3827
3838
|
]
|
|
3828
3839
|
});
|
|
3829
|
-
const
|
|
3840
|
+
const newRoot = context.echoHost.createDoc({
|
|
3830
3841
|
...rootHandle.docSync(),
|
|
3831
3842
|
objects: Object.fromEntries([
|
|
3832
3843
|
properties
|
|
3833
3844
|
])
|
|
3834
|
-
};
|
|
3835
|
-
const newRoot = context.repo.create(newSpaceDoc);
|
|
3845
|
+
});
|
|
3836
3846
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3837
|
-
F:
|
|
3838
|
-
L:
|
|
3847
|
+
F: __dxlog_file16,
|
|
3848
|
+
L: 82,
|
|
3839
3849
|
S: void 0,
|
|
3840
3850
|
A: [
|
|
3841
3851
|
"typeof newRoot.url === 'string' && newRoot.url.length > 0",
|
|
3842
3852
|
""
|
|
3843
3853
|
]
|
|
3844
3854
|
});
|
|
3845
|
-
const
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
], value);
|
|
3855
|
+
const newLinks = [];
|
|
3856
|
+
for (const [id, objData] of otherObjects) {
|
|
3857
|
+
const handle = context.echoHost.createDoc({
|
|
3858
|
+
version: SpaceDocVersion.CURRENT,
|
|
3859
|
+
access: {
|
|
3860
|
+
spaceKey: context.spaceKey.toHex()
|
|
3861
|
+
},
|
|
3862
|
+
objects: {
|
|
3863
|
+
[id]: objData
|
|
3864
|
+
}
|
|
3856
3865
|
});
|
|
3866
|
+
newLinks.push([
|
|
3867
|
+
id,
|
|
3868
|
+
handle.url
|
|
3869
|
+
]);
|
|
3870
|
+
}
|
|
3871
|
+
newRoot.change((doc) => {
|
|
3872
|
+
doc.links ??= {};
|
|
3873
|
+
for (const [id, url] of newLinks) {
|
|
3874
|
+
doc.links[id] = url;
|
|
3875
|
+
}
|
|
3857
3876
|
});
|
|
3858
|
-
await context.
|
|
3877
|
+
await context.echoHost.flush();
|
|
3859
3878
|
return {
|
|
3860
3879
|
newRoot: newRoot.url
|
|
3861
3880
|
};
|
|
3862
3881
|
}
|
|
3863
3882
|
case CreateEpochRequest.Migration.MIGRATE_REFERENCES_TO_DXN: {
|
|
3864
3883
|
const currentRootUrl = context.currentRoot;
|
|
3865
|
-
const rootHandle = context.
|
|
3866
|
-
|
|
3884
|
+
const rootHandle = await context.echoHost.loadDoc(ctx, currentRootUrl, {
|
|
3885
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3886
|
+
});
|
|
3867
3887
|
invariant12(rootHandle.docSync(), "Root doc not found", {
|
|
3868
|
-
F:
|
|
3869
|
-
L:
|
|
3888
|
+
F: __dxlog_file16,
|
|
3889
|
+
L: 115,
|
|
3870
3890
|
S: void 0,
|
|
3871
3891
|
A: [
|
|
3872
3892
|
"rootHandle.docSync()",
|
|
@@ -3875,40 +3895,59 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3875
3895
|
});
|
|
3876
3896
|
const newRootContent = await convertLegacySpaceRootDoc(structuredClone(rootHandle.docSync()));
|
|
3877
3897
|
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3898
|
+
try {
|
|
3899
|
+
const handle = await context.echoHost.loadDoc(ctx, url, {
|
|
3900
|
+
timeout: LOAD_DOC_TIMEOUT
|
|
3901
|
+
});
|
|
3902
|
+
invariant12(handle.docSync(), void 0, {
|
|
3903
|
+
F: __dxlog_file16,
|
|
3904
|
+
L: 122,
|
|
3905
|
+
S: void 0,
|
|
3906
|
+
A: [
|
|
3907
|
+
"handle.docSync()",
|
|
3908
|
+
""
|
|
3909
|
+
]
|
|
3910
|
+
});
|
|
3911
|
+
const newDoc = await convertLegacyReferences(structuredClone(handle.docSync()));
|
|
3912
|
+
const migratedDoc = migrateDocument(handle.docSync(), newDoc);
|
|
3913
|
+
const newHandle = context.echoHost.createDoc(migratedDoc, {
|
|
3914
|
+
preserveHistory: true
|
|
3915
|
+
});
|
|
3916
|
+
newRootContent.links[id] = newHandle.url;
|
|
3917
|
+
} catch (err) {
|
|
3918
|
+
log13.warn("Failed to migrate reference", {
|
|
3919
|
+
id,
|
|
3920
|
+
url,
|
|
3921
|
+
error: err
|
|
3922
|
+
}, {
|
|
3923
|
+
F: __dxlog_file16,
|
|
3924
|
+
L: 128,
|
|
3925
|
+
S: void 0,
|
|
3926
|
+
C: (f, a) => f(...a)
|
|
3927
|
+
});
|
|
3928
|
+
delete newRootContent.links[id];
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
const migratedRoot = migrateDocument(rootHandle.docSync(), newRootContent);
|
|
3932
|
+
const newRoot = context.echoHost.createDoc(migratedRoot, {
|
|
3933
|
+
preserveHistory: true
|
|
3934
|
+
});
|
|
3935
|
+
await context.echoHost.flush();
|
|
3936
|
+
return {
|
|
3937
|
+
newRoot: newRoot.url
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3940
|
+
case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3941
|
+
invariant12(context.newAutomergeRoot, void 0, {
|
|
3942
|
+
F: __dxlog_file16,
|
|
3943
|
+
L: 143,
|
|
3944
|
+
S: void 0,
|
|
3906
3945
|
A: [
|
|
3907
3946
|
"context.newAutomergeRoot",
|
|
3908
3947
|
""
|
|
3909
3948
|
]
|
|
3910
3949
|
});
|
|
3911
|
-
await context.
|
|
3950
|
+
await context.echoHost.flush();
|
|
3912
3951
|
return {
|
|
3913
3952
|
newRoot: context.newAutomergeRoot
|
|
3914
3953
|
};
|
|
@@ -3926,14 +3965,17 @@ import { log as log14 } from "@dxos/log";
|
|
|
3926
3965
|
import { schema as schema4 } from "@dxos/protocols";
|
|
3927
3966
|
import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
|
|
3928
3967
|
import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet4, entry } from "@dxos/util";
|
|
3929
|
-
var
|
|
3968
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3930
3969
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3931
3970
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3932
3971
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3933
3972
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3934
3973
|
var NotarizationPlugin = class {
|
|
3935
3974
|
constructor() {
|
|
3936
|
-
this._ctx = new Context7(
|
|
3975
|
+
this._ctx = new Context7(void 0, {
|
|
3976
|
+
F: __dxlog_file17,
|
|
3977
|
+
L: 62
|
|
3978
|
+
});
|
|
3937
3979
|
this._extensionOpened = new Event5();
|
|
3938
3980
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3939
3981
|
this._processedCredentials = new ComplexSet4(PublicKey9.hash);
|
|
@@ -3954,13 +3996,13 @@ var NotarizationPlugin = class {
|
|
|
3954
3996
|
log14("notarize", {
|
|
3955
3997
|
credentials
|
|
3956
3998
|
}, {
|
|
3957
|
-
F:
|
|
3999
|
+
F: __dxlog_file17,
|
|
3958
4000
|
L: 90,
|
|
3959
4001
|
S: this,
|
|
3960
4002
|
C: (f, a) => f(...a)
|
|
3961
4003
|
});
|
|
3962
4004
|
invariant13(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3963
|
-
F:
|
|
4005
|
+
F: __dxlog_file17,
|
|
3964
4006
|
L: 91,
|
|
3965
4007
|
S: this,
|
|
3966
4008
|
A: [
|
|
@@ -3974,7 +4016,7 @@ var NotarizationPlugin = class {
|
|
|
3974
4016
|
log14.warn("Notarization error", {
|
|
3975
4017
|
err
|
|
3976
4018
|
}, {
|
|
3977
|
-
F:
|
|
4019
|
+
F: __dxlog_file17,
|
|
3978
4020
|
L: 99,
|
|
3979
4021
|
S: this,
|
|
3980
4022
|
C: (f, a) => f(...a)
|
|
@@ -3990,7 +4032,7 @@ var NotarizationPlugin = class {
|
|
|
3990
4032
|
timeout,
|
|
3991
4033
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3992
4034
|
}, {
|
|
3993
|
-
F:
|
|
4035
|
+
F: __dxlog_file17,
|
|
3994
4036
|
L: 111,
|
|
3995
4037
|
S: this,
|
|
3996
4038
|
C: (f, a) => f(...a)
|
|
@@ -4013,7 +4055,7 @@ var NotarizationPlugin = class {
|
|
|
4013
4055
|
log14.info("Exhausted all peers to notarize with", {
|
|
4014
4056
|
retryIn: retryTimeout
|
|
4015
4057
|
}, {
|
|
4016
|
-
F:
|
|
4058
|
+
F: __dxlog_file17,
|
|
4017
4059
|
L: 136,
|
|
4018
4060
|
S: this,
|
|
4019
4061
|
C: (f, a) => f(...a)
|
|
@@ -4027,7 +4069,7 @@ var NotarizationPlugin = class {
|
|
|
4027
4069
|
peer: peer.localPeerId,
|
|
4028
4070
|
credentialId: credentials.map((credential) => credential.id)
|
|
4029
4071
|
}, {
|
|
4030
|
-
F:
|
|
4072
|
+
F: __dxlog_file17,
|
|
4031
4073
|
L: 143,
|
|
4032
4074
|
S: this,
|
|
4033
4075
|
C: (f, a) => f(...a)
|
|
@@ -4036,7 +4078,7 @@ var NotarizationPlugin = class {
|
|
|
4036
4078
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4037
4079
|
});
|
|
4038
4080
|
log14("success", void 0, {
|
|
4039
|
-
F:
|
|
4081
|
+
F: __dxlog_file17,
|
|
4040
4082
|
L: 147,
|
|
4041
4083
|
S: this,
|
|
4042
4084
|
C: (f, a) => f(...a)
|
|
@@ -4045,7 +4087,7 @@ var NotarizationPlugin = class {
|
|
|
4045
4087
|
} catch (err) {
|
|
4046
4088
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4047
4089
|
log14.info("error notarizing (recoverable)", err, {
|
|
4048
|
-
F:
|
|
4090
|
+
F: __dxlog_file17,
|
|
4049
4091
|
L: 151,
|
|
4050
4092
|
S: this,
|
|
4051
4093
|
C: (f, a) => f(...a)
|
|
@@ -4063,7 +4105,7 @@ var NotarizationPlugin = class {
|
|
|
4063
4105
|
errors.wait()
|
|
4064
4106
|
]);
|
|
4065
4107
|
log14("done", void 0, {
|
|
4066
|
-
F:
|
|
4108
|
+
F: __dxlog_file17,
|
|
4067
4109
|
L: 162,
|
|
4068
4110
|
S: this,
|
|
4069
4111
|
C: (f, a) => f(...a)
|
|
@@ -4085,7 +4127,7 @@ var NotarizationPlugin = class {
|
|
|
4085
4127
|
}
|
|
4086
4128
|
setWriter(writer) {
|
|
4087
4129
|
invariant13(!this._writer, "Writer already set.", {
|
|
4088
|
-
F:
|
|
4130
|
+
F: __dxlog_file17,
|
|
4089
4131
|
L: 181,
|
|
4090
4132
|
S: this,
|
|
4091
4133
|
A: [
|
|
@@ -4110,7 +4152,7 @@ var NotarizationPlugin = class {
|
|
|
4110
4152
|
}
|
|
4111
4153
|
for (const credential of request.credentials ?? []) {
|
|
4112
4154
|
invariant13(credential.id, "Credential must have an id", {
|
|
4113
|
-
F:
|
|
4155
|
+
F: __dxlog_file17,
|
|
4114
4156
|
L: 200,
|
|
4115
4157
|
S: this,
|
|
4116
4158
|
A: [
|
|
@@ -4130,7 +4172,7 @@ var NotarizationPlugin = class {
|
|
|
4130
4172
|
log14("extension opened", {
|
|
4131
4173
|
peer: extension.localPeerId
|
|
4132
4174
|
}, {
|
|
4133
|
-
F:
|
|
4175
|
+
F: __dxlog_file17,
|
|
4134
4176
|
L: 211,
|
|
4135
4177
|
S: this,
|
|
4136
4178
|
C: (f, a) => f(...a)
|
|
@@ -4142,7 +4184,7 @@ var NotarizationPlugin = class {
|
|
|
4142
4184
|
log14("extension closed", {
|
|
4143
4185
|
peer: extension.localPeerId
|
|
4144
4186
|
}, {
|
|
4145
|
-
F:
|
|
4187
|
+
F: __dxlog_file17,
|
|
4146
4188
|
L: 216,
|
|
4147
4189
|
S: this,
|
|
4148
4190
|
C: (f, a) => f(...a)
|
|
@@ -4259,10 +4301,13 @@ function _using_ctx() {
|
|
|
4259
4301
|
}
|
|
4260
4302
|
};
|
|
4261
4303
|
}
|
|
4262
|
-
var
|
|
4304
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4263
4305
|
var DataSpace = class {
|
|
4264
4306
|
constructor(params) {
|
|
4265
|
-
this._ctx = new Context8(
|
|
4307
|
+
this._ctx = new Context8(void 0, {
|
|
4308
|
+
F: __dxlog_file18,
|
|
4309
|
+
L: 84
|
|
4310
|
+
});
|
|
4266
4311
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4267
4312
|
this._cache = void 0;
|
|
4268
4313
|
// TODO(dmaretskyi): Move into Space?
|
|
@@ -4296,7 +4341,7 @@ var DataSpace = class {
|
|
|
4296
4341
|
log15("new state", {
|
|
4297
4342
|
state: SpaceState2[this._state]
|
|
4298
4343
|
}, {
|
|
4299
|
-
F:
|
|
4344
|
+
F: __dxlog_file18,
|
|
4300
4345
|
L: 146,
|
|
4301
4346
|
S: this,
|
|
4302
4347
|
C: (f, a) => f(...a)
|
|
@@ -4351,12 +4396,15 @@ var DataSpace = class {
|
|
|
4351
4396
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4352
4397
|
await this._automergeSpaceState.open();
|
|
4353
4398
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4354
|
-
await this._inner.open(new Context8(
|
|
4399
|
+
await this._inner.open(new Context8(void 0, {
|
|
4400
|
+
F: __dxlog_file18,
|
|
4401
|
+
L: 215
|
|
4402
|
+
}));
|
|
4355
4403
|
this._state = SpaceState2.CONTROL_ONLY;
|
|
4356
4404
|
log15("new state", {
|
|
4357
4405
|
state: SpaceState2[this._state]
|
|
4358
4406
|
}, {
|
|
4359
|
-
F:
|
|
4407
|
+
F: __dxlog_file18,
|
|
4360
4408
|
L: 217,
|
|
4361
4409
|
S: this,
|
|
4362
4410
|
C: (f, a) => f(...a)
|
|
@@ -4374,13 +4422,16 @@ var DataSpace = class {
|
|
|
4374
4422
|
log15("new state", {
|
|
4375
4423
|
state: SpaceState2[this._state]
|
|
4376
4424
|
}, {
|
|
4377
|
-
F:
|
|
4425
|
+
F: __dxlog_file18,
|
|
4378
4426
|
L: 231,
|
|
4379
4427
|
S: this,
|
|
4380
4428
|
C: (f, a) => f(...a)
|
|
4381
4429
|
});
|
|
4382
4430
|
await this._ctx.dispose();
|
|
4383
|
-
this._ctx = new Context8(
|
|
4431
|
+
this._ctx = new Context8(void 0, {
|
|
4432
|
+
F: __dxlog_file18,
|
|
4433
|
+
L: 233
|
|
4434
|
+
});
|
|
4384
4435
|
await this.authVerifier.close();
|
|
4385
4436
|
await this._inner.close();
|
|
4386
4437
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -4407,7 +4458,7 @@ var DataSpace = class {
|
|
|
4407
4458
|
} catch (err) {
|
|
4408
4459
|
if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
|
|
4409
4460
|
log15("data pipeline initialization cancelled", err, {
|
|
4410
|
-
F:
|
|
4461
|
+
F: __dxlog_file18,
|
|
4411
4462
|
L: 265,
|
|
4412
4463
|
S: this,
|
|
4413
4464
|
C: (f, a) => f(...a)
|
|
@@ -4415,7 +4466,7 @@ var DataSpace = class {
|
|
|
4415
4466
|
return;
|
|
4416
4467
|
}
|
|
4417
4468
|
log15.error("Error initializing data pipeline", err, {
|
|
4418
|
-
F:
|
|
4469
|
+
F: __dxlog_file18,
|
|
4419
4470
|
L: 269,
|
|
4420
4471
|
S: this,
|
|
4421
4472
|
C: (f, a) => f(...a)
|
|
@@ -4424,7 +4475,7 @@ var DataSpace = class {
|
|
|
4424
4475
|
log15("new state", {
|
|
4425
4476
|
state: SpaceState2[this._state]
|
|
4426
4477
|
}, {
|
|
4427
|
-
F:
|
|
4478
|
+
F: __dxlog_file18,
|
|
4428
4479
|
L: 271,
|
|
4429
4480
|
S: this,
|
|
4430
4481
|
C: (f, a) => f(...a)
|
|
@@ -4444,7 +4495,7 @@ var DataSpace = class {
|
|
|
4444
4495
|
log15("new state", {
|
|
4445
4496
|
state: SpaceState2[this._state]
|
|
4446
4497
|
}, {
|
|
4447
|
-
F:
|
|
4498
|
+
F: __dxlog_file18,
|
|
4448
4499
|
L: 287,
|
|
4449
4500
|
S: this,
|
|
4450
4501
|
C: (f, a) => f(...a)
|
|
@@ -4461,7 +4512,7 @@ var DataSpace = class {
|
|
|
4461
4512
|
log15("new state", {
|
|
4462
4513
|
state: SpaceState2[this._state]
|
|
4463
4514
|
}, {
|
|
4464
|
-
F:
|
|
4515
|
+
F: __dxlog_file18,
|
|
4465
4516
|
L: 306,
|
|
4466
4517
|
S: this,
|
|
4467
4518
|
C: (f, a) => f(...a)
|
|
@@ -4477,7 +4528,7 @@ var DataSpace = class {
|
|
|
4477
4528
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4478
4529
|
await this._createWritableFeeds();
|
|
4479
4530
|
log15("writable feeds created", void 0, {
|
|
4480
|
-
F:
|
|
4531
|
+
F: __dxlog_file18,
|
|
4481
4532
|
L: 322,
|
|
4482
4533
|
S: this,
|
|
4483
4534
|
C: (f, a) => f(...a)
|
|
@@ -4540,7 +4591,7 @@ var DataSpace = class {
|
|
|
4540
4591
|
space: this.key,
|
|
4541
4592
|
rootUrl
|
|
4542
4593
|
}, {
|
|
4543
|
-
F:
|
|
4594
|
+
F: __dxlog_file18,
|
|
4544
4595
|
L: 388,
|
|
4545
4596
|
S: this,
|
|
4546
4597
|
C: (f, a) => f(...a)
|
|
@@ -4551,7 +4602,7 @@ var DataSpace = class {
|
|
|
4551
4602
|
try {
|
|
4552
4603
|
var _usingCtx = _using_ctx();
|
|
4553
4604
|
await warnAfterTimeout(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4554
|
-
await
|
|
4605
|
+
await cancelWithContext4(this._ctx, handle.whenReady());
|
|
4555
4606
|
});
|
|
4556
4607
|
if (this._ctx.disposed) {
|
|
4557
4608
|
return;
|
|
@@ -4570,7 +4621,7 @@ var DataSpace = class {
|
|
|
4570
4621
|
}
|
|
4571
4622
|
const root = await this._echoHost.openSpaceRoot(handle.url);
|
|
4572
4623
|
this._databaseRoot = root;
|
|
4573
|
-
if (root.getVersion() !==
|
|
4624
|
+
if (root.getVersion() !== SpaceDocVersion2.CURRENT) {
|
|
4574
4625
|
if (this._state !== SpaceState2.REQUIRES_MIGRATION) {
|
|
4575
4626
|
this._state = SpaceState2.REQUIRES_MIGRATION;
|
|
4576
4627
|
this.stateUpdate.emit();
|
|
@@ -4594,8 +4645,8 @@ var DataSpace = class {
|
|
|
4594
4645
|
rootUrl,
|
|
4595
4646
|
err
|
|
4596
4647
|
}, {
|
|
4597
|
-
F:
|
|
4598
|
-
L:
|
|
4648
|
+
F: __dxlog_file18,
|
|
4649
|
+
L: 433,
|
|
4599
4650
|
S: this,
|
|
4600
4651
|
C: (f, a) => f(...a)
|
|
4601
4652
|
});
|
|
@@ -4623,7 +4674,7 @@ var DataSpace = class {
|
|
|
4623
4674
|
return null;
|
|
4624
4675
|
}
|
|
4625
4676
|
const { newRoot } = await runEpochMigration(ctx, {
|
|
4626
|
-
|
|
4677
|
+
echoHost: this._echoHost,
|
|
4627
4678
|
spaceId: this.id,
|
|
4628
4679
|
spaceKey: this.key,
|
|
4629
4680
|
migration: options.migration,
|
|
@@ -4680,8 +4731,8 @@ var DataSpace = class {
|
|
|
4680
4731
|
log15("new state", {
|
|
4681
4732
|
state: SpaceState2[this._state]
|
|
4682
4733
|
}, {
|
|
4683
|
-
F:
|
|
4684
|
-
L:
|
|
4734
|
+
F: __dxlog_file18,
|
|
4735
|
+
L: 514,
|
|
4685
4736
|
S: this,
|
|
4686
4737
|
C: (f, a) => f(...a)
|
|
4687
4738
|
});
|
|
@@ -4740,21 +4791,23 @@ DataSpace = _ts_decorate4([
|
|
|
4740
4791
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
4741
4792
|
import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
4742
4793
|
import { PropertiesType } from "@dxos/client-protocol";
|
|
4743
|
-
import { Context as Context9, cancelWithContext as
|
|
4744
|
-
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4794
|
+
import { Context as Context9, cancelWithContext as cancelWithContext5 } from "@dxos/context";
|
|
4795
|
+
import { getCredentialAssertion as getCredentialAssertion3, createAdmissionCredentials } from "@dxos/credentials";
|
|
4745
4796
|
import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2 } from "@dxos/echo-db";
|
|
4746
4797
|
import { AuthStatus } from "@dxos/echo-pipeline";
|
|
4747
|
-
import {
|
|
4798
|
+
import { CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
4799
|
+
import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion3, encodeReference } from "@dxos/echo-protocol";
|
|
4748
4800
|
import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
|
|
4801
|
+
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
4749
4802
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4750
4803
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4751
4804
|
import { log as log16 } from "@dxos/log";
|
|
4752
|
-
import { trace as Trace2 } from "@dxos/protocols";
|
|
4805
|
+
import { trace as Trace2, AlreadyJoinedError as AlreadyJoinedError3 } from "@dxos/protocols";
|
|
4753
4806
|
import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4754
4807
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4755
4808
|
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
4756
4809
|
import { trace as trace7 } from "@dxos/tracing";
|
|
4757
|
-
import { ComplexMap as ComplexMap3, assignDeep
|
|
4810
|
+
import { ComplexMap as ComplexMap3, assignDeep, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
|
|
4758
4811
|
|
|
4759
4812
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
4760
4813
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -4837,7 +4890,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4837
4890
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4838
4891
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4839
4892
|
}
|
|
4840
|
-
var
|
|
4893
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4841
4894
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4842
4895
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4843
4896
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4851,7 +4904,10 @@ var DataSpaceManager = class {
|
|
|
4851
4904
|
this._echoHost = _echoHost;
|
|
4852
4905
|
this._invitationsManager = _invitationsManager;
|
|
4853
4906
|
this._params = _params;
|
|
4854
|
-
this._ctx = new Context9(
|
|
4907
|
+
this._ctx = new Context9(void 0, {
|
|
4908
|
+
F: __dxlog_file19,
|
|
4909
|
+
L: 104
|
|
4910
|
+
});
|
|
4855
4911
|
this.updated = new Event7();
|
|
4856
4912
|
this._spaces = new ComplexMap3(PublicKey11.hash);
|
|
4857
4913
|
this._isOpen = false;
|
|
@@ -4885,24 +4941,24 @@ var DataSpaceManager = class {
|
|
|
4885
4941
|
}
|
|
4886
4942
|
async open() {
|
|
4887
4943
|
log16("open", void 0, {
|
|
4888
|
-
F:
|
|
4889
|
-
L:
|
|
4944
|
+
F: __dxlog_file19,
|
|
4945
|
+
L: 156,
|
|
4890
4946
|
S: this,
|
|
4891
4947
|
C: (f, a) => f(...a)
|
|
4892
4948
|
});
|
|
4893
4949
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
4894
4950
|
id: this._instanceId
|
|
4895
4951
|
}), {
|
|
4896
|
-
F:
|
|
4897
|
-
L:
|
|
4952
|
+
F: __dxlog_file19,
|
|
4953
|
+
L: 157,
|
|
4898
4954
|
S: this,
|
|
4899
4955
|
C: (f, a) => f(...a)
|
|
4900
4956
|
});
|
|
4901
4957
|
log16("metadata loaded", {
|
|
4902
4958
|
spaces: this._metadataStore.spaces.length
|
|
4903
4959
|
}, {
|
|
4904
|
-
F:
|
|
4905
|
-
L:
|
|
4960
|
+
F: __dxlog_file19,
|
|
4961
|
+
L: 158,
|
|
4906
4962
|
S: this,
|
|
4907
4963
|
C: (f, a) => f(...a)
|
|
4908
4964
|
});
|
|
@@ -4911,8 +4967,8 @@ var DataSpaceManager = class {
|
|
|
4911
4967
|
log16("load space", {
|
|
4912
4968
|
spaceMetadata
|
|
4913
4969
|
}, {
|
|
4914
|
-
F:
|
|
4915
|
-
L:
|
|
4970
|
+
F: __dxlog_file19,
|
|
4971
|
+
L: 162,
|
|
4916
4972
|
S: this,
|
|
4917
4973
|
C: (f, a) => f(...a)
|
|
4918
4974
|
});
|
|
@@ -4922,8 +4978,8 @@ var DataSpaceManager = class {
|
|
|
4922
4978
|
spaceMetadata,
|
|
4923
4979
|
err
|
|
4924
4980
|
}, {
|
|
4925
|
-
F:
|
|
4926
|
-
L:
|
|
4981
|
+
F: __dxlog_file19,
|
|
4982
|
+
L: 165,
|
|
4927
4983
|
S: this,
|
|
4928
4984
|
C: (f, a) => f(...a)
|
|
4929
4985
|
});
|
|
@@ -4934,16 +4990,16 @@ var DataSpaceManager = class {
|
|
|
4934
4990
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
4935
4991
|
id: this._instanceId
|
|
4936
4992
|
}), {
|
|
4937
|
-
F:
|
|
4938
|
-
L:
|
|
4993
|
+
F: __dxlog_file19,
|
|
4994
|
+
L: 172,
|
|
4939
4995
|
S: this,
|
|
4940
4996
|
C: (f, a) => f(...a)
|
|
4941
4997
|
});
|
|
4942
4998
|
}
|
|
4943
4999
|
async close() {
|
|
4944
5000
|
log16("close", void 0, {
|
|
4945
|
-
F:
|
|
4946
|
-
L:
|
|
5001
|
+
F: __dxlog_file19,
|
|
5002
|
+
L: 177,
|
|
4947
5003
|
S: this,
|
|
4948
5004
|
C: (f, a) => f(...a)
|
|
4949
5005
|
});
|
|
@@ -4959,8 +5015,8 @@ var DataSpaceManager = class {
|
|
|
4959
5015
|
*/
|
|
4960
5016
|
async createSpace() {
|
|
4961
5017
|
invariant14(this._isOpen, "Not open.", {
|
|
4962
|
-
F:
|
|
4963
|
-
L:
|
|
5018
|
+
F: __dxlog_file19,
|
|
5019
|
+
L: 191,
|
|
4964
5020
|
S: this,
|
|
4965
5021
|
A: [
|
|
4966
5022
|
"this._isOpen",
|
|
@@ -4980,8 +5036,8 @@ var DataSpaceManager = class {
|
|
|
4980
5036
|
log16("creating space...", {
|
|
4981
5037
|
spaceKey
|
|
4982
5038
|
}, {
|
|
4983
|
-
F:
|
|
4984
|
-
L:
|
|
5039
|
+
F: __dxlog_file19,
|
|
5040
|
+
L: 203,
|
|
4985
5041
|
S: this,
|
|
4986
5042
|
C: (f, a) => f(...a)
|
|
4987
5043
|
});
|
|
@@ -4992,8 +5048,8 @@ var DataSpaceManager = class {
|
|
|
4992
5048
|
await this._metadataStore.addSpace(metadata);
|
|
4993
5049
|
const memberCredential = credentials[1];
|
|
4994
5050
|
invariant14(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4995
|
-
F:
|
|
4996
|
-
L:
|
|
5051
|
+
F: __dxlog_file19,
|
|
5052
|
+
L: 213,
|
|
4997
5053
|
S: this,
|
|
4998
5054
|
A: [
|
|
4999
5055
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -5010,11 +5066,11 @@ var DataSpaceManager = class {
|
|
|
5010
5066
|
return false;
|
|
5011
5067
|
}
|
|
5012
5068
|
switch (space.databaseRoot.getVersion()) {
|
|
5013
|
-
case
|
|
5069
|
+
case SpaceDocVersion3.CURRENT: {
|
|
5014
5070
|
const [_, properties] = findInlineObjectOfType2(space.databaseRoot.docSync(), TYPE_PROPERTIES2) ?? [];
|
|
5015
5071
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5016
5072
|
}
|
|
5017
|
-
case
|
|
5073
|
+
case SpaceDocVersion3.LEGACY: {
|
|
5018
5074
|
const convertedDoc = await convertLegacyReferences2(space.databaseRoot.docSync());
|
|
5019
5075
|
const [_, properties] = findInlineObjectOfType2(convertedDoc, LEGACY_TYPE_PROPERTIES) ?? [];
|
|
5020
5076
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
@@ -5024,8 +5080,8 @@ var DataSpaceManager = class {
|
|
|
5024
5080
|
version: space.databaseRoot.getVersion(),
|
|
5025
5081
|
spaceId: space.id
|
|
5026
5082
|
}, {
|
|
5027
|
-
F:
|
|
5028
|
-
L:
|
|
5083
|
+
F: __dxlog_file19,
|
|
5084
|
+
L: 238,
|
|
5029
5085
|
S: this,
|
|
5030
5086
|
C: (f, a) => f(...a)
|
|
5031
5087
|
});
|
|
@@ -5048,7 +5104,7 @@ var DataSpaceManager = class {
|
|
|
5048
5104
|
};
|
|
5049
5105
|
const propertiesId = generateEchoId();
|
|
5050
5106
|
document.change((doc) => {
|
|
5051
|
-
|
|
5107
|
+
assignDeep(doc, [
|
|
5052
5108
|
"objects",
|
|
5053
5109
|
propertiesId
|
|
5054
5110
|
], properties);
|
|
@@ -5059,8 +5115,8 @@ var DataSpaceManager = class {
|
|
|
5059
5115
|
async _getSpaceRootDocument(space) {
|
|
5060
5116
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5061
5117
|
invariant14(automergeIndex, void 0, {
|
|
5062
|
-
F:
|
|
5063
|
-
L:
|
|
5118
|
+
F: __dxlog_file19,
|
|
5119
|
+
L: 271,
|
|
5064
5120
|
S: this,
|
|
5065
5121
|
A: [
|
|
5066
5122
|
"automergeIndex",
|
|
@@ -5076,14 +5132,14 @@ var DataSpaceManager = class {
|
|
|
5076
5132
|
log16("accept space", {
|
|
5077
5133
|
opts
|
|
5078
5134
|
}, {
|
|
5079
|
-
F:
|
|
5080
|
-
L:
|
|
5135
|
+
F: __dxlog_file19,
|
|
5136
|
+
L: 280,
|
|
5081
5137
|
S: this,
|
|
5082
5138
|
C: (f, a) => f(...a)
|
|
5083
5139
|
});
|
|
5084
5140
|
invariant14(this._isOpen, "Not open.", {
|
|
5085
|
-
F:
|
|
5086
|
-
L:
|
|
5141
|
+
F: __dxlog_file19,
|
|
5142
|
+
L: 281,
|
|
5087
5143
|
S: this,
|
|
5088
5144
|
A: [
|
|
5089
5145
|
"this._isOpen",
|
|
@@ -5091,8 +5147,8 @@ var DataSpaceManager = class {
|
|
|
5091
5147
|
]
|
|
5092
5148
|
});
|
|
5093
5149
|
invariant14(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5094
|
-
F:
|
|
5095
|
-
L:
|
|
5150
|
+
F: __dxlog_file19,
|
|
5151
|
+
L: 282,
|
|
5096
5152
|
S: this,
|
|
5097
5153
|
A: [
|
|
5098
5154
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5112,23 +5168,72 @@ var DataSpaceManager = class {
|
|
|
5112
5168
|
this.updated.emit();
|
|
5113
5169
|
return space;
|
|
5114
5170
|
}
|
|
5171
|
+
async admitMember(options) {
|
|
5172
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5173
|
+
invariant14(space, void 0, {
|
|
5174
|
+
F: __dxlog_file19,
|
|
5175
|
+
L: 302,
|
|
5176
|
+
S: this,
|
|
5177
|
+
A: [
|
|
5178
|
+
"space",
|
|
5179
|
+
""
|
|
5180
|
+
]
|
|
5181
|
+
});
|
|
5182
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== SpaceMember6.Role.REMOVED) {
|
|
5183
|
+
throw new AlreadyJoinedError3();
|
|
5184
|
+
}
|
|
5185
|
+
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5186
|
+
invariant14(credentials[0].credential, void 0, {
|
|
5187
|
+
F: __dxlog_file19,
|
|
5188
|
+
L: 321,
|
|
5189
|
+
S: this,
|
|
5190
|
+
A: [
|
|
5191
|
+
"credentials[0].credential",
|
|
5192
|
+
""
|
|
5193
|
+
]
|
|
5194
|
+
});
|
|
5195
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5196
|
+
invariant14(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5197
|
+
F: __dxlog_file19,
|
|
5198
|
+
L: 323,
|
|
5199
|
+
S: this,
|
|
5200
|
+
A: [
|
|
5201
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5202
|
+
""
|
|
5203
|
+
]
|
|
5204
|
+
});
|
|
5205
|
+
await writeMessages3(space.controlPipeline.writer, credentials);
|
|
5206
|
+
return spaceMemberCredential;
|
|
5207
|
+
}
|
|
5115
5208
|
/**
|
|
5116
5209
|
* Wait until the space data pipeline is fully initialized.
|
|
5117
5210
|
* Used by invitation handler.
|
|
5118
5211
|
* TODO(dmaretskyi): Consider removing.
|
|
5119
5212
|
*/
|
|
5120
5213
|
async waitUntilSpaceReady(spaceKey) {
|
|
5121
|
-
await
|
|
5214
|
+
await cancelWithContext5(this._ctx, this.updated.waitForCondition(() => {
|
|
5122
5215
|
const space = this._spaces.get(spaceKey);
|
|
5123
5216
|
return !!space && space.state === SpaceState3.READY;
|
|
5124
5217
|
}));
|
|
5125
5218
|
}
|
|
5219
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5220
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5221
|
+
spaceKey,
|
|
5222
|
+
identityKey: this._signingContext.identityKey,
|
|
5223
|
+
timeout: 15e3,
|
|
5224
|
+
swarmIdentity: {
|
|
5225
|
+
peerKey: this._signingContext.deviceKey,
|
|
5226
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5227
|
+
credentialAuthenticator: async () => true
|
|
5228
|
+
}
|
|
5229
|
+
});
|
|
5230
|
+
}
|
|
5126
5231
|
async _constructSpace(metadata) {
|
|
5127
5232
|
log16("construct space", {
|
|
5128
5233
|
metadata
|
|
5129
5234
|
}, {
|
|
5130
|
-
F:
|
|
5131
|
-
L:
|
|
5235
|
+
F: __dxlog_file19,
|
|
5236
|
+
L: 358,
|
|
5132
5237
|
S: this,
|
|
5133
5238
|
C: (f, a) => f(...a)
|
|
5134
5239
|
});
|
|
@@ -5156,6 +5261,7 @@ var DataSpaceManager = class {
|
|
|
5156
5261
|
credentialAuthenticator: deferFunction2(() => dataSpace.authVerifier.verifier)
|
|
5157
5262
|
},
|
|
5158
5263
|
onAuthorizedConnection: (session) => {
|
|
5264
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialServerExtension(space));
|
|
5159
5265
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5160
5266
|
remotePeerId: session.remotePeerId
|
|
5161
5267
|
}));
|
|
@@ -5165,8 +5271,8 @@ var DataSpaceManager = class {
|
|
|
5165
5271
|
},
|
|
5166
5272
|
onAuthFailure: () => {
|
|
5167
5273
|
log16.warn("auth failure", void 0, {
|
|
5168
|
-
F:
|
|
5169
|
-
L:
|
|
5274
|
+
F: __dxlog_file19,
|
|
5275
|
+
L: 396,
|
|
5170
5276
|
S: this,
|
|
5171
5277
|
C: (f, a) => f(...a)
|
|
5172
5278
|
});
|
|
@@ -5198,8 +5304,8 @@ var DataSpaceManager = class {
|
|
|
5198
5304
|
log16("before space ready", {
|
|
5199
5305
|
space: space.key
|
|
5200
5306
|
}, {
|
|
5201
|
-
F:
|
|
5202
|
-
L:
|
|
5307
|
+
F: __dxlog_file19,
|
|
5308
|
+
L: 423,
|
|
5203
5309
|
S: this,
|
|
5204
5310
|
C: (f, a) => f(...a)
|
|
5205
5311
|
});
|
|
@@ -5209,8 +5315,8 @@ var DataSpaceManager = class {
|
|
|
5209
5315
|
space: space.key,
|
|
5210
5316
|
open: this._isOpen
|
|
5211
5317
|
}, {
|
|
5212
|
-
F:
|
|
5213
|
-
L:
|
|
5318
|
+
F: __dxlog_file19,
|
|
5319
|
+
L: 426,
|
|
5214
5320
|
S: this,
|
|
5215
5321
|
C: (f, a) => f(...a)
|
|
5216
5322
|
});
|
|
@@ -5228,8 +5334,8 @@ var DataSpaceManager = class {
|
|
|
5228
5334
|
log16("before space close", {
|
|
5229
5335
|
space: space.key
|
|
5230
5336
|
}, {
|
|
5231
|
-
F:
|
|
5232
|
-
L:
|
|
5337
|
+
F: __dxlog_file19,
|
|
5338
|
+
L: 434,
|
|
5233
5339
|
S: this,
|
|
5234
5340
|
C: (f, a) => f(...a)
|
|
5235
5341
|
});
|
|
@@ -5269,8 +5375,8 @@ var DataSpaceManager = class {
|
|
|
5269
5375
|
peersOnline: presence.getPeersOnline().length,
|
|
5270
5376
|
closedSessions
|
|
5271
5377
|
}, {
|
|
5272
|
-
F:
|
|
5273
|
-
L:
|
|
5378
|
+
F: __dxlog_file19,
|
|
5379
|
+
L: 470,
|
|
5274
5380
|
S: this,
|
|
5275
5381
|
C: (f, a) => f(...a)
|
|
5276
5382
|
});
|
|
@@ -5284,8 +5390,8 @@ var DataSpaceManager = class {
|
|
|
5284
5390
|
log16("closing a session with a removed peer", {
|
|
5285
5391
|
peerId: peerState.peerId
|
|
5286
5392
|
}, {
|
|
5287
|
-
F:
|
|
5288
|
-
L:
|
|
5393
|
+
F: __dxlog_file19,
|
|
5394
|
+
L: 484,
|
|
5289
5395
|
S: this,
|
|
5290
5396
|
C: (f, a) => f(...a)
|
|
5291
5397
|
});
|
|
@@ -5350,13 +5456,13 @@ import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTas
|
|
|
5350
5456
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
5351
5457
|
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
|
|
5352
5458
|
import { raise as raise2 } from "@dxos/debug";
|
|
5353
|
-
import { writeMessages as
|
|
5459
|
+
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
5354
5460
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
5355
5461
|
import { log as log17 } from "@dxos/log";
|
|
5356
5462
|
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
5357
5463
|
import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5358
5464
|
import { trace as trace8 } from "@dxos/tracing";
|
|
5359
|
-
var
|
|
5465
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5360
5466
|
var SpacesServiceImpl = class {
|
|
5361
5467
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5362
5468
|
this._identityManager = _identityManager;
|
|
@@ -5400,8 +5506,8 @@ var SpacesServiceImpl = class {
|
|
|
5400
5506
|
}
|
|
5401
5507
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5402
5508
|
invariant15(credentials[0].credential, void 0, {
|
|
5403
|
-
F:
|
|
5404
|
-
L:
|
|
5509
|
+
F: __dxlog_file20,
|
|
5510
|
+
L: 102,
|
|
5405
5511
|
S: this,
|
|
5406
5512
|
A: [
|
|
5407
5513
|
"credentials[0].credential",
|
|
@@ -5410,15 +5516,15 @@ var SpacesServiceImpl = class {
|
|
|
5410
5516
|
});
|
|
5411
5517
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5412
5518
|
invariant15(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5413
|
-
F:
|
|
5414
|
-
L:
|
|
5519
|
+
F: __dxlog_file20,
|
|
5520
|
+
L: 104,
|
|
5415
5521
|
S: this,
|
|
5416
5522
|
A: [
|
|
5417
5523
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5418
5524
|
""
|
|
5419
5525
|
]
|
|
5420
5526
|
});
|
|
5421
|
-
await
|
|
5527
|
+
await writeMessages4(space.controlPipeline.writer, credentials);
|
|
5422
5528
|
}
|
|
5423
5529
|
querySpaces() {
|
|
5424
5530
|
return new Stream10(({ next, ctx }) => {
|
|
@@ -5428,8 +5534,8 @@ var SpacesServiceImpl = class {
|
|
|
5428
5534
|
log17("update", {
|
|
5429
5535
|
spaces
|
|
5430
5536
|
}, {
|
|
5431
|
-
F:
|
|
5432
|
-
L:
|
|
5537
|
+
F: __dxlog_file20,
|
|
5538
|
+
L: 115,
|
|
5433
5539
|
S: this,
|
|
5434
5540
|
C: (f, a) => f(...a)
|
|
5435
5541
|
});
|
|
@@ -5520,8 +5626,8 @@ var SpacesServiceImpl = class {
|
|
|
5520
5626
|
});
|
|
5521
5627
|
} else {
|
|
5522
5628
|
invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5523
|
-
F:
|
|
5524
|
-
L:
|
|
5629
|
+
F: __dxlog_file20,
|
|
5630
|
+
L: 213,
|
|
5525
5631
|
S: this,
|
|
5526
5632
|
A: [
|
|
5527
5633
|
"!credential.id",
|
|
@@ -5529,8 +5635,8 @@ var SpacesServiceImpl = class {
|
|
|
5529
5635
|
]
|
|
5530
5636
|
});
|
|
5531
5637
|
invariant15(this._identityManager.identity, "Identity is not available", {
|
|
5532
|
-
F:
|
|
5533
|
-
L:
|
|
5638
|
+
F: __dxlog_file20,
|
|
5639
|
+
L: 214,
|
|
5534
5640
|
S: this,
|
|
5535
5641
|
A: [
|
|
5536
5642
|
"this._identityManager.identity",
|
|
@@ -5539,8 +5645,8 @@ var SpacesServiceImpl = class {
|
|
|
5539
5645
|
});
|
|
5540
5646
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5541
5647
|
invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5542
|
-
F:
|
|
5543
|
-
L:
|
|
5648
|
+
F: __dxlog_file20,
|
|
5649
|
+
L: 216,
|
|
5544
5650
|
S: this,
|
|
5545
5651
|
A: [
|
|
5546
5652
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5570,6 +5676,59 @@ var SpacesServiceImpl = class {
|
|
|
5570
5676
|
epochCredential: credential ?? void 0
|
|
5571
5677
|
};
|
|
5572
5678
|
}
|
|
5679
|
+
async admitContact(request) {
|
|
5680
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5681
|
+
await dataSpaceManager.admitMember({
|
|
5682
|
+
spaceKey: request.spaceKey,
|
|
5683
|
+
identityKey: request.contact.identityKey,
|
|
5684
|
+
role: request.role
|
|
5685
|
+
});
|
|
5686
|
+
}
|
|
5687
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5688
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5689
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5690
|
+
return this._joinByAdmission({
|
|
5691
|
+
credential
|
|
5692
|
+
});
|
|
5693
|
+
}
|
|
5694
|
+
async _joinByAdmission({ credential }) {
|
|
5695
|
+
const assertion = getCredentialAssertion4(credential);
|
|
5696
|
+
invariant15(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5697
|
+
F: __dxlog_file20,
|
|
5698
|
+
L: 250,
|
|
5699
|
+
S: this,
|
|
5700
|
+
A: [
|
|
5701
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5702
|
+
"'Invalid credential'"
|
|
5703
|
+
]
|
|
5704
|
+
});
|
|
5705
|
+
const myIdentity = this._identityManager.identity;
|
|
5706
|
+
invariant15(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5707
|
+
F: __dxlog_file20,
|
|
5708
|
+
L: 252,
|
|
5709
|
+
S: this,
|
|
5710
|
+
A: [
|
|
5711
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5712
|
+
""
|
|
5713
|
+
]
|
|
5714
|
+
});
|
|
5715
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5716
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5717
|
+
if (!dataSpace) {
|
|
5718
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5719
|
+
spaceKey: assertion.spaceKey,
|
|
5720
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5721
|
+
});
|
|
5722
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5723
|
+
credential: {
|
|
5724
|
+
credential
|
|
5725
|
+
}
|
|
5726
|
+
});
|
|
5727
|
+
}
|
|
5728
|
+
return {
|
|
5729
|
+
space: this._serializeSpace(dataSpace)
|
|
5730
|
+
};
|
|
5731
|
+
}
|
|
5573
5732
|
_serializeSpace(space) {
|
|
5574
5733
|
return {
|
|
5575
5734
|
id: space.id,
|
|
@@ -5587,7 +5746,8 @@ var SpacesServiceImpl = class {
|
|
|
5587
5746
|
startDataTimeframe: void 0,
|
|
5588
5747
|
currentDataTimeframe: void 0,
|
|
5589
5748
|
targetDataTimeframe: void 0,
|
|
5590
|
-
totalDataTimeframe: void 0
|
|
5749
|
+
totalDataTimeframe: void 0,
|
|
5750
|
+
spaceRootUrl: space.databaseRoot?.url
|
|
5591
5751
|
},
|
|
5592
5752
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
5593
5753
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
@@ -5657,7 +5817,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5657
5817
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5658
5818
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5659
5819
|
}
|
|
5660
|
-
var
|
|
5820
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5661
5821
|
var ServiceContext = class extends Resource3 {
|
|
5662
5822
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5663
5823
|
super();
|
|
@@ -5701,7 +5861,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5701
5861
|
async _open(ctx) {
|
|
5702
5862
|
await this._checkStorageVersion();
|
|
5703
5863
|
log18("opening...", void 0, {
|
|
5704
|
-
F:
|
|
5864
|
+
F: __dxlog_file21,
|
|
5705
5865
|
L: 149,
|
|
5706
5866
|
S: this,
|
|
5707
5867
|
C: (f, a) => f(...a)
|
|
@@ -5709,7 +5869,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5709
5869
|
log18.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
5710
5870
|
id: this._instanceId
|
|
5711
5871
|
}), {
|
|
5712
|
-
F:
|
|
5872
|
+
F: __dxlog_file21,
|
|
5713
5873
|
L: 150,
|
|
5714
5874
|
S: this,
|
|
5715
5875
|
C: (f, a) => f(...a)
|
|
@@ -5727,7 +5887,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5727
5887
|
log18("loaded persistent invitations", {
|
|
5728
5888
|
count: loadedInvitations.invitations?.length
|
|
5729
5889
|
}, {
|
|
5730
|
-
F:
|
|
5890
|
+
F: __dxlog_file21,
|
|
5731
5891
|
L: 163,
|
|
5732
5892
|
S: this,
|
|
5733
5893
|
C: (f, a) => f(...a)
|
|
@@ -5735,13 +5895,13 @@ var ServiceContext = class extends Resource3 {
|
|
|
5735
5895
|
log18.trace("dxos.sdk.service-context.open", trace9.end({
|
|
5736
5896
|
id: this._instanceId
|
|
5737
5897
|
}), {
|
|
5738
|
-
F:
|
|
5898
|
+
F: __dxlog_file21,
|
|
5739
5899
|
L: 165,
|
|
5740
5900
|
S: this,
|
|
5741
5901
|
C: (f, a) => f(...a)
|
|
5742
5902
|
});
|
|
5743
5903
|
log18("opened", void 0, {
|
|
5744
|
-
F:
|
|
5904
|
+
F: __dxlog_file21,
|
|
5745
5905
|
L: 166,
|
|
5746
5906
|
S: this,
|
|
5747
5907
|
C: (f, a) => f(...a)
|
|
@@ -5749,7 +5909,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5749
5909
|
}
|
|
5750
5910
|
async _close(ctx) {
|
|
5751
5911
|
log18("closing...", void 0, {
|
|
5752
|
-
F:
|
|
5912
|
+
F: __dxlog_file21,
|
|
5753
5913
|
L: 170,
|
|
5754
5914
|
S: this,
|
|
5755
5915
|
C: (f, a) => f(...a)
|
|
@@ -5766,7 +5926,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5766
5926
|
await this.networkManager.close();
|
|
5767
5927
|
await this.signalManager.close();
|
|
5768
5928
|
log18("closed", void 0, {
|
|
5769
|
-
F:
|
|
5929
|
+
F: __dxlog_file21,
|
|
5770
5930
|
L: 182,
|
|
5771
5931
|
S: this,
|
|
5772
5932
|
C: (f, a) => f(...a)
|
|
@@ -5774,13 +5934,16 @@ var ServiceContext = class extends Resource3 {
|
|
|
5774
5934
|
}
|
|
5775
5935
|
async createIdentity(params = {}) {
|
|
5776
5936
|
const identity = await this.identityManager.createIdentity(params);
|
|
5777
|
-
await this._initialize(new Context10(
|
|
5937
|
+
await this._initialize(new Context10(void 0, {
|
|
5938
|
+
F: __dxlog_file21,
|
|
5939
|
+
L: 187
|
|
5940
|
+
}));
|
|
5778
5941
|
return identity;
|
|
5779
5942
|
}
|
|
5780
5943
|
getInvitationHandler(invitation) {
|
|
5781
5944
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5782
5945
|
invariant16(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5783
|
-
F:
|
|
5946
|
+
F: __dxlog_file21,
|
|
5784
5947
|
L: 193,
|
|
5785
5948
|
S: this,
|
|
5786
5949
|
A: [
|
|
@@ -5800,7 +5963,10 @@ var ServiceContext = class extends Resource3 {
|
|
|
5800
5963
|
}
|
|
5801
5964
|
async _acceptIdentity(params) {
|
|
5802
5965
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5803
|
-
await this._initialize(new Context10(
|
|
5966
|
+
await this._initialize(new Context10(void 0, {
|
|
5967
|
+
F: __dxlog_file21,
|
|
5968
|
+
L: 209
|
|
5969
|
+
}));
|
|
5804
5970
|
return identity;
|
|
5805
5971
|
}
|
|
5806
5972
|
async _checkStorageVersion() {
|
|
@@ -5812,7 +5978,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5812
5978
|
// Called when identity is created.
|
|
5813
5979
|
async _initialize(ctx) {
|
|
5814
5980
|
log18("initializing spaces...", void 0, {
|
|
5815
|
-
F:
|
|
5981
|
+
F: __dxlog_file21,
|
|
5816
5982
|
L: 224,
|
|
5817
5983
|
S: this,
|
|
5818
5984
|
C: (f, a) => f(...a)
|
|
@@ -5835,7 +6001,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5835
6001
|
await this.dataSpaceManager.open();
|
|
5836
6002
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
5837
6003
|
invariant16(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5838
|
-
F:
|
|
6004
|
+
F: __dxlog_file21,
|
|
5839
6005
|
L: 249,
|
|
5840
6006
|
S: this,
|
|
5841
6007
|
A: [
|
|
@@ -5859,7 +6025,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5859
6025
|
log18("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5860
6026
|
details: assertion
|
|
5861
6027
|
}, {
|
|
5862
|
-
F:
|
|
6028
|
+
F: __dxlog_file21,
|
|
5863
6029
|
L: 265,
|
|
5864
6030
|
S: this,
|
|
5865
6031
|
C: (f, a) => f(...a)
|
|
@@ -5870,7 +6036,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5870
6036
|
log18("space already exists, ignoring space admission", {
|
|
5871
6037
|
details: assertion
|
|
5872
6038
|
}, {
|
|
5873
|
-
F:
|
|
6039
|
+
F: __dxlog_file21,
|
|
5874
6040
|
L: 269,
|
|
5875
6041
|
S: this,
|
|
5876
6042
|
C: (f, a) => f(...a)
|
|
@@ -5881,7 +6047,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5881
6047
|
log18("accepting space recorded in halo", {
|
|
5882
6048
|
details: assertion
|
|
5883
6049
|
}, {
|
|
5884
|
-
F:
|
|
6050
|
+
F: __dxlog_file21,
|
|
5885
6051
|
L: 274,
|
|
5886
6052
|
S: this,
|
|
5887
6053
|
C: (f, a) => f(...a)
|
|
@@ -5892,7 +6058,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5892
6058
|
});
|
|
5893
6059
|
} catch (err) {
|
|
5894
6060
|
log18.catch(err, void 0, {
|
|
5895
|
-
F:
|
|
6061
|
+
F: __dxlog_file21,
|
|
5896
6062
|
L: 280,
|
|
5897
6063
|
S: this,
|
|
5898
6064
|
C: (f, a) => f(...a)
|
|
@@ -5939,7 +6105,7 @@ var ServiceRegistry = class {
|
|
|
5939
6105
|
};
|
|
5940
6106
|
|
|
5941
6107
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
5942
|
-
import { asyncTimeout as
|
|
6108
|
+
import { asyncTimeout as asyncTimeout2, Trigger as Trigger9 } from "@dxos/async";
|
|
5943
6109
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
5944
6110
|
import { log as log19, logInfo } from "@dxos/log";
|
|
5945
6111
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
@@ -5952,7 +6118,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5952
6118
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5953
6119
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5954
6120
|
}
|
|
5955
|
-
var
|
|
6121
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
|
|
5956
6122
|
var Message;
|
|
5957
6123
|
(function(Message2) {
|
|
5958
6124
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -5975,28 +6141,28 @@ var Lock = class {
|
|
|
5975
6141
|
});
|
|
5976
6142
|
try {
|
|
5977
6143
|
log19("aquiring lock...", void 0, {
|
|
5978
|
-
F:
|
|
6144
|
+
F: __dxlog_file22,
|
|
5979
6145
|
L: 42,
|
|
5980
6146
|
S: this,
|
|
5981
6147
|
C: (f, a) => f(...a)
|
|
5982
6148
|
});
|
|
5983
|
-
await
|
|
6149
|
+
await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
|
|
5984
6150
|
log19("acquired lock", void 0, {
|
|
5985
|
-
F:
|
|
6151
|
+
F: __dxlog_file22,
|
|
5986
6152
|
L: 44,
|
|
5987
6153
|
S: this,
|
|
5988
6154
|
C: (f, a) => f(...a)
|
|
5989
6155
|
});
|
|
5990
6156
|
} catch {
|
|
5991
6157
|
log19("stealing lock...", void 0, {
|
|
5992
|
-
F:
|
|
6158
|
+
F: __dxlog_file22,
|
|
5993
6159
|
L: 46,
|
|
5994
6160
|
S: this,
|
|
5995
6161
|
C: (f, a) => f(...a)
|
|
5996
6162
|
});
|
|
5997
6163
|
await this._requestLock(true);
|
|
5998
6164
|
log19("stolen lock", void 0, {
|
|
5999
|
-
F:
|
|
6165
|
+
F: __dxlog_file22,
|
|
6000
6166
|
L: 48,
|
|
6001
6167
|
S: this,
|
|
6002
6168
|
C: (f, a) => f(...a)
|
|
@@ -6015,7 +6181,7 @@ var Lock = class {
|
|
|
6015
6181
|
log19("requesting lock...", {
|
|
6016
6182
|
steal
|
|
6017
6183
|
}, {
|
|
6018
|
-
F:
|
|
6184
|
+
F: __dxlog_file22,
|
|
6019
6185
|
L: 63,
|
|
6020
6186
|
S: this,
|
|
6021
6187
|
C: (f, a) => f(...a)
|
|
@@ -6029,14 +6195,14 @@ var Lock = class {
|
|
|
6029
6195
|
this._releaseTrigger = new Trigger9();
|
|
6030
6196
|
await this._releaseTrigger.wait();
|
|
6031
6197
|
log19("releasing lock...", void 0, {
|
|
6032
|
-
F:
|
|
6198
|
+
F: __dxlog_file22,
|
|
6033
6199
|
L: 72,
|
|
6034
6200
|
S: this,
|
|
6035
6201
|
C: (f, a) => f(...a)
|
|
6036
6202
|
});
|
|
6037
6203
|
await this._onRelease?.();
|
|
6038
6204
|
log19("released lock", void 0, {
|
|
6039
|
-
F:
|
|
6205
|
+
F: __dxlog_file22,
|
|
6040
6206
|
L: 74,
|
|
6041
6207
|
S: this,
|
|
6042
6208
|
C: (f, a) => f(...a)
|
|
@@ -6048,7 +6214,7 @@ var Lock = class {
|
|
|
6048
6214
|
log19("recieved lock", {
|
|
6049
6215
|
steal
|
|
6050
6216
|
}, {
|
|
6051
|
-
F:
|
|
6217
|
+
F: __dxlog_file22,
|
|
6052
6218
|
L: 81,
|
|
6053
6219
|
S: this,
|
|
6054
6220
|
C: (f, a) => f(...a)
|
|
@@ -6142,7 +6308,7 @@ import { invariant as invariant17 } from "@dxos/invariant";
|
|
|
6142
6308
|
import { log as log20 } from "@dxos/log";
|
|
6143
6309
|
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
6144
6310
|
import { arrayToBuffer } from "@dxos/util";
|
|
6145
|
-
var
|
|
6311
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6146
6312
|
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
6147
6313
|
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
6148
6314
|
var exportProfileData = async ({ storage, level }) => {
|
|
@@ -6158,7 +6324,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6158
6324
|
log20.info("begin exporting files", {
|
|
6159
6325
|
count: files.length
|
|
6160
6326
|
}, {
|
|
6161
|
-
F:
|
|
6327
|
+
F: __dxlog_file23,
|
|
6162
6328
|
L: 30,
|
|
6163
6329
|
S: void 0,
|
|
6164
6330
|
C: (f, a) => f(...a)
|
|
@@ -6176,7 +6342,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6176
6342
|
log20.info("done exporting files", {
|
|
6177
6343
|
count: files.length
|
|
6178
6344
|
}, {
|
|
6179
|
-
F:
|
|
6345
|
+
F: __dxlog_file23,
|
|
6180
6346
|
L: 41,
|
|
6181
6347
|
S: void 0,
|
|
6182
6348
|
C: (f, a) => f(...a)
|
|
@@ -6184,7 +6350,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6184
6350
|
}
|
|
6185
6351
|
{
|
|
6186
6352
|
log20.info("begin exporting kv pairs", void 0, {
|
|
6187
|
-
F:
|
|
6353
|
+
F: __dxlog_file23,
|
|
6188
6354
|
L: 45,
|
|
6189
6355
|
S: void 0,
|
|
6190
6356
|
C: (f, a) => f(...a)
|
|
@@ -6205,7 +6371,7 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6205
6371
|
log20.info("done exporting kv pairs", {
|
|
6206
6372
|
count
|
|
6207
6373
|
}, {
|
|
6208
|
-
F:
|
|
6374
|
+
F: __dxlog_file23,
|
|
6209
6375
|
L: 56,
|
|
6210
6376
|
S: void 0,
|
|
6211
6377
|
C: (f, a) => f(...a)
|
|
@@ -6214,14 +6380,15 @@ var exportProfileData = async ({ storage, level }) => {
|
|
|
6214
6380
|
return archive;
|
|
6215
6381
|
};
|
|
6216
6382
|
var importProfileData = async ({ storage, level }, archive) => {
|
|
6217
|
-
|
|
6383
|
+
let batch = level.batch();
|
|
6384
|
+
let count = 0;
|
|
6218
6385
|
for (const entry2 of archive.storage) {
|
|
6219
6386
|
switch (entry2.type) {
|
|
6220
6387
|
case ProfileArchiveEntryType.FILE: {
|
|
6221
6388
|
const directory = await storage.createDirectory();
|
|
6222
6389
|
invariant17(typeof entry2.key === "string", "Invalid key type", {
|
|
6223
|
-
F:
|
|
6224
|
-
L:
|
|
6390
|
+
F: __dxlog_file23,
|
|
6391
|
+
L: 79,
|
|
6225
6392
|
S: void 0,
|
|
6226
6393
|
A: [
|
|
6227
6394
|
"typeof entry.key === 'string'",
|
|
@@ -6230,8 +6397,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6230
6397
|
});
|
|
6231
6398
|
const file = await directory.getOrCreateFile(entry2.key);
|
|
6232
6399
|
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6233
|
-
F:
|
|
6234
|
-
L:
|
|
6400
|
+
F: __dxlog_file23,
|
|
6401
|
+
L: 81,
|
|
6235
6402
|
S: void 0,
|
|
6236
6403
|
A: [
|
|
6237
6404
|
"entry.value instanceof Uint8Array",
|
|
@@ -6244,8 +6411,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6244
6411
|
}
|
|
6245
6412
|
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
6246
6413
|
invariant17(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6247
|
-
F:
|
|
6248
|
-
L:
|
|
6414
|
+
F: __dxlog_file23,
|
|
6415
|
+
L: 87,
|
|
6249
6416
|
S: void 0,
|
|
6250
6417
|
A: [
|
|
6251
6418
|
"entry.key instanceof Uint8Array",
|
|
@@ -6253,8 +6420,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6253
6420
|
]
|
|
6254
6421
|
});
|
|
6255
6422
|
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6256
|
-
F:
|
|
6257
|
-
L:
|
|
6423
|
+
F: __dxlog_file23,
|
|
6424
|
+
L: 88,
|
|
6258
6425
|
S: void 0,
|
|
6259
6426
|
A: [
|
|
6260
6427
|
"entry.value instanceof Uint8Array",
|
|
@@ -6270,7 +6437,27 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6270
6437
|
default:
|
|
6271
6438
|
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6272
6439
|
}
|
|
6440
|
+
if (++count % 1e3 === 0) {
|
|
6441
|
+
await batch.write();
|
|
6442
|
+
batch = level.batch();
|
|
6443
|
+
log20.info("importing", {
|
|
6444
|
+
count,
|
|
6445
|
+
total: archive.storage.length,
|
|
6446
|
+
progress: `${(count / archive.storage.length * 100).toFixed()}%`
|
|
6447
|
+
}, {
|
|
6448
|
+
F: __dxlog_file23,
|
|
6449
|
+
L: 101,
|
|
6450
|
+
S: void 0,
|
|
6451
|
+
C: (f, a) => f(...a)
|
|
6452
|
+
});
|
|
6453
|
+
}
|
|
6273
6454
|
}
|
|
6455
|
+
log20.info("committing changes..", void 0, {
|
|
6456
|
+
F: __dxlog_file23,
|
|
6457
|
+
L: 109,
|
|
6458
|
+
S: void 0,
|
|
6459
|
+
C: (f, a) => f(...a)
|
|
6460
|
+
});
|
|
6274
6461
|
await batch.write();
|
|
6275
6462
|
};
|
|
6276
6463
|
|
|
@@ -6279,7 +6466,7 @@ import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
|
|
|
6279
6466
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
6280
6467
|
import { Context as Context11 } from "@dxos/context";
|
|
6281
6468
|
import { invariant as invariant19 } from "@dxos/invariant";
|
|
6282
|
-
import { PublicKey as
|
|
6469
|
+
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
6283
6470
|
import { log as log22 } from "@dxos/log";
|
|
6284
6471
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
6285
6472
|
import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
@@ -6293,7 +6480,7 @@ import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
|
6293
6480
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
6294
6481
|
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6295
6482
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6296
|
-
var
|
|
6483
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6297
6484
|
var DevicesServiceImpl = class {
|
|
6298
6485
|
constructor(_identityManager) {
|
|
6299
6486
|
this._identityManager = _identityManager;
|
|
@@ -6311,7 +6498,7 @@ var DevicesServiceImpl = class {
|
|
|
6311
6498
|
});
|
|
6312
6499
|
} else {
|
|
6313
6500
|
invariant18(this._identityManager.identity?.presence, "presence not present", {
|
|
6314
|
-
F:
|
|
6501
|
+
F: __dxlog_file24,
|
|
6315
6502
|
L: 32,
|
|
6316
6503
|
S: this,
|
|
6317
6504
|
A: [
|
|
@@ -6417,10 +6604,93 @@ var findConfigs = () => {
|
|
|
6417
6604
|
return configs.map((r) => r.instance.deref()).filter(nonNullable);
|
|
6418
6605
|
};
|
|
6419
6606
|
|
|
6420
|
-
// packages/sdk/client-services/src/packlets/
|
|
6421
|
-
import {
|
|
6607
|
+
// packages/sdk/client-services/src/packlets/identity/contacts-service.ts
|
|
6608
|
+
import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask7, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
|
|
6422
6609
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
6423
6610
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
6611
|
+
import { ComplexMap as ComplexMap4, ComplexSet as ComplexSet6 } from "@dxos/util";
|
|
6612
|
+
var ContactsServiceImpl = class {
|
|
6613
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6614
|
+
this._identityManager = _identityManager;
|
|
6615
|
+
this._spaceManager = _spaceManager;
|
|
6616
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6617
|
+
}
|
|
6618
|
+
async getContacts() {
|
|
6619
|
+
const identity = this._identityManager.identity;
|
|
6620
|
+
if (identity == null) {
|
|
6621
|
+
return {
|
|
6622
|
+
contacts: []
|
|
6623
|
+
};
|
|
6624
|
+
}
|
|
6625
|
+
const contacts = [
|
|
6626
|
+
...this._spaceManager.spaces.values()
|
|
6627
|
+
].flatMap((s) => [
|
|
6628
|
+
...s.spaceState.members.values()
|
|
6629
|
+
].map((m) => [
|
|
6630
|
+
s.key,
|
|
6631
|
+
m
|
|
6632
|
+
])).reduce((acc, v) => {
|
|
6633
|
+
const [spaceKey, memberInfo] = v;
|
|
6634
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6635
|
+
return acc;
|
|
6636
|
+
}
|
|
6637
|
+
const existing = acc.get(memberInfo.key);
|
|
6638
|
+
if (existing != null) {
|
|
6639
|
+
existing.profile ??= memberInfo.profile;
|
|
6640
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6641
|
+
} else {
|
|
6642
|
+
acc.set(memberInfo.key, {
|
|
6643
|
+
identityKey: memberInfo.key,
|
|
6644
|
+
profile: memberInfo.profile,
|
|
6645
|
+
commonSpaces: [
|
|
6646
|
+
spaceKey
|
|
6647
|
+
]
|
|
6648
|
+
});
|
|
6649
|
+
}
|
|
6650
|
+
return acc;
|
|
6651
|
+
}, new ComplexMap4(PublicKey15.hash));
|
|
6652
|
+
return {
|
|
6653
|
+
contacts: [
|
|
6654
|
+
...contacts.values()
|
|
6655
|
+
]
|
|
6656
|
+
};
|
|
6657
|
+
}
|
|
6658
|
+
queryContacts() {
|
|
6659
|
+
const subscribedSpaceKeySet = new ComplexSet6(PublicKey15.hash);
|
|
6660
|
+
return new Stream12(({ next, ctx }) => {
|
|
6661
|
+
const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
|
|
6662
|
+
const contacts = await this.getContacts();
|
|
6663
|
+
next(contacts);
|
|
6664
|
+
}, {
|
|
6665
|
+
maxFrequency: 2
|
|
6666
|
+
});
|
|
6667
|
+
scheduleTask7(ctx, async () => {
|
|
6668
|
+
const subscriptions = new EventSubscriptions4();
|
|
6669
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6670
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6671
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6672
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6673
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6674
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6675
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6679
|
+
pushUpdateTask.trigger();
|
|
6680
|
+
}
|
|
6681
|
+
};
|
|
6682
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6683
|
+
ctx.onDispose(unsubscribe);
|
|
6684
|
+
subscribeToSpaceAndUpdate();
|
|
6685
|
+
});
|
|
6686
|
+
});
|
|
6687
|
+
}
|
|
6688
|
+
};
|
|
6689
|
+
|
|
6690
|
+
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
6691
|
+
import { Event as Event8 } from "@dxos/async";
|
|
6692
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
6693
|
+
import { PublicKey as PublicKey16 } from "@dxos/keys";
|
|
6424
6694
|
import { getContextFromEntry, log as log21 } from "@dxos/log";
|
|
6425
6695
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
6426
6696
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
@@ -6428,7 +6698,7 @@ var LoggingServiceImpl = class {
|
|
|
6428
6698
|
constructor() {
|
|
6429
6699
|
this._logs = new Event8();
|
|
6430
6700
|
this._started = Date.now();
|
|
6431
|
-
this._sessionId =
|
|
6701
|
+
this._sessionId = PublicKey16.random().toHex();
|
|
6432
6702
|
this._logProcessor = (_config, entry2) => {
|
|
6433
6703
|
this._logs.emit(entry2);
|
|
6434
6704
|
};
|
|
@@ -6464,7 +6734,7 @@ var LoggingServiceImpl = class {
|
|
|
6464
6734
|
stats: numericalValues(events, "duration")
|
|
6465
6735
|
};
|
|
6466
6736
|
};
|
|
6467
|
-
return new
|
|
6737
|
+
return new Stream13(({ next }) => {
|
|
6468
6738
|
const update = () => {
|
|
6469
6739
|
const metrics = {
|
|
6470
6740
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6486,7 +6756,7 @@ var LoggingServiceImpl = class {
|
|
|
6486
6756
|
});
|
|
6487
6757
|
}
|
|
6488
6758
|
queryLogs(request) {
|
|
6489
|
-
return new
|
|
6759
|
+
return new Stream13(({ ctx, next }) => {
|
|
6490
6760
|
const handler = (entry2) => {
|
|
6491
6761
|
if (LOG_PROCESSING > 0) {
|
|
6492
6762
|
return;
|
|
@@ -6542,14 +6812,14 @@ var shouldLog = (entry2, request) => {
|
|
|
6542
6812
|
var LOG_PROCESSING = 0;
|
|
6543
6813
|
|
|
6544
6814
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
6545
|
-
import { Stream as
|
|
6815
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
6546
6816
|
var NetworkServiceImpl = class {
|
|
6547
6817
|
constructor(networkManager, signalManager) {
|
|
6548
6818
|
this.networkManager = networkManager;
|
|
6549
6819
|
this.signalManager = signalManager;
|
|
6550
6820
|
}
|
|
6551
6821
|
queryStatus() {
|
|
6552
|
-
return new
|
|
6822
|
+
return new Stream14(({ next }) => {
|
|
6553
6823
|
const update = () => {
|
|
6554
6824
|
next({
|
|
6555
6825
|
swarm: this.networkManager.connectionState,
|
|
@@ -6575,7 +6845,7 @@ var NetworkServiceImpl = class {
|
|
|
6575
6845
|
};
|
|
6576
6846
|
|
|
6577
6847
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
6578
|
-
import { Stream as
|
|
6848
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf";
|
|
6579
6849
|
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6580
6850
|
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
6581
6851
|
var SystemServiceImpl = class {
|
|
@@ -6611,7 +6881,7 @@ var SystemServiceImpl = class {
|
|
|
6611
6881
|
}
|
|
6612
6882
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6613
6883
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6614
|
-
return new
|
|
6884
|
+
return new Stream15(({ next }) => {
|
|
6615
6885
|
const update = () => {
|
|
6616
6886
|
next({
|
|
6617
6887
|
status: this._getCurrentStatus()
|
|
@@ -6642,7 +6912,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6642
6912
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6643
6913
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6644
6914
|
}
|
|
6645
|
-
var
|
|
6915
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6646
6916
|
var ClientServicesHost = class {
|
|
6647
6917
|
constructor({
|
|
6648
6918
|
config,
|
|
@@ -6675,7 +6945,10 @@ var ClientServicesHost = class {
|
|
|
6675
6945
|
lockKey,
|
|
6676
6946
|
onAcquire: () => {
|
|
6677
6947
|
if (!this._opening) {
|
|
6678
|
-
void this.open(new Context11(
|
|
6948
|
+
void this.open(new Context11(void 0, {
|
|
6949
|
+
F: __dxlog_file25,
|
|
6950
|
+
L: 121
|
|
6951
|
+
}));
|
|
6679
6952
|
}
|
|
6680
6953
|
},
|
|
6681
6954
|
onRelease: () => this.close()
|
|
@@ -6731,8 +7004,8 @@ var ClientServicesHost = class {
|
|
|
6731
7004
|
*/
|
|
6732
7005
|
initialize({ config, ...options }) {
|
|
6733
7006
|
invariant19(!this._open, "service host is open", {
|
|
6734
|
-
F:
|
|
6735
|
-
L:
|
|
7007
|
+
F: __dxlog_file25,
|
|
7008
|
+
L: 187,
|
|
6736
7009
|
S: this,
|
|
6737
7010
|
A: [
|
|
6738
7011
|
"!this._open",
|
|
@@ -6740,15 +7013,15 @@ var ClientServicesHost = class {
|
|
|
6740
7013
|
]
|
|
6741
7014
|
});
|
|
6742
7015
|
log22("initializing...", void 0, {
|
|
6743
|
-
F:
|
|
6744
|
-
L:
|
|
7016
|
+
F: __dxlog_file25,
|
|
7017
|
+
L: 188,
|
|
6745
7018
|
S: this,
|
|
6746
7019
|
C: (f, a) => f(...a)
|
|
6747
7020
|
});
|
|
6748
7021
|
if (config) {
|
|
6749
7022
|
invariant19(!this._config, "config already set", {
|
|
6750
|
-
F:
|
|
6751
|
-
L:
|
|
7023
|
+
F: __dxlog_file25,
|
|
7024
|
+
L: 191,
|
|
6752
7025
|
S: this,
|
|
6753
7026
|
A: [
|
|
6754
7027
|
"!this._config",
|
|
@@ -6762,8 +7035,8 @@ var ClientServicesHost = class {
|
|
|
6762
7035
|
}
|
|
6763
7036
|
if (!options.signalManager) {
|
|
6764
7037
|
log22.warn("running signaling without telemetry metadata.", void 0, {
|
|
6765
|
-
F:
|
|
6766
|
-
L:
|
|
7038
|
+
F: __dxlog_file25,
|
|
7039
|
+
L: 199,
|
|
6767
7040
|
S: this,
|
|
6768
7041
|
C: (f, a) => f(...a)
|
|
6769
7042
|
});
|
|
@@ -6773,8 +7046,8 @@ var ClientServicesHost = class {
|
|
|
6773
7046
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6774
7047
|
this._signalManager = signalManager;
|
|
6775
7048
|
invariant19(!this._networkManager, "network manager already set", {
|
|
6776
|
-
F:
|
|
6777
|
-
L:
|
|
7049
|
+
F: __dxlog_file25,
|
|
7050
|
+
L: 210,
|
|
6778
7051
|
S: this,
|
|
6779
7052
|
A: [
|
|
6780
7053
|
"!this._networkManager",
|
|
@@ -6787,8 +7060,8 @@ var ClientServicesHost = class {
|
|
|
6787
7060
|
signalManager
|
|
6788
7061
|
});
|
|
6789
7062
|
log22("initialized", void 0, {
|
|
6790
|
-
F:
|
|
6791
|
-
L:
|
|
7063
|
+
F: __dxlog_file25,
|
|
7064
|
+
L: 217,
|
|
6792
7065
|
S: this,
|
|
6793
7066
|
C: (f, a) => f(...a)
|
|
6794
7067
|
});
|
|
@@ -6797,18 +7070,18 @@ var ClientServicesHost = class {
|
|
|
6797
7070
|
if (this._open) {
|
|
6798
7071
|
return;
|
|
6799
7072
|
}
|
|
6800
|
-
const traceId =
|
|
7073
|
+
const traceId = PublicKey17.random().toHex();
|
|
6801
7074
|
log22.trace("dxos.client-services.host.open", trace10.begin({
|
|
6802
7075
|
id: traceId
|
|
6803
7076
|
}), {
|
|
6804
|
-
F:
|
|
6805
|
-
L:
|
|
7077
|
+
F: __dxlog_file25,
|
|
7078
|
+
L: 228,
|
|
6806
7079
|
S: this,
|
|
6807
7080
|
C: (f, a) => f(...a)
|
|
6808
7081
|
});
|
|
6809
7082
|
invariant19(this._config, "config not set", {
|
|
6810
|
-
F:
|
|
6811
|
-
L:
|
|
7083
|
+
F: __dxlog_file25,
|
|
7084
|
+
L: 230,
|
|
6812
7085
|
S: this,
|
|
6813
7086
|
A: [
|
|
6814
7087
|
"this._config",
|
|
@@ -6816,8 +7089,8 @@ var ClientServicesHost = class {
|
|
|
6816
7089
|
]
|
|
6817
7090
|
});
|
|
6818
7091
|
invariant19(this._storage, "storage not set", {
|
|
6819
|
-
F:
|
|
6820
|
-
L:
|
|
7092
|
+
F: __dxlog_file25,
|
|
7093
|
+
L: 231,
|
|
6821
7094
|
S: this,
|
|
6822
7095
|
A: [
|
|
6823
7096
|
"this._storage",
|
|
@@ -6825,8 +7098,8 @@ var ClientServicesHost = class {
|
|
|
6825
7098
|
]
|
|
6826
7099
|
});
|
|
6827
7100
|
invariant19(this._signalManager, "signal manager not set", {
|
|
6828
|
-
F:
|
|
6829
|
-
L:
|
|
7101
|
+
F: __dxlog_file25,
|
|
7102
|
+
L: 232,
|
|
6830
7103
|
S: this,
|
|
6831
7104
|
A: [
|
|
6832
7105
|
"this._signalManager",
|
|
@@ -6834,8 +7107,8 @@ var ClientServicesHost = class {
|
|
|
6834
7107
|
]
|
|
6835
7108
|
});
|
|
6836
7109
|
invariant19(this._networkManager, "network manager not set", {
|
|
6837
|
-
F:
|
|
6838
|
-
L:
|
|
7110
|
+
F: __dxlog_file25,
|
|
7111
|
+
L: 233,
|
|
6839
7112
|
S: this,
|
|
6840
7113
|
A: [
|
|
6841
7114
|
"this._networkManager",
|
|
@@ -6846,8 +7119,8 @@ var ClientServicesHost = class {
|
|
|
6846
7119
|
log22("opening...", {
|
|
6847
7120
|
lockKey: this._resourceLock?.lockKey
|
|
6848
7121
|
}, {
|
|
6849
|
-
F:
|
|
6850
|
-
L:
|
|
7122
|
+
F: __dxlog_file25,
|
|
7123
|
+
L: 236,
|
|
6851
7124
|
S: this,
|
|
6852
7125
|
C: (f, a) => f(...a)
|
|
6853
7126
|
});
|
|
@@ -6858,16 +7131,18 @@ var ClientServicesHost = class {
|
|
|
6858
7131
|
await this._level.open();
|
|
6859
7132
|
await this._loggingService.open();
|
|
6860
7133
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
7134
|
+
const dataSpaceManagerProvider = async () => {
|
|
7135
|
+
await this._serviceContext.initialized.wait();
|
|
7136
|
+
return this._serviceContext.dataSpaceManager;
|
|
7137
|
+
};
|
|
6861
7138
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6862
7139
|
this._serviceRegistry.setServices({
|
|
6863
7140
|
SystemService: this._systemService,
|
|
6864
7141
|
IdentityService: identityService,
|
|
7142
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6865
7143
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6866
7144
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6867
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6868
|
-
await this._serviceContext.initialized.wait();
|
|
6869
|
-
return this._serviceContext.dataSpaceManager;
|
|
6870
|
-
}),
|
|
7145
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6871
7146
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6872
7147
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6873
7148
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6900,16 +7175,16 @@ var ClientServicesHost = class {
|
|
|
6900
7175
|
log22("opened", {
|
|
6901
7176
|
deviceKey
|
|
6902
7177
|
}, {
|
|
6903
|
-
F:
|
|
6904
|
-
L:
|
|
7178
|
+
F: __dxlog_file25,
|
|
7179
|
+
L: 322,
|
|
6905
7180
|
S: this,
|
|
6906
7181
|
C: (f, a) => f(...a)
|
|
6907
7182
|
});
|
|
6908
7183
|
log22.trace("dxos.client-services.host.open", trace10.end({
|
|
6909
7184
|
id: traceId
|
|
6910
7185
|
}), {
|
|
6911
|
-
F:
|
|
6912
|
-
L:
|
|
7186
|
+
F: __dxlog_file25,
|
|
7187
|
+
L: 323,
|
|
6913
7188
|
S: this,
|
|
6914
7189
|
C: (f, a) => f(...a)
|
|
6915
7190
|
});
|
|
@@ -6922,8 +7197,8 @@ var ClientServicesHost = class {
|
|
|
6922
7197
|
log22("closing...", {
|
|
6923
7198
|
deviceKey
|
|
6924
7199
|
}, {
|
|
6925
|
-
F:
|
|
6926
|
-
L:
|
|
7200
|
+
F: __dxlog_file25,
|
|
7201
|
+
L: 334,
|
|
6927
7202
|
S: this,
|
|
6928
7203
|
C: (f, a) => f(...a)
|
|
6929
7204
|
});
|
|
@@ -6940,41 +7215,41 @@ var ClientServicesHost = class {
|
|
|
6940
7215
|
log22("closed", {
|
|
6941
7216
|
deviceKey
|
|
6942
7217
|
}, {
|
|
6943
|
-
F:
|
|
6944
|
-
L:
|
|
7218
|
+
F: __dxlog_file25,
|
|
7219
|
+
L: 343,
|
|
6945
7220
|
S: this,
|
|
6946
7221
|
C: (f, a) => f(...a)
|
|
6947
7222
|
});
|
|
6948
7223
|
}
|
|
6949
7224
|
async reset() {
|
|
6950
|
-
const traceId =
|
|
7225
|
+
const traceId = PublicKey17.random().toHex();
|
|
6951
7226
|
log22.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
6952
7227
|
id: traceId
|
|
6953
7228
|
}), {
|
|
6954
|
-
F:
|
|
6955
|
-
L:
|
|
7229
|
+
F: __dxlog_file25,
|
|
7230
|
+
L: 348,
|
|
6956
7231
|
S: this,
|
|
6957
7232
|
C: (f, a) => f(...a)
|
|
6958
7233
|
});
|
|
6959
7234
|
log22.info("resetting...", void 0, {
|
|
6960
|
-
F:
|
|
6961
|
-
L:
|
|
7235
|
+
F: __dxlog_file25,
|
|
7236
|
+
L: 350,
|
|
6962
7237
|
S: this,
|
|
6963
7238
|
C: (f, a) => f(...a)
|
|
6964
7239
|
});
|
|
6965
7240
|
await this._serviceContext?.close();
|
|
6966
7241
|
await this._storage.reset();
|
|
6967
7242
|
log22.info("reset", void 0, {
|
|
6968
|
-
F:
|
|
6969
|
-
L:
|
|
7243
|
+
F: __dxlog_file25,
|
|
7244
|
+
L: 353,
|
|
6970
7245
|
S: this,
|
|
6971
7246
|
C: (f, a) => f(...a)
|
|
6972
7247
|
});
|
|
6973
7248
|
log22.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
6974
7249
|
id: traceId
|
|
6975
7250
|
}), {
|
|
6976
|
-
F:
|
|
6977
|
-
L:
|
|
7251
|
+
F: __dxlog_file25,
|
|
7252
|
+
L: 354,
|
|
6978
7253
|
S: this,
|
|
6979
7254
|
C: (f, a) => f(...a)
|
|
6980
7255
|
});
|
|
@@ -7048,4 +7323,4 @@ export {
|
|
|
7048
7323
|
ClientServicesProviderResource,
|
|
7049
7324
|
DiagnosticsCollector
|
|
7050
7325
|
};
|
|
7051
|
-
//# sourceMappingURL=chunk-
|
|
7326
|
+
//# sourceMappingURL=chunk-MD3R7DKE.mjs.map
|