Fixed issue where access policy rules couldn't reference fields inherited from mixins defined in separate imported files. The language service now correctly resolves these fields during scope computation.
## Root Cause
The `getRecursiveBases()` function only searched for mixin declarations in the current document (`decl.$container.declarations`), which failed for imported mixins.
## Solution
- Modified `getRecursiveBases()` to accept optional `LangiumDocuments` parameter
- Implemented two-strategy approach:
1. Use resolved reference if available (post-linking)
2. Search by name across all documents including imports (pre-linking)
- Updated `ZModelScopeComputation.processNode()` to pass `LangiumDocuments`
- Leverages existing `getAllDeclarationsIncludingImports()` helper
## Changes
- **packages/language/src/utils.ts**: Fixed `getRecursiveBases()` to search imported documents
- **packages/language/src/zmodel-scope.ts**: Pass LangiumDocuments to scope computation
- **packages/language/test/mixin.test.ts**: Added tests for imported mixin field resolution
- **packages/testtools**: Added `extraZModelFiles` option for multi-file test schemas
- **tests/regression/test/issue-598.test.ts**: Regression test for the issue
## Test Results
✅ All language package tests pass (65 tests)
✅ Regression test validates policy rules can access imported mixin fields
✅ Handles edge cases: cyclic imports, nested mixins, transitive imports
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* 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>
* 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>
* feat(orm): support where enum
* fix(orm): super transform for where
* feat(orm): support nested enum in where and/or
* fix: resolve field's model from scope instead of relying on table qualification
* fix(orm): cuid() generator should respect version argument
---------
Co-authored-by: FTB_lag <tabolskyy.git@gmail.com>
* Add support for generated identifier format strings (ID prefixing).
* Add tests.
* Add missing semicolon.
* Cleanup logic.
* Fix typo.
* Use `replaceAll` instead.
* Add language support and tests.
* Simplify logic.
* allow using '\\%s' to escape replacement pattern, improve tests
* Shorten some test names.
---------
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>