@dxos/client-services 0.6.12-main.ed7cda7 → 0.6.12-main.f9d0246
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-VENIOUQ4.mjs → chunk-7ONARHVD.mjs} +60 -50
- package/dist/lib/browser/chunk-7ONARHVD.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 +1 -1
- package/dist/lib/node/{chunk-US3NPCS5.cjs → chunk-UPLMIG6W.cjs} +63 -53
- package/dist/lib/node/chunk-UPLMIG6W.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-esm/{chunk-LV7T6HCX.mjs → chunk-DSRREBQH.mjs} +60 -50
- package/dist/lib/node-esm/chunk-DSRREBQH.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 +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/version.d.ts +1 -1
- package/package.json +38 -38
- package/src/packlets/spaces/edge-feed-replicator.test.ts +10 -0
- package/src/packlets/spaces/edge-feed-replicator.ts +34 -22
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-VENIOUQ4.mjs.map +0 -7
- package/dist/lib/node/chunk-US3NPCS5.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-LV7T6HCX.mjs.map +0 -7
|
@@ -32,7 +32,7 @@ __export(testing_exports, {
|
|
|
32
32
|
sanitizeInvitation: () => sanitizeInvitation
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(testing_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_UPLMIG6W = require("../chunk-UPLMIG6W.cjs");
|
|
36
36
|
var import_credentials = require("@dxos/credentials");
|
|
37
37
|
var import_keys = require("@dxos/keys");
|
|
38
38
|
var import_async = require("@dxos/async");
|
|
@@ -228,7 +228,7 @@ var createInvitation = async (host, options) => {
|
|
|
228
228
|
authMethod: import_services.Invitation.AuthMethod.NONE,
|
|
229
229
|
...options ?? {}
|
|
230
230
|
};
|
|
231
|
-
if (host instanceof
|
|
231
|
+
if (host instanceof import_chunk_UPLMIG6W.ServiceContext) {
|
|
232
232
|
return host.invitationsManager.createInvitation({
|
|
233
233
|
kind: import_services.Invitation.Kind.SPACE,
|
|
234
234
|
...options
|
|
@@ -238,7 +238,7 @@ var createInvitation = async (host, options) => {
|
|
|
238
238
|
};
|
|
239
239
|
var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
240
240
|
invitation = sanitizeInvitation(invitation);
|
|
241
|
-
if (guest instanceof
|
|
241
|
+
if (guest instanceof import_chunk_UPLMIG6W.ServiceContext) {
|
|
242
242
|
return guest.invitationsManager.acceptInvitation({
|
|
243
243
|
invitation,
|
|
244
244
|
deviceProfile: guestDeviceProfile
|
|
@@ -248,7 +248,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
|
248
248
|
};
|
|
249
249
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
|
|
250
250
|
var createServiceHost = (config, signalManagerContext) => {
|
|
251
|
-
return new
|
|
251
|
+
return new import_chunk_UPLMIG6W.ClientServicesHost({
|
|
252
252
|
config,
|
|
253
253
|
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
254
254
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
@@ -267,7 +267,7 @@ var createServiceContext = async ({ signalManagerFactory = async () => {
|
|
|
267
267
|
});
|
|
268
268
|
const level = (0, import_testing.createTestLevel)();
|
|
269
269
|
await level.open();
|
|
270
|
-
return new
|
|
270
|
+
return new import_chunk_UPLMIG6W.ServiceContext(storage, level, networkManager, signalManager, void 0, {
|
|
271
271
|
invitationConnectionDefaultParams: {
|
|
272
272
|
controlHeartbeatInterval: 200
|
|
273
273
|
},
|
|
@@ -376,7 +376,7 @@ var TestPeer = class {
|
|
|
376
376
|
return this._props.meshEchoReplicator ??= new import_echo_pipeline.MeshEchoReplicator();
|
|
377
377
|
}
|
|
378
378
|
get dataSpaceManager() {
|
|
379
|
-
return this._props.dataSpaceManager ??= new
|
|
379
|
+
return this._props.dataSpaceManager ??= new import_chunk_UPLMIG6W.DataSpaceManager({
|
|
380
380
|
spaceManager: this.spaceManager,
|
|
381
381
|
metadataStore: this.metadataStore,
|
|
382
382
|
keyring: this.keyring,
|
|
@@ -391,9 +391,9 @@ var TestPeer = class {
|
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
get invitationsManager() {
|
|
394
|
-
return this._props.invitationsManager ??= new
|
|
394
|
+
return this._props.invitationsManager ??= new import_chunk_UPLMIG6W.InvitationsManager(new import_chunk_UPLMIG6W.InvitationsHandler(this.networkManager), (invitation) => {
|
|
395
395
|
if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
|
|
396
|
-
return new
|
|
396
|
+
return new import_chunk_UPLMIG6W.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
|
|
397
397
|
} else {
|
|
398
398
|
throw new Error("not implemented");
|
|
399
399
|
}
|
|
@@ -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.f9d0246";
|
|
401
401
|
|
|
402
402
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
403
403
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -852,45 +852,31 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
852
852
|
}));
|
|
853
853
|
this._messenger.connected.on(this._ctx, async () => {
|
|
854
854
|
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
|
-
});
|
|
855
|
+
this._startReplication();
|
|
889
856
|
});
|
|
857
|
+
if (this._messenger.isConnected) {
|
|
858
|
+
this._startReplication();
|
|
859
|
+
}
|
|
890
860
|
}
|
|
891
861
|
async _close() {
|
|
892
862
|
await this._resetConnection();
|
|
893
863
|
}
|
|
864
|
+
_startReplication() {
|
|
865
|
+
this._connected = true;
|
|
866
|
+
const connectionCtx = this._createConnectionContext();
|
|
867
|
+
this._connectionCtx = connectionCtx;
|
|
868
|
+
log3("connection context created", void 0, {
|
|
869
|
+
F: __dxlog_file5,
|
|
870
|
+
L: 94,
|
|
871
|
+
S: this,
|
|
872
|
+
C: (f, a) => f(...a)
|
|
873
|
+
});
|
|
874
|
+
scheduleMicroTask(connectionCtx, async () => {
|
|
875
|
+
for (const feed of this._feeds.values()) {
|
|
876
|
+
await this._replicateFeed(connectionCtx, feed);
|
|
877
|
+
}
|
|
878
|
+
});
|
|
879
|
+
}
|
|
894
880
|
async _resetConnection() {
|
|
895
881
|
this._connected = false;
|
|
896
882
|
await this._connectionCtx?.dispose();
|
|
@@ -902,7 +888,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
902
888
|
key: feed.key
|
|
903
889
|
}, {
|
|
904
890
|
F: __dxlog_file5,
|
|
905
|
-
L:
|
|
891
|
+
L: 110,
|
|
906
892
|
S: this,
|
|
907
893
|
C: (f, a) => f(...a)
|
|
908
894
|
});
|
|
@@ -927,7 +913,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
927
913
|
if (!this._connectionCtx) {
|
|
928
914
|
log3.info("message dropped because connection was disposed", void 0, {
|
|
929
915
|
F: __dxlog_file5,
|
|
930
|
-
L:
|
|
916
|
+
L: 135,
|
|
931
917
|
S: this,
|
|
932
918
|
C: (f, a) => f(...a)
|
|
933
919
|
});
|
|
@@ -941,13 +927,13 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
941
927
|
};
|
|
942
928
|
log3.info("sending message", logPayload, {
|
|
943
929
|
F: __dxlog_file5,
|
|
944
|
-
L:
|
|
930
|
+
L: 141,
|
|
945
931
|
S: this,
|
|
946
932
|
C: (f, a) => f(...a)
|
|
947
933
|
});
|
|
948
934
|
invariant2(message.feedKey, void 0, {
|
|
949
935
|
F: __dxlog_file5,
|
|
950
|
-
L:
|
|
936
|
+
L: 143,
|
|
951
937
|
S: this,
|
|
952
938
|
A: [
|
|
953
939
|
"message.feedKey",
|
|
@@ -970,7 +956,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
970
956
|
if (!this._connectionCtx) {
|
|
971
957
|
log3.warn("received message after connection context was disposed", void 0, {
|
|
972
958
|
F: __dxlog_file5,
|
|
973
|
-
L:
|
|
959
|
+
L: 160,
|
|
974
960
|
S: this,
|
|
975
961
|
C: (f, a) => f(...a)
|
|
976
962
|
});
|
|
@@ -985,7 +971,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
985
971
|
message
|
|
986
972
|
}, {
|
|
987
973
|
F: __dxlog_file5,
|
|
988
|
-
L:
|
|
974
|
+
L: 166,
|
|
989
975
|
S: this,
|
|
990
976
|
C: (f, a) => f(...a)
|
|
991
977
|
});
|
|
@@ -996,7 +982,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
996
982
|
feedKey
|
|
997
983
|
}, {
|
|
998
984
|
F: __dxlog_file5,
|
|
999
|
-
L:
|
|
985
|
+
L: 171,
|
|
1000
986
|
S: this,
|
|
1001
987
|
C: (f, a) => f(...a)
|
|
1002
988
|
});
|
|
@@ -1029,7 +1015,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1029
1015
|
blocks: message.blocks.map((b) => b.index)
|
|
1030
1016
|
}, {
|
|
1031
1017
|
F: __dxlog_file5,
|
|
1032
|
-
L:
|
|
1018
|
+
L: 193,
|
|
1033
1019
|
S: this,
|
|
1034
1020
|
C: (f, a) => f(...a)
|
|
1035
1021
|
});
|
|
@@ -1040,7 +1026,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1040
1026
|
feedKey
|
|
1041
1027
|
}, {
|
|
1042
1028
|
F: __dxlog_file5,
|
|
1043
|
-
L:
|
|
1029
|
+
L: 198,
|
|
1044
1030
|
S: this,
|
|
1045
1031
|
C: (f, a) => f(...a)
|
|
1046
1032
|
});
|
|
@@ -1054,7 +1040,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1054
1040
|
...message
|
|
1055
1041
|
}, {
|
|
1056
1042
|
F: __dxlog_file5,
|
|
1057
|
-
L:
|
|
1043
|
+
L: 207,
|
|
1058
1044
|
S: this,
|
|
1059
1045
|
C: (f, a) => f(...a)
|
|
1060
1046
|
});
|
|
@@ -1069,7 +1055,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1069
1055
|
to
|
|
1070
1056
|
}, {
|
|
1071
1057
|
F: __dxlog_file5,
|
|
1072
|
-
L:
|
|
1058
|
+
L: 214,
|
|
1073
1059
|
S: this,
|
|
1074
1060
|
C: (f, a) => f(...a)
|
|
1075
1061
|
});
|
|
@@ -1079,7 +1065,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1079
1065
|
});
|
|
1080
1066
|
invariant2(data instanceof Uint8Array, void 0, {
|
|
1081
1067
|
F: __dxlog_file5,
|
|
1082
|
-
L:
|
|
1068
|
+
L: 219,
|
|
1083
1069
|
S: this,
|
|
1084
1070
|
A: [
|
|
1085
1071
|
"data instanceof Uint8Array",
|
|
@@ -1107,7 +1093,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1107
1093
|
blocks: blocks.length
|
|
1108
1094
|
}, {
|
|
1109
1095
|
F: __dxlog_file5,
|
|
1110
|
-
L:
|
|
1096
|
+
L: 240,
|
|
1111
1097
|
S: this,
|
|
1112
1098
|
C: (f, a) => f(...a)
|
|
1113
1099
|
});
|
|
@@ -1129,7 +1115,7 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1129
1115
|
if (!this._remoteLength.has(feed.key)) {
|
|
1130
1116
|
log3("blocks not pushed because remote length is unknown", void 0, {
|
|
1131
1117
|
F: __dxlog_file5,
|
|
1132
|
-
L:
|
|
1118
|
+
L: 261,
|
|
1133
1119
|
S: this,
|
|
1134
1120
|
C: (f, a) => f(...a)
|
|
1135
1121
|
});
|
|
@@ -1145,6 +1131,30 @@ var EdgeFeedReplicator = class extends Resource {
|
|
|
1145
1131
|
_usingCtx.d();
|
|
1146
1132
|
}
|
|
1147
1133
|
}
|
|
1134
|
+
_createConnectionContext() {
|
|
1135
|
+
const connectionCtx = new Context3({
|
|
1136
|
+
onError: async (err) => {
|
|
1137
|
+
if (connectionCtx !== this._connectionCtx) {
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
|
|
1141
|
+
log3("resetting on reconnect", void 0, {
|
|
1142
|
+
F: __dxlog_file5,
|
|
1143
|
+
L: 278,
|
|
1144
|
+
S: this,
|
|
1145
|
+
C: (f, a) => f(...a)
|
|
1146
|
+
});
|
|
1147
|
+
await this._resetConnection();
|
|
1148
|
+
} else {
|
|
1149
|
+
this._ctx.raise(err);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}, {
|
|
1153
|
+
F: __dxlog_file5,
|
|
1154
|
+
L: 272
|
|
1155
|
+
});
|
|
1156
|
+
return connectionCtx;
|
|
1157
|
+
}
|
|
1148
1158
|
};
|
|
1149
1159
|
var bufferizeBlock = (block) => ({
|
|
1150
1160
|
index: block.index,
|
|
@@ -7806,4 +7816,4 @@ export {
|
|
|
7806
7816
|
importProfileData,
|
|
7807
7817
|
ClientServicesHost
|
|
7808
7818
|
};
|
|
7809
|
-
//# sourceMappingURL=chunk-
|
|
7819
|
+
//# sourceMappingURL=chunk-DSRREBQH.mjs.map
|