@liveblocks/core 2.2.3-alpha2 → 2.4.0-test1
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 +267 -78
- package/dist/index.d.ts +267 -78
- package/dist/index.js +256 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +187 -107
- 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.4.0-test1";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -645,7 +645,9 @@ function memoizeOnSuccess(factoryFn) {
|
|
|
645
645
|
return () => {
|
|
646
646
|
if (cached === null) {
|
|
647
647
|
cached = factoryFn().catch((err) => {
|
|
648
|
-
|
|
648
|
+
setTimeout(() => {
|
|
649
|
+
cached = null;
|
|
650
|
+
}, 5e3);
|
|
649
651
|
throw err;
|
|
650
652
|
});
|
|
651
653
|
}
|
|
@@ -1776,15 +1778,13 @@ function stringify(object, ...args) {
|
|
|
1776
1778
|
|
|
1777
1779
|
// src/lib/batch.ts
|
|
1778
1780
|
var DEFAULT_SIZE = 50;
|
|
1779
|
-
var DEFAULT_DELAY = 100;
|
|
1780
|
-
var noop = () => {
|
|
1781
|
-
};
|
|
1782
1781
|
var BatchCall = class {
|
|
1783
|
-
constructor(
|
|
1784
|
-
this.
|
|
1785
|
-
|
|
1786
|
-
this.promise =
|
|
1787
|
-
this.
|
|
1782
|
+
constructor(input) {
|
|
1783
|
+
this.input = input;
|
|
1784
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
1785
|
+
this.promise = promise;
|
|
1786
|
+
this.resolve = resolve;
|
|
1787
|
+
this.reject = reject;
|
|
1788
1788
|
}
|
|
1789
1789
|
};
|
|
1790
1790
|
var Batch = class {
|
|
@@ -1792,8 +1792,8 @@ var Batch = class {
|
|
|
1792
1792
|
this.queue = [];
|
|
1793
1793
|
this.error = false;
|
|
1794
1794
|
this.callback = callback;
|
|
1795
|
-
this.size = options
|
|
1796
|
-
this.delay = options
|
|
1795
|
+
this.size = options.size ?? DEFAULT_SIZE;
|
|
1796
|
+
this.delay = options.delay;
|
|
1797
1797
|
}
|
|
1798
1798
|
clearDelayTimeout() {
|
|
1799
1799
|
if (this.delayTimeoutId !== void 0) {
|
|
@@ -1814,9 +1814,9 @@ var Batch = class {
|
|
|
1814
1814
|
return;
|
|
1815
1815
|
}
|
|
1816
1816
|
const calls = this.queue.splice(0);
|
|
1817
|
-
const
|
|
1817
|
+
const inputs = calls.map((call) => call.input);
|
|
1818
1818
|
try {
|
|
1819
|
-
const results = await this.callback(
|
|
1819
|
+
const results = await this.callback(inputs);
|
|
1820
1820
|
this.error = false;
|
|
1821
1821
|
calls.forEach((call, index) => {
|
|
1822
1822
|
const result = results?.[index];
|
|
@@ -1841,18 +1841,14 @@ var Batch = class {
|
|
|
1841
1841
|
});
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
1844
|
-
get(
|
|
1844
|
+
get(input) {
|
|
1845
1845
|
const existingCall = this.queue.find(
|
|
1846
|
-
(call2) => stringify(call2.
|
|
1846
|
+
(call2) => stringify(call2.input) === stringify(input)
|
|
1847
1847
|
);
|
|
1848
1848
|
if (existingCall) {
|
|
1849
1849
|
return existingCall.promise;
|
|
1850
1850
|
}
|
|
1851
|
-
const call = new BatchCall(
|
|
1852
|
-
call.promise = new Promise((resolve, reject) => {
|
|
1853
|
-
call.resolve = resolve;
|
|
1854
|
-
call.reject = reject;
|
|
1855
|
-
});
|
|
1851
|
+
const call = new BatchCall(input);
|
|
1856
1852
|
this.queue.push(call);
|
|
1857
1853
|
this.schedule();
|
|
1858
1854
|
return call.promise;
|
|
@@ -1871,21 +1867,17 @@ function createBatchStore(callback, options) {
|
|
|
1871
1867
|
return stringify(args);
|
|
1872
1868
|
}
|
|
1873
1869
|
function setStateAndNotify(cacheKey, state) {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
} else {
|
|
1877
|
-
cache.delete(cacheKey);
|
|
1878
|
-
}
|
|
1879
|
-
eventSource2.notify(state);
|
|
1870
|
+
cache.set(cacheKey, state);
|
|
1871
|
+
eventSource2.notify();
|
|
1880
1872
|
}
|
|
1881
|
-
async function get(
|
|
1882
|
-
const cacheKey = getCacheKey(
|
|
1873
|
+
async function get(input) {
|
|
1874
|
+
const cacheKey = getCacheKey(input);
|
|
1883
1875
|
if (cache.has(cacheKey)) {
|
|
1884
1876
|
return;
|
|
1885
1877
|
}
|
|
1886
1878
|
try {
|
|
1887
1879
|
setStateAndNotify(cacheKey, { isLoading: true });
|
|
1888
|
-
const result = await batch.get(
|
|
1880
|
+
const result = await batch.get(input);
|
|
1889
1881
|
setStateAndNotify(cacheKey, { isLoading: false, data: result });
|
|
1890
1882
|
} catch (error3) {
|
|
1891
1883
|
setStateAndNotify(cacheKey, {
|
|
@@ -1894,12 +1886,12 @@ function createBatchStore(callback, options) {
|
|
|
1894
1886
|
});
|
|
1895
1887
|
}
|
|
1896
1888
|
}
|
|
1897
|
-
function getState(
|
|
1898
|
-
const cacheKey = getCacheKey(
|
|
1889
|
+
function getState(input) {
|
|
1890
|
+
const cacheKey = getCacheKey(input);
|
|
1899
1891
|
return cache.get(cacheKey);
|
|
1900
1892
|
}
|
|
1901
1893
|
return {
|
|
1902
|
-
...eventSource2,
|
|
1894
|
+
...eventSource2.observable,
|
|
1903
1895
|
get,
|
|
1904
1896
|
getState
|
|
1905
1897
|
};
|
|
@@ -2086,25 +2078,32 @@ function createNotificationsApi({
|
|
|
2086
2078
|
}
|
|
2087
2079
|
return body;
|
|
2088
2080
|
}
|
|
2089
|
-
async function getInboxNotifications(
|
|
2090
|
-
const json = await fetchJson("/inbox-notifications", void 0, {
|
|
2091
|
-
limit: options?.limit,
|
|
2092
|
-
since: options?.since?.toISOString()
|
|
2093
|
-
});
|
|
2081
|
+
async function getInboxNotifications() {
|
|
2082
|
+
const json = await fetchJson("/inbox-notifications", void 0, {});
|
|
2094
2083
|
return {
|
|
2095
|
-
threads: json.threads.map(
|
|
2084
|
+
threads: json.threads.map(convertToThreadData),
|
|
2096
2085
|
inboxNotifications: json.inboxNotifications.map(
|
|
2097
|
-
|
|
2086
|
+
convertToInboxNotificationData
|
|
2098
2087
|
),
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
)
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2088
|
+
requestedAt: new Date(json.meta.requestedAt)
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
async function getInboxNotificationsSince(options) {
|
|
2092
|
+
const json = await fetchJson("/inbox-notifications", void 0, {
|
|
2093
|
+
since: options.since.toISOString()
|
|
2094
|
+
});
|
|
2095
|
+
return {
|
|
2096
|
+
threads: {
|
|
2097
|
+
modified: json.threads.map(convertToThreadData),
|
|
2098
|
+
deleted: json.deletedThreads.map(convertToThreadDeleteInfo)
|
|
2099
|
+
},
|
|
2100
|
+
inboxNotifications: {
|
|
2101
|
+
modified: json.inboxNotifications.map(convertToInboxNotificationData),
|
|
2102
|
+
deleted: json.deletedInboxNotifications.map(
|
|
2103
|
+
convertToInboxNotificationDeleteInfo
|
|
2104
|
+
)
|
|
2105
|
+
},
|
|
2106
|
+
requestedAt: new Date(json.meta.requestedAt)
|
|
2108
2107
|
};
|
|
2109
2108
|
}
|
|
2110
2109
|
async function getUnreadInboxNotificationsCount() {
|
|
@@ -2140,11 +2139,27 @@ function createNotificationsApi({
|
|
|
2140
2139
|
async function markInboxNotificationAsRead(inboxNotificationId) {
|
|
2141
2140
|
await batchedMarkInboxNotificationsAsRead.get(inboxNotificationId);
|
|
2142
2141
|
}
|
|
2142
|
+
async function deleteAllInboxNotifications() {
|
|
2143
|
+
await fetchJson("/inbox-notifications", {
|
|
2144
|
+
method: "DELETE"
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
async function deleteInboxNotification(inboxNotificationId) {
|
|
2148
|
+
await fetchJson(
|
|
2149
|
+
`/inbox-notifications/${encodeURIComponent(inboxNotificationId)}`,
|
|
2150
|
+
{
|
|
2151
|
+
method: "DELETE"
|
|
2152
|
+
}
|
|
2153
|
+
);
|
|
2154
|
+
}
|
|
2143
2155
|
return {
|
|
2144
2156
|
getInboxNotifications,
|
|
2157
|
+
getInboxNotificationsSince,
|
|
2145
2158
|
getUnreadInboxNotificationsCount,
|
|
2146
2159
|
markAllInboxNotificationsAsRead,
|
|
2147
|
-
markInboxNotificationAsRead
|
|
2160
|
+
markInboxNotificationAsRead,
|
|
2161
|
+
deleteAllInboxNotifications,
|
|
2162
|
+
deleteInboxNotification
|
|
2148
2163
|
};
|
|
2149
2164
|
}
|
|
2150
2165
|
|
|
@@ -2487,14 +2502,10 @@ function isChildCrdt(crdt) {
|
|
|
2487
2502
|
}
|
|
2488
2503
|
|
|
2489
2504
|
// src/lib/nanoid.ts
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
{ length },
|
|
2495
|
-
() => alphabet.charAt(Math.floor(Math.random() * len))
|
|
2496
|
-
).join("");
|
|
2497
|
-
}
|
|
2505
|
+
var nanoid = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce(
|
|
2506
|
+
(t2, e) => t2 += (e &= 63) < 36 ? e.toString(36) : e < 62 ? (e - 26).toString(36).toUpperCase() : e < 63 ? "_" : "-",
|
|
2507
|
+
""
|
|
2508
|
+
);
|
|
2498
2509
|
|
|
2499
2510
|
// src/crdts/LiveRegister.ts
|
|
2500
2511
|
var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
@@ -4708,6 +4719,23 @@ function findNonSerializableValue(value, path = "") {
|
|
|
4708
4719
|
return false;
|
|
4709
4720
|
}
|
|
4710
4721
|
|
|
4722
|
+
// src/lib/createIds.ts
|
|
4723
|
+
var THREAD_ID_PREFIX = "th";
|
|
4724
|
+
var COMMENT_ID_PREFIX = "cm";
|
|
4725
|
+
var INBOX_NOTIFICATION_ID_PREFIX = "in";
|
|
4726
|
+
function createOptimisticId(prefix) {
|
|
4727
|
+
return `${prefix}_${nanoid()}`;
|
|
4728
|
+
}
|
|
4729
|
+
function createThreadId() {
|
|
4730
|
+
return createOptimisticId(THREAD_ID_PREFIX);
|
|
4731
|
+
}
|
|
4732
|
+
function createCommentId() {
|
|
4733
|
+
return createOptimisticId(COMMENT_ID_PREFIX);
|
|
4734
|
+
}
|
|
4735
|
+
function createInboxNotificationId() {
|
|
4736
|
+
return createOptimisticId(INBOX_NOTIFICATION_ID_PREFIX);
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4711
4739
|
// src/lib/debug.ts
|
|
4712
4740
|
function captureStackTrace(msg, traceRoot) {
|
|
4713
4741
|
const errorLike = { name: msg };
|
|
@@ -5145,6 +5173,49 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5145
5173
|
}
|
|
5146
5174
|
return body;
|
|
5147
5175
|
}
|
|
5176
|
+
async function getThreadsSince(options) {
|
|
5177
|
+
const response = await fetchCommentsApi(
|
|
5178
|
+
"/threads",
|
|
5179
|
+
{
|
|
5180
|
+
since: options?.since?.toISOString()
|
|
5181
|
+
},
|
|
5182
|
+
{
|
|
5183
|
+
headers: {
|
|
5184
|
+
"Content-Type": "application/json"
|
|
5185
|
+
}
|
|
5186
|
+
}
|
|
5187
|
+
);
|
|
5188
|
+
if (response.ok) {
|
|
5189
|
+
const json = await response.json();
|
|
5190
|
+
return {
|
|
5191
|
+
threads: {
|
|
5192
|
+
modified: json.data.map(convertToThreadData),
|
|
5193
|
+
deleted: json.deletedThreads.map(convertToThreadDeleteInfo)
|
|
5194
|
+
},
|
|
5195
|
+
inboxNotifications: {
|
|
5196
|
+
modified: json.inboxNotifications.map(convertToInboxNotificationData),
|
|
5197
|
+
deleted: json.deletedInboxNotifications.map(
|
|
5198
|
+
convertToInboxNotificationDeleteInfo
|
|
5199
|
+
)
|
|
5200
|
+
},
|
|
5201
|
+
requestedAt: new Date(json.meta.requestedAt)
|
|
5202
|
+
};
|
|
5203
|
+
} else if (response.status === 404) {
|
|
5204
|
+
return {
|
|
5205
|
+
threads: {
|
|
5206
|
+
modified: [],
|
|
5207
|
+
deleted: []
|
|
5208
|
+
},
|
|
5209
|
+
inboxNotifications: {
|
|
5210
|
+
modified: [],
|
|
5211
|
+
deleted: []
|
|
5212
|
+
},
|
|
5213
|
+
requestedAt: /* @__PURE__ */ new Date()
|
|
5214
|
+
};
|
|
5215
|
+
} else {
|
|
5216
|
+
throw new Error("There was an error while getting threads.");
|
|
5217
|
+
}
|
|
5218
|
+
}
|
|
5148
5219
|
async function getThreads(options) {
|
|
5149
5220
|
let query;
|
|
5150
5221
|
if (options?.query) {
|
|
@@ -5153,7 +5224,6 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5153
5224
|
const response = await fetchCommentsApi(
|
|
5154
5225
|
"/threads",
|
|
5155
5226
|
{
|
|
5156
|
-
since: options?.since?.toISOString(),
|
|
5157
5227
|
query
|
|
5158
5228
|
},
|
|
5159
5229
|
{
|
|
@@ -5165,19 +5235,11 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5165
5235
|
if (response.ok) {
|
|
5166
5236
|
const json = await response.json();
|
|
5167
5237
|
return {
|
|
5168
|
-
threads: json.data.map(
|
|
5238
|
+
threads: json.data.map(convertToThreadData),
|
|
5169
5239
|
inboxNotifications: json.inboxNotifications.map(
|
|
5170
|
-
|
|
5171
|
-
),
|
|
5172
|
-
deletedThreads: json.deletedThreads.map(
|
|
5173
|
-
(info) => convertToThreadDeleteInfo(info)
|
|
5174
|
-
),
|
|
5175
|
-
deletedInboxNotifications: json.deletedInboxNotifications.map(
|
|
5176
|
-
(info) => convertToInboxNotificationDeleteInfo(info)
|
|
5240
|
+
convertToInboxNotificationData
|
|
5177
5241
|
),
|
|
5178
|
-
|
|
5179
|
-
requestedAt: new Date(json.meta.requestedAt)
|
|
5180
|
-
}
|
|
5242
|
+
requestedAt: new Date(json.meta.requestedAt)
|
|
5181
5243
|
};
|
|
5182
5244
|
} else if (response.status === 404) {
|
|
5183
5245
|
return {
|
|
@@ -5185,15 +5247,13 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5185
5247
|
inboxNotifications: [],
|
|
5186
5248
|
deletedThreads: [],
|
|
5187
5249
|
deletedInboxNotifications: [],
|
|
5188
|
-
|
|
5189
|
-
requestedAt: /* @__PURE__ */ new Date()
|
|
5190
|
-
}
|
|
5250
|
+
requestedAt: /* @__PURE__ */ new Date()
|
|
5191
5251
|
};
|
|
5192
5252
|
} else {
|
|
5193
5253
|
throw new Error("There was an error while getting threads.");
|
|
5194
5254
|
}
|
|
5195
5255
|
}
|
|
5196
|
-
async function getThread(
|
|
5256
|
+
async function getThread(threadId) {
|
|
5197
5257
|
const response = await fetchCommentsApi(
|
|
5198
5258
|
`/thread-with-notification/${threadId}`
|
|
5199
5259
|
);
|
|
@@ -5204,7 +5264,10 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5204
5264
|
inboxNotification: json.inboxNotification ? convertToInboxNotificationData(json.inboxNotification) : void 0
|
|
5205
5265
|
};
|
|
5206
5266
|
} else if (response.status === 404) {
|
|
5207
|
-
return
|
|
5267
|
+
return {
|
|
5268
|
+
thread: void 0,
|
|
5269
|
+
inboxNotification: void 0
|
|
5270
|
+
};
|
|
5208
5271
|
} else {
|
|
5209
5272
|
throw new Error(`There was an error while getting thread ${threadId}.`);
|
|
5210
5273
|
}
|
|
@@ -5212,8 +5275,8 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5212
5275
|
async function createThread({
|
|
5213
5276
|
metadata,
|
|
5214
5277
|
body,
|
|
5215
|
-
commentId,
|
|
5216
|
-
threadId
|
|
5278
|
+
commentId = createCommentId(),
|
|
5279
|
+
threadId = createThreadId()
|
|
5217
5280
|
}) {
|
|
5218
5281
|
const thread = await fetchJson("/threads", {
|
|
5219
5282
|
method: "POST",
|
|
@@ -5231,7 +5294,7 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5231
5294
|
});
|
|
5232
5295
|
return convertToThreadData(thread);
|
|
5233
5296
|
}
|
|
5234
|
-
async function deleteThread(
|
|
5297
|
+
async function deleteThread(threadId) {
|
|
5235
5298
|
await fetchJson(`/threads/${encodeURIComponent(threadId)}`, {
|
|
5236
5299
|
method: "DELETE"
|
|
5237
5300
|
});
|
|
@@ -5251,7 +5314,7 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5251
5314
|
}
|
|
5252
5315
|
);
|
|
5253
5316
|
}
|
|
5254
|
-
async function markThreadAsResolved(
|
|
5317
|
+
async function markThreadAsResolved(threadId) {
|
|
5255
5318
|
await fetchJson(
|
|
5256
5319
|
`/threads/${encodeURIComponent(threadId)}/mark-as-resolved`,
|
|
5257
5320
|
{
|
|
@@ -5259,7 +5322,7 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5259
5322
|
}
|
|
5260
5323
|
);
|
|
5261
5324
|
}
|
|
5262
|
-
async function markThreadAsUnresolved(
|
|
5325
|
+
async function markThreadAsUnresolved(threadId) {
|
|
5263
5326
|
await fetchJson(
|
|
5264
5327
|
`/threads/${encodeURIComponent(threadId)}/mark-as-unresolved`,
|
|
5265
5328
|
{
|
|
@@ -5269,7 +5332,7 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5269
5332
|
}
|
|
5270
5333
|
async function createComment({
|
|
5271
5334
|
threadId,
|
|
5272
|
-
commentId,
|
|
5335
|
+
commentId = createCommentId(),
|
|
5273
5336
|
body
|
|
5274
5337
|
}) {
|
|
5275
5338
|
const comment = await fetchJson(
|
|
@@ -5356,6 +5419,7 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5356
5419
|
}
|
|
5357
5420
|
return {
|
|
5358
5421
|
getThreads,
|
|
5422
|
+
getThreadsSince,
|
|
5359
5423
|
getThread,
|
|
5360
5424
|
createThread,
|
|
5361
5425
|
deleteThread,
|
|
@@ -6535,12 +6599,12 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6535
6599
|
}
|
|
6536
6600
|
return body;
|
|
6537
6601
|
}
|
|
6538
|
-
function
|
|
6602
|
+
function getNotificationSettings() {
|
|
6539
6603
|
return fetchNotificationsJson(
|
|
6540
6604
|
"/notification-settings"
|
|
6541
6605
|
);
|
|
6542
6606
|
}
|
|
6543
|
-
function
|
|
6607
|
+
function updateNotificationSettings(settings) {
|
|
6544
6608
|
return fetchNotificationsJson(
|
|
6545
6609
|
"/notification-settings",
|
|
6546
6610
|
{
|
|
@@ -6601,14 +6665,6 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6601
6665
|
// These exist only for our E2E testing app
|
|
6602
6666
|
explicitClose: (event) => managedSocket._privateSendMachineEvent({ type: "EXPLICIT_SOCKET_CLOSE", event }),
|
|
6603
6667
|
rawSend: (data) => managedSocket.send(data)
|
|
6604
|
-
},
|
|
6605
|
-
comments: {
|
|
6606
|
-
...commentsApi
|
|
6607
|
-
},
|
|
6608
|
-
notifications: {
|
|
6609
|
-
getRoomNotificationSettings,
|
|
6610
|
-
updateRoomNotificationSettings,
|
|
6611
|
-
markInboxNotificationAsRead
|
|
6612
6668
|
}
|
|
6613
6669
|
},
|
|
6614
6670
|
id: config.roomId,
|
|
@@ -6649,7 +6705,11 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6649
6705
|
getSelf: () => self.current,
|
|
6650
6706
|
// Presence
|
|
6651
6707
|
getPresence: () => context.myPresence.current,
|
|
6652
|
-
getOthers: () => context.others.current
|
|
6708
|
+
getOthers: () => context.others.current,
|
|
6709
|
+
getNotificationSettings,
|
|
6710
|
+
updateNotificationSettings,
|
|
6711
|
+
markInboxNotificationAsRead,
|
|
6712
|
+
...commentsApi
|
|
6653
6713
|
},
|
|
6654
6714
|
// Explictly make the internal field non-enumerable, to avoid aggressive
|
|
6655
6715
|
// freezing when used with Immer
|
|
@@ -6711,6 +6771,10 @@ function makeClassicSubscribeFn(events) {
|
|
|
6711
6771
|
return events.storageStatus.subscribe(
|
|
6712
6772
|
callback
|
|
6713
6773
|
);
|
|
6774
|
+
case "comments":
|
|
6775
|
+
return events.comments.subscribe(
|
|
6776
|
+
callback
|
|
6777
|
+
);
|
|
6714
6778
|
default:
|
|
6715
6779
|
return assertNever(
|
|
6716
6780
|
first,
|
|
@@ -6743,7 +6807,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
6743
6807
|
return subscribe;
|
|
6744
6808
|
}
|
|
6745
6809
|
function isRoomEventName(value) {
|
|
6746
|
-
return value === "my-presence" || value === "others" || value === "event" || value === "error" || value === "history" || value === "status" || value === "storage-status" || value === "lost-connection" || value === "connection";
|
|
6810
|
+
return value === "my-presence" || value === "others" || value === "event" || value === "error" || value === "history" || value === "status" || value === "storage-status" || value === "lost-connection" || value === "connection" || value === "comments";
|
|
6747
6811
|
}
|
|
6748
6812
|
function makeAuthDelegateForRoom(roomId, authManager) {
|
|
6749
6813
|
return async () => {
|
|
@@ -6828,9 +6892,7 @@ function createClientStore() {
|
|
|
6828
6892
|
),
|
|
6829
6893
|
queries: queryKey !== void 0 ? {
|
|
6830
6894
|
...state.queries,
|
|
6831
|
-
[queryKey]: {
|
|
6832
|
-
isLoading: false
|
|
6833
|
-
}
|
|
6895
|
+
[queryKey]: { isLoading: false, data: void 0 }
|
|
6834
6896
|
} : state.queries
|
|
6835
6897
|
}));
|
|
6836
6898
|
},
|
|
@@ -6843,9 +6905,7 @@ function createClientStore() {
|
|
|
6843
6905
|
},
|
|
6844
6906
|
queries: {
|
|
6845
6907
|
...state.queries,
|
|
6846
|
-
[queryKey]: {
|
|
6847
|
-
isLoading: false
|
|
6848
|
-
}
|
|
6908
|
+
[queryKey]: { isLoading: false, data: void 0 }
|
|
6849
6909
|
}
|
|
6850
6910
|
}));
|
|
6851
6911
|
},
|
|
@@ -7046,7 +7106,7 @@ function applyOptimisticUpdates(state) {
|
|
|
7046
7106
|
};
|
|
7047
7107
|
break;
|
|
7048
7108
|
}
|
|
7049
|
-
case "mark-inbox-notifications-as-read": {
|
|
7109
|
+
case "mark-all-inbox-notifications-as-read": {
|
|
7050
7110
|
for (const id in result.inboxNotifications) {
|
|
7051
7111
|
result.inboxNotifications[id] = {
|
|
7052
7112
|
...result.inboxNotifications[id],
|
|
@@ -7055,6 +7115,18 @@ function applyOptimisticUpdates(state) {
|
|
|
7055
7115
|
}
|
|
7056
7116
|
break;
|
|
7057
7117
|
}
|
|
7118
|
+
case "delete-inbox-notification": {
|
|
7119
|
+
const {
|
|
7120
|
+
[optimisticUpdate.inboxNotificationId]: _,
|
|
7121
|
+
...inboxNotifications
|
|
7122
|
+
} = result.inboxNotifications;
|
|
7123
|
+
result.inboxNotifications = inboxNotifications;
|
|
7124
|
+
break;
|
|
7125
|
+
}
|
|
7126
|
+
case "delete-all-inbox-notifications": {
|
|
7127
|
+
result.inboxNotifications = {};
|
|
7128
|
+
break;
|
|
7129
|
+
}
|
|
7058
7130
|
case "update-notification-settings": {
|
|
7059
7131
|
result.notificationSettings[optimisticUpdate.roomId] = {
|
|
7060
7132
|
...result.notificationSettings[optimisticUpdate.roomId],
|
|
@@ -7407,9 +7479,12 @@ function createClient(options) {
|
|
|
7407
7479
|
const currentUserIdStore = createStore(null);
|
|
7408
7480
|
const {
|
|
7409
7481
|
getInboxNotifications,
|
|
7482
|
+
getInboxNotificationsSince,
|
|
7410
7483
|
getUnreadInboxNotificationsCount,
|
|
7411
7484
|
markAllInboxNotificationsAsRead,
|
|
7412
|
-
markInboxNotificationAsRead
|
|
7485
|
+
markInboxNotificationAsRead,
|
|
7486
|
+
deleteAllInboxNotifications,
|
|
7487
|
+
deleteInboxNotification
|
|
7413
7488
|
} = createNotificationsApi({
|
|
7414
7489
|
baseUrl,
|
|
7415
7490
|
fetcher: clientOptions.polyfills?.fetch || /* istanbul ignore next */
|
|
@@ -7451,14 +7526,15 @@ function createClient(options) {
|
|
|
7451
7526
|
enterRoom,
|
|
7452
7527
|
getRoom,
|
|
7453
7528
|
logout,
|
|
7529
|
+
getInboxNotifications,
|
|
7530
|
+
getInboxNotificationsSince,
|
|
7531
|
+
getUnreadInboxNotificationsCount,
|
|
7532
|
+
markAllInboxNotificationsAsRead,
|
|
7533
|
+
markInboxNotificationAsRead,
|
|
7534
|
+
deleteAllInboxNotifications,
|
|
7535
|
+
deleteInboxNotification,
|
|
7454
7536
|
// Internal
|
|
7455
7537
|
[kInternal]: {
|
|
7456
|
-
notifications: {
|
|
7457
|
-
getInboxNotifications,
|
|
7458
|
-
getUnreadInboxNotificationsCount,
|
|
7459
|
-
markAllInboxNotificationsAsRead,
|
|
7460
|
-
markInboxNotificationAsRead
|
|
7461
|
-
},
|
|
7462
7538
|
currentUserIdStore,
|
|
7463
7539
|
resolveMentionSuggestions: clientOptions.resolveMentionSuggestions,
|
|
7464
7540
|
cacheStore,
|
|
@@ -8354,6 +8430,9 @@ export {
|
|
|
8354
8430
|
convertToInboxNotificationData,
|
|
8355
8431
|
convertToThreadData,
|
|
8356
8432
|
createClient,
|
|
8433
|
+
createCommentId,
|
|
8434
|
+
createInboxNotificationId,
|
|
8435
|
+
createThreadId,
|
|
8357
8436
|
deleteComment,
|
|
8358
8437
|
deprecate,
|
|
8359
8438
|
deprecateIf,
|
|
@@ -8375,6 +8454,7 @@ export {
|
|
|
8375
8454
|
makePoller,
|
|
8376
8455
|
makePosition,
|
|
8377
8456
|
memoizeOnSuccess,
|
|
8457
|
+
nanoid,
|
|
8378
8458
|
nn,
|
|
8379
8459
|
objectToQuery,
|
|
8380
8460
|
patchLiveObjectKey,
|