@liveblocks/node 2.18.4-uns2 → 2.20.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.ts CHANGED
@@ -58,7 +58,14 @@ declare class Session {
58
58
  * @liveblocks/core has browser-specific code.
59
59
  */
60
60
 
61
- type ToSimplifiedJson<S extends LsonObject> = LsonObject extends S ? JsonObject : ToImmutable<S>;
61
+ type SerializeMaps<T> = T extends ReadonlyMap<infer K, infer V> ? K extends string ? {
62
+ readonly [P in K]: SerializeMaps<V>;
63
+ } : {
64
+ readonly [key: string]: SerializeMaps<V>;
65
+ } : T extends object ? {
66
+ readonly [P in keyof T]: SerializeMaps<T[P]>;
67
+ } : T;
68
+ type ToSimplifiedJson<S extends LsonObject> = LsonObject extends S ? JsonObject : SerializeMaps<ToImmutable<S>>;
62
69
  type LiveblocksOptions = {
63
70
  /**
64
71
  * The Liveblocks secret key. Must start with "sk_".
@@ -130,6 +137,9 @@ type E = DE;
130
137
  type M = DM;
131
138
  type S = DS;
132
139
  type U = DU;
140
+ type RequestOptions = {
141
+ signal?: AbortSignal;
142
+ };
133
143
  /**
134
144
  * Interact with the Liveblocks API from your Node.js backend.
135
145
  */
@@ -201,6 +211,7 @@ declare class Liveblocks {
201
211
  * @param params.metadata (optional) A filter on metadata. Multiple metadata keys can be used to filter rooms.
202
212
  * @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used.
203
213
  * @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID.
214
+ * @param options.signal (optional) An abort signal to cancel the request.
204
215
  * @returns A list of rooms.
205
216
  */
206
217
  getRooms(params?: {
@@ -241,7 +252,7 @@ declare class Liveblocks {
241
252
  startsWith: string;
242
253
  };
243
254
  };
244
- }): Promise<{
255
+ }, options?: RequestOptions): Promise<{
245
256
  nextPage: string | null;
246
257
  nextCursor: string | null;
247
258
  data: RoomData[];
@@ -253,6 +264,7 @@ declare class Liveblocks {
253
264
  * @param params.groupsAccesses (optional) The group accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters.
254
265
  * @param params.usersAccesses (optional) The user accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters.
255
266
  * @param params.metadata (optional) The metadata for the room. Supports upto a maximum of 50 entries. Key length has a limit of 40 characters. Value length has a limit of 256 characters.
267
+ * @param options.signal (optional) An abort signal to cancel the request.
256
268
  * @returns The created room.
257
269
  */
258
270
  createRoom(roomId: string, params: {
@@ -260,13 +272,14 @@ declare class Liveblocks {
260
272
  groupsAccesses?: RoomAccesses;
261
273
  usersAccesses?: RoomAccesses;
262
274
  metadata?: RoomMetadata;
263
- }): Promise<RoomData>;
275
+ }, options?: RequestOptions): Promise<RoomData>;
264
276
  /**
265
277
  * Returns a room with the given id.
266
278
  * @param roomId The id of the room to return.
267
279
  * @returns The room with the given id.
280
+ * @param options.signal (optional) An abort signal to cancel the request.
268
281
  */
269
- getRoom(roomId: string): Promise<RoomData>;
282
+ getRoom(roomId: string, options?: RequestOptions): Promise<RoomData>;
270
283
  /**
271
284
  * Updates specific properties of a room. It’s not necessary to provide the entire room’s information.
272
285
  * Setting a property to `null` means to delete this property.
@@ -275,6 +288,7 @@ declare class Liveblocks {
275
288
  * @param params.groupsAccesses (optional) The group accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters.
276
289
  * @param params.usersAccesses (optional) The user accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters.
277
290
  * @param params.metadata (optional) The metadata for the room. Supports upto a maximum of 50 entries. Key length has a limit of 40 characters. Value length has a limit of 256 characters.
291
+ * @param options.signal (optional) An abort signal to cancel the request.
278
292
  * @returns The updated room.
279
293
  */
280
294
  updateRoom(roomId: string, params: {
@@ -286,26 +300,29 @@ declare class Liveblocks {
286
300
  "room:write"
287
301
  ] | ["room:read", "room:presence:write"] | null>;
288
302
  metadata?: Record<string, string | string[] | null>;
289
- }): Promise<RoomData>;
303
+ }, options?: RequestOptions): Promise<RoomData>;
290
304
  /**
291
305
  * Deletes a room with the given id. A deleted room is no longer accessible from the API or the dashboard and it cannot be restored.
292
306
  * @param roomId The id of the room to delete.
307
+ * @param options.signal (optional) An abort signal to cancel the request.
293
308
  */
294
- deleteRoom(roomId: string): Promise<void>;
309
+ deleteRoom(roomId: string, options?: RequestOptions): Promise<void>;
295
310
  /**
296
311
  * Returns a list of users currently present in the requested room. For better performance, we recommand to call this endpoint every 10 seconds maximum. Duplicates can happen if a user is in the requested room with multiple browser tabs opened.
297
312
  * @param roomId The id of the room to get the users from.
313
+ * @param options.signal (optional) An abort signal to cancel the request.
298
314
  * @returns A list of users currently present in the requested room.
299
315
  */
300
- getActiveUsers(roomId: string): Promise<{
316
+ getActiveUsers(roomId: string, options?: RequestOptions): Promise<{
301
317
  data: RoomUser<U>[];
302
318
  }>;
303
319
  /**
304
320
  * Boadcasts an event to a room without having to connect to it via the client from @liveblocks/client. The connectionId passed to event listeners is -1 when using this API.
305
321
  * @param roomId The id of the room to broadcast the event to.
306
322
  * @param message The message to broadcast. It can be any JSON serializable value.
323
+ * @param options.signal (optional) An abort signal to cancel the request.
307
324
  */
308
- broadcastEvent(roomId: string, message: E): Promise<void>;
325
+ broadcastEvent(roomId: string, message: E, options?: RequestOptions): Promise<void>;
309
326
  /**
310
327
  * Returns the contents of the room’s Storage tree.
311
328
  * The default outputted format is called “plain LSON”, which includes information on the Live data structures in the tree.
@@ -322,108 +339,122 @@ declare class Liveblocks {
322
339
  *
323
340
  * @param roomId The id of the room to get the storage from.
324
341
  * @param format (optional) Set to return `plan-lson` representation by default. If set to `json`, the output will be formatted as a simplified JSON representation of the Storage tree.
342
+ * @param options.signal (optional) An abort signal to cancel the request.
325
343
  * In that format, each LiveObject and LiveMap will be formatted as a simple JSON object, and each LiveList will be formatted as a simple JSON array. This is a lossy format because information about the original data structures is not retained, but it may be easier to work with.
326
344
  */
327
- getStorageDocument(roomId: string, format: "plain-lson"): Promise<PlainLsonObject>;
345
+ getStorageDocument(roomId: string, format: "plain-lson", options?: RequestOptions): Promise<PlainLsonObject>;
328
346
  getStorageDocument(roomId: string): Promise<PlainLsonObject>;
329
- getStorageDocument(roomId: string, format: "json"): Promise<ToSimplifiedJson<S>>;
347
+ getStorageDocument(roomId: string, format: "json", options?: RequestOptions): Promise<ToSimplifiedJson<S>>;
330
348
  /**
331
349
  * Initializes a room’s Storage. The room must already exist and have an empty Storage.
332
350
  * Calling this endpoint will disconnect all users from the room if there are any.
333
351
  *
334
352
  * @param roomId The id of the room to initialize the storage from.
335
353
  * @param document The document to initialize the storage with.
354
+ * @param options.signal (optional) An abort signal to cancel the request.
336
355
  * @returns The initialized storage document. It is of the same format as the one passed in.
337
356
  */
338
- initializeStorageDocument(roomId: string, document: PlainLsonObject): Promise<PlainLsonObject>;
357
+ initializeStorageDocument(roomId: string, document: PlainLsonObject, options?: RequestOptions): Promise<PlainLsonObject>;
339
358
  /**
340
359
  * Deletes all of the room’s Storage data and disconnect all users from the room if there are any. Note that this does not delete the Yjs document in the room if one exists.
341
360
  * @param roomId The id of the room to delete the storage from.
361
+ * @param options.signal (optional) An abort signal to cancel the request.
342
362
  */
343
- deleteStorageDocument(roomId: string): Promise<void>;
363
+ deleteStorageDocument(roomId: string, options?: RequestOptions): Promise<void>;
344
364
  /**
345
365
  * Returns a JSON representation of the room’s Yjs document.
346
366
  * @param roomId The id of the room to get the Yjs document from.
347
367
  * @param params.format (optional) If true, YText will return formatting.
348
368
  * @param params.key (optional) If provided, returns only a single key’s value, e.g. doc.get(key).toJSON().
349
369
  * @param params.type (optional) Used with key to override the inferred type, i.e. "ymap" will return doc.get(key, Y.Map).
370
+ * @param options.signal (optional) An abort signal to cancel the request.
350
371
  * @returns A JSON representation of the room’s Yjs document.
351
372
  */
352
373
  getYjsDocument(roomId: string, params?: {
353
374
  format?: boolean;
354
375
  key?: string;
355
376
  type?: string;
356
- }): Promise<JsonObject>;
377
+ }, options?: RequestOptions): Promise<JsonObject>;
357
378
  /**
358
379
  * Send a Yjs binary update to the room’s Yjs document. You can use this endpoint to initialize Yjs data for the room or to update the room’s Yjs document.
359
380
  * @param roomId The id of the room to send the Yjs binary update to.
360
381
  * @param update The Yjs update to send. Typically the result of calling `Yjs.encodeStateAsUpdate(doc)`. Read the [Yjs documentation](https://docs.yjs.dev/api/document-updates) to learn how to create a binary update.
361
382
  * @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.
383
+ * @param options.signal (optional) An abort signal to cancel the request.
362
384
  */
363
385
  sendYjsBinaryUpdate(roomId: string, update: Uint8Array, params?: {
364
386
  guid?: string;
365
- }): Promise<void>;
387
+ }, options?: RequestOptions): Promise<void>;
366
388
  /**
367
389
  * Returns the room’s Yjs document encoded as a single binary update. This can be used by Y.applyUpdate(responseBody) to get a copy of the document in your backend.
368
390
  * See [Yjs documentation](https://docs.yjs.dev/api/document-updates) for more information on working with updates.
369
391
  * @param roomId The id of the room to get the Yjs document from.
370
392
  * @param params.guid (optional) If provided, returns the binary update of the Yjs subdocument with the given guid. If not provided, returns the binary update of the root Yjs document.
393
+ * @param options.signal (optional) An abort signal to cancel the request.
371
394
  * @returns The room’s Yjs document encoded as a single binary update.
372
395
  */
373
396
  getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
374
397
  guid?: string;
375
- }): Promise<ArrayBuffer>;
398
+ }, options?: RequestOptions): Promise<ArrayBuffer>;
376
399
  /**
377
400
  * Creates a new schema which can be referenced later to enforce a room’s Storage data structure.
378
401
  * @param name The name used to reference the schema. Must be a non-empty string with less than 65 characters and only contain lowercase letters, numbers and dashes
379
402
  * @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
403
+ * @param options.signal (optional) An abort signal to cancel the request.
380
404
  * @returns The created schema.
381
405
  */
382
- createSchema(name: string, body: string): Promise<Schema>;
406
+ createSchema(name: string, body: string, options?: RequestOptions): Promise<Schema>;
383
407
  /**
384
408
  * Returns a schema by its id.
385
409
  * @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`.
410
+ * @param options.signal (optional) An abort signal to cancel the request.
386
411
  * @returns The schema with the given id.
387
412
  */
388
- getSchema(schemaId: string): Promise<Schema>;
413
+ getSchema(schemaId: string, options?: RequestOptions): Promise<Schema>;
389
414
  /**
390
415
  * Updates the body for the schema. A schema can only be updated if it is not used by any room.
391
416
  * @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`.
392
417
  * @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax).
418
+ * @param options.signal (optional) An abort signal to cancel the request.
393
419
  * @returns The updated schema. The version of the schema will be incremented.
394
420
  */
395
- updateSchema(schemaId: string, body: string): Promise<Schema>;
421
+ updateSchema(schemaId: string, body: string, options?: RequestOptions): Promise<Schema>;
396
422
  /**
397
423
  * Deletes a schema by its id. A schema can only be deleted if it is not used by any room.
398
424
  * @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`.
425
+ * @param options.signal (optional) An abort signal to cancel the request.
399
426
  */
400
- deleteSchema(schemaId: string): Promise<void>;
427
+ deleteSchema(schemaId: string, options?: RequestOptions): Promise<void>;
401
428
  /**
402
429
  * Returns the schema attached to a room.
403
430
  * @param roomId The id of the room to get the schema from.
431
+ * @param options.signal (optional) An abort signal to cancel the request.
404
432
  * @returns
405
433
  */
406
- getSchemaByRoomId(roomId: string): Promise<Schema>;
434
+ getSchemaByRoomId(roomId: string, options?: RequestOptions): Promise<Schema>;
407
435
  /**
408
436
  * Attaches a schema to a room, and instantly enables runtime schema validation for the room.
409
437
  * If the current contents of the room’s Storage do not match the schema, attaching will fail and the error message will give details on why the schema failed to attach.
410
438
  * @param roomId The id of the room to attach the schema to.
411
439
  * @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`.
440
+ * @param options.signal (optional) An abort signal to cancel the request.
412
441
  * @returns The schema id as JSON.
413
442
  */
414
- attachSchemaToRoom(roomId: string, schemaId: string): Promise<{
443
+ attachSchemaToRoom(roomId: string, schemaId: string, options?: RequestOptions): Promise<{
415
444
  schema: string;
416
445
  }>;
417
446
  /**
418
447
  * Detaches a schema from a room, and disables runtime schema validation for the room.
419
448
  * @param roomId The id of the room to detach the schema from.
449
+ * @param options.signal (optional) An abort signal to cancel the request.
420
450
  */
421
- detachSchemaFromRoom(roomId: string): Promise<void>;
451
+ detachSchemaFromRoom(roomId: string, options?: RequestOptions): Promise<void>;
422
452
  /**
423
453
  * Gets all the threads in a room.
424
454
  *
425
455
  * @param params.roomId The room ID to get the threads from.
426
456
  * @param params.query The query to filter threads by. It is based on our query language and can filter by metadata.
457
+ * @param options.signal (optional) An abort signal to cancel the request.
427
458
  * @returns A list of threads.
428
459
  */
429
460
  getThreads(params: {
@@ -458,7 +489,7 @@ declare class Liveblocks {
458
489
  metadata?: Partial<QueryMetadata<M>>;
459
490
  resolved?: boolean;
460
491
  };
461
- }): Promise<{
492
+ }, options?: RequestOptions): Promise<{
462
493
  data: ThreadData<M>[];
463
494
  }>;
464
495
  /**
@@ -466,12 +497,13 @@ declare class Liveblocks {
466
497
  *
467
498
  * @param params.roomId The room ID to get the thread from.
468
499
  * @param params.threadId The thread ID.
500
+ * @param options.signal (optional) An abort signal to cancel the request.
469
501
  * @returns A thread.
470
502
  */
471
503
  getThread(params: {
472
504
  roomId: string;
473
505
  threadId: string;
474
- }): Promise<ThreadData<M>>;
506
+ }, options?: RequestOptions): Promise<ThreadData<M>>;
475
507
  /**
476
508
  * Gets a thread's participants.
477
509
  *
@@ -480,25 +512,27 @@ declare class Liveblocks {
480
512
  *
481
513
  * @param params.roomId The room ID to get the thread participants from.
482
514
  * @param params.threadId The thread ID to get the participants from.
515
+ * @param options.signal (optional) An abort signal to cancel the request.
483
516
  * @returns An object containing an array of participant IDs.
484
517
  */
485
518
  getThreadParticipants(params: {
486
519
  roomId: string;
487
520
  threadId: string;
488
- }): Promise<ThreadParticipants>;
521
+ }, options?: RequestOptions): Promise<ThreadParticipants>;
489
522
  /**
490
523
  * Gets a thread's comment.
491
524
  *
492
525
  * @param params.roomId The room ID to get the comment from.
493
526
  * @param params.threadId The thread ID to get the comment from.
494
527
  * @param params.commentId The comment ID.
528
+ * @param options.signal (optional) An abort signal to cancel the request.
495
529
  * @returns A comment.
496
530
  */
497
531
  getComment(params: {
498
532
  roomId: string;
499
533
  threadId: string;
500
534
  commentId: string;
501
- }): Promise<CommentData>;
535
+ }, options?: RequestOptions): Promise<CommentData>;
502
536
  /**
503
537
  * Creates a comment.
504
538
  *
@@ -507,6 +541,7 @@ declare class Liveblocks {
507
541
  * @param params.data.userId The user ID of the user who is set to create the comment.
508
542
  * @param params.data.createdAt (optional) The date the comment is set to be created.
509
543
  * @param params.data.body The body of the comment.
544
+ * @param options.signal (optional) An abort signal to cancel the request.
510
545
  * @returns The created comment.
511
546
  */
512
547
  createComment(params: {
@@ -517,7 +552,7 @@ declare class Liveblocks {
517
552
  createdAt?: Date;
518
553
  body: CommentBody;
519
554
  };
520
- }): Promise<CommentData>;
555
+ }, options?: RequestOptions): Promise<CommentData>;
521
556
  /**
522
557
  * Edits a comment.
523
558
  * @param params.roomId The room ID to edit the comment in.
@@ -525,6 +560,7 @@ declare class Liveblocks {
525
560
  * @param params.commentId The comment ID to edit.
526
561
  * @param params.data.body The body of the comment.
527
562
  * @param params.data.editedAt (optional) The date the comment was edited.
563
+ * @param options.signal (optional) An abort signal to cancel the request.
528
564
  * @returns The edited comment.
529
565
  */
530
566
  editComment(params: {
@@ -535,18 +571,19 @@ declare class Liveblocks {
535
571
  body: CommentBody;
536
572
  editedAt?: Date;
537
573
  };
538
- }): Promise<CommentData>;
574
+ }, options?: RequestOptions): Promise<CommentData>;
539
575
  /**
540
576
  * Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
541
577
  * @param params.roomId The room ID to delete the comment in.
542
578
  * @param params.threadId The thread ID to delete the comment in.
543
579
  * @param params.commentId The comment ID to delete.
580
+ * @param options.signal (optional) An abort signal to cancel the request.
544
581
  */
545
582
  deleteComment(params: {
546
583
  roomId: string;
547
584
  threadId: string;
548
585
  commentId: string;
549
- }): Promise<void>;
586
+ }, options?: RequestOptions): Promise<void>;
550
587
  /**
551
588
  * Creates a new thread. The thread will be created with the specified comment as its first comment.
552
589
  * If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
@@ -555,23 +592,26 @@ declare class Liveblocks {
555
592
  * @param params.thread.comment.userId The user ID of the user who created the comment.
556
593
  * @param params.thread.comment.createdAt (optional) The date the comment was created.
557
594
  * @param params.thread.comment.body The body of the comment.
595
+ * @param options.signal (optional) An abort signal to cancel the request.
558
596
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
559
597
  */
560
- createThread(params: CreateThreadOptions<M>): Promise<ThreadData<M>>;
598
+ createThread(params: CreateThreadOptions<M>, options?: RequestOptions): Promise<ThreadData<M>>;
561
599
  /**
562
600
  * Deletes a thread and all of its comments.
563
601
  * @param params.roomId The room ID to delete the thread in.
564
602
  * @param params.threadId The thread ID to delete.
603
+ * @param options.signal (optional) An abort signal to cancel the request.
565
604
  */
566
605
  deleteThread(params: {
567
606
  roomId: string;
568
607
  threadId: string;
569
- }): Promise<void>;
608
+ }, options?: RequestOptions): Promise<void>;
570
609
  /**
571
610
  * Mark a thread as resolved.
572
611
  * @param params.roomId The room ID of the thread.
573
612
  * @param params.threadId The thread ID to mark as resolved.
574
613
  * @param params.data.userId The user ID of the user who marked the thread as resolved.
614
+ * @param options.signal (optional) An abort signal to cancel the request.
575
615
  * @returns The thread marked as resolved.
576
616
  */
577
617
  markThreadAsResolved(params: {
@@ -580,12 +620,13 @@ declare class Liveblocks {
580
620
  data: {
581
621
  userId: string;
582
622
  };
583
- }): Promise<ThreadData<M>>;
623
+ }, options?: RequestOptions): Promise<ThreadData<M>>;
584
624
  /**
585
625
  * Mark a thread as unresolved.
586
626
  * @param params.roomId The room ID of the thread.
587
627
  * @param params.threadId The thread ID to mark as unresolved.
588
628
  * @param params.data.userId The user ID of the user who marked the thread as unresolved.
629
+ * @param options.signal (optional) An abort signal to cancel the request.
589
630
  * @returns The thread marked as unresolved.
590
631
  */
591
632
  markThreadAsUnresolved(params: {
@@ -594,7 +635,7 @@ declare class Liveblocks {
594
635
  data: {
595
636
  userId: string;
596
637
  };
597
- }): Promise<ThreadData<M>>;
638
+ }, options?: RequestOptions): Promise<ThreadData<M>>;
598
639
  /**
599
640
  * Updates the metadata of the specified thread in a room.
600
641
  * @param params.roomId The room ID to update the thread in.
@@ -602,6 +643,7 @@ declare class Liveblocks {
602
643
  * @param params.data.metadata The metadata for the thread. Value must be a string, boolean or number
603
644
  * @param params.data.userId The user ID of the user who updated the thread.
604
645
  * @param params.data.updatedAt (optional) The date the thread is set to be updated.
646
+ * @param options.signal (optional) An abort signal to cancel the request.
605
647
  * @returns The updated thread metadata.
606
648
  */
607
649
  editThreadMetadata(params: {
@@ -612,7 +654,7 @@ declare class Liveblocks {
612
654
  userId: string;
613
655
  updatedAt?: Date;
614
656
  };
615
- }): Promise<M>;
657
+ }, options?: RequestOptions): Promise<M>;
616
658
  /**
617
659
  * Adds a new comment reaction to a comment.
618
660
  * @param params.roomId The room ID to add the comment reaction in.
@@ -621,6 +663,7 @@ declare class Liveblocks {
621
663
  * @param params.data.emoji The (emoji) reaction to add.
622
664
  * @param params.data.userId The user ID of the user associated with the reaction.
623
665
  * @param params.data.createdAt (optional) The date the reaction is set to be created.
666
+ * @param options.signal (optional) An abort signal to cancel the request.
624
667
  * @returns The created comment reaction.
625
668
  */
626
669
  addCommentReaction(params: {
@@ -632,7 +675,7 @@ declare class Liveblocks {
632
675
  userId: string;
633
676
  createdAt?: Date;
634
677
  };
635
- }): Promise<CommentUserReaction>;
678
+ }, options?: RequestOptions): Promise<CommentUserReaction>;
636
679
  /**
637
680
  * Removes a reaction from a comment.
638
681
  * @param params.roomId The room ID to remove the comment reaction from.
@@ -641,6 +684,7 @@ declare class Liveblocks {
641
684
  * @param params.data.emoji The (emoji) reaction to remove.
642
685
  * @param params.data.userId The user ID of the user associated with the reaction.
643
686
  * @param params.data.removedAt (optional) The date the reaction is set to be removed.
687
+ * @param options.signal (optional) An abort signal to cancel the request.
644
688
  */
645
689
  removeCommentReaction(params: {
646
690
  roomId: string;
@@ -651,20 +695,22 @@ declare class Liveblocks {
651
695
  userId: string;
652
696
  removedAt?: Date;
653
697
  };
654
- }): Promise<void>;
698
+ }, options?: RequestOptions): Promise<void>;
655
699
  /**
656
700
  * Returns the inbox notifications for a user.
657
701
  * @param params.userId The user ID to get the inbox notifications from.
658
702
  * @param params.inboxNotificationId The ID of the inbox notification to get.
703
+ * @param options.signal (optional) An abort signal to cancel the request.
659
704
  */
660
705
  getInboxNotification(params: {
661
706
  userId: string;
662
707
  inboxNotificationId: string;
663
- }): Promise<InboxNotificationData>;
708
+ }, options?: RequestOptions): Promise<InboxNotificationData>;
664
709
  /**
665
710
  * Returns the inbox notifications for a user.
666
711
  * @param params.userId The user ID to get the inbox notifications from.
667
712
  * @param params.query The query to filter inbox notifications by. It is based on our query language and can filter by unread.
713
+ * @param options.signal (optional) An abort signal to cancel the request.
668
714
  */
669
715
  getInboxNotifications(params: {
670
716
  userId: string;
@@ -691,97 +737,109 @@ declare class Liveblocks {
691
737
  query?: string | {
692
738
  unread: boolean;
693
739
  };
694
- }): Promise<{
740
+ }, options?: RequestOptions): Promise<{
695
741
  data: InboxNotificationData[];
696
742
  }>;
697
743
  /**
698
744
  * Gets the user's room notification settings.
699
745
  * @param params.userId The user ID to get the room notifications from.
700
746
  * @param params.roomId The room ID to get the room notification settings from.
747
+ * @param options.signal (optional) An abort signal to cancel the request.
701
748
  */
702
749
  getRoomNotificationSettings(params: {
703
750
  userId: string;
704
751
  roomId: string;
705
- }): Promise<RoomNotificationSettings>;
752
+ }, options?: RequestOptions): Promise<RoomNotificationSettings>;
706
753
  /**
707
754
  * Updates the user's room notification settings.
708
755
  * @param params.userId The user ID to update the room notification settings for.
709
756
  * @param params.roomId The room ID to update the room notification settings for.
710
757
  * @param params.data The new room notification settings for the user.
758
+ * @param options.signal (optional) An abort signal to cancel the request.
711
759
  */
712
760
  updateRoomNotificationSettings(params: {
713
761
  userId: string;
714
762
  roomId: string;
715
763
  data: RoomNotificationSettings;
716
- }): Promise<RoomNotificationSettings>;
764
+ }, options?: RequestOptions): Promise<RoomNotificationSettings>;
717
765
  /**
718
766
  * Delete the user's room notification settings.
719
767
  * @param params.userId The user ID to delete the room notification settings from.
720
768
  * @param params.roomId The room ID to delete the room notification settings from.
769
+ * @param options.signal (optional) An abort signal to cancel the request.
721
770
  */
722
771
  deleteRoomNotificationSettings(params: {
723
772
  userId: string;
724
773
  roomId: string;
725
- }): Promise<void>;
774
+ }, options?: RequestOptions): Promise<void>;
726
775
  /**
727
776
  * Update a room ID.
728
777
  * @param params.roomId The current ID of the room.
729
778
  * @param params.newRoomId The new room ID.
779
+ * @param options.signal (optional) An abort signal to cancel the request.
730
780
  */
731
781
  updateRoomId(params: {
732
782
  currentRoomId: string;
733
783
  newRoomId: string;
734
- }): Promise<RoomData>;
784
+ }, options?: RequestOptions): Promise<RoomData>;
735
785
  triggerInboxNotification<K extends KDAD>(params: {
736
786
  userId: string;
737
787
  kind: K;
738
788
  roomId?: string;
739
789
  subjectId: string;
740
790
  activityData: DAD[K];
741
- }): Promise<void>;
791
+ }, options?: RequestOptions): Promise<void>;
742
792
  /**
743
793
  * Deletes an inbox notification for a user.
744
794
  * @param params.userId The user ID for which to delete the inbox notification.
745
795
  * @param params.inboxNotificationId The ID of the inbox notification to delete.
796
+ * @param options.signal (optional) An abort signal to cancel the request.
746
797
  */
747
798
  deleteInboxNotification(params: {
748
799
  userId: string;
749
800
  inboxNotificationId: string;
750
- }): Promise<void>;
801
+ }, options?: RequestOptions): Promise<void>;
751
802
  /**
752
803
  * Deletes all inbox notifications for a user.
753
804
  * @param params.userId The user ID for which to delete all the inbox notifications.
805
+ * @param options.signal (optional) An abort signal to cancel the request.
754
806
  */
755
807
  deleteAllInboxNotifications(params: {
756
808
  userId: string;
757
- }): Promise<void>;
809
+ }, options?: RequestOptions): Promise<void>;
758
810
  /**
759
811
  * Get notification settings for a user for a project.
760
812
  * @param params.userId The user ID to get the notifications settings for.
813
+ * @param options.signal (optional) An abort signal to cancel the request.
761
814
  */
762
815
  getNotificationSettings(params: {
763
816
  userId: string;
764
- }): Promise<UserNotificationSettings>;
817
+ }, options?: RequestOptions): Promise<UserNotificationSettings>;
765
818
  /**
766
819
  * Update the user's notification settings.
767
820
  * @param params.userId The user ID to update the notification settings for.
768
821
  * @param params.data The new notification settings for the user.
822
+ * @param options.signal (optional) An abort signal to cancel the request.
769
823
  */
770
824
  updateNotificationSettings(params: {
771
825
  userId: string;
772
826
  data: PartialUserNotificationSettings;
773
- }): Promise<UserNotificationSettings>;
827
+ }, options?: RequestOptions): Promise<UserNotificationSettings>;
774
828
  /**
775
829
  * Delete the user's notification settings
776
830
  * @param params.userId The user ID to update the notification settings for.
831
+ * @param options.signal (optional) An abort signal to cancel the request.
777
832
  */
778
833
  deleteNotificationSettings(params: {
779
834
  userId: string;
780
- }): Promise<void>;
835
+ }, options?: RequestOptions): Promise<void>;
781
836
  }
782
837
  declare class LiveblocksError extends Error {
783
- status: number;
784
- constructor(status: number, message?: string);
838
+ readonly status: number;
839
+ readonly details?: string;
840
+ private constructor();
841
+ toString(): string;
842
+ static from(res: Response): Promise<LiveblocksError>;
785
843
  }
786
844
 
787
845
  declare class WebhookHandler {