@liveblocks/core 1.8.3-oss1 → 1.9.0
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.d.mts +7 -21
- package/dist/index.d.ts +7 -21
- package/dist/index.js +61 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -96,25 +96,6 @@ declare type AckOp = {
|
|
|
96
96
|
readonly id: "ACK";
|
|
97
97
|
readonly opId: string;
|
|
98
98
|
};
|
|
99
|
-
/**
|
|
100
|
-
* Create an Op that can be used as an acknowledgement for the given opId, to
|
|
101
|
-
* send back to the originating client in cases where the server decided to
|
|
102
|
-
* ignore the Op and not forward it.
|
|
103
|
-
*
|
|
104
|
-
* Why?
|
|
105
|
-
* It's important for the client to receive an acknowledgement for this, so
|
|
106
|
-
* that it can correctly update its own unacknowledged Ops administration.
|
|
107
|
-
* Otherwise it could get in "synchronizing" state indefinitely.
|
|
108
|
-
*
|
|
109
|
-
* CLEVER HACK
|
|
110
|
-
* Introducing a new Op type for this would not be backward-compatible as
|
|
111
|
-
* receiving such Op would crash old clients :(
|
|
112
|
-
* So the clever backward-compatible hack pulled here is that we codify the
|
|
113
|
-
* acknowledgement as a "deletion Op" for the non-existing node id "ACK". In
|
|
114
|
-
* old clients such Op is accepted, but will effectively be a no-op as that
|
|
115
|
-
* node does not exist, but as a side-effect the Op will get acknowledged.
|
|
116
|
-
*/
|
|
117
|
-
declare function ackOp(opId: string): AckOp;
|
|
118
99
|
declare type SetParentKeyOp = {
|
|
119
100
|
readonly opId?: string;
|
|
120
101
|
readonly id: string;
|
|
@@ -775,8 +756,13 @@ declare type Options = {
|
|
|
775
756
|
declare type PartialNullable<T> = {
|
|
776
757
|
[P in keyof T]?: T[P] | null | undefined;
|
|
777
758
|
};
|
|
759
|
+
declare type ThreadsFilterOptions<TThreadMetadata extends BaseMetadata> = {
|
|
760
|
+
query?: {
|
|
761
|
+
metadata?: Partial<TThreadMetadata>;
|
|
762
|
+
};
|
|
763
|
+
};
|
|
778
764
|
declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
|
|
779
|
-
getThreads(): Promise<ThreadData<TThreadMetadata>[]>;
|
|
765
|
+
getThreads(options?: ThreadsFilterOptions<TThreadMetadata>): Promise<ThreadData<TThreadMetadata>[]>;
|
|
780
766
|
createThread(options: {
|
|
781
767
|
threadId: string;
|
|
782
768
|
commentId: string;
|
|
@@ -2583,4 +2569,4 @@ declare type EnsureJson<T> = [
|
|
|
2583
2569
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2584
2570
|
};
|
|
2585
2571
|
|
|
2586
|
-
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg,
|
|
2572
|
+
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ThreadsFilterOptions, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToThreadData, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -96,25 +96,6 @@ declare type AckOp = {
|
|
|
96
96
|
readonly id: "ACK";
|
|
97
97
|
readonly opId: string;
|
|
98
98
|
};
|
|
99
|
-
/**
|
|
100
|
-
* Create an Op that can be used as an acknowledgement for the given opId, to
|
|
101
|
-
* send back to the originating client in cases where the server decided to
|
|
102
|
-
* ignore the Op and not forward it.
|
|
103
|
-
*
|
|
104
|
-
* Why?
|
|
105
|
-
* It's important for the client to receive an acknowledgement for this, so
|
|
106
|
-
* that it can correctly update its own unacknowledged Ops administration.
|
|
107
|
-
* Otherwise it could get in "synchronizing" state indefinitely.
|
|
108
|
-
*
|
|
109
|
-
* CLEVER HACK
|
|
110
|
-
* Introducing a new Op type for this would not be backward-compatible as
|
|
111
|
-
* receiving such Op would crash old clients :(
|
|
112
|
-
* So the clever backward-compatible hack pulled here is that we codify the
|
|
113
|
-
* acknowledgement as a "deletion Op" for the non-existing node id "ACK". In
|
|
114
|
-
* old clients such Op is accepted, but will effectively be a no-op as that
|
|
115
|
-
* node does not exist, but as a side-effect the Op will get acknowledged.
|
|
116
|
-
*/
|
|
117
|
-
declare function ackOp(opId: string): AckOp;
|
|
118
99
|
declare type SetParentKeyOp = {
|
|
119
100
|
readonly opId?: string;
|
|
120
101
|
readonly id: string;
|
|
@@ -775,8 +756,13 @@ declare type Options = {
|
|
|
775
756
|
declare type PartialNullable<T> = {
|
|
776
757
|
[P in keyof T]?: T[P] | null | undefined;
|
|
777
758
|
};
|
|
759
|
+
declare type ThreadsFilterOptions<TThreadMetadata extends BaseMetadata> = {
|
|
760
|
+
query?: {
|
|
761
|
+
metadata?: Partial<TThreadMetadata>;
|
|
762
|
+
};
|
|
763
|
+
};
|
|
778
764
|
declare type CommentsApi<TThreadMetadata extends BaseMetadata> = {
|
|
779
|
-
getThreads(): Promise<ThreadData<TThreadMetadata>[]>;
|
|
765
|
+
getThreads(options?: ThreadsFilterOptions<TThreadMetadata>): Promise<ThreadData<TThreadMetadata>[]>;
|
|
780
766
|
createThread(options: {
|
|
781
767
|
threadId: string;
|
|
782
768
|
commentId: string;
|
|
@@ -2583,4 +2569,4 @@ declare type EnsureJson<T> = [
|
|
|
2583
2569
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2584
2570
|
};
|
|
2585
2571
|
|
|
2586
|
-
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg,
|
|
2572
|
+
export { type AckOp, type AsyncCache, type AsyncState, type AsyncStateError, type AsyncStateInitial, type AsyncStateLoading, type AsyncStateResolved, type AsyncStateSuccess, type BaseAuthResult, type BaseMetadata, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyResolveUsersArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsApi, CommentsApiError, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type History, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type LegacyConnectionStatus, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, type LostConnectionEvent, type Lson, type LsonObject, type NodeMap, type Op, OpCode, type Others, type OthersEvent, type ParentToChildNodeMap, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type RejectedStorageOpServerMsg, type Resolve, type Room, type RoomEventMessage, type RoomInitializers, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ThreadsFilterOptions, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToThreadData, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "1.
|
|
9
|
+
var PKG_VERSION = "1.9.0";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -2145,8 +2145,8 @@ function createCommentsApi(roomId, getAuthValue, config) {
|
|
|
2145
2145
|
const url = new URL(
|
|
2146
2146
|
`/v2/c/rooms/${encodeURIComponent(roomId2)}${endpoint}`,
|
|
2147
2147
|
config.baseUrl
|
|
2148
|
-
)
|
|
2149
|
-
return await fetch(url, {
|
|
2148
|
+
);
|
|
2149
|
+
return await fetch(url.toString(), {
|
|
2150
2150
|
...options,
|
|
2151
2151
|
headers: {
|
|
2152
2152
|
..._optionalChain([options, 'optionalAccess', _55 => _55.headers]),
|
|
@@ -2154,8 +2154,16 @@ function createCommentsApi(roomId, getAuthValue, config) {
|
|
|
2154
2154
|
}
|
|
2155
2155
|
});
|
|
2156
2156
|
}
|
|
2157
|
-
async function getThreads() {
|
|
2158
|
-
const response = await fetchApi(roomId, "/threads"
|
|
2157
|
+
async function getThreads(options) {
|
|
2158
|
+
const response = await fetchApi(roomId, "/threads/search", {
|
|
2159
|
+
body: JSON.stringify({
|
|
2160
|
+
..._optionalChain([options, 'optionalAccess', _56 => _56.query, 'optionalAccess', _57 => _57.metadata]) && { metadata: options.query.metadata }
|
|
2161
|
+
}),
|
|
2162
|
+
headers: {
|
|
2163
|
+
"Content-Type": "application/json"
|
|
2164
|
+
},
|
|
2165
|
+
method: "POST"
|
|
2166
|
+
});
|
|
2159
2167
|
if (response.ok) {
|
|
2160
2168
|
const json = await response.json();
|
|
2161
2169
|
return json.data.map((thread) => convertToThreadData(thread));
|
|
@@ -2444,14 +2452,6 @@ var OpCode = /* @__PURE__ */ ((OpCode2) => {
|
|
|
2444
2452
|
OpCode2[OpCode2["CREATE_REGISTER"] = 8] = "CREATE_REGISTER";
|
|
2445
2453
|
return OpCode2;
|
|
2446
2454
|
})(OpCode || {});
|
|
2447
|
-
function ackOp(opId) {
|
|
2448
|
-
return {
|
|
2449
|
-
type: 5 /* DELETE_CRDT */,
|
|
2450
|
-
id: "ACK",
|
|
2451
|
-
// (H)ACK
|
|
2452
|
-
opId
|
|
2453
|
-
};
|
|
2454
|
-
}
|
|
2455
2455
|
function isAckOp(op) {
|
|
2456
2456
|
return op.type === 5 /* DELETE_CRDT */ && op.id === "ACK";
|
|
2457
2457
|
}
|
|
@@ -2677,7 +2677,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
2677
2677
|
return [
|
|
2678
2678
|
{
|
|
2679
2679
|
type: 8 /* CREATE_REGISTER */,
|
|
2680
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
2680
|
+
opId: _optionalChain([pool, 'optionalAccess', _58 => _58.generateOpId, 'call', _59 => _59()]),
|
|
2681
2681
|
id: this._id,
|
|
2682
2682
|
parentId,
|
|
2683
2683
|
parentKey,
|
|
@@ -2779,7 +2779,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2779
2779
|
const ops = [];
|
|
2780
2780
|
const op = {
|
|
2781
2781
|
id: this._id,
|
|
2782
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
2782
|
+
opId: _optionalChain([pool, 'optionalAccess', _60 => _60.generateOpId, 'call', _61 => _61()]),
|
|
2783
2783
|
type: 2 /* CREATE_LIST */,
|
|
2784
2784
|
parentId,
|
|
2785
2785
|
parentKey
|
|
@@ -3056,7 +3056,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3056
3056
|
_applyInsertUndoRedo(op) {
|
|
3057
3057
|
const { id, parentKey: key } = op;
|
|
3058
3058
|
const child = creationOpToLiveNode(op);
|
|
3059
|
-
if (_optionalChain([this, 'access',
|
|
3059
|
+
if (_optionalChain([this, 'access', _62 => _62._pool, 'optionalAccess', _63 => _63.getNode, 'call', _64 => _64(id)]) !== void 0) {
|
|
3060
3060
|
return { modified: false };
|
|
3061
3061
|
}
|
|
3062
3062
|
child._attach(id, nn(this._pool));
|
|
@@ -3064,8 +3064,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3064
3064
|
const existingItemIndex = this._indexOfPosition(key);
|
|
3065
3065
|
let newKey = key;
|
|
3066
3066
|
if (existingItemIndex !== -1) {
|
|
3067
|
-
const before2 = _optionalChain([this, 'access',
|
|
3068
|
-
const after2 = _optionalChain([this, 'access',
|
|
3067
|
+
const before2 = _optionalChain([this, 'access', _65 => _65._items, 'access', _66 => _66[existingItemIndex], 'optionalAccess', _67 => _67._parentPos]);
|
|
3068
|
+
const after2 = _optionalChain([this, 'access', _68 => _68._items, 'access', _69 => _69[existingItemIndex + 1], 'optionalAccess', _70 => _70._parentPos]);
|
|
3069
3069
|
newKey = makePosition(before2, after2);
|
|
3070
3070
|
child._setParentLink(this, newKey);
|
|
3071
3071
|
}
|
|
@@ -3080,7 +3080,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3080
3080
|
_applySetUndoRedo(op) {
|
|
3081
3081
|
const { id, parentKey: key } = op;
|
|
3082
3082
|
const child = creationOpToLiveNode(op);
|
|
3083
|
-
if (_optionalChain([this, 'access',
|
|
3083
|
+
if (_optionalChain([this, 'access', _71 => _71._pool, 'optionalAccess', _72 => _72.getNode, 'call', _73 => _73(id)]) !== void 0) {
|
|
3084
3084
|
return { modified: false };
|
|
3085
3085
|
}
|
|
3086
3086
|
this._unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -3202,7 +3202,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3202
3202
|
} else {
|
|
3203
3203
|
this._items[existingItemIndex]._setParentLink(
|
|
3204
3204
|
this,
|
|
3205
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3205
|
+
makePosition(newKey, _optionalChain([this, 'access', _74 => _74._items, 'access', _75 => _75[existingItemIndex + 1], 'optionalAccess', _76 => _76._parentPos]))
|
|
3206
3206
|
);
|
|
3207
3207
|
const previousIndex = this._items.indexOf(child);
|
|
3208
3208
|
child._setParentLink(this, newKey);
|
|
@@ -3228,7 +3228,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3228
3228
|
if (existingItemIndex !== -1) {
|
|
3229
3229
|
this._items[existingItemIndex]._setParentLink(
|
|
3230
3230
|
this,
|
|
3231
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3231
|
+
makePosition(newKey, _optionalChain([this, 'access', _77 => _77._items, 'access', _78 => _78[existingItemIndex + 1], 'optionalAccess', _79 => _79._parentPos]))
|
|
3232
3232
|
);
|
|
3233
3233
|
}
|
|
3234
3234
|
child._setParentLink(this, newKey);
|
|
@@ -3247,7 +3247,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3247
3247
|
if (existingItemIndex !== -1) {
|
|
3248
3248
|
this._items[existingItemIndex]._setParentLink(
|
|
3249
3249
|
this,
|
|
3250
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3250
|
+
makePosition(newKey, _optionalChain([this, 'access', _80 => _80._items, 'access', _81 => _81[existingItemIndex + 1], 'optionalAccess', _82 => _82._parentPos]))
|
|
3251
3251
|
);
|
|
3252
3252
|
}
|
|
3253
3253
|
child._setParentLink(this, newKey);
|
|
@@ -3275,7 +3275,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3275
3275
|
if (existingItemIndex !== -1) {
|
|
3276
3276
|
this._items[existingItemIndex]._setParentLink(
|
|
3277
3277
|
this,
|
|
3278
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3278
|
+
makePosition(newKey, _optionalChain([this, 'access', _83 => _83._items, 'access', _84 => _84[existingItemIndex + 1], 'optionalAccess', _85 => _85._parentPos]))
|
|
3279
3279
|
);
|
|
3280
3280
|
}
|
|
3281
3281
|
child._setParentLink(this, newKey);
|
|
@@ -3333,7 +3333,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3333
3333
|
* @param element The element to add to the end of the LiveList.
|
|
3334
3334
|
*/
|
|
3335
3335
|
push(element) {
|
|
3336
|
-
_optionalChain([this, 'access',
|
|
3336
|
+
_optionalChain([this, 'access', _86 => _86._pool, 'optionalAccess', _87 => _87.assertStorageIsWritable, 'call', _88 => _88()]);
|
|
3337
3337
|
return this.insert(element, this.length);
|
|
3338
3338
|
}
|
|
3339
3339
|
/**
|
|
@@ -3342,7 +3342,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3342
3342
|
* @param index The index at which you want to insert the element.
|
|
3343
3343
|
*/
|
|
3344
3344
|
insert(element, index) {
|
|
3345
|
-
_optionalChain([this, 'access',
|
|
3345
|
+
_optionalChain([this, 'access', _89 => _89._pool, 'optionalAccess', _90 => _90.assertStorageIsWritable, 'call', _91 => _91()]);
|
|
3346
3346
|
if (index < 0 || index > this._items.length) {
|
|
3347
3347
|
throw new Error(
|
|
3348
3348
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
|
|
@@ -3372,7 +3372,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3372
3372
|
* @param targetIndex The index where the element should be after moving.
|
|
3373
3373
|
*/
|
|
3374
3374
|
move(index, targetIndex) {
|
|
3375
|
-
_optionalChain([this, 'access',
|
|
3375
|
+
_optionalChain([this, 'access', _92 => _92._pool, 'optionalAccess', _93 => _93.assertStorageIsWritable, 'call', _94 => _94()]);
|
|
3376
3376
|
if (targetIndex < 0) {
|
|
3377
3377
|
throw new Error("targetIndex cannot be less than 0");
|
|
3378
3378
|
}
|
|
@@ -3430,7 +3430,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3430
3430
|
* @param index The index of the element to delete
|
|
3431
3431
|
*/
|
|
3432
3432
|
delete(index) {
|
|
3433
|
-
_optionalChain([this, 'access',
|
|
3433
|
+
_optionalChain([this, 'access', _95 => _95._pool, 'optionalAccess', _96 => _96.assertStorageIsWritable, 'call', _97 => _97()]);
|
|
3434
3434
|
if (index < 0 || index >= this._items.length) {
|
|
3435
3435
|
throw new Error(
|
|
3436
3436
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
@@ -3463,7 +3463,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3463
3463
|
}
|
|
3464
3464
|
}
|
|
3465
3465
|
clear() {
|
|
3466
|
-
_optionalChain([this, 'access',
|
|
3466
|
+
_optionalChain([this, 'access', _98 => _98._pool, 'optionalAccess', _99 => _99.assertStorageIsWritable, 'call', _100 => _100()]);
|
|
3467
3467
|
if (this._pool) {
|
|
3468
3468
|
const ops = [];
|
|
3469
3469
|
const reverseOps = [];
|
|
@@ -3497,7 +3497,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3497
3497
|
}
|
|
3498
3498
|
}
|
|
3499
3499
|
set(index, item) {
|
|
3500
|
-
_optionalChain([this, 'access',
|
|
3500
|
+
_optionalChain([this, 'access', _101 => _101._pool, 'optionalAccess', _102 => _102.assertStorageIsWritable, 'call', _103 => _103()]);
|
|
3501
3501
|
if (index < 0 || index >= this._items.length) {
|
|
3502
3502
|
throw new Error(
|
|
3503
3503
|
`Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
@@ -3645,7 +3645,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3645
3645
|
_shiftItemPosition(index, key) {
|
|
3646
3646
|
const shiftedPosition = makePosition(
|
|
3647
3647
|
key,
|
|
3648
|
-
this._items.length > index + 1 ? _optionalChain([this, 'access',
|
|
3648
|
+
this._items.length > index + 1 ? _optionalChain([this, 'access', _104 => _104._items, 'access', _105 => _105[index + 1], 'optionalAccess', _106 => _106._parentPos]) : void 0
|
|
3649
3649
|
);
|
|
3650
3650
|
this._items[index]._setParentLink(this, shiftedPosition);
|
|
3651
3651
|
}
|
|
@@ -3774,7 +3774,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3774
3774
|
const ops = [];
|
|
3775
3775
|
const op = {
|
|
3776
3776
|
id: this._id,
|
|
3777
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
3777
|
+
opId: _optionalChain([pool, 'optionalAccess', _107 => _107.generateOpId, 'call', _108 => _108()]),
|
|
3778
3778
|
type: 7 /* CREATE_MAP */,
|
|
3779
3779
|
parentId,
|
|
3780
3780
|
parentKey
|
|
@@ -3921,7 +3921,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3921
3921
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
3922
3922
|
*/
|
|
3923
3923
|
set(key, value) {
|
|
3924
|
-
_optionalChain([this, 'access',
|
|
3924
|
+
_optionalChain([this, 'access', _109 => _109._pool, 'optionalAccess', _110 => _110.assertStorageIsWritable, 'call', _111 => _111()]);
|
|
3925
3925
|
const oldValue = this._map.get(key);
|
|
3926
3926
|
if (oldValue) {
|
|
3927
3927
|
oldValue._detach();
|
|
@@ -3967,7 +3967,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3967
3967
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
3968
3968
|
*/
|
|
3969
3969
|
delete(key) {
|
|
3970
|
-
_optionalChain([this, 'access',
|
|
3970
|
+
_optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.assertStorageIsWritable, 'call', _114 => _114()]);
|
|
3971
3971
|
const item = this._map.get(key);
|
|
3972
3972
|
if (item === void 0) {
|
|
3973
3973
|
return false;
|
|
@@ -4146,7 +4146,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4146
4146
|
if (this._id === void 0) {
|
|
4147
4147
|
throw new Error("Cannot serialize item is not attached");
|
|
4148
4148
|
}
|
|
4149
|
-
const opId = _optionalChain([pool, 'optionalAccess',
|
|
4149
|
+
const opId = _optionalChain([pool, 'optionalAccess', _115 => _115.generateOpId, 'call', _116 => _116()]);
|
|
4150
4150
|
const ops = [];
|
|
4151
4151
|
const op = {
|
|
4152
4152
|
type: 4 /* CREATE_OBJECT */,
|
|
@@ -4424,7 +4424,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4424
4424
|
* @param value The value of the property to add
|
|
4425
4425
|
*/
|
|
4426
4426
|
set(key, value) {
|
|
4427
|
-
_optionalChain([this, 'access',
|
|
4427
|
+
_optionalChain([this, 'access', _117 => _117._pool, 'optionalAccess', _118 => _118.assertStorageIsWritable, 'call', _119 => _119()]);
|
|
4428
4428
|
this.update({ [key]: value });
|
|
4429
4429
|
}
|
|
4430
4430
|
/**
|
|
@@ -4439,7 +4439,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4439
4439
|
* @param key The key of the property to delete
|
|
4440
4440
|
*/
|
|
4441
4441
|
delete(key) {
|
|
4442
|
-
_optionalChain([this, 'access',
|
|
4442
|
+
_optionalChain([this, 'access', _120 => _120._pool, 'optionalAccess', _121 => _121.assertStorageIsWritable, 'call', _122 => _122()]);
|
|
4443
4443
|
const keyAsString = key;
|
|
4444
4444
|
const oldValue = this._map.get(keyAsString);
|
|
4445
4445
|
if (oldValue === void 0) {
|
|
@@ -4492,7 +4492,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4492
4492
|
* @param patch The object used to overrides properties
|
|
4493
4493
|
*/
|
|
4494
4494
|
update(patch) {
|
|
4495
|
-
_optionalChain([this, 'access',
|
|
4495
|
+
_optionalChain([this, 'access', _123 => _123._pool, 'optionalAccess', _124 => _124.assertStorageIsWritable, 'call', _125 => _125()]);
|
|
4496
4496
|
if (this._pool === void 0 || this._id === void 0) {
|
|
4497
4497
|
for (const key in patch) {
|
|
4498
4498
|
const newValue = patch[key];
|
|
@@ -5136,15 +5136,15 @@ function installBackgroundTabSpy() {
|
|
|
5136
5136
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
5137
5137
|
const inBackgroundSince = { current: null };
|
|
5138
5138
|
function onVisibilityChange() {
|
|
5139
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
5139
|
+
if (_optionalChain([doc, 'optionalAccess', _126 => _126.visibilityState]) === "hidden") {
|
|
5140
5140
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
5141
5141
|
} else {
|
|
5142
5142
|
inBackgroundSince.current = null;
|
|
5143
5143
|
}
|
|
5144
5144
|
}
|
|
5145
|
-
_optionalChain([doc, 'optionalAccess',
|
|
5145
|
+
_optionalChain([doc, 'optionalAccess', _127 => _127.addEventListener, 'call', _128 => _128("visibilitychange", onVisibilityChange)]);
|
|
5146
5146
|
const unsub = () => {
|
|
5147
|
-
_optionalChain([doc, 'optionalAccess',
|
|
5147
|
+
_optionalChain([doc, 'optionalAccess', _129 => _129.removeEventListener, 'call', _130 => _130("visibilitychange", onVisibilityChange)]);
|
|
5148
5148
|
};
|
|
5149
5149
|
return [inBackgroundSince, unsub];
|
|
5150
5150
|
}
|
|
@@ -5333,7 +5333,7 @@ function createRoom(options, config) {
|
|
|
5333
5333
|
}
|
|
5334
5334
|
},
|
|
5335
5335
|
assertStorageIsWritable: () => {
|
|
5336
|
-
const scopes = _optionalChain([context, 'access',
|
|
5336
|
+
const scopes = _optionalChain([context, 'access', _131 => _131.dynamicSessionInfo, 'access', _132 => _132.current, 'optionalAccess', _133 => _133.scopes]);
|
|
5337
5337
|
if (scopes === void 0) {
|
|
5338
5338
|
return;
|
|
5339
5339
|
}
|
|
@@ -5372,7 +5372,7 @@ function createRoom(options, config) {
|
|
|
5372
5372
|
`/v2/c/rooms/${encodeURIComponent(config.roomId)}${endpoint}`,
|
|
5373
5373
|
config.baseUrl
|
|
5374
5374
|
).toString();
|
|
5375
|
-
const fetcher = _optionalChain([config, 'access',
|
|
5375
|
+
const fetcher = _optionalChain([config, 'access', _134 => _134.polyfills, 'optionalAccess', _135 => _135.fetch]) || /* istanbul ignore next */
|
|
5376
5376
|
fetch;
|
|
5377
5377
|
return fetcher(url, {
|
|
5378
5378
|
method: "POST",
|
|
@@ -5385,7 +5385,7 @@ function createRoom(options, config) {
|
|
|
5385
5385
|
}
|
|
5386
5386
|
function sendMessages(messages) {
|
|
5387
5387
|
const serializedPayload = JSON.stringify(messages);
|
|
5388
|
-
const nonce = _optionalChain([context, 'access',
|
|
5388
|
+
const nonce = _optionalChain([context, 'access', _136 => _136.dynamicSessionInfo, 'access', _137 => _137.current, 'optionalAccess', _138 => _138.nonce]);
|
|
5389
5389
|
if (config.unstable_fallbackToHTTP && nonce) {
|
|
5390
5390
|
const size = new TextEncoder().encode(serializedPayload).length;
|
|
5391
5391
|
if (size > MAX_SOCKET_MESSAGE_SIZE) {
|
|
@@ -5647,7 +5647,7 @@ function createRoom(options, config) {
|
|
|
5647
5647
|
}
|
|
5648
5648
|
context.myPresence.patch(patch);
|
|
5649
5649
|
if (context.activeBatch) {
|
|
5650
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5650
|
+
if (_optionalChain([options2, 'optionalAccess', _139 => _139.addToHistory])) {
|
|
5651
5651
|
context.activeBatch.reverseOps.unshift({
|
|
5652
5652
|
type: "presence",
|
|
5653
5653
|
data: oldValues
|
|
@@ -5657,7 +5657,7 @@ function createRoom(options, config) {
|
|
|
5657
5657
|
} else {
|
|
5658
5658
|
flushNowOrSoon();
|
|
5659
5659
|
batchUpdates(() => {
|
|
5660
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5660
|
+
if (_optionalChain([options2, 'optionalAccess', _140 => _140.addToHistory])) {
|
|
5661
5661
|
addToUndoStack(
|
|
5662
5662
|
[{ type: "presence", data: oldValues }],
|
|
5663
5663
|
doNotBatchUpdates
|
|
@@ -5837,7 +5837,7 @@ function createRoom(options, config) {
|
|
|
5837
5837
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
5838
5838
|
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
5839
5839
|
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
5840
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
5840
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _141 => _141()]);
|
|
5841
5841
|
notifyStorageStatus();
|
|
5842
5842
|
eventHub.storageDidLoad.notify();
|
|
5843
5843
|
break;
|
|
@@ -5860,7 +5860,7 @@ function createRoom(options, config) {
|
|
|
5860
5860
|
if (process.env.NODE_ENV !== "production") {
|
|
5861
5861
|
const traces = /* @__PURE__ */ new Set();
|
|
5862
5862
|
for (const opId of message.opIds) {
|
|
5863
|
-
const trace = _optionalChain([context, 'access',
|
|
5863
|
+
const trace = _optionalChain([context, 'access', _142 => _142.opStackTraces, 'optionalAccess', _143 => _143.get, 'call', _144 => _144(opId)]);
|
|
5864
5864
|
if (trace) {
|
|
5865
5865
|
traces.add(trace);
|
|
5866
5866
|
}
|
|
@@ -6173,7 +6173,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6173
6173
|
/* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
|
|
6174
6174
|
__internal: {
|
|
6175
6175
|
get presenceBuffer() {
|
|
6176
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
6176
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _145 => _145.buffer, 'access', _146 => _146.presenceUpdates, 'optionalAccess', _147 => _147.data]), () => ( null)));
|
|
6177
6177
|
},
|
|
6178
6178
|
// prettier-ignore
|
|
6179
6179
|
get undoStack() {
|
|
@@ -6315,7 +6315,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
6315
6315
|
}
|
|
6316
6316
|
if (isLiveNode(first)) {
|
|
6317
6317
|
const node = first;
|
|
6318
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6318
|
+
if (_optionalChain([options, 'optionalAccess', _148 => _148.isDeep])) {
|
|
6319
6319
|
const storageCallback = second;
|
|
6320
6320
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
6321
6321
|
} else {
|
|
@@ -6440,12 +6440,12 @@ function createClient(options) {
|
|
|
6440
6440
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
6441
6441
|
roomId,
|
|
6442
6442
|
baseUrl,
|
|
6443
|
-
_optionalChain([clientOptions, 'access',
|
|
6443
|
+
_optionalChain([clientOptions, 'access', _149 => _149.polyfills, 'optionalAccess', _150 => _150.WebSocket])
|
|
6444
6444
|
),
|
|
6445
6445
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
6446
6446
|
})),
|
|
6447
6447
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
6448
|
-
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess',
|
|
6448
|
+
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _151 => _151.unstable_batchedUpdates]),
|
|
6449
6449
|
baseUrl,
|
|
6450
6450
|
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP
|
|
6451
6451
|
}
|
|
@@ -6460,7 +6460,7 @@ function createClient(options) {
|
|
|
6460
6460
|
const shouldConnect = _nullishCoalesce(_nullishCoalesce(options2.autoConnect, () => ( options2.shouldInitiallyConnect)), () => ( true));
|
|
6461
6461
|
if (shouldConnect) {
|
|
6462
6462
|
if (typeof atob === "undefined") {
|
|
6463
|
-
if (_optionalChain([clientOptions, 'access',
|
|
6463
|
+
if (_optionalChain([clientOptions, 'access', _152 => _152.polyfills, 'optionalAccess', _153 => _153.atob]) === void 0) {
|
|
6464
6464
|
throw new Error(
|
|
6465
6465
|
"You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
|
|
6466
6466
|
);
|
|
@@ -6476,11 +6476,11 @@ function createClient(options) {
|
|
|
6476
6476
|
return room;
|
|
6477
6477
|
}
|
|
6478
6478
|
function getRoom(roomId) {
|
|
6479
|
-
const room = _optionalChain([roomsById, 'access',
|
|
6479
|
+
const room = _optionalChain([roomsById, 'access', _154 => _154.get, 'call', _155 => _155(roomId), 'optionalAccess', _156 => _156.room]);
|
|
6480
6480
|
return room ? room : null;
|
|
6481
6481
|
}
|
|
6482
6482
|
function forceLeave(roomId) {
|
|
6483
|
-
const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access',
|
|
6483
|
+
const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access', _157 => _157.get, 'call', _158 => _158(roomId), 'optionalAccess', _159 => _159.unsubs]), () => ( /* @__PURE__ */ new Set()));
|
|
6484
6484
|
for (const unsub of unsubs) {
|
|
6485
6485
|
unsub();
|
|
6486
6486
|
}
|
|
@@ -6761,12 +6761,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
6761
6761
|
}
|
|
6762
6762
|
const newState = Object.assign({}, state);
|
|
6763
6763
|
for (const key in update.updates) {
|
|
6764
|
-
if (_optionalChain([update, 'access',
|
|
6764
|
+
if (_optionalChain([update, 'access', _160 => _160.updates, 'access', _161 => _161[key], 'optionalAccess', _162 => _162.type]) === "update") {
|
|
6765
6765
|
const val = update.node.get(key);
|
|
6766
6766
|
if (val !== void 0) {
|
|
6767
6767
|
newState[key] = lsonToJson(val);
|
|
6768
6768
|
}
|
|
6769
|
-
} else if (_optionalChain([update, 'access',
|
|
6769
|
+
} else if (_optionalChain([update, 'access', _163 => _163.updates, 'access', _164 => _164[key], 'optionalAccess', _165 => _165.type]) === "delete") {
|
|
6770
6770
|
delete newState[key];
|
|
6771
6771
|
}
|
|
6772
6772
|
}
|
|
@@ -6827,12 +6827,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
6827
6827
|
}
|
|
6828
6828
|
const newState = Object.assign({}, state);
|
|
6829
6829
|
for (const key in update.updates) {
|
|
6830
|
-
if (_optionalChain([update, 'access',
|
|
6830
|
+
if (_optionalChain([update, 'access', _166 => _166.updates, 'access', _167 => _167[key], 'optionalAccess', _168 => _168.type]) === "update") {
|
|
6831
6831
|
const value = update.node.get(key);
|
|
6832
6832
|
if (value !== void 0) {
|
|
6833
6833
|
newState[key] = lsonToJson(value);
|
|
6834
6834
|
}
|
|
6835
|
-
} else if (_optionalChain([update, 'access',
|
|
6835
|
+
} else if (_optionalChain([update, 'access', _169 => _169.updates, 'access', _170 => _170[key], 'optionalAccess', _171 => _171.type]) === "delete") {
|
|
6836
6836
|
delete newState[key];
|
|
6837
6837
|
}
|
|
6838
6838
|
}
|
|
@@ -6922,7 +6922,7 @@ function createCacheItem(key, asyncFunction, options) {
|
|
|
6922
6922
|
let previousState = { isLoading: false };
|
|
6923
6923
|
const eventSource2 = makeEventSource();
|
|
6924
6924
|
function notify() {
|
|
6925
|
-
const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
6925
|
+
const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _172 => _172.isStateEqual]), () => ( isShallowEqual));
|
|
6926
6926
|
if (!isEqual(previousState, state)) {
|
|
6927
6927
|
previousState = state;
|
|
6928
6928
|
eventSource2.notify(state);
|
|
@@ -6990,7 +6990,7 @@ function createAsyncCache(asyncFunction, options) {
|
|
|
6990
6990
|
return create(key).get();
|
|
6991
6991
|
}
|
|
6992
6992
|
function getState(key) {
|
|
6993
|
-
return _optionalChain([cache, 'access',
|
|
6993
|
+
return _optionalChain([cache, 'access', _173 => _173.get, 'call', _174 => _174(key), 'optionalAccess', _175 => _175.getState, 'call', _176 => _176()]);
|
|
6994
6994
|
}
|
|
6995
6995
|
function revalidate(key) {
|
|
6996
6996
|
return create(key).revalidate();
|
|
@@ -7175,6 +7175,5 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
|
7175
7175
|
|
|
7176
7176
|
|
|
7177
7177
|
|
|
7178
|
-
|
|
7179
|
-
exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.cloneLson = cloneLson; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToThreadData = convertToThreadData; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
|
|
7178
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.cloneLson = cloneLson; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToThreadData = convertToThreadData; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
|
|
7180
7179
|
//# sourceMappingURL=index.js.map
|