@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
|
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
397
397
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
398
398
|
|
|
399
399
|
// packages/sdk/client-services/src/version.ts
|
|
400
|
-
var DXOS_VERSION = "0.6.12-main.
|
|
400
|
+
var DXOS_VERSION = "0.6.12-main.89e9959";
|
|
401
401
|
|
|
402
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
403
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -670,7 +670,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
670
670
|
return false;
|
|
671
671
|
}
|
|
672
672
|
if (this._isTrustedKey(credential.issuer)) {
|
|
673
|
-
log2("key is
|
|
673
|
+
log2("key is trusted -- auth success", {
|
|
674
674
|
key: credential.issuer
|
|
675
675
|
}, {
|
|
676
676
|
F: __dxlog_file4,
|
|
@@ -697,7 +697,10 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
697
697
|
trigger.wake(true);
|
|
698
698
|
} else {
|
|
699
699
|
log2("key is not currently in trusted set, waiting...", {
|
|
700
|
-
key: credential.issuer
|
|
700
|
+
key: credential.issuer,
|
|
701
|
+
trusted: [
|
|
702
|
+
...this._params.trustedKeysProvider()
|
|
703
|
+
]
|
|
701
704
|
}, {
|
|
702
705
|
F: __dxlog_file4,
|
|
703
706
|
L: 84,
|
|
@@ -730,11 +733,17 @@ import { Context as Context3, Resource } from "@dxos/context";
|
|
|
730
733
|
import { EdgeConnectionClosedError, EdgeIdentityChangedError } from "@dxos/edge-client";
|
|
731
734
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
732
735
|
import { PublicKey as PublicKey3 } from "@dxos/keys";
|
|
733
|
-
import { log as log3 } from "@dxos/log";
|
|
736
|
+
import { log as log3, logInfo } from "@dxos/log";
|
|
734
737
|
import { EdgeService } from "@dxos/protocols";
|
|
735
738
|
import { buf } from "@dxos/protocols/buf";
|
|
736
739
|
import { MessageSchema as RouterMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
|
|
737
740
|
import { ComplexMap as ComplexMap2, arrayToBuffer, bufferToArray, defaultMap, rangeFromTo } from "@dxos/util";
|
|
741
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
742
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
743
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
744
|
+
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;
|
|
745
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
746
|
+
}
|
|
738
747
|
function _using_ctx() {
|
|
739
748
|
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
740
749
|
var err = new Error();
|
|
@@ -816,6 +825,12 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
816
825
|
this._spaceId = spaceId;
|
|
817
826
|
}
|
|
818
827
|
async _open() {
|
|
828
|
+
log3("open", void 0, {
|
|
829
|
+
F: __dxlog_file5,
|
|
830
|
+
L: 56,
|
|
831
|
+
S: this,
|
|
832
|
+
C: (f, a) => f(...a)
|
|
833
|
+
});
|
|
819
834
|
this._ctx.onDispose(this._messenger.addListener((message) => {
|
|
820
835
|
if (!message.serviceId) {
|
|
821
836
|
return;
|
|
@@ -831,20 +846,20 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
831
846
|
_spaceId: this._spaceId
|
|
832
847
|
}, {
|
|
833
848
|
F: __dxlog_file5,
|
|
834
|
-
L:
|
|
849
|
+
L: 70,
|
|
835
850
|
S: this,
|
|
836
851
|
C: (f, a) => f(...a)
|
|
837
852
|
});
|
|
838
853
|
return;
|
|
839
854
|
}
|
|
840
855
|
const payload = decodeCbor(message.payload.value);
|
|
841
|
-
log3
|
|
856
|
+
log3("receive", {
|
|
842
857
|
from: message.source,
|
|
843
858
|
feedKey: payload.feedKey,
|
|
844
859
|
type: payload.type
|
|
845
860
|
}, {
|
|
846
861
|
F: __dxlog_file5,
|
|
847
|
-
L:
|
|
862
|
+
L: 75,
|
|
848
863
|
S: this,
|
|
849
864
|
C: (f, a) => f(...a)
|
|
850
865
|
});
|
|
@@ -852,46 +867,44 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
852
867
|
}));
|
|
853
868
|
this._messenger.connected.on(this._ctx, async () => {
|
|
854
869
|
await this._resetConnection();
|
|
855
|
-
this.
|
|
856
|
-
const connectionCtx = new Context3({
|
|
857
|
-
onError: async (err) => {
|
|
858
|
-
if (connectionCtx !== this._connectionCtx) {
|
|
859
|
-
return;
|
|
860
|
-
}
|
|
861
|
-
if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
|
|
862
|
-
log3("resetting on reconnect", void 0, {
|
|
863
|
-
F: __dxlog_file5,
|
|
864
|
-
L: 86,
|
|
865
|
-
S: this,
|
|
866
|
-
C: (f, a) => f(...a)
|
|
867
|
-
});
|
|
868
|
-
await this._resetConnection();
|
|
869
|
-
} else {
|
|
870
|
-
this._ctx.raise(err);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
}, {
|
|
874
|
-
F: __dxlog_file5,
|
|
875
|
-
L: 80
|
|
876
|
-
});
|
|
877
|
-
this._connectionCtx = connectionCtx;
|
|
878
|
-
log3("connection context created", void 0, {
|
|
879
|
-
F: __dxlog_file5,
|
|
880
|
-
L: 94,
|
|
881
|
-
S: this,
|
|
882
|
-
C: (f, a) => f(...a)
|
|
883
|
-
});
|
|
884
|
-
scheduleMicroTask(connectionCtx, async () => {
|
|
885
|
-
for (const feed of this._feeds.values()) {
|
|
886
|
-
await this._replicateFeed(connectionCtx, feed);
|
|
887
|
-
}
|
|
888
|
-
});
|
|
870
|
+
this._startReplication();
|
|
889
871
|
});
|
|
872
|
+
if (this._messenger.isConnected) {
|
|
873
|
+
this._startReplication();
|
|
874
|
+
}
|
|
890
875
|
}
|
|
891
876
|
async _close() {
|
|
877
|
+
log3("close", void 0, {
|
|
878
|
+
F: __dxlog_file5,
|
|
879
|
+
L: 91,
|
|
880
|
+
S: this,
|
|
881
|
+
C: (f, a) => f(...a)
|
|
882
|
+
});
|
|
892
883
|
await this._resetConnection();
|
|
893
884
|
}
|
|
885
|
+
_startReplication() {
|
|
886
|
+
this._connected = true;
|
|
887
|
+
const connectionCtx = this._createConnectionContext();
|
|
888
|
+
this._connectionCtx = connectionCtx;
|
|
889
|
+
log3("connection context created", void 0, {
|
|
890
|
+
F: __dxlog_file5,
|
|
891
|
+
L: 99,
|
|
892
|
+
S: this,
|
|
893
|
+
C: (f, a) => f(...a)
|
|
894
|
+
});
|
|
895
|
+
scheduleMicroTask(connectionCtx, async () => {
|
|
896
|
+
for (const feed of this._feeds.values()) {
|
|
897
|
+
await this._replicateFeed(connectionCtx, feed);
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
}
|
|
894
901
|
async _resetConnection() {
|
|
902
|
+
log3("resetConnection", void 0, {
|
|
903
|
+
F: __dxlog_file5,
|
|
904
|
+
L: 108,
|
|
905
|
+
S: this,
|
|
906
|
+
C: (f, a) => f(...a)
|
|
907
|
+
});
|
|
895
908
|
this._connected = false;
|
|
896
909
|
await this._connectionCtx?.dispose();
|
|
897
910
|
this._connectionCtx = void 0;
|
|
@@ -899,10 +912,12 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
899
912
|
}
|
|
900
913
|
async addFeed(feed) {
|
|
901
914
|
log3.info("addFeed", {
|
|
902
|
-
key: feed.key
|
|
915
|
+
key: feed.key,
|
|
916
|
+
connected: this._connected,
|
|
917
|
+
hasConnectionCtx: !!this._connectionCtx
|
|
903
918
|
}, {
|
|
904
919
|
F: __dxlog_file5,
|
|
905
|
-
L:
|
|
920
|
+
L: 116,
|
|
906
921
|
S: this,
|
|
907
922
|
C: (f, a) => f(...a)
|
|
908
923
|
});
|
|
@@ -915,6 +930,14 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
915
930
|
return defaultMap(this._pushMutex, key, () => new Mutex());
|
|
916
931
|
}
|
|
917
932
|
async _replicateFeed(ctx, feed) {
|
|
933
|
+
log3("replicateFeed", {
|
|
934
|
+
key: feed.key
|
|
935
|
+
}, {
|
|
936
|
+
F: __dxlog_file5,
|
|
937
|
+
L: 129,
|
|
938
|
+
S: this,
|
|
939
|
+
C: (f, a) => f(...a)
|
|
940
|
+
});
|
|
918
941
|
await this._sendMessage({
|
|
919
942
|
type: "get-metadata",
|
|
920
943
|
feedKey: feed.key.toHex()
|
|
@@ -927,7 +950,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
927
950
|
if (!this._connectionCtx) {
|
|
928
951
|
log3.info("message dropped because connection was disposed", void 0, {
|
|
929
952
|
F: __dxlog_file5,
|
|
930
|
-
L:
|
|
953
|
+
L: 142,
|
|
931
954
|
S: this,
|
|
932
955
|
C: (f, a) => f(...a)
|
|
933
956
|
});
|
|
@@ -941,13 +964,13 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
941
964
|
};
|
|
942
965
|
log3.info("sending message", logPayload, {
|
|
943
966
|
F: __dxlog_file5,
|
|
944
|
-
L:
|
|
967
|
+
L: 148,
|
|
945
968
|
S: this,
|
|
946
969
|
C: (f, a) => f(...a)
|
|
947
970
|
});
|
|
948
971
|
invariant2(message.feedKey, void 0, {
|
|
949
972
|
F: __dxlog_file5,
|
|
950
|
-
L:
|
|
973
|
+
L: 150,
|
|
951
974
|
S: this,
|
|
952
975
|
A: [
|
|
953
976
|
"message.feedKey",
|
|
@@ -955,6 +978,14 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
955
978
|
]
|
|
956
979
|
});
|
|
957
980
|
const payloadValue = bufferToArray(encodeCbor(message));
|
|
981
|
+
log3("send", {
|
|
982
|
+
type: message.type
|
|
983
|
+
}, {
|
|
984
|
+
F: __dxlog_file5,
|
|
985
|
+
L: 153,
|
|
986
|
+
S: this,
|
|
987
|
+
C: (f, a) => f(...a)
|
|
988
|
+
});
|
|
958
989
|
await this._messenger.send(buf.create(RouterMessageSchema, {
|
|
959
990
|
source: {
|
|
960
991
|
identityKey: this._messenger.identityKey,
|
|
@@ -970,7 +1001,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
970
1001
|
if (!this._connectionCtx) {
|
|
971
1002
|
log3.warn("received message after connection context was disposed", void 0, {
|
|
972
1003
|
F: __dxlog_file5,
|
|
973
|
-
L:
|
|
1004
|
+
L: 168,
|
|
974
1005
|
S: this,
|
|
975
1006
|
C: (f, a) => f(...a)
|
|
976
1007
|
});
|
|
@@ -985,7 +1016,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
985
1016
|
message
|
|
986
1017
|
}, {
|
|
987
1018
|
F: __dxlog_file5,
|
|
988
|
-
L:
|
|
1019
|
+
L: 174,
|
|
989
1020
|
S: this,
|
|
990
1021
|
C: (f, a) => f(...a)
|
|
991
1022
|
});
|
|
@@ -996,7 +1027,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
996
1027
|
feedKey
|
|
997
1028
|
}, {
|
|
998
1029
|
F: __dxlog_file5,
|
|
999
|
-
L:
|
|
1030
|
+
L: 179,
|
|
1000
1031
|
S: this,
|
|
1001
1032
|
C: (f, a) => f(...a)
|
|
1002
1033
|
});
|
|
@@ -1029,7 +1060,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1029
1060
|
blocks: message.blocks.map((b) => b.index)
|
|
1030
1061
|
}, {
|
|
1031
1062
|
F: __dxlog_file5,
|
|
1032
|
-
L:
|
|
1063
|
+
L: 201,
|
|
1033
1064
|
S: this,
|
|
1034
1065
|
C: (f, a) => f(...a)
|
|
1035
1066
|
});
|
|
@@ -1040,7 +1071,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1040
1071
|
feedKey
|
|
1041
1072
|
}, {
|
|
1042
1073
|
F: __dxlog_file5,
|
|
1043
|
-
L:
|
|
1074
|
+
L: 206,
|
|
1044
1075
|
S: this,
|
|
1045
1076
|
C: (f, a) => f(...a)
|
|
1046
1077
|
});
|
|
@@ -1054,7 +1085,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1054
1085
|
...message
|
|
1055
1086
|
}, {
|
|
1056
1087
|
F: __dxlog_file5,
|
|
1057
|
-
L:
|
|
1088
|
+
L: 215,
|
|
1058
1089
|
S: this,
|
|
1059
1090
|
C: (f, a) => f(...a)
|
|
1060
1091
|
});
|
|
@@ -1069,7 +1100,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1069
1100
|
to
|
|
1070
1101
|
}, {
|
|
1071
1102
|
F: __dxlog_file5,
|
|
1072
|
-
L:
|
|
1103
|
+
L: 222,
|
|
1073
1104
|
S: this,
|
|
1074
1105
|
C: (f, a) => f(...a)
|
|
1075
1106
|
});
|
|
@@ -1079,7 +1110,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1079
1110
|
});
|
|
1080
1111
|
invariant2(data instanceof Uint8Array, void 0, {
|
|
1081
1112
|
F: __dxlog_file5,
|
|
1082
|
-
L:
|
|
1113
|
+
L: 227,
|
|
1083
1114
|
S: this,
|
|
1084
1115
|
A: [
|
|
1085
1116
|
"data instanceof Uint8Array",
|
|
@@ -1107,7 +1138,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1107
1138
|
blocks: blocks.length
|
|
1108
1139
|
}, {
|
|
1109
1140
|
F: __dxlog_file5,
|
|
1110
|
-
L:
|
|
1141
|
+
L: 248,
|
|
1111
1142
|
S: this,
|
|
1112
1143
|
C: (f, a) => f(...a)
|
|
1113
1144
|
});
|
|
@@ -1129,7 +1160,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1129
1160
|
if (!this._remoteLength.has(feed.key)) {
|
|
1130
1161
|
log3("blocks not pushed because remote length is unknown", void 0, {
|
|
1131
1162
|
F: __dxlog_file5,
|
|
1132
|
-
L:
|
|
1163
|
+
L: 269,
|
|
1133
1164
|
S: this,
|
|
1134
1165
|
C: (f, a) => f(...a)
|
|
1135
1166
|
});
|
|
@@ -1145,7 +1176,34 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1145
1176
|
_usingCtx.d();
|
|
1146
1177
|
}
|
|
1147
1178
|
}
|
|
1179
|
+
_createConnectionContext() {
|
|
1180
|
+
const connectionCtx = new Context3({
|
|
1181
|
+
onError: async (err) => {
|
|
1182
|
+
if (connectionCtx !== this._connectionCtx) {
|
|
1183
|
+
return;
|
|
1184
|
+
}
|
|
1185
|
+
if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
|
|
1186
|
+
log3("resetting on reconnect", void 0, {
|
|
1187
|
+
F: __dxlog_file5,
|
|
1188
|
+
L: 286,
|
|
1189
|
+
S: this,
|
|
1190
|
+
C: (f, a) => f(...a)
|
|
1191
|
+
});
|
|
1192
|
+
await this._resetConnection();
|
|
1193
|
+
} else {
|
|
1194
|
+
this._ctx.raise(err);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}, {
|
|
1198
|
+
F: __dxlog_file5,
|
|
1199
|
+
L: 280
|
|
1200
|
+
});
|
|
1201
|
+
return connectionCtx;
|
|
1202
|
+
}
|
|
1148
1203
|
};
|
|
1204
|
+
_ts_decorate([
|
|
1205
|
+
logInfo
|
|
1206
|
+
], EdgeFeedReplicator.prototype, "_spaceId", void 0);
|
|
1149
1207
|
var bufferizeBlock = (block) => ({
|
|
1150
1208
|
index: block.index,
|
|
1151
1209
|
data: arrayToBuffer(block.data),
|
|
@@ -1160,7 +1218,7 @@ var bufferizeBlock = (block) => ({
|
|
|
1160
1218
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
1161
1219
|
import { Event as Event7, Mutex as Mutex2, scheduleTask as scheduleTask4, sleep as sleep3, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
|
|
1162
1220
|
import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
1163
|
-
import { Context as
|
|
1221
|
+
import { Context as Context5, ContextDisposedError, cancelWithContext as cancelWithContext2 } from "@dxos/context";
|
|
1164
1222
|
import { timed, warnAfterTimeout } from "@dxos/debug";
|
|
1165
1223
|
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
1166
1224
|
import { SpaceDocVersion as SpaceDocVersion3 } from "@dxos/echo-protocol";
|
|
@@ -1395,53 +1453,67 @@ var runEpochMigration = async (ctx, context) => {
|
|
|
1395
1453
|
};
|
|
1396
1454
|
|
|
1397
1455
|
// packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
|
|
1398
|
-
import { DeferredTask, Event as Event3, scheduleTask as scheduleTask2, sleep, TimeoutError, Trigger as Trigger2 } from "@dxos/async";
|
|
1399
|
-
import {
|
|
1456
|
+
import { DeferredTask, Event as Event3, scheduleTask as scheduleTask2, sleep, TimeoutError, Trigger as Trigger2, scheduleMicroTask as scheduleMicroTask2 } from "@dxos/async";
|
|
1457
|
+
import { rejectOnDispose, Resource as Resource3 } from "@dxos/context";
|
|
1458
|
+
import { verifyCredential as verifyCredential2 } from "@dxos/credentials";
|
|
1400
1459
|
import { invariant as invariant4 } from "@dxos/invariant";
|
|
1401
1460
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1402
|
-
import { log as log5 } from "@dxos/log";
|
|
1461
|
+
import { logInfo as logInfo2, log as log5 } from "@dxos/log";
|
|
1462
|
+
import { EdgeCallFailedError } from "@dxos/protocols";
|
|
1403
1463
|
import { schema as schema2 } from "@dxos/protocols/proto";
|
|
1404
1464
|
import { RpcExtension } from "@dxos/teleport";
|
|
1405
1465
|
import { ComplexMap as ComplexMap3, ComplexSet, entry } from "@dxos/util";
|
|
1466
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1467
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1468
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1469
|
+
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;
|
|
1470
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1471
|
+
}
|
|
1406
1472
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts";
|
|
1407
1473
|
var DEFAULT_RETRY_TIMEOUT = 1e3;
|
|
1408
1474
|
var DEFAULT_SUCCESS_DELAY = 1e3;
|
|
1409
1475
|
var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
|
|
1476
|
+
var MAX_EDGE_RETRIES = 2;
|
|
1410
1477
|
var WRITER_NOT_SET_ERROR_CODE = "WRITER_NOT_SET";
|
|
1411
|
-
var
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
L: 62
|
|
1416
|
-
});
|
|
1478
|
+
var credentialCodec = schema2.getCodecForType("dxos.halo.credentials.Credential");
|
|
1479
|
+
var NotarizationPlugin = class extends Resource3 {
|
|
1480
|
+
constructor(params) {
|
|
1481
|
+
super();
|
|
1417
1482
|
this._extensionOpened = new Event3();
|
|
1418
1483
|
this._extensions = /* @__PURE__ */ new Set();
|
|
1419
1484
|
this._processedCredentials = new ComplexSet(PublicKey4.hash);
|
|
1420
1485
|
this._processCredentialsTriggers = new ComplexMap3(PublicKey4.hash);
|
|
1486
|
+
this._spaceId = params.spaceId;
|
|
1487
|
+
if (params.edgeClient && params.edgeFeatures?.feedReplicator) {
|
|
1488
|
+
this._edgeClient = params.edgeClient;
|
|
1489
|
+
}
|
|
1421
1490
|
}
|
|
1422
1491
|
get hasWriter() {
|
|
1423
1492
|
return !!this._writer;
|
|
1424
1493
|
}
|
|
1425
|
-
async
|
|
1494
|
+
async _open() {
|
|
1495
|
+
if (this._edgeClient && this._writer) {
|
|
1496
|
+
this._notarizePendingEdgeCredentials(this._edgeClient, this._writer);
|
|
1497
|
+
}
|
|
1426
1498
|
}
|
|
1427
|
-
async
|
|
1499
|
+
async _close() {
|
|
1428
1500
|
await this._ctx.dispose();
|
|
1429
1501
|
}
|
|
1430
1502
|
/**
|
|
1431
1503
|
* Request credentials to be notarized.
|
|
1432
1504
|
*/
|
|
1433
|
-
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY }) {
|
|
1505
|
+
async notarize({ ctx: opCtx, credentials, timeout = DEFAULT_NOTARIZE_TIMEOUT, retryTimeout = DEFAULT_RETRY_TIMEOUT, successDelay = DEFAULT_SUCCESS_DELAY, edgeRetryJitter }) {
|
|
1434
1506
|
log5("notarize", {
|
|
1435
1507
|
credentials
|
|
1436
1508
|
}, {
|
|
1437
1509
|
F: __dxlog_file7,
|
|
1438
|
-
L:
|
|
1510
|
+
L: 126,
|
|
1439
1511
|
S: this,
|
|
1440
1512
|
C: (f, a) => f(...a)
|
|
1441
1513
|
});
|
|
1442
1514
|
invariant4(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
1443
1515
|
F: __dxlog_file7,
|
|
1444
|
-
L:
|
|
1516
|
+
L: 127,
|
|
1445
1517
|
S: this,
|
|
1446
1518
|
A: [
|
|
1447
1519
|
"credentials.every((credential) => credential.id)",
|
|
@@ -1455,7 +1527,7 @@ var NotarizationPlugin = class {
|
|
|
1455
1527
|
err
|
|
1456
1528
|
}, {
|
|
1457
1529
|
F: __dxlog_file7,
|
|
1458
|
-
L:
|
|
1530
|
+
L: 135,
|
|
1459
1531
|
S: this,
|
|
1460
1532
|
C: (f, a) => f(...a)
|
|
1461
1533
|
});
|
|
@@ -1465,21 +1537,37 @@ var NotarizationPlugin = class {
|
|
|
1465
1537
|
});
|
|
1466
1538
|
opCtx?.onDispose(() => ctx.dispose());
|
|
1467
1539
|
if (timeout !== 0) {
|
|
1468
|
-
|
|
1469
|
-
log5.warn("Notarization timeout", {
|
|
1470
|
-
timeout,
|
|
1471
|
-
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1472
|
-
}, {
|
|
1473
|
-
F: __dxlog_file7,
|
|
1474
|
-
L: 111,
|
|
1475
|
-
S: this,
|
|
1476
|
-
C: (f, a) => f(...a)
|
|
1477
|
-
});
|
|
1478
|
-
void ctx.dispose();
|
|
1479
|
-
errors.throw(new TimeoutError(timeout, "Notarization timed out"));
|
|
1480
|
-
}, timeout);
|
|
1540
|
+
this._scheduleTimeout(ctx, errors, timeout);
|
|
1481
1541
|
}
|
|
1482
1542
|
const allNotarized = Promise.all(credentials.map((credential) => this._waitUntilProcessed(credential.id)));
|
|
1543
|
+
this._tryNotarizeCredentialsWithPeers(ctx, credentials, {
|
|
1544
|
+
retryTimeout,
|
|
1545
|
+
successDelay
|
|
1546
|
+
});
|
|
1547
|
+
if (this._edgeClient) {
|
|
1548
|
+
this._tryNotarizeCredentialsWithEdge(ctx, this._edgeClient, credentials, {
|
|
1549
|
+
retryTimeout,
|
|
1550
|
+
successDelay,
|
|
1551
|
+
jitter: edgeRetryJitter
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
try {
|
|
1555
|
+
await Promise.race([
|
|
1556
|
+
rejectOnDispose(ctx),
|
|
1557
|
+
allNotarized,
|
|
1558
|
+
errors.wait()
|
|
1559
|
+
]);
|
|
1560
|
+
log5("done", void 0, {
|
|
1561
|
+
F: __dxlog_file7,
|
|
1562
|
+
L: 160,
|
|
1563
|
+
S: this,
|
|
1564
|
+
C: (f, a) => f(...a)
|
|
1565
|
+
});
|
|
1566
|
+
} finally {
|
|
1567
|
+
await ctx.dispose();
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
_tryNotarizeCredentialsWithPeers(ctx, credentials, { retryTimeout, successDelay }) {
|
|
1483
1571
|
const peersTried = /* @__PURE__ */ new Set();
|
|
1484
1572
|
const notarizeTask = new DeferredTask(ctx, async () => {
|
|
1485
1573
|
try {
|
|
@@ -1494,7 +1582,7 @@ var NotarizationPlugin = class {
|
|
|
1494
1582
|
retryIn: retryTimeout
|
|
1495
1583
|
}, {
|
|
1496
1584
|
F: __dxlog_file7,
|
|
1497
|
-
L:
|
|
1585
|
+
L: 183,
|
|
1498
1586
|
S: this,
|
|
1499
1587
|
C: (f, a) => f(...a)
|
|
1500
1588
|
});
|
|
@@ -1508,7 +1596,7 @@ var NotarizationPlugin = class {
|
|
|
1508
1596
|
credentialId: credentials.map((credential) => credential.id)
|
|
1509
1597
|
}, {
|
|
1510
1598
|
F: __dxlog_file7,
|
|
1511
|
-
L:
|
|
1599
|
+
L: 190,
|
|
1512
1600
|
S: this,
|
|
1513
1601
|
C: (f, a) => f(...a)
|
|
1514
1602
|
});
|
|
@@ -1517,7 +1605,7 @@ var NotarizationPlugin = class {
|
|
|
1517
1605
|
});
|
|
1518
1606
|
log5("success", void 0, {
|
|
1519
1607
|
F: __dxlog_file7,
|
|
1520
|
-
L:
|
|
1608
|
+
L: 194,
|
|
1521
1609
|
S: this,
|
|
1522
1610
|
C: (f, a) => f(...a)
|
|
1523
1611
|
});
|
|
@@ -1526,7 +1614,7 @@ var NotarizationPlugin = class {
|
|
|
1526
1614
|
if (!ctx.disposed && !err.message.includes(WRITER_NOT_SET_ERROR_CODE)) {
|
|
1527
1615
|
log5.info("error notarizing (recoverable)", err, {
|
|
1528
1616
|
F: __dxlog_file7,
|
|
1529
|
-
L:
|
|
1617
|
+
L: 199,
|
|
1530
1618
|
S: this,
|
|
1531
1619
|
C: (f, a) => f(...a)
|
|
1532
1620
|
});
|
|
@@ -1536,21 +1624,33 @@ var NotarizationPlugin = class {
|
|
|
1536
1624
|
});
|
|
1537
1625
|
notarizeTask.schedule();
|
|
1538
1626
|
this._extensionOpened.on(ctx, () => notarizeTask.schedule());
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1627
|
+
}
|
|
1628
|
+
_tryNotarizeCredentialsWithEdge(ctx, client, credentials, timeouts) {
|
|
1629
|
+
const encodedCredentials = credentials.map((credential) => {
|
|
1630
|
+
const binary = credentialCodec.encode(credential);
|
|
1631
|
+
return Buffer.from(binary).toString("base64");
|
|
1632
|
+
});
|
|
1633
|
+
scheduleTask2(ctx, async () => {
|
|
1634
|
+
try {
|
|
1635
|
+
await client.notarizeCredentials(this._spaceId, {
|
|
1636
|
+
credentials: encodedCredentials
|
|
1637
|
+
}, {
|
|
1638
|
+
retry: {
|
|
1639
|
+
count: MAX_EDGE_RETRIES,
|
|
1640
|
+
timeout: timeouts.retryTimeout,
|
|
1641
|
+
jitter: timeouts.jitter
|
|
1642
|
+
}
|
|
1643
|
+
});
|
|
1644
|
+
log5("edge notarization success", void 0, {
|
|
1645
|
+
F: __dxlog_file7,
|
|
1646
|
+
L: 227,
|
|
1647
|
+
S: this,
|
|
1648
|
+
C: (f, a) => f(...a)
|
|
1649
|
+
});
|
|
1650
|
+
} catch (error) {
|
|
1651
|
+
handleEdgeError(error);
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1554
1654
|
}
|
|
1555
1655
|
/**
|
|
1556
1656
|
* Called with credentials arriving from the control pipeline.
|
|
@@ -1566,7 +1666,7 @@ var NotarizationPlugin = class {
|
|
|
1566
1666
|
setWriter(writer) {
|
|
1567
1667
|
invariant4(!this._writer, "Writer already set.", {
|
|
1568
1668
|
F: __dxlog_file7,
|
|
1569
|
-
L:
|
|
1669
|
+
L: 247,
|
|
1570
1670
|
S: this,
|
|
1571
1671
|
A: [
|
|
1572
1672
|
"!this._writer",
|
|
@@ -1574,6 +1674,59 @@ var NotarizationPlugin = class {
|
|
|
1574
1674
|
]
|
|
1575
1675
|
});
|
|
1576
1676
|
this._writer = writer;
|
|
1677
|
+
if (this._edgeClient) {
|
|
1678
|
+
this._notarizePendingEdgeCredentials(this._edgeClient, writer);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* The method is used only for adding agent feeds to spaces.
|
|
1683
|
+
* When an agent is created we can admit them into all the existing spaces. In case the operation fails
|
|
1684
|
+
* this method will fix it on the next space open.
|
|
1685
|
+
* Given how rarely this happens there's no need to poll the endpoint.
|
|
1686
|
+
*/
|
|
1687
|
+
_notarizePendingEdgeCredentials(client, writer) {
|
|
1688
|
+
scheduleMicroTask2(this._ctx, async () => {
|
|
1689
|
+
try {
|
|
1690
|
+
const response = await client.getCredentialsForNotarization(this._spaceId, {
|
|
1691
|
+
retry: {
|
|
1692
|
+
count: MAX_EDGE_RETRIES
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
const credentials = response.awaitingNotarization.credentials;
|
|
1696
|
+
if (!credentials.length) {
|
|
1697
|
+
log5("edge did not return credentials for notarization", void 0, {
|
|
1698
|
+
F: __dxlog_file7,
|
|
1699
|
+
L: 269,
|
|
1700
|
+
S: this,
|
|
1701
|
+
C: (f, a) => f(...a)
|
|
1702
|
+
});
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
log5("got edge credentials for notarization", {
|
|
1706
|
+
count: credentials.length
|
|
1707
|
+
}, {
|
|
1708
|
+
F: __dxlog_file7,
|
|
1709
|
+
L: 273,
|
|
1710
|
+
S: this,
|
|
1711
|
+
C: (f, a) => f(...a)
|
|
1712
|
+
});
|
|
1713
|
+
const decodedCredentials = credentials.map((credential) => {
|
|
1714
|
+
const binary = Buffer.from(credential, "base64");
|
|
1715
|
+
return credentialCodec.decode(binary);
|
|
1716
|
+
});
|
|
1717
|
+
await this._notarizeCredentials(writer, decodedCredentials);
|
|
1718
|
+
log5.info("notarized edge credentials", {
|
|
1719
|
+
count: decodedCredentials.length
|
|
1720
|
+
}, {
|
|
1721
|
+
F: __dxlog_file7,
|
|
1722
|
+
L: 282,
|
|
1723
|
+
S: this,
|
|
1724
|
+
C: (f, a) => f(...a)
|
|
1725
|
+
});
|
|
1726
|
+
} catch (error) {
|
|
1727
|
+
handleEdgeError(error);
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1577
1730
|
}
|
|
1578
1731
|
async _waitUntilProcessed(id) {
|
|
1579
1732
|
if (this._processedCredentials.has(id)) {
|
|
@@ -1588,10 +1741,13 @@ var NotarizationPlugin = class {
|
|
|
1588
1741
|
if (!this._writer) {
|
|
1589
1742
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
1590
1743
|
}
|
|
1591
|
-
|
|
1744
|
+
await this._notarizeCredentials(this._writer, request.credentials ?? []);
|
|
1745
|
+
}
|
|
1746
|
+
async _notarizeCredentials(writer, credentials) {
|
|
1747
|
+
for (const credential of credentials) {
|
|
1592
1748
|
invariant4(credential.id, "Credential must have an id", {
|
|
1593
1749
|
F: __dxlog_file7,
|
|
1594
|
-
L:
|
|
1750
|
+
L: 308,
|
|
1595
1751
|
S: this,
|
|
1596
1752
|
A: [
|
|
1597
1753
|
"credential.id",
|
|
@@ -1601,7 +1757,11 @@ var NotarizationPlugin = class {
|
|
|
1601
1757
|
if (this._processedCredentials.has(credential.id)) {
|
|
1602
1758
|
continue;
|
|
1603
1759
|
}
|
|
1604
|
-
await
|
|
1760
|
+
const verificationResult = await verifyCredential2(credential);
|
|
1761
|
+
if (verificationResult.kind === "fail") {
|
|
1762
|
+
throw new Error(`Credential verification failed: ${verificationResult.errors.join("\n")}.`);
|
|
1763
|
+
}
|
|
1764
|
+
await writer.write(credential);
|
|
1605
1765
|
}
|
|
1606
1766
|
}
|
|
1607
1767
|
createExtension() {
|
|
@@ -1611,7 +1771,7 @@ var NotarizationPlugin = class {
|
|
|
1611
1771
|
peer: extension.localPeerId
|
|
1612
1772
|
}, {
|
|
1613
1773
|
F: __dxlog_file7,
|
|
1614
|
-
L:
|
|
1774
|
+
L: 323,
|
|
1615
1775
|
S: this,
|
|
1616
1776
|
C: (f, a) => f(...a)
|
|
1617
1777
|
});
|
|
@@ -1623,7 +1783,7 @@ var NotarizationPlugin = class {
|
|
|
1623
1783
|
peer: extension.localPeerId
|
|
1624
1784
|
}, {
|
|
1625
1785
|
F: __dxlog_file7,
|
|
1626
|
-
L:
|
|
1786
|
+
L: 328,
|
|
1627
1787
|
S: this,
|
|
1628
1788
|
C: (f, a) => f(...a)
|
|
1629
1789
|
});
|
|
@@ -1633,6 +1793,43 @@ var NotarizationPlugin = class {
|
|
|
1633
1793
|
});
|
|
1634
1794
|
return extension;
|
|
1635
1795
|
}
|
|
1796
|
+
_scheduleTimeout(ctx, errors, timeout) {
|
|
1797
|
+
scheduleTask2(ctx, () => {
|
|
1798
|
+
log5.warn("Notarization timeout", {
|
|
1799
|
+
timeout,
|
|
1800
|
+
peers: Array.from(this._extensions).map((extension) => extension.remotePeerId)
|
|
1801
|
+
}, {
|
|
1802
|
+
F: __dxlog_file7,
|
|
1803
|
+
L: 340,
|
|
1804
|
+
S: this,
|
|
1805
|
+
C: (f, a) => f(...a)
|
|
1806
|
+
});
|
|
1807
|
+
void ctx.dispose();
|
|
1808
|
+
errors.throw(new TimeoutError(timeout, "Notarization timed out"));
|
|
1809
|
+
}, timeout);
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
_ts_decorate2([
|
|
1813
|
+
logInfo2
|
|
1814
|
+
], NotarizationPlugin.prototype, "_spaceId", void 0);
|
|
1815
|
+
var handleEdgeError = (error) => {
|
|
1816
|
+
if (!(error instanceof EdgeCallFailedError) || error.errorData) {
|
|
1817
|
+
log5.catch(error, void 0, {
|
|
1818
|
+
F: __dxlog_file7,
|
|
1819
|
+
L: 354,
|
|
1820
|
+
S: void 0,
|
|
1821
|
+
C: (f, a) => f(...a)
|
|
1822
|
+
});
|
|
1823
|
+
} else {
|
|
1824
|
+
log5.info("Edge notarization failure", {
|
|
1825
|
+
reason: error.reason
|
|
1826
|
+
}, {
|
|
1827
|
+
F: __dxlog_file7,
|
|
1828
|
+
L: 356,
|
|
1829
|
+
S: void 0,
|
|
1830
|
+
C: (f, a) => f(...a)
|
|
1831
|
+
});
|
|
1832
|
+
}
|
|
1636
1833
|
};
|
|
1637
1834
|
var NotarizationTeleportExtension = class extends RpcExtension {
|
|
1638
1835
|
constructor(_params) {
|
|
@@ -1727,7 +1924,7 @@ var DefaultSpaceStateMachine = class {
|
|
|
1727
1924
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
1728
1925
|
import { Event as Event4, synchronized, trackLeaks } from "@dxos/async";
|
|
1729
1926
|
import { PropertiesType } from "@dxos/client-protocol";
|
|
1730
|
-
import { LifecycleState, Resource as
|
|
1927
|
+
import { LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/context";
|
|
1731
1928
|
import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
|
|
1732
1929
|
import { convertLegacyReferences as convertLegacyReferences2, findInlineObjectOfType as findInlineObjectOfType2, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
|
|
1733
1930
|
import { LEGACY_TYPE_PROPERTIES, SpaceDocVersion as SpaceDocVersion2, encodeReference } from "@dxos/echo-protocol";
|
|
@@ -1814,7 +2011,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
|
1814
2011
|
};
|
|
1815
2012
|
|
|
1816
2013
|
// packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
|
|
1817
|
-
function
|
|
2014
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
1818
2015
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1819
2016
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1820
2017
|
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;
|
|
@@ -1824,13 +2021,14 @@ var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/sr
|
|
|
1824
2021
|
var PRESENCE_ANNOUNCE_INTERVAL = 1e4;
|
|
1825
2022
|
var PRESENCE_OFFLINE_TIMEOUT = 2e4;
|
|
1826
2023
|
var DEFAULT_SPACE_KEY = "__DEFAULT__";
|
|
1827
|
-
var DataSpaceManager = class extends
|
|
2024
|
+
var DataSpaceManager = class extends Resource4 {
|
|
1828
2025
|
constructor(params) {
|
|
1829
2026
|
super();
|
|
1830
2027
|
this.updated = new Event4();
|
|
1831
2028
|
this._spaces = new ComplexMap4(PublicKey5.hash);
|
|
1832
2029
|
this._instanceId = PublicKey5.random().toHex();
|
|
1833
2030
|
this._edgeConnection = void 0;
|
|
2031
|
+
this._edgeHttpClient = void 0;
|
|
1834
2032
|
this._edgeFeatures = void 0;
|
|
1835
2033
|
this._meshReplicator = void 0;
|
|
1836
2034
|
this._echoEdgeReplicator = void 0;
|
|
@@ -1846,6 +2044,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1846
2044
|
this._edgeConnection = params.edgeConnection;
|
|
1847
2045
|
this._edgeFeatures = params.edgeFeatures;
|
|
1848
2046
|
this._echoEdgeReplicator = params.echoEdgeReplicator;
|
|
2047
|
+
this._edgeHttpClient = params.edgeHttpClient;
|
|
1849
2048
|
this._runtimeParams = params.runtimeParams;
|
|
1850
2049
|
trace.diagnostic({
|
|
1851
2050
|
id: "spaces",
|
|
@@ -1877,7 +2076,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1877
2076
|
async _open() {
|
|
1878
2077
|
log7("open", void 0, {
|
|
1879
2078
|
F: __dxlog_file9,
|
|
1880
|
-
L:
|
|
2079
|
+
L: 198,
|
|
1881
2080
|
S: this,
|
|
1882
2081
|
C: (f, a) => f(...a)
|
|
1883
2082
|
});
|
|
@@ -1885,7 +2084,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1885
2084
|
id: this._instanceId
|
|
1886
2085
|
}), {
|
|
1887
2086
|
F: __dxlog_file9,
|
|
1888
|
-
L:
|
|
2087
|
+
L: 199,
|
|
1889
2088
|
S: this,
|
|
1890
2089
|
C: (f, a) => f(...a)
|
|
1891
2090
|
});
|
|
@@ -1893,7 +2092,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1893
2092
|
spaces: this._metadataStore.spaces.length
|
|
1894
2093
|
}, {
|
|
1895
2094
|
F: __dxlog_file9,
|
|
1896
|
-
L:
|
|
2095
|
+
L: 200,
|
|
1897
2096
|
S: this,
|
|
1898
2097
|
C: (f, a) => f(...a)
|
|
1899
2098
|
});
|
|
@@ -1903,7 +2102,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1903
2102
|
spaceMetadata
|
|
1904
2103
|
}, {
|
|
1905
2104
|
F: __dxlog_file9,
|
|
1906
|
-
L:
|
|
2105
|
+
L: 204,
|
|
1907
2106
|
S: this,
|
|
1908
2107
|
C: (f, a) => f(...a)
|
|
1909
2108
|
});
|
|
@@ -1914,7 +2113,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1914
2113
|
err
|
|
1915
2114
|
}, {
|
|
1916
2115
|
F: __dxlog_file9,
|
|
1917
|
-
L:
|
|
2116
|
+
L: 207,
|
|
1918
2117
|
S: this,
|
|
1919
2118
|
C: (f, a) => f(...a)
|
|
1920
2119
|
});
|
|
@@ -1925,7 +2124,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1925
2124
|
id: this._instanceId
|
|
1926
2125
|
}), {
|
|
1927
2126
|
F: __dxlog_file9,
|
|
1928
|
-
L:
|
|
2127
|
+
L: 213,
|
|
1929
2128
|
S: this,
|
|
1930
2129
|
C: (f, a) => f(...a)
|
|
1931
2130
|
});
|
|
@@ -1933,7 +2132,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1933
2132
|
async _close() {
|
|
1934
2133
|
log7("close", void 0, {
|
|
1935
2134
|
F: __dxlog_file9,
|
|
1936
|
-
L:
|
|
2135
|
+
L: 218,
|
|
1937
2136
|
S: this,
|
|
1938
2137
|
C: (f, a) => f(...a)
|
|
1939
2138
|
});
|
|
@@ -1948,7 +2147,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1948
2147
|
async createSpace() {
|
|
1949
2148
|
invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
1950
2149
|
F: __dxlog_file9,
|
|
1951
|
-
L:
|
|
2150
|
+
L: 230,
|
|
1952
2151
|
S: this,
|
|
1953
2152
|
A: [
|
|
1954
2153
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -1969,7 +2168,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1969
2168
|
spaceKey
|
|
1970
2169
|
}, {
|
|
1971
2170
|
F: __dxlog_file9,
|
|
1972
|
-
L:
|
|
2171
|
+
L: 242,
|
|
1973
2172
|
S: this,
|
|
1974
2173
|
C: (f, a) => f(...a)
|
|
1975
2174
|
});
|
|
@@ -1981,7 +2180,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
1981
2180
|
const memberCredential = credentials[1];
|
|
1982
2181
|
invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
1983
2182
|
F: __dxlog_file9,
|
|
1984
|
-
L:
|
|
2183
|
+
L: 252,
|
|
1985
2184
|
S: this,
|
|
1986
2185
|
A: [
|
|
1987
2186
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2013,7 +2212,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2013
2212
|
spaceId: space.id
|
|
2014
2213
|
}, {
|
|
2015
2214
|
F: __dxlog_file9,
|
|
2016
|
-
L:
|
|
2215
|
+
L: 277,
|
|
2017
2216
|
S: this,
|
|
2018
2217
|
C: (f, a) => f(...a)
|
|
2019
2218
|
});
|
|
@@ -2048,7 +2247,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2048
2247
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
2049
2248
|
invariant5(automergeIndex, void 0, {
|
|
2050
2249
|
F: __dxlog_file9,
|
|
2051
|
-
L:
|
|
2250
|
+
L: 310,
|
|
2052
2251
|
S: this,
|
|
2053
2252
|
A: [
|
|
2054
2253
|
"automergeIndex",
|
|
@@ -2065,13 +2264,13 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2065
2264
|
opts
|
|
2066
2265
|
}, {
|
|
2067
2266
|
F: __dxlog_file9,
|
|
2068
|
-
L:
|
|
2267
|
+
L: 319,
|
|
2069
2268
|
S: this,
|
|
2070
2269
|
C: (f, a) => f(...a)
|
|
2071
2270
|
});
|
|
2072
2271
|
invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
|
|
2073
2272
|
F: __dxlog_file9,
|
|
2074
|
-
L:
|
|
2273
|
+
L: 320,
|
|
2075
2274
|
S: this,
|
|
2076
2275
|
A: [
|
|
2077
2276
|
"this._lifecycleState === LifecycleState.OPEN",
|
|
@@ -2080,7 +2279,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2080
2279
|
});
|
|
2081
2280
|
invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
2082
2281
|
F: __dxlog_file9,
|
|
2083
|
-
L:
|
|
2282
|
+
L: 321,
|
|
2084
2283
|
S: this,
|
|
2085
2284
|
A: [
|
|
2086
2285
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -2104,7 +2303,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2104
2303
|
const space = this._spaceManager.spaces.get(options.spaceKey);
|
|
2105
2304
|
invariant5(space, void 0, {
|
|
2106
2305
|
F: __dxlog_file9,
|
|
2107
|
-
L:
|
|
2306
|
+
L: 341,
|
|
2108
2307
|
S: this,
|
|
2109
2308
|
A: [
|
|
2110
2309
|
"space",
|
|
@@ -2117,7 +2316,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2117
2316
|
const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
|
|
2118
2317
|
invariant5(credentials[0].credential, void 0, {
|
|
2119
2318
|
F: __dxlog_file9,
|
|
2120
|
-
L:
|
|
2319
|
+
L: 360,
|
|
2121
2320
|
S: this,
|
|
2122
2321
|
A: [
|
|
2123
2322
|
"credentials[0].credential",
|
|
@@ -2127,7 +2326,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2127
2326
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2128
2327
|
invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2129
2328
|
F: __dxlog_file9,
|
|
2130
|
-
L:
|
|
2329
|
+
L: 362,
|
|
2131
2330
|
S: this,
|
|
2132
2331
|
A: [
|
|
2133
2332
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2166,7 +2365,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2166
2365
|
metadata
|
|
2167
2366
|
}, {
|
|
2168
2367
|
F: __dxlog_file9,
|
|
2169
|
-
L:
|
|
2368
|
+
L: 398,
|
|
2170
2369
|
S: this,
|
|
2171
2370
|
C: (f, a) => f(...a)
|
|
2172
2371
|
});
|
|
@@ -2210,7 +2409,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2210
2409
|
err
|
|
2211
2410
|
}, {
|
|
2212
2411
|
F: __dxlog_file9,
|
|
2213
|
-
L:
|
|
2412
|
+
L: 440,
|
|
2214
2413
|
S: this,
|
|
2215
2414
|
C: (f, a) => f(...a)
|
|
2216
2415
|
});
|
|
@@ -2220,7 +2419,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2220
2419
|
onAuthFailure: () => {
|
|
2221
2420
|
log7.warn("auth failure", void 0, {
|
|
2222
2421
|
F: __dxlog_file9,
|
|
2223
|
-
L:
|
|
2422
|
+
L: 445,
|
|
2224
2423
|
S: this,
|
|
2225
2424
|
C: (f, a) => f(...a)
|
|
2226
2425
|
});
|
|
@@ -2253,7 +2452,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2253
2452
|
space: space.key
|
|
2254
2453
|
}, {
|
|
2255
2454
|
F: __dxlog_file9,
|
|
2256
|
-
L:
|
|
2455
|
+
L: 472,
|
|
2257
2456
|
S: this,
|
|
2258
2457
|
C: (f, a) => f(...a)
|
|
2259
2458
|
});
|
|
@@ -2264,7 +2463,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2264
2463
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
2265
2464
|
}, {
|
|
2266
2465
|
F: __dxlog_file9,
|
|
2267
|
-
L:
|
|
2466
|
+
L: 475,
|
|
2268
2467
|
S: this,
|
|
2269
2468
|
C: (f, a) => f(...a)
|
|
2270
2469
|
});
|
|
@@ -2283,7 +2482,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2283
2482
|
space: space.key
|
|
2284
2483
|
}, {
|
|
2285
2484
|
F: __dxlog_file9,
|
|
2286
|
-
L:
|
|
2485
|
+
L: 483,
|
|
2287
2486
|
S: this,
|
|
2288
2487
|
C: (f, a) => f(...a)
|
|
2289
2488
|
});
|
|
@@ -2291,6 +2490,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2291
2490
|
},
|
|
2292
2491
|
cache: metadata.cache,
|
|
2293
2492
|
edgeConnection: this._edgeConnection,
|
|
2493
|
+
edgeHttpClient: this._edgeHttpClient,
|
|
2294
2494
|
edgeFeatures: this._edgeFeatures
|
|
2295
2495
|
});
|
|
2296
2496
|
dataSpace.postOpen.append(async () => {
|
|
@@ -2317,7 +2517,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2317
2517
|
space: space.key
|
|
2318
2518
|
}, {
|
|
2319
2519
|
F: __dxlog_file9,
|
|
2320
|
-
L:
|
|
2520
|
+
L: 515,
|
|
2321
2521
|
S: this,
|
|
2322
2522
|
C: (f, a) => f(...a)
|
|
2323
2523
|
});
|
|
@@ -2350,7 +2550,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2350
2550
|
closedSessions
|
|
2351
2551
|
}, {
|
|
2352
2552
|
F: __dxlog_file9,
|
|
2353
|
-
L:
|
|
2553
|
+
L: 541,
|
|
2354
2554
|
S: this,
|
|
2355
2555
|
C: (f, a) => f(...a)
|
|
2356
2556
|
});
|
|
@@ -2365,7 +2565,7 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2365
2565
|
peerId: peerState.peerId
|
|
2366
2566
|
}, {
|
|
2367
2567
|
F: __dxlog_file9,
|
|
2368
|
-
L:
|
|
2568
|
+
L: 555,
|
|
2369
2569
|
S: this,
|
|
2370
2570
|
C: (f, a) => f(...a)
|
|
2371
2571
|
});
|
|
@@ -2409,19 +2609,19 @@ var DataSpaceManager = class extends Resource3 {
|
|
|
2409
2609
|
await Promise.all(tasks);
|
|
2410
2610
|
}
|
|
2411
2611
|
};
|
|
2412
|
-
|
|
2612
|
+
_ts_decorate3([
|
|
2413
2613
|
synchronized
|
|
2414
2614
|
], DataSpaceManager.prototype, "_open", null);
|
|
2415
|
-
|
|
2615
|
+
_ts_decorate3([
|
|
2416
2616
|
synchronized
|
|
2417
2617
|
], DataSpaceManager.prototype, "_close", null);
|
|
2418
|
-
|
|
2618
|
+
_ts_decorate3([
|
|
2419
2619
|
synchronized
|
|
2420
2620
|
], DataSpaceManager.prototype, "createSpace", null);
|
|
2421
|
-
|
|
2621
|
+
_ts_decorate3([
|
|
2422
2622
|
synchronized
|
|
2423
2623
|
], DataSpaceManager.prototype, "acceptSpace", null);
|
|
2424
|
-
DataSpaceManager =
|
|
2624
|
+
DataSpaceManager = _ts_decorate3([
|
|
2425
2625
|
trackLeaks("open", "close")
|
|
2426
2626
|
], DataSpaceManager);
|
|
2427
2627
|
|
|
@@ -2766,7 +2966,7 @@ var SpacesServiceImpl = class {
|
|
|
2766
2966
|
var getChannelId = (channel) => `user-channel/${channel}`;
|
|
2767
2967
|
|
|
2768
2968
|
// packages/sdk/client-services/src/packlets/identity/identity.ts
|
|
2769
|
-
function
|
|
2969
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
2770
2970
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2771
2971
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2772
2972
|
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;
|
|
@@ -2875,6 +3075,9 @@ var Identity = class {
|
|
|
2875
3075
|
get presence() {
|
|
2876
3076
|
return this._presence;
|
|
2877
3077
|
}
|
|
3078
|
+
get signer() {
|
|
3079
|
+
return this._signer;
|
|
3080
|
+
}
|
|
2878
3081
|
/**
|
|
2879
3082
|
* Issues credentials as identity.
|
|
2880
3083
|
* Requires identity to be ready.
|
|
@@ -2882,7 +3085,7 @@ var Identity = class {
|
|
|
2882
3085
|
getIdentityCredentialSigner() {
|
|
2883
3086
|
invariant7(this._deviceStateMachine.deviceCredentialChain, "Device credential chain is not ready.", {
|
|
2884
3087
|
F: __dxlog_file11,
|
|
2885
|
-
L:
|
|
3088
|
+
L: 189,
|
|
2886
3089
|
S: this,
|
|
2887
3090
|
A: [
|
|
2888
3091
|
"this._deviceStateMachine.deviceCredentialChain",
|
|
@@ -2926,7 +3129,7 @@ var Identity = class {
|
|
|
2926
3129
|
dataFeedKey
|
|
2927
3130
|
}, {
|
|
2928
3131
|
F: __dxlog_file11,
|
|
2929
|
-
L:
|
|
3132
|
+
L: 214,
|
|
2930
3133
|
S: this,
|
|
2931
3134
|
C: (f, a) => f(...a)
|
|
2932
3135
|
});
|
|
@@ -2967,20 +3170,20 @@ var Identity = class {
|
|
|
2967
3170
|
})));
|
|
2968
3171
|
}
|
|
2969
3172
|
};
|
|
2970
|
-
|
|
3173
|
+
_ts_decorate4([
|
|
2971
3174
|
trace3.span()
|
|
2972
3175
|
], Identity.prototype, "open", null);
|
|
2973
|
-
|
|
3176
|
+
_ts_decorate4([
|
|
2974
3177
|
trace3.span()
|
|
2975
3178
|
], Identity.prototype, "close", null);
|
|
2976
|
-
Identity =
|
|
3179
|
+
Identity = _ts_decorate4([
|
|
2977
3180
|
trace3.resource()
|
|
2978
3181
|
], Identity);
|
|
2979
3182
|
|
|
2980
3183
|
// packages/sdk/client-services/src/packlets/identity/identity-manager.ts
|
|
2981
3184
|
import platform from "platform";
|
|
2982
3185
|
import { Event as Event6 } from "@dxos/async";
|
|
2983
|
-
import { Context as
|
|
3186
|
+
import { Context as Context4 } from "@dxos/context";
|
|
2984
3187
|
import { createCredentialSignerWithKey as createCredentialSignerWithKey2, CredentialGenerator } from "@dxos/credentials";
|
|
2985
3188
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2986
3189
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
@@ -2992,7 +3195,7 @@ import { Gossip as Gossip2, Presence as Presence2 } from "@dxos/teleport-extensi
|
|
|
2992
3195
|
import { Timeframe as Timeframe3 } from "@dxos/timeframe";
|
|
2993
3196
|
import { trace as Trace2 } from "@dxos/tracing";
|
|
2994
3197
|
import { isNode, deferFunction as deferFunction2 } from "@dxos/util";
|
|
2995
|
-
function
|
|
3198
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
2996
3199
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2997
3200
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2998
3201
|
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;
|
|
@@ -3062,7 +3265,7 @@ var IdentityManager = class {
|
|
|
3062
3265
|
});
|
|
3063
3266
|
}
|
|
3064
3267
|
async close() {
|
|
3065
|
-
await this._identity?.close(new
|
|
3268
|
+
await this._identity?.close(new Context4(void 0, {
|
|
3066
3269
|
F: __dxlog_file12,
|
|
3067
3270
|
L: 140
|
|
3068
3271
|
}));
|
|
@@ -3095,7 +3298,7 @@ var IdentityManager = class {
|
|
|
3095
3298
|
}
|
|
3096
3299
|
};
|
|
3097
3300
|
const identity = await this._constructIdentity(identityRecord);
|
|
3098
|
-
await identity.open(new
|
|
3301
|
+
await identity.open(new Context4(void 0, {
|
|
3099
3302
|
F: __dxlog_file12,
|
|
3100
3303
|
L: 161
|
|
3101
3304
|
}));
|
|
@@ -3224,7 +3427,7 @@ var IdentityManager = class {
|
|
|
3224
3427
|
}
|
|
3225
3428
|
};
|
|
3226
3429
|
const identity = await this._constructIdentity(identityRecord);
|
|
3227
|
-
await identity.open(new
|
|
3430
|
+
await identity.open(new Context4(void 0, {
|
|
3228
3431
|
F: __dxlog_file12,
|
|
3229
3432
|
L: 268
|
|
3230
3433
|
}));
|
|
@@ -3443,19 +3646,19 @@ var IdentityManager = class {
|
|
|
3443
3646
|
});
|
|
3444
3647
|
}
|
|
3445
3648
|
};
|
|
3446
|
-
|
|
3649
|
+
_ts_decorate5([
|
|
3447
3650
|
Trace2.span({
|
|
3448
3651
|
showInBrowserTimeline: true
|
|
3449
3652
|
})
|
|
3450
3653
|
], IdentityManager.prototype, "open", null);
|
|
3451
|
-
IdentityManager =
|
|
3654
|
+
IdentityManager = _ts_decorate5([
|
|
3452
3655
|
Trace2.resource()
|
|
3453
3656
|
], IdentityManager);
|
|
3454
3657
|
|
|
3455
3658
|
// packages/sdk/client-services/src/packlets/identity/identity-service.ts
|
|
3456
3659
|
import { Trigger as Trigger3, sleep as sleep2 } from "@dxos/async";
|
|
3457
3660
|
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
3458
|
-
import { Resource as
|
|
3661
|
+
import { Resource as Resource5 } from "@dxos/context";
|
|
3459
3662
|
import { signPresentation } from "@dxos/credentials";
|
|
3460
3663
|
import { todo } from "@dxos/debug";
|
|
3461
3664
|
import { invariant as invariant9 } from "@dxos/invariant";
|
|
@@ -3464,7 +3667,7 @@ import { SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/ser
|
|
|
3464
3667
|
import { safeAwaitAll } from "@dxos/util";
|
|
3465
3668
|
var __dxlog_file13 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/identity/identity-service.ts";
|
|
3466
3669
|
var DEFAULT_SPACE_SEARCH_TIMEOUT = 1e4;
|
|
3467
|
-
var IdentityServiceImpl = class extends
|
|
3670
|
+
var IdentityServiceImpl = class extends Resource5 {
|
|
3468
3671
|
constructor(_identityManager, _keyring, _dataSpaceManagerProvider, _createIdentity, _onProfileUpdate) {
|
|
3469
3672
|
super();
|
|
3470
3673
|
this._identityManager = _identityManager;
|
|
@@ -3608,7 +3811,7 @@ var IdentityServiceImpl = class extends Resource4 {
|
|
|
3608
3811
|
};
|
|
3609
3812
|
|
|
3610
3813
|
// packages/sdk/client-services/src/packlets/spaces/data-space.ts
|
|
3611
|
-
function
|
|
3814
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
3612
3815
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3613
3816
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3614
3817
|
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;
|
|
@@ -3679,11 +3882,10 @@ function _using_ctx2() {
|
|
|
3679
3882
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/data-space.ts";
|
|
3680
3883
|
var DataSpace = class {
|
|
3681
3884
|
constructor(params) {
|
|
3682
|
-
this._ctx = new
|
|
3885
|
+
this._ctx = new Context5(void 0, {
|
|
3683
3886
|
F: __dxlog_file14,
|
|
3684
|
-
L:
|
|
3887
|
+
L: 95
|
|
3685
3888
|
});
|
|
3686
|
-
this._notarizationPlugin = new NotarizationPlugin();
|
|
3687
3889
|
this._cache = void 0;
|
|
3688
3890
|
this._edgeFeedReplicator = void 0;
|
|
3689
3891
|
// TODO(dmaretskyi): Move into Space?
|
|
@@ -3712,6 +3914,11 @@ var DataSpace = class {
|
|
|
3712
3914
|
this._signingContext = params.signingContext;
|
|
3713
3915
|
this._callbacks = params.callbacks ?? {};
|
|
3714
3916
|
this._echoHost = params.echoHost;
|
|
3917
|
+
this._notarizationPlugin = new NotarizationPlugin({
|
|
3918
|
+
spaceId: this._inner.id,
|
|
3919
|
+
edgeClient: params.edgeHttpClient,
|
|
3920
|
+
edgeFeatures: params.edgeFeatures
|
|
3921
|
+
});
|
|
3715
3922
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
3716
3923
|
trustedKeysProvider: () => new ComplexSet3(PublicKey8.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => member.role !== SpaceMember5.Role.REMOVED).map((member) => member.key)),
|
|
3717
3924
|
update: this._inner.stateUpdate,
|
|
@@ -3729,7 +3936,7 @@ var DataSpace = class {
|
|
|
3729
3936
|
state: SpaceState4[this._state]
|
|
3730
3937
|
}, {
|
|
3731
3938
|
F: __dxlog_file14,
|
|
3732
|
-
L:
|
|
3939
|
+
L: 170,
|
|
3733
3940
|
S: this,
|
|
3734
3941
|
C: (f, a) => f(...a)
|
|
3735
3942
|
});
|
|
@@ -3786,9 +3993,9 @@ var DataSpace = class {
|
|
|
3786
3993
|
if (this._edgeFeedReplicator) {
|
|
3787
3994
|
this.inner.protocol.feedAdded.append(this._onFeedAdded);
|
|
3788
3995
|
}
|
|
3789
|
-
await this._inner.open(new
|
|
3996
|
+
await this._inner.open(new Context5(void 0, {
|
|
3790
3997
|
F: __dxlog_file14,
|
|
3791
|
-
L:
|
|
3998
|
+
L: 244
|
|
3792
3999
|
}));
|
|
3793
4000
|
await this._edgeFeedReplicator?.open();
|
|
3794
4001
|
this._state = SpaceState4.SPACE_CONTROL_ONLY;
|
|
@@ -3796,7 +4003,7 @@ var DataSpace = class {
|
|
|
3796
4003
|
state: SpaceState4[this._state]
|
|
3797
4004
|
}, {
|
|
3798
4005
|
F: __dxlog_file14,
|
|
3799
|
-
L:
|
|
4006
|
+
L: 249,
|
|
3800
4007
|
S: this,
|
|
3801
4008
|
C: (f, a) => f(...a)
|
|
3802
4009
|
});
|
|
@@ -3816,14 +4023,14 @@ var DataSpace = class {
|
|
|
3816
4023
|
state: SpaceState4[this._state]
|
|
3817
4024
|
}, {
|
|
3818
4025
|
F: __dxlog_file14,
|
|
3819
|
-
L:
|
|
4026
|
+
L: 268,
|
|
3820
4027
|
S: this,
|
|
3821
4028
|
C: (f, a) => f(...a)
|
|
3822
4029
|
});
|
|
3823
4030
|
await this._ctx.dispose();
|
|
3824
|
-
this._ctx = new
|
|
4031
|
+
this._ctx = new Context5(void 0, {
|
|
3825
4032
|
F: __dxlog_file14,
|
|
3826
|
-
L:
|
|
4033
|
+
L: 270
|
|
3827
4034
|
});
|
|
3828
4035
|
if (this._edgeFeedReplicator) {
|
|
3829
4036
|
this.inner.protocol.feedAdded.remove(this._onFeedAdded);
|
|
@@ -3856,7 +4063,7 @@ var DataSpace = class {
|
|
|
3856
4063
|
if (err instanceof CancelledError || err instanceof ContextDisposedError) {
|
|
3857
4064
|
log12("data pipeline initialization cancelled", err, {
|
|
3858
4065
|
F: __dxlog_file14,
|
|
3859
|
-
L:
|
|
4066
|
+
L: 308,
|
|
3860
4067
|
S: this,
|
|
3861
4068
|
C: (f, a) => f(...a)
|
|
3862
4069
|
});
|
|
@@ -3864,7 +4071,7 @@ var DataSpace = class {
|
|
|
3864
4071
|
}
|
|
3865
4072
|
log12.error("Error initializing data pipeline", err, {
|
|
3866
4073
|
F: __dxlog_file14,
|
|
3867
|
-
L:
|
|
4074
|
+
L: 312,
|
|
3868
4075
|
S: this,
|
|
3869
4076
|
C: (f, a) => f(...a)
|
|
3870
4077
|
});
|
|
@@ -3873,7 +4080,7 @@ var DataSpace = class {
|
|
|
3873
4080
|
state: SpaceState4[this._state]
|
|
3874
4081
|
}, {
|
|
3875
4082
|
F: __dxlog_file14,
|
|
3876
|
-
L:
|
|
4083
|
+
L: 314,
|
|
3877
4084
|
S: this,
|
|
3878
4085
|
C: (f, a) => f(...a)
|
|
3879
4086
|
});
|
|
@@ -3893,15 +4100,39 @@ var DataSpace = class {
|
|
|
3893
4100
|
state: SpaceState4[this._state]
|
|
3894
4101
|
}, {
|
|
3895
4102
|
F: __dxlog_file14,
|
|
3896
|
-
L:
|
|
4103
|
+
L: 330,
|
|
4104
|
+
S: this,
|
|
4105
|
+
C: (f, a) => f(...a)
|
|
4106
|
+
});
|
|
4107
|
+
log12("initializing control pipeline", void 0, {
|
|
4108
|
+
F: __dxlog_file14,
|
|
4109
|
+
L: 332,
|
|
3897
4110
|
S: this,
|
|
3898
4111
|
C: (f, a) => f(...a)
|
|
3899
4112
|
});
|
|
3900
4113
|
await this._initializeAndReadControlPipeline();
|
|
3901
4114
|
await sleep3(1);
|
|
3902
4115
|
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
|
|
4116
|
+
log12("initializing automerge root", void 0, {
|
|
4117
|
+
F: __dxlog_file14,
|
|
4118
|
+
L: 340,
|
|
4119
|
+
S: this,
|
|
4120
|
+
C: (f, a) => f(...a)
|
|
4121
|
+
});
|
|
3903
4122
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4123
|
+
log12("waiting for space to be ready", void 0, {
|
|
4124
|
+
F: __dxlog_file14,
|
|
4125
|
+
L: 344,
|
|
4126
|
+
S: this,
|
|
4127
|
+
C: (f, a) => f(...a)
|
|
4128
|
+
});
|
|
3904
4129
|
await ready;
|
|
4130
|
+
log12("space is ready", void 0, {
|
|
4131
|
+
F: __dxlog_file14,
|
|
4132
|
+
L: 346,
|
|
4133
|
+
S: this,
|
|
4134
|
+
C: (f, a) => f(...a)
|
|
4135
|
+
});
|
|
3905
4136
|
}
|
|
3906
4137
|
async _enterReadyState() {
|
|
3907
4138
|
await this._callbacks.beforeReady?.();
|
|
@@ -3910,7 +4141,7 @@ var DataSpace = class {
|
|
|
3910
4141
|
state: SpaceState4[this._state]
|
|
3911
4142
|
}, {
|
|
3912
4143
|
F: __dxlog_file14,
|
|
3913
|
-
L:
|
|
4144
|
+
L: 353,
|
|
3914
4145
|
S: this,
|
|
3915
4146
|
C: (f, a) => f(...a)
|
|
3916
4147
|
});
|
|
@@ -3920,13 +4151,14 @@ var DataSpace = class {
|
|
|
3920
4151
|
async _initializeAndReadControlPipeline() {
|
|
3921
4152
|
await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
|
|
3922
4153
|
ctx: this._ctx,
|
|
4154
|
+
timeout: 1e4,
|
|
3923
4155
|
breakOnStall: false
|
|
3924
4156
|
});
|
|
3925
4157
|
this.metrics.controlPipelineReady = /* @__PURE__ */ new Date();
|
|
3926
4158
|
await this._createWritableFeeds();
|
|
3927
4159
|
log12("writable feeds created", void 0, {
|
|
3928
4160
|
F: __dxlog_file14,
|
|
3929
|
-
L:
|
|
4161
|
+
L: 370,
|
|
3930
4162
|
S: this,
|
|
3931
4163
|
C: (f, a) => f(...a)
|
|
3932
4164
|
});
|
|
@@ -3975,11 +4207,35 @@ var DataSpace = class {
|
|
|
3975
4207
|
}));
|
|
3976
4208
|
}
|
|
3977
4209
|
if (credentials.length > 0) {
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
4210
|
+
try {
|
|
4211
|
+
log12("will notarize credentials for feed admission", {
|
|
4212
|
+
count: credentials.length
|
|
4213
|
+
}, {
|
|
4214
|
+
F: __dxlog_file14,
|
|
4215
|
+
L: 428,
|
|
4216
|
+
S: this,
|
|
4217
|
+
C: (f, a) => f(...a)
|
|
4218
|
+
});
|
|
4219
|
+
await this.notarizationPlugin.notarize({
|
|
4220
|
+
ctx: this._ctx,
|
|
4221
|
+
credentials,
|
|
4222
|
+
timeout: 0
|
|
4223
|
+
});
|
|
4224
|
+
log12("credentials notarized", void 0, {
|
|
4225
|
+
F: __dxlog_file14,
|
|
4226
|
+
L: 432,
|
|
4227
|
+
S: this,
|
|
4228
|
+
C: (f, a) => f(...a)
|
|
4229
|
+
});
|
|
4230
|
+
} catch (err) {
|
|
4231
|
+
log12.error("error notarizing credentials for feed admission", err, {
|
|
4232
|
+
F: __dxlog_file14,
|
|
4233
|
+
L: 434,
|
|
4234
|
+
S: this,
|
|
4235
|
+
C: (f, a) => f(...a)
|
|
4236
|
+
});
|
|
4237
|
+
throw err;
|
|
4238
|
+
}
|
|
3983
4239
|
await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
|
|
3984
4240
|
}
|
|
3985
4241
|
}
|
|
@@ -3989,7 +4245,7 @@ var DataSpace = class {
|
|
|
3989
4245
|
rootUrl
|
|
3990
4246
|
}, {
|
|
3991
4247
|
F: __dxlog_file14,
|
|
3992
|
-
L:
|
|
4248
|
+
L: 444,
|
|
3993
4249
|
S: this,
|
|
3994
4250
|
C: (f, a) => f(...a)
|
|
3995
4251
|
});
|
|
@@ -4041,7 +4297,7 @@ var DataSpace = class {
|
|
|
4041
4297
|
err
|
|
4042
4298
|
}, {
|
|
4043
4299
|
F: __dxlog_file14,
|
|
4044
|
-
L:
|
|
4300
|
+
L: 487,
|
|
4045
4301
|
S: this,
|
|
4046
4302
|
C: (f, a) => f(...a)
|
|
4047
4303
|
});
|
|
@@ -4131,58 +4387,58 @@ var DataSpace = class {
|
|
|
4131
4387
|
state: SpaceState4[this._state]
|
|
4132
4388
|
}, {
|
|
4133
4389
|
F: __dxlog_file14,
|
|
4134
|
-
L:
|
|
4390
|
+
L: 569,
|
|
4135
4391
|
S: this,
|
|
4136
4392
|
C: (f, a) => f(...a)
|
|
4137
4393
|
});
|
|
4138
4394
|
this.stateUpdate.emit();
|
|
4139
4395
|
}
|
|
4140
4396
|
};
|
|
4141
|
-
|
|
4397
|
+
_ts_decorate6([
|
|
4142
4398
|
trace5.info()
|
|
4143
4399
|
], DataSpace.prototype, "_inner", void 0);
|
|
4144
|
-
|
|
4400
|
+
_ts_decorate6([
|
|
4145
4401
|
trace5.info()
|
|
4146
4402
|
], DataSpace.prototype, "id", null);
|
|
4147
|
-
|
|
4403
|
+
_ts_decorate6([
|
|
4148
4404
|
trace5.info()
|
|
4149
4405
|
], DataSpace.prototype, "key", null);
|
|
4150
|
-
|
|
4406
|
+
_ts_decorate6([
|
|
4151
4407
|
trace5.info({
|
|
4152
4408
|
enum: SpaceState4
|
|
4153
4409
|
})
|
|
4154
4410
|
], DataSpace.prototype, "state", null);
|
|
4155
|
-
|
|
4411
|
+
_ts_decorate6([
|
|
4156
4412
|
trace5.info({
|
|
4157
4413
|
depth: null
|
|
4158
4414
|
})
|
|
4159
4415
|
], DataSpace.prototype, "_automergeInfo", null);
|
|
4160
|
-
|
|
4416
|
+
_ts_decorate6([
|
|
4161
4417
|
synchronized2
|
|
4162
4418
|
], DataSpace.prototype, "open", null);
|
|
4163
|
-
|
|
4419
|
+
_ts_decorate6([
|
|
4164
4420
|
synchronized2
|
|
4165
4421
|
], DataSpace.prototype, "close", null);
|
|
4166
|
-
|
|
4422
|
+
_ts_decorate6([
|
|
4167
4423
|
trace5.span({
|
|
4168
4424
|
showInBrowserTimeline: true
|
|
4169
4425
|
})
|
|
4170
4426
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
4171
|
-
|
|
4427
|
+
_ts_decorate6([
|
|
4172
4428
|
trace5.span({
|
|
4173
4429
|
showInBrowserTimeline: true
|
|
4174
4430
|
})
|
|
4175
4431
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
4176
|
-
|
|
4432
|
+
_ts_decorate6([
|
|
4177
4433
|
timed(1e4)
|
|
4178
4434
|
], DataSpace.prototype, "_createWritableFeeds", null);
|
|
4179
|
-
|
|
4435
|
+
_ts_decorate6([
|
|
4180
4436
|
synchronized2
|
|
4181
4437
|
], DataSpace.prototype, "activate", null);
|
|
4182
|
-
|
|
4438
|
+
_ts_decorate6([
|
|
4183
4439
|
synchronized2
|
|
4184
4440
|
], DataSpace.prototype, "deactivate", null);
|
|
4185
|
-
DataSpace =
|
|
4441
|
+
DataSpace = _ts_decorate6([
|
|
4186
4442
|
trackLeaks2("open", "close"),
|
|
4187
4443
|
trace5.resource()
|
|
4188
4444
|
], DataSpace);
|
|
@@ -4316,7 +4572,7 @@ import { ComplexSet as ComplexSet5 } from "@dxos/util";
|
|
|
4316
4572
|
|
|
4317
4573
|
// packages/sdk/client-services/src/packlets/invitations/invitation-guest-extenstion.ts
|
|
4318
4574
|
import { Trigger as Trigger4 } from "@dxos/async";
|
|
4319
|
-
import { cancelWithContext as cancelWithContext4, Context as
|
|
4575
|
+
import { cancelWithContext as cancelWithContext4, Context as Context6 } from "@dxos/context";
|
|
4320
4576
|
import { invariant as invariant11 } from "@dxos/invariant";
|
|
4321
4577
|
import { log as log13 } from "@dxos/log";
|
|
4322
4578
|
import { InvalidInvitationExtensionRoleError } from "@dxos/protocols";
|
|
@@ -4358,7 +4614,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4358
4614
|
});
|
|
4359
4615
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
4360
4616
|
this._callbacks = _callbacks;
|
|
4361
|
-
this._ctx = new
|
|
4617
|
+
this._ctx = new Context6(void 0, {
|
|
4362
4618
|
F: __dxlog_file16,
|
|
4363
4619
|
L: 34
|
|
4364
4620
|
});
|
|
@@ -4470,7 +4726,7 @@ var InvitationGuestExtension = class extends RpcExtension2 {
|
|
|
4470
4726
|
|
|
4471
4727
|
// packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts
|
|
4472
4728
|
import { Trigger as Trigger5, scheduleTask as scheduleTask5 } from "@dxos/async";
|
|
4473
|
-
import { cancelWithContext as cancelWithContext5, Context as
|
|
4729
|
+
import { cancelWithContext as cancelWithContext5, Context as Context7 } from "@dxos/context";
|
|
4474
4730
|
import { randomBytes, verify } from "@dxos/crypto";
|
|
4475
4731
|
import { invariant as invariant12, InvariantViolation } from "@dxos/invariant";
|
|
4476
4732
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
@@ -4495,7 +4751,7 @@ var InvitationHostExtension = class extends RpcExtension3 {
|
|
|
4495
4751
|
});
|
|
4496
4752
|
this._invitationFlowMutex = _invitationFlowMutex;
|
|
4497
4753
|
this._callbacks = _callbacks;
|
|
4498
|
-
this._ctx = new
|
|
4754
|
+
this._ctx = new Context7(void 0, {
|
|
4499
4755
|
F: __dxlog_file17,
|
|
4500
4756
|
L: 53
|
|
4501
4757
|
});
|
|
@@ -5870,7 +6126,7 @@ var SpaceInvitationProtocol = class {
|
|
|
5870
6126
|
// packages/sdk/client-services/src/packlets/invitations/invitations-manager.ts
|
|
5871
6127
|
import { Event as Event8, PushStream, TimeoutError as TimeoutError3, Trigger as Trigger6 } from "@dxos/async";
|
|
5872
6128
|
import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT as INVITATION_TIMEOUT2 } from "@dxos/client-protocol";
|
|
5873
|
-
import { Context as
|
|
6129
|
+
import { Context as Context8 } from "@dxos/context";
|
|
5874
6130
|
import { generatePasscode } from "@dxos/credentials";
|
|
5875
6131
|
import { hasInvitationExpired } from "@dxos/echo-pipeline";
|
|
5876
6132
|
import { invariant as invariant16 } from "@dxos/invariant";
|
|
@@ -6102,7 +6358,7 @@ var InvitationsManager = class {
|
|
|
6102
6358
|
}
|
|
6103
6359
|
_createObservableInvitation(handler, invitation) {
|
|
6104
6360
|
const stream = new PushStream();
|
|
6105
|
-
const ctx = new
|
|
6361
|
+
const ctx = new Context8({
|
|
6106
6362
|
onError: (err) => {
|
|
6107
6363
|
stream.error(err);
|
|
6108
6364
|
void ctx.dispose();
|
|
@@ -6142,7 +6398,7 @@ var InvitationsManager = class {
|
|
|
6142
6398
|
_createObservableAcceptingInvitation(handler, initialState) {
|
|
6143
6399
|
const otpEnteredTrigger = new Trigger6();
|
|
6144
6400
|
const stream = new PushStream();
|
|
6145
|
-
const ctx = new
|
|
6401
|
+
const ctx = new Context8({
|
|
6146
6402
|
onError: (err) => {
|
|
6147
6403
|
if (err instanceof TimeoutError3) {
|
|
6148
6404
|
log18("timeout", {
|
|
@@ -6241,8 +6497,8 @@ var InvitationsManager = class {
|
|
|
6241
6497
|
// packages/sdk/client-services/src/packlets/locks/node.ts
|
|
6242
6498
|
import { invariant as invariant17 } from "@dxos/invariant";
|
|
6243
6499
|
import { LockFile } from "@dxos/lock-file";
|
|
6244
|
-
import { log as log19, logInfo } from "@dxos/log";
|
|
6245
|
-
function
|
|
6500
|
+
import { log as log19, logInfo as logInfo3 } from "@dxos/log";
|
|
6501
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
6246
6502
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6247
6503
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6248
6504
|
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;
|
|
@@ -6288,8 +6544,8 @@ var Lock = class {
|
|
|
6288
6544
|
await LockFile.release(this._fileHandle);
|
|
6289
6545
|
}
|
|
6290
6546
|
};
|
|
6291
|
-
|
|
6292
|
-
|
|
6547
|
+
_ts_decorate7([
|
|
6548
|
+
logInfo3
|
|
6293
6549
|
], Lock.prototype, "lockKey", null);
|
|
6294
6550
|
var isLocked = (lockPath) => LockFile.isLocked(lockPath);
|
|
6295
6551
|
|
|
@@ -6298,7 +6554,7 @@ import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
|
6298
6554
|
import { raise as raise2 } from "@dxos/debug";
|
|
6299
6555
|
import { parseMethodName, RpcPeer } from "@dxos/rpc";
|
|
6300
6556
|
import { MapCounter, trace as trace8 } from "@dxos/tracing";
|
|
6301
|
-
function
|
|
6557
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
6302
6558
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6303
6559
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6304
6560
|
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;
|
|
@@ -6360,22 +6616,23 @@ var ClientRpcServer = class {
|
|
|
6360
6616
|
return this._handlerCache.get(serviceName);
|
|
6361
6617
|
}
|
|
6362
6618
|
};
|
|
6363
|
-
|
|
6619
|
+
_ts_decorate8([
|
|
6364
6620
|
trace8.metricsCounter()
|
|
6365
6621
|
], ClientRpcServer.prototype, "_callMetrics", void 0);
|
|
6366
|
-
|
|
6622
|
+
_ts_decorate8([
|
|
6367
6623
|
trace8.info()
|
|
6368
6624
|
], ClientRpcServer.prototype, "_services", null);
|
|
6369
|
-
ClientRpcServer =
|
|
6625
|
+
ClientRpcServer = _ts_decorate8([
|
|
6370
6626
|
trace8.resource()
|
|
6371
6627
|
], ClientRpcServer);
|
|
6372
6628
|
|
|
6373
6629
|
// packages/sdk/client-services/src/packlets/services/service-context.ts
|
|
6374
|
-
import { Trigger as Trigger7 } from "@dxos/async";
|
|
6375
|
-
import { Context as
|
|
6630
|
+
import { Mutex as Mutex4, scheduleMicroTask as scheduleMicroTask3, Trigger as Trigger7 } from "@dxos/async";
|
|
6631
|
+
import { Context as Context9, Resource as Resource6 } from "@dxos/context";
|
|
6376
6632
|
import { getCredentialAssertion as getCredentialAssertion5 } from "@dxos/credentials";
|
|
6377
|
-
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
6633
|
+
import { failUndefined as failUndefined2, warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
|
|
6378
6634
|
import { EchoEdgeReplicator, EchoHost, MeshEchoReplicator, MetadataStore, SpaceManager, valueEncoding } from "@dxos/echo-pipeline";
|
|
6635
|
+
import { createChainEdgeIdentity, createEphemeralEdgeIdentity } from "@dxos/edge-client";
|
|
6379
6636
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
6380
6637
|
import { invariant as invariant18 } from "@dxos/invariant";
|
|
6381
6638
|
import { Keyring } from "@dxos/keyring";
|
|
@@ -6386,23 +6643,87 @@ import { Invitation as Invitation8 } from "@dxos/protocols/proto/dxos/client/ser
|
|
|
6386
6643
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
6387
6644
|
import { trace as Trace3 } from "@dxos/tracing";
|
|
6388
6645
|
import { safeInstanceof } from "@dxos/util";
|
|
6389
|
-
function
|
|
6646
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
6390
6647
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
6391
6648
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6392
6649
|
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;
|
|
6393
6650
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6394
6651
|
}
|
|
6652
|
+
function _using_ctx3() {
|
|
6653
|
+
var _disposeSuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed) {
|
|
6654
|
+
var err = new Error();
|
|
6655
|
+
err.name = "SuppressedError";
|
|
6656
|
+
err.suppressed = suppressed;
|
|
6657
|
+
err.error = error;
|
|
6658
|
+
return err;
|
|
6659
|
+
}, empty = {}, stack = [];
|
|
6660
|
+
function using(isAwait, value) {
|
|
6661
|
+
if (value != null) {
|
|
6662
|
+
if (Object(value) !== value) {
|
|
6663
|
+
throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
6664
|
+
}
|
|
6665
|
+
if (isAwait) {
|
|
6666
|
+
var dispose = value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
|
|
6667
|
+
}
|
|
6668
|
+
if (dispose == null) {
|
|
6669
|
+
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
|
|
6670
|
+
}
|
|
6671
|
+
if (typeof dispose !== "function") {
|
|
6672
|
+
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
|
|
6673
|
+
}
|
|
6674
|
+
stack.push({
|
|
6675
|
+
v: value,
|
|
6676
|
+
d: dispose,
|
|
6677
|
+
a: isAwait
|
|
6678
|
+
});
|
|
6679
|
+
} else if (isAwait) {
|
|
6680
|
+
stack.push({
|
|
6681
|
+
d: value,
|
|
6682
|
+
a: isAwait
|
|
6683
|
+
});
|
|
6684
|
+
}
|
|
6685
|
+
return value;
|
|
6686
|
+
}
|
|
6687
|
+
return {
|
|
6688
|
+
e: empty,
|
|
6689
|
+
u: using.bind(null, false),
|
|
6690
|
+
a: using.bind(null, true),
|
|
6691
|
+
d: function() {
|
|
6692
|
+
var error = this.e;
|
|
6693
|
+
function next() {
|
|
6694
|
+
while (resource = stack.pop()) {
|
|
6695
|
+
try {
|
|
6696
|
+
var resource, disposalResult = resource.d && resource.d.call(resource.v);
|
|
6697
|
+
if (resource.a) {
|
|
6698
|
+
return Promise.resolve(disposalResult).then(next, err);
|
|
6699
|
+
}
|
|
6700
|
+
} catch (e) {
|
|
6701
|
+
return err(e);
|
|
6702
|
+
}
|
|
6703
|
+
}
|
|
6704
|
+
if (error !== empty) throw error;
|
|
6705
|
+
}
|
|
6706
|
+
function err(e) {
|
|
6707
|
+
error = error !== empty ? new _disposeSuppressedError(error, e) : e;
|
|
6708
|
+
return next();
|
|
6709
|
+
}
|
|
6710
|
+
return next();
|
|
6711
|
+
}
|
|
6712
|
+
};
|
|
6713
|
+
}
|
|
6395
6714
|
var __dxlog_file23 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
6396
|
-
var ServiceContext = class extends
|
|
6397
|
-
constructor(storage, level, networkManager, signalManager, _edgeConnection, _runtimeParams, _edgeFeatures) {
|
|
6715
|
+
var ServiceContext = class extends Resource6 {
|
|
6716
|
+
constructor(storage, level, networkManager, signalManager, _edgeConnection, _edgeHttpClient, _runtimeParams, _edgeFeatures) {
|
|
6398
6717
|
super();
|
|
6399
6718
|
this.storage = storage;
|
|
6400
6719
|
this.level = level;
|
|
6401
6720
|
this.networkManager = networkManager;
|
|
6402
6721
|
this.signalManager = signalManager;
|
|
6403
6722
|
this._edgeConnection = _edgeConnection;
|
|
6723
|
+
this._edgeHttpClient = _edgeHttpClient;
|
|
6404
6724
|
this._runtimeParams = _runtimeParams;
|
|
6405
6725
|
this._edgeFeatures = _edgeFeatures;
|
|
6726
|
+
this._edgeIdentityUpdateMutex = new Mutex4();
|
|
6406
6727
|
this.initialized = new Trigger7();
|
|
6407
6728
|
this._meshReplicator = void 0;
|
|
6408
6729
|
this._echoEdgeReplicator = void 0;
|
|
@@ -6440,23 +6761,42 @@ var ServiceContext = class extends Resource5 {
|
|
|
6440
6761
|
callbacks: {
|
|
6441
6762
|
onIdentityConstruction: (identity) => {
|
|
6442
6763
|
if (this._edgeConnection) {
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6764
|
+
scheduleMicroTask3(this._ctx, async () => {
|
|
6765
|
+
try {
|
|
6766
|
+
var _usingCtx = _using_ctx3();
|
|
6767
|
+
const _ = _usingCtx.u(await this._edgeIdentityUpdateMutex.acquire());
|
|
6768
|
+
log20.info("Setting identity on edge connection", {
|
|
6769
|
+
identity: identity.identityKey.toHex(),
|
|
6770
|
+
oldIdentity: this._edgeConnection.identityKey,
|
|
6771
|
+
swarms: this.networkManager.topics
|
|
6772
|
+
}, {
|
|
6773
|
+
F: __dxlog_file23,
|
|
6774
|
+
L: 147,
|
|
6775
|
+
S: this,
|
|
6776
|
+
C: (f, a) => f(...a)
|
|
6777
|
+
});
|
|
6778
|
+
await warnAfterTimeout2(1e4, "Waiting for identity to be ready for edge connection", async () => {
|
|
6779
|
+
await identity.ready();
|
|
6780
|
+
});
|
|
6781
|
+
invariant18(identity.deviceCredentialChain, void 0, {
|
|
6782
|
+
F: __dxlog_file23,
|
|
6783
|
+
L: 157,
|
|
6784
|
+
S: this,
|
|
6785
|
+
A: [
|
|
6786
|
+
"identity.deviceCredentialChain",
|
|
6787
|
+
""
|
|
6788
|
+
]
|
|
6789
|
+
});
|
|
6790
|
+
this._edgeConnection.setIdentity(await createChainEdgeIdentity(identity.signer, identity.identityKey, identity.deviceKey, identity.deviceCredentialChain, []));
|
|
6791
|
+
this.networkManager.setPeerInfo({
|
|
6792
|
+
identityKey: identity.identityKey.toHex(),
|
|
6793
|
+
peerKey: identity.deviceKey.toHex()
|
|
6794
|
+
});
|
|
6795
|
+
} catch (_) {
|
|
6796
|
+
_usingCtx.e = _;
|
|
6797
|
+
} finally {
|
|
6798
|
+
_usingCtx.d();
|
|
6799
|
+
}
|
|
6460
6800
|
});
|
|
6461
6801
|
}
|
|
6462
6802
|
}
|
|
@@ -6482,7 +6822,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6482
6822
|
await this._checkStorageVersion();
|
|
6483
6823
|
log20("opening...", void 0, {
|
|
6484
6824
|
F: __dxlog_file23,
|
|
6485
|
-
L:
|
|
6825
|
+
L: 217,
|
|
6486
6826
|
S: this,
|
|
6487
6827
|
C: (f, a) => f(...a)
|
|
6488
6828
|
});
|
|
@@ -6490,11 +6830,14 @@ var ServiceContext = class extends Resource5 {
|
|
|
6490
6830
|
id: this._instanceId
|
|
6491
6831
|
}), {
|
|
6492
6832
|
F: __dxlog_file23,
|
|
6493
|
-
L:
|
|
6833
|
+
L: 218,
|
|
6494
6834
|
S: this,
|
|
6495
6835
|
C: (f, a) => f(...a)
|
|
6496
6836
|
});
|
|
6497
|
-
|
|
6837
|
+
if (this._edgeConnection) {
|
|
6838
|
+
this._edgeConnection.setIdentity(await createEphemeralEdgeIdentity());
|
|
6839
|
+
await this._edgeConnection.open();
|
|
6840
|
+
}
|
|
6498
6841
|
await this.signalManager.open();
|
|
6499
6842
|
await this.networkManager.open();
|
|
6500
6843
|
await this.echoHost.open(ctx);
|
|
@@ -6515,7 +6858,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6515
6858
|
count: loadedInvitations.invitations?.length
|
|
6516
6859
|
}, {
|
|
6517
6860
|
F: __dxlog_file23,
|
|
6518
|
-
L:
|
|
6861
|
+
L: 245,
|
|
6519
6862
|
S: this,
|
|
6520
6863
|
C: (f, a) => f(...a)
|
|
6521
6864
|
});
|
|
@@ -6523,13 +6866,13 @@ var ServiceContext = class extends Resource5 {
|
|
|
6523
6866
|
id: this._instanceId
|
|
6524
6867
|
}), {
|
|
6525
6868
|
F: __dxlog_file23,
|
|
6526
|
-
L:
|
|
6869
|
+
L: 247,
|
|
6527
6870
|
S: this,
|
|
6528
6871
|
C: (f, a) => f(...a)
|
|
6529
6872
|
});
|
|
6530
6873
|
log20("opened", void 0, {
|
|
6531
6874
|
F: __dxlog_file23,
|
|
6532
|
-
L:
|
|
6875
|
+
L: 248,
|
|
6533
6876
|
S: this,
|
|
6534
6877
|
C: (f, a) => f(...a)
|
|
6535
6878
|
});
|
|
@@ -6537,7 +6880,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6537
6880
|
async _close(ctx) {
|
|
6538
6881
|
log20("closing...", void 0, {
|
|
6539
6882
|
F: __dxlog_file23,
|
|
6540
|
-
L:
|
|
6883
|
+
L: 252,
|
|
6541
6884
|
S: this,
|
|
6542
6885
|
C: (f, a) => f(...a)
|
|
6543
6886
|
});
|
|
@@ -6555,16 +6898,16 @@ var ServiceContext = class extends Resource5 {
|
|
|
6555
6898
|
await this._edgeConnection?.close();
|
|
6556
6899
|
log20("closed", void 0, {
|
|
6557
6900
|
F: __dxlog_file23,
|
|
6558
|
-
L:
|
|
6901
|
+
L: 267,
|
|
6559
6902
|
S: this,
|
|
6560
6903
|
C: (f, a) => f(...a)
|
|
6561
6904
|
});
|
|
6562
6905
|
}
|
|
6563
6906
|
async createIdentity(params = {}) {
|
|
6564
6907
|
const identity = await this.identityManager.createIdentity(params);
|
|
6565
|
-
await this._initialize(new
|
|
6908
|
+
await this._initialize(new Context9(void 0, {
|
|
6566
6909
|
F: __dxlog_file23,
|
|
6567
|
-
L:
|
|
6910
|
+
L: 272
|
|
6568
6911
|
}));
|
|
6569
6912
|
return identity;
|
|
6570
6913
|
}
|
|
@@ -6572,7 +6915,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6572
6915
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
6573
6916
|
invariant18(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
6574
6917
|
F: __dxlog_file23,
|
|
6575
|
-
L:
|
|
6918
|
+
L: 278,
|
|
6576
6919
|
S: this,
|
|
6577
6920
|
A: [
|
|
6578
6921
|
"factory",
|
|
@@ -6591,9 +6934,9 @@ var ServiceContext = class extends Resource5 {
|
|
|
6591
6934
|
}
|
|
6592
6935
|
async _acceptIdentity(params) {
|
|
6593
6936
|
const identity = await this.identityManager.acceptIdentity(params);
|
|
6594
|
-
await this._initialize(new
|
|
6937
|
+
await this._initialize(new Context9(void 0, {
|
|
6595
6938
|
F: __dxlog_file23,
|
|
6596
|
-
L:
|
|
6939
|
+
L: 294
|
|
6597
6940
|
}));
|
|
6598
6941
|
return identity;
|
|
6599
6942
|
}
|
|
@@ -6607,7 +6950,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6607
6950
|
async _initialize(ctx) {
|
|
6608
6951
|
log20("initializing spaces...", void 0, {
|
|
6609
6952
|
F: __dxlog_file23,
|
|
6610
|
-
L:
|
|
6953
|
+
L: 309,
|
|
6611
6954
|
S: this,
|
|
6612
6955
|
C: (f, a) => f(...a)
|
|
6613
6956
|
});
|
|
@@ -6634,6 +6977,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6634
6977
|
echoHost: this.echoHost,
|
|
6635
6978
|
invitationsManager: this.invitationsManager,
|
|
6636
6979
|
edgeConnection: this._edgeConnection,
|
|
6980
|
+
edgeHttpClient: this._edgeHttpClient,
|
|
6637
6981
|
echoEdgeReplicator: this._echoEdgeReplicator,
|
|
6638
6982
|
meshReplicator: this._meshReplicator,
|
|
6639
6983
|
runtimeParams: this._runtimeParams,
|
|
@@ -6643,7 +6987,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6643
6987
|
this._handlerFactories.set(Invitation8.Kind.SPACE, (invitation) => {
|
|
6644
6988
|
invariant18(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
6645
6989
|
F: __dxlog_file23,
|
|
6646
|
-
L:
|
|
6990
|
+
L: 339,
|
|
6647
6991
|
S: this,
|
|
6648
6992
|
A: [
|
|
6649
6993
|
"this.dataSpaceManager",
|
|
@@ -6667,7 +7011,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6667
7011
|
details: assertion
|
|
6668
7012
|
}, {
|
|
6669
7013
|
F: __dxlog_file23,
|
|
6670
|
-
L:
|
|
7014
|
+
L: 355,
|
|
6671
7015
|
S: this,
|
|
6672
7016
|
C: (f, a) => f(...a)
|
|
6673
7017
|
});
|
|
@@ -6678,7 +7022,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6678
7022
|
details: assertion
|
|
6679
7023
|
}, {
|
|
6680
7024
|
F: __dxlog_file23,
|
|
6681
|
-
L:
|
|
7025
|
+
L: 359,
|
|
6682
7026
|
S: this,
|
|
6683
7027
|
C: (f, a) => f(...a)
|
|
6684
7028
|
});
|
|
@@ -6689,7 +7033,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6689
7033
|
details: assertion
|
|
6690
7034
|
}, {
|
|
6691
7035
|
F: __dxlog_file23,
|
|
6692
|
-
L:
|
|
7036
|
+
L: 364,
|
|
6693
7037
|
S: this,
|
|
6694
7038
|
C: (f, a) => f(...a)
|
|
6695
7039
|
});
|
|
@@ -6700,7 +7044,7 @@ var ServiceContext = class extends Resource5 {
|
|
|
6700
7044
|
} catch (err) {
|
|
6701
7045
|
log20.catch(err, void 0, {
|
|
6702
7046
|
F: __dxlog_file23,
|
|
6703
|
-
L:
|
|
7047
|
+
L: 370,
|
|
6704
7048
|
S: this,
|
|
6705
7049
|
C: (f, a) => f(...a)
|
|
6706
7050
|
});
|
|
@@ -6710,13 +7054,13 @@ var ServiceContext = class extends Resource5 {
|
|
|
6710
7054
|
await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
|
|
6711
7055
|
}
|
|
6712
7056
|
};
|
|
6713
|
-
|
|
7057
|
+
_ts_decorate9([
|
|
6714
7058
|
Trace3.span()
|
|
6715
7059
|
], ServiceContext.prototype, "_open", null);
|
|
6716
|
-
|
|
7060
|
+
_ts_decorate9([
|
|
6717
7061
|
Trace3.span()
|
|
6718
7062
|
], ServiceContext.prototype, "_initialize", null);
|
|
6719
|
-
ServiceContext =
|
|
7063
|
+
ServiceContext = _ts_decorate9([
|
|
6720
7064
|
safeInstanceof("dxos.client-services.ServiceContext"),
|
|
6721
7065
|
Trace3.resource()
|
|
6722
7066
|
], ServiceContext);
|
|
@@ -6981,8 +7325,8 @@ var importProfileData = async ({ storage, level }, archive) => {
|
|
|
6981
7325
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
6982
7326
|
import { Event as Event10, synchronized as synchronized3 } from "@dxos/async";
|
|
6983
7327
|
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
6984
|
-
import { Context as
|
|
6985
|
-
import { EdgeClient } from "@dxos/edge-client";
|
|
7328
|
+
import { Context as Context10 } from "@dxos/context";
|
|
7329
|
+
import { EdgeClient, EdgeHttpClient, createStubEdgeIdentity } from "@dxos/edge-client";
|
|
6986
7330
|
import { invariant as invariant21 } from "@dxos/invariant";
|
|
6987
7331
|
import { PublicKey as PublicKey17 } from "@dxos/keys";
|
|
6988
7332
|
import { log as log23 } from "@dxos/log";
|
|
@@ -7373,7 +7717,7 @@ var SystemServiceImpl = class {
|
|
|
7373
7717
|
};
|
|
7374
7718
|
|
|
7375
7719
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
7376
|
-
function
|
|
7720
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
7377
7721
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7378
7722
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
7379
7723
|
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;
|
|
@@ -7395,6 +7739,7 @@ var ClientServicesHost = class {
|
|
|
7395
7739
|
this._tracingService = TRACE_PROCESSOR3.createTraceSender();
|
|
7396
7740
|
this._statusUpdate = new Event10();
|
|
7397
7741
|
this._edgeConnection = void 0;
|
|
7742
|
+
this._edgeHttpClient = void 0;
|
|
7398
7743
|
this._opening = false;
|
|
7399
7744
|
this._open = false;
|
|
7400
7745
|
this._storage = storage;
|
|
@@ -7416,9 +7761,9 @@ var ClientServicesHost = class {
|
|
|
7416
7761
|
lockKey,
|
|
7417
7762
|
onAcquire: () => {
|
|
7418
7763
|
if (!this._opening) {
|
|
7419
|
-
void this.open(new
|
|
7764
|
+
void this.open(new Context10(void 0, {
|
|
7420
7765
|
F: __dxlog_file26,
|
|
7421
|
-
L:
|
|
7766
|
+
L: 133
|
|
7422
7767
|
}));
|
|
7423
7768
|
}
|
|
7424
7769
|
},
|
|
@@ -7476,7 +7821,7 @@ var ClientServicesHost = class {
|
|
|
7476
7821
|
initialize({ config, ...options }) {
|
|
7477
7822
|
invariant21(!this._open, "service host is open", {
|
|
7478
7823
|
F: __dxlog_file26,
|
|
7479
|
-
L:
|
|
7824
|
+
L: 199,
|
|
7480
7825
|
S: this,
|
|
7481
7826
|
A: [
|
|
7482
7827
|
"!this._open",
|
|
@@ -7485,14 +7830,14 @@ var ClientServicesHost = class {
|
|
|
7485
7830
|
});
|
|
7486
7831
|
log23("initializing...", void 0, {
|
|
7487
7832
|
F: __dxlog_file26,
|
|
7488
|
-
L:
|
|
7833
|
+
L: 200,
|
|
7489
7834
|
S: this,
|
|
7490
7835
|
C: (f, a) => f(...a)
|
|
7491
7836
|
});
|
|
7492
7837
|
if (config) {
|
|
7493
7838
|
invariant21(!this._config, "config already set", {
|
|
7494
7839
|
F: __dxlog_file26,
|
|
7495
|
-
L:
|
|
7840
|
+
L: 203,
|
|
7496
7841
|
S: this,
|
|
7497
7842
|
A: [
|
|
7498
7843
|
"!this._config",
|
|
@@ -7507,17 +7852,17 @@ var ClientServicesHost = class {
|
|
|
7507
7852
|
if (!options.signalManager) {
|
|
7508
7853
|
log23.warn("running signaling without telemetry metadata.", void 0, {
|
|
7509
7854
|
F: __dxlog_file26,
|
|
7510
|
-
L:
|
|
7855
|
+
L: 211,
|
|
7511
7856
|
S: this,
|
|
7512
7857
|
C: (f, a) => f(...a)
|
|
7513
7858
|
});
|
|
7514
7859
|
}
|
|
7515
7860
|
const edgeEndpoint = config?.get("runtime.services.edge.url");
|
|
7516
7861
|
if (edgeEndpoint) {
|
|
7517
|
-
|
|
7518
|
-
this._edgeConnection = new EdgeClient(randomKey, randomKey, {
|
|
7862
|
+
this._edgeConnection = new EdgeClient(createStubEdgeIdentity(), {
|
|
7519
7863
|
socketEndpoint: edgeEndpoint
|
|
7520
7864
|
});
|
|
7865
|
+
this._edgeHttpClient = new EdgeHttpClient(edgeEndpoint);
|
|
7521
7866
|
}
|
|
7522
7867
|
const { connectionLog = true, transportFactory = createRtcTransportFactory({
|
|
7523
7868
|
iceServers: this._config?.get("runtime.services.ice")
|
|
@@ -7527,7 +7872,7 @@ var ClientServicesHost = class {
|
|
|
7527
7872
|
this._signalManager = signalManager;
|
|
7528
7873
|
invariant21(!this._networkManager, "network manager already set", {
|
|
7529
7874
|
F: __dxlog_file26,
|
|
7530
|
-
L:
|
|
7875
|
+
L: 233,
|
|
7531
7876
|
S: this,
|
|
7532
7877
|
A: [
|
|
7533
7878
|
"!this._networkManager",
|
|
@@ -7545,7 +7890,7 @@ var ClientServicesHost = class {
|
|
|
7545
7890
|
});
|
|
7546
7891
|
log23("initialized", void 0, {
|
|
7547
7892
|
F: __dxlog_file26,
|
|
7548
|
-
L:
|
|
7893
|
+
L: 246,
|
|
7549
7894
|
S: this,
|
|
7550
7895
|
C: (f, a) => f(...a)
|
|
7551
7896
|
});
|
|
@@ -7559,13 +7904,13 @@ var ClientServicesHost = class {
|
|
|
7559
7904
|
id: traceId
|
|
7560
7905
|
}), {
|
|
7561
7906
|
F: __dxlog_file26,
|
|
7562
|
-
L:
|
|
7907
|
+
L: 257,
|
|
7563
7908
|
S: this,
|
|
7564
7909
|
C: (f, a) => f(...a)
|
|
7565
7910
|
});
|
|
7566
7911
|
invariant21(this._config, "config not set", {
|
|
7567
7912
|
F: __dxlog_file26,
|
|
7568
|
-
L:
|
|
7913
|
+
L: 259,
|
|
7569
7914
|
S: this,
|
|
7570
7915
|
A: [
|
|
7571
7916
|
"this._config",
|
|
@@ -7574,7 +7919,7 @@ var ClientServicesHost = class {
|
|
|
7574
7919
|
});
|
|
7575
7920
|
invariant21(this._storage, "storage not set", {
|
|
7576
7921
|
F: __dxlog_file26,
|
|
7577
|
-
L:
|
|
7922
|
+
L: 260,
|
|
7578
7923
|
S: this,
|
|
7579
7924
|
A: [
|
|
7580
7925
|
"this._storage",
|
|
@@ -7583,7 +7928,7 @@ var ClientServicesHost = class {
|
|
|
7583
7928
|
});
|
|
7584
7929
|
invariant21(this._signalManager, "signal manager not set", {
|
|
7585
7930
|
F: __dxlog_file26,
|
|
7586
|
-
L:
|
|
7931
|
+
L: 261,
|
|
7587
7932
|
S: this,
|
|
7588
7933
|
A: [
|
|
7589
7934
|
"this._signalManager",
|
|
@@ -7592,7 +7937,7 @@ var ClientServicesHost = class {
|
|
|
7592
7937
|
});
|
|
7593
7938
|
invariant21(this._networkManager, "network manager not set", {
|
|
7594
7939
|
F: __dxlog_file26,
|
|
7595
|
-
L:
|
|
7940
|
+
L: 262,
|
|
7596
7941
|
S: this,
|
|
7597
7942
|
A: [
|
|
7598
7943
|
"this._networkManager",
|
|
@@ -7604,7 +7949,7 @@ var ClientServicesHost = class {
|
|
|
7604
7949
|
lockKey: this._resourceLock?.lockKey
|
|
7605
7950
|
}, {
|
|
7606
7951
|
F: __dxlog_file26,
|
|
7607
|
-
L:
|
|
7952
|
+
L: 265,
|
|
7608
7953
|
S: this,
|
|
7609
7954
|
C: (f, a) => f(...a)
|
|
7610
7955
|
});
|
|
@@ -7614,7 +7959,7 @@ var ClientServicesHost = class {
|
|
|
7614
7959
|
}
|
|
7615
7960
|
await this._level.open();
|
|
7616
7961
|
await this._loggingService.open();
|
|
7617
|
-
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._edgeConnection, this._runtimeParams, this._config.get("runtime.client.edgeFeatures"));
|
|
7962
|
+
this._serviceContext = new ServiceContext(this._storage, this._level, this._networkManager, this._signalManager, this._edgeConnection, this._edgeHttpClient, this._runtimeParams, this._config.get("runtime.client.edgeFeatures"));
|
|
7618
7963
|
const dataSpaceManagerProvider = async () => {
|
|
7619
7964
|
await this._serviceContext.initialized.wait();
|
|
7620
7965
|
return this._serviceContext.dataSpaceManager;
|
|
@@ -7660,7 +8005,7 @@ var ClientServicesHost = class {
|
|
|
7660
8005
|
deviceKey
|
|
7661
8006
|
}, {
|
|
7662
8007
|
F: __dxlog_file26,
|
|
7663
|
-
L:
|
|
8008
|
+
L: 354,
|
|
7664
8009
|
S: this,
|
|
7665
8010
|
C: (f, a) => f(...a)
|
|
7666
8011
|
});
|
|
@@ -7668,7 +8013,7 @@ var ClientServicesHost = class {
|
|
|
7668
8013
|
id: traceId
|
|
7669
8014
|
}), {
|
|
7670
8015
|
F: __dxlog_file26,
|
|
7671
|
-
L:
|
|
8016
|
+
L: 355,
|
|
7672
8017
|
S: this,
|
|
7673
8018
|
C: (f, a) => f(...a)
|
|
7674
8019
|
});
|
|
@@ -7682,7 +8027,7 @@ var ClientServicesHost = class {
|
|
|
7682
8027
|
deviceKey
|
|
7683
8028
|
}, {
|
|
7684
8029
|
F: __dxlog_file26,
|
|
7685
|
-
L:
|
|
8030
|
+
L: 366,
|
|
7686
8031
|
S: this,
|
|
7687
8032
|
C: (f, a) => f(...a)
|
|
7688
8033
|
});
|
|
@@ -7700,7 +8045,7 @@ var ClientServicesHost = class {
|
|
|
7700
8045
|
deviceKey
|
|
7701
8046
|
}, {
|
|
7702
8047
|
F: __dxlog_file26,
|
|
7703
|
-
L:
|
|
8048
|
+
L: 375,
|
|
7704
8049
|
S: this,
|
|
7705
8050
|
C: (f, a) => f(...a)
|
|
7706
8051
|
});
|
|
@@ -7711,13 +8056,13 @@ var ClientServicesHost = class {
|
|
|
7711
8056
|
id: traceId
|
|
7712
8057
|
}), {
|
|
7713
8058
|
F: __dxlog_file26,
|
|
7714
|
-
L:
|
|
8059
|
+
L: 380,
|
|
7715
8060
|
S: this,
|
|
7716
8061
|
C: (f, a) => f(...a)
|
|
7717
8062
|
});
|
|
7718
8063
|
log23.info("resetting...", void 0, {
|
|
7719
8064
|
F: __dxlog_file26,
|
|
7720
|
-
L:
|
|
8065
|
+
L: 382,
|
|
7721
8066
|
S: this,
|
|
7722
8067
|
C: (f, a) => f(...a)
|
|
7723
8068
|
});
|
|
@@ -7725,7 +8070,7 @@ var ClientServicesHost = class {
|
|
|
7725
8070
|
await this._storage.reset();
|
|
7726
8071
|
log23.info("reset", void 0, {
|
|
7727
8072
|
F: __dxlog_file26,
|
|
7728
|
-
L:
|
|
8073
|
+
L: 385,
|
|
7729
8074
|
S: this,
|
|
7730
8075
|
C: (f, a) => f(...a)
|
|
7731
8076
|
});
|
|
@@ -7733,7 +8078,7 @@ var ClientServicesHost = class {
|
|
|
7733
8078
|
id: traceId
|
|
7734
8079
|
}), {
|
|
7735
8080
|
F: __dxlog_file26,
|
|
7736
|
-
L:
|
|
8081
|
+
L: 386,
|
|
7737
8082
|
S: this,
|
|
7738
8083
|
C: (f, a) => f(...a)
|
|
7739
8084
|
});
|
|
@@ -7745,21 +8090,21 @@ var ClientServicesHost = class {
|
|
|
7745
8090
|
return identity;
|
|
7746
8091
|
}
|
|
7747
8092
|
};
|
|
7748
|
-
|
|
8093
|
+
_ts_decorate10([
|
|
7749
8094
|
Trace4.info()
|
|
7750
8095
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
7751
|
-
|
|
8096
|
+
_ts_decorate10([
|
|
7752
8097
|
Trace4.info()
|
|
7753
8098
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
7754
|
-
|
|
8099
|
+
_ts_decorate10([
|
|
7755
8100
|
synchronized3,
|
|
7756
8101
|
Trace4.span()
|
|
7757
8102
|
], ClientServicesHost.prototype, "open", null);
|
|
7758
|
-
|
|
8103
|
+
_ts_decorate10([
|
|
7759
8104
|
synchronized3,
|
|
7760
8105
|
Trace4.span()
|
|
7761
8106
|
], ClientServicesHost.prototype, "close", null);
|
|
7762
|
-
ClientServicesHost =
|
|
8107
|
+
ClientServicesHost = _ts_decorate10([
|
|
7763
8108
|
Trace4.resource()
|
|
7764
8109
|
], ClientServicesHost);
|
|
7765
8110
|
|
|
@@ -7806,4 +8151,4 @@ export {
|
|
|
7806
8151
|
importProfileData,
|
|
7807
8152
|
ClientServicesHost
|
|
7808
8153
|
};
|
|
7809
|
-
//# sourceMappingURL=chunk-
|
|
8154
|
+
//# sourceMappingURL=chunk-6747X7GN.mjs.map
|