Repository navigation
v0.18.0
@kitcn/resend
Published @kitcn/resend@0.18.0.
kitcn
Minor Changes
-
#335
9b3494dThanks @MikeyZhang75! - ## Breaking changes- Fix
orderByreturning the wrong rows when thewherepins only part of a
compound index. Ordering bycreatedAtunderwhere: { type: 'a' }on an
index of(type, numLikes)used to hand back the rows sorted bynumLikes.
It now returns creation order. Queries in that shape return different rows
than before, and undercursorpagination withstrictthey now report that
the field has no usable index instead of paginating in the wrong order.
// Schema: index('numLikesAndType').on(t.type, t.numLikes) // Before — returned the two most-liked posts // After — returns the two newest posts, as asked await ctx.orm.query.posts.findMany({ where: { type: "a" }, orderBy: { createdAt: "desc" }, limit: 2, }); // Pinning the narrower index leaves creation time as the implicit next key index("by_type").on(t.type);
- Change which rows a
.through()relation returns for a givenlimit. Each
parent now gets its own firstlimitlinks instead of a window over the
order in which targets happened to be discovered across the whole page.
orderByon a through relation is unaffected.
Patches
- Push
limitandorderByon amany()relation into the relation index.
with: { posts: { limit: 5, orderBy: { createdAt: 'desc' } } }reads five
posts per parent instead of every post of every parent. - Bound
.through()relation reads by the requestedlimitinstead of reading
every junction row of every parent. Links whose target is missing or is
dropped by RLS or the relationwheredo not consume a slot, so the page
still comes back full. - Fill
limitwith rows that survive RLS and relationwhereinstead of
filtering after the read.findMany({ where: { ownerId }, limit: 3 })on a
table with a select policy used to return only whichever of the first three
stored rows happened to be visible — often none. - Push
limitintoin,notIn,neandisNotNullreads, which previously
read every matching row and sliced afterwards. - Use an index for
incombined with another filter —where: { status: { in: [...] }, name: { contains: 'x' } }scanned the whole table. - Order by a field the
wheredoes not pin without reading the whole bucket,
as long as the index sorts by it next. - Prefer an index that also supplies the requested order, so a compound
(tenantId, createdAt)is chosen over a narrow(tenantId)for a
tenant-scoped feed. - Serve
orderByon the leading field of a pinned.withIndex()from the
index instead of scanning the table. - Stop loading nested
with:data, extras and column selection for relation
rows that the per-parentlimitoroffsetthen discards. Deeply nested
reads that previously failed the relation fan-out guard now succeed. - Read each shared target once when counting a
.through()relation with a
where, instead of once per parent row. - Reuse aggregate bucket reads across rows of a
with._count. - Build the ORM once per request instead of twice; the RLS bypass client is
now created only when it is used. - Reduce per-row work on filtered reads, relation counts, and query planning.
- Fix