You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: DateTime maps to DateFromInput dual-boundary schema (#24)
Generated DateTime columns previously used Schema.DateFromSelf
(Encoded = Date) which broke RPC/HTTP wire decode where JSON-parsed
input is a string. Adds a new exported DateFromInput schema —
Schema.Union(Schema.DateFromSelf, Schema.Date) — wired into the
codegen, so decode accepts native Date instances (Kysely DA layer)
AND ISO strings (RPC wire layer). Encode picks the first union member
(DateFromSelf, identity) so Kysely-bound encode keeps producing Date
instances.
Mirrors the JsonValue dual-boundary discipline already in this package
(Schema<JsonValue, JsonValue> is wire-safe by construction).
Internal: consolidated duplicated PRISMA_TO_EFFECT_SCHEMA /
PRISMA_SCALAR_MAP constants. src/effect/type.ts now imports the
canonical map from src/utils/type-mappings.ts.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`DateFromInput` is `Schema.Union(Schema.DateFromSelf, Schema.Date)` — accepts native `Date` (Kysely DA boundary) and ISO strings (RPC/HTTP wire boundary). Encode picks the first union member (DateFromSelf identity) so Kysely-bound paths still receive Date instances.
Arrays → `Schema.Array(t)`. Nullable → `Schema.NullOr(t)`.`DateFromInput` accepts `Date | string` on the encoded side; `JsonValue` is `Schema<JsonValue, JsonValue>`. Both are wire-safe (`JSON.parse` output decodes cleanly).
0 commit comments