Commit 7092d63
fix(client)!: bind the organizations.* family to the wire shapes better-auth sends (#16576)
* fix(client)!: bind the organizations.* family to the wire shapes better-auth sends
Nineteen methods of the organizations.* namespace ended `return res.json()`
with no return annotation, so lib.dom's `Response.json(): Promise<any>` was
their published type. Each now declares the shape its route actually serves,
and its exported-any-returns.json entry is deleted in the same change — as is
the entry for organizations.invitations.resend, which carries no annotation of
its own and inherits invite's (22 entries before, 2 after):
organizations.create -> OrganizationCreateResult
organizations.update -> OrganizationEchoWire
organizations.setActive -> OrganizationWire | null
organizations.get -> OrganizationFullWire | null
organizations.listMembers -> OrganizationMembersPage
organizations.invite -> OrganizationInvitationWire<'pending'>
organizations.leave -> OrganizationMemberWithUserWire
organizations.delete -> OrganizationWire
organizations.removeMember -> OrganizationRemoveMemberResult
organizations.updateMemberRole -> OrganizationMemberWire
organizations.getActiveMember -> OrganizationMemberWithUserWire
organizations.invitations.cancel -> OrganizationInvitationWire<'canceled'>
organizations.invitations.accept -> OrganizationInvitationAcceptResult
organizations.invitations.reject -> OrganizationInvitationRejectResult
organizations.teams.create/update -> OrganizationTeamWire
organizations.teams.delete -> OrganizationTeamRemovedReceipt
organizations.teams.addMember -> OrganizationTeamMemberWire
organizations.teams.removeMember -> OrganizationTeamMemberRemovedReceipt
The shapes were read off the wire against a real server, not off
better-auth's own .d.ts: a real AuthManager (better-auth 1.7.2, organization
plugin, teams enabled) over a real SqlDriver (better-sqlite3), driven raw and
again through the real ObjectStackClient with only the socket stood in for,
plus an in-memory-engine leg for absent-vs-null. Four times the vendor's
declaration was the wrong answer: delete answers the organization row, not the
id string its OpenAPI stub declares; updateMemberRole answers the member bare,
not `{ member }`; metadata is decoded on create/update only and is the stored
JSON text on every read route; removeMember joins `user` only on the by-email
path.
Timestamps are ISO-8601 strings, never Date and never revived (maintainer
ruling on the family card): the adapter runs `supportsDates: false` and
JSON.stringify puts the ISO string back on the wire.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YFY46JydE1gMxQG1TqBcMZ
* chore(changeset): name only the type-surface-only refs the ADR-0087 dotted walker can resolve
Five direct members of organizations (create, update, listMembers, delete,
removeMember) share a name with a member of a nested literal, and the gate's
walker counts nested same-named definitions inside the region, so those five
have no resolvable spelling; they are stated in the marker's prose with the
issue that records the walker limitation.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YFY46JydE1gMxQG1TqBcMZ
* fix(client): correct two claims in the organizations.* binding — a compile-block line and the teams updatedAt guarantee
The changeset's 'reads that stop compiling' block carried one line that
does not compile: JSON.parse on the read-route metadata, whose declared type
is string | null | undefined (TS2345). It now guards the value first, which
is the honest spelling of 'the caller's step'.
OrganizationTeamWire's JSDoc claimed teams.create and teams.update both set
updatedAt explicitly. The vendor's update-team handler writes no timestamp;
the value on the wire comes from better-auth's team schema, whose updatedAt
declares an onUpdate default the adapter applies on every update of the
model, with the platform's own sys_team.updated_at stamping behind it.
Measured on a real SQL driver and on an engine with no platform stamping in
the loop: update-team on the vendor-minted default team answered a fresh
updatedAt on both. The type is unchanged; only the sentence moved. The
sibling OrganizationFullTeamWire's JSDoc no longer presents a hand-rolled
test fake's absent key as a measured store behaviour.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YFY46JydE1gMxQG1TqBcMZ
---------
Co-authored-by: os-sales <sales@objectstack.ai>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent b4abb0a commit 7092d63
4 files changed
Lines changed: 518 additions & 41 deletions
File tree
- .changeset
- packages/client
- src
Lines changed: 88 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 5 | | |
26 | 6 | | |
27 | 7 | | |
0 commit comments