@liveblocks/node 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.js +62 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var _core = require('@liveblocks/core');
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/node";
|
|
6
|
-
var PKG_VERSION = "2.8.0
|
|
6
|
+
var PKG_VERSION = "2.8.0";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -15,6 +15,11 @@ var PKG_FORMAT = "cjs";
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
// src/Session.ts
|
|
21
|
+
|
|
22
|
+
|
|
18
23
|
// src/utils.ts
|
|
19
24
|
var DEFAULT_BASE_URL = "https://api.liveblocks.io";
|
|
20
25
|
function getBaseUrl(baseUrl) {
|
|
@@ -53,27 +58,6 @@ function normalizeStatusCode(statusCode) {
|
|
|
53
58
|
return 403;
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
|
-
function toURLSearchParams(params) {
|
|
57
|
-
const result = new URLSearchParams();
|
|
58
|
-
for (const [key, value] of Object.entries(params)) {
|
|
59
|
-
if (value !== void 0 && value !== null) {
|
|
60
|
-
result.set(key, value.toString());
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
function urljoin(baseUrl, path, params) {
|
|
66
|
-
const url2 = new URL(path, baseUrl);
|
|
67
|
-
if (params !== void 0) {
|
|
68
|
-
url2.search = (params instanceof URLSearchParams ? params : toURLSearchParams(params)).toString();
|
|
69
|
-
}
|
|
70
|
-
return url2.toString();
|
|
71
|
-
}
|
|
72
|
-
function url(strings, ...values) {
|
|
73
|
-
return strings.reduce(
|
|
74
|
-
(result, str, i) => result + encodeURIComponent(_nullishCoalesce(values[i - 1], () => ( ""))) + str
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
61
|
|
|
78
62
|
// src/Session.ts
|
|
79
63
|
var ALL_PERMISSIONS = Object.freeze([
|
|
@@ -181,7 +165,7 @@ var Session = class {
|
|
|
181
165
|
);
|
|
182
166
|
}
|
|
183
167
|
try {
|
|
184
|
-
const resp = await this._postFn(url`/v2/authorize-user`, {
|
|
168
|
+
const resp = await this._postFn(_core.url`/v2/authorize-user`, {
|
|
185
169
|
// Required
|
|
186
170
|
userId: this._userId,
|
|
187
171
|
permissions: this.serializePermissions(),
|
|
@@ -216,13 +200,13 @@ var Liveblocks = class {
|
|
|
216
200
|
}
|
|
217
201
|
/** @internal */
|
|
218
202
|
async post(path, json) {
|
|
219
|
-
const
|
|
203
|
+
const url3 = _core.urljoin.call(void 0, this._baseUrl, path);
|
|
220
204
|
const headers = {
|
|
221
205
|
Authorization: `Bearer ${this._secret}`,
|
|
222
206
|
"Content-Type": "application/json"
|
|
223
207
|
};
|
|
224
208
|
const fetch = await fetchPolyfill();
|
|
225
|
-
const res = await fetch(
|
|
209
|
+
const res = await fetch(url3, {
|
|
226
210
|
method: "POST",
|
|
227
211
|
headers,
|
|
228
212
|
body: JSON.stringify(json)
|
|
@@ -231,13 +215,13 @@ var Liveblocks = class {
|
|
|
231
215
|
}
|
|
232
216
|
/** @internal */
|
|
233
217
|
async put(path, json) {
|
|
234
|
-
const
|
|
218
|
+
const url3 = _core.urljoin.call(void 0, this._baseUrl, path);
|
|
235
219
|
const headers = {
|
|
236
220
|
Authorization: `Bearer ${this._secret}`,
|
|
237
221
|
"Content-Type": "application/json"
|
|
238
222
|
};
|
|
239
223
|
const fetch = await fetchPolyfill();
|
|
240
|
-
return await fetch(
|
|
224
|
+
return await fetch(url3, {
|
|
241
225
|
method: "PUT",
|
|
242
226
|
headers,
|
|
243
227
|
body: JSON.stringify(json)
|
|
@@ -245,32 +229,32 @@ var Liveblocks = class {
|
|
|
245
229
|
}
|
|
246
230
|
/** @internal */
|
|
247
231
|
async putBinary(path, body, params) {
|
|
248
|
-
const
|
|
232
|
+
const url3 = _core.urljoin.call(void 0, this._baseUrl, path, params);
|
|
249
233
|
const headers = {
|
|
250
234
|
Authorization: `Bearer ${this._secret}`,
|
|
251
235
|
"Content-Type": "application/octet-stream"
|
|
252
236
|
};
|
|
253
237
|
const fetch = await fetchPolyfill();
|
|
254
|
-
return await fetch(
|
|
238
|
+
return await fetch(url3, { method: "PUT", headers, body });
|
|
255
239
|
}
|
|
256
240
|
/** @internal */
|
|
257
241
|
async delete(path) {
|
|
258
|
-
const
|
|
242
|
+
const url3 = _core.urljoin.call(void 0, this._baseUrl, path);
|
|
259
243
|
const headers = {
|
|
260
244
|
Authorization: `Bearer ${this._secret}`
|
|
261
245
|
};
|
|
262
246
|
const fetch = await fetchPolyfill();
|
|
263
|
-
const res = await fetch(
|
|
247
|
+
const res = await fetch(url3, { method: "DELETE", headers });
|
|
264
248
|
return res;
|
|
265
249
|
}
|
|
266
250
|
/** @internal */
|
|
267
251
|
async get(path, params) {
|
|
268
|
-
const
|
|
252
|
+
const url3 = _core.urljoin.call(void 0, this._baseUrl, path, params);
|
|
269
253
|
const headers = {
|
|
270
254
|
Authorization: `Bearer ${this._secret}`
|
|
271
255
|
};
|
|
272
256
|
const fetch = await fetchPolyfill();
|
|
273
|
-
const res = await fetch(
|
|
257
|
+
const res = await fetch(url3, { method: "GET", headers });
|
|
274
258
|
return res;
|
|
275
259
|
}
|
|
276
260
|
/* -------------------------------------------------------------------------------------------------
|
|
@@ -331,7 +315,7 @@ var Liveblocks = class {
|
|
|
331
315
|
// These fields define the security identity of the user. Whatever you pass in here will define which
|
|
332
316
|
async identifyUser(identity, ...rest) {
|
|
333
317
|
const options = rest[0];
|
|
334
|
-
const path = url`/v2/identify-user`;
|
|
318
|
+
const path = _core.url`/v2/identify-user`;
|
|
335
319
|
const userId = typeof identity === "string" ? identity : identity.userId;
|
|
336
320
|
const groupIds = typeof identity === "string" ? void 0 : identity.groupIds;
|
|
337
321
|
assertNonEmpty(userId, "userId");
|
|
@@ -349,7 +333,7 @@ var Liveblocks = class {
|
|
|
349
333
|
} catch (er) {
|
|
350
334
|
return {
|
|
351
335
|
status: 503,
|
|
352
|
-
body: `Call to ${urljoin(
|
|
336
|
+
body: `Call to ${_core.urljoin.call(void 0,
|
|
353
337
|
this._baseUrl,
|
|
354
338
|
path
|
|
355
339
|
)} failed. See "error" for more information.`,
|
|
@@ -371,7 +355,7 @@ var Liveblocks = class {
|
|
|
371
355
|
* @returns A list of rooms.
|
|
372
356
|
*/
|
|
373
357
|
async getRooms(params = {}) {
|
|
374
|
-
const path = url`/v2/rooms`;
|
|
358
|
+
const path = _core.url`/v2/rooms`;
|
|
375
359
|
let query;
|
|
376
360
|
if (typeof params.query === "string") {
|
|
377
361
|
query = params.query;
|
|
@@ -423,7 +407,7 @@ var Liveblocks = class {
|
|
|
423
407
|
*/
|
|
424
408
|
async createRoom(roomId, params) {
|
|
425
409
|
const { defaultAccesses, groupsAccesses, usersAccesses, metadata } = params;
|
|
426
|
-
const res = await this.post(url`/v2/rooms`, {
|
|
410
|
+
const res = await this.post(_core.url`/v2/rooms`, {
|
|
427
411
|
id: roomId,
|
|
428
412
|
defaultAccesses,
|
|
429
413
|
groupsAccesses,
|
|
@@ -449,7 +433,7 @@ var Liveblocks = class {
|
|
|
449
433
|
* @returns The room with the given id.
|
|
450
434
|
*/
|
|
451
435
|
async getRoom(roomId) {
|
|
452
|
-
const res = await this.get(url`/v2/rooms/${roomId}`);
|
|
436
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}`);
|
|
453
437
|
if (!res.ok) {
|
|
454
438
|
const text = await res.text();
|
|
455
439
|
throw new LiveblocksError(res.status, text);
|
|
@@ -475,7 +459,7 @@ var Liveblocks = class {
|
|
|
475
459
|
*/
|
|
476
460
|
async updateRoom(roomId, params) {
|
|
477
461
|
const { defaultAccesses, groupsAccesses, usersAccesses, metadata } = params;
|
|
478
|
-
const res = await this.post(url`/v2/rooms/${roomId}`, {
|
|
462
|
+
const res = await this.post(_core.url`/v2/rooms/${roomId}`, {
|
|
479
463
|
defaultAccesses,
|
|
480
464
|
groupsAccesses,
|
|
481
465
|
usersAccesses,
|
|
@@ -499,7 +483,7 @@ var Liveblocks = class {
|
|
|
499
483
|
* @param roomId The id of the room to delete.
|
|
500
484
|
*/
|
|
501
485
|
async deleteRoom(roomId) {
|
|
502
|
-
const res = await this.delete(url`/v2/rooms/${roomId}`);
|
|
486
|
+
const res = await this.delete(_core.url`/v2/rooms/${roomId}`);
|
|
503
487
|
if (!res.ok) {
|
|
504
488
|
const text = await res.text();
|
|
505
489
|
throw new LiveblocksError(res.status, text);
|
|
@@ -511,7 +495,7 @@ var Liveblocks = class {
|
|
|
511
495
|
* @returns A list of users currently present in the requested room.
|
|
512
496
|
*/
|
|
513
497
|
async getActiveUsers(roomId) {
|
|
514
|
-
const res = await this.get(url`/v2/rooms/${roomId}/active_users`);
|
|
498
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}/active_users`);
|
|
515
499
|
if (!res.ok) {
|
|
516
500
|
const text = await res.text();
|
|
517
501
|
throw new LiveblocksError(res.status, text);
|
|
@@ -525,7 +509,7 @@ var Liveblocks = class {
|
|
|
525
509
|
*/
|
|
526
510
|
async broadcastEvent(roomId, message) {
|
|
527
511
|
const res = await this.post(
|
|
528
|
-
url`/v2/rooms/${roomId}/broadcast_event`,
|
|
512
|
+
_core.url`/v2/rooms/${roomId}/broadcast_event`,
|
|
529
513
|
message
|
|
530
514
|
);
|
|
531
515
|
if (!res.ok) {
|
|
@@ -534,7 +518,7 @@ var Liveblocks = class {
|
|
|
534
518
|
}
|
|
535
519
|
}
|
|
536
520
|
async getStorageDocument(roomId, format = "plain-lson") {
|
|
537
|
-
const res = await this.get(url`/v2/rooms/${roomId}/storage`, { format });
|
|
521
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}/storage`, { format });
|
|
538
522
|
if (!res.ok) {
|
|
539
523
|
const text = await res.text();
|
|
540
524
|
throw new LiveblocksError(res.status, text);
|
|
@@ -550,7 +534,7 @@ var Liveblocks = class {
|
|
|
550
534
|
* @returns The initialized storage document. It is of the same format as the one passed in.
|
|
551
535
|
*/
|
|
552
536
|
async initializeStorageDocument(roomId, document) {
|
|
553
|
-
const res = await this.post(url`/v2/rooms/${roomId}/storage`, document);
|
|
537
|
+
const res = await this.post(_core.url`/v2/rooms/${roomId}/storage`, document);
|
|
554
538
|
if (!res.ok) {
|
|
555
539
|
const text = await res.text();
|
|
556
540
|
throw new LiveblocksError(res.status, text);
|
|
@@ -562,7 +546,7 @@ var Liveblocks = class {
|
|
|
562
546
|
* @param roomId The id of the room to delete the storage from.
|
|
563
547
|
*/
|
|
564
548
|
async deleteStorageDocument(roomId) {
|
|
565
|
-
const res = await this.delete(url`/v2/rooms/${roomId}/storage`);
|
|
549
|
+
const res = await this.delete(_core.url`/v2/rooms/${roomId}/storage`);
|
|
566
550
|
if (!res.ok) {
|
|
567
551
|
const text = await res.text();
|
|
568
552
|
throw new LiveblocksError(res.status, text);
|
|
@@ -581,7 +565,7 @@ var Liveblocks = class {
|
|
|
581
565
|
*/
|
|
582
566
|
async getYjsDocument(roomId, params = {}) {
|
|
583
567
|
const { format, key, type } = params;
|
|
584
|
-
const path = url`v2/rooms/${roomId}/ydoc`;
|
|
568
|
+
const path = _core.url`v2/rooms/${roomId}/ydoc`;
|
|
585
569
|
const res = await this.get(path, {
|
|
586
570
|
formatting: format ? "true" : void 0,
|
|
587
571
|
key,
|
|
@@ -600,7 +584,7 @@ var Liveblocks = class {
|
|
|
600
584
|
* @param params.guid (optional) If provided, the binary update will be applied to the Yjs subdocument with the given guid. If not provided, the binary update will be applied to the root Yjs document.
|
|
601
585
|
*/
|
|
602
586
|
async sendYjsBinaryUpdate(roomId, update, params = {}) {
|
|
603
|
-
const res = await this.putBinary(url`/v2/rooms/${roomId}/ydoc`, update, {
|
|
587
|
+
const res = await this.putBinary(_core.url`/v2/rooms/${roomId}/ydoc`, update, {
|
|
604
588
|
guid: params.guid
|
|
605
589
|
});
|
|
606
590
|
if (!res.ok) {
|
|
@@ -616,7 +600,7 @@ var Liveblocks = class {
|
|
|
616
600
|
* @returns The room’s Yjs document encoded as a single binary update.
|
|
617
601
|
*/
|
|
618
602
|
async getYjsDocumentAsBinaryUpdate(roomId, params = {}) {
|
|
619
|
-
const res = await this.get(url`/v2/rooms/${roomId}/ydoc-binary`, {
|
|
603
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}/ydoc-binary`, {
|
|
620
604
|
guid: params.guid
|
|
621
605
|
});
|
|
622
606
|
if (!res.ok) {
|
|
@@ -635,7 +619,7 @@ var Liveblocks = class {
|
|
|
635
619
|
* @returns The created schema.
|
|
636
620
|
*/
|
|
637
621
|
async createSchema(name, body) {
|
|
638
|
-
const res = await this.post(url`/v2/schemas`, {
|
|
622
|
+
const res = await this.post(_core.url`/v2/schemas`, {
|
|
639
623
|
name,
|
|
640
624
|
body
|
|
641
625
|
});
|
|
@@ -658,7 +642,7 @@ var Liveblocks = class {
|
|
|
658
642
|
* @returns The schema with the given id.
|
|
659
643
|
*/
|
|
660
644
|
async getSchema(schemaId) {
|
|
661
|
-
const res = await this.get(url`/v2/schemas/${schemaId}`);
|
|
645
|
+
const res = await this.get(_core.url`/v2/schemas/${schemaId}`);
|
|
662
646
|
if (!res.ok) {
|
|
663
647
|
const text = await res.text();
|
|
664
648
|
throw new LiveblocksError(res.status, text);
|
|
@@ -679,7 +663,7 @@ var Liveblocks = class {
|
|
|
679
663
|
* @returns The updated schema. The version of the schema will be incremented.
|
|
680
664
|
*/
|
|
681
665
|
async updateSchema(schemaId, body) {
|
|
682
|
-
const res = await this.put(url`/v2/schemas/${schemaId}`, {
|
|
666
|
+
const res = await this.put(_core.url`/v2/schemas/${schemaId}`, {
|
|
683
667
|
body
|
|
684
668
|
});
|
|
685
669
|
if (!res.ok) {
|
|
@@ -700,7 +684,7 @@ var Liveblocks = class {
|
|
|
700
684
|
* @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`.
|
|
701
685
|
*/
|
|
702
686
|
async deleteSchema(schemaId) {
|
|
703
|
-
const res = await this.delete(url`/v2/schemas/${schemaId}`);
|
|
687
|
+
const res = await this.delete(_core.url`/v2/schemas/${schemaId}`);
|
|
704
688
|
if (!res.ok) {
|
|
705
689
|
const text = await res.text();
|
|
706
690
|
throw new LiveblocksError(res.status, text);
|
|
@@ -712,7 +696,7 @@ var Liveblocks = class {
|
|
|
712
696
|
* @returns
|
|
713
697
|
*/
|
|
714
698
|
async getSchemaByRoomId(roomId) {
|
|
715
|
-
const res = await this.get(url`/v2/rooms/${roomId}/schema`);
|
|
699
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}/schema`);
|
|
716
700
|
if (!res.ok) {
|
|
717
701
|
const text = await res.text();
|
|
718
702
|
throw new LiveblocksError(res.status, text);
|
|
@@ -734,7 +718,7 @@ var Liveblocks = class {
|
|
|
734
718
|
* @returns The schema id as JSON.
|
|
735
719
|
*/
|
|
736
720
|
async attachSchemaToRoom(roomId, schemaId) {
|
|
737
|
-
const res = await this.post(url`/v2/rooms/${roomId}/schema`, {
|
|
721
|
+
const res = await this.post(_core.url`/v2/rooms/${roomId}/schema`, {
|
|
738
722
|
schema: schemaId
|
|
739
723
|
});
|
|
740
724
|
if (!res.ok) {
|
|
@@ -748,7 +732,7 @@ var Liveblocks = class {
|
|
|
748
732
|
* @param roomId The id of the room to detach the schema from.
|
|
749
733
|
*/
|
|
750
734
|
async detachSchemaFromRoom(roomId) {
|
|
751
|
-
const res = await this.delete(url`/v2/rooms/${roomId}/schema`);
|
|
735
|
+
const res = await this.delete(_core.url`/v2/rooms/${roomId}/schema`);
|
|
752
736
|
if (!res.ok) {
|
|
753
737
|
const text = await res.text();
|
|
754
738
|
throw new LiveblocksError(res.status, text);
|
|
@@ -772,7 +756,7 @@ var Liveblocks = class {
|
|
|
772
756
|
} else if (typeof params.query === "object") {
|
|
773
757
|
query = _core.objectToQuery.call(void 0, params.query);
|
|
774
758
|
}
|
|
775
|
-
const res = await this.get(url`/v2/rooms/${roomId}/threads`, {
|
|
759
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}/threads`, {
|
|
776
760
|
query
|
|
777
761
|
});
|
|
778
762
|
if (!res.ok) {
|
|
@@ -793,7 +777,7 @@ var Liveblocks = class {
|
|
|
793
777
|
*/
|
|
794
778
|
async getThread(params) {
|
|
795
779
|
const { roomId, threadId } = params;
|
|
796
|
-
const res = await this.get(url`/v2/rooms/${roomId}/threads/${threadId}`);
|
|
780
|
+
const res = await this.get(_core.url`/v2/rooms/${roomId}/threads/${threadId}`);
|
|
797
781
|
if (!res.ok) {
|
|
798
782
|
const text = await res.text();
|
|
799
783
|
throw new LiveblocksError(res.status, text);
|
|
@@ -813,7 +797,7 @@ var Liveblocks = class {
|
|
|
813
797
|
async getThreadParticipants(params) {
|
|
814
798
|
const { roomId, threadId } = params;
|
|
815
799
|
const res = await this.get(
|
|
816
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/participants`
|
|
800
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/participants`
|
|
817
801
|
);
|
|
818
802
|
if (!res.ok) {
|
|
819
803
|
const text = await res.text();
|
|
@@ -832,7 +816,7 @@ var Liveblocks = class {
|
|
|
832
816
|
async getComment(params) {
|
|
833
817
|
const { roomId, threadId, commentId } = params;
|
|
834
818
|
const res = await this.get(
|
|
835
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
|
|
819
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
|
|
836
820
|
);
|
|
837
821
|
if (!res.ok) {
|
|
838
822
|
const text = await res.text();
|
|
@@ -853,7 +837,7 @@ var Liveblocks = class {
|
|
|
853
837
|
async createComment(params) {
|
|
854
838
|
const { roomId, threadId, data } = params;
|
|
855
839
|
const res = await this.post(
|
|
856
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
|
|
840
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
|
|
857
841
|
{
|
|
858
842
|
...data,
|
|
859
843
|
createdAt: _optionalChain([data, 'access', _3 => _3.createdAt, 'optionalAccess', _4 => _4.toISOString, 'call', _5 => _5()])
|
|
@@ -877,7 +861,7 @@ var Liveblocks = class {
|
|
|
877
861
|
async editComment(params) {
|
|
878
862
|
const { roomId, threadId, commentId, data } = params;
|
|
879
863
|
const res = await this.post(
|
|
880
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
864
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
881
865
|
{
|
|
882
866
|
...data,
|
|
883
867
|
editedAt: _optionalChain([data, 'access', _6 => _6.editedAt, 'optionalAccess', _7 => _7.toISOString, 'call', _8 => _8()])
|
|
@@ -898,7 +882,7 @@ var Liveblocks = class {
|
|
|
898
882
|
async deleteComment(params) {
|
|
899
883
|
const { roomId, threadId, commentId } = params;
|
|
900
884
|
const res = await this.delete(
|
|
901
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
|
|
885
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
|
|
902
886
|
);
|
|
903
887
|
if (!res.ok) {
|
|
904
888
|
const text = await res.text();
|
|
@@ -917,7 +901,7 @@ var Liveblocks = class {
|
|
|
917
901
|
*/
|
|
918
902
|
async createThread(params) {
|
|
919
903
|
const { roomId, data } = params;
|
|
920
|
-
const res = await this.post(url`/v2/rooms/${roomId}/threads`, {
|
|
904
|
+
const res = await this.post(_core.url`/v2/rooms/${roomId}/threads`, {
|
|
921
905
|
...data,
|
|
922
906
|
comment: {
|
|
923
907
|
...data.comment,
|
|
@@ -937,7 +921,7 @@ var Liveblocks = class {
|
|
|
937
921
|
*/
|
|
938
922
|
async deleteThread(params) {
|
|
939
923
|
const { roomId, threadId } = params;
|
|
940
|
-
const res = await this.delete(url`/v2/rooms/${roomId}/threads/${threadId}`);
|
|
924
|
+
const res = await this.delete(_core.url`/v2/rooms/${roomId}/threads/${threadId}`);
|
|
941
925
|
if (!res.ok) {
|
|
942
926
|
const text = await res.text();
|
|
943
927
|
throw new LiveblocksError(res.status, text);
|
|
@@ -953,7 +937,7 @@ var Liveblocks = class {
|
|
|
953
937
|
async markThreadAsResolved(params) {
|
|
954
938
|
const { roomId, threadId } = params;
|
|
955
939
|
const res = await this.post(
|
|
956
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-resolved`,
|
|
940
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-resolved`,
|
|
957
941
|
{}
|
|
958
942
|
);
|
|
959
943
|
if (!res.ok) {
|
|
@@ -972,7 +956,7 @@ var Liveblocks = class {
|
|
|
972
956
|
async markThreadAsUnresolved(params) {
|
|
973
957
|
const { roomId, threadId } = params;
|
|
974
958
|
const res = await this.post(
|
|
975
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-unresolved`,
|
|
959
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-unresolved`,
|
|
976
960
|
{}
|
|
977
961
|
);
|
|
978
962
|
if (!res.ok) {
|
|
@@ -993,7 +977,7 @@ var Liveblocks = class {
|
|
|
993
977
|
async editThreadMetadata(params) {
|
|
994
978
|
const { roomId, threadId, data } = params;
|
|
995
979
|
const res = await this.post(
|
|
996
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
|
|
980
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
|
|
997
981
|
{
|
|
998
982
|
...data,
|
|
999
983
|
updatedAt: _optionalChain([data, 'access', _13 => _13.updatedAt, 'optionalAccess', _14 => _14.toISOString, 'call', _15 => _15()])
|
|
@@ -1018,7 +1002,7 @@ var Liveblocks = class {
|
|
|
1018
1002
|
async addCommentReaction(params) {
|
|
1019
1003
|
const { roomId, threadId, commentId, data } = params;
|
|
1020
1004
|
const res = await this.post(
|
|
1021
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
|
|
1005
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
|
|
1022
1006
|
{
|
|
1023
1007
|
...data,
|
|
1024
1008
|
createdAt: _optionalChain([data, 'access', _16 => _16.createdAt, 'optionalAccess', _17 => _17.toISOString, 'call', _18 => _18()])
|
|
@@ -1043,7 +1027,7 @@ var Liveblocks = class {
|
|
|
1043
1027
|
async removeCommentReaction(params) {
|
|
1044
1028
|
const { roomId, threadId, data } = params;
|
|
1045
1029
|
const res = await this.post(
|
|
1046
|
-
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
|
|
1030
|
+
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
|
|
1047
1031
|
{
|
|
1048
1032
|
...data,
|
|
1049
1033
|
removedAt: _optionalChain([data, 'access', _19 => _19.removedAt, 'optionalAccess', _20 => _20.toISOString, 'call', _21 => _21()])
|
|
@@ -1062,7 +1046,7 @@ var Liveblocks = class {
|
|
|
1062
1046
|
async getInboxNotification(params) {
|
|
1063
1047
|
const { userId, inboxNotificationId } = params;
|
|
1064
1048
|
const res = await this.get(
|
|
1065
|
-
url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
|
|
1049
|
+
_core.url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
|
|
1066
1050
|
);
|
|
1067
1051
|
if (!res.ok) {
|
|
1068
1052
|
const text = await res.text();
|
|
@@ -1085,7 +1069,7 @@ var Liveblocks = class {
|
|
|
1085
1069
|
} else if (typeof params.query === "object") {
|
|
1086
1070
|
query = _core.objectToQuery.call(void 0, params.query);
|
|
1087
1071
|
}
|
|
1088
|
-
const res = await this.get(url`/v2/users/${userId}/inbox-notifications`, {
|
|
1072
|
+
const res = await this.get(_core.url`/v2/users/${userId}/inbox-notifications`, {
|
|
1089
1073
|
query
|
|
1090
1074
|
});
|
|
1091
1075
|
if (!res.ok) {
|
|
@@ -1105,7 +1089,7 @@ var Liveblocks = class {
|
|
|
1105
1089
|
async getRoomNotificationSettings(params) {
|
|
1106
1090
|
const { userId, roomId } = params;
|
|
1107
1091
|
const res = await this.get(
|
|
1108
|
-
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
|
|
1092
|
+
_core.url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
|
|
1109
1093
|
);
|
|
1110
1094
|
if (!res.ok) {
|
|
1111
1095
|
const text = await res.text();
|
|
@@ -1122,7 +1106,7 @@ var Liveblocks = class {
|
|
|
1122
1106
|
async updateRoomNotificationSettings(params) {
|
|
1123
1107
|
const { userId, roomId, data } = params;
|
|
1124
1108
|
const res = await this.post(
|
|
1125
|
-
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`,
|
|
1109
|
+
_core.url`/v2/rooms/${roomId}/users/${userId}/notification-settings`,
|
|
1126
1110
|
data
|
|
1127
1111
|
);
|
|
1128
1112
|
if (!res.ok) {
|
|
@@ -1139,7 +1123,7 @@ var Liveblocks = class {
|
|
|
1139
1123
|
async deleteRoomNotificationSettings(params) {
|
|
1140
1124
|
const { userId, roomId } = params;
|
|
1141
1125
|
const res = await this.delete(
|
|
1142
|
-
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
|
|
1126
|
+
_core.url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
|
|
1143
1127
|
);
|
|
1144
1128
|
if (!res.ok) {
|
|
1145
1129
|
const text = await res.text();
|
|
@@ -1154,7 +1138,7 @@ var Liveblocks = class {
|
|
|
1154
1138
|
async updateRoomId(params) {
|
|
1155
1139
|
const { currentRoomId, newRoomId } = params;
|
|
1156
1140
|
const res = await this.post(
|
|
1157
|
-
url`/v2/rooms/${currentRoomId}/update-room-id`,
|
|
1141
|
+
_core.url`/v2/rooms/${currentRoomId}/update-room-id`,
|
|
1158
1142
|
{
|
|
1159
1143
|
newRoomId
|
|
1160
1144
|
}
|
|
@@ -1171,7 +1155,7 @@ var Liveblocks = class {
|
|
|
1171
1155
|
};
|
|
1172
1156
|
}
|
|
1173
1157
|
async triggerInboxNotification(params) {
|
|
1174
|
-
const res = await this.post(url`/v2/inbox-notifications/trigger`, params);
|
|
1158
|
+
const res = await this.post(_core.url`/v2/inbox-notifications/trigger`, params);
|
|
1175
1159
|
if (!res.ok) {
|
|
1176
1160
|
const text = await res.text();
|
|
1177
1161
|
throw new LiveblocksError(res.status, text);
|
|
@@ -1185,7 +1169,7 @@ var Liveblocks = class {
|
|
|
1185
1169
|
async deleteInboxNotification(params) {
|
|
1186
1170
|
const { userId, inboxNotificationId } = params;
|
|
1187
1171
|
const res = await this.delete(
|
|
1188
|
-
url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
|
|
1172
|
+
_core.url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
|
|
1189
1173
|
);
|
|
1190
1174
|
if (!res.ok) {
|
|
1191
1175
|
const text = await res.text();
|
|
@@ -1198,7 +1182,7 @@ var Liveblocks = class {
|
|
|
1198
1182
|
*/
|
|
1199
1183
|
async deleteAllInboxNotifications(params) {
|
|
1200
1184
|
const { userId } = params;
|
|
1201
|
-
const res = await this.delete(url`/v2/users/${userId}/inbox-notifications`);
|
|
1185
|
+
const res = await this.delete(_core.url`/v2/users/${userId}/inbox-notifications`);
|
|
1202
1186
|
if (!res.ok) {
|
|
1203
1187
|
const text = await res.text();
|
|
1204
1188
|
throw new LiveblocksError(res.status, text);
|