@liveblocks/core 1.4.7-test1 → 1.4.7
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 +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +25 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -43
- 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.7
|
|
9
|
+
var PKG_VERSION = "1.4.7";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -4900,23 +4900,6 @@ function createRoom(options, config) {
|
|
|
4900
4900
|
ydoc: makeEventSource(),
|
|
4901
4901
|
comments: makeEventSource()
|
|
4902
4902
|
};
|
|
4903
|
-
async function streamFetch(authTokenOrPublicApiKey, roomId) {
|
|
4904
|
-
const baseUrl = new URL(config.liveblocksServer);
|
|
4905
|
-
baseUrl.protocol = "https";
|
|
4906
|
-
const url = new URL(
|
|
4907
|
-
`/v2/c/rooms/${encodeURIComponent(roomId)}/storage`,
|
|
4908
|
-
baseUrl
|
|
4909
|
-
);
|
|
4910
|
-
const fetcher = config.polyfills?.fetch || /* istanbul ignore next */
|
|
4911
|
-
fetch;
|
|
4912
|
-
return fetcher(url.toString(), {
|
|
4913
|
-
method: "GET",
|
|
4914
|
-
headers: {
|
|
4915
|
-
"Content-Type": "application/json",
|
|
4916
|
-
Authorization: `Bearer ${authTokenOrPublicApiKey}`
|
|
4917
|
-
}
|
|
4918
|
-
});
|
|
4919
|
-
}
|
|
4920
4903
|
async function httpSend(authTokenOrPublicApiKey, roomId, nonce, messages) {
|
|
4921
4904
|
const baseUrl = new URL(config.liveblocksServer);
|
|
4922
4905
|
baseUrl.protocol = "https";
|
|
@@ -5391,7 +5374,12 @@ function createRoom(options, config) {
|
|
|
5391
5374
|
break;
|
|
5392
5375
|
}
|
|
5393
5376
|
case 200 /* INITIAL_STORAGE_STATE */: {
|
|
5394
|
-
|
|
5377
|
+
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
5378
|
+
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
5379
|
+
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
5380
|
+
_resolveStoragePromise?.();
|
|
5381
|
+
notifyStorageStatus();
|
|
5382
|
+
eventHub.storageDidLoad.notify();
|
|
5395
5383
|
break;
|
|
5396
5384
|
}
|
|
5397
5385
|
case 201 /* UPDATE_STORAGE */: {
|
|
@@ -5536,30 +5524,9 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
5536
5524
|
}
|
|
5537
5525
|
let _getStorage$ = null;
|
|
5538
5526
|
let _resolveStoragePromise = null;
|
|
5539
|
-
function processInitialStorage(message) {
|
|
5540
|
-
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
5541
|
-
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
5542
|
-
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
5543
|
-
_resolveStoragePromise?.();
|
|
5544
|
-
notifyStorageStatus();
|
|
5545
|
-
eventHub.storageDidLoad.notify();
|
|
5546
|
-
}
|
|
5547
|
-
async function streamStorage() {
|
|
5548
|
-
if (!managedSocket.authValue) {
|
|
5549
|
-
return;
|
|
5550
|
-
}
|
|
5551
|
-
const result = await streamFetch(
|
|
5552
|
-
managedSocket.authValue.type === "public" ? managedSocket.authValue.publicApiKey : managedSocket.authValue.token.raw,
|
|
5553
|
-
config.roomId
|
|
5554
|
-
);
|
|
5555
|
-
const items = await result.json();
|
|
5556
|
-
processInitialStorage({ type: 200 /* INITIAL_STORAGE_STATE */, items });
|
|
5557
|
-
}
|
|
5558
5527
|
function refreshStorage(options2) {
|
|
5559
5528
|
const messages = context.buffer.messages;
|
|
5560
|
-
if (
|
|
5561
|
-
void streamStorage();
|
|
5562
|
-
} else if (!messages.some((msg) => msg.type === 200 /* FETCH_STORAGE */)) {
|
|
5529
|
+
if (!messages.some((msg) => msg.type === 200 /* FETCH_STORAGE */)) {
|
|
5563
5530
|
messages.push({ type: 200 /* FETCH_STORAGE */ });
|
|
5564
5531
|
}
|
|
5565
5532
|
if (options2.flush) {
|
|
@@ -5979,8 +5946,7 @@ function createClient(options) {
|
|
|
5979
5946
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
5980
5947
|
unstable_batchedUpdates: options2?.unstable_batchedUpdates,
|
|
5981
5948
|
liveblocksServer: getServerFromClientOptions(clientOptions),
|
|
5982
|
-
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP
|
|
5983
|
-
unstable_streamData: !!clientOptions.unstable_streamData
|
|
5949
|
+
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP
|
|
5984
5950
|
}
|
|
5985
5951
|
);
|
|
5986
5952
|
rooms.set(roomId, newRoom);
|