zitejs/db:
zite, addressed by its SDK name in camelCase
(zite.tickets, zite.timeSlots), with fully-typed record types. Read the generated .zite/db.ts to see
the exact names and types.
Methods
bulkCreate takes at most 100 records per call. More than that is rejected, so chunk larger
imports.
Filters and sorting
Filters are objects keyed by field SDK name. A bare value means equality; an object applies an operator:There is no
eq or neq here: equality is the bare-value shorthand. The row filters in
zite.permissions.json are a separate system and do have eq and neq.sort: [{ field: 'createdAt', direction: 'desc' }]. Use fields: ['subject', 'status']
to fetch only the columns you need.
Read-only SQL
zite.sql() runs a single read-only SELECT against the workspace database using human-readable SDK names:
Postgres lowercases unquoted names, which is why everything but the system columns must be double-quoted.
The
.zite/db.ts header lists the link tables for your workspace.
Results are capped at 2,000 rows. The cap truncates silently rather than erroring, so check
truncated and paginate in SQL rather than assuming you got everything. Queries time out after 10
seconds.
Also on the client
The generatedzite object also exposes zite.auth.findAllUsers() and
zite.auth.updateUserProfile() for the workspace’s users. In-app notifications are a platform primitive
rather than part of the database client, so they come from zitejs/notifications
(see Notifications).