@liveblocks/core 1.5.2 → 1.5.3
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 +6 -11
- package/dist/index.d.ts +6 -11
- package/dist/index.js +20 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -41,8 +41,7 @@ declare enum OpCode {
|
|
|
41
41
|
* only.
|
|
42
42
|
*/
|
|
43
43
|
declare type Op = AckOp | CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
44
|
-
declare type CreateOp =
|
|
45
|
-
declare type CreateChildOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
44
|
+
declare type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
46
45
|
declare type UpdateObjectOp = {
|
|
47
46
|
readonly opId?: string;
|
|
48
47
|
readonly id: string;
|
|
@@ -59,14 +58,6 @@ declare type CreateObjectOp = {
|
|
|
59
58
|
readonly parentKey: string;
|
|
60
59
|
readonly data: JsonObject;
|
|
61
60
|
};
|
|
62
|
-
declare type CreateRootObjectOp = {
|
|
63
|
-
readonly opId?: string;
|
|
64
|
-
readonly id: string;
|
|
65
|
-
readonly type: OpCode.CREATE_OBJECT;
|
|
66
|
-
readonly data: JsonObject;
|
|
67
|
-
readonly parentId?: never;
|
|
68
|
-
readonly parentKey?: never;
|
|
69
|
-
};
|
|
70
61
|
declare type CreateListOp = {
|
|
71
62
|
readonly opId?: string;
|
|
72
63
|
readonly id: string;
|
|
@@ -2152,6 +2143,10 @@ declare const brand: unique symbol;
|
|
|
2152
2143
|
declare type Brand<T, TBrand extends string> = T & {
|
|
2153
2144
|
[brand]: TBrand;
|
|
2154
2145
|
};
|
|
2146
|
+
/**
|
|
2147
|
+
* Throw an error, but as an expression instead of a statement.
|
|
2148
|
+
*/
|
|
2149
|
+
declare function raise(msg: string): never;
|
|
2155
2150
|
declare function isPlainObject(blob: unknown): blob is {
|
|
2156
2151
|
[key: string]: unknown;
|
|
2157
2152
|
};
|
|
@@ -2438,4 +2433,4 @@ declare type EnsureJson<T> = [
|
|
|
2438
2433
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2439
2434
|
};
|
|
2440
2435
|
|
|
2441
|
-
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentReaction, CommentsApi, CrdtType,
|
|
2436
|
+
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, Brand, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentReaction, CommentsApi, CrdtType, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EnterOptions, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, OthersEvent, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomEventMessage, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, throwUsageError, toPlainLson, tryParseJson, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -41,8 +41,7 @@ declare enum OpCode {
|
|
|
41
41
|
* only.
|
|
42
42
|
*/
|
|
43
43
|
declare type Op = AckOp | CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
44
|
-
declare type CreateOp =
|
|
45
|
-
declare type CreateChildOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
44
|
+
declare type CreateOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
46
45
|
declare type UpdateObjectOp = {
|
|
47
46
|
readonly opId?: string;
|
|
48
47
|
readonly id: string;
|
|
@@ -59,14 +58,6 @@ declare type CreateObjectOp = {
|
|
|
59
58
|
readonly parentKey: string;
|
|
60
59
|
readonly data: JsonObject;
|
|
61
60
|
};
|
|
62
|
-
declare type CreateRootObjectOp = {
|
|
63
|
-
readonly opId?: string;
|
|
64
|
-
readonly id: string;
|
|
65
|
-
readonly type: OpCode.CREATE_OBJECT;
|
|
66
|
-
readonly data: JsonObject;
|
|
67
|
-
readonly parentId?: never;
|
|
68
|
-
readonly parentKey?: never;
|
|
69
|
-
};
|
|
70
61
|
declare type CreateListOp = {
|
|
71
62
|
readonly opId?: string;
|
|
72
63
|
readonly id: string;
|
|
@@ -2152,6 +2143,10 @@ declare const brand: unique symbol;
|
|
|
2152
2143
|
declare type Brand<T, TBrand extends string> = T & {
|
|
2153
2144
|
[brand]: TBrand;
|
|
2154
2145
|
};
|
|
2146
|
+
/**
|
|
2147
|
+
* Throw an error, but as an expression instead of a statement.
|
|
2148
|
+
*/
|
|
2149
|
+
declare function raise(msg: string): never;
|
|
2155
2150
|
declare function isPlainObject(blob: unknown): blob is {
|
|
2156
2151
|
[key: string]: unknown;
|
|
2157
2152
|
};
|
|
@@ -2438,4 +2433,4 @@ declare type EnsureJson<T> = [
|
|
|
2438
2433
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
2439
2434
|
};
|
|
2440
2435
|
|
|
2441
|
-
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentReaction, CommentsApi, CrdtType,
|
|
2436
|
+
export { AckOp, AsyncCache, AsyncState, AsyncStateError, AsyncStateInitial, AsyncStateLoading, AsyncStateResolved, AsyncStateSuccess, BaseAuthResult, BaseMetadata, BaseUserMeta, Brand, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyMention, CommentBodyParagraph, CommentBodyText, CommentData, CommentReaction, CommentsApi, CrdtType, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CustomAuthenticationResult, Delegates, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, EnterOptions, EventSource, FetchStorageClientMsg, FetchYDocClientMsg, History, IWebSocket, IWebSocketCloseEvent, IWebSocketEvent, IWebSocketInstance, IWebSocketMessageEvent, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LegacyConnectionStatus, LiveList, LiveListUpdate, LiveMap, LiveMapUpdate, LiveNode, LiveObject, LiveObjectUpdate, LiveStructure, LostConnectionEvent, Lson, LsonObject, NodeMap, Op, OpCode, Others, OthersEvent, ParentToChildNodeMap, PlainLson, PlainLsonFields, PlainLsonList, PlainLsonMap, PlainLsonObject, RejectedStorageOpServerMsg, Resolve, Room, RoomEventMessage, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, Status, StorageStatus, StorageUpdate, ThreadData, ToImmutable, ToJson, UnsubscribeCallback, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, UpdateYDocClientMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, YDocUpdateServerMsg, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, createAsyncCache, createClient, createCommentsApi, deprecate, deprecateIf, detectDupes, errorIf, freeze, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, patchLiveObjectKey, raise, shallow, stringify, 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.5.
|
|
9
|
+
var PKG_VERSION = "1.5.3";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -572,6 +572,9 @@ var FSM = class {
|
|
|
572
572
|
};
|
|
573
573
|
|
|
574
574
|
// src/lib/utils.ts
|
|
575
|
+
function raise(msg) {
|
|
576
|
+
throw new Error(msg);
|
|
577
|
+
}
|
|
575
578
|
function isPlainObject(blob) {
|
|
576
579
|
return blob !== null && typeof blob === "object" && Object.prototype.toString.call(blob) === "[object Object]";
|
|
577
580
|
}
|
|
@@ -3759,17 +3762,14 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
3759
3762
|
}
|
|
3760
3763
|
const opId = _optionalChain([pool, 'optionalAccess', _102 => _102.generateOpId, 'call', _103 => _103()]);
|
|
3761
3764
|
const ops = [];
|
|
3762
|
-
const op =
|
|
3765
|
+
const op = {
|
|
3763
3766
|
type: 4 /* CREATE_OBJECT */,
|
|
3764
3767
|
id: this._id,
|
|
3765
3768
|
opId,
|
|
3766
3769
|
parentId,
|
|
3767
3770
|
parentKey,
|
|
3768
3771
|
data: {}
|
|
3769
|
-
}
|
|
3770
|
-
// Root object
|
|
3771
|
-
{ type: 4 /* CREATE_OBJECT */, id: this._id, opId, data: {} }
|
|
3772
|
-
);
|
|
3772
|
+
};
|
|
3773
3773
|
ops.push(op);
|
|
3774
3774
|
for (const [key, value] of this._map) {
|
|
3775
3775
|
if (isLiveNode(value)) {
|
|
@@ -4377,18 +4377,18 @@ function getTreesDiffOperations(currentItems, newItems) {
|
|
|
4377
4377
|
});
|
|
4378
4378
|
break;
|
|
4379
4379
|
case 0 /* OBJECT */:
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
);
|
|
4380
|
+
if (crdt.parentId === void 0 || crdt.parentKey === void 0) {
|
|
4381
|
+
throw new Error(
|
|
4382
|
+
"Internal error. Cannot serialize storage root into an operation"
|
|
4383
|
+
);
|
|
4384
|
+
}
|
|
4385
|
+
ops.push({
|
|
4386
|
+
type: 4 /* CREATE_OBJECT */,
|
|
4387
|
+
id,
|
|
4388
|
+
parentId: crdt.parentId,
|
|
4389
|
+
parentKey: crdt.parentKey,
|
|
4390
|
+
data: crdt.data
|
|
4391
|
+
});
|
|
4392
4392
|
break;
|
|
4393
4393
|
case 2 /* MAP */:
|
|
4394
4394
|
ops.push({
|
|
@@ -6778,5 +6778,6 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
|
6778
6778
|
|
|
6779
6779
|
|
|
6780
6780
|
|
|
6781
|
-
|
|
6781
|
+
|
|
6782
|
+
exports.ClientMsgCode = ClientMsgCode; 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.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; 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.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
|
|
6782
6783
|
//# sourceMappingURL=index.js.map
|