@liveblocks/core 1.1.1-yjs1 → 1.1.1-yjs3
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 +3 -3
- package/dist/index.js +17 -17
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1054,7 +1054,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1054
1054
|
}): void;
|
|
1055
1055
|
/**
|
|
1056
1056
|
*
|
|
1057
|
-
* Sends
|
|
1057
|
+
* Sends Yjs document updates to liveblocks server
|
|
1058
1058
|
*
|
|
1059
1059
|
* @param {string} data the doc update to send to the server, base64 encoded uint8array
|
|
1060
1060
|
*/
|
|
@@ -1062,7 +1062,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1062
1062
|
/**
|
|
1063
1063
|
* Sends a request for the current document from liveblocks server
|
|
1064
1064
|
*/
|
|
1065
|
-
|
|
1065
|
+
fetchYDoc(stateVector: string): void;
|
|
1066
1066
|
/**
|
|
1067
1067
|
* Broadcasts an event to other users in the room. Event broadcasted to the room can be listened with {@link Room.subscribe}("event").
|
|
1068
1068
|
* @param {any} event the event to broadcast. Should be serializable to JSON
|
|
@@ -1120,7 +1120,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
|
|
|
1120
1120
|
*/
|
|
1121
1121
|
readonly storageDidLoad: Observable<void>;
|
|
1122
1122
|
readonly storageStatus: Observable<StorageStatus>;
|
|
1123
|
-
readonly
|
|
1123
|
+
readonly ydoc: Observable<string>;
|
|
1124
1124
|
};
|
|
1125
1125
|
/**
|
|
1126
1126
|
* Batches modifications made during the given function.
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,7 @@ var onMessageFromPanel = eventSource.observable;
|
|
|
145
145
|
// src/devtools/index.ts
|
|
146
146
|
var VERSION = true ? (
|
|
147
147
|
/* istanbul ignore next */
|
|
148
|
-
"1.1.1-
|
|
148
|
+
"1.1.1-yjs3"
|
|
149
149
|
) : "dev";
|
|
150
150
|
var _devtoolsSetupHasRun = false;
|
|
151
151
|
function setupDevTools(getAllRooms) {
|
|
@@ -1699,7 +1699,7 @@ function nanoid(length = 7) {
|
|
|
1699
1699
|
}
|
|
1700
1700
|
|
|
1701
1701
|
// src/crdts/LiveRegister.ts
|
|
1702
|
-
var LiveRegister = class extends AbstractCrdt {
|
|
1702
|
+
var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
1703
1703
|
constructor(data) {
|
|
1704
1704
|
super();
|
|
1705
1705
|
this._data = data;
|
|
@@ -1709,7 +1709,7 @@ var LiveRegister = class extends AbstractCrdt {
|
|
|
1709
1709
|
}
|
|
1710
1710
|
/** @internal */
|
|
1711
1711
|
static _deserialize([id, item], _parentToChildren, pool) {
|
|
1712
|
-
const register = new
|
|
1712
|
+
const register = new _LiveRegister(item.data);
|
|
1713
1713
|
register._attach(id, pool);
|
|
1714
1714
|
return register;
|
|
1715
1715
|
}
|
|
@@ -1777,7 +1777,7 @@ function compareNodePosition(itemA, itemB) {
|
|
|
1777
1777
|
const posB = itemB._parentPos;
|
|
1778
1778
|
return posA === posB ? 0 : posA < posB ? -1 : 1;
|
|
1779
1779
|
}
|
|
1780
|
-
var LiveList = class extends AbstractCrdt {
|
|
1780
|
+
var LiveList = class _LiveList extends AbstractCrdt {
|
|
1781
1781
|
constructor(items = []) {
|
|
1782
1782
|
super();
|
|
1783
1783
|
this._items = [];
|
|
@@ -1794,7 +1794,7 @@ var LiveList = class extends AbstractCrdt {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
/** @internal */
|
|
1796
1796
|
static _deserialize([id], parentToChildren, pool) {
|
|
1797
|
-
const list = new
|
|
1797
|
+
const list = new _LiveList();
|
|
1798
1798
|
list._attach(id, pool);
|
|
1799
1799
|
const children = parentToChildren.get(id);
|
|
1800
1800
|
if (children === void 0) {
|
|
@@ -2784,7 +2784,7 @@ var freeze = process.env.NODE_ENV === "production" ? (
|
|
|
2784
2784
|
) : Object.freeze;
|
|
2785
2785
|
|
|
2786
2786
|
// src/crdts/LiveMap.ts
|
|
2787
|
-
var LiveMap = class extends AbstractCrdt {
|
|
2787
|
+
var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
2788
2788
|
constructor(entries2) {
|
|
2789
2789
|
super();
|
|
2790
2790
|
this.unacknowledgedSet = /* @__PURE__ */ new Map();
|
|
@@ -2825,7 +2825,7 @@ var LiveMap = class extends AbstractCrdt {
|
|
|
2825
2825
|
* @internal
|
|
2826
2826
|
*/
|
|
2827
2827
|
static _deserialize([id, _item], parentToChildren, pool) {
|
|
2828
|
-
const map = new
|
|
2828
|
+
const map = new _LiveMap();
|
|
2829
2829
|
map._attach(id, pool);
|
|
2830
2830
|
const children = parentToChildren.get(id);
|
|
2831
2831
|
if (children === void 0) {
|
|
@@ -3130,7 +3130,7 @@ var LiveMap = class extends AbstractCrdt {
|
|
|
3130
3130
|
};
|
|
3131
3131
|
|
|
3132
3132
|
// src/crdts/LiveObject.ts
|
|
3133
|
-
var LiveObject = class extends AbstractCrdt {
|
|
3133
|
+
var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
3134
3134
|
constructor(obj = {}) {
|
|
3135
3135
|
super();
|
|
3136
3136
|
this._propToLastUpdate = /* @__PURE__ */ new Map();
|
|
@@ -3168,8 +3168,8 @@ var LiveObject = class extends AbstractCrdt {
|
|
|
3168
3168
|
}
|
|
3169
3169
|
/** @internal */
|
|
3170
3170
|
static _fromItems(items, pool) {
|
|
3171
|
-
const [root, parentToChildren] =
|
|
3172
|
-
return
|
|
3171
|
+
const [root, parentToChildren] = _LiveObject._buildRootAndParentToChildren(items);
|
|
3172
|
+
return _LiveObject._deserialize(
|
|
3173
3173
|
root,
|
|
3174
3174
|
parentToChildren,
|
|
3175
3175
|
pool
|
|
@@ -3205,7 +3205,7 @@ var LiveObject = class extends AbstractCrdt {
|
|
|
3205
3205
|
}
|
|
3206
3206
|
/** @internal */
|
|
3207
3207
|
static _deserialize([id, item], parentToChildren, pool) {
|
|
3208
|
-
const liveObj = new
|
|
3208
|
+
const liveObj = new _LiveObject(item.data);
|
|
3209
3209
|
liveObj._attach(id, pool);
|
|
3210
3210
|
return this._deserializeChildren(liveObj, parentToChildren, pool);
|
|
3211
3211
|
}
|
|
@@ -4395,7 +4395,7 @@ function createRoom(options, config) {
|
|
|
4395
4395
|
history: makeEventSource(),
|
|
4396
4396
|
storageDidLoad: makeEventSource(),
|
|
4397
4397
|
storageStatus: makeEventSource(),
|
|
4398
|
-
|
|
4398
|
+
ydoc: makeEventSource()
|
|
4399
4399
|
};
|
|
4400
4400
|
function sendMessages(messageOrMessages) {
|
|
4401
4401
|
var _a2, _b2;
|
|
@@ -4817,7 +4817,7 @@ function createRoom(options, config) {
|
|
|
4817
4817
|
break;
|
|
4818
4818
|
}
|
|
4819
4819
|
case 300 /* UPDATE_YDOC */: {
|
|
4820
|
-
eventHub.
|
|
4820
|
+
eventHub.ydoc.notify(message.update);
|
|
4821
4821
|
break;
|
|
4822
4822
|
}
|
|
4823
4823
|
case 104 /* ROOM_STATE */: {
|
|
@@ -5004,7 +5004,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5004
5004
|
};
|
|
5005
5005
|
});
|
|
5006
5006
|
}
|
|
5007
|
-
function
|
|
5007
|
+
function fetchYDoc(vector) {
|
|
5008
5008
|
context.buffer.messages.push({
|
|
5009
5009
|
type: 300 /* FETCH_YDOC */,
|
|
5010
5010
|
vector
|
|
@@ -5133,7 +5133,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5133
5133
|
history: eventHub.history.observable,
|
|
5134
5134
|
storageDidLoad: eventHub.storageDidLoad.observable,
|
|
5135
5135
|
storageStatus: eventHub.storageStatus.observable,
|
|
5136
|
-
|
|
5136
|
+
ydoc: eventHub.ydoc.observable
|
|
5137
5137
|
};
|
|
5138
5138
|
return {
|
|
5139
5139
|
/* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
|
|
@@ -5180,7 +5180,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5180
5180
|
pause: pauseHistory,
|
|
5181
5181
|
resume: resumeHistory
|
|
5182
5182
|
},
|
|
5183
|
-
|
|
5183
|
+
fetchYDoc,
|
|
5184
5184
|
getStorage,
|
|
5185
5185
|
getStorageSnapshot,
|
|
5186
5186
|
getStorageStatus,
|
|
@@ -5296,7 +5296,7 @@ function makeCreateSocketDelegateForRoom(liveblocksServer, WebSocketPolyfill) {
|
|
|
5296
5296
|
// @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
|
|
5297
5297
|
true ? (
|
|
5298
5298
|
/* istanbul ignore next */
|
|
5299
|
-
"1.1.1-
|
|
5299
|
+
"1.1.1-yjs3"
|
|
5300
5300
|
) : "dev"}`
|
|
5301
5301
|
);
|
|
5302
5302
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liveblocks/core",
|
|
3
|
-
"version": "1.1.1-
|
|
3
|
+
"version": "1.1.1-yjs3",
|
|
4
4
|
"description": "Shared code and foundational internals for Liveblocks",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"build": "tsup",
|
|
23
23
|
"format": "(eslint --fix src/ || true) && prettier --write src/",
|
|
24
24
|
"lint": "eslint src/",
|
|
25
|
+
"lint:package": "publint --strict && attw /tmp/$( npm pack -q --pack-destination /tmp )",
|
|
25
26
|
"test": "jest --silent --verbose --color=always",
|
|
26
27
|
"test:types": "tsd",
|
|
27
28
|
"test:watch": "jest --silent --verbose --color=always --watch",
|