Skip to content

fix(core): flatten plain objects in the GET leftover-field query fallback#335

Open
sam-goodwin wants to merge 1 commit into
mainfrom
fix/get-extra-query-deep-object
Open

fix(core): flatten plain objects in the GET leftover-field query fallback#335
sam-goodwin wants to merge 1 commit into
mainfrom
fix/get-extra-query-deep-object

Conversation

@sam-goodwin

Copy link
Copy Markdown
Collaborator

Follow-up to #334 — same latent [object Object] bug, but in the other query-serialization path: the GET fallback in client.ts that appends non-annotated leftover fields to the query string used String(value) for everything.

// before: ?filter=%5Bobject%20Object%5D
// after:  ?filter.exact=a&filter.contains=b
  • Extracts the fallback into buildExtraQueryParams in traits.ts (unit-testable) and reuses the deepObject flattening from fix(core): serialize struct query params as deepObject dot-notation #334.
  • Only plain objects change behavior. Scalars, top-level arrays (legacy ,-join on this path — deliberately preserved, unlike annotated params which send repeated pairs), and non-plain objects (Date, class instances) serialize exactly as before.

No generated schema currently sends objects through this path, so this is hardening rather than a live-bug fix — but it closes the gap before some future generated operation trips over it silently.

…back

The GET fallback in client.ts serializes non-annotated leftover fields
with String(value), so object values went over the wire as
`[object Object]` — same latent bug as the annotated query path fixed
in the previous commit. Extract the fallback into buildExtraQueryParams
and flatten plain objects to deepObject dot-notation; scalars,
top-level arrays (legacy comma-join), and non-plain objects keep their
existing serialization.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alchemy-version-bot

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

@distilled.cloud/core

bun add @distilled.cloud/core@https://pkg.distilled.cloud/core/ba4286e

@distilled.cloud/aws

bun add @distilled.cloud/aws@https://pkg.distilled.cloud/aws/ba4286e

@distilled.cloud/axiom

bun add @distilled.cloud/axiom@https://pkg.distilled.cloud/axiom/ba4286e

@distilled.cloud/azure

bun add @distilled.cloud/azure@https://pkg.distilled.cloud/azure/ba4286e

@distilled.cloud/cloudflare

bun add @distilled.cloud/cloudflare@https://pkg.distilled.cloud/cloudflare/ba4286e

@distilled.cloud/coinbase

bun add @distilled.cloud/coinbase@https://pkg.distilled.cloud/coinbase/ba4286e

@distilled.cloud/expo-eas

bun add @distilled.cloud/expo-eas@https://pkg.distilled.cloud/expo-eas/ba4286e

@distilled.cloud/fly-io

bun add @distilled.cloud/fly-io@https://pkg.distilled.cloud/fly-io/ba4286e

@distilled.cloud/gcp

bun add @distilled.cloud/gcp@https://pkg.distilled.cloud/gcp/ba4286e

@distilled.cloud/kubernetes

bun add @distilled.cloud/kubernetes@https://pkg.distilled.cloud/kubernetes/ba4286e

@distilled.cloud/mongodb-atlas

bun add @distilled.cloud/mongodb-atlas@https://pkg.distilled.cloud/mongodb-atlas/ba4286e

@distilled.cloud/neon

bun add @distilled.cloud/neon@https://pkg.distilled.cloud/neon/ba4286e

@distilled.cloud/planetscale

bun add @distilled.cloud/planetscale@https://pkg.distilled.cloud/planetscale/ba4286e

@distilled.cloud/posthog

bun add @distilled.cloud/posthog@https://pkg.distilled.cloud/posthog/ba4286e

@distilled.cloud/prisma-postgres

bun add @distilled.cloud/prisma-postgres@https://pkg.distilled.cloud/prisma-postgres/ba4286e

@distilled.cloud/stripe

bun add @distilled.cloud/stripe@https://pkg.distilled.cloud/stripe/ba4286e

@distilled.cloud/supabase

bun add @distilled.cloud/supabase@https://pkg.distilled.cloud/supabase/ba4286e

@distilled.cloud/turso

bun add @distilled.cloud/turso@https://pkg.distilled.cloud/turso/ba4286e

@distilled.cloud/typesense

bun add @distilled.cloud/typesense@https://pkg.distilled.cloud/typesense/ba4286e

@distilled.cloud/workos

bun add @distilled.cloud/workos@https://pkg.distilled.cloud/workos/ba4286e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant