@liveblocks/core 0.19.7 → 0.19.8
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.ts +7 -2
- package/dist/index.js +13 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare enum OpCode {
|
|
|
33
33
|
* These operations are the payload for {@link UpdateStorageServerMsg} messages
|
|
34
34
|
* only.
|
|
35
35
|
*/
|
|
36
|
-
declare type Op = CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
36
|
+
declare type Op = AckOp | CreateOp | UpdateObjectOp | DeleteCrdtOp | SetParentKeyOp | DeleteObjectKeyOp;
|
|
37
37
|
declare type CreateOp = CreateRootObjectOp | CreateChildOp;
|
|
38
38
|
declare type CreateChildOp = CreateObjectOp | CreateRegisterOp | CreateMapOp | CreateListOp;
|
|
39
39
|
declare type UpdateObjectOp = {
|
|
@@ -93,6 +93,11 @@ declare type DeleteCrdtOp = {
|
|
|
93
93
|
readonly id: string;
|
|
94
94
|
readonly type: OpCode.DELETE_CRDT;
|
|
95
95
|
};
|
|
96
|
+
declare type AckOp = {
|
|
97
|
+
readonly type: OpCode.DELETE_CRDT;
|
|
98
|
+
readonly id: "ACK";
|
|
99
|
+
readonly opId: string;
|
|
100
|
+
};
|
|
96
101
|
declare type SetParentKeyOp = {
|
|
97
102
|
readonly opId?: string;
|
|
98
103
|
readonly id: string;
|
|
@@ -1582,4 +1587,4 @@ declare type EnsureJson<T> = [
|
|
|
1582
1587
|
[K in keyof T]: EnsureJson<T[K]>;
|
|
1583
1588
|
};
|
|
1584
1589
|
|
|
1585
|
-
export { AppOnlyAuthToken, AuthToken, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, ConnectionState, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, FetchStorageClientMsg, History, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonObject, LiveList, LiveMap, LiveNode, LiveObject, LiveStructure, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, Resolve, Room, RoomAuthToken, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, StorageStatus, StorageUpdate, ToImmutable, ToJson, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asArrayWithLegacyMethods, assertNever, b64decode, comparePosition, createClient, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRoomAuthToken, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, tryParseJson };
|
|
1590
|
+
export { AckOp, AppOnlyAuthToken, AuthToken, BaseUserMeta, BroadcastEventClientMsg, BroadcastOptions, BroadcastedEventServerMsg, Client, ClientMsg, ClientMsgCode, ConnectionState, CrdtType, CreateChildOp, CreateListOp, CreateMapOp, CreateObjectOp, CreateOp, CreateRegisterOp, CreateRootObjectOp, DeleteCrdtOp, DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, EnsureJson, FetchStorageClientMsg, History, IdTuple, Immutable, InitialDocumentStateServerMsg, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveNode, LiveObject, LiveStructure, Lson, LsonObject, NodeMap, Op, OpCode, Others, ParentToChildNodeMap, Resolve, Room, RoomAuthToken, RoomInitializers, RoomStateServerMsg, SerializedChild, SerializedCrdt, SerializedList, SerializedMap, SerializedObject, SerializedRegister, SerializedRootObject, ServerMsg, ServerMsgCode, SetParentKeyOp, StorageStatus, StorageUpdate, ToImmutable, ToJson, UpdateObjectOp, UpdatePresenceClientMsg, UpdatePresenceServerMsg, UpdateStorageClientMsg, UpdateStorageServerMsg, User, UserJoinServerMsg, UserLeftServerMsg, WebsocketCloseCodes, asArrayWithLegacyMethods, assertNever, b64decode, comparePosition, createClient, deprecate, deprecateIf, errorIf, freeze, isAppOnlyAuthToken, isAuthToken, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isPlainObject, isRoomAuthToken, isRootCrdt, legacy_patchImmutableObject, lsonToJson, makePosition, nn, patchLiveObjectKey, shallow, throwUsageError, tryParseJson };
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
|
113
113
|
var onMessageFromPanel = eventSource.observable;
|
|
114
114
|
|
|
115
115
|
// src/devtools/index.ts
|
|
116
|
-
var VERSION = true ? "0.19.
|
|
116
|
+
var VERSION = true ? "0.19.8" : "dev";
|
|
117
117
|
var _devtoolsSetupHasRun = false;
|
|
118
118
|
function setupDevTools(getAllRooms) {
|
|
119
119
|
if (process.env.NODE_ENV === "production" || typeof window === "undefined") {
|
|
@@ -340,6 +340,9 @@ var OpCode = /* @__PURE__ */ ((OpCode2) => {
|
|
|
340
340
|
OpCode2[OpCode2["CREATE_REGISTER"] = 8] = "CREATE_REGISTER";
|
|
341
341
|
return OpCode2;
|
|
342
342
|
})(OpCode || {});
|
|
343
|
+
function isAckOp(op) {
|
|
344
|
+
return op.type === 5 /* DELETE_CRDT */ && op.id === "ACK";
|
|
345
|
+
}
|
|
343
346
|
|
|
344
347
|
// src/crdts/AbstractCrdt.ts
|
|
345
348
|
function crdtAsLiveNode(value) {
|
|
@@ -2079,7 +2082,7 @@ var LiveObject = class extends AbstractCrdt {
|
|
|
2079
2082
|
if (op.type === 3 /* UPDATE_OBJECT */) {
|
|
2080
2083
|
return this._applyUpdate(op, isLocal);
|
|
2081
2084
|
} else if (op.type === 6 /* DELETE_OBJECT_KEY */) {
|
|
2082
|
-
return this._applyDeleteObjectKey(op);
|
|
2085
|
+
return this._applyDeleteObjectKey(op, isLocal);
|
|
2083
2086
|
}
|
|
2084
2087
|
return super._apply(op, isLocal);
|
|
2085
2088
|
}
|
|
@@ -2162,12 +2165,12 @@ var LiveObject = class extends AbstractCrdt {
|
|
|
2162
2165
|
reverse
|
|
2163
2166
|
} : { modified: false };
|
|
2164
2167
|
}
|
|
2165
|
-
_applyDeleteObjectKey(op) {
|
|
2168
|
+
_applyDeleteObjectKey(op, isLocal) {
|
|
2166
2169
|
const key = op.key;
|
|
2167
2170
|
if (this._map.has(key) === false) {
|
|
2168
2171
|
return { modified: false };
|
|
2169
2172
|
}
|
|
2170
|
-
if (this._propToLastUpdate.get(key) !== void 0) {
|
|
2173
|
+
if (!isLocal && this._propToLastUpdate.get(key) !== void 0) {
|
|
2171
2174
|
return { modified: false };
|
|
2172
2175
|
}
|
|
2173
2176
|
const oldValue = this._map.get(key);
|
|
@@ -2945,7 +2948,7 @@ function makeStateMachine(state, config, mockedEffects) {
|
|
|
2945
2948
|
)
|
|
2946
2949
|
);
|
|
2947
2950
|
});
|
|
2948
|
-
activeBatch.reverseOps.
|
|
2951
|
+
activeBatch.reverseOps.unshift(...reverse);
|
|
2949
2952
|
} else {
|
|
2950
2953
|
batchUpdates(() => {
|
|
2951
2954
|
addToUndoStack(reverse, doNotBatchUpdates);
|
|
@@ -3203,6 +3206,9 @@ function makeStateMachine(state, config, mockedEffects) {
|
|
|
3203
3206
|
};
|
|
3204
3207
|
}
|
|
3205
3208
|
function applyOp(op, source) {
|
|
3209
|
+
if (isAckOp(op)) {
|
|
3210
|
+
return { modified: false };
|
|
3211
|
+
}
|
|
3206
3212
|
switch (op.type) {
|
|
3207
3213
|
case 6 /* DELETE_OBJECT_KEY */:
|
|
3208
3214
|
case 3 /* UPDATE_OBJECT */:
|
|
@@ -3354,7 +3360,7 @@ function makeStateMachine(state, config, mockedEffects) {
|
|
|
3354
3360
|
state.me.patch(patch);
|
|
3355
3361
|
if (state.activeBatch) {
|
|
3356
3362
|
if (options == null ? void 0 : options.addToHistory) {
|
|
3357
|
-
state.activeBatch.reverseOps.
|
|
3363
|
+
state.activeBatch.reverseOps.unshift({
|
|
3358
3364
|
type: "presence",
|
|
3359
3365
|
data: oldValues
|
|
3360
3366
|
});
|
|
@@ -4111,7 +4117,7 @@ function prepareCreateWebSocket(liveblocksServer, WebSocketPolyfill) {
|
|
|
4111
4117
|
const ws = WebSocketPolyfill || WebSocket;
|
|
4112
4118
|
return (token) => {
|
|
4113
4119
|
return new ws(
|
|
4114
|
-
`${liveblocksServer}/?token=${token}&version=${true ? "0.19.
|
|
4120
|
+
`${liveblocksServer}/?token=${token}&version=${true ? "0.19.8" : "dev"}`
|
|
4115
4121
|
);
|
|
4116
4122
|
};
|
|
4117
4123
|
}
|