@sublay/js 7.4.3 → 7.6.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.
package/dist/index.d.mts CHANGED
@@ -241,6 +241,15 @@ interface ChangePasswordResponse {
241
241
  }
242
242
  declare function changePassword(client: SublayHttpClient, data: ChangePasswordProps): Promise<ChangePasswordResponse>;
243
243
 
244
+ interface SetPasswordProps {
245
+ newPassword: string;
246
+ }
247
+ interface SetPasswordResponse {
248
+ success: boolean;
249
+ message: string;
250
+ }
251
+ declare function setPassword(client: SublayHttpClient, data: SetPasswordProps): Promise<SetPasswordResponse>;
252
+
244
253
  interface VerifyEmailProps {
245
254
  token: string;
246
255
  }
@@ -291,13 +300,14 @@ declare const Auth_requestNewAccessToken: typeof requestNewAccessToken;
291
300
  declare const Auth_requestPasswordReset: typeof requestPasswordReset;
292
301
  declare const Auth_resetPassword: typeof resetPassword;
293
302
  declare const Auth_sendVerificationEmail: typeof sendVerificationEmail;
303
+ declare const Auth_setPassword: typeof setPassword;
294
304
  declare const Auth_signIn: typeof signIn;
295
305
  declare const Auth_signOut: typeof signOut;
296
306
  declare const Auth_signUp: typeof signUp;
297
307
  declare const Auth_verifyEmail: typeof verifyEmail;
298
308
  declare const Auth_verifyExternalUser: typeof verifyExternalUser;
299
309
  declare namespace Auth {
300
- export { Auth_changePassword as changePassword, Auth_confirmAccountDeletion as confirmAccountDeletion, Auth_requestAccountDeletion as requestAccountDeletion, Auth_requestNewAccessToken as requestNewAccessToken, Auth_requestPasswordReset as requestPasswordReset, Auth_resetPassword as resetPassword, Auth_sendVerificationEmail as sendVerificationEmail, Auth_signIn as signIn, Auth_signOut as signOut, Auth_signUp as signUp, Auth_verifyEmail as verifyEmail, Auth_verifyExternalUser as verifyExternalUser };
310
+ export { Auth_changePassword as changePassword, Auth_confirmAccountDeletion as confirmAccountDeletion, Auth_requestAccountDeletion as requestAccountDeletion, Auth_requestNewAccessToken as requestNewAccessToken, Auth_requestPasswordReset as requestPasswordReset, Auth_resetPassword as resetPassword, Auth_sendVerificationEmail as sendVerificationEmail, Auth_setPassword as setPassword, Auth_signIn as signIn, Auth_signOut as signOut, Auth_signUp as signUp, Auth_verifyEmail as verifyEmail, Auth_verifyExternalUser as verifyExternalUser };
301
311
  }
302
312
 
303
313
  /**
@@ -724,8 +734,84 @@ interface RemoveConnectionByUserIdProps {
724
734
  }
725
735
  declare function removeConnectionByUserId(client: SublayHttpClient, data: RemoveConnectionByUserIdProps): Promise<RemoveConnectionByUserIdResponse>;
726
736
 
737
+ interface CreateBlockProps {
738
+ /** The user being blocked (the target). The blocker is the token holder. */
739
+ userId: string;
740
+ }
741
+ interface BlockResponse {
742
+ id: string;
743
+ blockerId: string;
744
+ blockedId: string;
745
+ createdAt: string;
746
+ }
747
+ /**
748
+ * POST /users/:userId/block — block `:userId`.
749
+ *
750
+ * The blocker is derived from the token (Rule A — no `actingUserId`). Idempotent:
751
+ * re-blocking an already-blocked user succeeds. Self-block is rejected server-side.
752
+ * On a new block the server tears down existing follows/connections both ways.
753
+ */
754
+ declare function createBlock(client: SublayHttpClient, data: CreateBlockProps): Promise<BlockResponse>;
755
+
756
+ interface DeleteBlockProps {
757
+ /** The user being unblocked (the target). The blocker is the token holder. */
758
+ userId: string;
759
+ }
760
+ /**
761
+ * DELETE /users/:userId/block — unblock `:userId`.
762
+ *
763
+ * The blocker is derived from the token (Rule A — no `actingUserId`). Idempotent:
764
+ * unblocking a user who isn't blocked succeeds. Restores nothing (torn-down
765
+ * follows/connections are gone for good).
766
+ */
767
+ declare function deleteBlock(client: SublayHttpClient, data: DeleteBlockProps): Promise<void>;
768
+
769
+ interface FetchBlockStatusProps {
770
+ /**
771
+ * The user whose block status is being checked (the target). The status is the
772
+ * token holder's OUTBOUND state only: do *I* block `:userId`?
773
+ */
774
+ userId: string;
775
+ }
776
+ /**
777
+ * The block-status response is outbound-only by design: it reports whether the
778
+ * token holder blocks the target, and NEVER whether the target blocked the
779
+ * caller (the inbound direction is deliberately not disclosed).
780
+ */
781
+ interface BlockStatusResponse {
782
+ blocked: boolean;
783
+ blockId?: string;
784
+ createdAt?: string;
785
+ }
786
+ /**
787
+ * GET /users/:userId/block — the token holder's outbound block status toward
788
+ * `:userId` (Rule A — no `actingUserId`).
789
+ */
790
+ declare function fetchBlockStatus(client: SublayHttpClient, data: FetchBlockStatusProps): Promise<BlockStatusResponse>;
791
+
792
+ interface FetchBlockedUsersProps {
793
+ page?: number;
794
+ limit?: number;
795
+ }
796
+ /** An entry in the token holder's own block list (their outbound blocks). */
797
+ interface BlockedUserListItem {
798
+ id: string;
799
+ blockedUser: User | null;
800
+ createdAt: string;
801
+ }
802
+ /**
803
+ * GET /blocks — the token holder's own block list (their outbound blocks),
804
+ * paginated. This is the private "manage / way back to unblock" surface (Rule A
805
+ * — the subject is derived from the token, no `actingUserId`).
806
+ */
807
+ declare function fetchBlockedUsers(client: SublayHttpClient, data?: FetchBlockedUsersProps): Promise<PaginatedResponse<BlockedUserListItem>>;
808
+
727
809
  declare const Users_checkUsernameAvailability: typeof checkUsernameAvailability;
810
+ declare const Users_createBlock: typeof createBlock;
728
811
  declare const Users_createFollow: typeof createFollow;
812
+ declare const Users_deleteBlock: typeof deleteBlock;
813
+ declare const Users_fetchBlockStatus: typeof fetchBlockStatus;
814
+ declare const Users_fetchBlockedUsers: typeof fetchBlockedUsers;
729
815
  declare const Users_fetchConnectionStatus: typeof fetchConnectionStatus;
730
816
  declare const Users_fetchConnectionsByUserId: typeof fetchConnectionsByUserId;
731
817
  declare const Users_fetchConnectionsCountByUserId: typeof fetchConnectionsCountByUserId;
@@ -742,7 +828,7 @@ declare const Users_removeConnectionByUserId: typeof removeConnectionByUserId;
742
828
  declare const Users_requestConnection: typeof requestConnection;
743
829
  declare const Users_updateUser: typeof updateUser;
744
830
  declare namespace Users {
745
- export { Users_checkUsernameAvailability as checkUsernameAvailability, Users_createFollow as createFollow, deleteFollow$1 as deleteFollow, Users_fetchConnectionStatus as fetchConnectionStatus, Users_fetchConnectionsByUserId as fetchConnectionsByUserId, Users_fetchConnectionsCountByUserId as fetchConnectionsCountByUserId, Users_fetchFollowStatus as fetchFollowStatus, Users_fetchFollowersByUserId as fetchFollowersByUserId, Users_fetchFollowersCountByUserId as fetchFollowersCountByUserId, Users_fetchFollowingByUserId as fetchFollowingByUserId, Users_fetchFollowingCountByUserId as fetchFollowingCountByUserId, Users_fetchUserByForeignId as fetchUserByForeignId, Users_fetchUserById as fetchUserById, Users_fetchUserByUsername as fetchUserByUsername, Users_fetchUserSuggestions as fetchUserSuggestions, Users_removeConnectionByUserId as removeConnectionByUserId, Users_requestConnection as requestConnection, Users_updateUser as updateUser };
831
+ export { Users_checkUsernameAvailability as checkUsernameAvailability, Users_createBlock as createBlock, Users_createFollow as createFollow, Users_deleteBlock as deleteBlock, deleteFollow$1 as deleteFollow, Users_fetchBlockStatus as fetchBlockStatus, Users_fetchBlockedUsers as fetchBlockedUsers, Users_fetchConnectionStatus as fetchConnectionStatus, Users_fetchConnectionsByUserId as fetchConnectionsByUserId, Users_fetchConnectionsCountByUserId as fetchConnectionsCountByUserId, Users_fetchFollowStatus as fetchFollowStatus, Users_fetchFollowersByUserId as fetchFollowersByUserId, Users_fetchFollowersCountByUserId as fetchFollowersCountByUserId, Users_fetchFollowingByUserId as fetchFollowingByUserId, Users_fetchFollowingCountByUserId as fetchFollowingCountByUserId, Users_fetchUserByForeignId as fetchUserByForeignId, Users_fetchUserById as fetchUserById, Users_fetchUserByUsername as fetchUserByUsername, Users_fetchUserSuggestions as fetchUserSuggestions, Users_removeConnectionByUserId as removeConnectionByUserId, Users_requestConnection as requestConnection, Users_updateUser as updateUser };
746
832
  }
747
833
 
748
834
  type Mention = UserMention | SpaceMention;
@@ -798,6 +884,8 @@ interface Space {
798
884
  postingPermission: PostingPermission;
799
885
  visibility: SpaceVisibility;
800
886
  requireJoinApproval: boolean;
887
+ nsfw: boolean;
888
+ nsfwEffective: boolean;
801
889
  parentSpaceId: string | null;
802
890
  depth: number;
803
891
  metadata: Record<string, any>;
@@ -960,6 +1048,8 @@ interface Entity {
960
1048
  coordinates: [number, number];
961
1049
  } | null;
962
1050
  metadata: Record<string, any>;
1051
+ nsfw: boolean;
1052
+ nsfwEffective: boolean;
963
1053
  topComment: TopComment | null;
964
1054
  isSaved?: boolean;
965
1055
  isDraft: boolean | null;
@@ -987,6 +1077,7 @@ interface CreateEntityProps {
987
1077
  longitude: number;
988
1078
  };
989
1079
  metadata?: Record<string, any>;
1080
+ nsfw?: boolean;
990
1081
  isDraft?: boolean;
991
1082
  /** Create the entity without attributing it to the logged-in user (authorless). */
992
1083
  excludeUserId?: boolean;
@@ -1069,6 +1160,8 @@ interface FetchManyEntitiesProps extends SpaceReputationContextParams {
1069
1160
  };
1070
1161
  attachmentsFilters?: AttachmentsFilters;
1071
1162
  locationFilters?: LocationFilters;
1163
+ nsfwFilter?: "include-all" | "exclude" | "only";
1164
+ blockedFilter?: "exclude" | "include-outbound-blocked";
1072
1165
  }
1073
1166
  declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
1074
1167
 
@@ -1084,6 +1177,7 @@ interface UpdateEntityProps {
1084
1177
  longitude: number;
1085
1178
  };
1086
1179
  metadata?: Record<string, any>;
1180
+ nsfw?: boolean;
1087
1181
  }
1088
1182
  declare function updateEntity(client: SublayHttpClient, data: UpdateEntityProps): Promise<Entity>;
1089
1183
 
@@ -1557,6 +1651,7 @@ interface FetchManyCommentsProps extends SpaceReputationContextParams {
1557
1651
  sortDir?: "asc" | "desc";
1558
1652
  include?: string;
1559
1653
  sourceId?: string;
1654
+ blockedFilter?: "exclude" | "include-outbound-blocked";
1560
1655
  }
1561
1656
  declare function fetchManyComments(client: SublayHttpClient, data: FetchManyCommentsProps): Promise<PaginatedResponse<Comment>>;
1562
1657
 
@@ -1622,6 +1717,7 @@ interface CreateSpaceProps {
1622
1717
  requireJoinApproval?: boolean;
1623
1718
  parentSpaceId?: string;
1624
1719
  metadata?: Record<string, any>;
1720
+ nsfw?: boolean;
1625
1721
  /**
1626
1722
  * Avatar image. When present the request is sent as `multipart/form-data` and
1627
1723
  * the server processes the image per `options`.
@@ -1642,6 +1738,7 @@ interface FetchManySpacesProps {
1642
1738
  searchAny?: string;
1643
1739
  memberOf?: "true";
1644
1740
  parentSpaceId?: string | "null";
1741
+ nsfwFilter?: "include-all" | "exclude" | "only";
1645
1742
  include?: string;
1646
1743
  }
1647
1744
  declare function fetchManySpaces(client: SublayHttpClient, data: FetchManySpacesProps): Promise<PaginatedResponse<Space>>;
@@ -1697,6 +1794,7 @@ interface UpdateSpaceProps {
1697
1794
  postingPermission?: PostingPermission;
1698
1795
  visibility?: SpaceVisibility;
1699
1796
  metadata?: Record<string, any>;
1797
+ nsfw?: boolean;
1700
1798
  /**
1701
1799
  * New avatar image. When present the request is sent as `multipart/form-data`
1702
1800
  * and the server processes the image per `options`, replacing the old avatar.
@@ -1921,6 +2019,22 @@ interface ModerationResponse {
1921
2019
  }
1922
2020
  declare function moderateSpaceEntity(client: SublayHttpClient, data: ModerateSpaceEntityProps): Promise<ModerationResponse>;
1923
2021
 
2022
+ interface SetSpaceEntityNsfwProps {
2023
+ spaceId: string;
2024
+ entityId: string;
2025
+ nsfw: boolean;
2026
+ }
2027
+ interface SetSpaceEntityNsfwResponse {
2028
+ message: string;
2029
+ nsfw: boolean;
2030
+ }
2031
+ /**
2032
+ * Space-moderator endpoint to set the NSFW flag on an entity within their space
2033
+ * (including other users' entities). Near-copy of `moderateSpaceEntity`, but it
2034
+ * writes the entity's own `nsfw` (the NSFW axis), not `moderationStatus`.
2035
+ */
2036
+ declare function setSpaceEntityNsfw(client: SublayHttpClient, data: SetSpaceEntityNsfwProps): Promise<SetSpaceEntityNsfwResponse>;
2037
+
1924
2038
  interface ModerateSpaceCommentProps {
1925
2039
  spaceId: string;
1926
2040
  commentId: string;
@@ -2081,13 +2195,14 @@ declare const Spaces_moderateSpaceChatMessage: typeof moderateSpaceChatMessage;
2081
2195
  declare const Spaces_moderateSpaceComment: typeof moderateSpaceComment;
2082
2196
  declare const Spaces_moderateSpaceEntity: typeof moderateSpaceEntity;
2083
2197
  declare const Spaces_reorderRules: typeof reorderRules;
2198
+ declare const Spaces_setSpaceEntityNsfw: typeof setSpaceEntityNsfw;
2084
2199
  declare const Spaces_unbanMember: typeof unbanMember;
2085
2200
  declare const Spaces_updateDigestConfig: typeof updateDigestConfig;
2086
2201
  declare const Spaces_updateMemberRole: typeof updateMemberRole;
2087
2202
  declare const Spaces_updateRule: typeof updateRule;
2088
2203
  declare const Spaces_updateSpace: typeof updateSpace;
2089
2204
  declare namespace Spaces {
2090
- export { Spaces_approveMembership as approveMembership, Spaces_banMember as banMember, Spaces_checkMyMembership as checkMyMembership, Spaces_checkSlugAvailability as checkSlugAvailability, Spaces_createRule as createRule, Spaces_createSpace as createSpace, Spaces_declineMembership as declineMembership, Spaces_deleteRule as deleteRule, Spaces_deleteSpace as deleteSpace, Spaces_fetchChildSpaces as fetchChildSpaces, Spaces_fetchDigestConfig as fetchDigestConfig, Spaces_fetchManyRules as fetchManyRules, Spaces_fetchManySpaces as fetchManySpaces, Spaces_fetchMutualSpaces as fetchMutualSpaces, Spaces_fetchRule as fetchRule, Spaces_fetchSpace as fetchSpace, Spaces_fetchSpaceBreadcrumb as fetchSpaceBreadcrumb, Spaces_fetchSpaceByShortId as fetchSpaceByShortId, Spaces_fetchSpaceBySlug as fetchSpaceBySlug, Spaces_fetchSpaceMembers as fetchSpaceMembers, Spaces_fetchSpaceTeam as fetchSpaceTeam, Spaces_fetchUserSpaces as fetchUserSpaces, Spaces_getSpaceConversation as getSpaceConversation, Spaces_handleCommentReport as handleCommentReport, Spaces_handleEntityReport as handleEntityReport, Spaces_handleSpaceChatReport as handleSpaceChatReport, Spaces_joinSpace as joinSpace, Spaces_leaveSpace as leaveSpace, Spaces_moderateSpaceChatMessage as moderateSpaceChatMessage, Spaces_moderateSpaceComment as moderateSpaceComment, Spaces_moderateSpaceEntity as moderateSpaceEntity, Spaces_reorderRules as reorderRules, Spaces_unbanMember as unbanMember, Spaces_updateDigestConfig as updateDigestConfig, Spaces_updateMemberRole as updateMemberRole, Spaces_updateRule as updateRule, Spaces_updateSpace as updateSpace };
2205
+ export { Spaces_approveMembership as approveMembership, Spaces_banMember as banMember, Spaces_checkMyMembership as checkMyMembership, Spaces_checkSlugAvailability as checkSlugAvailability, Spaces_createRule as createRule, Spaces_createSpace as createSpace, Spaces_declineMembership as declineMembership, Spaces_deleteRule as deleteRule, Spaces_deleteSpace as deleteSpace, Spaces_fetchChildSpaces as fetchChildSpaces, Spaces_fetchDigestConfig as fetchDigestConfig, Spaces_fetchManyRules as fetchManyRules, Spaces_fetchManySpaces as fetchManySpaces, Spaces_fetchMutualSpaces as fetchMutualSpaces, Spaces_fetchRule as fetchRule, Spaces_fetchSpace as fetchSpace, Spaces_fetchSpaceBreadcrumb as fetchSpaceBreadcrumb, Spaces_fetchSpaceByShortId as fetchSpaceByShortId, Spaces_fetchSpaceBySlug as fetchSpaceBySlug, Spaces_fetchSpaceMembers as fetchSpaceMembers, Spaces_fetchSpaceTeam as fetchSpaceTeam, Spaces_fetchUserSpaces as fetchUserSpaces, Spaces_getSpaceConversation as getSpaceConversation, Spaces_handleCommentReport as handleCommentReport, Spaces_handleEntityReport as handleEntityReport, Spaces_handleSpaceChatReport as handleSpaceChatReport, Spaces_joinSpace as joinSpace, Spaces_leaveSpace as leaveSpace, Spaces_moderateSpaceChatMessage as moderateSpaceChatMessage, Spaces_moderateSpaceComment as moderateSpaceComment, Spaces_moderateSpaceEntity as moderateSpaceEntity, Spaces_reorderRules as reorderRules, Spaces_setSpaceEntityNsfw as setSpaceEntityNsfw, Spaces_unbanMember as unbanMember, Spaces_updateDigestConfig as updateDigestConfig, Spaces_updateMemberRole as updateMemberRole, Spaces_updateRule as updateRule, Spaces_updateSpace as updateSpace };
2091
2206
  }
2092
2207
 
2093
2208
  interface Collection {
@@ -2891,6 +3006,7 @@ interface OAuthIdentity {
2891
3006
  }
2892
3007
  interface ListIdentitiesResponse {
2893
3008
  identities: OAuthIdentity[];
3009
+ hasPassword: boolean;
2894
3010
  }
2895
3011
 
2896
3012
  /** List the current user's linked OAuth identities (authenticated). */
package/dist/index.js CHANGED
@@ -177,6 +177,7 @@ __export(auth_exports, {
177
177
  requestPasswordReset: () => requestPasswordReset,
178
178
  resetPassword: () => resetPassword,
179
179
  sendVerificationEmail: () => sendVerificationEmail,
180
+ setPassword: () => setPassword,
180
181
  signIn: () => signIn,
181
182
  signOut: () => signOut,
182
183
  signUp: () => signUp,
@@ -270,6 +271,15 @@ async function changePassword(client, data) {
270
271
  return response.data;
271
272
  }
272
273
 
274
+ // src/modules/auth/setPassword.ts
275
+ async function setPassword(client, data) {
276
+ const response = await client.projectInstance.post(
277
+ "/auth/set-password",
278
+ data
279
+ );
280
+ return response.data;
281
+ }
282
+
273
283
  // src/modules/auth/verifyEmail.ts
274
284
  async function verifyEmail(client, data) {
275
285
  await client.projectInstance.post("/auth/verify-email", data);
@@ -302,8 +312,12 @@ async function confirmAccountDeletion(client, data) {
302
312
  var users_exports = {};
303
313
  __export(users_exports, {
304
314
  checkUsernameAvailability: () => checkUsernameAvailability,
315
+ createBlock: () => createBlock,
305
316
  createFollow: () => createFollow,
317
+ deleteBlock: () => deleteBlock,
306
318
  deleteFollow: () => deleteFollow,
319
+ fetchBlockStatus: () => fetchBlockStatus,
320
+ fetchBlockedUsers: () => fetchBlockedUsers,
307
321
  fetchConnectionStatus: () => fetchConnectionStatus,
308
322
  fetchConnectionsByUserId: () => fetchConnectionsByUserId,
309
323
  fetchConnectionsCountByUserId: () => fetchConnectionsCountByUserId,
@@ -647,6 +661,37 @@ async function removeConnectionByUserId(client, data) {
647
661
  return response.data;
648
662
  }
649
663
 
664
+ // src/modules/users/createBlock.ts
665
+ async function createBlock(client, data) {
666
+ const { userId } = data;
667
+ const response = await client.projectInstance.post(
668
+ `/users/${userId}/block`,
669
+ {}
670
+ );
671
+ return response.data;
672
+ }
673
+
674
+ // src/modules/users/deleteBlock.ts
675
+ async function deleteBlock(client, data) {
676
+ const { userId } = data;
677
+ await client.projectInstance.delete(`/users/${userId}/block`);
678
+ }
679
+
680
+ // src/modules/users/fetchBlockStatus.ts
681
+ async function fetchBlockStatus(client, data) {
682
+ const { userId } = data;
683
+ const response = await client.projectInstance.get(
684
+ `/users/${userId}/block`
685
+ );
686
+ return response.data;
687
+ }
688
+
689
+ // src/modules/users/fetchBlockedUsers.ts
690
+ async function fetchBlockedUsers(client, data = {}) {
691
+ const response = await client.projectInstance.get("/blocks", { params: data });
692
+ return response.data;
693
+ }
694
+
650
695
  // src/modules/entities/index.ts
651
696
  var entities_exports = {};
652
697
  __export(entities_exports, {
@@ -1210,6 +1255,7 @@ __export(spaces_exports, {
1210
1255
  moderateSpaceComment: () => moderateSpaceComment,
1211
1256
  moderateSpaceEntity: () => moderateSpaceEntity,
1212
1257
  reorderRules: () => reorderRules,
1258
+ setSpaceEntityNsfw: () => setSpaceEntityNsfw,
1213
1259
  unbanMember: () => unbanMember,
1214
1260
  updateDigestConfig: () => updateDigestConfig,
1215
1261
  updateMemberRole: () => updateMemberRole,
@@ -1562,6 +1608,16 @@ async function moderateSpaceEntity(client, data) {
1562
1608
  return response.data;
1563
1609
  }
1564
1610
 
1611
+ // src/modules/spaces/setSpaceEntityNsfw.ts
1612
+ async function setSpaceEntityNsfw(client, data) {
1613
+ const { spaceId, entityId, ...body } = data;
1614
+ const response = await client.projectInstance.patch(
1615
+ `/spaces/${spaceId}/entities/${entityId}/nsfw`,
1616
+ body
1617
+ );
1618
+ return response.data;
1619
+ }
1620
+
1565
1621
  // src/modules/spaces/moderateSpaceComment.ts
1566
1622
  async function moderateSpaceComment(client, data) {
1567
1623
  const { spaceId, commentId, ...body } = data;
package/dist/index.mjs CHANGED
@@ -145,6 +145,7 @@ __export(auth_exports, {
145
145
  requestPasswordReset: () => requestPasswordReset,
146
146
  resetPassword: () => resetPassword,
147
147
  sendVerificationEmail: () => sendVerificationEmail,
148
+ setPassword: () => setPassword,
148
149
  signIn: () => signIn,
149
150
  signOut: () => signOut,
150
151
  signUp: () => signUp,
@@ -238,6 +239,15 @@ async function changePassword(client, data) {
238
239
  return response.data;
239
240
  }
240
241
 
242
+ // src/modules/auth/setPassword.ts
243
+ async function setPassword(client, data) {
244
+ const response = await client.projectInstance.post(
245
+ "/auth/set-password",
246
+ data
247
+ );
248
+ return response.data;
249
+ }
250
+
241
251
  // src/modules/auth/verifyEmail.ts
242
252
  async function verifyEmail(client, data) {
243
253
  await client.projectInstance.post("/auth/verify-email", data);
@@ -270,8 +280,12 @@ async function confirmAccountDeletion(client, data) {
270
280
  var users_exports = {};
271
281
  __export(users_exports, {
272
282
  checkUsernameAvailability: () => checkUsernameAvailability,
283
+ createBlock: () => createBlock,
273
284
  createFollow: () => createFollow,
285
+ deleteBlock: () => deleteBlock,
274
286
  deleteFollow: () => deleteFollow,
287
+ fetchBlockStatus: () => fetchBlockStatus,
288
+ fetchBlockedUsers: () => fetchBlockedUsers,
275
289
  fetchConnectionStatus: () => fetchConnectionStatus,
276
290
  fetchConnectionsByUserId: () => fetchConnectionsByUserId,
277
291
  fetchConnectionsCountByUserId: () => fetchConnectionsCountByUserId,
@@ -615,6 +629,37 @@ async function removeConnectionByUserId(client, data) {
615
629
  return response.data;
616
630
  }
617
631
 
632
+ // src/modules/users/createBlock.ts
633
+ async function createBlock(client, data) {
634
+ const { userId } = data;
635
+ const response = await client.projectInstance.post(
636
+ `/users/${userId}/block`,
637
+ {}
638
+ );
639
+ return response.data;
640
+ }
641
+
642
+ // src/modules/users/deleteBlock.ts
643
+ async function deleteBlock(client, data) {
644
+ const { userId } = data;
645
+ await client.projectInstance.delete(`/users/${userId}/block`);
646
+ }
647
+
648
+ // src/modules/users/fetchBlockStatus.ts
649
+ async function fetchBlockStatus(client, data) {
650
+ const { userId } = data;
651
+ const response = await client.projectInstance.get(
652
+ `/users/${userId}/block`
653
+ );
654
+ return response.data;
655
+ }
656
+
657
+ // src/modules/users/fetchBlockedUsers.ts
658
+ async function fetchBlockedUsers(client, data = {}) {
659
+ const response = await client.projectInstance.get("/blocks", { params: data });
660
+ return response.data;
661
+ }
662
+
618
663
  // src/modules/entities/index.ts
619
664
  var entities_exports = {};
620
665
  __export(entities_exports, {
@@ -1178,6 +1223,7 @@ __export(spaces_exports, {
1178
1223
  moderateSpaceComment: () => moderateSpaceComment,
1179
1224
  moderateSpaceEntity: () => moderateSpaceEntity,
1180
1225
  reorderRules: () => reorderRules,
1226
+ setSpaceEntityNsfw: () => setSpaceEntityNsfw,
1181
1227
  unbanMember: () => unbanMember,
1182
1228
  updateDigestConfig: () => updateDigestConfig,
1183
1229
  updateMemberRole: () => updateMemberRole,
@@ -1530,6 +1576,16 @@ async function moderateSpaceEntity(client, data) {
1530
1576
  return response.data;
1531
1577
  }
1532
1578
 
1579
+ // src/modules/spaces/setSpaceEntityNsfw.ts
1580
+ async function setSpaceEntityNsfw(client, data) {
1581
+ const { spaceId, entityId, ...body } = data;
1582
+ const response = await client.projectInstance.patch(
1583
+ `/spaces/${spaceId}/entities/${entityId}/nsfw`,
1584
+ body
1585
+ );
1586
+ return response.data;
1587
+ }
1588
+
1533
1589
  // src/modules/spaces/moderateSpaceComment.ts
1534
1590
  async function moderateSpaceComment(client, data) {
1535
1591
  const { spaceId, commentId, ...body } = data;
@@ -39,6 +39,8 @@ export interface Entity {
39
39
  coordinates: [number, number];
40
40
  } | null;
41
41
  metadata: Record<string, any>;
42
+ nsfw: boolean;
43
+ nsfwEffective: boolean;
42
44
  topComment: TopComment | null;
43
45
  isSaved?: boolean;
44
46
  isDraft: boolean | null;
@@ -10,4 +10,5 @@ export interface OAuthIdentity {
10
10
  }
11
11
  export interface ListIdentitiesResponse {
12
12
  identities: OAuthIdentity[];
13
+ hasPassword: boolean;
13
14
  }
@@ -40,6 +40,8 @@ export interface Space {
40
40
  postingPermission: PostingPermission;
41
41
  visibility: SpaceVisibility;
42
42
  requireJoinApproval: boolean;
43
+ nsfw: boolean;
44
+ nsfwEffective: boolean;
43
45
  parentSpaceId: string | null;
44
46
  depth: number;
45
47
  metadata: Record<string, any>;
@@ -6,6 +6,7 @@ export { verifyExternalUser } from "./verifyExternalUser";
6
6
  export { requestPasswordReset } from "./requestPasswordReset";
7
7
  export { resetPassword } from "./resetPassword";
8
8
  export { changePassword } from "./changePassword";
9
+ export { setPassword } from "./setPassword";
9
10
  export { verifyEmail } from "./verifyEmail";
10
11
  export { sendVerificationEmail } from "./sendVerificationEmail";
11
12
  export { requestAccountDeletion } from "./requestAccountDeletion";
@@ -0,0 +1,9 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface SetPasswordProps {
3
+ newPassword: string;
4
+ }
5
+ export interface SetPasswordResponse {
6
+ success: boolean;
7
+ message: string;
8
+ }
9
+ export declare function setPassword(client: SublayHttpClient, data: SetPasswordProps): Promise<SetPasswordResponse>;
@@ -21,5 +21,6 @@ export interface FetchManyCommentsProps extends SpaceReputationContextParams {
21
21
  sortDir?: "asc" | "desc";
22
22
  include?: string;
23
23
  sourceId?: string;
24
+ blockedFilter?: "exclude" | "include-outbound-blocked";
24
25
  }
25
26
  export declare function fetchManyComments(client: SublayHttpClient, data: FetchManyCommentsProps): Promise<PaginatedResponse<Comment>>;
@@ -15,6 +15,7 @@ export interface CreateEntityProps {
15
15
  longitude: number;
16
16
  };
17
17
  metadata?: Record<string, any>;
18
+ nsfw?: boolean;
18
19
  isDraft?: boolean;
19
20
  /** Create the entity without attributing it to the logged-in user (authorless). */
20
21
  excludeUserId?: boolean;
@@ -59,5 +59,7 @@ export interface FetchManyEntitiesProps extends SpaceReputationContextParams {
59
59
  };
60
60
  attachmentsFilters?: AttachmentsFilters;
61
61
  locationFilters?: LocationFilters;
62
+ nsfwFilter?: "include-all" | "exclude" | "only";
63
+ blockedFilter?: "exclude" | "include-outbound-blocked";
62
64
  }
63
65
  export declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
@@ -13,5 +13,6 @@ export interface UpdateEntityProps {
13
13
  longitude: number;
14
14
  };
15
15
  metadata?: Record<string, any>;
16
+ nsfw?: boolean;
16
17
  }
17
18
  export declare function updateEntity(client: SublayHttpClient, data: UpdateEntityProps): Promise<Entity>;
@@ -17,6 +17,7 @@ export interface CreateSpaceProps {
17
17
  requireJoinApproval?: boolean;
18
18
  parentSpaceId?: string;
19
19
  metadata?: Record<string, any>;
20
+ nsfw?: boolean;
20
21
  /**
21
22
  * Avatar image. When present the request is sent as `multipart/form-data` and
22
23
  * the server processes the image per `options`.
@@ -11,6 +11,7 @@ export interface FetchManySpacesProps {
11
11
  searchAny?: string;
12
12
  memberOf?: "true";
13
13
  parentSpaceId?: string | "null";
14
+ nsfwFilter?: "include-all" | "exclude" | "only";
14
15
  include?: string;
15
16
  }
16
17
  export declare function fetchManySpaces(client: SublayHttpClient, data: FetchManySpacesProps): Promise<PaginatedResponse<Space>>;
@@ -29,6 +29,7 @@ export { reorderRules } from "./reorderRules";
29
29
  export { handleEntityReport } from "./handleEntityReport";
30
30
  export { handleCommentReport } from "./handleCommentReport";
31
31
  export { moderateSpaceEntity } from "./moderateSpaceEntity";
32
+ export { setSpaceEntityNsfw } from "./setSpaceEntityNsfw";
32
33
  export { moderateSpaceComment } from "./moderateSpaceComment";
33
34
  export { fetchDigestConfig } from "./fetchDigestConfig";
34
35
  export { updateDigestConfig } from "./updateDigestConfig";
@@ -0,0 +1,16 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface SetSpaceEntityNsfwProps {
3
+ spaceId: string;
4
+ entityId: string;
5
+ nsfw: boolean;
6
+ }
7
+ export interface SetSpaceEntityNsfwResponse {
8
+ message: string;
9
+ nsfw: boolean;
10
+ }
11
+ /**
12
+ * Space-moderator endpoint to set the NSFW flag on an entity within their space
13
+ * (including other users' entities). Near-copy of `moderateSpaceEntity`, but it
14
+ * writes the entity's own `nsfw` (the NSFW axis), not `moderationStatus`.
15
+ */
16
+ export declare function setSpaceEntityNsfw(client: SublayHttpClient, data: SetSpaceEntityNsfwProps): Promise<SetSpaceEntityNsfwResponse>;
@@ -10,6 +10,7 @@ export interface UpdateSpaceProps {
10
10
  postingPermission?: PostingPermission;
11
11
  visibility?: SpaceVisibility;
12
12
  metadata?: Record<string, any>;
13
+ nsfw?: boolean;
13
14
  /**
14
15
  * New avatar image. When present the request is sent as `multipart/form-data`
15
16
  * and the server processes the image per `options`, replacing the old avatar.
@@ -0,0 +1,19 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface CreateBlockProps {
3
+ /** The user being blocked (the target). The blocker is the token holder. */
4
+ userId: string;
5
+ }
6
+ export interface BlockResponse {
7
+ id: string;
8
+ blockerId: string;
9
+ blockedId: string;
10
+ createdAt: string;
11
+ }
12
+ /**
13
+ * POST /users/:userId/block — block `:userId`.
14
+ *
15
+ * The blocker is derived from the token (Rule A — no `actingUserId`). Idempotent:
16
+ * re-blocking an already-blocked user succeeds. Self-block is rejected server-side.
17
+ * On a new block the server tears down existing follows/connections both ways.
18
+ */
19
+ export declare function createBlock(client: SublayHttpClient, data: CreateBlockProps): Promise<BlockResponse>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface DeleteBlockProps {
3
+ /** The user being unblocked (the target). The blocker is the token holder. */
4
+ userId: string;
5
+ }
6
+ /**
7
+ * DELETE /users/:userId/block — unblock `:userId`.
8
+ *
9
+ * The blocker is derived from the token (Rule A — no `actingUserId`). Idempotent:
10
+ * unblocking a user who isn't blocked succeeds. Restores nothing (torn-down
11
+ * follows/connections are gone for good).
12
+ */
13
+ export declare function deleteBlock(client: SublayHttpClient, data: DeleteBlockProps): Promise<void>;
@@ -0,0 +1,23 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface FetchBlockStatusProps {
3
+ /**
4
+ * The user whose block status is being checked (the target). The status is the
5
+ * token holder's OUTBOUND state only: do *I* block `:userId`?
6
+ */
7
+ userId: string;
8
+ }
9
+ /**
10
+ * The block-status response is outbound-only by design: it reports whether the
11
+ * token holder blocks the target, and NEVER whether the target blocked the
12
+ * caller (the inbound direction is deliberately not disclosed).
13
+ */
14
+ export interface BlockStatusResponse {
15
+ blocked: boolean;
16
+ blockId?: string;
17
+ createdAt?: string;
18
+ }
19
+ /**
20
+ * GET /users/:userId/block — the token holder's outbound block status toward
21
+ * `:userId` (Rule A — no `actingUserId`).
22
+ */
23
+ export declare function fetchBlockStatus(client: SublayHttpClient, data: FetchBlockStatusProps): Promise<BlockStatusResponse>;
@@ -0,0 +1,19 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { User } from "../../interfaces/User";
3
+ import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
4
+ export interface FetchBlockedUsersProps {
5
+ page?: number;
6
+ limit?: number;
7
+ }
8
+ /** An entry in the token holder's own block list (their outbound blocks). */
9
+ export interface BlockedUserListItem {
10
+ id: string;
11
+ blockedUser: User | null;
12
+ createdAt: string;
13
+ }
14
+ /**
15
+ * GET /blocks — the token holder's own block list (their outbound blocks),
16
+ * paginated. This is the private "manage / way back to unblock" surface (Rule A
17
+ * — the subject is derived from the token, no `actingUserId`).
18
+ */
19
+ export declare function fetchBlockedUsers(client: SublayHttpClient, data?: FetchBlockedUsersProps): Promise<PaginatedResponse<BlockedUserListItem>>;
@@ -16,3 +16,7 @@ export { fetchFollowStatus } from "./fetchFollowStatus";
16
16
  export { requestConnection } from "./requestConnection";
17
17
  export { fetchConnectionStatus } from "./fetchConnectionStatus";
18
18
  export { removeConnectionByUserId } from "./removeConnectionByUserId";
19
+ export { createBlock } from "./createBlock";
20
+ export { deleteBlock } from "./deleteBlock";
21
+ export { fetchBlockStatus } from "./fetchBlockStatus";
22
+ export { fetchBlockedUsers } from "./fetchBlockedUsers";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sublay/js",
3
- "version": "7.4.3",
3
+ "version": "7.6.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [