@sublay/js 7.7.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.
- package/dist/index.d.mts +291 -44
- package/dist/index.d.ts +1 -1
- package/dist/index.js +158 -32
- package/dist/index.mjs +158 -32
- package/dist/interfaces/Report.d.ts +7 -1
- package/dist/interfaces/Workspace.d.ts +74 -1
- package/dist/modules/chat/index.d.ts +0 -1
- package/dist/modules/collections/updateCollection.d.ts +1 -1
- package/dist/modules/comments/updateComment.d.ts +4 -1
- package/dist/modules/reports/createReport.d.ts +2 -2
- package/dist/modules/spaces/fetchUserSpaces.d.ts +6 -0
- package/dist/modules/workspaces/acceptWorkspaceInvite.d.ts +13 -0
- package/dist/modules/workspaces/createWorkspaceInvite.d.ts +17 -0
- package/dist/modules/workspaces/declineWorkspaceInvite.d.ts +14 -0
- package/dist/modules/workspaces/deleteWorkspace.d.ts +13 -0
- package/dist/modules/workspaces/fetchMyWorkspaceInvites.d.ts +15 -0
- package/dist/modules/workspaces/fetchWorkspaceAuthority.d.ts +11 -0
- package/dist/modules/workspaces/fetchWorkspaceInvites.d.ts +17 -0
- package/dist/modules/workspaces/fetchWorkspaceMemberStanding.d.ts +11 -0
- package/dist/modules/workspaces/fetchWorkspaceMembers.d.ts +13 -0
- package/dist/modules/workspaces/index.d.ts +18 -6
- package/dist/modules/workspaces/leaveWorkspace.d.ts +11 -0
- package/dist/modules/workspaces/removeWorkspaceMember.d.ts +12 -0
- package/dist/modules/workspaces/removeWorkspaceMemberFromSubtree.d.ts +16 -0
- package/dist/modules/workspaces/resendWorkspaceInvite.d.ts +12 -0
- package/dist/modules/workspaces/revokeWorkspaceInvite.d.ts +13 -0
- package/dist/modules/workspaces/transferWorkspaceOwnership.d.ts +15 -0
- package/dist/modules/workspaces/updateWorkspace.d.ts +12 -0
- package/dist/modules/workspaces/updateWorkspaceInheritFlag.d.ts +13 -0
- package/dist/modules/workspaces/updateWorkspaceMember.d.ts +17 -0
- package/package.json +1 -1
|
@@ -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 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,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,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,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>;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
export { createWorkspace } from "./createWorkspace";
|
|
2
2
|
export { fetchWorkspace } from "./fetchWorkspace";
|
|
3
3
|
export { fetchManyWorkspaces } from "./fetchManyWorkspaces";
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
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>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { WorkspaceCapability, WorkspaceMember } from "../../interfaces/Workspace";
|
|
3
|
+
export interface UpdateWorkspaceMemberProps {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
targetUserId: string;
|
|
6
|
+
capabilities?: WorkspaceCapability[];
|
|
7
|
+
permissions?: string[];
|
|
8
|
+
rank?: number;
|
|
9
|
+
title?: string | null;
|
|
10
|
+
metadata?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Edit a member's grant / profile. Powerful fields need `edit-member-access`
|
|
14
|
+
* plus rank + no-escalation rules; cosmetic fields need only
|
|
15
|
+
* `edit-member-profile`. No `userId` is sent — the actor comes from the token.
|
|
16
|
+
*/
|
|
17
|
+
export declare function updateWorkspaceMember(client: SublayHttpClient, data: UpdateWorkspaceMemberProps): Promise<WorkspaceMember>;
|