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