@liveblocks/core 3.20.0-perm4 → 3.20.0-perm5
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 +57 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -28
- package/dist/index.d.ts +17 -28
- package/dist/index.js +57 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -66,47 +66,43 @@ type DistributiveRelax<T, Ks extends string | number | symbol> = T extends any ?
|
|
|
66
66
|
|
|
67
67
|
declare const Permission: {
|
|
68
68
|
/**
|
|
69
|
-
* Default permission for a room
|
|
69
|
+
* Default permission for a room.
|
|
70
70
|
*/
|
|
71
|
-
readonly
|
|
72
|
-
readonly
|
|
71
|
+
readonly Read: "*:read";
|
|
72
|
+
readonly Write: "*:write";
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Legacy aliases for default room permissions.
|
|
75
75
|
*/
|
|
76
|
-
readonly
|
|
77
|
-
readonly
|
|
76
|
+
readonly RoomWrite: "room:write";
|
|
77
|
+
readonly RoomRead: "room:read";
|
|
78
78
|
/**
|
|
79
79
|
* Storage
|
|
80
80
|
*/
|
|
81
|
-
readonly
|
|
82
|
-
readonly
|
|
83
|
-
readonly
|
|
81
|
+
readonly StorageRead: "storage:read";
|
|
82
|
+
readonly StorageWrite: "storage:write";
|
|
83
|
+
readonly StorageNone: "storage:none";
|
|
84
84
|
/**
|
|
85
85
|
* Comments
|
|
86
86
|
*/
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
87
|
+
readonly CommentsWrite: "comments:write";
|
|
88
|
+
readonly CommentsRead: "comments:read";
|
|
89
|
+
readonly CommentsNone: "comments:none";
|
|
90
90
|
/**
|
|
91
91
|
* Feeds
|
|
92
92
|
*/
|
|
93
|
-
readonly
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
93
|
+
readonly FeedsRead: "feeds:read";
|
|
94
|
+
readonly FeedsWrite: "feeds:write";
|
|
95
|
+
readonly FeedsNone: "feeds:none";
|
|
96
96
|
/**
|
|
97
97
|
* Legacy
|
|
98
98
|
*/
|
|
99
99
|
readonly LegacyRoomPresenceWrite: "room:presence:write";
|
|
100
|
-
readonly LegacyCommentsWrite: "comments:write";
|
|
101
|
-
readonly LegacyCommentsRead: "comments:read";
|
|
102
|
-
readonly LegacyFeedsWrite: "feeds:write";
|
|
103
100
|
};
|
|
104
101
|
type Permission = (typeof Permission)[keyof typeof Permission];
|
|
105
102
|
type AccessLevel = "write" | "read" | "none";
|
|
106
103
|
type RequiredAccessLevel = "read" | "write";
|
|
107
104
|
type PermissionMatrix = {
|
|
108
105
|
room: AccessLevel;
|
|
109
|
-
presence: AccessLevel;
|
|
110
106
|
storage: AccessLevel;
|
|
111
107
|
comments: AccessLevel;
|
|
112
108
|
feeds: AccessLevel;
|
|
@@ -122,14 +118,7 @@ type RoomPermissionGrant = {
|
|
|
122
118
|
scopes: readonly string[];
|
|
123
119
|
};
|
|
124
120
|
type RoomPermission = Permission[];
|
|
125
|
-
type
|
|
126
|
-
default?: "read" | "write";
|
|
127
|
-
presence?: "read" | "none";
|
|
128
|
-
storage?: "read" | "write" | "none";
|
|
129
|
-
comments?: "read" | "write" | "none";
|
|
130
|
-
feeds?: "read" | "write" | "none";
|
|
131
|
-
};
|
|
132
|
-
type RoomPermissionInput = readonly Permission[] | RoomPermissionObject;
|
|
121
|
+
type RoomPermissionInput = readonly Permission[];
|
|
133
122
|
type RoomAccesses = Record<string, RoomPermission>;
|
|
134
123
|
type RoomAccessesInput = Record<string, RoomPermissionInput>;
|
|
135
124
|
type RoomAccessesUpdateInput = Record<string, RoomPermissionInput | null>;
|
|
@@ -5775,4 +5764,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5775
5764
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5776
5765
|
};
|
|
5777
5766
|
|
|
5778
|
-
export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomAccessesInput, type RoomAccessesUpdateInput, type RoomEventMessage, type RoomPermission, type RoomPermissionGrant, type RoomPermissionInput, type
|
|
5767
|
+
export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomAccessesInput, type RoomAccessesUpdateInput, type RoomEventMessage, type RoomPermission, type RoomPermissionGrant, type RoomPermissionInput, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergePermissionMatrices, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccessesInput, normalizeRoomAccessesUpdateInput, normalizeRoomPermissionInput, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, permissionMatrixToScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -66,47 +66,43 @@ type DistributiveRelax<T, Ks extends string | number | symbol> = T extends any ?
|
|
|
66
66
|
|
|
67
67
|
declare const Permission: {
|
|
68
68
|
/**
|
|
69
|
-
* Default permission for a room
|
|
69
|
+
* Default permission for a room.
|
|
70
70
|
*/
|
|
71
|
-
readonly
|
|
72
|
-
readonly
|
|
71
|
+
readonly Read: "*:read";
|
|
72
|
+
readonly Write: "*:write";
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Legacy aliases for default room permissions.
|
|
75
75
|
*/
|
|
76
|
-
readonly
|
|
77
|
-
readonly
|
|
76
|
+
readonly RoomWrite: "room:write";
|
|
77
|
+
readonly RoomRead: "room:read";
|
|
78
78
|
/**
|
|
79
79
|
* Storage
|
|
80
80
|
*/
|
|
81
|
-
readonly
|
|
82
|
-
readonly
|
|
83
|
-
readonly
|
|
81
|
+
readonly StorageRead: "storage:read";
|
|
82
|
+
readonly StorageWrite: "storage:write";
|
|
83
|
+
readonly StorageNone: "storage:none";
|
|
84
84
|
/**
|
|
85
85
|
* Comments
|
|
86
86
|
*/
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
87
|
+
readonly CommentsWrite: "comments:write";
|
|
88
|
+
readonly CommentsRead: "comments:read";
|
|
89
|
+
readonly CommentsNone: "comments:none";
|
|
90
90
|
/**
|
|
91
91
|
* Feeds
|
|
92
92
|
*/
|
|
93
|
-
readonly
|
|
94
|
-
readonly
|
|
95
|
-
readonly
|
|
93
|
+
readonly FeedsRead: "feeds:read";
|
|
94
|
+
readonly FeedsWrite: "feeds:write";
|
|
95
|
+
readonly FeedsNone: "feeds:none";
|
|
96
96
|
/**
|
|
97
97
|
* Legacy
|
|
98
98
|
*/
|
|
99
99
|
readonly LegacyRoomPresenceWrite: "room:presence:write";
|
|
100
|
-
readonly LegacyCommentsWrite: "comments:write";
|
|
101
|
-
readonly LegacyCommentsRead: "comments:read";
|
|
102
|
-
readonly LegacyFeedsWrite: "feeds:write";
|
|
103
100
|
};
|
|
104
101
|
type Permission = (typeof Permission)[keyof typeof Permission];
|
|
105
102
|
type AccessLevel = "write" | "read" | "none";
|
|
106
103
|
type RequiredAccessLevel = "read" | "write";
|
|
107
104
|
type PermissionMatrix = {
|
|
108
105
|
room: AccessLevel;
|
|
109
|
-
presence: AccessLevel;
|
|
110
106
|
storage: AccessLevel;
|
|
111
107
|
comments: AccessLevel;
|
|
112
108
|
feeds: AccessLevel;
|
|
@@ -122,14 +118,7 @@ type RoomPermissionGrant = {
|
|
|
122
118
|
scopes: readonly string[];
|
|
123
119
|
};
|
|
124
120
|
type RoomPermission = Permission[];
|
|
125
|
-
type
|
|
126
|
-
default?: "read" | "write";
|
|
127
|
-
presence?: "read" | "none";
|
|
128
|
-
storage?: "read" | "write" | "none";
|
|
129
|
-
comments?: "read" | "write" | "none";
|
|
130
|
-
feeds?: "read" | "write" | "none";
|
|
131
|
-
};
|
|
132
|
-
type RoomPermissionInput = readonly Permission[] | RoomPermissionObject;
|
|
121
|
+
type RoomPermissionInput = readonly Permission[];
|
|
133
122
|
type RoomAccesses = Record<string, RoomPermission>;
|
|
134
123
|
type RoomAccessesInput = Record<string, RoomPermissionInput>;
|
|
135
124
|
type RoomAccessesUpdateInput = Record<string, RoomPermissionInput | null>;
|
|
@@ -5775,4 +5764,4 @@ type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (EnsureJson
|
|
|
5775
5764
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
5776
5765
|
};
|
|
5777
5766
|
|
|
5778
|
-
export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomAccessesInput, type RoomAccessesUpdateInput, type RoomEventMessage, type RoomPermission, type RoomPermissionGrant, type RoomPermissionInput, type
|
|
5767
|
+
export { type AccessLevel, type ActivityData, type AiAssistantContentPart, type AiAssistantMessage, type AiChat, type AiChatMessage, type AiChatsQuery, type AiKnowledgeRetrievalPart, type AiKnowledgeSource, type AiOpaqueToolDefinition, type AiOpaqueToolInvocationProps, type AiReasoningPart, type AiRetrievalPart, type AiSourcesPart, type AiTextPart, type AiToolDefinition, type AiToolExecuteCallback, type AiToolExecuteContext, type AiToolInvocationPart, type AiToolInvocationProps, type AiToolTypePack, type AiUrlSource, type AiUserMessage, type AiWebRetrievalPart, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseGroupInfo, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type ChildStorageNode, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type ClientWireOp, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, type CommentsEventServerMsg, type CompactChildNode, type CompactListNode, type CompactMapNode, type CompactNode, type CompactObjectNode, type CompactRegisterNode, type CompactRootNode, type ContextualPromptContext, type ContextualPromptResponse, type CopilotId, CrdtType, type CreateListOp, type CreateManagedPoolOptions, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type Cursor, type CustomAuthenticationResult, type DAD, type DCM, type DE, type DFM, type DFMD, type DGI, type DP, type DRI, type DS, type DTM, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, Deque, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type Feed, type FeedCreateMetadata, type FeedDeletedServerMsg, type FeedFetchMetadataFilter, type FeedMessage, type FeedMessagesAddedServerMsg, type FeedMessagesDeletedServerMsg, type FeedMessagesListServerMsg, type FeedMessagesUpdatedServerMsg, type FeedRequestError, FeedRequestErrorCode, type FeedRequestFailedServerMsg, type FeedUpdateMetadata, type FeedsAddedServerMsg, type FeedsEventServerMsg, type FeedsListServerMsg, type FeedsUpdatedServerMsg, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type GroupData, type GroupDataPlain, type GroupMemberData, type GroupMentionData, type GroupScopes, type HasOpId, type History, type HistoryVersion, HttpError, type ISODateString, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IgnoredOp, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InferFromSchema, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LayerKey, type ListStorageNode, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MENTION_CHARACTER, type ManagedPool, type MapStorageNode, type MentionData, type MessageId, MutableSignal, type NoInfr, type NodeMap, type NodeStream, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, type ObjectStorageNode, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, type Patchable, Permission, type PermissionMatrix, type PermissionResources, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type ReadonlyJson, type ReadonlyJsonObject, type RegisterStorageNode, type RejectedStorageOpServerMsg, type Relax, type RenderableToolResultResponse, type RequiredAccessLevel, type Resolve, type ResolveGroupsInfoArgs, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomAccesses, type RoomAccessesInput, type RoomAccessesUpdateInput, type RoomEventMessage, type RoomPermission, type RoomPermissionGrant, type RoomPermissionInput, type RoomStateServerMsg, type RoomSubscriptionSettings, type RootStorageNode, type SearchCommentsResult, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type ServerWireOp, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageChunkServerMsg, type StorageNode, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, type SyncConfig, type SyncMode, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToJson, type ToolResultResponse, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type UrlMetadata, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserMentionData, type UserRoomSubscriptionSettings, type UserSubscriptionData, type UserSubscriptionDataPlain, WebsocketCloseCodes, type WithNavigation, type WithOptional, type WithRequired, type YDocUpdateServerMsg, type YjsSyncStatus, asPos, assert, assertNever, autoRetry, b64decode, batch, checkBounds, chunk, cloneLson, compactNodesToNodeStream, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToGroupData, convertToInboxNotificationData, convertToSubscriptionData, convertToThreadData, convertToUserSubscriptionData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, deepLiveify, defineAiTool, deprecate, deprecateIf, detectDupes, entries, errorIf, findLastIndex, freeze, generateUrl, getMentionsFromCommentBody, getSubscriptionKey, hasPermissionAccess, html, htmlSafe, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isListStorageNode, isLiveNode, isMapStorageNode, isNotificationChannelEnabled, isNumberOperator, isObjectStorageNode, isPlainObject, isRegisterStorageNode, isRootStorageNode, isStartsWithOperator, isUrl, kInternal, keys, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, mergePermissionMatrices, nanoid, nn, nodeStreamToCompactNodes, normalizeRoomAccessesInput, normalizeRoomAccessesUpdateInput, normalizeRoomPermissionInput, objectToQuery, patchNotificationSettings, permissionMatrixFromScopes, permissionMatrixToScopes, raise, resolveMentionsInCommentBody, sanitizeUrl, shallow, shallow2, stableStringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, url, urljoin, wait, warnOnce, warnOnceIf, withTimeout };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "3.20.0-
|
|
9
|
+
var PKG_VERSION = "3.20.0-perm5";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -5170,40 +5170,37 @@ function createReceivingToolInvocation(invocationId, name, partialArgsText = "")
|
|
|
5170
5170
|
// src/protocol/Permissions.ts
|
|
5171
5171
|
var Permission = {
|
|
5172
5172
|
/**
|
|
5173
|
-
* Default permission for a room
|
|
5173
|
+
* Default permission for a room.
|
|
5174
5174
|
*/
|
|
5175
|
-
|
|
5176
|
-
|
|
5175
|
+
Read: "*:read",
|
|
5176
|
+
Write: "*:write",
|
|
5177
5177
|
/**
|
|
5178
|
-
*
|
|
5178
|
+
* Legacy aliases for default room permissions.
|
|
5179
5179
|
*/
|
|
5180
|
-
|
|
5181
|
-
|
|
5180
|
+
RoomWrite: "room:write",
|
|
5181
|
+
RoomRead: "room:read",
|
|
5182
5182
|
/**
|
|
5183
5183
|
* Storage
|
|
5184
5184
|
*/
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5185
|
+
StorageRead: "storage:read",
|
|
5186
|
+
StorageWrite: "storage:write",
|
|
5187
|
+
StorageNone: "storage:none",
|
|
5188
5188
|
/**
|
|
5189
5189
|
* Comments
|
|
5190
5190
|
*/
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5191
|
+
CommentsWrite: "comments:write",
|
|
5192
|
+
CommentsRead: "comments:read",
|
|
5193
|
+
CommentsNone: "comments:none",
|
|
5194
5194
|
/**
|
|
5195
5195
|
* Feeds
|
|
5196
5196
|
*/
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5197
|
+
FeedsRead: "feeds:read",
|
|
5198
|
+
FeedsWrite: "feeds:write",
|
|
5199
|
+
FeedsNone: "feeds:none",
|
|
5200
5200
|
/**
|
|
5201
5201
|
* Legacy
|
|
5202
5202
|
*/
|
|
5203
|
-
LegacyRoomPresenceWrite: "room:presence:write"
|
|
5204
|
-
LegacyCommentsWrite: "comments:write",
|
|
5205
|
-
LegacyCommentsRead: "comments:read",
|
|
5206
|
-
LegacyFeedsWrite: "feeds:write"
|
|
5203
|
+
LegacyRoomPresenceWrite: "room:presence:write"
|
|
5207
5204
|
};
|
|
5208
5205
|
var ACCESS_LEVELS = [
|
|
5209
5206
|
"none",
|
|
@@ -5217,7 +5214,6 @@ var ACCESS_RANKS = {
|
|
|
5217
5214
|
};
|
|
5218
5215
|
var NO_PERMISSION_MATRIX = {
|
|
5219
5216
|
room: "none",
|
|
5220
|
-
presence: "none",
|
|
5221
5217
|
storage: "none",
|
|
5222
5218
|
comments: "none",
|
|
5223
5219
|
feeds: "none",
|
|
@@ -5225,36 +5221,30 @@ var NO_PERMISSION_MATRIX = {
|
|
|
5225
5221
|
};
|
|
5226
5222
|
var RESOURCE_PERMISSIONS = {
|
|
5227
5223
|
room: {
|
|
5228
|
-
read: [Permission.RoomRead],
|
|
5229
|
-
write: [Permission.RoomWrite]
|
|
5224
|
+
read: [Permission.Read, Permission.RoomRead],
|
|
5225
|
+
write: [Permission.Write, Permission.RoomWrite]
|
|
5230
5226
|
},
|
|
5231
5227
|
personal: {
|
|
5232
5228
|
write: []
|
|
5233
5229
|
},
|
|
5234
|
-
presence: {
|
|
5235
|
-
write: [Permission.LegacyRoomPresenceWrite],
|
|
5236
|
-
read: [Permission.RoomPresenceRead],
|
|
5237
|
-
none: [Permission.RoomPresenceNone]
|
|
5238
|
-
},
|
|
5239
5230
|
storage: {
|
|
5240
|
-
write: [Permission.
|
|
5241
|
-
read: [Permission.
|
|
5242
|
-
none: [Permission.
|
|
5231
|
+
write: [Permission.StorageWrite],
|
|
5232
|
+
read: [Permission.StorageRead],
|
|
5233
|
+
none: [Permission.StorageNone]
|
|
5243
5234
|
},
|
|
5244
5235
|
comments: {
|
|
5245
|
-
write: [Permission.
|
|
5246
|
-
read: [Permission.
|
|
5247
|
-
none: [Permission.
|
|
5236
|
+
write: [Permission.CommentsWrite],
|
|
5237
|
+
read: [Permission.CommentsRead],
|
|
5238
|
+
none: [Permission.CommentsNone]
|
|
5248
5239
|
},
|
|
5249
5240
|
feeds: {
|
|
5250
|
-
write: [Permission.
|
|
5251
|
-
read: [Permission.
|
|
5252
|
-
none: [Permission.
|
|
5241
|
+
write: [Permission.FeedsWrite],
|
|
5242
|
+
read: [Permission.FeedsRead],
|
|
5243
|
+
none: [Permission.FeedsNone]
|
|
5253
5244
|
}
|
|
5254
5245
|
};
|
|
5255
5246
|
var DEFAULT_PERMISSION_RESOURCE = "room";
|
|
5256
5247
|
var ROOM_PERMISSION_RESOURCES = [
|
|
5257
|
-
"presence",
|
|
5258
5248
|
"storage",
|
|
5259
5249
|
"comments",
|
|
5260
5250
|
"feeds"
|
|
@@ -5272,7 +5262,7 @@ function resolveResourceAccess(scopes, resource) {
|
|
|
5272
5262
|
}
|
|
5273
5263
|
function resolveFullPermissionMatrix(resolved) {
|
|
5274
5264
|
if (!resolved.hasDefaultPermission) {
|
|
5275
|
-
return
|
|
5265
|
+
return NO_PERMISSION_MATRIX;
|
|
5276
5266
|
}
|
|
5277
5267
|
const matrix = {
|
|
5278
5268
|
...NO_PERMISSION_MATRIX,
|
|
@@ -5287,8 +5277,8 @@ function permissionMatrixFromScopes(scopes) {
|
|
|
5287
5277
|
return resolveFullPermissionMatrix(resolvePermissionMatrix(scopes));
|
|
5288
5278
|
}
|
|
5289
5279
|
function resolvePermissionMatrix(scopes) {
|
|
5290
|
-
const hasDefaultPermission = scopes.includes(Permission.RoomWrite) || scopes.includes(Permission.RoomRead);
|
|
5291
|
-
const baseAccess = scopes.includes(Permission.RoomWrite) ? "write" : scopes.includes(Permission.RoomRead) ? "read" : "none";
|
|
5280
|
+
const hasDefaultPermission = scopes.includes(Permission.Write) || scopes.includes(Permission.Read) || scopes.includes(Permission.RoomWrite) || scopes.includes(Permission.RoomRead);
|
|
5281
|
+
const baseAccess = scopes.includes(Permission.Write) || scopes.includes(Permission.RoomWrite) ? "write" : scopes.includes(Permission.Read) || scopes.includes(Permission.RoomRead) ? "read" : "none";
|
|
5292
5282
|
const matrix = {};
|
|
5293
5283
|
for (const resource of ROOM_PERMISSION_RESOURCES) {
|
|
5294
5284
|
const access = resolveResourceAccess(scopes, resource);
|
|
@@ -5309,10 +5299,6 @@ function isPermissionScopes(source) {
|
|
|
5309
5299
|
|
|
5310
5300
|
// src/permissions.ts
|
|
5311
5301
|
var VALID_PERMISSIONS = new Set(Object.values(Permission));
|
|
5312
|
-
var ROOM_PERMISSION_OBJECT_KEYS = /* @__PURE__ */ new Set([
|
|
5313
|
-
"default",
|
|
5314
|
-
...ROOM_PERMISSION_RESOURCES
|
|
5315
|
-
]);
|
|
5316
5302
|
function permissionForAccessLevel(resource, access, field = resource) {
|
|
5317
5303
|
const levels = RESOURCE_PERMISSIONS[resource];
|
|
5318
5304
|
const permissions = levels[access];
|
|
@@ -5333,8 +5319,10 @@ function resolveRoomPermissionMatrix(permissions, roomId) {
|
|
|
5333
5319
|
let hasDefaultPermission = false;
|
|
5334
5320
|
let baseAccess = "none";
|
|
5335
5321
|
const explicitMatrix = {};
|
|
5322
|
+
const explicitSpecificity = {};
|
|
5336
5323
|
for (const permission of matchedPermissions) {
|
|
5337
5324
|
const resolved = resolvePermissionMatrix(permission.scopes);
|
|
5325
|
+
const specificity = getResourceSpecificity(permission.resource);
|
|
5338
5326
|
if (resolved.hasDefaultPermission) {
|
|
5339
5327
|
hasDefaultPermission = true;
|
|
5340
5328
|
baseAccess = strongestAccess(baseAccess, resolved.baseAccess);
|
|
@@ -5342,10 +5330,16 @@ function resolveRoomPermissionMatrix(permissions, roomId) {
|
|
|
5342
5330
|
for (const resource of ROOM_PERMISSION_RESOURCES) {
|
|
5343
5331
|
const access = resolved.matrix[resource];
|
|
5344
5332
|
if (access !== void 0) {
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
access
|
|
5348
|
-
|
|
5333
|
+
const currentSpecificity = explicitSpecificity[resource] ?? -1;
|
|
5334
|
+
if (specificity > currentSpecificity) {
|
|
5335
|
+
explicitMatrix[resource] = access;
|
|
5336
|
+
explicitSpecificity[resource] = specificity;
|
|
5337
|
+
} else if (specificity === currentSpecificity) {
|
|
5338
|
+
explicitMatrix[resource] = strongestAccess(
|
|
5339
|
+
explicitMatrix[resource] ?? "none",
|
|
5340
|
+
access
|
|
5341
|
+
);
|
|
5342
|
+
}
|
|
5349
5343
|
}
|
|
5350
5344
|
}
|
|
5351
5345
|
}
|
|
@@ -5355,46 +5349,16 @@ function resolveRoomPermissionMatrix(permissions, roomId) {
|
|
|
5355
5349
|
matrix: explicitMatrix
|
|
5356
5350
|
});
|
|
5357
5351
|
}
|
|
5358
|
-
function isRoomPermissionArray(input) {
|
|
5359
|
-
return Array.isArray(input);
|
|
5360
|
-
}
|
|
5361
5352
|
function normalizeRoomPermissionInput(input) {
|
|
5362
|
-
if (
|
|
5363
|
-
|
|
5364
|
-
if (!VALID_PERMISSIONS.has(permission)) {
|
|
5365
|
-
throw new Error(`Not a valid permission: ${permission}`);
|
|
5366
|
-
}
|
|
5367
|
-
return permission;
|
|
5368
|
-
});
|
|
5353
|
+
if (!Array.isArray(input)) {
|
|
5354
|
+
throw new Error("Permission list must be an array");
|
|
5369
5355
|
}
|
|
5370
|
-
return
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
for (const key of Object.keys(objectInput)) {
|
|
5374
|
-
if (!ROOM_PERMISSION_OBJECT_KEYS.has(key)) {
|
|
5375
|
-
throw new Error(`Unknown permission field: ${key}`);
|
|
5356
|
+
return input.map((permission) => {
|
|
5357
|
+
if (!VALID_PERMISSIONS.has(permission)) {
|
|
5358
|
+
throw new Error(`Not a valid permission: ${permission}`);
|
|
5376
5359
|
}
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
if (objectInput.default !== void 0) {
|
|
5380
|
-
permissions.push(
|
|
5381
|
-
permissionForAccessLevel(
|
|
5382
|
-
DEFAULT_PERMISSION_RESOURCE,
|
|
5383
|
-
objectInput.default,
|
|
5384
|
-
"default"
|
|
5385
|
-
)
|
|
5386
|
-
);
|
|
5387
|
-
}
|
|
5388
|
-
for (const resource of ROOM_PERMISSION_RESOURCES) {
|
|
5389
|
-
const access = objectInput[resource];
|
|
5390
|
-
if (access !== void 0) {
|
|
5391
|
-
permissions.push(permissionForAccessLevel(resource, access));
|
|
5392
|
-
}
|
|
5393
|
-
}
|
|
5394
|
-
if (permissions.length === 0) {
|
|
5395
|
-
throw new Error("Permission object cannot be empty");
|
|
5396
|
-
}
|
|
5397
|
-
return permissions;
|
|
5360
|
+
return permission;
|
|
5361
|
+
});
|
|
5398
5362
|
}
|
|
5399
5363
|
function normalizeRoomAccessesInput(input) {
|
|
5400
5364
|
if (input === void 0) {
|
|
@@ -5421,7 +5385,6 @@ function normalizeRoomAccessesUpdateInput(input) {
|
|
|
5421
5385
|
function mergePermissionMatrices(sources) {
|
|
5422
5386
|
return {
|
|
5423
5387
|
room: strongestMatrixAccess(sources, "room"),
|
|
5424
|
-
presence: strongestMatrixAccess(sources, "presence"),
|
|
5425
5388
|
storage: strongestMatrixAccess(sources, "storage"),
|
|
5426
5389
|
comments: strongestMatrixAccess(sources, "comments"),
|
|
5427
5390
|
feeds: strongestMatrixAccess(sources, "feeds"),
|
|
@@ -5459,6 +5422,9 @@ function resourceMatchesRoomId(resource, roomId) {
|
|
|
5459
5422
|
}
|
|
5460
5423
|
return resource === roomId;
|
|
5461
5424
|
}
|
|
5425
|
+
function getResourceSpecificity(resource) {
|
|
5426
|
+
return resource.replace("*", "").length;
|
|
5427
|
+
}
|
|
5462
5428
|
|
|
5463
5429
|
// src/protocol/AuthToken.ts
|
|
5464
5430
|
function isValidAuthTokenPayload(data) {
|
|
@@ -11482,7 +11448,9 @@ function createRoom(options, config) {
|
|
|
11482
11448
|
_dump: () => {
|
|
11483
11449
|
const n = context.pool.nodes.size;
|
|
11484
11450
|
return `Room "${roomId}" (${n} node${n === 1 ? "" : "s"}):
|
|
11485
|
-
${dumpPool(
|
|
11451
|
+
${dumpPool(
|
|
11452
|
+
context.pool
|
|
11453
|
+
)}`;
|
|
11486
11454
|
},
|
|
11487
11455
|
destroy: () => {
|
|
11488
11456
|
pendingFeedsRequests.forEach(
|
|
@@ -11677,7 +11645,7 @@ function makeAuthDelegateForRoom(roomId, authManager) {
|
|
|
11677
11645
|
return async () => {
|
|
11678
11646
|
return authManager.getAuthValue({
|
|
11679
11647
|
roomId,
|
|
11680
|
-
resource: "
|
|
11648
|
+
resource: "room",
|
|
11681
11649
|
access: "read"
|
|
11682
11650
|
});
|
|
11683
11651
|
};
|