@sublay/js 7.5.0 → 7.7.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/README.md +1 -1
- package/dist/index.d.mts +273 -38
- package/dist/index.d.ts +3 -0
- package/dist/index.js +130 -21
- package/dist/index.mjs +130 -21
- package/dist/interfaces/Space.d.ts +0 -16
- package/dist/interfaces/Workspace.d.ts +75 -0
- package/dist/modules/chat/editMessage.d.ts +3 -2
- package/dist/modules/comments/fetchManyComments.d.ts +1 -0
- package/dist/modules/entities/fetchManyEntities.d.ts +1 -0
- package/dist/modules/spaces/index.d.ts +0 -2
- 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/dist/modules/workspaces/acceptInvite.d.ts +13 -0
- package/dist/modules/workspaces/createInvite.d.ts +17 -0
- package/dist/modules/workspaces/createWorkspace.d.ts +12 -0
- package/dist/modules/workspaces/declineInvite.d.ts +12 -0
- package/dist/modules/workspaces/fetchManyWorkspaces.d.ts +13 -0
- package/dist/modules/workspaces/fetchMembers.d.ts +13 -0
- package/dist/modules/workspaces/fetchMyInvites.d.ts +11 -0
- package/dist/modules/workspaces/fetchWorkspace.d.ts +7 -0
- package/dist/modules/workspaces/getAuthority.d.ts +11 -0
- package/dist/modules/workspaces/index.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ One `SublayClient` with 14 module namespaces (call them as `sublay.<module>.<fn>
|
|
|
42
42
|
| `users` | profiles, username lookup, suggestions, updates, and the per-user follow/connection graph |
|
|
43
43
|
| `entities` | content CRUD, drafts, feeds (`fetchManyEntities`), reactions, saves |
|
|
44
44
|
| `comments` | threaded comments CRUD, reactions |
|
|
45
|
-
| `spaces` | communities: lifecycle, membership, roles, rules,
|
|
45
|
+
| `spaces` | communities: lifecycle, membership, roles, rules, moderation |
|
|
46
46
|
| `collections` | saved-entity collections |
|
|
47
47
|
| `follows` / `connections` | the logged-in user's own follow graph and mutual connections |
|
|
48
48
|
| `appNotifications` | in-app notifications and unread counts |
|
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;
|
|
@@ -891,22 +967,6 @@ interface CheckMyMembershipResponse {
|
|
|
891
967
|
}
|
|
892
968
|
interface DeleteSpaceResponse {
|
|
893
969
|
message: string;
|
|
894
|
-
deletedSpace: {
|
|
895
|
-
id: string;
|
|
896
|
-
name: string;
|
|
897
|
-
};
|
|
898
|
-
counts: {
|
|
899
|
-
entities: number;
|
|
900
|
-
members: number;
|
|
901
|
-
childSpaces: number;
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
|
-
interface DigestConfig {
|
|
905
|
-
digestEnabled: boolean;
|
|
906
|
-
digestWebhookUrl: string | null;
|
|
907
|
-
digestWebhookSecret: string | null;
|
|
908
|
-
digestScheduleHour: number | null;
|
|
909
|
-
digestTimezone: string | null;
|
|
910
970
|
}
|
|
911
971
|
interface SpaceBreadcrumb {
|
|
912
972
|
breadcrumb: SpacePreview[];
|
|
@@ -1085,6 +1145,7 @@ interface FetchManyEntitiesProps extends SpaceReputationContextParams {
|
|
|
1085
1145
|
attachmentsFilters?: AttachmentsFilters;
|
|
1086
1146
|
locationFilters?: LocationFilters;
|
|
1087
1147
|
nsfwFilter?: "include-all" | "exclude" | "only";
|
|
1148
|
+
blockedFilter?: "exclude" | "include-outbound-blocked";
|
|
1088
1149
|
}
|
|
1089
1150
|
declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
|
|
1090
1151
|
|
|
@@ -1574,6 +1635,7 @@ interface FetchManyCommentsProps extends SpaceReputationContextParams {
|
|
|
1574
1635
|
sortDir?: "asc" | "desc";
|
|
1575
1636
|
include?: string;
|
|
1576
1637
|
sourceId?: string;
|
|
1638
|
+
blockedFilter?: "exclude" | "include-outbound-blocked";
|
|
1577
1639
|
}
|
|
1578
1640
|
declare function fetchManyComments(client: SublayHttpClient, data: FetchManyCommentsProps): Promise<PaginatedResponse<Comment>>;
|
|
1579
1641
|
|
|
@@ -1965,21 +2027,6 @@ interface ModerateSpaceCommentProps {
|
|
|
1965
2027
|
}
|
|
1966
2028
|
declare function moderateSpaceComment(client: SublayHttpClient, data: ModerateSpaceCommentProps): Promise<ModerationResponse>;
|
|
1967
2029
|
|
|
1968
|
-
interface FetchDigestConfigProps {
|
|
1969
|
-
spaceId: string;
|
|
1970
|
-
}
|
|
1971
|
-
declare function fetchDigestConfig(client: SublayHttpClient, data: FetchDigestConfigProps): Promise<DigestConfig>;
|
|
1972
|
-
|
|
1973
|
-
interface UpdateDigestConfigProps {
|
|
1974
|
-
spaceId: string;
|
|
1975
|
-
digestEnabled?: boolean;
|
|
1976
|
-
digestWebhookUrl?: string;
|
|
1977
|
-
digestWebhookSecret?: string;
|
|
1978
|
-
digestScheduleHour?: number;
|
|
1979
|
-
digestTimezone?: string;
|
|
1980
|
-
}
|
|
1981
|
-
declare function updateDigestConfig(client: SublayHttpClient, data: UpdateDigestConfigProps): Promise<DigestConfig>;
|
|
1982
|
-
|
|
1983
2030
|
interface ChatMessage {
|
|
1984
2031
|
id: string;
|
|
1985
2032
|
projectId: string;
|
|
@@ -2095,7 +2142,6 @@ declare const Spaces_declineMembership: typeof declineMembership;
|
|
|
2095
2142
|
declare const Spaces_deleteRule: typeof deleteRule;
|
|
2096
2143
|
declare const Spaces_deleteSpace: typeof deleteSpace;
|
|
2097
2144
|
declare const Spaces_fetchChildSpaces: typeof fetchChildSpaces;
|
|
2098
|
-
declare const Spaces_fetchDigestConfig: typeof fetchDigestConfig;
|
|
2099
2145
|
declare const Spaces_fetchManyRules: typeof fetchManyRules;
|
|
2100
2146
|
declare const Spaces_fetchManySpaces: typeof fetchManySpaces;
|
|
2101
2147
|
declare const Spaces_fetchMutualSpaces: typeof fetchMutualSpaces;
|
|
@@ -2119,12 +2165,11 @@ declare const Spaces_moderateSpaceEntity: typeof moderateSpaceEntity;
|
|
|
2119
2165
|
declare const Spaces_reorderRules: typeof reorderRules;
|
|
2120
2166
|
declare const Spaces_setSpaceEntityNsfw: typeof setSpaceEntityNsfw;
|
|
2121
2167
|
declare const Spaces_unbanMember: typeof unbanMember;
|
|
2122
|
-
declare const Spaces_updateDigestConfig: typeof updateDigestConfig;
|
|
2123
2168
|
declare const Spaces_updateMemberRole: typeof updateMemberRole;
|
|
2124
2169
|
declare const Spaces_updateRule: typeof updateRule;
|
|
2125
2170
|
declare const Spaces_updateSpace: typeof updateSpace;
|
|
2126
2171
|
declare namespace Spaces {
|
|
2127
|
-
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,
|
|
2172
|
+
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_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_updateMemberRole as updateMemberRole, Spaces_updateRule as updateRule, Spaces_updateSpace as updateSpace };
|
|
2128
2173
|
}
|
|
2129
2174
|
|
|
2130
2175
|
interface Collection {
|
|
@@ -3120,8 +3165,8 @@ interface EditMessageProps {
|
|
|
3120
3165
|
conversationId: string;
|
|
3121
3166
|
messageId: string;
|
|
3122
3167
|
content?: string;
|
|
3123
|
-
/** A GIF
|
|
3124
|
-
gif?:
|
|
3168
|
+
/** A GIF attachment, or null to clear it. */
|
|
3169
|
+
gif?: GifData | null;
|
|
3125
3170
|
mentions?: Mention[];
|
|
3126
3171
|
metadata?: Record<string, any> | null;
|
|
3127
3172
|
}
|
|
@@ -3295,6 +3340,195 @@ declare namespace Push {
|
|
|
3295
3340
|
export { Push_getNotificationPreferences as getNotificationPreferences, Push_updateNotificationPreferences as updateNotificationPreferences };
|
|
3296
3341
|
}
|
|
3297
3342
|
|
|
3343
|
+
/**
|
|
3344
|
+
* Workspaces bundle interfaces (client subset). Mirrors the server's
|
|
3345
|
+
* `IWorkspace` / `IWorkspaceMember` / `IWorkspaceInvitation` shapes and the
|
|
3346
|
+
* workspace controller responses.
|
|
3347
|
+
*
|
|
3348
|
+
* `capabilities` is a CLOSED, Sublay-enforced vocabulary (cascades via reach);
|
|
3349
|
+
* `permissions` is opaque free-form developer strings Sublay never consumes
|
|
3350
|
+
* (per-node only, does NOT cascade).
|
|
3351
|
+
*/
|
|
3352
|
+
type WorkspaceCapability = "view" | "invite" | "remove-member" | "edit-member-access" | "edit-member-profile" | "create-sub-workspace" | "edit-workspace";
|
|
3353
|
+
type WorkspaceInvitationStatus = "pending" | "accepted" | "declined" | "revoked";
|
|
3354
|
+
type WorkspaceAuthorityReason = "owner" | "ancestor-owner" | "member" | "reach-holder";
|
|
3355
|
+
interface Workspace {
|
|
3356
|
+
id: string;
|
|
3357
|
+
name: string;
|
|
3358
|
+
metadata: Record<string, any>;
|
|
3359
|
+
ownerId: string;
|
|
3360
|
+
parentWorkspaceId: string | null;
|
|
3361
|
+
depth: number;
|
|
3362
|
+
inheritsFromParent: boolean;
|
|
3363
|
+
createdAt: string;
|
|
3364
|
+
updatedAt: string;
|
|
3365
|
+
memberCount?: number;
|
|
3366
|
+
}
|
|
3367
|
+
interface WorkspaceInvitation {
|
|
3368
|
+
id: string;
|
|
3369
|
+
workspaceId: string;
|
|
3370
|
+
invitedBy: string;
|
|
3371
|
+
userId: string | null;
|
|
3372
|
+
email: string | null;
|
|
3373
|
+
capabilities: WorkspaceCapability[];
|
|
3374
|
+
permissions: string[];
|
|
3375
|
+
rank: number;
|
|
3376
|
+
title: string | null;
|
|
3377
|
+
status: WorkspaceInvitationStatus;
|
|
3378
|
+
expiresAt: string;
|
|
3379
|
+
createdAt: string;
|
|
3380
|
+
updatedAt: string;
|
|
3381
|
+
}
|
|
3382
|
+
interface WorkspaceRosterReason {
|
|
3383
|
+
type: "owner" | "member" | "ancestor-owner" | "reach-holder" | "descendant-member";
|
|
3384
|
+
rank?: number;
|
|
3385
|
+
capabilities?: WorkspaceCapability[];
|
|
3386
|
+
permissions?: string[];
|
|
3387
|
+
title?: string | null;
|
|
3388
|
+
metadata?: Record<string, any>;
|
|
3389
|
+
viaWorkspaceId?: string;
|
|
3390
|
+
workspaceId?: string;
|
|
3391
|
+
}
|
|
3392
|
+
interface WorkspaceRosterEntry {
|
|
3393
|
+
user: User;
|
|
3394
|
+
reasons: WorkspaceRosterReason[];
|
|
3395
|
+
}
|
|
3396
|
+
interface WorkspaceRosterResponse {
|
|
3397
|
+
data: WorkspaceRosterEntry[];
|
|
3398
|
+
total: number;
|
|
3399
|
+
}
|
|
3400
|
+
interface WorkspaceRosterCountsResponse {
|
|
3401
|
+
counts: {
|
|
3402
|
+
owner: number;
|
|
3403
|
+
member: number;
|
|
3404
|
+
ancestorOwner: number;
|
|
3405
|
+
reachHolder: number;
|
|
3406
|
+
descendantMember: number;
|
|
3407
|
+
};
|
|
3408
|
+
total: number;
|
|
3409
|
+
distinctUsers: number;
|
|
3410
|
+
}
|
|
3411
|
+
interface WorkspaceAuthority {
|
|
3412
|
+
reasons: WorkspaceAuthorityReason[];
|
|
3413
|
+
capabilities: WorkspaceCapability[];
|
|
3414
|
+
permissions: string[];
|
|
3415
|
+
rank: number | null;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
interface CreateWorkspaceProps {
|
|
3419
|
+
name: string;
|
|
3420
|
+
metadata?: Record<string, any>;
|
|
3421
|
+
parentWorkspaceId?: string | null;
|
|
3422
|
+
}
|
|
3423
|
+
/**
|
|
3424
|
+
* Create a root or child workspace. The creator (the bearer-token user) becomes
|
|
3425
|
+
* the owner. Root creation requires a verified email.
|
|
3426
|
+
*/
|
|
3427
|
+
declare function createWorkspace(client: SublayHttpClient, data: CreateWorkspaceProps): Promise<Workspace>;
|
|
3428
|
+
|
|
3429
|
+
interface FetchWorkspaceProps {
|
|
3430
|
+
workspaceId: string;
|
|
3431
|
+
include?: string;
|
|
3432
|
+
}
|
|
3433
|
+
declare function fetchWorkspace(client: SublayHttpClient, data: FetchWorkspaceProps): Promise<Workspace>;
|
|
3434
|
+
|
|
3435
|
+
interface FetchManyWorkspacesProps {
|
|
3436
|
+
page?: number;
|
|
3437
|
+
limit?: number;
|
|
3438
|
+
include?: string;
|
|
3439
|
+
}
|
|
3440
|
+
/**
|
|
3441
|
+
* List the bearer-token user's direct-membership + owned workspaces. The actor
|
|
3442
|
+
* is derived from the token — no `userId` is sent.
|
|
3443
|
+
*/
|
|
3444
|
+
declare function fetchManyWorkspaces(client: SublayHttpClient, data?: FetchManyWorkspacesProps): Promise<PaginatedResponse<Workspace>>;
|
|
3445
|
+
|
|
3446
|
+
interface FetchMembersProps {
|
|
3447
|
+
workspaceId: string;
|
|
3448
|
+
include?: string;
|
|
3449
|
+
countOnly?: boolean;
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* Unified roster read — one entry per distinct user, each with a `reasons`
|
|
3453
|
+
* array. Always returned in full (never paginated). With `countOnly=true` the
|
|
3454
|
+
* shape is `WorkspaceRosterCountsResponse` instead. Actor from the token.
|
|
3455
|
+
*/
|
|
3456
|
+
declare function fetchMembers(client: SublayHttpClient, data: FetchMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
|
|
3457
|
+
|
|
3458
|
+
interface CreateInviteProps {
|
|
3459
|
+
workspaceId: string;
|
|
3460
|
+
email?: string;
|
|
3461
|
+
userId?: string;
|
|
3462
|
+
username?: string;
|
|
3463
|
+
capabilities?: WorkspaceCapability[];
|
|
3464
|
+
permissions?: string[];
|
|
3465
|
+
rank: number;
|
|
3466
|
+
title?: string | null;
|
|
3467
|
+
}
|
|
3468
|
+
/**
|
|
3469
|
+
* Create an invitation (requires the `invite` capability on the workspace). The
|
|
3470
|
+
* inviter is the bearer-token user.
|
|
3471
|
+
*/
|
|
3472
|
+
declare function createInvite(client: SublayHttpClient, data: CreateInviteProps): Promise<WorkspaceInvitation>;
|
|
3473
|
+
|
|
3474
|
+
interface AcceptInviteProps {
|
|
3475
|
+
inviteId: string;
|
|
3476
|
+
}
|
|
3477
|
+
interface AcceptInviteResponse {
|
|
3478
|
+
success: boolean;
|
|
3479
|
+
workspaceId: string;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* Accept an invitation — identity-matched to the bearer-token user + verified
|
|
3483
|
+
* email required. Non-secret id. Idempotent when already a member/owner.
|
|
3484
|
+
*/
|
|
3485
|
+
declare function acceptInvite(client: SublayHttpClient, data: AcceptInviteProps): Promise<AcceptInviteResponse>;
|
|
3486
|
+
|
|
3487
|
+
interface DeclineInviteProps {
|
|
3488
|
+
inviteId: string;
|
|
3489
|
+
}
|
|
3490
|
+
interface DeclineInviteResponse {
|
|
3491
|
+
success: boolean;
|
|
3492
|
+
}
|
|
3493
|
+
/**
|
|
3494
|
+
* Decline an invitation — identity-matched to the bearer-token user (not
|
|
3495
|
+
* verification-gated).
|
|
3496
|
+
*/
|
|
3497
|
+
declare function declineInvite(client: SublayHttpClient, data: DeclineInviteProps): Promise<DeclineInviteResponse>;
|
|
3498
|
+
|
|
3499
|
+
interface FetchMyInvitesResponse {
|
|
3500
|
+
data: WorkspaceInvitation[];
|
|
3501
|
+
}
|
|
3502
|
+
/**
|
|
3503
|
+
* The bearer-token user's LIVE pending invites (`status='pending' AND expiresAt
|
|
3504
|
+
* > now`), matched by `userId` from the token. Surfacing is NOT
|
|
3505
|
+
* verification-gated (the verified check applies only at accept).
|
|
3506
|
+
*/
|
|
3507
|
+
declare function fetchMyInvites(client: SublayHttpClient): Promise<FetchMyInvitesResponse>;
|
|
3508
|
+
|
|
3509
|
+
interface GetAuthorityProps {
|
|
3510
|
+
workspaceId: string;
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Authority-as-a-service read — the bearer-token user's resolved standing
|
|
3514
|
+
* (`{ reasons, capabilities, permissions, rank }`) on the workspace. A
|
|
3515
|
+
* permission check is a one-line `.includes()` on the result.
|
|
3516
|
+
*/
|
|
3517
|
+
declare function getAuthority(client: SublayHttpClient, data: GetAuthorityProps): Promise<WorkspaceAuthority>;
|
|
3518
|
+
|
|
3519
|
+
declare const Workspaces_acceptInvite: typeof acceptInvite;
|
|
3520
|
+
declare const Workspaces_createInvite: typeof createInvite;
|
|
3521
|
+
declare const Workspaces_createWorkspace: typeof createWorkspace;
|
|
3522
|
+
declare const Workspaces_declineInvite: typeof declineInvite;
|
|
3523
|
+
declare const Workspaces_fetchManyWorkspaces: typeof fetchManyWorkspaces;
|
|
3524
|
+
declare const Workspaces_fetchMembers: typeof fetchMembers;
|
|
3525
|
+
declare const Workspaces_fetchMyInvites: typeof fetchMyInvites;
|
|
3526
|
+
declare const Workspaces_fetchWorkspace: typeof fetchWorkspace;
|
|
3527
|
+
declare const Workspaces_getAuthority: typeof getAuthority;
|
|
3528
|
+
declare namespace Workspaces {
|
|
3529
|
+
export { Workspaces_acceptInvite as acceptInvite, Workspaces_createInvite as createInvite, Workspaces_createWorkspace as createWorkspace, Workspaces_declineInvite as declineInvite, Workspaces_fetchManyWorkspaces as fetchManyWorkspaces, Workspaces_fetchMembers as fetchMembers, Workspaces_fetchMyInvites as fetchMyInvites, Workspaces_fetchWorkspace as fetchWorkspace, Workspaces_getAuthority as getAuthority };
|
|
3530
|
+
}
|
|
3531
|
+
|
|
3298
3532
|
/**
|
|
3299
3533
|
* Custom-table types for the `/db` surface (row ops only — the js-sdk holds no
|
|
3300
3534
|
* service key, so it carries no table-management/DDL surface).
|
|
@@ -3377,6 +3611,7 @@ declare class SublayClient {
|
|
|
3377
3611
|
oauth: BoundModule<typeof OAuth>;
|
|
3378
3612
|
chat: BoundModule<typeof Chat>;
|
|
3379
3613
|
push: BoundModule<typeof Push>;
|
|
3614
|
+
workspaces: BoundModule<typeof Workspaces>;
|
|
3380
3615
|
private constructor();
|
|
3381
3616
|
static init(config: ClientConfig): Promise<SublayClient>;
|
|
3382
3617
|
/**
|
|
@@ -3391,4 +3626,4 @@ declare class SublayClient {
|
|
|
3391
3626
|
clearTokens(): void;
|
|
3392
3627
|
}
|
|
3393
3628
|
|
|
3394
|
-
export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type DbFilter, type DbFilterOperator, type DeleteResult, MUTE_DURATIONS, type MuteConversationProps, type MuteConversationResponse, type MuteDuration, type NotificationPreferences, PUSH_EVENT_TYPES, type PaginatedResponse, type PaginationMetadata, type PushEventType, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UpdateNotificationPreferencesProps, type UserSearchParams };
|
|
3629
|
+
export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type DbFilter, type DbFilterOperator, type DeleteResult, MUTE_DURATIONS, type MuteConversationProps, type MuteConversationResponse, type MuteDuration, type NotificationPreferences, PUSH_EVENT_TYPES, type PaginatedResponse, type PaginationMetadata, type PushEventType, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UpdateNotificationPreferencesProps, type UserSearchParams, type Workspace, type WorkspaceAuthority, type WorkspaceAuthorityReason, type WorkspaceCapability, type WorkspaceInvitation, type WorkspaceInvitationStatus, type WorkspaceRosterCountsResponse, type WorkspaceRosterEntry, type WorkspaceRosterReason, type WorkspaceRosterResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import * as Storage from "./modules/storage";
|
|
|
15
15
|
import * as OAuth from "./modules/oauth";
|
|
16
16
|
import * as Chat from "./modules/chat";
|
|
17
17
|
import * as Push from "./modules/push";
|
|
18
|
+
import * as Workspaces from "./modules/workspaces";
|
|
18
19
|
import { TableAccessor, TableRow } from "./interfaces/Table";
|
|
19
20
|
type BoundModule<T extends Record<string, (client: SublayHttpClient, ...args: any[]) => any>> = {
|
|
20
21
|
[K in keyof T]: (...args: Parameters<T[K]> extends [any, ...infer R] ? R : never) => ReturnType<T[K]>;
|
|
@@ -37,6 +38,7 @@ export declare class SublayClient {
|
|
|
37
38
|
oauth: BoundModule<typeof OAuth>;
|
|
38
39
|
chat: BoundModule<typeof Chat>;
|
|
39
40
|
push: BoundModule<typeof Push>;
|
|
41
|
+
workspaces: BoundModule<typeof Workspaces>;
|
|
40
42
|
private constructor();
|
|
41
43
|
static init(config: ClientConfig): Promise<SublayClient>;
|
|
42
44
|
/**
|
|
@@ -54,6 +56,7 @@ export type { ClientConfig, AuthTokens } from "./core/client";
|
|
|
54
56
|
export type { PaginatedResponse, PaginationMetadata, } from "./interfaces/IPaginatedResponse";
|
|
55
57
|
export type { SpaceReputationContextParams, SpaceReputationUserParams, } from "./interfaces/SpaceReputation";
|
|
56
58
|
export type { UserSearchParams } from "./interfaces/UserSearch";
|
|
59
|
+
export type { Workspace, WorkspaceInvitation, WorkspaceCapability, WorkspaceInvitationStatus, WorkspaceAuthorityReason, WorkspaceRosterReason, WorkspaceRosterEntry, WorkspaceRosterResponse, WorkspaceRosterCountsResponse, WorkspaceAuthority, } from "./interfaces/Workspace";
|
|
57
60
|
export { PUSH_EVENT_TYPES, MUTE_DURATIONS } from "./interfaces/Push";
|
|
58
61
|
export type { PushEventType, MuteDuration, NotificationPreferences, } from "./interfaces/Push";
|
|
59
62
|
export type { UpdateNotificationPreferencesProps } from "./modules/push/updateNotificationPreferences";
|
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, {
|
|
@@ -1198,7 +1233,6 @@ __export(spaces_exports, {
|
|
|
1198
1233
|
deleteRule: () => deleteRule,
|
|
1199
1234
|
deleteSpace: () => deleteSpace,
|
|
1200
1235
|
fetchChildSpaces: () => fetchChildSpaces,
|
|
1201
|
-
fetchDigestConfig: () => fetchDigestConfig,
|
|
1202
1236
|
fetchManyRules: () => fetchManyRules,
|
|
1203
1237
|
fetchManySpaces: () => fetchManySpaces,
|
|
1204
1238
|
fetchMutualSpaces: () => fetchMutualSpaces,
|
|
@@ -1222,7 +1256,6 @@ __export(spaces_exports, {
|
|
|
1222
1256
|
reorderRules: () => reorderRules,
|
|
1223
1257
|
setSpaceEntityNsfw: () => setSpaceEntityNsfw,
|
|
1224
1258
|
unbanMember: () => unbanMember,
|
|
1225
|
-
updateDigestConfig: () => updateDigestConfig,
|
|
1226
1259
|
updateMemberRole: () => updateMemberRole,
|
|
1227
1260
|
updateRule: () => updateRule,
|
|
1228
1261
|
updateSpace: () => updateSpace
|
|
@@ -1593,25 +1626,6 @@ async function moderateSpaceComment(client, data) {
|
|
|
1593
1626
|
return response.data;
|
|
1594
1627
|
}
|
|
1595
1628
|
|
|
1596
|
-
// src/modules/spaces/fetchDigestConfig.ts
|
|
1597
|
-
async function fetchDigestConfig(client, data) {
|
|
1598
|
-
const { spaceId } = data;
|
|
1599
|
-
const response = await client.projectInstance.get(
|
|
1600
|
-
`/spaces/${spaceId}/digest-config`
|
|
1601
|
-
);
|
|
1602
|
-
return response.data;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
// src/modules/spaces/updateDigestConfig.ts
|
|
1606
|
-
async function updateDigestConfig(client, data) {
|
|
1607
|
-
const { spaceId, ...body } = data;
|
|
1608
|
-
const response = await client.projectInstance.patch(
|
|
1609
|
-
`/spaces/${spaceId}/digest-config`,
|
|
1610
|
-
body
|
|
1611
|
-
);
|
|
1612
|
-
return response.data;
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
1629
|
// src/modules/spaces/getSpaceConversation.ts
|
|
1616
1630
|
async function getSpaceConversation(client, data) {
|
|
1617
1631
|
const { spaceId } = data;
|
|
@@ -2522,6 +2536,99 @@ async function updateNotificationPreferences(client, data) {
|
|
|
2522
2536
|
return response.data;
|
|
2523
2537
|
}
|
|
2524
2538
|
|
|
2539
|
+
// src/modules/workspaces/index.ts
|
|
2540
|
+
var workspaces_exports = {};
|
|
2541
|
+
__export(workspaces_exports, {
|
|
2542
|
+
acceptInvite: () => acceptInvite,
|
|
2543
|
+
createInvite: () => createInvite,
|
|
2544
|
+
createWorkspace: () => createWorkspace,
|
|
2545
|
+
declineInvite: () => declineInvite,
|
|
2546
|
+
fetchManyWorkspaces: () => fetchManyWorkspaces,
|
|
2547
|
+
fetchMembers: () => fetchMembers,
|
|
2548
|
+
fetchMyInvites: () => fetchMyInvites,
|
|
2549
|
+
fetchWorkspace: () => fetchWorkspace,
|
|
2550
|
+
getAuthority: () => getAuthority
|
|
2551
|
+
});
|
|
2552
|
+
|
|
2553
|
+
// src/modules/workspaces/createWorkspace.ts
|
|
2554
|
+
async function createWorkspace(client, data) {
|
|
2555
|
+
const response = await client.projectInstance.post(
|
|
2556
|
+
"/workspaces",
|
|
2557
|
+
data
|
|
2558
|
+
);
|
|
2559
|
+
return response.data;
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
// src/modules/workspaces/fetchWorkspace.ts
|
|
2563
|
+
async function fetchWorkspace(client, data) {
|
|
2564
|
+
const { workspaceId, include } = data;
|
|
2565
|
+
const response = await client.projectInstance.get(
|
|
2566
|
+
`/workspaces/${workspaceId}`,
|
|
2567
|
+
{ params: include ? { include } : void 0 }
|
|
2568
|
+
);
|
|
2569
|
+
return response.data;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
// src/modules/workspaces/fetchManyWorkspaces.ts
|
|
2573
|
+
async function fetchManyWorkspaces(client, data = {}) {
|
|
2574
|
+
const response = await client.projectInstance.get("/workspaces", { params: data });
|
|
2575
|
+
return response.data;
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
// src/modules/workspaces/fetchMembers.ts
|
|
2579
|
+
async function fetchMembers(client, data) {
|
|
2580
|
+
const { workspaceId, ...params } = data;
|
|
2581
|
+
const response = await client.projectInstance.get(`/workspaces/${workspaceId}/members`, { params });
|
|
2582
|
+
return response.data;
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
// src/modules/workspaces/createInvite.ts
|
|
2586
|
+
async function createInvite(client, data) {
|
|
2587
|
+
const { workspaceId, ...body } = data;
|
|
2588
|
+
const response = await client.projectInstance.post(
|
|
2589
|
+
`/workspaces/${workspaceId}/invites`,
|
|
2590
|
+
body
|
|
2591
|
+
);
|
|
2592
|
+
return response.data;
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
// src/modules/workspaces/acceptInvite.ts
|
|
2596
|
+
async function acceptInvite(client, data) {
|
|
2597
|
+
const { inviteId } = data;
|
|
2598
|
+
const response = await client.projectInstance.post(
|
|
2599
|
+
`/workspace-invites/${inviteId}/accept`,
|
|
2600
|
+
{}
|
|
2601
|
+
);
|
|
2602
|
+
return response.data;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// src/modules/workspaces/declineInvite.ts
|
|
2606
|
+
async function declineInvite(client, data) {
|
|
2607
|
+
const { inviteId } = data;
|
|
2608
|
+
const response = await client.projectInstance.post(
|
|
2609
|
+
`/workspace-invites/${inviteId}/decline`,
|
|
2610
|
+
{}
|
|
2611
|
+
);
|
|
2612
|
+
return response.data;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
// src/modules/workspaces/fetchMyInvites.ts
|
|
2616
|
+
async function fetchMyInvites(client) {
|
|
2617
|
+
const response = await client.projectInstance.get(
|
|
2618
|
+
"/me/workspace-invites"
|
|
2619
|
+
);
|
|
2620
|
+
return response.data;
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
// src/modules/workspaces/getAuthority.ts
|
|
2624
|
+
async function getAuthority(client, data) {
|
|
2625
|
+
const { workspaceId } = data;
|
|
2626
|
+
const response = await client.projectInstance.get(
|
|
2627
|
+
`/workspaces/${workspaceId}/authority/me`
|
|
2628
|
+
);
|
|
2629
|
+
return response.data;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2525
2632
|
// src/modules/tables/find.ts
|
|
2526
2633
|
async function find(client, tableName, query = {}) {
|
|
2527
2634
|
const { filters, includeDeleted, ...rest } = query;
|
|
@@ -2653,6 +2760,7 @@ var SublayClient = class _SublayClient {
|
|
|
2653
2760
|
oauth;
|
|
2654
2761
|
chat;
|
|
2655
2762
|
push;
|
|
2763
|
+
workspaces;
|
|
2656
2764
|
constructor(http) {
|
|
2657
2765
|
this.http = http;
|
|
2658
2766
|
this.auth = bindModule(auth_exports, this.http);
|
|
@@ -2671,6 +2779,7 @@ var SublayClient = class _SublayClient {
|
|
|
2671
2779
|
this.oauth = bindModule(oauth_exports, this.http);
|
|
2672
2780
|
this.chat = bindModule(chat_exports, this.http);
|
|
2673
2781
|
this.push = bindModule(push_exports, this.http);
|
|
2782
|
+
this.workspaces = bindModule(workspaces_exports, this.http);
|
|
2674
2783
|
}
|
|
2675
2784
|
static async init(config) {
|
|
2676
2785
|
const http = new SublayHttpClient(config);
|
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, {
|
|
@@ -1166,7 +1201,6 @@ __export(spaces_exports, {
|
|
|
1166
1201
|
deleteRule: () => deleteRule,
|
|
1167
1202
|
deleteSpace: () => deleteSpace,
|
|
1168
1203
|
fetchChildSpaces: () => fetchChildSpaces,
|
|
1169
|
-
fetchDigestConfig: () => fetchDigestConfig,
|
|
1170
1204
|
fetchManyRules: () => fetchManyRules,
|
|
1171
1205
|
fetchManySpaces: () => fetchManySpaces,
|
|
1172
1206
|
fetchMutualSpaces: () => fetchMutualSpaces,
|
|
@@ -1190,7 +1224,6 @@ __export(spaces_exports, {
|
|
|
1190
1224
|
reorderRules: () => reorderRules,
|
|
1191
1225
|
setSpaceEntityNsfw: () => setSpaceEntityNsfw,
|
|
1192
1226
|
unbanMember: () => unbanMember,
|
|
1193
|
-
updateDigestConfig: () => updateDigestConfig,
|
|
1194
1227
|
updateMemberRole: () => updateMemberRole,
|
|
1195
1228
|
updateRule: () => updateRule,
|
|
1196
1229
|
updateSpace: () => updateSpace
|
|
@@ -1561,25 +1594,6 @@ async function moderateSpaceComment(client, data) {
|
|
|
1561
1594
|
return response.data;
|
|
1562
1595
|
}
|
|
1563
1596
|
|
|
1564
|
-
// src/modules/spaces/fetchDigestConfig.ts
|
|
1565
|
-
async function fetchDigestConfig(client, data) {
|
|
1566
|
-
const { spaceId } = data;
|
|
1567
|
-
const response = await client.projectInstance.get(
|
|
1568
|
-
`/spaces/${spaceId}/digest-config`
|
|
1569
|
-
);
|
|
1570
|
-
return response.data;
|
|
1571
|
-
}
|
|
1572
|
-
|
|
1573
|
-
// src/modules/spaces/updateDigestConfig.ts
|
|
1574
|
-
async function updateDigestConfig(client, data) {
|
|
1575
|
-
const { spaceId, ...body } = data;
|
|
1576
|
-
const response = await client.projectInstance.patch(
|
|
1577
|
-
`/spaces/${spaceId}/digest-config`,
|
|
1578
|
-
body
|
|
1579
|
-
);
|
|
1580
|
-
return response.data;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
1597
|
// src/modules/spaces/getSpaceConversation.ts
|
|
1584
1598
|
async function getSpaceConversation(client, data) {
|
|
1585
1599
|
const { spaceId } = data;
|
|
@@ -2490,6 +2504,99 @@ async function updateNotificationPreferences(client, data) {
|
|
|
2490
2504
|
return response.data;
|
|
2491
2505
|
}
|
|
2492
2506
|
|
|
2507
|
+
// src/modules/workspaces/index.ts
|
|
2508
|
+
var workspaces_exports = {};
|
|
2509
|
+
__export(workspaces_exports, {
|
|
2510
|
+
acceptInvite: () => acceptInvite,
|
|
2511
|
+
createInvite: () => createInvite,
|
|
2512
|
+
createWorkspace: () => createWorkspace,
|
|
2513
|
+
declineInvite: () => declineInvite,
|
|
2514
|
+
fetchManyWorkspaces: () => fetchManyWorkspaces,
|
|
2515
|
+
fetchMembers: () => fetchMembers,
|
|
2516
|
+
fetchMyInvites: () => fetchMyInvites,
|
|
2517
|
+
fetchWorkspace: () => fetchWorkspace,
|
|
2518
|
+
getAuthority: () => getAuthority
|
|
2519
|
+
});
|
|
2520
|
+
|
|
2521
|
+
// src/modules/workspaces/createWorkspace.ts
|
|
2522
|
+
async function createWorkspace(client, data) {
|
|
2523
|
+
const response = await client.projectInstance.post(
|
|
2524
|
+
"/workspaces",
|
|
2525
|
+
data
|
|
2526
|
+
);
|
|
2527
|
+
return response.data;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
// src/modules/workspaces/fetchWorkspace.ts
|
|
2531
|
+
async function fetchWorkspace(client, data) {
|
|
2532
|
+
const { workspaceId, include } = data;
|
|
2533
|
+
const response = await client.projectInstance.get(
|
|
2534
|
+
`/workspaces/${workspaceId}`,
|
|
2535
|
+
{ params: include ? { include } : void 0 }
|
|
2536
|
+
);
|
|
2537
|
+
return response.data;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
// src/modules/workspaces/fetchManyWorkspaces.ts
|
|
2541
|
+
async function fetchManyWorkspaces(client, data = {}) {
|
|
2542
|
+
const response = await client.projectInstance.get("/workspaces", { params: data });
|
|
2543
|
+
return response.data;
|
|
2544
|
+
}
|
|
2545
|
+
|
|
2546
|
+
// src/modules/workspaces/fetchMembers.ts
|
|
2547
|
+
async function fetchMembers(client, data) {
|
|
2548
|
+
const { workspaceId, ...params } = data;
|
|
2549
|
+
const response = await client.projectInstance.get(`/workspaces/${workspaceId}/members`, { params });
|
|
2550
|
+
return response.data;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
// src/modules/workspaces/createInvite.ts
|
|
2554
|
+
async function createInvite(client, data) {
|
|
2555
|
+
const { workspaceId, ...body } = data;
|
|
2556
|
+
const response = await client.projectInstance.post(
|
|
2557
|
+
`/workspaces/${workspaceId}/invites`,
|
|
2558
|
+
body
|
|
2559
|
+
);
|
|
2560
|
+
return response.data;
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
// src/modules/workspaces/acceptInvite.ts
|
|
2564
|
+
async function acceptInvite(client, data) {
|
|
2565
|
+
const { inviteId } = data;
|
|
2566
|
+
const response = await client.projectInstance.post(
|
|
2567
|
+
`/workspace-invites/${inviteId}/accept`,
|
|
2568
|
+
{}
|
|
2569
|
+
);
|
|
2570
|
+
return response.data;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
// src/modules/workspaces/declineInvite.ts
|
|
2574
|
+
async function declineInvite(client, data) {
|
|
2575
|
+
const { inviteId } = data;
|
|
2576
|
+
const response = await client.projectInstance.post(
|
|
2577
|
+
`/workspace-invites/${inviteId}/decline`,
|
|
2578
|
+
{}
|
|
2579
|
+
);
|
|
2580
|
+
return response.data;
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
// src/modules/workspaces/fetchMyInvites.ts
|
|
2584
|
+
async function fetchMyInvites(client) {
|
|
2585
|
+
const response = await client.projectInstance.get(
|
|
2586
|
+
"/me/workspace-invites"
|
|
2587
|
+
);
|
|
2588
|
+
return response.data;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
// src/modules/workspaces/getAuthority.ts
|
|
2592
|
+
async function getAuthority(client, data) {
|
|
2593
|
+
const { workspaceId } = data;
|
|
2594
|
+
const response = await client.projectInstance.get(
|
|
2595
|
+
`/workspaces/${workspaceId}/authority/me`
|
|
2596
|
+
);
|
|
2597
|
+
return response.data;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2493
2600
|
// src/modules/tables/find.ts
|
|
2494
2601
|
async function find(client, tableName, query = {}) {
|
|
2495
2602
|
const { filters, includeDeleted, ...rest } = query;
|
|
@@ -2621,6 +2728,7 @@ var SublayClient = class _SublayClient {
|
|
|
2621
2728
|
oauth;
|
|
2622
2729
|
chat;
|
|
2623
2730
|
push;
|
|
2731
|
+
workspaces;
|
|
2624
2732
|
constructor(http) {
|
|
2625
2733
|
this.http = http;
|
|
2626
2734
|
this.auth = bindModule(auth_exports, this.http);
|
|
@@ -2639,6 +2747,7 @@ var SublayClient = class _SublayClient {
|
|
|
2639
2747
|
this.oauth = bindModule(oauth_exports, this.http);
|
|
2640
2748
|
this.chat = bindModule(chat_exports, this.http);
|
|
2641
2749
|
this.push = bindModule(push_exports, this.http);
|
|
2750
|
+
this.workspaces = bindModule(workspaces_exports, this.http);
|
|
2642
2751
|
}
|
|
2643
2752
|
static async init(config) {
|
|
2644
2753
|
const http = new SublayHttpClient(config);
|
|
@@ -123,22 +123,6 @@ export interface CheckMyMembershipResponse {
|
|
|
123
123
|
}
|
|
124
124
|
export interface DeleteSpaceResponse {
|
|
125
125
|
message: string;
|
|
126
|
-
deletedSpace: {
|
|
127
|
-
id: string;
|
|
128
|
-
name: string;
|
|
129
|
-
};
|
|
130
|
-
counts: {
|
|
131
|
-
entities: number;
|
|
132
|
-
members: number;
|
|
133
|
-
childSpaces: number;
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
export interface DigestConfig {
|
|
137
|
-
digestEnabled: boolean;
|
|
138
|
-
digestWebhookUrl: string | null;
|
|
139
|
-
digestWebhookSecret: string | null;
|
|
140
|
-
digestScheduleHour: number | null;
|
|
141
|
-
digestTimezone: string | null;
|
|
142
126
|
}
|
|
143
127
|
export interface SpaceBreadcrumb {
|
|
144
128
|
breadcrumb: SpacePreview[];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { User } from "./User";
|
|
2
|
+
/**
|
|
3
|
+
* Workspaces bundle interfaces (client subset). Mirrors the server's
|
|
4
|
+
* `IWorkspace` / `IWorkspaceMember` / `IWorkspaceInvitation` shapes and the
|
|
5
|
+
* workspace controller responses.
|
|
6
|
+
*
|
|
7
|
+
* `capabilities` is a CLOSED, Sublay-enforced vocabulary (cascades via reach);
|
|
8
|
+
* `permissions` is opaque free-form developer strings Sublay never consumes
|
|
9
|
+
* (per-node only, does NOT cascade).
|
|
10
|
+
*/
|
|
11
|
+
export type WorkspaceCapability = "view" | "invite" | "remove-member" | "edit-member-access" | "edit-member-profile" | "create-sub-workspace" | "edit-workspace";
|
|
12
|
+
export type WorkspaceInvitationStatus = "pending" | "accepted" | "declined" | "revoked";
|
|
13
|
+
export type WorkspaceAuthorityReason = "owner" | "ancestor-owner" | "member" | "reach-holder";
|
|
14
|
+
export interface Workspace {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
metadata: Record<string, any>;
|
|
18
|
+
ownerId: string;
|
|
19
|
+
parentWorkspaceId: string | null;
|
|
20
|
+
depth: number;
|
|
21
|
+
inheritsFromParent: boolean;
|
|
22
|
+
createdAt: string;
|
|
23
|
+
updatedAt: string;
|
|
24
|
+
memberCount?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface WorkspaceInvitation {
|
|
27
|
+
id: string;
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
invitedBy: string;
|
|
30
|
+
userId: string | null;
|
|
31
|
+
email: string | null;
|
|
32
|
+
capabilities: WorkspaceCapability[];
|
|
33
|
+
permissions: string[];
|
|
34
|
+
rank: number;
|
|
35
|
+
title: string | null;
|
|
36
|
+
status: WorkspaceInvitationStatus;
|
|
37
|
+
expiresAt: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
}
|
|
41
|
+
export interface WorkspaceRosterReason {
|
|
42
|
+
type: "owner" | "member" | "ancestor-owner" | "reach-holder" | "descendant-member";
|
|
43
|
+
rank?: number;
|
|
44
|
+
capabilities?: WorkspaceCapability[];
|
|
45
|
+
permissions?: string[];
|
|
46
|
+
title?: string | null;
|
|
47
|
+
metadata?: Record<string, any>;
|
|
48
|
+
viaWorkspaceId?: string;
|
|
49
|
+
workspaceId?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface WorkspaceRosterEntry {
|
|
52
|
+
user: User;
|
|
53
|
+
reasons: WorkspaceRosterReason[];
|
|
54
|
+
}
|
|
55
|
+
export interface WorkspaceRosterResponse {
|
|
56
|
+
data: WorkspaceRosterEntry[];
|
|
57
|
+
total: number;
|
|
58
|
+
}
|
|
59
|
+
export interface WorkspaceRosterCountsResponse {
|
|
60
|
+
counts: {
|
|
61
|
+
owner: number;
|
|
62
|
+
member: number;
|
|
63
|
+
ancestorOwner: number;
|
|
64
|
+
reachHolder: number;
|
|
65
|
+
descendantMember: number;
|
|
66
|
+
};
|
|
67
|
+
total: number;
|
|
68
|
+
distinctUsers: number;
|
|
69
|
+
}
|
|
70
|
+
export interface WorkspaceAuthority {
|
|
71
|
+
reasons: WorkspaceAuthorityReason[];
|
|
72
|
+
capabilities: WorkspaceCapability[];
|
|
73
|
+
permissions: string[];
|
|
74
|
+
rank: number | null;
|
|
75
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
2
|
import { ChatMessage } from "../../interfaces/ChatMessage";
|
|
3
|
+
import { GifData } from "../../interfaces/Comment";
|
|
3
4
|
import { Mention } from "../../interfaces/Mention";
|
|
4
5
|
export interface EditMessageProps {
|
|
5
6
|
conversationId: string;
|
|
6
7
|
messageId: string;
|
|
7
8
|
content?: string;
|
|
8
|
-
/** A GIF
|
|
9
|
-
gif?:
|
|
9
|
+
/** A GIF attachment, or null to clear it. */
|
|
10
|
+
gif?: GifData | null;
|
|
10
11
|
mentions?: Mention[];
|
|
11
12
|
metadata?: Record<string, any> | null;
|
|
12
13
|
}
|
|
@@ -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>>;
|
|
@@ -31,8 +31,6 @@ export { handleCommentReport } from "./handleCommentReport";
|
|
|
31
31
|
export { moderateSpaceEntity } from "./moderateSpaceEntity";
|
|
32
32
|
export { setSpaceEntityNsfw } from "./setSpaceEntityNsfw";
|
|
33
33
|
export { moderateSpaceComment } from "./moderateSpaceComment";
|
|
34
|
-
export { fetchDigestConfig } from "./fetchDigestConfig";
|
|
35
|
-
export { updateDigestConfig } from "./updateDigestConfig";
|
|
36
34
|
export { getSpaceConversation } from "./getSpaceConversation";
|
|
37
35
|
export { moderateSpaceChatMessage } from "./moderateSpaceChatMessage";
|
|
38
36
|
export { handleSpaceChatReport } from "./handleSpaceChatReport";
|
|
@@ -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";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
export interface AcceptInviteProps {
|
|
3
|
+
inviteId: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AcceptInviteResponse {
|
|
6
|
+
success: boolean;
|
|
7
|
+
workspaceId: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Accept an invitation — identity-matched to the bearer-token user + verified
|
|
11
|
+
* email required. Non-secret id. Idempotent when already a member/owner.
|
|
12
|
+
*/
|
|
13
|
+
export declare function acceptInvite(client: SublayHttpClient, data: AcceptInviteProps): Promise<AcceptInviteResponse>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { WorkspaceCapability, WorkspaceInvitation } from "../../interfaces/Workspace";
|
|
3
|
+
export interface CreateInviteProps {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
userId?: string;
|
|
7
|
+
username?: string;
|
|
8
|
+
capabilities?: WorkspaceCapability[];
|
|
9
|
+
permissions?: string[];
|
|
10
|
+
rank: number;
|
|
11
|
+
title?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create an invitation (requires the `invite` capability on the workspace). The
|
|
15
|
+
* inviter is the bearer-token user.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createInvite(client: SublayHttpClient, data: CreateInviteProps): Promise<WorkspaceInvitation>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Workspace } from "../../interfaces/Workspace";
|
|
3
|
+
export interface CreateWorkspaceProps {
|
|
4
|
+
name: string;
|
|
5
|
+
metadata?: Record<string, any>;
|
|
6
|
+
parentWorkspaceId?: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Create a root or child workspace. The creator (the bearer-token user) becomes
|
|
10
|
+
* the owner. Root creation requires a verified email.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createWorkspace(client: SublayHttpClient, data: CreateWorkspaceProps): Promise<Workspace>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
export interface DeclineInviteProps {
|
|
3
|
+
inviteId: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DeclineInviteResponse {
|
|
6
|
+
success: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Decline an invitation — identity-matched to the bearer-token user (not
|
|
10
|
+
* verification-gated).
|
|
11
|
+
*/
|
|
12
|
+
export declare function declineInvite(client: SublayHttpClient, data: DeclineInviteProps): Promise<DeclineInviteResponse>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Workspace } from "../../interfaces/Workspace";
|
|
3
|
+
import { PaginatedResponse } from "../../interfaces/IPaginatedResponse";
|
|
4
|
+
export interface FetchManyWorkspacesProps {
|
|
5
|
+
page?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
include?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* List the bearer-token user's direct-membership + owned workspaces. The actor
|
|
11
|
+
* is derived from the token — no `userId` is sent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchManyWorkspaces(client: SublayHttpClient, data?: FetchManyWorkspacesProps): Promise<PaginatedResponse<Workspace>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { WorkspaceRosterResponse, WorkspaceRosterCountsResponse } from "../../interfaces/Workspace";
|
|
3
|
+
export interface FetchMembersProps {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
include?: string;
|
|
6
|
+
countOnly?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Unified roster read — one entry per distinct user, each with a `reasons`
|
|
10
|
+
* array. Always returned in full (never paginated). With `countOnly=true` the
|
|
11
|
+
* shape is `WorkspaceRosterCountsResponse` instead. Actor from the token.
|
|
12
|
+
*/
|
|
13
|
+
export declare function fetchMembers(client: SublayHttpClient, data: FetchMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { WorkspaceInvitation } from "../../interfaces/Workspace";
|
|
3
|
+
export interface FetchMyInvitesResponse {
|
|
4
|
+
data: WorkspaceInvitation[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The bearer-token user's LIVE pending invites (`status='pending' AND expiresAt
|
|
8
|
+
* > now`), matched by `userId` from the token. Surfacing is NOT
|
|
9
|
+
* verification-gated (the verified check applies only at accept).
|
|
10
|
+
*/
|
|
11
|
+
export declare function fetchMyInvites(client: SublayHttpClient): Promise<FetchMyInvitesResponse>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { Workspace } from "../../interfaces/Workspace";
|
|
3
|
+
export interface FetchWorkspaceProps {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
include?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function fetchWorkspace(client: SublayHttpClient, data: FetchWorkspaceProps): Promise<Workspace>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { WorkspaceAuthority } from "../../interfaces/Workspace";
|
|
3
|
+
export interface GetAuthorityProps {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Authority-as-a-service read — the bearer-token user's resolved standing
|
|
8
|
+
* (`{ reasons, capabilities, permissions, rank }`) on the workspace. A
|
|
9
|
+
* permission check is a one-line `.includes()` on the result.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAuthority(client: SublayHttpClient, data: GetAuthorityProps): Promise<WorkspaceAuthority>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { createWorkspace } from "./createWorkspace";
|
|
2
|
+
export { fetchWorkspace } from "./fetchWorkspace";
|
|
3
|
+
export { fetchManyWorkspaces } from "./fetchManyWorkspaces";
|
|
4
|
+
export { fetchMembers } from "./fetchMembers";
|
|
5
|
+
export { createInvite } from "./createInvite";
|
|
6
|
+
export { acceptInvite } from "./acceptInvite";
|
|
7
|
+
export { declineInvite } from "./declineInvite";
|
|
8
|
+
export { fetchMyInvites } from "./fetchMyInvites";
|
|
9
|
+
export { getAuthority } from "./getAuthority";
|