From a1a5e3d49fd319bbf6db1f5e3edfdb59e67676d7 Mon Sep 17 00:00:00 2001 From: Yanay Date: Mon, 17 Aug 2026 00:28:14 +0300 Subject: [PATCH 1/2] fix(entities): send incrementEntityViews count as a query param MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The server reads `count` from the query string, but it was sent as a body field — so it was ignored and every call incremented the counter by the schema default of 1, whatever amount was passed. Co-Authored-By: Claude Opus 5 --- __tests__/entities.test.ts | 22 ++++++++++++++++---- src/modules/entities/incrementEntityViews.ts | 8 +++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/__tests__/entities.test.ts b/__tests__/entities.test.ts index a76fe5f..8a989ff 100644 --- a/__tests__/entities.test.ts +++ b/__tests__/entities.test.ts @@ -74,12 +74,26 @@ describe("node-sdk entities — request shaping", () => { }); }); - it("incrementEntityViews strips entityId into the path and patches the rest", async () => { + it("incrementEntityViews sends count as a query param, not a body field", async () => { const { client, projectInstance } = makeClient(); await incrementEntityViews(client, { entityId: "e1", count: 3 }); - expect(projectInstance.patch).toHaveBeenCalledWith("/entities/e1/increment-views", { - count: 3, - }); + // The server reads `count` from the query string; as a body field it was + // ignored and every call incremented by the default of 1. + expect(projectInstance.patch).toHaveBeenCalledWith( + "/entities/e1/increment-views", + undefined, + { params: { count: 3 } }, + ); + }); + + it("incrementEntityViews omits count when not supplied", async () => { + const { client, projectInstance } = makeClient(); + await incrementEntityViews(client, { entityId: "e1" }); + expect(projectInstance.patch).toHaveBeenCalledWith( + "/entities/e1/increment-views", + undefined, + { params: {} }, + ); }); it("deleteEntity deletes /entities/:id", async () => { diff --git a/src/modules/entities/incrementEntityViews.ts b/src/modules/entities/incrementEntityViews.ts index ab537c5..eb7c922 100644 --- a/src/modules/entities/incrementEntityViews.ts +++ b/src/modules/entities/incrementEntityViews.ts @@ -11,7 +11,11 @@ export async function incrementEntityViews( data: IncrementEntityViewsProps ): Promise { const { entityId, ...restOfProps } = data; - const path = `/entities/${data.entityId}/increment-views`; - const response = await client.projectInstance.patch(path, restOfProps); + const path = `/entities/${entityId}/increment-views`; + // `count` is read from the query string, not the body — sending it as a body + // field left the server on its default of 1, silently ignoring the amount. + const response = await client.projectInstance.patch(path, undefined, { + params: restOfProps, + }); return response.data; } From d267974193246fb78c8f84811326f0803859330d Mon Sep 17 00:00:00 2001 From: Yanay Date: Mon, 17 Aug 2026 00:28:14 +0300 Subject: [PATCH 2/2] feat(spaces): expose the status filter on fetchUserSpaces The server now accepts a membership status on /spaces/user-spaces, so surface it: "active" (default), "pending" for join requests awaiting approval, or "banned". Co-Authored-By: Claude Opus 5 --- src/modules/spaces/fetchUserSpaces.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/spaces/fetchUserSpaces.ts b/src/modules/spaces/fetchUserSpaces.ts index cc43ade..866c989 100644 --- a/src/modules/spaces/fetchUserSpaces.ts +++ b/src/modules/spaces/fetchUserSpaces.ts @@ -9,6 +9,12 @@ export interface FetchUserSpacesProps { include?: string; role?: string; // single role or comma-separated, e.g. "admin,moderator" all?: "true" | "false"; + /** + * Membership status to list. Defaults to `"active"` (spaces the user is in); + * `"pending"` returns join requests awaiting approval, `"banned"` the spaces + * they were removed from. + */ + status?: "active" | "pending" | "banned"; } export async function fetchUserSpaces(