@sublay/js 7.9.0 → 7.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +9 -0
  3. package/README.md +23 -14
  4. package/dist/index.d.mts +38 -7
  5. package/dist/index.d.ts +4363 -35
  6. package/dist/index.js +3 -3
  7. package/dist/index.mjs +3 -3
  8. package/package.json +29 -18
  9. package/dist/core/client.d.ts +0 -64
  10. package/dist/core/multipart.d.ts +0 -22
  11. package/dist/core/spaceReputationParams.d.ts +0 -57
  12. package/dist/interfaces/AppNotification.d.ts +0 -258
  13. package/dist/interfaces/ChatMessage.d.ts +0 -40
  14. package/dist/interfaces/Collection.d.ts +0 -10
  15. package/dist/interfaces/Comment.d.ts +0 -50
  16. package/dist/interfaces/Connection.d.ts +0 -67
  17. package/dist/interfaces/Conversation.d.ts +0 -27
  18. package/dist/interfaces/ConversationMember.d.ts +0 -17
  19. package/dist/interfaces/Entity.d.ts +0 -63
  20. package/dist/interfaces/Event.d.ts +0 -66
  21. package/dist/interfaces/File.d.ts +0 -39
  22. package/dist/interfaces/Follow.d.ts +0 -19
  23. package/dist/interfaces/HostedApp.d.ts +0 -11
  24. package/dist/interfaces/IPaginatedResponse.d.ts +0 -11
  25. package/dist/interfaces/ImageProcessing.d.ts +0 -62
  26. package/dist/interfaces/Mention.d.ts +0 -12
  27. package/dist/interfaces/OAuthIdentity.d.ts +0 -14
  28. package/dist/interfaces/Project.d.ts +0 -14
  29. package/dist/interfaces/Push.d.ts +0 -74
  30. package/dist/interfaces/Reaction.d.ts +0 -23
  31. package/dist/interfaces/Report.d.ts +0 -38
  32. package/dist/interfaces/ReputationGrant.d.ts +0 -85
  33. package/dist/interfaces/Rule.d.ts +0 -22
  34. package/dist/interfaces/Space.d.ts +0 -130
  35. package/dist/interfaces/SpaceMember.d.ts +0 -29
  36. package/dist/interfaces/SpaceReputation.d.ts +0 -100
  37. package/dist/interfaces/Table.d.ts +0 -63
  38. package/dist/interfaces/User.d.ts +0 -46
  39. package/dist/interfaces/UserSearch.d.ts +0 -13
  40. package/dist/interfaces/Workspace.d.ts +0 -178
  41. package/dist/modules/app-notifications/countUnreadNotifications.d.ts +0 -2
  42. package/dist/modules/app-notifications/fetchNotifications.d.ts +0 -8
  43. package/dist/modules/app-notifications/index.d.ts +0 -4
  44. package/dist/modules/app-notifications/markAllNotificationsAsRead.d.ts +0 -5
  45. package/dist/modules/app-notifications/markNotificationAsRead.d.ts +0 -5
  46. package/dist/modules/auth/changePassword.d.ts +0 -34
  47. package/dist/modules/auth/confirmAccountDeletion.d.ts +0 -11
  48. package/dist/modules/auth/index.d.ts +0 -13
  49. package/dist/modules/auth/requestAccountDeletion.d.ts +0 -14
  50. package/dist/modules/auth/requestNewAccessToken.d.ts +0 -16
  51. package/dist/modules/auth/requestPasswordReset.d.ts +0 -5
  52. package/dist/modules/auth/resetPassword.d.ts +0 -6
  53. package/dist/modules/auth/sendVerificationEmail.d.ts +0 -13
  54. package/dist/modules/auth/setPassword.d.ts +0 -9
  55. package/dist/modules/auth/signIn.d.ts +0 -12
  56. package/dist/modules/auth/signOut.d.ts +0 -103
  57. package/dist/modules/auth/signUp.d.ts +0 -24
  58. package/dist/modules/auth/verifyEmail.d.ts +0 -5
  59. package/dist/modules/auth/verifyExternalUser.d.ts +0 -11
  60. package/dist/modules/chat/addMember.d.ts +0 -8
  61. package/dist/modules/chat/changeMemberRole.d.ts +0 -9
  62. package/dist/modules/chat/createDirectConversation.d.ts +0 -7
  63. package/dist/modules/chat/createGroupConversation.d.ts +0 -10
  64. package/dist/modules/chat/deleteConversation.d.ts +0 -8
  65. package/dist/modules/chat/deleteMessage.d.ts +0 -11
  66. package/dist/modules/chat/editMessage.d.ts +0 -14
  67. package/dist/modules/chat/getConversation.d.ts +0 -6
  68. package/dist/modules/chat/getMessage.d.ts +0 -13
  69. package/dist/modules/chat/getUnreadCount.d.ts +0 -6
  70. package/dist/modules/chat/index.d.ts +0 -21
  71. package/dist/modules/chat/leaveConversation.d.ts +0 -7
  72. package/dist/modules/chat/listConversations.d.ts +0 -17
  73. package/dist/modules/chat/listMembers.d.ts +0 -11
  74. package/dist/modules/chat/listMessages.d.ts +0 -44
  75. package/dist/modules/chat/listReactions.d.ts +0 -24
  76. package/dist/modules/chat/markAsRead.d.ts +0 -9
  77. package/dist/modules/chat/muteConversation.d.ts +0 -23
  78. package/dist/modules/chat/removeMember.d.ts +0 -9
  79. package/dist/modules/chat/reportMessage.d.ts +0 -12
  80. package/dist/modules/chat/sendMessage.d.ts +0 -22
  81. package/dist/modules/chat/toggleReaction.d.ts +0 -16
  82. package/dist/modules/chat/updateConversation.d.ts +0 -12
  83. package/dist/modules/collections/addEntityToCollection.d.ts +0 -13
  84. package/dist/modules/collections/createNewCollection.d.ts +0 -8
  85. package/dist/modules/collections/deleteCollection.d.ts +0 -5
  86. package/dist/modules/collections/fetchCollectionEntities.d.ts +0 -13
  87. package/dist/modules/collections/fetchRootCollection.d.ts +0 -3
  88. package/dist/modules/collections/fetchSubCollections.d.ts +0 -6
  89. package/dist/modules/collections/index.d.ts +0 -8
  90. package/dist/modules/collections/removeEntityFromCollection.d.ts +0 -7
  91. package/dist/modules/collections/updateCollection.d.ts +0 -7
  92. package/dist/modules/comments/addReaction.d.ts +0 -8
  93. package/dist/modules/comments/createComment.d.ts +0 -15
  94. package/dist/modules/comments/deleteComment.d.ts +0 -5
  95. package/dist/modules/comments/fetchComment.d.ts +0 -8
  96. package/dist/modules/comments/fetchCommentByForeignId.d.ts +0 -7
  97. package/dist/modules/comments/fetchManyComments.d.ts +0 -26
  98. package/dist/modules/comments/fetchReactions.d.ts +0 -16
  99. package/dist/modules/comments/getUserReaction.d.ts +0 -9
  100. package/dist/modules/comments/index.d.ts +0 -10
  101. package/dist/modules/comments/removeReaction.d.ts +0 -6
  102. package/dist/modules/comments/updateComment.d.ts +0 -10
  103. package/dist/modules/connections/acceptConnection.d.ts +0 -6
  104. package/dist/modules/connections/declineConnection.d.ts +0 -6
  105. package/dist/modules/connections/fetchConnections.d.ts +0 -9
  106. package/dist/modules/connections/fetchConnectionsCount.d.ts +0 -3
  107. package/dist/modules/connections/fetchReceivedPendingConnections.d.ts +0 -8
  108. package/dist/modules/connections/fetchSentPendingConnections.d.ts +0 -8
  109. package/dist/modules/connections/index.d.ts +0 -7
  110. package/dist/modules/connections/removeConnection.d.ts +0 -5
  111. package/dist/modules/entities/addReaction.d.ts +0 -8
  112. package/dist/modules/entities/createEntity.d.ts +0 -23
  113. package/dist/modules/entities/deleteEntity.d.ts +0 -5
  114. package/dist/modules/entities/fetchDrafts.d.ts +0 -11
  115. package/dist/modules/entities/fetchEntity.d.ts +0 -8
  116. package/dist/modules/entities/fetchEntityByForeignId.d.ts +0 -8
  117. package/dist/modules/entities/fetchEntityByShortId.d.ts +0 -7
  118. package/dist/modules/entities/fetchManyEntities.d.ts +0 -65
  119. package/dist/modules/entities/fetchReactions.d.ts +0 -16
  120. package/dist/modules/entities/fetchTopComment.d.ts +0 -6
  121. package/dist/modules/entities/getUserReaction.d.ts +0 -9
  122. package/dist/modules/entities/index.d.ts +0 -15
  123. package/dist/modules/entities/isEntitySaved.d.ts +0 -12
  124. package/dist/modules/entities/publishDraft.d.ts +0 -6
  125. package/dist/modules/entities/removeReaction.d.ts +0 -6
  126. package/dist/modules/entities/updateEntity.d.ts +0 -18
  127. package/dist/modules/events/addHost.d.ts +0 -8
  128. package/dist/modules/events/addInvite.d.ts +0 -8
  129. package/dist/modules/events/cancelEvent.d.ts +0 -6
  130. package/dist/modules/events/createEvent.d.ts +0 -49
  131. package/dist/modules/events/deleteEvent.d.ts +0 -5
  132. package/dist/modules/events/fetchEvent.d.ts +0 -8
  133. package/dist/modules/events/fetchEventRsvps.d.ts +0 -19
  134. package/dist/modules/events/fetchInvitees.d.ts +0 -12
  135. package/dist/modules/events/fetchManyEvents.d.ts +0 -42
  136. package/dist/modules/events/index.d.ts +0 -14
  137. package/dist/modules/events/removeHost.d.ts +0 -8
  138. package/dist/modules/events/removeInvite.d.ts +0 -8
  139. package/dist/modules/events/setRsvp.d.ts +0 -7
  140. package/dist/modules/events/updateEvent.d.ts +0 -43
  141. package/dist/modules/events/withdrawRsvp.d.ts +0 -6
  142. package/dist/modules/follows/deleteFollow.d.ts +0 -5
  143. package/dist/modules/follows/fetchFollowers.d.ts +0 -9
  144. package/dist/modules/follows/fetchFollowersCount.d.ts +0 -5
  145. package/dist/modules/follows/fetchFollowing.d.ts +0 -9
  146. package/dist/modules/follows/fetchFollowingCount.d.ts +0 -5
  147. package/dist/modules/follows/index.d.ts +0 -5
  148. package/dist/modules/oauth/authorize.d.ts +0 -25
  149. package/dist/modules/oauth/index.d.ts +0 -4
  150. package/dist/modules/oauth/linkIdentity.d.ts +0 -14
  151. package/dist/modules/oauth/listIdentities.d.ts +0 -4
  152. package/dist/modules/oauth/unlinkIdentity.d.ts +0 -12
  153. package/dist/modules/push/getNotificationPreferences.d.ts +0 -11
  154. package/dist/modules/push/index.d.ts +0 -2
  155. package/dist/modules/push/updateNotificationPreferences.d.ts +0 -16
  156. package/dist/modules/reports/createReport.d.ts +0 -9
  157. package/dist/modules/reports/fetchModeratedReports.d.ts +0 -13
  158. package/dist/modules/reports/index.d.ts +0 -2
  159. package/dist/modules/reputation/createGrant.d.ts +0 -45
  160. package/dist/modules/reputation/index.d.ts +0 -2
  161. package/dist/modules/reputation/listGrants.d.ts +0 -45
  162. package/dist/modules/search/askContent.d.ts +0 -58
  163. package/dist/modules/search/index.d.ts +0 -5
  164. package/dist/modules/search/matchUsers.d.ts +0 -36
  165. package/dist/modules/search/searchContent.d.ts +0 -24
  166. package/dist/modules/search/searchSpaces.d.ts +0 -11
  167. package/dist/modules/search/searchUsers.d.ts +0 -11
  168. package/dist/modules/spaces/approveMembership.d.ts +0 -7
  169. package/dist/modules/spaces/banMember.d.ts +0 -13
  170. package/dist/modules/spaces/checkMyMembership.d.ts +0 -6
  171. package/dist/modules/spaces/checkSlugAvailability.d.ts +0 -8
  172. package/dist/modules/spaces/createRule.d.ts +0 -8
  173. package/dist/modules/spaces/createSpace.d.ts +0 -29
  174. package/dist/modules/spaces/declineMembership.d.ts +0 -7
  175. package/dist/modules/spaces/deleteRule.d.ts +0 -7
  176. package/dist/modules/spaces/deleteSpace.d.ts +0 -6
  177. package/dist/modules/spaces/fetchChildSpaces.d.ts +0 -11
  178. package/dist/modules/spaces/fetchDigestConfig.d.ts +0 -6
  179. package/dist/modules/spaces/fetchManyRules.d.ts +0 -6
  180. package/dist/modules/spaces/fetchManySpaces.d.ts +0 -17
  181. package/dist/modules/spaces/fetchMutualSpaces.d.ts +0 -11
  182. package/dist/modules/spaces/fetchRule.d.ts +0 -7
  183. package/dist/modules/spaces/fetchSpace.d.ts +0 -6
  184. package/dist/modules/spaces/fetchSpaceBreadcrumb.d.ts +0 -6
  185. package/dist/modules/spaces/fetchSpaceByShortId.d.ts +0 -6
  186. package/dist/modules/spaces/fetchSpaceBySlug.d.ts +0 -6
  187. package/dist/modules/spaces/fetchSpaceMembers.d.ts +0 -11
  188. package/dist/modules/spaces/fetchSpaceTeam.d.ts +0 -7
  189. package/dist/modules/spaces/fetchUserSpaces.d.ts +0 -17
  190. package/dist/modules/spaces/getSpaceConversation.d.ts +0 -6
  191. package/dist/modules/spaces/handleCommentReport.d.ts +0 -14
  192. package/dist/modules/spaces/handleEntityReport.d.ts +0 -17
  193. package/dist/modules/spaces/handleSpaceChatReport.d.ts +0 -18
  194. package/dist/modules/spaces/index.d.ts +0 -36
  195. package/dist/modules/spaces/joinSpace.d.ts +0 -6
  196. package/dist/modules/spaces/leaveSpace.d.ts +0 -6
  197. package/dist/modules/spaces/moderateSpaceChatMessage.d.ts +0 -12
  198. package/dist/modules/spaces/moderateSpaceComment.d.ts +0 -9
  199. package/dist/modules/spaces/moderateSpaceEntity.d.ts +0 -12
  200. package/dist/modules/spaces/reorderRules.d.ts +0 -7
  201. package/dist/modules/spaces/setSpaceEntityNsfw.d.ts +0 -16
  202. package/dist/modules/spaces/unbanMember.d.ts +0 -13
  203. package/dist/modules/spaces/updateDigestConfig.d.ts +0 -11
  204. package/dist/modules/spaces/updateMemberRole.d.ts +0 -8
  205. package/dist/modules/spaces/updateRule.d.ts +0 -9
  206. package/dist/modules/spaces/updateSpace.d.ts +0 -22
  207. package/dist/modules/storage/deleteFile.d.ts +0 -5
  208. package/dist/modules/storage/getFile.d.ts +0 -34
  209. package/dist/modules/storage/index.d.ts +0 -4
  210. package/dist/modules/storage/uploadFile.d.ts +0 -30
  211. package/dist/modules/storage/uploadImage.d.ts +0 -42
  212. package/dist/modules/tables/bulkCreate.d.ts +0 -4
  213. package/dist/modules/tables/bulkDelete.d.ts +0 -7
  214. package/dist/modules/tables/create.d.ts +0 -4
  215. package/dist/modules/tables/createTableAccessor.d.ts +0 -9
  216. package/dist/modules/tables/deleteRow.d.ts +0 -9
  217. package/dist/modules/tables/find.d.ts +0 -8
  218. package/dist/modules/tables/findOne.d.ts +0 -7
  219. package/dist/modules/tables/index.d.ts +0 -9
  220. package/dist/modules/tables/restore.d.ts +0 -6
  221. package/dist/modules/tables/update.d.ts +0 -4
  222. package/dist/modules/users/checkUsernameAvailability.d.ts +0 -8
  223. package/dist/modules/users/createBlock.d.ts +0 -19
  224. package/dist/modules/users/createFollow.d.ts +0 -7
  225. package/dist/modules/users/deleteBlock.d.ts +0 -13
  226. package/dist/modules/users/deleteFollow.d.ts +0 -6
  227. package/dist/modules/users/fetchBlockStatus.d.ts +0 -23
  228. package/dist/modules/users/fetchBlockedUsers.d.ts +0 -19
  229. package/dist/modules/users/fetchConnectionStatus.d.ts +0 -10
  230. package/dist/modules/users/fetchConnectionsByUserId.d.ts +0 -11
  231. package/dist/modules/users/fetchConnectionsCountByUserId.d.ts +0 -6
  232. package/dist/modules/users/fetchFollowStatus.d.ts +0 -14
  233. package/dist/modules/users/fetchFollowersByUserId.d.ts +0 -11
  234. package/dist/modules/users/fetchFollowersCountByUserId.d.ts +0 -8
  235. package/dist/modules/users/fetchFollowingByUserId.d.ts +0 -11
  236. package/dist/modules/users/fetchFollowingCountByUserId.d.ts +0 -8
  237. package/dist/modules/users/fetchUserByForeignId.d.ts +0 -8
  238. package/dist/modules/users/fetchUserById.d.ts +0 -8
  239. package/dist/modules/users/fetchUserByUsername.d.ts +0 -8
  240. package/dist/modules/users/fetchUserSuggestions.d.ts +0 -7
  241. package/dist/modules/users/index.d.ts +0 -22
  242. package/dist/modules/users/removeConnectionByUserId.d.ts +0 -10
  243. package/dist/modules/users/requestConnection.d.ts +0 -11
  244. package/dist/modules/users/updateUser.d.ts +0 -32
  245. package/dist/modules/workspaces/acceptInvite.d.ts +0 -13
  246. package/dist/modules/workspaces/acceptWorkspaceInvite.d.ts +0 -13
  247. package/dist/modules/workspaces/createInvite.d.ts +0 -17
  248. package/dist/modules/workspaces/createWorkspace.d.ts +0 -12
  249. package/dist/modules/workspaces/createWorkspaceInvite.d.ts +0 -66
  250. package/dist/modules/workspaces/declineInvite.d.ts +0 -12
  251. package/dist/modules/workspaces/declineWorkspaceInvite.d.ts +0 -14
  252. package/dist/modules/workspaces/deleteWorkspace.d.ts +0 -13
  253. package/dist/modules/workspaces/fetchManyWorkspaces.d.ts +0 -17
  254. package/dist/modules/workspaces/fetchMembers.d.ts +0 -13
  255. package/dist/modules/workspaces/fetchMyInvites.d.ts +0 -11
  256. package/dist/modules/workspaces/fetchMyWorkspaceInvites.d.ts +0 -15
  257. package/dist/modules/workspaces/fetchWorkspace.d.ts +0 -7
  258. package/dist/modules/workspaces/fetchWorkspaceAuthority.d.ts +0 -16
  259. package/dist/modules/workspaces/fetchWorkspaceInvites.d.ts +0 -17
  260. package/dist/modules/workspaces/fetchWorkspaceMemberStanding.d.ts +0 -15
  261. package/dist/modules/workspaces/fetchWorkspaceMembers.d.ts +0 -18
  262. package/dist/modules/workspaces/getAuthority.d.ts +0 -11
  263. package/dist/modules/workspaces/index.d.ts +0 -21
  264. package/dist/modules/workspaces/leaveWorkspace.d.ts +0 -12
  265. package/dist/modules/workspaces/removeWorkspaceMember.d.ts +0 -12
  266. package/dist/modules/workspaces/removeWorkspaceMemberFromSubtree.d.ts +0 -16
  267. package/dist/modules/workspaces/resendWorkspaceInvite.d.ts +0 -12
  268. package/dist/modules/workspaces/revokeWorkspaceInvite.d.ts +0 -13
  269. package/dist/modules/workspaces/transferWorkspaceOwnership.d.ts +0 -15
  270. package/dist/modules/workspaces/updateWorkspace.d.ts +0 -12
  271. package/dist/modules/workspaces/updateWorkspaceInheritFlag.d.ts +0 -13
  272. package/dist/modules/workspaces/updateWorkspaceMember.d.ts +0 -35
package/dist/index.d.ts CHANGED
@@ -1,27 +1,4367 @@
1
- import { SublayHttpClient, ClientConfig, AuthTokens } from "./core/client";
2
- import * as Auth from "./modules/auth";
3
- import * as Users from "./modules/users";
4
- import * as Entities from "./modules/entities";
5
- import * as Events from "./modules/events";
6
- import * as Comments from "./modules/comments";
7
- import * as Spaces from "./modules/spaces";
8
- import * as Collections from "./modules/collections";
9
- import * as Follows from "./modules/follows";
10
- import * as Connections from "./modules/connections";
11
- import * as AppNotifications from "./modules/app-notifications";
12
- import * as Reports from "./modules/reports";
13
- import * as Reputation from "./modules/reputation";
14
- import * as Search from "./modules/search";
15
- import * as Storage from "./modules/storage";
16
- import * as OAuth from "./modules/oauth";
17
- import * as Chat from "./modules/chat";
18
- import * as Push from "./modules/push";
19
- import * as Workspaces from "./modules/workspaces";
20
- import { TableAccessor, TableRow } from "./interfaces/Table";
1
+ import { AxiosInstance } from 'axios';
2
+
3
+ interface AuthTokens {
4
+ accessToken: string;
5
+ refreshToken: string;
6
+ }
7
+ interface ClientConfig {
8
+ projectId: string;
9
+ /**
10
+ * Optional tokens to hydrate the SDK on init (SDK-managed mode) — e.g. tokens
11
+ * the host app persisted from a previous session.
12
+ */
13
+ initialTokens?: AuthTokens;
14
+ /**
15
+ * Optional async hook returning the current access token. **Providing it puts
16
+ * the SDK in "host-managed" mode**: the host owns the token and its refresh,
17
+ * and the SDK never stores or refreshes tokens itself.
18
+ */
19
+ getToken?: () => string | null | undefined | Promise<string | null | undefined>;
20
+ /**
21
+ * Called whenever the SDK sets, rotates, or clears tokens (SDK-managed mode
22
+ * only). Receives `null` on sign-out. Use it to persist tokens so a session
23
+ * survives a reload.
24
+ */
25
+ onAuthChange?: (tokens: AuthTokens | null) => void;
26
+ }
27
+ declare class SublayHttpClient {
28
+ projectInstance: AxiosInstance;
29
+ private readonly baseURL;
30
+ private readonly hostManaged;
31
+ private readonly getToken?;
32
+ private readonly onAuthChange?;
33
+ private accessToken;
34
+ private refreshToken;
35
+ /** Shared so concurrent 403s trigger a single refresh (mutex). */
36
+ private refreshPromise;
37
+ constructor({ projectId, initialTokens, getToken, onAuthChange, }: ClientConfig);
38
+ /**
39
+ * The SDK's own in-memory access token (SDK-managed mode). Distinct from the
40
+ * `init({ getToken })` host hook, which supplies a token in host-managed mode.
41
+ */
42
+ getAccessToken(): string | null;
43
+ getRefreshToken(): string | null;
44
+ /**
45
+ * The `Authorization` header value (`Bearer <token>`) for the active auth
46
+ * mode, or `undefined` if there is no token. Host-managed mode reads the
47
+ * `getToken` hook; SDK-managed mode reads the in-memory access token. Use this
48
+ * for requests that bypass `projectInstance` (e.g. the SSE `askContent`
49
+ * stream, which needs `fetch` rather than axios).
50
+ */
51
+ getAuthHeader(): Promise<string | undefined>;
52
+ /** Store a full token pair (SDK-managed mode only; no-op when host-managed). */
53
+ setTokens(tokens: AuthTokens): void;
54
+ /** Update just the access token, e.g. after a refresh (no-op when host-managed). */
55
+ setAccessToken(accessToken: string): void;
56
+ /** Clear tokens and notify with null (SDK-managed mode only). */
57
+ clearTokens(): void;
58
+ /**
59
+ * Refresh the access token using the in-memory refresh token. A single shared
60
+ * promise (mutex) means concurrent 403s trigger only one network refresh. The
61
+ * call goes through a bare axios (not `projectInstance`) so it never re-enters
62
+ * the response interceptor. Returns the new access token, or null on failure.
63
+ */
64
+ private refreshAccessToken;
65
+ }
66
+
67
+ interface FileImageVariant {
68
+ path: string;
69
+ publicPath: string;
70
+ width: number;
71
+ height: number;
72
+ size: number;
73
+ format: string;
74
+ }
75
+ interface FileImage {
76
+ fileId: string;
77
+ originalWidth: number;
78
+ originalHeight: number;
79
+ variants: Record<string, FileImageVariant>;
80
+ processingStatus: "completed" | "failed";
81
+ processingError: string | null;
82
+ format: string;
83
+ quality: number;
84
+ exifStripped: boolean;
85
+ createdAt: string;
86
+ updatedAt: string;
87
+ }
88
+ interface File$1 {
89
+ id: string;
90
+ projectId: string;
91
+ userId: string | null;
92
+ entityId: string | null;
93
+ commentId: string | null;
94
+ chatMessageId: string | null;
95
+ spaceId: string | null;
96
+ type: "image" | "video" | "document" | "other";
97
+ originalPath: string;
98
+ originalSize: number;
99
+ originalMimeType: string;
100
+ position: number;
101
+ metadata: Record<string, any>;
102
+ image?: FileImage;
103
+ createdAt: string;
104
+ updatedAt: string;
105
+ }
106
+
107
+ type UserRole = "admin" | "moderator" | "visitor";
108
+ type UserFull = {
109
+ id: string;
110
+ projectId: string;
111
+ foreignId: string | null;
112
+ role: UserRole;
113
+ email: string | null;
114
+ name: string | null;
115
+ username: string | null;
116
+ avatar: string | null;
117
+ avatarFileId: string | null;
118
+ bannerFileId: string | null;
119
+ avatarFile?: File$1 | null;
120
+ bannerFile?: File$1 | null;
121
+ bio: string | null;
122
+ birthdate: string | null;
123
+ location: {
124
+ type: "Point";
125
+ coordinates: [number, number];
126
+ } | null;
127
+ metadata: Record<string, any>;
128
+ secureMetadata: Record<string, any>;
129
+ reputation: number;
130
+ /**
131
+ * Space-scoped reputation, present only when the request opted in via
132
+ * `spaceReputationId` (and the project has the reputation bundle). It is the
133
+ * user's reputation within the requested space context — see
134
+ * {@link SpaceReputationContextParams} / {@link SpaceReputationUserParams}.
135
+ */
136
+ spaceReputation?: number;
137
+ isVerified: boolean;
138
+ isActive: boolean;
139
+ lastActive: string;
140
+ createdAt: string;
141
+ updatedAt: string;
142
+ };
143
+ type AuthUser = Omit<UserFull, "secureMetadata"> & {
144
+ suspensions: {
145
+ reason: string | null;
146
+ startDate: string;
147
+ endDate: string | null;
148
+ }[];
149
+ authMethods: string[];
150
+ };
151
+ type User = Omit<UserFull, "email" | "secureMetadata" | "isVerified" | "isActive" | "lastActive" | "updatedAt">;
152
+
153
+ interface SignUpProps {
154
+ email: string;
155
+ password: string;
156
+ name?: string;
157
+ username?: string;
158
+ avatar?: string;
159
+ bio?: string;
160
+ location?: {
161
+ latitude: number;
162
+ longitude: number;
163
+ };
164
+ /** ISO 8601 datetime string. */
165
+ birthdate?: string;
166
+ metadata?: Record<string, any>;
167
+ secureMetadata?: Record<string, any>;
168
+ }
169
+ interface SignUpResponse {
170
+ user: AuthUser;
171
+ accessToken: string;
172
+ refreshToken: string;
173
+ }
174
+ declare function signUp(client: SublayHttpClient, data: SignUpProps): Promise<SignUpResponse>;
175
+
176
+ interface SignInProps {
177
+ email: string;
178
+ password: string;
179
+ }
180
+ interface SignInResponse {
181
+ user: AuthUser;
182
+ accessToken: string;
183
+ refreshToken: string;
184
+ }
185
+ declare function signIn(client: SublayHttpClient, data: SignInProps): Promise<SignInResponse>;
186
+
187
+ /**
188
+ * Every push event type — the full app-notification type set plus the chat
189
+ * `message` event (push-only). Mirrors the server's `PUSH_EVENT_TYPES` exactly
190
+ * (server `src/constants/push/pushEvents.ts`); these are the only names a
191
+ * `disabledTypes` set may contain.
192
+ */
193
+ declare const PUSH_EVENT_TYPES: readonly ["entity-comment", "comment-reply", "entity-mention", "comment-mention", "entity-reaction", "comment-reaction", "entity-reaction-milestone-specific", "entity-reaction-milestone-total", "comment-reaction-milestone-specific", "comment-reaction-milestone-total", "new-follow", "connection-request", "connection-accepted", "space-membership-approved", "event-invite", "event-updated", "event-cancelled", "reputation-grant", "message"];
194
+ type PushEventType = (typeof PUSH_EVENT_TYPES)[number];
195
+ /**
196
+ * The four conversation-mute duration choices. Send the CHOICE, never a raw
197
+ * timestamp — the server resolves it and represents "forever" via the explicit
198
+ * `mutedForever` signal on the returned member. Mirrors the server's
199
+ * `MUTE_DURATIONS` (server `src/helpers/push/muteDuration.ts`).
200
+ */
201
+ declare const MUTE_DURATIONS: readonly ["8h", "24h", "1w", "forever"];
202
+ type MuteDuration = (typeof MUTE_DURATIONS)[number];
203
+ /** Response of read/update notification preferences. */
204
+ interface NotificationPreferences {
205
+ disabledTypes: PushEventType[];
206
+ }
207
+ /**
208
+ * A Web Push subscription in its SERIALIZED form — the JSON the server reads,
209
+ * not the live browser object.
210
+ *
211
+ * A `PushSubscription` straight from `PushManager.subscribe()` does NOT satisfy
212
+ * this type. It exposes its keys only through `getKey(name)`; there is no `keys`
213
+ * property to read, so it is not assignable here under strict TypeScript, and
214
+ * passing one through a cast sends a body the server rejects.
215
+ *
216
+ * To produce a value of this type:
217
+ *
218
+ * 1. **Serialize** the subscription with `subscription.toJSON()`.
219
+ * 2. **Confirm** `endpoint`, `keys.p256dh` and `keys.auth` are all present —
220
+ * `PushSubscriptionJSON` types every one of them as optional, while the
221
+ * server requires all three as non-empty strings and 400s otherwise.
222
+ *
223
+ * ```ts
224
+ * const json = subscription.toJSON();
225
+ * if (!json.endpoint || !json.keys?.p256dh || !json.keys?.auth) {
226
+ * throw new Error("Incomplete Web Push subscription");
227
+ * }
228
+ * const webPushSubscription: WebPushSubscription = {
229
+ * endpoint: json.endpoint,
230
+ * keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },
231
+ * };
232
+ * ```
233
+ *
234
+ * Mirrors the server's `webPushSubscriptionSchema`
235
+ * (server `src/v7/validation/push-notifications/push-notifications.schema.ts`).
236
+ */
237
+ interface WebPushSubscription {
238
+ endpoint: string;
239
+ keys: {
240
+ p256dh: string;
241
+ auth: string;
242
+ };
243
+ }
244
+ /**
245
+ * Identifies one physical device. Mirrors the server's device-identifier body
246
+ * exactly (server `src/v7/validation/push-notifications/push-notifications.schema.ts`):
247
+ * a provider token for `ios`/`android`, a Web Push subscription for `web`. The
248
+ * union encodes the server's own cross-check — it rejects the same
249
+ * combinations the server's `superRefine` rejects.
250
+ *
251
+ * Passed to `auth.signOut` to unbind that device's push binding in the same
252
+ * transaction as the sign-out.
253
+ */
254
+ type PushDeviceIdentifier = {
255
+ platform: "ios" | "android";
256
+ token: string;
257
+ } | {
258
+ platform: "web";
259
+ subscription: WebPushSubscription;
260
+ };
261
+
262
+ interface SignOutProps {
263
+ /**
264
+ * Defaults to the SDK's stored refresh token (SDK-managed mode). Pass it
265
+ * explicitly in host-managed mode, where the SDK holds no refresh token.
266
+ */
267
+ refreshToken?: string;
268
+ /**
269
+ * Optional. When supplied — and the project has the `push` bundle — the
270
+ * server deletes this user's push binding for that device in the SAME
271
+ * transaction as the token-family destroy: signing out unbinds the device's
272
+ * push, or nothing happens at all.
273
+ *
274
+ * **Needs a refresh token to have any effect.** The unbind is scoped to the
275
+ * `sub` of the refresh token, which is what stops one account removing
276
+ * another account's binding on a shared device — so with no token there is no
277
+ * user to scope it to and the server answers `204` before it ever looks at
278
+ * `pushDevice`. When none can be resolved the field is DROPPED from the
279
+ * request rather than sent into that silent no-op, the sign-out proceeds
280
+ * normally, and the returned `pushUnbindSkipped` says so. Watch for it in
281
+ * **host-managed mode**: such a client is built with `getToken` and no
282
+ * `initialTokens`, and its `setTokens` is inert, so it starts with no refresh
283
+ * token and can never acquire one. Pass `refreshToken` explicitly alongside
284
+ * `pushDevice` there.
285
+ *
286
+ * If the unbind fails the request fails (HTTP 500, code
287
+ * `auth/device-deregistration-failed` or `auth/sign-out-failed`) and NOTHING
288
+ * is committed — the session survives so the caller can retry, and this call
289
+ * rethrows WITHOUT clearing the SDK's local tokens, so the credential that
290
+ * retry needs is still there.
291
+ *
292
+ * That is the ONLY failure that leaves you signed in. Every other one — a
293
+ * `429` from the rate limiter or a quota gate, a `423`, a `503`, a `400` on
294
+ * the body, a dropped connection — never touched a push binding, so it
295
+ * clears the local tokens and RESOLVES: a user must always be able to sign
296
+ * out. See `UNBIND_FAILURE_CODES`.
297
+ *
298
+ * Omit it and the request is byte-identical to before this field existed.
299
+ */
300
+ pushDevice?: PushDeviceIdentifier;
301
+ }
302
+ /**
303
+ * Why the unbind did not happen. Present only when `pushUnbindSkipped` is
304
+ * `true`, and it exists because THE TWO SKIPS ARE RECOVERED DIFFERENTLY — a
305
+ * caller that cannot tell them apart can only ever pick the wrong remedy for
306
+ * one of them:
307
+ *
308
+ * - `no-refresh-token` — this SDK never asked. Nothing was destroyed either:
309
+ * with no token the server has no session to end, so the account, its
310
+ * credential and its binding are all still there. **Retryable**: re-issue
311
+ * the sign-out with an explicit `refreshToken` and the unbind happens.
312
+ * - `push-unbind-status-unknown` — the server was asked and could not answer.
313
+ * The sign-out itself DID commit, so the credential that would have driven a
314
+ * retry is gone; re-issuing achieves nothing. The binding clears when that
315
+ * account next registers on this device, or when the server prunes the token
316
+ * as undeliverable.
317
+ */
318
+ type PushUnbindSkipReason = "no-refresh-token" | "push-unbind-status-unknown";
319
+ interface SignOutResult {
320
+ /**
321
+ * `true` whenever a `pushDevice` was supplied and the unbind did NOT happen,
322
+ * so this device's push binding for that account may still be live. Either
323
+ * the SDK declined to ask (no refresh token to scope the unbind to) or the
324
+ * server could not answer whether a binding exists; `pushUnbindSkipReason`
325
+ * says which, and the two are recovered differently.
326
+ *
327
+ * `false` means NO SKIP WAS REPORTED — by this SDK or by the server. It is
328
+ * not a promise that no skip happened, and the difference is not academic:
329
+ * the server declines the unbind for several reasons it answers with a plain
330
+ * `204`, and every one of them reads `false` here.
331
+ *
332
+ * - The refresh token is authentic but expired beyond the server's unbind
333
+ * window (90 days past `exp`), so there is no subject to scope the unbind
334
+ * to. Reachable from this SDK by passing an old `refreshToken` explicitly
335
+ * alongside `pushDevice`.
336
+ * - The refresh token is malformed or fails signature verification.
337
+ * - The project has no `push` bundle, so no binding can exist.
338
+ * - The unbind ran and matched zero rows — the binding was already gone, or
339
+ * was never registered under this device key.
340
+ *
341
+ * The server logs each of those under its own reason; only the case where it
342
+ * could not determine whether a binding exists is reported in the response,
343
+ * because that is the one where the binding may still be LIVE and nobody
344
+ * looked. The rest either prove there was nothing to remove or leave a device
345
+ * key the server cannot attribute to a user, and neither gives the caller
346
+ * anything to act on beyond what it already knows.
347
+ *
348
+ * A request that failed short of an unbind attempt reads `false` too — a
349
+ * gate's `429` or `423`, a `503`, a `400`, a dropped connection. Those clear
350
+ * the local tokens and resolve rather than reject (see `UNBIND_FAILURE_CODES`
351
+ * for why), and none of them is a REPORTED skip; they are logged with a
352
+ * warning instead.
353
+ *
354
+ * The sign-out itself is unaffected by the flag in both directions: a user
355
+ * must always be able to sign out, so a skipped unbind never fails the call
356
+ * and never leaves the local tokens in place.
357
+ */
358
+ pushUnbindSkipped: boolean;
359
+ /** Set only when `pushUnbindSkipped` is `true`. See `PushUnbindSkipReason`. */
360
+ pushUnbindSkipReason?: PushUnbindSkipReason;
361
+ }
362
+ declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<SignOutResult>;
363
+
364
+ interface RequestNewAccessTokenProps {
365
+ /** Defaults to the SDK's stored refresh token (SDK-managed mode). */
366
+ refreshToken?: string;
367
+ }
368
+ interface RequestNewAccessTokenResponse {
369
+ accessToken: string;
370
+ /** The server rotates the refresh token on every refresh and returns the new one. */
371
+ refreshToken?: string;
372
+ }
373
+ /**
374
+ * Manually rotate the access token. The SDK auto-refreshes on 403 in
375
+ * SDK-managed mode, so this is rarely needed directly; it's exposed for parity
376
+ * and for host-managed callers that own their own refresh flow.
377
+ */
378
+ declare function requestNewAccessToken(client: SublayHttpClient, data?: RequestNewAccessTokenProps): Promise<RequestNewAccessTokenResponse>;
379
+
380
+ interface VerifyExternalUserProps {
381
+ userJwt: string;
382
+ }
383
+ interface VerifyExternalUserResponse {
384
+ user: AuthUser;
385
+ accessToken: string;
386
+ refreshToken: string;
387
+ }
388
+ declare function verifyExternalUser(client: SublayHttpClient, data: VerifyExternalUserProps): Promise<VerifyExternalUserResponse>;
389
+
390
+ interface RequestPasswordResetProps {
391
+ email: string;
392
+ }
393
+ declare function requestPasswordReset(client: SublayHttpClient, data: RequestPasswordResetProps): Promise<void>;
394
+
395
+ interface ResetPasswordProps {
396
+ token: string;
397
+ newPassword: string;
398
+ }
399
+ declare function resetPassword(client: SublayHttpClient, data: ResetPasswordProps): Promise<void>;
400
+
401
+ interface ChangePasswordProps {
402
+ /** The user's current password (verified before the change). */
403
+ password: string;
404
+ newPassword: string;
405
+ /**
406
+ * Optional. The physical device making this call.
407
+ *
408
+ * A password change also deletes every push binding the user holds, so an
409
+ * intruder's device stops receiving notification content. Naming this device
410
+ * keeps ITS binding — nothing re-binds a device from its live session, so
411
+ * without this the handset the user just changed their password on goes
412
+ * quiet until the app cold-starts or switches accounts.
413
+ *
414
+ * Same value passed to `push.register` / `auth.signOut`. Omit it and every
415
+ * binding for the user goes, this device included.
416
+ */
417
+ pushDevice?: PushDeviceIdentifier;
418
+ }
419
+ interface ChangePasswordResponse {
420
+ success: boolean;
421
+ message: string;
422
+ }
423
+ /**
424
+ * Change the signed-in user's password.
425
+ *
426
+ * Ends every OTHER session for that user — every other device must sign in
427
+ * again with the new password — while the session making this call survives.
428
+ * The server identifies that session from the access token this request is
429
+ * already authenticated with, so nothing about the caller's session has to be
430
+ * sent.
431
+ */
432
+ declare function changePassword(client: SublayHttpClient, data: ChangePasswordProps): Promise<ChangePasswordResponse>;
433
+
434
+ interface SetPasswordProps {
435
+ newPassword: string;
436
+ }
437
+ interface SetPasswordResponse {
438
+ success: boolean;
439
+ message: string;
440
+ }
441
+ declare function setPassword(client: SublayHttpClient, data: SetPasswordProps): Promise<SetPasswordResponse>;
442
+
443
+ interface VerifyEmailProps {
444
+ token: string;
445
+ }
446
+ declare function verifyEmail(client: SublayHttpClient, data: VerifyEmailProps): Promise<void>;
447
+
448
+ interface SendCodeVerificationEmailHexProps {
449
+ mode: "code";
450
+ tokenFormat: "hex";
451
+ tokenLength?: never;
452
+ }
453
+ interface SendCodeVerificationEmailShortProps {
454
+ mode: "code";
455
+ tokenFormat: "numeric" | "alpha" | "alphanumeric";
456
+ tokenLength: number;
457
+ }
458
+ interface SendLinkVerificationEmailProps {
459
+ mode: "link";
460
+ tokenFormat?: "hex" | "numeric" | "alpha" | "alphanumeric";
461
+ tokenLength?: number;
462
+ /** Where to send the user after the link is verified. */
463
+ redirectUrl?: string;
464
+ }
465
+ /**
466
+ * `mode` is required so every caller explicitly decides code vs link, and the
467
+ * `tokenFormat`/`tokenLength` pair for "code" is a discriminated union rather
468
+ * than two independent optionals — pairing `mode: "code"` with the default
469
+ * `tokenFormat: "hex"` used to compile fine and silently email a 64-character
470
+ * string no one could type.
471
+ */
472
+ type SendVerificationEmailProps = SendCodeVerificationEmailHexProps | SendCodeVerificationEmailShortProps | SendLinkVerificationEmailProps;
473
+ interface SendVerificationEmailResponse {
474
+ success: boolean;
475
+ }
476
+ declare function sendVerificationEmail(client: SublayHttpClient, data: SendVerificationEmailProps): Promise<SendVerificationEmailResponse>;
477
+
478
+ interface RequestAccountDeletionResponse {
479
+ success: boolean;
480
+ }
481
+ /**
482
+ * Step 1 of self-service account deletion. Emails the signed-in user a one-time
483
+ * confirmation code. Pass that code to {@link confirmAccountDeletion} to
484
+ * permanently delete the account.
485
+ *
486
+ * Requires the account to have an email on file — accounts without one (e.g.
487
+ * anonymous or foreign-id users) must be deleted server-side with a service key
488
+ * via the node SDK (`client.users.deleteUser`).
489
+ */
490
+ declare function requestAccountDeletion(client: SublayHttpClient): Promise<RequestAccountDeletionResponse>;
491
+
492
+ interface ConfirmAccountDeletionProps {
493
+ /** The one-time code emailed by {@link requestAccountDeletion}. */
494
+ code: string;
495
+ }
496
+ /**
497
+ * Step 2 of self-service account deletion. Verifies the emailed code and then
498
+ * permanently deletes the signed-in user's account (same cascade as the
499
+ * admin/service delete). This is immediate and cannot be undone.
500
+ */
501
+ declare function confirmAccountDeletion(client: SublayHttpClient, data: ConfirmAccountDeletionProps): Promise<void>;
502
+
503
+ declare const Auth_changePassword: typeof changePassword;
504
+ declare const Auth_confirmAccountDeletion: typeof confirmAccountDeletion;
505
+ declare const Auth_requestAccountDeletion: typeof requestAccountDeletion;
506
+ declare const Auth_requestNewAccessToken: typeof requestNewAccessToken;
507
+ declare const Auth_requestPasswordReset: typeof requestPasswordReset;
508
+ declare const Auth_resetPassword: typeof resetPassword;
509
+ declare const Auth_sendVerificationEmail: typeof sendVerificationEmail;
510
+ declare const Auth_setPassword: typeof setPassword;
511
+ declare const Auth_signIn: typeof signIn;
512
+ declare const Auth_signOut: typeof signOut;
513
+ declare const Auth_signUp: typeof signUp;
514
+ declare const Auth_verifyEmail: typeof verifyEmail;
515
+ declare const Auth_verifyExternalUser: typeof verifyExternalUser;
516
+ declare namespace Auth {
517
+ export { Auth_changePassword as changePassword, Auth_confirmAccountDeletion as confirmAccountDeletion, Auth_requestAccountDeletion as requestAccountDeletion, Auth_requestNewAccessToken as requestNewAccessToken, Auth_requestPasswordReset as requestPasswordReset, Auth_resetPassword as resetPassword, Auth_sendVerificationEmail as sendVerificationEmail, Auth_setPassword as setPassword, Auth_signIn as signIn, Auth_signOut as signOut, Auth_signUp as signUp, Auth_verifyEmail as verifyEmail, Auth_verifyExternalUser as verifyExternalUser };
518
+ }
519
+
520
+ /**
521
+ * Shared optional params for opting a request into space-scoped reputation
522
+ * enrichment. When set, users embedded in the response carry a
523
+ * `spaceReputation` field (see {@link import("./User").UserFull}).
524
+ *
525
+ * Two variants exist because the server accepts a different value set per
526
+ * endpoint class:
527
+ * - {@link SpaceReputationContextParams} — context endpoints (entities,
528
+ * comments, chat, spaces, search, reports). Accept `<uuid> | "none" |
529
+ * "context"`.
530
+ * - {@link SpaceReputationUserParams} — user-direct endpoints (the `users`
531
+ * module). Accept `<uuid> | "none"` only; `"context"` is rejected by the
532
+ * server (400).
533
+ *
534
+ * Both classes share the same param names and types — only the accepted
535
+ * `spaceReputationId` value set (documented in JSDoc) differs.
536
+ */
537
+ /**
538
+ * Space-reputation params for **context** endpoints.
539
+ */
540
+ interface SpaceReputationContextParams {
541
+ /**
542
+ * Opt into space-scoped reputation enrichment. The primary form: an object
543
+ * describing the space and whether to include descendants.
544
+ *
545
+ * - `spaceId` — a space `<uuid>` (reputation within that specific space),
546
+ * `"none"` (no space context — global reputation only), or `"context"`
547
+ * (derive the space from each record's own context, e.g. a feed enriches
548
+ * each row's author with reputation in that row's space).
549
+ * - `includeDescendants` — whether to include descendant spaces when
550
+ * computing space-scoped reputation. Only honored with an explicit space
551
+ * `<uuid>` (ignored for `"none"` / `"context"`).
552
+ */
553
+ spaceReputation?: {
554
+ spaceId: string | "none" | "context";
555
+ includeDescendants?: boolean;
556
+ };
557
+ /**
558
+ * @deprecated Pass the `spaceReputation` object instead. Retained for
559
+ * back-compat; removal is a later major version.
560
+ *
561
+ * Opt into space-scoped reputation enrichment. Accepted forms:
562
+ * - a space `<uuid>` — reputation within that specific space;
563
+ * - `"none"` — no space context (global reputation only);
564
+ * - `"context"` — derive the space from each record's own context
565
+ * (e.g. a feed enriches each row's author with reputation in that row's
566
+ * space).
567
+ */
568
+ spaceReputationId?: string;
569
+ /**
570
+ * @deprecated Pass the `spaceReputation` object (`includeDescendants`)
571
+ * instead. Retained for back-compat; removal is a later major version.
572
+ *
573
+ * Whether to include descendant spaces when computing space-scoped
574
+ * reputation. Only honored with an explicit space `<uuid>` (ignored for
575
+ * `"none"` / `"context"`).
576
+ */
577
+ spaceReputationDescendants?: boolean;
578
+ }
579
+ /**
580
+ * Space-reputation params for **user-direct** endpoints (the `users` module).
581
+ */
582
+ interface SpaceReputationUserParams {
583
+ /**
584
+ * Opt into space-scoped reputation enrichment. The primary form: an object
585
+ * describing the space and whether to include descendants.
586
+ *
587
+ * - `spaceId` — a space `<uuid>` (reputation within that specific space) or
588
+ * `"none"` (no space context — global reputation only). `"context"` is
589
+ * **rejected by the server (400)** on user-direct endpoints — there is no
590
+ * per-record context to derive a space from.
591
+ * - `includeDescendants` — whether to include descendant spaces when
592
+ * computing space-scoped reputation. Only honored with an explicit space
593
+ * `<uuid>`.
594
+ */
595
+ spaceReputation?: {
596
+ spaceId: string | "none";
597
+ includeDescendants?: boolean;
598
+ };
599
+ /**
600
+ * @deprecated Pass the `spaceReputation` object instead. Retained for
601
+ * back-compat; removal is a later major version.
602
+ *
603
+ * Opt into space-scoped reputation enrichment. Accepted forms:
604
+ * - a space `<uuid>` — reputation within that specific space;
605
+ * - `"none"` — no space context (global reputation only).
606
+ *
607
+ * `"context"` is **rejected by the server (400)** on user-direct endpoints —
608
+ * there is no per-record context to derive a space from.
609
+ */
610
+ spaceReputationId?: string;
611
+ /**
612
+ * @deprecated Pass the `spaceReputation` object (`includeDescendants`)
613
+ * instead. Retained for back-compat; removal is a later major version.
614
+ *
615
+ * Whether to include descendant spaces when computing space-scoped
616
+ * reputation. Only honored with an explicit space `<uuid>`.
617
+ */
618
+ spaceReputationDescendants?: boolean;
619
+ }
620
+
621
+ interface FetchUserByIdProps extends SpaceReputationUserParams {
622
+ userId: string;
623
+ include?: string;
624
+ }
625
+ declare function fetchUserById(client: SublayHttpClient, data: FetchUserByIdProps): Promise<User>;
626
+
627
+ interface FetchUserByForeignIdProps extends SpaceReputationUserParams {
628
+ foreignId: string;
629
+ include?: string;
630
+ }
631
+ declare function fetchUserByForeignId(client: SublayHttpClient, data: FetchUserByForeignIdProps): Promise<User>;
632
+
633
+ interface FetchUserByUsernameProps extends SpaceReputationUserParams {
634
+ username: string;
635
+ include?: string;
636
+ }
637
+ declare function fetchUserByUsername(client: SublayHttpClient, data: FetchUserByUsernameProps): Promise<User>;
638
+
639
+ interface FetchUserSuggestionsProps extends SpaceReputationUserParams {
640
+ query: string;
641
+ }
642
+ declare function fetchUserSuggestions(client: SublayHttpClient, data: FetchUserSuggestionsProps): Promise<User[]>;
643
+
644
+ interface CheckUsernameAvailabilityProps {
645
+ username: string;
646
+ }
647
+ interface CheckUsernameAvailabilityResponse {
648
+ available: boolean;
649
+ }
650
+ declare function checkUsernameAvailability(client: SublayHttpClient, data: CheckUsernameAvailabilityProps): Promise<CheckUsernameAvailabilityResponse>;
651
+
652
+ type ImageFit = "cover" | "contain" | "inside" | "outside";
653
+ type ImageFormat = "webp" | "jpeg" | "png" | "original";
654
+ interface BaseImageOptions {
655
+ /** 1–100. Output quality. */
656
+ quality?: number;
657
+ format?: ImageFormat;
658
+ stripExif?: boolean;
659
+ }
660
+ /** Mode 1 — explicit width/height per named variant. */
661
+ interface ExactDimensionsOptions extends BaseImageOptions {
662
+ mode: "exact-dimensions";
663
+ /** Keyed by variant name, e.g. `{ thumbnail: { width, height } }`. 50–10000. */
664
+ dimensions: Record<string, {
665
+ width: number;
666
+ height: number;
667
+ }>;
668
+ fit?: ImageFit;
669
+ }
670
+ /** Mode 2a — fixed aspect ratio, sized by width per variant. */
671
+ interface AspectRatioWidthOptions extends BaseImageOptions {
672
+ mode: "aspect-ratio-width-based";
673
+ aspectRatio: {
674
+ width: number;
675
+ height: number;
676
+ };
677
+ /** Keyed by variant name → target width (50–10000). */
678
+ widths: Record<string, number>;
679
+ fit?: ImageFit;
680
+ }
681
+ /** Mode 2b — fixed aspect ratio, sized by height per variant. */
682
+ interface AspectRatioHeightOptions extends BaseImageOptions {
683
+ mode: "aspect-ratio-height-based";
684
+ aspectRatio: {
685
+ width: number;
686
+ height: number;
687
+ };
688
+ /** Keyed by variant name → target height (50–10000). */
689
+ heights: Record<string, number>;
690
+ fit?: ImageFit;
691
+ }
692
+ /** Mode 3 — preserve the source aspect ratio, bounded per variant. */
693
+ interface OriginalAspectOptions extends BaseImageOptions {
694
+ mode: "original-aspect";
695
+ /** Keyed by variant name → bounding size (50–10000). */
696
+ sizes: Record<string, number>;
697
+ /** Server restricts this mode to `inside` | `outside`. */
698
+ fit?: "inside" | "outside";
699
+ }
700
+ /** Mode 4 — multiple aspect ratios, sized per variant. */
701
+ interface MultiAspectRatioOptions extends BaseImageOptions {
702
+ mode: "multi-aspect-ratio";
703
+ /** 1–10 aspect ratios. */
704
+ aspectRatios: {
705
+ width: number;
706
+ height: number;
707
+ }[];
708
+ /** Keyed by variant name → target size (50–10000). */
709
+ sizes: Record<string, number>;
710
+ fit?: ImageFit;
711
+ }
712
+ type ImageOptions = ExactDimensionsOptions | AspectRatioWidthOptions | AspectRatioHeightOptions | OriginalAspectOptions | MultiAspectRatioOptions;
713
+
714
+ /** A file plus the image-processing options the server requires alongside it. */
715
+ interface UserImageUpload {
716
+ file: Blob | File;
717
+ /** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
718
+ options: ImageOptions;
719
+ }
720
+ interface UpdateUserProps {
721
+ /** The user to update (the target). A user token may only update itself. */
722
+ userId: string;
723
+ name?: string;
724
+ username?: string;
725
+ avatar?: string;
726
+ bio?: string;
727
+ birthdate?: string;
728
+ location?: {
729
+ latitude: number;
730
+ longitude: number;
731
+ } | null;
732
+ metadata?: Record<string, any>;
733
+ secureMetadata?: Record<string, any>;
734
+ /**
735
+ * New avatar image. When present the request is sent as `multipart/form-data`.
736
+ * The server processes the image per `options` and replaces the old avatar.
737
+ */
738
+ avatarFile?: UserImageUpload;
739
+ /** New banner image; same contract as {@link UpdateUserProps.avatarFile}. */
740
+ bannerFile?: UserImageUpload;
741
+ }
742
+ declare function updateUser(client: SublayHttpClient, data: UpdateUserProps): Promise<AuthUser>;
743
+
744
+ interface Follow {
745
+ id: string;
746
+ projectId: string;
747
+ followerId: string;
748
+ followedId: string;
749
+ createdAt: string;
750
+ }
751
+ /**
752
+ * An entry in a follower/following list. The list endpoints
753
+ * (`/follows/(followers|following)` and `/users/:userId/(followers|following)`)
754
+ * return the follow id, the populated other user, and when the follow happened
755
+ * — NOT the raw {@link Follow} row.
756
+ */
757
+ interface FollowListItem {
758
+ followId: string;
759
+ user: User;
760
+ followedAt: string;
761
+ }
762
+
763
+ interface PaginationMetadata {
764
+ page: number;
765
+ pageSize: number;
766
+ totalPages: number;
767
+ totalItems: number;
768
+ hasMore: boolean;
769
+ }
770
+ interface PaginatedResponse<T> {
771
+ data: T[];
772
+ pagination: PaginationMetadata;
773
+ }
774
+
775
+ /**
776
+ * Shared optional params for text-searching a list of users
777
+ * (followers / following / connections).
778
+ *
779
+ * - `query` — free-text search term. When omitted, no filtering is applied.
780
+ * - `searchFields` — narrows which user field the term matches against. When
781
+ * omitted, the term matches either `username` OR `name` (case-insensitive
782
+ * substring). `"username"` / `"name"` restrict the match to that one field.
783
+ */
784
+ interface UserSearchParams {
785
+ query?: string;
786
+ searchFields?: "username" | "name";
787
+ }
788
+
789
+ interface FetchFollowersByUserIdProps extends SpaceReputationUserParams, UserSearchParams {
790
+ userId: string;
791
+ page?: number;
792
+ limit?: number;
793
+ }
794
+ declare function fetchFollowersByUserId(client: SublayHttpClient, data: FetchFollowersByUserIdProps): Promise<PaginatedResponse<FollowListItem>>;
795
+
796
+ interface FetchFollowersCountByUserIdProps {
797
+ userId: string;
798
+ }
799
+ interface FollowersCountResponse$1 {
800
+ count: number;
801
+ }
802
+ declare function fetchFollowersCountByUserId(client: SublayHttpClient, data: FetchFollowersCountByUserIdProps): Promise<FollowersCountResponse$1>;
803
+
804
+ interface FetchFollowingByUserIdProps extends SpaceReputationUserParams, UserSearchParams {
805
+ userId: string;
806
+ page?: number;
807
+ limit?: number;
808
+ }
809
+ declare function fetchFollowingByUserId(client: SublayHttpClient, data: FetchFollowingByUserIdProps): Promise<PaginatedResponse<FollowListItem>>;
810
+
811
+ interface FetchFollowingCountByUserIdProps {
812
+ userId: string;
813
+ }
814
+ interface FollowingCountResponse$1 {
815
+ count: number;
816
+ }
817
+ declare function fetchFollowingCountByUserId(client: SublayHttpClient, data: FetchFollowingCountByUserIdProps): Promise<FollowingCountResponse$1>;
818
+
819
+ interface Connection {
820
+ id: string;
821
+ message?: string;
822
+ createdAt: string;
823
+ }
824
+ /** Returned by `POST /users/:userId/connection` (requestConnection). */
825
+ interface ConnectionRequestResponse {
826
+ id: string;
827
+ status: string;
828
+ createdAt: string;
829
+ }
830
+ interface EstablishedConnection {
831
+ id: string;
832
+ connectedUser: User;
833
+ connectedAt: string;
834
+ }
835
+ interface PendingConnection extends Connection {
836
+ user: User;
837
+ type: "received" | "sent";
838
+ }
839
+ interface ConnectionActionResponse {
840
+ id: string;
841
+ status: string;
842
+ createdAt?: string;
843
+ respondedAt?: string;
844
+ }
845
+ interface ConnectionCountResponse {
846
+ count: number;
847
+ }
848
+ interface RemoveConnectionByUserIdResponse {
849
+ id?: string;
850
+ status?: string;
851
+ respondedAt?: string;
852
+ message?: string;
853
+ action?: "withdraw" | "disconnect" | "decline";
854
+ }
855
+ interface ConnectionStatusNone {
856
+ status: "none";
857
+ }
858
+ interface ConnectionStatusPending {
859
+ status: "pending";
860
+ type: "sent" | "received";
861
+ connectionId: string;
862
+ createdAt: string;
863
+ }
864
+ interface ConnectionStatusConnected {
865
+ status: "connected";
866
+ connectionId: string;
867
+ connectedAt: string;
868
+ requestedAt: string;
869
+ }
870
+ interface ConnectionStatusDeclined {
871
+ status: "declined";
872
+ type: "sent" | "received";
873
+ connectionId: string;
874
+ respondedAt: string;
875
+ }
876
+ type ConnectionStatusResponse = ConnectionStatusNone | ConnectionStatusPending | ConnectionStatusConnected | ConnectionStatusDeclined;
877
+
878
+ interface FetchConnectionsByUserIdProps extends SpaceReputationUserParams, UserSearchParams {
879
+ userId: string;
880
+ page?: number;
881
+ limit?: number;
882
+ }
883
+ declare function fetchConnectionsByUserId(client: SublayHttpClient, data: FetchConnectionsByUserIdProps): Promise<PaginatedResponse<EstablishedConnection>>;
884
+
885
+ interface FetchConnectionsCountByUserIdProps {
886
+ userId: string;
887
+ }
888
+ declare function fetchConnectionsCountByUserId(client: SublayHttpClient, data: FetchConnectionsCountByUserIdProps): Promise<ConnectionCountResponse>;
889
+
890
+ interface CreateFollowProps {
891
+ /** The user being followed (the target). The follower is the token holder. */
892
+ userId: string;
893
+ }
894
+ declare function createFollow(client: SublayHttpClient, data: CreateFollowProps): Promise<Follow>;
895
+
896
+ interface DeleteFollowProps {
897
+ /** The user being unfollowed (the target). The follower is the token holder. */
898
+ userId: string;
899
+ }
900
+ declare function deleteFollow$1(client: SublayHttpClient, data: DeleteFollowProps): Promise<void>;
901
+
902
+ interface FetchFollowStatusProps {
903
+ /**
904
+ * The user whose follow relationship is being checked (the target). The
905
+ * status is from the perspective of the token holder.
906
+ */
907
+ userId: string;
908
+ }
909
+ interface FollowStatusResponse {
910
+ isFollowing: boolean;
911
+ followId?: string;
912
+ followedAt?: string;
913
+ }
914
+ declare function fetchFollowStatus(client: SublayHttpClient, data: FetchFollowStatusProps): Promise<FollowStatusResponse>;
915
+
916
+ interface RequestConnectionProps {
917
+ /**
918
+ * The user the connection is requested with (the target). The requester is
919
+ * the token holder.
920
+ */
921
+ userId: string;
922
+ message?: string;
923
+ }
924
+ declare function requestConnection(client: SublayHttpClient, data: RequestConnectionProps): Promise<ConnectionRequestResponse>;
925
+
926
+ interface FetchConnectionStatusProps {
927
+ /**
928
+ * The other user in the connection (the target). The status is from the
929
+ * perspective of the token holder.
930
+ */
931
+ userId: string;
932
+ }
933
+ declare function fetchConnectionStatus(client: SublayHttpClient, data: FetchConnectionStatusProps): Promise<ConnectionStatusResponse>;
934
+
935
+ interface RemoveConnectionByUserIdProps {
936
+ /**
937
+ * The other user in the connection (the target). The token holder is the
938
+ * user withdrawing/declining/disconnecting.
939
+ */
940
+ userId: string;
941
+ }
942
+ declare function removeConnectionByUserId(client: SublayHttpClient, data: RemoveConnectionByUserIdProps): Promise<RemoveConnectionByUserIdResponse>;
943
+
944
+ interface CreateBlockProps {
945
+ /** The user being blocked (the target). The blocker is the token holder. */
946
+ userId: string;
947
+ }
948
+ interface BlockResponse {
949
+ id: string;
950
+ blockerId: string;
951
+ blockedId: string;
952
+ createdAt: string;
953
+ }
954
+ /**
955
+ * POST /users/:userId/block — block `:userId`.
956
+ *
957
+ * The blocker is derived from the token (Rule A — no `actingUserId`). Idempotent:
958
+ * re-blocking an already-blocked user succeeds. Self-block is rejected server-side.
959
+ * On a new block the server tears down existing follows/connections both ways.
960
+ */
961
+ declare function createBlock(client: SublayHttpClient, data: CreateBlockProps): Promise<BlockResponse>;
962
+
963
+ interface DeleteBlockProps {
964
+ /** The user being unblocked (the target). The blocker is the token holder. */
965
+ userId: string;
966
+ }
967
+ /**
968
+ * DELETE /users/:userId/block — unblock `:userId`.
969
+ *
970
+ * The blocker is derived from the token (Rule A — no `actingUserId`). Idempotent:
971
+ * unblocking a user who isn't blocked succeeds. Restores nothing (torn-down
972
+ * follows/connections are gone for good).
973
+ */
974
+ declare function deleteBlock(client: SublayHttpClient, data: DeleteBlockProps): Promise<void>;
975
+
976
+ interface FetchBlockStatusProps {
977
+ /**
978
+ * The user whose block status is being checked (the target). The status is the
979
+ * token holder's OUTBOUND state only: do *I* block `:userId`?
980
+ */
981
+ userId: string;
982
+ }
983
+ /**
984
+ * The block-status response is outbound-only by design: it reports whether the
985
+ * token holder blocks the target, and NEVER whether the target blocked the
986
+ * caller (the inbound direction is deliberately not disclosed).
987
+ */
988
+ interface BlockStatusResponse {
989
+ blocked: boolean;
990
+ blockId?: string;
991
+ createdAt?: string;
992
+ }
993
+ /**
994
+ * GET /users/:userId/block — the token holder's outbound block status toward
995
+ * `:userId` (Rule A — no `actingUserId`).
996
+ */
997
+ declare function fetchBlockStatus(client: SublayHttpClient, data: FetchBlockStatusProps): Promise<BlockStatusResponse>;
998
+
999
+ interface FetchBlockedUsersProps {
1000
+ page?: number;
1001
+ limit?: number;
1002
+ }
1003
+ /** An entry in the token holder's own block list (their outbound blocks). */
1004
+ interface BlockedUserListItem {
1005
+ id: string;
1006
+ blockedUser: User | null;
1007
+ createdAt: string;
1008
+ }
1009
+ /**
1010
+ * GET /blocks — the token holder's own block list (their outbound blocks),
1011
+ * paginated. This is the private "manage / way back to unblock" surface (Rule A
1012
+ * — the subject is derived from the token, no `actingUserId`).
1013
+ */
1014
+ declare function fetchBlockedUsers(client: SublayHttpClient, data?: FetchBlockedUsersProps): Promise<PaginatedResponse<BlockedUserListItem>>;
1015
+
1016
+ declare const Users_checkUsernameAvailability: typeof checkUsernameAvailability;
1017
+ declare const Users_createBlock: typeof createBlock;
1018
+ declare const Users_createFollow: typeof createFollow;
1019
+ declare const Users_deleteBlock: typeof deleteBlock;
1020
+ declare const Users_fetchBlockStatus: typeof fetchBlockStatus;
1021
+ declare const Users_fetchBlockedUsers: typeof fetchBlockedUsers;
1022
+ declare const Users_fetchConnectionStatus: typeof fetchConnectionStatus;
1023
+ declare const Users_fetchConnectionsByUserId: typeof fetchConnectionsByUserId;
1024
+ declare const Users_fetchConnectionsCountByUserId: typeof fetchConnectionsCountByUserId;
1025
+ declare const Users_fetchFollowStatus: typeof fetchFollowStatus;
1026
+ declare const Users_fetchFollowersByUserId: typeof fetchFollowersByUserId;
1027
+ declare const Users_fetchFollowersCountByUserId: typeof fetchFollowersCountByUserId;
1028
+ declare const Users_fetchFollowingByUserId: typeof fetchFollowingByUserId;
1029
+ declare const Users_fetchFollowingCountByUserId: typeof fetchFollowingCountByUserId;
1030
+ declare const Users_fetchUserByForeignId: typeof fetchUserByForeignId;
1031
+ declare const Users_fetchUserById: typeof fetchUserById;
1032
+ declare const Users_fetchUserByUsername: typeof fetchUserByUsername;
1033
+ declare const Users_fetchUserSuggestions: typeof fetchUserSuggestions;
1034
+ declare const Users_removeConnectionByUserId: typeof removeConnectionByUserId;
1035
+ declare const Users_requestConnection: typeof requestConnection;
1036
+ declare const Users_updateUser: typeof updateUser;
1037
+ declare namespace Users {
1038
+ export { Users_checkUsernameAvailability as checkUsernameAvailability, Users_createBlock as createBlock, Users_createFollow as createFollow, Users_deleteBlock as deleteBlock, deleteFollow$1 as deleteFollow, Users_fetchBlockStatus as fetchBlockStatus, Users_fetchBlockedUsers as fetchBlockedUsers, Users_fetchConnectionStatus as fetchConnectionStatus, Users_fetchConnectionsByUserId as fetchConnectionsByUserId, Users_fetchConnectionsCountByUserId as fetchConnectionsCountByUserId, Users_fetchFollowStatus as fetchFollowStatus, Users_fetchFollowersByUserId as fetchFollowersByUserId, Users_fetchFollowersCountByUserId as fetchFollowersCountByUserId, Users_fetchFollowingByUserId as fetchFollowingByUserId, Users_fetchFollowingCountByUserId as fetchFollowingCountByUserId, Users_fetchUserByForeignId as fetchUserByForeignId, Users_fetchUserById as fetchUserById, Users_fetchUserByUsername as fetchUserByUsername, Users_fetchUserSuggestions as fetchUserSuggestions, Users_removeConnectionByUserId as removeConnectionByUserId, Users_requestConnection as requestConnection, Users_updateUser as updateUser };
1039
+ }
1040
+
1041
+ /** The three grantable target kinds. Polymorphic — `targetId` carries no FK. */
1042
+ type ReputationGrantTargetType = "entity" | "comment" | "chat-message";
1043
+ /**
1044
+ * Who created the grant. `"user"` is a debited transfer (reputation moved out
1045
+ * of `senderId`'s bucket); `"app"` is a mint issued by the project itself with
1046
+ * a null `senderId`. Persisted rather than inferred from `senderId`, which is
1047
+ * also null for a transfer whose sender was later deleted.
1048
+ */
1049
+ type ReputationGrantSourceType = "user" | "app";
1050
+ /**
1051
+ * The "which item was rewarded" pair, as a both-or-neither union.
1052
+ *
1053
+ * Modelled as a two-branch union rather than two independent optional fields so
1054
+ * a half-filled target — `{ targetType }` with no `targetId`, or the reverse —
1055
+ * does not compile. The server answers that shape with
1056
+ * `400 reputation-grant/invalid-body` on the write (a shared
1057
+ * `bothOrNeitherTarget` refinement) and
1058
+ * `400 reputation-grant/invalid-filter` on the list, so the union turns a
1059
+ * guaranteed round trip into a red squiggle.
1060
+ *
1061
+ * The empty branch is `?: undefined`, NOT `?: null` — deliberately, and for the
1062
+ * same reason `metadata` is not nullable: `grantBodyFields.targetType` is
1063
+ * `.optional()` with no `.nullable()`, so an explicit `targetType: null` is
1064
+ * rejected. Omit both keys to mean "no target".
1065
+ *
1066
+ * Building the pair conditionally needs one accommodation: an inline
1067
+ * conditional spread of just these two keys widens both to `T | undefined` and
1068
+ * then matches neither branch. Either branch the whole argument, or name this
1069
+ * type on a helper and spread that:
1070
+ *
1071
+ * ```ts
1072
+ * const target: ReputationGrantTargetFilter = item
1073
+ * ? { targetType: "entity", targetId: item.id }
1074
+ * : {};
1075
+ * await listGrants(client, { ...base, ...target });
1076
+ * ```
1077
+ */
1078
+ type ReputationGrantTargetFilter = {
1079
+ /** The kind of item rewarded. Requires `targetId` alongside it. */
1080
+ targetType: ReputationGrantTargetType;
1081
+ /** The rewarded item's id. Requires `targetType` alongside it. */
1082
+ targetId: string;
1083
+ } | {
1084
+ targetType?: undefined;
1085
+ targetId?: undefined;
1086
+ };
1087
+ /**
1088
+ * Per-item reputation-grant summary. Covers positive grants only — negative
1089
+ * grants (app deductions) are invisible on every public read surface.
1090
+ */
1091
+ interface GrantSummary {
1092
+ /** Sum of positive grant amounts on the item. */
1093
+ total: number;
1094
+ /** Number of positive grants on the item. */
1095
+ count: number;
1096
+ /** The calling user's own summed positive grants on the item. */
1097
+ viewerTotal: number;
1098
+ }
1099
+ /**
1100
+ * A single reputation movement. Rows are append-only — nothing updates or
1101
+ * soft-deletes them — so the table is the audit log behind every balance.
1102
+ */
1103
+ interface ReputationGrant {
1104
+ id: string;
1105
+ sourceType: ReputationGrantSourceType;
1106
+ /** Null for an app mint, and for a transfer whose sender was deleted. */
1107
+ senderId: string | null;
1108
+ /** Populated when the list is called with `include: "user"`. */
1109
+ sender?: User | null;
1110
+ recipientId: string;
1111
+ /** Populated when the list is called with `include: "user"`. */
1112
+ recipient?: User | null;
1113
+ /** Non-zero. Negative only when `sourceType` is `"app"`. */
1114
+ amount: number;
1115
+ /** The bucket both legs moved in; null = the project-general bucket. */
1116
+ spaceId: string | null;
1117
+ /** Both null or both non-null. */
1118
+ targetType: ReputationGrantTargetType | null;
1119
+ targetId: string | null;
1120
+ note: string | null;
1121
+ metadata: Record<string, any> | null;
1122
+ createdAt: string;
1123
+ updatedAt: string;
1124
+ }
1125
+
1126
+ type Mention = UserMention | SpaceMention;
1127
+ interface UserMention {
1128
+ type: "user";
1129
+ id: string;
1130
+ foreignId?: string | null;
1131
+ username: string;
1132
+ }
1133
+ interface SpaceMention {
1134
+ type: "space";
1135
+ id: string;
1136
+ slug: string;
1137
+ }
1138
+
1139
+ type ReadingPermission = "anyone" | "members";
1140
+ type PostingPermission = "anyone" | "members" | "admins";
1141
+ type SpaceVisibility = "public" | "unlisted" | "private";
1142
+ type SpaceMemberRole = "admin" | "moderator" | "member";
1143
+ type SpaceMemberStatus = "pending" | "active" | "banned" | "rejected";
1144
+ interface SpaceMemberPermissions {
1145
+ isAdmin: boolean;
1146
+ isModerator: boolean;
1147
+ isMember: boolean;
1148
+ status: "pending" | "active" | "banned" | null;
1149
+ canPost: boolean;
1150
+ canModerate: boolean;
1151
+ canRead: boolean;
1152
+ }
1153
+ interface SpacePreview {
1154
+ id: string;
1155
+ shortId: string;
1156
+ name: string;
1157
+ slug: string | null;
1158
+ avatarFileId: string | null;
1159
+ readingPermission?: ReadingPermission;
1160
+ visibility?: SpaceVisibility;
1161
+ parentSpaceId?: string | null;
1162
+ depth?: number;
1163
+ avatarFile?: File$1;
1164
+ }
1165
+ interface Space {
1166
+ id: string;
1167
+ projectId: string;
1168
+ shortId: string;
1169
+ slug: string | null;
1170
+ name: string;
1171
+ description: string | null;
1172
+ avatarFileId: string | null;
1173
+ bannerFileId: string | null;
1174
+ userId: string;
1175
+ readingPermission: ReadingPermission;
1176
+ postingPermission: PostingPermission;
1177
+ visibility: SpaceVisibility;
1178
+ requireJoinApproval: boolean;
1179
+ nsfw: boolean;
1180
+ nsfwEffective: boolean;
1181
+ parentSpaceId: string | null;
1182
+ depth: number;
1183
+ metadata: Record<string, any>;
1184
+ createdAt: string;
1185
+ updatedAt: string;
1186
+ deletedAt: string | null;
1187
+ membersCount: number;
1188
+ childSpacesCount: number;
1189
+ isMember?: boolean;
1190
+ avatarFile?: File$1;
1191
+ bannerFile?: File$1;
1192
+ }
1193
+ interface SpaceDetailed extends Space {
1194
+ memberPermissions: SpaceMemberPermissions | null;
1195
+ parentSpace: SpacePreview | null;
1196
+ childSpaces: SpacePreview[];
1197
+ }
1198
+ interface UserSpaceItem {
1199
+ space: Space;
1200
+ membership: {
1201
+ membershipId: string;
1202
+ role: SpaceMemberRole;
1203
+ status: SpaceMemberStatus;
1204
+ joinedAt: string;
1205
+ };
1206
+ }
1207
+ type UserSpacesResponse = PaginatedResponse<UserSpaceItem>;
1208
+ interface JoinSpaceResponse {
1209
+ message: string;
1210
+ membership: {
1211
+ id: string;
1212
+ spaceId: string;
1213
+ userId: string;
1214
+ role: "member";
1215
+ status: "pending" | "active";
1216
+ joinedAt: string;
1217
+ };
1218
+ }
1219
+ interface LeaveSpaceResponse {
1220
+ message: string;
1221
+ }
1222
+ interface UpdateMemberRoleResponse {
1223
+ message: string;
1224
+ membership: {
1225
+ id: string;
1226
+ role: SpaceMemberRole;
1227
+ status: string;
1228
+ joinedAt: string;
1229
+ userId: string;
1230
+ };
1231
+ }
1232
+ interface ApproveMemberResponse {
1233
+ message: string;
1234
+ membership: {
1235
+ id: string;
1236
+ status: "active";
1237
+ joinedAt: string;
1238
+ };
1239
+ }
1240
+ interface DeclineMemberResponse {
1241
+ message: string;
1242
+ membership: {
1243
+ id: string;
1244
+ status: "rejected";
1245
+ };
1246
+ }
1247
+ interface CheckMyMembershipResponse {
1248
+ isMember: boolean;
1249
+ role: "admin" | "moderator" | "member" | null;
1250
+ status: "pending" | "active" | "banned" | "rejected" | null;
1251
+ joinedAt: string | null;
1252
+ permissions: {
1253
+ canPost: boolean;
1254
+ canModerate: boolean;
1255
+ canRead: boolean;
1256
+ isAdmin: boolean;
1257
+ isModerator: boolean;
1258
+ };
1259
+ }
1260
+ interface DeleteSpaceResponse {
1261
+ message: string;
1262
+ }
1263
+ interface SpaceBreadcrumb {
1264
+ breadcrumb: SpacePreview[];
1265
+ depth: number;
1266
+ }
1267
+
1268
+ type ReactionType = "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
1269
+ interface ReactionCounts {
1270
+ upvote: number;
1271
+ downvote: number;
1272
+ like: number;
1273
+ love: number;
1274
+ wow: number;
1275
+ sad: number;
1276
+ angry: number;
1277
+ funny: number;
1278
+ }
1279
+ interface Reaction {
1280
+ id: string;
1281
+ projectId: string;
1282
+ targetType: "entity" | "comment";
1283
+ targetId: string;
1284
+ userId: string;
1285
+ reactionType: ReactionType;
1286
+ createdAt: string;
1287
+ updatedAt: string;
1288
+ user?: User;
1289
+ }
1290
+
1291
+ interface TopComment {
1292
+ id: string;
1293
+ user: User;
1294
+ upvotesCount: number;
1295
+ content: string;
1296
+ createdAt: string;
1297
+ }
1298
+ interface Entity {
1299
+ id: string;
1300
+ foreignId: string | null;
1301
+ shortId: string;
1302
+ projectId: string;
1303
+ sourceId: string | null;
1304
+ spaceId: string | null;
1305
+ space?: Space | null;
1306
+ userId: string | null;
1307
+ user?: User | null;
1308
+ title: string | null;
1309
+ content: string | null;
1310
+ mentions: Mention[];
1311
+ attachments: Record<string, any>[];
1312
+ files?: File$1[];
1313
+ keywords: string[];
1314
+ upvotes: string[];
1315
+ downvotes: string[];
1316
+ reactionCounts: ReactionCounts;
1317
+ userReaction?: ReactionType | null;
1318
+ repliesCount: number;
1319
+ views: number;
1320
+ score: number;
1321
+ scoreUpdatedAt: string;
1322
+ location: {
1323
+ type: "Point";
1324
+ coordinates: [number, number];
1325
+ } | null;
1326
+ metadata: Record<string, any>;
1327
+ nsfw: boolean;
1328
+ nsfwEffective: boolean;
1329
+ topComment: TopComment | null;
1330
+ isSaved?: boolean;
1331
+ /**
1332
+ * Reputation-grant summary. Opt-in — present exactly when the read requested
1333
+ * `include=grants`. Once requested the server always returns the object,
1334
+ * zero-filled rather than omitted, on projects with no grants and on projects
1335
+ * without the reputation bundle alike.
1336
+ */
1337
+ grants?: GrantSummary;
1338
+ isDraft: boolean | null;
1339
+ moderationStatus: "approved" | "removed" | null;
1340
+ moderatedAt: string | null;
1341
+ moderatedById: string | null;
1342
+ moderatedByType: "client" | "user" | null;
1343
+ moderationReason: string | null;
1344
+ createdAt: string;
1345
+ updatedAt: string;
1346
+ deletedAt: string | null;
1347
+ }
1348
+
1349
+ interface CreateEntityProps {
1350
+ foreignId?: string;
1351
+ sourceId?: string;
1352
+ spaceId?: string;
1353
+ title?: string;
1354
+ content?: string;
1355
+ attachments?: Record<string, any>[];
1356
+ keywords?: string[];
1357
+ mentions?: Mention[];
1358
+ location?: {
1359
+ latitude: number;
1360
+ longitude: number;
1361
+ };
1362
+ metadata?: Record<string, any>;
1363
+ nsfw?: boolean;
1364
+ isDraft?: boolean;
1365
+ /** Create the entity without attributing it to the logged-in user (authorless). */
1366
+ excludeUserId?: boolean;
1367
+ }
1368
+ declare function createEntity(client: SublayHttpClient, data: CreateEntityProps): Promise<Entity>;
1369
+
1370
+ interface FetchEntityProps extends SpaceReputationContextParams {
1371
+ entityId: string;
1372
+ include?: string;
1373
+ }
1374
+ declare function fetchEntity(client: SublayHttpClient, data: FetchEntityProps): Promise<Entity>;
1375
+
1376
+ interface FetchEntityByForeignIdProps {
1377
+ foreignId: string;
1378
+ createIfNotFound?: boolean;
1379
+ include?: string;
1380
+ }
1381
+ declare function fetchEntityByForeignId(client: SublayHttpClient, data: FetchEntityByForeignIdProps): Promise<Entity>;
1382
+
1383
+ interface FetchEntityByShortIdProps {
1384
+ shortId: string;
1385
+ include?: string;
1386
+ }
1387
+ declare function fetchEntityByShortId(client: SublayHttpClient, data: FetchEntityByShortIdProps): Promise<Entity>;
1388
+
1389
+ interface KeywordsFilters {
1390
+ includes?: string[];
1391
+ doesNotInclude?: string[];
1392
+ }
1393
+ interface MetadataFilters {
1394
+ includes?: {
1395
+ [key: string]: any;
1396
+ };
1397
+ includesAny?: {
1398
+ [key: string]: any;
1399
+ }[];
1400
+ doesNotInclude?: {
1401
+ [key: string]: any;
1402
+ };
1403
+ exists?: string[];
1404
+ doesNotExist?: string[];
1405
+ }
1406
+ interface TextFilters {
1407
+ hasTitle?: "true" | "false";
1408
+ includes?: string | string[];
1409
+ doesNotInclude?: string | string[];
1410
+ }
1411
+ interface AttachmentsFilters {
1412
+ hasAttachments?: "true" | "false";
1413
+ }
1414
+ interface LocationFilters {
1415
+ latitude: string;
1416
+ longitude: string;
1417
+ radius: string;
1418
+ }
1419
+ interface FetchManyEntitiesProps extends SpaceReputationContextParams {
1420
+ sourceId?: string;
1421
+ spaceId?: string;
1422
+ sortBy?: "createdAt" | "hot" | "top" | "controversial"
1423
+ /** @deprecated Use "createdAt" instead. "new" is a directional alias removed
1424
+ * in v8; the server still accepts it (identical behavior) but responds with
1425
+ * deprecation headers. */
1426
+ | "new" | (string & {});
1427
+ sortDir?: "asc" | "desc";
1428
+ sortType?: "auto" | "numeric" | "text" | "boolean" | "timestamp";
1429
+ sortByReaction?: "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
1430
+ page?: number;
1431
+ limit?: number;
1432
+ include?: string;
1433
+ timeFrame?: "hour" | "day" | "week" | "month" | "year";
1434
+ userId?: string;
1435
+ followedOnly?: "true" | "false";
1436
+ keywordsFilters?: KeywordsFilters;
1437
+ metadataFilters?: MetadataFilters;
1438
+ titleFilters?: TextFilters;
1439
+ contentFilters?: {
1440
+ hasContent?: "true" | "false";
1441
+ includes?: string | string[];
1442
+ doesNotInclude?: string | string[];
1443
+ };
1444
+ attachmentsFilters?: AttachmentsFilters;
1445
+ locationFilters?: LocationFilters;
1446
+ nsfwFilter?: "include-all" | "exclude" | "only";
1447
+ blockedFilter?: "exclude" | "include-outbound-blocked";
1448
+ }
1449
+ declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
1450
+
1451
+ interface UpdateEntityProps {
1452
+ entityId: string;
1453
+ title?: string;
1454
+ content?: string;
1455
+ attachments?: Record<string, any>[];
1456
+ keywords?: string[];
1457
+ mentions?: Mention[];
1458
+ location?: {
1459
+ latitude: number;
1460
+ longitude: number;
1461
+ };
1462
+ metadata?: Record<string, any>;
1463
+ nsfw?: boolean;
1464
+ }
1465
+ declare function updateEntity(client: SublayHttpClient, data: UpdateEntityProps): Promise<Entity>;
1466
+
1467
+ interface DeleteEntityProps {
1468
+ entityId: string;
1469
+ }
1470
+ declare function deleteEntity(client: SublayHttpClient, data: DeleteEntityProps): Promise<void>;
1471
+
1472
+ interface FetchDraftsProps {
1473
+ page?: number;
1474
+ limit?: number;
1475
+ sourceId?: string;
1476
+ spaceId?: string;
1477
+ include?: string;
1478
+ }
1479
+ declare function fetchDrafts(client: SublayHttpClient, data: FetchDraftsProps): Promise<PaginatedResponse<Entity>>;
1480
+
1481
+ interface PublishDraftProps {
1482
+ entityId: string;
1483
+ }
1484
+ declare function publishDraft(client: SublayHttpClient, data: PublishDraftProps): Promise<Entity>;
1485
+
1486
+ interface FetchTopCommentProps {
1487
+ entityId: string;
1488
+ }
1489
+ declare function fetchTopComment(client: SublayHttpClient, data: FetchTopCommentProps): Promise<TopComment | null>;
1490
+
1491
+ interface AddEntityReactionProps {
1492
+ entityId: string;
1493
+ reactionType: ReactionType;
1494
+ }
1495
+ declare function addReaction$1(client: SublayHttpClient, data: AddEntityReactionProps): Promise<Entity>;
1496
+
1497
+ interface RemoveEntityReactionProps {
1498
+ entityId: string;
1499
+ }
1500
+ declare function removeReaction$1(client: SublayHttpClient, data: RemoveEntityReactionProps): Promise<Entity>;
1501
+
1502
+ interface FetchEntityReactionsProps extends SpaceReputationContextParams {
1503
+ entityId: string;
1504
+ reactionType?: ReactionType;
1505
+ page?: number;
1506
+ limit?: number;
1507
+ sortDir?: "asc" | "desc";
1508
+ }
1509
+ interface FetchEntityReactionsResponse {
1510
+ data: Reaction[];
1511
+ pagination: PaginationMetadata;
1512
+ }
1513
+ declare function fetchReactions$1(client: SublayHttpClient, data: FetchEntityReactionsProps): Promise<FetchEntityReactionsResponse>;
1514
+
1515
+ interface GetUserEntityReactionProps {
1516
+ entityId: string;
1517
+ }
1518
+ interface UserReactionResponse {
1519
+ reactionType: ReactionType | null;
1520
+ }
1521
+ declare function getUserReaction$1(client: SublayHttpClient, data: GetUserEntityReactionProps): Promise<UserReactionResponse>;
1522
+
1523
+ interface IsEntitySavedProps {
1524
+ entityId: string;
1525
+ }
1526
+ interface IsEntitySavedResponse {
1527
+ saved: boolean;
1528
+ collections: {
1529
+ id: string;
1530
+ name: string;
1531
+ }[];
1532
+ }
1533
+ declare function isEntitySaved(client: SublayHttpClient, data: IsEntitySavedProps): Promise<IsEntitySavedResponse>;
1534
+
1535
+ declare const Entities_createEntity: typeof createEntity;
1536
+ declare const Entities_deleteEntity: typeof deleteEntity;
1537
+ declare const Entities_fetchDrafts: typeof fetchDrafts;
1538
+ declare const Entities_fetchEntity: typeof fetchEntity;
1539
+ declare const Entities_fetchEntityByForeignId: typeof fetchEntityByForeignId;
1540
+ declare const Entities_fetchEntityByShortId: typeof fetchEntityByShortId;
1541
+ declare const Entities_fetchManyEntities: typeof fetchManyEntities;
1542
+ declare const Entities_fetchTopComment: typeof fetchTopComment;
1543
+ declare const Entities_isEntitySaved: typeof isEntitySaved;
1544
+ declare const Entities_publishDraft: typeof publishDraft;
1545
+ declare const Entities_updateEntity: typeof updateEntity;
1546
+ declare namespace Entities {
1547
+ export { addReaction$1 as addReaction, Entities_createEntity as createEntity, Entities_deleteEntity as deleteEntity, Entities_fetchDrafts as fetchDrafts, Entities_fetchEntity as fetchEntity, Entities_fetchEntityByForeignId as fetchEntityByForeignId, Entities_fetchEntityByShortId as fetchEntityByShortId, Entities_fetchManyEntities as fetchManyEntities, fetchReactions$1 as fetchReactions, Entities_fetchTopComment as fetchTopComment, getUserReaction$1 as getUserReaction, Entities_isEntitySaved as isEntitySaved, Entities_publishDraft as publishDraft, removeReaction$1 as removeReaction, Entities_updateEntity as updateEntity };
1548
+ }
1549
+
1550
+ type EventType = "online" | "physical" | "hybrid";
1551
+ type EventVisibility = "public" | "members" | "invite";
1552
+ type EventStatus = "active" | "cancelled";
1553
+ type RsvpStatus = "going" | "maybe" | "not_going";
1554
+ interface RsvpCounts {
1555
+ going: number;
1556
+ maybe: number;
1557
+ not_going: number;
1558
+ }
1559
+ interface Event {
1560
+ id: string;
1561
+ shortId: string;
1562
+ projectId: string;
1563
+ userId: string | null;
1564
+ user?: User | null;
1565
+ title: string;
1566
+ description: string | null;
1567
+ startTime: string;
1568
+ endTime: string | null;
1569
+ timezone: string | null;
1570
+ type: EventType;
1571
+ url: string | null;
1572
+ venueName: string | null;
1573
+ address: string | null;
1574
+ location: {
1575
+ type: "Point";
1576
+ coordinates: [number, number];
1577
+ } | null;
1578
+ spaceId: string | null;
1579
+ space?: Space | null;
1580
+ visibility: EventVisibility;
1581
+ status: EventStatus;
1582
+ allowMaybe: boolean;
1583
+ guestListVisible: boolean;
1584
+ capacity: number | null;
1585
+ hostIds: string[];
1586
+ coverImageId: string | null;
1587
+ files?: File$1[];
1588
+ rsvpCounts: RsvpCounts;
1589
+ userRsvp?: RsvpStatus | null;
1590
+ metadata: Record<string, any>;
1591
+ createdAt: string;
1592
+ updatedAt: string;
1593
+ deletedAt: string | null;
1594
+ }
1595
+ interface EventRsvp {
1596
+ id: string;
1597
+ eventId: string;
1598
+ userId: string;
1599
+ user?: User | null;
1600
+ status: RsvpStatus;
1601
+ createdAt: string;
1602
+ updatedAt: string;
1603
+ }
1604
+ interface EventInvite {
1605
+ id: string;
1606
+ eventId: string;
1607
+ userId: string;
1608
+ user?: User | null;
1609
+ invitedAt: string;
1610
+ createdAt: string;
1611
+ updatedAt: string;
1612
+ }
1613
+
1614
+ /** A single cover image plus its processing options (stored as Event.coverImageId). */
1615
+ interface EventCoverUpload {
1616
+ file: Blob | File;
1617
+ /** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
1618
+ options: ImageOptions;
1619
+ }
1620
+ /** A gallery image set plus shared processing options (Files with eventId + position). */
1621
+ interface EventGalleryUpload {
1622
+ files: (Blob | File)[];
1623
+ /** Image-processing config applied to every gallery image — see {@link ImageOptions}. */
1624
+ options: ImageOptions;
1625
+ }
1626
+ interface CreateEventProps {
1627
+ title: string;
1628
+ description?: string;
1629
+ startTime: string;
1630
+ endTime?: string;
1631
+ timezone?: string;
1632
+ type: EventType;
1633
+ url?: string;
1634
+ venueName?: string;
1635
+ address?: string;
1636
+ location?: {
1637
+ latitude: number;
1638
+ longitude: number;
1639
+ };
1640
+ spaceId?: string;
1641
+ visibility?: EventVisibility;
1642
+ capacity?: number;
1643
+ allowMaybe?: boolean;
1644
+ guestListVisible?: boolean;
1645
+ /** Additional host user IDs (the logged-in user is auto-added as a host). */
1646
+ hostIds?: string[];
1647
+ metadata?: Record<string, any>;
1648
+ /**
1649
+ * Inline cover image (single). When present the request is sent as
1650
+ * `multipart/form-data`. Requires the `files-images` bundle.
1651
+ */
1652
+ cover?: EventCoverUpload;
1653
+ /**
1654
+ * Inline gallery images (multi). When present the request is sent as
1655
+ * `multipart/form-data`. Requires the `files-images` bundle.
1656
+ */
1657
+ gallery?: EventGalleryUpload;
1658
+ }
1659
+ declare function createEvent(client: SublayHttpClient, data: CreateEventProps): Promise<Event>;
1660
+
1661
+ interface FetchEventProps {
1662
+ eventId: string;
1663
+ /** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
1664
+ include?: string;
1665
+ }
1666
+ declare function fetchEvent(client: SublayHttpClient, data: FetchEventProps): Promise<Event>;
1667
+
1668
+ interface EventTextFilters {
1669
+ hasTitle?: "true" | "false";
1670
+ includes?: string | string[];
1671
+ doesNotInclude?: string | string[];
1672
+ }
1673
+ interface EventDescriptionFilters {
1674
+ hasDescription?: "true" | "false";
1675
+ includes?: string | string[];
1676
+ doesNotInclude?: string | string[];
1677
+ }
1678
+ interface EventLocationFilters {
1679
+ latitude: string;
1680
+ longitude: string;
1681
+ radius: string;
1682
+ }
1683
+ interface FetchManyEventsProps {
1684
+ page?: number;
1685
+ limit?: number;
1686
+ sortBy?: "startTime" | "going";
1687
+ sortDir?: "asc" | "desc";
1688
+ timeWindow?: "upcoming" | "ongoing" | "past";
1689
+ startsAfter?: string;
1690
+ startsBefore?: string;
1691
+ spaceId?: string;
1692
+ hostId?: string;
1693
+ type?: EventType;
1694
+ status?: EventStatus;
1695
+ /**
1696
+ * Comma-separated RSVP statuses the logged-in user RSVP'd with, e.g.
1697
+ * "going,maybe". Filters to events the caller has that RSVP on.
1698
+ */
1699
+ myRsvp?: string;
1700
+ locationFilters?: EventLocationFilters;
1701
+ titleFilters?: EventTextFilters;
1702
+ descriptionFilters?: EventDescriptionFilters;
1703
+ /** Comma-separated associations to expand, e.g. "user,space,files,userRsvp". */
1704
+ include?: string;
1705
+ }
1706
+ declare function fetchManyEvents(client: SublayHttpClient, data?: FetchManyEventsProps): Promise<PaginatedResponse<Event>>;
1707
+
1708
+ interface UpdateEventProps {
1709
+ eventId: string;
1710
+ title?: string;
1711
+ description?: string;
1712
+ startTime?: string;
1713
+ endTime?: string;
1714
+ timezone?: string;
1715
+ type?: EventType;
1716
+ url?: string;
1717
+ venueName?: string;
1718
+ address?: string;
1719
+ location?: {
1720
+ latitude: number;
1721
+ longitude: number;
1722
+ };
1723
+ visibility?: EventVisibility;
1724
+ capacity?: number;
1725
+ allowMaybe?: boolean;
1726
+ guestListVisible?: boolean;
1727
+ metadata?: Record<string, any>;
1728
+ /**
1729
+ * File IDs of existing event images to REMOVE (gallery photos and/or the
1730
+ * current cover). Combine with `gallery` (append) + `cover` (replace) to fully
1731
+ * curate the image set in one update. Sent in the JSON body, or — when an
1732
+ * image file is also attached — as a JSON-string field the server parses.
1733
+ */
1734
+ removeImageIds?: string[];
1735
+ /**
1736
+ * New cover image (single) — REPLACES the existing cover. When present the
1737
+ * request is sent as `multipart/form-data`. Requires the `files-images` bundle.
1738
+ */
1739
+ cover?: EventCoverUpload;
1740
+ /**
1741
+ * Gallery images (multi) — APPENDED to the event's existing images. When
1742
+ * present the request is sent as `multipart/form-data`. Requires the
1743
+ * `files-images` bundle.
1744
+ */
1745
+ gallery?: EventGalleryUpload;
1746
+ }
1747
+ declare function updateEvent(client: SublayHttpClient, data: UpdateEventProps): Promise<Event>;
1748
+
1749
+ interface CancelEventProps {
1750
+ eventId: string;
1751
+ }
1752
+ declare function cancelEvent(client: SublayHttpClient, data: CancelEventProps): Promise<Event>;
1753
+
1754
+ interface DeleteEventProps {
1755
+ eventId: string;
1756
+ }
1757
+ declare function deleteEvent(client: SublayHttpClient, data: DeleteEventProps): Promise<void>;
1758
+
1759
+ interface SetRsvpProps {
1760
+ eventId: string;
1761
+ status: RsvpStatus;
1762
+ }
1763
+ declare function setRsvp(client: SublayHttpClient, data: SetRsvpProps): Promise<Event>;
1764
+
1765
+ interface WithdrawRsvpProps {
1766
+ eventId: string;
1767
+ }
1768
+ declare function withdrawRsvp(client: SublayHttpClient, data: WithdrawRsvpProps): Promise<Event>;
1769
+
1770
+ interface AddHostProps {
1771
+ eventId: string;
1772
+ /** The user to grant host on the event. */
1773
+ userId: string;
1774
+ }
1775
+ declare function addHost(client: SublayHttpClient, data: AddHostProps): Promise<Event>;
1776
+
1777
+ interface RemoveHostProps {
1778
+ eventId: string;
1779
+ /** The host to remove. Rejected if it would leave the event with no hosts. */
1780
+ userId: string;
1781
+ }
1782
+ declare function removeHost(client: SublayHttpClient, data: RemoveHostProps): Promise<Event>;
1783
+
1784
+ interface AddInviteProps {
1785
+ eventId: string;
1786
+ /** The user to invite (userId only — never a foreignId). Idempotent. */
1787
+ userId: string;
1788
+ }
1789
+ declare function addInvite(client: SublayHttpClient, data: AddInviteProps): Promise<Event>;
1790
+
1791
+ interface RemoveInviteProps {
1792
+ eventId: string;
1793
+ /** The invitee to remove. Also drops their RSVP and revokes access. */
1794
+ userId: string;
1795
+ }
1796
+ declare function removeInvite(client: SublayHttpClient, data: RemoveInviteProps): Promise<Event>;
1797
+
1798
+ interface FetchInviteesProps {
1799
+ eventId: string;
1800
+ page?: number;
1801
+ limit?: number;
1802
+ }
1803
+ /**
1804
+ * Host-only invitee (guest) list. Non-hosts get 403.
1805
+ */
1806
+ declare function fetchInvitees(client: SublayHttpClient, data: FetchInviteesProps): Promise<PaginatedResponse<EventInvite>>;
1807
+
1808
+ interface FetchEventRsvpsProps {
1809
+ eventId: string;
1810
+ page?: number;
1811
+ limit?: number;
1812
+ /**
1813
+ * Comma-separated RSVP statuses to filter by, e.g. "going,maybe". When
1814
+ * omitted, all statuses are returned.
1815
+ */
1816
+ status?: string;
1817
+ }
1818
+ /**
1819
+ * Named RSVP (guest) list. Visible to hosts always, or to any viewer when the
1820
+ * event's `guestListVisible` is true; otherwise 403. RSVP counts themselves are
1821
+ * public via the event's `rsvpCounts`.
1822
+ */
1823
+ declare function fetchEventRsvps(client: SublayHttpClient, data: FetchEventRsvpsProps): Promise<PaginatedResponse<EventRsvp>>;
1824
+
1825
+ declare const Events_addHost: typeof addHost;
1826
+ declare const Events_addInvite: typeof addInvite;
1827
+ declare const Events_cancelEvent: typeof cancelEvent;
1828
+ declare const Events_createEvent: typeof createEvent;
1829
+ declare const Events_deleteEvent: typeof deleteEvent;
1830
+ declare const Events_fetchEvent: typeof fetchEvent;
1831
+ declare const Events_fetchEventRsvps: typeof fetchEventRsvps;
1832
+ declare const Events_fetchInvitees: typeof fetchInvitees;
1833
+ declare const Events_fetchManyEvents: typeof fetchManyEvents;
1834
+ declare const Events_removeHost: typeof removeHost;
1835
+ declare const Events_removeInvite: typeof removeInvite;
1836
+ declare const Events_setRsvp: typeof setRsvp;
1837
+ declare const Events_updateEvent: typeof updateEvent;
1838
+ declare const Events_withdrawRsvp: typeof withdrawRsvp;
1839
+ declare namespace Events {
1840
+ export { Events_addHost as addHost, Events_addInvite as addInvite, Events_cancelEvent as cancelEvent, Events_createEvent as createEvent, Events_deleteEvent as deleteEvent, Events_fetchEvent as fetchEvent, Events_fetchEventRsvps as fetchEventRsvps, Events_fetchInvitees as fetchInvitees, Events_fetchManyEvents as fetchManyEvents, Events_removeHost as removeHost, Events_removeInvite as removeInvite, Events_setRsvp as setRsvp, Events_updateEvent as updateEvent, Events_withdrawRsvp as withdrawRsvp };
1841
+ }
1842
+
1843
+ interface GifData {
1844
+ id: string;
1845
+ url: string;
1846
+ gifUrl: string;
1847
+ gifPreviewUrl: string;
1848
+ altText: string;
1849
+ aspectRatio: string;
1850
+ }
1851
+ interface Comment {
1852
+ id: string;
1853
+ projectId: string;
1854
+ foreignId: string | null;
1855
+ entityId: string;
1856
+ entity?: Entity;
1857
+ userId: string;
1858
+ user?: User;
1859
+ parentId: string | null;
1860
+ parentComment?: Comment;
1861
+ content: string | null;
1862
+ gif: GifData | null;
1863
+ mentions: Mention[];
1864
+ upvotes: string[];
1865
+ downvotes: string[];
1866
+ reactionCounts: ReactionCounts;
1867
+ userReaction?: ReactionType | null;
1868
+ repliesCount: number;
1869
+ /**
1870
+ * Reputation-grant summary. Opt-in — present exactly when the read requested
1871
+ * `include=grants`. Once requested the server always returns the object,
1872
+ * zero-filled rather than omitted, on projects with no grants and on projects
1873
+ * without the reputation bundle alike.
1874
+ */
1875
+ grants?: GrantSummary;
1876
+ metadata: Record<string, any>;
1877
+ createdAt: string;
1878
+ updatedAt: string;
1879
+ deletedAt: string | null;
1880
+ parentDeletedAt: string | null;
1881
+ userDeletedAt: string | null;
1882
+ moderationStatus: "approved" | "removed" | null;
1883
+ moderatedAt: string | null;
1884
+ moderatedById: string | null;
1885
+ moderatedByType: "client" | "user" | null;
1886
+ moderationReason: string | null;
1887
+ }
1888
+
1889
+ interface CreateCommentProps {
1890
+ entityId: string;
1891
+ foreignId?: string;
1892
+ content?: string;
1893
+ gif?: GifData | null;
1894
+ mentions?: Mention[];
1895
+ parentId?: string | null;
1896
+ referencedCommentId?: string;
1897
+ attachments?: Record<string, any>[];
1898
+ metadata?: Record<string, any>;
1899
+ }
1900
+ declare function createComment(client: SublayHttpClient, data: CreateCommentProps): Promise<Comment>;
1901
+
1902
+ interface FetchCommentProps extends SpaceReputationContextParams {
1903
+ commentId: string;
1904
+ include?: string;
1905
+ }
1906
+ declare function fetchComment(client: SublayHttpClient, data: FetchCommentProps): Promise<Comment>;
1907
+
1908
+ interface FetchCommentByForeignIdProps {
1909
+ foreignId: string;
1910
+ include?: string;
1911
+ }
1912
+ declare function fetchCommentByForeignId(client: SublayHttpClient, data: FetchCommentByForeignIdProps): Promise<Comment>;
1913
+
1914
+ interface UpdateCommentProps {
1915
+ commentId: string;
1916
+ /** New text content. Cannot be empty. Omit to leave the content untouched. */
1917
+ content?: string;
1918
+ /** Replaces the comment's metadata wholesale (not merged). */
1919
+ metadata?: Record<string, any>;
1920
+ }
1921
+ declare function updateComment(client: SublayHttpClient, data: UpdateCommentProps): Promise<Comment>;
1922
+
1923
+ interface DeleteCommentProps {
1924
+ commentId: string;
1925
+ }
1926
+ declare function deleteComment(client: SublayHttpClient, data: DeleteCommentProps): Promise<void>;
1927
+
1928
+ interface FetchManyCommentsProps extends SpaceReputationContextParams {
1929
+ entityId?: string;
1930
+ userId?: string;
1931
+ parentId?: string;
1932
+ page?: number;
1933
+ limit?: number;
1934
+ sortBy?: "createdAt" | "top" | "controversial"
1935
+ /** @deprecated Use "createdAt" instead. "new" is a directional alias for
1936
+ * createdAt DESC, removed in v8; the server still accepts it (identical
1937
+ * behavior) but responds with deprecation headers. */
1938
+ | "new"
1939
+ /** @deprecated Use "createdAt" with sortDir:"asc" instead. "old" is a
1940
+ * directional alias for createdAt ASC, removed in v8; the server still
1941
+ * accepts it (identical behavior) but responds with deprecation headers. */
1942
+ | "old";
1943
+ /** Sort direction for `sortBy: "createdAt"`. Defaults to "desc". */
1944
+ sortDir?: "asc" | "desc";
1945
+ include?: string;
1946
+ sourceId?: string;
1947
+ blockedFilter?: "exclude" | "include-outbound-blocked";
1948
+ }
1949
+ declare function fetchManyComments(client: SublayHttpClient, data: FetchManyCommentsProps): Promise<PaginatedResponse<Comment>>;
1950
+
1951
+ interface AddCommentReactionProps {
1952
+ commentId: string;
1953
+ reactionType: ReactionType;
1954
+ }
1955
+ declare function addReaction(client: SublayHttpClient, data: AddCommentReactionProps): Promise<Comment>;
1956
+
1957
+ interface RemoveCommentReactionProps {
1958
+ commentId: string;
1959
+ }
1960
+ declare function removeReaction(client: SublayHttpClient, data: RemoveCommentReactionProps): Promise<Comment>;
1961
+
1962
+ interface FetchCommentReactionsProps extends SpaceReputationContextParams {
1963
+ commentId: string;
1964
+ reactionType?: ReactionType;
1965
+ page?: number;
1966
+ limit?: number;
1967
+ sortDir?: "asc" | "desc";
1968
+ }
1969
+ interface FetchCommentReactionsResponse {
1970
+ data: Reaction[];
1971
+ pagination: PaginationMetadata;
1972
+ }
1973
+ declare function fetchReactions(client: SublayHttpClient, data: FetchCommentReactionsProps): Promise<FetchCommentReactionsResponse>;
1974
+
1975
+ interface GetUserCommentReactionProps {
1976
+ commentId: string;
1977
+ }
1978
+ interface UserCommentReactionResponse {
1979
+ reactionType: ReactionType | null;
1980
+ }
1981
+ declare function getUserReaction(client: SublayHttpClient, data: GetUserCommentReactionProps): Promise<UserCommentReactionResponse>;
1982
+
1983
+ declare const Comments_addReaction: typeof addReaction;
1984
+ declare const Comments_createComment: typeof createComment;
1985
+ declare const Comments_deleteComment: typeof deleteComment;
1986
+ declare const Comments_fetchComment: typeof fetchComment;
1987
+ declare const Comments_fetchCommentByForeignId: typeof fetchCommentByForeignId;
1988
+ declare const Comments_fetchManyComments: typeof fetchManyComments;
1989
+ declare const Comments_fetchReactions: typeof fetchReactions;
1990
+ declare const Comments_getUserReaction: typeof getUserReaction;
1991
+ declare const Comments_removeReaction: typeof removeReaction;
1992
+ declare const Comments_updateComment: typeof updateComment;
1993
+ declare namespace Comments {
1994
+ export { Comments_addReaction as addReaction, Comments_createComment as createComment, Comments_deleteComment as deleteComment, Comments_fetchComment as fetchComment, Comments_fetchCommentByForeignId as fetchCommentByForeignId, Comments_fetchManyComments as fetchManyComments, Comments_fetchReactions as fetchReactions, Comments_getUserReaction as getUserReaction, Comments_removeReaction as removeReaction, Comments_updateComment as updateComment };
1995
+ }
1996
+
1997
+ /** A file plus the image-processing options the server requires alongside it. */
1998
+ interface SpaceImageUpload {
1999
+ file: Blob | File;
2000
+ /** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
2001
+ options: ImageOptions;
2002
+ }
2003
+ interface CreateSpaceProps {
2004
+ name: string;
2005
+ slug?: string;
2006
+ description?: string;
2007
+ readingPermission?: ReadingPermission;
2008
+ postingPermission?: PostingPermission;
2009
+ visibility?: SpaceVisibility;
2010
+ requireJoinApproval?: boolean;
2011
+ parentSpaceId?: string;
2012
+ metadata?: Record<string, any>;
2013
+ nsfw?: boolean;
2014
+ /**
2015
+ * Avatar image. When present the request is sent as `multipart/form-data` and
2016
+ * the server processes the image per `options`.
2017
+ */
2018
+ avatarFile?: SpaceImageUpload;
2019
+ /** Banner image; same contract as {@link CreateSpaceProps.avatarFile}. */
2020
+ bannerFile?: SpaceImageUpload;
2021
+ }
2022
+ declare function createSpace(client: SublayHttpClient, data: CreateSpaceProps): Promise<Space>;
2023
+
2024
+ interface FetchManySpacesProps {
2025
+ page?: number;
2026
+ limit?: number;
2027
+ sortBy?: "alphabetical" | "newest" | "members";
2028
+ searchSlug?: string;
2029
+ searchName?: string;
2030
+ searchDescription?: string;
2031
+ searchAny?: string;
2032
+ memberOf?: "true";
2033
+ parentSpaceId?: string | "null";
2034
+ nsfwFilter?: "include-all" | "exclude" | "only";
2035
+ include?: string;
2036
+ }
2037
+ declare function fetchManySpaces(client: SublayHttpClient, data: FetchManySpacesProps): Promise<PaginatedResponse<Space>>;
2038
+
2039
+ interface FetchSpaceProps {
2040
+ spaceId: string;
2041
+ }
2042
+ declare function fetchSpace(client: SublayHttpClient, data: FetchSpaceProps): Promise<SpaceDetailed>;
2043
+
2044
+ interface FetchSpaceByShortIdProps {
2045
+ shortId: string;
2046
+ }
2047
+ declare function fetchSpaceByShortId(client: SublayHttpClient, data: FetchSpaceByShortIdProps): Promise<SpaceDetailed>;
2048
+
2049
+ interface FetchSpaceBySlugProps {
2050
+ slug: string;
2051
+ }
2052
+ declare function fetchSpaceBySlug(client: SublayHttpClient, data: FetchSpaceBySlugProps): Promise<SpaceDetailed>;
2053
+
2054
+ interface FetchUserSpacesProps {
2055
+ page?: number;
2056
+ limit?: number;
2057
+ sortBy?: "alphabetical" | "newest" | "members";
2058
+ include?: string;
2059
+ role?: string;
2060
+ all?: "true" | "false";
2061
+ /**
2062
+ * Membership status to list. Defaults to `"active"` (spaces the user is in);
2063
+ * `"pending"` returns join requests awaiting approval, `"banned"` the spaces
2064
+ * they were removed from.
2065
+ */
2066
+ status?: "active" | "pending" | "banned";
2067
+ }
2068
+ declare function fetchUserSpaces(client: SublayHttpClient, data: FetchUserSpacesProps): Promise<UserSpacesResponse>;
2069
+
2070
+ interface FetchMutualSpacesProps {
2071
+ /** The OTHER user — spaces shared with this user are returned. */
2072
+ userId: string;
2073
+ page?: number;
2074
+ limit?: number;
2075
+ include?: string;
2076
+ }
2077
+ declare function fetchMutualSpaces(client: SublayHttpClient, { userId, ...params }: FetchMutualSpacesProps): Promise<PaginatedResponse<Space>>;
2078
+
2079
+ interface CheckSlugAvailabilityProps {
2080
+ slug: string;
2081
+ }
2082
+ interface CheckSlugAvailabilityResponse {
2083
+ available: boolean;
2084
+ }
2085
+ declare function checkSlugAvailability(client: SublayHttpClient, data: CheckSlugAvailabilityProps): Promise<CheckSlugAvailabilityResponse>;
2086
+
2087
+ interface UpdateSpaceProps {
2088
+ spaceId: string;
2089
+ name?: string;
2090
+ slug?: string;
2091
+ description?: string;
2092
+ readingPermission?: ReadingPermission;
2093
+ postingPermission?: PostingPermission;
2094
+ visibility?: SpaceVisibility;
2095
+ metadata?: Record<string, any>;
2096
+ nsfw?: boolean;
2097
+ /**
2098
+ * New avatar image. When present the request is sent as `multipart/form-data`
2099
+ * and the server processes the image per `options`, replacing the old avatar.
2100
+ */
2101
+ avatarFile?: SpaceImageUpload;
2102
+ /** New banner image; same contract as {@link UpdateSpaceProps.avatarFile}. */
2103
+ bannerFile?: SpaceImageUpload;
2104
+ }
2105
+ declare function updateSpace(client: SublayHttpClient, data: UpdateSpaceProps): Promise<Space>;
2106
+
2107
+ interface DeleteSpaceProps {
2108
+ spaceId: string;
2109
+ }
2110
+ declare function deleteSpace(client: SublayHttpClient, data: DeleteSpaceProps): Promise<DeleteSpaceResponse>;
2111
+
2112
+ interface FetchChildSpacesProps {
2113
+ spaceId: string;
2114
+ page?: number;
2115
+ limit?: number;
2116
+ sortBy?: "alphabetical" | "newest" | "members";
2117
+ include?: string;
2118
+ }
2119
+ declare function fetchChildSpaces(client: SublayHttpClient, data: FetchChildSpacesProps): Promise<PaginatedResponse<Space>>;
2120
+
2121
+ interface FetchSpaceBreadcrumbProps {
2122
+ spaceId: string;
2123
+ }
2124
+ declare function fetchSpaceBreadcrumb(client: SublayHttpClient, data: FetchSpaceBreadcrumbProps): Promise<SpaceBreadcrumb>;
2125
+
2126
+ interface JoinSpaceProps {
2127
+ spaceId: string;
2128
+ }
2129
+ declare function joinSpace(client: SublayHttpClient, data: JoinSpaceProps): Promise<JoinSpaceResponse>;
2130
+
2131
+ interface LeaveSpaceProps {
2132
+ spaceId: string;
2133
+ }
2134
+ declare function leaveSpace(client: SublayHttpClient, data: LeaveSpaceProps): Promise<LeaveSpaceResponse>;
2135
+
2136
+ interface CheckMyMembershipProps {
2137
+ spaceId: string;
2138
+ }
2139
+ declare function checkMyMembership(client: SublayHttpClient, data: CheckMyMembershipProps): Promise<CheckMyMembershipResponse>;
2140
+
2141
+ interface SpaceMemberWithUser {
2142
+ membershipId: string;
2143
+ role: SpaceMemberRole;
2144
+ status: SpaceMemberStatus;
2145
+ joinedAt: string;
2146
+ user: {
2147
+ id: string;
2148
+ username: string;
2149
+ displayName: string;
2150
+ avatar: string;
2151
+ metadata: object;
2152
+ };
2153
+ }
2154
+ type SpaceMembersResponse = PaginatedResponse<SpaceMemberWithUser>;
2155
+ interface SpaceTeamResponse {
2156
+ data: SpaceMemberWithUser[];
2157
+ }
2158
+
2159
+ interface FetchSpaceMembersProps extends SpaceReputationContextParams {
2160
+ spaceId: string;
2161
+ page?: number;
2162
+ limit?: number;
2163
+ role?: "admin" | "moderator" | "member";
2164
+ status?: "pending" | "active" | "banned" | "rejected";
2165
+ }
2166
+ declare function fetchSpaceMembers(client: SublayHttpClient, data: FetchSpaceMembersProps): Promise<SpaceMembersResponse>;
2167
+
2168
+ interface FetchSpaceTeamProps extends SpaceReputationContextParams {
2169
+ spaceId: string;
2170
+ }
2171
+ declare function fetchSpaceTeam(client: SublayHttpClient, data: FetchSpaceTeamProps): Promise<SpaceTeamResponse>;
2172
+
2173
+ interface UpdateMemberRoleProps {
2174
+ spaceId: string;
2175
+ memberId: string;
2176
+ role: SpaceMemberRole;
2177
+ }
2178
+ declare function updateMemberRole(client: SublayHttpClient, data: UpdateMemberRoleProps): Promise<UpdateMemberRoleResponse>;
2179
+
2180
+ interface ApproveMembershipProps {
2181
+ spaceId: string;
2182
+ memberId: string;
2183
+ }
2184
+ declare function approveMembership(client: SublayHttpClient, data: ApproveMembershipProps): Promise<ApproveMemberResponse>;
2185
+
2186
+ interface DeclineMembershipProps {
2187
+ spaceId: string;
2188
+ memberId: string;
2189
+ }
2190
+ declare function declineMembership(client: SublayHttpClient, data: DeclineMembershipProps): Promise<DeclineMemberResponse>;
2191
+
2192
+ interface BanMemberProps {
2193
+ spaceId: string;
2194
+ memberId: string;
2195
+ }
2196
+ interface BanMemberResponse {
2197
+ message: string;
2198
+ membership: {
2199
+ id: string;
2200
+ status: "banned";
2201
+ };
2202
+ }
2203
+ declare function banMember(client: SublayHttpClient, data: BanMemberProps): Promise<BanMemberResponse>;
2204
+
2205
+ interface UnbanMemberProps {
2206
+ spaceId: string;
2207
+ memberId: string;
2208
+ }
2209
+ interface UnbanMemberResponse {
2210
+ message: string;
2211
+ membership: {
2212
+ id: string;
2213
+ status: "active";
2214
+ };
2215
+ }
2216
+ declare function unbanMember(client: SublayHttpClient, data: UnbanMemberProps): Promise<UnbanMemberResponse>;
2217
+
2218
+ interface Rule {
2219
+ id: string;
2220
+ projectId: string;
2221
+ spaceId: string;
2222
+ title: string;
2223
+ description: string | null;
2224
+ order: number;
2225
+ lastApprovedBy: string | null;
2226
+ createdAt: string;
2227
+ updatedAt: string;
2228
+ }
2229
+ interface FetchManyRulesResponse {
2230
+ data: Rule[];
2231
+ count: number;
2232
+ }
2233
+ interface DeleteRuleResponse {
2234
+ message: string;
2235
+ deletedRule: {
2236
+ id: string;
2237
+ title: string;
2238
+ };
2239
+ }
2240
+
2241
+ interface FetchManyRulesProps {
2242
+ spaceId: string;
2243
+ }
2244
+ declare function fetchManyRules(client: SublayHttpClient, data: FetchManyRulesProps): Promise<FetchManyRulesResponse>;
2245
+
2246
+ interface FetchRuleProps {
2247
+ spaceId: string;
2248
+ ruleId: string;
2249
+ }
2250
+ declare function fetchRule(client: SublayHttpClient, data: FetchRuleProps): Promise<Rule>;
2251
+
2252
+ interface CreateRuleProps {
2253
+ spaceId: string;
2254
+ title: string;
2255
+ description?: string;
2256
+ }
2257
+ declare function createRule(client: SublayHttpClient, data: CreateRuleProps): Promise<Rule>;
2258
+
2259
+ interface UpdateRuleProps {
2260
+ spaceId: string;
2261
+ ruleId: string;
2262
+ title?: string;
2263
+ description?: string;
2264
+ }
2265
+ declare function updateRule(client: SublayHttpClient, data: UpdateRuleProps): Promise<Rule>;
2266
+
2267
+ interface DeleteRuleProps {
2268
+ spaceId: string;
2269
+ ruleId: string;
2270
+ }
2271
+ declare function deleteRule(client: SublayHttpClient, data: DeleteRuleProps): Promise<DeleteRuleResponse>;
2272
+
2273
+ interface ReorderRulesProps {
2274
+ spaceId: string;
2275
+ ruleIds: string[];
2276
+ }
2277
+ declare function reorderRules(client: SublayHttpClient, data: ReorderRulesProps): Promise<Rule[]>;
2278
+
2279
+ type EntityReportAction = "remove-entity" | "ban-user" | "dismiss";
2280
+ interface HandleEntityReportProps {
2281
+ spaceId: string;
2282
+ reportId: string;
2283
+ entityId: string;
2284
+ actions: EntityReportAction[];
2285
+ summary?: string;
2286
+ reason?: string;
2287
+ /** The user to ban (target), required when actions include "ban-user". */
2288
+ userId?: string;
2289
+ }
2290
+ interface HandleReportResponse {
2291
+ message: string;
2292
+ code: string;
2293
+ }
2294
+ declare function handleEntityReport(client: SublayHttpClient, data: HandleEntityReportProps): Promise<HandleReportResponse>;
2295
+
2296
+ type CommentReportAction = "remove-comment" | "ban-user" | "dismiss";
2297
+ interface HandleCommentReportProps {
2298
+ spaceId: string;
2299
+ reportId: string;
2300
+ commentId: string;
2301
+ actions: CommentReportAction[];
2302
+ summary?: string;
2303
+ reason?: string;
2304
+ /** The user to ban (target), required when actions include "ban-user". */
2305
+ userId?: string;
2306
+ }
2307
+ declare function handleCommentReport(client: SublayHttpClient, data: HandleCommentReportProps): Promise<HandleReportResponse>;
2308
+
2309
+ interface ModerateSpaceEntityProps {
2310
+ spaceId: string;
2311
+ entityId: string;
2312
+ action: "approve" | "remove";
2313
+ reason?: string;
2314
+ }
2315
+ interface ModerationResponse {
2316
+ message: string;
2317
+ moderationStatus: "approved" | "removed";
2318
+ }
2319
+ declare function moderateSpaceEntity(client: SublayHttpClient, data: ModerateSpaceEntityProps): Promise<ModerationResponse>;
2320
+
2321
+ interface SetSpaceEntityNsfwProps {
2322
+ spaceId: string;
2323
+ entityId: string;
2324
+ nsfw: boolean;
2325
+ }
2326
+ interface SetSpaceEntityNsfwResponse {
2327
+ message: string;
2328
+ nsfw: boolean;
2329
+ }
2330
+ /**
2331
+ * Space-moderator endpoint to set the NSFW flag on an entity within their space
2332
+ * (including other users' entities). Near-copy of `moderateSpaceEntity`, but it
2333
+ * writes the entity's own `nsfw` (the NSFW axis), not `moderationStatus`.
2334
+ */
2335
+ declare function setSpaceEntityNsfw(client: SublayHttpClient, data: SetSpaceEntityNsfwProps): Promise<SetSpaceEntityNsfwResponse>;
2336
+
2337
+ interface ModerateSpaceCommentProps {
2338
+ spaceId: string;
2339
+ commentId: string;
2340
+ action: "approve" | "remove";
2341
+ reason?: string;
2342
+ }
2343
+ declare function moderateSpaceComment(client: SublayHttpClient, data: ModerateSpaceCommentProps): Promise<ModerationResponse>;
2344
+
2345
+ interface ChatMessage {
2346
+ id: string;
2347
+ projectId: string;
2348
+ conversationId: string;
2349
+ userId: string | null;
2350
+ content: string | null;
2351
+ gif: GifData | null;
2352
+ mentions: Mention[];
2353
+ files?: File$1[];
2354
+ metadata: Record<string, any>;
2355
+ parentMessageId: string | null;
2356
+ quotedMessageId: string | null;
2357
+ threadReplyCount: number;
2358
+ reactionCounts: Record<string, number>;
2359
+ userReactions: string[];
2360
+ /**
2361
+ * Reputation-grant summary. Opt-in — present exactly when the read requested
2362
+ * `include=grants`. Once requested the server always returns the object,
2363
+ * zero-filled rather than omitted, on projects with no grants and on projects
2364
+ * without the reputation bundle alike.
2365
+ */
2366
+ grants?: GrantSummary;
2367
+ editedAt: string | null;
2368
+ userDeletedAt: string | null;
2369
+ moderationStatus: "approved" | "removed" | null;
2370
+ moderatedAt: string | null;
2371
+ moderatedById: string | null;
2372
+ moderatedByType: "client" | "user" | null;
2373
+ moderationReason: string | null;
2374
+ createdAt: string;
2375
+ updatedAt: string;
2376
+ user: User | null;
2377
+ quotedMessage?: ChatMessage | null;
2378
+ parentMessage?: ChatMessage | null;
2379
+ }
2380
+
2381
+ type ConversationMemberRole = "admin" | "member";
2382
+ interface ConversationMember {
2383
+ id: string;
2384
+ projectId: string;
2385
+ conversationId: string;
2386
+ userId: string;
2387
+ role: ConversationMemberRole | null;
2388
+ lastReadAt: string | null;
2389
+ mutedUntil?: string | null;
2390
+ mutedForever?: boolean;
2391
+ isActive: boolean;
2392
+ leftAt: string | null;
2393
+ createdAt: string;
2394
+ updatedAt: string;
2395
+ user?: User;
2396
+ }
2397
+
2398
+ interface Conversation {
2399
+ id: string;
2400
+ projectId: string;
2401
+ type: "direct" | "group" | "space";
2402
+ name: string | null;
2403
+ description: string | null;
2404
+ spaceId: string | null;
2405
+ createdById: string | null;
2406
+ avatarFileId: string | null;
2407
+ lastMessageAt: string | null;
2408
+ postingPermission: "members" | "admins" | null;
2409
+ metadata: Record<string, any>;
2410
+ createdAt: string;
2411
+ updatedAt: string;
2412
+ memberCount?: number;
2413
+ currentMember?: ConversationMember;
2414
+ avatarFile?: File$1;
2415
+ }
2416
+ interface ConversationPreview extends Conversation {
2417
+ unreadCount: number;
2418
+ lastMessage: ChatMessage | null;
2419
+ otherMembers?: Pick<User, "id" | "name" | "username" | "avatar">[];
2420
+ }
2421
+
2422
+ interface GetSpaceConversationProps {
2423
+ spaceId: string;
2424
+ }
2425
+ declare function getSpaceConversation(client: SublayHttpClient, data: GetSpaceConversationProps): Promise<Conversation>;
2426
+
2427
+ interface ModerateSpaceChatMessageProps {
2428
+ spaceId: string;
2429
+ messageId: string;
2430
+ moderationStatus: "removed";
2431
+ moderationReason?: string;
2432
+ }
2433
+ interface ModerateSpaceChatMessageResponse {
2434
+ message: string;
2435
+ moderationStatus: string;
2436
+ }
2437
+ declare function moderateSpaceChatMessage(client: SublayHttpClient, data: ModerateSpaceChatMessageProps): Promise<ModerateSpaceChatMessageResponse>;
2438
+
2439
+ type SpaceChatReportAction = "remove-message" | "ban-user" | "dismiss";
2440
+ interface HandleSpaceChatReportProps {
2441
+ spaceId: string;
2442
+ reportId: string;
2443
+ actions: SpaceChatReportAction[];
2444
+ summary?: string;
2445
+ /** The user to ban (target), required when actions include "ban-user". */
2446
+ userId?: string;
2447
+ reason?: string;
2448
+ /** The message to remove, required when actions include "remove-message". */
2449
+ messageId?: string;
2450
+ }
2451
+ interface HandleSpaceChatReportResponse {
2452
+ message: string;
2453
+ code: string;
2454
+ }
2455
+ declare function handleSpaceChatReport(client: SublayHttpClient, data: HandleSpaceChatReportProps): Promise<HandleSpaceChatReportResponse>;
2456
+
2457
+ declare const Spaces_approveMembership: typeof approveMembership;
2458
+ declare const Spaces_banMember: typeof banMember;
2459
+ declare const Spaces_checkMyMembership: typeof checkMyMembership;
2460
+ declare const Spaces_checkSlugAvailability: typeof checkSlugAvailability;
2461
+ declare const Spaces_createRule: typeof createRule;
2462
+ declare const Spaces_createSpace: typeof createSpace;
2463
+ declare const Spaces_declineMembership: typeof declineMembership;
2464
+ declare const Spaces_deleteRule: typeof deleteRule;
2465
+ declare const Spaces_deleteSpace: typeof deleteSpace;
2466
+ declare const Spaces_fetchChildSpaces: typeof fetchChildSpaces;
2467
+ declare const Spaces_fetchManyRules: typeof fetchManyRules;
2468
+ declare const Spaces_fetchManySpaces: typeof fetchManySpaces;
2469
+ declare const Spaces_fetchMutualSpaces: typeof fetchMutualSpaces;
2470
+ declare const Spaces_fetchRule: typeof fetchRule;
2471
+ declare const Spaces_fetchSpace: typeof fetchSpace;
2472
+ declare const Spaces_fetchSpaceBreadcrumb: typeof fetchSpaceBreadcrumb;
2473
+ declare const Spaces_fetchSpaceByShortId: typeof fetchSpaceByShortId;
2474
+ declare const Spaces_fetchSpaceBySlug: typeof fetchSpaceBySlug;
2475
+ declare const Spaces_fetchSpaceMembers: typeof fetchSpaceMembers;
2476
+ declare const Spaces_fetchSpaceTeam: typeof fetchSpaceTeam;
2477
+ declare const Spaces_fetchUserSpaces: typeof fetchUserSpaces;
2478
+ declare const Spaces_getSpaceConversation: typeof getSpaceConversation;
2479
+ declare const Spaces_handleCommentReport: typeof handleCommentReport;
2480
+ declare const Spaces_handleEntityReport: typeof handleEntityReport;
2481
+ declare const Spaces_handleSpaceChatReport: typeof handleSpaceChatReport;
2482
+ declare const Spaces_joinSpace: typeof joinSpace;
2483
+ declare const Spaces_leaveSpace: typeof leaveSpace;
2484
+ declare const Spaces_moderateSpaceChatMessage: typeof moderateSpaceChatMessage;
2485
+ declare const Spaces_moderateSpaceComment: typeof moderateSpaceComment;
2486
+ declare const Spaces_moderateSpaceEntity: typeof moderateSpaceEntity;
2487
+ declare const Spaces_reorderRules: typeof reorderRules;
2488
+ declare const Spaces_setSpaceEntityNsfw: typeof setSpaceEntityNsfw;
2489
+ declare const Spaces_unbanMember: typeof unbanMember;
2490
+ declare const Spaces_updateMemberRole: typeof updateMemberRole;
2491
+ declare const Spaces_updateRule: typeof updateRule;
2492
+ declare const Spaces_updateSpace: typeof updateSpace;
2493
+ declare namespace Spaces {
2494
+ export { Spaces_approveMembership as approveMembership, Spaces_banMember as banMember, Spaces_checkMyMembership as checkMyMembership, Spaces_checkSlugAvailability as checkSlugAvailability, Spaces_createRule as createRule, Spaces_createSpace as createSpace, Spaces_declineMembership as declineMembership, Spaces_deleteRule as deleteRule, Spaces_deleteSpace as deleteSpace, Spaces_fetchChildSpaces as fetchChildSpaces, Spaces_fetchManyRules as fetchManyRules, Spaces_fetchManySpaces as fetchManySpaces, Spaces_fetchMutualSpaces as fetchMutualSpaces, Spaces_fetchRule as fetchRule, Spaces_fetchSpace as fetchSpace, Spaces_fetchSpaceBreadcrumb as fetchSpaceBreadcrumb, Spaces_fetchSpaceByShortId as fetchSpaceByShortId, Spaces_fetchSpaceBySlug as fetchSpaceBySlug, Spaces_fetchSpaceMembers as fetchSpaceMembers, Spaces_fetchSpaceTeam as fetchSpaceTeam, Spaces_fetchUserSpaces as fetchUserSpaces, Spaces_getSpaceConversation as getSpaceConversation, Spaces_handleCommentReport as handleCommentReport, Spaces_handleEntityReport as handleEntityReport, Spaces_handleSpaceChatReport as handleSpaceChatReport, Spaces_joinSpace as joinSpace, Spaces_leaveSpace as leaveSpace, Spaces_moderateSpaceChatMessage as moderateSpaceChatMessage, Spaces_moderateSpaceComment as moderateSpaceComment, Spaces_moderateSpaceEntity as moderateSpaceEntity, Spaces_reorderRules as reorderRules, Spaces_setSpaceEntityNsfw as setSpaceEntityNsfw, Spaces_unbanMember as unbanMember, Spaces_updateMemberRole as updateMemberRole, Spaces_updateRule as updateRule, Spaces_updateSpace as updateSpace };
2495
+ }
2496
+
2497
+ interface Collection {
2498
+ id: string;
2499
+ projectId: string;
2500
+ userId: string;
2501
+ parentId: string | null;
2502
+ name: string;
2503
+ entityCount: number;
2504
+ createdAt: string;
2505
+ updatedAt: string;
2506
+ }
2507
+
2508
+ declare function fetchRootCollection(client: SublayHttpClient): Promise<Collection>;
2509
+
2510
+ interface FetchSubCollectionsProps {
2511
+ collectionId: string;
2512
+ }
2513
+ declare function fetchSubCollections(client: SublayHttpClient, data: FetchSubCollectionsProps): Promise<Collection[]>;
2514
+
2515
+ interface CreateNewCollectionProps {
2516
+ /** The parent collection under which to create the sub-collection. */
2517
+ collectionId: string;
2518
+ collectionName: string;
2519
+ }
2520
+ declare function createNewCollection(client: SublayHttpClient, data: CreateNewCollectionProps): Promise<Collection>;
2521
+
2522
+ interface FetchCollectionEntitiesProps {
2523
+ collectionId: string;
2524
+ page?: number;
2525
+ limit?: number;
2526
+ sortBy?: "new" | "added" | "top" | "hot";
2527
+ sortDir?: "asc" | "desc";
2528
+ /** Comma-separated list of associations to populate, e.g. "user". */
2529
+ include?: string;
2530
+ }
2531
+ declare function fetchCollectionEntities(client: SublayHttpClient, data: FetchCollectionEntitiesProps): Promise<PaginatedResponse<Entity>>;
2532
+
2533
+ interface AddEntityToCollectionProps {
2534
+ collectionId: string;
2535
+ entityId: string;
2536
+ }
2537
+ interface CollectionEntityMutationResponse {
2538
+ success: boolean;
2539
+ collection: {
2540
+ id: string;
2541
+ entityCount: number;
2542
+ };
2543
+ }
2544
+ declare function addEntityToCollection(client: SublayHttpClient, data: AddEntityToCollectionProps): Promise<CollectionEntityMutationResponse>;
2545
+
2546
+ interface RemoveEntityFromCollectionProps {
2547
+ collectionId: string;
2548
+ entityId: string;
2549
+ }
2550
+ declare function removeEntityFromCollection(client: SublayHttpClient, data: RemoveEntityFromCollectionProps): Promise<CollectionEntityMutationResponse>;
2551
+
2552
+ interface UpdateCollectionProps {
2553
+ collectionId: string;
2554
+ name: string;
2555
+ }
2556
+ declare function updateCollection(client: SublayHttpClient, data: UpdateCollectionProps): Promise<Collection>;
2557
+
2558
+ interface DeleteCollectionProps {
2559
+ collectionId: string;
2560
+ }
2561
+ declare function deleteCollection(client: SublayHttpClient, data: DeleteCollectionProps): Promise<void>;
2562
+
2563
+ declare const Collections_addEntityToCollection: typeof addEntityToCollection;
2564
+ declare const Collections_createNewCollection: typeof createNewCollection;
2565
+ declare const Collections_deleteCollection: typeof deleteCollection;
2566
+ declare const Collections_fetchCollectionEntities: typeof fetchCollectionEntities;
2567
+ declare const Collections_fetchRootCollection: typeof fetchRootCollection;
2568
+ declare const Collections_fetchSubCollections: typeof fetchSubCollections;
2569
+ declare const Collections_removeEntityFromCollection: typeof removeEntityFromCollection;
2570
+ declare const Collections_updateCollection: typeof updateCollection;
2571
+ declare namespace Collections {
2572
+ export { Collections_addEntityToCollection as addEntityToCollection, Collections_createNewCollection as createNewCollection, Collections_deleteCollection as deleteCollection, Collections_fetchCollectionEntities as fetchCollectionEntities, Collections_fetchRootCollection as fetchRootCollection, Collections_fetchSubCollections as fetchSubCollections, Collections_removeEntityFromCollection as removeEntityFromCollection, Collections_updateCollection as updateCollection };
2573
+ }
2574
+
2575
+ interface FetchFollowingProps extends UserSearchParams {
2576
+ page?: number;
2577
+ limit?: number;
2578
+ }
2579
+ declare function fetchFollowing(client: SublayHttpClient, data: FetchFollowingProps): Promise<PaginatedResponse<FollowListItem>>;
2580
+
2581
+ interface FetchFollowersProps extends UserSearchParams {
2582
+ page?: number;
2583
+ limit?: number;
2584
+ }
2585
+ declare function fetchFollowers(client: SublayHttpClient, data: FetchFollowersProps): Promise<PaginatedResponse<FollowListItem>>;
2586
+
2587
+ interface FollowingCountResponse {
2588
+ count: number;
2589
+ }
2590
+ declare function fetchFollowingCount(client: SublayHttpClient): Promise<FollowingCountResponse>;
2591
+
2592
+ interface FollowersCountResponse {
2593
+ count: number;
2594
+ }
2595
+ declare function fetchFollowersCount(client: SublayHttpClient): Promise<FollowersCountResponse>;
2596
+
2597
+ interface DeleteFollowByIdProps {
2598
+ followId: string;
2599
+ }
2600
+ declare function deleteFollow(client: SublayHttpClient, data: DeleteFollowByIdProps): Promise<void>;
2601
+
2602
+ declare const Follows_deleteFollow: typeof deleteFollow;
2603
+ declare const Follows_fetchFollowers: typeof fetchFollowers;
2604
+ declare const Follows_fetchFollowersCount: typeof fetchFollowersCount;
2605
+ declare const Follows_fetchFollowing: typeof fetchFollowing;
2606
+ declare const Follows_fetchFollowingCount: typeof fetchFollowingCount;
2607
+ declare namespace Follows {
2608
+ export { Follows_deleteFollow as deleteFollow, Follows_fetchFollowers as fetchFollowers, Follows_fetchFollowersCount as fetchFollowersCount, Follows_fetchFollowing as fetchFollowing, Follows_fetchFollowingCount as fetchFollowingCount };
2609
+ }
2610
+
2611
+ interface FetchConnectionsProps extends UserSearchParams {
2612
+ page?: number;
2613
+ limit?: number;
2614
+ }
2615
+ declare function fetchConnections(client: SublayHttpClient, data: FetchConnectionsProps): Promise<PaginatedResponse<EstablishedConnection>>;
2616
+
2617
+ declare function fetchConnectionsCount(client: SublayHttpClient): Promise<ConnectionCountResponse>;
2618
+
2619
+ interface FetchSentPendingConnectionsProps {
2620
+ page?: number;
2621
+ limit?: number;
2622
+ }
2623
+ declare function fetchSentPendingConnections(client: SublayHttpClient, data: FetchSentPendingConnectionsProps): Promise<PaginatedResponse<PendingConnection>>;
2624
+
2625
+ interface FetchReceivedPendingConnectionsProps {
2626
+ page?: number;
2627
+ limit?: number;
2628
+ }
2629
+ declare function fetchReceivedPendingConnections(client: SublayHttpClient, data: FetchReceivedPendingConnectionsProps): Promise<PaginatedResponse<PendingConnection>>;
2630
+
2631
+ interface AcceptConnectionProps {
2632
+ connectionId: string;
2633
+ }
2634
+ declare function acceptConnection(client: SublayHttpClient, data: AcceptConnectionProps): Promise<ConnectionActionResponse>;
2635
+
2636
+ interface DeclineConnectionProps {
2637
+ connectionId: string;
2638
+ }
2639
+ declare function declineConnection(client: SublayHttpClient, data: DeclineConnectionProps): Promise<ConnectionActionResponse>;
2640
+
2641
+ interface RemoveConnectionProps {
2642
+ connectionId: string;
2643
+ }
2644
+ declare function removeConnection(client: SublayHttpClient, data: RemoveConnectionProps): Promise<void>;
2645
+
2646
+ declare const Connections_acceptConnection: typeof acceptConnection;
2647
+ declare const Connections_declineConnection: typeof declineConnection;
2648
+ declare const Connections_fetchConnections: typeof fetchConnections;
2649
+ declare const Connections_fetchConnectionsCount: typeof fetchConnectionsCount;
2650
+ declare const Connections_fetchReceivedPendingConnections: typeof fetchReceivedPendingConnections;
2651
+ declare const Connections_fetchSentPendingConnections: typeof fetchSentPendingConnections;
2652
+ declare const Connections_removeConnection: typeof removeConnection;
2653
+ declare namespace Connections {
2654
+ export { Connections_acceptConnection as acceptConnection, Connections_declineConnection as declineConnection, Connections_fetchConnections as fetchConnections, Connections_fetchConnectionsCount as fetchConnectionsCount, Connections_fetchReceivedPendingConnections as fetchReceivedPendingConnections, Connections_fetchSentPendingConnections as fetchSentPendingConnections, Connections_removeConnection as removeConnection };
2655
+ }
2656
+
2657
+ type AppNotificationType = "system" | "entity-comment" | "comment-reply" | "entity-mention" | "comment-mention" | "entity-upvote" | "comment-upvote" | "entity-reaction" | "comment-reaction" | "entity-reaction-milestone-specific" | "entity-reaction-milestone-total" | "comment-reaction-milestone-specific" | "comment-reaction-milestone-total" | "new-follow" | "connection-request" | "connection-accepted" | "space-membership-approved";
2658
+ interface BaseAppNotification {
2659
+ id: string;
2660
+ userId: string;
2661
+ type: AppNotificationType;
2662
+ isRead: boolean;
2663
+ metadata: Record<string, any>;
2664
+ createdAt: string;
2665
+ }
2666
+ interface SystemNotification extends BaseAppNotification {
2667
+ type: "system";
2668
+ action: string;
2669
+ metadata: {
2670
+ title?: string;
2671
+ content?: string;
2672
+ buttonData: {
2673
+ text: string;
2674
+ url: string;
2675
+ } | null;
2676
+ };
2677
+ }
2678
+ interface EntityCommentNotification extends BaseAppNotification {
2679
+ type: "entity-comment";
2680
+ action: "open-comment";
2681
+ metadata: {
2682
+ entityId: string;
2683
+ entityShortId: string;
2684
+ entityTitle: string | null | undefined;
2685
+ entityContent: string | null | undefined;
2686
+ commentId: string;
2687
+ commentContent: string | null | undefined;
2688
+ initiatorId: string;
2689
+ initiatorName: string | null | undefined;
2690
+ initiatorUsername: string | null | undefined;
2691
+ initiatorAvatar: string | null | undefined;
2692
+ };
2693
+ }
2694
+ interface CommentReplyNotification extends BaseAppNotification {
2695
+ type: "comment-reply";
2696
+ action: "open-comment";
2697
+ metadata: {
2698
+ entityId: string;
2699
+ entityShortId: string;
2700
+ entityTitle: string | null | undefined;
2701
+ entityContent: string | null | undefined;
2702
+ commentId: string;
2703
+ commentContent: string | null | undefined;
2704
+ replyId: string;
2705
+ replyContent: string | null | undefined;
2706
+ initiatorId: string;
2707
+ initiatorName: string | null | undefined;
2708
+ initiatorUsername: string | null | undefined;
2709
+ initiatorAvatar: string | null | undefined;
2710
+ };
2711
+ }
2712
+ interface EntityMentionNotification extends BaseAppNotification {
2713
+ type: "entity-mention";
2714
+ action: "open-entity";
2715
+ metadata: {
2716
+ entityId: string;
2717
+ entityShortId: string;
2718
+ entityTitle: string | null | undefined;
2719
+ entityContent: string | null | undefined;
2720
+ initiatorId: string;
2721
+ initiatorName: string | null | undefined;
2722
+ initiatorUsername: string | null | undefined;
2723
+ initiatorAvatar: string | null | undefined;
2724
+ };
2725
+ }
2726
+ interface CommentMentionNotification extends BaseAppNotification {
2727
+ type: "comment-mention";
2728
+ action: "open-comment";
2729
+ metadata: {
2730
+ entityId: string;
2731
+ entityShortId: string;
2732
+ entityTitle: string | null | undefined;
2733
+ entityContent: string | null | undefined;
2734
+ commentId: string;
2735
+ commentContent: string | null | undefined;
2736
+ initiatorId: string;
2737
+ initiatorName: string | null | undefined;
2738
+ initiatorUsername: string | null | undefined;
2739
+ initiatorAvatar: string | null | undefined;
2740
+ };
2741
+ }
2742
+ interface EntityUpvoteNotification extends BaseAppNotification {
2743
+ type: "entity-upvote";
2744
+ action: "open-entity";
2745
+ metadata: {
2746
+ entityId: string;
2747
+ entityShortId: string;
2748
+ entityTitle: string | null | undefined;
2749
+ entityContent: string | null | undefined;
2750
+ initiatorId: string;
2751
+ initiatorName: string | null | undefined;
2752
+ initiatorUsername: string | null | undefined;
2753
+ initiatorAvatar: string | null | undefined;
2754
+ };
2755
+ }
2756
+ interface CommentUpvoteNotification extends BaseAppNotification {
2757
+ type: "comment-upvote";
2758
+ action: "open-comment";
2759
+ metadata: {
2760
+ entityId: string;
2761
+ entityShortId: string;
2762
+ entityTitle: string | null | undefined;
2763
+ entityContent: string | null | undefined;
2764
+ commentId: string;
2765
+ commentContent: string | null | undefined;
2766
+ initiatorId: string;
2767
+ initiatorName: string | null | undefined;
2768
+ initiatorUsername: string | null | undefined;
2769
+ initiatorAvatar: string | null | undefined;
2770
+ };
2771
+ }
2772
+ interface EntityReactionNotification extends BaseAppNotification {
2773
+ type: "entity-reaction";
2774
+ action: "open-entity";
2775
+ metadata: {
2776
+ entityId: string;
2777
+ entityShortId: string;
2778
+ entityTitle: string | null | undefined;
2779
+ entityContent: string | null | undefined;
2780
+ reactionType: string;
2781
+ initiatorId: string;
2782
+ initiatorName: string | null | undefined;
2783
+ initiatorUsername: string | null | undefined;
2784
+ initiatorAvatar: string | null | undefined;
2785
+ };
2786
+ }
2787
+ interface CommentReactionNotification extends BaseAppNotification {
2788
+ type: "comment-reaction";
2789
+ action: "open-comment";
2790
+ metadata: {
2791
+ entityId: string;
2792
+ entityShortId: string;
2793
+ entityTitle: string | null | undefined;
2794
+ entityContent: string | null | undefined;
2795
+ commentId: string;
2796
+ commentContent: string | null | undefined;
2797
+ reactionType: string;
2798
+ initiatorId: string;
2799
+ initiatorName: string | null | undefined;
2800
+ initiatorUsername: string | null | undefined;
2801
+ initiatorAvatar: string | null | undefined;
2802
+ };
2803
+ }
2804
+ interface MilestoneUser {
2805
+ id: string;
2806
+ name: string | null | undefined;
2807
+ username: string | null | undefined;
2808
+ avatar: string | null | undefined;
2809
+ }
2810
+ interface EntityReactionMilestoneSpecificNotification extends BaseAppNotification {
2811
+ type: "entity-reaction-milestone-specific";
2812
+ action: "open-entity";
2813
+ metadata: {
2814
+ entityId: string;
2815
+ entityShortId: string;
2816
+ entityTitle: string | null | undefined;
2817
+ entityContent: string | null | undefined;
2818
+ reactionType: string;
2819
+ milestoneCount: number;
2820
+ lastThreeUsers: MilestoneUser[];
2821
+ };
2822
+ }
2823
+ interface EntityReactionMilestoneTotalNotification extends BaseAppNotification {
2824
+ type: "entity-reaction-milestone-total";
2825
+ action: "open-entity";
2826
+ metadata: {
2827
+ entityId: string;
2828
+ entityShortId: string;
2829
+ entityTitle: string | null | undefined;
2830
+ entityContent: string | null | undefined;
2831
+ milestoneCount: number;
2832
+ reactionCounts: Record<string, number>;
2833
+ lastThreeUsers: MilestoneUser[];
2834
+ };
2835
+ }
2836
+ interface CommentReactionMilestoneSpecificNotification extends BaseAppNotification {
2837
+ type: "comment-reaction-milestone-specific";
2838
+ action: "open-comment";
2839
+ metadata: {
2840
+ entityId: string;
2841
+ entityShortId: string;
2842
+ entityTitle: string | null | undefined;
2843
+ entityContent: string | null | undefined;
2844
+ commentId: string;
2845
+ commentContent: string | null | undefined;
2846
+ reactionType: string;
2847
+ milestoneCount: number;
2848
+ lastThreeUsers: MilestoneUser[];
2849
+ };
2850
+ }
2851
+ interface CommentReactionMilestoneTotalNotification extends BaseAppNotification {
2852
+ type: "comment-reaction-milestone-total";
2853
+ action: "open-comment";
2854
+ metadata: {
2855
+ entityId: string;
2856
+ entityShortId: string;
2857
+ entityTitle: string | null | undefined;
2858
+ entityContent: string | null | undefined;
2859
+ commentId: string;
2860
+ commentContent: string | null | undefined;
2861
+ milestoneCount: number;
2862
+ reactionCounts: Record<string, number>;
2863
+ lastThreeUsers: MilestoneUser[];
2864
+ };
2865
+ }
2866
+ interface SpaceMembershipApprovedNotification extends BaseAppNotification {
2867
+ type: "space-membership-approved";
2868
+ action: "open-space";
2869
+ metadata: {
2870
+ spaceId: string;
2871
+ spaceName: string;
2872
+ spaceShortId: string;
2873
+ spaceSlug: string | null | undefined;
2874
+ spaceAvatar: string | null | undefined;
2875
+ };
2876
+ }
2877
+ interface NewFollowNotification extends BaseAppNotification {
2878
+ type: "new-follow";
2879
+ action: "open-profile";
2880
+ metadata: {
2881
+ initiatorId: string;
2882
+ initiatorName: string | null | undefined;
2883
+ initiatorUsername: string | null | undefined;
2884
+ initiatorAvatar: string | null | undefined;
2885
+ };
2886
+ }
2887
+ interface ConnectionRequestNotification extends BaseAppNotification {
2888
+ type: "connection-request";
2889
+ action: "open-profile";
2890
+ metadata: {
2891
+ connectionId: string;
2892
+ initiatorId: string;
2893
+ initiatorName: string | null | undefined;
2894
+ initiatorUsername: string | null | undefined;
2895
+ initiatorAvatar: string | null | undefined;
2896
+ };
2897
+ }
2898
+ interface ConnectionAcceptedNotification extends BaseAppNotification {
2899
+ type: "connection-accepted";
2900
+ action: "open-profile";
2901
+ metadata: {
2902
+ connectionId: string;
2903
+ initiatorId: string;
2904
+ initiatorName: string | null | undefined;
2905
+ initiatorUsername: string | null | undefined;
2906
+ initiatorAvatar: string | null | undefined;
2907
+ };
2908
+ }
2909
+ type UnifiedAppNotification = SystemNotification | EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | EntityReactionNotification | CommentReactionNotification | EntityReactionMilestoneSpecificNotification | EntityReactionMilestoneTotalNotification | CommentReactionMilestoneSpecificNotification | CommentReactionMilestoneTotalNotification | NewFollowNotification | ConnectionRequestNotification | ConnectionAcceptedNotification | SpaceMembershipApprovedNotification;
2910
+
2911
+ interface FetchNotificationsProps {
2912
+ page?: number;
2913
+ limit?: number;
2914
+ }
2915
+ declare function fetchNotifications(client: SublayHttpClient, data?: FetchNotificationsProps): Promise<PaginatedResponse<UnifiedAppNotification>>;
2916
+
2917
+ declare function countUnreadNotifications(client: SublayHttpClient): Promise<number>;
2918
+
2919
+ interface MarkNotificationAsReadProps {
2920
+ notificationId: string;
2921
+ }
2922
+ declare function markNotificationAsRead(client: SublayHttpClient, data: MarkNotificationAsReadProps): Promise<void>;
2923
+
2924
+ interface MarkAllNotificationsAsReadResponse {
2925
+ markedAsRead: number;
2926
+ }
2927
+ declare function markAllNotificationsAsRead(client: SublayHttpClient): Promise<MarkAllNotificationsAsReadResponse>;
2928
+
2929
+ declare const AppNotifications_countUnreadNotifications: typeof countUnreadNotifications;
2930
+ declare const AppNotifications_fetchNotifications: typeof fetchNotifications;
2931
+ declare const AppNotifications_markAllNotificationsAsRead: typeof markAllNotificationsAsRead;
2932
+ declare const AppNotifications_markNotificationAsRead: typeof markNotificationAsRead;
2933
+ declare namespace AppNotifications {
2934
+ export { AppNotifications_countUnreadNotifications as countUnreadNotifications, AppNotifications_fetchNotifications as fetchNotifications, AppNotifications_markAllNotificationsAsRead as markAllNotificationsAsRead, AppNotifications_markNotificationAsRead as markNotificationAsRead };
2935
+ }
2936
+
2937
+ type ReportTargetType = "entity" | "comment" | "message";
2938
+ /**
2939
+ * The reasons the API accepts on a report. Server-enforced — anything outside
2940
+ * this set is rejected with `report/invalid-body`. Use `other` plus `details`
2941
+ * for anything the taxonomy doesn't cover.
2942
+ */
2943
+ type ReportReason = "spam" | "inappropriateContent" | "harassment" | "misinformation" | "hateSpeech" | "violence" | "illegalActivity" | "selfHarm" | "other";
2944
+ type ReportStatus = "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
2945
+ interface UserReport {
2946
+ id: string;
2947
+ projectId: string;
2948
+ reportId: string;
2949
+ userId: string;
2950
+ reason: string;
2951
+ details: string | null;
2952
+ createdAt: string;
2953
+ }
2954
+ interface Report {
2955
+ id: string;
2956
+ projectId: string;
2957
+ spaceId: string | null;
2958
+ targetId: string;
2959
+ targetType: ReportTargetType;
2960
+ status: ReportStatus;
2961
+ reporterCount: number;
2962
+ createdAt: string;
2963
+ updatedAt: string;
2964
+ userReports?: UserReport[];
2965
+ target?: Entity | Comment | null;
2966
+ space?: Space | null;
2967
+ }
2968
+ interface CreateReportResponse {
2969
+ message: string;
2970
+ code: "report/created" | "report/updated" | "report/already-reported";
2971
+ }
2972
+
2973
+ interface CreateReportProps {
2974
+ targetType: ReportTargetType;
2975
+ targetId: string;
2976
+ reason: ReportReason;
2977
+ details?: string;
2978
+ }
2979
+ declare function createReport(client: SublayHttpClient, data: CreateReportProps): Promise<CreateReportResponse>;
2980
+
2981
+ interface FetchModeratedReportsProps extends SpaceReputationContextParams {
2982
+ spaceId?: string;
2983
+ targetType?: ReportTargetType;
2984
+ status?: ReportStatus;
2985
+ sortBy?: "new" | "old";
2986
+ page?: number;
2987
+ limit?: number;
2988
+ }
2989
+ declare function fetchModeratedReports(client: SublayHttpClient, data: FetchModeratedReportsProps): Promise<PaginatedResponse<Report>>;
2990
+
2991
+ declare const Reports_createReport: typeof createReport;
2992
+ declare const Reports_fetchModeratedReports: typeof fetchModeratedReports;
2993
+ declare namespace Reports {
2994
+ export { Reports_createReport as createReport, Reports_fetchModeratedReports as fetchModeratedReports };
2995
+ }
2996
+
2997
+ interface CreateGrantBaseProps {
2998
+ /** The user receiving the reputation. Cannot be the logged-in user. */
2999
+ recipientId: string;
3000
+ /**
3001
+ * Positive integer. A user transfer can never mint (negatives) nor be a
3002
+ * no-op (zero) — minting is service-key-only and lives in `@sublay/node`.
3003
+ */
3004
+ amount: number;
3005
+ /** The bucket both legs move in. Omitted/null = the project-general bucket. */
3006
+ spaceId?: string | null;
3007
+ /**
3008
+ * Free-text reason. Trimmed and capped at 2000 characters server-side.
3009
+ * Genuinely nullable — an explicit `null` is accepted and means "no note".
3010
+ */
3011
+ note?: string | null;
3012
+ /**
3013
+ * Arbitrary JSON, capped at 1 MB server-side.
3014
+ *
3015
+ * NOT nullable — deliberately asymmetric with `note` directly above, not a
3016
+ * typo. The server's shared `metadataSchema` is `z.record(...).optional()`
3017
+ * with no `.nullable()`, so an explicit `metadata: null` is rejected with
3018
+ * `400 reputation-grant/invalid-body`. Omit the key to mean "no metadata".
3019
+ */
3020
+ metadata?: Record<string, any>;
3021
+ }
3022
+ /**
3023
+ * `targetType` and `targetId` are supplied together or not at all — the
3024
+ * both-or-neither pair is carried by {@link ReputationGrantTargetFilter}, which
3025
+ * makes the half-filled shape a compile error instead of a
3026
+ * `400 reputation-grant/invalid-body`.
3027
+ */
3028
+ type CreateGrantProps = CreateGrantBaseProps & ReputationGrantTargetFilter;
3029
+ /**
3030
+ * Transfers reputation from the logged-in user to another user — a **debited
3031
+ * transfer**: the amount leaves the sender's bucket and lands in the
3032
+ * recipient's bucket in the same space. Nothing is created.
3033
+ *
3034
+ * There is no actor field: the sender is always the user the token belongs to.
3035
+ * Naming somebody else as the sender requires a service key, which this SDK
3036
+ * never holds.
3037
+ */
3038
+ declare function createGrant(client: SublayHttpClient, data: CreateGrantProps): Promise<ReputationGrant>;
3039
+
3040
+ interface ListGrantsBaseProps extends SpaceReputationContextParams {
3041
+ page?: number;
3042
+ limit?: number;
3043
+ /** What this user received. */
3044
+ recipientId?: string;
3045
+ /** What this user sent. */
3046
+ senderId?: string;
3047
+ /** Associations to expand. Only `"user"` is supported (hydrates both parties). */
3048
+ include?: string;
3049
+ }
3050
+ /**
3051
+ * The third filter shape — "who rewarded this item" — is the
3052
+ * {@link ReputationGrantTargetFilter} pair, so a half-filled target is a
3053
+ * compile error rather than a `400 reputation-grant/invalid-filter`.
3054
+ *
3055
+ * Mutual exclusivity between the three shapes is NOT expressed in the type: a
3056
+ * three-way exclusive union would multiply out across every pagination and
3057
+ * space-reputation field and make the props unreadable, for a rule the server
3058
+ * reports clearly. Only the both-or-neither pairing is typed.
3059
+ */
3060
+ type ListGrantsProps = ListGrantsBaseProps & ReputationGrantTargetFilter;
3061
+ /**
3062
+ * The `summary` block rides alongside the page envelope, and only on the
3063
+ * target filter shape.
3064
+ */
3065
+ interface ListGrantsResponse extends PaginatedResponse<ReputationGrant> {
3066
+ summary?: GrantSummary;
3067
+ }
3068
+ /**
3069
+ * Lists reputation grants.
3070
+ *
3071
+ * Exactly one filter shape per request — `recipientId`, `senderId`, or
3072
+ * `targetType` + `targetId`. Supplying none or combining two is a `400`; the
3073
+ * shapes are not AND-ed, which is what keeps the `summary` block reconcilable
3074
+ * with the rows beneath it.
3075
+ *
3076
+ * Only positive grants are ever returned. Negative grants are app moderation
3077
+ * deductions and are unreadable from every public surface.
3078
+ */
3079
+ declare function listGrants(client: SublayHttpClient, data: ListGrantsProps): Promise<ListGrantsResponse>;
3080
+
3081
+ declare const Reputation_createGrant: typeof createGrant;
3082
+ declare const Reputation_listGrants: typeof listGrants;
3083
+ declare namespace Reputation {
3084
+ export { Reputation_createGrant as createGrant, Reputation_listGrants as listGrants };
3085
+ }
3086
+
3087
+ interface SearchContentProps extends SpaceReputationContextParams {
3088
+ query: string;
3089
+ sourceTypes?: ("entity" | "comment" | "message")[];
3090
+ spaceId?: string;
3091
+ /**
3092
+ * With a `spaceId`, also search every space nested under it (children,
3093
+ * grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
3094
+ * Defaults to false (exact-space search).
3095
+ */
3096
+ includeChildSpaces?: boolean;
3097
+ conversationId?: string;
3098
+ limit?: number;
3099
+ }
3100
+ interface ContentSearchResult {
3101
+ sourceType: "entity" | "comment" | "message";
3102
+ similarity: number;
3103
+ record: Entity | Comment | ChatMessage;
3104
+ }
3105
+ declare function searchContent(client: SublayHttpClient, data: SearchContentProps): Promise<ContentSearchResult[]>;
3106
+
3107
+ interface SearchUsersProps {
3108
+ query: string;
3109
+ limit?: number;
3110
+ }
3111
+ interface UserSearchResult {
3112
+ similarity: number;
3113
+ record: User;
3114
+ }
3115
+ declare function searchUsers(client: SublayHttpClient, data: SearchUsersProps): Promise<UserSearchResult[]>;
3116
+
3117
+ interface SearchSpacesProps {
3118
+ query: string;
3119
+ limit?: number;
3120
+ }
3121
+ interface SpaceSearchResult {
3122
+ similarity: number;
3123
+ record: Space;
3124
+ }
3125
+ declare function searchSpaces(client: SublayHttpClient, data: SearchSpacesProps): Promise<SpaceSearchResult[]>;
3126
+
3127
+ interface AskContentProps extends SpaceReputationContextParams {
3128
+ query: string;
3129
+ sourceTypes?: ("entity" | "comment" | "message")[];
3130
+ spaceId?: string;
3131
+ /**
3132
+ * With a `spaceId`, also search every space nested under it (children,
3133
+ * grandchildren — the whole subtree, any depth). Ignored without a `spaceId`.
3134
+ * Defaults to false (exact-space search).
3135
+ */
3136
+ includeChildSpaces?: boolean;
3137
+ conversationId?: string;
3138
+ limit?: number;
3139
+ /** Abort the in-flight stream (e.g. when the user navigates away). */
3140
+ signal?: AbortSignal;
3141
+ }
3142
+ /**
3143
+ * A single Server-Sent Event from the `askContent` stream.
3144
+ * - `token` — an incremental chunk of the answer text.
3145
+ * - `sources` — the hydrated source records, emitted once after the answer.
3146
+ * - `done` — the stream finished successfully.
3147
+ * - `error` — the server reported an error (the stream ends after this).
3148
+ */
3149
+ type AskContentEvent = {
3150
+ type: "token";
3151
+ content: string;
3152
+ } | {
3153
+ type: "sources";
3154
+ sources: ContentSearchResult[];
3155
+ } | {
3156
+ type: "done";
3157
+ } | {
3158
+ type: "error";
3159
+ error: string;
3160
+ };
3161
+ /**
3162
+ * Ask a question over your project's content (semantic RAG). The server answers
3163
+ * by streaming Server-Sent Events, so this is an **async generator**: iterate it
3164
+ * to consume the answer as it arrives.
3165
+ *
3166
+ * ```ts
3167
+ * let answer = "";
3168
+ * for await (const ev of client.search.askContent({ query: "How do refunds work?" })) {
3169
+ * if (ev.type === "token") answer += ev.content;
3170
+ * else if (ev.type === "sources") console.log("sources:", ev.sources);
3171
+ * else if (ev.type === "error") throw new Error(ev.error);
3172
+ * }
3173
+ * ```
3174
+ *
3175
+ * Cancel by passing an `AbortSignal`, or by `break`ing out of the loop.
3176
+ *
3177
+ * Note: this request uses `fetch` (not the axios instance), so it does not get
3178
+ * the automatic 403→refresh retry. The token is read fresh at call time via the
3179
+ * client's active auth mode.
3180
+ */
3181
+ declare function askContent(client: SublayHttpClient, data: AskContentProps): AsyncGenerator<AskContentEvent, void, unknown>;
3182
+
3183
+ interface MatchUsersProps {
3184
+ mode: "passive" | "directed";
3185
+ query?: string;
3186
+ limit?: number;
3187
+ spaceId?: string;
3188
+ includeChildSpaces?: boolean;
3189
+ includeSampleContent?: boolean;
3190
+ excludeSelf?: boolean;
3191
+ }
3192
+ interface MatchFacetRef {
3193
+ id: string;
3194
+ hotness: number;
3195
+ }
3196
+ interface SampleContent {
3197
+ sourceType: "entity" | "comment" | "message";
3198
+ recordId: string;
3199
+ content: string;
3200
+ similarity: number;
3201
+ }
3202
+ interface MatchedFacet {
3203
+ similarity: number;
3204
+ askerFacet?: MatchFacetRef;
3205
+ candidateFacet: MatchFacetRef;
3206
+ sampleContent?: SampleContent[];
3207
+ }
3208
+ interface UserMatchResult {
3209
+ user: User;
3210
+ score: number;
3211
+ matchedFacets: MatchedFacet[];
3212
+ }
3213
+ interface MatchUsersResponse {
3214
+ results: UserMatchResult[];
3215
+ }
3216
+ declare function matchUsers(client: SublayHttpClient, data: MatchUsersProps): Promise<MatchUsersResponse>;
3217
+
3218
+ declare const Search_askContent: typeof askContent;
3219
+ declare const Search_matchUsers: typeof matchUsers;
3220
+ declare const Search_searchContent: typeof searchContent;
3221
+ declare const Search_searchSpaces: typeof searchSpaces;
3222
+ declare const Search_searchUsers: typeof searchUsers;
3223
+ declare namespace Search {
3224
+ export { Search_askContent as askContent, Search_matchUsers as matchUsers, Search_searchContent as searchContent, Search_searchSpaces as searchSpaces, Search_searchUsers as searchUsers };
3225
+ }
3226
+
3227
+ interface UploadedImageVariant {
3228
+ path: string;
3229
+ width: number;
3230
+ height: number;
3231
+ size: number;
3232
+ format: string;
3233
+ publicPath: string;
3234
+ }
3235
+ interface UploadImageResponse {
3236
+ fileId: string;
3237
+ type: "image";
3238
+ originalPath: string;
3239
+ originalSize: number;
3240
+ originalWidth: number;
3241
+ originalHeight: number;
3242
+ variants: Record<string, UploadedImageVariant>;
3243
+ format: string;
3244
+ quality: number;
3245
+ /** ISO-8601 timestamp. */
3246
+ createdAt: string;
3247
+ }
3248
+ interface UploadImageProps {
3249
+ /** The image to upload, as a browser `File` or `Blob`. */
3250
+ file: Blob | File;
3251
+ /** Optional filename for the multipart part (defaults to the `File.name` or `"upload"`). */
3252
+ filename?: string;
3253
+ /**
3254
+ * Image-processing configuration. A discriminated union on `mode` mirroring
3255
+ * the server's `uploadImageBodySchema` — see {@link ImageOptions}.
3256
+ */
3257
+ imageOptions: ImageOptions;
3258
+ /** Storage path segments, e.g. ["spaces", spaceId, "banner"]. */
3259
+ pathParts?: string[];
3260
+ /** Only one of entityId/commentId/spaceId/eventId may be set. */
3261
+ entityId?: string;
3262
+ commentId?: string;
3263
+ spaceId?: string;
3264
+ eventId?: string;
3265
+ }
3266
+ declare function uploadImage(client: SublayHttpClient, data: UploadImageProps): Promise<UploadImageResponse>;
3267
+
3268
+ interface UploadFileResponse {
3269
+ fileId: string;
3270
+ type: string;
3271
+ relativePath: string;
3272
+ publicPath: string;
3273
+ size: number;
3274
+ mimeType: string;
3275
+ /** ISO-8601 timestamp. */
3276
+ createdAt: string;
3277
+ }
3278
+ interface UploadFileProps {
3279
+ /** The file to upload, as a browser `File` or `Blob`. */
3280
+ file: Blob | File;
3281
+ /** Optional filename for the multipart part (defaults to the `File.name` or `"upload"`). */
3282
+ filename?: string;
3283
+ /**
3284
+ * Storage path segments for the file, e.g. ["avatars", userId]. Required by
3285
+ * the server (`uploadFileBodySchema.pathParts`).
3286
+ */
3287
+ pathParts: string[];
3288
+ /** Ordering within the associated entity/comment/space. */
3289
+ position?: number;
3290
+ metadata?: Record<string, any>;
3291
+ /** Only one of entityId/commentId/spaceId may be set. */
3292
+ entityId?: string;
3293
+ commentId?: string;
3294
+ spaceId?: string;
3295
+ }
3296
+ declare function uploadFile(client: SublayHttpClient, data: UploadFileProps): Promise<UploadFileResponse>;
3297
+
3298
+ interface GetFileImage {
3299
+ originalWidth: number;
3300
+ originalHeight: number;
3301
+ variants: Record<string, UploadedImageVariant>;
3302
+ processingStatus: "completed" | "failed";
3303
+ format: string;
3304
+ quality: number;
3305
+ exifStripped: boolean;
3306
+ }
3307
+ /** Shape returned by `GET /storage/:fileId` (a flat projection, not the populated `File` model). */
3308
+ interface GetFileResponse {
3309
+ fileId: string;
3310
+ type: string;
3311
+ originalPath: string;
3312
+ originalSize: number;
3313
+ originalMimeType: string;
3314
+ position: number | null;
3315
+ metadata: Record<string, any> | null;
3316
+ /** ISO-8601 timestamp. */
3317
+ createdAt: string;
3318
+ /** ISO-8601 timestamp. */
3319
+ updatedAt: string;
3320
+ userId?: string;
3321
+ entityId?: string;
3322
+ commentId?: string;
3323
+ spaceId?: string;
3324
+ image?: GetFileImage;
3325
+ }
3326
+ interface GetFileProps {
3327
+ fileId: string;
3328
+ }
3329
+ declare function getFile(client: SublayHttpClient, data: GetFileProps): Promise<GetFileResponse>;
3330
+
3331
+ interface DeleteFileProps {
3332
+ fileId: string;
3333
+ }
3334
+ declare function deleteFile(client: SublayHttpClient, data: DeleteFileProps): Promise<void>;
3335
+
3336
+ declare const Storage_deleteFile: typeof deleteFile;
3337
+ declare const Storage_getFile: typeof getFile;
3338
+ declare const Storage_uploadFile: typeof uploadFile;
3339
+ declare const Storage_uploadImage: typeof uploadImage;
3340
+ declare namespace Storage {
3341
+ export { Storage_deleteFile as deleteFile, Storage_getFile as getFile, Storage_uploadFile as uploadFile, Storage_uploadImage as uploadImage };
3342
+ }
3343
+
3344
+ /** Providers the server supports (mirrors the server's `oauthProviderSchema`). */
3345
+ type OAuthProvider = "google" | "github" | "apple" | "facebook";
3346
+ interface AuthorizeProps {
3347
+ provider: OAuthProvider;
3348
+ /**
3349
+ * Where the server should send the browser back to once auth completes. Must
3350
+ * be one of the project's allowed redirect URIs (configured in the dashboard).
3351
+ */
3352
+ redirectAfterAuth: string;
3353
+ }
3354
+ interface AuthorizeResponse {
3355
+ /**
3356
+ * The provider's authorization URL. The host app redirects the browser here;
3357
+ * the provider then bounces to the server's `/oauth/callback`, which finishes
3358
+ * auth and redirects back to `redirectAfterAuth` with the session.
3359
+ */
3360
+ authorizationUrl: string;
3361
+ }
3362
+ /**
3363
+ * Begin an OAuth sign-in / sign-up flow (unauthenticated). Returns the
3364
+ * `authorizationUrl` for the host to redirect to — it does NOT return tokens;
3365
+ * the server's callback establishes the session.
3366
+ */
3367
+ declare function authorize(client: SublayHttpClient, data: AuthorizeProps): Promise<AuthorizeResponse>;
3368
+
3369
+ interface LinkIdentityProps {
3370
+ provider: OAuthProvider;
3371
+ /** Allowed redirect URI to return the browser to after linking completes. */
3372
+ redirectAfterAuth: string;
3373
+ }
3374
+ /**
3375
+ * Link a new OAuth provider to the **current** user (authenticated). Same
3376
+ * redirect contract as {@link authorize}: returns the `authorizationUrl` for the
3377
+ * host to redirect to. The current user is taken from the auth token, never the
3378
+ * body.
3379
+ */
3380
+ declare function linkIdentity(client: SublayHttpClient, data: LinkIdentityProps): Promise<AuthorizeResponse>;
3381
+
3382
+ interface OAuthIdentity {
3383
+ id: string;
3384
+ provider: string;
3385
+ providerAccountId: string;
3386
+ email: string | null;
3387
+ name: string | null;
3388
+ avatar: string | null;
3389
+ isVerified: boolean;
3390
+ createdAt: string;
3391
+ }
3392
+ interface ListIdentitiesResponse {
3393
+ identities: OAuthIdentity[];
3394
+ hasPassword: boolean;
3395
+ }
3396
+
3397
+ /** List the current user's linked OAuth identities (authenticated). */
3398
+ declare function listIdentities(client: SublayHttpClient): Promise<ListIdentitiesResponse>;
3399
+
3400
+ interface UnlinkIdentityProps {
3401
+ identityId: string;
3402
+ }
3403
+ interface UnlinkIdentityResponse {
3404
+ success: boolean;
3405
+ }
3406
+ /**
3407
+ * Unlink one of the current user's OAuth identities (authenticated). The server
3408
+ * refuses to remove the last identity if the user has no password set.
3409
+ */
3410
+ declare function unlinkIdentity(client: SublayHttpClient, data: UnlinkIdentityProps): Promise<UnlinkIdentityResponse>;
3411
+
3412
+ declare const OAuth_authorize: typeof authorize;
3413
+ declare const OAuth_linkIdentity: typeof linkIdentity;
3414
+ declare const OAuth_listIdentities: typeof listIdentities;
3415
+ declare const OAuth_unlinkIdentity: typeof unlinkIdentity;
3416
+ declare namespace OAuth {
3417
+ export { OAuth_authorize as authorize, OAuth_linkIdentity as linkIdentity, OAuth_listIdentities as listIdentities, OAuth_unlinkIdentity as unlinkIdentity };
3418
+ }
3419
+
3420
+ interface ListConversationsProps {
3421
+ /** Comma-separated conversation types, e.g. "direct,group,space". */
3422
+ types?: string;
3423
+ /** Cursor for keyset pagination: the `lastMessageAt` of the last item from the previous page (ISO datetime). */
3424
+ cursor?: string;
3425
+ /** Tie-breaker cursor: the `createdAt` of the last item from the previous page (ISO datetime). */
3426
+ cursorCreatedAt?: string;
3427
+ /** Default 20, max 50. */
3428
+ limit?: number;
3429
+ }
3430
+ interface ListConversationsResponse {
3431
+ conversations: ConversationPreview[];
3432
+ hasMore: boolean;
3433
+ }
3434
+ declare function listConversations(client: SublayHttpClient, data?: ListConversationsProps): Promise<ListConversationsResponse>;
3435
+
3436
+ interface CreateGroupConversationProps {
3437
+ name?: string;
3438
+ description?: string;
3439
+ /** Member user IDs to add to the group. Defaults to []. */
3440
+ memberIds?: string[];
3441
+ metadata?: Record<string, any>;
3442
+ }
3443
+ declare function createGroupConversation(client: SublayHttpClient, data: CreateGroupConversationProps): Promise<Conversation>;
3444
+
3445
+ interface CreateDirectConversationProps {
3446
+ /** The other participant (the target). */
3447
+ userId: string;
3448
+ }
3449
+ declare function createDirectConversation(client: SublayHttpClient, data: CreateDirectConversationProps): Promise<Conversation>;
3450
+
3451
+ interface GetConversationProps {
3452
+ conversationId: string;
3453
+ }
3454
+ declare function getConversation(client: SublayHttpClient, data: GetConversationProps): Promise<Conversation>;
3455
+
3456
+ interface UpdateConversationProps {
3457
+ conversationId: string;
3458
+ name?: string;
3459
+ description?: string;
3460
+ /** File id for the conversation avatar, or null to clear it. */
3461
+ avatarFileId?: string | null;
3462
+ /** Space conversations only: who may post. */
3463
+ postingPermission?: "members" | "admins";
3464
+ }
3465
+ declare function updateConversation(client: SublayHttpClient, data: UpdateConversationProps): Promise<Conversation>;
3466
+
3467
+ interface DeleteConversationProps {
3468
+ conversationId: string;
3469
+ }
3470
+ interface DeleteConversationResponse {
3471
+ message: string;
3472
+ }
3473
+ declare function deleteConversation(client: SublayHttpClient, data: DeleteConversationProps): Promise<DeleteConversationResponse>;
3474
+
3475
+ interface UnreadCountResponse {
3476
+ totalUnread: number;
3477
+ unreadConversationCount: number;
3478
+ }
3479
+ declare function getUnreadCount(client: SublayHttpClient): Promise<UnreadCountResponse>;
3480
+
3481
+ interface ListMembersProps extends SpaceReputationContextParams {
3482
+ conversationId: string;
3483
+ page?: number;
3484
+ limit?: number;
3485
+ role?: "admin" | "member";
3486
+ }
3487
+ declare function listMembers(client: SublayHttpClient, data: ListMembersProps): Promise<PaginatedResponse<ConversationMember>>;
3488
+
3489
+ interface AddMemberProps {
3490
+ conversationId: string;
3491
+ /** The member to add (the target). */
3492
+ userId: string;
3493
+ }
3494
+ declare function addMember(client: SublayHttpClient, data: AddMemberProps): Promise<ConversationMember>;
3495
+
3496
+ interface RemoveMemberProps {
3497
+ conversationId: string;
3498
+ /** The member to remove (the target). */
3499
+ userId: string;
3500
+ }
3501
+ declare function removeMember(client: SublayHttpClient, data: RemoveMemberProps): Promise<{
3502
+ message: string;
3503
+ }>;
3504
+
3505
+ interface LeaveConversationProps {
3506
+ conversationId: string;
3507
+ }
3508
+ declare function leaveConversation(client: SublayHttpClient, data: LeaveConversationProps): Promise<{
3509
+ message: string;
3510
+ }>;
3511
+
3512
+ interface ChangeMemberRoleProps {
3513
+ conversationId: string;
3514
+ /** The member whose role changes (the target). */
3515
+ userId: string;
3516
+ role: ConversationMemberRole;
3517
+ }
3518
+ declare function changeMemberRole(client: SublayHttpClient, data: ChangeMemberRoleProps): Promise<ConversationMember>;
3519
+
3520
+ interface MessageFilters {
3521
+ /**
3522
+ * Filter to messages that have thread replies (not quotings). `true` returns
3523
+ * only messages with at least one thread reply; `false` returns only messages
3524
+ * with none. Omit for no reply-count filtering.
3525
+ */
3526
+ hasReplies?: boolean;
3527
+ }
3528
+ interface ListMessagesProps extends SpaceReputationContextParams {
3529
+ conversationId: string;
3530
+ /** Restrict to replies of this message (thread view). */
3531
+ parentId?: string;
3532
+ /** Keyset pagination: ISO timestamp; return messages created before this. Mutually exclusive with `after`. */
3533
+ before?: string;
3534
+ /** Keyset pagination: ISO timestamp; return messages created after this. Mutually exclusive with `before`. */
3535
+ after?: string;
3536
+ /** Page size (default 50, max 100). */
3537
+ limit?: number;
3538
+ sort?: "asc" | "desc";
3539
+ /**
3540
+ * Comma-separated associations to populate: `"files"` (message
3541
+ * attachments) and `"grants"` (the reputation-grant summary). Combine
3542
+ * them as `"files,grants"` — the server splits and trims this itself.
3543
+ */
3544
+ include?: string;
3545
+ /** Optional filters, e.g. `{ hasReplies: true }`. */
3546
+ filters?: MessageFilters;
3547
+ }
3548
+ interface ListMessagesResponse {
3549
+ messages: ChatMessage[];
3550
+ hasMore: boolean;
3551
+ oldestCreatedAt: string | null;
3552
+ newestCreatedAt: string | null;
3553
+ /**
3554
+ * Present only when a filter combination can't return results — e.g.
3555
+ * `hasReplies: true` together with `parentId` (thread replies are one level
3556
+ * deep and never have their own replies).
3557
+ */
3558
+ notice?: string;
3559
+ }
3560
+ declare function listMessages(client: SublayHttpClient, data: ListMessagesProps): Promise<ListMessagesResponse>;
3561
+
3562
+ interface SendMessageProps extends SpaceReputationContextParams {
3563
+ conversationId: string;
3564
+ content?: string;
3565
+ gif?: GifData | null;
3566
+ mentions?: Mention[];
3567
+ parentMessageId?: string;
3568
+ quotedMessageId?: string;
3569
+ metadata?: Record<string, any>;
3570
+ /** Client-generated id echoed back on the created message (not stored). */
3571
+ localId?: string;
3572
+ /**
3573
+ * Optional file attachments (browser `File`/`Blob`), up to 10. When present
3574
+ * the request is sent as `multipart/form-data`; otherwise it's a JSON body.
3575
+ */
3576
+ files?: (Blob | File)[];
3577
+ }
3578
+ declare function sendMessage(client: SublayHttpClient, data: SendMessageProps): Promise<ChatMessage>;
3579
+
3580
+ interface GetMessageProps extends SpaceReputationContextParams {
3581
+ conversationId: string;
3582
+ messageId: string;
3583
+ /**
3584
+ * Comma-separated associations to populate. Only `"grants"` is supported
3585
+ * here — it attaches the message's reputation-grant summary.
3586
+ */
3587
+ include?: string;
3588
+ }
3589
+ declare function getMessage(client: SublayHttpClient, data: GetMessageProps): Promise<ChatMessage>;
3590
+
3591
+ interface EditMessageProps {
3592
+ conversationId: string;
3593
+ messageId: string;
3594
+ content?: string;
3595
+ /** A GIF attachment, or null to clear it. */
3596
+ gif?: GifData | null;
3597
+ mentions?: Mention[];
3598
+ metadata?: Record<string, any> | null;
3599
+ }
3600
+ declare function editMessage(client: SublayHttpClient, data: EditMessageProps): Promise<ChatMessage>;
3601
+
3602
+ interface DeleteMessageProps {
3603
+ conversationId: string;
3604
+ messageId: string;
3605
+ }
3606
+ interface DeleteMessageResponse {
3607
+ message: string;
3608
+ /** Present when the author soft-deletes their own message. */
3609
+ userDeletedAt?: string;
3610
+ }
3611
+ declare function deleteMessage(client: SublayHttpClient, data: DeleteMessageProps): Promise<DeleteMessageResponse>;
3612
+
3613
+ interface ToggleReactionProps {
3614
+ conversationId: string;
3615
+ messageId: string;
3616
+ /** The reaction emoji (required, 1–10 chars). */
3617
+ emoji: string;
3618
+ }
3619
+ interface ToggleReactionResponse {
3620
+ /** Updated emoji → count map for the message. */
3621
+ reactionCounts: Record<string, number>;
3622
+ /** Emojis the acting user has reacted with after the toggle. */
3623
+ userReactions: string[];
3624
+ /** +1 if the reaction was added, -1 if it was removed. */
3625
+ delta: 1 | -1;
3626
+ }
3627
+ declare function toggleReaction(client: SublayHttpClient, data: ToggleReactionProps): Promise<ToggleReactionResponse>;
3628
+
3629
+ interface ListReactionsProps extends SpaceReputationContextParams {
3630
+ conversationId: string;
3631
+ messageId: string;
3632
+ /** The reaction emoji to list reactors for (required). */
3633
+ emoji: string;
3634
+ /** Page number (default 1). */
3635
+ page?: number;
3636
+ /** Page size (default 50, max 100). */
3637
+ limit?: number;
3638
+ }
3639
+ interface MessageReaction {
3640
+ user: User;
3641
+ emoji: string;
3642
+ createdAt: Date;
3643
+ }
3644
+ interface ListReactionsResponse {
3645
+ data: MessageReaction[];
3646
+ pagination: PaginationMetadata;
3647
+ }
3648
+ declare function listReactions(client: SublayHttpClient, data: ListReactionsProps): Promise<ListReactionsResponse>;
3649
+
3650
+ interface MarkAsReadProps {
3651
+ conversationId: string;
3652
+ /** The message up to which the conversation is marked read (uuid, required). */
3653
+ messageId: string;
3654
+ }
3655
+ declare function markAsRead(client: SublayHttpClient, data: MarkAsReadProps): Promise<{
3656
+ message: string;
3657
+ }>;
3658
+
3659
+ interface MuteConversationProps {
3660
+ conversationId: string;
3661
+ /**
3662
+ * The duration CHOICE (`8h` / `24h` / `1w` / `forever`), or `null` to clear
3663
+ * the mute. Never a raw timestamp — the server resolves it and represents
3664
+ * "forever" via the returned member's explicit `mutedForever` signal.
3665
+ */
3666
+ duration: MuteDuration | null;
3667
+ }
3668
+ interface MuteConversationResponse {
3669
+ currentMember: ConversationMember;
3670
+ }
3671
+ /**
3672
+ * Set / clear the logged-in user's conversation mute.
3673
+ *
3674
+ * Mirrors `POST /:projectId/chat/conversations/:conversationId/mute`. The actor
3675
+ * is derived from the user token (Rule A) — a user only mutes their own
3676
+ * membership, so there is no `userId` param.
3677
+ */
3678
+ declare function muteConversation(client: SublayHttpClient, data: MuteConversationProps): Promise<MuteConversationResponse>;
3679
+
3680
+ declare const Chat_addMember: typeof addMember;
3681
+ declare const Chat_changeMemberRole: typeof changeMemberRole;
3682
+ declare const Chat_createDirectConversation: typeof createDirectConversation;
3683
+ declare const Chat_createGroupConversation: typeof createGroupConversation;
3684
+ declare const Chat_deleteConversation: typeof deleteConversation;
3685
+ declare const Chat_deleteMessage: typeof deleteMessage;
3686
+ declare const Chat_editMessage: typeof editMessage;
3687
+ declare const Chat_getConversation: typeof getConversation;
3688
+ declare const Chat_getMessage: typeof getMessage;
3689
+ declare const Chat_getUnreadCount: typeof getUnreadCount;
3690
+ declare const Chat_leaveConversation: typeof leaveConversation;
3691
+ declare const Chat_listConversations: typeof listConversations;
3692
+ declare const Chat_listMembers: typeof listMembers;
3693
+ declare const Chat_listMessages: typeof listMessages;
3694
+ declare const Chat_listReactions: typeof listReactions;
3695
+ declare const Chat_markAsRead: typeof markAsRead;
3696
+ declare const Chat_muteConversation: typeof muteConversation;
3697
+ declare const Chat_removeMember: typeof removeMember;
3698
+ declare const Chat_sendMessage: typeof sendMessage;
3699
+ declare const Chat_toggleReaction: typeof toggleReaction;
3700
+ declare const Chat_updateConversation: typeof updateConversation;
3701
+ declare namespace Chat {
3702
+ export { Chat_addMember as addMember, Chat_changeMemberRole as changeMemberRole, Chat_createDirectConversation as createDirectConversation, Chat_createGroupConversation as createGroupConversation, Chat_deleteConversation as deleteConversation, Chat_deleteMessage as deleteMessage, Chat_editMessage as editMessage, Chat_getConversation as getConversation, Chat_getMessage as getMessage, Chat_getUnreadCount as getUnreadCount, Chat_leaveConversation as leaveConversation, Chat_listConversations as listConversations, Chat_listMembers as listMembers, Chat_listMessages as listMessages, Chat_listReactions as listReactions, Chat_markAsRead as markAsRead, Chat_muteConversation as muteConversation, Chat_removeMember as removeMember, Chat_sendMessage as sendMessage, Chat_toggleReaction as toggleReaction, Chat_updateConversation as updateConversation };
3703
+ }
3704
+
3705
+ /**
3706
+ * Read the logged-in user's push notification preferences (the set of event
3707
+ * types disabled for push). Returns an empty `disabledTypes` (all-on) when no
3708
+ * preference row exists.
3709
+ *
3710
+ * Mirrors `GET /:projectId/push-notifications/preferences`. The actor is derived
3711
+ * from the user token (Rule A) — no `userId` param.
3712
+ */
3713
+ declare function getNotificationPreferences(client: SublayHttpClient): Promise<NotificationPreferences>;
3714
+
3715
+ interface UpdateNotificationPreferencesProps {
3716
+ /**
3717
+ * The set of push event types the user has opted OUT of. Server-exact type
3718
+ * names only (unknown names are rejected server-side); duplicates collapse.
3719
+ */
3720
+ disabledTypes: PushEventType[];
3721
+ }
3722
+ /**
3723
+ * Upsert the logged-in user's push notification preferences.
3724
+ *
3725
+ * Mirrors `PUT /:projectId/push-notifications/preferences`. The actor is derived
3726
+ * from the user token (Rule A) — no `userId` param.
3727
+ */
3728
+ declare function updateNotificationPreferences(client: SublayHttpClient, data: UpdateNotificationPreferencesProps): Promise<NotificationPreferences>;
3729
+
3730
+ declare const Push_getNotificationPreferences: typeof getNotificationPreferences;
3731
+ declare const Push_updateNotificationPreferences: typeof updateNotificationPreferences;
3732
+ declare namespace Push {
3733
+ export { Push_getNotificationPreferences as getNotificationPreferences, Push_updateNotificationPreferences as updateNotificationPreferences };
3734
+ }
3735
+
3736
+ /**
3737
+ * Workspaces bundle interfaces (client subset). Mirrors the server's
3738
+ * `IWorkspace` / `IWorkspaceMember` / `IWorkspaceInvitation` shapes and the
3739
+ * workspace controller responses.
3740
+ *
3741
+ * `capabilities` is a CLOSED, Sublay-enforced vocabulary (cascades via reach);
3742
+ * `permissions` is opaque free-form developer strings Sublay never consumes
3743
+ * (per-node only, does NOT cascade).
3744
+ */
3745
+ type WorkspaceCapability = "view" | "invite" | "remove-member" | "edit-member-access" | "edit-member-profile" | "create-sub-workspace" | "edit-workspace";
3746
+ type WorkspaceInvitationStatus = "pending" | "accepted" | "declined" | "revoked";
3747
+ type WorkspaceAuthorityReason = "owner" | "ancestor-owner" | "member" | "reach-holder";
3748
+ type WorkspaceAuthorityReasonDetail = {
3749
+ type: "owner" | "member";
3750
+ viaWorkspaceId?: never;
3751
+ } | {
3752
+ type: "ancestor-owner" | "reach-holder";
3753
+ viaWorkspaceId: string;
3754
+ };
3755
+ interface Workspace {
3756
+ id: string;
3757
+ name: string;
3758
+ metadata: Record<string, any>;
3759
+ ownerId: string;
3760
+ parentWorkspaceId: string | null;
3761
+ depth: number;
3762
+ inheritsFromParent: boolean;
3763
+ createdAt: string;
3764
+ updatedAt: string;
3765
+ memberCount?: number;
3766
+ }
3767
+ interface WorkspaceMember {
3768
+ id: string;
3769
+ workspaceId: string;
3770
+ userId: string;
3771
+ capabilities: WorkspaceCapability[];
3772
+ permissions: string[];
3773
+ rank: number;
3774
+ title: string | null;
3775
+ metadata: Record<string, any>;
3776
+ joinedAt: string;
3777
+ createdAt: string;
3778
+ }
3779
+ interface WorkspaceInvitation {
3780
+ id: string;
3781
+ workspaceId: string;
3782
+ invitedBy: string;
3783
+ userId: string | null;
3784
+ email: string | null;
3785
+ capabilities: WorkspaceCapability[];
3786
+ permissions: string[];
3787
+ rank: number;
3788
+ title: string | null;
3789
+ status: WorkspaceInvitationStatus;
3790
+ expiresAt: string;
3791
+ createdAt: string;
3792
+ updatedAt: string;
3793
+ }
3794
+ interface WorkspaceInvitationInviter {
3795
+ id: string;
3796
+ name: string | null;
3797
+ username: string | null;
3798
+ avatar: string | null;
3799
+ reputation: number;
3800
+ }
3801
+ interface MyWorkspaceInvitation extends Omit<WorkspaceInvitation, "invitedBy"> {
3802
+ workspace: {
3803
+ id: string;
3804
+ name: string;
3805
+ };
3806
+ invitedBy: WorkspaceInvitationInviter;
3807
+ }
3808
+ interface WorkspaceRosterReason {
3809
+ type: "owner" | "member" | "ancestor-owner" | "reach-holder" | "descendant-member";
3810
+ rank?: number;
3811
+ /**
3812
+ * The SAME ladder position, expressed as an offset from the CALLER: `1` = one
3813
+ * rung below you, `0` = your peer, `-3` = three rungs above you. The caller's
3814
+ * own anchor is their member row on this workspace if they hold one, and apex
3815
+ * (one step above rank 0) if they do not — so a rank-0 member reads back as
3816
+ * `relativeRank: 1` for an owner.
3817
+ *
3818
+ * Authority-bearing and fenced WITH `rank`, never beside it: it is `rank`
3819
+ * minus a number the caller already knows, so leaking it leaks `rank` exactly.
3820
+ *
3821
+ * Present on same-node `member` reasons only. `descendant-member` entries
3822
+ * carry `rank` but NEVER `relativeRank` — rank is per-workspace, so an offset
3823
+ * measured against your standing on THIS node would be arithmetic across two
3824
+ * different ladders. Use their absolute `rank` there.
3825
+ *
3826
+ * Note the deliberate asymmetry with the fence described above: the FENCE is
3827
+ * per node (a descendant row may or may not carry `rank` depending on your
3828
+ * standing there), but PRESENCE of `relativeRank` is not — it is absent on
3829
+ * every `descendant-member` row, unconditionally, however much authority you
3830
+ * hold. A field that appears and disappears by who is asking is worse to
3831
+ * consume than one that is uniformly absent.
3832
+ */
3833
+ relativeRank?: number;
3834
+ capabilities?: WorkspaceCapability[];
3835
+ permissions?: string[];
3836
+ title?: string | null;
3837
+ metadata?: Record<string, any>;
3838
+ viaWorkspaceId?: string;
3839
+ workspaceId?: string;
3840
+ }
3841
+ interface WorkspaceRosterEntry {
3842
+ user: User;
3843
+ reasons: WorkspaceRosterReason[];
3844
+ }
3845
+ interface WorkspaceRosterResponse {
3846
+ data: WorkspaceRosterEntry[];
3847
+ total: number;
3848
+ }
3849
+ interface WorkspaceRosterCountsResponse {
3850
+ counts: {
3851
+ owner: number;
3852
+ member: number;
3853
+ ancestorOwner: number;
3854
+ reachHolder: number;
3855
+ descendantMember: number;
3856
+ };
3857
+ total: number;
3858
+ distinctUsers: number;
3859
+ }
3860
+ /**
3861
+ * The `user` carried by a standing read. Normally the full user record, but the
3862
+ * server falls back to `{ id }` alone when the user row is gone (a deleted user
3863
+ * with a lingering membership row is a reachable case), so every field except
3864
+ * `id` may be absent.
3865
+ */
3866
+ type WorkspaceStandingUser = Pick<User, "id"> & Partial<Omit<User, "id">>;
3867
+ interface WorkspaceMemberStanding {
3868
+ user: WorkspaceStandingUser;
3869
+ reasons: WorkspaceAuthorityReasonDetail[];
3870
+ capabilities?: WorkspaceCapability[];
3871
+ permissions?: string[];
3872
+ rank?: number | null;
3873
+ /**
3874
+ * `rank` expressed as an offset from the CALLER (negative = senior to you).
3875
+ * `null` exactly when `rank` is `null` — a target with no direct member row
3876
+ * here sits outside the ladder and has no position to measure. Fenced with
3877
+ * `rank`: absent (not null) for a caller who may not see it.
3878
+ */
3879
+ relativeRank?: number | null;
3880
+ title: string | null;
3881
+ metadata: Record<string, any>;
3882
+ }
3883
+ interface WorkspaceAuthority {
3884
+ reasons: WorkspaceAuthorityReasonDetail[];
3885
+ capabilities: WorkspaceCapability[];
3886
+ permissions: string[];
3887
+ rank: number | null;
3888
+ }
3889
+ /**
3890
+ * One descendant the subtree sweep did NOT clear, where the target user still
3891
+ * holds a direct membership.
3892
+ *
3893
+ * `id` / `name` are masked TOGETHER: an entry the acting user may see carries
3894
+ * both, and one they may not carries `null` for both — the sweep reports THAT a
3895
+ * membership survived without disclosing the existence or name of a sealed
3896
+ * sub-workspace the actor has no authority over (the same sealing fence the
3897
+ * descendant roster read applies). Modelled as a discriminated union so a
3898
+ * `null` check on `id` narrows `name` too.
3899
+ */
3900
+ type SkippedWorkspace = {
3901
+ id: string;
3902
+ name: string;
3903
+ /** Why it was skipped. `out-of-reach`: the actor's authority does not extend there. */
3904
+ reason: "out-of-reach";
3905
+ } | {
3906
+ id: null;
3907
+ name: null;
3908
+ /** Why it was skipped. `out-of-reach`: the actor's authority does not extend there. */
3909
+ reason: "out-of-reach";
3910
+ };
3911
+ interface RemoveWorkspaceMemberFromSubtreeResponse {
3912
+ removedCount: number;
3913
+ removed: {
3914
+ workspaceId: string;
3915
+ userId: string;
3916
+ }[];
3917
+ /**
3918
+ * How many descendant memberships the target RETAINED because the sweep could
3919
+ * not reach them. Always `0` for an owner / ancestor-owner / privileged key.
3920
+ * A non-zero value means the offboarding is PARTIAL — never conclude a user is
3921
+ * fully removed from `removedCount` alone.
3922
+ */
3923
+ skippedCount: number;
3924
+ /** One entry per retained membership; `skippedCount === skipped.length`. */
3925
+ skipped: SkippedWorkspace[];
3926
+ }
3927
+
3928
+ interface CreateWorkspaceProps {
3929
+ name: string;
3930
+ metadata?: Record<string, any>;
3931
+ parentWorkspaceId?: string | null;
3932
+ }
3933
+ /**
3934
+ * Create a root or child workspace. The creator (the bearer-token user) becomes
3935
+ * the owner. Root creation requires a verified email.
3936
+ */
3937
+ declare function createWorkspace(client: SublayHttpClient, data: CreateWorkspaceProps): Promise<Workspace>;
3938
+
3939
+ interface FetchWorkspaceProps {
3940
+ workspaceId: string;
3941
+ include?: string;
3942
+ }
3943
+ declare function fetchWorkspace(client: SublayHttpClient, data: FetchWorkspaceProps): Promise<Workspace>;
3944
+
3945
+ interface FetchManyWorkspacesProps {
3946
+ page?: number;
3947
+ limit?: number;
3948
+ include?: string;
3949
+ }
3950
+ /**
3951
+ * List the bearer-token user's direct-membership + owned workspaces. The actor
3952
+ * is derived from the token — no actor field is sent.
3953
+ *
3954
+ * ⚠️ Only the fields declared above are accepted. The workspaces endpoints
3955
+ * refuse any undeclared top-level field with a 400 rather than ignoring it, so
3956
+ * do not spread an unrelated object into `data`.
3957
+ */
3958
+ declare function fetchManyWorkspaces(client: SublayHttpClient, data?: FetchManyWorkspacesProps): Promise<PaginatedResponse<Workspace>>;
3959
+
3960
+ interface UpdateWorkspaceProps {
3961
+ workspaceId: string;
3962
+ name?: string;
3963
+ metadata?: Record<string, any>;
3964
+ }
3965
+ /**
3966
+ * Edit a workspace's name / metadata. Requires the `edit-workspace` capability
3967
+ * (or ownership). The actor is the bearer-token user — no actor field is sent.
3968
+ */
3969
+ declare function updateWorkspace(client: SublayHttpClient, data: UpdateWorkspaceProps): Promise<Workspace>;
3970
+
3971
+ interface UpdateWorkspaceInheritFlagProps {
3972
+ workspaceId: string;
3973
+ inheritsFromParent: boolean;
3974
+ }
3975
+ /**
3976
+ * Flip whether capabilities held on an ancestor "reach" into this workspace.
3977
+ * Owner-only in both directions (own owner or an ancestor owner), and blocked
3978
+ * (403 `workspace/inherit-enforced`) when the project enforces its default.
3979
+ * The actor is the bearer-token user — no actor field is sent.
3980
+ */
3981
+ declare function updateWorkspaceInheritFlag(client: SublayHttpClient, data: UpdateWorkspaceInheritFlagProps): Promise<Workspace>;
3982
+
3983
+ interface DeleteWorkspaceProps {
3984
+ workspaceId: string;
3985
+ }
3986
+ interface DeleteWorkspaceResponse {
3987
+ message: string;
3988
+ }
3989
+ /**
3990
+ * Owner-only delete (own owner or an ancestor owner). Cascades the whole
3991
+ * subtree transactionally. The actor is the bearer-token user — no actor
3992
+ * field is sent.
3993
+ */
3994
+ declare function deleteWorkspace(client: SublayHttpClient, data: DeleteWorkspaceProps): Promise<DeleteWorkspaceResponse>;
3995
+
3996
+ interface TransferWorkspaceOwnershipProps {
3997
+ workspaceId: string;
3998
+ newOwnerId: string;
3999
+ previousOwnerDisposition?: "demote" | "remove";
4000
+ previousOwnerRank?: number;
4001
+ previousOwnerCapabilities?: WorkspaceCapability[];
4002
+ }
4003
+ /**
4004
+ * Hand the workspace to a new owner. Owner-only (own owner or an ancestor
4005
+ * owner). The actor is the bearer-token user — no actor field is sent;
4006
+ * `newOwnerId` addresses the TARGET, not the actor.
4007
+ */
4008
+ declare function transferWorkspaceOwnership(client: SublayHttpClient, data: TransferWorkspaceOwnershipProps): Promise<Workspace>;
4009
+
4010
+ interface FetchWorkspaceMembersProps {
4011
+ workspaceId: string;
4012
+ include?: string;
4013
+ countOnly?: boolean;
4014
+ }
4015
+ /**
4016
+ * Unified roster read — one entry per distinct user, each with a `reasons`
4017
+ * array. Always returned in full (never paginated). With `countOnly=true` the
4018
+ * shape is `WorkspaceRosterCountsResponse` instead. Actor from the token.
4019
+ *
4020
+ * Same-node `member` reasons carry both rank coordinates: absolute `rank` and
4021
+ * `relativeRank`, the offset from you (`1` = one rung below you, `-3` = three
4022
+ * above). Both are fenced together and both are absent for a caller who does
4023
+ * not operate people here. `descendant-member` reasons carry `rank` only.
4024
+ */
4025
+ declare function fetchWorkspaceMembers(client: SublayHttpClient, data: FetchWorkspaceMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
4026
+
4027
+ interface FetchWorkspaceMemberStandingProps {
4028
+ workspaceId: string;
4029
+ targetUserId: string;
4030
+ }
4031
+ /**
4032
+ * Read one user's resolved standing on a workspace (`reasons`, `capabilities`,
4033
+ * `permissions`, `rank`, `relativeRank`, `title`, `metadata`).
4034
+ *
4035
+ * `relativeRank` is the target's `rank` as an offset from YOU (negative =
4036
+ * senior to you), and is fenced with `rank`: both are absent, not null, for a
4037
+ * caller who may not see the target's authority.
4038
+ */
4039
+ declare function fetchWorkspaceMemberStanding(client: SublayHttpClient, data: FetchWorkspaceMemberStandingProps): Promise<WorkspaceMemberStanding>;
4040
+
4041
+ interface UpdateWorkspaceMemberProps {
4042
+ workspaceId: string;
4043
+ targetUserId: string;
4044
+ capabilities?: WorkspaceCapability[];
4045
+ permissions?: string[];
4046
+ rank?: number;
4047
+ /**
4048
+ * `rank`'s relative twin: an offset from the ACTOR (`1` = one rung below me),
4049
+ * resolved to an absolute rank at write time and stored absolute. Must be
4050
+ * `>= 1`; mutually exclusive with `rank` (sending both is a 400). Both rank fields are also capped at `2147483647` (int4), and the RESOLVED sum is bounded too — an in-range anchor plus an in-range offset can still overflow, which is a 400 rather than a 500.
4051
+ *
4052
+ * The anchor is the actor's own rank if they hold a member row on this
4053
+ * workspace, apex otherwise. A SNAPSHOT — frozen at write time, it does not
4054
+ * follow the actor's own rank afterwards.
4055
+ *
4056
+ * Unlike invite, edit has NO default: omitting BOTH still means "rank
4057
+ * unchanged", so editing someone's capabilities never moves them on the
4058
+ * ladder.
4059
+ */
4060
+ relativeRank?: number;
4061
+ title?: string | null;
4062
+ metadata?: Record<string, any>;
4063
+ }
4064
+ /**
4065
+ * Edit a member's grant / profile. Powerful fields need `edit-member-access`
4066
+ * plus rank + no-escalation rules; cosmetic fields need only
4067
+ * `edit-member-profile`. No actor field is sent — the actor comes from the token.
4068
+ *
4069
+ * Rank moves in either coordinate — `rank` (absolute) or `relativeRank` (an
4070
+ * offset from the actor) — never both. Omitting both leaves rank UNCHANGED;
4071
+ * unlike invite, edit has no value default.
4072
+ */
4073
+ declare function updateWorkspaceMember(client: SublayHttpClient, data: UpdateWorkspaceMemberProps): Promise<WorkspaceMember>;
4074
+
4075
+ interface RemoveWorkspaceMemberProps {
4076
+ workspaceId: string;
4077
+ targetUserId: string;
4078
+ }
4079
+ /**
4080
+ * Remove a member from this workspace. Requires the `remove-member` capability
4081
+ * and is rank-bounded. The workspace owner cannot be removed (409
4082
+ * `workspace/sole-owner`) — transfer ownership first. No actor field is sent;
4083
+ * the actor comes from the token.
4084
+ */
4085
+ declare function removeWorkspaceMember(client: SublayHttpClient, data: RemoveWorkspaceMemberProps): Promise<void>;
4086
+
4087
+ interface LeaveWorkspaceProps {
4088
+ workspaceId: string;
4089
+ }
4090
+ /**
4091
+ * The bearer-token user leaves this workspace — removes THEIR OWN direct
4092
+ * membership on THIS node only (owning a child is unaffected). An owner cannot
4093
+ * leave (409 `workspace/sole-owner`) — transfer ownership or remove the
4094
+ * workspace first. No actor field is sent; the server derives the leaver from
4095
+ * the token.
4096
+ */
4097
+ declare function leaveWorkspace(client: SublayHttpClient, data: LeaveWorkspaceProps): Promise<void>;
4098
+
4099
+ interface RemoveWorkspaceMemberFromSubtreeProps {
4100
+ workspaceId: string;
4101
+ targetUserId: string;
4102
+ }
4103
+ /**
4104
+ * Removes the target user's direct memberships on this workspace and every
4105
+ * descendant. Requires `remove-member` (rank-bounded per node). Blocks (409
4106
+ * `workspace/owns-descendants`) with a report if the user OWNS any descendant
4107
+ * workspace — transfer or delete those first. The actor comes from the token.
4108
+ *
4109
+ * A NON-owner's sweep can be PARTIAL: it stops at sealed sub-workspaces. Check
4110
+ * `skippedCount` / `skipped` before treating the user as fully offboarded.
4111
+ */
4112
+ declare function removeWorkspaceMemberFromSubtree(client: SublayHttpClient, data: RemoveWorkspaceMemberFromSubtreeProps): Promise<RemoveWorkspaceMemberFromSubtreeResponse>;
4113
+
4114
+ interface CreateWorkspaceInviteProps {
4115
+ workspaceId: string;
4116
+ email?: string;
4117
+ userId?: string;
4118
+ username?: string;
4119
+ capabilities?: WorkspaceCapability[];
4120
+ permissions?: string[];
4121
+ /**
4122
+ * The invited rank, ABSOLUTE — a position on this workspace's ladder (smaller
4123
+ * = more senior). The escape hatch, and what tier-constant apps want, since
4124
+ * they compute the number anyway.
4125
+ *
4126
+ * Optional, and mutually exclusive with `relativeRank` — sending both is a
4127
+ * 400. Sending NEITHER defaults to `relativeRank: 1`, one rung below the
4128
+ * inviter, which is well defined for every actor and can never fail the rank
4129
+ * floor.
4130
+ *
4131
+ * ⚠️ That default is for a NEW invitation. Re-inviting a target who already
4132
+ * has a live pending invite updates it in place, and there omitting both rank
4133
+ * fields PRESERVES the stored rank instead of re-defaulting it. See the
4134
+ * function doc below.
4135
+ */
4136
+ rank?: number;
4137
+ /**
4138
+ * The invited rank, RELATIVE to the inviter: `1` = one rung below me, `2` =
4139
+ * two rungs below, and so on. The documented happy path — every governance
4140
+ * rule about rank is relative, so this is what callers usually mean.
4141
+ *
4142
+ * Must be `>= 1` on a write. `0` would mean "a peer", which the assign rule
4143
+ * forbids (you cannot clone your own authority), and a negative offset would
4144
+ * mint someone senior to you; both are a 400. Both rank fields are also capped at `2147483647` (int4), and the RESOLVED sum is bounded too — an in-range anchor plus an in-range offset can still overflow, which is a 400 rather than a 500.
4145
+ *
4146
+ * The anchor is the inviter's OWN rank if they hold a member row on this
4147
+ * workspace, and apex (one step above rank 0) if they do not — so an owner's
4148
+ * `relativeRank: 1` lands on rank 0, while a rank-3 member's lands on rank 4.
4149
+ *
4150
+ * ⚠️ A SNAPSHOT, not a live link: the offset is resolved to an absolute rank
4151
+ * once, at invite time, and frozen. It does not track the inviter's later
4152
+ * promotions or demotions.
4153
+ */
4154
+ relativeRank?: number;
4155
+ title?: string | null;
4156
+ }
4157
+ /**
4158
+ * Create an invitation (requires the `invite` capability on the workspace). The
4159
+ * inviter is the bearer-token user.
4160
+ *
4161
+ * The invited rank comes in either coordinate — `rank` (absolute) or
4162
+ * `relativeRank` (an offset from the inviter) — never both. Omitting both
4163
+ * defaults to `relativeRank: 1`, one rung below the inviter, which is the
4164
+ * documented happy path and can never fail the rank floor.
4165
+ *
4166
+ * ⚠️ This route doubles as an UPSERT, and the default above applies only to a
4167
+ * NEW invitation. Re-inviting a target who already holds a live pending invite
4168
+ * refreshes THAT invitation in place — same id, expiry reset — and on that
4169
+ * branch an omitted grant field is PRESERVED, not re-defaulted or blanked:
4170
+ * `rank`, `capabilities`, `permissions` and `title` all keep their stored
4171
+ * values. A "Resend invitation" button that posts only the address therefore
4172
+ * cannot silently re-rank the invitee to one below whoever clicked it. An
4173
+ * explicit value still overwrites, and an explicit `relativeRank` re-resolves
4174
+ * against the CURRENT caller. Full semantics:
4175
+ * https://docs.sublay.io/api-reference/workspaces/invitations/create-invite
4176
+ */
4177
+ declare function createWorkspaceInvite(client: SublayHttpClient, data: CreateWorkspaceInviteProps): Promise<WorkspaceInvitation>;
4178
+
4179
+ interface FetchWorkspaceInvitesProps {
4180
+ workspaceId: string;
4181
+ }
4182
+ interface FetchWorkspaceInvitesResponse {
4183
+ data: WorkspaceInvitation[];
4184
+ }
4185
+ /**
4186
+ * List a workspace's LIVE pending invites (`status='pending' AND expiresAt >
4187
+ * now`). Requires the `invite` capability (or owner). Always returned in full —
4188
+ * this list is deliberately unpaginated.
4189
+ *
4190
+ * This is the OUTBOX read — invites this workspace ISSUED. For the invites
4191
+ * addressed TO the caller, use `fetchMyWorkspaceInvites`.
4192
+ */
4193
+ declare function fetchWorkspaceInvites(client: SublayHttpClient, data: FetchWorkspaceInvitesProps): Promise<FetchWorkspaceInvitesResponse>;
4194
+
4195
+ interface RevokeWorkspaceInviteProps {
4196
+ workspaceId: string;
4197
+ inviteId: string;
4198
+ }
4199
+ interface RevokeWorkspaceInviteResponse {
4200
+ success: boolean;
4201
+ }
4202
+ /**
4203
+ * Revoke a pending invitation. Requires the `invite` capability (or owner).
4204
+ * Note the verb-suffixed POST route — this is not a `DELETE`.
4205
+ */
4206
+ declare function revokeWorkspaceInvite(client: SublayHttpClient, data: RevokeWorkspaceInviteProps): Promise<RevokeWorkspaceInviteResponse>;
4207
+
4208
+ interface ResendWorkspaceInviteProps {
4209
+ workspaceId: string;
4210
+ inviteId: string;
4211
+ }
4212
+ /**
4213
+ * Resend / refresh a pending invitation (valid on any `pending` invite, even one
4214
+ * past `expiresAt` — resets a 14-day expiry and resends the email). A terminal
4215
+ * invite (accepted/declined/revoked) → 409. Requires `invite` (or owner).
4216
+ */
4217
+ declare function resendWorkspaceInvite(client: SublayHttpClient, data: ResendWorkspaceInviteProps): Promise<WorkspaceInvitation>;
4218
+
4219
+ interface AcceptWorkspaceInviteProps {
4220
+ inviteId: string;
4221
+ }
4222
+ interface AcceptWorkspaceInviteResponse {
4223
+ success: boolean;
4224
+ workspaceId: string;
4225
+ }
4226
+ /**
4227
+ * Accept an invitation — identity-matched to the bearer-token user + verified
4228
+ * email required. Non-secret id. Idempotent when already a member/owner.
4229
+ */
4230
+ declare function acceptWorkspaceInvite(client: SublayHttpClient, data: AcceptWorkspaceInviteProps): Promise<AcceptWorkspaceInviteResponse>;
4231
+
4232
+ interface DeclineWorkspaceInviteProps {
4233
+ inviteId: string;
4234
+ }
4235
+ interface DeclineWorkspaceInviteResponse {
4236
+ success: boolean;
4237
+ }
4238
+ /**
4239
+ * Decline an invitation — identity-matched to the bearer-token user, and
4240
+ * verified-email-gated (the same gate as accept, so an unverified squatter on
4241
+ * someone else's address cannot burn their invite). An unverified decline
4242
+ * returns `403 workspace/email-not-verified`.
4243
+ */
4244
+ declare function declineWorkspaceInvite(client: SublayHttpClient, data: DeclineWorkspaceInviteProps): Promise<DeclineWorkspaceInviteResponse>;
4245
+
4246
+ interface FetchMyWorkspaceInvitesResponse {
4247
+ data: MyWorkspaceInvitation[];
4248
+ }
4249
+ /**
4250
+ * The bearer-token user's LIVE pending invites (`status='pending' AND expiresAt
4251
+ * > now`), matched by `userId` from the token. Surfacing is NOT
4252
+ * verification-gated (the verified check applies when the user ACTS on an
4253
+ * invite — accept or decline).
4254
+ *
4255
+ * This is the INBOX read — invites addressed TO the caller. For the invites a
4256
+ * workspace has ISSUED, use `fetchWorkspaceInvites`.
4257
+ */
4258
+ declare function fetchMyWorkspaceInvites(client: SublayHttpClient): Promise<FetchMyWorkspaceInvitesResponse>;
4259
+
4260
+ interface FetchWorkspaceAuthorityProps {
4261
+ workspaceId: string;
4262
+ }
4263
+ /**
4264
+ * Authority-as-a-service read — the bearer-token user's resolved standing
4265
+ * (`{ reasons, capabilities, permissions, rank }`) on the workspace. A
4266
+ * permission check is a one-line `.includes()` on the result.
4267
+ *
4268
+ * ⚠️ No `relativeRank` on this read. It is an offset from the caller, and here
4269
+ * the caller IS the subject — so it could only ever be `0`. `rank` is the only
4270
+ * rank coordinate this endpoint exposes. `relativeRank` is meaningful on the
4271
+ * roster and member-standing reads, where the subject is somebody else.
4272
+ */
4273
+ declare function fetchWorkspaceAuthority(client: SublayHttpClient, data: FetchWorkspaceAuthorityProps): Promise<WorkspaceAuthority>;
4274
+
4275
+ declare const Workspaces_acceptWorkspaceInvite: typeof acceptWorkspaceInvite;
4276
+ declare const Workspaces_createWorkspace: typeof createWorkspace;
4277
+ declare const Workspaces_createWorkspaceInvite: typeof createWorkspaceInvite;
4278
+ declare const Workspaces_declineWorkspaceInvite: typeof declineWorkspaceInvite;
4279
+ declare const Workspaces_deleteWorkspace: typeof deleteWorkspace;
4280
+ declare const Workspaces_fetchManyWorkspaces: typeof fetchManyWorkspaces;
4281
+ declare const Workspaces_fetchMyWorkspaceInvites: typeof fetchMyWorkspaceInvites;
4282
+ declare const Workspaces_fetchWorkspace: typeof fetchWorkspace;
4283
+ declare const Workspaces_fetchWorkspaceAuthority: typeof fetchWorkspaceAuthority;
4284
+ declare const Workspaces_fetchWorkspaceInvites: typeof fetchWorkspaceInvites;
4285
+ declare const Workspaces_fetchWorkspaceMemberStanding: typeof fetchWorkspaceMemberStanding;
4286
+ declare const Workspaces_fetchWorkspaceMembers: typeof fetchWorkspaceMembers;
4287
+ declare const Workspaces_leaveWorkspace: typeof leaveWorkspace;
4288
+ declare const Workspaces_removeWorkspaceMember: typeof removeWorkspaceMember;
4289
+ declare const Workspaces_removeWorkspaceMemberFromSubtree: typeof removeWorkspaceMemberFromSubtree;
4290
+ declare const Workspaces_resendWorkspaceInvite: typeof resendWorkspaceInvite;
4291
+ declare const Workspaces_revokeWorkspaceInvite: typeof revokeWorkspaceInvite;
4292
+ declare const Workspaces_transferWorkspaceOwnership: typeof transferWorkspaceOwnership;
4293
+ declare const Workspaces_updateWorkspace: typeof updateWorkspace;
4294
+ declare const Workspaces_updateWorkspaceInheritFlag: typeof updateWorkspaceInheritFlag;
4295
+ declare const Workspaces_updateWorkspaceMember: typeof updateWorkspaceMember;
4296
+ declare namespace Workspaces {
4297
+ export { Workspaces_acceptWorkspaceInvite as acceptWorkspaceInvite, Workspaces_createWorkspace as createWorkspace, Workspaces_createWorkspaceInvite as createWorkspaceInvite, Workspaces_declineWorkspaceInvite as declineWorkspaceInvite, Workspaces_deleteWorkspace as deleteWorkspace, Workspaces_fetchManyWorkspaces as fetchManyWorkspaces, Workspaces_fetchMyWorkspaceInvites as fetchMyWorkspaceInvites, Workspaces_fetchWorkspace as fetchWorkspace, Workspaces_fetchWorkspaceAuthority as fetchWorkspaceAuthority, Workspaces_fetchWorkspaceInvites as fetchWorkspaceInvites, Workspaces_fetchWorkspaceMemberStanding as fetchWorkspaceMemberStanding, Workspaces_fetchWorkspaceMembers as fetchWorkspaceMembers, Workspaces_leaveWorkspace as leaveWorkspace, Workspaces_removeWorkspaceMember as removeWorkspaceMember, Workspaces_removeWorkspaceMemberFromSubtree as removeWorkspaceMemberFromSubtree, Workspaces_resendWorkspaceInvite as resendWorkspaceInvite, Workspaces_revokeWorkspaceInvite as revokeWorkspaceInvite, Workspaces_transferWorkspaceOwnership as transferWorkspaceOwnership, Workspaces_updateWorkspace as updateWorkspace, Workspaces_updateWorkspaceInheritFlag as updateWorkspaceInheritFlag, Workspaces_updateWorkspaceMember as updateWorkspaceMember };
4298
+ }
4299
+
4300
+ /**
4301
+ * Custom-table types for the `/db` surface (row ops only — the js-sdk holds no
4302
+ * service key, so it carries no table-management/DDL surface).
4303
+ *
4304
+ * Names mirror the server's `/db` contract exactly.
4305
+ */
4306
+ type DbFilterOperator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "like" | "isNull";
4307
+ interface DbFilter {
4308
+ column: string;
4309
+ operator: DbFilterOperator;
4310
+ value?: unknown;
4311
+ }
4312
+ interface TableQuery {
4313
+ page?: number;
4314
+ limit?: number;
4315
+ sortBy?: string;
4316
+ sortDir?: "asc" | "desc";
4317
+ /** AND-combined filter clauses. Serialized to a JSON query param. */
4318
+ filters?: DbFilter[];
4319
+ /** Surface soft-deleted rows on a paranoid table. */
4320
+ includeDeleted?: boolean;
4321
+ }
4322
+ /** Shape every custom-table row shares (managed columns). */
4323
+ interface TableRow {
4324
+ id: string;
4325
+ createdAt?: string;
4326
+ updatedAt?: string;
4327
+ deletedAt?: string | null;
4328
+ [column: string]: unknown;
4329
+ }
4330
+ interface DeleteResult {
4331
+ deleted: boolean;
4332
+ soft: boolean;
4333
+ }
4334
+ interface BulkDeleteResult {
4335
+ deletedCount: number;
4336
+ soft: boolean;
4337
+ }
4338
+ interface BulkDeleteProps {
4339
+ rowIds?: string[];
4340
+ filters?: DbFilter[];
4341
+ force?: boolean;
4342
+ }
4343
+ /**
4344
+ * Per-table row-operations accessor returned by `client.table<T>(name)`.
4345
+ * The actor is derived server-side from the user token (js-sdk Rule A) — no
4346
+ * actor params here. No DDL surface (no service key).
4347
+ */
4348
+ interface TableAccessor<T = TableRow> {
4349
+ find(query?: TableQuery): Promise<PaginatedResponse<T>>;
4350
+ findOne(rowId: string): Promise<T>;
4351
+ create(data: Partial<T> | Record<string, unknown>): Promise<T>;
4352
+ bulkCreate(rows: Array<Partial<T> | Record<string, unknown>>): Promise<T[]>;
4353
+ update(rowId: string, data: Partial<T> | Record<string, unknown>): Promise<T>;
4354
+ delete(rowId: string, opts?: {
4355
+ force?: boolean;
4356
+ }): Promise<DeleteResult>;
4357
+ bulkDelete(params: BulkDeleteProps): Promise<BulkDeleteResult>;
4358
+ restore(rowId: string): Promise<T>;
4359
+ }
4360
+
21
4361
  type BoundModule<T extends Record<string, (client: SublayHttpClient, ...args: any[]) => any>> = {
22
4362
  [K in keyof T]: (...args: Parameters<T[K]> extends [any, ...infer R] ? R : never) => ReturnType<T[K]>;
23
4363
  };
24
- export declare class SublayClient {
4364
+ declare class SublayClient {
25
4365
  private http;
26
4366
  auth: BoundModule<typeof Auth>;
27
4367
  users: BoundModule<typeof Users>;
@@ -54,17 +4394,5 @@ export declare class SublayClient {
54
4394
  /** Imperatively clear the session tokens, e.g. on logout (SDK-managed mode). */
55
4395
  clearTokens(): void;
56
4396
  }
57
- export type { ClientConfig, AuthTokens } from "./core/client";
58
- export type { PaginatedResponse, PaginationMetadata, } from "./interfaces/IPaginatedResponse";
59
- export type { SpaceReputationContextParams, SpaceReputationUserParams, } from "./interfaces/SpaceReputation";
60
- export type { UserSearchParams } from "./interfaces/UserSearch";
61
- export type { ReputationGrant, ReputationGrantSourceType, ReputationGrantTargetType, ReputationGrantTargetFilter, GrantSummary, } from "./interfaces/ReputationGrant";
62
- export type { CreateGrantProps } from "./modules/reputation/createGrant";
63
- export type { ListGrantsProps, ListGrantsResponse, } from "./modules/reputation/listGrants";
64
- export type { Workspace, WorkspaceMember, WorkspaceInvitation, WorkspaceCapability, WorkspaceInvitationStatus, WorkspaceAuthorityReason, WorkspaceAuthorityReasonDetail, WorkspaceRosterReason, WorkspaceRosterEntry, WorkspaceRosterResponse, WorkspaceRosterCountsResponse, WorkspaceStandingUser, WorkspaceMemberStanding, WorkspaceAuthority, RemoveWorkspaceMemberFromSubtreeResponse, SkippedWorkspace, } from "./interfaces/Workspace";
65
- export { PUSH_EVENT_TYPES, MUTE_DURATIONS } from "./interfaces/Push";
66
- export type { PushEventType, MuteDuration, NotificationPreferences, PushDeviceIdentifier, WebPushSubscription, } from "./interfaces/Push";
67
- export type { SignOutResult, PushUnbindSkipReason, } from "./modules/auth/signOut";
68
- export type { UpdateNotificationPreferencesProps } from "./modules/push/updateNotificationPreferences";
69
- export type { MuteConversationProps, MuteConversationResponse, } from "./modules/chat/muteConversation";
70
- export type { TableAccessor, TableRow, TableQuery, DbFilter, DbFilterOperator, BulkDeleteProps, DeleteResult, BulkDeleteResult, } from "./interfaces/Table";
4397
+
4398
+ export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type CreateGrantProps, type DbFilter, type DbFilterOperator, type DeleteResult, type GrantSummary, type ListGrantsProps, type ListGrantsResponse, MUTE_DURATIONS, type MuteConversationProps, type MuteConversationResponse, type MuteDuration, type MyWorkspaceInvitation, type NotificationPreferences, PUSH_EVENT_TYPES, type PaginatedResponse, type PaginationMetadata, type PushDeviceIdentifier, type PushEventType, type PushUnbindSkipReason, type RemoveWorkspaceMemberFromSubtreeResponse, type ReputationGrant, type ReputationGrantSourceType, type ReputationGrantTargetFilter, type ReputationGrantTargetType, type SignOutResult, type SkippedWorkspace, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UpdateNotificationPreferencesProps, type UserSearchParams, type WebPushSubscription, type Workspace, type WorkspaceAuthority, type WorkspaceAuthorityReason, type WorkspaceAuthorityReasonDetail, type WorkspaceCapability, type WorkspaceInvitation, type WorkspaceInvitationInviter, type WorkspaceInvitationStatus, type WorkspaceMember, type WorkspaceMemberStanding, type WorkspaceRosterCountsResponse, type WorkspaceRosterEntry, type WorkspaceRosterReason, type WorkspaceRosterResponse, type WorkspaceStandingUser };