@sublay/js 7.7.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +482 -66
- package/dist/index.d.ts +3 -2
- package/dist/index.js +208 -37
- package/dist/index.mjs +208 -37
- package/dist/interfaces/Push.d.ts +54 -0
- package/dist/interfaces/Report.d.ts +7 -1
- package/dist/interfaces/Workspace.d.ts +74 -1
- package/dist/modules/auth/changePassword.d.ts +23 -0
- package/dist/modules/auth/signOut.d.ts +95 -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
|
@@ -18,3 +18,57 @@ export type MuteDuration = (typeof MUTE_DURATIONS)[number];
|
|
|
18
18
|
export interface NotificationPreferences {
|
|
19
19
|
disabledTypes: PushEventType[];
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* A Web Push subscription in its SERIALIZED form — the JSON the server reads,
|
|
23
|
+
* not the live browser object.
|
|
24
|
+
*
|
|
25
|
+
* A `PushSubscription` straight from `PushManager.subscribe()` does NOT satisfy
|
|
26
|
+
* this type. It exposes its keys only through `getKey(name)`; there is no `keys`
|
|
27
|
+
* property to read, so it is not assignable here under strict TypeScript, and
|
|
28
|
+
* passing one through a cast sends a body the server rejects.
|
|
29
|
+
*
|
|
30
|
+
* To produce a value of this type:
|
|
31
|
+
*
|
|
32
|
+
* 1. **Serialize** the subscription with `subscription.toJSON()`.
|
|
33
|
+
* 2. **Confirm** `endpoint`, `keys.p256dh` and `keys.auth` are all present —
|
|
34
|
+
* `PushSubscriptionJSON` types every one of them as optional, while the
|
|
35
|
+
* server requires all three as non-empty strings and 400s otherwise.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* const json = subscription.toJSON();
|
|
39
|
+
* if (!json.endpoint || !json.keys?.p256dh || !json.keys?.auth) {
|
|
40
|
+
* throw new Error("Incomplete Web Push subscription");
|
|
41
|
+
* }
|
|
42
|
+
* const webPushSubscription: WebPushSubscription = {
|
|
43
|
+
* endpoint: json.endpoint,
|
|
44
|
+
* keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* Mirrors the server's `webPushSubscriptionSchema`
|
|
49
|
+
* (server `src/v7/validation/push-notifications/push-notifications.schema.ts`).
|
|
50
|
+
*/
|
|
51
|
+
export interface WebPushSubscription {
|
|
52
|
+
endpoint: string;
|
|
53
|
+
keys: {
|
|
54
|
+
p256dh: string;
|
|
55
|
+
auth: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Identifies one physical device. Mirrors the server's device-identifier body
|
|
60
|
+
* exactly (server `src/v7/validation/push-notifications/push-notifications.schema.ts`):
|
|
61
|
+
* a provider token for `ios`/`android`, a Web Push subscription for `web`. The
|
|
62
|
+
* union encodes the server's own cross-check — it rejects the same
|
|
63
|
+
* combinations the server's `superRefine` rejects.
|
|
64
|
+
*
|
|
65
|
+
* Passed to `auth.signOut` to unbind that device's push binding in the same
|
|
66
|
+
* transaction as the sign-out.
|
|
67
|
+
*/
|
|
68
|
+
export type PushDeviceIdentifier = {
|
|
69
|
+
platform: "ios" | "android";
|
|
70
|
+
token: string;
|
|
71
|
+
} | {
|
|
72
|
+
platform: "web";
|
|
73
|
+
subscription: WebPushSubscription;
|
|
74
|
+
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Entity } from "./Entity";
|
|
2
2
|
import { Comment } from "./Comment";
|
|
3
3
|
import { Space } from "./Space";
|
|
4
|
-
export type ReportTargetType = "entity" | "comment";
|
|
4
|
+
export type ReportTargetType = "entity" | "comment" | "message";
|
|
5
|
+
/**
|
|
6
|
+
* The reasons the API accepts on a report. Server-enforced — anything outside
|
|
7
|
+
* this set is rejected with `report/invalid-body`. Use `other` plus `details`
|
|
8
|
+
* for anything the taxonomy doesn't cover.
|
|
9
|
+
*/
|
|
10
|
+
export type ReportReason = "spam" | "inappropriateContent" | "harassment" | "misinformation" | "hateSpeech" | "violence" | "illegalActivity" | "selfHarm" | "other";
|
|
5
11
|
export type ReportStatus = "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
|
|
6
12
|
export interface UserReport {
|
|
7
13
|
id: string;
|
|
@@ -11,6 +11,13 @@ import { User } from "./User";
|
|
|
11
11
|
export type WorkspaceCapability = "view" | "invite" | "remove-member" | "edit-member-access" | "edit-member-profile" | "create-sub-workspace" | "edit-workspace";
|
|
12
12
|
export type WorkspaceInvitationStatus = "pending" | "accepted" | "declined" | "revoked";
|
|
13
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
|
+
};
|
|
14
21
|
export interface Workspace {
|
|
15
22
|
id: string;
|
|
16
23
|
name: string;
|
|
@@ -23,6 +30,18 @@ export interface Workspace {
|
|
|
23
30
|
updatedAt: string;
|
|
24
31
|
memberCount?: number;
|
|
25
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
|
+
}
|
|
26
45
|
export interface WorkspaceInvitation {
|
|
27
46
|
id: string;
|
|
28
47
|
workspaceId: string;
|
|
@@ -67,9 +86,63 @@ export interface WorkspaceRosterCountsResponse {
|
|
|
67
86
|
total: number;
|
|
68
87
|
distinctUsers: number;
|
|
69
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
|
+
}
|
|
70
105
|
export interface WorkspaceAuthority {
|
|
71
|
-
reasons:
|
|
106
|
+
reasons: WorkspaceAuthorityReasonDetail[];
|
|
72
107
|
capabilities: WorkspaceCapability[];
|
|
73
108
|
permissions: string[];
|
|
74
109
|
rank: number | null;
|
|
75
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,11 +1,34 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { PushDeviceIdentifier } from "../../interfaces/Push";
|
|
2
3
|
export interface ChangePasswordProps {
|
|
3
4
|
/** The user's current password (verified before the change). */
|
|
4
5
|
password: string;
|
|
5
6
|
newPassword: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional. The physical device making this call.
|
|
9
|
+
*
|
|
10
|
+
* A password change also deletes every push binding the user holds, so an
|
|
11
|
+
* intruder's device stops receiving notification content. Naming this device
|
|
12
|
+
* keeps ITS binding — nothing re-binds a device from its live session, so
|
|
13
|
+
* without this the handset the user just changed their password on goes
|
|
14
|
+
* quiet until the app cold-starts or switches accounts.
|
|
15
|
+
*
|
|
16
|
+
* Same value passed to `push.register` / `auth.signOut`. Omit it and every
|
|
17
|
+
* binding for the user goes, this device included.
|
|
18
|
+
*/
|
|
19
|
+
pushDevice?: PushDeviceIdentifier;
|
|
6
20
|
}
|
|
7
21
|
export interface ChangePasswordResponse {
|
|
8
22
|
success: boolean;
|
|
9
23
|
message: string;
|
|
10
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Change the signed-in user's password.
|
|
27
|
+
*
|
|
28
|
+
* Ends every OTHER session for that user — every other device must sign in
|
|
29
|
+
* again with the new password — while the session making this call survives.
|
|
30
|
+
* The server identifies that session from the access token this request is
|
|
31
|
+
* already authenticated with, so nothing about the caller's session has to be
|
|
32
|
+
* sent.
|
|
33
|
+
*/
|
|
11
34
|
export declare function changePassword(client: SublayHttpClient, data: ChangePasswordProps): Promise<ChangePasswordResponse>;
|
|
@@ -1,9 +1,103 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { PushDeviceIdentifier } from "../../interfaces/Push";
|
|
2
3
|
export interface SignOutProps {
|
|
3
4
|
/**
|
|
4
5
|
* Defaults to the SDK's stored refresh token (SDK-managed mode). Pass it
|
|
5
6
|
* explicitly in host-managed mode, where the SDK holds no refresh token.
|
|
6
7
|
*/
|
|
7
8
|
refreshToken?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional. When supplied — and the project has the `push` bundle — the
|
|
11
|
+
* server deletes this user's push binding for that device in the SAME
|
|
12
|
+
* transaction as the token-family destroy: signing out unbinds the device's
|
|
13
|
+
* push, or nothing happens at all.
|
|
14
|
+
*
|
|
15
|
+
* **Needs a refresh token to have any effect.** The unbind is scoped to the
|
|
16
|
+
* `sub` of the refresh token, which is what stops one account removing
|
|
17
|
+
* another account's binding on a shared device — so with no token there is no
|
|
18
|
+
* user to scope it to and the server answers `204` before it ever looks at
|
|
19
|
+
* `pushDevice`. When none can be resolved the field is DROPPED from the
|
|
20
|
+
* request rather than sent into that silent no-op, the sign-out proceeds
|
|
21
|
+
* normally, and the returned `pushUnbindSkipped` says so. Watch for it in
|
|
22
|
+
* **host-managed mode**: such a client is built with `getToken` and no
|
|
23
|
+
* `initialTokens`, and its `setTokens` is inert, so it starts with no refresh
|
|
24
|
+
* token and can never acquire one. Pass `refreshToken` explicitly alongside
|
|
25
|
+
* `pushDevice` there.
|
|
26
|
+
*
|
|
27
|
+
* If the unbind fails the request fails (HTTP 500, code
|
|
28
|
+
* `auth/device-deregistration-failed` or `auth/sign-out-failed`) and NOTHING
|
|
29
|
+
* is committed — the session survives so the caller can retry, and this call
|
|
30
|
+
* rethrows WITHOUT clearing the SDK's local tokens, so the credential that
|
|
31
|
+
* retry needs is still there.
|
|
32
|
+
*
|
|
33
|
+
* That is the ONLY failure that leaves you signed in. Every other one — a
|
|
34
|
+
* `429` from the rate limiter or a quota gate, a `423`, a `503`, a `400` on
|
|
35
|
+
* the body, a dropped connection — never touched a push binding, so it
|
|
36
|
+
* clears the local tokens and RESOLVES: a user must always be able to sign
|
|
37
|
+
* out. See `UNBIND_FAILURE_CODES`.
|
|
38
|
+
*
|
|
39
|
+
* Omit it and the request is byte-identical to before this field existed.
|
|
40
|
+
*/
|
|
41
|
+
pushDevice?: PushDeviceIdentifier;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Why the unbind did not happen. Present only when `pushUnbindSkipped` is
|
|
45
|
+
* `true`, and it exists because THE TWO SKIPS ARE RECOVERED DIFFERENTLY — a
|
|
46
|
+
* caller that cannot tell them apart can only ever pick the wrong remedy for
|
|
47
|
+
* one of them:
|
|
48
|
+
*
|
|
49
|
+
* - `no-refresh-token` — this SDK never asked. Nothing was destroyed either:
|
|
50
|
+
* with no token the server has no session to end, so the account, its
|
|
51
|
+
* credential and its binding are all still there. **Retryable**: re-issue
|
|
52
|
+
* the sign-out with an explicit `refreshToken` and the unbind happens.
|
|
53
|
+
* - `push-unbind-status-unknown` — the server was asked and could not answer.
|
|
54
|
+
* The sign-out itself DID commit, so the credential that would have driven a
|
|
55
|
+
* retry is gone; re-issuing achieves nothing. The binding clears when that
|
|
56
|
+
* account next registers on this device, or when the server prunes the token
|
|
57
|
+
* as undeliverable.
|
|
58
|
+
*/
|
|
59
|
+
export type PushUnbindSkipReason = "no-refresh-token" | "push-unbind-status-unknown";
|
|
60
|
+
export interface SignOutResult {
|
|
61
|
+
/**
|
|
62
|
+
* `true` whenever a `pushDevice` was supplied and the unbind did NOT happen,
|
|
63
|
+
* so this device's push binding for that account may still be live. Either
|
|
64
|
+
* the SDK declined to ask (no refresh token to scope the unbind to) or the
|
|
65
|
+
* server could not answer whether a binding exists; `pushUnbindSkipReason`
|
|
66
|
+
* says which, and the two are recovered differently.
|
|
67
|
+
*
|
|
68
|
+
* `false` means NO SKIP WAS REPORTED — by this SDK or by the server. It is
|
|
69
|
+
* not a promise that no skip happened, and the difference is not academic:
|
|
70
|
+
* the server declines the unbind for several reasons it answers with a plain
|
|
71
|
+
* `204`, and every one of them reads `false` here.
|
|
72
|
+
*
|
|
73
|
+
* - The refresh token is authentic but expired beyond the server's unbind
|
|
74
|
+
* window (90 days past `exp`), so there is no subject to scope the unbind
|
|
75
|
+
* to. Reachable from this SDK by passing an old `refreshToken` explicitly
|
|
76
|
+
* alongside `pushDevice`.
|
|
77
|
+
* - The refresh token is malformed or fails signature verification.
|
|
78
|
+
* - The project has no `push` bundle, so no binding can exist.
|
|
79
|
+
* - The unbind ran and matched zero rows — the binding was already gone, or
|
|
80
|
+
* was never registered under this device key.
|
|
81
|
+
*
|
|
82
|
+
* The server logs each of those under its own reason; only the case where it
|
|
83
|
+
* could not determine whether a binding exists is reported in the response,
|
|
84
|
+
* because that is the one where the binding may still be LIVE and nobody
|
|
85
|
+
* looked. The rest either prove there was nothing to remove or leave a device
|
|
86
|
+
* key the server cannot attribute to a user, and neither gives the caller
|
|
87
|
+
* anything to act on beyond what it already knows.
|
|
88
|
+
*
|
|
89
|
+
* A request that failed short of an unbind attempt reads `false` too — a
|
|
90
|
+
* gate's `429` or `423`, a `503`, a `400`, a dropped connection. Those clear
|
|
91
|
+
* the local tokens and resolve rather than reject (see `UNBIND_FAILURE_CODES`
|
|
92
|
+
* for why), and none of them is a REPORTED skip; they are logged with a
|
|
93
|
+
* warning instead.
|
|
94
|
+
*
|
|
95
|
+
* The sign-out itself is unaffected by the flag in both directions: a user
|
|
96
|
+
* must always be able to sign out, so a skipped unbind never fails the call
|
|
97
|
+
* and never leaves the local tokens in place.
|
|
98
|
+
*/
|
|
99
|
+
pushUnbindSkipped: boolean;
|
|
100
|
+
/** Set only when `pushUnbindSkipped` is `true`. See `PushUnbindSkipReason`. */
|
|
101
|
+
pushUnbindSkipReason?: PushUnbindSkipReason;
|
|
8
102
|
}
|
|
9
|
-
export declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<
|
|
103
|
+
export declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<SignOutResult>;
|
|
@@ -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
|
|
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
|
|
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:
|
|
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>;
|
|
@@ -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>;
|