@liveblocks/core 2.10.2 → 2.11.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.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 = "2.10.2";
9
+ var PKG_VERSION = "2.11.0";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -6599,19 +6599,31 @@ ${Array.from(traces).join("\n\n")}`
6599
6599
  query = objectToQuery(options2.query);
6600
6600
  }
6601
6601
  const PAGE_SIZE = 50;
6602
- const result = await httpClient2.get(url`/v2/c/rooms/${config.roomId}/threads`, {
6603
- cursor: options2?.cursor,
6604
- query,
6605
- limit: PAGE_SIZE
6606
- });
6607
- return {
6608
- threads: result.data.map(convertToThreadData),
6609
- inboxNotifications: result.inboxNotifications.map(
6610
- convertToInboxNotificationData
6611
- ),
6612
- nextCursor: result.meta.nextCursor,
6613
- requestedAt: new Date(result.meta.requestedAt)
6614
- };
6602
+ try {
6603
+ const result = await httpClient2.get(url`/v2/c/rooms/${config.roomId}/threads`, {
6604
+ cursor: options2?.cursor,
6605
+ query,
6606
+ limit: PAGE_SIZE
6607
+ });
6608
+ return {
6609
+ threads: result.data.map(convertToThreadData),
6610
+ inboxNotifications: result.inboxNotifications.map(
6611
+ convertToInboxNotificationData
6612
+ ),
6613
+ nextCursor: result.meta.nextCursor,
6614
+ requestedAt: new Date(result.meta.requestedAt)
6615
+ };
6616
+ } catch (err) {
6617
+ if (err instanceof HttpError && err.status === 404) {
6618
+ return {
6619
+ threads: [],
6620
+ inboxNotifications: [],
6621
+ nextCursor: null,
6622
+ requestedAt: /* @__PURE__ */ new Date()
6623
+ };
6624
+ }
6625
+ throw err;
6626
+ }
6615
6627
  }
6616
6628
  async function getThread(threadId) {
6617
6629
  const response = await httpClient2.rawGet(
@@ -7690,6 +7702,22 @@ async function stringifyCommentBody(body, options) {
7690
7702
  return blocks.join(separator);
7691
7703
  }
7692
7704
 
7705
+ // src/comments/comment-url.ts
7706
+ var PLACEHOLDER_BASE_URL = "https://localhost:9999";
7707
+ var ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
7708
+ function generateCommentUrl({
7709
+ roomUrl,
7710
+ commentId
7711
+ }) {
7712
+ const isAbsolute = ABSOLUTE_URL_REGEX.test(roomUrl);
7713
+ const urlObject = new URL(
7714
+ roomUrl,
7715
+ isAbsolute ? void 0 : PLACEHOLDER_BASE_URL
7716
+ );
7717
+ urlObject.hash = `#${commentId}`;
7718
+ return isAbsolute ? urlObject.href : urlObject.href.replace(PLACEHOLDER_BASE_URL, "");
7719
+ }
7720
+
7693
7721
  // src/crdts/utils.ts
7694
7722
  function toPlainLson(lson) {
7695
7723
  if (lson instanceof LiveObject) {
@@ -8263,6 +8291,13 @@ var SortedList = class _SortedList {
8263
8291
  }
8264
8292
  };
8265
8293
 
8294
+ // src/types/Others.ts
8295
+ var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
8296
+ TextEditorType2["Lexical"] = "lexical";
8297
+ TextEditorType2["TipTap"] = "tiptap";
8298
+ return TextEditorType2;
8299
+ })(TextEditorType || {});
8300
+
8266
8301
  // src/index.ts
8267
8302
  detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
8268
8303
  var CommentsApiError = HttpError;
@@ -8277,8 +8312,10 @@ export {
8277
8312
  LiveObject,
8278
8313
  NotificationsApiError,
8279
8314
  OpCode,
8315
+ Promise_withResolvers,
8280
8316
  ServerMsgCode,
8281
8317
  SortedList,
8318
+ TextEditorType,
8282
8319
  WebsocketCloseCodes,
8283
8320
  ackOp,
8284
8321
  asPos,
@@ -8304,8 +8341,14 @@ export {
8304
8341
  detectDupes,
8305
8342
  errorIf,
8306
8343
  freeze,
8344
+ generateCommentUrl,
8307
8345
  getMentionedIdsFromCommentBody,
8346
+ html,
8347
+ htmlSafe,
8308
8348
  isChildCrdt,
8349
+ isCommentBodyLink,
8350
+ isCommentBodyMention,
8351
+ isCommentBodyText,
8309
8352
  isJsonArray,
8310
8353
  isJsonObject,
8311
8354
  isJsonScalar,
@@ -8325,10 +8368,12 @@ export {
8325
8368
  objectToQuery,
8326
8369
  patchLiveObjectKey,
8327
8370
  raise,
8371
+ resolveUsersInCommentBody,
8328
8372
  shallow,
8329
8373
  stringify,
8330
8374
  stringifyCommentBody,
8331
8375
  throwUsageError,
8376
+ toAbsoluteUrl,
8332
8377
  toPlainLson,
8333
8378
  tryParseJson,
8334
8379
  url,