Skip to content

Understand the Engine

gaiacasalinuovo-hub edited this page Aug 20, 2026 · 4 revisions

Module map

Module Responsibility
src/index.ts Public compile flow, phase batching, endpoint resolution, orchestration
src/rbac.ts Field resolution, value tokens, table map extraction, field validation, aggregates
src/drizzle.ts Condition construction, joins, CRUD operations, triggers
src/types.ts Public and internal TypeScript shapes and permission presets

Request processing pipeline

VoidQL processing pipeline

The engine resolves the table and endpoint first. It selects the role permission branch, builds policy row constraints, validates request fields, resolves data, and builds an executable Drizzle operation.

Compile versus execute

compile() does not expose a SQL string as its public result. It returns { execute }. Some validation and plan construction happen before execute; the database operation and transactional trigger lifecycle happen during execute.

Transactions

Each main operation is wrapped in db.transaction. A TRANSACTION phase builds its queries against a shared transaction. A QUERY phase executes plans independently while collecting failures.

Policy resolution

The selected endpoint must exist, the role key must be present, and its permission value must be object-shaped. Policy and request where conditions are combined with logical AND.

Field resolution

Requested fields are checked against both the Drizzle table map and endpoint permissions. Joined-table fields are evaluated against the joined table's endpoint and role configuration.

Dynamic values

The resolver supports contextual tokens used in repository examples, including user, request data, column, and trigger-stage values. Because the token grammar is not yet published as a stable contract, prefer tested examples and avoid undocumented variants.

Architecture decisions visible in code

  • Drizzle remains the SQL construction and driver abstraction layer.
  • Authorization constraints are composed before execution.
  • Role configuration is colocated with each table operation.
  • The plan/execution split allows validation before the operation runs.
  • Triggers execute within the database transaction.

For contributor setup, continue to Develop VoidQL.

← Operators · Security →

Clone this wiki locally