@liveblocks/core 2.17.0 → 2.18.0-yjsfactory
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 +94 -1
- package/dist/index.d.ts +94 -1
- package/dist/index.js +155 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +60 -16
- 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-yjsfactory";
|
|
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
|
}
|
|
@@ -6586,7 +6611,8 @@ function createRoom(options, config) {
|
|
|
6586
6611
|
storageDidLoad: makeEventSource(),
|
|
6587
6612
|
storageStatus: makeEventSource(),
|
|
6588
6613
|
ydoc: makeEventSource(),
|
|
6589
|
-
comments: makeEventSource()
|
|
6614
|
+
comments: makeEventSource(),
|
|
6615
|
+
roomWillDestroy: makeEventSource()
|
|
6590
6616
|
};
|
|
6591
6617
|
const roomId = config.roomId;
|
|
6592
6618
|
async function createTextMention(userId, mentionId) {
|
|
@@ -7491,7 +7517,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7491
7517
|
storageDidLoad: eventHub.storageDidLoad.observable,
|
|
7492
7518
|
storageStatus: eventHub.storageStatus.observable,
|
|
7493
7519
|
ydoc: eventHub.ydoc.observable,
|
|
7494
|
-
comments: eventHub.comments.observable
|
|
7520
|
+
comments: eventHub.comments.observable,
|
|
7521
|
+
roomWillDestroy: eventHub.roomWillDestroy.observable
|
|
7495
7522
|
};
|
|
7496
7523
|
async function getThreadsSince(options2) {
|
|
7497
7524
|
return httpClient.getThreadsSince({
|
|
@@ -7685,11 +7712,17 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7685
7712
|
reconnect: () => managedSocket.reconnect(),
|
|
7686
7713
|
disconnect: () => managedSocket.disconnect(),
|
|
7687
7714
|
destroy: () => {
|
|
7688
|
-
|
|
7715
|
+
const { roomWillDestroy, ...eventsExceptDestroy } = eventHub;
|
|
7716
|
+
for (const source of Object.values(eventsExceptDestroy)) {
|
|
7717
|
+
source[Symbol.dispose]();
|
|
7718
|
+
}
|
|
7719
|
+
eventHub.roomWillDestroy.notify();
|
|
7689
7720
|
context.yjsProvider?.off("status", yjsStatusDidChange);
|
|
7721
|
+
syncSourceForStorage.destroy();
|
|
7690
7722
|
syncSourceForYjs.destroy();
|
|
7691
7723
|
uninstallBgTabSpy();
|
|
7692
7724
|
managedSocket.destroy();
|
|
7725
|
+
roomWillDestroy[Symbol.dispose]();
|
|
7693
7726
|
},
|
|
7694
7727
|
// Presence
|
|
7695
7728
|
updatePresence,
|
|
@@ -8102,6 +8135,9 @@ function createClient(options) {
|
|
|
8102
8135
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
8103
8136
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
8104
8137
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
8138
|
+
// Public channel notification settings API
|
|
8139
|
+
getNotificationSettings: httpClient.getUserNotificationSettings,
|
|
8140
|
+
updateNotificationSettings: httpClient.updateUserNotificationSettings,
|
|
8105
8141
|
// Advanced resolvers APIs
|
|
8106
8142
|
resolvers: {
|
|
8107
8143
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -8298,9 +8334,9 @@ function escapeHtml(value) {
|
|
|
8298
8334
|
var HtmlSafeString = class {
|
|
8299
8335
|
#strings;
|
|
8300
8336
|
#values;
|
|
8301
|
-
constructor(strings,
|
|
8337
|
+
constructor(strings, values2) {
|
|
8302
8338
|
this.#strings = strings;
|
|
8303
|
-
this.#values =
|
|
8339
|
+
this.#values = values2;
|
|
8304
8340
|
}
|
|
8305
8341
|
toString() {
|
|
8306
8342
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8308,8 +8344,8 @@ var HtmlSafeString = class {
|
|
|
8308
8344
|
});
|
|
8309
8345
|
}
|
|
8310
8346
|
};
|
|
8311
|
-
function html(strings, ...
|
|
8312
|
-
return new HtmlSafeString(strings,
|
|
8347
|
+
function html(strings, ...values2) {
|
|
8348
|
+
return new HtmlSafeString(strings, values2);
|
|
8313
8349
|
}
|
|
8314
8350
|
var markdownEscapables = {
|
|
8315
8351
|
_: "\\_",
|
|
@@ -8354,9 +8390,9 @@ function escapeMarkdown(value) {
|
|
|
8354
8390
|
var MarkdownSafeString = class {
|
|
8355
8391
|
#strings;
|
|
8356
8392
|
#values;
|
|
8357
|
-
constructor(strings,
|
|
8393
|
+
constructor(strings, values2) {
|
|
8358
8394
|
this.#strings = strings;
|
|
8359
|
-
this.#values =
|
|
8395
|
+
this.#values = values2;
|
|
8360
8396
|
}
|
|
8361
8397
|
toString() {
|
|
8362
8398
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8364,8 +8400,8 @@ var MarkdownSafeString = class {
|
|
|
8364
8400
|
});
|
|
8365
8401
|
}
|
|
8366
8402
|
};
|
|
8367
|
-
function markdown(strings, ...
|
|
8368
|
-
return new MarkdownSafeString(strings,
|
|
8403
|
+
function markdown(strings, ...values2) {
|
|
8404
|
+
return new MarkdownSafeString(strings, values2);
|
|
8369
8405
|
}
|
|
8370
8406
|
function toAbsoluteUrl(url2) {
|
|
8371
8407
|
if (url2.startsWith("http://") || url2.startsWith("https://")) {
|
|
@@ -9091,6 +9127,11 @@ var SortedList = class _SortedList {
|
|
|
9091
9127
|
}
|
|
9092
9128
|
};
|
|
9093
9129
|
|
|
9130
|
+
// src/protocol/UserNotificationSettings.ts
|
|
9131
|
+
function isNotificationChannelEnabled(settings) {
|
|
9132
|
+
return values(settings).every((enabled) => enabled === true);
|
|
9133
|
+
}
|
|
9134
|
+
|
|
9094
9135
|
// src/types/Others.ts
|
|
9095
9136
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
9096
9137
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -9146,6 +9187,7 @@ export {
|
|
|
9146
9187
|
deprecate,
|
|
9147
9188
|
deprecateIf,
|
|
9148
9189
|
detectDupes,
|
|
9190
|
+
entries,
|
|
9149
9191
|
errorIf,
|
|
9150
9192
|
freeze,
|
|
9151
9193
|
generateCommentUrl,
|
|
@@ -9160,10 +9202,12 @@ export {
|
|
|
9160
9202
|
isJsonObject,
|
|
9161
9203
|
isJsonScalar,
|
|
9162
9204
|
isLiveNode,
|
|
9205
|
+
isNotificationChannelEnabled,
|
|
9163
9206
|
isPlainObject,
|
|
9164
9207
|
isRootCrdt,
|
|
9165
9208
|
isStartsWithOperator,
|
|
9166
9209
|
kInternal,
|
|
9210
|
+
keys,
|
|
9167
9211
|
legacy_patchImmutableObject,
|
|
9168
9212
|
lsonToJson,
|
|
9169
9213
|
makeEventSource,
|