@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.
Files changed (34) hide show
  1. package/dist/index.d.mts +482 -66
  2. package/dist/index.d.ts +3 -2
  3. package/dist/index.js +208 -37
  4. package/dist/index.mjs +208 -37
  5. package/dist/interfaces/Push.d.ts +54 -0
  6. package/dist/interfaces/Report.d.ts +7 -1
  7. package/dist/interfaces/Workspace.d.ts +74 -1
  8. package/dist/modules/auth/changePassword.d.ts +23 -0
  9. package/dist/modules/auth/signOut.d.ts +95 -1
  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/workspaces/acceptWorkspaceInvite.d.ts +13 -0
  16. package/dist/modules/workspaces/createWorkspaceInvite.d.ts +17 -0
  17. package/dist/modules/workspaces/declineWorkspaceInvite.d.ts +14 -0
  18. package/dist/modules/workspaces/deleteWorkspace.d.ts +13 -0
  19. package/dist/modules/workspaces/fetchMyWorkspaceInvites.d.ts +15 -0
  20. package/dist/modules/workspaces/fetchWorkspaceAuthority.d.ts +11 -0
  21. package/dist/modules/workspaces/fetchWorkspaceInvites.d.ts +17 -0
  22. package/dist/modules/workspaces/fetchWorkspaceMemberStanding.d.ts +11 -0
  23. package/dist/modules/workspaces/fetchWorkspaceMembers.d.ts +13 -0
  24. package/dist/modules/workspaces/index.d.ts +18 -6
  25. package/dist/modules/workspaces/leaveWorkspace.d.ts +11 -0
  26. package/dist/modules/workspaces/removeWorkspaceMember.d.ts +12 -0
  27. package/dist/modules/workspaces/removeWorkspaceMemberFromSubtree.d.ts +16 -0
  28. package/dist/modules/workspaces/resendWorkspaceInvite.d.ts +12 -0
  29. package/dist/modules/workspaces/revokeWorkspaceInvite.d.ts +13 -0
  30. package/dist/modules/workspaces/transferWorkspaceOwnership.d.ts +15 -0
  31. package/dist/modules/workspaces/updateWorkspace.d.ts +12 -0
  32. package/dist/modules/workspaces/updateWorkspaceInheritFlag.d.ts +13 -0
  33. package/dist/modules/workspaces/updateWorkspaceMember.d.ts +17 -0
  34. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -184,14 +184,182 @@ interface SignInResponse {
184
184
  }
185
185
  declare function signIn(client: SublayHttpClient, data: SignInProps): Promise<SignInResponse>;
186
186
 
187
+ /**
188
+ * Every push event type — the full app-notification type set plus the chat
189
+ * `message` event (push-only). Mirrors the server's `PUSH_EVENT_TYPES` exactly
190
+ * (server `src/constants/push/pushEvents.ts`); these are the only names a
191
+ * `disabledTypes` set may contain.
192
+ */
193
+ declare const PUSH_EVENT_TYPES: readonly ["entity-comment", "comment-reply", "entity-mention", "comment-mention", "entity-reaction", "comment-reaction", "entity-reaction-milestone-specific", "entity-reaction-milestone-total", "comment-reaction-milestone-specific", "comment-reaction-milestone-total", "new-follow", "connection-request", "connection-accepted", "space-membership-approved", "event-invite", "event-updated", "event-cancelled", "message"];
194
+ type PushEventType = (typeof PUSH_EVENT_TYPES)[number];
195
+ /**
196
+ * The four conversation-mute duration choices. Send the CHOICE, never a raw
197
+ * timestamp — the server resolves it and represents "forever" via the explicit
198
+ * `mutedForever` signal on the returned member. Mirrors the server's
199
+ * `MUTE_DURATIONS` (server `src/helpers/push/muteDuration.ts`).
200
+ */
201
+ declare const MUTE_DURATIONS: readonly ["8h", "24h", "1w", "forever"];
202
+ type MuteDuration = (typeof MUTE_DURATIONS)[number];
203
+ /** Response of read/update notification preferences. */
204
+ interface NotificationPreferences {
205
+ disabledTypes: PushEventType[];
206
+ }
207
+ /**
208
+ * A Web Push subscription in its SERIALIZED form — the JSON the server reads,
209
+ * not the live browser object.
210
+ *
211
+ * A `PushSubscription` straight from `PushManager.subscribe()` does NOT satisfy
212
+ * this type. It exposes its keys only through `getKey(name)`; there is no `keys`
213
+ * property to read, so it is not assignable here under strict TypeScript, and
214
+ * passing one through a cast sends a body the server rejects.
215
+ *
216
+ * To produce a value of this type:
217
+ *
218
+ * 1. **Serialize** the subscription with `subscription.toJSON()`.
219
+ * 2. **Confirm** `endpoint`, `keys.p256dh` and `keys.auth` are all present —
220
+ * `PushSubscriptionJSON` types every one of them as optional, while the
221
+ * server requires all three as non-empty strings and 400s otherwise.
222
+ *
223
+ * ```ts
224
+ * const json = subscription.toJSON();
225
+ * if (!json.endpoint || !json.keys?.p256dh || !json.keys?.auth) {
226
+ * throw new Error("Incomplete Web Push subscription");
227
+ * }
228
+ * const webPushSubscription: WebPushSubscription = {
229
+ * endpoint: json.endpoint,
230
+ * keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },
231
+ * };
232
+ * ```
233
+ *
234
+ * Mirrors the server's `webPushSubscriptionSchema`
235
+ * (server `src/v7/validation/push-notifications/push-notifications.schema.ts`).
236
+ */
237
+ interface WebPushSubscription {
238
+ endpoint: string;
239
+ keys: {
240
+ p256dh: string;
241
+ auth: string;
242
+ };
243
+ }
244
+ /**
245
+ * Identifies one physical device. Mirrors the server's device-identifier body
246
+ * exactly (server `src/v7/validation/push-notifications/push-notifications.schema.ts`):
247
+ * a provider token for `ios`/`android`, a Web Push subscription for `web`. The
248
+ * union encodes the server's own cross-check — it rejects the same
249
+ * combinations the server's `superRefine` rejects.
250
+ *
251
+ * Passed to `auth.signOut` to unbind that device's push binding in the same
252
+ * transaction as the sign-out.
253
+ */
254
+ type PushDeviceIdentifier = {
255
+ platform: "ios" | "android";
256
+ token: string;
257
+ } | {
258
+ platform: "web";
259
+ subscription: WebPushSubscription;
260
+ };
261
+
187
262
  interface SignOutProps {
188
263
  /**
189
264
  * Defaults to the SDK's stored refresh token (SDK-managed mode). Pass it
190
265
  * explicitly in host-managed mode, where the SDK holds no refresh token.
191
266
  */
192
267
  refreshToken?: string;
268
+ /**
269
+ * Optional. When supplied — and the project has the `push` bundle — the
270
+ * server deletes this user's push binding for that device in the SAME
271
+ * transaction as the token-family destroy: signing out unbinds the device's
272
+ * push, or nothing happens at all.
273
+ *
274
+ * **Needs a refresh token to have any effect.** The unbind is scoped to the
275
+ * `sub` of the refresh token, which is what stops one account removing
276
+ * another account's binding on a shared device — so with no token there is no
277
+ * user to scope it to and the server answers `204` before it ever looks at
278
+ * `pushDevice`. When none can be resolved the field is DROPPED from the
279
+ * request rather than sent into that silent no-op, the sign-out proceeds
280
+ * normally, and the returned `pushUnbindSkipped` says so. Watch for it in
281
+ * **host-managed mode**: such a client is built with `getToken` and no
282
+ * `initialTokens`, and its `setTokens` is inert, so it starts with no refresh
283
+ * token and can never acquire one. Pass `refreshToken` explicitly alongside
284
+ * `pushDevice` there.
285
+ *
286
+ * If the unbind fails the request fails (HTTP 500, code
287
+ * `auth/device-deregistration-failed` or `auth/sign-out-failed`) and NOTHING
288
+ * is committed — the session survives so the caller can retry, and this call
289
+ * rethrows WITHOUT clearing the SDK's local tokens, so the credential that
290
+ * retry needs is still there.
291
+ *
292
+ * That is the ONLY failure that leaves you signed in. Every other one — a
293
+ * `429` from the rate limiter or a quota gate, a `423`, a `503`, a `400` on
294
+ * the body, a dropped connection — never touched a push binding, so it
295
+ * clears the local tokens and RESOLVES: a user must always be able to sign
296
+ * out. See `UNBIND_FAILURE_CODES`.
297
+ *
298
+ * Omit it and the request is byte-identical to before this field existed.
299
+ */
300
+ pushDevice?: PushDeviceIdentifier;
193
301
  }
194
- declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<void>;
302
+ /**
303
+ * Why the unbind did not happen. Present only when `pushUnbindSkipped` is
304
+ * `true`, and it exists because THE TWO SKIPS ARE RECOVERED DIFFERENTLY — a
305
+ * caller that cannot tell them apart can only ever pick the wrong remedy for
306
+ * one of them:
307
+ *
308
+ * - `no-refresh-token` — this SDK never asked. Nothing was destroyed either:
309
+ * with no token the server has no session to end, so the account, its
310
+ * credential and its binding are all still there. **Retryable**: re-issue
311
+ * the sign-out with an explicit `refreshToken` and the unbind happens.
312
+ * - `push-unbind-status-unknown` — the server was asked and could not answer.
313
+ * The sign-out itself DID commit, so the credential that would have driven a
314
+ * retry is gone; re-issuing achieves nothing. The binding clears when that
315
+ * account next registers on this device, or when the server prunes the token
316
+ * as undeliverable.
317
+ */
318
+ type PushUnbindSkipReason = "no-refresh-token" | "push-unbind-status-unknown";
319
+ interface SignOutResult {
320
+ /**
321
+ * `true` whenever a `pushDevice` was supplied and the unbind did NOT happen,
322
+ * so this device's push binding for that account may still be live. Either
323
+ * the SDK declined to ask (no refresh token to scope the unbind to) or the
324
+ * server could not answer whether a binding exists; `pushUnbindSkipReason`
325
+ * says which, and the two are recovered differently.
326
+ *
327
+ * `false` means NO SKIP WAS REPORTED — by this SDK or by the server. It is
328
+ * not a promise that no skip happened, and the difference is not academic:
329
+ * the server declines the unbind for several reasons it answers with a plain
330
+ * `204`, and every one of them reads `false` here.
331
+ *
332
+ * - The refresh token is authentic but expired beyond the server's unbind
333
+ * window (90 days past `exp`), so there is no subject to scope the unbind
334
+ * to. Reachable from this SDK by passing an old `refreshToken` explicitly
335
+ * alongside `pushDevice`.
336
+ * - The refresh token is malformed or fails signature verification.
337
+ * - The project has no `push` bundle, so no binding can exist.
338
+ * - The unbind ran and matched zero rows — the binding was already gone, or
339
+ * was never registered under this device key.
340
+ *
341
+ * The server logs each of those under its own reason; only the case where it
342
+ * could not determine whether a binding exists is reported in the response,
343
+ * because that is the one where the binding may still be LIVE and nobody
344
+ * looked. The rest either prove there was nothing to remove or leave a device
345
+ * key the server cannot attribute to a user, and neither gives the caller
346
+ * anything to act on beyond what it already knows.
347
+ *
348
+ * A request that failed short of an unbind attempt reads `false` too — a
349
+ * gate's `429` or `423`, a `503`, a `400`, a dropped connection. Those clear
350
+ * the local tokens and resolve rather than reject (see `UNBIND_FAILURE_CODES`
351
+ * for why), and none of them is a REPORTED skip; they are logged with a
352
+ * warning instead.
353
+ *
354
+ * The sign-out itself is unaffected by the flag in both directions: a user
355
+ * must always be able to sign out, so a skipped unbind never fails the call
356
+ * and never leaves the local tokens in place.
357
+ */
358
+ pushUnbindSkipped: boolean;
359
+ /** Set only when `pushUnbindSkipped` is `true`. See `PushUnbindSkipReason`. */
360
+ pushUnbindSkipReason?: PushUnbindSkipReason;
361
+ }
362
+ declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<SignOutResult>;
195
363
 
196
364
  interface RequestNewAccessTokenProps {
197
365
  /** Defaults to the SDK's stored refresh token (SDK-managed mode). */
@@ -234,11 +402,33 @@ interface ChangePasswordProps {
234
402
  /** The user's current password (verified before the change). */
235
403
  password: string;
236
404
  newPassword: string;
405
+ /**
406
+ * Optional. The physical device making this call.
407
+ *
408
+ * A password change also deletes every push binding the user holds, so an
409
+ * intruder's device stops receiving notification content. Naming this device
410
+ * keeps ITS binding — nothing re-binds a device from its live session, so
411
+ * without this the handset the user just changed their password on goes
412
+ * quiet until the app cold-starts or switches accounts.
413
+ *
414
+ * Same value passed to `push.register` / `auth.signOut`. Omit it and every
415
+ * binding for the user goes, this device included.
416
+ */
417
+ pushDevice?: PushDeviceIdentifier;
237
418
  }
238
419
  interface ChangePasswordResponse {
239
420
  success: boolean;
240
421
  message: string;
241
422
  }
423
+ /**
424
+ * Change the signed-in user's password.
425
+ *
426
+ * Ends every OTHER session for that user — every other device must sign in
427
+ * again with the new password — while the session making this call survives.
428
+ * The server identifies that session from the access token this request is
429
+ * already authenticated with, so nothing about the caller's session has to be
430
+ * sent.
431
+ */
242
432
  declare function changePassword(client: SublayHttpClient, data: ChangePasswordProps): Promise<ChangePasswordResponse>;
243
433
 
244
434
  interface SetPasswordProps {
@@ -1607,7 +1797,10 @@ declare function fetchCommentByForeignId(client: SublayHttpClient, data: FetchCo
1607
1797
 
1608
1798
  interface UpdateCommentProps {
1609
1799
  commentId: string;
1610
- content: string;
1800
+ /** New text content. Cannot be empty. Omit to leave the content untouched. */
1801
+ content?: string;
1802
+ /** Replaces the comment's metadata wholesale (not merged). */
1803
+ metadata?: Record<string, any>;
1611
1804
  }
1612
1805
  declare function updateComment(client: SublayHttpClient, data: UpdateCommentProps): Promise<Comment>;
1613
1806
 
@@ -1749,6 +1942,12 @@ interface FetchUserSpacesProps {
1749
1942
  include?: string;
1750
1943
  role?: string;
1751
1944
  all?: "true" | "false";
1945
+ /**
1946
+ * Membership status to list. Defaults to `"active"` (spaces the user is in);
1947
+ * `"pending"` returns join requests awaiting approval, `"banned"` the spaces
1948
+ * they were removed from.
1949
+ */
1950
+ status?: "active" | "pending" | "banned";
1752
1951
  }
1753
1952
  declare function fetchUserSpaces(client: SublayHttpClient, data: FetchUserSpacesProps): Promise<UserSpacesResponse>;
1754
1953
 
@@ -2229,7 +2428,7 @@ declare function removeEntityFromCollection(client: SublayHttpClient, data: Remo
2229
2428
 
2230
2429
  interface UpdateCollectionProps {
2231
2430
  collectionId: string;
2232
- name?: string;
2431
+ name: string;
2233
2432
  }
2234
2433
  declare function updateCollection(client: SublayHttpClient, data: UpdateCollectionProps): Promise<Collection>;
2235
2434
 
@@ -2612,7 +2811,13 @@ declare namespace AppNotifications {
2612
2811
  export { AppNotifications_countUnreadNotifications as countUnreadNotifications, AppNotifications_fetchNotifications as fetchNotifications, AppNotifications_markAllNotificationsAsRead as markAllNotificationsAsRead, AppNotifications_markNotificationAsRead as markNotificationAsRead };
2613
2812
  }
2614
2813
 
2615
- type ReportTargetType = "entity" | "comment";
2814
+ type ReportTargetType = "entity" | "comment" | "message";
2815
+ /**
2816
+ * The reasons the API accepts on a report. Server-enforced — anything outside
2817
+ * this set is rejected with `report/invalid-body`. Use `other` plus `details`
2818
+ * for anything the taxonomy doesn't cover.
2819
+ */
2820
+ type ReportReason = "spam" | "inappropriateContent" | "harassment" | "misinformation" | "hateSpeech" | "violence" | "illegalActivity" | "selfHarm" | "other";
2616
2821
  type ReportStatus = "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
2617
2822
  interface UserReport {
2618
2823
  id: string;
@@ -2645,7 +2850,7 @@ interface CreateReportResponse {
2645
2850
  interface CreateReportProps {
2646
2851
  targetType: ReportTargetType;
2647
2852
  targetId: string;
2648
- reason: string;
2853
+ reason: ReportReason;
2649
2854
  details?: string;
2650
2855
  }
2651
2856
  declare function createReport(client: SublayHttpClient, data: CreateReportProps): Promise<CreateReportResponse>;
@@ -3229,27 +3434,6 @@ declare function markAsRead(client: SublayHttpClient, data: MarkAsReadProps): Pr
3229
3434
  message: string;
3230
3435
  }>;
3231
3436
 
3232
- /**
3233
- * Every push event type — the full app-notification type set plus the chat
3234
- * `message` event (push-only). Mirrors the server's `PUSH_EVENT_TYPES` exactly
3235
- * (server `src/constants/push/pushEvents.ts`); these are the only names a
3236
- * `disabledTypes` set may contain.
3237
- */
3238
- declare const PUSH_EVENT_TYPES: readonly ["entity-comment", "comment-reply", "entity-mention", "comment-mention", "entity-reaction", "comment-reaction", "entity-reaction-milestone-specific", "entity-reaction-milestone-total", "comment-reaction-milestone-specific", "comment-reaction-milestone-total", "new-follow", "connection-request", "connection-accepted", "space-membership-approved", "event-invite", "event-updated", "event-cancelled", "message"];
3239
- type PushEventType = (typeof PUSH_EVENT_TYPES)[number];
3240
- /**
3241
- * The four conversation-mute duration choices. Send the CHOICE, never a raw
3242
- * timestamp — the server resolves it and represents "forever" via the explicit
3243
- * `mutedForever` signal on the returned member. Mirrors the server's
3244
- * `MUTE_DURATIONS` (server `src/helpers/push/muteDuration.ts`).
3245
- */
3246
- declare const MUTE_DURATIONS: readonly ["8h", "24h", "1w", "forever"];
3247
- type MuteDuration = (typeof MUTE_DURATIONS)[number];
3248
- /** Response of read/update notification preferences. */
3249
- interface NotificationPreferences {
3250
- disabledTypes: PushEventType[];
3251
- }
3252
-
3253
3437
  interface MuteConversationProps {
3254
3438
  conversationId: string;
3255
3439
  /**
@@ -3271,18 +3455,6 @@ interface MuteConversationResponse {
3271
3455
  */
3272
3456
  declare function muteConversation(client: SublayHttpClient, data: MuteConversationProps): Promise<MuteConversationResponse>;
3273
3457
 
3274
- interface ReportMessageProps {
3275
- conversationId: string;
3276
- messageId: string;
3277
- reason: string;
3278
- details?: string;
3279
- }
3280
- interface ReportMessageResponse {
3281
- message: string;
3282
- code: string;
3283
- }
3284
- declare function reportMessage(client: SublayHttpClient, data: ReportMessageProps): Promise<ReportMessageResponse>;
3285
-
3286
3458
  declare const Chat_addMember: typeof addMember;
3287
3459
  declare const Chat_changeMemberRole: typeof changeMemberRole;
3288
3460
  declare const Chat_createDirectConversation: typeof createDirectConversation;
@@ -3301,12 +3473,11 @@ declare const Chat_listReactions: typeof listReactions;
3301
3473
  declare const Chat_markAsRead: typeof markAsRead;
3302
3474
  declare const Chat_muteConversation: typeof muteConversation;
3303
3475
  declare const Chat_removeMember: typeof removeMember;
3304
- declare const Chat_reportMessage: typeof reportMessage;
3305
3476
  declare const Chat_sendMessage: typeof sendMessage;
3306
3477
  declare const Chat_toggleReaction: typeof toggleReaction;
3307
3478
  declare const Chat_updateConversation: typeof updateConversation;
3308
3479
  declare namespace Chat {
3309
- export { Chat_addMember as addMember, Chat_changeMemberRole as changeMemberRole, Chat_createDirectConversation as createDirectConversation, Chat_createGroupConversation as createGroupConversation, Chat_deleteConversation as deleteConversation, Chat_deleteMessage as deleteMessage, Chat_editMessage as editMessage, Chat_getConversation as getConversation, Chat_getMessage as getMessage, Chat_getUnreadCount as getUnreadCount, Chat_leaveConversation as leaveConversation, Chat_listConversations as listConversations, Chat_listMembers as listMembers, Chat_listMessages as listMessages, Chat_listReactions as listReactions, Chat_markAsRead as markAsRead, Chat_muteConversation as muteConversation, Chat_removeMember as removeMember, Chat_reportMessage as reportMessage, Chat_sendMessage as sendMessage, Chat_toggleReaction as toggleReaction, Chat_updateConversation as updateConversation };
3480
+ export { Chat_addMember as addMember, Chat_changeMemberRole as changeMemberRole, Chat_createDirectConversation as createDirectConversation, Chat_createGroupConversation as createGroupConversation, Chat_deleteConversation as deleteConversation, Chat_deleteMessage as deleteMessage, Chat_editMessage as editMessage, Chat_getConversation as getConversation, Chat_getMessage as getMessage, Chat_getUnreadCount as getUnreadCount, Chat_leaveConversation as leaveConversation, Chat_listConversations as listConversations, Chat_listMembers as listMembers, Chat_listMessages as listMessages, Chat_listReactions as listReactions, Chat_markAsRead as markAsRead, Chat_muteConversation as muteConversation, Chat_removeMember as removeMember, Chat_sendMessage as sendMessage, Chat_toggleReaction as toggleReaction, Chat_updateConversation as updateConversation };
3310
3481
  }
3311
3482
 
3312
3483
  /**
@@ -3352,6 +3523,13 @@ declare namespace Push {
3352
3523
  type WorkspaceCapability = "view" | "invite" | "remove-member" | "edit-member-access" | "edit-member-profile" | "create-sub-workspace" | "edit-workspace";
3353
3524
  type WorkspaceInvitationStatus = "pending" | "accepted" | "declined" | "revoked";
3354
3525
  type WorkspaceAuthorityReason = "owner" | "ancestor-owner" | "member" | "reach-holder";
3526
+ type WorkspaceAuthorityReasonDetail = {
3527
+ type: "owner" | "member";
3528
+ viaWorkspaceId?: never;
3529
+ } | {
3530
+ type: "ancestor-owner" | "reach-holder";
3531
+ viaWorkspaceId: string;
3532
+ };
3355
3533
  interface Workspace {
3356
3534
  id: string;
3357
3535
  name: string;
@@ -3364,6 +3542,18 @@ interface Workspace {
3364
3542
  updatedAt: string;
3365
3543
  memberCount?: number;
3366
3544
  }
3545
+ interface WorkspaceMember {
3546
+ id: string;
3547
+ workspaceId: string;
3548
+ userId: string;
3549
+ capabilities: WorkspaceCapability[];
3550
+ permissions: string[];
3551
+ rank: number;
3552
+ title: string | null;
3553
+ metadata: Record<string, any>;
3554
+ joinedAt: string;
3555
+ createdAt: string;
3556
+ }
3367
3557
  interface WorkspaceInvitation {
3368
3558
  id: string;
3369
3559
  workspaceId: string;
@@ -3408,12 +3598,66 @@ interface WorkspaceRosterCountsResponse {
3408
3598
  total: number;
3409
3599
  distinctUsers: number;
3410
3600
  }
3601
+ /**
3602
+ * The `user` carried by a standing read. Normally the full user record, but the
3603
+ * server falls back to `{ id }` alone when the user row is gone (a deleted user
3604
+ * with a lingering membership row is a reachable case), so every field except
3605
+ * `id` may be absent.
3606
+ */
3607
+ type WorkspaceStandingUser = Pick<User, "id"> & Partial<Omit<User, "id">>;
3608
+ interface WorkspaceMemberStanding {
3609
+ user: WorkspaceStandingUser;
3610
+ reasons: WorkspaceAuthorityReasonDetail[];
3611
+ capabilities?: WorkspaceCapability[];
3612
+ permissions?: string[];
3613
+ rank?: number | null;
3614
+ title: string | null;
3615
+ metadata: Record<string, any>;
3616
+ }
3411
3617
  interface WorkspaceAuthority {
3412
- reasons: WorkspaceAuthorityReason[];
3618
+ reasons: WorkspaceAuthorityReasonDetail[];
3413
3619
  capabilities: WorkspaceCapability[];
3414
3620
  permissions: string[];
3415
3621
  rank: number | null;
3416
3622
  }
3623
+ /**
3624
+ * One descendant the subtree sweep did NOT clear, where the target user still
3625
+ * holds a direct membership.
3626
+ *
3627
+ * `id` / `name` are masked TOGETHER: an entry the acting user may see carries
3628
+ * both, and one they may not carries `null` for both — the sweep reports THAT a
3629
+ * membership survived without disclosing the existence or name of a sealed
3630
+ * sub-workspace the actor has no authority over (the same sealing fence the
3631
+ * descendant roster read applies). Modelled as a discriminated union so a
3632
+ * `null` check on `id` narrows `name` too.
3633
+ */
3634
+ type SkippedWorkspace = {
3635
+ id: string;
3636
+ name: string;
3637
+ /** Why it was skipped. `out-of-reach`: the actor's authority does not extend there. */
3638
+ reason: "out-of-reach";
3639
+ } | {
3640
+ id: null;
3641
+ name: null;
3642
+ /** Why it was skipped. `out-of-reach`: the actor's authority does not extend there. */
3643
+ reason: "out-of-reach";
3644
+ };
3645
+ interface RemoveWorkspaceMemberFromSubtreeResponse {
3646
+ removedCount: number;
3647
+ removed: {
3648
+ workspaceId: string;
3649
+ userId: string;
3650
+ }[];
3651
+ /**
3652
+ * How many descendant memberships the target RETAINED because the sweep could
3653
+ * not reach them. Always `0` for an owner / ancestor-owner / privileged key.
3654
+ * A non-zero value means the offboarding is PARTIAL — never conclude a user is
3655
+ * fully removed from `removedCount` alone.
3656
+ */
3657
+ skippedCount: number;
3658
+ /** One entry per retained membership; `skippedCount === skipped.length`. */
3659
+ skipped: SkippedWorkspace[];
3660
+ }
3417
3661
 
3418
3662
  interface CreateWorkspaceProps {
3419
3663
  name: string;
@@ -3443,7 +3687,57 @@ interface FetchManyWorkspacesProps {
3443
3687
  */
3444
3688
  declare function fetchManyWorkspaces(client: SublayHttpClient, data?: FetchManyWorkspacesProps): Promise<PaginatedResponse<Workspace>>;
3445
3689
 
3446
- interface FetchMembersProps {
3690
+ interface UpdateWorkspaceProps {
3691
+ workspaceId: string;
3692
+ name?: string;
3693
+ metadata?: Record<string, any>;
3694
+ }
3695
+ /**
3696
+ * Edit a workspace's name / metadata. Requires the `edit-workspace` capability
3697
+ * (or ownership). The actor is the bearer-token user — no `userId` is sent.
3698
+ */
3699
+ declare function updateWorkspace(client: SublayHttpClient, data: UpdateWorkspaceProps): Promise<Workspace>;
3700
+
3701
+ interface UpdateWorkspaceInheritFlagProps {
3702
+ workspaceId: string;
3703
+ inheritsFromParent: boolean;
3704
+ }
3705
+ /**
3706
+ * Flip whether capabilities held on an ancestor "reach" into this workspace.
3707
+ * Owner-only in both directions (own owner or an ancestor owner), and blocked
3708
+ * (403 `workspace/inherit-enforced`) when the project enforces its default.
3709
+ * The actor is the bearer-token user — no `userId` is sent.
3710
+ */
3711
+ declare function updateWorkspaceInheritFlag(client: SublayHttpClient, data: UpdateWorkspaceInheritFlagProps): Promise<Workspace>;
3712
+
3713
+ interface DeleteWorkspaceProps {
3714
+ workspaceId: string;
3715
+ }
3716
+ interface DeleteWorkspaceResponse {
3717
+ message: string;
3718
+ }
3719
+ /**
3720
+ * Owner-only delete (own owner or an ancestor owner). Cascades the whole
3721
+ * subtree transactionally. The actor is the bearer-token user — no `userId`
3722
+ * body is sent.
3723
+ */
3724
+ declare function deleteWorkspace(client: SublayHttpClient, data: DeleteWorkspaceProps): Promise<DeleteWorkspaceResponse>;
3725
+
3726
+ interface TransferWorkspaceOwnershipProps {
3727
+ workspaceId: string;
3728
+ newOwnerId: string;
3729
+ previousOwnerDisposition?: "demote" | "remove";
3730
+ previousOwnerRank?: number;
3731
+ previousOwnerCapabilities?: WorkspaceCapability[];
3732
+ }
3733
+ /**
3734
+ * Hand the workspace to a new owner. Owner-only (own owner or an ancestor
3735
+ * owner). The actor is the bearer-token user — no `userId` is sent;
3736
+ * `newOwnerId` addresses the TARGET, not the actor.
3737
+ */
3738
+ declare function transferWorkspaceOwnership(client: SublayHttpClient, data: TransferWorkspaceOwnershipProps): Promise<Workspace>;
3739
+
3740
+ interface FetchWorkspaceMembersProps {
3447
3741
  workspaceId: string;
3448
3742
  include?: string;
3449
3743
  countOnly?: boolean;
@@ -3453,9 +3747,73 @@ interface FetchMembersProps {
3453
3747
  * array. Always returned in full (never paginated). With `countOnly=true` the
3454
3748
  * shape is `WorkspaceRosterCountsResponse` instead. Actor from the token.
3455
3749
  */
3456
- declare function fetchMembers(client: SublayHttpClient, data: FetchMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
3750
+ declare function fetchWorkspaceMembers(client: SublayHttpClient, data: FetchWorkspaceMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
3457
3751
 
3458
- interface CreateInviteProps {
3752
+ interface FetchWorkspaceMemberStandingProps {
3753
+ workspaceId: string;
3754
+ targetUserId: string;
3755
+ }
3756
+ /**
3757
+ * Read one user's resolved standing on a workspace (`reasons`, `capabilities`,
3758
+ * `permissions`, `rank`, `title`, `metadata`).
3759
+ */
3760
+ declare function fetchWorkspaceMemberStanding(client: SublayHttpClient, data: FetchWorkspaceMemberStandingProps): Promise<WorkspaceMemberStanding>;
3761
+
3762
+ interface UpdateWorkspaceMemberProps {
3763
+ workspaceId: string;
3764
+ targetUserId: string;
3765
+ capabilities?: WorkspaceCapability[];
3766
+ permissions?: string[];
3767
+ rank?: number;
3768
+ title?: string | null;
3769
+ metadata?: Record<string, any>;
3770
+ }
3771
+ /**
3772
+ * Edit a member's grant / profile. Powerful fields need `edit-member-access`
3773
+ * plus rank + no-escalation rules; cosmetic fields need only
3774
+ * `edit-member-profile`. No `userId` is sent — the actor comes from the token.
3775
+ */
3776
+ declare function updateWorkspaceMember(client: SublayHttpClient, data: UpdateWorkspaceMemberProps): Promise<WorkspaceMember>;
3777
+
3778
+ interface RemoveWorkspaceMemberProps {
3779
+ workspaceId: string;
3780
+ targetUserId: string;
3781
+ }
3782
+ /**
3783
+ * Remove a member from this workspace. Requires the `remove-member` capability
3784
+ * and is rank-bounded. The workspace owner cannot be removed (409
3785
+ * `workspace/sole-owner`) — transfer ownership first. No `userId` body is sent;
3786
+ * the actor comes from the token.
3787
+ */
3788
+ declare function removeWorkspaceMember(client: SublayHttpClient, data: RemoveWorkspaceMemberProps): Promise<void>;
3789
+
3790
+ interface LeaveWorkspaceProps {
3791
+ workspaceId: string;
3792
+ }
3793
+ /**
3794
+ * The bearer-token user leaves this workspace — removes THEIR OWN direct
3795
+ * membership on THIS node only (owning a child is unaffected). An owner cannot
3796
+ * leave (409 `workspace/sole-owner`); transfer or delete first. No `userId` is
3797
+ * sent — the server derives the leaver from the token.
3798
+ */
3799
+ declare function leaveWorkspace(client: SublayHttpClient, data: LeaveWorkspaceProps): Promise<void>;
3800
+
3801
+ interface RemoveWorkspaceMemberFromSubtreeProps {
3802
+ workspaceId: string;
3803
+ targetUserId: string;
3804
+ }
3805
+ /**
3806
+ * Removes the target user's direct memberships on this workspace and every
3807
+ * descendant. Requires `remove-member` (rank-bounded per node). Blocks (409
3808
+ * `workspace/owns-descendants`) with a report if the user OWNS any descendant
3809
+ * workspace — transfer or delete those first. The actor comes from the token.
3810
+ *
3811
+ * A NON-owner's sweep can be PARTIAL: it stops at sealed sub-workspaces. Check
3812
+ * `skippedCount` / `skipped` before treating the user as fully offboarded.
3813
+ */
3814
+ declare function removeWorkspaceMemberFromSubtree(client: SublayHttpClient, data: RemoveWorkspaceMemberFromSubtreeProps): Promise<RemoveWorkspaceMemberFromSubtreeResponse>;
3815
+
3816
+ interface CreateWorkspaceInviteProps {
3459
3817
  workspaceId: string;
3460
3818
  email?: string;
3461
3819
  userId?: string;
@@ -3469,12 +3827,52 @@ interface CreateInviteProps {
3469
3827
  * Create an invitation (requires the `invite` capability on the workspace). The
3470
3828
  * inviter is the bearer-token user.
3471
3829
  */
3472
- declare function createInvite(client: SublayHttpClient, data: CreateInviteProps): Promise<WorkspaceInvitation>;
3830
+ declare function createWorkspaceInvite(client: SublayHttpClient, data: CreateWorkspaceInviteProps): Promise<WorkspaceInvitation>;
3831
+
3832
+ interface FetchWorkspaceInvitesProps {
3833
+ workspaceId: string;
3834
+ }
3835
+ interface FetchWorkspaceInvitesResponse {
3836
+ data: WorkspaceInvitation[];
3837
+ }
3838
+ /**
3839
+ * List a workspace's LIVE pending invites (`status='pending' AND expiresAt >
3840
+ * now`). Requires the `invite` capability (or owner). Always returned in full —
3841
+ * this list is deliberately unpaginated.
3842
+ *
3843
+ * This is the OUTBOX read — invites this workspace ISSUED. For the invites
3844
+ * addressed TO the caller, use `fetchMyWorkspaceInvites`.
3845
+ */
3846
+ declare function fetchWorkspaceInvites(client: SublayHttpClient, data: FetchWorkspaceInvitesProps): Promise<FetchWorkspaceInvitesResponse>;
3847
+
3848
+ interface RevokeWorkspaceInviteProps {
3849
+ workspaceId: string;
3850
+ inviteId: string;
3851
+ }
3852
+ interface RevokeWorkspaceInviteResponse {
3853
+ success: boolean;
3854
+ }
3855
+ /**
3856
+ * Revoke a pending invitation. Requires the `invite` capability (or owner).
3857
+ * Note the verb-suffixed POST route — this is not a `DELETE`.
3858
+ */
3859
+ declare function revokeWorkspaceInvite(client: SublayHttpClient, data: RevokeWorkspaceInviteProps): Promise<RevokeWorkspaceInviteResponse>;
3473
3860
 
3474
- interface AcceptInviteProps {
3861
+ interface ResendWorkspaceInviteProps {
3862
+ workspaceId: string;
3475
3863
  inviteId: string;
3476
3864
  }
3477
- interface AcceptInviteResponse {
3865
+ /**
3866
+ * Resend / refresh a pending invitation (valid on any `pending` invite, even one
3867
+ * past `expiresAt` — resets a 14-day expiry and resends the email). A terminal
3868
+ * invite (accepted/declined/revoked) → 409. Requires `invite` (or owner).
3869
+ */
3870
+ declare function resendWorkspaceInvite(client: SublayHttpClient, data: ResendWorkspaceInviteProps): Promise<WorkspaceInvitation>;
3871
+
3872
+ interface AcceptWorkspaceInviteProps {
3873
+ inviteId: string;
3874
+ }
3875
+ interface AcceptWorkspaceInviteResponse {
3478
3876
  success: boolean;
3479
3877
  workspaceId: string;
3480
3878
  }
@@ -3482,31 +3880,37 @@ interface AcceptInviteResponse {
3482
3880
  * Accept an invitation — identity-matched to the bearer-token user + verified
3483
3881
  * email required. Non-secret id. Idempotent when already a member/owner.
3484
3882
  */
3485
- declare function acceptInvite(client: SublayHttpClient, data: AcceptInviteProps): Promise<AcceptInviteResponse>;
3883
+ declare function acceptWorkspaceInvite(client: SublayHttpClient, data: AcceptWorkspaceInviteProps): Promise<AcceptWorkspaceInviteResponse>;
3486
3884
 
3487
- interface DeclineInviteProps {
3885
+ interface DeclineWorkspaceInviteProps {
3488
3886
  inviteId: string;
3489
3887
  }
3490
- interface DeclineInviteResponse {
3888
+ interface DeclineWorkspaceInviteResponse {
3491
3889
  success: boolean;
3492
3890
  }
3493
3891
  /**
3494
- * Decline an invitation — identity-matched to the bearer-token user (not
3495
- * verification-gated).
3892
+ * Decline an invitation — identity-matched to the bearer-token user, and
3893
+ * verified-email-gated (the same gate as accept, so an unverified squatter on
3894
+ * someone else's address cannot burn their invite). An unverified decline
3895
+ * returns `403 workspace/email-not-verified`.
3496
3896
  */
3497
- declare function declineInvite(client: SublayHttpClient, data: DeclineInviteProps): Promise<DeclineInviteResponse>;
3897
+ declare function declineWorkspaceInvite(client: SublayHttpClient, data: DeclineWorkspaceInviteProps): Promise<DeclineWorkspaceInviteResponse>;
3498
3898
 
3499
- interface FetchMyInvitesResponse {
3899
+ interface FetchMyWorkspaceInvitesResponse {
3500
3900
  data: WorkspaceInvitation[];
3501
3901
  }
3502
3902
  /**
3503
3903
  * The bearer-token user's LIVE pending invites (`status='pending' AND expiresAt
3504
3904
  * > now`), matched by `userId` from the token. Surfacing is NOT
3505
- * verification-gated (the verified check applies only at accept).
3905
+ * verification-gated (the verified check applies when the user ACTS on an
3906
+ * invite — accept or decline).
3907
+ *
3908
+ * This is the INBOX read — invites addressed TO the caller. For the invites a
3909
+ * workspace has ISSUED, use `fetchWorkspaceInvites`.
3506
3910
  */
3507
- declare function fetchMyInvites(client: SublayHttpClient): Promise<FetchMyInvitesResponse>;
3911
+ declare function fetchMyWorkspaceInvites(client: SublayHttpClient): Promise<FetchMyWorkspaceInvitesResponse>;
3508
3912
 
3509
- interface GetAuthorityProps {
3913
+ interface FetchWorkspaceAuthorityProps {
3510
3914
  workspaceId: string;
3511
3915
  }
3512
3916
  /**
@@ -3514,19 +3918,31 @@ interface GetAuthorityProps {
3514
3918
  * (`{ reasons, capabilities, permissions, rank }`) on the workspace. A
3515
3919
  * permission check is a one-line `.includes()` on the result.
3516
3920
  */
3517
- declare function getAuthority(client: SublayHttpClient, data: GetAuthorityProps): Promise<WorkspaceAuthority>;
3921
+ declare function fetchWorkspaceAuthority(client: SublayHttpClient, data: FetchWorkspaceAuthorityProps): Promise<WorkspaceAuthority>;
3518
3922
 
3519
- declare const Workspaces_acceptInvite: typeof acceptInvite;
3520
- declare const Workspaces_createInvite: typeof createInvite;
3923
+ declare const Workspaces_acceptWorkspaceInvite: typeof acceptWorkspaceInvite;
3521
3924
  declare const Workspaces_createWorkspace: typeof createWorkspace;
3522
- declare const Workspaces_declineInvite: typeof declineInvite;
3925
+ declare const Workspaces_createWorkspaceInvite: typeof createWorkspaceInvite;
3926
+ declare const Workspaces_declineWorkspaceInvite: typeof declineWorkspaceInvite;
3927
+ declare const Workspaces_deleteWorkspace: typeof deleteWorkspace;
3523
3928
  declare const Workspaces_fetchManyWorkspaces: typeof fetchManyWorkspaces;
3524
- declare const Workspaces_fetchMembers: typeof fetchMembers;
3525
- declare const Workspaces_fetchMyInvites: typeof fetchMyInvites;
3929
+ declare const Workspaces_fetchMyWorkspaceInvites: typeof fetchMyWorkspaceInvites;
3526
3930
  declare const Workspaces_fetchWorkspace: typeof fetchWorkspace;
3527
- declare const Workspaces_getAuthority: typeof getAuthority;
3931
+ declare const Workspaces_fetchWorkspaceAuthority: typeof fetchWorkspaceAuthority;
3932
+ declare const Workspaces_fetchWorkspaceInvites: typeof fetchWorkspaceInvites;
3933
+ declare const Workspaces_fetchWorkspaceMemberStanding: typeof fetchWorkspaceMemberStanding;
3934
+ declare const Workspaces_fetchWorkspaceMembers: typeof fetchWorkspaceMembers;
3935
+ declare const Workspaces_leaveWorkspace: typeof leaveWorkspace;
3936
+ declare const Workspaces_removeWorkspaceMember: typeof removeWorkspaceMember;
3937
+ declare const Workspaces_removeWorkspaceMemberFromSubtree: typeof removeWorkspaceMemberFromSubtree;
3938
+ declare const Workspaces_resendWorkspaceInvite: typeof resendWorkspaceInvite;
3939
+ declare const Workspaces_revokeWorkspaceInvite: typeof revokeWorkspaceInvite;
3940
+ declare const Workspaces_transferWorkspaceOwnership: typeof transferWorkspaceOwnership;
3941
+ declare const Workspaces_updateWorkspace: typeof updateWorkspace;
3942
+ declare const Workspaces_updateWorkspaceInheritFlag: typeof updateWorkspaceInheritFlag;
3943
+ declare const Workspaces_updateWorkspaceMember: typeof updateWorkspaceMember;
3528
3944
  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 };
3945
+ export { Workspaces_acceptWorkspaceInvite as acceptWorkspaceInvite, Workspaces_createWorkspace as createWorkspace, Workspaces_createWorkspaceInvite as createWorkspaceInvite, Workspaces_declineWorkspaceInvite as declineWorkspaceInvite, Workspaces_deleteWorkspace as deleteWorkspace, Workspaces_fetchManyWorkspaces as fetchManyWorkspaces, Workspaces_fetchMyWorkspaceInvites as fetchMyWorkspaceInvites, Workspaces_fetchWorkspace as fetchWorkspace, Workspaces_fetchWorkspaceAuthority as fetchWorkspaceAuthority, Workspaces_fetchWorkspaceInvites as fetchWorkspaceInvites, Workspaces_fetchWorkspaceMemberStanding as fetchWorkspaceMemberStanding, Workspaces_fetchWorkspaceMembers as fetchWorkspaceMembers, Workspaces_leaveWorkspace as leaveWorkspace, Workspaces_removeWorkspaceMember as removeWorkspaceMember, Workspaces_removeWorkspaceMemberFromSubtree as removeWorkspaceMemberFromSubtree, Workspaces_resendWorkspaceInvite as resendWorkspaceInvite, Workspaces_revokeWorkspaceInvite as revokeWorkspaceInvite, Workspaces_transferWorkspaceOwnership as transferWorkspaceOwnership, Workspaces_updateWorkspace as updateWorkspace, Workspaces_updateWorkspaceInheritFlag as updateWorkspaceInheritFlag, Workspaces_updateWorkspaceMember as updateWorkspaceMember };
3530
3946
  }
3531
3947
 
3532
3948
  /**
@@ -3626,4 +4042,4 @@ declare class SublayClient {
3626
4042
  clearTokens(): void;
3627
4043
  }
3628
4044
 
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 };
4045
+ 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 PushDeviceIdentifier, type PushEventType, type PushUnbindSkipReason, type RemoveWorkspaceMemberFromSubtreeResponse, type SignOutResult, type SkippedWorkspace, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UpdateNotificationPreferencesProps, type UserSearchParams, type WebPushSubscription, type Workspace, type WorkspaceAuthority, type WorkspaceAuthorityReason, type WorkspaceAuthorityReasonDetail, type WorkspaceCapability, type WorkspaceInvitation, type WorkspaceInvitationStatus, type WorkspaceMember, type WorkspaceMemberStanding, type WorkspaceRosterCountsResponse, type WorkspaceRosterEntry, type WorkspaceRosterReason, type WorkspaceRosterResponse, type WorkspaceStandingUser };