@liveblocks/core 1.4.5 → 1.4.6-test1
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 +20 -14
- package/dist/index.d.ts +20 -14
- package/dist/index.js +25 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
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.4.
|
|
9
|
+
var PKG_VERSION = "1.4.6-test1";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -5727,10 +5727,10 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5727
5727
|
getSelf_forDevTools: () => selfAsTreeNode.current,
|
|
5728
5728
|
getOthers_forDevTools: () => others_forDevTools.current,
|
|
5729
5729
|
// prettier-ignore
|
|
5730
|
-
|
|
5730
|
+
simulate: {
|
|
5731
5731
|
// These exist only for our E2E testing app
|
|
5732
5732
|
explicitClose: (event) => managedSocket._privateSendMachineEvent({ type: "EXPLICIT_SOCKET_CLOSE", event }),
|
|
5733
|
-
|
|
5733
|
+
rawSend: (data) => managedSocket.send(data)
|
|
5734
5734
|
}
|
|
5735
5735
|
},
|
|
5736
5736
|
id: config.roomId,
|
|
@@ -6382,8 +6382,8 @@ function isShallowEqual(a, b) {
|
|
|
6382
6382
|
return shallow(a.data, b.data) && shallow(a.error, b.error);
|
|
6383
6383
|
}
|
|
6384
6384
|
}
|
|
6385
|
-
function createCacheItem(key,
|
|
6386
|
-
|
|
6385
|
+
function createCacheItem(key, asyncFunction, options) {
|
|
6386
|
+
const $asyncFunction = async () => asyncFunction(key);
|
|
6387
6387
|
const context = {
|
|
6388
6388
|
isInvalid: true
|
|
6389
6389
|
};
|
|
@@ -6426,7 +6426,7 @@ function createCacheItem(key, defaultAsyncFunction, options) {
|
|
|
6426
6426
|
if (context.isInvalid) {
|
|
6427
6427
|
if (!context.promise) {
|
|
6428
6428
|
context.isInvalid = true;
|
|
6429
|
-
context.promise = asyncFunction(
|
|
6429
|
+
context.promise = $asyncFunction();
|
|
6430
6430
|
state = { isLoading: true, data: state.data };
|
|
6431
6431
|
notify();
|
|
6432
6432
|
}
|
|
@@ -6437,12 +6437,8 @@ function createCacheItem(key, defaultAsyncFunction, options) {
|
|
|
6437
6437
|
function getState() {
|
|
6438
6438
|
return state;
|
|
6439
6439
|
}
|
|
6440
|
-
function setAsyncFunction(overrideAsyncFunction) {
|
|
6441
|
-
asyncFunction = overrideAsyncFunction;
|
|
6442
|
-
}
|
|
6443
6440
|
return {
|
|
6444
6441
|
...eventSource2.observable,
|
|
6445
|
-
setAsyncFunction,
|
|
6446
6442
|
get,
|
|
6447
6443
|
getState,
|
|
6448
6444
|
revalidate
|
|
@@ -6450,19 +6446,12 @@ function createCacheItem(key, defaultAsyncFunction, options) {
|
|
|
6450
6446
|
}
|
|
6451
6447
|
function createAsyncCache(asyncFunction, options) {
|
|
6452
6448
|
const cache = /* @__PURE__ */ new Map();
|
|
6453
|
-
function create(key
|
|
6449
|
+
function create(key) {
|
|
6454
6450
|
let cacheItem = cache.get(key);
|
|
6455
6451
|
if (cacheItem) {
|
|
6456
|
-
if (overrideAsyncFunction) {
|
|
6457
|
-
cacheItem.setAsyncFunction(overrideAsyncFunction);
|
|
6458
|
-
}
|
|
6459
6452
|
return cacheItem;
|
|
6460
6453
|
}
|
|
6461
|
-
cacheItem = createCacheItem(
|
|
6462
|
-
key,
|
|
6463
|
-
overrideAsyncFunction ?? asyncFunction,
|
|
6464
|
-
options
|
|
6465
|
-
);
|
|
6454
|
+
cacheItem = createCacheItem(key, asyncFunction, options);
|
|
6466
6455
|
cache.set(key, cacheItem);
|
|
6467
6456
|
return cacheItem;
|
|
6468
6457
|
}
|
|
@@ -6588,6 +6577,21 @@ function makePoller(callback) {
|
|
|
6588
6577
|
};
|
|
6589
6578
|
}
|
|
6590
6579
|
|
|
6580
|
+
// src/lib/stringify.ts
|
|
6581
|
+
function stringify(object, ...args) {
|
|
6582
|
+
if (typeof object !== "object" || object === null || Array.isArray(object)) {
|
|
6583
|
+
return JSON.stringify(object, ...args);
|
|
6584
|
+
}
|
|
6585
|
+
const sortedObject = Object.keys(object).sort().reduce(
|
|
6586
|
+
(sortedObject2, key) => {
|
|
6587
|
+
sortedObject2[key] = object[key];
|
|
6588
|
+
return sortedObject2;
|
|
6589
|
+
},
|
|
6590
|
+
{}
|
|
6591
|
+
);
|
|
6592
|
+
return JSON.stringify(sortedObject, ...args);
|
|
6593
|
+
}
|
|
6594
|
+
|
|
6591
6595
|
// src/index.ts
|
|
6592
6596
|
detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
6593
6597
|
export {
|
|
@@ -6627,6 +6631,7 @@ export {
|
|
|
6627
6631
|
nn,
|
|
6628
6632
|
patchLiveObjectKey,
|
|
6629
6633
|
shallow,
|
|
6634
|
+
stringify,
|
|
6630
6635
|
throwUsageError,
|
|
6631
6636
|
toPlainLson,
|
|
6632
6637
|
tryParseJson,
|