fix(cloudflare): D1 value-union params + Vectorize raw x-ndjson body - #379
Merged
Conversation
Contributor
|
Install the packages built from this commit: @distilled.cloud/core bun add @distilled.cloud/core@https://pkg.distilled.cloud/core/ef9c953@distilled.cloud/aws bun add @distilled.cloud/aws@https://pkg.distilled.cloud/aws/ef9c953@distilled.cloud/axiom bun add @distilled.cloud/axiom@https://pkg.distilled.cloud/axiom/ef9c953@distilled.cloud/azure bun add @distilled.cloud/azure@https://pkg.distilled.cloud/azure/ef9c953@distilled.cloud/cloudflare bun add @distilled.cloud/cloudflare@https://pkg.distilled.cloud/cloudflare/ef9c953@distilled.cloud/coinbase bun add @distilled.cloud/coinbase@https://pkg.distilled.cloud/coinbase/ef9c953@distilled.cloud/expo-eas bun add @distilled.cloud/expo-eas@https://pkg.distilled.cloud/expo-eas/ef9c953@distilled.cloud/fly-io bun add @distilled.cloud/fly-io@https://pkg.distilled.cloud/fly-io/ef9c953@distilled.cloud/gcp bun add @distilled.cloud/gcp@https://pkg.distilled.cloud/gcp/ef9c953@distilled.cloud/kubernetes bun add @distilled.cloud/kubernetes@https://pkg.distilled.cloud/kubernetes/ef9c953@distilled.cloud/mongodb-atlas bun add @distilled.cloud/mongodb-atlas@https://pkg.distilled.cloud/mongodb-atlas/ef9c953@distilled.cloud/neon bun add @distilled.cloud/neon@https://pkg.distilled.cloud/neon/ef9c953@distilled.cloud/planetscale bun add @distilled.cloud/planetscale@https://pkg.distilled.cloud/planetscale/ef9c953@distilled.cloud/posthog bun add @distilled.cloud/posthog@https://pkg.distilled.cloud/posthog/ef9c953@distilled.cloud/prisma-postgres bun add @distilled.cloud/prisma-postgres@https://pkg.distilled.cloud/prisma-postgres/ef9c953@distilled.cloud/stripe bun add @distilled.cloud/stripe@https://pkg.distilled.cloud/stripe/ef9c953@distilled.cloud/supabase bun add @distilled.cloud/supabase@https://pkg.distilled.cloud/supabase/ef9c953@distilled.cloud/turso bun add @distilled.cloud/turso@https://pkg.distilled.cloud/turso/ef9c953@distilled.cloud/typesense bun add @distilled.cloud/typesense@https://pkg.distilled.cloud/typesense/ef9c953@distilled.cloud/workos bun add @distilled.cloud/workos@https://pkg.distilled.cloud/workos/ef9c953 |
sam-goodwin
added a commit
to alchemy-run/alchemy
that referenced
this pull request
Jul 15, 2026
Rebases the D1 params + Vectorize multipart fixes onto distilled main (companion PR alchemy-run/distilled#379), dropping the stale claude/typescript-7-stable base so the submodule pointer no longer conflicts with alchemy main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sam-goodwin
force-pushed
the
claude/d1-vectorize-local-fixes
branch
from
July 15, 2026 20:20
1103d29 to
7d06469
Compare
sam-goodwin
added a commit
to alchemy-run/alchemy
that referenced
this pull request
Jul 15, 2026
Repoints the submodule to distilled 7d06469fc (companion PR alchemy-run/distilled#379): D1 params are now a precise value union `string | number | null | number[]` instead of unknown[]. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tches - HttpTrait.bodyMediaType lets a `contentType: "binary"` request carry a specific Content-Type (e.g. application/x-ndjson) instead of the generic application/octet-stream; setBinaryBody threads it into the HttpBody so `setBody` cannot clobber it. Caller content-type header still wins. - cloudflare generator: a `format: binary` body under any non-multipart content-type is now a raw binary body (not a form-data file), and its media type is carried through as `bodyMediaType`. - patch `appendUnion` now wraps a non-union scalar field into a union (previously it only extended existing unions).
…json body The Cloudflare SDK sends the ndjson vector payload as a RAW request body (Content-Type application/x-ndjson), but the generator was conflating the Core.Uploadable body into a multipart form file. Model it as a raw binary body with bodyMediaType application/x-ndjson so it matches the SDK/API.
The SDK types D1 params (single + batch) as string[], so Distilled rejected native D1 bind values (.bind(42)/.bind(null)) during request encoding. Model params as the wire-accurate value union string | number | null | number[] (TEXT/INTEGER-REAL/NULL/BLOB) via request patches on queryDatabase + rawDatabase.
sam-goodwin
force-pushed
the
claude/d1-vectorize-local-fixes
branch
from
July 15, 2026 20:44
7d06469 to
88349b7
Compare
sam-goodwin
added a commit
to alchemy-run/alchemy
that referenced
this pull request
Jul 15, 2026
Distilled now models vectorize insert/upsert as a raw application/x-ndjson body (companion PR alchemy-run/distilled#379) matching the Cloudflare SDK, instead of the multipart-with-vectors workaround. SearchIndexLocal passes the ndjson blob as `body`. Bumps the distilled submodule. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mkassabov
added a commit
that referenced
this pull request
Jul 20, 2026
From v0 main (bb54823..c9a7779), everything applicable: #369 (broad AWS fan-out): full machinery delta — synthetic errors (message-matcher-carved tags, spec-schema + response-parser + generator support), legacy SigV2 for SimpleDB (signed-body request built in AwsProtocol.encode; core executes it), smithy.api#endpoint hostPrefix (label substitution + double-prefix guard; carried through core OperationConfig as endpointHostPrefix), streaming-input UNSIGNED-PAYLOAD with the service denylist, S3 Control/Glacier payload SHA-256 precompute, the new Presign module + export, union overrides / sensitive / errorHttpStatus spec-patch capabilities, and the complete aws patches dir (which includes #383's ec2 duplicate security-group synthetic errors — 16 typed variants emitted). #374: single /*@__PURE__*/ annotation (Rolldown 1.1+ treats /*#__PURE__*/ as unknown) — both generators, all services re-emitted. #379: core pagination isTerminalToken (empty-string continuation tokens end pagination instead of looping); bodyMediaType on core's HttpTrait + raw-body path in protocol-http; Vectorize insert/upsert gain their previously-unmodeled application/x-ndjson body via manual patches; D1 params retyped string[] -> unknown[] (JSON values). #368: workers createRoute error 10019 typed as RouteScriptNotFound. #380 (rulesets status_code) not ported: v1's docs-derived model already types every status_code as a number — the string bug was in v0's openapi source. Planetscale/stripe PRs N/A (no such v1 packages); the typescript-7 migration is not taken (v1 stays on tsgo). Verified: typecheck + offline wire sanity across all four families.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three Cloudflare SDK-accuracy fixes surfaced by the alchemy
*Localbindings work (alchemy-run/alchemy#807), plus the small core/generator enablers they need.D1 —
paramstyped asstring[]The cloudflare-typescript SDK genuinely under-types D1 query/raw
params(single and batch) asArray<string>, so Distilled rejected native D1 bind values during request encoding (SchemaError: Expected string, got 42). The D1 HTTP API accepts numbers/null/BLOB verbatim (verified live), so modelparamsas the wire-accurate value unionstring | number | null | number[](TEXT/INTEGER-REAL/NULL/BLOB) via request patches onqueryDatabase+rawDatabase.Vectorize — insert/upsert sent as multipart instead of a raw body
The SDK sends the ndjson payload as a raw
application/x-ndjsonrequest body:The generator's
Core.Uploadable ⇒ multipart form fileheuristic mis-modeled it. Model it as a raw binary body carryingapplication/x-ndjsonso it matches the SDK/API (not multipart).Core / generator enablers
HttpTrait.bodyMediaType— acontentType: "binary"request can now carry a specificContent-Type(e.g.application/x-ndjson) instead of the genericapplication/octet-stream.setBinaryBodythreads it into theHttpBodysosetBodycan't clobber it; a caller-suppliedcontent-typeheader still wins.format: binarybody under any non-multipart content-type as a raw binary body (not a form file) and carries its media type through.appendUnionnow wraps a non-union scalar field into a union (previously it only extended existing unions), which is what makes the D1 value union expressible.All regenerated against current
main; the cloudflare package builds, and the changes are exercised by alchemy's live D1/Vectorize/R2*Localtests (binary-body path unregressed).