@sublay/js 7.9.0 → 7.9.1

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 +1 -1
  7. package/dist/index.mjs +1 -1
  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.js CHANGED
@@ -334,7 +334,7 @@ async function verifyEmail(client, data) {
334
334
  async function sendVerificationEmail(client, data) {
335
335
  const response = await client.projectInstance.post(
336
336
  "/auth/send-verification-email",
337
- data ?? {}
337
+ data
338
338
  );
339
339
  return response.data;
340
340
  }
package/dist/index.mjs CHANGED
@@ -302,7 +302,7 @@ async function verifyEmail(client, data) {
302
302
  async function sendVerificationEmail(client, data) {
303
303
  const response = await client.projectInstance.post(
304
304
  "/auth/send-verification-email",
305
- data ?? {}
305
+ data
306
306
  );
307
307
  return response.data;
308
308
  }
package/package.json CHANGED
@@ -1,23 +1,39 @@
1
1
  {
2
2
  "name": "@sublay/js",
3
- "version": "7.9.0",
3
+ "version": "7.9.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
7
- "dist"
7
+ "dist",
8
+ "NOTICE"
8
9
  ],
9
10
  "description": "Official JavaScript SDK for Sublay",
11
+ "bugs": {
12
+ "url": "https://discord.com/invite/REKxnCJzPz"
13
+ },
14
+ "homepage": "https://docs.sublay.io",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/sublay-io/monorepo.git",
18
+ "directory": "packages/js"
19
+ },
10
20
  "author": "Sublay team",
11
- "license": "ISC",
21
+ "license": "Apache-2.0",
12
22
  "publishConfig": {
13
23
  "access": "public"
14
24
  },
15
25
  "exports": {
16
26
  ".": {
17
- "types": "./dist/index.d.ts",
18
- "import": "./dist/index.js",
19
- "require": "./dist/index.js"
20
- }
27
+ "import": {
28
+ "types": "./dist/index.d.mts",
29
+ "default": "./dist/index.mjs"
30
+ },
31
+ "require": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ }
35
+ },
36
+ "./package.json": "./package.json"
21
37
  },
22
38
  "dependencies": {
23
39
  "axios": "^1.15.0"
@@ -30,17 +46,12 @@
30
46
  "tsup": "^8.5.1",
31
47
  "typescript": "^6.0.3"
32
48
  },
49
+ "engines": {
50
+ "node": ">=22.13"
51
+ },
33
52
  "scripts": {
34
- "build": "tsup src/index.ts --dts --format cjs,esm",
35
- "build:types": "tsc --emitDeclarationOnly",
36
- "test": "jest",
37
- "version:patch": "pnpm version patch --no-git-tag-version --no-git-checks",
38
- "version:minor": "pnpm version minor --no-git-tag-version --no-git-checks",
39
- "publish-beta": "pnpm test && pnpm publish --tag beta --no-git-checks",
40
- "publish-prod": "pnpm test && pnpm publish --no-git-checks",
41
- "publish-beta:patch": "pnpm version:patch && pnpm publish-beta",
42
- "publish-beta:minor": "pnpm version:minor && pnpm publish-beta",
43
- "publish-prod:patch": "pnpm version:patch && pnpm publish-prod",
44
- "publish-prod:minor": "pnpm version:minor && pnpm publish-prod"
53
+ "build": "tsup src/index.ts --dts --format cjs,esm --clean",
54
+ "build:types": "tsc --noEmit",
55
+ "test": "jest"
45
56
  }
46
57
  }
@@ -1,64 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- export interface AuthTokens {
3
- accessToken: string;
4
- refreshToken: string;
5
- }
6
- export interface ClientConfig {
7
- projectId: string;
8
- /**
9
- * Optional tokens to hydrate the SDK on init (SDK-managed mode) — e.g. tokens
10
- * the host app persisted from a previous session.
11
- */
12
- initialTokens?: AuthTokens;
13
- /**
14
- * Optional async hook returning the current access token. **Providing it puts
15
- * the SDK in "host-managed" mode**: the host owns the token and its refresh,
16
- * and the SDK never stores or refreshes tokens itself.
17
- */
18
- getToken?: () => string | null | undefined | Promise<string | null | undefined>;
19
- /**
20
- * Called whenever the SDK sets, rotates, or clears tokens (SDK-managed mode
21
- * only). Receives `null` on sign-out. Use it to persist tokens so a session
22
- * survives a reload.
23
- */
24
- onAuthChange?: (tokens: AuthTokens | null) => void;
25
- }
26
- export declare class SublayHttpClient {
27
- projectInstance: AxiosInstance;
28
- private readonly baseURL;
29
- private readonly hostManaged;
30
- private readonly getToken?;
31
- private readonly onAuthChange?;
32
- private accessToken;
33
- private refreshToken;
34
- /** Shared so concurrent 403s trigger a single refresh (mutex). */
35
- private refreshPromise;
36
- constructor({ projectId, initialTokens, getToken, onAuthChange, }: ClientConfig);
37
- /**
38
- * The SDK's own in-memory access token (SDK-managed mode). Distinct from the
39
- * `init({ getToken })` host hook, which supplies a token in host-managed mode.
40
- */
41
- getAccessToken(): string | null;
42
- getRefreshToken(): string | null;
43
- /**
44
- * The `Authorization` header value (`Bearer <token>`) for the active auth
45
- * mode, or `undefined` if there is no token. Host-managed mode reads the
46
- * `getToken` hook; SDK-managed mode reads the in-memory access token. Use this
47
- * for requests that bypass `projectInstance` (e.g. the SSE `askContent`
48
- * stream, which needs `fetch` rather than axios).
49
- */
50
- getAuthHeader(): Promise<string | undefined>;
51
- /** Store a full token pair (SDK-managed mode only; no-op when host-managed). */
52
- setTokens(tokens: AuthTokens): void;
53
- /** Update just the access token, e.g. after a refresh (no-op when host-managed). */
54
- setAccessToken(accessToken: string): void;
55
- /** Clear tokens and notify with null (SDK-managed mode only). */
56
- clearTokens(): void;
57
- /**
58
- * Refresh the access token using the in-memory refresh token. A single shared
59
- * promise (mutex) means concurrent 403s trigger only one network refresh. The
60
- * call goes through a bare axios (not `projectInstance`) so it never re-enters
61
- * the response interceptor. Returns the new access token, or null on failure.
62
- */
63
- private refreshAccessToken;
64
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Helpers for building `multipart/form-data` request bodies. Shared by every
3
- * upload site (storage, chat messages, user avatar/banner) so they encode
4
- * fields identically: object/array values are JSON-stringified (the server
5
- * re-parses them), scalars are coerced to strings, and `undefined` is skipped.
6
- *
7
- * Do NOT set the request's `Content-Type` manually for these bodies — axios sets
8
- * it to `undefined` for a `FormData` instance so the browser writes the
9
- * multipart boundary itself.
10
- */
11
- /** Append a single field: skip `undefined`, JSON-stringify objects/arrays. */
12
- export declare function appendField(form: FormData, key: string, value: unknown): void;
13
- /** Append every own field of `fields` via {@link appendField}. */
14
- export declare function appendFields(form: FormData, fields: Record<string, unknown>): void;
15
- /**
16
- * Append a file part under `field`. The multipart filename is, in order of
17
- * precedence: an explicit `filename`, the `File`'s own name, then `fallback`.
18
- */
19
- export declare function appendFile(form: FormData, field: string, file: Blob | File, opts?: {
20
- filename?: string;
21
- fallback?: string;
22
- }): void;
@@ -1,57 +0,0 @@
1
- /**
2
- * Input accepted by {@link buildSpaceReputationParams}: either the new
3
- * `spaceReputation` object or the deprecated flat props.
4
- *
5
- * The flat inputs accept `null` (in addition to `undefined`) so the helper's
6
- * contract matches `@sublay/core` and `@sublay/node` exactly; `null` is treated
7
- * as unset. js-sdk never persists these params, so the `null` tolerance is not
8
- * strictly required here, but matching the sibling helpers is harmless and
9
- * consistent.
10
- */
11
- export interface BuildSpaceReputationParamsInput {
12
- spaceReputation?: {
13
- spaceId: string | "none" | "context";
14
- includeDescendants?: boolean;
15
- };
16
- /**
17
- * @deprecated Pass `spaceReputation` instead. Accepted for back-compat.
18
- */
19
- spaceReputationId?: string | null;
20
- /**
21
- * @deprecated Pass `spaceReputation` instead. Accepted for back-compat.
22
- */
23
- spaceReputationDescendants?: boolean | null;
24
- }
25
- /**
26
- * Flat output handed to the query-string serializer (axios `params` or the
27
- * `askContent` `URLSearchParams`). Both keys are omitted when unset — never
28
- * bracketed, never nested.
29
- */
30
- export interface SpaceReputationFlatParams {
31
- spaceReputationId?: string;
32
- spaceReputationDescendants?: boolean;
33
- }
34
- /**
35
- * Normalize the `spaceReputation` object or the deprecated flat props down to
36
- * the flat query params the server understands
37
- * (`spaceReputationId` / `spaceReputationDescendants`).
38
- *
39
- * **Critical:** this is the only thing that prevents the nested
40
- * `spaceReputation` object from reaching a query-string serializer. Axios would
41
- * bracket-encode it (`spaceReputation[spaceId]=…`) and the `askContent`
42
- * `URLSearchParams` path would stringify it to `[object Object]`; the server
43
- * ignores both — silently no-opping the new (primary) form. Every
44
- * reputation-consuming module must route the object through here and merge only
45
- * the flat output.
46
- *
47
- * Rules (mirrors the `@sublay/core` / `@sublay/node` helper contract):
48
- * - **Object wins when present.** "Present" means the `spaceReputation` key was
49
- * supplied at all (`spaceReputation !== undefined`) — even `{}` or a partial
50
- * object suppresses the flat props.
51
- * - When **both** the object and a flat prop are supplied, the object wins and a
52
- * one-time dev-only `console.warn` fires (never throws).
53
- * - The flat inputs tolerate `null` (treated as unset → param omitted).
54
- * - Output keys are omitted when unset; the result is always the two flat keys,
55
- * never a bracketed/nested object.
56
- */
57
- export declare function buildSpaceReputationParams(input: BuildSpaceReputationParamsInput): SpaceReputationFlatParams;
@@ -1,258 +0,0 @@
1
- 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";
2
- interface BaseAppNotification {
3
- id: string;
4
- userId: string;
5
- type: AppNotificationType;
6
- isRead: boolean;
7
- metadata: Record<string, any>;
8
- createdAt: string;
9
- }
10
- export interface SystemNotification extends BaseAppNotification {
11
- type: "system";
12
- action: string;
13
- metadata: {
14
- title?: string;
15
- content?: string;
16
- buttonData: {
17
- text: string;
18
- url: string;
19
- } | null;
20
- };
21
- }
22
- export interface EntityCommentNotification extends BaseAppNotification {
23
- type: "entity-comment";
24
- action: "open-comment";
25
- metadata: {
26
- entityId: string;
27
- entityShortId: string;
28
- entityTitle: string | null | undefined;
29
- entityContent: string | null | undefined;
30
- commentId: string;
31
- commentContent: string | null | undefined;
32
- initiatorId: string;
33
- initiatorName: string | null | undefined;
34
- initiatorUsername: string | null | undefined;
35
- initiatorAvatar: string | null | undefined;
36
- };
37
- }
38
- export interface CommentReplyNotification extends BaseAppNotification {
39
- type: "comment-reply";
40
- action: "open-comment";
41
- metadata: {
42
- entityId: string;
43
- entityShortId: string;
44
- entityTitle: string | null | undefined;
45
- entityContent: string | null | undefined;
46
- commentId: string;
47
- commentContent: string | null | undefined;
48
- replyId: string;
49
- replyContent: string | null | undefined;
50
- initiatorId: string;
51
- initiatorName: string | null | undefined;
52
- initiatorUsername: string | null | undefined;
53
- initiatorAvatar: string | null | undefined;
54
- };
55
- }
56
- export interface EntityMentionNotification extends BaseAppNotification {
57
- type: "entity-mention";
58
- action: "open-entity";
59
- metadata: {
60
- entityId: string;
61
- entityShortId: string;
62
- entityTitle: string | null | undefined;
63
- entityContent: string | null | undefined;
64
- initiatorId: string;
65
- initiatorName: string | null | undefined;
66
- initiatorUsername: string | null | undefined;
67
- initiatorAvatar: string | null | undefined;
68
- };
69
- }
70
- export interface CommentMentionNotification extends BaseAppNotification {
71
- type: "comment-mention";
72
- action: "open-comment";
73
- metadata: {
74
- entityId: string;
75
- entityShortId: string;
76
- entityTitle: string | null | undefined;
77
- entityContent: string | null | undefined;
78
- commentId: string;
79
- commentContent: string | null | undefined;
80
- initiatorId: string;
81
- initiatorName: string | null | undefined;
82
- initiatorUsername: string | null | undefined;
83
- initiatorAvatar: string | null | undefined;
84
- };
85
- }
86
- export interface EntityUpvoteNotification extends BaseAppNotification {
87
- type: "entity-upvote";
88
- action: "open-entity";
89
- metadata: {
90
- entityId: string;
91
- entityShortId: string;
92
- entityTitle: string | null | undefined;
93
- entityContent: string | null | undefined;
94
- initiatorId: string;
95
- initiatorName: string | null | undefined;
96
- initiatorUsername: string | null | undefined;
97
- initiatorAvatar: string | null | undefined;
98
- };
99
- }
100
- export interface CommentUpvoteNotification extends BaseAppNotification {
101
- type: "comment-upvote";
102
- action: "open-comment";
103
- metadata: {
104
- entityId: string;
105
- entityShortId: string;
106
- entityTitle: string | null | undefined;
107
- entityContent: string | null | undefined;
108
- commentId: string;
109
- commentContent: string | null | undefined;
110
- initiatorId: string;
111
- initiatorName: string | null | undefined;
112
- initiatorUsername: string | null | undefined;
113
- initiatorAvatar: string | null | undefined;
114
- };
115
- }
116
- export interface EntityReactionNotification extends BaseAppNotification {
117
- type: "entity-reaction";
118
- action: "open-entity";
119
- metadata: {
120
- entityId: string;
121
- entityShortId: string;
122
- entityTitle: string | null | undefined;
123
- entityContent: string | null | undefined;
124
- reactionType: string;
125
- initiatorId: string;
126
- initiatorName: string | null | undefined;
127
- initiatorUsername: string | null | undefined;
128
- initiatorAvatar: string | null | undefined;
129
- };
130
- }
131
- export interface CommentReactionNotification extends BaseAppNotification {
132
- type: "comment-reaction";
133
- action: "open-comment";
134
- metadata: {
135
- entityId: string;
136
- entityShortId: string;
137
- entityTitle: string | null | undefined;
138
- entityContent: string | null | undefined;
139
- commentId: string;
140
- commentContent: string | null | undefined;
141
- reactionType: string;
142
- initiatorId: string;
143
- initiatorName: string | null | undefined;
144
- initiatorUsername: string | null | undefined;
145
- initiatorAvatar: string | null | undefined;
146
- };
147
- }
148
- interface MilestoneUser {
149
- id: string;
150
- name: string | null | undefined;
151
- username: string | null | undefined;
152
- avatar: string | null | undefined;
153
- }
154
- export interface EntityReactionMilestoneSpecificNotification extends BaseAppNotification {
155
- type: "entity-reaction-milestone-specific";
156
- action: "open-entity";
157
- metadata: {
158
- entityId: string;
159
- entityShortId: string;
160
- entityTitle: string | null | undefined;
161
- entityContent: string | null | undefined;
162
- reactionType: string;
163
- milestoneCount: number;
164
- lastThreeUsers: MilestoneUser[];
165
- };
166
- }
167
- export interface EntityReactionMilestoneTotalNotification extends BaseAppNotification {
168
- type: "entity-reaction-milestone-total";
169
- action: "open-entity";
170
- metadata: {
171
- entityId: string;
172
- entityShortId: string;
173
- entityTitle: string | null | undefined;
174
- entityContent: string | null | undefined;
175
- milestoneCount: number;
176
- reactionCounts: Record<string, number>;
177
- lastThreeUsers: MilestoneUser[];
178
- };
179
- }
180
- export interface CommentReactionMilestoneSpecificNotification extends BaseAppNotification {
181
- type: "comment-reaction-milestone-specific";
182
- action: "open-comment";
183
- metadata: {
184
- entityId: string;
185
- entityShortId: string;
186
- entityTitle: string | null | undefined;
187
- entityContent: string | null | undefined;
188
- commentId: string;
189
- commentContent: string | null | undefined;
190
- reactionType: string;
191
- milestoneCount: number;
192
- lastThreeUsers: MilestoneUser[];
193
- };
194
- }
195
- export interface CommentReactionMilestoneTotalNotification extends BaseAppNotification {
196
- type: "comment-reaction-milestone-total";
197
- action: "open-comment";
198
- metadata: {
199
- entityId: string;
200
- entityShortId: string;
201
- entityTitle: string | null | undefined;
202
- entityContent: string | null | undefined;
203
- commentId: string;
204
- commentContent: string | null | undefined;
205
- milestoneCount: number;
206
- reactionCounts: Record<string, number>;
207
- lastThreeUsers: MilestoneUser[];
208
- };
209
- }
210
- export interface SpaceMembershipApprovedNotification extends BaseAppNotification {
211
- type: "space-membership-approved";
212
- action: "open-space";
213
- metadata: {
214
- spaceId: string;
215
- spaceName: string;
216
- spaceShortId: string;
217
- spaceSlug: string | null | undefined;
218
- spaceAvatar: string | null | undefined;
219
- };
220
- }
221
- export interface NewFollowNotification extends BaseAppNotification {
222
- type: "new-follow";
223
- action: "open-profile";
224
- metadata: {
225
- initiatorId: string;
226
- initiatorName: string | null | undefined;
227
- initiatorUsername: string | null | undefined;
228
- initiatorAvatar: string | null | undefined;
229
- };
230
- }
231
- export interface ConnectionRequestNotification extends BaseAppNotification {
232
- type: "connection-request";
233
- action: "open-profile";
234
- metadata: {
235
- connectionId: string;
236
- initiatorId: string;
237
- initiatorName: string | null | undefined;
238
- initiatorUsername: string | null | undefined;
239
- initiatorAvatar: string | null | undefined;
240
- };
241
- }
242
- export interface ConnectionAcceptedNotification extends BaseAppNotification {
243
- type: "connection-accepted";
244
- action: "open-profile";
245
- metadata: {
246
- connectionId: string;
247
- initiatorId: string;
248
- initiatorName: string | null | undefined;
249
- initiatorUsername: string | null | undefined;
250
- initiatorAvatar: string | null | undefined;
251
- };
252
- }
253
- export type UnifiedAppNotification = SystemNotification | EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | EntityReactionNotification | CommentReactionNotification | EntityReactionMilestoneSpecificNotification | EntityReactionMilestoneTotalNotification | CommentReactionMilestoneSpecificNotification | CommentReactionMilestoneTotalNotification | NewFollowNotification | ConnectionRequestNotification | ConnectionAcceptedNotification | SpaceMembershipApprovedNotification;
254
- export type PotentiallyPopulatedUnifiedAppNotification = UnifiedAppNotification & {
255
- title?: string;
256
- content?: string;
257
- };
258
- export {};
@@ -1,40 +0,0 @@
1
- import { GrantSummary } from "./ReputationGrant";
2
- import { GifData } from "./Comment";
3
- import { File } from "./File";
4
- import { Mention } from "./Mention";
5
- import { User } from "./User";
6
- export interface ChatMessage {
7
- id: string;
8
- projectId: string;
9
- conversationId: string;
10
- userId: string | null;
11
- content: string | null;
12
- gif: GifData | null;
13
- mentions: Mention[];
14
- files?: File[];
15
- metadata: Record<string, any>;
16
- parentMessageId: string | null;
17
- quotedMessageId: string | null;
18
- threadReplyCount: number;
19
- reactionCounts: Record<string, number>;
20
- userReactions: string[];
21
- /**
22
- * Reputation-grant summary. Opt-in — present exactly when the read requested
23
- * `include=grants`. Once requested the server always returns the object,
24
- * zero-filled rather than omitted, on projects with no grants and on projects
25
- * without the reputation bundle alike.
26
- */
27
- grants?: GrantSummary;
28
- editedAt: string | null;
29
- userDeletedAt: string | null;
30
- moderationStatus: "approved" | "removed" | null;
31
- moderatedAt: string | null;
32
- moderatedById: string | null;
33
- moderatedByType: "client" | "user" | null;
34
- moderationReason: string | null;
35
- createdAt: string;
36
- updatedAt: string;
37
- user: User | null;
38
- quotedMessage?: ChatMessage | null;
39
- parentMessage?: ChatMessage | null;
40
- }
@@ -1,10 +0,0 @@
1
- export interface Collection {
2
- id: string;
3
- projectId: string;
4
- userId: string;
5
- parentId: string | null;
6
- name: string;
7
- entityCount: number;
8
- createdAt: string;
9
- updatedAt: string;
10
- }
@@ -1,50 +0,0 @@
1
- import { GrantSummary } from "./ReputationGrant";
2
- import { Entity } from "./Entity";
3
- import { Mention } from "./Mention";
4
- import { User } from "./User";
5
- import { ReactionCounts, ReactionType } from "./Reaction";
6
- export interface GifData {
7
- id: string;
8
- url: string;
9
- gifUrl: string;
10
- gifPreviewUrl: string;
11
- altText: string;
12
- aspectRatio: string;
13
- }
14
- export interface Comment {
15
- id: string;
16
- projectId: string;
17
- foreignId: string | null;
18
- entityId: string;
19
- entity?: Entity;
20
- userId: string;
21
- user?: User;
22
- parentId: string | null;
23
- parentComment?: Comment;
24
- content: string | null;
25
- gif: GifData | null;
26
- mentions: Mention[];
27
- upvotes: string[];
28
- downvotes: string[];
29
- reactionCounts: ReactionCounts;
30
- userReaction?: ReactionType | null;
31
- repliesCount: number;
32
- /**
33
- * Reputation-grant summary. Opt-in — present exactly when the read requested
34
- * `include=grants`. Once requested the server always returns the object,
35
- * zero-filled rather than omitted, on projects with no grants and on projects
36
- * without the reputation bundle alike.
37
- */
38
- grants?: GrantSummary;
39
- metadata: Record<string, any>;
40
- createdAt: string;
41
- updatedAt: string;
42
- deletedAt: string | null;
43
- parentDeletedAt: string | null;
44
- userDeletedAt: string | null;
45
- moderationStatus: "approved" | "removed" | null;
46
- moderatedAt: string | null;
47
- moderatedById: string | null;
48
- moderatedByType: "client" | "user" | null;
49
- moderationReason: string | null;
50
- }
@@ -1,67 +0,0 @@
1
- import { User } from "./User";
2
- export interface Connection {
3
- id: string;
4
- message?: string;
5
- createdAt: string;
6
- }
7
- /** Returned by `POST /users/:userId/connection` (requestConnection). */
8
- export interface ConnectionRequestResponse {
9
- id: string;
10
- status: string;
11
- createdAt: string;
12
- }
13
- export interface EstablishedConnection {
14
- id: string;
15
- connectedUser: User;
16
- connectedAt: string;
17
- }
18
- export interface PendingConnection extends Connection {
19
- user: User;
20
- type: "received" | "sent";
21
- }
22
- export interface ConnectionRequestParams {
23
- userId: string;
24
- message?: string;
25
- }
26
- export interface ConnectionActionResponse {
27
- id: string;
28
- status: string;
29
- createdAt?: string;
30
- respondedAt?: string;
31
- }
32
- export interface ConnectionWithdrawResponse {
33
- message: string;
34
- }
35
- export interface ConnectionCountResponse {
36
- count: number;
37
- }
38
- export interface RemoveConnectionByUserIdResponse {
39
- id?: string;
40
- status?: string;
41
- respondedAt?: string;
42
- message?: string;
43
- action?: "withdraw" | "disconnect" | "decline";
44
- }
45
- export interface ConnectionStatusNone {
46
- status: "none";
47
- }
48
- export interface ConnectionStatusPending {
49
- status: "pending";
50
- type: "sent" | "received";
51
- connectionId: string;
52
- createdAt: string;
53
- }
54
- export interface ConnectionStatusConnected {
55
- status: "connected";
56
- connectionId: string;
57
- connectedAt: string;
58
- requestedAt: string;
59
- }
60
- export interface ConnectionStatusDeclined {
61
- status: "declined";
62
- type: "sent" | "received";
63
- connectionId: string;
64
- respondedAt: string;
65
- }
66
- export type ConnectionStatusResponse = ConnectionStatusNone | ConnectionStatusPending | ConnectionStatusConnected | ConnectionStatusDeclined;
67
- export type ConnectionStatus = "none" | "pending-sent" | "pending-received" | "connected" | "declined-sent" | "declined-received";