@liveblocks/node 2.22.0 → 2.22.2
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.cjs +55 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -8
- package/dist/index.d.ts +12 -8
- package/dist/index.js +42 -59
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, UserNotificationSettings, PartialUserNotificationSettings, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, NotificationChannel } from '@liveblocks/core';
|
|
2
|
-
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
2
|
+
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
5
5
|
declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"];
|
|
@@ -240,6 +240,10 @@ type UpdateRoomOptions = {
|
|
|
240
240
|
] | ["room:read", "room:presence:write"] | null>;
|
|
241
241
|
metadata?: Record<string, string | string[] | null>;
|
|
242
242
|
};
|
|
243
|
+
type UpsertRoomOptions = {
|
|
244
|
+
update: UpdateRoomOptions;
|
|
245
|
+
create?: CreateRoomOptions;
|
|
246
|
+
};
|
|
243
247
|
type RequestOptions = {
|
|
244
248
|
signal?: AbortSignal;
|
|
245
249
|
};
|
|
@@ -345,7 +349,9 @@ declare class Liveblocks {
|
|
|
345
349
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
346
350
|
* @returns The created room.
|
|
347
351
|
*/
|
|
348
|
-
createRoom(roomId: string, params: CreateRoomOptions, options?: RequestOptions
|
|
352
|
+
createRoom(roomId: string, params: CreateRoomOptions, options?: RequestOptions & {
|
|
353
|
+
idempotent?: boolean;
|
|
354
|
+
}): Promise<RoomData>;
|
|
349
355
|
/**
|
|
350
356
|
* Returns a room with the given id, or creates one with the given creation
|
|
351
357
|
* options if it doesn't exist yet.
|
|
@@ -363,14 +369,12 @@ declare class Liveblocks {
|
|
|
363
369
|
* Updates or creates a new room with the given properties.
|
|
364
370
|
*
|
|
365
371
|
* @param roomId The id of the room to update or create.
|
|
366
|
-
* @param
|
|
367
|
-
* @param
|
|
368
|
-
* @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.
|
|
369
|
-
* @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.
|
|
372
|
+
* @param update The fields to update. These values will be updated when the room exists, or set when the room does not exist and gets created. Must specify at least one key.
|
|
373
|
+
* @param create (optional) The fields to only use when the room does not exist and will be created. When the room already exists, these values are ignored.
|
|
370
374
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
371
375
|
* @returns The room.
|
|
372
376
|
*/
|
|
373
|
-
upsertRoom(roomId: string, params:
|
|
377
|
+
upsertRoom(roomId: string, params: UpsertRoomOptions, options?: RequestOptions): Promise<RoomData>;
|
|
374
378
|
/**
|
|
375
379
|
* Returns a room with the given id.
|
|
376
380
|
* @param roomId The id of the room to return.
|
|
@@ -1303,4 +1307,4 @@ declare function isCustomNotificationEvent(event: WebhookEvent): event is Custom
|
|
|
1303
1307
|
*/
|
|
1304
1308
|
type RoomInfo = RoomData;
|
|
1305
1309
|
|
|
1306
|
-
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateRoomOptions, type CustomNotificationEvent, type GetInboxNotificationsOptions, type GetRoomsOptions, type InboxNotificationsQueryCriteria, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
|
1310
|
+
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateRoomOptions, type CustomNotificationEvent, type GetInboxNotificationsOptions, type GetRoomsOptions, type InboxNotificationsQueryCriteria, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, UserNotificationSettings, PartialUserNotificationSettings, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, NotificationChannel } from '@liveblocks/core';
|
|
2
|
-
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
2
|
+
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
5
5
|
declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"];
|
|
@@ -240,6 +240,10 @@ type UpdateRoomOptions = {
|
|
|
240
240
|
] | ["room:read", "room:presence:write"] | null>;
|
|
241
241
|
metadata?: Record<string, string | string[] | null>;
|
|
242
242
|
};
|
|
243
|
+
type UpsertRoomOptions = {
|
|
244
|
+
update: UpdateRoomOptions;
|
|
245
|
+
create?: CreateRoomOptions;
|
|
246
|
+
};
|
|
243
247
|
type RequestOptions = {
|
|
244
248
|
signal?: AbortSignal;
|
|
245
249
|
};
|
|
@@ -345,7 +349,9 @@ declare class Liveblocks {
|
|
|
345
349
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
346
350
|
* @returns The created room.
|
|
347
351
|
*/
|
|
348
|
-
createRoom(roomId: string, params: CreateRoomOptions, options?: RequestOptions
|
|
352
|
+
createRoom(roomId: string, params: CreateRoomOptions, options?: RequestOptions & {
|
|
353
|
+
idempotent?: boolean;
|
|
354
|
+
}): Promise<RoomData>;
|
|
349
355
|
/**
|
|
350
356
|
* Returns a room with the given id, or creates one with the given creation
|
|
351
357
|
* options if it doesn't exist yet.
|
|
@@ -363,14 +369,12 @@ declare class Liveblocks {
|
|
|
363
369
|
* Updates or creates a new room with the given properties.
|
|
364
370
|
*
|
|
365
371
|
* @param roomId The id of the room to update or create.
|
|
366
|
-
* @param
|
|
367
|
-
* @param
|
|
368
|
-
* @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.
|
|
369
|
-
* @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.
|
|
372
|
+
* @param update The fields to update. These values will be updated when the room exists, or set when the room does not exist and gets created. Must specify at least one key.
|
|
373
|
+
* @param create (optional) The fields to only use when the room does not exist and will be created. When the room already exists, these values are ignored.
|
|
370
374
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
371
375
|
* @returns The room.
|
|
372
376
|
*/
|
|
373
|
-
upsertRoom(roomId: string, params:
|
|
377
|
+
upsertRoom(roomId: string, params: UpsertRoomOptions, options?: RequestOptions): Promise<RoomData>;
|
|
374
378
|
/**
|
|
375
379
|
* Returns a room with the given id.
|
|
376
380
|
* @param roomId The id of the room to return.
|
|
@@ -1303,4 +1307,4 @@ declare function isCustomNotificationEvent(event: WebhookEvent): event is Custom
|
|
|
1303
1307
|
*/
|
|
1304
1308
|
type RoomInfo = RoomData;
|
|
1305
1309
|
|
|
1306
|
-
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateRoomOptions, type CustomNotificationEvent, type GetInboxNotificationsOptions, type GetRoomsOptions, type InboxNotificationsQueryCriteria, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
|
1310
|
+
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateRoomOptions, type CustomNotificationEvent, type GetInboxNotificationsOptions, type GetRoomsOptions, type InboxNotificationsQueryCriteria, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/node";
|
|
6
|
-
var PKG_VERSION = "2.22.
|
|
6
|
+
var PKG_VERSION = "2.22.2";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -270,6 +270,15 @@ var Session = class {
|
|
|
270
270
|
};
|
|
271
271
|
|
|
272
272
|
// src/client.ts
|
|
273
|
+
function inflateRoomData(room) {
|
|
274
|
+
const createdAt = new Date(room.createdAt);
|
|
275
|
+
const lastConnectionAt = room.lastConnectionAt ? new Date(room.lastConnectionAt) : void 0;
|
|
276
|
+
return {
|
|
277
|
+
...room,
|
|
278
|
+
createdAt,
|
|
279
|
+
lastConnectionAt
|
|
280
|
+
};
|
|
281
|
+
}
|
|
273
282
|
var Liveblocks = class {
|
|
274
283
|
#secret;
|
|
275
284
|
#baseUrl;
|
|
@@ -477,15 +486,7 @@ var Liveblocks = class {
|
|
|
477
486
|
throw await LiveblocksError.from(res);
|
|
478
487
|
}
|
|
479
488
|
const page = await res.json();
|
|
480
|
-
const rooms = page.data.map(
|
|
481
|
-
const lastConnectionAt = room.lastConnectionAt ? new Date(room.lastConnectionAt) : void 0;
|
|
482
|
-
const createdAt = new Date(room.createdAt);
|
|
483
|
-
return {
|
|
484
|
-
...room,
|
|
485
|
-
createdAt,
|
|
486
|
-
lastConnectionAt
|
|
487
|
-
};
|
|
488
|
-
});
|
|
489
|
+
const rooms = page.data.map(inflateRoomData);
|
|
489
490
|
return {
|
|
490
491
|
...page,
|
|
491
492
|
data: rooms
|
|
@@ -536,7 +537,7 @@ var Liveblocks = class {
|
|
|
536
537
|
async createRoom(roomId, params, options) {
|
|
537
538
|
const { defaultAccesses, groupsAccesses, usersAccesses, metadata } = params;
|
|
538
539
|
const res = await this.#post(
|
|
539
|
-
url2`/v2/rooms`,
|
|
540
|
+
options?.idempotent ? url2`/v2/rooms?idempotent` : url2`/v2/rooms`,
|
|
540
541
|
{
|
|
541
542
|
id: roomId,
|
|
542
543
|
defaultAccesses,
|
|
@@ -550,13 +551,7 @@ var Liveblocks = class {
|
|
|
550
551
|
throw await LiveblocksError.from(res);
|
|
551
552
|
}
|
|
552
553
|
const data = await res.json();
|
|
553
|
-
|
|
554
|
-
const createdAt = new Date(data.createdAt);
|
|
555
|
-
return {
|
|
556
|
-
...data,
|
|
557
|
-
lastConnectionAt,
|
|
558
|
-
createdAt
|
|
559
|
-
};
|
|
554
|
+
return inflateRoomData(data);
|
|
560
555
|
}
|
|
561
556
|
/**
|
|
562
557
|
* Returns a room with the given id, or creates one with the given creation
|
|
@@ -571,37 +566,31 @@ var Liveblocks = class {
|
|
|
571
566
|
* @returns The room.
|
|
572
567
|
*/
|
|
573
568
|
async getOrCreateRoom(roomId, params, options) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
return await this.getRoom(roomId, options);
|
|
579
|
-
} else {
|
|
580
|
-
throw err;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
569
|
+
return await this.createRoom(roomId, params, {
|
|
570
|
+
...options,
|
|
571
|
+
idempotent: true
|
|
572
|
+
});
|
|
583
573
|
}
|
|
584
574
|
/**
|
|
585
575
|
* Updates or creates a new room with the given properties.
|
|
586
576
|
*
|
|
587
577
|
* @param roomId The id of the room to update or create.
|
|
588
|
-
* @param
|
|
589
|
-
* @param
|
|
590
|
-
* @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.
|
|
591
|
-
* @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.
|
|
578
|
+
* @param update The fields to update. These values will be updated when the room exists, or set when the room does not exist and gets created. Must specify at least one key.
|
|
579
|
+
* @param create (optional) The fields to only use when the room does not exist and will be created. When the room already exists, these values are ignored.
|
|
592
580
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
593
581
|
* @returns The room.
|
|
594
582
|
*/
|
|
595
583
|
async upsertRoom(roomId, params, options) {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
584
|
+
const res = await this.#post(
|
|
585
|
+
url2`/v2/rooms/${roomId}/upsert`,
|
|
586
|
+
params,
|
|
587
|
+
options
|
|
588
|
+
);
|
|
589
|
+
if (!res.ok) {
|
|
590
|
+
throw await LiveblocksError.from(res);
|
|
604
591
|
}
|
|
592
|
+
const data = await res.json();
|
|
593
|
+
return inflateRoomData(data);
|
|
605
594
|
}
|
|
606
595
|
/**
|
|
607
596
|
* Returns a room with the given id.
|
|
@@ -615,13 +604,7 @@ var Liveblocks = class {
|
|
|
615
604
|
throw await LiveblocksError.from(res);
|
|
616
605
|
}
|
|
617
606
|
const data = await res.json();
|
|
618
|
-
|
|
619
|
-
const createdAt = new Date(data.createdAt);
|
|
620
|
-
return {
|
|
621
|
-
...data,
|
|
622
|
-
createdAt,
|
|
623
|
-
lastConnectionAt
|
|
624
|
-
};
|
|
607
|
+
return inflateRoomData(data);
|
|
625
608
|
}
|
|
626
609
|
/**
|
|
627
610
|
* Updates specific properties of a room. It’s not necessary to provide the entire room’s information.
|
|
@@ -650,13 +633,7 @@ var Liveblocks = class {
|
|
|
650
633
|
throw await LiveblocksError.from(res);
|
|
651
634
|
}
|
|
652
635
|
const data = await res.json();
|
|
653
|
-
|
|
654
|
-
const createdAt = new Date(data.createdAt);
|
|
655
|
-
return {
|
|
656
|
-
...data,
|
|
657
|
-
lastConnectionAt,
|
|
658
|
-
createdAt
|
|
659
|
-
};
|
|
636
|
+
return inflateRoomData(data);
|
|
660
637
|
}
|
|
661
638
|
/**
|
|
662
639
|
* 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.
|
|
@@ -1438,11 +1415,7 @@ var Liveblocks = class {
|
|
|
1438
1415
|
throw await LiveblocksError.from(res);
|
|
1439
1416
|
}
|
|
1440
1417
|
const data = await res.json();
|
|
1441
|
-
return
|
|
1442
|
-
...data,
|
|
1443
|
-
createdAt: new Date(data.createdAt),
|
|
1444
|
-
lastConnectionAt: data.lastConnectionAt ? new Date(data.lastConnectionAt) : void 0
|
|
1445
|
-
};
|
|
1418
|
+
return inflateRoomData(data);
|
|
1446
1419
|
}
|
|
1447
1420
|
async triggerInboxNotification(params, options) {
|
|
1448
1421
|
const res = await this.#post(
|
|
@@ -1673,6 +1646,8 @@ ${this.details}`;
|
|
|
1673
1646
|
return msg;
|
|
1674
1647
|
}
|
|
1675
1648
|
static async from(res) {
|
|
1649
|
+
const origErrLocation = new Error();
|
|
1650
|
+
Error.captureStackTrace(origErrLocation, _LiveblocksError.from);
|
|
1676
1651
|
const FALLBACK = "An error happened without an error message";
|
|
1677
1652
|
let text;
|
|
1678
1653
|
try {
|
|
@@ -1686,7 +1661,9 @@ ${this.details}`;
|
|
|
1686
1661
|
obj.suggestion ? `Suggestion: ${String(obj.suggestion)}` : void 0,
|
|
1687
1662
|
obj.docs ? `See also: ${String(obj.docs)}` : void 0
|
|
1688
1663
|
].filter(Boolean).join("\n") || void 0;
|
|
1689
|
-
|
|
1664
|
+
const err = new _LiveblocksError(message, res.status, details);
|
|
1665
|
+
err.stack = origErrLocation.stack;
|
|
1666
|
+
return err;
|
|
1690
1667
|
}
|
|
1691
1668
|
};
|
|
1692
1669
|
|
|
@@ -1838,10 +1815,16 @@ function isCustomNotificationEvent(event) {
|
|
|
1838
1815
|
import {
|
|
1839
1816
|
getMentionedIdsFromCommentBody,
|
|
1840
1817
|
isNotificationChannelEnabled,
|
|
1818
|
+
LiveList,
|
|
1819
|
+
LiveMap,
|
|
1820
|
+
LiveObject as LiveObject2,
|
|
1841
1821
|
stringifyCommentBody
|
|
1842
1822
|
} from "@liveblocks/core";
|
|
1843
1823
|
detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
1844
1824
|
export {
|
|
1825
|
+
LiveList,
|
|
1826
|
+
LiveMap,
|
|
1827
|
+
LiveObject2 as LiveObject,
|
|
1845
1828
|
Liveblocks,
|
|
1846
1829
|
LiveblocksError,
|
|
1847
1830
|
WebhookHandler,
|