@dxos/client-services 0.5.9-main.e183eeb → 0.5.9-main.e9b9049
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-S5DPO2DT.mjs → chunk-3DXQACFA.mjs} +847 -463
- package/dist/lib/browser/chunk-3DXQACFA.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-F2EIFQZH.cjs → chunk-4LN54Y73.cjs} +861 -477
- package/dist/lib/node/chunk-4LN54Y73.cjs.map +7 -0
- package/dist/lib/node/index.cjs +53 -42
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +17 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +14 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/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/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/invitations/invitations-handler.ts +13 -5
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -32
- package/src/packlets/services/service-host.ts +12 -4
- package/src/packlets/spaces/data-space-manager.ts +55 -2
- package/src/packlets/spaces/data-space.ts +5 -5
- package/src/packlets/spaces/epoch-migrations.ts +12 -7
- package/src/packlets/spaces/spaces-service.ts +50 -2
- package/src/packlets/storage/index.ts +1 -0
- package/src/packlets/storage/profile-archive.ts +97 -0
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-S5DPO2DT.mjs.map +0 -7
- package/dist/lib/node/chunk-F2EIFQZH.cjs.map +0 -7
|
@@ -85,6 +85,7 @@ var subscribeToFeedBlocks = ({ feedStore }, { feedKey, maxBlocks = 10 }) => {
|
|
|
85
85
|
import { Stream as Stream2 } from "@dxos/codec-protobuf";
|
|
86
86
|
import { Context } from "@dxos/context";
|
|
87
87
|
import { PublicKey as PublicKey2 } from "@dxos/keys";
|
|
88
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devtools/network.ts";
|
|
88
89
|
var subscribeToNetworkStatus = ({ signalManager }) => new Stream2(({ next, close }) => {
|
|
89
90
|
const update = () => {
|
|
90
91
|
try {
|
|
@@ -100,7 +101,10 @@ var subscribeToNetworkStatus = ({ signalManager }) => new Stream2(({ next, close
|
|
|
100
101
|
update();
|
|
101
102
|
});
|
|
102
103
|
var subscribeToSignal = ({ signalManager }) => new Stream2(({ next }) => {
|
|
103
|
-
const ctx = new Context(
|
|
104
|
+
const ctx = new Context(void 0, {
|
|
105
|
+
F: __dxlog_file,
|
|
106
|
+
L: 36
|
|
107
|
+
});
|
|
104
108
|
signalManager.onMessage.on(ctx, (message) => {
|
|
105
109
|
next({
|
|
106
110
|
message: {
|
|
@@ -355,7 +359,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
355
359
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
356
360
|
|
|
357
361
|
// packages/sdk/client-services/src/version.ts
|
|
358
|
-
var DXOS_VERSION = "0.5.9-main.
|
|
362
|
+
var DXOS_VERSION = "0.5.9-main.e9b9049";
|
|
359
363
|
|
|
360
364
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
361
365
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -388,7 +392,7 @@ var getPlatform = () => {
|
|
|
388
392
|
};
|
|
389
393
|
|
|
390
394
|
// packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts
|
|
391
|
-
var
|
|
395
|
+
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/diagnostics.ts";
|
|
392
396
|
var DEFAULT_TIMEOUT = 1e3;
|
|
393
397
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
394
398
|
const diagnostics = {
|
|
@@ -405,7 +409,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
405
409
|
await Promise.all([
|
|
406
410
|
(async () => {
|
|
407
411
|
invariant(clientServices.LoggingService, "SystemService is not available.", {
|
|
408
|
-
F:
|
|
412
|
+
F: __dxlog_file2,
|
|
409
413
|
L: 110,
|
|
410
414
|
S: void 0,
|
|
411
415
|
A: [
|
|
@@ -510,7 +514,7 @@ var getStorageDiagnostics = async () => {
|
|
|
510
514
|
// packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts
|
|
511
515
|
import { Trigger } from "@dxos/async";
|
|
512
516
|
import { log } from "@dxos/log";
|
|
513
|
-
var
|
|
517
|
+
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/diagnostics/browser-diagnostics-broadcast.ts";
|
|
514
518
|
var CHANNEL_NAME = "dxos.diagnostics.broadcast";
|
|
515
519
|
var MessageType;
|
|
516
520
|
(function(MessageType2) {
|
|
@@ -579,7 +583,7 @@ var createCollectDiagnosticsBroadcastHandler = (systemService) => {
|
|
|
579
583
|
}
|
|
580
584
|
} catch (error) {
|
|
581
585
|
log.catch(error, void 0, {
|
|
582
|
-
F:
|
|
586
|
+
F: __dxlog_file3,
|
|
583
587
|
L: 77,
|
|
584
588
|
S: void 0,
|
|
585
589
|
C: (f, a) => f(...a)
|
|
@@ -687,7 +691,7 @@ import { Context as Context2 } from "@dxos/context";
|
|
|
687
691
|
import { verifyCredential } from "@dxos/credentials";
|
|
688
692
|
import { log as log2 } from "@dxos/log";
|
|
689
693
|
import { schema } from "@dxos/protocols";
|
|
690
|
-
var
|
|
694
|
+
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/authenticator.ts";
|
|
691
695
|
var Credential = schema.getCodecForType("dxos.halo.credentials.Credential");
|
|
692
696
|
var createAuthProvider = (signer) => async (nonce) => {
|
|
693
697
|
const credential = await signer.createCredential({
|
|
@@ -702,7 +706,10 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
702
706
|
var TrustedKeySetAuthVerifier = class {
|
|
703
707
|
constructor(_params) {
|
|
704
708
|
this._params = _params;
|
|
705
|
-
this._ctx = new Context2(
|
|
709
|
+
this._ctx = new Context2(void 0, {
|
|
710
|
+
F: __dxlog_file4,
|
|
711
|
+
L: 45
|
|
712
|
+
});
|
|
706
713
|
}
|
|
707
714
|
async close() {
|
|
708
715
|
await this._ctx.dispose();
|
|
@@ -713,7 +720,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
713
720
|
log2("authenticating...", {
|
|
714
721
|
credential
|
|
715
722
|
}, {
|
|
716
|
-
F:
|
|
723
|
+
F: __dxlog_file4,
|
|
717
724
|
L: 56,
|
|
718
725
|
S: this,
|
|
719
726
|
C: (f, a) => f(...a)
|
|
@@ -723,7 +730,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
723
730
|
log2("Invalid credential", {
|
|
724
731
|
result
|
|
725
732
|
}, {
|
|
726
|
-
F:
|
|
733
|
+
F: __dxlog_file4,
|
|
727
734
|
L: 60,
|
|
728
735
|
S: this,
|
|
729
736
|
C: (f, a) => f(...a)
|
|
@@ -735,7 +742,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
735
742
|
nonce,
|
|
736
743
|
credential
|
|
737
744
|
}, {
|
|
738
|
-
F:
|
|
745
|
+
F: __dxlog_file4,
|
|
739
746
|
L: 65,
|
|
740
747
|
S: this,
|
|
741
748
|
C: (f, a) => f(...a)
|
|
@@ -746,7 +753,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
746
753
|
log2("key is not currently in trusted set, waiting...", {
|
|
747
754
|
key: credential.issuer
|
|
748
755
|
}, {
|
|
749
|
-
F:
|
|
756
|
+
F: __dxlog_file4,
|
|
750
757
|
L: 70,
|
|
751
758
|
S: this,
|
|
752
759
|
C: (f, a) => f(...a)
|
|
@@ -762,7 +769,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
762
769
|
log2("auth success", {
|
|
763
770
|
key: credential.issuer
|
|
764
771
|
}, {
|
|
765
|
-
F:
|
|
772
|
+
F: __dxlog_file4,
|
|
766
773
|
L: 81,
|
|
767
774
|
S: this,
|
|
768
775
|
C: (f, a) => f(...a)
|
|
@@ -772,7 +779,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
772
779
|
log2("key is not currently in trusted set, waiting...", {
|
|
773
780
|
key: credential.issuer
|
|
774
781
|
}, {
|
|
775
|
-
F:
|
|
782
|
+
F: __dxlog_file4,
|
|
776
783
|
L: 84,
|
|
777
784
|
S: this,
|
|
778
785
|
C: (f, a) => f(...a)
|
|
@@ -813,7 +820,7 @@ import { ComplexSet } from "@dxos/util";
|
|
|
813
820
|
import { getCredentialAssertion } from "@dxos/credentials";
|
|
814
821
|
import { SpaceId } from "@dxos/keys";
|
|
815
822
|
import { log as log3 } from "@dxos/log";
|
|
816
|
-
var
|
|
823
|
+
var __dxlog_file5 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/default-space-state-machine.ts";
|
|
817
824
|
var DefaultSpaceStateMachine = class {
|
|
818
825
|
constructor(_params) {
|
|
819
826
|
this._params = _params;
|
|
@@ -830,7 +837,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
830
837
|
expectedIdentity: this._params.identityKey,
|
|
831
838
|
credential
|
|
832
839
|
}, {
|
|
833
|
-
F:
|
|
840
|
+
F: __dxlog_file5,
|
|
834
841
|
L: 32,
|
|
835
842
|
S: this,
|
|
836
843
|
C: (f, a) => f(...a)
|
|
@@ -841,7 +848,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
841
848
|
log3.warn("Invalid default space id", {
|
|
842
849
|
id: assertion.spaceId
|
|
843
850
|
}, {
|
|
844
|
-
F:
|
|
851
|
+
F: __dxlog_file5,
|
|
845
852
|
L: 36,
|
|
846
853
|
S: this,
|
|
847
854
|
C: (f, a) => f(...a)
|
|
@@ -866,7 +873,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
866
873
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
867
874
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
868
875
|
}
|
|
869
|
-
var
|
|
876
|
+
var __dxlog_file6 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity.ts";
|
|
870
877
|
var Identity = class {
|
|
871
878
|
constructor({ space, signer, identityKey, deviceKey, presence }) {
|
|
872
879
|
this.stateUpdate = new Event();
|
|
@@ -878,7 +885,7 @@ var Identity = class {
|
|
|
878
885
|
log4.trace("dxos.halo.device", {
|
|
879
886
|
deviceKey
|
|
880
887
|
}, {
|
|
881
|
-
F:
|
|
888
|
+
F: __dxlog_file6,
|
|
882
889
|
L: 70,
|
|
883
890
|
S: this,
|
|
884
891
|
C: (f, a) => f(...a)
|
|
@@ -957,7 +964,7 @@ var Identity = class {
|
|
|
957
964
|
*/
|
|
958
965
|
getIdentityCredentialSigner() {
|
|
959
966
|
invariant2(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
960
|
-
F:
|
|
967
|
+
F: __dxlog_file6,
|
|
961
968
|
L: 159,
|
|
962
969
|
S: this,
|
|
963
970
|
A: [
|
|
@@ -1001,7 +1008,7 @@ var Identity = class {
|
|
|
1001
1008
|
controlFeedKey,
|
|
1002
1009
|
dataFeedKey
|
|
1003
1010
|
}, {
|
|
1004
|
-
F:
|
|
1011
|
+
F: __dxlog_file6,
|
|
1005
1012
|
L: 184,
|
|
1006
1013
|
S: this,
|
|
1007
1014
|
C: (f, a) => f(...a)
|
|
@@ -1078,7 +1085,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
1078
1085
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1079
1086
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1080
1087
|
}
|
|
1081
|
-
var
|
|
1088
|
+
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-manager.ts";
|
|
1082
1089
|
var DEVICE_PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1083
1090
|
var DEVICE_PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1084
1091
|
var IdentityManager = class {
|
|
@@ -1102,7 +1109,7 @@ var IdentityManager = class {
|
|
|
1102
1109
|
log5.trace("dxos.halo.identity-manager.open", trace3.begin({
|
|
1103
1110
|
id: traceId
|
|
1104
1111
|
}), {
|
|
1105
|
-
F:
|
|
1112
|
+
F: __dxlog_file7,
|
|
1106
1113
|
L: 104,
|
|
1107
1114
|
S: this,
|
|
1108
1115
|
C: (f, a) => f(...a)
|
|
@@ -1111,7 +1118,7 @@ var IdentityManager = class {
|
|
|
1111
1118
|
log5("identity record", {
|
|
1112
1119
|
identityRecord
|
|
1113
1120
|
}, {
|
|
1114
|
-
F:
|
|
1121
|
+
F: __dxlog_file7,
|
|
1115
1122
|
L: 107,
|
|
1116
1123
|
S: this,
|
|
1117
1124
|
C: (f, a) => f(...a)
|
|
@@ -1124,7 +1131,7 @@ var IdentityManager = class {
|
|
|
1124
1131
|
identityKey: identityRecord.identityKey,
|
|
1125
1132
|
displayName: this._identity.profileDocument?.displayName
|
|
1126
1133
|
}, {
|
|
1127
|
-
F:
|
|
1134
|
+
F: __dxlog_file7,
|
|
1128
1135
|
L: 112,
|
|
1129
1136
|
S: this,
|
|
1130
1137
|
C: (f, a) => f(...a)
|
|
@@ -1134,18 +1141,21 @@ var IdentityManager = class {
|
|
|
1134
1141
|
log5.trace("dxos.halo.identity-manager.open", trace3.end({
|
|
1135
1142
|
id: traceId
|
|
1136
1143
|
}), {
|
|
1137
|
-
F:
|
|
1144
|
+
F: __dxlog_file7,
|
|
1138
1145
|
L: 119,
|
|
1139
1146
|
S: this,
|
|
1140
1147
|
C: (f, a) => f(...a)
|
|
1141
1148
|
});
|
|
1142
1149
|
}
|
|
1143
1150
|
async close() {
|
|
1144
|
-
await this._identity?.close(new Context3(
|
|
1151
|
+
await this._identity?.close(new Context3(void 0, {
|
|
1152
|
+
F: __dxlog_file7,
|
|
1153
|
+
L: 123
|
|
1154
|
+
}));
|
|
1145
1155
|
}
|
|
1146
1156
|
async createIdentity({ displayName, deviceProfile } = {}) {
|
|
1147
1157
|
invariant3(!this._identity, "Identity already exists.", {
|
|
1148
|
-
F:
|
|
1158
|
+
F: __dxlog_file7,
|
|
1149
1159
|
L: 128,
|
|
1150
1160
|
S: this,
|
|
1151
1161
|
A: [
|
|
@@ -1154,7 +1164,7 @@ var IdentityManager = class {
|
|
|
1154
1164
|
]
|
|
1155
1165
|
});
|
|
1156
1166
|
log5("creating identity...", void 0, {
|
|
1157
|
-
F:
|
|
1167
|
+
F: __dxlog_file7,
|
|
1158
1168
|
L: 129,
|
|
1159
1169
|
S: this,
|
|
1160
1170
|
C: (f, a) => f(...a)
|
|
@@ -1171,11 +1181,14 @@ var IdentityManager = class {
|
|
|
1171
1181
|
}
|
|
1172
1182
|
};
|
|
1173
1183
|
const identity = await this._constructIdentity(identityRecord);
|
|
1174
|
-
await identity.open(new Context3(
|
|
1184
|
+
await identity.open(new Context3(void 0, {
|
|
1185
|
+
F: __dxlog_file7,
|
|
1186
|
+
L: 144
|
|
1187
|
+
}));
|
|
1175
1188
|
{
|
|
1176
1189
|
const generator = new CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
1177
1190
|
invariant3(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
1178
|
-
F:
|
|
1191
|
+
F: __dxlog_file7,
|
|
1179
1192
|
L: 148,
|
|
1180
1193
|
S: this,
|
|
1181
1194
|
A: [
|
|
@@ -1184,7 +1197,7 @@ var IdentityManager = class {
|
|
|
1184
1197
|
]
|
|
1185
1198
|
});
|
|
1186
1199
|
invariant3(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
1187
|
-
F:
|
|
1200
|
+
F: __dxlog_file7,
|
|
1188
1201
|
L: 149,
|
|
1189
1202
|
S: this,
|
|
1190
1203
|
A: [
|
|
@@ -1223,7 +1236,7 @@ var IdentityManager = class {
|
|
|
1223
1236
|
identityKey: identityRecord.identityKey,
|
|
1224
1237
|
displayName: this._identity.profileDocument?.displayName
|
|
1225
1238
|
}, {
|
|
1226
|
-
F:
|
|
1239
|
+
F: __dxlog_file7,
|
|
1227
1240
|
L: 191,
|
|
1228
1241
|
S: this,
|
|
1229
1242
|
C: (f, a) => f(...a)
|
|
@@ -1234,7 +1247,7 @@ var IdentityManager = class {
|
|
|
1234
1247
|
deviceKey: identity.deviceKey,
|
|
1235
1248
|
profile: identity.profileDocument
|
|
1236
1249
|
}, {
|
|
1237
|
-
F:
|
|
1250
|
+
F: __dxlog_file7,
|
|
1238
1251
|
L: 197,
|
|
1239
1252
|
S: this,
|
|
1240
1253
|
C: (f, a) => f(...a)
|
|
@@ -1271,13 +1284,13 @@ var IdentityManager = class {
|
|
|
1271
1284
|
log5("accepting identity", {
|
|
1272
1285
|
params
|
|
1273
1286
|
}, {
|
|
1274
|
-
F:
|
|
1287
|
+
F: __dxlog_file7,
|
|
1275
1288
|
L: 235,
|
|
1276
1289
|
S: this,
|
|
1277
1290
|
C: (f, a) => f(...a)
|
|
1278
1291
|
});
|
|
1279
1292
|
invariant3(!this._identity, "Identity already exists.", {
|
|
1280
|
-
F:
|
|
1293
|
+
F: __dxlog_file7,
|
|
1281
1294
|
L: 236,
|
|
1282
1295
|
S: this,
|
|
1283
1296
|
A: [
|
|
@@ -1297,7 +1310,10 @@ var IdentityManager = class {
|
|
|
1297
1310
|
}
|
|
1298
1311
|
};
|
|
1299
1312
|
const identity = await this._constructIdentity(identityRecord);
|
|
1300
|
-
await identity.open(new Context3(
|
|
1313
|
+
await identity.open(new Context3(void 0, {
|
|
1314
|
+
F: __dxlog_file7,
|
|
1315
|
+
L: 251
|
|
1316
|
+
}));
|
|
1301
1317
|
this._identity = identity;
|
|
1302
1318
|
await this._metadataStore.setIdentityRecord(identityRecord);
|
|
1303
1319
|
await this._identity.ready();
|
|
@@ -1305,7 +1321,7 @@ var IdentityManager = class {
|
|
|
1305
1321
|
identityKey: identityRecord.identityKey,
|
|
1306
1322
|
displayName: this._identity.profileDocument?.displayName
|
|
1307
1323
|
}, {
|
|
1308
|
-
F:
|
|
1324
|
+
F: __dxlog_file7,
|
|
1309
1325
|
L: 255,
|
|
1310
1326
|
S: this,
|
|
1311
1327
|
C: (f, a) => f(...a)
|
|
@@ -1319,7 +1335,7 @@ var IdentityManager = class {
|
|
|
1319
1335
|
identityKey: identity.identityKey,
|
|
1320
1336
|
deviceKey: identity.deviceKey
|
|
1321
1337
|
}, {
|
|
1322
|
-
F:
|
|
1338
|
+
F: __dxlog_file7,
|
|
1323
1339
|
L: 265,
|
|
1324
1340
|
S: this,
|
|
1325
1341
|
C: (f, a) => f(...a)
|
|
@@ -1331,7 +1347,7 @@ var IdentityManager = class {
|
|
|
1331
1347
|
*/
|
|
1332
1348
|
async updateProfile(profile) {
|
|
1333
1349
|
invariant3(this._identity, "Identity not initialized.", {
|
|
1334
|
-
F:
|
|
1350
|
+
F: __dxlog_file7,
|
|
1335
1351
|
L: 273,
|
|
1336
1352
|
S: this,
|
|
1337
1353
|
A: [
|
|
@@ -1362,7 +1378,7 @@ var IdentityManager = class {
|
|
|
1362
1378
|
}
|
|
1363
1379
|
async updateDeviceProfile(profile) {
|
|
1364
1380
|
invariant3(this._identity, "Identity not initialized.", {
|
|
1365
|
-
F:
|
|
1381
|
+
F: __dxlog_file7,
|
|
1366
1382
|
L: 290,
|
|
1367
1383
|
S: this,
|
|
1368
1384
|
A: [
|
|
@@ -1398,7 +1414,7 @@ var IdentityManager = class {
|
|
|
1398
1414
|
}
|
|
1399
1415
|
async _constructIdentity(identityRecord) {
|
|
1400
1416
|
invariant3(!this._identity, void 0, {
|
|
1401
|
-
F:
|
|
1417
|
+
F: __dxlog_file7,
|
|
1402
1418
|
L: 316,
|
|
1403
1419
|
S: this,
|
|
1404
1420
|
A: [
|
|
@@ -1409,7 +1425,7 @@ var IdentityManager = class {
|
|
|
1409
1425
|
log5("constructing identity", {
|
|
1410
1426
|
identityRecord
|
|
1411
1427
|
}, {
|
|
1412
|
-
F:
|
|
1428
|
+
F: __dxlog_file7,
|
|
1413
1429
|
L: 317,
|
|
1414
1430
|
S: this,
|
|
1415
1431
|
C: (f, a) => f(...a)
|
|
@@ -1424,7 +1440,7 @@ var IdentityManager = class {
|
|
|
1424
1440
|
gossip
|
|
1425
1441
|
});
|
|
1426
1442
|
invariant3(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1427
|
-
F:
|
|
1443
|
+
F: __dxlog_file7,
|
|
1428
1444
|
L: 330,
|
|
1429
1445
|
S: this,
|
|
1430
1446
|
A: [
|
|
@@ -1436,7 +1452,7 @@ var IdentityManager = class {
|
|
|
1436
1452
|
writable: true
|
|
1437
1453
|
});
|
|
1438
1454
|
invariant3(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1439
|
-
F:
|
|
1455
|
+
F: __dxlog_file7,
|
|
1440
1456
|
L: 334,
|
|
1441
1457
|
S: this,
|
|
1442
1458
|
A: [
|
|
@@ -1470,7 +1486,7 @@ var IdentityManager = class {
|
|
|
1470
1486
|
log5("done", {
|
|
1471
1487
|
identityKey: identityRecord.identityKey
|
|
1472
1488
|
}, {
|
|
1473
|
-
F:
|
|
1489
|
+
F: __dxlog_file7,
|
|
1474
1490
|
L: 360,
|
|
1475
1491
|
S: this,
|
|
1476
1492
|
C: (f, a) => f(...a)
|
|
@@ -1495,7 +1511,7 @@ var IdentityManager = class {
|
|
|
1495
1511
|
},
|
|
1496
1512
|
onAuthFailure: () => {
|
|
1497
1513
|
log5.warn("auth failure", void 0, {
|
|
1498
|
-
F:
|
|
1514
|
+
F: __dxlog_file7,
|
|
1499
1515
|
L: 385,
|
|
1500
1516
|
S: this,
|
|
1501
1517
|
C: (f, a) => f(...a)
|
|
@@ -1528,7 +1544,7 @@ import { invariant as invariant4 } from "@dxos/invariant";
|
|
|
1528
1544
|
import { log as log6 } from "@dxos/log";
|
|
1529
1545
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
1530
1546
|
import { safeAwaitAll } from "@dxos/util";
|
|
1531
|
-
var
|
|
1547
|
+
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
1532
1548
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
1533
1549
|
var IdentityServiceImpl = class extends Resource {
|
|
1534
1550
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
@@ -1558,7 +1574,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1558
1574
|
const space = await dataSpaceManager.createDefaultSpace();
|
|
1559
1575
|
const identity = this._identityManager.identity;
|
|
1560
1576
|
invariant4(identity, void 0, {
|
|
1561
|
-
F:
|
|
1577
|
+
F: __dxlog_file8,
|
|
1562
1578
|
L: 59,
|
|
1563
1579
|
S: this,
|
|
1564
1580
|
A: [
|
|
@@ -1592,7 +1608,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1592
1608
|
}
|
|
1593
1609
|
async updateProfile(profile) {
|
|
1594
1610
|
invariant4(this._identityManager.identity, "Identity not initialized.", {
|
|
1595
|
-
F:
|
|
1611
|
+
F: __dxlog_file8,
|
|
1596
1612
|
L: 89,
|
|
1597
1613
|
S: this,
|
|
1598
1614
|
A: [
|
|
@@ -1606,7 +1622,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1606
1622
|
}
|
|
1607
1623
|
async signPresentation({ presentation, nonce }) {
|
|
1608
1624
|
invariant4(this._identityManager.identity, "Identity not initialized.", {
|
|
1609
|
-
F:
|
|
1625
|
+
F: __dxlog_file8,
|
|
1610
1626
|
L: 96,
|
|
1611
1627
|
S: this,
|
|
1612
1628
|
A: [
|
|
@@ -1641,7 +1657,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1641
1657
|
log6.warn("Multiple default spaces found. Using the first one.", {
|
|
1642
1658
|
duplicate: space.id
|
|
1643
1659
|
}, {
|
|
1644
|
-
F:
|
|
1660
|
+
F: __dxlog_file8,
|
|
1645
1661
|
L: 127,
|
|
1646
1662
|
S: this,
|
|
1647
1663
|
C: (f, a) => f(...a)
|
|
@@ -1669,7 +1685,7 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1669
1685
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1670
1686
|
import { AlreadyJoinedError } from "@dxos/protocols";
|
|
1671
1687
|
import { Invitation } from "@dxos/protocols/proto/dxos/client/services";
|
|
1672
|
-
var
|
|
1688
|
+
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/device-invitation-protocol.ts";
|
|
1673
1689
|
var DeviceInvitationProtocol = class {
|
|
1674
1690
|
constructor(_keyring, _getIdentity, _acceptIdentity) {
|
|
1675
1691
|
this._keyring = _keyring;
|
|
@@ -1695,7 +1711,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1695
1711
|
}
|
|
1696
1712
|
async admit(_, request) {
|
|
1697
1713
|
invariant5(request.device, void 0, {
|
|
1698
|
-
F:
|
|
1714
|
+
F: __dxlog_file9,
|
|
1699
1715
|
L: 50,
|
|
1700
1716
|
S: this,
|
|
1701
1717
|
A: [
|
|
@@ -1741,7 +1757,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1741
1757
|
}
|
|
1742
1758
|
async accept(response, request) {
|
|
1743
1759
|
invariant5(response.device, void 0, {
|
|
1744
|
-
F:
|
|
1760
|
+
F: __dxlog_file9,
|
|
1745
1761
|
L: 95,
|
|
1746
1762
|
S: this,
|
|
1747
1763
|
A: [
|
|
@@ -1751,7 +1767,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1751
1767
|
});
|
|
1752
1768
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1753
1769
|
invariant5(request.device, void 0, {
|
|
1754
|
-
F:
|
|
1770
|
+
F: __dxlog_file9,
|
|
1755
1771
|
L: 98,
|
|
1756
1772
|
S: this,
|
|
1757
1773
|
A: [
|
|
@@ -1820,7 +1836,7 @@ var tryAcquireBeforeContextDisposed = async (ctx, mutex) => {
|
|
|
1820
1836
|
};
|
|
1821
1837
|
|
|
1822
1838
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
1823
|
-
var
|
|
1839
|
+
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts";
|
|
1824
1840
|
var OPTIONS_TIMEOUT = 1e4;
|
|
1825
1841
|
var InvitationGuestExtension = class extends RpcExtension {
|
|
1826
1842
|
constructor(_invitationFlowMutex, _callbacks) {
|
|
@@ -1834,7 +1850,10 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1834
1850
|
});
|
|
1835
1851
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1836
1852
|
this._callbacks = _callbacks;
|
|
1837
|
-
this._ctx = new Context4(
|
|
1853
|
+
this._ctx = new Context4(void 0, {
|
|
1854
|
+
F: __dxlog_file10,
|
|
1855
|
+
L: 33
|
|
1856
|
+
});
|
|
1838
1857
|
this._remoteOptionsTrigger = new Trigger4();
|
|
1839
1858
|
this._invitationFlowLock = null;
|
|
1840
1859
|
}
|
|
@@ -1846,7 +1865,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1846
1865
|
InvitationHostService: {
|
|
1847
1866
|
options: async (options) => {
|
|
1848
1867
|
invariant6(!this._remoteOptions, "Remote options already set.", {
|
|
1849
|
-
F:
|
|
1868
|
+
F: __dxlog_file10,
|
|
1850
1869
|
L: 63,
|
|
1851
1870
|
S: this,
|
|
1852
1871
|
A: [
|
|
@@ -1873,14 +1892,14 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1873
1892
|
await super.onOpen(context);
|
|
1874
1893
|
try {
|
|
1875
1894
|
log7("guest acquire lock", void 0, {
|
|
1876
|
-
F:
|
|
1895
|
+
F: __dxlog_file10,
|
|
1877
1896
|
L: 84,
|
|
1878
1897
|
S: this,
|
|
1879
1898
|
C: (f, a) => f(...a)
|
|
1880
1899
|
});
|
|
1881
1900
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
1882
1901
|
log7("guest lock acquired", void 0, {
|
|
1883
|
-
F:
|
|
1902
|
+
F: __dxlog_file10,
|
|
1884
1903
|
L: 86,
|
|
1885
1904
|
S: this,
|
|
1886
1905
|
C: (f, a) => f(...a)
|
|
@@ -1889,7 +1908,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1889
1908
|
role: Options.Role.GUEST
|
|
1890
1909
|
}));
|
|
1891
1910
|
log7("options sent", void 0, {
|
|
1892
|
-
F:
|
|
1911
|
+
F: __dxlog_file10,
|
|
1893
1912
|
L: 88,
|
|
1894
1913
|
S: this,
|
|
1895
1914
|
C: (f, a) => f(...a)
|
|
@@ -1898,7 +1917,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1898
1917
|
timeout: OPTIONS_TIMEOUT
|
|
1899
1918
|
}));
|
|
1900
1919
|
log7("options received", void 0, {
|
|
1901
|
-
F:
|
|
1920
|
+
F: __dxlog_file10,
|
|
1902
1921
|
L: 90,
|
|
1903
1922
|
S: this,
|
|
1904
1923
|
C: (f, a) => f(...a)
|
|
@@ -1932,7 +1951,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1932
1951
|
this._invitationFlowLock.release();
|
|
1933
1952
|
this._invitationFlowLock = null;
|
|
1934
1953
|
log7("invitation flow lock released", void 0, {
|
|
1935
|
-
F:
|
|
1954
|
+
F: __dxlog_file10,
|
|
1936
1955
|
L: 123,
|
|
1937
1956
|
S: this,
|
|
1938
1957
|
C: (f, a) => f(...a)
|
|
@@ -1952,7 +1971,7 @@ import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleEr
|
|
|
1952
1971
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1953
1972
|
import { AuthenticationResponse, Options as Options2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1954
1973
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1955
|
-
var
|
|
1974
|
+
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
1956
1975
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
1957
1976
|
var MAX_OTP_ATTEMPTS = 3;
|
|
1958
1977
|
var InvitationHostExtension = class extends RpcExtension2 {
|
|
@@ -1967,7 +1986,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1967
1986
|
});
|
|
1968
1987
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
1969
1988
|
this._callbacks = _callbacks;
|
|
1970
|
-
this._ctx = new Context5(
|
|
1989
|
+
this._ctx = new Context5(void 0, {
|
|
1990
|
+
F: __dxlog_file11,
|
|
1991
|
+
L: 52
|
|
1992
|
+
});
|
|
1971
1993
|
this._remoteOptionsTrigger = new Trigger5();
|
|
1972
1994
|
this._challenge = void 0;
|
|
1973
1995
|
this.guestProfile = void 0;
|
|
@@ -1986,7 +2008,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
1986
2008
|
InvitationHostService: {
|
|
1987
2009
|
options: async (options) => {
|
|
1988
2010
|
invariant7(!this._remoteOptions, "Remote options already set.", {
|
|
1989
|
-
F:
|
|
2011
|
+
F: __dxlog_file11,
|
|
1990
2012
|
L: 101,
|
|
1991
2013
|
S: this,
|
|
1992
2014
|
A: [
|
|
@@ -2003,7 +2025,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2003
2025
|
log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.begin({
|
|
2004
2026
|
id: traceId
|
|
2005
2027
|
}), {
|
|
2006
|
-
F:
|
|
2028
|
+
F: __dxlog_file11,
|
|
2007
2029
|
L: 110,
|
|
2008
2030
|
S: this,
|
|
2009
2031
|
C: (f, a) => f(...a)
|
|
@@ -2015,7 +2037,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2015
2037
|
expected: invitation.invitationId,
|
|
2016
2038
|
actual: invitationId
|
|
2017
2039
|
}, {
|
|
2018
|
-
F:
|
|
2040
|
+
F: __dxlog_file11,
|
|
2019
2041
|
L: 116,
|
|
2020
2042
|
S: this,
|
|
2021
2043
|
C: (f, a) => f(...a)
|
|
@@ -2029,7 +2051,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2029
2051
|
log8("guest introduced themselves", {
|
|
2030
2052
|
guestProfile: profile
|
|
2031
2053
|
}, {
|
|
2032
|
-
F:
|
|
2054
|
+
F: __dxlog_file11,
|
|
2033
2055
|
L: 125,
|
|
2034
2056
|
S: this,
|
|
2035
2057
|
C: (f, a) => f(...a)
|
|
@@ -2040,7 +2062,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2040
2062
|
log8.trace("dxos.sdk.invitation-handler.host.introduce", trace4.end({
|
|
2041
2063
|
id: traceId
|
|
2042
2064
|
}), {
|
|
2043
|
-
F:
|
|
2065
|
+
F: __dxlog_file11,
|
|
2044
2066
|
L: 132,
|
|
2045
2067
|
S: this,
|
|
2046
2068
|
C: (f, a) => f(...a)
|
|
@@ -2055,7 +2077,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2055
2077
|
log8.trace("dxos.sdk.invitation-handler.host.authenticate", trace4.begin({
|
|
2056
2078
|
id: traceId
|
|
2057
2079
|
}), {
|
|
2058
|
-
F:
|
|
2080
|
+
F: __dxlog_file11,
|
|
2059
2081
|
L: 141,
|
|
2060
2082
|
S: this,
|
|
2061
2083
|
C: (f, a) => f(...a)
|
|
@@ -2064,7 +2086,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2064
2086
|
log8("received authentication request", {
|
|
2065
2087
|
authCode: code
|
|
2066
2088
|
}, {
|
|
2067
|
-
F:
|
|
2089
|
+
F: __dxlog_file11,
|
|
2068
2090
|
L: 144,
|
|
2069
2091
|
S: this,
|
|
2070
2092
|
C: (f, a) => f(...a)
|
|
@@ -2078,7 +2100,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2078
2100
|
switch (invitation.authMethod) {
|
|
2079
2101
|
case Invitation3.AuthMethod.NONE: {
|
|
2080
2102
|
log8("authentication not required", void 0, {
|
|
2081
|
-
F:
|
|
2103
|
+
F: __dxlog_file11,
|
|
2082
2104
|
L: 152,
|
|
2083
2105
|
S: this,
|
|
2084
2106
|
C: (f, a) => f(...a)
|
|
@@ -2116,7 +2138,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2116
2138
|
log8.error("invalid authentication method", {
|
|
2117
2139
|
authMethod: invitation.authMethod
|
|
2118
2140
|
}, {
|
|
2119
|
-
F:
|
|
2141
|
+
F: __dxlog_file11,
|
|
2120
2142
|
L: 190,
|
|
2121
2143
|
S: this,
|
|
2122
2144
|
C: (f, a) => f(...a)
|
|
@@ -2141,7 +2163,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2141
2163
|
status
|
|
2142
2164
|
}
|
|
2143
2165
|
}), {
|
|
2144
|
-
F:
|
|
2166
|
+
F: __dxlog_file11,
|
|
2145
2167
|
L: 202,
|
|
2146
2168
|
S: this,
|
|
2147
2169
|
C: (f, a) => f(...a)
|
|
@@ -2155,7 +2177,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2155
2177
|
log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.begin({
|
|
2156
2178
|
id: traceId
|
|
2157
2179
|
}), {
|
|
2158
|
-
F:
|
|
2180
|
+
F: __dxlog_file11,
|
|
2159
2181
|
L: 208,
|
|
2160
2182
|
S: this,
|
|
2161
2183
|
C: (f, a) => f(...a)
|
|
@@ -2172,7 +2194,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2172
2194
|
log8.trace("dxos.sdk.invitation-handler.host.admit", trace4.end({
|
|
2173
2195
|
id: traceId
|
|
2174
2196
|
}), {
|
|
2175
|
-
F:
|
|
2197
|
+
F: __dxlog_file11,
|
|
2176
2198
|
L: 222,
|
|
2177
2199
|
S: this,
|
|
2178
2200
|
C: (f, a) => f(...a)
|
|
@@ -2190,14 +2212,14 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2190
2212
|
await super.onOpen(context);
|
|
2191
2213
|
try {
|
|
2192
2214
|
log8("host acquire lock", void 0, {
|
|
2193
|
-
F:
|
|
2215
|
+
F: __dxlog_file11,
|
|
2194
2216
|
L: 237,
|
|
2195
2217
|
S: this,
|
|
2196
2218
|
C: (f, a) => f(...a)
|
|
2197
2219
|
});
|
|
2198
2220
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
2199
2221
|
log8("host lock acquired", void 0, {
|
|
2200
|
-
F:
|
|
2222
|
+
F: __dxlog_file11,
|
|
2201
2223
|
L: 239,
|
|
2202
2224
|
S: this,
|
|
2203
2225
|
C: (f, a) => f(...a)
|
|
@@ -2208,7 +2230,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2208
2230
|
role: Options2.Role.HOST
|
|
2209
2231
|
});
|
|
2210
2232
|
log8("options sent", void 0, {
|
|
2211
|
-
F:
|
|
2233
|
+
F: __dxlog_file11,
|
|
2212
2234
|
L: 243,
|
|
2213
2235
|
S: this,
|
|
2214
2236
|
C: (f, a) => f(...a)
|
|
@@ -2217,7 +2239,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2217
2239
|
timeout: OPTIONS_TIMEOUT2
|
|
2218
2240
|
}));
|
|
2219
2241
|
log8("options received", void 0, {
|
|
2220
|
-
F:
|
|
2242
|
+
F: __dxlog_file11,
|
|
2221
2243
|
L: 245,
|
|
2222
2244
|
S: this,
|
|
2223
2245
|
C: (f, a) => f(...a)
|
|
@@ -2271,7 +2293,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2271
2293
|
this._invitationFlowLock?.release();
|
|
2272
2294
|
this._invitationFlowLock = null;
|
|
2273
2295
|
log8("invitation flow lock released", void 0, {
|
|
2274
|
-
F:
|
|
2296
|
+
F: __dxlog_file11,
|
|
2275
2297
|
L: 300,
|
|
2276
2298
|
S: this,
|
|
2277
2299
|
C: (f, a) => f(...a)
|
|
@@ -2287,7 +2309,7 @@ import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
|
2287
2309
|
import { log as log9 } from "@dxos/log";
|
|
2288
2310
|
import { Options as Options3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
2289
2311
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2290
|
-
var
|
|
2312
|
+
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2291
2313
|
var InvitationTopology = class {
|
|
2292
2314
|
constructor(_role) {
|
|
2293
2315
|
this._role = _role;
|
|
@@ -2295,7 +2317,7 @@ var InvitationTopology = class {
|
|
|
2295
2317
|
}
|
|
2296
2318
|
init(controller) {
|
|
2297
2319
|
invariant8(!this._controller, "Already initialized.", {
|
|
2298
|
-
F:
|
|
2320
|
+
F: __dxlog_file12,
|
|
2299
2321
|
L: 42,
|
|
2300
2322
|
S: this,
|
|
2301
2323
|
A: [
|
|
@@ -2307,7 +2329,7 @@ var InvitationTopology = class {
|
|
|
2307
2329
|
}
|
|
2308
2330
|
update() {
|
|
2309
2331
|
invariant8(this._controller, "Not initialized.", {
|
|
2310
|
-
F:
|
|
2332
|
+
F: __dxlog_file12,
|
|
2311
2333
|
L: 47,
|
|
2312
2334
|
S: this,
|
|
2313
2335
|
A: [
|
|
@@ -2330,7 +2352,7 @@ var InvitationTopology = class {
|
|
|
2330
2352
|
ownPeerId,
|
|
2331
2353
|
remotePeerId: firstUnknownPeer
|
|
2332
2354
|
}, {
|
|
2333
|
-
F:
|
|
2355
|
+
F: __dxlog_file12,
|
|
2334
2356
|
L: 69,
|
|
2335
2357
|
S: this,
|
|
2336
2358
|
C: (f, a) => f(...a)
|
|
@@ -2341,7 +2363,7 @@ var InvitationTopology = class {
|
|
|
2341
2363
|
}
|
|
2342
2364
|
async onOffer(peer) {
|
|
2343
2365
|
invariant8(this._controller, "Not initialized.", {
|
|
2344
|
-
F:
|
|
2366
|
+
F: __dxlog_file12,
|
|
2345
2367
|
L: 76,
|
|
2346
2368
|
S: this,
|
|
2347
2369
|
A: [
|
|
@@ -2360,7 +2382,7 @@ var InvitationTopology = class {
|
|
|
2360
2382
|
};
|
|
2361
2383
|
|
|
2362
2384
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
2363
|
-
var
|
|
2385
|
+
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
2364
2386
|
var MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
2365
2387
|
var InvitationsHandler = class {
|
|
2366
2388
|
/**
|
|
@@ -2385,7 +2407,7 @@ var InvitationsHandler = class {
|
|
|
2385
2407
|
try {
|
|
2386
2408
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2387
2409
|
invariant9(deviceKey, void 0, {
|
|
2388
|
-
F:
|
|
2410
|
+
F: __dxlog_file13,
|
|
2389
2411
|
L: 90,
|
|
2390
2412
|
S: this,
|
|
2391
2413
|
A: [
|
|
@@ -2414,7 +2436,7 @@ var InvitationsHandler = class {
|
|
|
2414
2436
|
log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.begin({
|
|
2415
2437
|
id: traceId
|
|
2416
2438
|
}), {
|
|
2417
|
-
F:
|
|
2439
|
+
F: __dxlog_file13,
|
|
2418
2440
|
L: 115,
|
|
2419
2441
|
S: this,
|
|
2420
2442
|
C: (f, a) => f(...a)
|
|
@@ -2422,7 +2444,7 @@ var InvitationsHandler = class {
|
|
|
2422
2444
|
log10("connected", {
|
|
2423
2445
|
...protocol.toJSON()
|
|
2424
2446
|
}, {
|
|
2425
|
-
F:
|
|
2447
|
+
F: __dxlog_file13,
|
|
2426
2448
|
L: 116,
|
|
2427
2449
|
S: this,
|
|
2428
2450
|
C: (f, a) => f(...a)
|
|
@@ -2434,7 +2456,7 @@ var InvitationsHandler = class {
|
|
|
2434
2456
|
guest: deviceKey,
|
|
2435
2457
|
...protocol.toJSON()
|
|
2436
2458
|
}, {
|
|
2437
|
-
F:
|
|
2459
|
+
F: __dxlog_file13,
|
|
2438
2460
|
L: 118,
|
|
2439
2461
|
S: this,
|
|
2440
2462
|
C: (f, a) => f(...a)
|
|
@@ -2443,7 +2465,7 @@ var InvitationsHandler = class {
|
|
|
2443
2465
|
log10.trace("dxos.sdk.invitations-handler.host.onOpen", trace5.end({
|
|
2444
2466
|
id: traceId
|
|
2445
2467
|
}), {
|
|
2446
|
-
F:
|
|
2468
|
+
F: __dxlog_file13,
|
|
2447
2469
|
L: 120,
|
|
2448
2470
|
S: this,
|
|
2449
2471
|
C: (f, a) => f(...a)
|
|
@@ -2458,7 +2480,7 @@ var InvitationsHandler = class {
|
|
|
2458
2480
|
log10("timeout", {
|
|
2459
2481
|
...protocol.toJSON()
|
|
2460
2482
|
}, {
|
|
2461
|
-
F:
|
|
2483
|
+
F: __dxlog_file13,
|
|
2462
2484
|
L: 129,
|
|
2463
2485
|
S: this,
|
|
2464
2486
|
C: (f, a) => f(...a)
|
|
@@ -2467,7 +2489,7 @@ var InvitationsHandler = class {
|
|
|
2467
2489
|
} else {
|
|
2468
2490
|
if (guardedState.error(extension, err)) {
|
|
2469
2491
|
log10.error("failed", err, {
|
|
2470
|
-
F:
|
|
2492
|
+
F: __dxlog_file13,
|
|
2471
2493
|
L: 133,
|
|
2472
2494
|
S: this,
|
|
2473
2495
|
C: (f, a) => f(...a)
|
|
@@ -2478,7 +2500,7 @@ var InvitationsHandler = class {
|
|
|
2478
2500
|
id: traceId,
|
|
2479
2501
|
error: err
|
|
2480
2502
|
}), {
|
|
2481
|
-
F:
|
|
2503
|
+
F: __dxlog_file13,
|
|
2482
2504
|
L: 136,
|
|
2483
2505
|
S: this,
|
|
2484
2506
|
C: (f, a) => f(...a)
|
|
@@ -2492,7 +2514,7 @@ var InvitationsHandler = class {
|
|
|
2492
2514
|
log10("invalid role", {
|
|
2493
2515
|
...err.context
|
|
2494
2516
|
}, {
|
|
2495
|
-
F:
|
|
2517
|
+
F: __dxlog_file13,
|
|
2496
2518
|
L: 144,
|
|
2497
2519
|
S: this,
|
|
2498
2520
|
C: (f, a) => f(...a)
|
|
@@ -2504,7 +2526,7 @@ var InvitationsHandler = class {
|
|
|
2504
2526
|
log10("timeout", {
|
|
2505
2527
|
err
|
|
2506
2528
|
}, {
|
|
2507
|
-
F:
|
|
2529
|
+
F: __dxlog_file13,
|
|
2508
2530
|
L: 149,
|
|
2509
2531
|
S: this,
|
|
2510
2532
|
C: (f, a) => f(...a)
|
|
@@ -2513,7 +2535,7 @@ var InvitationsHandler = class {
|
|
|
2513
2535
|
} else {
|
|
2514
2536
|
if (guardedState.error(extension, err)) {
|
|
2515
2537
|
log10.error("failed", err, {
|
|
2516
|
-
F:
|
|
2538
|
+
F: __dxlog_file13,
|
|
2517
2539
|
L: 153,
|
|
2518
2540
|
S: this,
|
|
2519
2541
|
C: (f, a) => f(...a)
|
|
@@ -2527,7 +2549,7 @@ var InvitationsHandler = class {
|
|
|
2527
2549
|
if (invitation.lifetime && invitation.created) {
|
|
2528
2550
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2529
2551
|
log10.warn("invitation has already expired", void 0, {
|
|
2530
|
-
F:
|
|
2552
|
+
F: __dxlog_file13,
|
|
2531
2553
|
L: 164,
|
|
2532
2554
|
S: this,
|
|
2533
2555
|
C: (f, a) => f(...a)
|
|
@@ -2550,7 +2572,7 @@ var InvitationsHandler = class {
|
|
|
2550
2572
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
2551
2573
|
if (deviceProfile) {
|
|
2552
2574
|
invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2553
|
-
F:
|
|
2575
|
+
F: __dxlog_file13,
|
|
2554
2576
|
L: 197,
|
|
2555
2577
|
S: this,
|
|
2556
2578
|
A: [
|
|
@@ -2568,7 +2590,7 @@ var InvitationsHandler = class {
|
|
|
2568
2590
|
invitationType: Invitation4.Type.DELEGATED,
|
|
2569
2591
|
triedPeers: triedPeersIds.size
|
|
2570
2592
|
}, {
|
|
2571
|
-
F:
|
|
2593
|
+
F: __dxlog_file13,
|
|
2572
2594
|
L: 205,
|
|
2573
2595
|
S: this,
|
|
2574
2596
|
C: (f, a) => f(...a)
|
|
@@ -2595,7 +2617,7 @@ var InvitationsHandler = class {
|
|
|
2595
2617
|
admitted,
|
|
2596
2618
|
currentState: guardedState.current.state
|
|
2597
2619
|
}, {
|
|
2598
|
-
F:
|
|
2620
|
+
F: __dxlog_file13,
|
|
2599
2621
|
L: 233,
|
|
2600
2622
|
S: this,
|
|
2601
2623
|
C: (f, a) => f(...a)
|
|
@@ -2613,7 +2635,7 @@ var InvitationsHandler = class {
|
|
|
2613
2635
|
log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.begin({
|
|
2614
2636
|
id: traceId
|
|
2615
2637
|
}), {
|
|
2616
|
-
F:
|
|
2638
|
+
F: __dxlog_file13,
|
|
2617
2639
|
L: 245,
|
|
2618
2640
|
S: this,
|
|
2619
2641
|
C: (f, a) => f(...a)
|
|
@@ -2625,7 +2647,7 @@ var InvitationsHandler = class {
|
|
|
2625
2647
|
log10("connected", {
|
|
2626
2648
|
...protocol.toJSON()
|
|
2627
2649
|
}, {
|
|
2628
|
-
F:
|
|
2650
|
+
F: __dxlog_file13,
|
|
2629
2651
|
L: 256,
|
|
2630
2652
|
S: this,
|
|
2631
2653
|
C: (f, a) => f(...a)
|
|
@@ -2634,7 +2656,7 @@ var InvitationsHandler = class {
|
|
|
2634
2656
|
log10("introduce", {
|
|
2635
2657
|
...protocol.toJSON()
|
|
2636
2658
|
}, {
|
|
2637
|
-
F:
|
|
2659
|
+
F: __dxlog_file13,
|
|
2638
2660
|
L: 260,
|
|
2639
2661
|
S: this,
|
|
2640
2662
|
C: (f, a) => f(...a)
|
|
@@ -2647,7 +2669,7 @@ var InvitationsHandler = class {
|
|
|
2647
2669
|
...protocol.toJSON(),
|
|
2648
2670
|
response: introductionResponse
|
|
2649
2671
|
}, {
|
|
2650
|
-
F:
|
|
2672
|
+
F: __dxlog_file13,
|
|
2651
2673
|
L: 265,
|
|
2652
2674
|
S: this,
|
|
2653
2675
|
C: (f, a) => f(...a)
|
|
@@ -2668,7 +2690,7 @@ var InvitationsHandler = class {
|
|
|
2668
2690
|
log10("request admission", {
|
|
2669
2691
|
...protocol.toJSON()
|
|
2670
2692
|
}, {
|
|
2671
|
-
F:
|
|
2693
|
+
F: __dxlog_file13,
|
|
2672
2694
|
L: 291,
|
|
2673
2695
|
S: this,
|
|
2674
2696
|
C: (f, a) => f(...a)
|
|
@@ -2680,7 +2702,7 @@ var InvitationsHandler = class {
|
|
|
2680
2702
|
log10("admitted by host", {
|
|
2681
2703
|
...protocol.toJSON()
|
|
2682
2704
|
}, {
|
|
2683
|
-
F:
|
|
2705
|
+
F: __dxlog_file13,
|
|
2684
2706
|
L: 302,
|
|
2685
2707
|
S: this,
|
|
2686
2708
|
C: (f, a) => f(...a)
|
|
@@ -2693,7 +2715,7 @@ var InvitationsHandler = class {
|
|
|
2693
2715
|
log10.trace("dxos.sdk.invitations-handler.guest.onOpen", trace5.end({
|
|
2694
2716
|
id: traceId
|
|
2695
2717
|
}), {
|
|
2696
|
-
F:
|
|
2718
|
+
F: __dxlog_file13,
|
|
2697
2719
|
L: 308,
|
|
2698
2720
|
S: this,
|
|
2699
2721
|
C: (f, a) => f(...a)
|
|
@@ -2703,7 +2725,7 @@ var InvitationsHandler = class {
|
|
|
2703
2725
|
log10("timeout", {
|
|
2704
2726
|
...protocol.toJSON()
|
|
2705
2727
|
}, {
|
|
2706
|
-
F:
|
|
2728
|
+
F: __dxlog_file13,
|
|
2707
2729
|
L: 311,
|
|
2708
2730
|
S: this,
|
|
2709
2731
|
C: (f, a) => f(...a)
|
|
@@ -2711,7 +2733,7 @@ var InvitationsHandler = class {
|
|
|
2711
2733
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2712
2734
|
} else {
|
|
2713
2735
|
log10("auth failed", err, {
|
|
2714
|
-
F:
|
|
2736
|
+
F: __dxlog_file13,
|
|
2715
2737
|
L: 314,
|
|
2716
2738
|
S: this,
|
|
2717
2739
|
C: (f, a) => f(...a)
|
|
@@ -2723,7 +2745,7 @@ var InvitationsHandler = class {
|
|
|
2723
2745
|
id: traceId,
|
|
2724
2746
|
error: err
|
|
2725
2747
|
}), {
|
|
2726
|
-
F:
|
|
2748
|
+
F: __dxlog_file13,
|
|
2727
2749
|
L: 318,
|
|
2728
2750
|
S: this,
|
|
2729
2751
|
C: (f, a) => f(...a)
|
|
@@ -2739,7 +2761,7 @@ var InvitationsHandler = class {
|
|
|
2739
2761
|
log10("timeout", {
|
|
2740
2762
|
...protocol.toJSON()
|
|
2741
2763
|
}, {
|
|
2742
|
-
F:
|
|
2764
|
+
F: __dxlog_file13,
|
|
2743
2765
|
L: 327,
|
|
2744
2766
|
S: this,
|
|
2745
2767
|
C: (f, a) => f(...a)
|
|
@@ -2747,7 +2769,7 @@ var InvitationsHandler = class {
|
|
|
2747
2769
|
guardedState.set(extension, Invitation4.State.TIMEOUT);
|
|
2748
2770
|
} else {
|
|
2749
2771
|
log10("auth failed", err, {
|
|
2750
|
-
F:
|
|
2772
|
+
F: __dxlog_file13,
|
|
2751
2773
|
L: 330,
|
|
2752
2774
|
S: this,
|
|
2753
2775
|
C: (f, a) => f(...a)
|
|
@@ -2765,7 +2787,7 @@ var InvitationsHandler = class {
|
|
|
2765
2787
|
await ctx.dispose();
|
|
2766
2788
|
} else {
|
|
2767
2789
|
invariant9(invitation.swarmKey, void 0, {
|
|
2768
|
-
F:
|
|
2790
|
+
F: __dxlog_file13,
|
|
2769
2791
|
L: 345,
|
|
2770
2792
|
S: this,
|
|
2771
2793
|
A: [
|
|
@@ -2859,16 +2881,29 @@ var InvitationsHandler = class {
|
|
|
2859
2881
|
};
|
|
2860
2882
|
}
|
|
2861
2883
|
_logStateUpdate(invitation, actor, newState) {
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2884
|
+
if (this._isNotTerminal(newState)) {
|
|
2885
|
+
log10("invitation state update", {
|
|
2886
|
+
actor: actor?.constructor.name,
|
|
2887
|
+
newState: stateToString(newState),
|
|
2888
|
+
oldState: stateToString(invitation.state)
|
|
2889
|
+
}, {
|
|
2890
|
+
F: __dxlog_file13,
|
|
2891
|
+
L: 439,
|
|
2892
|
+
S: this,
|
|
2893
|
+
C: (f, a) => f(...a)
|
|
2894
|
+
});
|
|
2895
|
+
} else {
|
|
2896
|
+
log10.info("invitation state update", {
|
|
2897
|
+
actor: actor?.constructor.name,
|
|
2898
|
+
newState: stateToString(newState),
|
|
2899
|
+
oldState: stateToString(invitation.state)
|
|
2900
|
+
}, {
|
|
2901
|
+
F: __dxlog_file13,
|
|
2902
|
+
L: 445,
|
|
2903
|
+
S: this,
|
|
2904
|
+
C: (f, a) => f(...a)
|
|
2905
|
+
});
|
|
2906
|
+
}
|
|
2872
2907
|
}
|
|
2873
2908
|
_isNotTerminal(currentState) {
|
|
2874
2909
|
return ![
|
|
@@ -2882,16 +2917,16 @@ var InvitationsHandler = class {
|
|
|
2882
2917
|
async _handleGuestOtpAuth(extension, setState, authenticated, options) {
|
|
2883
2918
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2884
2919
|
log10("guest waiting for authentication code...", void 0, {
|
|
2885
|
-
F:
|
|
2886
|
-
L:
|
|
2920
|
+
F: __dxlog_file13,
|
|
2921
|
+
L: 470,
|
|
2887
2922
|
S: this,
|
|
2888
2923
|
C: (f, a) => f(...a)
|
|
2889
2924
|
});
|
|
2890
2925
|
setState(Invitation4.State.READY_FOR_AUTHENTICATION);
|
|
2891
2926
|
const authCode = await authenticated.wait(options);
|
|
2892
2927
|
log10("sending authentication request", void 0, {
|
|
2893
|
-
F:
|
|
2894
|
-
L:
|
|
2928
|
+
F: __dxlog_file13,
|
|
2929
|
+
L: 474,
|
|
2895
2930
|
S: this,
|
|
2896
2931
|
C: (f, a) => f(...a)
|
|
2897
2932
|
});
|
|
@@ -2909,8 +2944,8 @@ var InvitationsHandler = class {
|
|
|
2909
2944
|
log10("retrying invalid code", {
|
|
2910
2945
|
attempt
|
|
2911
2946
|
}, {
|
|
2912
|
-
F:
|
|
2913
|
-
L:
|
|
2947
|
+
F: __dxlog_file13,
|
|
2948
|
+
L: 485,
|
|
2914
2949
|
S: this,
|
|
2915
2950
|
C: (f, a) => f(...a)
|
|
2916
2951
|
});
|
|
@@ -2927,8 +2962,8 @@ var InvitationsHandler = class {
|
|
|
2927
2962
|
throw new Error("challenge missing in the introduction");
|
|
2928
2963
|
}
|
|
2929
2964
|
log10("sending authentication request", void 0, {
|
|
2930
|
-
F:
|
|
2931
|
-
L:
|
|
2965
|
+
F: __dxlog_file13,
|
|
2966
|
+
L: 504,
|
|
2932
2967
|
S: this,
|
|
2933
2968
|
C: (f, a) => f(...a)
|
|
2934
2969
|
});
|
|
@@ -3048,14 +3083,14 @@ var InvitationsServiceImpl = class {
|
|
|
3048
3083
|
};
|
|
3049
3084
|
|
|
3050
3085
|
// packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts
|
|
3051
|
-
import {
|
|
3086
|
+
import { createCancelDelegatedSpaceInvitationCredential, createDelegatedSpaceInvitationCredential, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
3052
3087
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
3053
3088
|
import { invariant as invariant10 } from "@dxos/invariant";
|
|
3054
3089
|
import { log as log11 } from "@dxos/log";
|
|
3055
3090
|
import { AlreadyJoinedError as AlreadyJoinedError2, AuthorizationError, InvalidInvitationError, SpaceNotFoundError } from "@dxos/protocols";
|
|
3056
3091
|
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3057
3092
|
import { SpaceMember as SpaceMember2 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3058
|
-
var
|
|
3093
|
+
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
3059
3094
|
var SpaceInvitationProtocol = class {
|
|
3060
3095
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
3061
3096
|
this._spaceManager = _spaceManager;
|
|
@@ -3089,79 +3124,43 @@ var SpaceInvitationProtocol = class {
|
|
|
3089
3124
|
};
|
|
3090
3125
|
}
|
|
3091
3126
|
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,
|
|
3127
|
+
invariant10(this._spaceKey && request.space, void 0, {
|
|
3128
|
+
F: __dxlog_file14,
|
|
3129
|
+
L: 74,
|
|
3114
3130
|
S: this,
|
|
3115
3131
|
A: [
|
|
3116
|
-
"request.space",
|
|
3132
|
+
"this._spaceKey && request.space",
|
|
3117
3133
|
""
|
|
3118
3134
|
]
|
|
3119
3135
|
});
|
|
3120
|
-
const { identityKey, deviceKey } = request.space;
|
|
3121
|
-
if (space.inner.spaceState.getMemberRole(identityKey) !== SpaceMember2.Role.REMOVED) {
|
|
3122
|
-
throw new AlreadyJoinedError2();
|
|
3123
|
-
}
|
|
3124
3136
|
log11("writing guest credentials", {
|
|
3125
3137
|
host: this._signingContext.deviceKey,
|
|
3126
|
-
guest: deviceKey
|
|
3138
|
+
guest: request.space.deviceKey
|
|
3127
3139
|
}, {
|
|
3128
|
-
F:
|
|
3129
|
-
L:
|
|
3140
|
+
F: __dxlog_file14,
|
|
3141
|
+
L: 75,
|
|
3130
3142
|
S: this,
|
|
3131
3143
|
C: (f, a) => f(...a)
|
|
3132
3144
|
});
|
|
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
|
-
]
|
|
3145
|
+
const spaceMemberCredential = await this._spaceManager.admitMember({
|
|
3146
|
+
spaceKey: this._spaceKey,
|
|
3147
|
+
identityKey: request.space.identityKey,
|
|
3148
|
+
role: invitation.role ?? SpaceMember2.Role.ADMIN,
|
|
3149
|
+
profile: guestProfile,
|
|
3150
|
+
delegationCredentialId: invitation.delegationCredentialId
|
|
3152
3151
|
});
|
|
3153
|
-
|
|
3152
|
+
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3154
3153
|
return {
|
|
3155
3154
|
space: {
|
|
3156
3155
|
credential: spaceMemberCredential,
|
|
3157
|
-
controlTimeframe: space
|
|
3156
|
+
controlTimeframe: space?.inner.controlPipeline.state.timeframe
|
|
3158
3157
|
}
|
|
3159
3158
|
};
|
|
3160
3159
|
}
|
|
3161
3160
|
async delegate(invitation) {
|
|
3162
3161
|
invariant10(this._spaceKey, void 0, {
|
|
3163
|
-
F:
|
|
3164
|
-
L:
|
|
3162
|
+
F: __dxlog_file14,
|
|
3163
|
+
L: 95,
|
|
3165
3164
|
S: this,
|
|
3166
3165
|
A: [
|
|
3167
3166
|
"this._spaceKey",
|
|
@@ -3170,8 +3169,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3170
3169
|
});
|
|
3171
3170
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3172
3171
|
invariant10(space, void 0, {
|
|
3173
|
-
F:
|
|
3174
|
-
L:
|
|
3172
|
+
F: __dxlog_file14,
|
|
3173
|
+
L: 97,
|
|
3175
3174
|
S: this,
|
|
3176
3175
|
A: [
|
|
3177
3176
|
"space",
|
|
@@ -3180,8 +3179,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3180
3179
|
});
|
|
3181
3180
|
if (invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY) {
|
|
3182
3181
|
invariant10(invitation.guestKeypair?.publicKey, void 0, {
|
|
3183
|
-
F:
|
|
3184
|
-
L:
|
|
3182
|
+
F: __dxlog_file14,
|
|
3183
|
+
L: 99,
|
|
3185
3184
|
S: this,
|
|
3186
3185
|
A: [
|
|
3187
3186
|
"invitation.guestKeypair?.publicKey",
|
|
@@ -3193,8 +3192,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3193
3192
|
host: this._signingContext.deviceKey,
|
|
3194
3193
|
id: invitation.invitationId
|
|
3195
3194
|
}, {
|
|
3196
|
-
F:
|
|
3197
|
-
L:
|
|
3195
|
+
F: __dxlog_file14,
|
|
3196
|
+
L: 102,
|
|
3198
3197
|
S: this,
|
|
3199
3198
|
C: (f, a) => f(...a)
|
|
3200
3199
|
});
|
|
@@ -3208,8 +3207,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3208
3207
|
guestKey: invitation.authMethod === Invitation5.AuthMethod.KNOWN_PUBLIC_KEY ? invitation.guestKeypair.publicKey : void 0
|
|
3209
3208
|
});
|
|
3210
3209
|
invariant10(credential.credential, void 0, {
|
|
3211
|
-
F:
|
|
3212
|
-
L:
|
|
3210
|
+
F: __dxlog_file14,
|
|
3211
|
+
L: 122,
|
|
3213
3212
|
S: this,
|
|
3214
3213
|
A: [
|
|
3215
3214
|
"credential.credential",
|
|
@@ -3223,8 +3222,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3223
3222
|
}
|
|
3224
3223
|
async cancelDelegation(invitation) {
|
|
3225
3224
|
invariant10(this._spaceKey, void 0, {
|
|
3226
|
-
F:
|
|
3227
|
-
L:
|
|
3225
|
+
F: __dxlog_file14,
|
|
3226
|
+
L: 128,
|
|
3228
3227
|
S: this,
|
|
3229
3228
|
A: [
|
|
3230
3229
|
"this._spaceKey",
|
|
@@ -3232,8 +3231,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3232
3231
|
]
|
|
3233
3232
|
});
|
|
3234
3233
|
invariant10(invitation.type === Invitation5.Type.DELEGATED && invitation.delegationCredentialId, void 0, {
|
|
3235
|
-
F:
|
|
3236
|
-
L:
|
|
3234
|
+
F: __dxlog_file14,
|
|
3235
|
+
L: 129,
|
|
3237
3236
|
S: this,
|
|
3238
3237
|
A: [
|
|
3239
3238
|
"invitation.type === Invitation.Type.DELEGATED && invitation.delegationCredentialId",
|
|
@@ -3242,8 +3241,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3242
3241
|
});
|
|
3243
3242
|
const space = this._spaceManager.spaces.get(this._spaceKey);
|
|
3244
3243
|
invariant10(space, void 0, {
|
|
3245
|
-
F:
|
|
3246
|
-
L:
|
|
3244
|
+
F: __dxlog_file14,
|
|
3245
|
+
L: 131,
|
|
3247
3246
|
S: this,
|
|
3248
3247
|
A: [
|
|
3249
3248
|
"space",
|
|
@@ -3254,15 +3253,15 @@ var SpaceInvitationProtocol = class {
|
|
|
3254
3253
|
host: this._signingContext.deviceKey,
|
|
3255
3254
|
id: invitation.invitationId
|
|
3256
3255
|
}, {
|
|
3257
|
-
F:
|
|
3258
|
-
L:
|
|
3256
|
+
F: __dxlog_file14,
|
|
3257
|
+
L: 133,
|
|
3259
3258
|
S: this,
|
|
3260
3259
|
C: (f, a) => f(...a)
|
|
3261
3260
|
});
|
|
3262
3261
|
const credential = await createCancelDelegatedSpaceInvitationCredential(this._signingContext.credentialSigner, space.key, invitation.delegationCredentialId);
|
|
3263
3262
|
invariant10(credential.credential, void 0, {
|
|
3264
|
-
F:
|
|
3265
|
-
L:
|
|
3263
|
+
F: __dxlog_file14,
|
|
3264
|
+
L: 140,
|
|
3266
3265
|
S: this,
|
|
3267
3266
|
A: [
|
|
3268
3267
|
"credential.credential",
|
|
@@ -3300,8 +3299,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3300
3299
|
}
|
|
3301
3300
|
async accept(response) {
|
|
3302
3301
|
invariant10(response.space, void 0, {
|
|
3303
|
-
F:
|
|
3304
|
-
L:
|
|
3302
|
+
F: __dxlog_file14,
|
|
3303
|
+
L: 175,
|
|
3305
3304
|
S: this,
|
|
3306
3305
|
A: [
|
|
3307
3306
|
"response.space",
|
|
@@ -3311,8 +3310,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3311
3310
|
const { credential, controlTimeframe, dataTimeframe } = response.space;
|
|
3312
3311
|
const assertion = getCredentialAssertion2(credential);
|
|
3313
3312
|
invariant10(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3314
|
-
F:
|
|
3315
|
-
L:
|
|
3313
|
+
F: __dxlog_file14,
|
|
3314
|
+
L: 178,
|
|
3316
3315
|
S: this,
|
|
3317
3316
|
A: [
|
|
3318
3317
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3320,8 +3319,8 @@ var SpaceInvitationProtocol = class {
|
|
|
3320
3319
|
]
|
|
3321
3320
|
});
|
|
3322
3321
|
invariant10(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
3323
|
-
F:
|
|
3324
|
-
L:
|
|
3322
|
+
F: __dxlog_file14,
|
|
3323
|
+
L: 179,
|
|
3325
3324
|
S: this,
|
|
3326
3325
|
A: [
|
|
3327
3326
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
@@ -3355,7 +3354,7 @@ import { PublicKey as PublicKey8 } from "@dxos/keys";
|
|
|
3355
3354
|
import { log as log12 } from "@dxos/log";
|
|
3356
3355
|
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3357
3356
|
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
3358
|
-
var
|
|
3357
|
+
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts";
|
|
3359
3358
|
var InvitationsManager = class {
|
|
3360
3359
|
constructor(_invitationsHandler, _getHandler, _metadataStore) {
|
|
3361
3360
|
this._invitationsHandler = _invitationsHandler;
|
|
@@ -3398,7 +3397,7 @@ var InvitationsManager = class {
|
|
|
3398
3397
|
await this._persistIfRequired(handler, stream, invitation);
|
|
3399
3398
|
} catch (err) {
|
|
3400
3399
|
log12.catch(err, void 0, {
|
|
3401
|
-
F:
|
|
3400
|
+
F: __dxlog_file15,
|
|
3402
3401
|
L: 82,
|
|
3403
3402
|
S: this,
|
|
3404
3403
|
C: (f, a) => f(...a)
|
|
@@ -3421,7 +3420,7 @@ var InvitationsManager = class {
|
|
|
3421
3420
|
const freshInvitations = persistentInvitations.filter((invitation) => !hasInvitationExpired(invitation));
|
|
3422
3421
|
const loadTasks = freshInvitations.map((persistentInvitation) => {
|
|
3423
3422
|
invariant11(!this._createInvitations.get(persistentInvitation.invitationId), "invitation already exists", {
|
|
3424
|
-
F:
|
|
3423
|
+
F: __dxlog_file15,
|
|
3425
3424
|
L: 103,
|
|
3426
3425
|
S: this,
|
|
3427
3426
|
A: [
|
|
@@ -3440,7 +3439,7 @@ var InvitationsManager = class {
|
|
|
3440
3439
|
};
|
|
3441
3440
|
} catch (err) {
|
|
3442
3441
|
log12.catch(err, void 0, {
|
|
3443
|
-
F:
|
|
3442
|
+
F: __dxlog_file15,
|
|
3444
3443
|
L: 110,
|
|
3445
3444
|
S: this,
|
|
3446
3445
|
C: (f, a) => f(...a)
|
|
@@ -3472,13 +3471,13 @@ var InvitationsManager = class {
|
|
|
3472
3471
|
}
|
|
3473
3472
|
async authenticate({ invitationId, authCode }) {
|
|
3474
3473
|
log12("authenticating...", void 0, {
|
|
3475
|
-
F:
|
|
3474
|
+
F: __dxlog_file15,
|
|
3476
3475
|
L: 140,
|
|
3477
3476
|
S: this,
|
|
3478
3477
|
C: (f, a) => f(...a)
|
|
3479
3478
|
});
|
|
3480
3479
|
invariant11(invitationId, void 0, {
|
|
3481
|
-
F:
|
|
3480
|
+
F: __dxlog_file15,
|
|
3482
3481
|
L: 141,
|
|
3483
3482
|
S: this,
|
|
3484
3483
|
A: [
|
|
@@ -3491,7 +3490,7 @@ var InvitationsManager = class {
|
|
|
3491
3490
|
log12.warn("invalid invitation", {
|
|
3492
3491
|
invitationId
|
|
3493
3492
|
}, {
|
|
3494
|
-
F:
|
|
3493
|
+
F: __dxlog_file15,
|
|
3495
3494
|
L: 144,
|
|
3496
3495
|
S: this,
|
|
3497
3496
|
C: (f, a) => f(...a)
|
|
@@ -3504,13 +3503,13 @@ var InvitationsManager = class {
|
|
|
3504
3503
|
log12("cancelInvitation...", {
|
|
3505
3504
|
invitationId
|
|
3506
3505
|
}, {
|
|
3507
|
-
F:
|
|
3506
|
+
F: __dxlog_file15,
|
|
3508
3507
|
L: 151,
|
|
3509
3508
|
S: this,
|
|
3510
3509
|
C: (f, a) => f(...a)
|
|
3511
3510
|
});
|
|
3512
3511
|
invariant11(invitationId, void 0, {
|
|
3513
|
-
F:
|
|
3512
|
+
F: __dxlog_file15,
|
|
3514
3513
|
L: 152,
|
|
3515
3514
|
S: this,
|
|
3516
3515
|
A: [
|
|
@@ -3584,12 +3583,15 @@ var InvitationsManager = class {
|
|
|
3584
3583
|
stream.error(err);
|
|
3585
3584
|
void ctx.dispose();
|
|
3586
3585
|
}
|
|
3586
|
+
}, {
|
|
3587
|
+
F: __dxlog_file15,
|
|
3588
|
+
L: 234
|
|
3587
3589
|
});
|
|
3588
3590
|
ctx.onDispose(() => {
|
|
3589
3591
|
log12("complete", {
|
|
3590
3592
|
...handler.toJSON()
|
|
3591
3593
|
}, {
|
|
3592
|
-
F:
|
|
3594
|
+
F: __dxlog_file15,
|
|
3593
3595
|
L: 241,
|
|
3594
3596
|
S: this,
|
|
3595
3597
|
C: (f, a) => f(...a)
|
|
@@ -3622,7 +3624,7 @@ var InvitationsManager = class {
|
|
|
3622
3624
|
log12("timeout", {
|
|
3623
3625
|
...handler.toJSON()
|
|
3624
3626
|
}, {
|
|
3625
|
-
F:
|
|
3627
|
+
F: __dxlog_file15,
|
|
3626
3628
|
L: 261,
|
|
3627
3629
|
S: this,
|
|
3628
3630
|
C: (f, a) => f(...a)
|
|
@@ -3633,7 +3635,7 @@ var InvitationsManager = class {
|
|
|
3633
3635
|
});
|
|
3634
3636
|
} else {
|
|
3635
3637
|
log12.warn("auth failed", err, {
|
|
3636
|
-
F:
|
|
3638
|
+
F: __dxlog_file15,
|
|
3637
3639
|
L: 264,
|
|
3638
3640
|
S: this,
|
|
3639
3641
|
C: (f, a) => f(...a)
|
|
@@ -3645,12 +3647,15 @@ var InvitationsManager = class {
|
|
|
3645
3647
|
}
|
|
3646
3648
|
void ctx.dispose();
|
|
3647
3649
|
}
|
|
3650
|
+
}, {
|
|
3651
|
+
F: __dxlog_file15,
|
|
3652
|
+
L: 258
|
|
3648
3653
|
});
|
|
3649
3654
|
ctx.onDispose(() => {
|
|
3650
3655
|
log12("complete", {
|
|
3651
3656
|
...handler.toJSON()
|
|
3652
3657
|
}, {
|
|
3653
|
-
F:
|
|
3658
|
+
F: __dxlog_file15,
|
|
3654
3659
|
L: 271,
|
|
3655
3660
|
S: this,
|
|
3656
3661
|
C: (f, a) => f(...a)
|
|
@@ -3695,7 +3700,7 @@ var InvitationsManager = class {
|
|
|
3695
3700
|
await this._metadataStore.removeInvitation(invitation.invitationId);
|
|
3696
3701
|
} catch (err) {
|
|
3697
3702
|
log12.catch(err, void 0, {
|
|
3698
|
-
F:
|
|
3703
|
+
F: __dxlog_file15,
|
|
3699
3704
|
L: 307,
|
|
3700
3705
|
S: this,
|
|
3701
3706
|
C: (f, a) => f(...a)
|
|
@@ -3782,7 +3787,7 @@ import { invariant as invariant12 } from "@dxos/invariant";
|
|
|
3782
3787
|
import { log as log13 } from "@dxos/log";
|
|
3783
3788
|
import { CreateEpochRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
3784
3789
|
import { assignDeep } from "@dxos/util";
|
|
3785
|
-
var
|
|
3790
|
+
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/epoch-migrations.ts";
|
|
3786
3791
|
var runEpochMigration = async (ctx, context) => {
|
|
3787
3792
|
switch (context.migration) {
|
|
3788
3793
|
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
@@ -3806,7 +3811,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3806
3811
|
}
|
|
3807
3812
|
case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT: {
|
|
3808
3813
|
log13.info("Fragmenting", void 0, {
|
|
3809
|
-
F:
|
|
3814
|
+
F: __dxlog_file16,
|
|
3810
3815
|
L: 63,
|
|
3811
3816
|
S: void 0,
|
|
3812
3817
|
C: (f, a) => f(...a)
|
|
@@ -3818,7 +3823,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3818
3823
|
const properties = findInlineObjectOfType(rootHandle.docSync(), TYPE_PROPERTIES);
|
|
3819
3824
|
const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
|
|
3820
3825
|
invariant12(properties, "Properties not found", {
|
|
3821
|
-
F:
|
|
3826
|
+
F: __dxlog_file16,
|
|
3822
3827
|
L: 73,
|
|
3823
3828
|
S: void 0,
|
|
3824
3829
|
A: [
|
|
@@ -3834,7 +3839,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3834
3839
|
};
|
|
3835
3840
|
const newRoot = context.repo.create(newSpaceDoc);
|
|
3836
3841
|
invariant12(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
|
|
3837
|
-
F:
|
|
3842
|
+
F: __dxlog_file16,
|
|
3838
3843
|
L: 78,
|
|
3839
3844
|
S: void 0,
|
|
3840
3845
|
A: [
|
|
@@ -3865,7 +3870,7 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3865
3870
|
const rootHandle = context.repo.find(currentRootUrl);
|
|
3866
3871
|
await cancelWithContext4(ctx, asyncTimeout2(rootHandle.whenReady(), 1e4));
|
|
3867
3872
|
invariant12(rootHandle.docSync(), "Root doc not found", {
|
|
3868
|
-
F:
|
|
3873
|
+
F: __dxlog_file16,
|
|
3869
3874
|
L: 100,
|
|
3870
3875
|
S: void 0,
|
|
3871
3876
|
A: [
|
|
@@ -3875,21 +3880,35 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3875
3880
|
});
|
|
3876
3881
|
const newRootContent = await convertLegacySpaceRootDoc(structuredClone(rootHandle.docSync()));
|
|
3877
3882
|
for (const [id, url] of Object.entries(newRootContent.links ?? {})) {
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3883
|
+
try {
|
|
3884
|
+
const handle = context.repo.find(url);
|
|
3885
|
+
await cancelWithContext4(ctx, asyncTimeout2(handle.whenReady(), 1e4));
|
|
3886
|
+
invariant12(handle.docSync(), "Doc not found", {
|
|
3887
|
+
F: __dxlog_file16,
|
|
3888
|
+
L: 108,
|
|
3889
|
+
S: void 0,
|
|
3890
|
+
A: [
|
|
3891
|
+
"handle.docSync()",
|
|
3892
|
+
"'Doc not found'"
|
|
3893
|
+
]
|
|
3894
|
+
});
|
|
3895
|
+
const newDoc = await convertLegacyReferences(structuredClone(handle.docSync()));
|
|
3896
|
+
const migratedDoc = migrateDocument(handle.docSync(), newDoc);
|
|
3897
|
+
const newHandle = context.repo.import(am.save(migratedDoc));
|
|
3898
|
+
newRootContent.links[id] = newHandle.url;
|
|
3899
|
+
} catch (err) {
|
|
3900
|
+
log13.warn("Failed to migrate reference", {
|
|
3901
|
+
id,
|
|
3902
|
+
url,
|
|
3903
|
+
error: err
|
|
3904
|
+
}, {
|
|
3905
|
+
F: __dxlog_file16,
|
|
3906
|
+
L: 114,
|
|
3907
|
+
S: void 0,
|
|
3908
|
+
C: (f, a) => f(...a)
|
|
3909
|
+
});
|
|
3910
|
+
delete newRootContent.links[id];
|
|
3911
|
+
}
|
|
3893
3912
|
}
|
|
3894
3913
|
const migratedRoot = migrateDocument(rootHandle.docSync(), newRootContent);
|
|
3895
3914
|
const newRoot = context.repo.import(am.save(migratedRoot));
|
|
@@ -3900,8 +3919,8 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
3900
3919
|
}
|
|
3901
3920
|
case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
|
|
3902
3921
|
invariant12(context.newAutomergeRoot, void 0, {
|
|
3903
|
-
F:
|
|
3904
|
-
L:
|
|
3922
|
+
F: __dxlog_file16,
|
|
3923
|
+
L: 129,
|
|
3905
3924
|
S: void 0,
|
|
3906
3925
|
A: [
|
|
3907
3926
|
"context.newAutomergeRoot",
|
|
@@ -3926,14 +3945,17 @@ import { log as log14 } from "@dxos/log";
|
|
|
3926
3945
|
import { schema as schema4 } from "@dxos/protocols";
|
|
3927
3946
|
import { RpcExtension as RpcExtension3 } from "@dxos/teleport";
|
|
3928
3947
|
import { ComplexMap as ComplexMap2, ComplexSet as ComplexSet4, entry } from "@dxos/util";
|
|
3929
|
-
var
|
|
3948
|
+
var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
3930
3949
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
3931
3950
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
3932
3951
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
3933
3952
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
3934
3953
|
var NotarizationPlugin = class {
|
|
3935
3954
|
constructor() {
|
|
3936
|
-
this._ctx = new Context7(
|
|
3955
|
+
this._ctx = new Context7(void 0, {
|
|
3956
|
+
F: __dxlog_file17,
|
|
3957
|
+
L: 62
|
|
3958
|
+
});
|
|
3937
3959
|
this._extensionOpened = new Event5();
|
|
3938
3960
|
this._extensions = /* @__PURE__ */ new Set();
|
|
3939
3961
|
this._processedCredentials = new ComplexSet4(PublicKey9.hash);
|
|
@@ -3954,13 +3976,13 @@ var NotarizationPlugin = class {
|
|
|
3954
3976
|
log14("notarize", {
|
|
3955
3977
|
credentials
|
|
3956
3978
|
}, {
|
|
3957
|
-
F:
|
|
3979
|
+
F: __dxlog_file17,
|
|
3958
3980
|
L: 90,
|
|
3959
3981
|
S: this,
|
|
3960
3982
|
C: (f, a) => f(...a)
|
|
3961
3983
|
});
|
|
3962
3984
|
invariant13(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
3963
|
-
F:
|
|
3985
|
+
F: __dxlog_file17,
|
|
3964
3986
|
L: 91,
|
|
3965
3987
|
S: this,
|
|
3966
3988
|
A: [
|
|
@@ -3974,7 +3996,7 @@ var NotarizationPlugin = class {
|
|
|
3974
3996
|
log14.warn("Notarization error", {
|
|
3975
3997
|
err
|
|
3976
3998
|
}, {
|
|
3977
|
-
F:
|
|
3999
|
+
F: __dxlog_file17,
|
|
3978
4000
|
L: 99,
|
|
3979
4001
|
S: this,
|
|
3980
4002
|
C: (f, a) => f(...a)
|
|
@@ -3990,7 +4012,7 @@ var NotarizationPlugin = class {
|
|
|
3990
4012
|
timeout,
|
|
3991
4013
|
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
3992
4014
|
}, {
|
|
3993
|
-
F:
|
|
4015
|
+
F: __dxlog_file17,
|
|
3994
4016
|
L: 111,
|
|
3995
4017
|
S: this,
|
|
3996
4018
|
C: (f, a) => f(...a)
|
|
@@ -4013,7 +4035,7 @@ var NotarizationPlugin = class {
|
|
|
4013
4035
|
log14.info("Exhausted all peers to notarize with", {
|
|
4014
4036
|
retryIn: retryTimeout
|
|
4015
4037
|
}, {
|
|
4016
|
-
F:
|
|
4038
|
+
F: __dxlog_file17,
|
|
4017
4039
|
L: 136,
|
|
4018
4040
|
S: this,
|
|
4019
4041
|
C: (f, a) => f(...a)
|
|
@@ -4027,7 +4049,7 @@ var NotarizationPlugin = class {
|
|
|
4027
4049
|
peer: peer.localPeerId,
|
|
4028
4050
|
credentialId: credentials.map((credential) => credential.id)
|
|
4029
4051
|
}, {
|
|
4030
|
-
F:
|
|
4052
|
+
F: __dxlog_file17,
|
|
4031
4053
|
L: 143,
|
|
4032
4054
|
S: this,
|
|
4033
4055
|
C: (f, a) => f(...a)
|
|
@@ -4036,7 +4058,7 @@ var NotarizationPlugin = class {
|
|
|
4036
4058
|
credentials: credentials.filter((credential) => !this._processedCredentials.has(credential.id))
|
|
4037
4059
|
});
|
|
4038
4060
|
log14("success", void 0, {
|
|
4039
|
-
F:
|
|
4061
|
+
F: __dxlog_file17,
|
|
4040
4062
|
L: 147,
|
|
4041
4063
|
S: this,
|
|
4042
4064
|
C: (f, a) => f(...a)
|
|
@@ -4045,7 +4067,7 @@ var NotarizationPlugin = class {
|
|
|
4045
4067
|
} catch (err) {
|
|
4046
4068
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
4047
4069
|
log14.info("error notarizing (recoverable)", err, {
|
|
4048
|
-
F:
|
|
4070
|
+
F: __dxlog_file17,
|
|
4049
4071
|
L: 151,
|
|
4050
4072
|
S: this,
|
|
4051
4073
|
C: (f, a) => f(...a)
|
|
@@ -4063,7 +4085,7 @@ var NotarizationPlugin = class {
|
|
|
4063
4085
|
errors.wait()
|
|
4064
4086
|
]);
|
|
4065
4087
|
log14("done", void 0, {
|
|
4066
|
-
F:
|
|
4088
|
+
F: __dxlog_file17,
|
|
4067
4089
|
L: 162,
|
|
4068
4090
|
S: this,
|
|
4069
4091
|
C: (f, a) => f(...a)
|
|
@@ -4085,7 +4107,7 @@ var NotarizationPlugin = class {
|
|
|
4085
4107
|
}
|
|
4086
4108
|
setWriter(writer) {
|
|
4087
4109
|
invariant13(!this._writer, "Writer already set.", {
|
|
4088
|
-
F:
|
|
4110
|
+
F: __dxlog_file17,
|
|
4089
4111
|
L: 181,
|
|
4090
4112
|
S: this,
|
|
4091
4113
|
A: [
|
|
@@ -4110,7 +4132,7 @@ var NotarizationPlugin = class {
|
|
|
4110
4132
|
}
|
|
4111
4133
|
for (const credential of request.credentials ?? []) {
|
|
4112
4134
|
invariant13(credential.id, "Credential must have an id", {
|
|
4113
|
-
F:
|
|
4135
|
+
F: __dxlog_file17,
|
|
4114
4136
|
L: 200,
|
|
4115
4137
|
S: this,
|
|
4116
4138
|
A: [
|
|
@@ -4130,7 +4152,7 @@ var NotarizationPlugin = class {
|
|
|
4130
4152
|
log14("extension opened", {
|
|
4131
4153
|
peer: extension.localPeerId
|
|
4132
4154
|
}, {
|
|
4133
|
-
F:
|
|
4155
|
+
F: __dxlog_file17,
|
|
4134
4156
|
L: 211,
|
|
4135
4157
|
S: this,
|
|
4136
4158
|
C: (f, a) => f(...a)
|
|
@@ -4142,7 +4164,7 @@ var NotarizationPlugin = class {
|
|
|
4142
4164
|
log14("extension closed", {
|
|
4143
4165
|
peer: extension.localPeerId
|
|
4144
4166
|
}, {
|
|
4145
|
-
F:
|
|
4167
|
+
F: __dxlog_file17,
|
|
4146
4168
|
L: 216,
|
|
4147
4169
|
S: this,
|
|
4148
4170
|
C: (f, a) => f(...a)
|
|
@@ -4259,10 +4281,13 @@ function _using_ctx() {
|
|
|
4259
4281
|
}
|
|
4260
4282
|
};
|
|
4261
4283
|
}
|
|
4262
|
-
var
|
|
4284
|
+
var __dxlog_file18 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
4263
4285
|
var DataSpace = class {
|
|
4264
4286
|
constructor(params) {
|
|
4265
|
-
this._ctx = new Context8(
|
|
4287
|
+
this._ctx = new Context8(void 0, {
|
|
4288
|
+
F: __dxlog_file18,
|
|
4289
|
+
L: 84
|
|
4290
|
+
});
|
|
4266
4291
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
4267
4292
|
this._cache = void 0;
|
|
4268
4293
|
// TODO(dmaretskyi): Move into Space?
|
|
@@ -4296,7 +4321,7 @@ var DataSpace = class {
|
|
|
4296
4321
|
log15("new state", {
|
|
4297
4322
|
state: SpaceState2[this._state]
|
|
4298
4323
|
}, {
|
|
4299
|
-
F:
|
|
4324
|
+
F: __dxlog_file18,
|
|
4300
4325
|
L: 146,
|
|
4301
4326
|
S: this,
|
|
4302
4327
|
C: (f, a) => f(...a)
|
|
@@ -4351,12 +4376,15 @@ var DataSpace = class {
|
|
|
4351
4376
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
4352
4377
|
await this._automergeSpaceState.open();
|
|
4353
4378
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
4354
|
-
await this._inner.open(new Context8(
|
|
4379
|
+
await this._inner.open(new Context8(void 0, {
|
|
4380
|
+
F: __dxlog_file18,
|
|
4381
|
+
L: 215
|
|
4382
|
+
}));
|
|
4355
4383
|
this._state = SpaceState2.CONTROL_ONLY;
|
|
4356
4384
|
log15("new state", {
|
|
4357
4385
|
state: SpaceState2[this._state]
|
|
4358
4386
|
}, {
|
|
4359
|
-
F:
|
|
4387
|
+
F: __dxlog_file18,
|
|
4360
4388
|
L: 217,
|
|
4361
4389
|
S: this,
|
|
4362
4390
|
C: (f, a) => f(...a)
|
|
@@ -4374,13 +4402,16 @@ var DataSpace = class {
|
|
|
4374
4402
|
log15("new state", {
|
|
4375
4403
|
state: SpaceState2[this._state]
|
|
4376
4404
|
}, {
|
|
4377
|
-
F:
|
|
4405
|
+
F: __dxlog_file18,
|
|
4378
4406
|
L: 231,
|
|
4379
4407
|
S: this,
|
|
4380
4408
|
C: (f, a) => f(...a)
|
|
4381
4409
|
});
|
|
4382
4410
|
await this._ctx.dispose();
|
|
4383
|
-
this._ctx = new Context8(
|
|
4411
|
+
this._ctx = new Context8(void 0, {
|
|
4412
|
+
F: __dxlog_file18,
|
|
4413
|
+
L: 233
|
|
4414
|
+
});
|
|
4384
4415
|
await this.authVerifier.close();
|
|
4385
4416
|
await this._inner.close();
|
|
4386
4417
|
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
@@ -4407,7 +4438,7 @@ var DataSpace = class {
|
|
|
4407
4438
|
} catch (err) {
|
|
4408
4439
|
if (err instanceof CancelledError || err instanceof ContextDisposedError3) {
|
|
4409
4440
|
log15("data pipeline initialization cancelled", err, {
|
|
4410
|
-
F:
|
|
4441
|
+
F: __dxlog_file18,
|
|
4411
4442
|
L: 265,
|
|
4412
4443
|
S: this,
|
|
4413
4444
|
C: (f, a) => f(...a)
|
|
@@ -4415,7 +4446,7 @@ var DataSpace = class {
|
|
|
4415
4446
|
return;
|
|
4416
4447
|
}
|
|
4417
4448
|
log15.error("Error initializing data pipeline", err, {
|
|
4418
|
-
F:
|
|
4449
|
+
F: __dxlog_file18,
|
|
4419
4450
|
L: 269,
|
|
4420
4451
|
S: this,
|
|
4421
4452
|
C: (f, a) => f(...a)
|
|
@@ -4424,7 +4455,7 @@ var DataSpace = class {
|
|
|
4424
4455
|
log15("new state", {
|
|
4425
4456
|
state: SpaceState2[this._state]
|
|
4426
4457
|
}, {
|
|
4427
|
-
F:
|
|
4458
|
+
F: __dxlog_file18,
|
|
4428
4459
|
L: 271,
|
|
4429
4460
|
S: this,
|
|
4430
4461
|
C: (f, a) => f(...a)
|
|
@@ -4444,7 +4475,7 @@ var DataSpace = class {
|
|
|
4444
4475
|
log15("new state", {
|
|
4445
4476
|
state: SpaceState2[this._state]
|
|
4446
4477
|
}, {
|
|
4447
|
-
F:
|
|
4478
|
+
F: __dxlog_file18,
|
|
4448
4479
|
L: 287,
|
|
4449
4480
|
S: this,
|
|
4450
4481
|
C: (f, a) => f(...a)
|
|
@@ -4461,7 +4492,7 @@ var DataSpace = class {
|
|
|
4461
4492
|
log15("new state", {
|
|
4462
4493
|
state: SpaceState2[this._state]
|
|
4463
4494
|
}, {
|
|
4464
|
-
F:
|
|
4495
|
+
F: __dxlog_file18,
|
|
4465
4496
|
L: 306,
|
|
4466
4497
|
S: this,
|
|
4467
4498
|
C: (f, a) => f(...a)
|
|
@@ -4477,7 +4508,7 @@ var DataSpace = class {
|
|
|
4477
4508
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4478
4509
|
await this._createWritableFeeds();
|
|
4479
4510
|
log15("writable feeds created", void 0, {
|
|
4480
|
-
F:
|
|
4511
|
+
F: __dxlog_file18,
|
|
4481
4512
|
L: 322,
|
|
4482
4513
|
S: this,
|
|
4483
4514
|
C: (f, a) => f(...a)
|
|
@@ -4540,12 +4571,11 @@ var DataSpace = class {
|
|
|
4540
4571
|
space: this.key,
|
|
4541
4572
|
rootUrl
|
|
4542
4573
|
}, {
|
|
4543
|
-
F:
|
|
4574
|
+
F: __dxlog_file18,
|
|
4544
4575
|
L: 388,
|
|
4545
4576
|
S: this,
|
|
4546
4577
|
C: (f, a) => f(...a)
|
|
4547
4578
|
});
|
|
4548
|
-
this._echoHost.replicateDocument(rootUrl);
|
|
4549
4579
|
const handle = this._echoHost.automergeRepo.find(rootUrl);
|
|
4550
4580
|
queueMicrotask(async () => {
|
|
4551
4581
|
try {
|
|
@@ -4572,8 +4602,10 @@ var DataSpace = class {
|
|
|
4572
4602
|
const root = await this._echoHost.openSpaceRoot(handle.url);
|
|
4573
4603
|
this._databaseRoot = root;
|
|
4574
4604
|
if (root.getVersion() !== SpaceDocVersion.CURRENT) {
|
|
4575
|
-
this._state
|
|
4576
|
-
|
|
4605
|
+
if (this._state !== SpaceState2.REQUIRES_MIGRATION) {
|
|
4606
|
+
this._state = SpaceState2.REQUIRES_MIGRATION;
|
|
4607
|
+
this.stateUpdate.emit();
|
|
4608
|
+
}
|
|
4577
4609
|
} else {
|
|
4578
4610
|
if (this._state !== SpaceState2.READY) {
|
|
4579
4611
|
await this._enterReadyState();
|
|
@@ -4593,7 +4625,7 @@ var DataSpace = class {
|
|
|
4593
4625
|
rootUrl,
|
|
4594
4626
|
err
|
|
4595
4627
|
}, {
|
|
4596
|
-
F:
|
|
4628
|
+
F: __dxlog_file18,
|
|
4597
4629
|
L: 431,
|
|
4598
4630
|
S: this,
|
|
4599
4631
|
C: (f, a) => f(...a)
|
|
@@ -4679,7 +4711,7 @@ var DataSpace = class {
|
|
|
4679
4711
|
log15("new state", {
|
|
4680
4712
|
state: SpaceState2[this._state]
|
|
4681
4713
|
}, {
|
|
4682
|
-
F:
|
|
4714
|
+
F: __dxlog_file18,
|
|
4683
4715
|
L: 512,
|
|
4684
4716
|
S: this,
|
|
4685
4717
|
C: (f, a) => f(...a)
|
|
@@ -4740,15 +4772,17 @@ DataSpace = _ts_decorate4([
|
|
|
4740
4772
|
import { Event as Event7, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
4741
4773
|
import { PropertiesType } from "@dxos/client-protocol";
|
|
4742
4774
|
import { Context as Context9, cancelWithContext as cancelWithContext6 } from "@dxos/context";
|
|
4743
|
-
import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credentials";
|
|
4775
|
+
import { getCredentialAssertion as getCredentialAssertion3, createAdmissionCredentials } from "@dxos/credentials";
|
|
4744
4776
|
import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2 } from "@dxos/echo-db";
|
|
4745
4777
|
import { AuthStatus } from "@dxos/echo-pipeline";
|
|
4778
|
+
import { CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
4746
4779
|
import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
|
|
4747
4780
|
import { TYPE_PROPERTIES as TYPE_PROPERTIES2, generateEchoId, getTypeReference } from "@dxos/echo-schema";
|
|
4781
|
+
import { writeMessages as writeMessages3 } from "@dxos/feed-store";
|
|
4748
4782
|
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4749
4783
|
import { PublicKey as PublicKey11 } from "@dxos/keys";
|
|
4750
4784
|
import { log as log16 } from "@dxos/log";
|
|
4751
|
-
import { trace as Trace2 } from "@dxos/protocols";
|
|
4785
|
+
import { trace as Trace2, AlreadyJoinedError as AlreadyJoinedError3 } from "@dxos/protocols";
|
|
4752
4786
|
import { Invitation as Invitation7, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
4753
4787
|
import { SpaceMember as SpaceMember6 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
4754
4788
|
import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extension-gossip";
|
|
@@ -4836,7 +4870,7 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
4836
4870
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4837
4871
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4838
4872
|
}
|
|
4839
|
-
var
|
|
4873
|
+
var __dxlog_file19 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts";
|
|
4840
4874
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
4841
4875
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
4842
4876
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
@@ -4850,7 +4884,10 @@ var DataSpaceManager = class {
|
|
|
4850
4884
|
this._echoHost = _echoHost;
|
|
4851
4885
|
this._invitationsManager = _invitationsManager;
|
|
4852
4886
|
this._params = _params;
|
|
4853
|
-
this._ctx = new Context9(
|
|
4887
|
+
this._ctx = new Context9(void 0, {
|
|
4888
|
+
F: __dxlog_file19,
|
|
4889
|
+
L: 104
|
|
4890
|
+
});
|
|
4854
4891
|
this.updated = new Event7();
|
|
4855
4892
|
this._spaces = new ComplexMap3(PublicKey11.hash);
|
|
4856
4893
|
this._isOpen = false;
|
|
@@ -4884,24 +4921,24 @@ var DataSpaceManager = class {
|
|
|
4884
4921
|
}
|
|
4885
4922
|
async open() {
|
|
4886
4923
|
log16("open", void 0, {
|
|
4887
|
-
F:
|
|
4888
|
-
L:
|
|
4924
|
+
F: __dxlog_file19,
|
|
4925
|
+
L: 156,
|
|
4889
4926
|
S: this,
|
|
4890
4927
|
C: (f, a) => f(...a)
|
|
4891
4928
|
});
|
|
4892
4929
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.begin({
|
|
4893
4930
|
id: this._instanceId
|
|
4894
4931
|
}), {
|
|
4895
|
-
F:
|
|
4896
|
-
L:
|
|
4932
|
+
F: __dxlog_file19,
|
|
4933
|
+
L: 157,
|
|
4897
4934
|
S: this,
|
|
4898
4935
|
C: (f, a) => f(...a)
|
|
4899
4936
|
});
|
|
4900
4937
|
log16("metadata loaded", {
|
|
4901
4938
|
spaces: this._metadataStore.spaces.length
|
|
4902
4939
|
}, {
|
|
4903
|
-
F:
|
|
4904
|
-
L:
|
|
4940
|
+
F: __dxlog_file19,
|
|
4941
|
+
L: 158,
|
|
4905
4942
|
S: this,
|
|
4906
4943
|
C: (f, a) => f(...a)
|
|
4907
4944
|
});
|
|
@@ -4910,8 +4947,8 @@ var DataSpaceManager = class {
|
|
|
4910
4947
|
log16("load space", {
|
|
4911
4948
|
spaceMetadata
|
|
4912
4949
|
}, {
|
|
4913
|
-
F:
|
|
4914
|
-
L:
|
|
4950
|
+
F: __dxlog_file19,
|
|
4951
|
+
L: 162,
|
|
4915
4952
|
S: this,
|
|
4916
4953
|
C: (f, a) => f(...a)
|
|
4917
4954
|
});
|
|
@@ -4921,8 +4958,8 @@ var DataSpaceManager = class {
|
|
|
4921
4958
|
spaceMetadata,
|
|
4922
4959
|
err
|
|
4923
4960
|
}, {
|
|
4924
|
-
F:
|
|
4925
|
-
L:
|
|
4961
|
+
F: __dxlog_file19,
|
|
4962
|
+
L: 165,
|
|
4926
4963
|
S: this,
|
|
4927
4964
|
C: (f, a) => f(...a)
|
|
4928
4965
|
});
|
|
@@ -4933,16 +4970,16 @@ var DataSpaceManager = class {
|
|
|
4933
4970
|
log16.trace("dxos.echo.data-space-manager.open", Trace2.end({
|
|
4934
4971
|
id: this._instanceId
|
|
4935
4972
|
}), {
|
|
4936
|
-
F:
|
|
4937
|
-
L:
|
|
4973
|
+
F: __dxlog_file19,
|
|
4974
|
+
L: 172,
|
|
4938
4975
|
S: this,
|
|
4939
4976
|
C: (f, a) => f(...a)
|
|
4940
4977
|
});
|
|
4941
4978
|
}
|
|
4942
4979
|
async close() {
|
|
4943
4980
|
log16("close", void 0, {
|
|
4944
|
-
F:
|
|
4945
|
-
L:
|
|
4981
|
+
F: __dxlog_file19,
|
|
4982
|
+
L: 177,
|
|
4946
4983
|
S: this,
|
|
4947
4984
|
C: (f, a) => f(...a)
|
|
4948
4985
|
});
|
|
@@ -4958,8 +4995,8 @@ var DataSpaceManager = class {
|
|
|
4958
4995
|
*/
|
|
4959
4996
|
async createSpace() {
|
|
4960
4997
|
invariant14(this._isOpen, "Not open.", {
|
|
4961
|
-
F:
|
|
4962
|
-
L:
|
|
4998
|
+
F: __dxlog_file19,
|
|
4999
|
+
L: 191,
|
|
4963
5000
|
S: this,
|
|
4964
5001
|
A: [
|
|
4965
5002
|
"this._isOpen",
|
|
@@ -4979,8 +5016,8 @@ var DataSpaceManager = class {
|
|
|
4979
5016
|
log16("creating space...", {
|
|
4980
5017
|
spaceKey
|
|
4981
5018
|
}, {
|
|
4982
|
-
F:
|
|
4983
|
-
L:
|
|
5019
|
+
F: __dxlog_file19,
|
|
5020
|
+
L: 203,
|
|
4984
5021
|
S: this,
|
|
4985
5022
|
C: (f, a) => f(...a)
|
|
4986
5023
|
});
|
|
@@ -4991,8 +5028,8 @@ var DataSpaceManager = class {
|
|
|
4991
5028
|
await this._metadataStore.addSpace(metadata);
|
|
4992
5029
|
const memberCredential = credentials[1];
|
|
4993
5030
|
invariant14(getCredentialAssertion3(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
4994
|
-
F:
|
|
4995
|
-
L:
|
|
5031
|
+
F: __dxlog_file19,
|
|
5032
|
+
L: 213,
|
|
4996
5033
|
S: this,
|
|
4997
5034
|
A: [
|
|
4998
5035
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -5023,8 +5060,8 @@ var DataSpaceManager = class {
|
|
|
5023
5060
|
version: space.databaseRoot.getVersion(),
|
|
5024
5061
|
spaceId: space.id
|
|
5025
5062
|
}, {
|
|
5026
|
-
F:
|
|
5027
|
-
L:
|
|
5063
|
+
F: __dxlog_file19,
|
|
5064
|
+
L: 238,
|
|
5028
5065
|
S: this,
|
|
5029
5066
|
C: (f, a) => f(...a)
|
|
5030
5067
|
});
|
|
@@ -5058,8 +5095,8 @@ var DataSpaceManager = class {
|
|
|
5058
5095
|
async _getSpaceRootDocument(space) {
|
|
5059
5096
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5060
5097
|
invariant14(automergeIndex, void 0, {
|
|
5061
|
-
F:
|
|
5062
|
-
L:
|
|
5098
|
+
F: __dxlog_file19,
|
|
5099
|
+
L: 271,
|
|
5063
5100
|
S: this,
|
|
5064
5101
|
A: [
|
|
5065
5102
|
"automergeIndex",
|
|
@@ -5075,14 +5112,14 @@ var DataSpaceManager = class {
|
|
|
5075
5112
|
log16("accept space", {
|
|
5076
5113
|
opts
|
|
5077
5114
|
}, {
|
|
5078
|
-
F:
|
|
5079
|
-
L:
|
|
5115
|
+
F: __dxlog_file19,
|
|
5116
|
+
L: 280,
|
|
5080
5117
|
S: this,
|
|
5081
5118
|
C: (f, a) => f(...a)
|
|
5082
5119
|
});
|
|
5083
5120
|
invariant14(this._isOpen, "Not open.", {
|
|
5084
|
-
F:
|
|
5085
|
-
L:
|
|
5121
|
+
F: __dxlog_file19,
|
|
5122
|
+
L: 281,
|
|
5086
5123
|
S: this,
|
|
5087
5124
|
A: [
|
|
5088
5125
|
"this._isOpen",
|
|
@@ -5090,8 +5127,8 @@ var DataSpaceManager = class {
|
|
|
5090
5127
|
]
|
|
5091
5128
|
});
|
|
5092
5129
|
invariant14(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
5093
|
-
F:
|
|
5094
|
-
L:
|
|
5130
|
+
F: __dxlog_file19,
|
|
5131
|
+
L: 282,
|
|
5095
5132
|
S: this,
|
|
5096
5133
|
A: [
|
|
5097
5134
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -5111,6 +5148,43 @@ var DataSpaceManager = class {
|
|
|
5111
5148
|
this.updated.emit();
|
|
5112
5149
|
return space;
|
|
5113
5150
|
}
|
|
5151
|
+
async admitMember(options) {
|
|
5152
|
+
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
5153
|
+
invariant14(space, void 0, {
|
|
5154
|
+
F: __dxlog_file19,
|
|
5155
|
+
L: 302,
|
|
5156
|
+
S: this,
|
|
5157
|
+
A: [
|
|
5158
|
+
"space",
|
|
5159
|
+
""
|
|
5160
|
+
]
|
|
5161
|
+
});
|
|
5162
|
+
if (space.spaceState.getMemberRole(options.identityKey) !== SpaceMember6.Role.REMOVED) {
|
|
5163
|
+
throw new AlreadyJoinedError3();
|
|
5164
|
+
}
|
|
5165
|
+
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
5166
|
+
invariant14(credentials[0].credential, void 0, {
|
|
5167
|
+
F: __dxlog_file19,
|
|
5168
|
+
L: 321,
|
|
5169
|
+
S: this,
|
|
5170
|
+
A: [
|
|
5171
|
+
"credentials[0].credential",
|
|
5172
|
+
""
|
|
5173
|
+
]
|
|
5174
|
+
});
|
|
5175
|
+
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5176
|
+
invariant14(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5177
|
+
F: __dxlog_file19,
|
|
5178
|
+
L: 323,
|
|
5179
|
+
S: this,
|
|
5180
|
+
A: [
|
|
5181
|
+
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5182
|
+
""
|
|
5183
|
+
]
|
|
5184
|
+
});
|
|
5185
|
+
await writeMessages3(space.controlPipeline.writer, credentials);
|
|
5186
|
+
return spaceMemberCredential;
|
|
5187
|
+
}
|
|
5114
5188
|
/**
|
|
5115
5189
|
* Wait until the space data pipeline is fully initialized.
|
|
5116
5190
|
* Used by invitation handler.
|
|
@@ -5122,12 +5196,24 @@ var DataSpaceManager = class {
|
|
|
5122
5196
|
return !!space && space.state === SpaceState3.READY;
|
|
5123
5197
|
}));
|
|
5124
5198
|
}
|
|
5199
|
+
async requestSpaceAdmissionCredential(spaceKey) {
|
|
5200
|
+
return this._spaceManager.requestSpaceAdmissionCredential({
|
|
5201
|
+
spaceKey,
|
|
5202
|
+
identityKey: this._signingContext.identityKey,
|
|
5203
|
+
timeout: 15e3,
|
|
5204
|
+
swarmIdentity: {
|
|
5205
|
+
peerKey: this._signingContext.deviceKey,
|
|
5206
|
+
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
5207
|
+
credentialAuthenticator: async () => true
|
|
5208
|
+
}
|
|
5209
|
+
});
|
|
5210
|
+
}
|
|
5125
5211
|
async _constructSpace(metadata) {
|
|
5126
5212
|
log16("construct space", {
|
|
5127
5213
|
metadata
|
|
5128
5214
|
}, {
|
|
5129
|
-
F:
|
|
5130
|
-
L:
|
|
5215
|
+
F: __dxlog_file19,
|
|
5216
|
+
L: 358,
|
|
5131
5217
|
S: this,
|
|
5132
5218
|
C: (f, a) => f(...a)
|
|
5133
5219
|
});
|
|
@@ -5155,6 +5241,7 @@ var DataSpaceManager = class {
|
|
|
5155
5241
|
credentialAuthenticator: deferFunction2(() => dataSpace.authVerifier.verifier)
|
|
5156
5242
|
},
|
|
5157
5243
|
onAuthorizedConnection: (session) => {
|
|
5244
|
+
session.addExtension("dxos.mesh.teleport.admission-discovery", new CredentialServerExtension(space));
|
|
5158
5245
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
5159
5246
|
remotePeerId: session.remotePeerId
|
|
5160
5247
|
}));
|
|
@@ -5164,8 +5251,8 @@ var DataSpaceManager = class {
|
|
|
5164
5251
|
},
|
|
5165
5252
|
onAuthFailure: () => {
|
|
5166
5253
|
log16.warn("auth failure", void 0, {
|
|
5167
|
-
F:
|
|
5168
|
-
L:
|
|
5254
|
+
F: __dxlog_file19,
|
|
5255
|
+
L: 396,
|
|
5169
5256
|
S: this,
|
|
5170
5257
|
C: (f, a) => f(...a)
|
|
5171
5258
|
});
|
|
@@ -5197,8 +5284,8 @@ var DataSpaceManager = class {
|
|
|
5197
5284
|
log16("before space ready", {
|
|
5198
5285
|
space: space.key
|
|
5199
5286
|
}, {
|
|
5200
|
-
F:
|
|
5201
|
-
L:
|
|
5287
|
+
F: __dxlog_file19,
|
|
5288
|
+
L: 423,
|
|
5202
5289
|
S: this,
|
|
5203
5290
|
C: (f, a) => f(...a)
|
|
5204
5291
|
});
|
|
@@ -5208,8 +5295,8 @@ var DataSpaceManager = class {
|
|
|
5208
5295
|
space: space.key,
|
|
5209
5296
|
open: this._isOpen
|
|
5210
5297
|
}, {
|
|
5211
|
-
F:
|
|
5212
|
-
L:
|
|
5298
|
+
F: __dxlog_file19,
|
|
5299
|
+
L: 426,
|
|
5213
5300
|
S: this,
|
|
5214
5301
|
C: (f, a) => f(...a)
|
|
5215
5302
|
});
|
|
@@ -5227,8 +5314,8 @@ var DataSpaceManager = class {
|
|
|
5227
5314
|
log16("before space close", {
|
|
5228
5315
|
space: space.key
|
|
5229
5316
|
}, {
|
|
5230
|
-
F:
|
|
5231
|
-
L:
|
|
5317
|
+
F: __dxlog_file19,
|
|
5318
|
+
L: 434,
|
|
5232
5319
|
S: this,
|
|
5233
5320
|
C: (f, a) => f(...a)
|
|
5234
5321
|
});
|
|
@@ -5268,8 +5355,8 @@ var DataSpaceManager = class {
|
|
|
5268
5355
|
peersOnline: presence.getPeersOnline().length,
|
|
5269
5356
|
closedSessions
|
|
5270
5357
|
}, {
|
|
5271
|
-
F:
|
|
5272
|
-
L:
|
|
5358
|
+
F: __dxlog_file19,
|
|
5359
|
+
L: 470,
|
|
5273
5360
|
S: this,
|
|
5274
5361
|
C: (f, a) => f(...a)
|
|
5275
5362
|
});
|
|
@@ -5283,8 +5370,8 @@ var DataSpaceManager = class {
|
|
|
5283
5370
|
log16("closing a session with a removed peer", {
|
|
5284
5371
|
peerId: peerState.peerId
|
|
5285
5372
|
}, {
|
|
5286
|
-
F:
|
|
5287
|
-
L:
|
|
5373
|
+
F: __dxlog_file19,
|
|
5374
|
+
L: 484,
|
|
5288
5375
|
S: this,
|
|
5289
5376
|
C: (f, a) => f(...a)
|
|
5290
5377
|
});
|
|
@@ -5349,13 +5436,13 @@ import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTas
|
|
|
5349
5436
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
5350
5437
|
import { createAdmissionCredentials as createAdmissionCredentials2, getCredentialAssertion as getCredentialAssertion4 } from "@dxos/credentials";
|
|
5351
5438
|
import { raise as raise2 } from "@dxos/debug";
|
|
5352
|
-
import { writeMessages as
|
|
5439
|
+
import { writeMessages as writeMessages4 } from "@dxos/feed-store";
|
|
5353
5440
|
import { invariant as invariant15 } from "@dxos/invariant";
|
|
5354
5441
|
import { log as log17 } from "@dxos/log";
|
|
5355
5442
|
import { ApiError, SpaceNotFoundError as SpaceNotFoundError2, encodeError, IdentityNotInitializedError, AuthorizationError as AuthorizationError2 } from "@dxos/protocols";
|
|
5356
5443
|
import { SpaceMember as SpaceMember7, SpaceState as SpaceState4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
5357
5444
|
import { trace as trace8 } from "@dxos/tracing";
|
|
5358
|
-
var
|
|
5445
|
+
var __dxlog_file20 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
5359
5446
|
var SpacesServiceImpl = class {
|
|
5360
5447
|
constructor(_identityManager, _spaceManager, _getDataSpaceManager) {
|
|
5361
5448
|
this._identityManager = _identityManager;
|
|
@@ -5399,8 +5486,8 @@ var SpacesServiceImpl = class {
|
|
|
5399
5486
|
}
|
|
5400
5487
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
5401
5488
|
invariant15(credentials[0].credential, void 0, {
|
|
5402
|
-
F:
|
|
5403
|
-
L:
|
|
5489
|
+
F: __dxlog_file20,
|
|
5490
|
+
L: 102,
|
|
5404
5491
|
S: this,
|
|
5405
5492
|
A: [
|
|
5406
5493
|
"credentials[0].credential",
|
|
@@ -5409,15 +5496,15 @@ var SpacesServiceImpl = class {
|
|
|
5409
5496
|
});
|
|
5410
5497
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
5411
5498
|
invariant15(getCredentialAssertion4(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
5412
|
-
F:
|
|
5413
|
-
L:
|
|
5499
|
+
F: __dxlog_file20,
|
|
5500
|
+
L: 104,
|
|
5414
5501
|
S: this,
|
|
5415
5502
|
A: [
|
|
5416
5503
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5417
5504
|
""
|
|
5418
5505
|
]
|
|
5419
5506
|
});
|
|
5420
|
-
await
|
|
5507
|
+
await writeMessages4(space.controlPipeline.writer, credentials);
|
|
5421
5508
|
}
|
|
5422
5509
|
querySpaces() {
|
|
5423
5510
|
return new Stream10(({ next, ctx }) => {
|
|
@@ -5427,8 +5514,8 @@ var SpacesServiceImpl = class {
|
|
|
5427
5514
|
log17("update", {
|
|
5428
5515
|
spaces
|
|
5429
5516
|
}, {
|
|
5430
|
-
F:
|
|
5431
|
-
L:
|
|
5517
|
+
F: __dxlog_file20,
|
|
5518
|
+
L: 115,
|
|
5432
5519
|
S: this,
|
|
5433
5520
|
C: (f, a) => f(...a)
|
|
5434
5521
|
});
|
|
@@ -5446,7 +5533,15 @@ var SpacesServiceImpl = class {
|
|
|
5446
5533
|
const subscribeSpaces = () => {
|
|
5447
5534
|
subscriptions.clear();
|
|
5448
5535
|
for (const space of dataSpaceManager.spaces.values()) {
|
|
5449
|
-
|
|
5536
|
+
let lastState;
|
|
5537
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => {
|
|
5538
|
+
if (space.state !== lastState) {
|
|
5539
|
+
scheduler.forceTrigger();
|
|
5540
|
+
} else {
|
|
5541
|
+
scheduler.trigger();
|
|
5542
|
+
}
|
|
5543
|
+
lastState = space.state;
|
|
5544
|
+
}));
|
|
5450
5545
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
5451
5546
|
subscriptions.add(space.automergeSpaceState.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
5452
5547
|
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
@@ -5511,8 +5606,8 @@ var SpacesServiceImpl = class {
|
|
|
5511
5606
|
});
|
|
5512
5607
|
} else {
|
|
5513
5608
|
invariant15(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
5514
|
-
F:
|
|
5515
|
-
L:
|
|
5609
|
+
F: __dxlog_file20,
|
|
5610
|
+
L: 213,
|
|
5516
5611
|
S: this,
|
|
5517
5612
|
A: [
|
|
5518
5613
|
"!credential.id",
|
|
@@ -5520,8 +5615,8 @@ var SpacesServiceImpl = class {
|
|
|
5520
5615
|
]
|
|
5521
5616
|
});
|
|
5522
5617
|
invariant15(this._identityManager.identity, "Identity is not available", {
|
|
5523
|
-
F:
|
|
5524
|
-
L:
|
|
5618
|
+
F: __dxlog_file20,
|
|
5619
|
+
L: 214,
|
|
5525
5620
|
S: this,
|
|
5526
5621
|
A: [
|
|
5527
5622
|
"this._identityManager.identity",
|
|
@@ -5530,8 +5625,8 @@ var SpacesServiceImpl = class {
|
|
|
5530
5625
|
});
|
|
5531
5626
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
5532
5627
|
invariant15(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
5533
|
-
F:
|
|
5534
|
-
L:
|
|
5628
|
+
F: __dxlog_file20,
|
|
5629
|
+
L: 216,
|
|
5535
5630
|
S: this,
|
|
5536
5631
|
A: [
|
|
5537
5632
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -5561,6 +5656,59 @@ var SpacesServiceImpl = class {
|
|
|
5561
5656
|
epochCredential: credential ?? void 0
|
|
5562
5657
|
};
|
|
5563
5658
|
}
|
|
5659
|
+
async admitContact(request) {
|
|
5660
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5661
|
+
await dataSpaceManager.admitMember({
|
|
5662
|
+
spaceKey: request.spaceKey,
|
|
5663
|
+
identityKey: request.contact.identityKey,
|
|
5664
|
+
role: request.role
|
|
5665
|
+
});
|
|
5666
|
+
}
|
|
5667
|
+
async joinBySpaceKey({ spaceKey }) {
|
|
5668
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5669
|
+
const credential = await dataSpaceManager.requestSpaceAdmissionCredential(spaceKey);
|
|
5670
|
+
return this._joinByAdmission({
|
|
5671
|
+
credential
|
|
5672
|
+
});
|
|
5673
|
+
}
|
|
5674
|
+
async _joinByAdmission({ credential }) {
|
|
5675
|
+
const assertion = getCredentialAssertion4(credential);
|
|
5676
|
+
invariant15(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
5677
|
+
F: __dxlog_file20,
|
|
5678
|
+
L: 250,
|
|
5679
|
+
S: this,
|
|
5680
|
+
A: [
|
|
5681
|
+
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
5682
|
+
"'Invalid credential'"
|
|
5683
|
+
]
|
|
5684
|
+
});
|
|
5685
|
+
const myIdentity = this._identityManager.identity;
|
|
5686
|
+
invariant15(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
5687
|
+
F: __dxlog_file20,
|
|
5688
|
+
L: 252,
|
|
5689
|
+
S: this,
|
|
5690
|
+
A: [
|
|
5691
|
+
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
5692
|
+
""
|
|
5693
|
+
]
|
|
5694
|
+
});
|
|
5695
|
+
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5696
|
+
let dataSpace = dataSpaceManager.spaces.get(assertion.spaceKey);
|
|
5697
|
+
if (!dataSpace) {
|
|
5698
|
+
dataSpace = await dataSpaceManager.acceptSpace({
|
|
5699
|
+
spaceKey: assertion.spaceKey,
|
|
5700
|
+
genesisFeedKey: assertion.genesisFeedKey
|
|
5701
|
+
});
|
|
5702
|
+
await myIdentity.controlPipeline.writer.write({
|
|
5703
|
+
credential: {
|
|
5704
|
+
credential
|
|
5705
|
+
}
|
|
5706
|
+
});
|
|
5707
|
+
}
|
|
5708
|
+
return {
|
|
5709
|
+
space: this._serializeSpace(dataSpace)
|
|
5710
|
+
};
|
|
5711
|
+
}
|
|
5564
5712
|
_serializeSpace(space) {
|
|
5565
5713
|
return {
|
|
5566
5714
|
id: space.id,
|
|
@@ -5648,7 +5796,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
5648
5796
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5649
5797
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5650
5798
|
}
|
|
5651
|
-
var
|
|
5799
|
+
var __dxlog_file21 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
5652
5800
|
var ServiceContext = class extends Resource3 {
|
|
5653
5801
|
constructor(storage, level, networkManager, signalManager, _runtimeParams) {
|
|
5654
5802
|
super();
|
|
@@ -5692,7 +5840,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5692
5840
|
async _open(ctx) {
|
|
5693
5841
|
await this._checkStorageVersion();
|
|
5694
5842
|
log18("opening...", void 0, {
|
|
5695
|
-
F:
|
|
5843
|
+
F: __dxlog_file21,
|
|
5696
5844
|
L: 149,
|
|
5697
5845
|
S: this,
|
|
5698
5846
|
C: (f, a) => f(...a)
|
|
@@ -5700,7 +5848,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5700
5848
|
log18.trace("dxos.sdk.service-context.open", trace9.begin({
|
|
5701
5849
|
id: this._instanceId
|
|
5702
5850
|
}), {
|
|
5703
|
-
F:
|
|
5851
|
+
F: __dxlog_file21,
|
|
5704
5852
|
L: 150,
|
|
5705
5853
|
S: this,
|
|
5706
5854
|
C: (f, a) => f(...a)
|
|
@@ -5718,7 +5866,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5718
5866
|
log18("loaded persistent invitations", {
|
|
5719
5867
|
count: loadedInvitations.invitations?.length
|
|
5720
5868
|
}, {
|
|
5721
|
-
F:
|
|
5869
|
+
F: __dxlog_file21,
|
|
5722
5870
|
L: 163,
|
|
5723
5871
|
S: this,
|
|
5724
5872
|
C: (f, a) => f(...a)
|
|
@@ -5726,13 +5874,13 @@ var ServiceContext = class extends Resource3 {
|
|
|
5726
5874
|
log18.trace("dxos.sdk.service-context.open", trace9.end({
|
|
5727
5875
|
id: this._instanceId
|
|
5728
5876
|
}), {
|
|
5729
|
-
F:
|
|
5877
|
+
F: __dxlog_file21,
|
|
5730
5878
|
L: 165,
|
|
5731
5879
|
S: this,
|
|
5732
5880
|
C: (f, a) => f(...a)
|
|
5733
5881
|
});
|
|
5734
5882
|
log18("opened", void 0, {
|
|
5735
|
-
F:
|
|
5883
|
+
F: __dxlog_file21,
|
|
5736
5884
|
L: 166,
|
|
5737
5885
|
S: this,
|
|
5738
5886
|
C: (f, a) => f(...a)
|
|
@@ -5740,7 +5888,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5740
5888
|
}
|
|
5741
5889
|
async _close(ctx) {
|
|
5742
5890
|
log18("closing...", void 0, {
|
|
5743
|
-
F:
|
|
5891
|
+
F: __dxlog_file21,
|
|
5744
5892
|
L: 170,
|
|
5745
5893
|
S: this,
|
|
5746
5894
|
C: (f, a) => f(...a)
|
|
@@ -5757,7 +5905,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5757
5905
|
await this.networkManager.close();
|
|
5758
5906
|
await this.signalManager.close();
|
|
5759
5907
|
log18("closed", void 0, {
|
|
5760
|
-
F:
|
|
5908
|
+
F: __dxlog_file21,
|
|
5761
5909
|
L: 182,
|
|
5762
5910
|
S: this,
|
|
5763
5911
|
C: (f, a) => f(...a)
|
|
@@ -5765,13 +5913,16 @@ var ServiceContext = class extends Resource3 {
|
|
|
5765
5913
|
}
|
|
5766
5914
|
async createIdentity(params = {}) {
|
|
5767
5915
|
const identity = await this.identityManager.createIdentity(params);
|
|
5768
|
-
await this._initialize(new Context10(
|
|
5916
|
+
await this._initialize(new Context10(void 0, {
|
|
5917
|
+
F: __dxlog_file21,
|
|
5918
|
+
L: 187
|
|
5919
|
+
}));
|
|
5769
5920
|
return identity;
|
|
5770
5921
|
}
|
|
5771
5922
|
getInvitationHandler(invitation) {
|
|
5772
5923
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
5773
5924
|
invariant16(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
5774
|
-
F:
|
|
5925
|
+
F: __dxlog_file21,
|
|
5775
5926
|
L: 193,
|
|
5776
5927
|
S: this,
|
|
5777
5928
|
A: [
|
|
@@ -5791,7 +5942,10 @@ var ServiceContext = class extends Resource3 {
|
|
|
5791
5942
|
}
|
|
5792
5943
|
async _acceptIdentity(params) {
|
|
5793
5944
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
5794
|
-
await this._initialize(new Context10(
|
|
5945
|
+
await this._initialize(new Context10(void 0, {
|
|
5946
|
+
F: __dxlog_file21,
|
|
5947
|
+
L: 209
|
|
5948
|
+
}));
|
|
5795
5949
|
return identity;
|
|
5796
5950
|
}
|
|
5797
5951
|
async _checkStorageVersion() {
|
|
@@ -5803,7 +5957,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5803
5957
|
// Called when identity is created.
|
|
5804
5958
|
async _initialize(ctx) {
|
|
5805
5959
|
log18("initializing spaces...", void 0, {
|
|
5806
|
-
F:
|
|
5960
|
+
F: __dxlog_file21,
|
|
5807
5961
|
L: 224,
|
|
5808
5962
|
S: this,
|
|
5809
5963
|
C: (f, a) => f(...a)
|
|
@@ -5826,7 +5980,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5826
5980
|
await this.dataSpaceManager.open();
|
|
5827
5981
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
5828
5982
|
invariant16(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
5829
|
-
F:
|
|
5983
|
+
F: __dxlog_file21,
|
|
5830
5984
|
L: 249,
|
|
5831
5985
|
S: this,
|
|
5832
5986
|
A: [
|
|
@@ -5850,7 +6004,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5850
6004
|
log18("dataSpaceManager not initialized yet, ignoring space admission", {
|
|
5851
6005
|
details: assertion
|
|
5852
6006
|
}, {
|
|
5853
|
-
F:
|
|
6007
|
+
F: __dxlog_file21,
|
|
5854
6008
|
L: 265,
|
|
5855
6009
|
S: this,
|
|
5856
6010
|
C: (f, a) => f(...a)
|
|
@@ -5861,7 +6015,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5861
6015
|
log18("space already exists, ignoring space admission", {
|
|
5862
6016
|
details: assertion
|
|
5863
6017
|
}, {
|
|
5864
|
-
F:
|
|
6018
|
+
F: __dxlog_file21,
|
|
5865
6019
|
L: 269,
|
|
5866
6020
|
S: this,
|
|
5867
6021
|
C: (f, a) => f(...a)
|
|
@@ -5872,7 +6026,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5872
6026
|
log18("accepting space recorded in halo", {
|
|
5873
6027
|
details: assertion
|
|
5874
6028
|
}, {
|
|
5875
|
-
F:
|
|
6029
|
+
F: __dxlog_file21,
|
|
5876
6030
|
L: 274,
|
|
5877
6031
|
S: this,
|
|
5878
6032
|
C: (f, a) => f(...a)
|
|
@@ -5883,7 +6037,7 @@ var ServiceContext = class extends Resource3 {
|
|
|
5883
6037
|
});
|
|
5884
6038
|
} catch (err) {
|
|
5885
6039
|
log18.catch(err, void 0, {
|
|
5886
|
-
F:
|
|
6040
|
+
F: __dxlog_file21,
|
|
5887
6041
|
L: 280,
|
|
5888
6042
|
S: this,
|
|
5889
6043
|
C: (f, a) => f(...a)
|
|
@@ -5943,7 +6097,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
5943
6097
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5944
6098
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5945
6099
|
}
|
|
5946
|
-
var
|
|
6100
|
+
var __dxlog_file22 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/locks/browser.ts";
|
|
5947
6101
|
var Message;
|
|
5948
6102
|
(function(Message2) {
|
|
5949
6103
|
Message2["ACQUIRING"] = "acquiring";
|
|
@@ -5966,28 +6120,28 @@ var Lock = class {
|
|
|
5966
6120
|
});
|
|
5967
6121
|
try {
|
|
5968
6122
|
log19("aquiring lock...", void 0, {
|
|
5969
|
-
F:
|
|
6123
|
+
F: __dxlog_file22,
|
|
5970
6124
|
L: 42,
|
|
5971
6125
|
S: this,
|
|
5972
6126
|
C: (f, a) => f(...a)
|
|
5973
6127
|
});
|
|
5974
6128
|
await asyncTimeout3(this._requestLock(), RESOURCE_LOCK_TIMEOUT);
|
|
5975
6129
|
log19("acquired lock", void 0, {
|
|
5976
|
-
F:
|
|
6130
|
+
F: __dxlog_file22,
|
|
5977
6131
|
L: 44,
|
|
5978
6132
|
S: this,
|
|
5979
6133
|
C: (f, a) => f(...a)
|
|
5980
6134
|
});
|
|
5981
6135
|
} catch {
|
|
5982
6136
|
log19("stealing lock...", void 0, {
|
|
5983
|
-
F:
|
|
6137
|
+
F: __dxlog_file22,
|
|
5984
6138
|
L: 46,
|
|
5985
6139
|
S: this,
|
|
5986
6140
|
C: (f, a) => f(...a)
|
|
5987
6141
|
});
|
|
5988
6142
|
await this._requestLock(true);
|
|
5989
6143
|
log19("stolen lock", void 0, {
|
|
5990
|
-
F:
|
|
6144
|
+
F: __dxlog_file22,
|
|
5991
6145
|
L: 48,
|
|
5992
6146
|
S: this,
|
|
5993
6147
|
C: (f, a) => f(...a)
|
|
@@ -6006,7 +6160,7 @@ var Lock = class {
|
|
|
6006
6160
|
log19("requesting lock...", {
|
|
6007
6161
|
steal
|
|
6008
6162
|
}, {
|
|
6009
|
-
F:
|
|
6163
|
+
F: __dxlog_file22,
|
|
6010
6164
|
L: 63,
|
|
6011
6165
|
S: this,
|
|
6012
6166
|
C: (f, a) => f(...a)
|
|
@@ -6020,14 +6174,14 @@ var Lock = class {
|
|
|
6020
6174
|
this._releaseTrigger = new Trigger9();
|
|
6021
6175
|
await this._releaseTrigger.wait();
|
|
6022
6176
|
log19("releasing lock...", void 0, {
|
|
6023
|
-
F:
|
|
6177
|
+
F: __dxlog_file22,
|
|
6024
6178
|
L: 72,
|
|
6025
6179
|
S: this,
|
|
6026
6180
|
C: (f, a) => f(...a)
|
|
6027
6181
|
});
|
|
6028
6182
|
await this._onRelease?.();
|
|
6029
6183
|
log19("released lock", void 0, {
|
|
6030
|
-
F:
|
|
6184
|
+
F: __dxlog_file22,
|
|
6031
6185
|
L: 74,
|
|
6032
6186
|
S: this,
|
|
6033
6187
|
C: (f, a) => f(...a)
|
|
@@ -6039,7 +6193,7 @@ var Lock = class {
|
|
|
6039
6193
|
log19("recieved lock", {
|
|
6040
6194
|
steal
|
|
6041
6195
|
}, {
|
|
6042
|
-
F:
|
|
6196
|
+
F: __dxlog_file22,
|
|
6043
6197
|
L: 81,
|
|
6044
6198
|
S: this,
|
|
6045
6199
|
C: (f, a) => f(...a)
|
|
@@ -6127,13 +6281,151 @@ var createLevel = async (config) => {
|
|
|
6127
6281
|
return level;
|
|
6128
6282
|
};
|
|
6129
6283
|
|
|
6284
|
+
// packages/sdk/client-services/src/packlets/storage/profile-archive.ts
|
|
6285
|
+
import { cbor } from "@dxos/automerge/automerge-repo";
|
|
6286
|
+
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6287
|
+
import { log as log20 } from "@dxos/log";
|
|
6288
|
+
import { ProfileArchiveEntryType } from "@dxos/protocols";
|
|
6289
|
+
import { arrayToBuffer } from "@dxos/util";
|
|
6290
|
+
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/storage/profile-archive.ts";
|
|
6291
|
+
var encodeProfileArchive = (profile) => cbor.encode(profile);
|
|
6292
|
+
var decodeProfileArchive = (data) => cbor.decode(data);
|
|
6293
|
+
var exportProfileData = async ({ storage, level }) => {
|
|
6294
|
+
const archive = {
|
|
6295
|
+
storage: [],
|
|
6296
|
+
meta: {
|
|
6297
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6298
|
+
}
|
|
6299
|
+
};
|
|
6300
|
+
{
|
|
6301
|
+
const directory = await storage.createDirectory();
|
|
6302
|
+
const files = await directory.list();
|
|
6303
|
+
log20.info("begin exporting files", {
|
|
6304
|
+
count: files.length
|
|
6305
|
+
}, {
|
|
6306
|
+
F: __dxlog_file23,
|
|
6307
|
+
L: 30,
|
|
6308
|
+
S: void 0,
|
|
6309
|
+
C: (f, a) => f(...a)
|
|
6310
|
+
});
|
|
6311
|
+
for (const filename of files) {
|
|
6312
|
+
const file = await directory.getOrCreateFile(filename);
|
|
6313
|
+
const { size } = await file.stat();
|
|
6314
|
+
const data = await file.read(0, size);
|
|
6315
|
+
archive.storage.push({
|
|
6316
|
+
type: ProfileArchiveEntryType.FILE,
|
|
6317
|
+
key: filename,
|
|
6318
|
+
value: data
|
|
6319
|
+
});
|
|
6320
|
+
}
|
|
6321
|
+
log20.info("done exporting files", {
|
|
6322
|
+
count: files.length
|
|
6323
|
+
}, {
|
|
6324
|
+
F: __dxlog_file23,
|
|
6325
|
+
L: 41,
|
|
6326
|
+
S: void 0,
|
|
6327
|
+
C: (f, a) => f(...a)
|
|
6328
|
+
});
|
|
6329
|
+
}
|
|
6330
|
+
{
|
|
6331
|
+
log20.info("begin exporting kv pairs", void 0, {
|
|
6332
|
+
F: __dxlog_file23,
|
|
6333
|
+
L: 45,
|
|
6334
|
+
S: void 0,
|
|
6335
|
+
C: (f, a) => f(...a)
|
|
6336
|
+
});
|
|
6337
|
+
const iter = await level.iterator({
|
|
6338
|
+
keyEncoding: "binary",
|
|
6339
|
+
valueEncoding: "binary"
|
|
6340
|
+
});
|
|
6341
|
+
let count = 0;
|
|
6342
|
+
for await (const [key, value] of iter) {
|
|
6343
|
+
archive.storage.push({
|
|
6344
|
+
type: ProfileArchiveEntryType.KEY_VALUE,
|
|
6345
|
+
key,
|
|
6346
|
+
value
|
|
6347
|
+
});
|
|
6348
|
+
count++;
|
|
6349
|
+
}
|
|
6350
|
+
log20.info("done exporting kv pairs", {
|
|
6351
|
+
count
|
|
6352
|
+
}, {
|
|
6353
|
+
F: __dxlog_file23,
|
|
6354
|
+
L: 56,
|
|
6355
|
+
S: void 0,
|
|
6356
|
+
C: (f, a) => f(...a)
|
|
6357
|
+
});
|
|
6358
|
+
}
|
|
6359
|
+
return archive;
|
|
6360
|
+
};
|
|
6361
|
+
var importProfileData = async ({ storage, level }, archive) => {
|
|
6362
|
+
const batch = level.batch();
|
|
6363
|
+
for (const entry2 of archive.storage) {
|
|
6364
|
+
switch (entry2.type) {
|
|
6365
|
+
case ProfileArchiveEntryType.FILE: {
|
|
6366
|
+
const directory = await storage.createDirectory();
|
|
6367
|
+
invariant17(typeof entry2.key === "string", "Invalid key type", {
|
|
6368
|
+
F: __dxlog_file23,
|
|
6369
|
+
L: 78,
|
|
6370
|
+
S: void 0,
|
|
6371
|
+
A: [
|
|
6372
|
+
"typeof entry.key === 'string'",
|
|
6373
|
+
"'Invalid key type'"
|
|
6374
|
+
]
|
|
6375
|
+
});
|
|
6376
|
+
const file = await directory.getOrCreateFile(entry2.key);
|
|
6377
|
+
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6378
|
+
F: __dxlog_file23,
|
|
6379
|
+
L: 80,
|
|
6380
|
+
S: void 0,
|
|
6381
|
+
A: [
|
|
6382
|
+
"entry.value instanceof Uint8Array",
|
|
6383
|
+
"'Invalid value type'"
|
|
6384
|
+
]
|
|
6385
|
+
});
|
|
6386
|
+
await file.write(0, arrayToBuffer(entry2.value));
|
|
6387
|
+
await file.close();
|
|
6388
|
+
break;
|
|
6389
|
+
}
|
|
6390
|
+
case ProfileArchiveEntryType.KEY_VALUE: {
|
|
6391
|
+
invariant17(entry2.key instanceof Uint8Array, "Invalid key type", {
|
|
6392
|
+
F: __dxlog_file23,
|
|
6393
|
+
L: 86,
|
|
6394
|
+
S: void 0,
|
|
6395
|
+
A: [
|
|
6396
|
+
"entry.key instanceof Uint8Array",
|
|
6397
|
+
"'Invalid key type'"
|
|
6398
|
+
]
|
|
6399
|
+
});
|
|
6400
|
+
invariant17(entry2.value instanceof Uint8Array, "Invalid value type", {
|
|
6401
|
+
F: __dxlog_file23,
|
|
6402
|
+
L: 87,
|
|
6403
|
+
S: void 0,
|
|
6404
|
+
A: [
|
|
6405
|
+
"entry.value instanceof Uint8Array",
|
|
6406
|
+
"'Invalid value type'"
|
|
6407
|
+
]
|
|
6408
|
+
});
|
|
6409
|
+
batch.put(entry2.key, entry2.value, {
|
|
6410
|
+
keyEncoding: "binary",
|
|
6411
|
+
valueEncoding: "binary"
|
|
6412
|
+
});
|
|
6413
|
+
break;
|
|
6414
|
+
}
|
|
6415
|
+
default:
|
|
6416
|
+
throw new Error(`Invalid entry type: ${entry2.type}`);
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
await batch.write();
|
|
6420
|
+
};
|
|
6421
|
+
|
|
6130
6422
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
6131
6423
|
import { Event as Event9, synchronized as synchronized3 } from "@dxos/async";
|
|
6132
6424
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
6133
6425
|
import { Context as Context11 } from "@dxos/context";
|
|
6134
|
-
import { invariant as
|
|
6135
|
-
import { PublicKey as
|
|
6136
|
-
import { log as
|
|
6426
|
+
import { invariant as invariant19 } from "@dxos/invariant";
|
|
6427
|
+
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
6428
|
+
import { log as log22 } from "@dxos/log";
|
|
6137
6429
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
6138
6430
|
import { SwarmNetworkManager, createSimplePeerTransportFactory } from "@dxos/network-manager";
|
|
6139
6431
|
import { trace as trace10 } from "@dxos/protocols";
|
|
@@ -6144,9 +6436,9 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
|
|
|
6144
6436
|
// packages/sdk/client-services/src/packlets/devices/devices-service.ts
|
|
6145
6437
|
import { EventSubscriptions as EventSubscriptions3 } from "@dxos/async";
|
|
6146
6438
|
import { Stream as Stream11 } from "@dxos/codec-protobuf";
|
|
6147
|
-
import { invariant as
|
|
6439
|
+
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6148
6440
|
import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6149
|
-
var
|
|
6441
|
+
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
|
|
6150
6442
|
var DevicesServiceImpl = class {
|
|
6151
6443
|
constructor(_identityManager) {
|
|
6152
6444
|
this._identityManager = _identityManager;
|
|
@@ -6163,8 +6455,8 @@ var DevicesServiceImpl = class {
|
|
|
6163
6455
|
devices: []
|
|
6164
6456
|
});
|
|
6165
6457
|
} else {
|
|
6166
|
-
|
|
6167
|
-
F:
|
|
6458
|
+
invariant18(this._identityManager.identity?.presence, "presence not present", {
|
|
6459
|
+
F: __dxlog_file24,
|
|
6168
6460
|
L: 32,
|
|
6169
6461
|
S: this,
|
|
6170
6462
|
A: [
|
|
@@ -6270,28 +6562,111 @@ var findConfigs = () => {
|
|
|
6270
6562
|
return configs.map((r) => r.instance.deref()).filter(nonNullable);
|
|
6271
6563
|
};
|
|
6272
6564
|
|
|
6273
|
-
// packages/sdk/client-services/src/packlets/
|
|
6274
|
-
import {
|
|
6565
|
+
// packages/sdk/client-services/src/packlets/identity/contacts-service.ts
|
|
6566
|
+
import { EventSubscriptions as EventSubscriptions4, scheduleTask as scheduleTask7, UpdateScheduler as UpdateScheduler2 } from "@dxos/async";
|
|
6275
6567
|
import { Stream as Stream12 } from "@dxos/codec-protobuf";
|
|
6276
6568
|
import { PublicKey as PublicKey15 } from "@dxos/keys";
|
|
6277
|
-
import {
|
|
6569
|
+
import { ComplexMap as ComplexMap4, ComplexSet as ComplexSet6 } from "@dxos/util";
|
|
6570
|
+
var ContactsServiceImpl = class {
|
|
6571
|
+
constructor(_identityManager, _spaceManager, _dataSpaceManagerProvider) {
|
|
6572
|
+
this._identityManager = _identityManager;
|
|
6573
|
+
this._spaceManager = _spaceManager;
|
|
6574
|
+
this._dataSpaceManagerProvider = _dataSpaceManagerProvider;
|
|
6575
|
+
}
|
|
6576
|
+
async getContacts() {
|
|
6577
|
+
const identity = this._identityManager.identity;
|
|
6578
|
+
if (identity == null) {
|
|
6579
|
+
return {
|
|
6580
|
+
contacts: []
|
|
6581
|
+
};
|
|
6582
|
+
}
|
|
6583
|
+
const contacts = [
|
|
6584
|
+
...this._spaceManager.spaces.values()
|
|
6585
|
+
].flatMap((s) => [
|
|
6586
|
+
...s.spaceState.members.values()
|
|
6587
|
+
].map((m) => [
|
|
6588
|
+
s.key,
|
|
6589
|
+
m
|
|
6590
|
+
])).reduce((acc, v) => {
|
|
6591
|
+
const [spaceKey, memberInfo] = v;
|
|
6592
|
+
if (memberInfo.key.equals(identity.identityKey)) {
|
|
6593
|
+
return acc;
|
|
6594
|
+
}
|
|
6595
|
+
const existing = acc.get(memberInfo.key);
|
|
6596
|
+
if (existing != null) {
|
|
6597
|
+
existing.profile ??= memberInfo.profile;
|
|
6598
|
+
existing.commonSpaces?.push(spaceKey);
|
|
6599
|
+
} else {
|
|
6600
|
+
acc.set(memberInfo.key, {
|
|
6601
|
+
identityKey: memberInfo.key,
|
|
6602
|
+
profile: memberInfo.profile,
|
|
6603
|
+
commonSpaces: [
|
|
6604
|
+
spaceKey
|
|
6605
|
+
]
|
|
6606
|
+
});
|
|
6607
|
+
}
|
|
6608
|
+
return acc;
|
|
6609
|
+
}, new ComplexMap4(PublicKey15.hash));
|
|
6610
|
+
return {
|
|
6611
|
+
contacts: [
|
|
6612
|
+
...contacts.values()
|
|
6613
|
+
]
|
|
6614
|
+
};
|
|
6615
|
+
}
|
|
6616
|
+
queryContacts() {
|
|
6617
|
+
const subscribedSpaceKeySet = new ComplexSet6(PublicKey15.hash);
|
|
6618
|
+
return new Stream12(({ next, ctx }) => {
|
|
6619
|
+
const pushUpdateTask = new UpdateScheduler2(ctx, async () => {
|
|
6620
|
+
const contacts = await this.getContacts();
|
|
6621
|
+
next(contacts);
|
|
6622
|
+
}, {
|
|
6623
|
+
maxFrequency: 2
|
|
6624
|
+
});
|
|
6625
|
+
scheduleTask7(ctx, async () => {
|
|
6626
|
+
const subscriptions = new EventSubscriptions4();
|
|
6627
|
+
ctx.onDispose(() => subscriptions.clear());
|
|
6628
|
+
const subscribeToSpaceAndUpdate = () => {
|
|
6629
|
+
const oldSetSize = subscribedSpaceKeySet.size;
|
|
6630
|
+
for (const space of this._spaceManager.spaces.values()) {
|
|
6631
|
+
if (!subscribedSpaceKeySet.has(space.key)) {
|
|
6632
|
+
subscriptions.add(space.stateUpdate.on(ctx, () => pushUpdateTask.trigger()));
|
|
6633
|
+
subscribedSpaceKeySet.add(space.key);
|
|
6634
|
+
}
|
|
6635
|
+
}
|
|
6636
|
+
if (oldSetSize !== subscribedSpaceKeySet.size) {
|
|
6637
|
+
pushUpdateTask.trigger();
|
|
6638
|
+
}
|
|
6639
|
+
};
|
|
6640
|
+
const unsubscribe = (await this._dataSpaceManagerProvider()).updated.on(ctx, subscribeToSpaceAndUpdate);
|
|
6641
|
+
ctx.onDispose(unsubscribe);
|
|
6642
|
+
subscribeToSpaceAndUpdate();
|
|
6643
|
+
});
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6646
|
+
};
|
|
6647
|
+
|
|
6648
|
+
// packages/sdk/client-services/src/packlets/logging/logging-service.ts
|
|
6649
|
+
import { Event as Event8 } from "@dxos/async";
|
|
6650
|
+
import { Stream as Stream13 } from "@dxos/codec-protobuf";
|
|
6651
|
+
import { PublicKey as PublicKey16 } from "@dxos/keys";
|
|
6652
|
+
import { getContextFromEntry, log as log21 } from "@dxos/log";
|
|
6278
6653
|
import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
|
|
6279
6654
|
import { getDebugName, jsonify, numericalValues, tracer } from "@dxos/util";
|
|
6280
6655
|
var LoggingServiceImpl = class {
|
|
6281
6656
|
constructor() {
|
|
6282
6657
|
this._logs = new Event8();
|
|
6283
6658
|
this._started = Date.now();
|
|
6284
|
-
this._sessionId =
|
|
6659
|
+
this._sessionId = PublicKey16.random().toHex();
|
|
6285
6660
|
this._logProcessor = (_config, entry2) => {
|
|
6286
6661
|
this._logs.emit(entry2);
|
|
6287
6662
|
};
|
|
6288
6663
|
}
|
|
6289
6664
|
async open() {
|
|
6290
|
-
|
|
6665
|
+
log21.runtimeConfig.processors.push(this._logProcessor);
|
|
6291
6666
|
}
|
|
6292
6667
|
async close() {
|
|
6293
|
-
const index =
|
|
6294
|
-
|
|
6668
|
+
const index = log21.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
6669
|
+
log21.runtimeConfig.processors.splice(index, 1);
|
|
6295
6670
|
}
|
|
6296
6671
|
async controlMetrics({ reset, record }) {
|
|
6297
6672
|
if (reset) {
|
|
@@ -6317,7 +6692,7 @@ var LoggingServiceImpl = class {
|
|
|
6317
6692
|
stats: numericalValues(events, "duration")
|
|
6318
6693
|
};
|
|
6319
6694
|
};
|
|
6320
|
-
return new
|
|
6695
|
+
return new Stream13(({ next }) => {
|
|
6321
6696
|
const update = () => {
|
|
6322
6697
|
const metrics = {
|
|
6323
6698
|
timestamp: /* @__PURE__ */ new Date(),
|
|
@@ -6339,7 +6714,7 @@ var LoggingServiceImpl = class {
|
|
|
6339
6714
|
});
|
|
6340
6715
|
}
|
|
6341
6716
|
queryLogs(request) {
|
|
6342
|
-
return new
|
|
6717
|
+
return new Stream13(({ ctx, next }) => {
|
|
6343
6718
|
const handler = (entry2) => {
|
|
6344
6719
|
if (LOG_PROCESSING > 0) {
|
|
6345
6720
|
return;
|
|
@@ -6395,14 +6770,14 @@ var shouldLog = (entry2, request) => {
|
|
|
6395
6770
|
var LOG_PROCESSING = 0;
|
|
6396
6771
|
|
|
6397
6772
|
// packages/sdk/client-services/src/packlets/network/network-service.ts
|
|
6398
|
-
import { Stream as
|
|
6773
|
+
import { Stream as Stream14 } from "@dxos/codec-protobuf";
|
|
6399
6774
|
var NetworkServiceImpl = class {
|
|
6400
6775
|
constructor(networkManager, signalManager) {
|
|
6401
6776
|
this.networkManager = networkManager;
|
|
6402
6777
|
this.signalManager = signalManager;
|
|
6403
6778
|
}
|
|
6404
6779
|
queryStatus() {
|
|
6405
|
-
return new
|
|
6780
|
+
return new Stream14(({ next }) => {
|
|
6406
6781
|
const update = () => {
|
|
6407
6782
|
next({
|
|
6408
6783
|
swarm: this.networkManager.connectionState,
|
|
@@ -6428,7 +6803,7 @@ var NetworkServiceImpl = class {
|
|
|
6428
6803
|
};
|
|
6429
6804
|
|
|
6430
6805
|
// packages/sdk/client-services/src/packlets/system/system-service.ts
|
|
6431
|
-
import { Stream as
|
|
6806
|
+
import { Stream as Stream15 } from "@dxos/codec-protobuf";
|
|
6432
6807
|
import { GetDiagnosticsRequest as GetDiagnosticsRequest2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
6433
6808
|
import { jsonKeyReplacer as jsonKeyReplacer2 } from "@dxos/util";
|
|
6434
6809
|
var SystemServiceImpl = class {
|
|
@@ -6464,7 +6839,7 @@ var SystemServiceImpl = class {
|
|
|
6464
6839
|
}
|
|
6465
6840
|
// TODO(burdon): Standardize interval option in stream request?
|
|
6466
6841
|
queryStatus({ interval = 3e3 } = {}) {
|
|
6467
|
-
return new
|
|
6842
|
+
return new Stream15(({ next }) => {
|
|
6468
6843
|
const update = () => {
|
|
6469
6844
|
next({
|
|
6470
6845
|
status: this._getCurrentStatus()
|
|
@@ -6495,7 +6870,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
6495
6870
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6496
6871
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6497
6872
|
}
|
|
6498
|
-
var
|
|
6873
|
+
var __dxlog_file25 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-host.ts";
|
|
6499
6874
|
var ClientServicesHost = class {
|
|
6500
6875
|
constructor({
|
|
6501
6876
|
config,
|
|
@@ -6528,7 +6903,10 @@ var ClientServicesHost = class {
|
|
|
6528
6903
|
lockKey,
|
|
6529
6904
|
onAcquire: () => {
|
|
6530
6905
|
if (!this._opening) {
|
|
6531
|
-
void this.open(new Context11(
|
|
6906
|
+
void this.open(new Context11(void 0, {
|
|
6907
|
+
F: __dxlog_file25,
|
|
6908
|
+
L: 121
|
|
6909
|
+
}));
|
|
6532
6910
|
}
|
|
6533
6911
|
},
|
|
6534
6912
|
onRelease: () => this.close()
|
|
@@ -6583,25 +6961,25 @@ var ClientServicesHost = class {
|
|
|
6583
6961
|
* Can only be called once.
|
|
6584
6962
|
*/
|
|
6585
6963
|
initialize({ config, ...options }) {
|
|
6586
|
-
|
|
6587
|
-
F:
|
|
6588
|
-
L:
|
|
6964
|
+
invariant19(!this._open, "service host is open", {
|
|
6965
|
+
F: __dxlog_file25,
|
|
6966
|
+
L: 187,
|
|
6589
6967
|
S: this,
|
|
6590
6968
|
A: [
|
|
6591
6969
|
"!this._open",
|
|
6592
6970
|
"'service host is open'"
|
|
6593
6971
|
]
|
|
6594
6972
|
});
|
|
6595
|
-
|
|
6596
|
-
F:
|
|
6597
|
-
L:
|
|
6973
|
+
log22("initializing...", void 0, {
|
|
6974
|
+
F: __dxlog_file25,
|
|
6975
|
+
L: 188,
|
|
6598
6976
|
S: this,
|
|
6599
6977
|
C: (f, a) => f(...a)
|
|
6600
6978
|
});
|
|
6601
6979
|
if (config) {
|
|
6602
|
-
|
|
6603
|
-
F:
|
|
6604
|
-
L:
|
|
6980
|
+
invariant19(!this._config, "config already set", {
|
|
6981
|
+
F: __dxlog_file25,
|
|
6982
|
+
L: 191,
|
|
6605
6983
|
S: this,
|
|
6606
6984
|
A: [
|
|
6607
6985
|
"!this._config",
|
|
@@ -6614,9 +6992,9 @@ var ClientServicesHost = class {
|
|
|
6614
6992
|
}
|
|
6615
6993
|
}
|
|
6616
6994
|
if (!options.signalManager) {
|
|
6617
|
-
|
|
6618
|
-
F:
|
|
6619
|
-
L:
|
|
6995
|
+
log22.warn("running signaling without telemetry metadata.", void 0, {
|
|
6996
|
+
F: __dxlog_file25,
|
|
6997
|
+
L: 199,
|
|
6620
6998
|
S: this,
|
|
6621
6999
|
C: (f, a) => f(...a)
|
|
6622
7000
|
});
|
|
@@ -6625,9 +7003,9 @@ var ClientServicesHost = class {
|
|
|
6625
7003
|
iceServers: this._config?.get("runtime.services.ice")
|
|
6626
7004
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
6627
7005
|
this._signalManager = signalManager;
|
|
6628
|
-
|
|
6629
|
-
F:
|
|
6630
|
-
L:
|
|
7006
|
+
invariant19(!this._networkManager, "network manager already set", {
|
|
7007
|
+
F: __dxlog_file25,
|
|
7008
|
+
L: 210,
|
|
6631
7009
|
S: this,
|
|
6632
7010
|
A: [
|
|
6633
7011
|
"!this._networkManager",
|
|
@@ -6639,9 +7017,9 @@ var ClientServicesHost = class {
|
|
|
6639
7017
|
transportFactory,
|
|
6640
7018
|
signalManager
|
|
6641
7019
|
});
|
|
6642
|
-
|
|
6643
|
-
F:
|
|
6644
|
-
L:
|
|
7020
|
+
log22("initialized", void 0, {
|
|
7021
|
+
F: __dxlog_file25,
|
|
7022
|
+
L: 217,
|
|
6645
7023
|
S: this,
|
|
6646
7024
|
C: (f, a) => f(...a)
|
|
6647
7025
|
});
|
|
@@ -6650,45 +7028,45 @@ var ClientServicesHost = class {
|
|
|
6650
7028
|
if (this._open) {
|
|
6651
7029
|
return;
|
|
6652
7030
|
}
|
|
6653
|
-
const traceId =
|
|
6654
|
-
|
|
7031
|
+
const traceId = PublicKey17.random().toHex();
|
|
7032
|
+
log22.trace("dxos.client-services.host.open", trace10.begin({
|
|
6655
7033
|
id: traceId
|
|
6656
7034
|
}), {
|
|
6657
|
-
F:
|
|
6658
|
-
L:
|
|
7035
|
+
F: __dxlog_file25,
|
|
7036
|
+
L: 228,
|
|
6659
7037
|
S: this,
|
|
6660
7038
|
C: (f, a) => f(...a)
|
|
6661
7039
|
});
|
|
6662
|
-
|
|
6663
|
-
F:
|
|
6664
|
-
L:
|
|
7040
|
+
invariant19(this._config, "config not set", {
|
|
7041
|
+
F: __dxlog_file25,
|
|
7042
|
+
L: 230,
|
|
6665
7043
|
S: this,
|
|
6666
7044
|
A: [
|
|
6667
7045
|
"this._config",
|
|
6668
7046
|
"'config not set'"
|
|
6669
7047
|
]
|
|
6670
7048
|
});
|
|
6671
|
-
|
|
6672
|
-
F:
|
|
6673
|
-
L:
|
|
7049
|
+
invariant19(this._storage, "storage not set", {
|
|
7050
|
+
F: __dxlog_file25,
|
|
7051
|
+
L: 231,
|
|
6674
7052
|
S: this,
|
|
6675
7053
|
A: [
|
|
6676
7054
|
"this._storage",
|
|
6677
7055
|
"'storage not set'"
|
|
6678
7056
|
]
|
|
6679
7057
|
});
|
|
6680
|
-
|
|
6681
|
-
F:
|
|
6682
|
-
L:
|
|
7058
|
+
invariant19(this._signalManager, "signal manager not set", {
|
|
7059
|
+
F: __dxlog_file25,
|
|
7060
|
+
L: 232,
|
|
6683
7061
|
S: this,
|
|
6684
7062
|
A: [
|
|
6685
7063
|
"this._signalManager",
|
|
6686
7064
|
"'signal manager not set'"
|
|
6687
7065
|
]
|
|
6688
7066
|
});
|
|
6689
|
-
|
|
6690
|
-
F:
|
|
6691
|
-
L:
|
|
7067
|
+
invariant19(this._networkManager, "network manager not set", {
|
|
7068
|
+
F: __dxlog_file25,
|
|
7069
|
+
L: 233,
|
|
6692
7070
|
S: this,
|
|
6693
7071
|
A: [
|
|
6694
7072
|
"this._networkManager",
|
|
@@ -6696,11 +7074,11 @@ var ClientServicesHost = class {
|
|
|
6696
7074
|
]
|
|
6697
7075
|
});
|
|
6698
7076
|
this._opening = true;
|
|
6699
|
-
|
|
7077
|
+
log22("opening...", {
|
|
6700
7078
|
lockKey: this._resourceLock?.lockKey
|
|
6701
7079
|
}, {
|
|
6702
|
-
F:
|
|
6703
|
-
L:
|
|
7080
|
+
F: __dxlog_file25,
|
|
7081
|
+
L: 236,
|
|
6704
7082
|
S: this,
|
|
6705
7083
|
C: (f, a) => f(...a)
|
|
6706
7084
|
});
|
|
@@ -6711,16 +7089,18 @@ var ClientServicesHost = class {
|
|
|
6711
7089
|
await this._level.open();
|
|
6712
7090
|
await this._loggingService.open();
|
|
6713
7091
|
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._runtimeParams);
|
|
7092
|
+
const dataSpaceManagerProvider = async () => {
|
|
7093
|
+
await this._serviceContext.initialized.wait();
|
|
7094
|
+
return this._serviceContext.dataSpaceManager;
|
|
7095
|
+
};
|
|
6714
7096
|
const identityService = new IdentityServiceImpl(this._serviceContext.identityManager, this._serviceContext.keyring, () => this._serviceContext.dataSpaceManager, (params) => this._createIdentity(params), (profile) => this._serviceContext.broadcastProfileUpdate(profile));
|
|
6715
7097
|
this._serviceRegistry.setServices({
|
|
6716
7098
|
SystemService: this._systemService,
|
|
6717
7099
|
IdentityService: identityService,
|
|
7100
|
+
ContactsService: new ContactsServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6718
7101
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitationsManager),
|
|
6719
7102
|
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
|
-
}),
|
|
7103
|
+
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
|
|
6724
7104
|
DataService: this._serviceContext.echoHost.dataService,
|
|
6725
7105
|
QueryService: this._serviceContext.echoHost.queryService,
|
|
6726
7106
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
@@ -6750,19 +7130,19 @@ var ClientServicesHost = class {
|
|
|
6750
7130
|
this._open = true;
|
|
6751
7131
|
this._statusUpdate.emit();
|
|
6752
7132
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6753
|
-
|
|
7133
|
+
log22("opened", {
|
|
6754
7134
|
deviceKey
|
|
6755
7135
|
}, {
|
|
6756
|
-
F:
|
|
6757
|
-
L:
|
|
7136
|
+
F: __dxlog_file25,
|
|
7137
|
+
L: 322,
|
|
6758
7138
|
S: this,
|
|
6759
7139
|
C: (f, a) => f(...a)
|
|
6760
7140
|
});
|
|
6761
|
-
|
|
7141
|
+
log22.trace("dxos.client-services.host.open", trace10.end({
|
|
6762
7142
|
id: traceId
|
|
6763
7143
|
}), {
|
|
6764
|
-
F:
|
|
6765
|
-
L:
|
|
7144
|
+
F: __dxlog_file25,
|
|
7145
|
+
L: 323,
|
|
6766
7146
|
S: this,
|
|
6767
7147
|
C: (f, a) => f(...a)
|
|
6768
7148
|
});
|
|
@@ -6772,11 +7152,11 @@ var ClientServicesHost = class {
|
|
|
6772
7152
|
return;
|
|
6773
7153
|
}
|
|
6774
7154
|
const deviceKey = this._serviceContext.identityManager.identity?.deviceKey;
|
|
6775
|
-
|
|
7155
|
+
log22("closing...", {
|
|
6776
7156
|
deviceKey
|
|
6777
7157
|
}, {
|
|
6778
|
-
F:
|
|
6779
|
-
L:
|
|
7158
|
+
F: __dxlog_file25,
|
|
7159
|
+
L: 334,
|
|
6780
7160
|
S: this,
|
|
6781
7161
|
C: (f, a) => f(...a)
|
|
6782
7162
|
});
|
|
@@ -6790,44 +7170,44 @@ var ClientServicesHost = class {
|
|
|
6790
7170
|
await this._level?.close();
|
|
6791
7171
|
this._open = false;
|
|
6792
7172
|
this._statusUpdate.emit();
|
|
6793
|
-
|
|
7173
|
+
log22("closed", {
|
|
6794
7174
|
deviceKey
|
|
6795
7175
|
}, {
|
|
6796
|
-
F:
|
|
6797
|
-
L:
|
|
7176
|
+
F: __dxlog_file25,
|
|
7177
|
+
L: 343,
|
|
6798
7178
|
S: this,
|
|
6799
7179
|
C: (f, a) => f(...a)
|
|
6800
7180
|
});
|
|
6801
7181
|
}
|
|
6802
7182
|
async reset() {
|
|
6803
|
-
const traceId =
|
|
6804
|
-
|
|
7183
|
+
const traceId = PublicKey17.random().toHex();
|
|
7184
|
+
log22.trace("dxos.sdk.client-services-host.reset", trace10.begin({
|
|
6805
7185
|
id: traceId
|
|
6806
7186
|
}), {
|
|
6807
|
-
F:
|
|
6808
|
-
L:
|
|
7187
|
+
F: __dxlog_file25,
|
|
7188
|
+
L: 348,
|
|
6809
7189
|
S: this,
|
|
6810
7190
|
C: (f, a) => f(...a)
|
|
6811
7191
|
});
|
|
6812
|
-
|
|
6813
|
-
F:
|
|
6814
|
-
L:
|
|
7192
|
+
log22.info("resetting...", void 0, {
|
|
7193
|
+
F: __dxlog_file25,
|
|
7194
|
+
L: 350,
|
|
6815
7195
|
S: this,
|
|
6816
7196
|
C: (f, a) => f(...a)
|
|
6817
7197
|
});
|
|
6818
7198
|
await this._serviceContext?.close();
|
|
6819
7199
|
await this._storage.reset();
|
|
6820
|
-
|
|
6821
|
-
F:
|
|
6822
|
-
L:
|
|
7200
|
+
log22.info("reset", void 0, {
|
|
7201
|
+
F: __dxlog_file25,
|
|
7202
|
+
L: 353,
|
|
6823
7203
|
S: this,
|
|
6824
7204
|
C: (f, a) => f(...a)
|
|
6825
7205
|
});
|
|
6826
|
-
|
|
7206
|
+
log22.trace("dxos.sdk.client-services-host.reset", trace10.end({
|
|
6827
7207
|
id: traceId
|
|
6828
7208
|
}), {
|
|
6829
|
-
F:
|
|
6830
|
-
L:
|
|
7209
|
+
F: __dxlog_file25,
|
|
7210
|
+
L: 354,
|
|
6831
7211
|
S: this,
|
|
6832
7212
|
C: (f, a) => f(...a)
|
|
6833
7213
|
});
|
|
@@ -6893,8 +7273,12 @@ export {
|
|
|
6893
7273
|
isLocked,
|
|
6894
7274
|
createStorageObjects,
|
|
6895
7275
|
createLevel,
|
|
7276
|
+
encodeProfileArchive,
|
|
7277
|
+
decodeProfileArchive,
|
|
7278
|
+
exportProfileData,
|
|
7279
|
+
importProfileData,
|
|
6896
7280
|
ClientServicesHost,
|
|
6897
7281
|
ClientServicesProviderResource,
|
|
6898
7282
|
DiagnosticsCollector
|
|
6899
7283
|
};
|
|
6900
|
-
//# sourceMappingURL=chunk-
|
|
7284
|
+
//# sourceMappingURL=chunk-3DXQACFA.mjs.map
|