@sublay/js 7.6.0 → 7.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.mts +459 -55
  3. package/dist/index.d.ts +3 -0
  4. package/dist/index.js +232 -32
  5. package/dist/index.mjs +232 -32
  6. package/dist/interfaces/Report.d.ts +7 -1
  7. package/dist/interfaces/Space.d.ts +0 -16
  8. package/dist/interfaces/Workspace.d.ts +148 -0
  9. package/dist/modules/chat/editMessage.d.ts +3 -2
  10. package/dist/modules/chat/index.d.ts +0 -1
  11. package/dist/modules/collections/updateCollection.d.ts +1 -1
  12. package/dist/modules/comments/updateComment.d.ts +4 -1
  13. package/dist/modules/reports/createReport.d.ts +2 -2
  14. package/dist/modules/spaces/fetchUserSpaces.d.ts +6 -0
  15. package/dist/modules/spaces/index.d.ts +0 -2
  16. package/dist/modules/workspaces/acceptInvite.d.ts +13 -0
  17. package/dist/modules/workspaces/acceptWorkspaceInvite.d.ts +13 -0
  18. package/dist/modules/workspaces/createInvite.d.ts +17 -0
  19. package/dist/modules/workspaces/createWorkspace.d.ts +12 -0
  20. package/dist/modules/workspaces/createWorkspaceInvite.d.ts +17 -0
  21. package/dist/modules/workspaces/declineInvite.d.ts +12 -0
  22. package/dist/modules/workspaces/declineWorkspaceInvite.d.ts +14 -0
  23. package/dist/modules/workspaces/deleteWorkspace.d.ts +13 -0
  24. package/dist/modules/workspaces/fetchManyWorkspaces.d.ts +13 -0
  25. package/dist/modules/workspaces/fetchMembers.d.ts +13 -0
  26. package/dist/modules/workspaces/fetchMyInvites.d.ts +11 -0
  27. package/dist/modules/workspaces/fetchMyWorkspaceInvites.d.ts +15 -0
  28. package/dist/modules/workspaces/fetchWorkspace.d.ts +7 -0
  29. package/dist/modules/workspaces/fetchWorkspaceAuthority.d.ts +11 -0
  30. package/dist/modules/workspaces/fetchWorkspaceInvites.d.ts +17 -0
  31. package/dist/modules/workspaces/fetchWorkspaceMemberStanding.d.ts +11 -0
  32. package/dist/modules/workspaces/fetchWorkspaceMembers.d.ts +13 -0
  33. package/dist/modules/workspaces/getAuthority.d.ts +11 -0
  34. package/dist/modules/workspaces/index.d.ts +21 -0
  35. package/dist/modules/workspaces/leaveWorkspace.d.ts +11 -0
  36. package/dist/modules/workspaces/removeWorkspaceMember.d.ts +12 -0
  37. package/dist/modules/workspaces/removeWorkspaceMemberFromSubtree.d.ts +16 -0
  38. package/dist/modules/workspaces/resendWorkspaceInvite.d.ts +12 -0
  39. package/dist/modules/workspaces/revokeWorkspaceInvite.d.ts +13 -0
  40. package/dist/modules/workspaces/transferWorkspaceOwnership.d.ts +15 -0
  41. package/dist/modules/workspaces/updateWorkspace.d.ts +12 -0
  42. package/dist/modules/workspaces/updateWorkspaceInheritFlag.d.ts +13 -0
  43. package/dist/modules/workspaces/updateWorkspaceMember.d.ts +17 -0
  44. package/package.json +1 -1
@@ -0,0 +1,148 @@
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 type WorkspaceAuthorityReasonDetail = {
15
+ type: "owner" | "member";
16
+ viaWorkspaceId?: never;
17
+ } | {
18
+ type: "ancestor-owner" | "reach-holder";
19
+ viaWorkspaceId: string;
20
+ };
21
+ export interface Workspace {
22
+ id: string;
23
+ name: string;
24
+ metadata: Record<string, any>;
25
+ ownerId: string;
26
+ parentWorkspaceId: string | null;
27
+ depth: number;
28
+ inheritsFromParent: boolean;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ memberCount?: number;
32
+ }
33
+ export interface WorkspaceMember {
34
+ id: string;
35
+ workspaceId: string;
36
+ userId: string;
37
+ capabilities: WorkspaceCapability[];
38
+ permissions: string[];
39
+ rank: number;
40
+ title: string | null;
41
+ metadata: Record<string, any>;
42
+ joinedAt: string;
43
+ createdAt: string;
44
+ }
45
+ export interface WorkspaceInvitation {
46
+ id: string;
47
+ workspaceId: string;
48
+ invitedBy: string;
49
+ userId: string | null;
50
+ email: string | null;
51
+ capabilities: WorkspaceCapability[];
52
+ permissions: string[];
53
+ rank: number;
54
+ title: string | null;
55
+ status: WorkspaceInvitationStatus;
56
+ expiresAt: string;
57
+ createdAt: string;
58
+ updatedAt: string;
59
+ }
60
+ export interface WorkspaceRosterReason {
61
+ type: "owner" | "member" | "ancestor-owner" | "reach-holder" | "descendant-member";
62
+ rank?: number;
63
+ capabilities?: WorkspaceCapability[];
64
+ permissions?: string[];
65
+ title?: string | null;
66
+ metadata?: Record<string, any>;
67
+ viaWorkspaceId?: string;
68
+ workspaceId?: string;
69
+ }
70
+ export interface WorkspaceRosterEntry {
71
+ user: User;
72
+ reasons: WorkspaceRosterReason[];
73
+ }
74
+ export interface WorkspaceRosterResponse {
75
+ data: WorkspaceRosterEntry[];
76
+ total: number;
77
+ }
78
+ export interface WorkspaceRosterCountsResponse {
79
+ counts: {
80
+ owner: number;
81
+ member: number;
82
+ ancestorOwner: number;
83
+ reachHolder: number;
84
+ descendantMember: number;
85
+ };
86
+ total: number;
87
+ distinctUsers: number;
88
+ }
89
+ /**
90
+ * The `user` carried by a standing read. Normally the full user record, but the
91
+ * server falls back to `{ id }` alone when the user row is gone (a deleted user
92
+ * with a lingering membership row is a reachable case), so every field except
93
+ * `id` may be absent.
94
+ */
95
+ export type WorkspaceStandingUser = Pick<User, "id"> & Partial<Omit<User, "id">>;
96
+ export interface WorkspaceMemberStanding {
97
+ user: WorkspaceStandingUser;
98
+ reasons: WorkspaceAuthorityReasonDetail[];
99
+ capabilities?: WorkspaceCapability[];
100
+ permissions?: string[];
101
+ rank?: number | null;
102
+ title: string | null;
103
+ metadata: Record<string, any>;
104
+ }
105
+ export interface WorkspaceAuthority {
106
+ reasons: WorkspaceAuthorityReasonDetail[];
107
+ capabilities: WorkspaceCapability[];
108
+ permissions: string[];
109
+ rank: number | null;
110
+ }
111
+ /**
112
+ * One descendant the subtree sweep did NOT clear, where the target user still
113
+ * holds a direct membership.
114
+ *
115
+ * `id` / `name` are masked TOGETHER: an entry the acting user may see carries
116
+ * both, and one they may not carries `null` for both — the sweep reports THAT a
117
+ * membership survived without disclosing the existence or name of a sealed
118
+ * sub-workspace the actor has no authority over (the same sealing fence the
119
+ * descendant roster read applies). Modelled as a discriminated union so a
120
+ * `null` check on `id` narrows `name` too.
121
+ */
122
+ export type SkippedWorkspace = {
123
+ id: string;
124
+ name: string;
125
+ /** Why it was skipped. `out-of-reach`: the actor's authority does not extend there. */
126
+ reason: "out-of-reach";
127
+ } | {
128
+ id: null;
129
+ name: null;
130
+ /** Why it was skipped. `out-of-reach`: the actor's authority does not extend there. */
131
+ reason: "out-of-reach";
132
+ };
133
+ export interface RemoveWorkspaceMemberFromSubtreeResponse {
134
+ removedCount: number;
135
+ removed: {
136
+ workspaceId: string;
137
+ userId: string;
138
+ }[];
139
+ /**
140
+ * How many descendant memberships the target RETAINED because the sweep could
141
+ * not reach them. Always `0` for an owner / ancestor-owner / privileged key.
142
+ * A non-zero value means the offboarding is PARTIAL — never conclude a user is
143
+ * fully removed from `removedCount` alone.
144
+ */
145
+ skippedCount: number;
146
+ /** One entry per retained membership; `skippedCount === skipped.length`. */
147
+ skipped: SkippedWorkspace[];
148
+ }
@@ -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 URL, or null to clear it. */
9
- gif?: string | null;
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
  }
@@ -19,4 +19,3 @@ export { toggleReaction } from "./toggleReaction";
19
19
  export { listReactions } from "./listReactions";
20
20
  export { markAsRead } from "./markAsRead";
21
21
  export { muteConversation } from "./muteConversation";
22
- export { reportMessage } from "./reportMessage";
@@ -2,6 +2,6 @@ import { SublayHttpClient } from "../../core/client";
2
2
  import { Collection } from "../../interfaces/Collection";
3
3
  export interface UpdateCollectionProps {
4
4
  collectionId: string;
5
- name?: string;
5
+ name: string;
6
6
  }
7
7
  export declare function updateCollection(client: SublayHttpClient, data: UpdateCollectionProps): Promise<Collection>;
@@ -2,6 +2,9 @@ import { SublayHttpClient } from "../../core/client";
2
2
  import { Comment } from "../../interfaces/Comment";
3
3
  export interface UpdateCommentProps {
4
4
  commentId: string;
5
- content: string;
5
+ /** New text content. Cannot be empty. Omit to leave the content untouched. */
6
+ content?: string;
7
+ /** Replaces the comment's metadata wholesale (not merged). */
8
+ metadata?: Record<string, any>;
6
9
  }
7
10
  export declare function updateComment(client: SublayHttpClient, data: UpdateCommentProps): Promise<Comment>;
@@ -1,9 +1,9 @@
1
1
  import { SublayHttpClient } from "../../core/client";
2
- import { CreateReportResponse, ReportTargetType } from "../../interfaces/Report";
2
+ import { CreateReportResponse, ReportReason, ReportTargetType } from "../../interfaces/Report";
3
3
  export interface CreateReportProps {
4
4
  targetType: ReportTargetType;
5
5
  targetId: string;
6
- reason: string;
6
+ reason: ReportReason;
7
7
  details?: string;
8
8
  }
9
9
  export declare function createReport(client: SublayHttpClient, data: CreateReportProps): Promise<CreateReportResponse>;
@@ -7,5 +7,11 @@ export interface FetchUserSpacesProps {
7
7
  include?: string;
8
8
  role?: string;
9
9
  all?: "true" | "false";
10
+ /**
11
+ * Membership status to list. Defaults to `"active"` (spaces the user is in);
12
+ * `"pending"` returns join requests awaiting approval, `"banned"` the spaces
13
+ * they were removed from.
14
+ */
15
+ status?: "active" | "pending" | "banned";
10
16
  }
11
17
  export declare function fetchUserSpaces(client: SublayHttpClient, data: FetchUserSpacesProps): Promise<UserSpacesResponse>;
@@ -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,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,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface AcceptWorkspaceInviteProps {
3
+ inviteId: string;
4
+ }
5
+ export interface AcceptWorkspaceInviteResponse {
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 acceptWorkspaceInvite(client: SublayHttpClient, data: AcceptWorkspaceInviteProps): Promise<AcceptWorkspaceInviteResponse>;
@@ -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,17 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { WorkspaceCapability, WorkspaceInvitation } from "../../interfaces/Workspace";
3
+ export interface CreateWorkspaceInviteProps {
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 createWorkspaceInvite(client: SublayHttpClient, data: CreateWorkspaceInviteProps): Promise<WorkspaceInvitation>;
@@ -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,14 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface DeclineWorkspaceInviteProps {
3
+ inviteId: string;
4
+ }
5
+ export interface DeclineWorkspaceInviteResponse {
6
+ success: boolean;
7
+ }
8
+ /**
9
+ * Decline an invitation — identity-matched to the bearer-token user, and
10
+ * verified-email-gated (the same gate as accept, so an unverified squatter on
11
+ * someone else's address cannot burn their invite). An unverified decline
12
+ * returns `403 workspace/email-not-verified`.
13
+ */
14
+ export declare function declineWorkspaceInvite(client: SublayHttpClient, data: DeclineWorkspaceInviteProps): Promise<DeclineWorkspaceInviteResponse>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface DeleteWorkspaceProps {
3
+ workspaceId: string;
4
+ }
5
+ export interface DeleteWorkspaceResponse {
6
+ message: string;
7
+ }
8
+ /**
9
+ * Owner-only delete (own owner or an ancestor owner). Cascades the whole
10
+ * subtree transactionally. The actor is the bearer-token user — no `userId`
11
+ * body is sent.
12
+ */
13
+ export declare function deleteWorkspace(client: SublayHttpClient, data: DeleteWorkspaceProps): Promise<DeleteWorkspaceResponse>;
@@ -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,15 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { WorkspaceInvitation } from "../../interfaces/Workspace";
3
+ export interface FetchMyWorkspaceInvitesResponse {
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 when the user ACTS on an
10
+ * invite — accept or decline).
11
+ *
12
+ * This is the INBOX read — invites addressed TO the caller. For the invites a
13
+ * workspace has ISSUED, use `fetchWorkspaceInvites`.
14
+ */
15
+ export declare function fetchMyWorkspaceInvites(client: SublayHttpClient): Promise<FetchMyWorkspaceInvitesResponse>;
@@ -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 FetchWorkspaceAuthorityProps {
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 fetchWorkspaceAuthority(client: SublayHttpClient, data: FetchWorkspaceAuthorityProps): Promise<WorkspaceAuthority>;
@@ -0,0 +1,17 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { WorkspaceInvitation } from "../../interfaces/Workspace";
3
+ export interface FetchWorkspaceInvitesProps {
4
+ workspaceId: string;
5
+ }
6
+ export interface FetchWorkspaceInvitesResponse {
7
+ data: WorkspaceInvitation[];
8
+ }
9
+ /**
10
+ * List a workspace's LIVE pending invites (`status='pending' AND expiresAt >
11
+ * now`). Requires the `invite` capability (or owner). Always returned in full —
12
+ * this list is deliberately unpaginated.
13
+ *
14
+ * This is the OUTBOX read — invites this workspace ISSUED. For the invites
15
+ * addressed TO the caller, use `fetchMyWorkspaceInvites`.
16
+ */
17
+ export declare function fetchWorkspaceInvites(client: SublayHttpClient, data: FetchWorkspaceInvitesProps): Promise<FetchWorkspaceInvitesResponse>;
@@ -0,0 +1,11 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { WorkspaceMemberStanding } from "../../interfaces/Workspace";
3
+ export interface FetchWorkspaceMemberStandingProps {
4
+ workspaceId: string;
5
+ targetUserId: string;
6
+ }
7
+ /**
8
+ * Read one user's resolved standing on a workspace (`reasons`, `capabilities`,
9
+ * `permissions`, `rank`, `title`, `metadata`).
10
+ */
11
+ export declare function fetchWorkspaceMemberStanding(client: SublayHttpClient, data: FetchWorkspaceMemberStandingProps): Promise<WorkspaceMemberStanding>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { WorkspaceRosterResponse, WorkspaceRosterCountsResponse } from "../../interfaces/Workspace";
3
+ export interface FetchWorkspaceMembersProps {
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 fetchWorkspaceMembers(client: SublayHttpClient, data: FetchWorkspaceMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
@@ -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,21 @@
1
+ export { createWorkspace } from "./createWorkspace";
2
+ export { fetchWorkspace } from "./fetchWorkspace";
3
+ export { fetchManyWorkspaces } from "./fetchManyWorkspaces";
4
+ export { updateWorkspace } from "./updateWorkspace";
5
+ export { updateWorkspaceInheritFlag } from "./updateWorkspaceInheritFlag";
6
+ export { deleteWorkspace } from "./deleteWorkspace";
7
+ export { transferWorkspaceOwnership } from "./transferWorkspaceOwnership";
8
+ export { fetchWorkspaceMembers } from "./fetchWorkspaceMembers";
9
+ export { fetchWorkspaceMemberStanding } from "./fetchWorkspaceMemberStanding";
10
+ export { updateWorkspaceMember } from "./updateWorkspaceMember";
11
+ export { removeWorkspaceMember } from "./removeWorkspaceMember";
12
+ export { leaveWorkspace } from "./leaveWorkspace";
13
+ export { removeWorkspaceMemberFromSubtree } from "./removeWorkspaceMemberFromSubtree";
14
+ export { createWorkspaceInvite } from "./createWorkspaceInvite";
15
+ export { fetchWorkspaceInvites } from "./fetchWorkspaceInvites";
16
+ export { revokeWorkspaceInvite } from "./revokeWorkspaceInvite";
17
+ export { resendWorkspaceInvite } from "./resendWorkspaceInvite";
18
+ export { acceptWorkspaceInvite } from "./acceptWorkspaceInvite";
19
+ export { declineWorkspaceInvite } from "./declineWorkspaceInvite";
20
+ export { fetchMyWorkspaceInvites } from "./fetchMyWorkspaceInvites";
21
+ export { fetchWorkspaceAuthority } from "./fetchWorkspaceAuthority";
@@ -0,0 +1,11 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface LeaveWorkspaceProps {
3
+ workspaceId: string;
4
+ }
5
+ /**
6
+ * The bearer-token user leaves this workspace — removes THEIR OWN direct
7
+ * membership on THIS node only (owning a child is unaffected). An owner cannot
8
+ * leave (409 `workspace/sole-owner`); transfer or delete first. No `userId` is
9
+ * sent — the server derives the leaver from the token.
10
+ */
11
+ export declare function leaveWorkspace(client: SublayHttpClient, data: LeaveWorkspaceProps): Promise<void>;
@@ -0,0 +1,12 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface RemoveWorkspaceMemberProps {
3
+ workspaceId: string;
4
+ targetUserId: string;
5
+ }
6
+ /**
7
+ * Remove a member from this workspace. Requires the `remove-member` capability
8
+ * and is rank-bounded. The workspace owner cannot be removed (409
9
+ * `workspace/sole-owner`) — transfer ownership first. No `userId` body is sent;
10
+ * the actor comes from the token.
11
+ */
12
+ export declare function removeWorkspaceMember(client: SublayHttpClient, data: RemoveWorkspaceMemberProps): Promise<void>;
@@ -0,0 +1,16 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { RemoveWorkspaceMemberFromSubtreeResponse } from "../../interfaces/Workspace";
3
+ export interface RemoveWorkspaceMemberFromSubtreeProps {
4
+ workspaceId: string;
5
+ targetUserId: string;
6
+ }
7
+ /**
8
+ * Removes the target user's direct memberships on this workspace and every
9
+ * descendant. Requires `remove-member` (rank-bounded per node). Blocks (409
10
+ * `workspace/owns-descendants`) with a report if the user OWNS any descendant
11
+ * workspace — transfer or delete those first. The actor comes from the token.
12
+ *
13
+ * A NON-owner's sweep can be PARTIAL: it stops at sealed sub-workspaces. Check
14
+ * `skippedCount` / `skipped` before treating the user as fully offboarded.
15
+ */
16
+ export declare function removeWorkspaceMemberFromSubtree(client: SublayHttpClient, data: RemoveWorkspaceMemberFromSubtreeProps): Promise<RemoveWorkspaceMemberFromSubtreeResponse>;
@@ -0,0 +1,12 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { WorkspaceInvitation } from "../../interfaces/Workspace";
3
+ export interface ResendWorkspaceInviteProps {
4
+ workspaceId: string;
5
+ inviteId: string;
6
+ }
7
+ /**
8
+ * Resend / refresh a pending invitation (valid on any `pending` invite, even one
9
+ * past `expiresAt` — resets a 14-day expiry and resends the email). A terminal
10
+ * invite (accepted/declined/revoked) → 409. Requires `invite` (or owner).
11
+ */
12
+ export declare function resendWorkspaceInvite(client: SublayHttpClient, data: ResendWorkspaceInviteProps): Promise<WorkspaceInvitation>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ export interface RevokeWorkspaceInviteProps {
3
+ workspaceId: string;
4
+ inviteId: string;
5
+ }
6
+ export interface RevokeWorkspaceInviteResponse {
7
+ success: boolean;
8
+ }
9
+ /**
10
+ * Revoke a pending invitation. Requires the `invite` capability (or owner).
11
+ * Note the verb-suffixed POST route — this is not a `DELETE`.
12
+ */
13
+ export declare function revokeWorkspaceInvite(client: SublayHttpClient, data: RevokeWorkspaceInviteProps): Promise<RevokeWorkspaceInviteResponse>;
@@ -0,0 +1,15 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Workspace, WorkspaceCapability } from "../../interfaces/Workspace";
3
+ export interface TransferWorkspaceOwnershipProps {
4
+ workspaceId: string;
5
+ newOwnerId: string;
6
+ previousOwnerDisposition?: "demote" | "remove";
7
+ previousOwnerRank?: number;
8
+ previousOwnerCapabilities?: WorkspaceCapability[];
9
+ }
10
+ /**
11
+ * Hand the workspace to a new owner. Owner-only (own owner or an ancestor
12
+ * owner). The actor is the bearer-token user — no `userId` is sent;
13
+ * `newOwnerId` addresses the TARGET, not the actor.
14
+ */
15
+ export declare function transferWorkspaceOwnership(client: SublayHttpClient, data: TransferWorkspaceOwnershipProps): Promise<Workspace>;
@@ -0,0 +1,12 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Workspace } from "../../interfaces/Workspace";
3
+ export interface UpdateWorkspaceProps {
4
+ workspaceId: string;
5
+ name?: string;
6
+ metadata?: Record<string, any>;
7
+ }
8
+ /**
9
+ * Edit a workspace's name / metadata. Requires the `edit-workspace` capability
10
+ * (or ownership). The actor is the bearer-token user — no `userId` is sent.
11
+ */
12
+ export declare function updateWorkspace(client: SublayHttpClient, data: UpdateWorkspaceProps): Promise<Workspace>;
@@ -0,0 +1,13 @@
1
+ import { SublayHttpClient } from "../../core/client";
2
+ import { Workspace } from "../../interfaces/Workspace";
3
+ export interface UpdateWorkspaceInheritFlagProps {
4
+ workspaceId: string;
5
+ inheritsFromParent: boolean;
6
+ }
7
+ /**
8
+ * Flip whether capabilities held on an ancestor "reach" into this workspace.
9
+ * Owner-only in both directions (own owner or an ancestor owner), and blocked
10
+ * (403 `workspace/inherit-enforced`) when the project enforces its default.
11
+ * The actor is the bearer-token user — no `userId` is sent.
12
+ */
13
+ export declare function updateWorkspaceInheritFlag(client: SublayHttpClient, data: UpdateWorkspaceInheritFlagProps): Promise<Workspace>;