feat: DateTime maps to DateFromInput dual-boundary schema#24
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
📝 WalkthroughWalkthroughThis PR introduces ChangesDateFromInput Dual-Boundary DateTime
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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>
45e120f to
c49cf6c
Compare
Summary
DateFromInput(Encoded =Date | string) instead ofSchema.DateFromSelf(Encoded =Date). Decode accepts both native Date (Kysely) and ISO strings (RPC wire). Encode picks the first union member (DateFromSelf identity) so existing Kysely-bound paths keep working.Schema<JsonValue, JsonValue>is wire-safe by construction).PRISMA_TO_EFFECT_SCHEMA/PRISMA_SCALAR_MAPconstants —src/effect/type.tsnow imports fromsrc/utils/type-mappings.ts.Why minor (not major)
Selectable<T>/Insertable<T>/Updateable<T>Type sides unchanged. Decode now accepts MORE inputs (Date AND string), not fewer. Encode still produces Date. Existing call sites continue to work — that's why consumers can drop theirSchema.extendDate-override workarounds.Test plan
bun run prepublishOnlypasses (lint + typecheck + 344 tests + build)generated(DateFromInput)and the new package import line🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Dateobjects and ISO date strings, providing flexibility for handling data from various sources (in-memory vs. JSON/HTTP transport).