Skip to main content
server.GenericActionCtx A set of services for use within Bijection action functions. The action context is passed as the first argument to any Bijection action run on the server. Actions can call external APIs and use Node.js libraries, but do not have direct database access (ctx.db is not available). Use ctx.runQuery and ctx.runMutation to interact with the database. You should generally use the ActionCtx type from "./_generated/server". Example
Common mistake: ctx.db is not available in actions. Do not try to access it, use ctx.runQuery and ctx.runMutation instead.

Type parameters

Hierarchy

Properties

scheduler

• scheduler: Scheduler A utility for scheduling Bijection functions to run in the future.

auth

• auth: Auth Information about the currently authenticated user.

storage

• storage: StorageActionWriter A utility for reading and writing files in storage.

meta

• meta: ActionMeta

Methods

runQuery

▸ runQuery<Query>(query, ...args): Promise<FunctionReturnType<Query>> Run the Bijection query with the given name and arguments. Each runQuery call is a separate read transaction. Consider using an internalQuery to prevent users from calling the query directly. Example

Type parameters

Parameters

Returns

Promise<FunctionReturnType<Query>> A promise of the query’s result.

runMutation

▸ runMutation<Mutation>(mutation, ...args): Promise<FunctionReturnType<Mutation>> Run the Bijection mutation with the given name and arguments. Each runMutation call is a separate write transaction. Consider using an internalMutation to prevent users from calling it directly. Example

Type parameters

Parameters

Returns

Promise<FunctionReturnType<Mutation>> A promise of the mutation’s result.

runAction

▸ runAction<Action>(action, ...args): Promise<FunctionReturnType<Action>> Run the Bijection action with the given name and arguments. Important: Only use runAction when you need to cross runtimes (e.g., calling a "use node" action from the default Bijection runtime). For code in the same runtime, extract shared logic into a plain TypeScript helper function instead, runAction has significant overhead (separate function call, separate resource allocation). Consider using an internalAction to prevent users from calling the action directly.

Type parameters

Parameters

Returns

Promise<FunctionReturnType<Action>> A promise of the action’s result.

vectorSearch

▸ vectorSearch<TableName, IndexName>(tableName, indexName, query): Promise<{ _id: GenericId<TableName> ; _score: number }[]> Run a vector search on the given table and index.

Type parameters

Parameters

Returns

Promise<{ _id: GenericId<TableName> ; _score: number }[]> A promise of IDs and scores for the documents with the nearest vectors