@sublay/js 7.8.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.
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +23 -14
- package/dist/index.d.mts +374 -21
- package/dist/index.d.ts +4364 -31
- package/dist/index.js +53 -19
- package/dist/index.mjs +53 -19
- package/package.json +29 -18
- package/dist/core/client.d.ts +0 -64
- package/dist/core/multipart.d.ts +0 -22
- package/dist/core/spaceReputationParams.d.ts +0 -57
- package/dist/interfaces/AppNotification.d.ts +0 -258
- package/dist/interfaces/ChatMessage.d.ts +0 -32
- package/dist/interfaces/Collection.d.ts +0 -10
- package/dist/interfaces/Comment.d.ts +0 -42
- package/dist/interfaces/Connection.d.ts +0 -67
- package/dist/interfaces/Conversation.d.ts +0 -27
- package/dist/interfaces/ConversationMember.d.ts +0 -17
- package/dist/interfaces/Entity.d.ts +0 -55
- package/dist/interfaces/Event.d.ts +0 -66
- package/dist/interfaces/File.d.ts +0 -39
- package/dist/interfaces/Follow.d.ts +0 -19
- package/dist/interfaces/HostedApp.d.ts +0 -11
- package/dist/interfaces/IPaginatedResponse.d.ts +0 -11
- package/dist/interfaces/ImageProcessing.d.ts +0 -62
- package/dist/interfaces/Mention.d.ts +0 -12
- package/dist/interfaces/OAuthIdentity.d.ts +0 -14
- package/dist/interfaces/Project.d.ts +0 -14
- package/dist/interfaces/Push.d.ts +0 -74
- package/dist/interfaces/Reaction.d.ts +0 -23
- package/dist/interfaces/Report.d.ts +0 -38
- package/dist/interfaces/Rule.d.ts +0 -22
- package/dist/interfaces/Space.d.ts +0 -130
- package/dist/interfaces/SpaceMember.d.ts +0 -29
- package/dist/interfaces/SpaceReputation.d.ts +0 -100
- package/dist/interfaces/Table.d.ts +0 -63
- package/dist/interfaces/User.d.ts +0 -46
- package/dist/interfaces/UserSearch.d.ts +0 -13
- package/dist/interfaces/Workspace.d.ts +0 -148
- package/dist/modules/app-notifications/countUnreadNotifications.d.ts +0 -2
- package/dist/modules/app-notifications/fetchNotifications.d.ts +0 -8
- package/dist/modules/app-notifications/index.d.ts +0 -4
- package/dist/modules/app-notifications/markAllNotificationsAsRead.d.ts +0 -5
- package/dist/modules/app-notifications/markNotificationAsRead.d.ts +0 -5
- package/dist/modules/auth/changePassword.d.ts +0 -34
- package/dist/modules/auth/confirmAccountDeletion.d.ts +0 -11
- package/dist/modules/auth/index.d.ts +0 -13
- package/dist/modules/auth/requestAccountDeletion.d.ts +0 -14
- package/dist/modules/auth/requestNewAccessToken.d.ts +0 -16
- package/dist/modules/auth/requestPasswordReset.d.ts +0 -5
- package/dist/modules/auth/resetPassword.d.ts +0 -6
- package/dist/modules/auth/sendVerificationEmail.d.ts +0 -13
- package/dist/modules/auth/setPassword.d.ts +0 -9
- package/dist/modules/auth/signIn.d.ts +0 -12
- package/dist/modules/auth/signOut.d.ts +0 -103
- package/dist/modules/auth/signUp.d.ts +0 -24
- package/dist/modules/auth/verifyEmail.d.ts +0 -5
- package/dist/modules/auth/verifyExternalUser.d.ts +0 -11
- package/dist/modules/chat/addMember.d.ts +0 -8
- package/dist/modules/chat/changeMemberRole.d.ts +0 -9
- package/dist/modules/chat/createDirectConversation.d.ts +0 -7
- package/dist/modules/chat/createGroupConversation.d.ts +0 -10
- package/dist/modules/chat/deleteConversation.d.ts +0 -8
- package/dist/modules/chat/deleteMessage.d.ts +0 -11
- package/dist/modules/chat/editMessage.d.ts +0 -14
- package/dist/modules/chat/getConversation.d.ts +0 -6
- package/dist/modules/chat/getMessage.d.ts +0 -8
- package/dist/modules/chat/getUnreadCount.d.ts +0 -6
- package/dist/modules/chat/index.d.ts +0 -21
- package/dist/modules/chat/leaveConversation.d.ts +0 -7
- package/dist/modules/chat/listConversations.d.ts +0 -17
- package/dist/modules/chat/listMembers.d.ts +0 -11
- package/dist/modules/chat/listMessages.d.ts +0 -40
- package/dist/modules/chat/listReactions.d.ts +0 -24
- package/dist/modules/chat/markAsRead.d.ts +0 -9
- package/dist/modules/chat/muteConversation.d.ts +0 -23
- package/dist/modules/chat/removeMember.d.ts +0 -9
- package/dist/modules/chat/reportMessage.d.ts +0 -12
- package/dist/modules/chat/sendMessage.d.ts +0 -22
- package/dist/modules/chat/toggleReaction.d.ts +0 -16
- package/dist/modules/chat/updateConversation.d.ts +0 -12
- package/dist/modules/collections/addEntityToCollection.d.ts +0 -13
- package/dist/modules/collections/createNewCollection.d.ts +0 -8
- package/dist/modules/collections/deleteCollection.d.ts +0 -5
- package/dist/modules/collections/fetchCollectionEntities.d.ts +0 -13
- package/dist/modules/collections/fetchRootCollection.d.ts +0 -3
- package/dist/modules/collections/fetchSubCollections.d.ts +0 -6
- package/dist/modules/collections/index.d.ts +0 -8
- package/dist/modules/collections/removeEntityFromCollection.d.ts +0 -7
- package/dist/modules/collections/updateCollection.d.ts +0 -7
- package/dist/modules/comments/addReaction.d.ts +0 -8
- package/dist/modules/comments/createComment.d.ts +0 -15
- package/dist/modules/comments/deleteComment.d.ts +0 -5
- package/dist/modules/comments/fetchComment.d.ts +0 -8
- package/dist/modules/comments/fetchCommentByForeignId.d.ts +0 -7
- package/dist/modules/comments/fetchManyComments.d.ts +0 -26
- package/dist/modules/comments/fetchReactions.d.ts +0 -16
- package/dist/modules/comments/getUserReaction.d.ts +0 -9
- package/dist/modules/comments/index.d.ts +0 -10
- package/dist/modules/comments/removeReaction.d.ts +0 -6
- package/dist/modules/comments/updateComment.d.ts +0 -10
- package/dist/modules/connections/acceptConnection.d.ts +0 -6
- package/dist/modules/connections/declineConnection.d.ts +0 -6
- package/dist/modules/connections/fetchConnections.d.ts +0 -9
- package/dist/modules/connections/fetchConnectionsCount.d.ts +0 -3
- package/dist/modules/connections/fetchReceivedPendingConnections.d.ts +0 -8
- package/dist/modules/connections/fetchSentPendingConnections.d.ts +0 -8
- package/dist/modules/connections/index.d.ts +0 -7
- package/dist/modules/connections/removeConnection.d.ts +0 -5
- package/dist/modules/entities/addReaction.d.ts +0 -8
- package/dist/modules/entities/createEntity.d.ts +0 -23
- package/dist/modules/entities/deleteEntity.d.ts +0 -5
- package/dist/modules/entities/fetchDrafts.d.ts +0 -11
- package/dist/modules/entities/fetchEntity.d.ts +0 -8
- package/dist/modules/entities/fetchEntityByForeignId.d.ts +0 -8
- package/dist/modules/entities/fetchEntityByShortId.d.ts +0 -7
- package/dist/modules/entities/fetchManyEntities.d.ts +0 -65
- package/dist/modules/entities/fetchReactions.d.ts +0 -16
- package/dist/modules/entities/fetchTopComment.d.ts +0 -6
- package/dist/modules/entities/getUserReaction.d.ts +0 -9
- package/dist/modules/entities/index.d.ts +0 -15
- package/dist/modules/entities/isEntitySaved.d.ts +0 -12
- package/dist/modules/entities/publishDraft.d.ts +0 -6
- package/dist/modules/entities/removeReaction.d.ts +0 -6
- package/dist/modules/entities/updateEntity.d.ts +0 -18
- package/dist/modules/events/addHost.d.ts +0 -8
- package/dist/modules/events/addInvite.d.ts +0 -8
- package/dist/modules/events/cancelEvent.d.ts +0 -6
- package/dist/modules/events/createEvent.d.ts +0 -49
- package/dist/modules/events/deleteEvent.d.ts +0 -5
- package/dist/modules/events/fetchEvent.d.ts +0 -8
- package/dist/modules/events/fetchEventRsvps.d.ts +0 -19
- package/dist/modules/events/fetchInvitees.d.ts +0 -12
- package/dist/modules/events/fetchManyEvents.d.ts +0 -42
- package/dist/modules/events/index.d.ts +0 -14
- package/dist/modules/events/removeHost.d.ts +0 -8
- package/dist/modules/events/removeInvite.d.ts +0 -8
- package/dist/modules/events/setRsvp.d.ts +0 -7
- package/dist/modules/events/updateEvent.d.ts +0 -43
- package/dist/modules/events/withdrawRsvp.d.ts +0 -6
- package/dist/modules/follows/deleteFollow.d.ts +0 -5
- package/dist/modules/follows/fetchFollowers.d.ts +0 -9
- package/dist/modules/follows/fetchFollowersCount.d.ts +0 -5
- package/dist/modules/follows/fetchFollowing.d.ts +0 -9
- package/dist/modules/follows/fetchFollowingCount.d.ts +0 -5
- package/dist/modules/follows/index.d.ts +0 -5
- package/dist/modules/oauth/authorize.d.ts +0 -25
- package/dist/modules/oauth/index.d.ts +0 -4
- package/dist/modules/oauth/linkIdentity.d.ts +0 -14
- package/dist/modules/oauth/listIdentities.d.ts +0 -4
- package/dist/modules/oauth/unlinkIdentity.d.ts +0 -12
- package/dist/modules/push/getNotificationPreferences.d.ts +0 -11
- package/dist/modules/push/index.d.ts +0 -2
- package/dist/modules/push/updateNotificationPreferences.d.ts +0 -16
- package/dist/modules/reports/createReport.d.ts +0 -9
- package/dist/modules/reports/fetchModeratedReports.d.ts +0 -13
- package/dist/modules/reports/index.d.ts +0 -2
- package/dist/modules/search/askContent.d.ts +0 -58
- package/dist/modules/search/index.d.ts +0 -5
- package/dist/modules/search/matchUsers.d.ts +0 -36
- package/dist/modules/search/searchContent.d.ts +0 -24
- package/dist/modules/search/searchSpaces.d.ts +0 -11
- package/dist/modules/search/searchUsers.d.ts +0 -11
- package/dist/modules/spaces/approveMembership.d.ts +0 -7
- package/dist/modules/spaces/banMember.d.ts +0 -13
- package/dist/modules/spaces/checkMyMembership.d.ts +0 -6
- package/dist/modules/spaces/checkSlugAvailability.d.ts +0 -8
- package/dist/modules/spaces/createRule.d.ts +0 -8
- package/dist/modules/spaces/createSpace.d.ts +0 -29
- package/dist/modules/spaces/declineMembership.d.ts +0 -7
- package/dist/modules/spaces/deleteRule.d.ts +0 -7
- package/dist/modules/spaces/deleteSpace.d.ts +0 -6
- package/dist/modules/spaces/fetchChildSpaces.d.ts +0 -11
- package/dist/modules/spaces/fetchDigestConfig.d.ts +0 -6
- package/dist/modules/spaces/fetchManyRules.d.ts +0 -6
- package/dist/modules/spaces/fetchManySpaces.d.ts +0 -17
- package/dist/modules/spaces/fetchMutualSpaces.d.ts +0 -11
- package/dist/modules/spaces/fetchRule.d.ts +0 -7
- package/dist/modules/spaces/fetchSpace.d.ts +0 -6
- package/dist/modules/spaces/fetchSpaceBreadcrumb.d.ts +0 -6
- package/dist/modules/spaces/fetchSpaceByShortId.d.ts +0 -6
- package/dist/modules/spaces/fetchSpaceBySlug.d.ts +0 -6
- package/dist/modules/spaces/fetchSpaceMembers.d.ts +0 -11
- package/dist/modules/spaces/fetchSpaceTeam.d.ts +0 -7
- package/dist/modules/spaces/fetchUserSpaces.d.ts +0 -17
- package/dist/modules/spaces/getSpaceConversation.d.ts +0 -6
- package/dist/modules/spaces/handleCommentReport.d.ts +0 -14
- package/dist/modules/spaces/handleEntityReport.d.ts +0 -17
- package/dist/modules/spaces/handleSpaceChatReport.d.ts +0 -18
- package/dist/modules/spaces/index.d.ts +0 -36
- package/dist/modules/spaces/joinSpace.d.ts +0 -6
- package/dist/modules/spaces/leaveSpace.d.ts +0 -6
- package/dist/modules/spaces/moderateSpaceChatMessage.d.ts +0 -12
- package/dist/modules/spaces/moderateSpaceComment.d.ts +0 -9
- package/dist/modules/spaces/moderateSpaceEntity.d.ts +0 -12
- package/dist/modules/spaces/reorderRules.d.ts +0 -7
- package/dist/modules/spaces/setSpaceEntityNsfw.d.ts +0 -16
- package/dist/modules/spaces/unbanMember.d.ts +0 -13
- package/dist/modules/spaces/updateDigestConfig.d.ts +0 -11
- package/dist/modules/spaces/updateMemberRole.d.ts +0 -8
- package/dist/modules/spaces/updateRule.d.ts +0 -9
- package/dist/modules/spaces/updateSpace.d.ts +0 -22
- package/dist/modules/storage/deleteFile.d.ts +0 -5
- package/dist/modules/storage/getFile.d.ts +0 -34
- package/dist/modules/storage/index.d.ts +0 -4
- package/dist/modules/storage/uploadFile.d.ts +0 -30
- package/dist/modules/storage/uploadImage.d.ts +0 -42
- package/dist/modules/tables/bulkCreate.d.ts +0 -4
- package/dist/modules/tables/bulkDelete.d.ts +0 -7
- package/dist/modules/tables/create.d.ts +0 -4
- package/dist/modules/tables/createTableAccessor.d.ts +0 -9
- package/dist/modules/tables/deleteRow.d.ts +0 -9
- package/dist/modules/tables/find.d.ts +0 -8
- package/dist/modules/tables/findOne.d.ts +0 -7
- package/dist/modules/tables/index.d.ts +0 -9
- package/dist/modules/tables/restore.d.ts +0 -6
- package/dist/modules/tables/update.d.ts +0 -4
- package/dist/modules/users/checkUsernameAvailability.d.ts +0 -8
- package/dist/modules/users/createBlock.d.ts +0 -19
- package/dist/modules/users/createFollow.d.ts +0 -7
- package/dist/modules/users/deleteBlock.d.ts +0 -13
- package/dist/modules/users/deleteFollow.d.ts +0 -6
- package/dist/modules/users/fetchBlockStatus.d.ts +0 -23
- package/dist/modules/users/fetchBlockedUsers.d.ts +0 -19
- package/dist/modules/users/fetchConnectionStatus.d.ts +0 -10
- package/dist/modules/users/fetchConnectionsByUserId.d.ts +0 -11
- package/dist/modules/users/fetchConnectionsCountByUserId.d.ts +0 -6
- package/dist/modules/users/fetchFollowStatus.d.ts +0 -14
- package/dist/modules/users/fetchFollowersByUserId.d.ts +0 -11
- package/dist/modules/users/fetchFollowersCountByUserId.d.ts +0 -8
- package/dist/modules/users/fetchFollowingByUserId.d.ts +0 -11
- package/dist/modules/users/fetchFollowingCountByUserId.d.ts +0 -8
- package/dist/modules/users/fetchUserByForeignId.d.ts +0 -8
- package/dist/modules/users/fetchUserById.d.ts +0 -8
- package/dist/modules/users/fetchUserByUsername.d.ts +0 -8
- package/dist/modules/users/fetchUserSuggestions.d.ts +0 -7
- package/dist/modules/users/index.d.ts +0 -22
- package/dist/modules/users/removeConnectionByUserId.d.ts +0 -10
- package/dist/modules/users/requestConnection.d.ts +0 -11
- package/dist/modules/users/updateUser.d.ts +0 -32
- package/dist/modules/workspaces/acceptInvite.d.ts +0 -13
- package/dist/modules/workspaces/acceptWorkspaceInvite.d.ts +0 -13
- package/dist/modules/workspaces/createInvite.d.ts +0 -17
- package/dist/modules/workspaces/createWorkspace.d.ts +0 -12
- package/dist/modules/workspaces/createWorkspaceInvite.d.ts +0 -17
- package/dist/modules/workspaces/declineInvite.d.ts +0 -12
- package/dist/modules/workspaces/declineWorkspaceInvite.d.ts +0 -14
- package/dist/modules/workspaces/deleteWorkspace.d.ts +0 -13
- package/dist/modules/workspaces/fetchManyWorkspaces.d.ts +0 -13
- package/dist/modules/workspaces/fetchMembers.d.ts +0 -13
- package/dist/modules/workspaces/fetchMyInvites.d.ts +0 -11
- package/dist/modules/workspaces/fetchMyWorkspaceInvites.d.ts +0 -15
- package/dist/modules/workspaces/fetchWorkspace.d.ts +0 -7
- package/dist/modules/workspaces/fetchWorkspaceAuthority.d.ts +0 -11
- package/dist/modules/workspaces/fetchWorkspaceInvites.d.ts +0 -17
- package/dist/modules/workspaces/fetchWorkspaceMemberStanding.d.ts +0 -11
- package/dist/modules/workspaces/fetchWorkspaceMembers.d.ts +0 -13
- package/dist/modules/workspaces/getAuthority.d.ts +0 -11
- package/dist/modules/workspaces/index.d.ts +0 -21
- package/dist/modules/workspaces/leaveWorkspace.d.ts +0 -11
- package/dist/modules/workspaces/removeWorkspaceMember.d.ts +0 -12
- package/dist/modules/workspaces/removeWorkspaceMemberFromSubtree.d.ts +0 -16
- package/dist/modules/workspaces/resendWorkspaceInvite.d.ts +0 -12
- package/dist/modules/workspaces/revokeWorkspaceInvite.d.ts +0 -13
- package/dist/modules/workspaces/transferWorkspaceOwnership.d.ts +0 -15
- package/dist/modules/workspaces/updateWorkspace.d.ts +0 -12
- package/dist/modules/workspaces/updateWorkspaceInheritFlag.d.ts +0 -13
- package/dist/modules/workspaces/updateWorkspaceMember.d.ts +0 -17
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
|
}
|
|
@@ -1978,6 +1978,49 @@ async function fetchModeratedReports(client, data) {
|
|
|
1978
1978
|
return response.data;
|
|
1979
1979
|
}
|
|
1980
1980
|
|
|
1981
|
+
// src/modules/reputation/index.ts
|
|
1982
|
+
var reputation_exports = {};
|
|
1983
|
+
__export(reputation_exports, {
|
|
1984
|
+
createGrant: () => createGrant,
|
|
1985
|
+
listGrants: () => listGrants
|
|
1986
|
+
});
|
|
1987
|
+
|
|
1988
|
+
// src/modules/reputation/createGrant.ts
|
|
1989
|
+
async function createGrant(client, data) {
|
|
1990
|
+
const response = await client.projectInstance.post(
|
|
1991
|
+
"/reputation-grants",
|
|
1992
|
+
data
|
|
1993
|
+
);
|
|
1994
|
+
return response.data;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
// src/modules/reputation/listGrants.ts
|
|
1998
|
+
async function listGrants(client, data) {
|
|
1999
|
+
const {
|
|
2000
|
+
spaceReputation,
|
|
2001
|
+
spaceReputationId,
|
|
2002
|
+
spaceReputationDescendants,
|
|
2003
|
+
...rest
|
|
2004
|
+
} = data;
|
|
2005
|
+
const response = await client.projectInstance.get(
|
|
2006
|
+
"/reputation-grants",
|
|
2007
|
+
{
|
|
2008
|
+
params: {
|
|
2009
|
+
...rest,
|
|
2010
|
+
// `spaceReputationId=context` scores each hydrated user against THAT
|
|
2011
|
+
// GRANT'S own bucket. Normalized rather than spread raw — axios would
|
|
2012
|
+
// bracket-encode the object and the server would ignore it.
|
|
2013
|
+
...buildSpaceReputationParams({
|
|
2014
|
+
spaceReputation,
|
|
2015
|
+
spaceReputationId,
|
|
2016
|
+
spaceReputationDescendants
|
|
2017
|
+
})
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
);
|
|
2021
|
+
return response.data;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
1981
2024
|
// src/modules/search/index.ts
|
|
1982
2025
|
var search_exports = {};
|
|
1983
2026
|
__export(search_exports, {
|
|
@@ -2598,11 +2641,9 @@ __export(workspaces_exports, {
|
|
|
2598
2641
|
|
|
2599
2642
|
// src/modules/workspaces/createWorkspace.ts
|
|
2600
2643
|
async function createWorkspace(client, data) {
|
|
2601
|
-
const body = { ...data };
|
|
2602
|
-
delete body.userId;
|
|
2603
2644
|
const response = await client.projectInstance.post(
|
|
2604
2645
|
"/workspaces",
|
|
2605
|
-
|
|
2646
|
+
data
|
|
2606
2647
|
);
|
|
2607
2648
|
return response.data;
|
|
2608
2649
|
}
|
|
@@ -2619,17 +2660,13 @@ async function fetchWorkspace(client, data) {
|
|
|
2619
2660
|
|
|
2620
2661
|
// src/modules/workspaces/fetchManyWorkspaces.ts
|
|
2621
2662
|
async function fetchManyWorkspaces(client, data = {}) {
|
|
2622
|
-
const
|
|
2623
|
-
delete params.userId;
|
|
2624
|
-
const response = await client.projectInstance.get("/workspaces", { params });
|
|
2663
|
+
const response = await client.projectInstance.get("/workspaces", { params: data });
|
|
2625
2664
|
return response.data;
|
|
2626
2665
|
}
|
|
2627
2666
|
|
|
2628
2667
|
// src/modules/workspaces/updateWorkspace.ts
|
|
2629
2668
|
async function updateWorkspace(client, data) {
|
|
2630
|
-
const { workspaceId, ...
|
|
2631
|
-
const body = { ...rest };
|
|
2632
|
-
delete body.userId;
|
|
2669
|
+
const { workspaceId, ...body } = data;
|
|
2633
2670
|
const response = await client.projectInstance.patch(
|
|
2634
2671
|
`/workspaces/${workspaceId}`,
|
|
2635
2672
|
body
|
|
@@ -2658,9 +2695,7 @@ async function deleteWorkspace(client, data) {
|
|
|
2658
2695
|
|
|
2659
2696
|
// src/modules/workspaces/transferWorkspaceOwnership.ts
|
|
2660
2697
|
async function transferWorkspaceOwnership(client, data) {
|
|
2661
|
-
const { workspaceId, ...
|
|
2662
|
-
const body = { ...rest };
|
|
2663
|
-
delete body.userId;
|
|
2698
|
+
const { workspaceId, ...body } = data;
|
|
2664
2699
|
const response = await client.projectInstance.post(
|
|
2665
2700
|
`/workspaces/${workspaceId}/transfer-ownership`,
|
|
2666
2701
|
body
|
|
@@ -2670,9 +2705,7 @@ async function transferWorkspaceOwnership(client, data) {
|
|
|
2670
2705
|
|
|
2671
2706
|
// src/modules/workspaces/fetchWorkspaceMembers.ts
|
|
2672
2707
|
async function fetchWorkspaceMembers(client, data) {
|
|
2673
|
-
const { workspaceId, ...
|
|
2674
|
-
const params = { ...rest };
|
|
2675
|
-
delete params.userId;
|
|
2708
|
+
const { workspaceId, ...params } = data;
|
|
2676
2709
|
const response = await client.projectInstance.get(`/workspaces/${workspaceId}/members`, { params });
|
|
2677
2710
|
return response.data;
|
|
2678
2711
|
}
|
|
@@ -2688,9 +2721,7 @@ async function fetchWorkspaceMemberStanding(client, data) {
|
|
|
2688
2721
|
|
|
2689
2722
|
// src/modules/workspaces/updateWorkspaceMember.ts
|
|
2690
2723
|
async function updateWorkspaceMember(client, data) {
|
|
2691
|
-
const { workspaceId, targetUserId, ...
|
|
2692
|
-
const body = { ...rest };
|
|
2693
|
-
delete body.userId;
|
|
2724
|
+
const { workspaceId, targetUserId, ...body } = data;
|
|
2694
2725
|
const response = await client.projectInstance.patch(
|
|
2695
2726
|
`/workspaces/${workspaceId}/members/${targetUserId}`,
|
|
2696
2727
|
body
|
|
@@ -2908,6 +2939,7 @@ var PUSH_EVENT_TYPES = [
|
|
|
2908
2939
|
"event-invite",
|
|
2909
2940
|
"event-updated",
|
|
2910
2941
|
"event-cancelled",
|
|
2942
|
+
"reputation-grant",
|
|
2911
2943
|
"message"
|
|
2912
2944
|
];
|
|
2913
2945
|
var MUTE_DURATIONS = ["8h", "24h", "1w", "forever"];
|
|
@@ -2926,6 +2958,7 @@ var SublayClient = class _SublayClient {
|
|
|
2926
2958
|
connections;
|
|
2927
2959
|
appNotifications;
|
|
2928
2960
|
reports;
|
|
2961
|
+
reputation;
|
|
2929
2962
|
search;
|
|
2930
2963
|
storage;
|
|
2931
2964
|
oauth;
|
|
@@ -2945,6 +2978,7 @@ var SublayClient = class _SublayClient {
|
|
|
2945
2978
|
this.connections = bindModule(connections_exports, this.http);
|
|
2946
2979
|
this.appNotifications = bindModule(app_notifications_exports, this.http);
|
|
2947
2980
|
this.reports = bindModule(reports_exports, this.http);
|
|
2981
|
+
this.reputation = bindModule(reputation_exports, this.http);
|
|
2948
2982
|
this.search = bindModule(search_exports, this.http);
|
|
2949
2983
|
this.storage = bindModule(storage_exports, this.http);
|
|
2950
2984
|
this.oauth = bindModule(oauth_exports, this.http);
|
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
|
}
|
|
@@ -1946,6 +1946,49 @@ async function fetchModeratedReports(client, data) {
|
|
|
1946
1946
|
return response.data;
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
|
+
// src/modules/reputation/index.ts
|
|
1950
|
+
var reputation_exports = {};
|
|
1951
|
+
__export(reputation_exports, {
|
|
1952
|
+
createGrant: () => createGrant,
|
|
1953
|
+
listGrants: () => listGrants
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
// src/modules/reputation/createGrant.ts
|
|
1957
|
+
async function createGrant(client, data) {
|
|
1958
|
+
const response = await client.projectInstance.post(
|
|
1959
|
+
"/reputation-grants",
|
|
1960
|
+
data
|
|
1961
|
+
);
|
|
1962
|
+
return response.data;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
// src/modules/reputation/listGrants.ts
|
|
1966
|
+
async function listGrants(client, data) {
|
|
1967
|
+
const {
|
|
1968
|
+
spaceReputation,
|
|
1969
|
+
spaceReputationId,
|
|
1970
|
+
spaceReputationDescendants,
|
|
1971
|
+
...rest
|
|
1972
|
+
} = data;
|
|
1973
|
+
const response = await client.projectInstance.get(
|
|
1974
|
+
"/reputation-grants",
|
|
1975
|
+
{
|
|
1976
|
+
params: {
|
|
1977
|
+
...rest,
|
|
1978
|
+
// `spaceReputationId=context` scores each hydrated user against THAT
|
|
1979
|
+
// GRANT'S own bucket. Normalized rather than spread raw — axios would
|
|
1980
|
+
// bracket-encode the object and the server would ignore it.
|
|
1981
|
+
...buildSpaceReputationParams({
|
|
1982
|
+
spaceReputation,
|
|
1983
|
+
spaceReputationId,
|
|
1984
|
+
spaceReputationDescendants
|
|
1985
|
+
})
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
);
|
|
1989
|
+
return response.data;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1949
1992
|
// src/modules/search/index.ts
|
|
1950
1993
|
var search_exports = {};
|
|
1951
1994
|
__export(search_exports, {
|
|
@@ -2566,11 +2609,9 @@ __export(workspaces_exports, {
|
|
|
2566
2609
|
|
|
2567
2610
|
// src/modules/workspaces/createWorkspace.ts
|
|
2568
2611
|
async function createWorkspace(client, data) {
|
|
2569
|
-
const body = { ...data };
|
|
2570
|
-
delete body.userId;
|
|
2571
2612
|
const response = await client.projectInstance.post(
|
|
2572
2613
|
"/workspaces",
|
|
2573
|
-
|
|
2614
|
+
data
|
|
2574
2615
|
);
|
|
2575
2616
|
return response.data;
|
|
2576
2617
|
}
|
|
@@ -2587,17 +2628,13 @@ async function fetchWorkspace(client, data) {
|
|
|
2587
2628
|
|
|
2588
2629
|
// src/modules/workspaces/fetchManyWorkspaces.ts
|
|
2589
2630
|
async function fetchManyWorkspaces(client, data = {}) {
|
|
2590
|
-
const
|
|
2591
|
-
delete params.userId;
|
|
2592
|
-
const response = await client.projectInstance.get("/workspaces", { params });
|
|
2631
|
+
const response = await client.projectInstance.get("/workspaces", { params: data });
|
|
2593
2632
|
return response.data;
|
|
2594
2633
|
}
|
|
2595
2634
|
|
|
2596
2635
|
// src/modules/workspaces/updateWorkspace.ts
|
|
2597
2636
|
async function updateWorkspace(client, data) {
|
|
2598
|
-
const { workspaceId, ...
|
|
2599
|
-
const body = { ...rest };
|
|
2600
|
-
delete body.userId;
|
|
2637
|
+
const { workspaceId, ...body } = data;
|
|
2601
2638
|
const response = await client.projectInstance.patch(
|
|
2602
2639
|
`/workspaces/${workspaceId}`,
|
|
2603
2640
|
body
|
|
@@ -2626,9 +2663,7 @@ async function deleteWorkspace(client, data) {
|
|
|
2626
2663
|
|
|
2627
2664
|
// src/modules/workspaces/transferWorkspaceOwnership.ts
|
|
2628
2665
|
async function transferWorkspaceOwnership(client, data) {
|
|
2629
|
-
const { workspaceId, ...
|
|
2630
|
-
const body = { ...rest };
|
|
2631
|
-
delete body.userId;
|
|
2666
|
+
const { workspaceId, ...body } = data;
|
|
2632
2667
|
const response = await client.projectInstance.post(
|
|
2633
2668
|
`/workspaces/${workspaceId}/transfer-ownership`,
|
|
2634
2669
|
body
|
|
@@ -2638,9 +2673,7 @@ async function transferWorkspaceOwnership(client, data) {
|
|
|
2638
2673
|
|
|
2639
2674
|
// src/modules/workspaces/fetchWorkspaceMembers.ts
|
|
2640
2675
|
async function fetchWorkspaceMembers(client, data) {
|
|
2641
|
-
const { workspaceId, ...
|
|
2642
|
-
const params = { ...rest };
|
|
2643
|
-
delete params.userId;
|
|
2676
|
+
const { workspaceId, ...params } = data;
|
|
2644
2677
|
const response = await client.projectInstance.get(`/workspaces/${workspaceId}/members`, { params });
|
|
2645
2678
|
return response.data;
|
|
2646
2679
|
}
|
|
@@ -2656,9 +2689,7 @@ async function fetchWorkspaceMemberStanding(client, data) {
|
|
|
2656
2689
|
|
|
2657
2690
|
// src/modules/workspaces/updateWorkspaceMember.ts
|
|
2658
2691
|
async function updateWorkspaceMember(client, data) {
|
|
2659
|
-
const { workspaceId, targetUserId, ...
|
|
2660
|
-
const body = { ...rest };
|
|
2661
|
-
delete body.userId;
|
|
2692
|
+
const { workspaceId, targetUserId, ...body } = data;
|
|
2662
2693
|
const response = await client.projectInstance.patch(
|
|
2663
2694
|
`/workspaces/${workspaceId}/members/${targetUserId}`,
|
|
2664
2695
|
body
|
|
@@ -2876,6 +2907,7 @@ var PUSH_EVENT_TYPES = [
|
|
|
2876
2907
|
"event-invite",
|
|
2877
2908
|
"event-updated",
|
|
2878
2909
|
"event-cancelled",
|
|
2910
|
+
"reputation-grant",
|
|
2879
2911
|
"message"
|
|
2880
2912
|
];
|
|
2881
2913
|
var MUTE_DURATIONS = ["8h", "24h", "1w", "forever"];
|
|
@@ -2894,6 +2926,7 @@ var SublayClient = class _SublayClient {
|
|
|
2894
2926
|
connections;
|
|
2895
2927
|
appNotifications;
|
|
2896
2928
|
reports;
|
|
2929
|
+
reputation;
|
|
2897
2930
|
search;
|
|
2898
2931
|
storage;
|
|
2899
2932
|
oauth;
|
|
@@ -2913,6 +2946,7 @@ var SublayClient = class _SublayClient {
|
|
|
2913
2946
|
this.connections = bindModule(connections_exports, this.http);
|
|
2914
2947
|
this.appNotifications = bindModule(app_notifications_exports, this.http);
|
|
2915
2948
|
this.reports = bindModule(reports_exports, this.http);
|
|
2949
|
+
this.reputation = bindModule(reputation_exports, this.http);
|
|
2916
2950
|
this.search = bindModule(search_exports, this.http);
|
|
2917
2951
|
this.storage = bindModule(storage_exports, this.http);
|
|
2918
2952
|
this.oauth = bindModule(oauth_exports, this.http);
|
package/package.json
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sublay/js",
|
|
3
|
-
"version": "7.
|
|
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": "
|
|
21
|
+
"license": "Apache-2.0",
|
|
12
22
|
"publishConfig": {
|
|
13
23
|
"access": "public"
|
|
14
24
|
},
|
|
15
25
|
"exports": {
|
|
16
26
|
".": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
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 --
|
|
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
|
}
|
package/dist/core/client.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/core/multipart.d.ts
DELETED
|
@@ -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;
|