Docs

Repository Methods

Repository Methods Repositories are the main way to interact with your database tables in Enfyra. Every table you create automatically gets a repository that you can access through $ctx.$repos.tableName . Quick Reference Record methods return data in this format: { data: [...], /

Repository Methods

Repositories are the main way to interact with your database tables in Enfyra. Every table you create automatically gets a repository that you can access through $ctx.$repos.tableName.

Quick Reference

Record methods return data in this format:

{
  data: [...],        // Array of records
  meta: {            // Metadata (when requested)
    totalCount: 100,
    filterCount: 25
  }
}

aggregate() also returns { data: [...] }, but its rows contain only computed dimensions and measures, never raw records or meta.aggregate.

Available Methods: - Find - Query raw records with filtering, sorting, and pagination - Aggregate - Return scalar summaries or grouped analytics - Create - Create new records - Update - Update existing records by ID - Delete - Delete records by ID - Batch mutations - Create, update, or delete many records in one generic-table operation

Accessing Repositories

Repositories are available through the context object ($ctx) in hooks and handlers:

// Access a repository by table name
const productsRepo = $ctx.$repos.products;
const usersRepo = $ctx.$repos.enfyra_user;

// Access the main table repository (if configured in route)
const mainRepo = $ctx.$repos.main;

Important: - Repositories are resolved from metadata by table name or alias (see RepoRegistryService). You do not configure a per-route list for basic access. - $ctx.$repos.main is the current route’s main table (field permissions enforced). - $ctx.$repos.secure.<name> — same enforcement for another table; $ctx.$repos.<name> — no field-permission enforcement unless you use main / secure. - All repository methods are async and require await

Documentation

Next Steps