@liveblocks/node 3.15.0-components1 → 3.15.0-feeds2
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/README.md +6 -16
- package/dist/index.cjs +222 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +128 -5
- package/dist/index.d.ts +128 -5
- package/dist/index.js +201 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseUserMeta, DU, LiveObject, Awaitable, DS,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, Json, JsonObject, OptionalTupleUnless, PlainLsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, Feed, FeedMessage, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DTM, DCM, NotificationChannel } from '@liveblocks/core';
|
|
2
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, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
5
|
-
declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"];
|
|
5
|
+
declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read", "feeds:write", "feeds:read"];
|
|
6
6
|
type Permission = (typeof ALL_PERMISSIONS)[number];
|
|
7
7
|
/**
|
|
8
8
|
* Class to help you construct the exact permission set to grant a user, used
|
|
@@ -41,8 +41,8 @@ type Permission = (typeof ALL_PERMISSIONS)[number];
|
|
|
41
41
|
*/
|
|
42
42
|
declare class Session {
|
|
43
43
|
#private;
|
|
44
|
-
readonly FULL_ACCESS: readonly ["room:write", "comments:write"];
|
|
45
|
-
readonly READ_ACCESS: readonly ["room:read", "room:presence:write", "comments:read"];
|
|
44
|
+
readonly FULL_ACCESS: readonly ["room:write", "comments:write", "feeds:write"];
|
|
45
|
+
readonly READ_ACCESS: readonly ["room:read", "room:presence:write", "comments:read", "feeds:read"];
|
|
46
46
|
allow(roomIdOrPattern: string, newPerms: readonly Permission[]): this;
|
|
47
47
|
/**
|
|
48
48
|
* Call this to authorize the session to access Liveblocks. Note that this
|
|
@@ -444,6 +444,22 @@ type GetWebKnowledgeSourceLinksOptions = {
|
|
|
444
444
|
copilotId: string;
|
|
445
445
|
knowledgeSourceId: string;
|
|
446
446
|
} & PaginationOptions;
|
|
447
|
+
type CreateFeedOptions<FM extends Json = Json> = {
|
|
448
|
+
feedId: string;
|
|
449
|
+
metadata?: FM;
|
|
450
|
+
timestamp?: number;
|
|
451
|
+
};
|
|
452
|
+
type UpdateFeedOptions<FM extends Json = Json> = {
|
|
453
|
+
metadata: FM;
|
|
454
|
+
};
|
|
455
|
+
type CreateFeedMessageOptions<FMD extends Json = Json> = {
|
|
456
|
+
id?: string;
|
|
457
|
+
timestamp?: number;
|
|
458
|
+
data: FMD;
|
|
459
|
+
};
|
|
460
|
+
type UpdateFeedMessageOptions<FMD extends Json = Json> = {
|
|
461
|
+
data: FMD;
|
|
462
|
+
};
|
|
447
463
|
type KnowledgeSource = ({
|
|
448
464
|
type: "ai-knowledge-web-source";
|
|
449
465
|
link: {
|
|
@@ -1438,6 +1454,113 @@ declare class Liveblocks {
|
|
|
1438
1454
|
* @returns A paginated list of web knowledge source links.
|
|
1439
1455
|
*/
|
|
1440
1456
|
getWebKnowledgeSourceLinks(params: GetWebKnowledgeSourceLinksOptions, options?: RequestOptions): Promise<Page<WebKnowledgeSourceLink>>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Returns a list of feeds in a room.
|
|
1459
|
+
* @param params.roomId The room ID to get the feeds from.
|
|
1460
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1461
|
+
* @returns A list of feeds.
|
|
1462
|
+
*/
|
|
1463
|
+
getFeeds<FM extends Json = Json>(params: {
|
|
1464
|
+
roomId: string;
|
|
1465
|
+
}, options?: RequestOptions): Promise<{
|
|
1466
|
+
data: Feed<FM>[];
|
|
1467
|
+
}>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Creates a new feed in a room.
|
|
1470
|
+
* @param params.roomId The room ID to create the feed in.
|
|
1471
|
+
* @param params.feedId The feed ID.
|
|
1472
|
+
* @param params.metadata (optional) The metadata for the feed.
|
|
1473
|
+
* @param params.timestamp (optional) The timestamp for the feed. If not provided, the current time will be used.
|
|
1474
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1475
|
+
* @returns The created feed.
|
|
1476
|
+
*/
|
|
1477
|
+
createFeed<FM extends Json = Json>(params: {
|
|
1478
|
+
roomId: string;
|
|
1479
|
+
} & CreateFeedOptions<FM>, options?: RequestOptions): Promise<Feed<FM>>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Returns a feed with the given id.
|
|
1482
|
+
* @param params.roomId The room ID to get the feed from.
|
|
1483
|
+
* @param params.feedId The feed ID.
|
|
1484
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1485
|
+
* @returns The feed.
|
|
1486
|
+
*/
|
|
1487
|
+
getFeed<FM extends Json = Json>(params: {
|
|
1488
|
+
roomId: string;
|
|
1489
|
+
feedId: string;
|
|
1490
|
+
}, options?: RequestOptions): Promise<Feed<FM>>;
|
|
1491
|
+
/**
|
|
1492
|
+
* Updates the metadata of a feed.
|
|
1493
|
+
* @param params.roomId The room ID to update the feed in.
|
|
1494
|
+
* @param params.feedId The feed ID to update.
|
|
1495
|
+
* @param params.metadata The metadata for the feed.
|
|
1496
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1497
|
+
*/
|
|
1498
|
+
updateFeed<FM extends Json = Json>(params: {
|
|
1499
|
+
roomId: string;
|
|
1500
|
+
feedId: string;
|
|
1501
|
+
} & UpdateFeedOptions<FM>, options?: RequestOptions): Promise<void>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Deletes a feed.
|
|
1504
|
+
* @param params.roomId The room ID to delete the feed from.
|
|
1505
|
+
* @param params.feedId The feed ID to delete.
|
|
1506
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1507
|
+
*/
|
|
1508
|
+
deleteFeed(params: {
|
|
1509
|
+
roomId: string;
|
|
1510
|
+
feedId: string;
|
|
1511
|
+
}, options?: RequestOptions): Promise<void>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Returns a list of messages in a feed.
|
|
1514
|
+
* @param params.roomId The room ID to get the feed messages from.
|
|
1515
|
+
* @param params.feedId The feed ID to get the messages from.
|
|
1516
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1517
|
+
* @returns A list of feed messages.
|
|
1518
|
+
*/
|
|
1519
|
+
getFeedMessages<FMD extends Json = Json>(params: {
|
|
1520
|
+
roomId: string;
|
|
1521
|
+
feedId: string;
|
|
1522
|
+
}, options?: RequestOptions): Promise<{
|
|
1523
|
+
data: FeedMessage<FMD>[];
|
|
1524
|
+
}>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Creates a new message in a feed.
|
|
1527
|
+
* @param params.roomId The room ID to create the feed message in.
|
|
1528
|
+
* @param params.feedId The feed ID to create the message in.
|
|
1529
|
+
* @param params.id (optional) The message ID. If not provided, one will be generated.
|
|
1530
|
+
* @param params.timestamp (optional) The message timestamp. If not provided, the current time will be used.
|
|
1531
|
+
* @param params.data The message data.
|
|
1532
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1533
|
+
* @returns The created feed message.
|
|
1534
|
+
*/
|
|
1535
|
+
createFeedMessage<FMD extends Json = Json>(params: {
|
|
1536
|
+
roomId: string;
|
|
1537
|
+
feedId: string;
|
|
1538
|
+
} & CreateFeedMessageOptions<FMD>, options?: RequestOptions): Promise<FeedMessage<FMD>>;
|
|
1539
|
+
/**
|
|
1540
|
+
* Updates a feed message.
|
|
1541
|
+
* @param params.roomId The room ID to update the feed message in.
|
|
1542
|
+
* @param params.feedId The feed ID to update the message in.
|
|
1543
|
+
* @param params.messageId The message ID to update.
|
|
1544
|
+
* @param params.data The message data.
|
|
1545
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1546
|
+
*/
|
|
1547
|
+
updateFeedMessage<FMD extends Json = Json>(params: {
|
|
1548
|
+
roomId: string;
|
|
1549
|
+
feedId: string;
|
|
1550
|
+
messageId: string;
|
|
1551
|
+
} & UpdateFeedMessageOptions<FMD>, options?: RequestOptions): Promise<void>;
|
|
1552
|
+
/**
|
|
1553
|
+
* Deletes a feed message.
|
|
1554
|
+
* @param params.roomId The room ID to delete the feed message from.
|
|
1555
|
+
* @param params.feedId The feed ID to delete the message from.
|
|
1556
|
+
* @param params.messageId The message ID to delete.
|
|
1557
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1558
|
+
*/
|
|
1559
|
+
deleteFeedMessage(params: {
|
|
1560
|
+
roomId: string;
|
|
1561
|
+
feedId: string;
|
|
1562
|
+
messageId: string;
|
|
1563
|
+
}, options?: RequestOptions): Promise<void>;
|
|
1441
1564
|
}
|
|
1442
1565
|
declare class LiveblocksError extends Error {
|
|
1443
1566
|
readonly status: number;
|
|
@@ -1848,4 +1971,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1848
1971
|
*/
|
|
1849
1972
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1850
1973
|
|
|
1851
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, 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 RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
|
1974
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFeedMessageOptions, type CreateFeedOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, 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 RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateFeedMessageOptions, type UpdateFeedOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseUserMeta, DU, LiveObject, Awaitable, DS,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, Json, JsonObject, OptionalTupleUnless, PlainLsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, Feed, FeedMessage, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DTM, DCM, NotificationChannel } from '@liveblocks/core';
|
|
2
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, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
5
|
-
declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"];
|
|
5
|
+
declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read", "feeds:write", "feeds:read"];
|
|
6
6
|
type Permission = (typeof ALL_PERMISSIONS)[number];
|
|
7
7
|
/**
|
|
8
8
|
* Class to help you construct the exact permission set to grant a user, used
|
|
@@ -41,8 +41,8 @@ type Permission = (typeof ALL_PERMISSIONS)[number];
|
|
|
41
41
|
*/
|
|
42
42
|
declare class Session {
|
|
43
43
|
#private;
|
|
44
|
-
readonly FULL_ACCESS: readonly ["room:write", "comments:write"];
|
|
45
|
-
readonly READ_ACCESS: readonly ["room:read", "room:presence:write", "comments:read"];
|
|
44
|
+
readonly FULL_ACCESS: readonly ["room:write", "comments:write", "feeds:write"];
|
|
45
|
+
readonly READ_ACCESS: readonly ["room:read", "room:presence:write", "comments:read", "feeds:read"];
|
|
46
46
|
allow(roomIdOrPattern: string, newPerms: readonly Permission[]): this;
|
|
47
47
|
/**
|
|
48
48
|
* Call this to authorize the session to access Liveblocks. Note that this
|
|
@@ -444,6 +444,22 @@ type GetWebKnowledgeSourceLinksOptions = {
|
|
|
444
444
|
copilotId: string;
|
|
445
445
|
knowledgeSourceId: string;
|
|
446
446
|
} & PaginationOptions;
|
|
447
|
+
type CreateFeedOptions<FM extends Json = Json> = {
|
|
448
|
+
feedId: string;
|
|
449
|
+
metadata?: FM;
|
|
450
|
+
timestamp?: number;
|
|
451
|
+
};
|
|
452
|
+
type UpdateFeedOptions<FM extends Json = Json> = {
|
|
453
|
+
metadata: FM;
|
|
454
|
+
};
|
|
455
|
+
type CreateFeedMessageOptions<FMD extends Json = Json> = {
|
|
456
|
+
id?: string;
|
|
457
|
+
timestamp?: number;
|
|
458
|
+
data: FMD;
|
|
459
|
+
};
|
|
460
|
+
type UpdateFeedMessageOptions<FMD extends Json = Json> = {
|
|
461
|
+
data: FMD;
|
|
462
|
+
};
|
|
447
463
|
type KnowledgeSource = ({
|
|
448
464
|
type: "ai-knowledge-web-source";
|
|
449
465
|
link: {
|
|
@@ -1438,6 +1454,113 @@ declare class Liveblocks {
|
|
|
1438
1454
|
* @returns A paginated list of web knowledge source links.
|
|
1439
1455
|
*/
|
|
1440
1456
|
getWebKnowledgeSourceLinks(params: GetWebKnowledgeSourceLinksOptions, options?: RequestOptions): Promise<Page<WebKnowledgeSourceLink>>;
|
|
1457
|
+
/**
|
|
1458
|
+
* Returns a list of feeds in a room.
|
|
1459
|
+
* @param params.roomId The room ID to get the feeds from.
|
|
1460
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1461
|
+
* @returns A list of feeds.
|
|
1462
|
+
*/
|
|
1463
|
+
getFeeds<FM extends Json = Json>(params: {
|
|
1464
|
+
roomId: string;
|
|
1465
|
+
}, options?: RequestOptions): Promise<{
|
|
1466
|
+
data: Feed<FM>[];
|
|
1467
|
+
}>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Creates a new feed in a room.
|
|
1470
|
+
* @param params.roomId The room ID to create the feed in.
|
|
1471
|
+
* @param params.feedId The feed ID.
|
|
1472
|
+
* @param params.metadata (optional) The metadata for the feed.
|
|
1473
|
+
* @param params.timestamp (optional) The timestamp for the feed. If not provided, the current time will be used.
|
|
1474
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1475
|
+
* @returns The created feed.
|
|
1476
|
+
*/
|
|
1477
|
+
createFeed<FM extends Json = Json>(params: {
|
|
1478
|
+
roomId: string;
|
|
1479
|
+
} & CreateFeedOptions<FM>, options?: RequestOptions): Promise<Feed<FM>>;
|
|
1480
|
+
/**
|
|
1481
|
+
* Returns a feed with the given id.
|
|
1482
|
+
* @param params.roomId The room ID to get the feed from.
|
|
1483
|
+
* @param params.feedId The feed ID.
|
|
1484
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1485
|
+
* @returns The feed.
|
|
1486
|
+
*/
|
|
1487
|
+
getFeed<FM extends Json = Json>(params: {
|
|
1488
|
+
roomId: string;
|
|
1489
|
+
feedId: string;
|
|
1490
|
+
}, options?: RequestOptions): Promise<Feed<FM>>;
|
|
1491
|
+
/**
|
|
1492
|
+
* Updates the metadata of a feed.
|
|
1493
|
+
* @param params.roomId The room ID to update the feed in.
|
|
1494
|
+
* @param params.feedId The feed ID to update.
|
|
1495
|
+
* @param params.metadata The metadata for the feed.
|
|
1496
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1497
|
+
*/
|
|
1498
|
+
updateFeed<FM extends Json = Json>(params: {
|
|
1499
|
+
roomId: string;
|
|
1500
|
+
feedId: string;
|
|
1501
|
+
} & UpdateFeedOptions<FM>, options?: RequestOptions): Promise<void>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Deletes a feed.
|
|
1504
|
+
* @param params.roomId The room ID to delete the feed from.
|
|
1505
|
+
* @param params.feedId The feed ID to delete.
|
|
1506
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1507
|
+
*/
|
|
1508
|
+
deleteFeed(params: {
|
|
1509
|
+
roomId: string;
|
|
1510
|
+
feedId: string;
|
|
1511
|
+
}, options?: RequestOptions): Promise<void>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Returns a list of messages in a feed.
|
|
1514
|
+
* @param params.roomId The room ID to get the feed messages from.
|
|
1515
|
+
* @param params.feedId The feed ID to get the messages from.
|
|
1516
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1517
|
+
* @returns A list of feed messages.
|
|
1518
|
+
*/
|
|
1519
|
+
getFeedMessages<FMD extends Json = Json>(params: {
|
|
1520
|
+
roomId: string;
|
|
1521
|
+
feedId: string;
|
|
1522
|
+
}, options?: RequestOptions): Promise<{
|
|
1523
|
+
data: FeedMessage<FMD>[];
|
|
1524
|
+
}>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Creates a new message in a feed.
|
|
1527
|
+
* @param params.roomId The room ID to create the feed message in.
|
|
1528
|
+
* @param params.feedId The feed ID to create the message in.
|
|
1529
|
+
* @param params.id (optional) The message ID. If not provided, one will be generated.
|
|
1530
|
+
* @param params.timestamp (optional) The message timestamp. If not provided, the current time will be used.
|
|
1531
|
+
* @param params.data The message data.
|
|
1532
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1533
|
+
* @returns The created feed message.
|
|
1534
|
+
*/
|
|
1535
|
+
createFeedMessage<FMD extends Json = Json>(params: {
|
|
1536
|
+
roomId: string;
|
|
1537
|
+
feedId: string;
|
|
1538
|
+
} & CreateFeedMessageOptions<FMD>, options?: RequestOptions): Promise<FeedMessage<FMD>>;
|
|
1539
|
+
/**
|
|
1540
|
+
* Updates a feed message.
|
|
1541
|
+
* @param params.roomId The room ID to update the feed message in.
|
|
1542
|
+
* @param params.feedId The feed ID to update the message in.
|
|
1543
|
+
* @param params.messageId The message ID to update.
|
|
1544
|
+
* @param params.data The message data.
|
|
1545
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1546
|
+
*/
|
|
1547
|
+
updateFeedMessage<FMD extends Json = Json>(params: {
|
|
1548
|
+
roomId: string;
|
|
1549
|
+
feedId: string;
|
|
1550
|
+
messageId: string;
|
|
1551
|
+
} & UpdateFeedMessageOptions<FMD>, options?: RequestOptions): Promise<void>;
|
|
1552
|
+
/**
|
|
1553
|
+
* Deletes a feed message.
|
|
1554
|
+
* @param params.roomId The room ID to delete the feed message from.
|
|
1555
|
+
* @param params.feedId The feed ID to delete the message from.
|
|
1556
|
+
* @param params.messageId The message ID to delete.
|
|
1557
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1558
|
+
*/
|
|
1559
|
+
deleteFeedMessage(params: {
|
|
1560
|
+
roomId: string;
|
|
1561
|
+
feedId: string;
|
|
1562
|
+
messageId: string;
|
|
1563
|
+
}, options?: RequestOptions): Promise<void>;
|
|
1441
1564
|
}
|
|
1442
1565
|
declare class LiveblocksError extends Error {
|
|
1443
1566
|
readonly status: number;
|
|
@@ -1848,4 +1971,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
|
|
|
1848
1971
|
*/
|
|
1849
1972
|
declare function isCustomNotificationEvent(event: WebhookEvent): event is CustomNotificationEvent;
|
|
1850
1973
|
|
|
1851
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, 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 RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
|
|
1974
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFeedMessageOptions, type CreateFeedOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, 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 RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateFeedMessageOptions, type UpdateFeedOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, 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 = "3.15.0-
|
|
6
|
+
var PKG_VERSION = "3.15.0-feeds2";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -165,7 +165,9 @@ var ALL_PERMISSIONS = Object.freeze([
|
|
|
165
165
|
"room:read",
|
|
166
166
|
"room:presence:write",
|
|
167
167
|
"comments:write",
|
|
168
|
-
"comments:read"
|
|
168
|
+
"comments:read",
|
|
169
|
+
"feeds:write",
|
|
170
|
+
"feeds:read"
|
|
169
171
|
]);
|
|
170
172
|
function isPermission(value) {
|
|
171
173
|
return ALL_PERMISSIONS.includes(value);
|
|
@@ -174,9 +176,14 @@ var MAX_PERMS_PER_SET = 10;
|
|
|
174
176
|
var READ_ACCESS = Object.freeze([
|
|
175
177
|
"room:read",
|
|
176
178
|
"room:presence:write",
|
|
177
|
-
"comments:read"
|
|
179
|
+
"comments:read",
|
|
180
|
+
"feeds:read"
|
|
181
|
+
]);
|
|
182
|
+
var FULL_ACCESS = Object.freeze([
|
|
183
|
+
"room:write",
|
|
184
|
+
"comments:write",
|
|
185
|
+
"feeds:write"
|
|
178
186
|
]);
|
|
179
|
-
var FULL_ACCESS = Object.freeze(["room:write", "comments:write"]);
|
|
180
187
|
var roomPatternRegex = /^([*]|[^*]{1,128}[*]?)$/;
|
|
181
188
|
var Session = class {
|
|
182
189
|
FULL_ACCESS = FULL_ACCESS;
|
|
@@ -360,6 +367,22 @@ var Liveblocks = class {
|
|
|
360
367
|
xwarn(res, "POST", path);
|
|
361
368
|
return res;
|
|
362
369
|
}
|
|
370
|
+
async #patch(path, json, options) {
|
|
371
|
+
const url3 = urljoin(this.#baseUrl, path);
|
|
372
|
+
const headers = {
|
|
373
|
+
Authorization: `Bearer ${this.#secret}`,
|
|
374
|
+
"Content-Type": "application/json"
|
|
375
|
+
};
|
|
376
|
+
const fetch = await fetchPolyfill();
|
|
377
|
+
const res = await fetch(url3, {
|
|
378
|
+
method: "PATCH",
|
|
379
|
+
headers,
|
|
380
|
+
body: JSON.stringify(json),
|
|
381
|
+
signal: options?.signal
|
|
382
|
+
});
|
|
383
|
+
xwarn(res, "PATCH", path);
|
|
384
|
+
return res;
|
|
385
|
+
}
|
|
363
386
|
async #putBinary(path, body, params, options) {
|
|
364
387
|
const url3 = urljoin(this.#baseUrl, path, params);
|
|
365
388
|
const headers = {
|
|
@@ -2190,6 +2213,180 @@ var Liveblocks = class {
|
|
|
2190
2213
|
data: page.data.map(inflateWebKnowledgeSourceLink)
|
|
2191
2214
|
};
|
|
2192
2215
|
}
|
|
2216
|
+
/* -------------------------------------------------------------------------------------------------
|
|
2217
|
+
* Feeds
|
|
2218
|
+
* -----------------------------------------------------------------------------------------------*/
|
|
2219
|
+
/**
|
|
2220
|
+
* Returns a list of feeds in a room.
|
|
2221
|
+
* @param params.roomId The room ID to get the feeds from.
|
|
2222
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2223
|
+
* @returns A list of feeds.
|
|
2224
|
+
*/
|
|
2225
|
+
async getFeeds(params, options) {
|
|
2226
|
+
const { roomId } = params;
|
|
2227
|
+
const res = await this.#get(
|
|
2228
|
+
url2`/v2/rooms/${roomId}/feeds`,
|
|
2229
|
+
void 0,
|
|
2230
|
+
options
|
|
2231
|
+
);
|
|
2232
|
+
if (!res.ok) {
|
|
2233
|
+
throw await LiveblocksError.from(res);
|
|
2234
|
+
}
|
|
2235
|
+
return await res.json();
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Creates a new feed in a room.
|
|
2239
|
+
* @param params.roomId The room ID to create the feed in.
|
|
2240
|
+
* @param params.feedId The feed ID.
|
|
2241
|
+
* @param params.metadata (optional) The metadata for the feed.
|
|
2242
|
+
* @param params.timestamp (optional) The timestamp for the feed. If not provided, the current time will be used.
|
|
2243
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2244
|
+
* @returns The created feed.
|
|
2245
|
+
*/
|
|
2246
|
+
async createFeed(params, options) {
|
|
2247
|
+
const { roomId, feedId, metadata, timestamp } = params;
|
|
2248
|
+
const res = await this.#post(
|
|
2249
|
+
url2`/v2/rooms/${roomId}/feed`,
|
|
2250
|
+
{ feedId, metadata, timestamp },
|
|
2251
|
+
options
|
|
2252
|
+
);
|
|
2253
|
+
if (!res.ok) {
|
|
2254
|
+
throw await LiveblocksError.from(res);
|
|
2255
|
+
}
|
|
2256
|
+
return (await res.json()).data;
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Returns a feed with the given id.
|
|
2260
|
+
* @param params.roomId The room ID to get the feed from.
|
|
2261
|
+
* @param params.feedId The feed ID.
|
|
2262
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2263
|
+
* @returns The feed.
|
|
2264
|
+
*/
|
|
2265
|
+
async getFeed(params, options) {
|
|
2266
|
+
const { roomId, feedId } = params;
|
|
2267
|
+
const res = await this.#get(
|
|
2268
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}`,
|
|
2269
|
+
void 0,
|
|
2270
|
+
options
|
|
2271
|
+
);
|
|
2272
|
+
if (!res.ok) {
|
|
2273
|
+
throw await LiveblocksError.from(res);
|
|
2274
|
+
}
|
|
2275
|
+
return (await res.json()).data;
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* Updates the metadata of a feed.
|
|
2279
|
+
* @param params.roomId The room ID to update the feed in.
|
|
2280
|
+
* @param params.feedId The feed ID to update.
|
|
2281
|
+
* @param params.metadata The metadata for the feed.
|
|
2282
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2283
|
+
*/
|
|
2284
|
+
async updateFeed(params, options) {
|
|
2285
|
+
const { roomId, feedId, metadata } = params;
|
|
2286
|
+
const res = await this.#patch(
|
|
2287
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}`,
|
|
2288
|
+
{ metadata },
|
|
2289
|
+
options
|
|
2290
|
+
);
|
|
2291
|
+
if (!res.ok) {
|
|
2292
|
+
throw await LiveblocksError.from(res);
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* Deletes a feed.
|
|
2297
|
+
* @param params.roomId The room ID to delete the feed from.
|
|
2298
|
+
* @param params.feedId The feed ID to delete.
|
|
2299
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2300
|
+
*/
|
|
2301
|
+
async deleteFeed(params, options) {
|
|
2302
|
+
const { roomId, feedId } = params;
|
|
2303
|
+
const res = await this.#delete(
|
|
2304
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}`,
|
|
2305
|
+
void 0,
|
|
2306
|
+
options
|
|
2307
|
+
);
|
|
2308
|
+
if (!res.ok) {
|
|
2309
|
+
throw await LiveblocksError.from(res);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* Returns a list of messages in a feed.
|
|
2314
|
+
* @param params.roomId The room ID to get the feed messages from.
|
|
2315
|
+
* @param params.feedId The feed ID to get the messages from.
|
|
2316
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2317
|
+
* @returns A list of feed messages.
|
|
2318
|
+
*/
|
|
2319
|
+
async getFeedMessages(params, options) {
|
|
2320
|
+
const { roomId, feedId } = params;
|
|
2321
|
+
const res = await this.#get(
|
|
2322
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}/messages`,
|
|
2323
|
+
void 0,
|
|
2324
|
+
options
|
|
2325
|
+
);
|
|
2326
|
+
if (!res.ok) {
|
|
2327
|
+
throw await LiveblocksError.from(res);
|
|
2328
|
+
}
|
|
2329
|
+
return await res.json();
|
|
2330
|
+
}
|
|
2331
|
+
/**
|
|
2332
|
+
* Creates a new message in a feed.
|
|
2333
|
+
* @param params.roomId The room ID to create the feed message in.
|
|
2334
|
+
* @param params.feedId The feed ID to create the message in.
|
|
2335
|
+
* @param params.id (optional) The message ID. If not provided, one will be generated.
|
|
2336
|
+
* @param params.timestamp (optional) The message timestamp. If not provided, the current time will be used.
|
|
2337
|
+
* @param params.data The message data.
|
|
2338
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2339
|
+
* @returns The created feed message.
|
|
2340
|
+
*/
|
|
2341
|
+
async createFeedMessage(params, options) {
|
|
2342
|
+
const { roomId, feedId, id, timestamp, data } = params;
|
|
2343
|
+
const res = await this.#post(
|
|
2344
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}/messages`,
|
|
2345
|
+
{ id, timestamp, data },
|
|
2346
|
+
options
|
|
2347
|
+
);
|
|
2348
|
+
if (!res.ok) {
|
|
2349
|
+
throw await LiveblocksError.from(res);
|
|
2350
|
+
}
|
|
2351
|
+
return (await res.json()).data;
|
|
2352
|
+
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Updates a feed message.
|
|
2355
|
+
* @param params.roomId The room ID to update the feed message in.
|
|
2356
|
+
* @param params.feedId The feed ID to update the message in.
|
|
2357
|
+
* @param params.messageId The message ID to update.
|
|
2358
|
+
* @param params.data The message data.
|
|
2359
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2360
|
+
*/
|
|
2361
|
+
async updateFeedMessage(params, options) {
|
|
2362
|
+
const { roomId, feedId, messageId, data } = params;
|
|
2363
|
+
const res = await this.#patch(
|
|
2364
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}/messages/${messageId}`,
|
|
2365
|
+
{ data },
|
|
2366
|
+
options
|
|
2367
|
+
);
|
|
2368
|
+
if (!res.ok) {
|
|
2369
|
+
throw await LiveblocksError.from(res);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
/**
|
|
2373
|
+
* Deletes a feed message.
|
|
2374
|
+
* @param params.roomId The room ID to delete the feed message from.
|
|
2375
|
+
* @param params.feedId The feed ID to delete the message from.
|
|
2376
|
+
* @param params.messageId The message ID to delete.
|
|
2377
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2378
|
+
*/
|
|
2379
|
+
async deleteFeedMessage(params, options) {
|
|
2380
|
+
const { roomId, feedId, messageId } = params;
|
|
2381
|
+
const res = await this.#delete(
|
|
2382
|
+
url2`/v2/rooms/${roomId}/feeds/${feedId}/messages/${messageId}`,
|
|
2383
|
+
void 0,
|
|
2384
|
+
options
|
|
2385
|
+
);
|
|
2386
|
+
if (!res.ok) {
|
|
2387
|
+
throw await LiveblocksError.from(res);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2193
2390
|
};
|
|
2194
2391
|
var LiveblocksError = class _LiveblocksError extends Error {
|
|
2195
2392
|
status;
|