@liveblocks/server 1.6.1 → 1.6.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/dist/index.cjs +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1439,7 +1439,7 @@ type RoomOptions<SM, CM extends JsonObject, C> = {
|
|
|
1439
1439
|
* Therefore, only ever use this hook to implement a side effect (like
|
|
1440
1440
|
* trigger a notification), don't read storage in this hook directly.
|
|
1441
1441
|
*/
|
|
1442
|
-
postClientMsgStorageDidUpdate?: (ctx?: C) => void | Promise<void>;
|
|
1442
|
+
postClientMsgStorageDidUpdate?: (ctx?: C, sess?: BrowserSession<SM, CM>) => void | Promise<void>;
|
|
1443
1443
|
/**
|
|
1444
1444
|
* Called when Yjs Storage for the room was updated.
|
|
1445
1445
|
*
|
|
@@ -1811,6 +1811,33 @@ declare class NestedMap<K1, K2, V> {
|
|
|
1811
1811
|
deleteAll(key1: K1): void;
|
|
1812
1812
|
}
|
|
1813
1813
|
|
|
1814
|
+
/**
|
|
1815
|
+
* Copyright (c) Liveblocks Inc.
|
|
1816
|
+
*
|
|
1817
|
+
* This program is free software: you can redistribute it and/or modify
|
|
1818
|
+
* it under the terms of the GNU Affero General Public License as published
|
|
1819
|
+
* by the Free Software Foundation, either version 3 of the License, or
|
|
1820
|
+
* (at your option) any later version.
|
|
1821
|
+
*
|
|
1822
|
+
* This program is distributed in the hope that it will be useful,
|
|
1823
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1824
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1825
|
+
* GNU Affero General Public License for more details.
|
|
1826
|
+
*
|
|
1827
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
1828
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
1829
|
+
*/
|
|
1830
|
+
/**
|
|
1831
|
+
* Compares two semver-ish version strings (`major.minor.patch` with an optional
|
|
1832
|
+
* `-prerelease` suffix). Returns a negative number if `a < b`, a positive number
|
|
1833
|
+
* if `a > b`, and `0` if they're equal.
|
|
1834
|
+
*
|
|
1835
|
+
* Missing numeric components are treated as `0`, so `"3.21"` and `"3.21.0"`
|
|
1836
|
+
* compare equal. A final release outranks any of its prereleases
|
|
1837
|
+
* (`"3.14.0" > "3.14.0-rc1"`); prereleases are otherwise compared lexically.
|
|
1838
|
+
*/
|
|
1839
|
+
declare function cmpSemver(a: string, b: string): number;
|
|
1840
|
+
|
|
1814
1841
|
/**
|
|
1815
1842
|
* Copyright (c) Liveblocks Inc.
|
|
1816
1843
|
*
|
|
@@ -1967,4 +1994,4 @@ declare class InMemoryDriver implements IStorageDriver {
|
|
|
1967
1994
|
private _loadNodesApi;
|
|
1968
1995
|
}
|
|
1969
1996
|
|
|
1970
|
-
export { type ActorID, type AddFeedClientMsg, type AddFeedMessageClientMsg, BackendSession, BrowserSession, ConsoleTarget, type CreateTicketOptions, DefaultMap, type DeleteFeedClientMsg, type DeleteFeedMessageClientMsg, type Feed, type FeedDeletedServerMsg, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesServerMsg, type FeedMessagesUpdatedServerMsg, FeedMsgCode, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedsAddedServerMsg, type FeedsListServerMsg, type FeedsServerMsg, type FeedsUpdatedServerMsg, type FetchFeedMessagesClientMsg, type FetchFeedsClientMsg, type FixOp, type Guid, type IReadableSnapshot, type IServerWebSocket, type IStorageDriver, type IUserData, InMemoryDriver, type LeasedSession, type ListFeedMessagesOptions, type ListFeedMessagesResult, type ListFeedsOptions, type ListFeedsResult, LogLevel, LogTarget, Logger, type MetadataDB, type Millis, NestedMap, type NodeMap, type NodeStream, type NodeTuple, type Pos, ProtocolVersion, ROOT_YDOC_ID, Room, type SessionKey, type Ticket, UniqueMap, type UpdateFeedClientMsg, type UpdateFeedMessageClientMsg, type YDocId, type YUpdate, type YVector, ackIgnoredOp, clientMsgDecoder, concatUint8Arrays, feedFailureServerMsg, feedMetadataIdDecoder, feedMetadataUpdateDecoder, feedRequestFailed, fetchFeedsMetadataFilterDecoder, guidDecoder, isLeasedSessionExpired, jsonObjectYolo, jsonYolo, type jstring, makeInMemorySnapshot, makeMetadataDB, mapFeedError, optionalFeedMetadataDecoder, plainLsonToNodeStream, protocolVersionDecoder, quote, serialize as serializeServerMsg, snapshotToLossyJson_eager, snapshotToLossyJson_lazy, snapshotToNodeStream, snapshotToPlainLson_eager, snapshotToPlainLson_lazy, Storage as test_only__Storage, YjsStorage as test_only__YjsStorage, transientClientMsgDecoder, tryCatch };
|
|
1997
|
+
export { type ActorID, type AddFeedClientMsg, type AddFeedMessageClientMsg, BackendSession, BrowserSession, ConsoleTarget, type CreateTicketOptions, DefaultMap, type DeleteFeedClientMsg, type DeleteFeedMessageClientMsg, type Feed, type FeedDeletedServerMsg, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesServerMsg, type FeedMessagesUpdatedServerMsg, FeedMsgCode, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedsAddedServerMsg, type FeedsListServerMsg, type FeedsServerMsg, type FeedsUpdatedServerMsg, type FetchFeedMessagesClientMsg, type FetchFeedsClientMsg, type FixOp, type Guid, type IReadableSnapshot, type IServerWebSocket, type IStorageDriver, type IUserData, InMemoryDriver, type LeasedSession, type ListFeedMessagesOptions, type ListFeedMessagesResult, type ListFeedsOptions, type ListFeedsResult, LogLevel, LogTarget, Logger, type MetadataDB, type Millis, NestedMap, type NodeMap, type NodeStream, type NodeTuple, type Pos, ProtocolVersion, ROOT_YDOC_ID, Room, type SessionKey, type Ticket, UniqueMap, type UpdateFeedClientMsg, type UpdateFeedMessageClientMsg, type YDocId, type YUpdate, type YVector, ackIgnoredOp, clientMsgDecoder, cmpSemver, concatUint8Arrays, feedFailureServerMsg, feedMetadataIdDecoder, feedMetadataUpdateDecoder, feedRequestFailed, fetchFeedsMetadataFilterDecoder, guidDecoder, isLeasedSessionExpired, jsonObjectYolo, jsonYolo, type jstring, makeInMemorySnapshot, makeMetadataDB, mapFeedError, optionalFeedMetadataDecoder, plainLsonToNodeStream, protocolVersionDecoder, quote, serialize as serializeServerMsg, snapshotToLossyJson_eager, snapshotToLossyJson_lazy, snapshotToNodeStream, snapshotToPlainLson_eager, snapshotToPlainLson_lazy, Storage as test_only__Storage, YjsStorage as test_only__YjsStorage, transientClientMsgDecoder, tryCatch };
|
package/dist/index.d.ts
CHANGED
|
@@ -1439,7 +1439,7 @@ type RoomOptions<SM, CM extends JsonObject, C> = {
|
|
|
1439
1439
|
* Therefore, only ever use this hook to implement a side effect (like
|
|
1440
1440
|
* trigger a notification), don't read storage in this hook directly.
|
|
1441
1441
|
*/
|
|
1442
|
-
postClientMsgStorageDidUpdate?: (ctx?: C) => void | Promise<void>;
|
|
1442
|
+
postClientMsgStorageDidUpdate?: (ctx?: C, sess?: BrowserSession<SM, CM>) => void | Promise<void>;
|
|
1443
1443
|
/**
|
|
1444
1444
|
* Called when Yjs Storage for the room was updated.
|
|
1445
1445
|
*
|
|
@@ -1811,6 +1811,33 @@ declare class NestedMap<K1, K2, V> {
|
|
|
1811
1811
|
deleteAll(key1: K1): void;
|
|
1812
1812
|
}
|
|
1813
1813
|
|
|
1814
|
+
/**
|
|
1815
|
+
* Copyright (c) Liveblocks Inc.
|
|
1816
|
+
*
|
|
1817
|
+
* This program is free software: you can redistribute it and/or modify
|
|
1818
|
+
* it under the terms of the GNU Affero General Public License as published
|
|
1819
|
+
* by the Free Software Foundation, either version 3 of the License, or
|
|
1820
|
+
* (at your option) any later version.
|
|
1821
|
+
*
|
|
1822
|
+
* This program is distributed in the hope that it will be useful,
|
|
1823
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
1824
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
1825
|
+
* GNU Affero General Public License for more details.
|
|
1826
|
+
*
|
|
1827
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
1828
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
1829
|
+
*/
|
|
1830
|
+
/**
|
|
1831
|
+
* Compares two semver-ish version strings (`major.minor.patch` with an optional
|
|
1832
|
+
* `-prerelease` suffix). Returns a negative number if `a < b`, a positive number
|
|
1833
|
+
* if `a > b`, and `0` if they're equal.
|
|
1834
|
+
*
|
|
1835
|
+
* Missing numeric components are treated as `0`, so `"3.21"` and `"3.21.0"`
|
|
1836
|
+
* compare equal. A final release outranks any of its prereleases
|
|
1837
|
+
* (`"3.14.0" > "3.14.0-rc1"`); prereleases are otherwise compared lexically.
|
|
1838
|
+
*/
|
|
1839
|
+
declare function cmpSemver(a: string, b: string): number;
|
|
1840
|
+
|
|
1814
1841
|
/**
|
|
1815
1842
|
* Copyright (c) Liveblocks Inc.
|
|
1816
1843
|
*
|
|
@@ -1967,4 +1994,4 @@ declare class InMemoryDriver implements IStorageDriver {
|
|
|
1967
1994
|
private _loadNodesApi;
|
|
1968
1995
|
}
|
|
1969
1996
|
|
|
1970
|
-
export { type ActorID, type AddFeedClientMsg, type AddFeedMessageClientMsg, BackendSession, BrowserSession, ConsoleTarget, type CreateTicketOptions, DefaultMap, type DeleteFeedClientMsg, type DeleteFeedMessageClientMsg, type Feed, type FeedDeletedServerMsg, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesServerMsg, type FeedMessagesUpdatedServerMsg, FeedMsgCode, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedsAddedServerMsg, type FeedsListServerMsg, type FeedsServerMsg, type FeedsUpdatedServerMsg, type FetchFeedMessagesClientMsg, type FetchFeedsClientMsg, type FixOp, type Guid, type IReadableSnapshot, type IServerWebSocket, type IStorageDriver, type IUserData, InMemoryDriver, type LeasedSession, type ListFeedMessagesOptions, type ListFeedMessagesResult, type ListFeedsOptions, type ListFeedsResult, LogLevel, LogTarget, Logger, type MetadataDB, type Millis, NestedMap, type NodeMap, type NodeStream, type NodeTuple, type Pos, ProtocolVersion, ROOT_YDOC_ID, Room, type SessionKey, type Ticket, UniqueMap, type UpdateFeedClientMsg, type UpdateFeedMessageClientMsg, type YDocId, type YUpdate, type YVector, ackIgnoredOp, clientMsgDecoder, concatUint8Arrays, feedFailureServerMsg, feedMetadataIdDecoder, feedMetadataUpdateDecoder, feedRequestFailed, fetchFeedsMetadataFilterDecoder, guidDecoder, isLeasedSessionExpired, jsonObjectYolo, jsonYolo, type jstring, makeInMemorySnapshot, makeMetadataDB, mapFeedError, optionalFeedMetadataDecoder, plainLsonToNodeStream, protocolVersionDecoder, quote, serialize as serializeServerMsg, snapshotToLossyJson_eager, snapshotToLossyJson_lazy, snapshotToNodeStream, snapshotToPlainLson_eager, snapshotToPlainLson_lazy, Storage as test_only__Storage, YjsStorage as test_only__YjsStorage, transientClientMsgDecoder, tryCatch };
|
|
1997
|
+
export { type ActorID, type AddFeedClientMsg, type AddFeedMessageClientMsg, BackendSession, BrowserSession, ConsoleTarget, type CreateTicketOptions, DefaultMap, type DeleteFeedClientMsg, type DeleteFeedMessageClientMsg, type Feed, type FeedDeletedServerMsg, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesServerMsg, type FeedMessagesUpdatedServerMsg, FeedMsgCode, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedsAddedServerMsg, type FeedsListServerMsg, type FeedsServerMsg, type FeedsUpdatedServerMsg, type FetchFeedMessagesClientMsg, type FetchFeedsClientMsg, type FixOp, type Guid, type IReadableSnapshot, type IServerWebSocket, type IStorageDriver, type IUserData, InMemoryDriver, type LeasedSession, type ListFeedMessagesOptions, type ListFeedMessagesResult, type ListFeedsOptions, type ListFeedsResult, LogLevel, LogTarget, Logger, type MetadataDB, type Millis, NestedMap, type NodeMap, type NodeStream, type NodeTuple, type Pos, ProtocolVersion, ROOT_YDOC_ID, Room, type SessionKey, type Ticket, UniqueMap, type UpdateFeedClientMsg, type UpdateFeedMessageClientMsg, type YDocId, type YUpdate, type YVector, ackIgnoredOp, clientMsgDecoder, cmpSemver, concatUint8Arrays, feedFailureServerMsg, feedMetadataIdDecoder, feedMetadataUpdateDecoder, feedRequestFailed, fetchFeedsMetadataFilterDecoder, guidDecoder, isLeasedSessionExpired, jsonObjectYolo, jsonYolo, type jstring, makeInMemorySnapshot, makeMetadataDB, mapFeedError, optionalFeedMetadataDecoder, plainLsonToNodeStream, protocolVersionDecoder, quote, serialize as serializeServerMsg, snapshotToLossyJson_eager, snapshotToLossyJson_lazy, snapshotToNodeStream, snapshotToPlainLson_eager, snapshotToPlainLson_lazy, Storage as test_only__Storage, YjsStorage as test_only__YjsStorage, transientClientMsgDecoder, tryCatch };
|
package/dist/index.js
CHANGED
|
@@ -3154,7 +3154,7 @@ var Room = class {
|
|
|
3154
3154
|
});
|
|
3155
3155
|
}
|
|
3156
3156
|
if (opsToForward.length > 0) {
|
|
3157
|
-
const p$ = this.hooks.postClientMsgStorageDidUpdate?.(ctx);
|
|
3157
|
+
const p$ = this.hooks.postClientMsgStorageDidUpdate?.(ctx, session);
|
|
3158
3158
|
if (p$) defer(p$);
|
|
3159
3159
|
}
|
|
3160
3160
|
break;
|
|
@@ -3395,6 +3395,23 @@ var Room = class {
|
|
|
3395
3395
|
};
|
|
3396
3396
|
_logger = new WeakMap();
|
|
3397
3397
|
__debug2 = new WeakMap();
|
|
3398
|
+
|
|
3399
|
+
// src/lib/semver.ts
|
|
3400
|
+
function cmpSemver(a, b) {
|
|
3401
|
+
const [coreA = "", preA] = a.split("-", 2);
|
|
3402
|
+
const [coreB = "", preB] = b.split("-", 2);
|
|
3403
|
+
const partsA = coreA.split(".").map(Number);
|
|
3404
|
+
const partsB = coreB.split(".").map(Number);
|
|
3405
|
+
for (let i = 0; i < 3; i++) {
|
|
3406
|
+
const pa = partsA[i] ?? 0;
|
|
3407
|
+
const pb = partsB[i] ?? 0;
|
|
3408
|
+
if (pa !== pb) return pa - pb;
|
|
3409
|
+
}
|
|
3410
|
+
if (!preA && preB) return 1;
|
|
3411
|
+
if (preA && !preB) return -1;
|
|
3412
|
+
if (preA && preB) return preA < preB ? -1 : preA > preB ? 1 : 0;
|
|
3413
|
+
return 0;
|
|
3414
|
+
}
|
|
3398
3415
|
export {
|
|
3399
3416
|
BackendSession,
|
|
3400
3417
|
BrowserSession,
|
|
@@ -3413,6 +3430,7 @@ export {
|
|
|
3413
3430
|
UniqueMap,
|
|
3414
3431
|
ackIgnoredOp,
|
|
3415
3432
|
clientMsgDecoder,
|
|
3433
|
+
cmpSemver,
|
|
3416
3434
|
concatUint8Arrays,
|
|
3417
3435
|
feedFailureServerMsg,
|
|
3418
3436
|
feedMetadataIdDecoder,
|