> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: BijectionActionCtx<DataModel>

> Reference for the BijectionActionCtx interface in bijection/server.

[server](/api/modules/server).BijectionActionCtx

## Type parameters

| Name | Type |
| :- | :- |
| `DataModel` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |

## Hierarchy

* [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`DataModel`>

  ↳ **`BijectionActionCtx`**

## Properties

### sources

• **sources**: [`ActionSources`](/api/interfaces/server.ActionSources)

***

### storage

• **storage**: [`BijectionStorageActionWriter`](/api/interfaces/server.BijectionStorageActionWriter)

A utility for reading and writing files in storage.

#### Overrides

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[storage](/api/interfaces/server.GenericActionCtx#storage)

***

### scheduler

• **scheduler**: [`Scheduler`](/api/interfaces/server.Scheduler)

A utility for scheduling Bijection functions to run in the future.

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[scheduler](/api/interfaces/server.GenericActionCtx#scheduler)

***

### auth

• **auth**: [`Auth`](/api/interfaces/server.Auth)

Information about the currently authenticated user.

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[auth](/api/interfaces/server.GenericActionCtx#auth)

***

### meta

• **meta**: [`ActionMeta`](/api/interfaces/server.ActionMeta)

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[meta](/api/interfaces/server.GenericActionCtx#meta)

## Methods

### runQuery

▸ **runQuery**\<`Query`>(`query`, `...args`): `Promise`\<[`FunctionReturnType`](/api/modules/server#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`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const user = await ctx.runQuery(internal.users.get, { userId });
```

#### Type parameters

| Name | Type |
| :- | :- |
| `Query` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"public"` \| `"internal"`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`"query"`, `"public"` \| `"internal"`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `query` | `Query` | A [FunctionReference](/api/modules/server#functionreference) for the query to run. |
| `...args` | [`OptionalRestArgs`](/api/modules/server#optionalrestargs)\<`Query`> | The arguments to the query function. |

#### Returns

`Promise`\<[`FunctionReturnType`](/api/modules/server#functionreturntype)\<`Query`>>

A promise of the query's result.

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[runQuery](/api/interfaces/server.GenericActionCtx#runquery)

***

### runMutation

▸ **runMutation**\<`Mutation`>(`mutation`, `...args`): `Promise`\<[`FunctionReturnType`](/api/modules/server#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`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
await ctx.runMutation(internal.orders.markPaid, { id: orderId });
```

#### Type parameters

| Name | Type |
| :- | :- |
| `Mutation` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `"public"` \| `"internal"`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`"mutation"`, `"public"` \| `"internal"`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `mutation` | `Mutation` | A [FunctionReference](/api/modules/server#functionreference) for the mutation to run. |
| `...args` | [`OptionalRestArgs`](/api/modules/server#optionalrestargs)\<`Mutation`> | The arguments to the mutation function. |

#### Returns

`Promise`\<[`FunctionReturnType`](/api/modules/server#functionreturntype)\<`Mutation`>>

A promise of the mutation's result.

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[runMutation](/api/interfaces/server.GenericActionCtx#runmutation)

***

### runAction

▸ **runAction**\<`Action`>(`action`, `...args`): `Promise`\<[`FunctionReturnType`](/api/modules/server#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

| Name | Type |
| :- | :- |
| `Action` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`"action"`, `"public"` \| `"internal"`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`"action"`, `"public"` \| `"internal"`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `action` | `Action` | A [FunctionReference](/api/modules/server#functionreference) for the action to run. |
| `...args` | [`OptionalRestArgs`](/api/modules/server#optionalrestargs)\<`Action`> | The arguments to the action function. |

#### Returns

`Promise`\<[`FunctionReturnType`](/api/modules/server#functionreturntype)\<`Action`>>

A promise of the action's result.

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[runAction](/api/interfaces/server.GenericActionCtx#runaction)

***

### vectorSearch

▸ **vectorSearch**\<`TableName`, `IndexName`>(`tableName`, `indexName`, `query`): `Promise`\<\{ `_id`: [`GenericId`](/api/modules/values#genericid)\<`TableName`> ; `_score`: `number`  }\[]>

Run a vector search on the given table and index.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |
| `IndexName` | extends `string` \| `number` \| `symbol` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `tableName` | `TableName` | The name of the table to query. |
| `indexName` | `IndexName` | The name of the vector index on the table to query. |
| `query` | `Object` | A [VectorSearchQuery](/api/interfaces/server.VectorSearchQuery) containing the vector to query, the number of results to return, and any filters. |
| `query.vector` | `number`\[] | The query vector. This must have the same length as the `dimensions` of the index. This vector search will return the IDs of the documents most similar to this vector. |
| `query.limit?` | `number` | The number of results to return. If specified, must be between 1 and 256 inclusive. **`Default`** `ts 10 ` |
| `query.filter?` | (`q`: [`VectorFilterBuilder`](/api/interfaces/server.VectorFilterBuilder)\<[`DocumentByInfo`](/api/modules/server#documentbyinfo)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>>, [`NamedVectorIndex`](/api/modules/server#namedvectorindex)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>, `IndexName`>>) => [`FilterExpression`](/api/classes/server.FilterExpression)\<`boolean`> | Optional filter expression made up of `q.or` and `q.eq` operating over the filter fields of the index. e.g. `filter: q => q.or(q.eq("genre", "comedy"), q.eq("genre", "drama"))` |

#### Returns

`Promise`\<\{ `_id`: [`GenericId`](/api/modules/values#genericid)\<`TableName`> ; `_score`: `number`  }\[]>

A promise of IDs and scores for the documents with the nearest
vectors

#### Inherited from

[GenericActionCtx](/api/interfaces/server.GenericActionCtx).[vectorSearch](/api/interfaces/server.GenericActionCtx#vectorsearch)
