Skip to content

Commit 31e7542

Browse files
docs(client): README approval decisions are objects, and register carries its required name (#16926)
The published README's namespace tour called `approvals.approve` / `approvals.reject` with a bare comment string. Both declare `(requestId: string, decision?: { actorId?; comment?; attachments? })`, so a TypeScript reader gets TS2559 and a JavaScript reader gets nothing at all — the string goes out as the request body where the route reads the decision object's fields, and the approval's reason is silently dropped. Type-checking the whole fence against the package's own built `dist/index.d.ts` turned up one more call in the same defect class: `auth.register` was passed `{ email, password }` while `RegisterRequestSchema` declares `name` as required, failing TS2345. All three now match the spelling `content/docs/api/client-sdk.mdx` already carries. No source changes; `packages/client/src/index.ts` was read only. Claude-Session: https://claude.ai/code/session_015QE8qk46e5CHJxyQEUjbf8 Co-authored-by: Claude <noreply@anthropic.com>
1 parent aae8843 commit 31e7542

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@objectstack/client": patch
3+
---
4+
5+
The README's namespace tour calls `approvals.approve` / `approvals.reject` with the decision object they declare, and `auth.register` with the field its schema requires.
6+
7+
`approve` and `reject` take `(requestId: string, decision?: { actorId?: string; comment?: string; attachments?: string[] })`. The tour passed the comment as a bare string — `approve(requestId, 'LGTM')` — which a TypeScript reader hits as `TS2559` and a JavaScript reader does not hit at all: the string goes out as the request body where the route reads the decision object's fields, so the approval is recorded and its **reason is silently dropped**. In an approvals surface a lost reason is not a typo. The calls now read `{ comment: 'LGTM' }` / `{ comment: 'Incomplete' }`, the spelling the docs site's Client SDK page already carried.
8+
9+
Type-checking the whole fence against the package's own built `dist/index.d.ts` found one more call in the same defect class — a live method given the wrong argument shape. `auth.register` takes `RegisterRequest`, whose schema declares `name: z.string()` as required (and pins the rejection of a request without it); the tour passed only `{ email, password }`, failing `TS2345`. It now passes `name` as well, again matching the Client SDK page. All 35 calls in the fence type-check clean against the built declarations after this change.
10+
11+
No behaviour changes and no source change: this is the README, and `files` ships `README.md` inside the tarball, so correcting it moves what `@objectstack/client` publishes — it is the package's npm front page.

packages/client/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ await client.data.batch('contact', batchRequest);
237237

238238
// Authentication
239239
await client.auth.login({ email: 'user@example.com', password: 'pass' });
240-
await client.auth.register({ email: 'new@example.com', password: 'pass' });
240+
await client.auth.register({ email: 'new@example.com', password: 'pass', name: 'New User' });
241241
await client.auth.me();
242242
await client.auth.logout();
243243
await client.auth.refreshToken('refresh-token-string');
@@ -252,8 +252,8 @@ await client.packages.install({
252252
await client.packages.enable('plugin-id');
253253

254254
// Approvals (approval is a flow node — decisions are keyed by request id)
255-
await client.approvals.approve(requestId, 'LGTM');
256-
await client.approvals.reject(requestId, 'Incomplete');
255+
await client.approvals.approve(requestId, { comment: 'LGTM' });
256+
await client.approvals.reject(requestId, { comment: 'Incomplete' });
257257

258258
// Notifications
259259
await client.notifications.list({ read: false }); // unread only

0 commit comments

Comments
 (0)