@sublay/js 7.8.0 → 7.9.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 CHANGED
@@ -190,7 +190,7 @@ declare function signIn(client: SublayHttpClient, data: SignInProps): Promise<Si
190
190
  * (server `src/constants/push/pushEvents.ts`); these are the only names a
191
191
  * `disabledTypes` set may contain.
192
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"];
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", "reputation-grant", "message"];
194
194
  type PushEventType = (typeof PUSH_EVENT_TYPES)[number];
195
195
  /**
196
196
  * The four conversation-mute duration choices. Send the CHOICE, never a raw
@@ -1021,6 +1021,91 @@ declare namespace Users {
1021
1021
  export { Users_checkUsernameAvailability as checkUsernameAvailability, Users_createBlock as createBlock, Users_createFollow as createFollow, Users_deleteBlock as deleteBlock, deleteFollow$1 as deleteFollow, Users_fetchBlockStatus as fetchBlockStatus, Users_fetchBlockedUsers as fetchBlockedUsers, Users_fetchConnectionStatus as fetchConnectionStatus, Users_fetchConnectionsByUserId as fetchConnectionsByUserId, Users_fetchConnectionsCountByUserId as fetchConnectionsCountByUserId, Users_fetchFollowStatus as fetchFollowStatus, Users_fetchFollowersByUserId as fetchFollowersByUserId, Users_fetchFollowersCountByUserId as fetchFollowersCountByUserId, Users_fetchFollowingByUserId as fetchFollowingByUserId, Users_fetchFollowingCountByUserId as fetchFollowingCountByUserId, Users_fetchUserByForeignId as fetchUserByForeignId, Users_fetchUserById as fetchUserById, Users_fetchUserByUsername as fetchUserByUsername, Users_fetchUserSuggestions as fetchUserSuggestions, Users_removeConnectionByUserId as removeConnectionByUserId, Users_requestConnection as requestConnection, Users_updateUser as updateUser };
1022
1022
  }
1023
1023
 
1024
+ /** The three grantable target kinds. Polymorphic — `targetId` carries no FK. */
1025
+ type ReputationGrantTargetType = "entity" | "comment" | "chat-message";
1026
+ /**
1027
+ * Who created the grant. `"user"` is a debited transfer (reputation moved out
1028
+ * of `senderId`'s bucket); `"app"` is a mint issued by the project itself with
1029
+ * a null `senderId`. Persisted rather than inferred from `senderId`, which is
1030
+ * also null for a transfer whose sender was later deleted.
1031
+ */
1032
+ type ReputationGrantSourceType = "user" | "app";
1033
+ /**
1034
+ * The "which item was rewarded" pair, as a both-or-neither union.
1035
+ *
1036
+ * Modelled as a two-branch union rather than two independent optional fields so
1037
+ * a half-filled target — `{ targetType }` with no `targetId`, or the reverse —
1038
+ * does not compile. The server answers that shape with
1039
+ * `400 reputation-grant/invalid-body` on the write (a shared
1040
+ * `bothOrNeitherTarget` refinement) and
1041
+ * `400 reputation-grant/invalid-filter` on the list, so the union turns a
1042
+ * guaranteed round trip into a red squiggle.
1043
+ *
1044
+ * The empty branch is `?: undefined`, NOT `?: null` — deliberately, and for the
1045
+ * same reason `metadata` is not nullable: `grantBodyFields.targetType` is
1046
+ * `.optional()` with no `.nullable()`, so an explicit `targetType: null` is
1047
+ * rejected. Omit both keys to mean "no target".
1048
+ *
1049
+ * Building the pair conditionally needs one accommodation: an inline
1050
+ * conditional spread of just these two keys widens both to `T | undefined` and
1051
+ * then matches neither branch. Either branch the whole argument, or name this
1052
+ * type on a helper and spread that:
1053
+ *
1054
+ * ```ts
1055
+ * const target: ReputationGrantTargetFilter = item
1056
+ * ? { targetType: "entity", targetId: item.id }
1057
+ * : {};
1058
+ * await listGrants(client, { ...base, ...target });
1059
+ * ```
1060
+ */
1061
+ type ReputationGrantTargetFilter = {
1062
+ /** The kind of item rewarded. Requires `targetId` alongside it. */
1063
+ targetType: ReputationGrantTargetType;
1064
+ /** The rewarded item's id. Requires `targetType` alongside it. */
1065
+ targetId: string;
1066
+ } | {
1067
+ targetType?: undefined;
1068
+ targetId?: undefined;
1069
+ };
1070
+ /**
1071
+ * Per-item reputation-grant summary. Covers positive grants only — negative
1072
+ * grants (app deductions) are invisible on every public read surface.
1073
+ */
1074
+ interface GrantSummary {
1075
+ /** Sum of positive grant amounts on the item. */
1076
+ total: number;
1077
+ /** Number of positive grants on the item. */
1078
+ count: number;
1079
+ /** The calling user's own summed positive grants on the item. */
1080
+ viewerTotal: number;
1081
+ }
1082
+ /**
1083
+ * A single reputation movement. Rows are append-only — nothing updates or
1084
+ * soft-deletes them — so the table is the audit log behind every balance.
1085
+ */
1086
+ interface ReputationGrant {
1087
+ id: string;
1088
+ sourceType: ReputationGrantSourceType;
1089
+ /** Null for an app mint, and for a transfer whose sender was deleted. */
1090
+ senderId: string | null;
1091
+ /** Populated when the list is called with `include: "user"`. */
1092
+ sender?: User | null;
1093
+ recipientId: string;
1094
+ /** Populated when the list is called with `include: "user"`. */
1095
+ recipient?: User | null;
1096
+ /** Non-zero. Negative only when `sourceType` is `"app"`. */
1097
+ amount: number;
1098
+ /** The bucket both legs moved in; null = the project-general bucket. */
1099
+ spaceId: string | null;
1100
+ /** Both null or both non-null. */
1101
+ targetType: ReputationGrantTargetType | null;
1102
+ targetId: string | null;
1103
+ note: string | null;
1104
+ metadata: Record<string, any> | null;
1105
+ createdAt: string;
1106
+ updatedAt: string;
1107
+ }
1108
+
1024
1109
  type Mention = UserMention | SpaceMention;
1025
1110
  interface UserMention {
1026
1111
  type: "user";
@@ -1226,6 +1311,13 @@ interface Entity {
1226
1311
  nsfwEffective: boolean;
1227
1312
  topComment: TopComment | null;
1228
1313
  isSaved?: boolean;
1314
+ /**
1315
+ * Reputation-grant summary. Opt-in — present exactly when the read requested
1316
+ * `include=grants`. Once requested the server always returns the object,
1317
+ * zero-filled rather than omitted, on projects with no grants and on projects
1318
+ * without the reputation bundle alike.
1319
+ */
1320
+ grants?: GrantSummary;
1229
1321
  isDraft: boolean | null;
1230
1322
  moderationStatus: "approved" | "removed" | null;
1231
1323
  moderatedAt: string | null;
@@ -1757,6 +1849,13 @@ interface Comment {
1757
1849
  reactionCounts: ReactionCounts;
1758
1850
  userReaction?: ReactionType | null;
1759
1851
  repliesCount: number;
1852
+ /**
1853
+ * Reputation-grant summary. Opt-in — present exactly when the read requested
1854
+ * `include=grants`. Once requested the server always returns the object,
1855
+ * zero-filled rather than omitted, on projects with no grants and on projects
1856
+ * without the reputation bundle alike.
1857
+ */
1858
+ grants?: GrantSummary;
1760
1859
  metadata: Record<string, any>;
1761
1860
  createdAt: string;
1762
1861
  updatedAt: string;
@@ -2241,6 +2340,13 @@ interface ChatMessage {
2241
2340
  threadReplyCount: number;
2242
2341
  reactionCounts: Record<string, number>;
2243
2342
  userReactions: string[];
2343
+ /**
2344
+ * Reputation-grant summary. Opt-in — present exactly when the read requested
2345
+ * `include=grants`. Once requested the server always returns the object,
2346
+ * zero-filled rather than omitted, on projects with no grants and on projects
2347
+ * without the reputation bundle alike.
2348
+ */
2349
+ grants?: GrantSummary;
2244
2350
  editedAt: string | null;
2245
2351
  userDeletedAt: string | null;
2246
2352
  moderationStatus: "approved" | "removed" | null;
@@ -2871,6 +2977,96 @@ declare namespace Reports {
2871
2977
  export { Reports_createReport as createReport, Reports_fetchModeratedReports as fetchModeratedReports };
2872
2978
  }
2873
2979
 
2980
+ interface CreateGrantBaseProps {
2981
+ /** The user receiving the reputation. Cannot be the logged-in user. */
2982
+ recipientId: string;
2983
+ /**
2984
+ * Positive integer. A user transfer can never mint (negatives) nor be a
2985
+ * no-op (zero) — minting is service-key-only and lives in `@sublay/node`.
2986
+ */
2987
+ amount: number;
2988
+ /** The bucket both legs move in. Omitted/null = the project-general bucket. */
2989
+ spaceId?: string | null;
2990
+ /**
2991
+ * Free-text reason. Trimmed and capped at 2000 characters server-side.
2992
+ * Genuinely nullable — an explicit `null` is accepted and means "no note".
2993
+ */
2994
+ note?: string | null;
2995
+ /**
2996
+ * Arbitrary JSON, capped at 1 MB server-side.
2997
+ *
2998
+ * NOT nullable — deliberately asymmetric with `note` directly above, not a
2999
+ * typo. The server's shared `metadataSchema` is `z.record(...).optional()`
3000
+ * with no `.nullable()`, so an explicit `metadata: null` is rejected with
3001
+ * `400 reputation-grant/invalid-body`. Omit the key to mean "no metadata".
3002
+ */
3003
+ metadata?: Record<string, any>;
3004
+ }
3005
+ /**
3006
+ * `targetType` and `targetId` are supplied together or not at all — the
3007
+ * both-or-neither pair is carried by {@link ReputationGrantTargetFilter}, which
3008
+ * makes the half-filled shape a compile error instead of a
3009
+ * `400 reputation-grant/invalid-body`.
3010
+ */
3011
+ type CreateGrantProps = CreateGrantBaseProps & ReputationGrantTargetFilter;
3012
+ /**
3013
+ * Transfers reputation from the logged-in user to another user — a **debited
3014
+ * transfer**: the amount leaves the sender's bucket and lands in the
3015
+ * recipient's bucket in the same space. Nothing is created.
3016
+ *
3017
+ * There is no actor field: the sender is always the user the token belongs to.
3018
+ * Naming somebody else as the sender requires a service key, which this SDK
3019
+ * never holds.
3020
+ */
3021
+ declare function createGrant(client: SublayHttpClient, data: CreateGrantProps): Promise<ReputationGrant>;
3022
+
3023
+ interface ListGrantsBaseProps extends SpaceReputationContextParams {
3024
+ page?: number;
3025
+ limit?: number;
3026
+ /** What this user received. */
3027
+ recipientId?: string;
3028
+ /** What this user sent. */
3029
+ senderId?: string;
3030
+ /** Associations to expand. Only `"user"` is supported (hydrates both parties). */
3031
+ include?: string;
3032
+ }
3033
+ /**
3034
+ * The third filter shape — "who rewarded this item" — is the
3035
+ * {@link ReputationGrantTargetFilter} pair, so a half-filled target is a
3036
+ * compile error rather than a `400 reputation-grant/invalid-filter`.
3037
+ *
3038
+ * Mutual exclusivity between the three shapes is NOT expressed in the type: a
3039
+ * three-way exclusive union would multiply out across every pagination and
3040
+ * space-reputation field and make the props unreadable, for a rule the server
3041
+ * reports clearly. Only the both-or-neither pairing is typed.
3042
+ */
3043
+ type ListGrantsProps = ListGrantsBaseProps & ReputationGrantTargetFilter;
3044
+ /**
3045
+ * The `summary` block rides alongside the page envelope, and only on the
3046
+ * target filter shape.
3047
+ */
3048
+ interface ListGrantsResponse extends PaginatedResponse<ReputationGrant> {
3049
+ summary?: GrantSummary;
3050
+ }
3051
+ /**
3052
+ * Lists reputation grants.
3053
+ *
3054
+ * Exactly one filter shape per request — `recipientId`, `senderId`, or
3055
+ * `targetType` + `targetId`. Supplying none or combining two is a `400`; the
3056
+ * shapes are not AND-ed, which is what keeps the `summary` block reconcilable
3057
+ * with the rows beneath it.
3058
+ *
3059
+ * Only positive grants are ever returned. Negative grants are app moderation
3060
+ * deductions and are unreadable from every public surface.
3061
+ */
3062
+ declare function listGrants(client: SublayHttpClient, data: ListGrantsProps): Promise<ListGrantsResponse>;
3063
+
3064
+ declare const Reputation_createGrant: typeof createGrant;
3065
+ declare const Reputation_listGrants: typeof listGrants;
3066
+ declare namespace Reputation {
3067
+ export { Reputation_createGrant as createGrant, Reputation_listGrants as listGrants };
3068
+ }
3069
+
2874
3070
  interface SearchContentProps extends SpaceReputationContextParams {
2875
3071
  query: string;
2876
3072
  sourceTypes?: ("entity" | "comment" | "message")[];
@@ -3323,7 +3519,11 @@ interface ListMessagesProps extends SpaceReputationContextParams {
3323
3519
  /** Page size (default 50, max 100). */
3324
3520
  limit?: number;
3325
3521
  sort?: "asc" | "desc";
3326
- /** Comma-separated associations to populate, e.g. "files". */
3522
+ /**
3523
+ * Comma-separated associations to populate: `"files"` (message
3524
+ * attachments) and `"grants"` (the reputation-grant summary). Combine
3525
+ * them as `"files,grants"` — the server splits and trims this itself.
3526
+ */
3327
3527
  include?: string;
3328
3528
  /** Optional filters, e.g. `{ hasReplies: true }`. */
3329
3529
  filters?: MessageFilters;
@@ -3363,6 +3563,11 @@ declare function sendMessage(client: SublayHttpClient, data: SendMessageProps):
3363
3563
  interface GetMessageProps extends SpaceReputationContextParams {
3364
3564
  conversationId: string;
3365
3565
  messageId: string;
3566
+ /**
3567
+ * Comma-separated associations to populate. Only `"grants"` is supported
3568
+ * here — it attaches the message's reputation-grant summary.
3569
+ */
3570
+ include?: string;
3366
3571
  }
3367
3572
  declare function getMessage(client: SublayHttpClient, data: GetMessageProps): Promise<ChatMessage>;
3368
3573
 
@@ -3572,6 +3777,29 @@ interface WorkspaceInvitation {
3572
3777
  interface WorkspaceRosterReason {
3573
3778
  type: "owner" | "member" | "ancestor-owner" | "reach-holder" | "descendant-member";
3574
3779
  rank?: number;
3780
+ /**
3781
+ * The SAME ladder position, expressed as an offset from the CALLER: `1` = one
3782
+ * rung below you, `0` = your peer, `-3` = three rungs above you. The caller's
3783
+ * own anchor is their member row on this workspace if they hold one, and apex
3784
+ * (one step above rank 0) if they do not — so a rank-0 member reads back as
3785
+ * `relativeRank: 1` for an owner.
3786
+ *
3787
+ * Authority-bearing and fenced WITH `rank`, never beside it: it is `rank`
3788
+ * minus a number the caller already knows, so leaking it leaks `rank` exactly.
3789
+ *
3790
+ * Present on same-node `member` reasons only. `descendant-member` entries
3791
+ * carry `rank` but NEVER `relativeRank` — rank is per-workspace, so an offset
3792
+ * measured against your standing on THIS node would be arithmetic across two
3793
+ * different ladders. Use their absolute `rank` there.
3794
+ *
3795
+ * Note the deliberate asymmetry with the fence described above: the FENCE is
3796
+ * per node (a descendant row may or may not carry `rank` depending on your
3797
+ * standing there), but PRESENCE of `relativeRank` is not — it is absent on
3798
+ * every `descendant-member` row, unconditionally, however much authority you
3799
+ * hold. A field that appears and disappears by who is asking is worse to
3800
+ * consume than one that is uniformly absent.
3801
+ */
3802
+ relativeRank?: number;
3575
3803
  capabilities?: WorkspaceCapability[];
3576
3804
  permissions?: string[];
3577
3805
  title?: string | null;
@@ -3611,6 +3839,13 @@ interface WorkspaceMemberStanding {
3611
3839
  capabilities?: WorkspaceCapability[];
3612
3840
  permissions?: string[];
3613
3841
  rank?: number | null;
3842
+ /**
3843
+ * `rank` expressed as an offset from the CALLER (negative = senior to you).
3844
+ * `null` exactly when `rank` is `null` — a target with no direct member row
3845
+ * here sits outside the ladder and has no position to measure. Fenced with
3846
+ * `rank`: absent (not null) for a caller who may not see it.
3847
+ */
3848
+ relativeRank?: number | null;
3614
3849
  title: string | null;
3615
3850
  metadata: Record<string, any>;
3616
3851
  }
@@ -3683,7 +3918,11 @@ interface FetchManyWorkspacesProps {
3683
3918
  }
3684
3919
  /**
3685
3920
  * List the bearer-token user's direct-membership + owned workspaces. The actor
3686
- * is derived from the token — no `userId` is sent.
3921
+ * is derived from the token — no actor field is sent.
3922
+ *
3923
+ * ⚠️ Only the fields declared above are accepted. The workspaces endpoints
3924
+ * refuse any undeclared top-level field with a 400 rather than ignoring it, so
3925
+ * do not spread an unrelated object into `data`.
3687
3926
  */
3688
3927
  declare function fetchManyWorkspaces(client: SublayHttpClient, data?: FetchManyWorkspacesProps): Promise<PaginatedResponse<Workspace>>;
3689
3928
 
@@ -3694,7 +3933,7 @@ interface UpdateWorkspaceProps {
3694
3933
  }
3695
3934
  /**
3696
3935
  * 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.
3936
+ * (or ownership). The actor is the bearer-token user — no actor field is sent.
3698
3937
  */
3699
3938
  declare function updateWorkspace(client: SublayHttpClient, data: UpdateWorkspaceProps): Promise<Workspace>;
3700
3939
 
@@ -3706,7 +3945,7 @@ interface UpdateWorkspaceInheritFlagProps {
3706
3945
  * Flip whether capabilities held on an ancestor "reach" into this workspace.
3707
3946
  * Owner-only in both directions (own owner or an ancestor owner), and blocked
3708
3947
  * (403 `workspace/inherit-enforced`) when the project enforces its default.
3709
- * The actor is the bearer-token user — no `userId` is sent.
3948
+ * The actor is the bearer-token user — no actor field is sent.
3710
3949
  */
3711
3950
  declare function updateWorkspaceInheritFlag(client: SublayHttpClient, data: UpdateWorkspaceInheritFlagProps): Promise<Workspace>;
3712
3951
 
@@ -3718,8 +3957,8 @@ interface DeleteWorkspaceResponse {
3718
3957
  }
3719
3958
  /**
3720
3959
  * 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.
3960
+ * subtree transactionally. The actor is the bearer-token user — no actor
3961
+ * field is sent.
3723
3962
  */
3724
3963
  declare function deleteWorkspace(client: SublayHttpClient, data: DeleteWorkspaceProps): Promise<DeleteWorkspaceResponse>;
3725
3964
 
@@ -3732,7 +3971,7 @@ interface TransferWorkspaceOwnershipProps {
3732
3971
  }
3733
3972
  /**
3734
3973
  * 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;
3974
+ * owner). The actor is the bearer-token user — no actor field is sent;
3736
3975
  * `newOwnerId` addresses the TARGET, not the actor.
3737
3976
  */
3738
3977
  declare function transferWorkspaceOwnership(client: SublayHttpClient, data: TransferWorkspaceOwnershipProps): Promise<Workspace>;
@@ -3746,6 +3985,11 @@ interface FetchWorkspaceMembersProps {
3746
3985
  * Unified roster read — one entry per distinct user, each with a `reasons`
3747
3986
  * array. Always returned in full (never paginated). With `countOnly=true` the
3748
3987
  * shape is `WorkspaceRosterCountsResponse` instead. Actor from the token.
3988
+ *
3989
+ * Same-node `member` reasons carry both rank coordinates: absolute `rank` and
3990
+ * `relativeRank`, the offset from you (`1` = one rung below you, `-3` = three
3991
+ * above). Both are fenced together and both are absent for a caller who does
3992
+ * not operate people here. `descendant-member` reasons carry `rank` only.
3749
3993
  */
3750
3994
  declare function fetchWorkspaceMembers(client: SublayHttpClient, data: FetchWorkspaceMembersProps): Promise<WorkspaceRosterResponse | WorkspaceRosterCountsResponse>;
3751
3995
 
@@ -3755,7 +3999,11 @@ interface FetchWorkspaceMemberStandingProps {
3755
3999
  }
3756
4000
  /**
3757
4001
  * Read one user's resolved standing on a workspace (`reasons`, `capabilities`,
3758
- * `permissions`, `rank`, `title`, `metadata`).
4002
+ * `permissions`, `rank`, `relativeRank`, `title`, `metadata`).
4003
+ *
4004
+ * `relativeRank` is the target's `rank` as an offset from YOU (negative =
4005
+ * senior to you), and is fenced with `rank`: both are absent, not null, for a
4006
+ * caller who may not see the target's authority.
3759
4007
  */
3760
4008
  declare function fetchWorkspaceMemberStanding(client: SublayHttpClient, data: FetchWorkspaceMemberStandingProps): Promise<WorkspaceMemberStanding>;
3761
4009
 
@@ -3765,13 +4013,31 @@ interface UpdateWorkspaceMemberProps {
3765
4013
  capabilities?: WorkspaceCapability[];
3766
4014
  permissions?: string[];
3767
4015
  rank?: number;
4016
+ /**
4017
+ * `rank`'s relative twin: an offset from the ACTOR (`1` = one rung below me),
4018
+ * resolved to an absolute rank at write time and stored absolute. Must be
4019
+ * `>= 1`; mutually exclusive with `rank` (sending both is a 400). Both rank fields are also capped at `2147483647` (int4), and the RESOLVED sum is bounded too — an in-range anchor plus an in-range offset can still overflow, which is a 400 rather than a 500.
4020
+ *
4021
+ * The anchor is the actor's own rank if they hold a member row on this
4022
+ * workspace, apex otherwise. A SNAPSHOT — frozen at write time, it does not
4023
+ * follow the actor's own rank afterwards.
4024
+ *
4025
+ * Unlike invite, edit has NO default: omitting BOTH still means "rank
4026
+ * unchanged", so editing someone's capabilities never moves them on the
4027
+ * ladder.
4028
+ */
4029
+ relativeRank?: number;
3768
4030
  title?: string | null;
3769
4031
  metadata?: Record<string, any>;
3770
4032
  }
3771
4033
  /**
3772
4034
  * Edit a member's grant / profile. Powerful fields need `edit-member-access`
3773
4035
  * plus rank + no-escalation rules; cosmetic fields need only
3774
- * `edit-member-profile`. No `userId` is sent — the actor comes from the token.
4036
+ * `edit-member-profile`. No actor field is sent — the actor comes from the token.
4037
+ *
4038
+ * Rank moves in either coordinate — `rank` (absolute) or `relativeRank` (an
4039
+ * offset from the actor) — never both. Omitting both leaves rank UNCHANGED;
4040
+ * unlike invite, edit has no value default.
3775
4041
  */
3776
4042
  declare function updateWorkspaceMember(client: SublayHttpClient, data: UpdateWorkspaceMemberProps): Promise<WorkspaceMember>;
3777
4043
 
@@ -3782,7 +4048,7 @@ interface RemoveWorkspaceMemberProps {
3782
4048
  /**
3783
4049
  * Remove a member from this workspace. Requires the `remove-member` capability
3784
4050
  * and is rank-bounded. The workspace owner cannot be removed (409
3785
- * `workspace/sole-owner`) — transfer ownership first. No `userId` body is sent;
4051
+ * `workspace/sole-owner`) — transfer ownership first. No actor field is sent;
3786
4052
  * the actor comes from the token.
3787
4053
  */
3788
4054
  declare function removeWorkspaceMember(client: SublayHttpClient, data: RemoveWorkspaceMemberProps): Promise<void>;
@@ -3793,8 +4059,9 @@ interface LeaveWorkspaceProps {
3793
4059
  /**
3794
4060
  * The bearer-token user leaves this workspace — removes THEIR OWN direct
3795
4061
  * 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.
4062
+ * leave (409 `workspace/sole-owner`) — transfer ownership or remove the
4063
+ * workspace first. No actor field is sent; the server derives the leaver from
4064
+ * the token.
3798
4065
  */
3799
4066
  declare function leaveWorkspace(client: SublayHttpClient, data: LeaveWorkspaceProps): Promise<void>;
3800
4067
 
@@ -3820,12 +4087,61 @@ interface CreateWorkspaceInviteProps {
3820
4087
  username?: string;
3821
4088
  capabilities?: WorkspaceCapability[];
3822
4089
  permissions?: string[];
3823
- rank: number;
4090
+ /**
4091
+ * The invited rank, ABSOLUTE — a position on this workspace's ladder (smaller
4092
+ * = more senior). The escape hatch, and what tier-constant apps want, since
4093
+ * they compute the number anyway.
4094
+ *
4095
+ * Optional, and mutually exclusive with `relativeRank` — sending both is a
4096
+ * 400. Sending NEITHER defaults to `relativeRank: 1`, one rung below the
4097
+ * inviter, which is well defined for every actor and can never fail the rank
4098
+ * floor.
4099
+ *
4100
+ * ⚠️ That default is for a NEW invitation. Re-inviting a target who already
4101
+ * has a live pending invite updates it in place, and there omitting both rank
4102
+ * fields PRESERVES the stored rank instead of re-defaulting it. See the
4103
+ * function doc below.
4104
+ */
4105
+ rank?: number;
4106
+ /**
4107
+ * The invited rank, RELATIVE to the inviter: `1` = one rung below me, `2` =
4108
+ * two rungs below, and so on. The documented happy path — every governance
4109
+ * rule about rank is relative, so this is what callers usually mean.
4110
+ *
4111
+ * Must be `>= 1` on a write. `0` would mean "a peer", which the assign rule
4112
+ * forbids (you cannot clone your own authority), and a negative offset would
4113
+ * mint someone senior to you; both are a 400. Both rank fields are also capped at `2147483647` (int4), and the RESOLVED sum is bounded too — an in-range anchor plus an in-range offset can still overflow, which is a 400 rather than a 500.
4114
+ *
4115
+ * The anchor is the inviter's OWN rank if they hold a member row on this
4116
+ * workspace, and apex (one step above rank 0) if they do not — so an owner's
4117
+ * `relativeRank: 1` lands on rank 0, while a rank-3 member's lands on rank 4.
4118
+ *
4119
+ * ⚠️ A SNAPSHOT, not a live link: the offset is resolved to an absolute rank
4120
+ * once, at invite time, and frozen. It does not track the inviter's later
4121
+ * promotions or demotions.
4122
+ */
4123
+ relativeRank?: number;
3824
4124
  title?: string | null;
3825
4125
  }
3826
4126
  /**
3827
4127
  * Create an invitation (requires the `invite` capability on the workspace). The
3828
4128
  * inviter is the bearer-token user.
4129
+ *
4130
+ * The invited rank comes in either coordinate — `rank` (absolute) or
4131
+ * `relativeRank` (an offset from the inviter) — never both. Omitting both
4132
+ * defaults to `relativeRank: 1`, one rung below the inviter, which is the
4133
+ * documented happy path and can never fail the rank floor.
4134
+ *
4135
+ * ⚠️ This route doubles as an UPSERT, and the default above applies only to a
4136
+ * NEW invitation. Re-inviting a target who already holds a live pending invite
4137
+ * refreshes THAT invitation in place — same id, expiry reset — and on that
4138
+ * branch an omitted grant field is PRESERVED, not re-defaulted or blanked:
4139
+ * `rank`, `capabilities`, `permissions` and `title` all keep their stored
4140
+ * values. A "Resend invitation" button that posts only the address therefore
4141
+ * cannot silently re-rank the invitee to one below whoever clicked it. An
4142
+ * explicit value still overwrites, and an explicit `relativeRank` re-resolves
4143
+ * against the CURRENT caller. Full semantics:
4144
+ * https://docs.sublay.io/api-reference/workspaces/invitations/create-invite
3829
4145
  */
3830
4146
  declare function createWorkspaceInvite(client: SublayHttpClient, data: CreateWorkspaceInviteProps): Promise<WorkspaceInvitation>;
3831
4147
 
@@ -3917,6 +4233,11 @@ interface FetchWorkspaceAuthorityProps {
3917
4233
  * Authority-as-a-service read — the bearer-token user's resolved standing
3918
4234
  * (`{ reasons, capabilities, permissions, rank }`) on the workspace. A
3919
4235
  * permission check is a one-line `.includes()` on the result.
4236
+ *
4237
+ * ⚠️ No `relativeRank` on this read. It is an offset from the caller, and here
4238
+ * the caller IS the subject — so it could only ever be `0`. `rank` is the only
4239
+ * rank coordinate this endpoint exposes. `relativeRank` is meaningful on the
4240
+ * roster and member-standing reads, where the subject is somebody else.
3920
4241
  */
3921
4242
  declare function fetchWorkspaceAuthority(client: SublayHttpClient, data: FetchWorkspaceAuthorityProps): Promise<WorkspaceAuthority>;
3922
4243
 
@@ -4022,6 +4343,7 @@ declare class SublayClient {
4022
4343
  connections: BoundModule<typeof Connections>;
4023
4344
  appNotifications: BoundModule<typeof AppNotifications>;
4024
4345
  reports: BoundModule<typeof Reports>;
4346
+ reputation: BoundModule<typeof Reputation>;
4025
4347
  search: BoundModule<typeof Search>;
4026
4348
  storage: BoundModule<typeof Storage>;
4027
4349
  oauth: BoundModule<typeof OAuth>;
@@ -4042,4 +4364,4 @@ declare class SublayClient {
4042
4364
  clearTokens(): void;
4043
4365
  }
4044
4366
 
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 };
4367
+ export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type CreateGrantProps, type DbFilter, type DbFilterOperator, type DeleteResult, type GrantSummary, type ListGrantsProps, type ListGrantsResponse, 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 ReputationGrant, type ReputationGrantSourceType, type ReputationGrantTargetFilter, type ReputationGrantTargetType, 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 };
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ import * as Follows from "./modules/follows";
10
10
  import * as Connections from "./modules/connections";
11
11
  import * as AppNotifications from "./modules/app-notifications";
12
12
  import * as Reports from "./modules/reports";
13
+ import * as Reputation from "./modules/reputation";
13
14
  import * as Search from "./modules/search";
14
15
  import * as Storage from "./modules/storage";
15
16
  import * as OAuth from "./modules/oauth";
@@ -33,6 +34,7 @@ export declare class SublayClient {
33
34
  connections: BoundModule<typeof Connections>;
34
35
  appNotifications: BoundModule<typeof AppNotifications>;
35
36
  reports: BoundModule<typeof Reports>;
37
+ reputation: BoundModule<typeof Reputation>;
36
38
  search: BoundModule<typeof Search>;
37
39
  storage: BoundModule<typeof Storage>;
38
40
  oauth: BoundModule<typeof OAuth>;
@@ -56,6 +58,9 @@ export type { ClientConfig, AuthTokens } from "./core/client";
56
58
  export type { PaginatedResponse, PaginationMetadata, } from "./interfaces/IPaginatedResponse";
57
59
  export type { SpaceReputationContextParams, SpaceReputationUserParams, } from "./interfaces/SpaceReputation";
58
60
  export type { UserSearchParams } from "./interfaces/UserSearch";
61
+ export type { ReputationGrant, ReputationGrantSourceType, ReputationGrantTargetType, ReputationGrantTargetFilter, GrantSummary, } from "./interfaces/ReputationGrant";
62
+ export type { CreateGrantProps } from "./modules/reputation/createGrant";
63
+ export type { ListGrantsProps, ListGrantsResponse, } from "./modules/reputation/listGrants";
59
64
  export type { Workspace, WorkspaceMember, WorkspaceInvitation, WorkspaceCapability, WorkspaceInvitationStatus, WorkspaceAuthorityReason, WorkspaceAuthorityReasonDetail, WorkspaceRosterReason, WorkspaceRosterEntry, WorkspaceRosterResponse, WorkspaceRosterCountsResponse, WorkspaceStandingUser, WorkspaceMemberStanding, WorkspaceAuthority, RemoveWorkspaceMemberFromSubtreeResponse, SkippedWorkspace, } from "./interfaces/Workspace";
60
65
  export { PUSH_EVENT_TYPES, MUTE_DURATIONS } from "./interfaces/Push";
61
66
  export type { PushEventType, MuteDuration, NotificationPreferences, PushDeviceIdentifier, WebPushSubscription, } from "./interfaces/Push";