mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
Adds a new ZModel field-level `@fuzzy` attribute that opts a `String` field into fuzzy search. Without `@fuzzy`, the `fuzzy` filter operator and `_fuzzyRelevance` orderBy are unavailable both at the type level and at runtime. - Language: declare `@fuzzy` in stdlib (StringField only, @@@once) - Validator: enforce postgres-only via shared `getDataSourceProvider` helper - Schema: surface `fuzzy?: boolean` on `FieldDef`; generator emits it - ORM types: gate `fuzzy:` filter and `_fuzzyRelevance.fields` to opted-in fields - Zod factory: thread `withFuzzy` through string filter; filter `_fuzzyRelevance` enum - Runtime: throw `InvalidInputError` when fuzzy is used on non-`@fuzzy` fields - Tests: dedicated `fuzzy-search` test schema; validator coverage for postgres/sqlite/mysql/non-String Breaking: existing schemas using fuzzy search must annotate fields with `@fuzzy` to retain access. Fuzzy search shipped only one PR ago (#2573). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| eslint.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| vitest.config.ts | ||
@zenstackhq/schema
Runtime schema representation for ZenStack. Defines the TypeScript types and accessor utilities for the compiled schema that zenstack generate produces from ZModel files. This schema object describes models, fields, relations, expressions, and other metadata used by packages like @zenstackhq/orm and @zenstackhq/server at runtime.
Installation
npm install @zenstackhq/schema