@dxos/client-services 0.5.9-next.a50ff17 → 0.6.1-main.18a8c5d
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-LCPF6KL6.mjs → chunk-HVAGZ7TD.mjs} +953 -527
- package/dist/lib/browser/chunk-HVAGZ7TD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -2
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +10 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-L7MVHCXK.cjs → chunk-YW5LUAQO.cjs} +988 -562
- package/dist/lib/node/chunk-YW5LUAQO.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -42
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +17 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/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/index.d.ts +1 -0
- package/dist/types/src/packlets/storage/index.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts +14 -0
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/contacts-service.ts +85 -0
- package/src/packlets/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/automerge-host.test.ts +1 -1
- 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 +8 -6
- package/src/packlets/spaces/epoch-migrations.ts +57 -38
- package/src/packlets/spaces/spaces-service.ts +52 -2
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +111 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-LCPF6KL6.mjs.map +0 -7
- package/dist/lib/node/chunk-L7MVHCXK.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.
|
|
362
|
+
var DXOS_VERSION = "0.6.1-main.18a8c5d";
|
|
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,19 +4591,18 @@ 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)
|
|
4547
4598
|
});
|
|
4548
|
-
this._echoHost.replicateDocument(rootUrl);
|
|
4549
4599
|
const handle = this._echoHost.automergeRepo.find(rootUrl);
|
|
4550
4600
|
queueMicrotask(async () => {
|
|
4551
4601
|
try {
|
|
4552
4602
|
try {
|
|
4553
4603
|
var _usingCtx = _using_ctx();
|
|
4554
4604
|
await warnAfterTimeout(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
|
|
4555
|
-
await
|
|
4605
|
+
await cancelWithContext4(this._ctx, handle.whenReady());
|
|
4556
4606
|
});
|
|
4557
4607
|
if (this._ctx.disposed) {
|
|
4558
4608
|
return;
|
|
@@ -4571,9 +4621,11 @@ var DataSpace = class {
|
|
|
4571
4621
|
}
|
|
4572
4622
|
const root = await this._echoHost.openSpaceRoot(handle.url);
|
|
4573
4623
|
this._databaseRoot = root;
|
|
4574
|
-
if (root.getVersion() !==
|
|
4575
|
-
this._state
|
|
4576
|
-
|
|
4624
|
+
if (root.getVersion() !== SpaceDocVersion2.CURRENT) {
|
|
4625
|
+
if (this._state !== SpaceState2.REQUIRES_MIGRATION) {
|
|
4626
|
+
this._state = SpaceState2.REQUIRES_MIGRATION;
|
|
4627
|
+
this.stateUpdate.emit();
|
|
4628
|
+
}
|
|
4577
4629
|
} else {
|
|
4578
4630
|
if (this._state !== SpaceState2.READY) {
|
|
4579
4631
|
await this._enterReadyState();
|
|
@@ -4593,8 +4645,8 @@ var DataSpace = class {
|
|
|
4593
4645
|
rootUrl,
|
|
4594
4646
|
err
|
|
4595
4647
|
}, {
|
|
4596
|
-
F:
|
|
4597
|
-
L:
|
|
4648
|
+
F: __dxlog_file18,
|
|
4649
|
+
L: 433,
|
|
4598
4650
|
S: this,
|
|
4599
4651
|
C: (f, a) => f(...a)
|
|
4600
4652
|
});
|
|
@@ -4622,7 +4674,7 @@ var DataSpace = class {
|
|
|
4622
4674
|
return null;
|
|
4623
4675
|
}
|
|
4624
4676
|
const { newRoot } = await runEpochMigration(ctx, {
|
|
4625
|
-
|
|
4677
|
+
echoHost: this._echoHost,
|
|
4626
4678
|
spaceId: this.id,
|
|
4627
4679
|
spaceKey: this.key,
|
|
4628
4680
|
migration: options.migration,
|
|
@@ -4679,8 +4731,8 @@ var DataSpace = class {
|
|
|
4679
4731
|
log15("new state", {
|
|
4680
4732
|
state: SpaceState2[this._state]
|
|
4681
4733
|
}, {
|
|
4682
|
-
F:
|
|
4683
|
-
L:
|
|
4734
|
+
F: __dxlog_file18,
|
|
4735
|
+
L: 514,
|
|
4684
4736
|
S: this,
|
|
4685
4737
|
C: (f, a) => f(...a)
|
|
4686
4738
|
});
|
|
@@ -4739,21 +4791,23 @@ DataSpace = _ts_decorate4([
|
|
|
4739
4791
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
4740
4792
|
import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
4741
4793
|
import { PropertiesType } from "@dxos/client-protocol";
|
|
4742
|
-
import { Context as Context9, cancelWithContext as
|
|
4743
|
-
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";
|
|
4744
4796
|
import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2 } from "@dxos/echo-db";
|
|
4745
4797
|
import { AuthStatus } from "@dxos/echo-pipeline";
|
|
4746
|
-
import {
|
|
4798
|
+
import { CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
4799
|
+
import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion3, encodeReference } from "@dxos/echo-protocol";
|
|
4747
4800
|
import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
|
|
4801
|
+
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
4748
4802
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4749
4803
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4750
4804
|
import { log as log16 } from "@dxos/log";
|
|
4751
|
-
import { trace as Trace2 } from "@dxos/protocols";
|
|
4805
|
+
import { trace as Trace2, AlreadyJoinedError as AlreadyJoinedError3 } from "@dxos/protocols";
|
|
4752
4806
|
import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4753
4807
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4754
4808
|
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
4755
4809
|
import { trace as trace7 } from "@dxos/tracing";
|
|
4756
|
-
import { ComplexMap as ComplexMap3, assignDeep
|
|
4810
|
+
import { ComplexMap as ComplexMap3, assignDeep, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
|
|
4757
4811
|
|
|
4758
4812
|
// packages/sdk/client-services/src/packlets/spaces/genesis.ts
|
|
4759
4813
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -4836,7 +4890,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4836
4890
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4837
4891
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4838
4892
|
}
|
|
4839
|
-
var
|
|
4893
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4840
4894
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4841
4895
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4842
4896
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4850,7 +4904,10 @@ var DataSpaceManager = class {
|
|
|
4850
4904
|
this._echoHost = _echoHost;
|
|
4851
4905
|
this._invitationsManager = _invitationsManager;
|
|
4852
4906
|
this._params = _params;
|
|
4853
|
-
this._ctx = new Context9(
|
|
4907
|
+
this._ctx = new Context9(void 0, {
|
|
4908
|
+
F: __dxlog_file19,
|
|
4909
|
+
L: 104
|
|
4910
|
+
});
|
|
4854
4911
|
this.updated = new Event7();
|
|
4855
4912
|
this._spaces = new ComplexMap3(PublicKey11.hash);
|
|
4856
4913
|
this._isOpen = false;
|
|
@@ -4884,24 +4941,24 @@ var DataSpaceManager = class {
|
|
|
4884
4941
|
}
|
|
4885
4942
|
async open() {
|
|
4886
4943
|
log16("open", void 0, {
|
|
4887
|
-
F:
|
|
4888
|
-
L:
|
|
4944
|
+
F: __dxlog_file19,
|
|
4945
|
+
L: 156,
|
|
4889
4946
|
S: this,
|
|
4890
4947
|
C: (f, a) => f(...a)
|
|
4891
4948
|
});
|
|
4892
4949
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
4893
4950
|
id: this._instanceId
|
|
4894
4951
|
}), {
|
|
4895
|
-
F:
|
|
4896
|
-
L:
|
|
4952
|
+
F: __dxlog_file19,
|
|
4953
|
+
L: 157,
|
|
4897
4954
|
S: this,
|
|
4898
4955
|
C: (f, a) => f(...a)
|
|
4899
4956
|
});
|
|
4900
4957
|
log16("metadata loaded", {
|
|
4901
4958
|
spaces: this._metadataStore.spaces.length
|
|
4902
4959
|
}, {
|
|
4903
|
-
F:
|
|
4904
|
-
L:
|
|
4960
|
+
F: __dxlog_file19,
|
|
4961
|
+
L: 158,
|
|
4905
4962
|
S: this,
|
|
4906
4963
|
C: (f, a) => f(...a)
|
|
4907
4964
|
});
|
|
@@ -4910,8 +4967,8 @@ var DataSpaceManager = class {
|
|
|
4910
4967
|
log16("load space", {
|
|
4911
4968
|
spaceMetadata
|
|
4912
4969
|
}, {
|
|
4913
|
-
F:
|
|
4914
|
-
L:
|
|
4970
|
+
F: __dxlog_file19,
|
|
4971
|
+
L: 162,
|
|
4915
4972
|
S: this,
|
|
4916
4973
|
C: (f, a) => f(...a)
|
|
4917
4974
|
});
|
|
@@ -4921,8 +4978,8 @@ var DataSpaceManager = class {
|
|
|
4921
4978
|
spaceMetadata,
|
|
4922
4979
|
err
|
|
4923
4980
|
}, {
|
|
4924
|
-
F:
|
|
4925
|
-
L:
|
|
4981
|
+
F: __dxlog_file19,
|
|
4982
|
+
L: 165,
|
|
4926
4983
|
S: this,
|
|
4927
4984
|
C: (f, a) => f(...a)
|
|
4928
4985
|
});
|
|
@@ -4933,16 +4990,16 @@ var DataSpaceManager = class {
|
|
|
4933
4990
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
4934
4991
|
id: this._instanceId
|
|
4935
4992
|
}), {
|
|
4936
|
-
F:
|
|
4937
|
-
L:
|
|
4993
|
+
F: __dxlog_file19,
|
|
4994
|
+
L: 172,
|
|
4938
4995
|
S: this,
|
|
4939
4996
|
C: (f, a) => f(...a)
|
|
4940
4997
|
});
|
|
4941
4998
|
}
|
|
4942
4999
|
async close() {
|
|
4943
5000
|
log16("close", void 0, {
|
|
4944
|
-
F:
|
|
4945
|
-
L:
|
|
5001
|
+
F: __dxlog_file19,
|
|
5002
|
+
L: 177,
|
|
4946
5003
|
S: this,
|
|
4947
5004
|
C: (f, a) => f(...a)
|
|
4948
5005
|
});
|
|
@@ -4958,8 +5015,8 @@ var DataSpaceManager = class {
|
|
|
4958
5015
|
*/
|
|
4959
5016
|
async createSpace() {
|
|
4960
5017
|
invariant14(this._isOpen, "Not open.", {
|
|
4961
|
-
F:
|
|
4962
|
-
L:
|
|
5018
|
+
F: __dxlog_file19,
|
|
5019
|
+
L: 191,
|
|
4963
5020
|
S: this,
|
|
4964
5021
|
A: [
|
|
4965
5022
|
"this._isOpen",
|
|
@@ -4979,8 +5036,8 @@ var DataSpaceManager = class {
|
|
|
4979
5036
|
log16("creating space...", {
|
|
4980
5037
|
spaceKey
|
|
4981
5038
|
}, {
|
|
4982
|
-
F:
|
|
4983
|
-
L:
|
|
5039
|
+
F: __dxlog_file19,
|
|
5040
|
+
L: 203,
|
|
4984
5041
|
S: this,
|
|
4985
5042
|
C: (f, a) => f(...a)
|
|
4986
5043
|
});
|
|
@@ -4991,8 +5048,8 @@ var DataSpaceManager = class {
|
|
|
4991
5048
|
await this._metadataStore.addSpace(metadata);
|
|
4992
5049
|
const memberCredential = credentials[1];
|
|
4993
5050
|
invariant14(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4994
|
-
F:
|
|
4995
|
-
L:
|
|
5051
|
+
F: __dxlog_file19,
|
|
5052
|
+
L: 213,
|
|
4996
5053
|
S: this,
|
|
4997
5054
|
A: [
|
|
4998
5055
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -5009,11 +5066,11 @@ var DataSpaceManager = class {
|
|
|
5009
5066
|
return false;
|
|
5010
5067
|
}
|
|
5011
5068
|
switch (space.databaseRoot.getVersion()) {
|
|
5012
|
-
case
|
|
5069
|
+
case SpaceDocVersion3.CURRENT: {
|
|
5013
5070
|
const [_, properties] = findInlineObjectOfType2(space.databaseRoot.docSync(), TYPE_PROPERTIES2) ?? [];
|
|
5014
5071
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
5015
5072
|
}
|
|
5016
|
-
case
|
|
5073
|
+
case SpaceDocVersion3.LEGACY: {
|
|
5017
5074
|
const convertedDoc = await convertLegacyReferences2(space.databaseRoot.docSync());
|
|
5018
5075
|
const [_, properties] = findInlineObjectOfType2(convertedDoc, LEGACY_TYPE_PROPERTIES) ?? [];
|
|
5019
5076
|
return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
|
|
@@ -5023,8 +5080,8 @@ var DataSpaceManager = class {
|
|
|
5023
5080
|
version: space.databaseRoot.getVersion(),
|
|
5024
5081
|
spaceId: space.id
|
|
5025
5082
|
}, {
|
|
5026
|
-
F:
|
|
5027
|
-
L:
|
|
5083
|
+
F: __dxlog_file19,
|
|
5084
|
+
L: 238,
|
|
5028
5085
|
S: this,
|
|
5029
5086
|
C: (f, a) => f(...a)
|
|
5030
5087
|
});
|
|
@@ -5047,7 +5104,7 @@ var DataSpaceManager = class {
|
|
|
5047
5104
|
};
|
|
5048
5105
|
const propertiesId = generateEchoId();
|
|
5049
5106
|
document.change((doc) => {
|
|
5050
|
-
|
|
5107
|
+
assignDeep(doc, [
|
|
5051
5108
|
"objects",
|
|
5052
5109
|
propertiesId
|
|
5053
5110
|
], properties);
|
|
@@ -5058,8 +5115,8 @@ var DataSpaceManager = class {
|
|
|
5058
5115
|
async _getSpaceRootDocument(space) {
|
|
5059
5116
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5060
5117
|
invariant14(automergeIndex, void 0, {
|
|
5061
|
-
F:
|
|
5062
|
-
L:
|
|
5118
|
+
F: __dxlog_file19,
|
|
5119
|
+
L: 271,
|
|
5063
5120
|
S: this,
|
|
5064
5121
|
A: [
|
|
5065
5122
|
"automergeIndex",
|
|
@@ -5075,14 +5132,14 @@ var DataSpaceManager = class {
|
|
|
5075
5132
|
log16("accept space", {
|
|
5076
5133
|
opts
|
|
5077
5134
|
}, {
|
|
5078
|
-
F:
|
|
5079
|
-
L:
|
|
5135
|
+
F: __dxlog_file19,
|
|
5136
|
+
L: 280,
|
|
5080
5137
|
S: this,
|
|
5081
5138
|
C: (f, a) => f(...a)
|
|
5082
5139
|
});
|
|
5083
5140
|
invariant14(this._isOpen, "Not open.", {
|
|
5084
|
-
F:
|
|
5085
|
-
L:
|
|
5141
|
+
F: __dxlog_file19,
|
|
5142
|
+
L: 281,
|
|
5086
5143
|
S: this,
|
|
5087
5144
|
A: [
|
|
5088
5145
|
"this._isOpen",
|
|
@@ -5090,8 +5147,8 @@ var DataSpaceManager = class {
|
|
|
5090
5147
|
]
|
|
5091
5148
|
});
|
|
5092
5149
|
invariant14(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5093
|
-
F:
|
|
5094
|
-
L:
|
|
5150
|
+
F: __dxlog_file19,
|
|
5151
|
+
L: 282,
|
|
5095
5152
|
S: this,
|
|
5096
5153
|
A: [
|
|
5097
5154
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5111,23 +5168,72 @@ var DataSpaceManager = class {
|
|
|
5111
5168
|
this.updated.emit();
|
|
5112
5169
|
return space;
|
|
5113
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
|
+
}
|
|
5114
5208
|
/**
|
|
5115
5209
|
* Wait until the space data pipeline is fully initialized.
|
|
5116
5210
|
* Used by invitation handler.
|
|
5117
5211
|
* TODO(dmaretskyi): Consider removing.
|
|
5118
5212
|
*/
|
|
5119
5213
|
async waitUntilSpaceReady(spaceKey) {
|
|
5120
|
-
await
|
|
5214
|
+
await cancelWithContext5(this._ctx, this.updated.waitForCondition(() => {
|
|
5121
5215
|
const space = this._spaces.get(spaceKey);
|
|
5122
5216
|
return !!space && space.state === SpaceState3.READY;
|
|
5123
5217
|
}));
|
|
5124
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
|
+
}
|
|
5125
5231
|
async _constructSpace(metadata) {
|
|
5126
5232
|
log16("construct space", {
|
|
5127
5233
|
metadata
|
|
5128
5234
|
}, {
|
|
5129
|
-
F:
|
|
5130
|
-
L:
|
|
5235
|
+
F: __dxlog_file19,
|
|
5236
|
+
L: 358,
|
|
5131
5237
|
S: this,
|
|
5132
5238
|
C: (f, a) => f(...a)
|
|
5133
5239
|
});
|
|
@@ -5155,6 +5261,7 @@ var DataSpaceManager = class {
|
|
|
5155
5261
|
credentialAuthenticator: deferFunction2(() => dataSpace.authVerifier.verifier)
|
|
5156
5262
|
},
|
|
5157
5263
|
onAuthorizedConnection: (session) => {
|
|
5264
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialServerExtension(space));
|
|
5158
5265
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5159
5266
|
remotePeerId: session.remotePeerId
|
|
5160
5267
|
}));
|
|
@@ -5164,8 +5271,8 @@ var DataSpaceManager = class {
|
|
|
5164
5271
|
},
|
|
5165
5272
|
onAuthFailure: () => {
|
|
5166
5273
|
log16.warn("auth failure", void 0, {
|
|
5167
|
-
F:
|
|
5168
|
-
L:
|
|
5274
|
+
F: __dxlog_file19,
|
|
5275
|
+
L: 396,
|
|
5169
5276
|
S: this,
|
|
5170
5277
|
C: (f, a) => f(...a)
|
|
5171
5278
|
});
|
|
@@ -5197,8 +5304,8 @@ var DataSpaceManager = class {
|
|
|
5197
5304
|
log16("before space ready", {
|
|
5198
5305
|
space: space.key
|
|
5199
5306
|
}, {
|
|
5200
|
-
F:
|
|
5201
|
-
L:
|
|
5307
|
+
F: __dxlog_file19,
|
|
5308
|
+
L: 423,
|
|
5202
5309
|
S: this,
|
|
5203
5310
|
C: (f, a) => f(...a)
|
|
5204
5311
|
});
|
|
@@ -5208,8 +5315,8 @@ var DataSpaceManager = class {
|
|
|
5208
5315
|
space: space.key,
|
|
5209
5316
|
open: this._isOpen
|
|
5210
5317
|
}, {
|
|
5211
|
-
F:
|
|
5212
|
-
L:
|
|
5318
|
+
F: __dxlog_file19,
|
|
5319
|
+
L: 426,
|
|
5213
5320
|
S: this,
|
|
5214
5321
|
C: (f, a) => f(...a)
|
|
5215
5322
|
});
|
|
@@ -5227,8 +5334,8 @@ var DataSpaceManager = class {
|
|
|
5227
5334
|
log16("before space close", {
|
|
5228
5335
|
space: space.key
|
|
5229
5336
|
}, {
|
|
5230
|
-
F:
|
|
5231
|
-
L:
|
|
5337
|
+
F: __dxlog_file19,
|
|
5338
|
+
L: 434,
|
|
5232
5339
|
S: this,
|
|
5233
5340
|
C: (f, a) => f(...a)
|
|
5234
5341
|
});
|
|
@@ -5268,8 +5375,8 @@ var DataSpaceManager = class {
|
|
|
5268
5375
|
peersOnline: presence.getPeersOnline().length,
|
|
5269
5376
|
closedSessions
|
|
5270
5377
|
}, {
|
|
5271
|
-
F:
|
|
5272
|
-
L:
|
|
5378
|
+
F: __dxlog_file19,
|
|
5379
|
+
L: 470,
|
|
5273
5380
|
S: this,
|
|
5274
5381
|
C: (f, a) => f(...a)
|
|
5275
5382
|
});
|
|
@@ -5283,8 +5390,8 @@ var DataSpaceManager = class {
|
|
|
5283
5390
|
log16("closing a session with a removed peer", {
|
|
5284
5391
|
peerId: peerState.peerId
|
|
5285
5392
|
}, {
|
|
5286
|
-
F:
|
|
5287
|
-
L:
|
|
5393
|
+
F: __dxlog_file19,
|
|
5394
|
+
L: 484,
|
|
5288
5395
|
S: this,
|
|
5289
5396
|
C: (f, a) => f(...a)
|
|
5290
5397
|
});
|
|
@@ -5349,13 +5456,13 @@ import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTas
|
|
|
5349
5456
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
5350
5457
|
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
|
|
5351
5458
|
import { raise as raise2 } from "@dxos/debug";
|
|
5352
|
-
import { writeMessages as
|
|
5459
|
+
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
5353
5460
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
5354
5461
|
import { log as log17 } from "@dxos/log";
|
|
5355
5462
|
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
5356
5463
|
import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5357
5464
|
import { trace as trace8 } from "@dxos/tracing";
|
|
5358
|
-
var
|
|
5465
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5359
5466
|
var SpacesServiceImpl = class {
|
|
5360
5467
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5361
5468
|
this._identityManager = _identityManager;
|
|
@@ -5399,8 +5506,8 @@ var SpacesServiceImpl = class {
|
|
|
5399
5506
|
}
|
|
5400
5507
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5401
5508
|
invariant15(credentials[0].credential, void 0, {
|
|
5402
|
-
F:
|
|
5403
|
-
L:
|
|
5509
|
+
F: __dxlog_file20,
|
|
5510
|
+
L: 102,
|
|
5404
5511
|
S: this,
|
|
5405
5512
|
A: [
|
|
5406
5513
|
"credentials[0].credential",
|
|
@@ -5409,15 +5516,15 @@ var SpacesServiceImpl = class {
|
|
|
5409
5516
|
});
|
|
5410
5517
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5411
5518
|
invariant15(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5412
|
-
F:
|
|
5413
|
-
L:
|
|
5519
|
+
F: __dxlog_file20,
|
|
5520
|
+
L: 104,
|
|
5414
5521
|
S: this,
|
|
5415
5522
|
A: [
|
|
5416
5523
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5417
5524
|
""
|
|
5418
5525
|
]
|
|
5419
5526
|
});
|
|
5420
|
-
await
|
|
5527
|
+
await writeMessages4(space.controlPipeline.writer, credentials);
|
|
5421
5528
|
}
|
|
5422
5529
|
querySpaces() {
|
|
5423
5530
|
return new Stream10(({ next, ctx }) => {
|
|
@@ -5427,8 +5534,8 @@ var SpacesServiceImpl = class {
|
|
|
5427
5534
|
log17("update", {
|
|
5428
5535
|
spaces
|
|
5429
5536
|
}, {
|
|
5430
|
-
F:
|
|
5431
|
-
L:
|
|
5537
|
+
F: __dxlog_file20,
|
|
5538
|
+
L: 115,
|
|
5432
5539
|
S: this,
|
|
5433
5540
|
C: (f, a) => f(...a)
|
|
5434
5541
|
});
|
|
@@ -5446,7 +5553,15 @@ var SpacesServiceImpl = class {
|
|
|
5446
5553
|
const subscribeSpaces = () => {
|
|
5447
5554
|
subscriptions.clear();
|
|
5448
5555
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
5449
|
-
|
|
5556
|
+
let lastState;
|
|
5557
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => {
|
|
5558
|
+
if (space.state !== lastState) {
|
|
5559
|
+
scheduler.forceTrigger();
|
|
5560
|
+
} else {
|
|
5561
|
+
scheduler.trigger();
|
|
5562
|
+
}
|
|
5563
|
+
lastState = space.state;
|
|
5564
|
+
}));
|
|
5450
5565
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
5451
5566
|
subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
5452
5567
|
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
@@ -5511,8 +5626,8 @@ var SpacesServiceImpl = class {
|
|
|
5511
5626
|
});
|
|
5512
5627
|
} else {
|
|
5513
5628
|
invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5514
|
-
F:
|
|
5515
|
-
L:
|
|
5629
|
+
F: __dxlog_file20,
|
|
5630
|
+
L: 213,
|
|
5516
5631
|
S: this,
|
|
5517
5632
|
A: [
|
|
5518
5633
|
"!credential.id",
|
|
@@ -5520,8 +5635,8 @@ var SpacesServiceImpl = class {
|
|
|
5520
5635
|
]
|
|
5521
5636
|
});
|
|
5522
5637
|
invariant15(this._identityManager.identity, "Identity is not available", {
|
|
5523
|
-
F:
|
|
5524
|
-
L:
|
|
5638
|
+
F: __dxlog_file20,
|
|
5639
|
+
L: 214,
|
|
5525
5640
|
S: this,
|
|
5526
5641
|
A: [
|
|
5527
5642
|
"this._identityManager.identity",
|
|
@@ -5530,8 +5645,8 @@ var SpacesServiceImpl = class {
|
|
|
5530
5645
|
});
|
|
5531
5646
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5532
5647
|
invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5533
|
-
F:
|
|
5534
|
-
L:
|
|
5648
|
+
F: __dxlog_file20,
|
|
5649
|
+
L: 216,
|
|
5535
5650
|
S: this,
|
|
5536
5651
|
A: [
|
|
5537
5652
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5561,6 +5676,59 @@ var SpacesServiceImpl = class {
|
|
|
5561
5676
|
epochCredential: credential ?? void 0
|
|
5562
5677
|
};
|
|
5563
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
|
+
}
|
|
5564
5732
|
_serializeSpace(space) {
|
|
5565
5733
|
return {
|
|
5566
5734
|
id: space.id,
|
|
@@ -5578,7 +5746,8 @@ var SpacesServiceImpl = class {
|
|
|
5578
5746
|
startDataTimeframe: void 0,
|
|
5579
5747
|
currentDataTimeframe: void 0,
|
|
5580
5748
|
targetDataTimeframe: void 0,
|
|
5581
|
-
totalDataTimeframe: void 0
|
|
5749
|
+
totalDataTimeframe: void 0,
|
|
5750
|
+
spaceRootUrl: space.databaseRoot?.url
|
|
5582
5751
|
},
|
|
5583
5752
|
members: Array.from(space.inner.spaceState.members.values()).map((member) => {
|
|
5584
5753
|
const peers = space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key));
|
|
@@ -5648,7 +5817,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5648
5817
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5649
5818
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5650
5819
|
}
|
|
5651
|
-
var
|
|
5820
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5652
5821
|
var ServiceContext = class extends Resource3 {
|
|
5653
5822
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5654
5823
|
super();
|
|
@@ -5692,7 +5861,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5692
5861
|
async _open(ctx) {
|
|
5693
5862
|
await this._checkStorageVersion();
|
|
5694
5863
|
log18("opening...", void 0, {
|
|
5695
|
-
F:
|
|
5864
|
+
F: __dxlog_file21,
|
|
5696
5865
|
L: 149,
|
|
5697
5866
|
S: this,
|
|
5698
5867
|
C: (f, a) => f(...a)
|
|
@@ -5700,7 +5869,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5700
5869
|
log18.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
5701
5870
|
id: this._instanceId
|
|
5702
5871
|
}), {
|
|
5703
|
-
F:
|
|
5872
|
+
F: __dxlog_file21,
|
|
5704
5873
|
L: 150,
|
|
5705
5874
|
S: this,
|
|
5706
5875
|
C: (f, a) => f(...a)
|
|
@@ -5718,7 +5887,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5718
5887
|
log18("loaded persistent invitations", {
|
|
5719
5888
|
count: loadedInvitations.invitations?.length
|
|
5720
5889
|
}, {
|
|
5721
|
-
F:
|
|
5890
|
+
F: __dxlog_file21,
|
|
5722
5891
|
L: 163,
|
|
5723
5892
|
S: this,
|
|
5724
5893
|
C: (f, a) => f(...a)
|
|
@@ -5726,13 +5895,13 @@ var ServiceContext = class extends Resource3 {
|
|
|
5726
5895
|
log18.trace("dxos.sdk.service-context.open", trace9.end({
|
|
5727
5896
|
id: this._instanceId
|
|
5728
5897
|
}), {
|
|
5729
|
-
F:
|
|
5898
|
+
F: __dxlog_file21,
|
|
5730
5899
|
L: 165,
|
|
5731
5900
|
S: this,
|
|
5732
5901
|
C: (f, a) => f(...a)
|
|
5733
5902
|
});
|
|
5734
5903
|
log18("opened", void 0, {
|
|
5735
|
-
F:
|
|
5904
|
+
F: __dxlog_file21,
|
|
5736
5905
|
L: 166,
|
|
5737
5906
|
S: this,
|
|
5738
5907
|
C: (f, a) => f(...a)
|
|
@@ -5740,7 +5909,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5740
5909
|
}
|
|
5741
5910
|
async _close(ctx) {
|
|
5742
5911
|
log18("closing...", void 0, {
|
|
5743
|
-
F:
|
|
5912
|
+
F: __dxlog_file21,
|
|
5744
5913
|
L: 170,
|
|
5745
5914
|
S: this,
|
|
5746
5915
|
C: (f, a) => f(...a)
|
|
@@ -5757,7 +5926,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5757
5926
|
await this.networkManager.close();
|
|
5758
5927
|
await this.signalManager.close();
|
|
5759
5928
|
log18("closed", void 0, {
|
|
5760
|
-
F:
|
|
5929
|
+
F: __dxlog_file21,
|
|
5761
5930
|
L: 182,
|
|
5762
5931
|
S: this,
|
|
5763
5932
|
C: (f, a) => f(...a)
|
|
@@ -5765,13 +5934,16 @@ var ServiceContext = class extends Resource3 {
|
|
|
5765
5934
|
}
|
|
5766
5935
|
async createIdentity(params = {}) {
|
|
5767
5936
|
const identity = await this.identityManager.createIdentity(params);
|
|
5768
|
-
await this._initialize(new Context10(
|
|
5937
|
+
await this._initialize(new Context10(void 0, {
|
|
5938
|
+
F: __dxlog_file21,
|
|
5939
|
+
L: 187
|
|
5940
|
+
}));
|
|
5769
5941
|
return identity;
|
|
5770
5942
|
}
|
|
5771
5943
|
getInvitationHandler(invitation) {
|
|
5772
5944
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5773
5945
|
invariant16(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5774
|
-
F:
|
|
5946
|
+
F: __dxlog_file21,
|
|
5775
5947
|
L: 193,
|
|
5776
5948
|
S: this,
|
|
5777
5949
|
A: [
|
|
@@ -5791,7 +5963,10 @@ var ServiceContext = class extends Resource3 {
|
|
|
5791
5963
|
}
|
|
5792
5964
|
async _acceptIdentity(params) {
|
|
5793
5965
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5794
|
-
await this._initialize(new Context10(
|
|
5966
|
+
await this._initialize(new Context10(void 0, {
|
|
5967
|
+
F: __dxlog_file21,
|
|
5968
|
+
L: 209
|
|
5969
|
+
}));
|
|
5795
5970
|
return identity;
|
|
5796
5971
|
}
|
|
5797
5972
|
async _checkStorageVersion() {
|
|
@@ -5803,7 +5978,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5803
5978
|
// Called when identity is created.
|
|
5804
5979
|
async _initialize(ctx) {
|
|
5805
5980
|
log18("initializing spaces...", void 0, {
|
|
5806
|
-
F:
|
|
5981
|
+
F: __dxlog_file21,
|
|
5807
5982
|
L: 224,
|
|
5808
5983
|
S: this,
|
|
5809
5984
|
C: (f, a) => f(...a)
|
|
@@ -5826,7 +6001,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5826
6001
|
await this.dataSpaceManager.open();
|
|
5827
6002
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
5828
6003
|
invariant16(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5829
|
-
F:
|
|
6004
|
+
F: __dxlog_file21,
|
|
5830
6005
|
L: 249,
|
|
5831
6006
|
S: this,
|
|
5832
6007
|
A: [
|
|
@@ -5850,7 +6025,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5850
6025
|
log18("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5851
6026
|
details: assertion
|
|
5852
6027
|
}, {
|
|
5853
|
-
F:
|
|
6028
|
+
F: __dxlog_file21,
|
|
5854
6029
|
L: 265,
|
|
5855
6030
|
S: this,
|
|
5856
6031
|
C: (f, a) => f(...a)
|
|
@@ -5861,7 +6036,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5861
6036
|
log18("space already exists, ignoring space admission", {
|
|
5862
6037
|
details: assertion
|
|
5863
6038
|
}, {
|
|
5864
|
-
F:
|
|
6039
|
+
F: __dxlog_file21,
|
|
5865
6040
|
L: 269,
|
|
5866
6041
|
S: this,
|
|
5867
6042
|
C: (f, a) => f(...a)
|
|
@@ -5872,7 +6047,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5872
6047
|
log18("accepting space recorded in halo", {
|
|
5873
6048
|
details: assertion
|
|
5874
6049
|
}, {
|
|
5875
|
-
F:
|
|
6050
|
+
F: __dxlog_file21,
|
|
5876
6051
|
L: 274,
|
|
5877
6052
|
S: this,
|
|
5878
6053
|
C: (f, a) => f(...a)
|
|
@@ -5883,7 +6058,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5883
6058
|
});
|
|
5884
6059
|
} catch (err) {
|
|
5885
6060
|
log18.catch(err, void 0, {
|
|
5886
|
-
F:
|
|
6061
|
+
F: __dxlog_file21,
|
|
5887
6062
|
L: 280,
|
|
5888
6063
|
S: this,
|
|
5889
6064
|
C: (f, a) => f(...a)
|
|
@@ -5930,7 +6105,7 @@ var ServiceRegistry = class {
|
|
|
5930
6105
|
};
|
|
5931
6106
|
|
|
5932
6107
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
5933
|
-
import { asyncTimeout as
|
|
6108
|
+
import { asyncTimeout as asyncTimeout2, Trigger as Trigger9 } from "@dxos/async";
|
|
5934
6109
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
5935
6110
|
import { log as log19, logInfo } from "@dxos/log";
|
|
5936
6111
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
@@ -5943,7 +6118,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5943
6118
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5944
6119
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5945
6120
|
}
|
|
5946
|
-
var
|
|
6121
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
|
|
5947
6122
|
var Message;
|
|
5948
6123
|
(function(Message2) {
|
|
5949
6124
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -5966,28 +6141,28 @@ var Lock = class {
|
|
|
5966
6141
|
});
|
|
5967
6142
|
try {
|
|
5968
6143
|
log19("aquiring lock...", void 0, {
|
|
5969
|
-
F:
|
|
6144
|
+
F: __dxlog_file22,
|
|
5970
6145
|
L: 42,
|
|
5971
6146
|
S: this,
|
|
5972
6147
|
C: (f, a) => f(...a)
|
|
5973
6148
|
});
|
|
5974
|
-
await
|
|
6149
|
+
await asyncTimeout2(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
|
|
5975
6150
|
log19("acquired lock", void 0, {
|
|
5976
|
-
F:
|
|
6151
|
+
F: __dxlog_file22,
|
|
5977
6152
|
L: 44,
|
|
5978
6153
|
S: this,
|
|
5979
6154
|
C: (f, a) => f(...a)
|
|
5980
6155
|
});
|
|
5981
6156
|
} catch {
|
|
5982
6157
|
log19("stealing lock...", void 0, {
|
|
5983
|
-
F:
|
|
6158
|
+
F: __dxlog_file22,
|
|
5984
6159
|
L: 46,
|
|
5985
6160
|
S: this,
|
|
5986
6161
|
C: (f, a) => f(...a)
|
|
5987
6162
|
});
|
|
5988
6163
|
await this._requestLock(true);
|
|
5989
6164
|
log19("stolen lock", void 0, {
|
|
5990
|
-
F:
|
|
6165
|
+
F: __dxlog_file22,
|
|
5991
6166
|
L: 48,
|
|
5992
6167
|
S: this,
|
|
5993
6168
|
C: (f, a) => f(...a)
|
|
@@ -6006,7 +6181,7 @@ var Lock = class {
|
|
|
6006
6181
|
log19("requesting lock...", {
|
|
6007
6182
|
steal
|
|
6008
6183
|
}, {
|
|
6009
|
-
F:
|
|
6184
|
+
F: __dxlog_file22,
|
|
6010
6185
|
L: 63,
|
|
6011
6186
|
S: this,
|
|
6012
6187
|
C: (f, a) => f(...a)
|
|
@@ -6020,14 +6195,14 @@ var Lock = class {
|
|
|
6020
6195
|
this._releaseTrigger = new Trigger9();
|
|
6021
6196
|
await this._releaseTrigger.wait();
|
|
6022
6197
|
log19("releasing lock...", void 0, {
|
|
6023
|
-
F:
|
|
6198
|
+
F: __dxlog_file22,
|
|
6024
6199
|
L: 72,
|
|
6025
6200
|
S: this,
|
|
6026
6201
|
C: (f, a) => f(...a)
|
|
6027
6202
|
});
|
|
6028
6203
|
await this._onRelease?.();
|
|
6029
6204
|
log19("released lock", void 0, {
|
|
6030
|
-
F:
|
|
6205
|
+
F: __dxlog_file22,
|
|
6031
6206
|
L: 74,
|
|
6032
6207
|
S: this,
|
|
6033
6208
|
C: (f, a) => f(...a)
|
|
@@ -6039,7 +6214,7 @@ var Lock = class {
|
|
|
6039
6214
|
log19("recieved lock", {
|
|
6040
6215
|
steal
|
|
6041
6216
|
}, {
|
|
6042
|
-
F:
|
|
6217
|
+
F: __dxlog_file22,
|
|
6043
6218
|
L: 81,
|
|
6044
6219
|
S: this,
|
|
6045
6220
|
C: (f, a) => f(...a)
|
|
@@ -6127,13 +6302,172 @@ var createLevel = async (config) => {
|
|
|
6127
6302
|
return level;
|
|
6128
6303
|
};
|
|
6129
6304
|
|
|
6305
|
+
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
6306
|
+
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
6307
|
+
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6308
|
+
import { log as log20 } from "@dxos/log";
|
|
6309
|
+
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
6310
|
+
import { arrayToBuffer } from "@dxos/util";
|
|
6311
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6312
|
+
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
6313
|
+
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
6314
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6315
|
+
const archive = {
|
|
6316
|
+
storage: [],
|
|
6317
|
+
meta: {
|
|
6318
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6319
|
+
}
|
|
6320
|
+
};
|
|
6321
|
+
{
|
|
6322
|
+
const directory = await storage.createDirectory();
|
|
6323
|
+
const files = await directory.list();
|
|
6324
|
+
log20.info("begin exporting files", {
|
|
6325
|
+
count: files.length
|
|
6326
|
+
}, {
|
|
6327
|
+
F: __dxlog_file23,
|
|
6328
|
+
L: 30,
|
|
6329
|
+
S: void 0,
|
|
6330
|
+
C: (f, a) => f(...a)
|
|
6331
|
+
});
|
|
6332
|
+
for (const filename of files) {
|
|
6333
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6334
|
+
const { size } = await file.stat();
|
|
6335
|
+
const data = await file.read(0, size);
|
|
6336
|
+
archive.storage.push({
|
|
6337
|
+
type: ProfileArchiveEntryType.FILE,
|
|
6338
|
+
key: filename,
|
|
6339
|
+
value: data
|
|
6340
|
+
});
|
|
6341
|
+
}
|
|
6342
|
+
log20.info("done exporting files", {
|
|
6343
|
+
count: files.length
|
|
6344
|
+
}, {
|
|
6345
|
+
F: __dxlog_file23,
|
|
6346
|
+
L: 41,
|
|
6347
|
+
S: void 0,
|
|
6348
|
+
C: (f, a) => f(...a)
|
|
6349
|
+
});
|
|
6350
|
+
}
|
|
6351
|
+
{
|
|
6352
|
+
log20.info("begin exporting kv pairs", void 0, {
|
|
6353
|
+
F: __dxlog_file23,
|
|
6354
|
+
L: 45,
|
|
6355
|
+
S: void 0,
|
|
6356
|
+
C: (f, a) => f(...a)
|
|
6357
|
+
});
|
|
6358
|
+
const iter = await level.iterator({
|
|
6359
|
+
keyEncoding: "binary",
|
|
6360
|
+
valueEncoding: "binary"
|
|
6361
|
+
});
|
|
6362
|
+
let count = 0;
|
|
6363
|
+
for await (const [key, value] of iter) {
|
|
6364
|
+
archive.storage.push({
|
|
6365
|
+
type: ProfileArchiveEntryType.KEY_VALUE,
|
|
6366
|
+
key,
|
|
6367
|
+
value
|
|
6368
|
+
});
|
|
6369
|
+
count++;
|
|
6370
|
+
}
|
|
6371
|
+
log20.info("done exporting kv pairs", {
|
|
6372
|
+
count
|
|
6373
|
+
}, {
|
|
6374
|
+
F: __dxlog_file23,
|
|
6375
|
+
L: 56,
|
|
6376
|
+
S: void 0,
|
|
6377
|
+
C: (f, a) => f(...a)
|
|
6378
|
+
});
|
|
6379
|
+
}
|
|
6380
|
+
return archive;
|
|
6381
|
+
};
|
|
6382
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6383
|
+
let batch = level.batch();
|
|
6384
|
+
let count = 0;
|
|
6385
|
+
for (const entry2 of archive.storage) {
|
|
6386
|
+
switch (entry2.type) {
|
|
6387
|
+
case ProfileArchiveEntryType.FILE: {
|
|
6388
|
+
const directory = await storage.createDirectory();
|
|
6389
|
+
invariant17(typeof entry2.key === "string", "Invalid key type", {
|
|
6390
|
+
F: __dxlog_file23,
|
|
6391
|
+
L: 79,
|
|
6392
|
+
S: void 0,
|
|
6393
|
+
A: [
|
|
6394
|
+
"typeof entry.key === 'string'",
|
|
6395
|
+
"'Invalid key type'"
|
|
6396
|
+
]
|
|
6397
|
+
});
|
|
6398
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6399
|
+
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6400
|
+
F: __dxlog_file23,
|
|
6401
|
+
L: 81,
|
|
6402
|
+
S: void 0,
|
|
6403
|
+
A: [
|
|
6404
|
+
"entry.value instanceof Uint8Array",
|
|
6405
|
+
"'Invalid value type'"
|
|
6406
|
+
]
|
|
6407
|
+
});
|
|
6408
|
+
await file.write(0, arrayToBuffer(entry2.value));
|
|
6409
|
+
await file.close();
|
|
6410
|
+
break;
|
|
6411
|
+
}
|
|
6412
|
+
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
6413
|
+
invariant17(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6414
|
+
F: __dxlog_file23,
|
|
6415
|
+
L: 87,
|
|
6416
|
+
S: void 0,
|
|
6417
|
+
A: [
|
|
6418
|
+
"entry.key instanceof Uint8Array",
|
|
6419
|
+
"'Invalid key type'"
|
|
6420
|
+
]
|
|
6421
|
+
});
|
|
6422
|
+
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6423
|
+
F: __dxlog_file23,
|
|
6424
|
+
L: 88,
|
|
6425
|
+
S: void 0,
|
|
6426
|
+
A: [
|
|
6427
|
+
"entry.value instanceof Uint8Array",
|
|
6428
|
+
"'Invalid value type'"
|
|
6429
|
+
]
|
|
6430
|
+
});
|
|
6431
|
+
batch.put(entry2.key, entry2.value, {
|
|
6432
|
+
keyEncoding: "binary",
|
|
6433
|
+
valueEncoding: "binary"
|
|
6434
|
+
});
|
|
6435
|
+
break;
|
|
6436
|
+
}
|
|
6437
|
+
default:
|
|
6438
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
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
|
+
}
|
|
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
|
+
});
|
|
6461
|
+
await batch.write();
|
|
6462
|
+
};
|
|
6463
|
+
|
|
6130
6464
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
6131
6465
|
import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
|
|
6132
6466
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
6133
6467
|
import { Context as Context11 } from "@dxos/context";
|
|
6134
|
-
import { invariant as
|
|
6135
|
-
import { PublicKey as
|
|
6136
|
-
import { log as
|
|
6468
|
+
import { invariant as invariant19 } from "@dxos/invariant";
|
|
6469
|
+
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
6470
|
+
import { log as log22 } from "@dxos/log";
|
|
6137
6471
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
6138
6472
|
import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
6139
6473
|
import { trace as trace10 } from "@dxos/protocols";
|
|
@@ -6144,9 +6478,9 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
|
6144
6478
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
6145
6479
|
import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
6146
6480
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
6147
|
-
import { invariant as
|
|
6481
|
+
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6148
6482
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6149
|
-
var
|
|
6483
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6150
6484
|
var DevicesServiceImpl = class {
|
|
6151
6485
|
constructor(_identityManager) {
|
|
6152
6486
|
this._identityManager = _identityManager;
|
|
@@ -6163,8 +6497,8 @@ var DevicesServiceImpl = class {
|
|
|
6163
6497
|
devices: []
|
|
6164
6498
|
});
|
|
6165
6499
|
} else {
|
|
6166
|
-
|
|
6167
|
-
F:
|
|
6500
|
+
invariant18(this._identityManager.identity?.presence, "presence not present", {
|
|
6501
|
+
F: __dxlog_file24,
|
|
6168
6502
|
L: 32,
|
|
6169
6503
|
S: this,
|
|
6170
6504
|
A: [
|
|
@@ -6270,28 +6604,111 @@ var findConfigs = () => {
|
|
|
6270
6604
|
return configs.map((r) => r.instance.deref()).filter(nonNullable);
|
|
6271
6605
|
};
|
|
6272
6606
|
|
|
6273
|
-
// packages/sdk/client-services/src/packlets/
|
|
6274
|
-
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";
|
|
6275
6609
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
6276
6610
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
6277
|
-
import {
|
|
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";
|
|
6694
|
+
import { getContextFromEntry, log as log21 } from "@dxos/log";
|
|
6278
6695
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
6279
6696
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
6280
6697
|
var LoggingServiceImpl = class {
|
|
6281
6698
|
constructor() {
|
|
6282
6699
|
this._logs = new Event8();
|
|
6283
6700
|
this._started = Date.now();
|
|
6284
|
-
this._sessionId =
|
|
6701
|
+
this._sessionId = PublicKey16.random().toHex();
|
|
6285
6702
|
this._logProcessor = (_config, entry2) => {
|
|
6286
6703
|
this._logs.emit(entry2);
|
|
6287
6704
|
};
|
|
6288
6705
|
}
|
|
6289
6706
|
async open() {
|
|
6290
|
-
|
|
6707
|
+
log21.runtimeConfig.processors.push(this._logProcessor);
|
|
6291
6708
|
}
|
|
6292
6709
|
async close() {
|
|
6293
|
-
const index =
|
|
6294
|
-
|
|
6710
|
+
const index = log21.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6711
|
+
log21.runtimeConfig.processors.splice(index, 1);
|
|
6295
6712
|
}
|
|
6296
6713
|
async controlMetrics({ reset, record }) {
|
|
6297
6714
|
if (reset) {
|
|
@@ -6317,7 +6734,7 @@ var LoggingServiceImpl = class {
|
|
|
6317
6734
|
stats: numericalValues(events, "duration")
|
|
6318
6735
|
};
|
|
6319
6736
|
};
|
|
6320
|
-
return new
|
|
6737
|
+
return new Stream13(({ next }) => {
|
|
6321
6738
|
const update = () => {
|
|
6322
6739
|
const metrics = {
|
|
6323
6740
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6339,7 +6756,7 @@ var LoggingServiceImpl = class {
|
|
|
6339
6756
|
});
|
|
6340
6757
|
}
|
|
6341
6758
|
queryLogs(request) {
|
|
6342
|
-
return new
|
|
6759
|
+
return new Stream13(({ ctx, next }) => {
|
|
6343
6760
|
const handler = (entry2) => {
|
|
6344
6761
|
if (LOG_PROCESSING > 0) {
|
|
6345
6762
|
return;
|
|
@@ -6395,14 +6812,14 @@ var shouldLog = (entry2, request) => {
|
|
|
6395
6812
|
var LOG_PROCESSING = 0;
|
|
6396
6813
|
|
|
6397
6814
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
6398
|
-
import { Stream as
|
|
6815
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
6399
6816
|
var NetworkServiceImpl = class {
|
|
6400
6817
|
constructor(networkManager, signalManager) {
|
|
6401
6818
|
this.networkManager = networkManager;
|
|
6402
6819
|
this.signalManager = signalManager;
|
|
6403
6820
|
}
|
|
6404
6821
|
queryStatus() {
|
|
6405
|
-
return new
|
|
6822
|
+
return new Stream14(({ next }) => {
|
|
6406
6823
|
const update = () => {
|
|
6407
6824
|
next({
|
|
6408
6825
|
swarm: this.networkManager.connectionState,
|
|
@@ -6428,7 +6845,7 @@ var NetworkServiceImpl = class {
|
|
|
6428
6845
|
};
|
|
6429
6846
|
|
|
6430
6847
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
6431
|
-
import { Stream as
|
|
6848
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf";
|
|
6432
6849
|
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6433
6850
|
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
6434
6851
|
var SystemServiceImpl = class {
|
|
@@ -6464,7 +6881,7 @@ var SystemServiceImpl = class {
|
|
|
6464
6881
|
}
|
|
6465
6882
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6466
6883
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6467
|
-
return new
|
|
6884
|
+
return new Stream15(({ next }) => {
|
|
6468
6885
|
const update = () => {
|
|
6469
6886
|
next({
|
|
6470
6887
|
status: this._getCurrentStatus()
|
|
@@ -6495,7 +6912,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6495
6912
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6496
6913
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6497
6914
|
}
|
|
6498
|
-
var
|
|
6915
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6499
6916
|
var ClientServicesHost = class {
|
|
6500
6917
|
constructor({
|
|
6501
6918
|
config,
|
|
@@ -6528,7 +6945,10 @@ var ClientServicesHost = class {
|
|
|
6528
6945
|
lockKey,
|
|
6529
6946
|
onAcquire: () => {
|
|
6530
6947
|
if (!this._opening) {
|
|
6531
|
-
void this.open(new Context11(
|
|
6948
|
+
void this.open(new Context11(void 0, {
|
|
6949
|
+
F: __dxlog_file25,
|
|
6950
|
+
L: 121
|
|
6951
|
+
}));
|
|
6532
6952
|
}
|
|
6533
6953
|
},
|
|
6534
6954
|
onRelease: () => this.close()
|
|
@@ -6583,25 +7003,25 @@ var ClientServicesHost = class {
|
|
|
6583
7003
|
* Can only be called once.
|
|
6584
7004
|
*/
|
|
6585
7005
|
initialize({ config, ...options }) {
|
|
6586
|
-
|
|
6587
|
-
F:
|
|
6588
|
-
L:
|
|
7006
|
+
invariant19(!this._open, "service host is open", {
|
|
7007
|
+
F: __dxlog_file25,
|
|
7008
|
+
L: 187,
|
|
6589
7009
|
S: this,
|
|
6590
7010
|
A: [
|
|
6591
7011
|
"!this._open",
|
|
6592
7012
|
"'service host is open'"
|
|
6593
7013
|
]
|
|
6594
7014
|
});
|
|
6595
|
-
|
|
6596
|
-
F:
|
|
6597
|
-
L:
|
|
7015
|
+
log22("initializing...", void 0, {
|
|
7016
|
+
F: __dxlog_file25,
|
|
7017
|
+
L: 188,
|
|
6598
7018
|
S: this,
|
|
6599
7019
|
C: (f, a) => f(...a)
|
|
6600
7020
|
});
|
|
6601
7021
|
if (config) {
|
|
6602
|
-
|
|
6603
|
-
F:
|
|
6604
|
-
L:
|
|
7022
|
+
invariant19(!this._config, "config already set", {
|
|
7023
|
+
F: __dxlog_file25,
|
|
7024
|
+
L: 191,
|
|
6605
7025
|
S: this,
|
|
6606
7026
|
A: [
|
|
6607
7027
|
"!this._config",
|
|
@@ -6614,9 +7034,9 @@ var ClientServicesHost = class {
|
|
|
6614
7034
|
}
|
|
6615
7035
|
}
|
|
6616
7036
|
if (!options.signalManager) {
|
|
6617
|
-
|
|
6618
|
-
F:
|
|
6619
|
-
L:
|
|
7037
|
+
log22.warn("running signaling without telemetry metadata.", void 0, {
|
|
7038
|
+
F: __dxlog_file25,
|
|
7039
|
+
L: 199,
|
|
6620
7040
|
S: this,
|
|
6621
7041
|
C: (f, a) => f(...a)
|
|
6622
7042
|
});
|
|
@@ -6625,9 +7045,9 @@ var ClientServicesHost = class {
|
|
|
6625
7045
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6626
7046
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6627
7047
|
this._signalManager = signalManager;
|
|
6628
|
-
|
|
6629
|
-
F:
|
|
6630
|
-
L:
|
|
7048
|
+
invariant19(!this._networkManager, "network manager already set", {
|
|
7049
|
+
F: __dxlog_file25,
|
|
7050
|
+
L: 210,
|
|
6631
7051
|
S: this,
|
|
6632
7052
|
A: [
|
|
6633
7053
|
"!this._networkManager",
|
|
@@ -6639,9 +7059,9 @@ var ClientServicesHost = class {
|
|
|
6639
7059
|
transportFactory,
|
|
6640
7060
|
signalManager
|
|
6641
7061
|
});
|
|
6642
|
-
|
|
6643
|
-
F:
|
|
6644
|
-
L:
|
|
7062
|
+
log22("initialized", void 0, {
|
|
7063
|
+
F: __dxlog_file25,
|
|
7064
|
+
L: 217,
|
|
6645
7065
|
S: this,
|
|
6646
7066
|
C: (f, a) => f(...a)
|
|
6647
7067
|
});
|
|
@@ -6650,45 +7070,45 @@ var ClientServicesHost = class {
|
|
|
6650
7070
|
if (this._open) {
|
|
6651
7071
|
return;
|
|
6652
7072
|
}
|
|
6653
|
-
const traceId =
|
|
6654
|
-
|
|
7073
|
+
const traceId = PublicKey17.random().toHex();
|
|
7074
|
+
log22.trace("dxos.client-services.host.open", trace10.begin({
|
|
6655
7075
|
id: traceId
|
|
6656
7076
|
}), {
|
|
6657
|
-
F:
|
|
6658
|
-
L:
|
|
7077
|
+
F: __dxlog_file25,
|
|
7078
|
+
L: 228,
|
|
6659
7079
|
S: this,
|
|
6660
7080
|
C: (f, a) => f(...a)
|
|
6661
7081
|
});
|
|
6662
|
-
|
|
6663
|
-
F:
|
|
6664
|
-
L:
|
|
7082
|
+
invariant19(this._config, "config not set", {
|
|
7083
|
+
F: __dxlog_file25,
|
|
7084
|
+
L: 230,
|
|
6665
7085
|
S: this,
|
|
6666
7086
|
A: [
|
|
6667
7087
|
"this._config",
|
|
6668
7088
|
"'config not set'"
|
|
6669
7089
|
]
|
|
6670
7090
|
});
|
|
6671
|
-
|
|
6672
|
-
F:
|
|
6673
|
-
L:
|
|
7091
|
+
invariant19(this._storage, "storage not set", {
|
|
7092
|
+
F: __dxlog_file25,
|
|
7093
|
+
L: 231,
|
|
6674
7094
|
S: this,
|
|
6675
7095
|
A: [
|
|
6676
7096
|
"this._storage",
|
|
6677
7097
|
"'storage not set'"
|
|
6678
7098
|
]
|
|
6679
7099
|
});
|
|
6680
|
-
|
|
6681
|
-
F:
|
|
6682
|
-
L:
|
|
7100
|
+
invariant19(this._signalManager, "signal manager not set", {
|
|
7101
|
+
F: __dxlog_file25,
|
|
7102
|
+
L: 232,
|
|
6683
7103
|
S: this,
|
|
6684
7104
|
A: [
|
|
6685
7105
|
"this._signalManager",
|
|
6686
7106
|
"'signal manager not set'"
|
|
6687
7107
|
]
|
|
6688
7108
|
});
|
|
6689
|
-
|
|
6690
|
-
F:
|
|
6691
|
-
L:
|
|
7109
|
+
invariant19(this._networkManager, "network manager not set", {
|
|
7110
|
+
F: __dxlog_file25,
|
|
7111
|
+
L: 233,
|
|
6692
7112
|
S: this,
|
|
6693
7113
|
A: [
|
|
6694
7114
|
"this._networkManager",
|
|
@@ -6696,11 +7116,11 @@ var ClientServicesHost = class {
|
|
|
6696
7116
|
]
|
|
6697
7117
|
});
|
|
6698
7118
|
this._opening = true;
|
|
6699
|
-
|
|
7119
|
+
log22("opening...", {
|
|
6700
7120
|
lockKey: this._resourceLock?.lockKey
|
|
6701
7121
|
}, {
|
|
6702
|
-
F:
|
|
6703
|
-
L:
|
|
7122
|
+
F: __dxlog_file25,
|
|
7123
|
+
L: 236,
|
|
6704
7124
|
S: this,
|
|
6705
7125
|
C: (f, a) => f(...a)
|
|
6706
7126
|
});
|
|
@@ -6711,16 +7131,18 @@ var ClientServicesHost = class {
|
|
|
6711
7131
|
await this._level.open();
|
|
6712
7132
|
await this._loggingService.open();
|
|
6713
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
|
+
};
|
|
6714
7138
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6715
7139
|
this._serviceRegistry.setServices({
|
|
6716
7140
|
SystemService: this._systemService,
|
|
6717
7141
|
IdentityService: identityService,
|
|
7142
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6718
7143
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6719
7144
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
6720
|
-
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager,
|
|
6721
|
-
await this._serviceContext.initialized.wait();
|
|
6722
|
-
return this._serviceContext.dataSpaceManager;
|
|
6723
|
-
}),
|
|
7145
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6724
7146
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6725
7147
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6726
7148
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6750,19 +7172,19 @@ var ClientServicesHost = class {
|
|
|
6750
7172
|
this._open = true;
|
|
6751
7173
|
this._statusUpdate.emit();
|
|
6752
7174
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6753
|
-
|
|
7175
|
+
log22("opened", {
|
|
6754
7176
|
deviceKey
|
|
6755
7177
|
}, {
|
|
6756
|
-
F:
|
|
6757
|
-
L:
|
|
7178
|
+
F: __dxlog_file25,
|
|
7179
|
+
L: 322,
|
|
6758
7180
|
S: this,
|
|
6759
7181
|
C: (f, a) => f(...a)
|
|
6760
7182
|
});
|
|
6761
|
-
|
|
7183
|
+
log22.trace("dxos.client-services.host.open", trace10.end({
|
|
6762
7184
|
id: traceId
|
|
6763
7185
|
}), {
|
|
6764
|
-
F:
|
|
6765
|
-
L:
|
|
7186
|
+
F: __dxlog_file25,
|
|
7187
|
+
L: 323,
|
|
6766
7188
|
S: this,
|
|
6767
7189
|
C: (f, a) => f(...a)
|
|
6768
7190
|
});
|
|
@@ -6772,11 +7194,11 @@ var ClientServicesHost = class {
|
|
|
6772
7194
|
return;
|
|
6773
7195
|
}
|
|
6774
7196
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6775
|
-
|
|
7197
|
+
log22("closing...", {
|
|
6776
7198
|
deviceKey
|
|
6777
7199
|
}, {
|
|
6778
|
-
F:
|
|
6779
|
-
L:
|
|
7200
|
+
F: __dxlog_file25,
|
|
7201
|
+
L: 334,
|
|
6780
7202
|
S: this,
|
|
6781
7203
|
C: (f, a) => f(...a)
|
|
6782
7204
|
});
|
|
@@ -6790,44 +7212,44 @@ var ClientServicesHost = class {
|
|
|
6790
7212
|
await this._level?.close();
|
|
6791
7213
|
this._open = false;
|
|
6792
7214
|
this._statusUpdate.emit();
|
|
6793
|
-
|
|
7215
|
+
log22("closed", {
|
|
6794
7216
|
deviceKey
|
|
6795
7217
|
}, {
|
|
6796
|
-
F:
|
|
6797
|
-
L:
|
|
7218
|
+
F: __dxlog_file25,
|
|
7219
|
+
L: 343,
|
|
6798
7220
|
S: this,
|
|
6799
7221
|
C: (f, a) => f(...a)
|
|
6800
7222
|
});
|
|
6801
7223
|
}
|
|
6802
7224
|
async reset() {
|
|
6803
|
-
const traceId =
|
|
6804
|
-
|
|
7225
|
+
const traceId = PublicKey17.random().toHex();
|
|
7226
|
+
log22.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
6805
7227
|
id: traceId
|
|
6806
7228
|
}), {
|
|
6807
|
-
F:
|
|
6808
|
-
L:
|
|
7229
|
+
F: __dxlog_file25,
|
|
7230
|
+
L: 348,
|
|
6809
7231
|
S: this,
|
|
6810
7232
|
C: (f, a) => f(...a)
|
|
6811
7233
|
});
|
|
6812
|
-
|
|
6813
|
-
F:
|
|
6814
|
-
L:
|
|
7234
|
+
log22.info("resetting...", void 0, {
|
|
7235
|
+
F: __dxlog_file25,
|
|
7236
|
+
L: 350,
|
|
6815
7237
|
S: this,
|
|
6816
7238
|
C: (f, a) => f(...a)
|
|
6817
7239
|
});
|
|
6818
7240
|
await this._serviceContext?.close();
|
|
6819
7241
|
await this._storage.reset();
|
|
6820
|
-
|
|
6821
|
-
F:
|
|
6822
|
-
L:
|
|
7242
|
+
log22.info("reset", void 0, {
|
|
7243
|
+
F: __dxlog_file25,
|
|
7244
|
+
L: 353,
|
|
6823
7245
|
S: this,
|
|
6824
7246
|
C: (f, a) => f(...a)
|
|
6825
7247
|
});
|
|
6826
|
-
|
|
7248
|
+
log22.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
6827
7249
|
id: traceId
|
|
6828
7250
|
}), {
|
|
6829
|
-
F:
|
|
6830
|
-
L:
|
|
7251
|
+
F: __dxlog_file25,
|
|
7252
|
+
L: 354,
|
|
6831
7253
|
S: this,
|
|
6832
7254
|
C: (f, a) => f(...a)
|
|
6833
7255
|
});
|
|
@@ -6893,8 +7315,12 @@ export {
|
|
|
6893
7315
|
isLocked,
|
|
6894
7316
|
createStorageObjects,
|
|
6895
7317
|
createLevel,
|
|
7318
|
+
encodeProfileArchive,
|
|
7319
|
+
decodeProfileArchive,
|
|
7320
|
+
exportProfileData,
|
|
7321
|
+
importProfileData,
|
|
6896
7322
|
ClientServicesHost,
|
|
6897
7323
|
ClientServicesProviderResource,
|
|
6898
7324
|
DiagnosticsCollector
|
|
6899
7325
|
};
|
|
6900
|
-
//# sourceMappingURL=chunk-
|
|
7326
|
+
//# sourceMappingURL=chunk-HVAGZ7TD.mjs.map
|