@liveblocks/core 2.17.0 → 2.18.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 +88 -1
- package/dist/index.d.ts +88 -1
- package/dist/index.js +145 -109
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -13
- 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 = "2.
|
|
9
|
+
var PKG_VERSION = "2.18.0";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -181,6 +181,12 @@ function raise(msg) {
|
|
|
181
181
|
function entries(obj) {
|
|
182
182
|
return Object.entries(obj);
|
|
183
183
|
}
|
|
184
|
+
function keys(obj) {
|
|
185
|
+
return Object.keys(obj);
|
|
186
|
+
}
|
|
187
|
+
function values(obj) {
|
|
188
|
+
return Object.values(obj);
|
|
189
|
+
}
|
|
184
190
|
function mapValues(obj, mapFn) {
|
|
185
191
|
const result = {};
|
|
186
192
|
for (const pair of Object.entries(obj)) {
|
|
@@ -1058,9 +1064,9 @@ function urljoin(baseUrl, path, params) {
|
|
|
1058
1064
|
}
|
|
1059
1065
|
return url2.toString();
|
|
1060
1066
|
}
|
|
1061
|
-
function url(strings, ...
|
|
1067
|
+
function url(strings, ...values2) {
|
|
1062
1068
|
return strings.reduce(
|
|
1063
|
-
(result, str, i) => result + encodeURIComponent(
|
|
1069
|
+
(result, str, i) => result + encodeURIComponent(values2[i - 1] ?? "") + str
|
|
1064
1070
|
);
|
|
1065
1071
|
}
|
|
1066
1072
|
|
|
@@ -1728,6 +1734,21 @@ function createApiClient({
|
|
|
1728
1734
|
await authManager.getAuthValue({ requestedScope: "comments:read" })
|
|
1729
1735
|
);
|
|
1730
1736
|
}
|
|
1737
|
+
async function getUserNotificationSettings(options) {
|
|
1738
|
+
return httpClient.get(
|
|
1739
|
+
url`/v2/c/notification-settings`,
|
|
1740
|
+
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1741
|
+
void 0,
|
|
1742
|
+
{ signal: options?.signal }
|
|
1743
|
+
);
|
|
1744
|
+
}
|
|
1745
|
+
async function updateUserNotificationSettings(settings) {
|
|
1746
|
+
return httpClient.post(
|
|
1747
|
+
url`/v2/c/notification-settings`,
|
|
1748
|
+
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1749
|
+
settings
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1731
1752
|
async function getUserThreads_experimental(options) {
|
|
1732
1753
|
let query;
|
|
1733
1754
|
if (options?.query) {
|
|
@@ -1790,10 +1811,10 @@ function createApiClient({
|
|
|
1790
1811
|
removeReaction,
|
|
1791
1812
|
markThreadAsResolved,
|
|
1792
1813
|
markThreadAsUnresolved,
|
|
1793
|
-
// Room notifications
|
|
1794
1814
|
markRoomInboxNotificationAsRead,
|
|
1795
|
-
|
|
1815
|
+
// Room notifications
|
|
1796
1816
|
getNotificationSettings,
|
|
1817
|
+
updateNotificationSettings,
|
|
1797
1818
|
// Room text editor
|
|
1798
1819
|
createTextMention,
|
|
1799
1820
|
deleteTextMention,
|
|
@@ -1817,6 +1838,8 @@ function createApiClient({
|
|
|
1817
1838
|
markInboxNotificationAsRead,
|
|
1818
1839
|
deleteAllInboxNotifications,
|
|
1819
1840
|
deleteInboxNotification,
|
|
1841
|
+
getUserNotificationSettings,
|
|
1842
|
+
updateUserNotificationSettings,
|
|
1820
1843
|
// User threads
|
|
1821
1844
|
getUserThreads_experimental,
|
|
1822
1845
|
getUserThreadsSince_experimental,
|
|
@@ -6339,6 +6362,8 @@ function defaultMessageFromContext(context) {
|
|
|
6339
6362
|
return "Could not delete all inbox notifications";
|
|
6340
6363
|
case "UPDATE_NOTIFICATION_SETTINGS_ERROR":
|
|
6341
6364
|
return "Could not update notification settings";
|
|
6365
|
+
case "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR":
|
|
6366
|
+
return "Could not update user notification settings";
|
|
6342
6367
|
default:
|
|
6343
6368
|
return assertNever(context, "Unhandled case");
|
|
6344
6369
|
}
|
|
@@ -8102,6 +8127,9 @@ function createClient(options) {
|
|
|
8102
8127
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
8103
8128
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
8104
8129
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
8130
|
+
// Public channel notification settings API
|
|
8131
|
+
getNotificationSettings: httpClient.getUserNotificationSettings,
|
|
8132
|
+
updateNotificationSettings: httpClient.updateUserNotificationSettings,
|
|
8105
8133
|
// Advanced resolvers APIs
|
|
8106
8134
|
resolvers: {
|
|
8107
8135
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -8298,9 +8326,9 @@ function escapeHtml(value) {
|
|
|
8298
8326
|
var HtmlSafeString = class {
|
|
8299
8327
|
#strings;
|
|
8300
8328
|
#values;
|
|
8301
|
-
constructor(strings,
|
|
8329
|
+
constructor(strings, values2) {
|
|
8302
8330
|
this.#strings = strings;
|
|
8303
|
-
this.#values =
|
|
8331
|
+
this.#values = values2;
|
|
8304
8332
|
}
|
|
8305
8333
|
toString() {
|
|
8306
8334
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8308,8 +8336,8 @@ var HtmlSafeString = class {
|
|
|
8308
8336
|
});
|
|
8309
8337
|
}
|
|
8310
8338
|
};
|
|
8311
|
-
function html(strings, ...
|
|
8312
|
-
return new HtmlSafeString(strings,
|
|
8339
|
+
function html(strings, ...values2) {
|
|
8340
|
+
return new HtmlSafeString(strings, values2);
|
|
8313
8341
|
}
|
|
8314
8342
|
var markdownEscapables = {
|
|
8315
8343
|
_: "\\_",
|
|
@@ -8354,9 +8382,9 @@ function escapeMarkdown(value) {
|
|
|
8354
8382
|
var MarkdownSafeString = class {
|
|
8355
8383
|
#strings;
|
|
8356
8384
|
#values;
|
|
8357
|
-
constructor(strings,
|
|
8385
|
+
constructor(strings, values2) {
|
|
8358
8386
|
this.#strings = strings;
|
|
8359
|
-
this.#values =
|
|
8387
|
+
this.#values = values2;
|
|
8360
8388
|
}
|
|
8361
8389
|
toString() {
|
|
8362
8390
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8364,8 +8392,8 @@ var MarkdownSafeString = class {
|
|
|
8364
8392
|
});
|
|
8365
8393
|
}
|
|
8366
8394
|
};
|
|
8367
|
-
function markdown(strings, ...
|
|
8368
|
-
return new MarkdownSafeString(strings,
|
|
8395
|
+
function markdown(strings, ...values2) {
|
|
8396
|
+
return new MarkdownSafeString(strings, values2);
|
|
8369
8397
|
}
|
|
8370
8398
|
function toAbsoluteUrl(url2) {
|
|
8371
8399
|
if (url2.startsWith("http://") || url2.startsWith("https://")) {
|
|
@@ -9091,6 +9119,11 @@ var SortedList = class _SortedList {
|
|
|
9091
9119
|
}
|
|
9092
9120
|
};
|
|
9093
9121
|
|
|
9122
|
+
// src/protocol/UserNotificationSettings.ts
|
|
9123
|
+
function isNotificationChannelEnabled(settings) {
|
|
9124
|
+
return values(settings).every((enabled) => enabled === true);
|
|
9125
|
+
}
|
|
9126
|
+
|
|
9094
9127
|
// src/types/Others.ts
|
|
9095
9128
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
9096
9129
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -9146,6 +9179,7 @@ export {
|
|
|
9146
9179
|
deprecate,
|
|
9147
9180
|
deprecateIf,
|
|
9148
9181
|
detectDupes,
|
|
9182
|
+
entries,
|
|
9149
9183
|
errorIf,
|
|
9150
9184
|
freeze,
|
|
9151
9185
|
generateCommentUrl,
|
|
@@ -9160,10 +9194,12 @@ export {
|
|
|
9160
9194
|
isJsonObject,
|
|
9161
9195
|
isJsonScalar,
|
|
9162
9196
|
isLiveNode,
|
|
9197
|
+
isNotificationChannelEnabled,
|
|
9163
9198
|
isPlainObject,
|
|
9164
9199
|
isRootCrdt,
|
|
9165
9200
|
isStartsWithOperator,
|
|
9166
9201
|
kInternal,
|
|
9202
|
+
keys,
|
|
9167
9203
|
legacy_patchImmutableObject,
|
|
9168
9204
|
lsonToJson,
|
|
9169
9205
|
makeEventSource,
|