tinybase 5.2.0-beta.1 → 5.2.0-beta.2
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/@types/synchronizers/synchronizer-ws-server/index.d.cts +4 -1
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +4 -1
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +6 -1
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +6 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +35 -29
- package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +35 -29
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
- package/cjs/synchronizers/synchronizer-ws-server/index.cjs +30 -27
- package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +30 -27
- package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/es6/synchronizers/synchronizer-ws-server/index.js +35 -29
- package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +35 -29
- package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/package.json +3 -3
- package/readme.md +3 -3
- package/releases.md +4 -4
- package/synchronizers/synchronizer-ws-server/index.js +30 -27
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +30 -27
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/es6/synchronizers/synchronizer-ws-server/index.js +35 -33
- package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +35 -33
- package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/umd/synchronizers/synchronizer-ws-server/index.js +32 -27
- package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +32 -27
|
@@ -641,32 +641,37 @@
|
|
|
641
641
|
const [addListener, callListeners, delListenerImpl] = getListenerFunctions(
|
|
642
642
|
() => wsServer,
|
|
643
643
|
);
|
|
644
|
-
const configureServerClient = (serverClient, pathId, clients) =>
|
|
645
|
-
ifNotUndefined(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
644
|
+
const configureServerClient = async (serverClient, pathId, clients) =>
|
|
645
|
+
ifNotUndefined(
|
|
646
|
+
await createPersisterForPath?.(pathId),
|
|
647
|
+
(persisterMaybeThen) => {
|
|
648
|
+
serverClient[0 /* State */] = 1;
|
|
649
|
+
serverClient[1 /* Persister */] = isArray(persisterMaybeThen)
|
|
650
|
+
? persisterMaybeThen[0]
|
|
651
|
+
: persisterMaybeThen;
|
|
652
|
+
const messageHandler = getMessageHandler(
|
|
653
|
+
SERVER_CLIENT_ID,
|
|
654
|
+
clients,
|
|
655
|
+
serverClient,
|
|
656
|
+
);
|
|
657
|
+
serverClient[2 /* Synchronizer */] = createCustomSynchronizer(
|
|
658
|
+
serverClient[1 /* Persister */].getStore(),
|
|
659
|
+
(toClientId, requestId, message, body) =>
|
|
660
|
+
messageHandler(
|
|
661
|
+
createPayload(toClientId, requestId, message, body),
|
|
662
|
+
),
|
|
663
|
+
(receive) =>
|
|
664
|
+
(serverClient[3 /* Send */] = (payload) =>
|
|
665
|
+
receivePayload(payload, receive)),
|
|
666
|
+
() => {},
|
|
667
|
+
1,
|
|
668
|
+
);
|
|
669
|
+
serverClient[4 /* Buffer */] = [];
|
|
670
|
+
serverClient[5 /* Then */] = isArray(persisterMaybeThen)
|
|
671
|
+
? persisterMaybeThen[1]
|
|
672
|
+
: (_) => 0;
|
|
673
|
+
},
|
|
674
|
+
);
|
|
670
675
|
const startServerClient = async (serverClient) => {
|
|
671
676
|
serverClient[0 /* State */] = 2 /* Starting */;
|
|
672
677
|
await serverClient[1 /* Persister */].schedule(
|
|
@@ -715,7 +720,7 @@
|
|
|
715
720
|
);
|
|
716
721
|
if (collIsEmpty(clients)) {
|
|
717
722
|
callListeners(pathIdListeners, void 0, pathId, 1);
|
|
718
|
-
configureServerClient(serverClient, pathId, clients);
|
|
723
|
+
await configureServerClient(serverClient, pathId, clients);
|
|
719
724
|
}
|
|
720
725
|
mapSet(clients, clientId, webSocket);
|
|
721
726
|
callListeners(clientIdListeners, [pathId], clientId, 1);
|