@liveblocks/core 3.21.0-private1 → 3.21.0-private3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -93,9 +93,6 @@ declare const Permission: {
93
93
  readonly CommentsPrivateWrite: "comments:private:write";
94
94
  readonly CommentsPrivateRead: "comments:private:read";
95
95
  readonly CommentsPrivateNone: "comments:private:none";
96
- readonly CommentsPersonalWrite: "comments:personal:write";
97
- readonly CommentsPersonalRead: "comments:personal:read";
98
- readonly CommentsPersonalNone: "comments:personal:none";
99
96
  /**
100
97
  * Feeds
101
98
  */
@@ -117,7 +114,6 @@ type PermissionMatrix = {
117
114
  comments: AccessLevel;
118
115
  "comments:public": AccessLevel;
119
116
  "comments:private": AccessLevel;
120
- "comments:personal": AccessLevel;
121
117
  feeds: AccessLevel;
122
118
  personal: AccessLevel;
123
119
  };
@@ -125,22 +121,11 @@ type PermissionResources = keyof PermissionMatrix;
125
121
  type RoomPermissions = Permission[];
126
122
  type RoomAccesses = Record<string, RoomPermissions>;
127
123
  type UpdateRoomAccesses = Record<string, RoomPermissions | null>;
124
+ declare function permissionMatrixFromScopes(scopes: RoomPermissions): PermissionMatrix;
125
+ declare function hasPermissionAccess(matrix: Partial<PermissionMatrix>, resource: PermissionResources, requiredAccess: RequiredAccessLevel): boolean;
128
126
  declare function normalizeRoomPermissions(permissions: string[] | readonly string[]): RoomPermissions;
129
127
  declare function normalizeRoomAccesses(accesses: RoomAccesses | undefined): RoomAccesses | undefined;
130
128
  declare function normalizeUpdateRoomAccesses(accesses: UpdateRoomAccesses | undefined): UpdateRoomAccesses | undefined;
131
- /**
132
- * Validates a set of permissions:
133
- * - every scope must be a known permission scope,
134
- * - exactly one base permission is required (*:read, *:write, or the legacy
135
- * aliases room:read, room:write),
136
- * - at most one scope per feature (storage, comments, feeds, ...),
137
- * - room:presence:write is accepted as an extra legacy scope.
138
- *
139
- * Returns `true` when the set is valid, or an error message otherwise.
140
- */
141
- declare function validatePermissionsSet(scopes: readonly string[]): true | string;
142
- declare function permissionMatrixFromScopes(scopes: RoomPermissions): PermissionMatrix;
143
- declare function hasPermissionAccess(matrix: Partial<PermissionMatrix>, resource: PermissionResources, requiredAccess: RequiredAccessLevel): boolean;
144
129
  /**
145
130
  * Merges permission scopes from multiple sources, by priority: explicit user
146
131
  * accesses override group accesses, which override the room defaults. Groups
@@ -152,6 +137,17 @@ declare function mergeRoomPermissionScopes({ defaultAccesses, groupsAccesses, us
152
137
  groupsAccesses: RoomPermissions[];
153
138
  userAccesses: RoomPermissions;
154
139
  }): RoomPermissions;
140
+ /**
141
+ * Validates a set of permissions:
142
+ * - every scope must be a known permission scope,
143
+ * - exactly one base permission is required (*:read, *:write, or the legacy
144
+ * aliases room:read, room:write),
145
+ * - at most one scope per feature (storage, comments, feeds, ...),
146
+ * - room:presence:write is accepted as an extra legacy scope.
147
+ *
148
+ * Returns `true` when the set is valid, or an error message otherwise.
149
+ */
150
+ declare function validatePermissionsSet(scopes: readonly string[]): true | string;
155
151
 
156
152
  type CustomAuthenticationResult = Relax<{
157
153
  token: string;
@@ -1750,17 +1746,20 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1750
1746
  deleteThread({ roomId, threadId, }: {
1751
1747
  roomId: string;
1752
1748
  threadId: string;
1749
+ visibility?: ThreadVisibility;
1753
1750
  }): Promise<void>;
1754
1751
  editThreadMetadata({ roomId, metadata, threadId, }: {
1755
1752
  roomId: string;
1756
1753
  metadata: Patchable<TM>;
1757
1754
  threadId: string;
1755
+ visibility?: ThreadVisibility;
1758
1756
  }): Promise<TM>;
1759
1757
  editCommentMetadata({ roomId, threadId, commentId, metadata, }: {
1760
1758
  roomId: string;
1761
1759
  threadId: string;
1762
1760
  commentId: string;
1763
1761
  metadata: Patchable<CM>;
1762
+ visibility?: ThreadVisibility;
1764
1763
  }): Promise<CM>;
1765
1764
  createComment({ roomId, threadId, commentId, body, metadata, attachmentIds, }: {
1766
1765
  roomId: string;
@@ -1769,6 +1768,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1769
1768
  body: CommentBody;
1770
1769
  metadata?: CM;
1771
1770
  attachmentIds?: string[];
1771
+ visibility?: ThreadVisibility;
1772
1772
  }): Promise<CommentData<CM>>;
1773
1773
  editComment({ roomId, threadId, commentId, body, attachmentIds, metadata, }: {
1774
1774
  roomId: string;
@@ -1777,31 +1777,37 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1777
1777
  body: CommentBody;
1778
1778
  attachmentIds?: string[];
1779
1779
  metadata?: Patchable<CM>;
1780
+ visibility?: ThreadVisibility;
1780
1781
  }): Promise<CommentData<CM>>;
1781
1782
  deleteComment({ roomId, threadId, commentId, }: {
1782
1783
  roomId: string;
1783
1784
  threadId: string;
1784
1785
  commentId: string;
1786
+ visibility?: ThreadVisibility;
1785
1787
  }): Promise<void>;
1786
1788
  addReaction({ roomId, threadId, commentId, emoji, }: {
1787
1789
  roomId: string;
1788
1790
  threadId: string;
1789
1791
  commentId: string;
1790
1792
  emoji: string;
1793
+ visibility?: ThreadVisibility;
1791
1794
  }): Promise<CommentUserReaction>;
1792
1795
  removeReaction({ roomId, threadId, commentId, emoji, }: {
1793
1796
  roomId: string;
1794
1797
  threadId: string;
1795
1798
  commentId: string;
1796
1799
  emoji: string;
1800
+ visibility?: ThreadVisibility;
1797
1801
  }): Promise<void>;
1798
1802
  markThreadAsResolved({ roomId, threadId, }: {
1799
1803
  roomId: string;
1800
1804
  threadId: string;
1805
+ visibility?: ThreadVisibility;
1801
1806
  }): Promise<void>;
1802
1807
  markThreadAsUnresolved({ roomId, threadId, }: {
1803
1808
  roomId: string;
1804
1809
  threadId: string;
1810
+ visibility?: ThreadVisibility;
1805
1811
  }): Promise<void>;
1806
1812
  subscribeToThread({ roomId, threadId, }: {
1807
1813
  roomId: string;
@@ -4150,6 +4156,7 @@ type PrivateRoomApi = {
4150
4156
  getSelf_forDevTools(): UserTreeNode | null;
4151
4157
  getOthers_forDevTools(): readonly UserTreeNode[];
4152
4158
  reportTextEditor(editor: TextEditorType, rootKey: string): Promise<void>;
4159
+ getPermissionMatrix(): PermissionMatrix | undefined;
4153
4160
  createTextMention(mentionId: string, mention: MentionData): Promise<void>;
4154
4161
  deleteTextMention(mentionId: string): Promise<void>;
4155
4162
  listTextVersions(): Promise<{
package/dist/index.d.ts CHANGED
@@ -93,9 +93,6 @@ declare const Permission: {
93
93
  readonly CommentsPrivateWrite: "comments:private:write";
94
94
  readonly CommentsPrivateRead: "comments:private:read";
95
95
  readonly CommentsPrivateNone: "comments:private:none";
96
- readonly CommentsPersonalWrite: "comments:personal:write";
97
- readonly CommentsPersonalRead: "comments:personal:read";
98
- readonly CommentsPersonalNone: "comments:personal:none";
99
96
  /**
100
97
  * Feeds
101
98
  */
@@ -117,7 +114,6 @@ type PermissionMatrix = {
117
114
  comments: AccessLevel;
118
115
  "comments:public": AccessLevel;
119
116
  "comments:private": AccessLevel;
120
- "comments:personal": AccessLevel;
121
117
  feeds: AccessLevel;
122
118
  personal: AccessLevel;
123
119
  };
@@ -125,22 +121,11 @@ type PermissionResources = keyof PermissionMatrix;
125
121
  type RoomPermissions = Permission[];
126
122
  type RoomAccesses = Record<string, RoomPermissions>;
127
123
  type UpdateRoomAccesses = Record<string, RoomPermissions | null>;
124
+ declare function permissionMatrixFromScopes(scopes: RoomPermissions): PermissionMatrix;
125
+ declare function hasPermissionAccess(matrix: Partial<PermissionMatrix>, resource: PermissionResources, requiredAccess: RequiredAccessLevel): boolean;
128
126
  declare function normalizeRoomPermissions(permissions: string[] | readonly string[]): RoomPermissions;
129
127
  declare function normalizeRoomAccesses(accesses: RoomAccesses | undefined): RoomAccesses | undefined;
130
128
  declare function normalizeUpdateRoomAccesses(accesses: UpdateRoomAccesses | undefined): UpdateRoomAccesses | undefined;
131
- /**
132
- * Validates a set of permissions:
133
- * - every scope must be a known permission scope,
134
- * - exactly one base permission is required (*:read, *:write, or the legacy
135
- * aliases room:read, room:write),
136
- * - at most one scope per feature (storage, comments, feeds, ...),
137
- * - room:presence:write is accepted as an extra legacy scope.
138
- *
139
- * Returns `true` when the set is valid, or an error message otherwise.
140
- */
141
- declare function validatePermissionsSet(scopes: readonly string[]): true | string;
142
- declare function permissionMatrixFromScopes(scopes: RoomPermissions): PermissionMatrix;
143
- declare function hasPermissionAccess(matrix: Partial<PermissionMatrix>, resource: PermissionResources, requiredAccess: RequiredAccessLevel): boolean;
144
129
  /**
145
130
  * Merges permission scopes from multiple sources, by priority: explicit user
146
131
  * accesses override group accesses, which override the room defaults. Groups
@@ -152,6 +137,17 @@ declare function mergeRoomPermissionScopes({ defaultAccesses, groupsAccesses, us
152
137
  groupsAccesses: RoomPermissions[];
153
138
  userAccesses: RoomPermissions;
154
139
  }): RoomPermissions;
140
+ /**
141
+ * Validates a set of permissions:
142
+ * - every scope must be a known permission scope,
143
+ * - exactly one base permission is required (*:read, *:write, or the legacy
144
+ * aliases room:read, room:write),
145
+ * - at most one scope per feature (storage, comments, feeds, ...),
146
+ * - room:presence:write is accepted as an extra legacy scope.
147
+ *
148
+ * Returns `true` when the set is valid, or an error message otherwise.
149
+ */
150
+ declare function validatePermissionsSet(scopes: readonly string[]): true | string;
155
151
 
156
152
  type CustomAuthenticationResult = Relax<{
157
153
  token: string;
@@ -1750,17 +1746,20 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1750
1746
  deleteThread({ roomId, threadId, }: {
1751
1747
  roomId: string;
1752
1748
  threadId: string;
1749
+ visibility?: ThreadVisibility;
1753
1750
  }): Promise<void>;
1754
1751
  editThreadMetadata({ roomId, metadata, threadId, }: {
1755
1752
  roomId: string;
1756
1753
  metadata: Patchable<TM>;
1757
1754
  threadId: string;
1755
+ visibility?: ThreadVisibility;
1758
1756
  }): Promise<TM>;
1759
1757
  editCommentMetadata({ roomId, threadId, commentId, metadata, }: {
1760
1758
  roomId: string;
1761
1759
  threadId: string;
1762
1760
  commentId: string;
1763
1761
  metadata: Patchable<CM>;
1762
+ visibility?: ThreadVisibility;
1764
1763
  }): Promise<CM>;
1765
1764
  createComment({ roomId, threadId, commentId, body, metadata, attachmentIds, }: {
1766
1765
  roomId: string;
@@ -1769,6 +1768,7 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1769
1768
  body: CommentBody;
1770
1769
  metadata?: CM;
1771
1770
  attachmentIds?: string[];
1771
+ visibility?: ThreadVisibility;
1772
1772
  }): Promise<CommentData<CM>>;
1773
1773
  editComment({ roomId, threadId, commentId, body, attachmentIds, metadata, }: {
1774
1774
  roomId: string;
@@ -1777,31 +1777,37 @@ interface RoomHttpApi<TM extends BaseMetadata, CM extends BaseMetadata> {
1777
1777
  body: CommentBody;
1778
1778
  attachmentIds?: string[];
1779
1779
  metadata?: Patchable<CM>;
1780
+ visibility?: ThreadVisibility;
1780
1781
  }): Promise<CommentData<CM>>;
1781
1782
  deleteComment({ roomId, threadId, commentId, }: {
1782
1783
  roomId: string;
1783
1784
  threadId: string;
1784
1785
  commentId: string;
1786
+ visibility?: ThreadVisibility;
1785
1787
  }): Promise<void>;
1786
1788
  addReaction({ roomId, threadId, commentId, emoji, }: {
1787
1789
  roomId: string;
1788
1790
  threadId: string;
1789
1791
  commentId: string;
1790
1792
  emoji: string;
1793
+ visibility?: ThreadVisibility;
1791
1794
  }): Promise<CommentUserReaction>;
1792
1795
  removeReaction({ roomId, threadId, commentId, emoji, }: {
1793
1796
  roomId: string;
1794
1797
  threadId: string;
1795
1798
  commentId: string;
1796
1799
  emoji: string;
1800
+ visibility?: ThreadVisibility;
1797
1801
  }): Promise<void>;
1798
1802
  markThreadAsResolved({ roomId, threadId, }: {
1799
1803
  roomId: string;
1800
1804
  threadId: string;
1805
+ visibility?: ThreadVisibility;
1801
1806
  }): Promise<void>;
1802
1807
  markThreadAsUnresolved({ roomId, threadId, }: {
1803
1808
  roomId: string;
1804
1809
  threadId: string;
1810
+ visibility?: ThreadVisibility;
1805
1811
  }): Promise<void>;
1806
1812
  subscribeToThread({ roomId, threadId, }: {
1807
1813
  roomId: string;
@@ -4150,6 +4156,7 @@ type PrivateRoomApi = {
4150
4156
  getSelf_forDevTools(): UserTreeNode | null;
4151
4157
  getOthers_forDevTools(): readonly UserTreeNode[];
4152
4158
  reportTextEditor(editor: TextEditorType, rootKey: string): Promise<void>;
4159
+ getPermissionMatrix(): PermissionMatrix | undefined;
4153
4160
  createTextMention(mentionId: string, mention: MentionData): Promise<void>;
4154
4161
  deleteTextMention(mentionId: string): Promise<void>;
4155
4162
  listTextVersions(): Promise<{