@liveblocks/core 1.6.0 → 1.7.0
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 +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +32 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -11
- 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.
|
|
9
|
+
var PKG_VERSION = "1.7.0";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -619,7 +619,7 @@ function compactObject(obj) {
|
|
|
619
619
|
});
|
|
620
620
|
return newObj;
|
|
621
621
|
}
|
|
622
|
-
async function withTimeout(promise, millis, errmsg
|
|
622
|
+
async function withTimeout(promise, millis, errmsg) {
|
|
623
623
|
let timerID;
|
|
624
624
|
const timer$ = new Promise((_, reject) => {
|
|
625
625
|
timerID = setTimeout(() => {
|
|
@@ -875,7 +875,11 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
875
875
|
"@auth.busy"
|
|
876
876
|
).onEnterAsync(
|
|
877
877
|
"@auth.busy",
|
|
878
|
-
() => withTimeout(
|
|
878
|
+
() => withTimeout(
|
|
879
|
+
delegates.authenticate(),
|
|
880
|
+
AUTH_TIMEOUT,
|
|
881
|
+
"Timed out during auth"
|
|
882
|
+
),
|
|
879
883
|
// On successful authentication
|
|
880
884
|
(okEvent) => ({
|
|
881
885
|
target: "@connecting.busy",
|
|
@@ -981,7 +985,11 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
981
985
|
});
|
|
982
986
|
}
|
|
983
987
|
);
|
|
984
|
-
return withTimeout(
|
|
988
|
+
return withTimeout(
|
|
989
|
+
connect$,
|
|
990
|
+
SOCKET_CONNECT_TIMEOUT,
|
|
991
|
+
"Timed out during websocket connection"
|
|
992
|
+
).then(
|
|
985
993
|
//
|
|
986
994
|
// Part 3:
|
|
987
995
|
// By now, our "open" event has fired, and the promise has been
|
|
@@ -1744,21 +1752,31 @@ function getAuthBearerHeaderFromAuthValue(authValue) {
|
|
|
1744
1752
|
return authValue.token.raw;
|
|
1745
1753
|
}
|
|
1746
1754
|
}
|
|
1755
|
+
var CommentsApiError = class extends Error {
|
|
1756
|
+
constructor(message, status, details) {
|
|
1757
|
+
super(message);
|
|
1758
|
+
this.message = message;
|
|
1759
|
+
this.status = status;
|
|
1760
|
+
this.details = details;
|
|
1761
|
+
}
|
|
1762
|
+
};
|
|
1747
1763
|
function createCommentsApi(roomId, getAuthValue, config) {
|
|
1748
1764
|
async function fetchJson(endpoint, options) {
|
|
1749
1765
|
const response = await fetchApi(roomId, endpoint, options);
|
|
1750
1766
|
if (!response.ok) {
|
|
1751
1767
|
if (response.status >= 400 && response.status < 600) {
|
|
1752
|
-
let
|
|
1768
|
+
let error3;
|
|
1753
1769
|
try {
|
|
1754
1770
|
const errorBody = await response.json();
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1771
|
+
error3 = new CommentsApiError(
|
|
1772
|
+
errorBody.message,
|
|
1773
|
+
response.status,
|
|
1774
|
+
errorBody
|
|
1775
|
+
);
|
|
1776
|
+
} catch {
|
|
1777
|
+
error3 = new CommentsApiError(response.statusText, response.status);
|
|
1758
1778
|
}
|
|
1759
|
-
throw
|
|
1760
|
-
`Request failed with status ${response.status}: ${errorMessage}`
|
|
1761
|
-
);
|
|
1779
|
+
throw error3;
|
|
1762
1780
|
}
|
|
1763
1781
|
}
|
|
1764
1782
|
let body;
|
|
@@ -6739,6 +6757,7 @@ function stringify(object, ...args) {
|
|
|
6739
6757
|
detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
6740
6758
|
export {
|
|
6741
6759
|
ClientMsgCode,
|
|
6760
|
+
CommentsApiError,
|
|
6742
6761
|
CrdtType,
|
|
6743
6762
|
LiveList,
|
|
6744
6763
|
LiveMap,
|