@sublay/js 5.0.0 → 7.0.0

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 (211) hide show
  1. package/README.md +33 -4
  2. package/dist/core/client.d.ts +58 -2
  3. package/dist/core/multipart.d.ts +22 -0
  4. package/dist/index.d.mts +2525 -42
  5. package/dist/index.d.ts +29 -2
  6. package/dist/index.js +1746 -37
  7. package/dist/index.mjs +1746 -37
  8. package/dist/interfaces/AppNotification.d.ts +258 -0
  9. package/dist/interfaces/ChatMessage.d.ts +32 -0
  10. package/dist/interfaces/Collection.d.ts +10 -0
  11. package/dist/interfaces/Comment.d.ts +42 -0
  12. package/dist/interfaces/Connection.d.ts +67 -0
  13. package/dist/interfaces/Conversation.d.ts +25 -0
  14. package/dist/interfaces/ConversationMember.d.ts +16 -0
  15. package/dist/interfaces/Entity.d.ts +53 -0
  16. package/dist/interfaces/File.d.ts +39 -0
  17. package/dist/interfaces/Follow.d.ts +19 -0
  18. package/dist/interfaces/HostedApp.d.ts +11 -0
  19. package/dist/interfaces/ImageProcessing.d.ts +62 -0
  20. package/dist/interfaces/Mention.d.ts +12 -0
  21. package/dist/interfaces/OAuthIdentity.d.ts +13 -0
  22. package/dist/interfaces/Project.d.ts +14 -0
  23. package/dist/interfaces/Reaction.d.ts +23 -0
  24. package/dist/interfaces/Report.d.ts +32 -0
  25. package/dist/interfaces/Rule.d.ts +22 -0
  26. package/dist/interfaces/Space.d.ts +141 -0
  27. package/dist/interfaces/SpaceMember.d.ts +29 -0
  28. package/dist/interfaces/User.d.ts +39 -0
  29. package/dist/modules/app-notifications/countUnreadNotifications.d.ts +2 -0
  30. package/dist/modules/app-notifications/fetchNotifications.d.ts +8 -0
  31. package/dist/modules/app-notifications/index.d.ts +4 -0
  32. package/dist/modules/app-notifications/markAllNotificationsAsRead.d.ts +5 -0
  33. package/dist/modules/app-notifications/markNotificationAsRead.d.ts +5 -0
  34. package/dist/modules/auth/changePassword.d.ts +11 -0
  35. package/dist/modules/auth/index.d.ts +10 -0
  36. package/dist/modules/auth/requestNewAccessToken.d.ts +16 -0
  37. package/dist/modules/auth/requestPasswordReset.d.ts +5 -0
  38. package/dist/modules/auth/resetPassword.d.ts +6 -0
  39. package/dist/modules/auth/sendVerificationEmail.d.ts +13 -0
  40. package/dist/modules/auth/signIn.d.ts +12 -0
  41. package/dist/modules/auth/signOut.d.ts +9 -0
  42. package/dist/modules/auth/signUp.d.ts +24 -0
  43. package/dist/modules/auth/verifyEmail.d.ts +5 -0
  44. package/dist/modules/auth/verifyExternalUser.d.ts +11 -0
  45. package/dist/modules/chat/addMember.d.ts +8 -0
  46. package/dist/modules/chat/changeMemberRole.d.ts +9 -0
  47. package/dist/modules/chat/createDirectConversation.d.ts +7 -0
  48. package/dist/modules/chat/createGroupConversation.d.ts +10 -0
  49. package/dist/modules/chat/deleteConversation.d.ts +8 -0
  50. package/dist/modules/chat/deleteMessage.d.ts +11 -0
  51. package/dist/modules/chat/editMessage.d.ts +13 -0
  52. package/dist/modules/chat/getConversation.d.ts +6 -0
  53. package/dist/modules/chat/getMessage.d.ts +7 -0
  54. package/dist/modules/chat/getUnreadCount.d.ts +6 -0
  55. package/dist/modules/chat/index.d.ts +21 -0
  56. package/dist/modules/chat/leaveConversation.d.ts +7 -0
  57. package/dist/modules/chat/listConversations.d.ts +17 -0
  58. package/dist/modules/chat/listMembers.d.ts +10 -0
  59. package/dist/modules/chat/listMessages.d.ts +23 -0
  60. package/dist/modules/chat/listReactions.d.ts +27 -0
  61. package/dist/modules/chat/markAsRead.d.ts +9 -0
  62. package/dist/modules/chat/removeMember.d.ts +9 -0
  63. package/dist/modules/chat/reportMessage.d.ts +12 -0
  64. package/dist/modules/chat/sendMessage.d.ts +21 -0
  65. package/dist/modules/chat/toggleReaction.d.ts +16 -0
  66. package/dist/modules/chat/updateConversation.d.ts +12 -0
  67. package/dist/modules/collections/addEntityToCollection.d.ts +13 -0
  68. package/dist/modules/collections/createNewCollection.d.ts +8 -0
  69. package/dist/modules/collections/deleteCollection.d.ts +5 -0
  70. package/dist/modules/collections/fetchCollectionEntities.d.ts +13 -0
  71. package/dist/modules/collections/fetchRootCollection.d.ts +3 -0
  72. package/dist/modules/collections/fetchSubCollections.d.ts +6 -0
  73. package/dist/modules/collections/index.d.ts +8 -0
  74. package/dist/modules/collections/removeEntityFromCollection.d.ts +7 -0
  75. package/dist/modules/collections/updateCollection.d.ts +7 -0
  76. package/dist/modules/comments/addReaction.d.ts +8 -0
  77. package/dist/modules/comments/createComment.d.ts +15 -0
  78. package/dist/modules/comments/deleteComment.d.ts +5 -0
  79. package/dist/modules/comments/fetchComment.d.ts +3 -1
  80. package/dist/modules/comments/fetchCommentByForeignId.d.ts +3 -1
  81. package/dist/modules/comments/fetchManyComments.d.ts +14 -0
  82. package/dist/modules/comments/fetchReactions.d.ts +20 -0
  83. package/dist/modules/comments/getUserReaction.d.ts +9 -0
  84. package/dist/modules/comments/index.d.ts +10 -3
  85. package/dist/modules/comments/removeReaction.d.ts +6 -0
  86. package/dist/modules/comments/updateComment.d.ts +7 -0
  87. package/dist/modules/connections/acceptConnection.d.ts +6 -0
  88. package/dist/modules/connections/declineConnection.d.ts +6 -0
  89. package/dist/modules/connections/fetchConnections.d.ts +8 -0
  90. package/dist/modules/connections/fetchConnectionsCount.d.ts +3 -0
  91. package/dist/modules/connections/fetchReceivedPendingConnections.d.ts +8 -0
  92. package/dist/modules/connections/fetchSentPendingConnections.d.ts +8 -0
  93. package/dist/modules/connections/index.d.ts +7 -0
  94. package/dist/modules/connections/removeConnection.d.ts +5 -0
  95. package/dist/modules/entities/addReaction.d.ts +8 -0
  96. package/dist/modules/entities/createEntity.d.ts +7 -2
  97. package/dist/modules/entities/deleteEntity.d.ts +1 -1
  98. package/dist/modules/entities/fetchDrafts.d.ts +11 -0
  99. package/dist/modules/entities/fetchEntity.d.ts +3 -1
  100. package/dist/modules/entities/fetchEntityByForeignId.d.ts +3 -1
  101. package/dist/modules/entities/fetchEntityByShortId.d.ts +3 -1
  102. package/dist/modules/entities/fetchManyEntities.d.ts +11 -3
  103. package/dist/modules/entities/fetchReactions.d.ts +20 -0
  104. package/dist/modules/entities/fetchTopComment.d.ts +6 -0
  105. package/dist/modules/entities/getUserReaction.d.ts +9 -0
  106. package/dist/modules/entities/index.d.ts +15 -8
  107. package/dist/modules/entities/isEntitySaved.d.ts +12 -0
  108. package/dist/modules/entities/publishDraft.d.ts +6 -0
  109. package/dist/modules/entities/removeReaction.d.ts +6 -0
  110. package/dist/modules/entities/updateEntity.d.ts +6 -7
  111. package/dist/modules/follows/deleteFollow.d.ts +5 -0
  112. package/dist/modules/follows/fetchFollowers.d.ts +8 -0
  113. package/dist/modules/follows/fetchFollowersCount.d.ts +5 -0
  114. package/dist/modules/follows/fetchFollowing.d.ts +8 -0
  115. package/dist/modules/follows/fetchFollowingCount.d.ts +5 -0
  116. package/dist/modules/follows/index.d.ts +5 -0
  117. package/dist/modules/oauth/authorize.d.ts +25 -0
  118. package/dist/modules/oauth/index.d.ts +4 -0
  119. package/dist/modules/oauth/linkIdentity.d.ts +14 -0
  120. package/dist/modules/oauth/listIdentities.d.ts +4 -0
  121. package/dist/modules/oauth/unlinkIdentity.d.ts +12 -0
  122. package/dist/modules/reports/createReport.d.ts +9 -0
  123. package/dist/modules/reports/fetchModeratedReports.d.ts +12 -0
  124. package/dist/modules/reports/index.d.ts +2 -0
  125. package/dist/modules/search/askContent.d.ts +51 -0
  126. package/dist/modules/search/index.d.ts +4 -0
  127. package/dist/modules/search/searchContent.d.ts +17 -0
  128. package/dist/modules/search/searchSpaces.d.ts +11 -0
  129. package/dist/modules/search/searchUsers.d.ts +11 -0
  130. package/dist/modules/spaces/approveMembership.d.ts +7 -0
  131. package/dist/modules/spaces/banMember.d.ts +13 -0
  132. package/dist/modules/spaces/checkMyMembership.d.ts +6 -0
  133. package/dist/modules/spaces/checkSlugAvailability.d.ts +8 -0
  134. package/dist/modules/spaces/createRule.d.ts +8 -0
  135. package/dist/modules/spaces/createSpace.d.ts +13 -0
  136. package/dist/modules/spaces/declineMembership.d.ts +7 -0
  137. package/dist/modules/spaces/deleteRule.d.ts +7 -0
  138. package/dist/modules/spaces/deleteSpace.d.ts +6 -0
  139. package/dist/modules/spaces/fetchChildSpaces.d.ts +11 -0
  140. package/dist/modules/spaces/fetchDigestConfig.d.ts +6 -0
  141. package/dist/modules/spaces/fetchManyRules.d.ts +6 -0
  142. package/dist/modules/spaces/fetchManySpaces.d.ts +16 -0
  143. package/dist/modules/spaces/fetchRule.d.ts +7 -0
  144. package/dist/modules/spaces/fetchSpace.d.ts +6 -0
  145. package/dist/modules/spaces/fetchSpaceBreadcrumb.d.ts +6 -0
  146. package/dist/modules/spaces/fetchSpaceByShortId.d.ts +6 -0
  147. package/dist/modules/spaces/fetchSpaceBySlug.d.ts +6 -0
  148. package/dist/modules/spaces/fetchSpaceMembers.d.ts +10 -0
  149. package/dist/modules/spaces/fetchSpaceTeam.d.ts +6 -0
  150. package/dist/modules/spaces/fetchUserSpaces.d.ts +11 -0
  151. package/dist/modules/spaces/getSpaceConversation.d.ts +6 -0
  152. package/dist/modules/spaces/handleCommentReport.d.ts +14 -0
  153. package/dist/modules/spaces/handleEntityReport.d.ts +17 -0
  154. package/dist/modules/spaces/handleSpaceChatReport.d.ts +18 -0
  155. package/dist/modules/spaces/index.d.ts +36 -0
  156. package/dist/modules/spaces/joinSpace.d.ts +6 -0
  157. package/dist/modules/spaces/leaveSpace.d.ts +6 -0
  158. package/dist/modules/spaces/moderateSpaceChatMessage.d.ts +12 -0
  159. package/dist/modules/spaces/moderateSpaceComment.d.ts +9 -0
  160. package/dist/modules/spaces/moderateSpaceEntity.d.ts +12 -0
  161. package/dist/modules/spaces/reorderRules.d.ts +7 -0
  162. package/dist/modules/spaces/unbanMember.d.ts +13 -0
  163. package/dist/modules/spaces/updateDigestConfig.d.ts +11 -0
  164. package/dist/modules/spaces/updateMemberRole.d.ts +8 -0
  165. package/dist/modules/spaces/updateRule.d.ts +9 -0
  166. package/dist/modules/spaces/updateSpace.d.ts +12 -0
  167. package/dist/modules/storage/deleteFile.d.ts +5 -0
  168. package/dist/modules/storage/getFile.d.ts +34 -0
  169. package/dist/modules/storage/index.d.ts +4 -0
  170. package/dist/modules/storage/uploadFile.d.ts +30 -0
  171. package/dist/modules/storage/uploadImage.d.ts +41 -0
  172. package/dist/modules/users/checkUsernameAvailability.d.ts +8 -0
  173. package/dist/modules/users/createFollow.d.ts +7 -0
  174. package/dist/modules/users/deleteFollow.d.ts +6 -0
  175. package/dist/modules/users/fetchConnectionStatus.d.ts +10 -0
  176. package/dist/modules/users/fetchConnectionsByUserId.d.ts +9 -0
  177. package/dist/modules/users/fetchConnectionsCountByUserId.d.ts +6 -0
  178. package/dist/modules/users/fetchFollowStatus.d.ts +14 -0
  179. package/dist/modules/users/fetchFollowersByUserId.d.ts +9 -0
  180. package/dist/modules/users/fetchFollowersCountByUserId.d.ts +8 -0
  181. package/dist/modules/users/fetchFollowingByUserId.d.ts +9 -0
  182. package/dist/modules/users/fetchFollowingCountByUserId.d.ts +8 -0
  183. package/dist/modules/users/fetchUserByForeignId.d.ts +3 -7
  184. package/dist/modules/users/fetchUserById.d.ts +3 -1
  185. package/dist/modules/users/fetchUserByUsername.d.ts +7 -0
  186. package/dist/modules/users/fetchUserSuggestions.d.ts +6 -0
  187. package/dist/modules/users/index.d.ts +18 -3
  188. package/dist/modules/users/removeConnectionByUserId.d.ts +10 -0
  189. package/dist/modules/users/requestConnection.d.ts +11 -0
  190. package/dist/modules/users/updateUser.d.ts +32 -0
  191. package/package.json +6 -3
  192. package/CLAUDE.md +0 -339
  193. package/pnpm-workspace.yaml +0 -2
  194. package/src/core/client.ts +0 -15
  195. package/src/index.ts +0 -45
  196. package/src/interfaces/IPaginatedResponse.ts +0 -12
  197. package/src/modules/comments/fetchComment.ts +0 -14
  198. package/src/modules/comments/fetchCommentByForeignId.ts +0 -14
  199. package/src/modules/comments/index.ts +0 -4
  200. package/src/modules/entities/createEntity.ts +0 -27
  201. package/src/modules/entities/deleteEntity.ts +0 -14
  202. package/src/modules/entities/fetchEntity.ts +0 -14
  203. package/src/modules/entities/fetchEntityByForeignId.ts +0 -15
  204. package/src/modules/entities/fetchEntityByShortId.ts +0 -14
  205. package/src/modules/entities/fetchManyEntities.ts +0 -79
  206. package/src/modules/entities/index.ts +0 -17
  207. package/src/modules/entities/updateEntity.ts +0 -28
  208. package/src/modules/users/fetchUserByForeignId.ts +0 -40
  209. package/src/modules/users/fetchUserById.ts +0 -15
  210. package/src/modules/users/index.ts +0 -4
  211. package/tsconfig.json +0 -14
@@ -0,0 +1,23 @@
1
+ import { User } from "./User";
2
+ export type ReactionType = "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
3
+ export interface ReactionCounts {
4
+ upvote: number;
5
+ downvote: number;
6
+ like: number;
7
+ love: number;
8
+ wow: number;
9
+ sad: number;
10
+ angry: number;
11
+ funny: number;
12
+ }
13
+ export interface Reaction {
14
+ id: string;
15
+ projectId: string;
16
+ targetType: "entity" | "comment";
17
+ targetId: string;
18
+ userId: string;
19
+ reactionType: ReactionType;
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ user?: User;
23
+ }
@@ -0,0 +1,32 @@
1
+ import { Entity } from "./Entity";
2
+ import { Comment } from "./Comment";
3
+ import { Space } from "./Space";
4
+ export type ReportTargetType = "entity" | "comment";
5
+ export type ReportStatus = "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
6
+ export interface UserReport {
7
+ id: string;
8
+ projectId: string;
9
+ reportId: string;
10
+ userId: string;
11
+ reason: string;
12
+ details: string | null;
13
+ createdAt: string;
14
+ }
15
+ export interface Report {
16
+ id: string;
17
+ projectId: string;
18
+ spaceId: string | null;
19
+ targetId: string;
20
+ targetType: ReportTargetType;
21
+ status: ReportStatus;
22
+ reporterCount: number;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ userReports?: UserReport[];
26
+ target?: Entity | Comment | null;
27
+ space?: Space | null;
28
+ }
29
+ export interface CreateReportResponse {
30
+ message: string;
31
+ code: "report/created" | "report/updated" | "report/already-reported";
32
+ }
@@ -0,0 +1,22 @@
1
+ export interface Rule {
2
+ id: string;
3
+ projectId: string;
4
+ spaceId: string;
5
+ title: string;
6
+ description: string | null;
7
+ order: number;
8
+ lastApprovedBy: string | null;
9
+ createdAt: string;
10
+ updatedAt: string;
11
+ }
12
+ export interface FetchManyRulesResponse {
13
+ data: Rule[];
14
+ count: number;
15
+ }
16
+ export interface DeleteRuleResponse {
17
+ message: string;
18
+ deletedRule: {
19
+ id: string;
20
+ title: string;
21
+ };
22
+ }
@@ -0,0 +1,141 @@
1
+ import { PaginatedResponse } from "./IPaginatedResponse";
2
+ import { File } from "./File";
3
+ export type ReadingPermission = "anyone" | "members";
4
+ export type PostingPermission = "anyone" | "members" | "admins";
5
+ export type SpaceMemberRole = "admin" | "moderator" | "member";
6
+ export type SpaceMemberStatus = "pending" | "active" | "banned" | "rejected";
7
+ export interface SpaceMemberPermissions {
8
+ isAdmin: boolean;
9
+ isModerator: boolean;
10
+ isMember: boolean;
11
+ status: "pending" | "active" | "banned" | null;
12
+ canPost: boolean;
13
+ canModerate: boolean;
14
+ canRead: boolean;
15
+ }
16
+ export interface SpacePreview {
17
+ id: string;
18
+ shortId: string;
19
+ name: string;
20
+ slug: string | null;
21
+ avatarFileId: string | null;
22
+ readingPermission?: ReadingPermission;
23
+ parentSpaceId?: string | null;
24
+ depth?: number;
25
+ avatarFile?: File;
26
+ }
27
+ export interface Space {
28
+ id: string;
29
+ projectId: string;
30
+ shortId: string;
31
+ slug: string | null;
32
+ name: string;
33
+ description: string | null;
34
+ avatarFileId: string | null;
35
+ bannerFileId: string | null;
36
+ userId: string;
37
+ readingPermission: ReadingPermission;
38
+ postingPermission: PostingPermission;
39
+ requireJoinApproval: boolean;
40
+ parentSpaceId: string | null;
41
+ depth: number;
42
+ metadata: Record<string, any>;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ deletedAt: string | null;
46
+ membersCount: number;
47
+ childSpacesCount: number;
48
+ isMember?: boolean;
49
+ avatarFile?: File;
50
+ bannerFile?: File;
51
+ }
52
+ export interface SpaceDetailed extends Space {
53
+ memberPermissions: SpaceMemberPermissions | null;
54
+ parentSpace: SpacePreview | null;
55
+ childSpaces: SpacePreview[];
56
+ }
57
+ export interface UserSpaceItem {
58
+ space: Space;
59
+ membership: {
60
+ membershipId: string;
61
+ role: SpaceMemberRole;
62
+ status: SpaceMemberStatus;
63
+ joinedAt: string;
64
+ };
65
+ }
66
+ export type UserSpacesResponse = PaginatedResponse<UserSpaceItem>;
67
+ export interface JoinSpaceResponse {
68
+ message: string;
69
+ membership: {
70
+ id: string;
71
+ spaceId: string;
72
+ userId: string;
73
+ role: "member";
74
+ status: "pending" | "active";
75
+ joinedAt: string;
76
+ };
77
+ }
78
+ export interface LeaveSpaceResponse {
79
+ message: string;
80
+ }
81
+ export interface UpdateMemberRoleResponse {
82
+ message: string;
83
+ membership: {
84
+ id: string;
85
+ role: SpaceMemberRole;
86
+ status: string;
87
+ joinedAt: string;
88
+ userId: string;
89
+ };
90
+ }
91
+ export interface ApproveMemberResponse {
92
+ message: string;
93
+ membership: {
94
+ id: string;
95
+ status: "active";
96
+ joinedAt: string;
97
+ };
98
+ }
99
+ export interface DeclineMemberResponse {
100
+ message: string;
101
+ membership: {
102
+ id: string;
103
+ status: "rejected";
104
+ };
105
+ }
106
+ export interface CheckMyMembershipResponse {
107
+ isMember: boolean;
108
+ role: "admin" | "moderator" | "member" | null;
109
+ status: "pending" | "active" | "banned" | "rejected" | null;
110
+ joinedAt: string | null;
111
+ permissions: {
112
+ canPost: boolean;
113
+ canModerate: boolean;
114
+ canRead: boolean;
115
+ isAdmin: boolean;
116
+ isModerator: boolean;
117
+ };
118
+ }
119
+ export interface DeleteSpaceResponse {
120
+ message: string;
121
+ deletedSpace: {
122
+ id: string;
123
+ name: string;
124
+ };
125
+ counts: {
126
+ entities: number;
127
+ members: number;
128
+ childSpaces: number;
129
+ };
130
+ }
131
+ export interface DigestConfig {
132
+ digestEnabled: boolean;
133
+ digestWebhookUrl: string | null;
134
+ digestWebhookSecret: string | null;
135
+ digestScheduleHour: number | null;
136
+ digestTimezone: string | null;
137
+ }
138
+ export interface SpaceBreadcrumb {
139
+ breadcrumb: SpacePreview[];
140
+ depth: number;
141
+ }
@@ -0,0 +1,29 @@
1
+ import { PaginatedResponse } from "./IPaginatedResponse";
2
+ import { SpaceMemberRole, SpaceMemberStatus } from "./Space";
3
+ export interface SpaceMember {
4
+ id: string;
5
+ projectId: string;
6
+ spaceId: string;
7
+ userId: string;
8
+ role: SpaceMemberRole;
9
+ status: SpaceMemberStatus;
10
+ joinedAt: string;
11
+ createdAt: string;
12
+ }
13
+ export interface SpaceMemberWithUser {
14
+ membershipId: string;
15
+ role: SpaceMemberRole;
16
+ status: SpaceMemberStatus;
17
+ joinedAt: string;
18
+ user: {
19
+ id: string;
20
+ username: string;
21
+ displayName: string;
22
+ avatar: string;
23
+ metadata: object;
24
+ };
25
+ }
26
+ export type SpaceMembersResponse = PaginatedResponse<SpaceMemberWithUser>;
27
+ export interface SpaceTeamResponse {
28
+ data: SpaceMemberWithUser[];
29
+ }
@@ -0,0 +1,39 @@
1
+ import { File } from "./File";
2
+ export type UserRole = "admin" | "moderator" | "visitor";
3
+ export type UserFull = {
4
+ id: string;
5
+ projectId: string;
6
+ foreignId: string | null;
7
+ role: UserRole;
8
+ email: string | null;
9
+ name: string | null;
10
+ username: string | null;
11
+ avatar: string | null;
12
+ avatarFileId: string | null;
13
+ bannerFileId: string | null;
14
+ avatarFile?: File | null;
15
+ bannerFile?: File | null;
16
+ bio: string | null;
17
+ birthdate: string | null;
18
+ location: {
19
+ type: "Point";
20
+ coordinates: [number, number];
21
+ } | null;
22
+ metadata: Record<string, any>;
23
+ secureMetadata: Record<string, any>;
24
+ reputation: number;
25
+ isVerified: boolean;
26
+ isActive: boolean;
27
+ lastActive: string;
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ };
31
+ export type AuthUser = Omit<UserFull, "secureMetadata"> & {
32
+ suspensions: {
33
+ reason: string | null;
34
+ startDate: string;
35
+ endDate: string | null;
36
+ }[];
37
+ authMethods: string[];
38
+ };
39
+ export type User = Omit<UserFull, "email" | "secureMetadata" | "isVerified" | "isActive" | "lastActive" | "updatedAt">;
@@ -0,0 +1,2 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export declare function countUnreadNotifications(client: SublayHttpClient): Promise<number>;
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { UnifiedAppNotification } from "../../interfaces/AppNotification";
3
+ import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
4
+ export interface FetchNotificationsProps {
5
+ page?: number;
6
+ limit?: number;
7
+ }
8
+ export declare function fetchNotifications(client: SublayHttpClient, data?: FetchNotificationsProps): Promise<PaginatedResponse<UnifiedAppNotification>>;
@@ -0,0 +1,4 @@
1
+ export { fetchNotifications } from "./fetchNotifications";
2
+ export { countUnreadNotifications } from "./countUnreadNotifications";
3
+ export { markNotificationAsRead } from "./markNotificationAsRead";
4
+ export { markAllNotificationsAsRead } from "./markAllNotificationsAsRead";
@@ -0,0 +1,5 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface MarkAllNotificationsAsReadResponse {
3
+ markedAsRead: number;
4
+ }
5
+ export declare function markAllNotificationsAsRead(client: SublayHttpClient): Promise<MarkAllNotificationsAsReadResponse>;
@@ -0,0 +1,5 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface MarkNotificationAsReadProps {
3
+ notificationId: string;
4
+ }
5
+ export declare function markNotificationAsRead(client: SublayHttpClient, data: MarkNotificationAsReadProps): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface ChangePasswordProps {
3
+ /** The user's current password (verified before the change). */
4
+ password: string;
5
+ newPassword: string;
6
+ }
7
+ export interface ChangePasswordResponse {
8
+ success: boolean;
9
+ message: string;
10
+ }
11
+ export declare function changePassword(client: SublayHttpClient, data: ChangePasswordProps): Promise<ChangePasswordResponse>;
@@ -0,0 +1,10 @@
1
+ export { signUp } from "./signUp";
2
+ export { signIn } from "./signIn";
3
+ export { signOut } from "./signOut";
4
+ export { requestNewAccessToken } from "./requestNewAccessToken";
5
+ export { verifyExternalUser } from "./verifyExternalUser";
6
+ export { requestPasswordReset } from "./requestPasswordReset";
7
+ export { resetPassword } from "./resetPassword";
8
+ export { changePassword } from "./changePassword";
9
+ export { verifyEmail } from "./verifyEmail";
10
+ export { sendVerificationEmail } from "./sendVerificationEmail";
@@ -0,0 +1,16 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface RequestNewAccessTokenProps {
3
+ /** Defaults to the SDK's stored refresh token (SDK-managed mode). */
4
+ refreshToken?: string;
5
+ }
6
+ export interface RequestNewAccessTokenResponse {
7
+ accessToken: string;
8
+ /** The server rotates the refresh token on every refresh and returns the new one. */
9
+ refreshToken?: string;
10
+ }
11
+ /**
12
+ * Manually rotate the access token. The SDK auto-refreshes on 403 in
13
+ * SDK-managed mode, so this is rarely needed directly; it's exposed for parity
14
+ * and for host-managed callers that own their own refresh flow.
15
+ */
16
+ export declare function requestNewAccessToken(client: SublayHttpClient, data?: RequestNewAccessTokenProps): Promise<RequestNewAccessTokenResponse>;
@@ -0,0 +1,5 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface RequestPasswordResetProps {
3
+ email: string;
4
+ }
5
+ export declare function requestPasswordReset(client: SublayHttpClient, data: RequestPasswordResetProps): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface ResetPasswordProps {
3
+ token: string;
4
+ newPassword: string;
5
+ }
6
+ export declare function resetPassword(client: SublayHttpClient, data: ResetPasswordProps): Promise<void>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface SendVerificationEmailProps {
3
+ /** "code" emails a short token; "link" emails a verification URL. Defaults to "code". */
4
+ mode?: "code" | "link";
5
+ tokenFormat?: "hex" | "numeric" | "alpha" | "alphanumeric";
6
+ tokenLength?: number;
7
+ /** For mode "link": where to send the user after the link is verified. */
8
+ redirectUrl?: string;
9
+ }
10
+ export interface SendVerificationEmailResponse {
11
+ success: boolean;
12
+ }
13
+ export declare function sendVerificationEmail(client: SublayHttpClient, data?: SendVerificationEmailProps): Promise<SendVerificationEmailResponse>;
@@ -0,0 +1,12 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { AuthUser } from "../../interfaces/User";
3
+ export interface SignInProps {
4
+ email: string;
5
+ password: string;
6
+ }
7
+ export interface SignInResponse {
8
+ user: AuthUser;
9
+ accessToken: string;
10
+ refreshToken: string;
11
+ }
12
+ export declare function signIn(client: SublayHttpClient, data: SignInProps): Promise<SignInResponse>;
@@ -0,0 +1,9 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface SignOutProps {
3
+ /**
4
+ * Defaults to the SDK's stored refresh token (SDK-managed mode). Pass it
5
+ * explicitly in host-managed mode, where the SDK holds no refresh token.
6
+ */
7
+ refreshToken?: string;
8
+ }
9
+ export declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<void>;
@@ -0,0 +1,24 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { AuthUser } from "../../interfaces/User";
3
+ export interface SignUpProps {
4
+ email: string;
5
+ password: string;
6
+ name?: string;
7
+ username?: string;
8
+ avatar?: string;
9
+ bio?: string;
10
+ location?: {
11
+ latitude: number;
12
+ longitude: number;
13
+ };
14
+ /** ISO 8601 datetime string. */
15
+ birthdate?: string;
16
+ metadata?: Record<string, any>;
17
+ secureMetadata?: Record<string, any>;
18
+ }
19
+ export interface SignUpResponse {
20
+ user: AuthUser;
21
+ accessToken: string;
22
+ refreshToken: string;
23
+ }
24
+ export declare function signUp(client: SublayHttpClient, data: SignUpProps): Promise<SignUpResponse>;
@@ -0,0 +1,5 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface VerifyEmailProps {
3
+ token: string;
4
+ }
5
+ export declare function verifyEmail(client: SublayHttpClient, data: VerifyEmailProps): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { AuthUser } from "../../interfaces/User";
3
+ export interface VerifyExternalUserProps {
4
+ userJwt: string;
5
+ }
6
+ export interface VerifyExternalUserResponse {
7
+ user: AuthUser;
8
+ accessToken: string;
9
+ refreshToken: string;
10
+ }
11
+ export declare function verifyExternalUser(client: SublayHttpClient, data: VerifyExternalUserProps): Promise<VerifyExternalUserResponse>;
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ConversationMember } from "../../interfaces/ConversationMember";
3
+ export interface AddMemberProps {
4
+ conversationId: string;
5
+ /** The member to add (the target). */
6
+ userId: string;
7
+ }
8
+ export declare function addMember(client: SublayHttpClient, data: AddMemberProps): Promise<ConversationMember>;
@@ -0,0 +1,9 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ConversationMember, ConversationMemberRole } from "../../interfaces/ConversationMember";
3
+ export interface ChangeMemberRoleProps {
4
+ conversationId: string;
5
+ /** The member whose role changes (the target). */
6
+ userId: string;
7
+ role: ConversationMemberRole;
8
+ }
9
+ export declare function changeMemberRole(client: SublayHttpClient, data: ChangeMemberRoleProps): Promise<ConversationMember>;
@@ -0,0 +1,7 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Conversation } from "../../interfaces/Conversation";
3
+ export interface CreateDirectConversationProps {
4
+ /** The other participant (the target). */
5
+ userId: string;
6
+ }
7
+ export declare function createDirectConversation(client: SublayHttpClient, data: CreateDirectConversationProps): Promise<Conversation>;
@@ -0,0 +1,10 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Conversation } from "../../interfaces/Conversation";
3
+ export interface CreateGroupConversationProps {
4
+ name?: string;
5
+ description?: string;
6
+ /** Member user IDs to add to the group. Defaults to []. */
7
+ memberIds?: string[];
8
+ metadata?: Record<string, any>;
9
+ }
10
+ export declare function createGroupConversation(client: SublayHttpClient, data: CreateGroupConversationProps): Promise<Conversation>;
@@ -0,0 +1,8 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface DeleteConversationProps {
3
+ conversationId: string;
4
+ }
5
+ export interface DeleteConversationResponse {
6
+ message: string;
7
+ }
8
+ export declare function deleteConversation(client: SublayHttpClient, data: DeleteConversationProps): Promise<DeleteConversationResponse>;
@@ -0,0 +1,11 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface DeleteMessageProps {
3
+ conversationId: string;
4
+ messageId: string;
5
+ }
6
+ export interface DeleteMessageResponse {
7
+ message: string;
8
+ /** Present when the author soft-deletes their own message. */
9
+ userDeletedAt?: string;
10
+ }
11
+ export declare function deleteMessage(client: SublayHttpClient, data: DeleteMessageProps): Promise<DeleteMessageResponse>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ChatMessage } from "../../interfaces/ChatMessage";
3
+ import { Mention } from "../../interfaces/Mention";
4
+ export interface EditMessageProps {
5
+ conversationId: string;
6
+ messageId: string;
7
+ content?: string;
8
+ /** A GIF URL, or null to clear it. */
9
+ gif?: string | null;
10
+ mentions?: Mention[];
11
+ metadata?: Record<string, any> | null;
12
+ }
13
+ export declare function editMessage(client: SublayHttpClient, data: EditMessageProps): Promise<ChatMessage>;
@@ -0,0 +1,6 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Conversation } from "../../interfaces/Conversation";
3
+ export interface GetConversationProps {
4
+ conversationId: string;
5
+ }
6
+ export declare function getConversation(client: SublayHttpClient, data: GetConversationProps): Promise<Conversation>;
@@ -0,0 +1,7 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ChatMessage } from "../../interfaces/ChatMessage";
3
+ export interface GetMessageProps {
4
+ conversationId: string;
5
+ messageId: string;
6
+ }
7
+ export declare function getMessage(client: SublayHttpClient, data: GetMessageProps): Promise<ChatMessage>;
@@ -0,0 +1,6 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface UnreadCountResponse {
3
+ totalUnread: number;
4
+ unreadConversationCount: number;
5
+ }
6
+ export declare function getUnreadCount(client: SublayHttpClient): Promise<UnreadCountResponse>;
@@ -0,0 +1,21 @@
1
+ export { listConversations } from "./listConversations";
2
+ export { createGroupConversation } from "./createGroupConversation";
3
+ export { createDirectConversation } from "./createDirectConversation";
4
+ export { getConversation } from "./getConversation";
5
+ export { updateConversation } from "./updateConversation";
6
+ export { deleteConversation } from "./deleteConversation";
7
+ export { getUnreadCount } from "./getUnreadCount";
8
+ export { listMembers } from "./listMembers";
9
+ export { addMember } from "./addMember";
10
+ export { removeMember } from "./removeMember";
11
+ export { leaveConversation } from "./leaveConversation";
12
+ export { changeMemberRole } from "./changeMemberRole";
13
+ export { listMessages } from "./listMessages";
14
+ export { sendMessage } from "./sendMessage";
15
+ export { getMessage } from "./getMessage";
16
+ export { editMessage } from "./editMessage";
17
+ export { deleteMessage } from "./deleteMessage";
18
+ export { toggleReaction } from "./toggleReaction";
19
+ export { listReactions } from "./listReactions";
20
+ export { markAsRead } from "./markAsRead";
21
+ export { reportMessage } from "./reportMessage";
@@ -0,0 +1,7 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface LeaveConversationProps {
3
+ conversationId: string;
4
+ }
5
+ export declare function leaveConversation(client: SublayHttpClient, data: LeaveConversationProps): Promise<{
6
+ message: string;
7
+ }>;
@@ -0,0 +1,17 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ConversationPreview } from "../../interfaces/Conversation";
3
+ export interface ListConversationsProps {
4
+ /** Comma-separated conversation types, e.g. "direct,group,space". */
5
+ types?: string;
6
+ /** Cursor for keyset pagination: the `lastMessageAt` of the last item from the previous page (ISO datetime). */
7
+ cursor?: string;
8
+ /** Tie-breaker cursor: the `createdAt` of the last item from the previous page (ISO datetime). */
9
+ cursorCreatedAt?: string;
10
+ /** Default 20, max 50. */
11
+ limit?: number;
12
+ }
13
+ export interface ListConversationsResponse {
14
+ conversations: ConversationPreview[];
15
+ hasMore: boolean;
16
+ }
17
+ export declare function listConversations(client: SublayHttpClient, data?: ListConversationsProps): Promise<ListConversationsResponse>;
@@ -0,0 +1,10 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ConversationMember } from "../../interfaces/ConversationMember";
3
+ import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
4
+ export interface ListMembersProps {
5
+ conversationId: string;
6
+ page?: number;
7
+ limit?: number;
8
+ role?: "admin" | "member";
9
+ }
10
+ export declare function listMembers(client: SublayHttpClient, data: ListMembersProps): Promise<PaginatedResponse<ConversationMember>>;
@@ -0,0 +1,23 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { ChatMessage } from "../../interfaces/ChatMessage";
3
+ export interface ListMessagesProps {
4
+ conversationId: string;
5
+ /** Restrict to replies of this message (thread view). */
6
+ parentId?: string;
7
+ /** Keyset pagination: ISO timestamp; return messages created before this. Mutually exclusive with `after`. */
8
+ before?: string;
9
+ /** Keyset pagination: ISO timestamp; return messages created after this. Mutually exclusive with `before`. */
10
+ after?: string;
11
+ /** Page size (default 50, max 100). */
12
+ limit?: number;
13
+ sort?: "asc" | "desc";
14
+ /** Comma-separated associations to populate, e.g. "files". */
15
+ include?: string;
16
+ }
17
+ export interface ListMessagesResponse {
18
+ messages: ChatMessage[];
19
+ hasMore: boolean;
20
+ oldestCreatedAt: string | null;
21
+ newestCreatedAt: string | null;
22
+ }
23
+ export declare function listMessages(client: SublayHttpClient, data: ListMessagesProps): Promise<ListMessagesResponse>;