Commit graph

23 commits

Author SHA1 Message Date
Yiming Cao
eff4263c47
refactor(tanstack-query, orm): thread plugin generics through transactions (#2645)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 10:56:06 -07:00
Yiming Cao
22e0fd40a9
feat(tanstack-query): add useTransaction hook for sequential transactions (#2637)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
2026-05-03 18:33:15 -07:00
ymc9
516a2a2d81 update test 2026-04-29 23:06:51 -07:00
ymc9
67da884019 fix(tanstack-query): support DbNull/JsonNull/AnyNull serialization over the wire
Register SuperJSON custom serializers for the three JSON null sentinels in
both the client-helpers fetch layer and the server's registerCustomSerializers,
so they survive HTTP round-trips when used as query filters or mutation input.
Re-export the singletons from all tanstack-query framework entry points
(react, vue, svelte) for convenient user access.

Fixes #2278

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 22:59:43 -07:00
Yiming Cao
f1375259d1
fix(tanstack-query): propagate TPageParam generic through useInfiniteFindMany (#2561)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 16:48:29 -07:00
Eugen Istoc
abae35aa61
feat(clients): add ExtResult support to TanStack Query hooks (#2490) 2026-03-18 09:43:35 -07:00
ymc9
1ba4e54066 refactor(schema): widen types for attributes, default, and foreignKeyFor in generated schema
The generated schema previously used `as const` on entire model/enum/typeDef
objects, causing TypeScript to deeply infer literal types for all nested
properties. This is unnecessary for `attributes`, `default`, and `foreignKeyFor`
which are only used at runtime, not in CRUD type computations.

Changes:
- Add type assertions (`as readonly AttributeApplication[]`, `as FieldDefault`,
  `as readonly string[]`) to prevent deep const inference on these properties
- Extract `FieldDefault` type alias from `FieldDef` for cleaner generated code
- Change `FieldHasDefault` to use key existence check (`'default' extends keyof`)
  instead of value type check, enabling the `default` widening
- Conditionally import `AttributeApplication` and `FieldDefault` only when used

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:51:43 -07:00
Yiming Cao
3e03ab1506
refactor: remove import from orm package in generated schema (#2387) 2026-02-19 18:16:13 -08:00
Yiming Cao
da3b0af343
feat: ORM api slicing (#2383) 2026-02-18 07:45:04 -08:00
Yiming Cao
f3a24dd5d5
chore: rebuild and update test schemas (#671) 2026-02-08 11:29:32 +08:00
Mike Willbanks
2172614e0e
custom procedures (#551)
* feat: custom procs

* chore: cleanup

* fix: remove $procedures from client

* fix: failing test due to previous alias

* feat(custom-procs)!: make procedures envelope-only via $procs

- Switch procedure calls to `db.$procs.name({ args: {...} })` (no positional args)
- Remove legacy `$procedures` alias entirely (client API + server routing/logging)
- Validate procedure envelope input (`args` object, required/unknown keys)
- Keep TanStack Query procedure hooks as `(args, options)` (with conditional args optionality)
- Update server/ORM/client tests for the envelope API

* fix: code review feedback

* fix: code review comments

* fix: coderabbit review comments

* fix: remove useless proxy method

* test: add a couple of e2e tests that verify both typing and runtime

* test: improve e2e tests

* test: add missing mutation flag

* regenerate test schema

* refactor: procedure params generation fix and type refactors

- Simplified procedure's params definition from a tuple an object, since procs are now called with an envelop now

- Refactored procedure related typing to make them more consistent with other CURD types (that usually takes the schema as the first type parameter, and a name as the second)

- Moved detailed procedure's types to "crud-types" where other ORM client detailed types are defined

- Removed some type duplication from hooks side

- Updated the "orm" sample to demonstrate procedures

* fix: disable infinite custom proc queries for now

---------

Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-08 11:21:51 +08:00
sanny-io
446a48335f
feat: exists operation (#550)
* feat: exists operation

* Add RPC handling.

* Add frontend handling.

* Add tests.

* Fix postgres error.

* Add JSDoc.

* Remove `@ts-expect-error`

* Disable post-processing.

* Put semicolon back.
2026-01-07 18:05:49 +08:00
Yiming Cao
fe731f726a
refactor: extract client-helpers package, update svelte-query to v6 (#535) 2025-12-27 22:49:19 +08:00
Yiming Cao
ac4a68cd5d
refactor(orm): simplify model results typing (#485)
* refactor(orm): simplify model results typing

* add missing dev dependency

* update

* update

* update
2025-12-13 16:59:03 +08:00
Yiming Cao
2d740f12e6
feat(orm): implement field omission (#441)
* feat: implement field omission

* Update tests/e2e/orm/client-api/omit.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix build

* fix build

* fix build

* update sample

* fix tests

* update

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-27 09:50:46 +08:00
Yiming Cao
ed931da78c
fix(orm): reimplement typescript type display simplification (#405)
* fix(orm): reimplement typescript type display simplification

* update
2025-11-14 22:44:29 -08:00
Yiming Cao
e0117f2a7f
refactor(orm): simplify ORM query args (#396)
* refactor(orm): simplify ORM query args

* update

* simplify hooks signatures

* addressing PR comments

* update
2025-11-13 11:57:10 -08:00
Yiming Cao
81924d9e55
fix(tanstack): query result $optimistic typing (#372)
* fix(tanstack): query result $optimistic typing

* update
2025-11-05 19:45:15 -08:00
Yiming Cao
e7f191c90c
fix(tanstack): delegate hooks typing (#370) 2025-11-05 12:24:38 -08:00
Yiming Cao
5ff17ce6b9
fix(tanstack): improve mutation mutateAsync typing (#368)
* fix(tanstack): improve mutation mutateAsync typing

* simplify typing
2025-11-05 11:51:01 -08:00
Yiming Cao
bf2ab4b9df
fix(tanstack): additional typing fixes (#360) 2025-11-03 15:33:35 -08:00
Yiming Cao
170535a6f9
feat(schema): add option for generating lite schema (#357)
* feat(schema): add option for generating lite schema

* fix --lite-only option and add CLI test
2025-11-03 09:25:23 -08:00
Yiming Cao
e919bb0199
feat(tanstack-query): new implementation of tanstack-query react hooks (#356)
* WIP

* feat: tanstack-query/react CRUD hooks implementation

* fix build

* addressing PR comments

* update

* update

* migrate tests

* update

* fix test environment

* use happy-dom instead of jsdom
2025-11-02 23:14:11 -08:00