@liveblocks/core 2.8.0-beta3 → 2.8.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.8.0-beta3";
9
+ var PKG_VERSION = "2.8.0";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2055,11 +2055,16 @@ function toURLSearchParams(params) {
2055
2055
  return result;
2056
2056
  }
2057
2057
  function urljoin(baseUrl, path, params) {
2058
- const url = new URL(path, baseUrl);
2058
+ const url2 = new URL(path, baseUrl);
2059
2059
  if (params !== void 0) {
2060
- url.search = (params instanceof URLSearchParams ? params : toURLSearchParams(params)).toString();
2060
+ url2.search = (params instanceof URLSearchParams ? params : toURLSearchParams(params)).toString();
2061
2061
  }
2062
- return url.toString();
2062
+ return url2.toString();
2063
+ }
2064
+ function url(strings, ...values) {
2065
+ return strings.reduce(
2066
+ (result, str, i) => result + encodeURIComponent(values[i - 1] ?? "") + str
2067
+ );
2063
2068
  }
2064
2069
 
2065
2070
  // src/notifications.ts
@@ -2071,6 +2076,9 @@ function createNotificationsApi({
2071
2076
  fetcher
2072
2077
  }) {
2073
2078
  async function fetchJson(endpoint, options, params) {
2079
+ if (!endpoint.startsWith("/v2/c/")) {
2080
+ raise("Expected a /v2/c/* endpoint");
2081
+ }
2074
2082
  const authValue = await authManager.getAuthValue({
2075
2083
  requestedScope: "comments:read"
2076
2084
  });
@@ -2078,8 +2086,8 @@ function createNotificationsApi({
2078
2086
  const userId = authValue.token.parsed.uid;
2079
2087
  currentUserIdStore.set(() => userId);
2080
2088
  }
2081
- const url = urljoin(baseUrl, `/v2/c${endpoint}`, params);
2082
- const response = await fetcher(url.toString(), {
2089
+ const url2 = urljoin(baseUrl, endpoint, params);
2090
+ const response = await fetcher(url2.toString(), {
2083
2091
  ...options,
2084
2092
  headers: {
2085
2093
  ...options?.headers,
@@ -2114,7 +2122,7 @@ function createNotificationsApi({
2114
2122
  return body;
2115
2123
  }
2116
2124
  async function getInboxNotifications() {
2117
- const json = await fetchJson("/inbox-notifications", void 0, {});
2125
+ const json = await fetchJson(url`/v2/c/inbox-notifications`, void 0, {});
2118
2126
  return {
2119
2127
  threads: json.threads.map(convertToThreadData),
2120
2128
  inboxNotifications: json.inboxNotifications.map(
@@ -2124,7 +2132,7 @@ function createNotificationsApi({
2124
2132
  };
2125
2133
  }
2126
2134
  async function getInboxNotificationsSince(options) {
2127
- const json = await fetchJson("/inbox-notifications", void 0, {
2135
+ const json = await fetchJson(url`/v2/c/inbox-notifications`, void 0, {
2128
2136
  since: options.since.toISOString()
2129
2137
  });
2130
2138
  return {
@@ -2142,11 +2150,11 @@ function createNotificationsApi({
2142
2150
  };
2143
2151
  }
2144
2152
  async function getUnreadInboxNotificationsCount() {
2145
- const { count } = await fetchJson("/inbox-notifications/count");
2153
+ const { count } = await fetchJson(url`/v2/c/inbox-notifications/count`);
2146
2154
  return count;
2147
2155
  }
2148
2156
  async function markAllInboxNotificationsAsRead() {
2149
- await fetchJson("/inbox-notifications/read", {
2157
+ await fetchJson(url`/v2/c/inbox-notifications/read`, {
2150
2158
  method: "POST",
2151
2159
  headers: {
2152
2160
  "Content-Type": "application/json"
@@ -2155,7 +2163,7 @@ function createNotificationsApi({
2155
2163
  });
2156
2164
  }
2157
2165
  async function markInboxNotificationsAsRead(inboxNotificationIds) {
2158
- await fetchJson("/inbox-notifications/read", {
2166
+ await fetchJson(url`/v2/c/inbox-notifications/read`, {
2159
2167
  method: "POST",
2160
2168
  headers: {
2161
2169
  "Content-Type": "application/json"
@@ -2175,24 +2183,21 @@ function createNotificationsApi({
2175
2183
  await batchedMarkInboxNotificationsAsRead.get(inboxNotificationId);
2176
2184
  }
2177
2185
  async function deleteAllInboxNotifications() {
2178
- await fetchJson("/inbox-notifications", {
2186
+ await fetchJson(url`/v2/c/inbox-notifications`, {
2179
2187
  method: "DELETE"
2180
2188
  });
2181
2189
  }
2182
2190
  async function deleteInboxNotification(inboxNotificationId) {
2183
- await fetchJson(
2184
- `/inbox-notifications/${encodeURIComponent(inboxNotificationId)}`,
2185
- {
2186
- method: "DELETE"
2187
- }
2188
- );
2191
+ await fetchJson(url`/v2/c/inbox-notifications/${inboxNotificationId}`, {
2192
+ method: "DELETE"
2193
+ });
2189
2194
  }
2190
2195
  async function getThreads(options) {
2191
2196
  let query;
2192
2197
  if (options?.query) {
2193
2198
  query = objectToQuery(options.query);
2194
2199
  }
2195
- const json = await fetchJson("/threads", void 0, {
2200
+ const json = await fetchJson(url`/v2/c/threads`, void 0, {
2196
2201
  query
2197
2202
  });
2198
2203
  return {
@@ -2208,7 +2213,7 @@ function createNotificationsApi({
2208
2213
  if (options?.query) {
2209
2214
  query = objectToQuery(options.query);
2210
2215
  }
2211
- const json = await fetchJson("/threads", void 0, {
2216
+ const json = await fetchJson(url`/v2/c/threads`, void 0, {
2212
2217
  since: options.since.toISOString(),
2213
2218
  query
2214
2219
  });
@@ -4796,7 +4801,7 @@ function findNonSerializableValue(value, path = "") {
4796
4801
  }
4797
4802
 
4798
4803
  // src/lib/autoRetry.ts
4799
- async function autoRetry(promiseFn, maxTries, backoff, exitCondition) {
4804
+ async function autoRetry(promiseFn, maxTries, backoff, throwError) {
4800
4805
  const fallbackBackoff = backoff.length > 0 ? backoff[backoff.length - 1] : 0;
4801
4806
  let attempt = 0;
4802
4807
  while (true) {
@@ -4805,7 +4810,7 @@ async function autoRetry(promiseFn, maxTries, backoff, exitCondition) {
4805
4810
  try {
4806
4811
  return await promise;
4807
4812
  } catch (err) {
4808
- if (exitCondition && exitCondition(err)) {
4813
+ if (throwError?.(err)) {
4809
4814
  throw err;
4810
4815
  }
4811
4816
  if (attempt >= maxTries) {
@@ -5501,15 +5506,14 @@ function createRoom(options, config) {
5501
5506
  ydoc: makeEventSource(),
5502
5507
  comments: makeEventSource()
5503
5508
  };
5504
- async function fetchClientApi(roomId, endpoint, authValue, options2, params) {
5505
- const url = urljoin(
5506
- config.baseUrl,
5507
- `/v2/c/rooms/${encodeURIComponent(roomId)}${endpoint}`,
5508
- params
5509
- );
5509
+ async function fetchClientApi(endpoint, authValue, options2, params) {
5510
+ if (!endpoint.startsWith("/v2/c/rooms/")) {
5511
+ raise("Expected a /v2/c/rooms/* endpoint");
5512
+ }
5513
+ const url2 = urljoin(config.baseUrl, endpoint, params);
5510
5514
  const fetcher = config.polyfills?.fetch || /* istanbul ignore next */
5511
5515
  fetch;
5512
- return await fetcher(url, {
5516
+ return await fetcher(url2, {
5513
5517
  ...options2,
5514
5518
  headers: {
5515
5519
  ...options2?.headers,
@@ -5518,7 +5522,7 @@ function createRoom(options, config) {
5518
5522
  });
5519
5523
  }
5520
5524
  async function streamFetch(authValue, roomId) {
5521
- return fetchClientApi(roomId, "/storage", authValue, {
5525
+ return fetchClientApi(url`/v2/c/rooms/${roomId}/storage`, authValue, {
5522
5526
  method: "GET",
5523
5527
  headers: {
5524
5528
  "Content-Type": "application/json"
@@ -5529,21 +5533,24 @@ function createRoom(options, config) {
5529
5533
  if (!managedSocket.authValue) {
5530
5534
  throw new Error("Not authorized");
5531
5535
  }
5532
- return fetchClientApi(config.roomId, endpoint, managedSocket.authValue, {
5533
- method: "POST",
5534
- headers: {
5535
- "Content-Type": "application/json"
5536
- },
5537
- body: JSON.stringify(body)
5538
- });
5536
+ return fetchClientApi(
5537
+ endpoint === "/send-message" ? url`/v2/c/rooms/${config.roomId}/send-message` : url`/v2/c/rooms/${config.roomId}/text-metadata`,
5538
+ managedSocket.authValue,
5539
+ {
5540
+ method: "POST",
5541
+ headers: {
5542
+ "Content-Type": "application/json"
5543
+ },
5544
+ body: JSON.stringify(body)
5545
+ }
5546
+ );
5539
5547
  }
5540
5548
  async function createTextMention(userId, mentionId) {
5541
5549
  if (!managedSocket.authValue) {
5542
5550
  throw new Error("Not authorized");
5543
5551
  }
5544
5552
  return fetchClientApi(
5545
- config.roomId,
5546
- "/text-mentions",
5553
+ url`/v2/c/rooms/${config.roomId}/text-mentions`,
5547
5554
  managedSocket.authValue,
5548
5555
  {
5549
5556
  method: "POST",
@@ -5562,8 +5569,7 @@ function createRoom(options, config) {
5562
5569
  throw new Error("Not authorized");
5563
5570
  }
5564
5571
  return fetchClientApi(
5565
- config.roomId,
5566
- `/text-mentions/${mentionId}`,
5572
+ url`/v2/c/rooms/${config.roomId}/text-mentions/${mentionId}`,
5567
5573
  managedSocket.authValue,
5568
5574
  {
5569
5575
  method: "DELETE"
@@ -5572,39 +5578,41 @@ function createRoom(options, config) {
5572
5578
  }
5573
5579
  async function reportTextEditor(type, rootKey) {
5574
5580
  const authValue = await delegates.authenticate();
5575
- return fetchClientApi(config.roomId, "/text-metadata", authValue, {
5576
- method: "POST",
5577
- headers: {
5578
- "Content-Type": "application/json"
5579
- },
5580
- body: JSON.stringify({
5581
- type,
5582
- rootKey
5583
- })
5584
- });
5581
+ return fetchClientApi(
5582
+ url`/v2/c/rooms/${config.roomId}/text-metadata`,
5583
+ authValue,
5584
+ {
5585
+ method: "POST",
5586
+ headers: { "Content-Type": "application/json" },
5587
+ body: JSON.stringify({ type, rootKey })
5588
+ }
5589
+ );
5585
5590
  }
5586
5591
  async function listTextVersions() {
5587
- const authValue = await delegates.authenticate();
5588
- return fetchClientApi(config.roomId, "/versions/", authValue, {
5589
- method: "GET"
5590
- });
5591
- }
5592
- async function getTextVersion(versionId) {
5593
5592
  const authValue = await delegates.authenticate();
5594
5593
  return fetchClientApi(
5595
- config.roomId,
5596
- `/y-version/${encodeURIComponent(versionId)}`,
5594
+ url`/v2/c/rooms/${config.roomId}/versions`,
5597
5595
  authValue,
5598
5596
  {
5599
5597
  method: "GET"
5600
5598
  }
5601
5599
  );
5602
5600
  }
5601
+ async function getTextVersion(versionId) {
5602
+ const authValue = await delegates.authenticate();
5603
+ return fetchClientApi(
5604
+ url`/v2/c/rooms/${config.roomId}/y-version/${versionId}`,
5605
+ authValue,
5606
+ { method: "GET" }
5607
+ );
5608
+ }
5603
5609
  async function createTextVersion() {
5604
5610
  const authValue = await delegates.authenticate();
5605
- return fetchClientApi(config.roomId, "/version", authValue, {
5606
- method: "POST"
5607
- });
5611
+ return fetchClientApi(
5612
+ url`/v2/c/rooms/${config.roomId}/version`,
5613
+ authValue,
5614
+ { method: "POST" }
5615
+ );
5608
5616
  }
5609
5617
  function sendMessages(messages) {
5610
5618
  const serializedPayload = JSON.stringify(messages);
@@ -6436,7 +6444,7 @@ ${Array.from(traces).join("\n\n")}`
6436
6444
  };
6437
6445
  async function fetchCommentsApi(endpoint, params, options2) {
6438
6446
  const authValue = await delegates.authenticate();
6439
- return fetchClientApi(config.roomId, endpoint, authValue, options2, params);
6447
+ return fetchClientApi(endpoint, authValue, options2, params);
6440
6448
  }
6441
6449
  async function fetchCommentsJson(endpoint, options2, params) {
6442
6450
  const response = await fetchCommentsApi(endpoint, params, options2);
@@ -6466,7 +6474,7 @@ ${Array.from(traces).join("\n\n")}`
6466
6474
  }
6467
6475
  async function getThreadsSince(options2) {
6468
6476
  const response = await fetchCommentsApi(
6469
- "/threads",
6477
+ url`/v2/c/rooms/${config.roomId}/threads`,
6470
6478
  {
6471
6479
  since: options2?.since?.toISOString()
6472
6480
  },
@@ -6513,15 +6521,9 @@ ${Array.from(traces).join("\n\n")}`
6513
6521
  query = objectToQuery(options2.query);
6514
6522
  }
6515
6523
  const response = await fetchCommentsApi(
6516
- "/threads",
6517
- {
6518
- query
6519
- },
6520
- {
6521
- headers: {
6522
- "Content-Type": "application/json"
6523
- }
6524
- }
6524
+ url`/v2/c/rooms/${config.roomId}/threads`,
6525
+ { query },
6526
+ { headers: { "Content-Type": "application/json" } }
6525
6527
  );
6526
6528
  if (response.ok) {
6527
6529
  const json = await response.json();
@@ -6546,7 +6548,7 @@ ${Array.from(traces).join("\n\n")}`
6546
6548
  }
6547
6549
  async function getThread(threadId) {
6548
6550
  const response = await fetchCommentsApi(
6549
- `/thread-with-notification/${threadId}`
6551
+ url`/v2/c/rooms/${config.roomId}/thread-with-notification/${threadId}`
6550
6552
  );
6551
6553
  if (response.ok) {
6552
6554
  const json = await response.json();
@@ -6570,34 +6572,38 @@ ${Array.from(traces).join("\n\n")}`
6570
6572
  threadId = createThreadId(),
6571
6573
  attachmentIds
6572
6574
  }) {
6573
- const thread = await fetchCommentsJson("/threads", {
6574
- method: "POST",
6575
- headers: {
6576
- "Content-Type": "application/json"
6577
- },
6578
- body: JSON.stringify({
6579
- id: threadId,
6580
- comment: {
6581
- id: commentId,
6582
- body,
6583
- attachmentIds
6575
+ const thread = await fetchCommentsJson(
6576
+ url`/v2/c/rooms/${config.roomId}/threads`,
6577
+ {
6578
+ method: "POST",
6579
+ headers: {
6580
+ "Content-Type": "application/json"
6584
6581
  },
6585
- metadata
6586
- })
6587
- });
6582
+ body: JSON.stringify({
6583
+ id: threadId,
6584
+ comment: {
6585
+ id: commentId,
6586
+ body,
6587
+ attachmentIds
6588
+ },
6589
+ metadata
6590
+ })
6591
+ }
6592
+ );
6588
6593
  return convertToThreadData(thread);
6589
6594
  }
6590
6595
  async function deleteThread(threadId) {
6591
- await fetchCommentsJson(`/threads/${encodeURIComponent(threadId)}`, {
6592
- method: "DELETE"
6593
- });
6596
+ await fetchCommentsJson(
6597
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}`,
6598
+ { method: "DELETE" }
6599
+ );
6594
6600
  }
6595
6601
  async function editThreadMetadata({
6596
6602
  metadata,
6597
6603
  threadId
6598
6604
  }) {
6599
6605
  return await fetchCommentsJson(
6600
- `/threads/${encodeURIComponent(threadId)}/metadata`,
6606
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/metadata`,
6601
6607
  {
6602
6608
  method: "POST",
6603
6609
  headers: {
@@ -6609,18 +6615,14 @@ ${Array.from(traces).join("\n\n")}`
6609
6615
  }
6610
6616
  async function markThreadAsResolved(threadId) {
6611
6617
  await fetchCommentsJson(
6612
- `/threads/${encodeURIComponent(threadId)}/mark-as-resolved`,
6613
- {
6614
- method: "POST"
6615
- }
6618
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/mark-as-resolved`,
6619
+ { method: "POST" }
6616
6620
  );
6617
6621
  }
6618
6622
  async function markThreadAsUnresolved(threadId) {
6619
6623
  await fetchCommentsJson(
6620
- `/threads/${encodeURIComponent(threadId)}/mark-as-unresolved`,
6621
- {
6622
- method: "POST"
6623
- }
6624
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/mark-as-unresolved`,
6625
+ { method: "POST" }
6624
6626
  );
6625
6627
  }
6626
6628
  async function createComment({
@@ -6630,7 +6632,7 @@ ${Array.from(traces).join("\n\n")}`
6630
6632
  attachmentIds
6631
6633
  }) {
6632
6634
  const comment = await fetchCommentsJson(
6633
- `/threads/${encodeURIComponent(threadId)}/comments`,
6635
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/comments`,
6634
6636
  {
6635
6637
  method: "POST",
6636
6638
  headers: {
@@ -6652,9 +6654,7 @@ ${Array.from(traces).join("\n\n")}`
6652
6654
  attachmentIds
6653
6655
  }) {
6654
6656
  const comment = await fetchCommentsJson(
6655
- `/threads/${encodeURIComponent(threadId)}/comments/${encodeURIComponent(
6656
- commentId
6657
- )}`,
6657
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/comments/${commentId}`,
6658
6658
  {
6659
6659
  method: "POST",
6660
6660
  headers: {
@@ -6673,12 +6673,8 @@ ${Array.from(traces).join("\n\n")}`
6673
6673
  commentId
6674
6674
  }) {
6675
6675
  await fetchCommentsJson(
6676
- `/threads/${encodeURIComponent(threadId)}/comments/${encodeURIComponent(
6677
- commentId
6678
- )}`,
6679
- {
6680
- method: "DELETE"
6681
- }
6676
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/comments/${commentId}`,
6677
+ { method: "DELETE" }
6682
6678
  );
6683
6679
  }
6684
6680
  async function addReaction({
@@ -6687,9 +6683,7 @@ ${Array.from(traces).join("\n\n")}`
6687
6683
  emoji
6688
6684
  }) {
6689
6685
  const reaction = await fetchCommentsJson(
6690
- `/threads/${encodeURIComponent(threadId)}/comments/${encodeURIComponent(
6691
- commentId
6692
- )}/reactions`,
6686
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/comments/${commentId}/reactions`,
6693
6687
  {
6694
6688
  method: "POST",
6695
6689
  headers: {
@@ -6706,12 +6700,8 @@ ${Array.from(traces).join("\n\n")}`
6706
6700
  emoji
6707
6701
  }) {
6708
6702
  await fetchCommentsJson(
6709
- `/threads/${encodeURIComponent(threadId)}/comments/${encodeURIComponent(
6710
- commentId
6711
- )}/reactions/${encodeURIComponent(emoji)}`,
6712
- {
6713
- method: "DELETE"
6714
- }
6703
+ url`/v2/c/rooms/${config.roomId}/threads/${threadId}/comments/${commentId}/reactions/${emoji}`,
6704
+ { method: "DELETE" }
6715
6705
  );
6716
6706
  }
6717
6707
  function prepareAttachment(file) {
@@ -6746,7 +6736,7 @@ ${Array.from(traces).join("\n\n")}`
6746
6736
  if (attachment.size <= ATTACHMENT_PART_SIZE) {
6747
6737
  return autoRetry(
6748
6738
  () => fetchCommentsJson(
6749
- `/attachments/${encodeURIComponent(attachment.id)}/upload/${encodeURIComponent(attachment.name)}`,
6739
+ url`/v2/c/rooms/${config.roomId}/attachments/${attachment.id}/upload/${encodeURIComponent(attachment.name)}`,
6750
6740
  {
6751
6741
  method: "PUT",
6752
6742
  body: attachment.file,
@@ -6765,7 +6755,7 @@ ${Array.from(traces).join("\n\n")}`
6765
6755
  const uploadedParts = [];
6766
6756
  const createMultiPartUpload = await autoRetry(
6767
6757
  () => fetchCommentsJson(
6768
- `/attachments/${encodeURIComponent(attachment.id)}/multipart/${encodeURIComponent(attachment.name)}`,
6758
+ url`/v2/c/rooms/${config.roomId}/attachments/${attachment.id}/multipart/${encodeURIComponent(attachment.name)}`,
6769
6759
  {
6770
6760
  method: "POST",
6771
6761
  signal: abortSignal
@@ -6791,7 +6781,7 @@ ${Array.from(traces).join("\n\n")}`
6791
6781
  uploadedPartsPromises.push(
6792
6782
  autoRetry(
6793
6783
  () => fetchCommentsJson(
6794
- `/attachments/${encodeURIComponent(attachment.id)}/multipart/${encodeURIComponent(createMultiPartUpload.uploadId)}/${encodeURIComponent(partNumber)}`,
6784
+ url`/v2/c/rooms/${config.roomId}/attachments/${attachment.id}/multipart/${createMultiPartUpload.uploadId}/${String(partNumber)}`,
6795
6785
  {
6796
6786
  method: "PUT",
6797
6787
  body: part,
@@ -6813,7 +6803,7 @@ ${Array.from(traces).join("\n\n")}`
6813
6803
  (a, b) => a.partNumber - b.partNumber
6814
6804
  );
6815
6805
  return fetchCommentsJson(
6816
- `/attachments/${encodeURIComponent(attachment.id)}/multipart/${encodeURIComponent(uploadId)}/complete`,
6806
+ url`/v2/c/rooms/${config.roomId}/attachments/${attachment.id}/multipart/${uploadId}/complete`,
6817
6807
  {
6818
6808
  method: "POST",
6819
6809
  headers: {
@@ -6827,7 +6817,7 @@ ${Array.from(traces).join("\n\n")}`
6827
6817
  if (uploadId && error3?.name && (error3.name === "AbortError" || error3.name === "TimeoutError")) {
6828
6818
  try {
6829
6819
  await fetchCommentsApi(
6830
- `/attachments/${encodeURIComponent(attachment.id)}/multipart/${encodeURIComponent(uploadId)}`,
6820
+ url`/v2/c/rooms/${config.roomId}/attachments/${attachment.id}/multipart/${uploadId}`,
6831
6821
  void 0,
6832
6822
  {
6833
6823
  method: "DELETE"
@@ -6842,7 +6832,7 @@ ${Array.from(traces).join("\n\n")}`
6842
6832
  }
6843
6833
  async function getAttachmentUrls(attachmentIds) {
6844
6834
  const { urls } = await fetchCommentsJson(
6845
- "/attachments/presigned-urls",
6835
+ url`/v2/c/rooms/${config.roomId}/attachments/presigned-urls`,
6846
6836
  {
6847
6837
  method: "POST",
6848
6838
  headers: {
@@ -6858,7 +6848,7 @@ ${Array.from(traces).join("\n\n")}`
6858
6848
  const attachmentIds = batchedAttachmentIds.flat();
6859
6849
  const attachmentUrls = await getAttachmentUrls(attachmentIds);
6860
6850
  return attachmentUrls.map(
6861
- (url) => url ?? new Error("There was an error while getting this attachment's URL")
6851
+ (url2) => url2 ?? new Error("There was an error while getting this attachment's URL")
6862
6852
  );
6863
6853
  },
6864
6854
  { delay: GET_ATTACHMENT_URLS_BATCH_DELAY }
@@ -6869,12 +6859,7 @@ ${Array.from(traces).join("\n\n")}`
6869
6859
  }
6870
6860
  async function fetchNotificationsJson(endpoint, options2) {
6871
6861
  const authValue = await delegates.authenticate();
6872
- const response = await fetchClientApi(
6873
- config.roomId,
6874
- endpoint,
6875
- authValue,
6876
- options2
6877
- );
6862
+ const response = await fetchClientApi(endpoint, authValue, options2);
6878
6863
  if (!response.ok) {
6879
6864
  if (response.status >= 400 && response.status < 600) {
6880
6865
  let error3;
@@ -6904,12 +6889,12 @@ ${Array.from(traces).join("\n\n")}`
6904
6889
  }
6905
6890
  function getNotificationSettings() {
6906
6891
  return fetchNotificationsJson(
6907
- "/notification-settings"
6892
+ url`/v2/c/rooms/${config.roomId}/notification-settings`
6908
6893
  );
6909
6894
  }
6910
6895
  function updateNotificationSettings(settings) {
6911
6896
  return fetchNotificationsJson(
6912
- "/notification-settings",
6897
+ url`/v2/c/rooms/${config.roomId}/notification-settings`,
6913
6898
  {
6914
6899
  method: "POST",
6915
6900
  body: JSON.stringify(settings),
@@ -6920,13 +6905,16 @@ ${Array.from(traces).join("\n\n")}`
6920
6905
  );
6921
6906
  }
6922
6907
  async function markInboxNotificationsAsRead(inboxNotificationIds) {
6923
- await fetchNotificationsJson("/inbox-notifications/read", {
6924
- method: "POST",
6925
- headers: {
6926
- "Content-Type": "application/json"
6927
- },
6928
- body: JSON.stringify({ inboxNotificationIds })
6929
- });
6908
+ await fetchNotificationsJson(
6909
+ url`/v2/c/rooms/${config.roomId}/inbox-notifications/read`,
6910
+ {
6911
+ method: "POST",
6912
+ headers: {
6913
+ "Content-Type": "application/json"
6914
+ },
6915
+ body: JSON.stringify({ inboxNotificationIds })
6916
+ }
6917
+ );
6930
6918
  }
6931
6919
  const batchedMarkInboxNotificationsAsRead = new Batch(
6932
6920
  async (batchedInboxNotificationIds) => {
@@ -7157,19 +7145,19 @@ function makeCreateSocketDelegateForRoom(roomId, baseUrl, WebSocketPolyfill) {
7157
7145
  "To use Liveblocks client in a non-DOM environment, you need to provide a WebSocket polyfill."
7158
7146
  );
7159
7147
  }
7160
- const url = new URL(baseUrl);
7161
- url.protocol = url.protocol === "http:" ? "ws" : "wss";
7162
- url.pathname = "/v7";
7163
- url.searchParams.set("roomId", roomId);
7148
+ const url2 = new URL(baseUrl);
7149
+ url2.protocol = url2.protocol === "http:" ? "ws" : "wss";
7150
+ url2.pathname = "/v7";
7151
+ url2.searchParams.set("roomId", roomId);
7164
7152
  if (authValue.type === "secret") {
7165
- url.searchParams.set("tok", authValue.token.raw);
7153
+ url2.searchParams.set("tok", authValue.token.raw);
7166
7154
  } else if (authValue.type === "public") {
7167
- url.searchParams.set("pubkey", authValue.publicApiKey);
7155
+ url2.searchParams.set("pubkey", authValue.publicApiKey);
7168
7156
  } else {
7169
7157
  return assertNever(authValue, "Unhandled case");
7170
7158
  }
7171
- url.searchParams.set("version", PKG_VERSION || "dev");
7172
- return new ws(url.toString());
7159
+ url2.searchParams.set("version", PKG_VERSION || "dev");
7160
+ return new ws(url2.toString());
7173
7161
  };
7174
7162
  }
7175
7163
 
@@ -7431,7 +7419,7 @@ function createDevelopmentWarning(condition, ...args) {
7431
7419
 
7432
7420
  // src/comments/comment-body.ts
7433
7421
  function isCommentBodyParagraph(element) {
7434
- return "type" in element && element.type === "mention";
7422
+ return "type" in element && element.type === "paragraph";
7435
7423
  }
7436
7424
  function isCommentBodyText(element) {
7437
7425
  return !("type" in element) && "text" in element && typeof element.text === "string";
@@ -7606,11 +7594,11 @@ var MarkdownSafeString = class {
7606
7594
  function markdown(strings, ...values) {
7607
7595
  return new MarkdownSafeString(strings, values);
7608
7596
  }
7609
- function toAbsoluteUrl(url) {
7610
- if (url.startsWith("http://") || url.startsWith("https://")) {
7611
- return url;
7612
- } else if (url.startsWith("www.")) {
7613
- return "https://" + url;
7597
+ function toAbsoluteUrl(url2) {
7598
+ if (url2.startsWith("http://") || url2.startsWith("https://")) {
7599
+ return url2;
7600
+ } else if (url2.startsWith("www.")) {
7601
+ return "https://" + url2;
7614
7602
  }
7615
7603
  return;
7616
7604
  }
@@ -8294,6 +8282,8 @@ export {
8294
8282
  throwUsageError,
8295
8283
  toPlainLson,
8296
8284
  tryParseJson,
8285
+ url,
8286
+ urljoin,
8297
8287
  wait,
8298
8288
  withTimeout
8299
8289
  };