@sublay/js 7.5.0 → 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 +79 -1
- package/dist/index.js +35 -0
- package/dist/index.mjs +35 -0
- package/dist/modules/comments/fetchManyComments.d.ts +1 -0
- package/dist/modules/entities/fetchManyEntities.d.ts +1 -0
- package/dist/modules/users/createBlock.d.ts +19 -0
- package/dist/modules/users/deleteBlock.d.ts +13 -0
- package/dist/modules/users/fetchBlockStatus.d.ts +23 -0
- package/dist/modules/users/fetchBlockedUsers.d.ts +19 -0
- package/dist/modules/users/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -734,8 +734,84 @@ interface RemoveConnectionByUserIdProps {
|
|
|
734
734
|
}
|
|
735
735
|
declare function removeConnectionByUserId(client: SublayHttpClient, data: RemoveConnectionByUserIdProps): Promise<RemoveConnectionByUserIdResponse>;
|
|
736
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
|
+
|
|
737
809
|
declare const Users_checkUsernameAvailability: typeof checkUsernameAvailability;
|
|
810
|
+
declare const Users_createBlock: typeof createBlock;
|
|
738
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;
|
|
739
815
|
declare const Users_fetchConnectionStatus: typeof fetchConnectionStatus;
|
|
740
816
|
declare const Users_fetchConnectionsByUserId: typeof fetchConnectionsByUserId;
|
|
741
817
|
declare const Users_fetchConnectionsCountByUserId: typeof fetchConnectionsCountByUserId;
|
|
@@ -752,7 +828,7 @@ declare const Users_removeConnectionByUserId: typeof removeConnectionByUserId;
|
|
|
752
828
|
declare const Users_requestConnection: typeof requestConnection;
|
|
753
829
|
declare const Users_updateUser: typeof updateUser;
|
|
754
830
|
declare namespace Users {
|
|
755
|
-
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 };
|
|
756
832
|
}
|
|
757
833
|
|
|
758
834
|
type Mention = UserMention | SpaceMention;
|
|
@@ -1085,6 +1161,7 @@ interface FetchManyEntitiesProps extends SpaceReputationContextParams {
|
|
|
1085
1161
|
attachmentsFilters?: AttachmentsFilters;
|
|
1086
1162
|
locationFilters?: LocationFilters;
|
|
1087
1163
|
nsfwFilter?: "include-all" | "exclude" | "only";
|
|
1164
|
+
blockedFilter?: "exclude" | "include-outbound-blocked";
|
|
1088
1165
|
}
|
|
1089
1166
|
declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
|
|
1090
1167
|
|
|
@@ -1574,6 +1651,7 @@ interface FetchManyCommentsProps extends SpaceReputationContextParams {
|
|
|
1574
1651
|
sortDir?: "asc" | "desc";
|
|
1575
1652
|
include?: string;
|
|
1576
1653
|
sourceId?: string;
|
|
1654
|
+
blockedFilter?: "exclude" | "include-outbound-blocked";
|
|
1577
1655
|
}
|
|
1578
1656
|
declare function fetchManyComments(client: SublayHttpClient, data: FetchManyCommentsProps): Promise<PaginatedResponse<Comment>>;
|
|
1579
1657
|
|
package/dist/index.js
CHANGED
|
@@ -312,8 +312,12 @@ async function confirmAccountDeletion(client, data) {
|
|
|
312
312
|
var users_exports = {};
|
|
313
313
|
__export(users_exports, {
|
|
314
314
|
checkUsernameAvailability: () => checkUsernameAvailability,
|
|
315
|
+
createBlock: () => createBlock,
|
|
315
316
|
createFollow: () => createFollow,
|
|
317
|
+
deleteBlock: () => deleteBlock,
|
|
316
318
|
deleteFollow: () => deleteFollow,
|
|
319
|
+
fetchBlockStatus: () => fetchBlockStatus,
|
|
320
|
+
fetchBlockedUsers: () => fetchBlockedUsers,
|
|
317
321
|
fetchConnectionStatus: () => fetchConnectionStatus,
|
|
318
322
|
fetchConnectionsByUserId: () => fetchConnectionsByUserId,
|
|
319
323
|
fetchConnectionsCountByUserId: () => fetchConnectionsCountByUserId,
|
|
@@ -657,6 +661,37 @@ async function removeConnectionByUserId(client, data) {
|
|
|
657
661
|
return response.data;
|
|
658
662
|
}
|
|
659
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
|
+
|
|
660
695
|
// src/modules/entities/index.ts
|
|
661
696
|
var entities_exports = {};
|
|
662
697
|
__export(entities_exports, {
|
package/dist/index.mjs
CHANGED
|
@@ -280,8 +280,12 @@ async function confirmAccountDeletion(client, data) {
|
|
|
280
280
|
var users_exports = {};
|
|
281
281
|
__export(users_exports, {
|
|
282
282
|
checkUsernameAvailability: () => checkUsernameAvailability,
|
|
283
|
+
createBlock: () => createBlock,
|
|
283
284
|
createFollow: () => createFollow,
|
|
285
|
+
deleteBlock: () => deleteBlock,
|
|
284
286
|
deleteFollow: () => deleteFollow,
|
|
287
|
+
fetchBlockStatus: () => fetchBlockStatus,
|
|
288
|
+
fetchBlockedUsers: () => fetchBlockedUsers,
|
|
285
289
|
fetchConnectionStatus: () => fetchConnectionStatus,
|
|
286
290
|
fetchConnectionsByUserId: () => fetchConnectionsByUserId,
|
|
287
291
|
fetchConnectionsCountByUserId: () => fetchConnectionsCountByUserId,
|
|
@@ -625,6 +629,37 @@ async function removeConnectionByUserId(client, data) {
|
|
|
625
629
|
return response.data;
|
|
626
630
|
}
|
|
627
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
|
+
|
|
628
663
|
// src/modules/entities/index.ts
|
|
629
664
|
var entities_exports = {};
|
|
630
665
|
__export(entities_exports, {
|
|
@@ -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>>;
|
|
@@ -60,5 +60,6 @@ export interface FetchManyEntitiesProps extends SpaceReputationContextParams {
|
|
|
60
60
|
attachmentsFilters?: AttachmentsFilters;
|
|
61
61
|
locationFilters?: LocationFilters;
|
|
62
62
|
nsfwFilter?: "include-all" | "exclude" | "only";
|
|
63
|
+
blockedFilter?: "exclude" | "include-outbound-blocked";
|
|
63
64
|
}
|
|
64
65
|
export declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
|
|
@@ -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";
|