Commit graph

684 commits

Author SHA1 Message Date
github-actions[bot]
87644178b3
[CI] Bump version 3.7.1 (#2678)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-05-22 08:31:58 -07:00
Lukas Wolf
7bc2fe57d7
feat(orm): implement delegateMap attribute (#2676) 2026-05-22 08:31:43 -07:00
github-actions[bot]
b53e908a5d
[CI] Bump version 3.7.0 (#2656)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-05-07 22:35:13 -07:00
Yiming Cao
9bfc3fecf9
feat(orm): implement postgres full-text search (#2653) 2026-05-06 21:47:44 -07:00
ymc9
d0dd954827 feat(orm): add @fullText attribute and Postgres full-text search
Introduces a Prisma-style full-text search capability gated by a new
field-level `@fullText` ZModel attribute. PostgreSQL only — MySQL/SQLite
throw NotSupported. Mirrors the existing `@fuzzy` design.

- Filter operator: `where: { title: { fts: { search, config? } } }`
  emits `to_tsvector(field) @@ to_tsquery(query)` (or with a `::regconfig`
  cast when `config` is provided; otherwise Postgres uses the database's
  `default_text_search_config`).
- OrderBy operator: `_ftsRelevance: { fields, search, config?, sort }`
  emits a single `ts_rank(...)`. Multi-field combines fields with
  `concat_ws(' ', ...)` so AND queries match terms across fields
  (matches Prisma's behavior).
- Type-level gating: the `fts` operator and `_ftsRelevance` orderBy
  appear only on String fields annotated with `@fullText` and only when
  the schema's provider is `postgresql`. Slicing's `'FullText'` filter
  kind controls availability of the runtime operator.
- Cursor pagination is rejected when combined with `_ftsRelevance`
  (parallel to `_fuzzyRelevance`).

Also refactors `buildOrderBy` to dispatch to small per-branch helpers
(`applyScalarOrderBy`, `applyAggregationOrderBy`, `applyRelationOrderBy`,
`applyFuzzyRelevanceOrderBy`, `applyFtsRelevanceOrderBy`).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 11:34:30 -07:00
Yiming Cao
9d147b931a
feat(fetch-client): implement fetch-based CRUD API client (#2651)
Some checks failed
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-06 08:28:12 -07:00
ymc9
f0fa5ea4ce chore: run test:generate during build for orm/schema/zod
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Adds `pnpm test:generate` to the build scripts of @zenstackhq/orm,
@zenstackhq/schema, and @zenstackhq/zod so test fixtures are
regenerated as part of `pnpm build`. Includes the resulting
regeneration of packages/schema/test/schema/schema.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 22:58:21 -07:00
Yiming Cao
8ddbfdebdc
feat(orm): add field-level @fuzzy attribute to gate fuzzy search (#2642)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 12:41:09 -07:00
github-actions[bot]
80c0bd6d68
[CI] Bump version 3.6.4 (#2624)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-27 17:50:05 -07:00
github-actions[bot]
8609d5b3e3
[CI] Bump version 3.6.3 (#2613)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-24 21:21:24 -07:00
github-actions[bot]
fd8db57ef2
[CI] Bump version 3.6.2 (#2604)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-22 10:54:53 -07:00
github-actions[bot]
a1374c042f
[CI] Bump version 3.6.1 (#2598)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-21 08:52:19 -07:00
Yiming Cao
b8209d7eeb
chore: migrate from tsup to tsdown (#2580) 2026-04-15 12:13:34 -07:00
github-actions[bot]
3dc922d6a9
[CI] Bump version 3.6.0 (#2571)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-11 19:18:20 -07:00
github-actions[bot]
df9b35ea64
[CI] Bump version 3.5.6 (#2560)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-06 13:14:51 -07:00
github-actions[bot]
0495333ca3
[CI] Bump version 3.5.5 (#2553)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-03 14:13:43 -07:00
github-actions[bot]
263074ce78
[CI] Bump version 3.5.4 (#2545)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-04-02 10:23:46 -07:00
github-actions[bot]
80f364a2f0
[CI] Bump version 3.5.3 (#2533)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-30 18:40:07 -07:00
Yiming Cao
85d8b6bf2f
chore: add package metadata to all public packages (#2530)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 13:02:21 -07:00
github-actions[bot]
e79ea0cbad
[CI] Bump version 3.5.2 (#2523) 2026-03-26 08:26:49 -07:00
ymc9
3145ba686b fix(cli): regression of CLI plugin resolution 2026-03-24 19:02:25 -07:00
github-actions[bot]
8b1046b2c7
[CI] Bump version 3.5.0 (#2511)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-23 16:31:36 -07:00
ymc9
5bb9e67a96 docs: add README.md to all public packages
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 21:51:13 -07:00
Yiming Cao
c768af7b7c
fix(orm): exclude Unsupported fields from ORM client (#2468) 2026-03-17 12:36:46 -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
github-actions[bot]
2c32dc329e
[CI] Bump version 3.4.6 (#2477)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-11 11:40:16 -07:00
github-actions[bot]
bd2b111b8e
[CI] Bump version 3.4.5 (#2457)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-06 22:26:46 -08:00
github-actions[bot]
07586f24cf
[CI] Bump version 3.4.4 (#2450)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-04 18:48:24 -08:00
Yiming Cao
a49c2da456
fix(cli): add "@zenstackhq/schema" package installation for "zenstack create" and "zen init" (#2437) 2026-03-03 09:43:45 -08:00
github-actions[bot]
518cbb7ddf
[CI] Bump version 3.4.3 (#2436)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-03 09:34:03 -08:00
github-actions[bot]
f58550e262
[CI] Bump version 3.4.2 (#2430)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-03-01 20:26:23 -08:00
github-actions[bot]
3336505ed6
[CI] Bump version 3.4.1 (#2422)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-02-27 19:37:57 -08:00
github-actions[bot]
2da0c214dc
[CI] Bump version 3.4.0 (#2408)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-02-25 22:40:51 -05:00
Yiming Cao
7a98d4106d
feat: creating zod schemas for zmodel constructs and ORM query input validations (#2389) 2026-02-20 06:31:00 -08:00
Yiming Cao
5def9479f5
chore: more repo merge cleanup (#2371) 2026-02-11 12:02:34 +08:00
Yiming Cao
fc703b8f42
chore: clean up repo merging stale files (#2370) 2026-02-11 11:51:44 +08:00
ymc9
2564cd457b Merge remote-tracking branch 'v3/dev' into dev 2026-02-10 16:20:19 +08:00
github-actions[bot]
274871b858
chore: bump version 3.3.3 (#659)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-02-06 16:14:11 +08:00
github-actions[bot]
392b8a2da5
chore: bump version 3.3.2 (#648)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-02-01 20:59:52 +08:00
github-actions[bot]
646267d736
chore: bump version 3.3.1 (#642)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-31 16:07:23 +08:00
github-actions[bot]
3392104d04
chore: bump version 3.3.0 (#635)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-30 16:22:01 +08:00
sanny-io
2b3d7d6f61
feat: ignore argument for @updatedAt (#572)
* feat: `ignore` argument for `@updatedAt`

* chore: add tests

* Trigger Build

* Check test.

* Use `getTime`

* Retry.

* Retry.

* Retry.

* Retry.

* Retry.

* Retry.

* Retry.

* Clean up.

* Document param.

* Extract to function.

* Relocate function.

* Adjust formatting.

* Use `getAttributeArg`

* Use `$resolvedParam`

* Null check.

* fix: resolve a merge error

* fix: delay data clone to right before changing it

---------

Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-30 16:16:16 +08:00
Yiming Cao
209312a27b
fix(orm): properly handle literal array values in policy evaluation for postgres (#628) 2026-01-29 00:15:07 +08:00
Yiming Cao
84d1e60ae1
perf(orm): more aggressive caching of validation zod schemas (#623)
* WIP: more aggressive caching of validation zod schemas

* refactor: use a decorator-based approach for caching

* update

* update

* update

* update

* update

* remove object-type args from cache key

* update cache key
2026-01-27 11:30:05 +08:00
Yiming Cao
99f68e2f7b
feat(orm): mysql support (#616)
* WIP(orm): mysql support

* WIP: more progress with fixing tests

* WIP: get all client api tests pass

* WIP: get all tests pass

* fix executor

* add MySQL to CI matrix

* fix sqlite test runs

* fix test

* fix delete readback check

* set mysql container max connections

* fix tests

* fix test

* refactor: extract duplicated mysql/pg code into base class

* address PR comments

* refactor: remove order by duplicated code

* refactor: optimize stripTableReference

* addressing PR comments

* fix tests
2026-01-24 23:21:36 +08:00
Mike Willbanks
077f03f732
feat(zmodel): collection predicate binding (#548)
* feat: audit policy collection aliases

provides a means to alias collections in @@allow collections by extending the ast
this allows for utilizing collections inside of @@allow like:

```
memberships?[m,
    auth().memberships?[
        tenantId == m.tenantId ...
    ]
  ]
```

* fix: code review comments + syntax fixes

* refactor: extract collection predicate binding to its own language construct (#2)

- adjusted language processing chain accordingly
- fixed several issues in policy transformer/evaluator
- more test cases

* addressing PR comments

---------

Co-authored-by: Yiming Cao <yiming@whimslab.io>
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-18 14:08:10 +08:00
github-actions[bot]
f54093db51
chore: bump version 3.2.1 (#587)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-11 16:44:20 +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
github-actions[bot]
20f07770b3
chore: bump version 3.2.0 (#561)
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
2026-01-05 16:57:58 +08:00
Yiming Cao
ea93dd63de
chore: bump version (#2322) 2025-12-29 16:32:52 +08:00