From aaff32ce65d855cb9e1111c5904158bb6d9f43e9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 8 Sep 2026 16:47:42 +0000 Subject: [PATCH] docs(client): README approval decisions are objects, and register carries its required name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_015QE8qk46e5CHJxyQEUjbf8 --- .changeset/client-readme-approvals-decision-object.md | 11 +++++++++++ packages/client/README.md | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .changeset/client-readme-approvals-decision-object.md diff --git a/.changeset/client-readme-approvals-decision-object.md b/.changeset/client-readme-approvals-decision-object.md new file mode 100644 index 0000000000..b22c479c7b --- /dev/null +++ b/.changeset/client-readme-approvals-decision-object.md @@ -0,0 +1,11 @@ +--- +"@objectstack/client": patch +--- + +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. + +`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. + +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. + +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. diff --git a/packages/client/README.md b/packages/client/README.md index 63c0e95c14..93c5186941 100644 --- a/packages/client/README.md +++ b/packages/client/README.md @@ -237,7 +237,7 @@ await client.data.batch('contact', batchRequest); // Authentication await client.auth.login({ email: 'user@example.com', password: 'pass' }); -await client.auth.register({ email: 'new@example.com', password: 'pass' }); +await client.auth.register({ email: 'new@example.com', password: 'pass', name: 'New User' }); await client.auth.me(); await client.auth.logout(); await client.auth.refreshToken('refresh-token-string'); @@ -252,8 +252,8 @@ await client.packages.install({ await client.packages.enable('plugin-id'); // Approvals (approval is a flow node — decisions are keyed by request id) -await client.approvals.approve(requestId, 'LGTM'); -await client.approvals.reject(requestId, 'Incomplete'); +await client.approvals.approve(requestId, { comment: 'LGTM' }); +await client.approvals.reject(requestId, { comment: 'Incomplete' }); // Notifications await client.notifications.list({ read: false }); // unread only