@liveblocks/core 2.16.0-toolbars4 → 2.17.0-channels1
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 +157 -49
- package/dist/index.d.ts +157 -49
- package/dist/index.js +148 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -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.17.0-channels1";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -173,6 +173,12 @@ function raise(msg) {
|
|
|
173
173
|
function entries(obj) {
|
|
174
174
|
return Object.entries(obj);
|
|
175
175
|
}
|
|
176
|
+
function keys(obj) {
|
|
177
|
+
return Object.keys(obj);
|
|
178
|
+
}
|
|
179
|
+
function values(obj) {
|
|
180
|
+
return Object.values(obj);
|
|
181
|
+
}
|
|
176
182
|
function mapValues(obj, mapFn) {
|
|
177
183
|
const result = {};
|
|
178
184
|
for (const pair of Object.entries(obj)) {
|
|
@@ -1038,9 +1044,9 @@ function urljoin(baseUrl, path, params) {
|
|
|
1038
1044
|
}
|
|
1039
1045
|
return url2.toString();
|
|
1040
1046
|
}
|
|
1041
|
-
function url(strings, ...
|
|
1047
|
+
function url(strings, ...values2) {
|
|
1042
1048
|
return strings.reduce(
|
|
1043
|
-
(result, str, i) => result + encodeURIComponent(
|
|
1049
|
+
(result, str, i) => result + encodeURIComponent(values2[i - 1] ?? "") + str
|
|
1044
1050
|
);
|
|
1045
1051
|
}
|
|
1046
1052
|
|
|
@@ -1685,6 +1691,21 @@ function createApiClient({
|
|
|
1685
1691
|
await authManager.getAuthValue({ requestedScope: "comments:read" })
|
|
1686
1692
|
);
|
|
1687
1693
|
}
|
|
1694
|
+
async function getChannelsNotificationSettings(options) {
|
|
1695
|
+
return httpClient.get(
|
|
1696
|
+
url`/v2/c/channels-notification-settings`,
|
|
1697
|
+
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1698
|
+
void 0,
|
|
1699
|
+
{ signal: options?.signal }
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
async function updateChannelsNotificationSettings(settings) {
|
|
1703
|
+
return httpClient.post(
|
|
1704
|
+
url`/v2/c/channels-notification-settings`,
|
|
1705
|
+
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1706
|
+
settings
|
|
1707
|
+
);
|
|
1708
|
+
}
|
|
1688
1709
|
async function getUserThreads_experimental(options) {
|
|
1689
1710
|
let query;
|
|
1690
1711
|
if (options?.query) {
|
|
@@ -1750,7 +1771,9 @@ function createApiClient({
|
|
|
1750
1771
|
// Room notifications
|
|
1751
1772
|
markRoomInboxNotificationAsRead,
|
|
1752
1773
|
updateNotificationSettings,
|
|
1774
|
+
// Channel notification settings
|
|
1753
1775
|
getNotificationSettings,
|
|
1776
|
+
updateChannelsNotificationSettings,
|
|
1754
1777
|
// Room text editor
|
|
1755
1778
|
createTextMention,
|
|
1756
1779
|
deleteTextMention,
|
|
@@ -1774,6 +1797,7 @@ function createApiClient({
|
|
|
1774
1797
|
markInboxNotificationAsRead,
|
|
1775
1798
|
deleteAllInboxNotifications,
|
|
1776
1799
|
deleteInboxNotification,
|
|
1800
|
+
getChannelsNotificationSettings,
|
|
1777
1801
|
// User threads
|
|
1778
1802
|
getUserThreads_experimental,
|
|
1779
1803
|
getUserThreadsSince_experimental
|
|
@@ -7071,11 +7095,12 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7071
7095
|
}
|
|
7072
7096
|
return messages;
|
|
7073
7097
|
}
|
|
7074
|
-
function updateYDoc(update, guid) {
|
|
7098
|
+
function updateYDoc(update, guid, isV2) {
|
|
7075
7099
|
const clientMsg = {
|
|
7076
7100
|
type: 301 /* UPDATE_YDOC */,
|
|
7077
7101
|
update,
|
|
7078
|
-
guid
|
|
7102
|
+
guid,
|
|
7103
|
+
v2: isV2
|
|
7079
7104
|
};
|
|
7080
7105
|
context.buffer.messages.push(clientMsg);
|
|
7081
7106
|
eventHub.ydoc.notify(clientMsg);
|
|
@@ -7156,14 +7181,15 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7156
7181
|
root: nn(context.root)
|
|
7157
7182
|
};
|
|
7158
7183
|
}
|
|
7159
|
-
function fetchYDoc(vector, guid) {
|
|
7184
|
+
function fetchYDoc(vector, guid, isV2) {
|
|
7160
7185
|
if (!context.buffer.messages.find((m) => {
|
|
7161
|
-
return m.type === 300 /* FETCH_YDOC */ && m.vector === vector && m.guid === guid;
|
|
7186
|
+
return m.type === 300 /* FETCH_YDOC */ && m.vector === vector && m.guid === guid && m.v2 === isV2;
|
|
7162
7187
|
})) {
|
|
7163
7188
|
context.buffer.messages.push({
|
|
7164
7189
|
type: 300 /* FETCH_YDOC */,
|
|
7165
7190
|
vector,
|
|
7166
|
-
guid
|
|
7191
|
+
guid,
|
|
7192
|
+
v2: isV2
|
|
7167
7193
|
});
|
|
7168
7194
|
}
|
|
7169
7195
|
flushNowOrSoon();
|
|
@@ -7914,6 +7940,9 @@ function createClient(options) {
|
|
|
7914
7940
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
7915
7941
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
7916
7942
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
7943
|
+
// Public channel notification settings API
|
|
7944
|
+
getChannelsNotificationSettings: httpClient.getChannelsNotificationSettings,
|
|
7945
|
+
updateChannelsNotificationSettings: httpClient.updateChannelsNotificationSettings,
|
|
7917
7946
|
// Advanced resolvers APIs
|
|
7918
7947
|
resolvers: {
|
|
7919
7948
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -8102,9 +8131,9 @@ function escapeHtml(value) {
|
|
|
8102
8131
|
var HtmlSafeString = class {
|
|
8103
8132
|
#strings;
|
|
8104
8133
|
#values;
|
|
8105
|
-
constructor(strings,
|
|
8134
|
+
constructor(strings, values2) {
|
|
8106
8135
|
this.#strings = strings;
|
|
8107
|
-
this.#values =
|
|
8136
|
+
this.#values = values2;
|
|
8108
8137
|
}
|
|
8109
8138
|
toString() {
|
|
8110
8139
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8112,8 +8141,8 @@ var HtmlSafeString = class {
|
|
|
8112
8141
|
});
|
|
8113
8142
|
}
|
|
8114
8143
|
};
|
|
8115
|
-
function html(strings, ...
|
|
8116
|
-
return new HtmlSafeString(strings,
|
|
8144
|
+
function html(strings, ...values2) {
|
|
8145
|
+
return new HtmlSafeString(strings, values2);
|
|
8117
8146
|
}
|
|
8118
8147
|
var markdownEscapables = {
|
|
8119
8148
|
_: "\\_",
|
|
@@ -8158,9 +8187,9 @@ function escapeMarkdown(value) {
|
|
|
8158
8187
|
var MarkdownSafeString = class {
|
|
8159
8188
|
#strings;
|
|
8160
8189
|
#values;
|
|
8161
|
-
constructor(strings,
|
|
8190
|
+
constructor(strings, values2) {
|
|
8162
8191
|
this.#strings = strings;
|
|
8163
|
-
this.#values =
|
|
8192
|
+
this.#values = values2;
|
|
8164
8193
|
}
|
|
8165
8194
|
toString() {
|
|
8166
8195
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8168,8 +8197,8 @@ var MarkdownSafeString = class {
|
|
|
8168
8197
|
});
|
|
8169
8198
|
}
|
|
8170
8199
|
};
|
|
8171
|
-
function markdown(strings, ...
|
|
8172
|
-
return new MarkdownSafeString(strings,
|
|
8200
|
+
function markdown(strings, ...values2) {
|
|
8201
|
+
return new MarkdownSafeString(strings, values2);
|
|
8173
8202
|
}
|
|
8174
8203
|
function toAbsoluteUrl(url2) {
|
|
8175
8204
|
if (url2.startsWith("http://") || url2.startsWith("https://")) {
|
|
@@ -8894,6 +8923,11 @@ var SortedList = class _SortedList {
|
|
|
8894
8923
|
}
|
|
8895
8924
|
};
|
|
8896
8925
|
|
|
8926
|
+
// src/protocol/ChannelsNotificationSettings.ts
|
|
8927
|
+
function isChannelNotificationSettingEnabled(setting) {
|
|
8928
|
+
return values(setting).every((enabled) => enabled === true);
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8897
8931
|
// src/types/Others.ts
|
|
8898
8932
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
8899
8933
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -8948,12 +8982,14 @@ export {
|
|
|
8948
8982
|
deprecate,
|
|
8949
8983
|
deprecateIf,
|
|
8950
8984
|
detectDupes,
|
|
8985
|
+
entries,
|
|
8951
8986
|
errorIf,
|
|
8952
8987
|
freeze,
|
|
8953
8988
|
generateCommentUrl,
|
|
8954
8989
|
getMentionedIdsFromCommentBody,
|
|
8955
8990
|
html,
|
|
8956
8991
|
htmlSafe,
|
|
8992
|
+
isChannelNotificationSettingEnabled,
|
|
8957
8993
|
isChildCrdt,
|
|
8958
8994
|
isCommentBodyLink,
|
|
8959
8995
|
isCommentBodyMention,
|
|
@@ -8966,6 +9002,7 @@ export {
|
|
|
8966
9002
|
isRootCrdt,
|
|
8967
9003
|
isStartsWithOperator,
|
|
8968
9004
|
kInternal,
|
|
9005
|
+
keys,
|
|
8969
9006
|
legacy_patchImmutableObject,
|
|
8970
9007
|
lsonToJson,
|
|
8971
9008
|
makeEventSource,
|