@dxos/client-services 0.6.12-main.78ddbdf → 0.6.12-main.89e9959
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-XSFLJVDP.mjs → chunk-XVI3VSJT.mjs} +637 -292
- package/dist/lib/browser/chunk-XVI3VSJT.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +2 -2
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/node/{chunk-F3WGFGEN.cjs → chunk-NZL66D6K.cjs} +727 -382
- package/dist/lib/node/chunk-NZL66D6K.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node/testing/index.cjs.map +2 -2
- package/dist/lib/node-esm/{chunk-3HDLTAT2.mjs → chunk-6747X7GN.mjs} +637 -292
- package/dist/lib/node-esm/chunk-6747X7GN.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +2 -2
- package/dist/lib/node-esm/testing/index.mjs.map +2 -2
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +1 -0
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +4 -2
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +3 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +2 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +31 -6
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +38 -38
- package/src/packlets/identity/authenticator.ts +5 -2
- package/src/packlets/identity/contacts-service.ts +1 -1
- package/src/packlets/identity/identity.ts +4 -0
- package/src/packlets/services/service-context.ts +41 -17
- package/src/packlets/services/service-host.ts +7 -5
- package/src/packlets/spaces/data-space-manager.ts +5 -1
- package/src/packlets/spaces/data-space.ts +23 -4
- package/src/packlets/spaces/edge-feed-replicator.test.ts +22 -15
- package/src/packlets/spaces/edge-feed-replicator.ts +45 -25
- package/src/packlets/spaces/notarization-plugin.test.ts +8 -4
- package/src/packlets/spaces/notarization-plugin.ts +169 -29
- package/src/packlets/testing/test-builder.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-XSFLJVDP.mjs.map +0 -7
- package/dist/lib/node/chunk-F3WGFGEN.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-3HDLTAT2.mjs.map +0 -7
|
@@ -404,7 +404,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
404
404
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
405
405
|
|
|
406
406
|
// packages/sdk/client-services/src/version.ts
|
|
407
|
-
var DXOS_VERSION = "0.6.12-main.
|
|
407
|
+
var DXOS_VERSION = "0.6.12-main.89e9959";
|
|
408
408
|
|
|
409
409
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
410
410
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -755,7 +755,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
755
755
|
return false;
|
|
756
756
|
}
|
|
757
757
|
if (this._isTrustedKey(credential.issuer)) {
|
|
758
|
-
log3("key is
|
|
758
|
+
log3("key is trusted -- auth success", {
|
|
759
759
|
key: credential.issuer
|
|
760
760
|
}, {
|
|
761
761
|
F: __dxlog_file5,
|
|
@@ -782,7 +782,10 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
782
782
|
trigger.wake(true);
|
|
783
783
|
} else {
|
|
784
784
|
log3("key is not currently in trusted set, waiting...", {
|
|
785
|
-
key: credential.issuer
|
|
785
|
+
key: credential.issuer,
|
|
786
|
+
trusted: [
|
|
787
|
+
...this._params.trustedKeysProvider()
|
|
788
|
+
]
|
|
786
789
|
}, {
|
|
787
790
|
F: __dxlog_file5,
|
|
788
791
|
L: 84,
|
|
@@ -815,11 +818,17 @@ import { Context as Context3, Resource } from "@dxos/context";
|
|
|
815
818
|
import { EdgeConnectionClosedError, EdgeIdentityChangedError } from "@dxos/edge-client";
|
|
816
819
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
817
820
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
818
|
-
import { log as log4 } from "@dxos/log";
|
|
821
|
+
import { log as log4, logInfo } from "@dxos/log";
|
|
819
822
|
import { EdgeService } from "@dxos/protocols";
|
|
820
823
|
import { buf } from "@dxos/protocols/buf";
|
|
821
824
|
import { MessageSchema as RouterMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
822
825
|
import { ComplexMap as ComplexMap2, arrayToBuffer, bufferToArray, defaultMap, rangeFromTo } from "@dxos/util";
|
|
826
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
827
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
828
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
829
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
830
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
831
|
+
}
|
|
823
832
|
function _using_ctx() {
|
|
824
833
|
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
825
834
|
var err = new Error();
|
|
@@ -901,6 +910,12 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
901
910
|
this._spaceId = spaceId;
|
|
902
911
|
}
|
|
903
912
|
async _open() {
|
|
913
|
+
log4("open", void 0, {
|
|
914
|
+
F: __dxlog_file6,
|
|
915
|
+
L: 56,
|
|
916
|
+
S: this,
|
|
917
|
+
C: (f, a) => f(...a)
|
|
918
|
+
});
|
|
904
919
|
this._ctx.onDispose(this._messenger.addListener((message) => {
|
|
905
920
|
if (!message.serviceId) {
|
|
906
921
|
return;
|
|
@@ -916,20 +931,20 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
916
931
|
_spaceId: this._spaceId
|
|
917
932
|
}, {
|
|
918
933
|
F: __dxlog_file6,
|
|
919
|
-
L:
|
|
934
|
+
L: 70,
|
|
920
935
|
S: this,
|
|
921
936
|
C: (f, a) => f(...a)
|
|
922
937
|
});
|
|
923
938
|
return;
|
|
924
939
|
}
|
|
925
940
|
const payload = decodeCbor(message.payload.value);
|
|
926
|
-
log4
|
|
941
|
+
log4("receive", {
|
|
927
942
|
from: message.source,
|
|
928
943
|
feedKey: payload.feedKey,
|
|
929
944
|
type: payload.type
|
|
930
945
|
}, {
|
|
931
946
|
F: __dxlog_file6,
|
|
932
|
-
L:
|
|
947
|
+
L: 75,
|
|
933
948
|
S: this,
|
|
934
949
|
C: (f, a) => f(...a)
|
|
935
950
|
});
|
|
@@ -937,46 +952,44 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
937
952
|
}));
|
|
938
953
|
this._messenger.connected.on(this._ctx, async () => {
|
|
939
954
|
await this._resetConnection();
|
|
940
|
-
this.
|
|
941
|
-
const connectionCtx = new Context3({
|
|
942
|
-
onError: async (err) => {
|
|
943
|
-
if (connectionCtx !== this._connectionCtx) {
|
|
944
|
-
return;
|
|
945
|
-
}
|
|
946
|
-
if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
|
|
947
|
-
log4("resetting on reconnect", void 0, {
|
|
948
|
-
F: __dxlog_file6,
|
|
949
|
-
L: 86,
|
|
950
|
-
S: this,
|
|
951
|
-
C: (f, a) => f(...a)
|
|
952
|
-
});
|
|
953
|
-
await this._resetConnection();
|
|
954
|
-
} else {
|
|
955
|
-
this._ctx.raise(err);
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
}, {
|
|
959
|
-
F: __dxlog_file6,
|
|
960
|
-
L: 80
|
|
961
|
-
});
|
|
962
|
-
this._connectionCtx = connectionCtx;
|
|
963
|
-
log4("connection context created", void 0, {
|
|
964
|
-
F: __dxlog_file6,
|
|
965
|
-
L: 94,
|
|
966
|
-
S: this,
|
|
967
|
-
C: (f, a) => f(...a)
|
|
968
|
-
});
|
|
969
|
-
scheduleMicroTask(connectionCtx, async () => {
|
|
970
|
-
for (const feed of this._feeds.values()) {
|
|
971
|
-
await this._replicateFeed(connectionCtx, feed);
|
|
972
|
-
}
|
|
973
|
-
});
|
|
955
|
+
this._startReplication();
|
|
974
956
|
});
|
|
957
|
+
if (this._messenger.isConnected) {
|
|
958
|
+
this._startReplication();
|
|
959
|
+
}
|
|
975
960
|
}
|
|
976
961
|
async _close() {
|
|
962
|
+
log4("close", void 0, {
|
|
963
|
+
F: __dxlog_file6,
|
|
964
|
+
L: 91,
|
|
965
|
+
S: this,
|
|
966
|
+
C: (f, a) => f(...a)
|
|
967
|
+
});
|
|
977
968
|
await this._resetConnection();
|
|
978
969
|
}
|
|
970
|
+
_startReplication() {
|
|
971
|
+
this._connected = true;
|
|
972
|
+
const connectionCtx = this._createConnectionContext();
|
|
973
|
+
this._connectionCtx = connectionCtx;
|
|
974
|
+
log4("connection context created", void 0, {
|
|
975
|
+
F: __dxlog_file6,
|
|
976
|
+
L: 99,
|
|
977
|
+
S: this,
|
|
978
|
+
C: (f, a) => f(...a)
|
|
979
|
+
});
|
|
980
|
+
scheduleMicroTask(connectionCtx, async () => {
|
|
981
|
+
for (const feed of this._feeds.values()) {
|
|
982
|
+
await this._replicateFeed(connectionCtx, feed);
|
|
983
|
+
}
|
|
984
|
+
});
|
|
985
|
+
}
|
|
979
986
|
async _resetConnection() {
|
|
987
|
+
log4("resetConnection", void 0, {
|
|
988
|
+
F: __dxlog_file6,
|
|
989
|
+
L: 108,
|
|
990
|
+
S: this,
|
|
991
|
+
C: (f, a) => f(...a)
|
|
992
|
+
});
|
|
980
993
|
this._connected = false;
|
|
981
994
|
await this._connectionCtx?.dispose();
|
|
982
995
|
this._connectionCtx = void 0;
|
|
@@ -984,10 +997,12 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
984
997
|
}
|
|
985
998
|
async addFeed(feed) {
|
|
986
999
|
log4.info("addFeed", {
|
|
987
|
-
key: feed.key
|
|
1000
|
+
key: feed.key,
|
|
1001
|
+
connected: this._connected,
|
|
1002
|
+
hasConnectionCtx: !!this._connectionCtx
|
|
988
1003
|
}, {
|
|
989
1004
|
F: __dxlog_file6,
|
|
990
|
-
L:
|
|
1005
|
+
L: 116,
|
|
991
1006
|
S: this,
|
|
992
1007
|
C: (f, a) => f(...a)
|
|
993
1008
|
});
|
|
@@ -1000,6 +1015,14 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1000
1015
|
return defaultMap(this._pushMutex, key, () => new Mutex());
|
|
1001
1016
|
}
|
|
1002
1017
|
async _replicateFeed(ctx, feed) {
|
|
1018
|
+
log4("replicateFeed", {
|
|
1019
|
+
key: feed.key
|
|
1020
|
+
}, {
|
|
1021
|
+
F: __dxlog_file6,
|
|
1022
|
+
L: 129,
|
|
1023
|
+
S: this,
|
|
1024
|
+
C: (f, a) => f(...a)
|
|
1025
|
+
});
|
|
1003
1026
|
await this._sendMessage({
|
|
1004
1027
|
type: "get-metadata",
|
|
1005
1028
|
feedKey: feed.key.toHex()
|
|
@@ -1012,7 +1035,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1012
1035
|
if (!this._connectionCtx) {
|
|
1013
1036
|
log4.info("message dropped because connection was disposed", void 0, {
|
|
1014
1037
|
F: __dxlog_file6,
|
|
1015
|
-
L:
|
|
1038
|
+
L: 142,
|
|
1016
1039
|
S: this,
|
|
1017
1040
|
C: (f, a) => f(...a)
|
|
1018
1041
|
});
|
|
@@ -1026,13 +1049,13 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1026
1049
|
};
|
|
1027
1050
|
log4.info("sending message", logPayload, {
|
|
1028
1051
|
F: __dxlog_file6,
|
|
1029
|
-
L:
|
|
1052
|
+
L: 148,
|
|
1030
1053
|
S: this,
|
|
1031
1054
|
C: (f, a) => f(...a)
|
|
1032
1055
|
});
|
|
1033
1056
|
invariant2(message.feedKey, void 0, {
|
|
1034
1057
|
F: __dxlog_file6,
|
|
1035
|
-
L:
|
|
1058
|
+
L: 150,
|
|
1036
1059
|
S: this,
|
|
1037
1060
|
A: [
|
|
1038
1061
|
"message.feedKey",
|
|
@@ -1040,6 +1063,14 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1040
1063
|
]
|
|
1041
1064
|
});
|
|
1042
1065
|
const payloadValue = bufferToArray(encodeCbor(message));
|
|
1066
|
+
log4("send", {
|
|
1067
|
+
type: message.type
|
|
1068
|
+
}, {
|
|
1069
|
+
F: __dxlog_file6,
|
|
1070
|
+
L: 153,
|
|
1071
|
+
S: this,
|
|
1072
|
+
C: (f, a) => f(...a)
|
|
1073
|
+
});
|
|
1043
1074
|
await this._messenger.send(buf.create(RouterMessageSchema, {
|
|
1044
1075
|
source: {
|
|
1045
1076
|
identityKey: this._messenger.identityKey,
|
|
@@ -1055,7 +1086,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1055
1086
|
if (!this._connectionCtx) {
|
|
1056
1087
|
log4.warn("received message after connection context was disposed", void 0, {
|
|
1057
1088
|
F: __dxlog_file6,
|
|
1058
|
-
L:
|
|
1089
|
+
L: 168,
|
|
1059
1090
|
S: this,
|
|
1060
1091
|
C: (f, a) => f(...a)
|
|
1061
1092
|
});
|
|
@@ -1070,7 +1101,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1070
1101
|
message
|
|
1071
1102
|
}, {
|
|
1072
1103
|
F: __dxlog_file6,
|
|
1073
|
-
L:
|
|
1104
|
+
L: 174,
|
|
1074
1105
|
S: this,
|
|
1075
1106
|
C: (f, a) => f(...a)
|
|
1076
1107
|
});
|
|
@@ -1081,7 +1112,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1081
1112
|
feedKey
|
|
1082
1113
|
}, {
|
|
1083
1114
|
F: __dxlog_file6,
|
|
1084
|
-
L:
|
|
1115
|
+
L: 179,
|
|
1085
1116
|
S: this,
|
|
1086
1117
|
C: (f, a) => f(...a)
|
|
1087
1118
|
});
|
|
@@ -1114,7 +1145,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1114
1145
|
blocks: message.blocks.map((b) => b.index)
|
|
1115
1146
|
}, {
|
|
1116
1147
|
F: __dxlog_file6,
|
|
1117
|
-
L:
|
|
1148
|
+
L: 201,
|
|
1118
1149
|
S: this,
|
|
1119
1150
|
C: (f, a) => f(...a)
|
|
1120
1151
|
});
|
|
@@ -1125,7 +1156,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1125
1156
|
feedKey
|
|
1126
1157
|
}, {
|
|
1127
1158
|
F: __dxlog_file6,
|
|
1128
|
-
L:
|
|
1159
|
+
L: 206,
|
|
1129
1160
|
S: this,
|
|
1130
1161
|
C: (f, a) => f(...a)
|
|
1131
1162
|
});
|
|
@@ -1139,7 +1170,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1139
1170
|
...message
|
|
1140
1171
|
}, {
|
|
1141
1172
|
F: __dxlog_file6,
|
|
1142
|
-
L:
|
|
1173
|
+
L: 215,
|
|
1143
1174
|
S: this,
|
|
1144
1175
|
C: (f, a) => f(...a)
|
|
1145
1176
|
});
|
|
@@ -1154,7 +1185,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1154
1185
|
to
|
|
1155
1186
|
}, {
|
|
1156
1187
|
F: __dxlog_file6,
|
|
1157
|
-
L:
|
|
1188
|
+
L: 222,
|
|
1158
1189
|
S: this,
|
|
1159
1190
|
C: (f, a) => f(...a)
|
|
1160
1191
|
});
|
|
@@ -1164,7 +1195,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1164
1195
|
});
|
|
1165
1196
|
invariant2(data instanceof Uint8Array, void 0, {
|
|
1166
1197
|
F: __dxlog_file6,
|
|
1167
|
-
L:
|
|
1198
|
+
L: 227,
|
|
1168
1199
|
S: this,
|
|
1169
1200
|
A: [
|
|
1170
1201
|
"data instanceof Uint8Array",
|
|
@@ -1192,7 +1223,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1192
1223
|
blocks: blocks.length
|
|
1193
1224
|
}, {
|
|
1194
1225
|
F: __dxlog_file6,
|
|
1195
|
-
L:
|
|
1226
|
+
L: 248,
|
|
1196
1227
|
S: this,
|
|
1197
1228
|
C: (f, a) => f(...a)
|
|
1198
1229
|
});
|
|
@@ -1214,7 +1245,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1214
1245
|
if (!this._remoteLength.has(feed.key)) {
|
|
1215
1246
|
log4("blocks not pushed because remote length is unknown", void 0, {
|
|
1216
1247
|
F: __dxlog_file6,
|
|
1217
|
-
L:
|
|
1248
|
+
L: 269,
|
|
1218
1249
|
S: this,
|
|
1219
1250
|
C: (f, a) => f(...a)
|
|
1220
1251
|
});
|
|
@@ -1230,7 +1261,34 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1230
1261
|
_usingCtx.d();
|
|
1231
1262
|
}
|
|
1232
1263
|
}
|
|
1264
|
+
_createConnectionContext() {
|
|
1265
|
+
const connectionCtx = new Context3({
|
|
1266
|
+
onError: async (err) => {
|
|
1267
|
+
if (connectionCtx !== this._connectionCtx) {
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
|
|
1271
|
+
log4("resetting on reconnect", void 0, {
|
|
1272
|
+
F: __dxlog_file6,
|
|
1273
|
+
L: 286,
|
|
1274
|
+
S: this,
|
|
1275
|
+
C: (f, a) => f(...a)
|
|
1276
|
+
});
|
|
1277
|
+
await this._resetConnection();
|
|
1278
|
+
} else {
|
|
1279
|
+
this._ctx.raise(err);
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
}, {
|
|
1283
|
+
F: __dxlog_file6,
|
|
1284
|
+
L: 280
|
|
1285
|
+
});
|
|
1286
|
+
return connectionCtx;
|
|
1287
|
+
}
|
|
1233
1288
|
};
|
|
1289
|
+
_ts_decorate([
|
|
1290
|
+
logInfo
|
|
1291
|
+
], EdgeFeedReplicator.prototype, "_spaceId", void 0);
|
|
1234
1292
|
var bufferizeBlock = (block) => ({
|
|
1235
1293
|
index: block.index,
|
|
1236
1294
|
data: arrayToBuffer(block.data),
|
|
@@ -1245,7 +1303,7 @@ var bufferizeBlock = (block) => ({
|
|
|
1245
1303
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
1246
1304
|
import { Event as Event7, Mutex as Mutex2, scheduleTask as scheduleTask4, sleep as sleep3, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1247
1305
|
import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
1248
|
-
import { Context as
|
|
1306
|
+
import { Context as Context5, ContextDisposedError, cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
1249
1307
|
import { timed, warnAfterTimeout } from "@dxos/debug";
|
|
1250
1308
|
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
1251
1309
|
import { SpaceDocVersion as SpaceDocVersion3 } from "@dxos/echo-protocol";
|
|
@@ -1480,53 +1538,67 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
1480
1538
|
};
|
|
1481
1539
|
|
|
1482
1540
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
1483
|
-
import { DeferredTask, Event as Event3, scheduleTask as scheduleTask2, sleep, TimeoutError, Trigger as Trigger3 } from "@dxos/async";
|
|
1484
|
-
import {
|
|
1541
|
+
import { DeferredTask, Event as Event3, scheduleTask as scheduleTask2, sleep, TimeoutError, Trigger as Trigger3, scheduleMicroTask as scheduleMicroTask2 } from "@dxos/async";
|
|
1542
|
+
import { rejectOnDispose, Resource as Resource3 } from "@dxos/context";
|
|
1543
|
+
import { verifyCredential as verifyCredential2 } from "@dxos/credentials";
|
|
1485
1544
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1486
1545
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1487
|
-
import { log as log6 } from "@dxos/log";
|
|
1546
|
+
import { logInfo as logInfo2, log as log6 } from "@dxos/log";
|
|
1547
|
+
import { EdgeCallFailedError } from "@dxos/protocols";
|
|
1488
1548
|
import { schema as schema2 } from "@dxos/protocols/proto";
|
|
1489
1549
|
import { RpcExtension } from "@dxos/teleport";
|
|
1490
1550
|
import { ComplexMap as ComplexMap3, ComplexSet, entry } from "@dxos/util";
|
|
1551
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1552
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1553
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1554
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1555
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1556
|
+
}
|
|
1491
1557
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
1492
1558
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
1493
1559
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
1494
1560
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
1561
|
+
var MAX_EDGE_RETRIES = 2;
|
|
1495
1562
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
1496
|
-
var
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
L: 62
|
|
1501
|
-
});
|
|
1563
|
+
var credentialCodec = schema2.getCodecForType("dxos.halo.credentials.Credential");
|
|
1564
|
+
var NotarizationPlugin = class extends Resource3 {
|
|
1565
|
+
constructor(params) {
|
|
1566
|
+
super();
|
|
1502
1567
|
this._extensionOpened = new Event3();
|
|
1503
1568
|
this._extensions = /* @__PURE__ */ new Set();
|
|
1504
1569
|
this._processedCredentials = new ComplexSet(PublicKey4.hash);
|
|
1505
1570
|
this._processCredentialsTriggers = new ComplexMap3(PublicKey4.hash);
|
|
1571
|
+
this._spaceId = params.spaceId;
|
|
1572
|
+
if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
|
|
1573
|
+
this._edgeClient = params.edgeClient;
|
|
1574
|
+
}
|
|
1506
1575
|
}
|
|
1507
1576
|
get hasWriter() {
|
|
1508
1577
|
return !!this._writer;
|
|
1509
1578
|
}
|
|
1510
|
-
async
|
|
1579
|
+
async _open() {
|
|
1580
|
+
if (this._edgeClient && this._writer) {
|
|
1581
|
+
this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
|
|
1582
|
+
}
|
|
1511
1583
|
}
|
|
1512
|
-
async
|
|
1584
|
+
async _close() {
|
|
1513
1585
|
await this._ctx.dispose();
|
|
1514
1586
|
}
|
|
1515
1587
|
/**
|
|
1516
1588
|
* Request credentials to be notarized.
|
|
1517
1589
|
*/
|
|
1518
|
-
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
1590
|
+
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY, edgeRetryJitter }) {
|
|
1519
1591
|
log6("notarize", {
|
|
1520
1592
|
credentials
|
|
1521
1593
|
}, {
|
|
1522
1594
|
F: __dxlog_file8,
|
|
1523
|
-
L:
|
|
1595
|
+
L: 126,
|
|
1524
1596
|
S: this,
|
|
1525
1597
|
C: (f, a) => f(...a)
|
|
1526
1598
|
});
|
|
1527
1599
|
invariant4(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
1528
1600
|
F: __dxlog_file8,
|
|
1529
|
-
L:
|
|
1601
|
+
L: 127,
|
|
1530
1602
|
S: this,
|
|
1531
1603
|
A: [
|
|
1532
1604
|
"credentials.every((credential) => credential.id)",
|
|
@@ -1540,7 +1612,7 @@ var NotarizationPlugin = class {
|
|
|
1540
1612
|
err
|
|
1541
1613
|
}, {
|
|
1542
1614
|
F: __dxlog_file8,
|
|
1543
|
-
L:
|
|
1615
|
+
L: 135,
|
|
1544
1616
|
S: this,
|
|
1545
1617
|
C: (f, a) => f(...a)
|
|
1546
1618
|
});
|
|
@@ -1550,21 +1622,37 @@ var NotarizationPlugin = class {
|
|
|
1550
1622
|
});
|
|
1551
1623
|
opCtx?.onDispose(() => ctx.dispose());
|
|
1552
1624
|
if (timeout !== 0) {
|
|
1553
|
-
|
|
1554
|
-
log6.warn("Notarization timeout", {
|
|
1555
|
-
timeout,
|
|
1556
|
-
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1557
|
-
}, {
|
|
1558
|
-
F: __dxlog_file8,
|
|
1559
|
-
L: 111,
|
|
1560
|
-
S: this,
|
|
1561
|
-
C: (f, a) => f(...a)
|
|
1562
|
-
});
|
|
1563
|
-
void ctx.dispose();
|
|
1564
|
-
errors.throw(new TimeoutError(timeout, "Notarization timed out"));
|
|
1565
|
-
}, timeout);
|
|
1625
|
+
this._scheduleTimeout(ctx, errors, timeout);
|
|
1566
1626
|
}
|
|
1567
1627
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
1628
|
+
this._tryNotarizeCredentialsWithPeers(ctx, credentials, {
|
|
1629
|
+
retryTimeout,
|
|
1630
|
+
successDelay
|
|
1631
|
+
});
|
|
1632
|
+
if (this._edgeClient) {
|
|
1633
|
+
this._tryNotarizeCredentialsWithEdge(ctx, this._edgeClient, credentials, {
|
|
1634
|
+
retryTimeout,
|
|
1635
|
+
successDelay,
|
|
1636
|
+
jitter: edgeRetryJitter
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
try {
|
|
1640
|
+
await Promise.race([
|
|
1641
|
+
rejectOnDispose(ctx),
|
|
1642
|
+
allNotarized,
|
|
1643
|
+
errors.wait()
|
|
1644
|
+
]);
|
|
1645
|
+
log6("done", void 0, {
|
|
1646
|
+
F: __dxlog_file8,
|
|
1647
|
+
L: 160,
|
|
1648
|
+
S: this,
|
|
1649
|
+
C: (f, a) => f(...a)
|
|
1650
|
+
});
|
|
1651
|
+
} finally {
|
|
1652
|
+
await ctx.dispose();
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
_tryNotarizeCredentialsWithPeers(ctx, credentials, { retryTimeout, successDelay }) {
|
|
1568
1656
|
const peersTried = /* @__PURE__ */ new Set();
|
|
1569
1657
|
const notarizeTask = new DeferredTask(ctx, async () => {
|
|
1570
1658
|
try {
|
|
@@ -1579,7 +1667,7 @@ var NotarizationPlugin = class {
|
|
|
1579
1667
|
retryIn: retryTimeout
|
|
1580
1668
|
}, {
|
|
1581
1669
|
F: __dxlog_file8,
|
|
1582
|
-
L:
|
|
1670
|
+
L: 183,
|
|
1583
1671
|
S: this,
|
|
1584
1672
|
C: (f, a) => f(...a)
|
|
1585
1673
|
});
|
|
@@ -1593,7 +1681,7 @@ var NotarizationPlugin = class {
|
|
|
1593
1681
|
credentialId: credentials.map((credential) => credential.id)
|
|
1594
1682
|
}, {
|
|
1595
1683
|
F: __dxlog_file8,
|
|
1596
|
-
L:
|
|
1684
|
+
L: 190,
|
|
1597
1685
|
S: this,
|
|
1598
1686
|
C: (f, a) => f(...a)
|
|
1599
1687
|
});
|
|
@@ -1602,7 +1690,7 @@ var NotarizationPlugin = class {
|
|
|
1602
1690
|
});
|
|
1603
1691
|
log6("success", void 0, {
|
|
1604
1692
|
F: __dxlog_file8,
|
|
1605
|
-
L:
|
|
1693
|
+
L: 194,
|
|
1606
1694
|
S: this,
|
|
1607
1695
|
C: (f, a) => f(...a)
|
|
1608
1696
|
});
|
|
@@ -1611,7 +1699,7 @@ var NotarizationPlugin = class {
|
|
|
1611
1699
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
1612
1700
|
log6.info("error notarizing (recoverable)", err, {
|
|
1613
1701
|
F: __dxlog_file8,
|
|
1614
|
-
L:
|
|
1702
|
+
L: 199,
|
|
1615
1703
|
S: this,
|
|
1616
1704
|
C: (f, a) => f(...a)
|
|
1617
1705
|
});
|
|
@@ -1621,21 +1709,33 @@ var NotarizationPlugin = class {
|
|
|
1621
1709
|
});
|
|
1622
1710
|
notarizeTask.schedule();
|
|
1623
1711
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1712
|
+
}
|
|
1713
|
+
_tryNotarizeCredentialsWithEdge(ctx, client, credentials, timeouts) {
|
|
1714
|
+
const encodedCredentials = credentials.map((credential) => {
|
|
1715
|
+
const binary = credentialCodec.encode(credential);
|
|
1716
|
+
return Buffer.from(binary).toString("base64");
|
|
1717
|
+
});
|
|
1718
|
+
scheduleTask2(ctx, async () => {
|
|
1719
|
+
try {
|
|
1720
|
+
await client.notarizeCredentials(this._spaceId, {
|
|
1721
|
+
credentials: encodedCredentials
|
|
1722
|
+
}, {
|
|
1723
|
+
retry: {
|
|
1724
|
+
count: MAX_EDGE_RETRIES,
|
|
1725
|
+
timeout: timeouts.retryTimeout,
|
|
1726
|
+
jitter: timeouts.jitter
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
log6("edge notarization success", void 0, {
|
|
1730
|
+
F: __dxlog_file8,
|
|
1731
|
+
L: 227,
|
|
1732
|
+
S: this,
|
|
1733
|
+
C: (f, a) => f(...a)
|
|
1734
|
+
});
|
|
1735
|
+
} catch (error) {
|
|
1736
|
+
handleEdgeError(error);
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1639
1739
|
}
|
|
1640
1740
|
/**
|
|
1641
1741
|
* Called with credentials arriving from the control pipeline.
|
|
@@ -1651,7 +1751,7 @@ var NotarizationPlugin = class {
|
|
|
1651
1751
|
setWriter(writer) {
|
|
1652
1752
|
invariant4(!this._writer, "Writer already set.", {
|
|
1653
1753
|
F: __dxlog_file8,
|
|
1654
|
-
L:
|
|
1754
|
+
L: 247,
|
|
1655
1755
|
S: this,
|
|
1656
1756
|
A: [
|
|
1657
1757
|
"!this._writer",
|
|
@@ -1659,6 +1759,59 @@ var NotarizationPlugin = class {
|
|
|
1659
1759
|
]
|
|
1660
1760
|
});
|
|
1661
1761
|
this._writer = writer;
|
|
1762
|
+
if (this._edgeClient) {
|
|
1763
|
+
this._notarizePendingEdgeCredentials(this._edgeClient, writer);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* The method is used only for adding agent feeds to spaces.
|
|
1768
|
+
* When an agent is created we can admit them into all the existing spaces. In case the operation fails
|
|
1769
|
+
* this method will fix it on the next space open.
|
|
1770
|
+
* Given how rarely this happens there's no need to poll the endpoint.
|
|
1771
|
+
*/
|
|
1772
|
+
_notarizePendingEdgeCredentials(client, writer) {
|
|
1773
|
+
scheduleMicroTask2(this._ctx, async () => {
|
|
1774
|
+
try {
|
|
1775
|
+
const response = await client.getCredentialsForNotarization(this._spaceId, {
|
|
1776
|
+
retry: {
|
|
1777
|
+
count: MAX_EDGE_RETRIES
|
|
1778
|
+
}
|
|
1779
|
+
});
|
|
1780
|
+
const credentials = response.awaitingNotarization.credentials;
|
|
1781
|
+
if (!credentials.length) {
|
|
1782
|
+
log6("edge did not return credentials for notarization", void 0, {
|
|
1783
|
+
F: __dxlog_file8,
|
|
1784
|
+
L: 269,
|
|
1785
|
+
S: this,
|
|
1786
|
+
C: (f, a) => f(...a)
|
|
1787
|
+
});
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
log6("got edge credentials for notarization", {
|
|
1791
|
+
count: credentials.length
|
|
1792
|
+
}, {
|
|
1793
|
+
F: __dxlog_file8,
|
|
1794
|
+
L: 273,
|
|
1795
|
+
S: this,
|
|
1796
|
+
C: (f, a) => f(...a)
|
|
1797
|
+
});
|
|
1798
|
+
const decodedCredentials = credentials.map((credential) => {
|
|
1799
|
+
const binary = Buffer.from(credential, "base64");
|
|
1800
|
+
return credentialCodec.decode(binary);
|
|
1801
|
+
});
|
|
1802
|
+
await this._notarizeCredentials(writer, decodedCredentials);
|
|
1803
|
+
log6.info("notarized edge credentials", {
|
|
1804
|
+
count: decodedCredentials.length
|
|
1805
|
+
}, {
|
|
1806
|
+
F: __dxlog_file8,
|
|
1807
|
+
L: 282,
|
|
1808
|
+
S: this,
|
|
1809
|
+
C: (f, a) => f(...a)
|
|
1810
|
+
});
|
|
1811
|
+
} catch (error) {
|
|
1812
|
+
handleEdgeError(error);
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1662
1815
|
}
|
|
1663
1816
|
async _waitUntilProcessed(id) {
|
|
1664
1817
|
if (this._processedCredentials.has(id)) {
|
|
@@ -1673,10 +1826,13 @@ var NotarizationPlugin = class {
|
|
|
1673
1826
|
if (!this._writer) {
|
|
1674
1827
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
1675
1828
|
}
|
|
1676
|
-
|
|
1829
|
+
await this._notarizeCredentials(this._writer, request.credentials ?? []);
|
|
1830
|
+
}
|
|
1831
|
+
async _notarizeCredentials(writer, credentials) {
|
|
1832
|
+
for (const credential of credentials) {
|
|
1677
1833
|
invariant4(credential.id, "Credential must have an id", {
|
|
1678
1834
|
F: __dxlog_file8,
|
|
1679
|
-
L:
|
|
1835
|
+
L: 308,
|
|
1680
1836
|
S: this,
|
|
1681
1837
|
A: [
|
|
1682
1838
|
"credential.id",
|
|
@@ -1686,7 +1842,11 @@ var NotarizationPlugin = class {
|
|
|
1686
1842
|
if (this._processedCredentials.has(credential.id)) {
|
|
1687
1843
|
continue;
|
|
1688
1844
|
}
|
|
1689
|
-
await
|
|
1845
|
+
const verificationResult = await verifyCredential2(credential);
|
|
1846
|
+
if (verificationResult.kind === "fail") {
|
|
1847
|
+
throw new Error(`Credential verification failed: ${verificationResult.errors.join("\n")}.`);
|
|
1848
|
+
}
|
|
1849
|
+
await writer.write(credential);
|
|
1690
1850
|
}
|
|
1691
1851
|
}
|
|
1692
1852
|
createExtension() {
|
|
@@ -1696,7 +1856,7 @@ var NotarizationPlugin = class {
|
|
|
1696
1856
|
peer: extension.localPeerId
|
|
1697
1857
|
}, {
|
|
1698
1858
|
F: __dxlog_file8,
|
|
1699
|
-
L:
|
|
1859
|
+
L: 323,
|
|
1700
1860
|
S: this,
|
|
1701
1861
|
C: (f, a) => f(...a)
|
|
1702
1862
|
});
|
|
@@ -1708,7 +1868,7 @@ var NotarizationPlugin = class {
|
|
|
1708
1868
|
peer: extension.localPeerId
|
|
1709
1869
|
}, {
|
|
1710
1870
|
F: __dxlog_file8,
|
|
1711
|
-
L:
|
|
1871
|
+
L: 328,
|
|
1712
1872
|
S: this,
|
|
1713
1873
|
C: (f, a) => f(...a)
|
|
1714
1874
|
});
|
|
@@ -1718,6 +1878,43 @@ var NotarizationPlugin = class {
|
|
|
1718
1878
|
});
|
|
1719
1879
|
return extension;
|
|
1720
1880
|
}
|
|
1881
|
+
_scheduleTimeout(ctx, errors, timeout) {
|
|
1882
|
+
scheduleTask2(ctx, () => {
|
|
1883
|
+
log6.warn("Notarization timeout", {
|
|
1884
|
+
timeout,
|
|
1885
|
+
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1886
|
+
}, {
|
|
1887
|
+
F: __dxlog_file8,
|
|
1888
|
+
L: 340,
|
|
1889
|
+
S: this,
|
|
1890
|
+
C: (f, a) => f(...a)
|
|
1891
|
+
});
|
|
1892
|
+
void ctx.dispose();
|
|
1893
|
+
errors.throw(new TimeoutError(timeout, "Notarization timed out"));
|
|
1894
|
+
}, timeout);
|
|
1895
|
+
}
|
|
1896
|
+
};
|
|
1897
|
+
_ts_decorate2([
|
|
1898
|
+
logInfo2
|
|
1899
|
+
], NotarizationPlugin.prototype, "_spaceId", void 0);
|
|
1900
|
+
var handleEdgeError = (error) => {
|
|
1901
|
+
if (!(error instanceof EdgeCallFailedError) || error.errorData) {
|
|
1902
|
+
log6.catch(error, void 0, {
|
|
1903
|
+
F: __dxlog_file8,
|
|
1904
|
+
L: 354,
|
|
1905
|
+
S: void 0,
|
|
1906
|
+
C: (f, a) => f(...a)
|
|
1907
|
+
});
|
|
1908
|
+
} else {
|
|
1909
|
+
log6.info("Edge notarization failure", {
|
|
1910
|
+
reason: error.reason
|
|
1911
|
+
}, {
|
|
1912
|
+
F: __dxlog_file8,
|
|
1913
|
+
L: 356,
|
|
1914
|
+
S: void 0,
|
|
1915
|
+
C: (f, a) => f(...a)
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1721
1918
|
};
|
|
1722
1919
|
var NotarizationTeleportExtension = class extends RpcExtension {
|
|
1723
1920
|
constructor(_params) {
|
|
@@ -1812,7 +2009,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1812
2009
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
1813
2010
|
import { Event as Event4, synchronized, trackLeaks } from "@dxos/async";
|
|
1814
2011
|
import { PropertiesType } from "@dxos/client-protocol";
|
|
1815
|
-
import { LifecycleState, Resource as
|
|
2012
|
+
import { LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/context";
|
|
1816
2013
|
import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
1817
2014
|
import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
1818
2015
|
import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
|
|
@@ -1899,7 +2096,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
1899
2096
|
};
|
|
1900
2097
|
|
|
1901
2098
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
1902
|
-
function
|
|
2099
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
1903
2100
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1904
2101
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1905
2102
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1909,13 +2106,14 @@ var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
1909
2106
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1910
2107
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1911
2108
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
1912
|
-
var DataSpaceManager = class extends
|
|
2109
|
+
var DataSpaceManager = class extends Resource4 {
|
|
1913
2110
|
constructor(params) {
|
|
1914
2111
|
super();
|
|
1915
2112
|
this.updated = new Event4();
|
|
1916
2113
|
this._spaces = new ComplexMap4(PublicKey5.hash);
|
|
1917
2114
|
this._instanceId = PublicKey5.random().toHex();
|
|
1918
2115
|
this._edgeConnection = void 0;
|
|
2116
|
+
this._edgeHttpClient = void 0;
|
|
1919
2117
|
this._edgeFeatures = void 0;
|
|
1920
2118
|
this._meshReplicator = void 0;
|
|
1921
2119
|
this._echoEdgeReplicator = void 0;
|
|
@@ -1931,6 +2129,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1931
2129
|
this._edgeConnection = params.edgeConnection;
|
|
1932
2130
|
this._edgeFeatures = params.edgeFeatures;
|
|
1933
2131
|
this._echoEdgeReplicator = params.echoEdgeReplicator;
|
|
2132
|
+
this._edgeHttpClient = params.edgeHttpClient;
|
|
1934
2133
|
this._runtimeParams = params.runtimeParams;
|
|
1935
2134
|
trace.diagnostic({
|
|
1936
2135
|
id: "spaces",
|
|
@@ -1962,7 +2161,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1962
2161
|
async _open() {
|
|
1963
2162
|
log8("open", void 0, {
|
|
1964
2163
|
F: __dxlog_file10,
|
|
1965
|
-
L:
|
|
2164
|
+
L: 198,
|
|
1966
2165
|
S: this,
|
|
1967
2166
|
C: (f, a) => f(...a)
|
|
1968
2167
|
});
|
|
@@ -1970,7 +2169,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1970
2169
|
id: this._instanceId
|
|
1971
2170
|
}), {
|
|
1972
2171
|
F: __dxlog_file10,
|
|
1973
|
-
L:
|
|
2172
|
+
L: 199,
|
|
1974
2173
|
S: this,
|
|
1975
2174
|
C: (f, a) => f(...a)
|
|
1976
2175
|
});
|
|
@@ -1978,7 +2177,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1978
2177
|
spaces: this._metadataStore.spaces.length
|
|
1979
2178
|
}, {
|
|
1980
2179
|
F: __dxlog_file10,
|
|
1981
|
-
L:
|
|
2180
|
+
L: 200,
|
|
1982
2181
|
S: this,
|
|
1983
2182
|
C: (f, a) => f(...a)
|
|
1984
2183
|
});
|
|
@@ -1988,7 +2187,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1988
2187
|
spaceMetadata
|
|
1989
2188
|
}, {
|
|
1990
2189
|
F: __dxlog_file10,
|
|
1991
|
-
L:
|
|
2190
|
+
L: 204,
|
|
1992
2191
|
S: this,
|
|
1993
2192
|
C: (f, a) => f(...a)
|
|
1994
2193
|
});
|
|
@@ -1999,7 +2198,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1999
2198
|
err
|
|
2000
2199
|
}, {
|
|
2001
2200
|
F: __dxlog_file10,
|
|
2002
|
-
L:
|
|
2201
|
+
L: 207,
|
|
2003
2202
|
S: this,
|
|
2004
2203
|
C: (f, a) => f(...a)
|
|
2005
2204
|
});
|
|
@@ -2010,7 +2209,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2010
2209
|
id: this._instanceId
|
|
2011
2210
|
}), {
|
|
2012
2211
|
F: __dxlog_file10,
|
|
2013
|
-
L:
|
|
2212
|
+
L: 213,
|
|
2014
2213
|
S: this,
|
|
2015
2214
|
C: (f, a) => f(...a)
|
|
2016
2215
|
});
|
|
@@ -2018,7 +2217,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2018
2217
|
async _close() {
|
|
2019
2218
|
log8("close", void 0, {
|
|
2020
2219
|
F: __dxlog_file10,
|
|
2021
|
-
L:
|
|
2220
|
+
L: 218,
|
|
2022
2221
|
S: this,
|
|
2023
2222
|
C: (f, a) => f(...a)
|
|
2024
2223
|
});
|
|
@@ -2033,7 +2232,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2033
2232
|
async createSpace() {
|
|
2034
2233
|
invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
2035
2234
|
F: __dxlog_file10,
|
|
2036
|
-
L:
|
|
2235
|
+
L: 230,
|
|
2037
2236
|
S: this,
|
|
2038
2237
|
A: [
|
|
2039
2238
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2054,7 +2253,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2054
2253
|
spaceKey
|
|
2055
2254
|
}, {
|
|
2056
2255
|
F: __dxlog_file10,
|
|
2057
|
-
L:
|
|
2256
|
+
L: 242,
|
|
2058
2257
|
S: this,
|
|
2059
2258
|
C: (f, a) => f(...a)
|
|
2060
2259
|
});
|
|
@@ -2066,7 +2265,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2066
2265
|
const memberCredential = credentials[1];
|
|
2067
2266
|
invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2068
2267
|
F: __dxlog_file10,
|
|
2069
|
-
L:
|
|
2268
|
+
L: 252,
|
|
2070
2269
|
S: this,
|
|
2071
2270
|
A: [
|
|
2072
2271
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2098,7 +2297,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2098
2297
|
spaceId: space.id
|
|
2099
2298
|
}, {
|
|
2100
2299
|
F: __dxlog_file10,
|
|
2101
|
-
L:
|
|
2300
|
+
L: 277,
|
|
2102
2301
|
S: this,
|
|
2103
2302
|
C: (f, a) => f(...a)
|
|
2104
2303
|
});
|
|
@@ -2133,7 +2332,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2133
2332
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
2134
2333
|
invariant5(automergeIndex, void 0, {
|
|
2135
2334
|
F: __dxlog_file10,
|
|
2136
|
-
L:
|
|
2335
|
+
L: 310,
|
|
2137
2336
|
S: this,
|
|
2138
2337
|
A: [
|
|
2139
2338
|
"automergeIndex",
|
|
@@ -2150,13 +2349,13 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2150
2349
|
opts
|
|
2151
2350
|
}, {
|
|
2152
2351
|
F: __dxlog_file10,
|
|
2153
|
-
L:
|
|
2352
|
+
L: 319,
|
|
2154
2353
|
S: this,
|
|
2155
2354
|
C: (f, a) => f(...a)
|
|
2156
2355
|
});
|
|
2157
2356
|
invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
2158
2357
|
F: __dxlog_file10,
|
|
2159
|
-
L:
|
|
2358
|
+
L: 320,
|
|
2160
2359
|
S: this,
|
|
2161
2360
|
A: [
|
|
2162
2361
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2165,7 +2364,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2165
2364
|
});
|
|
2166
2365
|
invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
2167
2366
|
F: __dxlog_file10,
|
|
2168
|
-
L:
|
|
2367
|
+
L: 321,
|
|
2169
2368
|
S: this,
|
|
2170
2369
|
A: [
|
|
2171
2370
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -2189,7 +2388,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2189
2388
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
2190
2389
|
invariant5(space, void 0, {
|
|
2191
2390
|
F: __dxlog_file10,
|
|
2192
|
-
L:
|
|
2391
|
+
L: 341,
|
|
2193
2392
|
S: this,
|
|
2194
2393
|
A: [
|
|
2195
2394
|
"space",
|
|
@@ -2202,7 +2401,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2202
2401
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
2203
2402
|
invariant5(credentials[0].credential, void 0, {
|
|
2204
2403
|
F: __dxlog_file10,
|
|
2205
|
-
L:
|
|
2404
|
+
L: 360,
|
|
2206
2405
|
S: this,
|
|
2207
2406
|
A: [
|
|
2208
2407
|
"credentials[0].credential",
|
|
@@ -2212,7 +2411,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2212
2411
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2213
2412
|
invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2214
2413
|
F: __dxlog_file10,
|
|
2215
|
-
L:
|
|
2414
|
+
L: 362,
|
|
2216
2415
|
S: this,
|
|
2217
2416
|
A: [
|
|
2218
2417
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2251,7 +2450,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2251
2450
|
metadata
|
|
2252
2451
|
}, {
|
|
2253
2452
|
F: __dxlog_file10,
|
|
2254
|
-
L:
|
|
2453
|
+
L: 398,
|
|
2255
2454
|
S: this,
|
|
2256
2455
|
C: (f, a) => f(...a)
|
|
2257
2456
|
});
|
|
@@ -2295,7 +2494,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2295
2494
|
err
|
|
2296
2495
|
}, {
|
|
2297
2496
|
F: __dxlog_file10,
|
|
2298
|
-
L:
|
|
2497
|
+
L: 440,
|
|
2299
2498
|
S: this,
|
|
2300
2499
|
C: (f, a) => f(...a)
|
|
2301
2500
|
});
|
|
@@ -2305,7 +2504,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2305
2504
|
onAuthFailure: () => {
|
|
2306
2505
|
log8.warn("auth failure", void 0, {
|
|
2307
2506
|
F: __dxlog_file10,
|
|
2308
|
-
L:
|
|
2507
|
+
L: 445,
|
|
2309
2508
|
S: this,
|
|
2310
2509
|
C: (f, a) => f(...a)
|
|
2311
2510
|
});
|
|
@@ -2338,7 +2537,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2338
2537
|
space: space.key
|
|
2339
2538
|
}, {
|
|
2340
2539
|
F: __dxlog_file10,
|
|
2341
|
-
L:
|
|
2540
|
+
L: 472,
|
|
2342
2541
|
S: this,
|
|
2343
2542
|
C: (f, a) => f(...a)
|
|
2344
2543
|
});
|
|
@@ -2349,7 +2548,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2349
2548
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
2350
2549
|
}, {
|
|
2351
2550
|
F: __dxlog_file10,
|
|
2352
|
-
L:
|
|
2551
|
+
L: 475,
|
|
2353
2552
|
S: this,
|
|
2354
2553
|
C: (f, a) => f(...a)
|
|
2355
2554
|
});
|
|
@@ -2368,7 +2567,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2368
2567
|
space: space.key
|
|
2369
2568
|
}, {
|
|
2370
2569
|
F: __dxlog_file10,
|
|
2371
|
-
L:
|
|
2570
|
+
L: 483,
|
|
2372
2571
|
S: this,
|
|
2373
2572
|
C: (f, a) => f(...a)
|
|
2374
2573
|
});
|
|
@@ -2376,6 +2575,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2376
2575
|
},
|
|
2377
2576
|
cache: metadata.cache,
|
|
2378
2577
|
edgeConnection: this._edgeConnection,
|
|
2578
|
+
edgeHttpClient: this._edgeHttpClient,
|
|
2379
2579
|
edgeFeatures: this._edgeFeatures
|
|
2380
2580
|
});
|
|
2381
2581
|
dataSpace.postOpen.append(async () => {
|
|
@@ -2402,7 +2602,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2402
2602
|
space: space.key
|
|
2403
2603
|
}, {
|
|
2404
2604
|
F: __dxlog_file10,
|
|
2405
|
-
L:
|
|
2605
|
+
L: 515,
|
|
2406
2606
|
S: this,
|
|
2407
2607
|
C: (f, a) => f(...a)
|
|
2408
2608
|
});
|
|
@@ -2435,7 +2635,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2435
2635
|
closedSessions
|
|
2436
2636
|
}, {
|
|
2437
2637
|
F: __dxlog_file10,
|
|
2438
|
-
L:
|
|
2638
|
+
L: 541,
|
|
2439
2639
|
S: this,
|
|
2440
2640
|
C: (f, a) => f(...a)
|
|
2441
2641
|
});
|
|
@@ -2450,7 +2650,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2450
2650
|
peerId: peerState.peerId
|
|
2451
2651
|
}, {
|
|
2452
2652
|
F: __dxlog_file10,
|
|
2453
|
-
L:
|
|
2653
|
+
L: 555,
|
|
2454
2654
|
S: this,
|
|
2455
2655
|
C: (f, a) => f(...a)
|
|
2456
2656
|
});
|
|
@@ -2494,19 +2694,19 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2494
2694
|
await Promise.all(tasks);
|
|
2495
2695
|
}
|
|
2496
2696
|
};
|
|
2497
|
-
|
|
2697
|
+
_ts_decorate3([
|
|
2498
2698
|
synchronized
|
|
2499
2699
|
], DataSpaceManager.prototype, "_open", null);
|
|
2500
|
-
|
|
2700
|
+
_ts_decorate3([
|
|
2501
2701
|
synchronized
|
|
2502
2702
|
], DataSpaceManager.prototype, "_close", null);
|
|
2503
|
-
|
|
2703
|
+
_ts_decorate3([
|
|
2504
2704
|
synchronized
|
|
2505
2705
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
2506
|
-
|
|
2706
|
+
_ts_decorate3([
|
|
2507
2707
|
synchronized
|
|
2508
2708
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
2509
|
-
DataSpaceManager =
|
|
2709
|
+
DataSpaceManager = _ts_decorate3([
|
|
2510
2710
|
trackLeaks("open", "close")
|
|
2511
2711
|
], DataSpaceManager);
|
|
2512
2712
|
|
|
@@ -2851,7 +3051,7 @@ var SpacesServiceImpl = class {
|
|
|
2851
3051
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
2852
3052
|
|
|
2853
3053
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
2854
|
-
function
|
|
3054
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
2855
3055
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2856
3056
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2857
3057
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -2960,6 +3160,9 @@ var Identity = class {
|
|
|
2960
3160
|
get presence() {
|
|
2961
3161
|
return this._presence;
|
|
2962
3162
|
}
|
|
3163
|
+
get signer() {
|
|
3164
|
+
return this._signer;
|
|
3165
|
+
}
|
|
2963
3166
|
/**
|
|
2964
3167
|
* Issues credentials as identity.
|
|
2965
3168
|
* Requires identity to be ready.
|
|
@@ -2967,7 +3170,7 @@ var Identity = class {
|
|
|
2967
3170
|
getIdentityCredentialSigner() {
|
|
2968
3171
|
invariant7(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
2969
3172
|
F: __dxlog_file12,
|
|
2970
|
-
L:
|
|
3173
|
+
L: 189,
|
|
2971
3174
|
S: this,
|
|
2972
3175
|
A: [
|
|
2973
3176
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -3011,7 +3214,7 @@ var Identity = class {
|
|
|
3011
3214
|
dataFeedKey
|
|
3012
3215
|
}, {
|
|
3013
3216
|
F: __dxlog_file12,
|
|
3014
|
-
L:
|
|
3217
|
+
L: 214,
|
|
3015
3218
|
S: this,
|
|
3016
3219
|
C: (f, a) => f(...a)
|
|
3017
3220
|
});
|
|
@@ -3052,20 +3255,20 @@ var Identity = class {
|
|
|
3052
3255
|
})));
|
|
3053
3256
|
}
|
|
3054
3257
|
};
|
|
3055
|
-
|
|
3258
|
+
_ts_decorate4([
|
|
3056
3259
|
trace3.span()
|
|
3057
3260
|
], Identity.prototype, "open", null);
|
|
3058
|
-
|
|
3261
|
+
_ts_decorate4([
|
|
3059
3262
|
trace3.span()
|
|
3060
3263
|
], Identity.prototype, "close", null);
|
|
3061
|
-
Identity =
|
|
3264
|
+
Identity = _ts_decorate4([
|
|
3062
3265
|
trace3.resource()
|
|
3063
3266
|
], Identity);
|
|
3064
3267
|
|
|
3065
3268
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
3066
3269
|
import platform from "platform";
|
|
3067
3270
|
import { Event as Event6 } from "@dxos/async";
|
|
3068
|
-
import { Context as
|
|
3271
|
+
import { Context as Context4 } from "@dxos/context";
|
|
3069
3272
|
import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
|
|
3070
3273
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
3071
3274
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
@@ -3077,7 +3280,7 @@ import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extensi
|
|
|
3077
3280
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
3078
3281
|
import { trace as Trace2 } from "@dxos/tracing";
|
|
3079
3282
|
import { isNode, deferFunction as deferFunction2 } from "@dxos/util";
|
|
3080
|
-
function
|
|
3283
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
3081
3284
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3082
3285
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3083
3286
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -3147,7 +3350,7 @@ var IdentityManager = class {
|
|
|
3147
3350
|
});
|
|
3148
3351
|
}
|
|
3149
3352
|
async close() {
|
|
3150
|
-
await this._identity?.close(new
|
|
3353
|
+
await this._identity?.close(new Context4(void 0, {
|
|
3151
3354
|
F: __dxlog_file13,
|
|
3152
3355
|
L: 140
|
|
3153
3356
|
}));
|
|
@@ -3180,7 +3383,7 @@ var IdentityManager = class {
|
|
|
3180
3383
|
}
|
|
3181
3384
|
};
|
|
3182
3385
|
const identity = await this._constructIdentity(identityRecord);
|
|
3183
|
-
await identity.open(new
|
|
3386
|
+
await identity.open(new Context4(void 0, {
|
|
3184
3387
|
F: __dxlog_file13,
|
|
3185
3388
|
L: 161
|
|
3186
3389
|
}));
|
|
@@ -3309,7 +3512,7 @@ var IdentityManager = class {
|
|
|
3309
3512
|
}
|
|
3310
3513
|
};
|
|
3311
3514
|
const identity = await this._constructIdentity(identityRecord);
|
|
3312
|
-
await identity.open(new
|
|
3515
|
+
await identity.open(new Context4(void 0, {
|
|
3313
3516
|
F: __dxlog_file13,
|
|
3314
3517
|
L: 268
|
|
3315
3518
|
}));
|
|
@@ -3528,19 +3731,19 @@ var IdentityManager = class {
|
|
|
3528
3731
|
});
|
|
3529
3732
|
}
|
|
3530
3733
|
};
|
|
3531
|
-
|
|
3734
|
+
_ts_decorate5([
|
|
3532
3735
|
Trace2.span({
|
|
3533
3736
|
showInBrowserTimeline: true
|
|
3534
3737
|
})
|
|
3535
3738
|
], IdentityManager.prototype, "open", null);
|
|
3536
|
-
IdentityManager =
|
|
3739
|
+
IdentityManager = _ts_decorate5([
|
|
3537
3740
|
Trace2.resource()
|
|
3538
3741
|
], IdentityManager);
|
|
3539
3742
|
|
|
3540
3743
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
3541
3744
|
import { Trigger as Trigger4, sleep as sleep2 } from "@dxos/async";
|
|
3542
3745
|
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
3543
|
-
import { Resource as
|
|
3746
|
+
import { Resource as Resource5 } from "@dxos/context";
|
|
3544
3747
|
import { signPresentation } from "@dxos/credentials";
|
|
3545
3748
|
import { todo } from "@dxos/debug";
|
|
3546
3749
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
@@ -3549,7 +3752,7 @@ import { SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/ser
|
|
|
3549
3752
|
import { safeAwaitAll } from "@dxos/util";
|
|
3550
3753
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
3551
3754
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
3552
|
-
var IdentityServiceImpl = class extends
|
|
3755
|
+
var IdentityServiceImpl = class extends Resource5 {
|
|
3553
3756
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
3554
3757
|
super();
|
|
3555
3758
|
this._identityManager = _identityManager;
|
|
@@ -3693,7 +3896,7 @@ var IdentityServiceImpl = class extends Resource4 {
|
|
|
3693
3896
|
};
|
|
3694
3897
|
|
|
3695
3898
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
3696
|
-
function
|
|
3899
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
3697
3900
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3698
3901
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3699
3902
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -3764,11 +3967,10 @@ function _using_ctx2() {
|
|
|
3764
3967
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3765
3968
|
var DataSpace = class {
|
|
3766
3969
|
constructor(params) {
|
|
3767
|
-
this._ctx = new
|
|
3970
|
+
this._ctx = new Context5(void 0, {
|
|
3768
3971
|
F: __dxlog_file15,
|
|
3769
|
-
L:
|
|
3972
|
+
L: 95
|
|
3770
3973
|
});
|
|
3771
|
-
this._notarizationPlugin = new NotarizationPlugin();
|
|
3772
3974
|
this._cache = void 0;
|
|
3773
3975
|
this._edgeFeedReplicator = void 0;
|
|
3774
3976
|
// TODO(dmaretskyi): Move into Space?
|
|
@@ -3797,6 +3999,11 @@ var DataSpace = class {
|
|
|
3797
3999
|
this._signingContext = params.signingContext;
|
|
3798
4000
|
this._callbacks = params.callbacks ?? {};
|
|
3799
4001
|
this._echoHost = params.echoHost;
|
|
4002
|
+
this._notarizationPlugin = new NotarizationPlugin({
|
|
4003
|
+
spaceId: this._inner.id,
|
|
4004
|
+
edgeClient: params.edgeHttpClient,
|
|
4005
|
+
edgeFeatures: params.edgeFeatures
|
|
4006
|
+
});
|
|
3800
4007
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3801
4008
|
trustedKeysProvider: () => new ComplexSet3(PublicKey8.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== SpaceMember5.Role.REMOVED).map((member) => member.key)),
|
|
3802
4009
|
update: this._inner.stateUpdate,
|
|
@@ -3814,7 +4021,7 @@ var DataSpace = class {
|
|
|
3814
4021
|
state: SpaceState4[this._state]
|
|
3815
4022
|
}, {
|
|
3816
4023
|
F: __dxlog_file15,
|
|
3817
|
-
L:
|
|
4024
|
+
L: 170,
|
|
3818
4025
|
S: this,
|
|
3819
4026
|
C: (f, a) => f(...a)
|
|
3820
4027
|
});
|
|
@@ -3871,9 +4078,9 @@ var DataSpace = class {
|
|
|
3871
4078
|
if (this._edgeFeedReplicator) {
|
|
3872
4079
|
this.inner.protocol.feedAdded.append(this._onFeedAdded);
|
|
3873
4080
|
}
|
|
3874
|
-
await this._inner.open(new
|
|
4081
|
+
await this._inner.open(new Context5(void 0, {
|
|
3875
4082
|
F: __dxlog_file15,
|
|
3876
|
-
L:
|
|
4083
|
+
L: 244
|
|
3877
4084
|
}));
|
|
3878
4085
|
await this._edgeFeedReplicator?.open();
|
|
3879
4086
|
this._state = SpaceState4.SPACE_CONTROL_ONLY;
|
|
@@ -3881,7 +4088,7 @@ var DataSpace = class {
|
|
|
3881
4088
|
state: SpaceState4[this._state]
|
|
3882
4089
|
}, {
|
|
3883
4090
|
F: __dxlog_file15,
|
|
3884
|
-
L:
|
|
4091
|
+
L: 249,
|
|
3885
4092
|
S: this,
|
|
3886
4093
|
C: (f, a) => f(...a)
|
|
3887
4094
|
});
|
|
@@ -3901,14 +4108,14 @@ var DataSpace = class {
|
|
|
3901
4108
|
state: SpaceState4[this._state]
|
|
3902
4109
|
}, {
|
|
3903
4110
|
F: __dxlog_file15,
|
|
3904
|
-
L:
|
|
4111
|
+
L: 268,
|
|
3905
4112
|
S: this,
|
|
3906
4113
|
C: (f, a) => f(...a)
|
|
3907
4114
|
});
|
|
3908
4115
|
await this._ctx.dispose();
|
|
3909
|
-
this._ctx = new
|
|
4116
|
+
this._ctx = new Context5(void 0, {
|
|
3910
4117
|
F: __dxlog_file15,
|
|
3911
|
-
L:
|
|
4118
|
+
L: 270
|
|
3912
4119
|
});
|
|
3913
4120
|
if (this._edgeFeedReplicator) {
|
|
3914
4121
|
this.inner.protocol.feedAdded.remove(this._onFeedAdded);
|
|
@@ -3941,7 +4148,7 @@ var DataSpace = class {
|
|
|
3941
4148
|
if (err instanceof CancelledError || err instanceof ContextDisposedError) {
|
|
3942
4149
|
log13("data pipeline initialization cancelled", err, {
|
|
3943
4150
|
F: __dxlog_file15,
|
|
3944
|
-
L:
|
|
4151
|
+
L: 308,
|
|
3945
4152
|
S: this,
|
|
3946
4153
|
C: (f, a) => f(...a)
|
|
3947
4154
|
});
|
|
@@ -3949,7 +4156,7 @@ var DataSpace = class {
|
|
|
3949
4156
|
}
|
|
3950
4157
|
log13.error("Error initializing data pipeline", err, {
|
|
3951
4158
|
F: __dxlog_file15,
|
|
3952
|
-
L:
|
|
4159
|
+
L: 312,
|
|
3953
4160
|
S: this,
|
|
3954
4161
|
C: (f, a) => f(...a)
|
|
3955
4162
|
});
|
|
@@ -3958,7 +4165,7 @@ var DataSpace = class {
|
|
|
3958
4165
|
state: SpaceState4[this._state]
|
|
3959
4166
|
}, {
|
|
3960
4167
|
F: __dxlog_file15,
|
|
3961
|
-
L:
|
|
4168
|
+
L: 314,
|
|
3962
4169
|
S: this,
|
|
3963
4170
|
C: (f, a) => f(...a)
|
|
3964
4171
|
});
|
|
@@ -3978,15 +4185,39 @@ var DataSpace = class {
|
|
|
3978
4185
|
state: SpaceState4[this._state]
|
|
3979
4186
|
}, {
|
|
3980
4187
|
F: __dxlog_file15,
|
|
3981
|
-
L:
|
|
4188
|
+
L: 330,
|
|
4189
|
+
S: this,
|
|
4190
|
+
C: (f, a) => f(...a)
|
|
4191
|
+
});
|
|
4192
|
+
log13("initializing control pipeline", void 0, {
|
|
4193
|
+
F: __dxlog_file15,
|
|
4194
|
+
L: 332,
|
|
3982
4195
|
S: this,
|
|
3983
4196
|
C: (f, a) => f(...a)
|
|
3984
4197
|
});
|
|
3985
4198
|
await this._initializeAndReadControlPipeline();
|
|
3986
4199
|
await sleep3(1);
|
|
3987
4200
|
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
|
|
4201
|
+
log13("initializing automerge root", void 0, {
|
|
4202
|
+
F: __dxlog_file15,
|
|
4203
|
+
L: 340,
|
|
4204
|
+
S: this,
|
|
4205
|
+
C: (f, a) => f(...a)
|
|
4206
|
+
});
|
|
3988
4207
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4208
|
+
log13("waiting for space to be ready", void 0, {
|
|
4209
|
+
F: __dxlog_file15,
|
|
4210
|
+
L: 344,
|
|
4211
|
+
S: this,
|
|
4212
|
+
C: (f, a) => f(...a)
|
|
4213
|
+
});
|
|
3989
4214
|
await ready;
|
|
4215
|
+
log13("space is ready", void 0, {
|
|
4216
|
+
F: __dxlog_file15,
|
|
4217
|
+
L: 346,
|
|
4218
|
+
S: this,
|
|
4219
|
+
C: (f, a) => f(...a)
|
|
4220
|
+
});
|
|
3990
4221
|
}
|
|
3991
4222
|
async _enterReadyState() {
|
|
3992
4223
|
await this._callbacks.beforeReady?.();
|
|
@@ -3995,7 +4226,7 @@ var DataSpace = class {
|
|
|
3995
4226
|
state: SpaceState4[this._state]
|
|
3996
4227
|
}, {
|
|
3997
4228
|
F: __dxlog_file15,
|
|
3998
|
-
L:
|
|
4229
|
+
L: 353,
|
|
3999
4230
|
S: this,
|
|
4000
4231
|
C: (f, a) => f(...a)
|
|
4001
4232
|
});
|
|
@@ -4005,13 +4236,14 @@ var DataSpace = class {
|
|
|
4005
4236
|
async _initializeAndReadControlPipeline() {
|
|
4006
4237
|
await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
4007
4238
|
ctx: this._ctx,
|
|
4239
|
+
timeout: 1e4,
|
|
4008
4240
|
breakOnStall: false
|
|
4009
4241
|
});
|
|
4010
4242
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
4011
4243
|
await this._createWritableFeeds();
|
|
4012
4244
|
log13("writable feeds created", void 0, {
|
|
4013
4245
|
F: __dxlog_file15,
|
|
4014
|
-
L:
|
|
4246
|
+
L: 370,
|
|
4015
4247
|
S: this,
|
|
4016
4248
|
C: (f, a) => f(...a)
|
|
4017
4249
|
});
|
|
@@ -4060,11 +4292,35 @@ var DataSpace = class {
|
|
|
4060
4292
|
}));
|
|
4061
4293
|
}
|
|
4062
4294
|
if (credentials.length > 0) {
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4295
|
+
try {
|
|
4296
|
+
log13("will notarize credentials for feed admission", {
|
|
4297
|
+
count: credentials.length
|
|
4298
|
+
}, {
|
|
4299
|
+
F: __dxlog_file15,
|
|
4300
|
+
L: 428,
|
|
4301
|
+
S: this,
|
|
4302
|
+
C: (f, a) => f(...a)
|
|
4303
|
+
});
|
|
4304
|
+
await this.notarizationPlugin.notarize({
|
|
4305
|
+
ctx: this._ctx,
|
|
4306
|
+
credentials,
|
|
4307
|
+
timeout: 0
|
|
4308
|
+
});
|
|
4309
|
+
log13("credentials notarized", void 0, {
|
|
4310
|
+
F: __dxlog_file15,
|
|
4311
|
+
L: 432,
|
|
4312
|
+
S: this,
|
|
4313
|
+
C: (f, a) => f(...a)
|
|
4314
|
+
});
|
|
4315
|
+
} catch (err) {
|
|
4316
|
+
log13.error("error notarizing credentials for feed admission", err, {
|
|
4317
|
+
F: __dxlog_file15,
|
|
4318
|
+
L: 434,
|
|
4319
|
+
S: this,
|
|
4320
|
+
C: (f, a) => f(...a)
|
|
4321
|
+
});
|
|
4322
|
+
throw err;
|
|
4323
|
+
}
|
|
4068
4324
|
await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
|
|
4069
4325
|
}
|
|
4070
4326
|
}
|
|
@@ -4074,7 +4330,7 @@ var DataSpace = class {
|
|
|
4074
4330
|
rootUrl
|
|
4075
4331
|
}, {
|
|
4076
4332
|
F: __dxlog_file15,
|
|
4077
|
-
L:
|
|
4333
|
+
L: 444,
|
|
4078
4334
|
S: this,
|
|
4079
4335
|
C: (f, a) => f(...a)
|
|
4080
4336
|
});
|
|
@@ -4126,7 +4382,7 @@ var DataSpace = class {
|
|
|
4126
4382
|
err
|
|
4127
4383
|
}, {
|
|
4128
4384
|
F: __dxlog_file15,
|
|
4129
|
-
L:
|
|
4385
|
+
L: 487,
|
|
4130
4386
|
S: this,
|
|
4131
4387
|
C: (f, a) => f(...a)
|
|
4132
4388
|
});
|
|
@@ -4216,58 +4472,58 @@ var DataSpace = class {
|
|
|
4216
4472
|
state: SpaceState4[this._state]
|
|
4217
4473
|
}, {
|
|
4218
4474
|
F: __dxlog_file15,
|
|
4219
|
-
L:
|
|
4475
|
+
L: 569,
|
|
4220
4476
|
S: this,
|
|
4221
4477
|
C: (f, a) => f(...a)
|
|
4222
4478
|
});
|
|
4223
4479
|
this.stateUpdate.emit();
|
|
4224
4480
|
}
|
|
4225
4481
|
};
|
|
4226
|
-
|
|
4482
|
+
_ts_decorate6([
|
|
4227
4483
|
trace5.info()
|
|
4228
4484
|
], DataSpace.prototype, "_inner", void 0);
|
|
4229
|
-
|
|
4485
|
+
_ts_decorate6([
|
|
4230
4486
|
trace5.info()
|
|
4231
4487
|
], DataSpace.prototype, "id", null);
|
|
4232
|
-
|
|
4488
|
+
_ts_decorate6([
|
|
4233
4489
|
trace5.info()
|
|
4234
4490
|
], DataSpace.prototype, "key", null);
|
|
4235
|
-
|
|
4491
|
+
_ts_decorate6([
|
|
4236
4492
|
trace5.info({
|
|
4237
4493
|
enum: SpaceState4
|
|
4238
4494
|
})
|
|
4239
4495
|
], DataSpace.prototype, "state", null);
|
|
4240
|
-
|
|
4496
|
+
_ts_decorate6([
|
|
4241
4497
|
trace5.info({
|
|
4242
4498
|
depth: null
|
|
4243
4499
|
})
|
|
4244
4500
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
4245
|
-
|
|
4501
|
+
_ts_decorate6([
|
|
4246
4502
|
synchronized2
|
|
4247
4503
|
], DataSpace.prototype, "open", null);
|
|
4248
|
-
|
|
4504
|
+
_ts_decorate6([
|
|
4249
4505
|
synchronized2
|
|
4250
4506
|
], DataSpace.prototype, "close", null);
|
|
4251
|
-
|
|
4507
|
+
_ts_decorate6([
|
|
4252
4508
|
trace5.span({
|
|
4253
4509
|
showInBrowserTimeline: true
|
|
4254
4510
|
})
|
|
4255
4511
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
4256
|
-
|
|
4512
|
+
_ts_decorate6([
|
|
4257
4513
|
trace5.span({
|
|
4258
4514
|
showInBrowserTimeline: true
|
|
4259
4515
|
})
|
|
4260
4516
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
4261
|
-
|
|
4517
|
+
_ts_decorate6([
|
|
4262
4518
|
timed(1e4)
|
|
4263
4519
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
4264
|
-
|
|
4520
|
+
_ts_decorate6([
|
|
4265
4521
|
synchronized2
|
|
4266
4522
|
], DataSpace.prototype, "activate", null);
|
|
4267
|
-
|
|
4523
|
+
_ts_decorate6([
|
|
4268
4524
|
synchronized2
|
|
4269
4525
|
], DataSpace.prototype, "deactivate", null);
|
|
4270
|
-
DataSpace =
|
|
4526
|
+
DataSpace = _ts_decorate6([
|
|
4271
4527
|
trackLeaks2("open", "close"),
|
|
4272
4528
|
trace5.resource()
|
|
4273
4529
|
], DataSpace);
|
|
@@ -4401,7 +4657,7 @@ import { ComplexSet as ComplexSet5 } from "@dxos/util";
|
|
|
4401
4657
|
|
|
4402
4658
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
4403
4659
|
import { Trigger as Trigger5 } from "@dxos/async";
|
|
4404
|
-
import { cancelWithContext as cancelWithContext4, Context as
|
|
4660
|
+
import { cancelWithContext as cancelWithContext4, Context as Context6 } from "@dxos/context";
|
|
4405
4661
|
import { invariant as invariant11 } from "@dxos/invariant";
|
|
4406
4662
|
import { log as log14 } from "@dxos/log";
|
|
4407
4663
|
import { InvalidInvitationExtensionRoleError } from "@dxos/protocols";
|
|
@@ -4443,7 +4699,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4443
4699
|
});
|
|
4444
4700
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
4445
4701
|
this._callbacks = _callbacks;
|
|
4446
|
-
this._ctx = new
|
|
4702
|
+
this._ctx = new Context6(void 0, {
|
|
4447
4703
|
F: __dxlog_file17,
|
|
4448
4704
|
L: 34
|
|
4449
4705
|
});
|
|
@@ -4555,7 +4811,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4555
4811
|
|
|
4556
4812
|
// packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts
|
|
4557
4813
|
import { Trigger as Trigger6, scheduleTask as scheduleTask5 } from "@dxos/async";
|
|
4558
|
-
import { cancelWithContext as cancelWithContext5, Context as
|
|
4814
|
+
import { cancelWithContext as cancelWithContext5, Context as Context7 } from "@dxos/context";
|
|
4559
4815
|
import { randomBytes, verify } from "@dxos/crypto";
|
|
4560
4816
|
import { invariant as invariant12, InvariantViolation } from "@dxos/invariant";
|
|
4561
4817
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
@@ -4580,7 +4836,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
4580
4836
|
});
|
|
4581
4837
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
4582
4838
|
this._callbacks = _callbacks;
|
|
4583
|
-
this._ctx = new
|
|
4839
|
+
this._ctx = new Context7(void 0, {
|
|
4584
4840
|
F: __dxlog_file18,
|
|
4585
4841
|
L: 53
|
|
4586
4842
|
});
|
|
@@ -5955,7 +6211,7 @@ var SpaceInvitationProtocol = class {
|
|
|
5955
6211
|
// packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts
|
|
5956
6212
|
import { Event as Event8, PushStream, TimeoutError as TimeoutError3, Trigger as Trigger7 } from "@dxos/async";
|
|
5957
6213
|
import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT as INVITATION_TIMEOUT2 } from "@dxos/client-protocol";
|
|
5958
|
-
import { Context as
|
|
6214
|
+
import { Context as Context8 } from "@dxos/context";
|
|
5959
6215
|
import { generatePasscode } from "@dxos/credentials";
|
|
5960
6216
|
import { hasInvitationExpired } from "@dxos/echo-pipeline";
|
|
5961
6217
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
@@ -6187,7 +6443,7 @@ var InvitationsManager = class {
|
|
|
6187
6443
|
}
|
|
6188
6444
|
_createObservableInvitation(handler, invitation) {
|
|
6189
6445
|
const stream = new PushStream();
|
|
6190
|
-
const ctx = new
|
|
6446
|
+
const ctx = new Context8({
|
|
6191
6447
|
onError: (err) => {
|
|
6192
6448
|
stream.error(err);
|
|
6193
6449
|
void ctx.dispose();
|
|
@@ -6227,7 +6483,7 @@ var InvitationsManager = class {
|
|
|
6227
6483
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
6228
6484
|
const otpEnteredTrigger = new Trigger7();
|
|
6229
6485
|
const stream = new PushStream();
|
|
6230
|
-
const ctx = new
|
|
6486
|
+
const ctx = new Context8({
|
|
6231
6487
|
onError: (err) => {
|
|
6232
6488
|
if (err instanceof TimeoutError3) {
|
|
6233
6489
|
log19("timeout", {
|
|
@@ -6326,8 +6582,8 @@ var InvitationsManager = class {
|
|
|
6326
6582
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
6327
6583
|
import { asyncTimeout as asyncTimeout2, Trigger as Trigger8 } from "@dxos/async";
|
|
6328
6584
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
6329
|
-
import { log as log20, logInfo } from "@dxos/log";
|
|
6330
|
-
function
|
|
6585
|
+
import { log as log20, logInfo as logInfo3 } from "@dxos/log";
|
|
6586
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
6331
6587
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6332
6588
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6333
6589
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -6436,8 +6692,8 @@ var Lock = class {
|
|
|
6436
6692
|
});
|
|
6437
6693
|
}
|
|
6438
6694
|
};
|
|
6439
|
-
|
|
6440
|
-
|
|
6695
|
+
_ts_decorate7([
|
|
6696
|
+
logInfo3
|
|
6441
6697
|
], Lock.prototype, "lockKey", null);
|
|
6442
6698
|
var isLocked = (lockPath) => {
|
|
6443
6699
|
throw new Error("Not implemented");
|
|
@@ -6448,7 +6704,7 @@ import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
|
6448
6704
|
import { raise as raise2 } from "@dxos/debug";
|
|
6449
6705
|
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
6450
6706
|
import { MapCounter, trace as trace8 } from "@dxos/tracing";
|
|
6451
|
-
function
|
|
6707
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
6452
6708
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6453
6709
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6454
6710
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -6510,22 +6766,23 @@ var ClientRpcServer = class {
|
|
|
6510
6766
|
return this._handlerCache.get(serviceName);
|
|
6511
6767
|
}
|
|
6512
6768
|
};
|
|
6513
|
-
|
|
6769
|
+
_ts_decorate8([
|
|
6514
6770
|
trace8.metricsCounter()
|
|
6515
6771
|
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
6516
|
-
|
|
6772
|
+
_ts_decorate8([
|
|
6517
6773
|
trace8.info()
|
|
6518
6774
|
], ClientRpcServer.prototype, "_services", null);
|
|
6519
|
-
ClientRpcServer =
|
|
6775
|
+
ClientRpcServer = _ts_decorate8([
|
|
6520
6776
|
trace8.resource()
|
|
6521
6777
|
], ClientRpcServer);
|
|
6522
6778
|
|
|
6523
6779
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
6524
|
-
import { Trigger as Trigger9 } from "@dxos/async";
|
|
6525
|
-
import { Context as
|
|
6780
|
+
import { Mutex as Mutex4, scheduleMicroTask as scheduleMicroTask3, Trigger as Trigger9 } from "@dxos/async";
|
|
6781
|
+
import { Context as Context9, Resource as Resource6 } from "@dxos/context";
|
|
6526
6782
|
import { getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
|
|
6527
|
-
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
6783
|
+
import { failUndefined as failUndefined2, warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
|
|
6528
6784
|
import { EchoEdgeReplicator, EchoHost, MeshEchoReplicator, MetadataStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
|
|
6785
|
+
import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from "@dxos/edge-client";
|
|
6529
6786
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
6530
6787
|
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6531
6788
|
import { Keyring } from "@dxos/keyring";
|
|
@@ -6536,23 +6793,87 @@ import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/ser
|
|
|
6536
6793
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
6537
6794
|
import { trace as Trace3 } from "@dxos/tracing";
|
|
6538
6795
|
import { safeInstanceof } from "@dxos/util";
|
|
6539
|
-
function
|
|
6796
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
6540
6797
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6541
6798
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6542
6799
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6543
6800
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6544
6801
|
}
|
|
6802
|
+
function _using_ctx3() {
|
|
6803
|
+
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
6804
|
+
var err = new Error();
|
|
6805
|
+
err.name = "SuppressedError";
|
|
6806
|
+
err.suppressed = suppressed;
|
|
6807
|
+
err.error = error;
|
|
6808
|
+
return err;
|
|
6809
|
+
}, empty = {}, stack = [];
|
|
6810
|
+
function using(isAwait, value) {
|
|
6811
|
+
if (value != null) {
|
|
6812
|
+
if (Object(value) !== value) {
|
|
6813
|
+
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
6814
|
+
}
|
|
6815
|
+
if (isAwait) {
|
|
6816
|
+
var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
|
|
6817
|
+
}
|
|
6818
|
+
if (dispose == null) {
|
|
6819
|
+
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
|
|
6820
|
+
}
|
|
6821
|
+
if (typeof dispose !== "function") {
|
|
6822
|
+
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
|
|
6823
|
+
}
|
|
6824
|
+
stack.push({
|
|
6825
|
+
v: value,
|
|
6826
|
+
d: dispose,
|
|
6827
|
+
a: isAwait
|
|
6828
|
+
});
|
|
6829
|
+
} else if (isAwait) {
|
|
6830
|
+
stack.push({
|
|
6831
|
+
d: value,
|
|
6832
|
+
a: isAwait
|
|
6833
|
+
});
|
|
6834
|
+
}
|
|
6835
|
+
return value;
|
|
6836
|
+
}
|
|
6837
|
+
return {
|
|
6838
|
+
e: empty,
|
|
6839
|
+
u: using.bind(null, false),
|
|
6840
|
+
a: using.bind(null, true),
|
|
6841
|
+
d: function() {
|
|
6842
|
+
var error = this.e;
|
|
6843
|
+
function next() {
|
|
6844
|
+
while (resource = stack.pop()) {
|
|
6845
|
+
try {
|
|
6846
|
+
var resource, disposalResult = resource.d && resource.d.call(resource.v);
|
|
6847
|
+
if (resource.a) {
|
|
6848
|
+
return Promise.resolve(disposalResult).then(next, err);
|
|
6849
|
+
}
|
|
6850
|
+
} catch (e) {
|
|
6851
|
+
return err(e);
|
|
6852
|
+
}
|
|
6853
|
+
}
|
|
6854
|
+
if (error !== empty) throw error;
|
|
6855
|
+
}
|
|
6856
|
+
function err(e) {
|
|
6857
|
+
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
6858
|
+
return next();
|
|
6859
|
+
}
|
|
6860
|
+
return next();
|
|
6861
|
+
}
|
|
6862
|
+
};
|
|
6863
|
+
}
|
|
6545
6864
|
var __dxlog_file24 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
6546
|
-
var ServiceContext = class extends
|
|
6547
|
-
constructor(storage, level, networkManager, signalManager, _edgeConnection, _runtimeParams, _edgeFeatures) {
|
|
6865
|
+
var ServiceContext = class extends Resource6 {
|
|
6866
|
+
constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
|
|
6548
6867
|
super();
|
|
6549
6868
|
this.storage = storage;
|
|
6550
6869
|
this.level = level;
|
|
6551
6870
|
this.networkManager = networkManager;
|
|
6552
6871
|
this.signalManager = signalManager;
|
|
6553
6872
|
this._edgeConnection = _edgeConnection;
|
|
6873
|
+
this._edgeHttpClient = _edgeHttpClient;
|
|
6554
6874
|
this._runtimeParams = _runtimeParams;
|
|
6555
6875
|
this._edgeFeatures = _edgeFeatures;
|
|
6876
|
+
this._edgeIdentityUpdateMutex = new Mutex4();
|
|
6556
6877
|
this.initialized = new Trigger9();
|
|
6557
6878
|
this._meshReplicator = void 0;
|
|
6558
6879
|
this._echoEdgeReplicator = void 0;
|
|
@@ -6590,23 +6911,42 @@ var ServiceContext = class extends Resource5 {
|
|
|
6590
6911
|
callbacks: {
|
|
6591
6912
|
onIdentityConstruction: (identity) => {
|
|
6592
6913
|
if (this._edgeConnection) {
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6914
|
+
scheduleMicroTask3(this._ctx, async () => {
|
|
6915
|
+
try {
|
|
6916
|
+
var _usingCtx = _using_ctx3();
|
|
6917
|
+
const _ = _usingCtx.u(await this._edgeIdentityUpdateMutex.acquire());
|
|
6918
|
+
log21.info("Setting identity on edge connection", {
|
|
6919
|
+
identity: identity.identityKey.toHex(),
|
|
6920
|
+
oldIdentity: this._edgeConnection.identityKey,
|
|
6921
|
+
swarms: this.networkManager.topics
|
|
6922
|
+
}, {
|
|
6923
|
+
F: __dxlog_file24,
|
|
6924
|
+
L: 147,
|
|
6925
|
+
S: this,
|
|
6926
|
+
C: (f, a) => f(...a)
|
|
6927
|
+
});
|
|
6928
|
+
await warnAfterTimeout2(1e4, "Waiting for identity to be ready for edge connection", async () => {
|
|
6929
|
+
await identity.ready();
|
|
6930
|
+
});
|
|
6931
|
+
invariant17(identity.deviceCredentialChain, void 0, {
|
|
6932
|
+
F: __dxlog_file24,
|
|
6933
|
+
L: 157,
|
|
6934
|
+
S: this,
|
|
6935
|
+
A: [
|
|
6936
|
+
"identity.deviceCredentialChain",
|
|
6937
|
+
""
|
|
6938
|
+
]
|
|
6939
|
+
});
|
|
6940
|
+
this._edgeConnection.setIdentity(await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, identity.deviceCredentialChain, []));
|
|
6941
|
+
this.networkManager.setPeerInfo({
|
|
6942
|
+
identityKey: identity.identityKey.toHex(),
|
|
6943
|
+
peerKey: identity.deviceKey.toHex()
|
|
6944
|
+
});
|
|
6945
|
+
} catch (_) {
|
|
6946
|
+
_usingCtx.e = _;
|
|
6947
|
+
} finally {
|
|
6948
|
+
_usingCtx.d();
|
|
6949
|
+
}
|
|
6610
6950
|
});
|
|
6611
6951
|
}
|
|
6612
6952
|
}
|
|
@@ -6632,7 +6972,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6632
6972
|
await this._checkStorageVersion();
|
|
6633
6973
|
log21("opening...", void 0, {
|
|
6634
6974
|
F: __dxlog_file24,
|
|
6635
|
-
L:
|
|
6975
|
+
L: 217,
|
|
6636
6976
|
S: this,
|
|
6637
6977
|
C: (f, a) => f(...a)
|
|
6638
6978
|
});
|
|
@@ -6640,11 +6980,14 @@ var ServiceContext = class extends Resource5 {
|
|
|
6640
6980
|
id: this._instanceId
|
|
6641
6981
|
}), {
|
|
6642
6982
|
F: __dxlog_file24,
|
|
6643
|
-
L:
|
|
6983
|
+
L: 218,
|
|
6644
6984
|
S: this,
|
|
6645
6985
|
C: (f, a) => f(...a)
|
|
6646
6986
|
});
|
|
6647
|
-
|
|
6987
|
+
if (this._edgeConnection) {
|
|
6988
|
+
this._edgeConnection.setIdentity(await createEphemeralEdgeIdentity());
|
|
6989
|
+
await this._edgeConnection.open();
|
|
6990
|
+
}
|
|
6648
6991
|
await this.signalManager.open();
|
|
6649
6992
|
await this.networkManager.open();
|
|
6650
6993
|
await this.echoHost.open(ctx);
|
|
@@ -6665,7 +7008,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6665
7008
|
count: loadedInvitations.invitations?.length
|
|
6666
7009
|
}, {
|
|
6667
7010
|
F: __dxlog_file24,
|
|
6668
|
-
L:
|
|
7011
|
+
L: 245,
|
|
6669
7012
|
S: this,
|
|
6670
7013
|
C: (f, a) => f(...a)
|
|
6671
7014
|
});
|
|
@@ -6673,13 +7016,13 @@ var ServiceContext = class extends Resource5 {
|
|
|
6673
7016
|
id: this._instanceId
|
|
6674
7017
|
}), {
|
|
6675
7018
|
F: __dxlog_file24,
|
|
6676
|
-
L:
|
|
7019
|
+
L: 247,
|
|
6677
7020
|
S: this,
|
|
6678
7021
|
C: (f, a) => f(...a)
|
|
6679
7022
|
});
|
|
6680
7023
|
log21("opened", void 0, {
|
|
6681
7024
|
F: __dxlog_file24,
|
|
6682
|
-
L:
|
|
7025
|
+
L: 248,
|
|
6683
7026
|
S: this,
|
|
6684
7027
|
C: (f, a) => f(...a)
|
|
6685
7028
|
});
|
|
@@ -6687,7 +7030,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6687
7030
|
async _close(ctx) {
|
|
6688
7031
|
log21("closing...", void 0, {
|
|
6689
7032
|
F: __dxlog_file24,
|
|
6690
|
-
L:
|
|
7033
|
+
L: 252,
|
|
6691
7034
|
S: this,
|
|
6692
7035
|
C: (f, a) => f(...a)
|
|
6693
7036
|
});
|
|
@@ -6705,16 +7048,16 @@ var ServiceContext = class extends Resource5 {
|
|
|
6705
7048
|
await this._edgeConnection?.close();
|
|
6706
7049
|
log21("closed", void 0, {
|
|
6707
7050
|
F: __dxlog_file24,
|
|
6708
|
-
L:
|
|
7051
|
+
L: 267,
|
|
6709
7052
|
S: this,
|
|
6710
7053
|
C: (f, a) => f(...a)
|
|
6711
7054
|
});
|
|
6712
7055
|
}
|
|
6713
7056
|
async createIdentity(params = {}) {
|
|
6714
7057
|
const identity = await this.identityManager.createIdentity(params);
|
|
6715
|
-
await this._initialize(new
|
|
7058
|
+
await this._initialize(new Context9(void 0, {
|
|
6716
7059
|
F: __dxlog_file24,
|
|
6717
|
-
L:
|
|
7060
|
+
L: 272
|
|
6718
7061
|
}));
|
|
6719
7062
|
return identity;
|
|
6720
7063
|
}
|
|
@@ -6722,7 +7065,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6722
7065
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
6723
7066
|
invariant17(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
6724
7067
|
F: __dxlog_file24,
|
|
6725
|
-
L:
|
|
7068
|
+
L: 278,
|
|
6726
7069
|
S: this,
|
|
6727
7070
|
A: [
|
|
6728
7071
|
"factory",
|
|
@@ -6741,9 +7084,9 @@ var ServiceContext = class extends Resource5 {
|
|
|
6741
7084
|
}
|
|
6742
7085
|
async _acceptIdentity(params) {
|
|
6743
7086
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
6744
|
-
await this._initialize(new
|
|
7087
|
+
await this._initialize(new Context9(void 0, {
|
|
6745
7088
|
F: __dxlog_file24,
|
|
6746
|
-
L:
|
|
7089
|
+
L: 294
|
|
6747
7090
|
}));
|
|
6748
7091
|
return identity;
|
|
6749
7092
|
}
|
|
@@ -6757,7 +7100,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6757
7100
|
async _initialize(ctx) {
|
|
6758
7101
|
log21("initializing spaces...", void 0, {
|
|
6759
7102
|
F: __dxlog_file24,
|
|
6760
|
-
L:
|
|
7103
|
+
L: 309,
|
|
6761
7104
|
S: this,
|
|
6762
7105
|
C: (f, a) => f(...a)
|
|
6763
7106
|
});
|
|
@@ -6784,6 +7127,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6784
7127
|
echoHost: this.echoHost,
|
|
6785
7128
|
invitationsManager: this.invitationsManager,
|
|
6786
7129
|
edgeConnection: this._edgeConnection,
|
|
7130
|
+
edgeHttpClient: this._edgeHttpClient,
|
|
6787
7131
|
echoEdgeReplicator: this._echoEdgeReplicator,
|
|
6788
7132
|
meshReplicator: this._meshReplicator,
|
|
6789
7133
|
runtimeParams: this._runtimeParams,
|
|
@@ -6793,7 +7137,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6793
7137
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
6794
7138
|
invariant17(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
6795
7139
|
F: __dxlog_file24,
|
|
6796
|
-
L:
|
|
7140
|
+
L: 339,
|
|
6797
7141
|
S: this,
|
|
6798
7142
|
A: [
|
|
6799
7143
|
"this.dataSpaceManager",
|
|
@@ -6817,7 +7161,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6817
7161
|
details: assertion
|
|
6818
7162
|
}, {
|
|
6819
7163
|
F: __dxlog_file24,
|
|
6820
|
-
L:
|
|
7164
|
+
L: 355,
|
|
6821
7165
|
S: this,
|
|
6822
7166
|
C: (f, a) => f(...a)
|
|
6823
7167
|
});
|
|
@@ -6828,7 +7172,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6828
7172
|
details: assertion
|
|
6829
7173
|
}, {
|
|
6830
7174
|
F: __dxlog_file24,
|
|
6831
|
-
L:
|
|
7175
|
+
L: 359,
|
|
6832
7176
|
S: this,
|
|
6833
7177
|
C: (f, a) => f(...a)
|
|
6834
7178
|
});
|
|
@@ -6839,7 +7183,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6839
7183
|
details: assertion
|
|
6840
7184
|
}, {
|
|
6841
7185
|
F: __dxlog_file24,
|
|
6842
|
-
L:
|
|
7186
|
+
L: 364,
|
|
6843
7187
|
S: this,
|
|
6844
7188
|
C: (f, a) => f(...a)
|
|
6845
7189
|
});
|
|
@@ -6850,7 +7194,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6850
7194
|
} catch (err) {
|
|
6851
7195
|
log21.catch(err, void 0, {
|
|
6852
7196
|
F: __dxlog_file24,
|
|
6853
|
-
L:
|
|
7197
|
+
L: 370,
|
|
6854
7198
|
S: this,
|
|
6855
7199
|
C: (f, a) => f(...a)
|
|
6856
7200
|
});
|
|
@@ -6860,13 +7204,13 @@ var ServiceContext = class extends Resource5 {
|
|
|
6860
7204
|
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
6861
7205
|
}
|
|
6862
7206
|
};
|
|
6863
|
-
|
|
7207
|
+
_ts_decorate9([
|
|
6864
7208
|
Trace3.span()
|
|
6865
7209
|
], ServiceContext.prototype, "_open", null);
|
|
6866
|
-
|
|
7210
|
+
_ts_decorate9([
|
|
6867
7211
|
Trace3.span()
|
|
6868
7212
|
], ServiceContext.prototype, "_initialize", null);
|
|
6869
|
-
ServiceContext =
|
|
7213
|
+
ServiceContext = _ts_decorate9([
|
|
6870
7214
|
safeInstanceof("dxos.client-services.ServiceContext"),
|
|
6871
7215
|
Trace3.resource()
|
|
6872
7216
|
], ServiceContext);
|
|
@@ -7131,8 +7475,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
7131
7475
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
7132
7476
|
import { Event as Event10, synchronized as synchronized3 } from "@dxos/async";
|
|
7133
7477
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
7134
|
-
import { Context as
|
|
7135
|
-
import { EdgeClient } from "@dxos/edge-client";
|
|
7478
|
+
import { Context as Context10 } from "@dxos/context";
|
|
7479
|
+
import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
|
|
7136
7480
|
import { invariant as invariant20 } from "@dxos/invariant";
|
|
7137
7481
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
7138
7482
|
import { log as log24 } from "@dxos/log";
|
|
@@ -7523,7 +7867,7 @@ var SystemServiceImpl = class {
|
|
|
7523
7867
|
};
|
|
7524
7868
|
|
|
7525
7869
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
7526
|
-
function
|
|
7870
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
7527
7871
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7528
7872
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7529
7873
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -7545,6 +7889,7 @@ var ClientServicesHost = class {
|
|
|
7545
7889
|
this._tracingService = TRACE_PROCESSOR3.createTraceSender();
|
|
7546
7890
|
this._statusUpdate = new Event10();
|
|
7547
7891
|
this._edgeConnection = void 0;
|
|
7892
|
+
this._edgeHttpClient = void 0;
|
|
7548
7893
|
this._opening = false;
|
|
7549
7894
|
this._open = false;
|
|
7550
7895
|
this._storage = storage;
|
|
@@ -7566,9 +7911,9 @@ var ClientServicesHost = class {
|
|
|
7566
7911
|
lockKey,
|
|
7567
7912
|
onAcquire: () => {
|
|
7568
7913
|
if (!this._opening) {
|
|
7569
|
-
void this.open(new
|
|
7914
|
+
void this.open(new Context10(void 0, {
|
|
7570
7915
|
F: __dxlog_file27,
|
|
7571
|
-
L:
|
|
7916
|
+
L: 133
|
|
7572
7917
|
}));
|
|
7573
7918
|
}
|
|
7574
7919
|
},
|
|
@@ -7626,7 +7971,7 @@ var ClientServicesHost = class {
|
|
|
7626
7971
|
initialize({ config, ...options }) {
|
|
7627
7972
|
invariant20(!this._open, "service host is open", {
|
|
7628
7973
|
F: __dxlog_file27,
|
|
7629
|
-
L:
|
|
7974
|
+
L: 199,
|
|
7630
7975
|
S: this,
|
|
7631
7976
|
A: [
|
|
7632
7977
|
"!this._open",
|
|
@@ -7635,14 +7980,14 @@ var ClientServicesHost = class {
|
|
|
7635
7980
|
});
|
|
7636
7981
|
log24("initializing...", void 0, {
|
|
7637
7982
|
F: __dxlog_file27,
|
|
7638
|
-
L:
|
|
7983
|
+
L: 200,
|
|
7639
7984
|
S: this,
|
|
7640
7985
|
C: (f, a) => f(...a)
|
|
7641
7986
|
});
|
|
7642
7987
|
if (config) {
|
|
7643
7988
|
invariant20(!this._config, "config already set", {
|
|
7644
7989
|
F: __dxlog_file27,
|
|
7645
|
-
L:
|
|
7990
|
+
L: 203,
|
|
7646
7991
|
S: this,
|
|
7647
7992
|
A: [
|
|
7648
7993
|
"!this._config",
|
|
@@ -7657,17 +8002,17 @@ var ClientServicesHost = class {
|
|
|
7657
8002
|
if (!options.signalManager) {
|
|
7658
8003
|
log24.warn("running signaling without telemetry metadata.", void 0, {
|
|
7659
8004
|
F: __dxlog_file27,
|
|
7660
|
-
L:
|
|
8005
|
+
L: 211,
|
|
7661
8006
|
S: this,
|
|
7662
8007
|
C: (f, a) => f(...a)
|
|
7663
8008
|
});
|
|
7664
8009
|
}
|
|
7665
8010
|
const edgeEndpoint = config?.get("runtime.services.edge.url");
|
|
7666
8011
|
if (edgeEndpoint) {
|
|
7667
|
-
|
|
7668
|
-
this._edgeConnection = new EdgeClient(randomKey, randomKey, {
|
|
8012
|
+
this._edgeConnection = new EdgeClient(createStubEdgeIdentity(), {
|
|
7669
8013
|
socketEndpoint: edgeEndpoint
|
|
7670
8014
|
});
|
|
8015
|
+
this._edgeHttpClient = new EdgeHttpClient(edgeEndpoint);
|
|
7671
8016
|
}
|
|
7672
8017
|
const { connectionLog = true, transportFactory = createRtcTransportFactory({
|
|
7673
8018
|
iceServers: this._config?.get("runtime.services.ice")
|
|
@@ -7677,7 +8022,7 @@ var ClientServicesHost = class {
|
|
|
7677
8022
|
this._signalManager = signalManager;
|
|
7678
8023
|
invariant20(!this._networkManager, "network manager already set", {
|
|
7679
8024
|
F: __dxlog_file27,
|
|
7680
|
-
L:
|
|
8025
|
+
L: 233,
|
|
7681
8026
|
S: this,
|
|
7682
8027
|
A: [
|
|
7683
8028
|
"!this._networkManager",
|
|
@@ -7695,7 +8040,7 @@ var ClientServicesHost = class {
|
|
|
7695
8040
|
});
|
|
7696
8041
|
log24("initialized", void 0, {
|
|
7697
8042
|
F: __dxlog_file27,
|
|
7698
|
-
L:
|
|
8043
|
+
L: 246,
|
|
7699
8044
|
S: this,
|
|
7700
8045
|
C: (f, a) => f(...a)
|
|
7701
8046
|
});
|
|
@@ -7709,13 +8054,13 @@ var ClientServicesHost = class {
|
|
|
7709
8054
|
id: traceId
|
|
7710
8055
|
}), {
|
|
7711
8056
|
F: __dxlog_file27,
|
|
7712
|
-
L:
|
|
8057
|
+
L: 257,
|
|
7713
8058
|
S: this,
|
|
7714
8059
|
C: (f, a) => f(...a)
|
|
7715
8060
|
});
|
|
7716
8061
|
invariant20(this._config, "config not set", {
|
|
7717
8062
|
F: __dxlog_file27,
|
|
7718
|
-
L:
|
|
8063
|
+
L: 259,
|
|
7719
8064
|
S: this,
|
|
7720
8065
|
A: [
|
|
7721
8066
|
"this._config",
|
|
@@ -7724,7 +8069,7 @@ var ClientServicesHost = class {
|
|
|
7724
8069
|
});
|
|
7725
8070
|
invariant20(this._storage, "storage not set", {
|
|
7726
8071
|
F: __dxlog_file27,
|
|
7727
|
-
L:
|
|
8072
|
+
L: 260,
|
|
7728
8073
|
S: this,
|
|
7729
8074
|
A: [
|
|
7730
8075
|
"this._storage",
|
|
@@ -7733,7 +8078,7 @@ var ClientServicesHost = class {
|
|
|
7733
8078
|
});
|
|
7734
8079
|
invariant20(this._signalManager, "signal manager not set", {
|
|
7735
8080
|
F: __dxlog_file27,
|
|
7736
|
-
L:
|
|
8081
|
+
L: 261,
|
|
7737
8082
|
S: this,
|
|
7738
8083
|
A: [
|
|
7739
8084
|
"this._signalManager",
|
|
@@ -7742,7 +8087,7 @@ var ClientServicesHost = class {
|
|
|
7742
8087
|
});
|
|
7743
8088
|
invariant20(this._networkManager, "network manager not set", {
|
|
7744
8089
|
F: __dxlog_file27,
|
|
7745
|
-
L:
|
|
8090
|
+
L: 262,
|
|
7746
8091
|
S: this,
|
|
7747
8092
|
A: [
|
|
7748
8093
|
"this._networkManager",
|
|
@@ -7754,7 +8099,7 @@ var ClientServicesHost = class {
|
|
|
7754
8099
|
lockKey: this._resourceLock?.lockKey
|
|
7755
8100
|
}, {
|
|
7756
8101
|
F: __dxlog_file27,
|
|
7757
|
-
L:
|
|
8102
|
+
L: 265,
|
|
7758
8103
|
S: this,
|
|
7759
8104
|
C: (f, a) => f(...a)
|
|
7760
8105
|
});
|
|
@@ -7764,7 +8109,7 @@ var ClientServicesHost = class {
|
|
|
7764
8109
|
}
|
|
7765
8110
|
await this._level.open();
|
|
7766
8111
|
await this._loggingService.open();
|
|
7767
|
-
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._edgeConnection, this._runtimeParams, this._config.get("runtime.client.edgeFeatures"));
|
|
8112
|
+
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._edgeConnection, this._edgeHttpClient, this._runtimeParams, this._config.get("runtime.client.edgeFeatures"));
|
|
7768
8113
|
const dataSpaceManagerProvider = async () => {
|
|
7769
8114
|
await this._serviceContext.initialized.wait();
|
|
7770
8115
|
return this._serviceContext.dataSpaceManager;
|
|
@@ -7810,7 +8155,7 @@ var ClientServicesHost = class {
|
|
|
7810
8155
|
deviceKey
|
|
7811
8156
|
}, {
|
|
7812
8157
|
F: __dxlog_file27,
|
|
7813
|
-
L:
|
|
8158
|
+
L: 354,
|
|
7814
8159
|
S: this,
|
|
7815
8160
|
C: (f, a) => f(...a)
|
|
7816
8161
|
});
|
|
@@ -7818,7 +8163,7 @@ var ClientServicesHost = class {
|
|
|
7818
8163
|
id: traceId
|
|
7819
8164
|
}), {
|
|
7820
8165
|
F: __dxlog_file27,
|
|
7821
|
-
L:
|
|
8166
|
+
L: 355,
|
|
7822
8167
|
S: this,
|
|
7823
8168
|
C: (f, a) => f(...a)
|
|
7824
8169
|
});
|
|
@@ -7832,7 +8177,7 @@ var ClientServicesHost = class {
|
|
|
7832
8177
|
deviceKey
|
|
7833
8178
|
}, {
|
|
7834
8179
|
F: __dxlog_file27,
|
|
7835
|
-
L:
|
|
8180
|
+
L: 366,
|
|
7836
8181
|
S: this,
|
|
7837
8182
|
C: (f, a) => f(...a)
|
|
7838
8183
|
});
|
|
@@ -7850,7 +8195,7 @@ var ClientServicesHost = class {
|
|
|
7850
8195
|
deviceKey
|
|
7851
8196
|
}, {
|
|
7852
8197
|
F: __dxlog_file27,
|
|
7853
|
-
L:
|
|
8198
|
+
L: 375,
|
|
7854
8199
|
S: this,
|
|
7855
8200
|
C: (f, a) => f(...a)
|
|
7856
8201
|
});
|
|
@@ -7861,13 +8206,13 @@ var ClientServicesHost = class {
|
|
|
7861
8206
|
id: traceId
|
|
7862
8207
|
}), {
|
|
7863
8208
|
F: __dxlog_file27,
|
|
7864
|
-
L:
|
|
8209
|
+
L: 380,
|
|
7865
8210
|
S: this,
|
|
7866
8211
|
C: (f, a) => f(...a)
|
|
7867
8212
|
});
|
|
7868
8213
|
log24.info("resetting...", void 0, {
|
|
7869
8214
|
F: __dxlog_file27,
|
|
7870
|
-
L:
|
|
8215
|
+
L: 382,
|
|
7871
8216
|
S: this,
|
|
7872
8217
|
C: (f, a) => f(...a)
|
|
7873
8218
|
});
|
|
@@ -7875,7 +8220,7 @@ var ClientServicesHost = class {
|
|
|
7875
8220
|
await this._storage.reset();
|
|
7876
8221
|
log24.info("reset", void 0, {
|
|
7877
8222
|
F: __dxlog_file27,
|
|
7878
|
-
L:
|
|
8223
|
+
L: 385,
|
|
7879
8224
|
S: this,
|
|
7880
8225
|
C: (f, a) => f(...a)
|
|
7881
8226
|
});
|
|
@@ -7883,7 +8228,7 @@ var ClientServicesHost = class {
|
|
|
7883
8228
|
id: traceId
|
|
7884
8229
|
}), {
|
|
7885
8230
|
F: __dxlog_file27,
|
|
7886
|
-
L:
|
|
8231
|
+
L: 386,
|
|
7887
8232
|
S: this,
|
|
7888
8233
|
C: (f, a) => f(...a)
|
|
7889
8234
|
});
|
|
@@ -7895,21 +8240,21 @@ var ClientServicesHost = class {
|
|
|
7895
8240
|
return identity;
|
|
7896
8241
|
}
|
|
7897
8242
|
};
|
|
7898
|
-
|
|
8243
|
+
_ts_decorate10([
|
|
7899
8244
|
Trace4.info()
|
|
7900
8245
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
7901
|
-
|
|
8246
|
+
_ts_decorate10([
|
|
7902
8247
|
Trace4.info()
|
|
7903
8248
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
7904
|
-
|
|
8249
|
+
_ts_decorate10([
|
|
7905
8250
|
synchronized3,
|
|
7906
8251
|
Trace4.span()
|
|
7907
8252
|
], ClientServicesHost.prototype, "open", null);
|
|
7908
|
-
|
|
8253
|
+
_ts_decorate10([
|
|
7909
8254
|
synchronized3,
|
|
7910
8255
|
Trace4.span()
|
|
7911
8256
|
], ClientServicesHost.prototype, "close", null);
|
|
7912
|
-
ClientServicesHost =
|
|
8257
|
+
ClientServicesHost = _ts_decorate10([
|
|
7913
8258
|
Trace4.resource()
|
|
7914
8259
|
], ClientServicesHost);
|
|
7915
8260
|
|
|
@@ -7957,4 +8302,4 @@ export {
|
|
|
7957
8302
|
importProfileData,
|
|
7958
8303
|
ClientServicesHost
|
|
7959
8304
|
};
|
|
7960
|
-
//# sourceMappingURL=chunk-
|
|
8305
|
+
//# sourceMappingURL=chunk-XVI3VSJT.mjs.map
|