> ## 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.

# Module: server

> Utilities for implementing server-side Bijection query and mutation functions.

Utilities for implementing server-side Bijection query and mutation functions.

## Usage

### Code Generation

This module is typically used alongside generated server code.

To generate the server code, run `bijection dev` in your Bijection project.
This will create a `bijection/_generated/server.js` file with the following
functions, typed for your schema:

* [query](/generated-api/server#query)
* [mutation](/generated-api/server#mutation)

If you aren't using TypeScript and code generation, you can use these untyped
functions instead:

* [queryGeneric](/api/modules/server#querygeneric)
* [mutationGeneric](/api/modules/server#mutationgeneric)

### Example

Bijection functions are defined by using either the `query` or
`mutation` wrappers.

Queries receive a `db` that implements the [GenericDatabaseReader](/api/interfaces/server.GenericDatabaseReader) interface.

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { query } from "./_generated/server";

export default query({
  handler: async ({ db }, { arg1, arg2 }) => {
    // Your (read-only) code here!
  },
});
```

If your function needs to write to the database, such as inserting, updating,
or deleting documents, use `mutation` instead which provides a `db` that
implements the [GenericDatabaseWriter](/api/interfaces/server.GenericDatabaseWriter) interface.

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { mutation } from "./_generated/server";

export default mutation({
  handler: async ({ db }, { arg1, arg2 }) => {
    // Your mutation code here!
  },
});
```

## Classes

* [Crons](/api/classes/server.Crons)
* [Expression](/api/classes/server.Expression)
* [IndexRange](/api/classes/server.IndexRange)
* [PublishedDefinition](/api/classes/server.PublishedDefinition)
* [HttpRouter](/api/classes/server.HttpRouter)
* [TableDefinition](/api/classes/server.TableDefinition)
* [SchemaDefinition](/api/classes/server.SchemaDefinition)
* [SearchFilter](/api/classes/server.SearchFilter)
* [FilterExpression](/api/classes/server.FilterExpression)
* [ViewQuery](/api/classes/server.ViewQuery)
* [ViewDefinition](/api/classes/server.ViewDefinition)

## Interfaces

* [UserIdentity](/api/interfaces/server.UserIdentity)
* [Auth](/api/interfaces/server.Auth)
* [ProtectedFileBinding](/api/interfaces/server.ProtectedFileBinding)
* [BijectionStorageReader](/api/interfaces/server.BijectionStorageReader)
* [PrepareUploadOptions](/api/interfaces/server.PrepareUploadOptions)
* [BijectionStorageWriter](/api/interfaces/server.BijectionStorageWriter)
* [BijectionStorageActionWriter](/api/interfaces/server.BijectionStorageActionWriter)
* [OccurrenceCustody](/api/interfaces/server.OccurrenceCustody)
* [BijectionQueryCtx](/api/interfaces/server.BijectionQueryCtx)
* [BijectionMutationCtx](/api/interfaces/server.BijectionMutationCtx)
* [BijectionActionCtx](/api/interfaces/server.BijectionActionCtx)
* [CronJob](/api/interfaces/server.CronJob)
* [BaseTableReader](/api/interfaces/server.BaseTableReader)
* [GenericDatabaseReader](/api/interfaces/server.GenericDatabaseReader)
* [GenericDatabaseReaderWithTable](/api/interfaces/server.GenericDatabaseReaderWithTable)
* [GenericDatabaseWriter](/api/interfaces/server.GenericDatabaseWriter)
* [GenericDatabaseWriterWithTable](/api/interfaces/server.GenericDatabaseWriterWithTable)
* [BaseTableWriter](/api/interfaces/server.BaseTableWriter)
* [FilterBuilder](/api/interfaces/server.FilterBuilder)
* [IndexRangeBuilder](/api/interfaces/server.IndexRangeBuilder)
* [ExternalCalls](/api/interfaces/server.ExternalCalls)
* [Approvals](/api/interfaces/server.Approvals)
* [Sources](/api/interfaces/server.Sources)
* [ActionSources](/api/interfaces/server.ActionSources)
* [TransactionLimits](/api/interfaces/server.TransactionLimits)
* [QueryMeta](/api/interfaces/server.QueryMeta)
* [MutationMeta](/api/interfaces/server.MutationMeta)
* [ActionMeta](/api/interfaces/server.ActionMeta)
* [PaginationResult](/api/interfaces/server.PaginationResult)
* [PaginationOptions](/api/interfaces/server.PaginationOptions)
* [QueryInitializer](/api/interfaces/server.QueryInitializer)
* [Query](/api/interfaces/server.Query)
* [OrderedQuery](/api/interfaces/server.OrderedQuery)
* [GenericMutationCtx](/api/interfaces/server.GenericMutationCtx)
* [GenericQueryCtx](/api/interfaces/server.GenericQueryCtx)
* [GenericActionCtx](/api/interfaces/server.GenericActionCtx)
* [ValidatedFunction](/api/interfaces/server.ValidatedFunction)
* [AdvancedRunQueryOptions](/api/interfaces/server.AdvancedRunQueryOptions)
* [Scheduler](/api/interfaces/server.Scheduler)
* [SearchIndexConfig](/api/interfaces/server.SearchIndexConfig)
* [VectorIndexConfig](/api/interfaces/server.VectorIndexConfig)
* [DefineSchemaOptions](/api/interfaces/server.DefineSchemaOptions)
* [SystemDataModel](/api/interfaces/server.SystemDataModel)
* [SearchFilterBuilder](/api/interfaces/server.SearchFilterBuilder)
* [SearchFilterFinalizer](/api/interfaces/server.SearchFilterFinalizer)
* [ProjectedOrderedQuery](/api/interfaces/server.ProjectedOrderedQuery)
* [ProjectedQuery](/api/interfaces/server.ProjectedQuery)
* [SelectableOrderedQuery](/api/interfaces/server.SelectableOrderedQuery)
* [SelectableQuery](/api/interfaces/server.SelectableQuery)
* [SelectableQueryInitializer](/api/interfaces/server.SelectableQueryInitializer)
* [StorageReader](/api/interfaces/server.StorageReader)
* [StorageWriter](/api/interfaces/server.StorageWriter)
* [StorageActionWriter](/api/interfaces/server.StorageActionWriter)
* [VectorSearchQuery](/api/interfaces/server.VectorSearchQuery)
* [VectorFilterBuilder](/api/interfaces/server.VectorFilterBuilder)

## References

### UserIdentityAttributes

Re-exports [UserIdentityAttributes](/api/modules/browser#useridentityattributes)

## Type Aliases

### FunctionType

Ƭ **FunctionType**: `"query"` | `"mutation"` | `"action"`

The type of a Bijection function.

***

### FunctionReference

Ƭ **FunctionReference**\<`Type`, `Visibility`, `Args`, `ReturnType`, `ComponentPath`>: `Object`

A reference to a registered Bijection function.

You can create a [FunctionReference](/api/modules/server#functionreference) using the generated `api` utility:

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { api } from "../bijection/_generated/api";

const reference = api.myModule.myFunction;
```

If you aren't using code generation, you can create references using
[anyApi](/api/modules/server#anyapi-2):

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { anyApi } from "bijection/server";

const reference = anyApi.myModule.myFunction;
```

Function references can be used to invoke functions from the client. For
example, in React you can pass references to the [useQuery](/api/modules/react#usequery) hook:

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const result = useQuery(api.myModule.myFunction);
```

If you want to accept a `FunctionReference` as a callback argument, prefer
typing the callback parameter as [FunctionReference\_future](/api/modules/server#functionreference_future).

#### Type parameters

| Name | Type | Description |
| :- | :- | :- |
| `Type` | extends [`FunctionType`](/api/modules/server#functiontype) | The type of the function ("query", "mutation", or "action"). |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) = `"public"` | The visibility of the function ("public" or "internal"). |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) = `any` | The arguments to this function. This is an object mapping argument names to their types. |
| `ReturnType` | `any` | The return type of this function. |
| `ComponentPath` | `string` \| `undefined` | - |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `_type` | `Type` | - |
| `_visibility` | `Visibility` | - |
| `_args` | `Args` | To read the arguments for a `FunctionReference`, prefer [FunctionArgs](/api/modules/server#functionargs). This slot will be removed in a future version. **`Deprecated`** |
| `_returnType` | `ReturnType` | To read the return type of a `FunctionReference`, prefer [FunctionReturnType](/api/modules/server#functionreturntype). This slot will be removed in a future version. **`Deprecated`** |
| `_componentPath` | `ComponentPath` | - |
| `_fn?` | (`args`: `Args`, `keys`: `FunctionReferenceArgKeys`\<`Args`>) => `ReturnType` | To read the arguments or return type of a `FunctionReference`, prefer [FunctionArgs](/api/modules/server#functionargs) and [FunctionReturnType](/api/modules/server#functionreturntype). |

***

### FunctionReference\_future

Ƭ **FunctionReference\_future**\<`Type`, `Visibility`, `Args`, `ReturnType`, `ComponentPath`>: `Object`

A reference to a Bijection function whose arguments are checked closer to the
way Bijection checks them at runtime.

Use this instead of [FunctionReference](/api/modules/server#functionreference) when you accept someone else's
Bijection function as a callback and know which arguments you will pass it.

A plain `FunctionReference` gets a couple things backwards: it accepts a
function requiring arguments you never pass, and rejects a function
accepting broader values than you pass. An ordinary TypeScript function type
doesn't map perfectly either: it treats a surplus argument as harmless,
where a Bijection validator rejects it.

This type melds regular TypeScript function reference behavior with top
level checking of arguments to prevent surplus arguments from hitting
runtime validation errors. The caveat: a surplus key inside a nested object,
an array element, or one arm of a union passes the type check and fails the
validator at runtime.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { FunctionReference_future } from "bijection/server";

declare function onComplete(
  fn: FunctionReference_future<
    "mutation",
    "internal",
    { taskId: string; force: boolean },
    null
  >,
): void;

// Takes exactly `{ taskId: string; force: boolean }`.
onComplete(internal.tasks.finish);
// Takes `{ taskId: string | number; force?: boolean }`: calling it is safe.
onComplete(internal.tasks.finishLoosely);
// Requires a `reason` argument that `onComplete` never passes.
onComplete(internal.tasks.finishWithReason);
//          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rejected
// Takes only `{ taskId: string }`: its validator would reject `force`.
onComplete(internal.tasks.finishById);
//          ~~~~~~~~~~~~~~~~~~~~~~~~ rejected
```

A value of this type is usable with `ctx.runMutation`,
`ctx.scheduler.runAfter`, `createFunctionHandle`, and everything else in
this package that takes a reference, all of which accept either kind.

It is *not* assignable to a plain `FunctionReference`. Code that wants to
accept both kinds should take
`FunctionReference<...> | FunctionReference_future<...>` and read arguments
and return types through [FunctionArgs](/api/modules/server#functionargs) and [FunctionReturnType](/api/modules/server#functionreturntype).

Argument checking here relies on `strictFunctionTypes` (implied by `strict`)
and is skipped for projects that disable it. Everything else about the
reference is compared exactly as `FunctionReference` compares it.

#### Type parameters

| Name | Type | Description |
| :- | :- | :- |
| `Type` | extends [`FunctionType`](/api/modules/server#functiontype) | The type of the function ("query", "mutation", or "action"). |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) = `"public"` | The visibility of the function ("public" or "internal"). |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) = `any` | The arguments the consumer of the reference will pass. |
| `ReturnType` | `any` | The return type of this function. |
| `ComponentPath` | `string` \| `undefined` | - |

#### Type declaration

| Name | Type |
| :- | :- |
| `_type` | `Type` |
| `_visibility` | `Visibility` |
| `_componentPath` | `ComponentPath` |
| `_fn?` | (`args`: `Args`, `keys`: `FunctionReference_futureArgKeys`\<`Args`>) => `ReturnType` |

***

### ApiFromModules

Ƭ **ApiFromModules**\<`AllModules`>: [`FilterApi`](/api/modules/server#filterapi)\<`ApiFromModulesAllowEmptyNodes`\<`AllModules`>, [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `any`, `any`, `any`> | [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`>>

Given the types of all modules in the `bijection/` directory, construct the type
of `api`.

`api` is a utility for constructing [FunctionReference](/api/modules/server#functionreference)s.

#### Type parameters

| Name | Type | Description |
| :- | :- | :- |
| `AllModules` | extends `Record`\<`string`, `object`> | A type mapping module paths (like `"dir/myModule"`) to the types of the modules. |

***

### FilterApi

Ƭ **FilterApi**\<`API`, `Predicate`>: [`Expand`](/api/modules/server#expand)\<\{ \[mod in keyof API as FilterKeysInApi\<mod, API\[mod], Predicate>]: API\[mod] extends Predicate ? API\[mod] : FilterApi\<API\[mod], Predicate> }>

Filter a Bijection deployment api object for functions which meet criteria,
for example all public queries.

#### Type parameters

| Name |
| :- |
| `API` |
| `Predicate` |

***

### AnyApi

Ƭ **AnyApi**: `Record`\<`string`, `Record`\<`string`, `AnyModuleDirOrFunc`>>

The type that Bijection api objects extend. If you were writing an api from
scratch it should extend this type.

***

### PartialApi

Ƭ **PartialApi**\<`API`>: \{ \[mod in keyof API]?: API\[mod] extends FunctionReference\<any, any, any, any> | OperationReference\<any, any, any> ? API\[mod] : PartialApi\<API\[mod]> }

Recursive partial API, useful for defining a subset of an API when mocking
or building custom api objects.

#### Type parameters

| Name |
| :- |
| `API` |

***

### FunctionArgs

Ƭ **FunctionArgs**\<`FuncRef`>: `ExtractSignature`\<`FuncRef`>\[`"args"`]

Given a [FunctionReference](/api/modules/server#functionreference) or [FunctionReference\_future](/api/modules/server#functionreference_future), get
the arguments of the function.

This is represented as an object mapping argument names to values.

#### Type parameters

| Name | Type |
| :- | :- |
| `FuncRef` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `any`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`any`, `any`> \| [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`> |

***

### OptionalRestArgs

Ƭ **OptionalRestArgs**\<`FuncRef`>: [`FunctionArgs`](/api/modules/server#functionargs)\<`FuncRef`> extends `EmptyObject` ? \[args?: EmptyObject] : \[args: FunctionArgs\<FuncRef>]

A tuple type of the (maybe optional) arguments to `FuncRef`.

This type is used to make methods involving arguments type safe while allowing
skipping the arguments for functions that don't require arguments.

#### Type parameters

| Name | Type |
| :- | :- |
| `FuncRef` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `any`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`any`, `any`> \| [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`> |

***

### ArgsAndOptions

Ƭ **ArgsAndOptions**\<`FuncRef`, `Options`>: [`FunctionArgs`](/api/modules/server#functionargs)\<`FuncRef`> extends `EmptyObject` ? \[args?: EmptyObject, options?: Options] : \[args: FunctionArgs\<FuncRef>, options?: Options]

A tuple type of the (maybe optional) arguments to `FuncRef`, followed by an options
object of type `Options`.

This type is used to make methods like `useQuery` type-safe while allowing

1. Skipping arguments for functions that don't require arguments.
2. Skipping the options object.

#### Type parameters

| Name | Type |
| :- | :- |
| `FuncRef` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `any`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`any`, `any`> |
| `Options` | `Options` |

***

### FunctionReturnType

Ƭ **FunctionReturnType**\<`FuncRef`>: `ExtractSignature`\<`FuncRef`>\[`"returnType"`]

Given a [FunctionReference](/api/modules/server#functionreference) or [FunctionReference\_future](/api/modules/server#functionreference_future), get
the return type of the function.

#### Type parameters

| Name | Type |
| :- | :- |
| `FuncRef` | extends [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `any`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`any`, `any`> \| [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`> |

***

### ValidatorTypeToReturnType

Ƭ **ValidatorTypeToReturnType**\<`T`>: `Promise`\<`NullToUndefinedOrNull`\<`T`>> | `NullToUndefinedOrNull`\<`T`>

#### Type parameters

| Name |
| :- |
| `T` |

***

### ApplicationSourceControl

Ƭ **ApplicationSourceControl**: (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `request`: \{ `action`: `"sync"` | `"check"` ; `collection`: `string` ; `source`: `string`  }) => `Promise`\<`boolean`>

#### Type declaration

▸ (`ctx`, `request`): `Promise`\<`boolean`>

The program's decision whether this caller may ask for a sync of, or a
connection check on, one source of an exposed synced collection
(`applicationQueries({ sourceControl })`). Whoever it allows spends
provider budget; the engine's coalescing and the connection's budget bound
that. It runs after `authorize` and the collection check, with the
caller's own context, and only `true` allows the request.

##### Parameters

| Name | Type |
| :- | :- |
| `ctx` | [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)> |
| `request` | `Object` |
| `request.action` | `"sync"` \| `"check"` |
| `request.collection` | `string` |
| `request.source` | `string` |

##### Returns

`Promise`\<`boolean`>

***

### CollectionNotificationKind

Ƭ **CollectionNotificationKind**: `Object`

A category whose events are rows of an exposed collection: the event names
the object it is about in `objectProperty` and carries its message in
`messageProperty`. With `tab`, the notice opens that object view tab with
the event itself as its detail.

#### Type declaration

| Name | Type |
| :- | :- |
| `label` | `string` |
| `eventCollection` | `string` |
| `objectCollection` | `string` |
| `objectProperty` | `string` |
| `messageProperty` | `string` |
| `tab?` | `string` |

***

### AppNoticeContent

Ƭ **AppNoticeContent**: `Object`

What a resolved category's event is, as the reader may see it now. The
message is cut to APP\_NOTICE\_MESSAGE\_MAX characters. An object
subject names an exposed collection's object, which is titled through the
reader's own read of it; a page subject names a workspace page by its
kebab-case id, the route it opens and its title (at most 200 characters are
shown).

#### Type declaration

| Name | Type |
| :- | :- |
| `message` | `string` |
| `subject` | \{ `kind`: `"object"` ; `collection`: `string` ; `id`: `string` ; `tab?`: `string` ; `detail?`: `string`  } \| \{ `kind`: `"page"` ; `page`: `string` ; `route?`: `AppNoticeRoute` ; `title`: `string`  } |

***

### ResolvedNotificationKind

Ƭ **ResolvedNotificationKind**: `Object`

A category resolved by product code. `resolve` runs inside the reader's own
notification query and updates, with the READER's context and current
authority, and answers the notice or null to omit it. It may make at most
one protected read for an object subject (the object is read once more to
title it) and two for a page subject: a notification is budgeted
READ\_SUBJECTS\_PER\_NOTIFICATION read subjects, its delivery row
included, and a query beyond the engine's bound fails whole. An answer that
does not have the shape above is omitted like null.

#### Type declaration

| Name | Type |
| :- | :- |
| `label` | `string` |
| `resolve` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `event`: `string`) => `Promise`\<[`AppNoticeContent`](/api/modules/server#appnoticecontent) \| `null`> |

***

### ApplicationNotificationKind

Ƭ **ApplicationNotificationKind**: [`CollectionNotificationKind`](/api/modules/server#collectionnotificationkind) | [`ResolvedNotificationKind`](/api/modules/server#resolvednotificationkind)

***

### ApplicationNotifications

Ƭ **ApplicationNotifications**: `Object`

Customer-owned delivery state referencing authoritative business events.

`table` is a private table with `by_recipient_read` and
`by_recipient_archive` indexes whose rows are
[applicationNotificationRow](/api/modules/server#applicationnotificationrow)s. `kinds` declares at most sixteen
categories, each keyed by a kebab-case identifier. The in-app recipient is
the caller's own person (`applicationQueries({ people })`).

#### Type declaration

| Name | Type |
| :- | :- |
| `table` | `string` |
| `kinds` | `Record`\<`string`, [`ApplicationNotificationKind`](/api/modules/server#applicationnotificationkind)> |
| `recipient?` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>) => `Promise`\<`string` \| `null`> |

***

### ApplicationPeople

Ƭ **ApplicationPeople**: `Object`

Who the application's people are: the one identity every recipient,
grantee, author and mention names.

`collection` is an exposed collection whose objects are the people. It
declares `search`, so a person can be found by name, it is not a connection
type, and its title property is a person's name: names are read through
it under the reader's rules, never stored beside an id.

`self` answers the signed-in caller's own person: the id of their object in
`collection`, or null when the caller is not one of its people. It runs
after `authorize`, with the caller's context, so its reads are the caller's.

#### Type declaration

| Name | Type |
| :- | :- |
| `collection` | `string` |
| `self` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>) => `Promise`\<`string` \| `null`> |

***

### AppPlace

Ƭ **AppPlace**: `Object`

One place a location search found: WGS84 `[longitude, latitude]`, how
precise the match is, and the provider's attribution text.

#### Type declaration

| Name | Type |
| :- | :- |
| `label` | `string` |
| `position` | \[`number`, `number`] |
| `precision` | `"address"` \| `"street"` \| `"locality"` \| `"region"` |
| `attribution` | `string` |

***

### AppPlaceSearch

Ƭ **AppPlaceSearch**: \{ `status`: `"pending"`  } | \{ `status`: `"answered"` ; `places`: [`AppPlace`](/api/modules/server#appplace)\[]  } | \{ `status`: `"failed"` | `"unknown"` ; `message`: `string`  }

A durable location search as its reader answers it: still pending,
answered with at most APP\_PLACES places, or failed / of unknown
outcome with the provider's message.

***

### ApplicationPlaces

Ƭ **ApplicationPlaces**: `Object`

A program's location search (`applicationQueries({ places })`). A search is
durable intent: `request` records it under the caller in the calling
mutation and the program's own scheduled work asks its provider, so the
browser never holds a provider key; `read` answers the recorded request
reactively. Both run in the application's functions with the caller's
authority, after the application's `authorize`.

#### Type declaration

| Name | Type |
| :- | :- |
| `request` | (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `text`: `string`) => `Promise`\<`string`> |
| `read` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `id`: `string`) => `Promise`\<`null` \| [`AppPlaceSearch`](/api/modules/server#appplacesearch)> |

***

### ApplicationMapValues

Ƭ **ApplicationMapValues**: `Record`\<`string`, \{ `collection`: `string` ; `label`: `string` ; `values`: (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `ids`: `string`\[]) => `Promise`\<`Record`\<`string`, `null` | `string` | `number`>>  }>

Values a program computes for map styling (Foundry function-backed
styling), by name: each belongs to one exposed collection and answers for
the ids it is given. The `mapValues` query reads every object through the
ordinary authorized read first and passes only readable ids.

***

### AppSpatialBound

Ƭ **AppSpatialBound**: `Object`

What an index may spend reading. `subjects` is the read-access budget of a
collection read under per-row access checks, null for a collection read
without them. The engine records one subject per distinct range demand (a
range's equalities) and `rowCost` per distinct row visited, matching or
not.

#### Type declaration

| Name | Type |
| :- | :- |
| `subjects` | `number` \| `null` |
| `rowCost` | `number` |

***

### AppSpatialIndex

Ƭ **AppSpatialIndex**: `Object`

A program's spatial index over one declared geometry property: the reads
that answer the property's spatial clauses. Each runs with ordinary reads of
the collection in the calling query, under the caller's authority.

* `kind`: `points` for a point property (regions of every kind by
  `intersects` and `disjoint`, nearest objects, cells), `shapes` for any
  other (box and polygon regions by every mode).
* `table`: the collection the index reads, which is the collection it
  answers for: its reads are the collection's own, under its read rule.
* `index`: the index of `table` its range reads use; the engine's row cost
  for it bounds them, and an index the engine reports unbounded refuses
  every clause.
* `cells`: the grid systems `cellOf` answers (none for `shapes`).
* `select`: the objects of the collection whose value relates to `region`
  by `mode`, at most `limit`, in any order, as the index's reads returned
  them. `isComplete: false` when more may match or the reads could not
  cover the region within `subjects`; the application then refuses the
  scope rather than answering from part of it. An object without a value
  matches no mode.
* `nearest`: the `k` located objects nearest `center` within `maxMetres`,
  nearest first (ties by id), with their distances in metres, or fewer when
  fewer exist; `isComplete: false` when the ranking could not be proven
  within `subjects`. A `shapes` index refuses it.
* `cellOf`: the cell of `grouping` holding one object's point value, or
  null when it has none (a `shapes` index answers null).

#### Type declaration

| Name | Type |
| :- | :- |
| `kind` | `"points"` \| `"shapes"` |
| `table` | `string` |
| `index` | `string` |
| `cells` | `AppCellSystem`\[] |
| `select` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `query`: \{ `region`: `AppRegion` ; `mode`: `AppSpatialMode`  }, `bound`: [`AppSpatialBound`](/api/modules/server#appspatialbound) & \{ `limit`: `number`  }) => `Promise`\<\{ `objects`: [`GenericDocument`](/api/modules/server#genericdocument)\[] ; `isComplete`: `boolean`  }> |
| `nearest` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `query`: \{ `center`: \[`number`, `number`] ; `k`: `number` ; `maxMetres`: `number`  }, `bound`: [`AppSpatialBound`](/api/modules/server#appspatialbound)) => `Promise`\<\{ `ranked`: \{ `object`: [`GenericDocument`](/api/modules/server#genericdocument) ; `distanceMetres`: `number`  }\[] ; `isComplete`: `boolean`  }> |
| `cellOf` | (`value`: `AppGeometry`, `grouping`: `AppCellGrouping`) => `null` \| `string` |

***

### AppSpatialIndexes

Ƭ **AppSpatialIndexes**: `Record`\<`string`, `Record`\<`string`, [`AppSpatialIndex`](/api/modules/server#appspatialindex)>>

Spatial indexes by collection and declared geometry property.

***

### AuditLogBody

Ƭ **AuditLogBody**: `Object`

#### Index signature

▪ \[key: `string`]: [`AuditLogValue`](/api/modules/server#auditlogvalue)

***

### AuditLogValue

Ƭ **AuditLogValue**: `null` | `undefined` | `boolean` | `number` | `string` | `LogVar` | [`AuditLogValue`](/api/modules/server#auditlogvalue)\[] | \{ `[key: string]`: [`AuditLogValue`](/api/modules/server#auditlogvalue);  }

***

### AuthConfig

Ƭ **AuthConfig**: `Object`

The value exported by your Bijection project in `auth.config.ts`.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { AuthConfig } from "bijection/server";

export default {
  providers: [
    {
      domain: "https://your.issuer.url.com",
      applicationID: "your-application-id",
    },
  ],
} satisfies AuthConfig;
```

#### Type declaration

| Name | Type |
| :- | :- |
| `providers` | [`AuthProvider`](/api/modules/server#authprovider)\[] |

***

### AuthProvider

Ƭ **AuthProvider**: \{ `applicationID`: `string` ; `domain`: `string`  } | \{ `type`: `"customJwt"` ; `applicationID?`: `string` ; `issuer`: `string` ; `jwks`: `string` ; `algorithm`: `"RS256"` | `"ES256"`  }

An authentication provider allowed to issue JWTs for your app.

See: [https://docs.bijection.com/auth/advanced/custom-auth](/auth/advanced/custom-auth) and [https://docs.bijection.com/auth/advanced/custom-jwt](/auth/advanced/custom-jwt)

***

### FunctionHandle

Ƭ **FunctionHandle**\<`Type`, `Args`, `ReturnType`>: `string` & [`FunctionReference`](/api/modules/server#functionreference)\<`Type`, `"internal"`, `Args`, `ReturnType`>

A serializable reference to a Bijection function.
Passing a this reference to another component allows that component to call this
function during the current function execution or at any later time.
Function handles are used like `api.folder.function` FunctionReferences,
e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.

A function reference is stable across code pushes but it's possible
the Bijection function it refers to might no longer exist.

This is a feature of components, which are in beta.
This API is unstable and may change in subsequent releases.

#### Type parameters

| Name | Type |
| :- | :- |
| `Type` | extends [`FunctionType`](/api/modules/server#functiontype) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) = `any` |
| `ReturnType` | `any` |

***

### ComponentDefinition

Ƭ **ComponentDefinition**\<`Exports`, `Env`>: `Object`

An object of this type should be the default export of a
bijection.config.ts file in a component definition directory.

This is a feature of components, which are in beta.
This API is unstable and may change in subsequent releases.

#### Type parameters

| Name | Type |
| :- | :- |
| `Exports` | extends `ComponentExports` = `any` |
| `Env` | extends [`EnvDefinition`](/api/modules/server#envdefinition) = \{} |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `use` | \<Definition>(`definition`: `Definition`, ...`args`: `UseArgs`\<`Definition`>) => `InstalledComponent`\<`Definition`> | Install a component with the given definition in this component definition. Takes a component definition and an optional name. For editor tooling this method expects a [ComponentDefinition](/api/modules/server#componentdefinition) but at runtime the object that is imported will be a ImportedComponentDefinition |
| `__exports` | `Exports` | Internal type-only property tracking exports provided. **`Deprecated`** This is a type-only property, don't use it. |
| `env` | `EnvRefFromDefinition`\<`Env`> | References to this component's declared env vars. Pass one of these in `app.use(child, { env: { ... } })` to bind a child's env var by reference to this component's env var. |
| `__env` | `Env` | Internal type-only property tracking env definition. **`Deprecated`** This is a type-only property, don't use it. |

***

### EnvDefinition

Ƭ **EnvDefinition**: `Record`\<`string`, `StringLikeValidator` | [`VOptional`](/api/modules/values#voptional)\<`StringLikeValidator`>>

A definition of environment variables for the app.

Maps environment variable names to string-like validators. Use
`v.string()` for a plain string, `v.literal("a")` for an enum value, or
`v.union(v.literal("a"), v.literal("b"))` for an enum. Wrap in
`v.optional(...)` for optional vars.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { defineApp } from "bijection/server";
import { v } from "bijection/values";

const app = defineApp({
  env: {
    OPENAI_API_KEY: v.string(),
    DEBUG_MODE: v.optional(v.string()),
  },
});
```

***

### EnvFromDefinition

Ƭ **EnvFromDefinition**\<`E`>: [`Expand`](/api/modules/server#expand)\<\{ \[K in keyof E as E\[K] extends Validator\<any, "optional", any> ? never : K]: Infer\<E\[K]> } & \{ \[K in keyof E as E\[K] extends Validator\<any, "optional", any> ? K : never]?: Infer\<E\[K]> }>

Compute the typed environment object from an [EnvDefinition](/api/modules/server#envdefinition).

Required entries get the validator's inferred string type; optional
entries are `T | undefined`.

#### Type parameters

| Name | Type |
| :- | :- |
| `E` | extends [`EnvDefinition`](/api/modules/server#envdefinition) |

***

### EnvFromAppDefinition

Ƭ **EnvFromAppDefinition**\<`A`>: `A` extends [`AppDefinition`](/api/modules/server#appdefinition)\<infer E> ? [`EnvFromDefinition`](/api/modules/server#envfromdefinition)\<`E`> : `Record`\<`string`, `never`>

Extract the typed environment from an [AppDefinition](/api/modules/server#appdefinition).

#### Type parameters

| Name |
| :- |
| `A` |

***

### AppDefinition

Ƭ **AppDefinition**\<`Env`>: `Object`

An object of this type should be the default export of a
bijection.config.ts file in a component-aware bijection directory.

This is a feature of components, which are in beta.
This API is unstable and may change in subsequent releases.

#### Type parameters

| Name | Type |
| :- | :- |
| `Env` | extends [`EnvDefinition`](/api/modules/server#envdefinition) = [`EnvDefinition`](/api/modules/server#envdefinition) |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `use` | \<Definition>(`definition`: `Definition`, ...`args`: `UseArgs`\<`Definition`>) => `InstalledComponent`\<`Definition`> | Install a component with the given definition in this component definition. Takes a component definition and an optional name. For editor tooling this method expects a [ComponentDefinition](/api/modules/server#componentdefinition) but at runtime the object that is imported will be a ImportedComponentDefinition |
| `env` | `EnvRefFromDefinition`\<`Env`> | References to this app's declared env vars. Pass one of these in `app.use(child, { env: { ... } })` to bind a child's env var by reference to this app's env var. |
| `__env` | `Env` | Internal type-only property tracking env definition. **`Deprecated`** This is a type-only property, don't use it. |

***

### AnyChildComponents

Ƭ **AnyChildComponents**: `Record`\<`string`, `AnyComponentReference`>

***

### AnyComponents

Ƭ **AnyComponents**: [`AnyChildComponents`](/api/modules/server#anychildcomponents)

***

### UploadCompletionReference

Ƭ **UploadCompletionReference**: [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `"public"` | `"internal"`, \{ `file`: [`GenericId`](/api/modules/values#genericid)\<`"_storage"`>  }>

A mutation that attaches a newly uploaded file: it receives the file as
`file` beside the arguments its preparation named.

***

### BijectionQueryBuilder

Ƭ **BijectionQueryBuilder**\<`DM`, `V`>: `BijectionFunctionBuilder`\<`DM`, `V`, `"query"`>

#### Type parameters

| Name | Type |
| :- | :- |
| `DM` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `V` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |

***

### BijectionMutationBuilder

Ƭ **BijectionMutationBuilder**\<`DM`, `V`>: `BijectionFunctionBuilder`\<`DM`, `V`, `"mutation"`>

#### Type parameters

| Name | Type |
| :- | :- |
| `DM` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `V` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |

***

### BijectionActionBuilder

Ƭ **BijectionActionBuilder**\<`DM`, `V`>: `BijectionFunctionBuilder`\<`DM`, `V`, `"action"`>

#### Type parameters

| Name | Type |
| :- | :- |
| `DM` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `V` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |

***

### GenericDocument

Ƭ **GenericDocument**: `Record`\<`string`, [`Value`](/api/modules/values#value)>

A document stored in Bijection.

***

### GenericFieldPaths

Ƭ **GenericFieldPaths**: `string`

A type describing all of the document fields in a table.

These can either be field names (like "name") or references to fields on
nested objects (like "properties.name").

***

### GenericIndexFields

Ƭ **GenericIndexFields**: `string`\[]

A type describing the ordered fields in an index.

These can either be field names (like "name") or references to fields on
nested objects (like "properties.name").

***

### GenericTableIndexes

Ƭ **GenericTableIndexes**: `Record`\<`string`, [`GenericIndexFields`](/api/modules/server#genericindexfields)>

A type describing the indexes in a table.

It's an object mapping each index name to the fields in the index.

***

### GenericSearchIndexConfig

Ƭ **GenericSearchIndexConfig**: `Object`

A type describing the configuration of a search index.

#### Type declaration

| Name | Type |
| :- | :- |
| `searchField` | `string` |
| `filterFields` | `string` |

***

### GenericTableSearchIndexes

Ƭ **GenericTableSearchIndexes**: `Record`\<`string`, [`GenericSearchIndexConfig`](/api/modules/server#genericsearchindexconfig)>

A type describing all of the search indexes in a table.

This is an object mapping each index name to the config for the index.

***

### GenericVectorIndexConfig

Ƭ **GenericVectorIndexConfig**: `Object`

A type describing the configuration of a vector index.

#### Type declaration

| Name | Type |
| :- | :- |
| `vectorField` | `string` |
| `dimensions` | `number` |
| `filterFields` | `string` |

***

### GenericTableVectorIndexes

Ƭ **GenericTableVectorIndexes**: `Record`\<`string`, [`GenericVectorIndexConfig`](/api/modules/server#genericvectorindexconfig)>

A type describing all of the vector indexes in a table.

This is an object mapping each index name to the config for the index.

***

### FieldTypeFromFieldPath

Ƭ **FieldTypeFromFieldPath**\<`Document`, `FieldPath`>: [`FieldTypeFromFieldPathInner`](/api/modules/server#fieldtypefromfieldpathinner)\<`Document`, `FieldPath`> extends [`Value`](/api/modules/values#value) | `undefined` ? [`FieldTypeFromFieldPathInner`](/api/modules/server#fieldtypefromfieldpathinner)\<`Document`, `FieldPath`> : [`Value`](/api/modules/values#value) | `undefined`

The type of a field in a document.

Note that this supports both simple fields like "name" and nested fields like
"properties.name".

If the field is not present in the document it is considered to be `undefined`.

#### Type parameters

| Name | Type |
| :- | :- |
| `Document` | extends [`GenericDocument`](/api/modules/server#genericdocument) |
| `FieldPath` | extends `string` |

***

### FieldTypeFromFieldPathInner

Ƭ **FieldTypeFromFieldPathInner**\<`Document`, `FieldPath`>: `FieldPath` extends \`$\{infer First}.$\{infer Second}\` ? `ValueFromUnion`\<`Document`, `First`, `Record`\<`never`, `never`>> extends infer FieldValue ? `FieldValue` extends [`GenericDocument`](/api/modules/server#genericdocument) ? [`FieldTypeFromFieldPath`](/api/modules/server#fieldtypefromfieldpath)\<`FieldValue`, `Second`> : `undefined` : `undefined` : `ValueFromUnion`\<`Document`, `FieldPath`, `undefined`>

The inner type of [FieldTypeFromFieldPath](/api/modules/server#fieldtypefromfieldpath).

It's wrapped in a helper to coerce the type to `Value | undefined` since some
versions of TypeScript fail to infer this type correctly.

#### Type parameters

| Name | Type |
| :- | :- |
| `Document` | extends [`GenericDocument`](/api/modules/server#genericdocument) |
| `FieldPath` | extends `string` |

***

### GenericTableInfo

Ƭ **GenericTableInfo**: `Object`

A type describing the document type and indexes in a table.

#### Type declaration

| Name | Type |
| :- | :- |
| `document` | [`GenericDocument`](/api/modules/server#genericdocument) |
| `fieldPaths` | [`GenericFieldPaths`](/api/modules/server#genericfieldpaths) |
| `indexes` | [`GenericTableIndexes`](/api/modules/server#generictableindexes) |
| `searchIndexes` | [`GenericTableSearchIndexes`](/api/modules/server#generictablesearchindexes) |
| `vectorIndexes` | [`GenericTableVectorIndexes`](/api/modules/server#generictablevectorindexes) |

***

### DocumentByInfo

Ƭ **DocumentByInfo**\<`TableInfo`>: `TableInfo`\[`"document"`]

The type of a document in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### FieldPaths

Ƭ **FieldPaths**\<`TableInfo`>: `TableInfo`\[`"fieldPaths"`]

The field paths in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

These can either be field names (like "name") or references to fields on
nested objects (like "properties.name").

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### Indexes

Ƭ **Indexes**\<`TableInfo`>: `TableInfo`\[`"indexes"`]

The database indexes in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

This will be an object mapping index names to the fields in the index.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### IndexNames

Ƭ **IndexNames**\<`TableInfo`>: keyof [`Indexes`](/api/modules/server#indexes)\<`TableInfo`>

The names of indexes in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### NamedIndex

Ƭ **NamedIndex**\<`TableInfo`, `IndexName`>: [`Indexes`](/api/modules/server#indexes)\<`TableInfo`>\[`IndexName`]

Extract the fields of an index from a [GenericTableInfo](/api/modules/server#generictableinfo) by name.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |
| `IndexName` | extends [`IndexNames`](/api/modules/server#indexnames)\<`TableInfo`> |

***

### SearchIndexes

Ƭ **SearchIndexes**\<`TableInfo`>: `TableInfo`\[`"searchIndexes"`]

The search indexes in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

This will be an object mapping index names to the search index config.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### SearchIndexNames

Ƭ **SearchIndexNames**\<`TableInfo`>: keyof [`SearchIndexes`](/api/modules/server#searchindexes)\<`TableInfo`>

The names of search indexes in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### NamedSearchIndex

Ƭ **NamedSearchIndex**\<`TableInfo`, `IndexName`>: [`SearchIndexes`](/api/modules/server#searchindexes)\<`TableInfo`>\[`IndexName`]

Extract the config of a search index from a [GenericTableInfo](/api/modules/server#generictableinfo) by name.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |
| `IndexName` | extends [`SearchIndexNames`](/api/modules/server#searchindexnames)\<`TableInfo`> |

***

### VectorIndexes

Ƭ **VectorIndexes**\<`TableInfo`>: `TableInfo`\[`"vectorIndexes"`]

The vector indexes in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

This will be an object mapping index names to the vector index config.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### VectorIndexNames

Ƭ **VectorIndexNames**\<`TableInfo`>: keyof [`VectorIndexes`](/api/modules/server#vectorindexes)\<`TableInfo`>

The names of vector indexes in a table for a given [GenericTableInfo](/api/modules/server#generictableinfo).

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |

***

### NamedVectorIndex

Ƭ **NamedVectorIndex**\<`TableInfo`, `IndexName`>: [`VectorIndexes`](/api/modules/server#vectorindexes)\<`TableInfo`>\[`IndexName`]

Extract the config of a vector index from a [GenericTableInfo](/api/modules/server#generictableinfo) by name.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableInfo` | extends [`GenericTableInfo`](/api/modules/server#generictableinfo) |
| `IndexName` | extends [`VectorIndexNames`](/api/modules/server#vectorindexnames)\<`TableInfo`> |

***

### GenericDataModel

Ƭ **GenericDataModel**: `Record`\<`string`, [`GenericTableInfo`](/api/modules/server#generictableinfo)>

A type describing the tables in a Bijection project.

This is designed to be code generated with `bijection dev`.

***

### AnyDataModel

Ƭ **AnyDataModel**: `Object`

A [GenericDataModel](/api/modules/server#genericdatamodel) that considers documents to be `any` and does not
support indexes.

This is the default before a schema is defined.

#### Index signature

▪ \[tableName: `string`]: \{ `document`: `any` ; `fieldPaths`: [`GenericFieldPaths`](/api/modules/server#genericfieldpaths) ; `indexes`: [`SystemIndexes`](/api/modules/server#systemindexes) ; `searchIndexes`: \{} ; `vectorIndexes`: \{}  }

***

### TableNamesInDataModel

Ƭ **TableNamesInDataModel**\<`DataModel`>: keyof `DataModel` & `string`

A type of all of the table names defined in a [GenericDataModel](/api/modules/server#genericdatamodel).

#### Type parameters

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

***

### NamedTableInfo

Ƭ **NamedTableInfo**\<`DataModel`, `TableName`>: `DataModel`\[`TableName`]

Extract the `TableInfo` for a table in a [GenericDataModel](/api/modules/server#genericdatamodel) by table
name.

#### Type parameters

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

***

### DocumentByName

Ƭ **DocumentByName**\<`DataModel`, `TableName`>: `DataModel`\[`TableName`]\[`"document"`]

The type of a document in a [GenericDataModel](/api/modules/server#genericdatamodel) by table name.

#### Type parameters

| Name | Type |
| :- | :- |
| `DataModel` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `TableName` | extends [`TableNamesInDataModel`](/api/modules/server#tablenamesindatamodel)\<`DataModel`> |

***

### WritableTableNames

Ƭ **WritableTableNames**\<`DataModel`>: \{ \[Name in TableNamesInDataModel\<DataModel>]: DataModel\[Name] extends Object ? never : Name }\[[`TableNamesInDataModel`](/api/modules/server#tablenamesindatamodel)\<`DataModel`>]

Tables accepting ordinary application writes according to generated ownership metadata.

#### Type parameters

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

***

### TableKey

Ƭ **TableKey**\<`DataModel`, `Name`>: `0` extends `1` & `DataModel`\[`Name`] ? [`GenericId`](/api/modules/values#genericid)\<`Name`> : `DataModel`\[`Name`] extends \{ `key`: infer Key  } ? `Key` : [`GenericId`](/api/modules/values#genericid)\<`Name`>

Key accepted by a table-qualified read. A keyed view preserves its authoritative key domain.

#### Type parameters

| Name | Type |
| :- | :- |
| `DataModel` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `Name` | extends [`TableNamesInDataModel`](/api/modules/server#tablenamesindatamodel)\<`DataModel`> |

***

### ExternalCallStatus

Ƭ **ExternalCallStatus**: `"pending"` | `"held"` | `"unknown"` | `"delivered"` | `"refused"` | `"indeterminate"` | `"delivered_unacknowledged"` | `"not_applied"` | `"duplicated"` | `"superseded"`

Where a governed external call stands, as the operations owner records it.

* `pending`: persisted, not yet delivered.
* `held`: waiting on its ordering domain or an approval.
* `unknown`: a dispatch's outcome could not be established; it stays unknown
  until reconciled, and is never read as a failure.
* `delivered`, `refused`: the destination's settled answer.
* `indeterminate`, `delivered_unacknowledged`, `not_applied`, `duplicated`:
  what reconciliation established when the answer itself was not proof.
* `superseded`: replaced by a later operation.

The provider's own name for a refusal never crosses.

***

### ExpressionOrValue

Ƭ **ExpressionOrValue**\<`T`>: [`Expression`](/api/classes/server.Expression)\<`T`> | `T`

An [Expression](/api/classes/server.Expression) or a constant [Value](/api/modules/values#value)

#### Type parameters

| Name | Type |
| :- | :- |
| `T` | extends [`Value`](/api/modules/values#value) \| `undefined` |

***

### AccessFields

Ƭ **AccessFields**: readonly `string`\[] | `"rest"`

The fields a permission covers: a list, or every field no other
permission of the same map lists.

***

### AccessRowGrant

Ƭ **AccessRowGrant**: `string` | \{ `role`: `string` ; `members`: \{ `type`: `string` ; `permission`: `string`  }  }

A field of a row that names users or groups and so confers a role on
them: a grant stored in the row.

***

### AccessTypeDefinition

Ƭ **AccessTypeDefinition**: `Object`

One object type.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `table?` | `string` | The table backing the type. Omit it for a key-only type such as an organization or a group, whose objects exist only as grant keys. |
| `parent?` | \{ `field`: `string` ; `type`: `string` ; `index?`: `string`  } | The field naming the parent object, the parent's type, and the index (default `by_<field>`) pinning the field. A type without a parent is a child of the root. Key-only types cannot declare a parent. |
| `parent.field` | `string` | - |
| `parent.type` | `string` | - |
| `parent.index?` | `string` | - |
| `permissions?` | readonly `string`\[] | Additional permission names beyond the read and write maps, `create`, `delete` and one `grant.<role>` per role of the type, which are implied. |
| `read?` | `Record`\<`string`, [`AccessFields`](/api/modules/server#accessfields)> | Read permissions by the fields they cover. Every field belongs to exactly one; the one covering `_id` decides whether an object is visible at all. Default: `{ read: "rest" }`. |
| `write?` | `Record`\<`string`, [`AccessFields`](/api/modules/server#accessfields)> | Write permissions by the fields they cover. Default: `{ edit: "rest" }`. |
| `restrictions?` | \{ `root?`: \{ `type`: `string` ; `category`: `string`  } ; `field?`: \{ `name`: `string` ; `type`: `string`  }  } | Restrictions: the tenant root the caller must pass, and a field listing restricting objects (markings). Inherited by descendants. Both restricting types are children of the root. |
| `restrictions.root?` | \{ `type`: `string` ; `category`: `string`  } | - |
| `restrictions.root.type` | `string` | - |
| `restrictions.root.category` | `string` | - |
| `restrictions.field?` | \{ `name`: `string` ; `type`: `string`  } | - |
| `restrictions.field.name` | `string` | - |
| `restrictions.field.type` | `string` | - |
| `category?` | `string` \| \{ `from`: `"key"`  } | For a type whose objects restrict others: the category of each object, fixed or taken from the key prefix before `:`. |
| `rowGrants?` | `Record`\<`string`, [`AccessRowGrant`](/api/modules/server#accessrowgrant)> | Row fields that confer a role, keyed by field name. A string names a role of this type conferred on the user keys the field holds. |
| `holders?` | `string` | A permission of this type whose holders may see who holds grants on an object. Without it, only holders of a `grant.*` permission may. |

***

### AccessRoleDefinition

Ƭ **AccessRoleDefinition**: readonly `string`\[] | \{ `permissions`: readonly `string`\[] ; `maxDuration?`: `number` ; `justification?`: `boolean` ; `selfGrant?`: `string`  }

A role: the permissions it bundles, as `type:name`, `type:*` or
`type:grant.*`, on its own type and descendant types. A role may bound
the duration of its grants, require a written reason on each, and let
holders of a permission of its type grant it to themselves: just-in-time
access, which must then be bounded and justified, and which ends no later
than the holder's own grant of that permission.

***

### AccessDirectory

Ƭ **AccessDirectory**: `Object`

A source-owned table of identity-provider memberships conferring `role`
on `(member, object)` pairs. `index` covers `[member, object]`.

A row confers its role only while the source that published it (its
`source_id`) has completed an acquisition, has not lost continuity, and
was last observed less than `maxAge` milliseconds ago, read through
`ctx.sources.coverage`. A removal the provider exposes at time t therefore
takes effect by t + `maxAge` at the latest, whether or not the sync runs,
and a decision relying on a membership is valid until its source's
observation is `maxAge` old. An observation stamped later than the
decision's clock counts as made then, so no decision outlasts `maxAge`
from now. A row without a source, or a context without `sources`, confers
nothing.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `table` | `string` | - |
| `index` | `string` | - |
| `type` | `string` | - |
| `role` | `string` | - |
| `object` | `string` | - |
| `member` | `string` | - |
| `maxAge` | `number` | How old, in milliseconds, the source's newest observation may be for its rows to confer the role: 1 s to 365 days. |

***

### AccessDirectoryCoverage

Ƭ **AccessDirectoryCoverage**: `Pick`\<[`SourceCoverage`](/api/modules/server#sourcecoverage), `"acquired"` | `"observedTo"` | `"continuityLost"`>

What a directory's freshness rule reads of a source's coverage.

***

### AccessRoleDefinitions

Ƭ **AccessRoleDefinitions**: `Object`

Roles tenants define as rows of `table`, each scoped to one object of the
`scope` type, which must be a tenant root type. Defining one needs
`defineRoles` on the scope object and every permission it bundles there,
held, for a permission added to a role already granted, at least as long
as those grants last; granting one needs `grant.custom` on the
object.

#### Type declaration

| Name | Type |
| :- | :- |
| `table` | `string` |
| `scope` | `string` |

***

### RoleDefinitionDocument

Ƭ **RoleDefinitionDocument**: `Object`

One tenant-defined role: the permissions, as `type:name`, of a role of
`type` usable on objects under the scope object `scope`. `maxDuration`
bounds its grants as a declared role's does: each must expire within it,
and recertifying one renews it for at most that long.

#### Type declaration

| Name | Type |
| :- | :- |
| `_id` | [`GenericId`](/api/modules/values#genericid)\<`string`> |
| `scope` | `string` |
| `type` | `string` |
| `name` | `string` |
| `permissions` | `string`\[] |
| `maxDuration?` | `number` |

***

### AccessModelDefinition

Ƭ **AccessModelDefinition**: `Object`

The whole declaration.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `grants?` | `string` | The grants table name. Default `grants`. |
| `categories?` | `Record`\<`string`, `"all"` \| `"any"`> | Restriction categories: `all` requires passing every restricting object of the category, `any` at least one of each set of them an object of the chain carries. Adding a marking to an object's non-empty `any` set widens it, so it needs `declassify` on each marking the set held as well as `apply` on the new one. |
| `types` | `Record`\<`string`, [`AccessTypeDefinition`](/api/modules/server#accesstypedefinition)> | - |
| `roles` | `Record`\<`string`, [`AccessRoleDefinition`](/api/modules/server#accessroledefinition)> | - |
| `groups?` | \{ `types?`: readonly `string`\[] ; `depth?`: `number`  } | Types whose members can be grant principals, and how deeply group principals may nest (1 to 3). |
| `groups.types?` | readonly `string`\[] | - |
| `groups.depth?` | `number` | - |
| `directories?` | readonly [`AccessDirectory`](/api/modules/server#accessdirectory)\[] | - |
| `roleDefinitions?` | [`AccessRoleDefinitions`](/api/modules/server#accessroledefinitions) | - |
| `claims?` | `Record`\<`string`, [`AccessClaimType`](/api/modules/server#accessclaimtype)> | Claims of the verified token the model reads, by name and type. The identity provider asserts them: authentication strength, a declared purpose, the network or device a session came from. |
| `conditions?` | `Record`\<`string`, \{ `when`: `string` ; `on?`: readonly `string`\[]  }> | Conditions on claims, by name: `when` in the Cedar expression subset over `context.<claim>`, guarding the listed permissions (`type:name` or `type:*`), or every permission when `on` is omitted. A condition whose claims are absent or of another type refuses. One guarding `T:pass` binds every decision an object of `T` restricts. |
| `requestScope?` | \{ `objects?`: `string` ; `permissions?`: `string`  } | Claims narrowing a request below the caller's grants: `objects` names a claim listing `type:key` objects every decision must fall under, and `permissions` a claim listing the only permissions it may use. Absent claims narrow nothing; a malformed one refuses everything. Neither applies to the pass a restriction decision relies on: its resource is the restricting object, not the decided one. |
| `requestScope.objects?` | `string` | - |
| `requestScope.permissions?` | `string` | - |
| `audit?` | `boolean` | Record decisions made through `audited`, grant changes made through `grant`, `recertify`, `expireGrant` and `revokeAll`, and reminders found due by `reviewDue`, with `log.audit`: who, which object and permission, through which grant or row field, and why. |
| `users?` | \{ `table`: `string` ; `index`: `string` ; `user`: `string`  } | Resolve the caller to a local user key through an identity table instead of using `tokenIdentifier` itself. The table is keyed by `tokenIdentifier`, the verified issuer\|subject pair (`index` covers `[tokenIdentifier]`), and `user` names the field holding the local user key: a subject alone would let another issuer's user of the same subject hold this one's grants. Grants name the local user, so an issuer change re-associates identity rows and keeps every grant. |
| `users.table` | `string` | - |
| `users.index` | `string` | - |
| `users.user` | `string` | - |

***

### AccessCtx

Ƭ **AccessCtx**: `Object`

The context a rule or helper needs. Every query context satisfies it.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `auth` | [`Auth`](/api/interfaces/server.Auth) | - |
| `db` | [`GenericDatabaseReader`](/api/interfaces/server.GenericDatabaseReader)\<`any`> | - |
| `sources?` | [`Sources`](/api/interfaces/server.Sources) | The coverage of the sources that publish directory rows. Without it, no directory row confers a role. |
| `audit?` | (`body`: [`AuditLogBody`](/api/modules/server#auditlogbody)) => `Promise`\<`void`> | Where audit records go; `log.audit` unless given. |

***

### AccessMutationCtx

Ƭ **AccessMutationCtx**: `Object`

The context of the grant mutation helpers.

#### Type declaration

| Name | Type |
| :- | :- |
| `auth` | [`Auth`](/api/interfaces/server.Auth) |
| `db` | [`GenericDatabaseWriter`](/api/interfaces/server.GenericDatabaseWriter)\<`any`> |
| `scheduler` | [`Scheduler`](/api/interfaces/server.Scheduler) |
| `audit?` | (`body`: [`AuditLogBody`](/api/modules/server#auditlogbody)) => `Promise`\<`void`> |

***

### GrantDocument

Ƭ **GrantDocument**: `Object`

One stored grant.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `_id` | [`GenericId`](/api/modules/values#genericid)\<`string`> | - |
| `type` | `string` | - |
| `object` | `string` | - |
| `role` | `string` | - |
| `subjectKind` | `"user"` \| `"group"` | - |
| `subjectType` | `string` | - |
| `subject` | `string` | - |
| `subjectPermission?` | `string` | - |
| `expiresAt?` | `number` | - |
| `reason?` | `string` | Why the grant was made, required by roles that ask for one. |

***

### AccessPath

Ƭ **AccessPath**: \{ `via`: `"grant"` ; `on`: `string` ; `role`: `string` ; `principal`: `string`  } | \{ `via`: `"row"` ; `on`: `string` ; `role`: `string` ; `field`: `string`  } | \{ `via`: `"directory"` ; `on`: `string` ; `role`: `string` ; `table`: `string` ; `source`: `string` ; `until`: `number`  }

How a permission was reached, for `explain`. A directory path names the
source that published the membership and the instant its observation
becomes too old to rely on.

***

### AccessClaimType

Ƭ **AccessClaimType**: `"String"` | `"Long"` | `"Bool"` | `"Set<String>"` | `"Set<Long>"`

The type of a declared claim.

***

### GrantInput

Ƭ **GrantInput**: `Object`

A grant to insert through `grant`.

#### Type declaration

| Name | Type |
| :- | :- |
| `type` | `string` |
| `object` | `string` |
| `role` | `string` |
| `subject` | \{ `user`: `string`  } \| \{ `type`: `string` ; `key`: `string` ; `permission`: `string`  } |
| `expiresAt?` | `number` |
| `reason?` | `string` |

***

### GrantMutation

Ƭ **GrantMutation**: [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `"internal"`, \{ `id`: [`GenericId`](/api/modules/values#genericid)\<`string`>  }>

A product internal mutation taking a grant's id.

***

### GrantReminder

Ƭ **GrantReminder**: `Object`

A review reminder for a bounded grant: `notify`, the product's internal
mutation, runs `before` milliseconds ahead of the grant's expiry (at once
when that moment has passed) with the grant's id. It calls `reviewDue`
and commits the notice.

#### Type declaration

| Name | Type |
| :- | :- |
| `before` | `number` |
| `notify` | [`GrantMutation`](/api/modules/server#grantmutation) |

***

### GrantOptions

Ƭ **GrantOptions**: `Object`

How `grant` and `recertify` schedule a bounded grant's lapse, through
`expire`, the product's export of `expireGrant`, and its review reminder.

#### Type declaration

| Name | Type |
| :- | :- |
| `expire?` | [`GrantMutation`](/api/modules/server#grantmutation) |
| `remind?` | [`GrantReminder`](/api/modules/server#grantreminder) |

***

### AccessModel

Ƭ **AccessModel**: `ReturnType`\<typeof `buildModel`>

The declared model and everything derived from it.

***

### AccessCedarPolicies

Ƭ **AccessCedarPolicies**: `Object`

A model compiled to Cedar: a schema in Cedar's schema syntax, one template
per role and the static policies, all in Cedar's policy syntax. They depend
on the declaration only.

#### Type declaration

| Name | Type |
| :- | :- |
| `schema` | `string` |
| `templates` | `Record`\<`string`, `string`> |
| `policies` | `Record`\<`string`, `string`> |

***

### AccessCedarUid

Ƭ **AccessCedarUid**: `Object`

A Cedar entity reference in Cedar's JSON format.

#### Type declaration

| Name | Type |
| :- | :- |
| `type` | `string` |
| `id` | `string` |

***

### AccessCedarEntities

Ƭ **AccessCedarEntities**: `Object`

The Cedar data a world of rows determines, in Cedar's JSON formats: the
entities, one template per tenant-defined role and scope, and one template
link per live grant or directory row.

#### Type declaration

| Name | Type |
| :- | :- |
| `templates` | `Record`\<`string`, `string`> |
| `entities` | \{ `uid`: [`AccessCedarUid`](/api/modules/server#accesscedaruid) ; `attrs`: `Record`\<`string`, `unknown`> ; `parents`: [`AccessCedarUid`](/api/modules/server#accesscedaruid)\[]  }\[] |
| `templateLinks` | \{ `templateId`: `string` ; `newId`: `string` ; `values`: \{ `?principal`: [`AccessCedarUid`](/api/modules/server#accesscedaruid) ; `?resource`: [`AccessCedarUid`](/api/modules/server#accesscedaruid)  }  }\[] |

***

### ServiceName

Ƭ **ServiceName**: `"ai-gateway"`

A Bijection-managed service. The backend decides which names it accepts; this
type lists the ones the current release knows about.

***

### SetupSupplier

Ƭ **SetupSupplier**: `"administrator"` | `"account"`

Who is holding the answer.

`administrator` is deployment configuration: the person who deployed this
definition knows it, it is the same for every connection they make, and it
may be recorded. `account` is the connecting customer's own: their instance,
their region, their workspace. The distinction is not cosmetic -- it decides
who is asked, what may be retained and, for a value that reaches a URL, how
far it is allowed to move.

***

### SetupSlot

Ƭ **SetupSlot**: `"base_url"`

The one slot a setup value may fill beyond being recorded.

A value that fills `base_url` is rendered as `prefix + value + suffix` and
becomes the connection's base URL. That is the ONLY way a supplied value
reaches an address, and it is why the rendering is a template the definition
wrote rather than a string the supplier wrote: the supplier contributes one
host label inside an address they did not choose, and the result still has
to pass the deployment's ordinary base-URL confinement before any request is
built from it.

***

### SetupValidation

Ƭ **SetupValidation**: `Object`

What an admitted value has to look like.

`pattern` is matched against the WHOLE value; there is no need to anchor it
and no way to leave it unanchored. It is restricted to the constructs Rust's
regular expressions and JavaScript's agree on, because the same pattern is
compiled on both sides and a pattern that means two things is worse than no
pattern at all: lookaround and backreferences are refused at definition time.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `pattern?` | `string` | - |
| `allowed?` | readonly `string`\[] | The complete set of admitted values, for a choice rather than a format. |
| `minLength?` | `number` | - |
| `maxLength?` | `number` | - |

***

### SetupField

Ƭ **SetupField**: [`SetupValidation`](/api/modules/server#setupvalidation) & \{ `key`: `string` ; `supplier`: [`SetupSupplier`](/api/modules/server#setupsupplier) ; `label`: `string` ; `help?`: `string` ; `docUrl?`: `string` ; `example?`: `string` ; `prefix?`: `string` ; `suffix?`: `string` ; `secret?`: `boolean` ; `optional?`: `boolean` ; `derivable?`: `boolean` ; `fills?`: [`SetupSlot`](/api/modules/server#setupslot)  }

One thing a connection has to be told.

***

### SetupDeclaration

Ƭ **SetupDeclaration**: readonly [`SetupField`](/api/modules/server#setupfield)\[]

The declaration as it is written on an integration definition.

***

### SetupRefusal

Ƭ **SetupRefusal**: \{ `kind`: `"unknown_field"` ; `key`: `string`  } | \{ `kind`: `"missing_required"` ; `key`: `string`  } | \{ `kind`: `"pattern_mismatch"` ; `key`: `string`  } | \{ `kind`: `"not_allowed"` ; `key`: `string`  } | \{ `kind`: `"too_short"` ; `key`: `string` ; `minLength`: `number`  } | \{ `kind`: `"too_long"` ; `key`: `string` ; `maxLength`: `number`  } | \{ `kind`: `"secret_not_accepted"` ; `key`: `string`  } | \{ `kind`: `"slot_not_one_label"` ; `key`: `string`  } | \{ `kind`: `"not_account_supplied"` ; `key`: `string`  }

Why one supplied value was refused.

Exhaustive and typed on both sides of the boundary: the same variants are a
Rust enum the backend matches on, so a new kind of refusal is a compile
error rather than a new string nobody renders.

***

### SetupRequirement

Ƭ **SetupRequirement**: [`SetupField`](/api/modules/server#setupfield) & \{ `configured`: `boolean`  }

What the deployment says about one declared field when asked what a
connection still needs.

It carries the declaration and ONE fact about the deployment: whether the
value is already held. It never carries a value -- not a secret, and not a
recorded administrator value either, because a reader that does not need it
to fill a form does not need it at all.

***

### IntegrationAddress

Ƭ **IntegrationAddress**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `module` | `string` |
| `export` | `string` |

***

### SourceBinding

Ƭ **SourceBinding**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `version` | `1` |
| `integration` | [`IntegrationAddress`](/api/modules/server#integrationaddress) |
| `collection` | `string` |

***

### WirePath

Ƭ **WirePath**: readonly `string`\[]

Paths select own wire-object fields, never arbitrary guest expressions.

***

### HttpArgumentReference

Ƭ **HttpArgumentReference**: `Object`

A retained command argument, addressed by its own field path.

#### Type declaration

| Name | Type |
| :- | :- |
| `input` | `"argument"` |
| `path?` | [`WirePath`](/api/modules/server#wirepath) |

***

### HttpInputReference

Ƭ **HttpInputReference**: \{ `input`: `"checkpoint"` | `"resume"` | `"operation_id"` | `"expires_at"` | `"target_version"`  } | \{ `input`: `"target_key"` ; `path?`: [`WirePath`](/api/modules/server#wirepath)  } | \{ `input`: `"created_key"`  } | [`HttpArgumentReference`](/api/modules/server#httpargumentreference) | \{ `input`: `"parameter"` ; `path?`: [`WirePath`](/api/modules/server#wirepath)  }

***

### HttpInput

Ƭ **HttpInput**: \{ `kind`: `"input"`  } & [`HttpInputReference`](/api/modules/server#httpinputreference)

***

### HttpTemplate

Ƭ **HttpTemplate**: \{ `kind`: `"key_component"` ; `subject`: [`HttpInputReference`](/api/modules/server#httpinputreference) ; `index`: `number`  } | \{ `kind`: `"json_string"` ; `value`: [`HttpTemplate`](/api/modules/server#httptemplate)  } | \{ `kind`: `"host"` ; `value`: `"listener_channel_id"` | `"listener_callback_url"` | `"listener_expiration"` | `"listener_resource_id"` | `"listener_channel_token"`  } | \{ `kind`: `"resume_path"` ; `prefix`: `string`  } | \{ `kind`: `"literal"` ; `value`: [`JSONValue`](/api/modules/values#jsonvalue)  } | [`HttpInput`](/api/modules/server#httpinput) | \{ `kind`: `"object"` ; `fields`: `Record`\<`string`, [`HttpTemplate`](/api/modules/server#httptemplate)>  } | \{ `kind`: `"array"` ; `items`: readonly [`HttpTemplate`](/api/modules/server#httptemplate)\[]  }

***

### Selector

Ƭ **Selector**: \{ `kind`: `"header"` ; `name`: `string`  } | \{ `kind`: `"body"` ; `path?`: [`WirePath`](/api/modules/server#wirepath)  }

Where one piece of evidence is read in a retained response. A provider's
conditional token is often a header, so selection cannot assume a body.

***

### BodyContract

Ƭ **BodyContract**: \{ `kind`: `"none"`  } | \{ `kind`: `"json"` ; `validator`: [`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>  } | \{ `kind`: `"xml"` ; `validator`: [`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>  } | \{ `kind`: `"jsonl"` ; `validator`: [`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>  } | \{ `kind`: `"positional"` ; `schema`: [`WirePath`](/api/modules/server#wirepath) ; `name`: [`WirePath`](/api/modules/server#wirepath) ; `column_type`: [`WirePath`](/api/modules/server#wirepath) ; `rows`: [`WirePath`](/api/modules/server#wirepath) ; `cells`: [`WirePath`](/api/modules/server#wirepath) ; `value`: [`WirePath`](/api/modules/server#wirepath) ; `columns`: `Record`\<`string`, `string`> ; `validator`: [`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>  } | \{ `kind`: `"json_fields"` ; `fields`: readonly `string`\[] ; `optional_fields?`: readonly `string`\[]  } | \{ `kind`: `"json_batch"` ; `selection`: \{ `items`: [`WirePath`](/api/modules/server#wirepath) ; `fields`: readonly `string`\[] ; `max_records`: `number` ; `scan_key?`: `string` ; `string_fields?`: readonly [`WirePath`](/api/modules/server#wirepath)\[] ; `parents?`: \{ `path`: [`WirePath`](/api/modules/server#wirepath) ; `key`: [`WirePath`](/api/modules/server#wirepath) ; `child_key`: [`WirePath`](/api/modules/server#wirepath)  }  }  } | \{ `kind`: `"opaque"`  }

The body an admitted status carries. These are three different things.
`none` is no body at all: a successful empty 204 declares it, and bytes
arriving anyway violate the contract rather than being an empty success.
`json` must parse and match the validator; malformed bytes are invalid at
that status and never degrade to an empty success. `opaque` is bytes the
host retains without interpreting, such as a provider answering an ordinary
error with HTML or plain text. `opaque` is not "ignore any body": the status
is still evidence, and the body supplies no field evidence at all.

***

### ResponseContract

Ƭ **ResponseContract**: `Object`

What may be interpreted from a response. A status outside `statuses` is
still retained, but proves only that the provider answered.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `statuses` | `Record`\<`number`, [`BodyContract`](/api/modules/server#bodycontract)> | - |
| `headers?` | readonly `string`\[] | Exact lowercase response headers retained for evidence; others drop. |
| `failures?` | readonly \{ `status`: `number` ; `kind`: `"transient"` \| `"unavailable"` \| `"insufficient_scope"` \| `"authentication"` \| `"signature"` \| `"throttled"` ; `when?`: \{ `kind`: `"any"` ; `items`: [`WirePath`](/api/modules/server#wirepath) ; `path`: [`WirePath`](/api/modules/server#wirepath) ; `value`: [`ScalarValue`](/api/modules/server#scalarvalue)  } \| \{ `kind`: `"all"` \| `"not_all"` ; `matches`: readonly \{ `path`: [`WirePath`](/api/modules/server#wirepath) ; `value`: [`ScalarValue`](/api/modules/server#scalarvalue)  }\[]  }  }\[] | Acquisition only. Failed observations remain in custody, and transient failures back off under the same pinned request. Never retries a command. |

***

### ScalarValue

Ƭ **ScalarValue**: \{ `type`: `"bool"` ; `value`: `boolean`  } | \{ `type`: `"text"` ; `value`: `string`  } | \{ `type`: `"integer"` ; `value`: `string`  } | \{ `type`: `"null"`  } | \{ `type`: `"missing"`  }

An exact scalar a response field may equal. Matching is by type and value
together, so `false`, `"false"`, `null` and an absent field stay four
different things. An integer is canonical decimal text compared against an
exact JSON integer, never through a float.

***

### KeyEncoding

Ƭ **KeyEncoding**: `"text"` | `"integer"`

How one key component is read. `integer` preserves an exact provider
identifier: a value that is not an exact JSON integer is refused rather than
rounded, so a large numeric id never loses its low digits.

***

### KindMatch

Ƭ **KindMatch**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `value` | [`ScalarValue`](/api/modules/server#scalarvalue) |
| `record` | `"present"` \| `"deleted"` |

***

### RecordKindSource

Ƭ **RecordKindSource**: \{ `kind`: `"fixed"` ; `record`: `"present"` | `"deleted"`  } | \{ `kind`: `"match"` ; `path`: [`WirePath`](/api/modules/server#wirepath) ; `variants`: readonly [`KindMatch`](/api/modules/server#kindmatch)\[]  }

How a response says what each of its records is. Providers differ: one tags
rows with a string, another with a boolean archived flag, and an endpoint
that only ever returns live records says nothing at all.

***

### KeyPart

Ƭ **KeyPart**: \{ `kind`: `"literal"` ; `value`: `string`  } | \{ `kind`: `"mapped_field"` ; `path`: [`WirePath`](/api/modules/server#wirepath) ; `values`: `Record`\<`string`, `string`>  } | [`HttpInput`](/api/modules/server#httpinput) | \{ `kind`: `"field"` ; `path`: [`WirePath`](/api/modules/server#wirepath) ; `encoding`: [`KeyEncoding`](/api/modules/server#keyencoding)  }

One component of a compound key. A provider returning association rows omits
the parent it was asked about, so identity is completed from the admitted
request context rather than from anything a response invented.

***

### RecordKeySource

Ƭ **RecordKeySource**: \{ `kind`: `"input"`  } & [`HttpInputReference`](/api/modules/server#httpinputreference) | \{ `kind`: `"field"` ; `path`: [`WirePath`](/api/modules/server#wirepath) ; `encoding`: [`KeyEncoding`](/api/modules/server#keyencoding)  } | \{ `kind`: `"compound"` ; `parts`: readonly [`KeyPart`](/api/modules/server#keypart)\[]  }

How each record's key is assembled.

***

### ResumeSource

Ƭ **ResumeSource**: \{ `kind`: `"stated"` ; `from`: [`Selector`](/api/modules/server#selector)  } | \{ `kind`: `"while_more"` ; `from`: [`Selector`](/api/modules/server#selector)  } | \{ `kind`: `"link_relation"` ; `header`: `string` ; `relation`: `string`  } | \{ `kind`: `"last_record_key"`  } | \{ `kind`: `"maximum_field"` ; `path`: [`WirePath`](/api/modules/server#wirepath)  }

Where the position the NEXT acquisition request resumes from comes from.

`stated` is the provider's own cursor, read from the position it states it
at. `last_record_key` is the `after=<id>` walk: the provider states no cursor
and the next request continues after the LAST record this response returned,
so the HOST derives the position from the keys it already verified against
this same response's declared `key`. The connector composes nothing, because
a position the host cannot check against retained evidence is one a guest
could move backwards over records already published. An empty page names no
last row and therefore derives no position.

`maximum_field` is the third, and it is the same derivation over a different
value: the provider states no cursor and the next request continues from the
LARGEST value a declared ordered field took over this page's records --
Odoo's `write_date >= <the largest one you saw>`, and BigQuery's `APPENDS`
instant. It exists because neither other arm can say it: there is no stated
cursor to select, and the last ROW's key is a different value in a different
domain from the one the request filters on.

Two rules come with it. The values are compared as the PROVIDER spelled them,
so every row must carry the field as text of one width -- a fixed-width
timestamp orders by bytes and `"9"` against `"10"` does not, so a page mixing
widths is refused rather than positioned wrongly. And the continuation is
INCLUSIVE of its own boundary, because the field's rendering may be coarser
than the comparison the provider makes on it: Odoo renders `write_date` to
the second and compares at full stored precision, so a strict `>` returns the
row it came from. The boundary row is therefore re-read on every resume, and
the declaration owes an opaque record version so that the re-read row is
deduplicated by (key, version) instead of churning history.

That inclusiveness is also why the walk needs an end: the last page returns
its boundary row and nothing else, and its maximum is the position the
request already carried. The host derives a position only where what it
computed is STRICTLY GREATER than the one this request resumed from, and an
empty page derives none, so a finished walk exhausts instead of asking for
the same page for ever.

***

### RecordProjection

Ƭ **RecordProjection**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `collection` | `string` | - |
| `subject?` | [`HttpInputReference`](/api/modules/server#httpinputreference) | - |
| `items?` | [`WirePath`](/api/modules/server#wirepath) | - |
| `presence` | [`RecordKindSource`](/api/modules/server#recordkindsource) | - |
| `key` | [`RecordKeySource`](/api/modules/server#recordkeysource) | - |
| `version?` | [`Selector`](/api/modules/server#selector) | - |
| `complete?` | [`WirePath`](/api/modules/server#wirepath) | At most one of `complete`, `more` and `end_cursor`, as standalone `records` evidence declares it. |
| `more?` | [`WirePath`](/api/modules/server#wirepath) | - |
| `end_cursor?` | [`WirePath`](/api/modules/server#wirepath) | Completion is stated by an absent or empty string at this cursor. |
| `resume?` | [`ResumeSource`](/api/modules/server#resumesource) | - |

***

### HttpEvidence

Ƭ **HttpEvidence**: \{ `kind`: `"resources"` ; `items?`: [`WirePath`](/api/modules/server#wirepath) ; `id`: \{ `path`: [`WirePath`](/api/modules/server#wirepath) ; `encoding`: [`KeyEncoding`](/api/modules/server#keyencoding)  } ; `label?`: [`WirePath`](/api/modules/server#wirepath) ; `next_page?`: [`WirePath`](/api/modules/server#wirepath)  } | \{ `kind`: `"query_result"` ; `collection`: `string` ; `items`: [`WirePath`](/api/modules/server#wirepath) ; `columns`: [`WirePath`](/api/modules/server#wirepath) ; `column_names`: readonly `string`\[] ; `key_prefix`: readonly `string`\[] ; `key_columns`: readonly `number`\[] ; `has_more`: [`WirePath`](/api/modules/server#wirepath) ; `is_cached`: [`WirePath`](/api/modules/server#wirepath) ; `calculated_at`: [`WirePath`](/api/modules/server#wirepath) ; `calculated_at_field`: `string`  } | \{ `kind`: `"identity"` ; `account?`: \{ `path`: [`WirePath`](/api/modules/server#wirepath) ; `encoding`: [`KeyEncoding`](/api/modules/server#keyencoding)  } ; `incarnation?`: [`WirePath`](/api/modules/server#wirepath)  } | \{ `kind`: `"feed"` ; `collection`: `string` ; `items`: [`WirePath`](/api/modules/server#wirepath) ; `discriminator`: [`WirePath`](/api/modules/server#wirepath) ; `variants`: `Record`\<`string`, \{ `kind`: `"replace"` | `"delete"` ; `key`: [`WirePath`](/api/modules/server#wirepath) ; `position`: [`WirePath`](/api/modules/server#wirepath)  }> ; `through`: [`WirePath`](/api/modules/server#wirepath) ; `head`: [`WirePath`](/api/modules/server#wirepath) ; `has_more`: [`WirePath`](/api/modules/server#wirepath)  } | \{ `kind`: `"records"` ; `collection`: `string` ; `subject?`: [`HttpInputReference`](/api/modules/server#httpinputreference) ; `items?`: [`WirePath`](/api/modules/server#wirepath) ; `parents?`: [`WirePath`](/api/modules/server#wirepath) ; `sole?`: [`WirePath`](/api/modules/server#wirepath) ; `presence`: [`RecordKindSource`](/api/modules/server#recordkindsource) ; `key`: [`RecordKeySource`](/api/modules/server#recordkeysource) ; `version?`: [`Selector`](/api/modules/server#selector) ; `complete?`: [`WirePath`](/api/modules/server#wirepath) ; `more?`: [`WirePath`](/api/modules/server#wirepath) ; `end_cursor?`: [`WirePath`](/api/modules/server#wirepath) ; `resume?`: [`ResumeSource`](/api/modules/server#resumesource) ; `exact?`: readonly \{ `path`: [`WirePath`](/api/modules/server#wirepath) ; `encoding`: \{ `kind`: `"decimal_string"`  } | \{ `kind`: `"minor_units"` ; `scale`: `number`  } | \{ `kind`: `"implied_decimals"` ; `scale`: `number`  }  }\[]  } | \{ `kind`: `"projections"` ; `records`: readonly [`RecordProjection`](/api/modules/server#recordprojection)\[]  } | \{ `kind`: `"incremental"` ; `collection`: `string` ; `items`: [`WirePath`](/api/modules/server#wirepath) ; `items_optional?`: `boolean` ; `presence`: [`RecordKindSource`](/api/modules/server#recordkindsource) ; `key`: [`RecordKeySource`](/api/modules/server#recordkeysource) ; `version?`: [`Selector`](/api/modules/server#selector) ; `next_page`: [`Selector`](/api/modules/server#selector) ; `next_sync`: [`Selector`](/api/modules/server#selector) ; `terminal?`: [`WirePath`](/api/modules/server#wirepath) ; `sync_parameter`: `string` ; `page_parameter`: `string` ; `reset_status`: `number`  } | \{ `kind`: `"traversal"` ; `collection`: `string` ; `deletions`: readonly `string`\[] ; `items`: readonly \{ `parents?`: [`WirePath`](/api/modules/server#wirepath) ; `parents_optional?`: `boolean` ; `items`: [`WirePath`](/api/modules/server#wirepath) ; `items_optional?`: `boolean` ; `key`: [`WirePath`](/api/modules/server#wirepath) ; `version?`: [`WirePath`](/api/modules/server#wirepath) ; `presence`: [`RecordKindSource`](/api/modules/server#recordkindsource)  }\[] ; `duplicates`: `"present"` | `"deleted"` | `"last"` ; `next_page?`: [`Selector`](/api/modules/server#selector) ; `checkpoint?`: [`Selector`](/api/modules/server#selector) ; `checkpoint_name`: `string` ; `page_parameter?`: `string` ; `checkpoint_parameter?`: `string` ; `reset_status`: `number` ; `terminal_without_checkpoint?`: `boolean`  } | \{ `kind`: `"discovery"` ; `collection`: `string` ; `items`: [`WirePath`](/api/modules/server#wirepath) ; `presence`: [`RecordKindSource`](/api/modules/server#recordkindsource) ; `key`: [`RecordKeySource`](/api/modules/server#recordkeysource) ; `complete?`: [`WirePath`](/api/modules/server#wirepath) ; `resume?`: [`Selector`](/api/modules/server#selector) ; `continuation?`: [`HttpInputReference`](/api/modules/server#httpinputreference)  } | \{ `kind`: `"data"`  } | \{ `kind`: `"checkpoint"` ; `name`: `string` ; `value`: [`Selector`](/api/modules/server#selector)  } | \{ `kind`: `"command"` ; `command`: `string` ; `outcome`: \{ `kind`: `"status"`  } | \{ `kind`: `"selected"` ; `from`: [`Selector`](/api/modules/server#selector)  } | \{ `kind`: `"presence"` ; `of`: [`WirePath`](/api/modules/server#wirepath)  } ; `outcomes`: `Record`\<`string`, \{ `kind`: `"confirmed"` ; `target_key?`: [`Selector`](/api/modules/server#selector) ; `effects?`: readonly \{ `response`: [`WirePath`](/api/modules/server#wirepath) ; `input`: [`HttpArgumentReference`](/api/modules/server#httpargumentreference)  }\[] ; `observation?`: \{ `key`: [`WirePath`](/api/modules/server#wirepath) ; `position`: [`WirePath`](/api/modules/server#wirepath)  }  } | \{ `kind`: `"rejected"` | `"pending"` | `"unknown"`  } | \{ `kind`: `"counted"`  } | \{ `kind`: `"withdrawn"`  } | \{ `kind`: `"refused"`  }> ; `refusal?`: \{ `name`: [`Selector`](/api/modules/server#selector) ; `kinds`: `Record`\<`string`, `"precondition_failed"` | `"member_missing"` | `"invariant_violated"` | `"malformed"` | `"identity_reused"`> ; `member?`: \{ `on`: `string`\[] ; `reasons`: [`WirePath`](/api/modules/server#wirepath) ; `code`: [`WirePath`](/api/modules/server#wirepath) ; `unaffected`: `string`  } ; `current?`: \{ `kind`: `"body"` ; `path`: [`WirePath`](/api/modules/server#wirepath)  } | \{ `kind`: `"member"` ; `path`: [`WirePath`](/api/modules/server#wirepath)  }  } ; `attribution?`: \{ `kind`: `"echoed"` ; `operation_id`: [`Selector`](/api/modules/server#selector)  } | \{ `kind`: `"searched"` ; `list?`: [`WirePath`](/api/modules/server#wirepath) ; `operation_id`: [`WirePath`](/api/modules/server#wirepath) ; `complete?`: [`WirePath`](/api/modules/server#wirepath) ; `more?`: [`WirePath`](/api/modules/server#wirepath) ; `page`: `number`  } | \{ `kind`: `"absence"` ; `target_key`: [`Selector`](/api/modules/server#selector)  } | \{ `kind`: `"created"`  } ; `created?`: [`Selector`](/api/modules/server#selector)  }

***

### HttpContract

Ƭ **HttpContract**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `handler` | \{ `member`: readonly `string`\[]  } | - |
| `handler.member` | readonly `string`\[] | - |
| `method` | `"GET"` \| `"HEAD"` \| `"POST"` \| `"PUT"` \| `"PATCH"` \| `"DELETE"` | - |
| `route` | readonly (\{ `kind`: `"literal"` ; `value`: `string`  } \| [`HttpInput`](/api/modules/server#httpinput) \| \{ `kind`: `"resume_path"` ; `prefix`: `string`  } \| `Extract`\<[`HttpTemplate`](/api/modules/server#httptemplate), \{ `kind`: `"key_component"`  }>)\[] | - |
| `path_scope?` | `"base"` \| `"origin_root"` | Where the route is anchored. `base` (the default) appends the route to the connection's own resource URL. `origin_root` anchors it at the provider origin instead, which is admitted only for a listener `stop` contract whose route is entirely literal -- the one endpoint that is not under the watched resource. Nothing else may leave the resource path. |
| `query` | `Record`\<`string`, [`HttpTemplate`](/api/modules/server#httptemplate)> | - |
| `headers` | `Record`\<`string`, [`HttpTemplate`](/api/modules/server#httptemplate)> | - |
| `body?` | [`HttpTemplate`](/api/modules/server#httptemplate) | - |
| `body_encoding?` | \{ `kind`: `"raw"` ; `content_type`: `string` ; `encoding`: `"utf8"` \| `"base64url"`  } \| \{ `kind`: `"multipart"` ; `subtype`: `"form_data"` \| `"related"` ; `parts`: readonly \{ `name`: `string` ; `filename?`: `string` ; `content_type`: `string` ; `encoding`: `"json"` \| `"utf8"` \| `"base64url"`  }\[]  } | Immutable bytes encoded before signing. Multipart parts select fields of the body object; names and media types are declared literals. Neither encoding grants filesystem or URL access. |
| `parameters?` | `Fields` | Values the integration supplies at call time; absent declares none. |
| `response` | [`ResponseContract`](/api/modules/server#responsecontract) | - |
| `next_page?` | \{ `kind`: `"absolute"` ; `parameter`: `string` ; `contract`: `string`  } \| \{ `kind`: `"query_from_url"` ; `parameter`: `string` ; `contract`: `string`  } \| \{ `kind`: `"query"` ; `parameter`: `string` ; `contract`: `string` ; `query`: `string`  } | How the next page of a paged GET is addressed from retained evidence. `parameter` names the declared parameter the integration passes the next page reference in; `contract` names the contract whose traversal or resource evidence supplies that next page, and it must belong to the same handler. Only a retained page of this group's own basis may redirect the request, and every mode stays on the admitted origin and the declared resource path: - `absolute` takes the provider's own next-page URL and REPLACES the declared query with the one that URL carries. The URL must have the same origin and the same path as the declared route. - `query_from_url` also REPLACES the declared query with the provider URL's query, but keeps the declared path whatever path that URL had. - `query` keeps the declared query and APPENDS one more pair, named by `query`, carrying the provider's opaque next-page token. That name may not collide with a declared query field. A next page is a resource-scoped GET: it is refused on any other method, on an origin-root path, and on a listener contract. |
| `retrieval?` | \{ `parameter`: `string` ; `contract`: `string` ; `url`: [`WirePath`](/api/modules/server#wirepath)  } | The retrieval of an export the provider prepared at an address of its own choosing, and the one request that deliberately leaves the connection's origin. `contract` names the contract whose retained response carried the address and `url` where in that response it sits; `parameter` is the typed parameter through which the caller cites that retained response. Guest code cites evidence it already holds and never names an address. Three host rules bound it, and none of them is declarable: the address must come from a retained response of THIS acquisition; it must be either the connection's own origin or an `https` address at a named domain, never an IP literal, so no provider field can send the engine to loopback, to a link-local metadata service or into a private range; and no credential and no declared header travels with it, because a prepared export is authorized by its own address. Declared with `next_page`, or with a route, query, body or header, it is refused. |
| `retrieval.parameter` | `string` | - |
| `retrieval.contract` | `string` | - |
| `retrieval.url` | [`WirePath`](/api/modules/server#wirepath) | - |
| `observation_lag_ms?` | `number` | How far behind the present this endpoint's own answer is, in milliseconds, as a provider fact. A provider may deliberately withhold a window at the head of its change stream so that a record still being written cannot slip between two pages. Such an endpoint answers with what it could see a window ago and says nothing about it, so the declaration states it and the host SHIFTS this response's whole observation window back by it before anything is retained: a view taken at `t` is a view of the world at `t - lag`. Every claim the response publishes then carries the shifted bounds, and a coverage record closed on it ends a window earlier. Omitted is zero, and zero is a claim: this endpoint's answer speaks for the instant it was answered. It belongs only to a contract that publishes observations; a command receipt is not one. At most one hour. |
| `role?` | `string` | The CREDENTIAL ROLE this contract dispatches under. A role is protocol structure, which is why a definition names one and a deployment binds it: the definition states that this endpoint is authorized differently from the rest of the provider, and the deployment states where that role lives and which private credential it is. A definition names no secret and no address, and an operator reads no definition to learn what to provision. PagerDuty is the shape that needed it. Its write half is an events-ingest key in a request body on one host; its read half is an account key in an `Authorization` header on another; and the read half is not optional, because the reconcile IS the read -- the ingest host answers `202` for a routing key that names nothing, so a REST read of the incident is the only evidence one exists. No single credential authorizes both halves. Omitted is the one unnamed default role, which is the connection's own base URL and credential, and is what every single-credential definition means. A contract naming a role the connection does not hold is refused when the definition is bound to that connection, before any request exists. |
| `evidence` | [`HttpEvidence`](/api/modules/server#httpevidence) | - |
| `file?` | \{ `collection`: `string` ; `parser`: `"mime"` ; `body`: \{ `kind`: `"whole"`  } ; `max_bytes?`: `never`  } \| \{ `collection`: `string` ; `parser`: `"mime"` ; `body`: \{ `kind`: `"json_base64"` ; `selector`: [`WirePath`](/api/modules/server#wirepath) ; `encoding`: `"base64url"`  } ; `max_bytes?`: `never`  } \| \{ `collection`: `string` ; `parser`: `"bytes"` ; `body`: \{ `kind`: `"stream"` \| `"revalidate"`  } ; `max_bytes`: `number`  } | Host-owned parsing of retained response bytes into protected files. The host reads the declared bytes, parses them with the declared parser and attaches the resulting files to the named collection's projected key; guest code never supplies bytes, a storage destination or a parser at runtime. The collection must be declared and must be one this response actually projects. `whole` requires every admitted successful status to carry an `opaque` body; `json_base64` requires every admitted successful status to carry a JSON body and selects the encoded bytes from one field path. `stream` is the third body and the only one the host never retains: the response bytes go straight into staged protected storage during acquisition, and what the host keeps is custody of them -- the storage id, the exact size, the digest and the admitted headers -- rather than the bytes. It is the response body itself, so it pairs only with the `bytes` parser, which interprets nothing, and only with opaque successful bodies. `max_bytes` is that pairing's declared ceiling and belongs to it alone: a streamed body leaves no retained value to measure afterwards, so the bound has to be enforced while the bytes are written, and the other two bodies declare none. Its own ceiling is the protected file ceiling, 16 MiB. |

***

### ResponseEvidence

Ƭ **ResponseEvidence**: `string`

A reference is only a lookup key; native admission checks its invocation.

***

### IntegrationContext

Ƭ **IntegrationContext**\<`H`>: `Object`

#### Type parameters

| Name | Type |
| :- | :- |
| `H` | extends `HttpContracts` = `HttpContracts` |

#### Type declaration

| Name | Type |
| :- | :- |
| `http` | \{ `request`: \<N>(`contract`: `N`, `parameters?`: `HttpParameters`\<`H`\[`N`]>) => `Promise`\<`HttpOutcome`\<`H`\[`N`]>>  } |
| `http.request` | \[object Object] |

***

### SourceProtocol

Ƭ **SourceProtocol**: \{ `kind`: `"postgres_cdc"`  } | \{ `kind`: `"change_feed"` ; `position`: \{ `domain`: `string` ; `encoding`: `"uint64_decimal"` | `"int64_decimal"`  } ; `checkpoint`: \{ `initial`: `string` ; `continuity`: `"complete_prefix"` ; `retention`: `Retention`  } ; `records`: `"full_or_delete"` ; `atomic_group`: `"one_change"`  } | \{ `kind`: `"record_observation"` ; `version`: \{ `kind`: `"opaque"`  } | \{ `kind`: `"none"`  } ; `coverage`: \{ `kind`: `"enumeration"`  } | \{ `kind`: `"query_result"` ; `max_rows`: `number`  } | \{ `kind`: `"incremental_snapshot"` ; `max_rows`: `number`  } | \{ `kind`: `"filtered"` ; `completeness`: `"stated"` | `"none"`  } | \{ `kind`: `"none"`  } ; `resume`: \{ `kind`: `"opaque_cursor"`  } | \{ `kind`: `"none"`  }  } | \{ `kind`: `"measurement"` ; `shape`: [`MeasurementShape`](/api/modules/server#measurementshape) ; `cadence`: \{ `revisionsPerKeyPerMinute`: `number`  }  }

What an acquisition actually proves. Records with a done flag and a
a resume cursor are not a change feed; declaring one would claim ordering and
completeness the provider never established.

***

### MeasurementShape

Ƭ **MeasurementShape**: \{ `shape`: `"twin_hot"`  } | \{ `shape`: `"twin_cold"` ; `dwell_ms`: `number`  } | \{ `shape`: `"window"` ; `definition`: `string` ; `revision`: `number` ; `window_ms`: `number` ; `lateness_ms`: `number`  } | \{ `shape`: `"late_observation"`  } | \{ `shape`: `"occurrence_log"`  } | \{ `shape`: `"refusal"`  }

Which of the shapes a measurement collection holds.

Each is a different bound on the same quantity. The two twin shapes revise
one row per key; the other three append a row and are bounded by what
produces them -- a closed interval, a transition, or a refusal.

***

### CoupledResult

Ƭ **CoupledResult**\<`S`>: `wire.CoupledResult`\<\{ \[K in keyof S]: RecordObservation\<ObjectType\<S\[K]>>\[] }, keyof `S` & `string`>

What one coupled acquisition attempt claims, as a candidate only.

The envelope is generated; this states the two narrowings that are facts
about the *declaration* rather than about the wire, exactly as
`ProtocolInput` and `ProtocolResult` do below: `records` is a mapped type
over the author's own collection schemas, and every collection named by an
unresolved key or a file request is one of the author's own collections.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Record`\<`string`, `Fields`> |

***

### CouplingDefinition

Ƭ **CouplingDefinition**\<`S`, `H`>: `Object`

One acquisition over a whole group of collections: the collections it owns,
the one interval the group is scheduled on, and the one reader.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Record`\<`string`, `Fields`> |
| `H` | extends `HttpContracts` = `HttpContracts` |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `collections` | readonly keyof `S` & `string`\[] | - |
| `reconcile?` | \{ `absent`: `404` \| `410`  } | Recheck previously published keys omitted by the live traversal. A retained singleton response with this status withdraws every corresponding member atomically. Other failures stay unresolved. No coverage is claimed. |
| `reconcile.absent` | `404` \| `410` | - |
| `every` | `SyncEvery` | - |
| `read` | (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: [`CoupledInput`](/api/modules/server#coupledinput)) => `Promise`\<[`CoupledResult`](/api/modules/server#coupledresult)\<`S`>> | - |

***

### ListenerProtocol

Ƭ **ListenerProtocol**: \{ `kind`: `"queue"` ; `provider`: `"sqs"` ; `visibility_seconds`: `number` ; `wait_seconds`: `number` ; `poll_interval_ms`: `number` ; `proves`: `"refresh_hint"`  } | \{ `kind`: `"socket"` ; `open`: `string` ; `address`: [`Selector`](/api/modules/server#selector) ; `envelope`: readonly `string`\[] ; `frame_kind`: readonly `string`\[] ; `disconnect`: `string` ; `acknowledge`: `string` ; `max_frame_bytes`: `number` ; `proves`: `"refresh_hint"`  } | \{ `kind`: `"push"` ; `ingress`: `ListenerIngress` ; `subscription?`: \{ `channel`: \{ `resource`: readonly `string`\[] ; `proof`: \{ `channel_id`: [`Selector`](/api/modules/server#selector) ; `resource_id`: [`Selector`](/api/modules/server#selector) ; `resource_uri`: [`Selector`](/api/modules/server#selector) ; `expiration`: [`Selector`](/api/modules/server#selector)  } ; `matching`: \{ `tolerated_query?`: readonly `string`\[] ; `lifetime_ms`: `number` ; `renewal_margin_ms`: `number`  }  } ; `watch`: `string` ; `stop`: `string`  }  } | \{ `kind`: `"pull"` ; `poll`: `string` ; `interval_ms`: `number` ; `min_interval_ms`: `number` ; `max_interval_ms`: `number` ; `continuation`: \{ `kind`: `"validator"` ; `request_header`: `string` ; `response_header`: `string` ; `interval_header?`: `string` ; `quiet_status`: `number`  } | \{ `kind`: `"cursor"` ; `parameter`: `string` ; `resume`: `ResumePrefix` ; `retention`: `Retention`  } ; `position`: \{ `items?`: readonly `string`\[] ; `id`: readonly `string`\[] ; `order`: `"decimal"` | `"opaque"` | `"opaque_ascending"`  } ; `keys?`: \{ `list`: `string` ; `items?`: readonly `string`\[] ; `id?`: readonly `string`\[] ; `parameter`: `string` ; `partition`: readonly `string`\[]  }  }

How change hints reach the engine for one collection, and the whole of what
a listener declares.

The variant is the transport class and it carries what that transport needs.
`push` has an ingress endpoint because the provider delivers to one; `pull`
has none, because nothing is delivered to it. Neither is an optional field a
declaration could leave empty.

A delivery, and equally a poll, is a refresh hint only: it asks the engine to
read again and proves nothing by itself. A listener's collection declares its
own `sync`, because a hint asks for acquisition and there has to be one to
ask for.

***

### CollectionDefinition

Ƭ **CollectionDefinition**\<`S`, `H`, `P`>: `CollectionShape`\<`S`, `P`> & \{ `sync`: \{ `every`: `SyncEvery` ; `read`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: `ProtocolInput`\<`P`>) => `Promise`\<`ProtocolResult`\<`P`, [`ObjectType`](/api/modules/values#objecttype)\<`S`>>>  }  }

A collection acquired on its own: it declares its own interval and its own
reader.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Fields` |
| `H` | extends `HttpContracts` = `HttpContracts` |
| `P` | extends [`SourceProtocol`](/api/modules/server#sourceprotocol) = `Extract`\<[`SourceProtocol`](/api/modules/server#sourceprotocol), \{ `kind`: `"change_feed"`  }> |

***

### CoupledCollectionDefinition

Ƭ **CoupledCollectionDefinition**\<`S`, `P`>: `CollectionShape`\<`S`, `P`> & \{ `sync?`: `never`  }

A collection of a coupled group. One acquisition walks the whole group, so
the group's `coupling` owns the interval and the read and the collection
declares neither: a per-collection `sync` here would name a schedule nothing
runs and a reader nothing calls.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Fields` |
| `P` | extends [`SourceProtocol`](/api/modules/server#sourceprotocol) = [`SourceProtocol`](/api/modules/server#sourceprotocol) |

***

### CommandCondition

Ƭ **CommandCondition**: \{ `kind`: `"target_version"` ; `from`: \{ `kind`: `"record_observation_position"`  } | \{ `kind`: `"record_version"`  }  } | \{ `kind`: `"unconditional"`  } | \{ `kind`: `"field_ownership"`  }

Exact native provenance for the provider's conditional version. An ordered
feed position and an opaque record token are not interchangeable.
`unconditional` states that the destination enforces no compare-and-set on
this endpoint, so the request carries no provider conditional token at all.
It is the ABSENCE of a precondition, never an empty or fabricated one, and it
promises nothing about writers acting directly in the provider.

***

### CommandGoverningResult

Ƭ **CommandGoverningResult**: \[`Exclude`\<[`GoverningResult`](/api/modules/server#governingresult), `null`> & \{ `recheckAt?`: `never`  } | `null` | \{ `recheckAt`: `number` ; `validUntil?`: `never`  }]

A command rule decides one command and returns a one-element list: the
shared permitting results plus command-only advisory deferral. A bare
value, an empty or longer list, and a rule that falls off its end refuse.
recheckAt denies now and requests a future evaluation; it is never permission.
Its timestamp has the same finite safe-integer epoch-millisecond, strictly
future, at-most-366-day bounds as validUntil. Review, acceptance and send
require a permitting result whose validity extends past the actual commit.
The native decoder rejects unknown fields and mixed permit/defer objects.
A rule that never defers declares `returns: readAccessResults`.

***

### CommandTarget

Ƭ **CommandTarget**: [`GenericId`](/api/modules/values#genericid)\<`string`> | \{ `sourceId`: `string`  }

Existing records use their local ID. Creates address one installed source,
including when several accounts populate the same table. The host enforces
the target kind against the command declaration and rechecks its binding.

***

### CommandGoverningInput

Ƭ **CommandGoverningInput**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `condition` | [`CommandCondition`](/api/modules/server#commandcondition) | Native admitted comparison contract. The product rule must refuse a condition weaker than the business operation requires. It is retained with the exact command meaning through acceptance and recovery. |
| `delivery` | [`CommandDefinition`](/api/modules/server#commanddefinition)\<`Fields`, `Record`\<`string`, `Fields`>>\[`"delivery"`] | Native retained deduplication and expiry assumptions. Product policy can require these independently of conditional comparison. |
| `phase` | `"review"` \| `"acceptance"` \| `"send"` | - |
| `requester` | `string` | - |
| `target` | [`CommandTarget`](/api/modules/server#commandtarget) | - |
| `args` | [`Value`](/api/modules/values#value) | - |
| `approval` | `null` \| \{ `id`: `string` ; `approver`: `string` ; `beneficiary`: `string`  } | - |

***

### CommandGoverningDefinition

Ƭ **CommandGoverningDefinition**: [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"public"` | `"internal"`, `any`, [`CommandGoverningResult`](/api/modules/server#commandgoverningresult)> | \{ `query`: [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"public"` | `"internal"`, `any`, [`CommandGoverningResult`](/api/modules/server#commandgoverningresult)> ; `reads`: readonly `string`\[]  }

A command policy may read named private inputs at review, admission and
send. Only its decision is released; reads do not become caller authority.
Commands always evaluate the current final basis.

***

### CommandStates

Ƭ **CommandStates**\<`A`>: `Object`

The change a record-targeted command's send REQUESTS of its target record,
field by field: each key is a field of the target collection's schema, and
each value is the path into this command's arguments whose value the request
asks that field to take. Every path names REQUIRED arguments, and the
argument's type must be one the field admits.

It is read only on a branch, where nothing is delivered: a held call whose
command states its change is shown there as that change, with assumed
provenance, so the branch's views show its consequence. It never becomes
evidence that the destination applied anything, and fields the provider
computes -- assigned identifiers, totals -- are not stated and stay as last
observed. A create cannot state a change: its record's key is the
provider's to assign.

#### Type parameters

| Name | Type |
| :- | :- |
| `A` | extends `Fields` |

#### Index signature

▪ \[field: `string`]: readonly \[keyof `A` & `string`, ...string\[]]

***

### CommandDefinition

Ƭ **CommandDefinition**\<`A`, `S`, `H`>: `CommandShape`\<`A`, `S`> & \{ `creates?`: `undefined` ; `states?`: [`CommandStates`](/api/modules/server#commandstates)\<`A`> ; `send`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: `CommandInput`\<`A`>) => `Promise`\<`CommandResult`\<`S`>> ; `reconcile`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: `Omit`\<`CommandInput`\<`A`>, `"expires_at"`>) => `Promise`\<`CommandResult`\<`S`>>  } | `CommandShape`\<`A`, `S`> & \{ `creates`: \{ `kind`: `"deduplicated"`  } | \{ `kind`: `"stored"`  } | \{ `kind`: `"unattributed"`  } ; `states?`: `undefined` ; `send`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: `CreateCommandInput`\<`A`>) => `Promise`\<`CommandResult`\<`S`>> ; `reconcile`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: `Omit`\<`CreateCommandInput`\<`A`>, `"expires_at"`>) => `Promise`\<`CommandResult`\<`S`>>  }

One command.

The two arms differ in exactly one fact and everything else follows from it:
whether the send addresses a RECORD of the target collection or the
COLLECTION itself. A record-targeted command's handlers receive that
record's key; a create's do not, because the record does not exist yet, and
they receive the operation's own identity instead.

#### Type parameters

| Name | Type |
| :- | :- |
| `A` | extends `Fields` |
| `S` | extends `Record`\<`string`, `Fields`> |
| `H` | extends `HttpContracts` = `HttpContracts` |

***

### CommandHandle

Ƭ **CommandHandle**\<`Args`>: `Object`

#### Type parameters

| Name | Type |
| :- | :- |
| `Args` | extends `Record`\<`string`, [`Value`](/api/modules/values#value)> = `Record`\<`string`, [`Value`](/api/modules/values#value)> |

#### Type declaration

| Name | Type |
| :- | :- |
| `[commandExport]` | () => \{ `version`: `1` ; `integration`: [`IntegrationAddress`](/api/modules/server#integrationaddress) ; `command`: `string`  } |
| `__commandArgs?` | `Args` |

***

### CommandArgs

Ƭ **CommandArgs**\<`C`>: `C` extends [`CommandHandle`](/api/modules/server#commandhandle)\<infer Args> ? `Args` : `never`

#### Type parameters

| Name | Type |
| :- | :- |
| `C` | extends [`CommandHandle`](/api/modules/server#commandhandle)\<`any`> |

***

### ApprovalId

Ƭ **ApprovalId**: [`GenericId`](/api/modules/values#genericid)\<`"_approvals"`>

***

### ExternalCallId

Ƭ **ExternalCallId**: `string` & \{ `__externalCallId`: unique `symbol`  }

***

### SourceCoverage

Ƭ **SourceCoverage**: `Object`

What the engine can prove about one installed source's population.

Every field is derived from the evidence the capture and acquisition owners
already record for that source alone. There is no credential, destination
name or provider identifier here, and a value read for one source discloses
nothing about another.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `acquired` | `boolean` | Whether an initial acquisition has completed. `false` is not an empty population. It is the absence of any completed acquisition, which is what makes "this source is covered and holds nothing" and "we cannot establish whether this source holds anything" different answers instead of the same empty page. |
| `observedFrom` | `number` \| `null` | The beginning of the window the current coverage publishes, in epoch milliseconds. It moves only when a completed acquisition publishes coverage, so it is the last publication that changed what this source says. `null` until an acquisition completes. |
| `observedTo` | `number` \| `null` | The newest observation the coverage extends to, in epoch milliseconds. An unchanged answer advances this without moving `observedFrom`. |
| `age` | `number` \| `null` | The age of that newest observation, in milliseconds. |
| `continuityLost` | `boolean` | Whether continuity was lost. The coverage still proves what it proved and can no longer be extended. |
| `checkedAt` | `number` \| `null` | The last check this source answered successfully, in epoch milliseconds. Later than `observedFrom` means the source was asked again and nothing had changed. |
| `refreshOutstanding` | `boolean` | Whether a refresh responsibility is still outstanding. |
| `dataset?` | \{ `lastCompleteVersion`: `string` \| `null` ; `targetVersion`: `string` \| `null` ; `coherent`: `boolean` ; `checkpoint`: \{ `kind`: `"uninitialized"`  } \| \{ `kind`: `"published"` ; `version`: `string`  } \| \{ `kind`: `"moving"` ; `base`: `string` \| `null` ; `target`: `string` ; `cursor`: \{ `bucket`: `number` ; `afterKey`: `string` \| `null`  } ; `rebase`: `boolean`  } \| \{ `kind`: `"rebase_ready"`  } \| \{ `kind`: `"erasing"` \| `"erased"`  } \| \{ `kind`: `"confirming"` ; `target`: `string` ; `after`: `string` \| `null`  } ; `gap`: `"base_unavailable"` \| `"target_retired"` \| `"binding_changed"` \| `"projection_withheld"` \| `"bucket_bound"` \| `"retention_released"` \| `null`  } | Exact dataset basis when this is a dataset-backed source. `coherent` is false while pages of a new version are being published or a gap is held; its rows may then be a mix of the last complete and target versions. |
| `dataset.lastCompleteVersion` | `string` \| `null` | - |
| `dataset.targetVersion` | `string` \| `null` | - |
| `dataset.coherent` | `boolean` | - |
| `dataset.checkpoint` | \{ `kind`: `"uninitialized"`  } \| \{ `kind`: `"published"` ; `version`: `string`  } \| \{ `kind`: `"moving"` ; `base`: `string` \| `null` ; `target`: `string` ; `cursor`: \{ `bucket`: `number` ; `afterKey`: `string` \| `null`  } ; `rebase`: `boolean`  } \| \{ `kind`: `"rebase_ready"`  } \| \{ `kind`: `"erasing"` \| `"erased"`  } \| \{ `kind`: `"confirming"` ; `target`: `string` ; `after`: `string` \| `null`  } | The exact durable page or confirmation position used for the next read. |
| `dataset.gap` | `"base_unavailable"` \| `"target_retired"` \| `"binding_changed"` \| `"projection_withheld"` \| `"bucket_bound"` \| `"retention_released"` \| `null` | - |

***

### SourceFetchValue

Ƭ **SourceFetchValue**: `string` | `bigint` | `boolean` | `ArrayBuffer`

An exact value a fetch filter compares a declared field with: the value
the field is published as. There is no `number`: an approximate value has
no exact equality. An integer column's value is a `bigint`; an exact
decimal, a date or a timestamp is its canonical text, a decimal at its
column's scale (`"12.50"`, not `"12.5"`).

***

### SourceFetchOptions

Ƭ **SourceFetchOptions**: `Object`

One pinned, bounded read of an installed source's table.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `where?` | `Record`\<`string`, [`SourceFetchValue`](/api/modules/server#sourcefetchvalue)> | Declared output fields and the exact values they must equal. Values are bound as parameters; a fetch never carries query text. At most eight. They are also the rows the caller's read authority is asked for, so a rule that scopes readers by row decides the fetch from them. A page in which the source's own comparison matched a row whose value differs (a case-insensitive collation, an equal instant at another offset) is refused as `SourceFetchInexactFilter`. |
| `at?` | `string` | Read at this position, from an earlier receipt's `position`. Absent, the fetch reads at the source's current position and names it. The opaque position binds that source incarnation and declaration; it cannot be reused after either changes. |
| `cursor?` | `string` | Continue an earlier receipt's page sequence at the same position. |
| `limit?` | `number` | At most this many rows, 1 through 128. Defaults to 128. |

***

### SourceFetchReceipt

Ƭ **SourceFetchReceipt**: `Object`

What a fetch read.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `rows` | `Record`\<`string`, [`Value`](/api/modules/values#value)>\[] | The declared fields of each row read, in key order, as exact values. |
| `position` | `string` | The source position every row was read at. Pass it as `at` to read the same state again, for as long as the source retains it. |
| `cursor` | `string` \| `null` | Where the next page continues, or `null` when the source had no more. |

***

### SourceFetchErrorCode

Ƭ **SourceFetchErrorCode**: `"ReadAccess"` | `"ActionDisclosure"` | `"IntegrationReinstallRequired"` | `"SourceFetchArguments"` | `"SourceFetchUnavailable"` | `"SourceFetchUnsupported"` | `"SourceFetchUnpinned"` | `"SourceFetchUndeclaredField"` | `"SourceFetchTooManyFilters"` | `"SourceFetchFilterValue"` | `"SourceFetchPosition"` | `"SourceFetchContinuation"` | `"SourceFetchSourceReplaced"` | `"SourceFetchHistoryUnavailable"` | `"SourceFetchRowBound"` | `"SourceFetchInexactFilter"`

Why a fetch was refused. `ReadAccess`: the source's read rule refused the
rows the filters name. `ActionDisclosure`: the action holds protected
information from elsewhere than this source's rows, which the fetch would
send to the source. `SourceFetchHistoryUnavailable`: the source no
longer retains the pinned position; fetch again without `at`.
`SourceFetchSourceReplaced`: the table is not the installed incarnation.
`SourceFetchInexactFilter`: the source's comparison matched a row whose
value differs from a filter's.

***

### SourceFetchErrorData

Ƭ **SourceFetchErrorData**: `Object`

The data of the `BijectionError` a refused fetch throws.

#### Type declaration

| Name | Type |
| :- | :- |
| `kind` | `"source_fetch_error"` |
| `code` | [`SourceFetchErrorCode`](/api/modules/server#sourcefetcherrorcode) |

***

### SourceHandle

Ƭ **SourceHandle**\<`S`>: `Object`

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Fields` = `Fields` |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `schema` | `S` | - |
| `__sourceType?` | [`ObjectType`](/api/modules/values#objecttype)\<`S`> | Phantom shape used to check the destination table's validator. |

***

### ConnectionBudget

Ƭ **ConnectionBudget**: \{ `capacity`: `number` ; `restorePerSecond`: `number` ; `restorePerMinute?`: `undefined` ; `perMinute?`: `undefined`  } | \{ `capacity`: `number` ; `restorePerMinute`: `number` ; `restorePerSecond?`: `undefined` ; `perMinute?`: `undefined`  } | \{ `perMinute`: `number` ; `capacity?`: `undefined` ; `restorePerSecond?`: `undefined` ; `restorePerMinute?`: `undefined`  } & \{ `requestCost?`: `number` ; `stated?`: \{ `available`: [`Selector`](/api/modules/server#selector) ; `capacity?`: [`Selector`](/api/modules/server#selector) ; `restorePerSecond?`: [`Selector`](/api/modules/server#selector)  }  }

What one connection may spend, and where the provider's answers state it.

The budget belongs to the connection rather than to a collection: the
provider counts it against the credential, so every collection, listener and
command that speaks through one connection shares one bucket. Declare it in
whichever form the provider publishes -- a cost bucket with a restore rate,
or a count per minute -- and the engine keeps one quantity either way.

`stated` names where an answer carries the provider's own figure. A stated
availability can only lower what the engine believes it has, because the
engine counts its own requests and the provider counts everybody's; a stated
ceiling or rate replaces the declared one, because those are the provider's
contract rather than a measurement.

***

### BackoffRepresentation

Ƭ **BackoffRepresentation**: `"secondsFromResponse"` | `"epochSeconds"` | `"epochMillis"` | `"httpDate"` | `"retryAfter"`

How a stated backoff value is spelled.

* `secondsFromResponse` is a duration from the answer, in seconds. It admits
  RFC 9110 delta-seconds (`Retry-After: 120`) and a fractional
  seconds-remaining (`x-ratelimit-reset-after: 0.529`) alike: those are one
  quantity written two ways, and a fraction is always rounded up so a wait
  never comes out shorter than the one asked for.
* `epochSeconds` and `epochMillis` are an absolute instant. The two cannot be
  told apart from the value, so the declaration names the unit.
* `httpDate` is an absolute instant as an RFC 9110 HTTP-date. The two
  obsolete date forms are not read.
* `retryAfter` is the `Retry-After` header itself, which RFC 9110 lets a
  provider spell either way in the same header; the form is decided by the
  value rather than by the declaration.

***

### ConnectionBackoff

Ƭ **ConnectionBackoff**: `Object`

When this provider will accept another request, and where its answers say
so.

It belongs to the connection rather than to a collection or a command,
because a provider throttles the credential. Declare the statuses this
provider states a wait on, where the statement is, and the longest wait this
integration will honour on its own; a provider asking for longer holds the
connection for an operator instead of sleeping for it.

Every declared signal is read and the LATEST instant any of them names is
the one honoured: two fields stating one quantity can disagree, and waiting
longer is the only safe direction.

IT NEVER AUTHORIZES REPEATING AN OPERATION. This says when the provider will
accept another request. Whether a particular external command may be sent
again is decided by that command's own delivery contract from its retained
operation identity, and nothing declared here reaches that decision.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `statuses` | readonly `number`\[] | The error statuses this provider states a wait on. `429` is the ordinary one; declare `403` as well where this provider signals an exhausted quota that way. It is not a failure classifier -- what kind of failure a status is stays with the response contract's own `failures`. |
| `signals` | `ReadonlyArray`\<\{ `at`: [`Selector`](/api/modules/server#selector) ; `is`: [`BackoffRepresentation`](/api/modules/server#backoffrepresentation)  }> | Where the statement is. A header name is matched without regard to case and must be declared in lower case. |
| `maxWaitSeconds` | `number` | The longest wait this integration honours without an operator, in seconds. At most one day. |

***

### ReplicationTransport

Ƭ **ReplicationTransport**: `Record`\<`string`, `never`>

A PostgreSQL logical replication slot, pgoutput protocol v1. Physical
relation names, publication and credentials are private installation
configuration and are never declared here.

***

### MailboxTransport

Ƭ **MailboxTransport**: `Object`

One mailbox session. The account, endpoint, selected folders and
credentials are private installation configuration; a declaration names only
the three projections it publishes.

#### Type declaration

| Name | Type |
| :- | :- |
| `provider` | `"imap"` |
| `messages` | `string` |
| `contents` | `string` |
| `memberships` | `string` |

***

### StreamTransport

Ƭ **StreamTransport**: `Object`

One device stream.

The broker address, its partitions and its credentials are private
installation configuration; a declaration names only the topic and the four
record fields the engine reads. `correlation` is the field a device's
acknowledgement carries its command's operation identity in: a protocol that
omits it declares that it does not acknowledge, and a command against such a
protocol is refused rather than confirmed from a later reading.

The batch cadence is each collection's own `every`, exactly as it is for the
other host-executed transports, so a hot twin's declared revision rate has
one owner rather than a second number here.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `encoding` | \{ `kind`: `"json"`  } \| \{ `kind`: `"avro"`  } | - |
| `topic` | `string` | - |
| `key` | `string` | - |
| `event_time` | `string` | - |
| `value` | `string` | - |
| `correlation?` | `string` | - |
| `command_topic?` | `string` | The topic this group's commands are produced to. A group declaring it delivers its commands over this transport rather than through an HTTP contract: one broker, one connection, one credential, and no second outbound address on the same installed source. It requires `correlation`, because a command whose acknowledgement has no field to arrive on would leave every call unknown for ever, and it is never the topic this group consumes, because one topic carrying both directions would route a command's own record back to it as its own acknowledgement. |

***

### AcquisitionTransport

Ƭ **AcquisitionTransport**: \{ `transport`: `"replication"` ; `value`: [`ReplicationTransport`](/api/modules/server#replicationtransport)  } | \{ `transport`: `"mailbox"` ; `value`: [`MailboxTransport`](/api/modules/server#mailboxtransport)  } | \{ `transport`: `"stream"` ; `value`: [`StreamTransport`](/api/modules/server#streamtransport)  } | \{ `transport`: `"dynamo_db"` ; `value`: \{ `collection`: `string`  }  } | \{ `transport`: `"git"` ; `value`: \{ `collection`: `string`  }  } | \{ `transport`: `"big_query"` ; `value`: \{ `collection`: `string`  }  } | \{ `transport`: `"sheets"` ; `value`: \{ `collection`: `string`  }  } | \{ `transport`: `"kubernetes"` ; `value`: \{ `collection`: `string`  }  } | \{ `transport`: `"bayeux"` ; `value`: `BayeuxTransport`  } | \{ `transport`: `"mongo"` ; `value`: \{ `collection`: `string` ; `fields`: `Record`\<`string`, `string`> ; `max_initial_rows`: `number`  }  } | \{ `transport`: `"sql"` ; `value`: `SqlTransport`  } | \{ `transport`: `"dataset"` ; `value`: `DatasetTransport`  } | \{ `transport`: `"bijection"` ; `value`: `BijectionTransport`  } | \{ `transport`: `"sftp"` ; `value`: `SftpTransport`  } | \{ `transport`: `"odata"` ; `value`: `ODataTransport`  }

The declared transport. The discriminator is spelled `transport` because
that is what it selects; there is no acquisition kind beside it.

***

### SyncInput

Ƭ **SyncInput**: [`FeedInput`](/api/modules/server#feedinput) | [`IncrementalInput`](/api/modules/server#incrementalinput) | [`EnumerationInput`](/api/modules/server#enumerationinput) | [`SweepInput`](/api/modules/server#sweepinput)

The read arguments of one acquisition.

Untagged, because that is the shipped wire and the guest branches on which
fields are present. The three shapes have disjoint required fields and each
refuses unknown ones, so the union stays unambiguous in both directions.

***

### FeedInput

Ƭ **FeedInput**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `checkpoint` | `string` |

***

### IncrementalInput

Ƭ **IncrementalInput**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `sync_token` | `string` \| `null` | Rendered even when absent: the guest reads a present `null` as "no membership token yet", which is a different fact from a missing field. |
| `page_token` | `string` \| `null` | - |

***

### EnumerationInput

Ƭ **EnumerationInput**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `position` | `string` \| `null` | Engine-owned. Constructed locally, never presented to a provider, compared with a provider value, or described as a resume cursor. |
| `resume` | `string` \| `null` | The provider's own resume cursor within that position. |
| `discovery` | `DiscoverySlice` \| `null` | The retained listing slice this fanout resolves. Work input, not a guest cursor and not a new provider observation. |
| `batch_size` | `number` | - |

***

### SweepInput

Ƭ **SweepInput**: `Object`

One batch of a reconciliation sweep: the keys this engine has already
published that this pass is to read again.

The keys are the HOST's, resolved from publication and pinned on the
acquisition's own start, so the read that goes out is addressed at a key the
engine holds rather than one a connector chose. There is no cursor here and
no listing: a sweep asks the provider about named records and the provider
answers about exactly those.

#### Type declaration

| Name | Type |
| :- | :- |
| `keys` | `string`\[] |
| `batch_size` | `number` |

***

### CoupledInput

Ƭ **CoupledInput**: `Object`

What the host gives one coupled acquisition attempt.

Every field is host state the attempt is checked against, and none of it is
something an integration may invent. It is its own shape rather than a
member of `SyncInput` because a coupled group has its own reader: the
group's `coupling.read` is called with this, a collection's own `sync.read`
is called with a `SyncInput`, and no handler ever receives both.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `baseline_owed` | `boolean` | An initial enumeration is still owed, so the reader should traverse rather than read changes. |
| `checkpoints` | `Record`\<`string`, `CoupledCheckpoint`> | The provider progress marks this group actually retains, each with the response that proved it. Sorted by collection, which is also the order the retained group state iterates in. |
| `next_page_reference` | `string` \| `null` | The retained tail page this traversal resumes from, or absent to start. No other page is accepted. |
| `phase` | `CoupledPhase` | - |
| `batch_size` | `number` | - |

***

### ChangeFeedResult

Ƭ **ChangeFeedResult**\<`T`>: `Object`

What one change-feed read claims.

#### Type parameters

| Name |
| :- |
| `T` |

#### Type declaration

| Name | Type |
| :- | :- |
| `evidence` | `string` |
| `changes` | [`Observation`](/api/modules/server#observation)\<`T`>\[] |
| `next_checkpoint` | `string` |
| `observed_head` | `string` |
| `has_more` | `boolean` |

***

### Observation

Ƭ **Observation**\<`T`>: \{ `kind`: `"replace"` ; `evidence`: `string` ; `item_index`: `number` ; `key`: `string` ; `position`: `string` ; `value`: `T`  } | \{ `kind`: `"delete"` ; `evidence`: `string` ; `item_index`: `number` ; `key`: `string` ; `position`: `string`  }

One observed change in an ordered feed.

`evidence` cites the retained response that proved it; `item_index` is the
item's position *within that response*, which is how the host matches a
guest's interpretation to the evidence rather than trusting its order. A
feed item is a replacement or a deletion, and both carry the position the
provider stated. There is no third case: a feed that cannot say which of the
two an item is has no evidence contract here.

#### Type parameters

| Name |
| :- |
| `T` |

***

### RecordResult

Ƭ **RecordResult**\<`T`>: `ResetResult` | `EnumerationResult`\<`T`> | `FanoutResult`\<`T`> | `KeyedFanoutResult`\<`T`> | `SweepResult`\<`T`> | `SnapshotResult`\<`T`>

What one record-observation read claims.

Untagged, because that is the shipped wire: the guest returns a bare object
and branches on which fields it filled. The four shapes are told apart by
fields no other shape admits — `reset`, `next_page`/`next_sync`, `complete`,
`unresolved` — and each refuses the others' fields, so the union stays
unambiguous in both directions.

#### Type parameters

| Name |
| :- |
| `T` |

***

### RecordObservation

Ƭ **RecordObservation**\<`T`>: \{ `kind`: `"present"` ; `evidence`: `string` ; `item_index`: `number` ; `key`: `string` ; `version?`: `string` ; `value`: `T`  } | \{ `kind`: `"deleted"` ; `evidence`: `string` ; `item_index`: `number` ; `key`: `string`  }

One observed record.

`version` is an opaque equality token and never a position; a deletion
carries neither a version nor a value, because a record the provider says is
gone has no state to project.

#### Type parameters

| Name |
| :- |
| `T` |

***

### TransactionMetric

Ƭ **TransactionMetric**: `Object`

Used and remaining amounts for a single transaction limit.

#### Type declaration

| Name | Type |
| :- | :- |
| `used` | `number` |
| `remaining` | `number` |

***

### TransactionMetrics

Ƭ **TransactionMetrics**: `Object`

The remaining headroom for a transaction before hitting limits.

See [https://docs.bijection.com/production/state/limits](/production/state/limits)

#### Type declaration

| Name | Type |
| :- | :- |
| `bytesRead` | [`TransactionMetric`](/api/modules/server#transactionmetric) |
| `bytesWritten` | [`TransactionMetric`](/api/modules/server#transactionmetric) |
| `databaseQueries` | [`TransactionMetric`](/api/modules/server#transactionmetric) |
| `documentsRead` | [`TransactionMetric`](/api/modules/server#transactionmetric) |
| `documentsWritten` | [`TransactionMetric`](/api/modules/server#transactionmetric) |
| `functionsScheduled` | [`TransactionMetric`](/api/modules/server#transactionmetric) |
| `scheduledFunctionArgsBytes` | [`TransactionMetric`](/api/modules/server#transactionmetric) |

***

### FunctionMetadata

Ƭ **FunctionMetadata**: `Object`

Metadata about the currently executing Bijection function.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `name` | `string` | The name of the function, in the format `"path/to/module:functionName"` |
| `componentPath` | `string` | The path of the component this function belongs to. This is an empty string `""` for the app. |
| `type` | [`FunctionType`](/api/modules/server#functiontype) | Whether it's a query, mutation, or action. |
| `visibility` | [`FunctionVisibility`](/api/modules/server#functionvisibility) | Whether the function is public or internal. |

***

### DeploymentMetadata

Ƭ **DeploymentMetadata**: `Object`

Metadata about the deployment this function is running on.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `name` | `string` | The deployment name, e.g. `"tall-tiger-123"` for cloud deployments, `"local-my_team-my_project"` for local deployments, or `"anonymous-*"` for anonymous deployments. |
| `region` | `string` \| `null` | The deployment region, e.g. `"aws-us-east-1"`. `null` for local and self-hosted deployments. |
| `class` | `"s16"` \| `"s256"` \| `"d1024"` \| `"d2048"` | The deployment class, e.g. `"s16"`, `"s256"`, `"d1024"`, or `"d2048"`. |

***

### RequestMetadata

Ƭ **RequestMetadata**: `Object`

Metadata about the HTTP request that triggered the current function execution.

`ip` and `userAgent` are `null` when the function was not triggered by an
HTTP request (e.g. scheduled jobs or cron jobs).

Functions called from within a function (i.e. using `runMutation` or
`runAction`) will have the same request metadata as the parent function.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `ip` | `string` \| `null` | - |
| `userAgent` | `string` \| `null` | - |
| `requestId` | `string` | - |
| `scheduledFunctionId` | `string` \| `null` | The ID of the scheduled function document (in `_scheduled_functions`) that this execution belongs to, or `null` otherwise. This is set for the scheduled function itself and for any functions it calls (e.g. a mutation invoked via `runMutation` by a scheduled action), propagating the top-level scheduled function's ID down the call tree. It is `null` when the function was not scheduled. |
| `authToken` | `string` \| `null` | The raw auth token (a JWT) the request was authenticated with, or `null` when the request was unauthenticated or authenticated with an admin key. This is the same token that `ctx.auth.getUserIdentity()` derives its attributes from. |

***

### OperationInterfaceContract

Ƭ **OperationInterfaceContract**: `Object`

A shared operation shape. The concrete operation supplies its target ID
domain and all execution/authorization behavior.

#### Type declaration

| Name | Type |
| :- | :- |
| `version` | `1` |
| `name` | `string` |
| `args` | [`ValidatorJSON`](/api/modules/values#validatorjson) |
| `returns` | [`ValidatorJSON`](/api/modules/values#validatorjson) |

***

### OperationContract

Ƭ **OperationContract**: `Object`

The analyzed business contract paired with a generated operation reference.
It identifies a declaration and grants no authority.

#### Type declaration

| Name | Type |
| :- | :- |
| `version` | `1` |
| `operation` | `string` |
| `visibility` | `"public"` \| `"internal"` |
| `on` | `string` |
| `target?` | \{ `argument`: `string`  } |
| `target.argument` | `string` |
| `interfaces?` | [`OperationInterfaceContract`](/api/modules/server#operationinterfacecontract)\[] |
| `consumes?` | [`PublicationConsumption`](/api/modules/server#publicationconsumption) |
| `args` | [`ValidatorJSON`](/api/modules/values#validatorjson) |
| `returns` | [`ValidatorJSON`](/api/modules/values#validatorjson) |

***

### OperationContractMetadata

Ƭ **OperationContractMetadata**: `Object`

A contract and the digest carried by its generated reference.

#### Type declaration

| Name | Type |
| :- | :- |
| `contract` | [`OperationContract`](/api/modules/server#operationcontract) |
| `contract_digest` | `string` |

***

### OperationImplementation

Ƭ **OperationImplementation**\<`Args`, `Result`>: `Object`

Protected discovery returns concrete, recoverable operation addresses.
The phantom fields preserve the shared argument/result types.

#### Type parameters

| Name | Type |
| :- | :- |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `Result` | `Result` |

#### Type declaration

| Name | Type |
| :- | :- |
| `component` | `string` |
| `contract_json` | `string` |
| `contract_digest` | `string` |
| `_interfaceArgs` | `Args` |
| `_interfaceResult` | `Result` |

***

### OperationInterfaceDefinition

Ƭ **OperationInterfaceDefinition**\<`Args`, `Result`>: [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `on?`: `string`  }, `Promise`\<[`OperationImplementation`](/api/modules/server#operationimplementation)\<`Args`, `Result`>\[]>> & \{  }

A shared capability and its ordinary discovery query. It supplies no
storage, target authority, approvals or implementation.

#### Type parameters

| Name | Type |
| :- | :- |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `Result` | `Result` |

***

### ComponentOperationManifest

Ƭ **ComponentOperationManifest**: `Record`\<`string`, [`OperationContractMetadata`](/api/modules/server#operationcontractmetadata) & \{ `functions`: `Record`\<`"invoke"` | `"preview"` | `"recover"` | `"status"` | `"revise"`, `string`>  }>

Generated component exports bind a contract to each actual adapter address.

***

### OperationReference

Ƭ **OperationReference**\<`Visibility`, `Args`, `LocalResult`, `ComponentPath`>: `Object`

A generated business operation reference. This is distinct from an ordinary
query, mutation or action reference.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) = `"public"` |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) = `any` |
| `LocalResult` | `any` |
| `ComponentPath` | `string` \| `undefined` |

#### Type declaration

| Name | Type |
| :- | :- |
| `_kind` | `"operation"` |
| `_visibility` | `Visibility` |
| `_args` | `Args` |
| `_returnType` | `LocalResult` |
| `_componentPath` | `ComponentPath` |

***

### OperationArgs

Ƭ **OperationArgs**\<`Operation`>: `Operation`\[`"_args"`]

Arguments inferred from an operation reference.

#### Type parameters

| Name | Type |
| :- | :- |
| `Operation` | extends [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`> |

***

### OperationLocalResult

Ƭ **OperationLocalResult**\<`Operation`>: `Operation`\[`"_returnType"`]

The operation's validated local result, independent of remote outcomes.

#### Type parameters

| Name | Type |
| :- | :- |
| `Operation` | extends [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`> |

***

### OperationInvocationId

Ƭ **OperationInvocationId**: `string` & \{ `__operationInvocationId`: unique `symbol`  }

An accepted business invocation's opaque identity. It is a locator and grants
no permission to read or change that invocation.

***

### OperationAcceptance

Ƭ **OperationAcceptance**\<`LocalResult`>: `Object`

Evidence that the local preparation committed. This does not establish a
provider's application of any external call.

#### Type parameters

| Name | Type |
| :- | :- |
| `LocalResult` | `any` |

#### Type declaration

| Name | Type |
| :- | :- |
| `invocation_id` | [`OperationInvocationId`](/api/modules/server#operationinvocationid) |
| `accepted_revision` | `bigint` |
| `target?` | \{ `view`: `string` ; `id`: `string`  } |
| `target.view` | `string` |
| `target.id` | `string` |
| `local_result` | `LocalResult` |
| `definition_digest` | `string` |

***

### OperationRecovery

Ƭ **OperationRecovery**\<`LocalResult`>: \{ `kind`: `"absent"`  } | \{ `kind`: `"accepted"`  } & [`OperationAcceptance`](/api/modules/server#operationacceptance)\<`LocalResult`>

Recovery inspects the original request; an absent result does not itself
authorize submitting different arguments or a new request identity.

#### Type parameters

| Name | Type |
| :- | :- |
| `LocalResult` | `any` |

***

### OperationPreview

Ƭ **OperationPreview**\<`LocalResult`>: `Object`

A native evaluation result on one provisional basis. It grants no approval,
acceptance, reservation or permission to execute later.

#### Type parameters

| Name | Type |
| :- | :- |
| `LocalResult` | `any` |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `kind` | `"preview"` | - |
| `basis_revision` | `bigint` | - |
| `contract_digest` | `string` | - |
| `is_complete` | `boolean` | - |
| `is_executable` | `boolean` | - |
| `is_disclosure_complete` | `boolean` | - |
| `is_result_complete` | `boolean` | - |
| `checks` | `Record`\<`"preparation"` \| `"constraints"` \| `"governing"` \| `"invocation"`, `"satisfied"` \| `"denied"` \| `"unevaluated"`> | - |
| `arguments?` | [`Value`](/api/modules/values#value) | - |
| `local_result?` | `LocalResult` | - |
| `changes` | \{ `component`: `string` ; `table`: `string` ; `id`: `string` ; `before`: [`Value`](/api/modules/values#value) ; `after`: [`Value`](/api/modules/values#value) ; `is_derived`: `boolean`  }\[] | - |
| `external_calls` | \{ `integration`: `string` ; `command`: `string` ; `target`: `string` ; `args`: [`Value`](/api/modules/values#value) ; `outcome`: `"unevaluated"`  }\[] | - |
| `refusal` | \{ `code`: `string` ; `message`: `string`  } \| `null` | The operation's own declared refusal, when its preparation threw one: a `BijectionError` whose data carries a string `code` and `message`, repeated exactly as submitting the same request would return them and after the same check of what the preparation read. Only those two fields; null for any other failure, whose details a preview withholds. |

***

### OperationReviewState

Ƭ **OperationReviewState**: \{ `kind`: `"none"`  } | \{ `kind`: `"awaiting_review"` ; `operation`: `string` ; `blocker`: `string` ; `responsible`: `string` ; `since`: `bigint` | `null`  } | \{ `kind`: `"waiting"` ; `operation`: `string` ; `blocker`: `string` ; `responsible`: `string` ; `until`: `bigint` | `null`  } | \{ `kind`: `"approved"` ; `approval`: `string` ; `approved_by`: `string` ; `beneficiary`: `string` ; `decided_at`: `number` ; `expires_at`: `bigint`  } | \{ `kind`: `"awaiting_approval"` ; `approval`: `string` ; `approved_by`: `string` ; `beneficiary`: `string` ; `expires_at`: `bigint`  } | \{ `kind`: `"rejected"` ; `approval`: `string` ; `approved_by`: `string` ; `beneficiary`: `string`  }

Whether a request is held, and who must act. Every variant is derived from a
retained row at read time: the approval the request consumed, or the refusal
the ordinary dispatch evaluator returns for one of its external calls. No
variant is inferred from how long a request has been waiting. Instants are
epoch milliseconds: exact `bigint` where the engine stores an integer, and
`number` for `decided_at`, which is the row's own `_creationTime`.

***

### OperationStatus

Ƭ **OperationStatus**: `Omit`\<[`OperationAcceptance`](/api/modules/server#operationacceptance), `"local_result"`> & \{ `external_calls`: \{ `id`: `string` ; `delivery`: `"pending"` | `"held"` | `"unknown"` | `"delivered"` | `"refused"` | `"indeterminate"` | `"delivered_unacknowledged"` | `"not_applied"` | `"duplicated"` | `"superseded"` ; `publication`: `null` | \{ `kind`: `"pending"`  } | \{ `kind`: `"blocked"`  } | \{ `kind`: `"published"` ; `revision`: `bigint`  }  }\[] ; `summary`: \{ `total`: `bigint` ; `pending`: `bigint` ; `unknown`: `bigint` ; `refused`: `bigint` ; `delivered`: `bigint` ; `superseded`: `bigint` ; `delivered_unacknowledged`: `bigint` ; `publication_pending`: `bigint` ; `not_applied`: `bigint` ; `duplicated`: `bigint`  } ; `review`: [`OperationReviewState`](/api/modules/server#operationreviewstate)  }

The retained state of one accepted request: its acceptance identity, the
delivery and publication state of each external call it accepted, and its
review state. Delivery values describe local knowledge of the destination,
never proof that the provider applied anything. Status excludes the original
business result. Recovering that result requires retained content protection;
status rechecks current authority without releasing the earlier content.

***

### OperationErrorCode

Ƭ **OperationErrorCode**: `"OperationAccess"` | `"OperationArguments"` | `"OperationDefinitionChanged"` | `"OperationInvocationAccess"` | `"OperationInvocationBounds"` | `"OperationInvocationCustody"` | `"OperationInvocationNotFound"` | `"OperationObjectType"` | `"OperationTarget"` | `"OperationRequestConflict"` | `"OperationReadProvenanceUnavailable"` | `"OperationPreviewContext"` | `"OperationPreviewCapability"` | `"OperationRetired"` | `"OperationResultExpired"`

Native operation invocation error codes.

***

### OperationErrorData

Ƭ **OperationErrorData**: `Object`

Native invocation error data carried by the ordinary BijectionError. This
identifies the refused boundary; it does not describe an external outcome.

#### Type declaration

| Name | Type |
| :- | :- |
| `kind` | `"operation_error"` |
| `code` | [`OperationErrorCode`](/api/modules/server#operationerrorcode) |

***

### OperationFunctionReferences

Ƭ **OperationFunctionReferences**\<`Visibility`, `Args`, `LocalResult`>: `Object`

Actual generated adapter addresses, for components with explicit export
mappings. No companion address is inferred from an arbitrary component alias.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) = `"public"` |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) = `any` |
| `LocalResult` | `any` |

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `invoke` | [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `Visibility`, \{ `request_key`: `string` ; `args`: `Args` ; `expected_contract`: `string`  }, [`OperationAcceptance`](/api/modules/server#operationacceptance)\<`LocalResult`>> | - |
| `preview` | [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `Visibility`, \{ `args`: `Args` ; `expected_contract`: `string`  }, [`OperationPreview`](/api/modules/server#operationpreview)\<`LocalResult`>> | - |
| `recover` | [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `Visibility`, \{ `request_key`: `string` ; `args`: `Args` ; `expected_contract`: `string`  }, [`OperationRecovery`](/api/modules/server#operationrecovery)\<`LocalResult`>> | - |
| `status` | [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `Visibility`, \{ `expected_contract`: `string`  } & \{ `invocation_id`: `string`  } \| \{ `request_key`: `string` ; `args`: `Args`  }, [`OperationStatus`](/api/modules/server#operationstatus)> | - |
| `revise` | [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `Visibility`, \{ `invocation_id`: `string` ; `expected_contract`: `string`  }, [`OperationRevision`](/api/modules/server#operationrevision)> | Re-admits an accepted request's never-held external calls under their destinations' current revisions. |

***

### OperationRevision

Ƭ **OperationRevision**: `Object`

What `revise` reports: which of a request's external calls were re-stamped
onto the current contract, and which already named it. A call that was ever
held is not in either list -- it refuses, and the whole revision with it.

#### Type declaration

| Name | Type |
| :- | :- |
| `kind` | `"revised"` |
| `restamped` | `string`\[] |
| `unchanged` | `string`\[] |

***

### OperationDefinition

Ƭ **OperationDefinition**\<`Visibility`, `Args`, `LocalResult`>: \{ `isOperation`: `true`  } & `Visibility` extends `"public"` ? \{ `isPublic`: `true`  } : \{ `isInternal`: `true`  }

A business declaration lowered to ordinary transactional mutation and query
execution. Its object association supports discovery and grants no authority.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `LocalResult` | `LocalResult` |

***

### OperationBuilder

Ƭ **OperationBuilder**\<`DataModel`, `Visibility`>: \<ArgsValidator, ReturnsValidator>(`definition`: \{ `on`: [`ViewDefinition`](/api/classes/server.ViewDefinition)\<`any`, `any`, `any`> | [`TableDefinition`](/api/classes/server.TableDefinition)\<`any`, `any`, `any`, `any`, `false`> ; `target?`: \{ `argument`: `string`  } ; `implements?`: readonly [`OperationInterfaceDefinition`](/api/modules/server#operationinterfacedefinition)\<`any`, `any`>\[] ; `consumes?`: [`PublicationConsumption`](/api/modules/server#publicationconsumption) ; `args`: `ArgsValidator` ; `returns`: `ReturnsValidator` ; `prepare`: (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`DataModel`>, `args`: `OperationArgsFromValidator`\<`ArgsValidator`>) => [`ReturnValueForOptionalValidator`](/api/modules/server#returnvalueforoptionalvalidator)\<`ReturnsValidator`>  }) => [`OperationDefinition`](/api/modules/server#operationdefinition)\<`Visibility`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

#### Type parameters

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

#### Type declaration

▸ \<`ArgsValidator`, `ReturnsValidator`>(`definition`): [`OperationDefinition`](/api/modules/server#operationdefinition)\<`Visibility`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

The schema-specific type used by generated server utilities.

##### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `OperationArgsValidator` |
| `ReturnsValidator` | extends `OperationReturnValidator` |

##### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.on` | [`ViewDefinition`](/api/classes/server.ViewDefinition)\<`any`, `any`, `any`> \| [`TableDefinition`](/api/classes/server.TableDefinition)\<`any`, `any`, `any`, `any`, `false`> | - |
| `definition.target?` | `Object` | Explicit selected-object argument; discovery never guesses from names. |
| `definition.target.argument` | `string` | - |
| `definition.implements?` | readonly [`OperationInterfaceDefinition`](/api/modules/server#operationinterfacedefinition)\<`any`, `any`>\[] | - |
| `definition.consumes?` | [`PublicationConsumption`](/api/modules/server#publicationconsumption) | - |
| `definition.args` | `ArgsValidator` | - |
| `definition.returns` | `ReturnsValidator` | Defines the public local result type and validates preparation, independently of a particular handler's narrower result or any remote outcome. |
| `definition.prepare` | (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`DataModel`>, `args`: `OperationArgsFromValidator`\<`ArgsValidator`>) => [`ReturnValueForOptionalValidator`](/api/modules/server#returnvalueforoptionalvalidator)\<`ReturnsValidator`> | - |

##### Returns

[`OperationDefinition`](/api/modules/server#operationdefinition)\<`Visibility`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

***

### Cursor

Ƭ **Cursor**: `string`

An opaque identifier used for paginating a database query.

Cursors are returned from [paginate](/api/interfaces/server.OrderedQuery#paginate) and represent the
point of the query where the page of results ended.

To continue paginating, pass the cursor back into
[paginate](/api/interfaces/server.OrderedQuery#paginate) in the [PaginationOptions](/api/interfaces/server.PaginationOptions) object to
fetch another page of results.

Note: Cursors can only be passed to *exactly* the same database query that
they were generated from. You may not reuse a cursor between different
database queries.

***

### PublicationConsumption

Ƭ **PublicationConsumption**: `Object`

Enforced by the native reader before the declared function body runs.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `tables` | readonly `string`\[] | - |
| `compatibility` | `"sameGroup"` \| `"sharedRoots"` | - |
| `covers?` | readonly \{ `table`: `string` ; `argument`: `string`  }\[] | Each argument must be a required string containing a native checkpoint. `table` names an input relation whose processing is required. |

***

### PublicationRequirement

Ƭ **PublicationRequirement**: `Object`

A transaction-local requirement, using concrete native checkpoint values.

#### Type declaration

| Name | Type |
| :- | :- |
| `tables` | readonly `string`\[] |
| `compatibility` | `"sameGroup"` \| `"sharedRoots"` |
| `covers?` | readonly \{ `table`: `string` ; `after`: `string`  }\[] |

***

### PublicationReadiness

Ƭ **PublicationReadiness**: \{ `kind`: `"ready"`  } | \{ `kind`: `"pending"` ; `reason`: `"PublishedUnavailable"` | `"PublicationUnavailable"` | `"PublicationSourceUnavailable"` | `"PublicationGroupMismatch"` | `"PublicationEvidenceUnavailable"` | `"PublicationRootMismatch"` | `"PublicationRootOverlap"` | `"PublicationCoverage"`  }

Current native serving state under this query's read and access dependencies.

***

### PublicationEvidence

Ƭ **PublicationEvidence**: \{ `kind`: `"unknown"`  } | \{ `kind`: `"certified"` ; `roots`: \{ `table`: `string` ; `source`: `string` | `null` ; `readBasis`: `string` ; `observedFrom`: `string` | `null` ; `observedTo`: `string` | `null`  }\[] ; `partitionedRoots`: `number`  }

***

### PublicationCapture

Ƭ **PublicationCapture**: `Object`

A page read and attested by the native database owner.

#### Type declaration

| Name | Type |
| :- | :- |
| `rows` | `Record`\<`string`, `any`>\[] |
| `cursor` | `string` \| `null` |
| `isDone` | `boolean` |
| `witness` | `string` |

***

### PublicationServing

Ƭ **PublicationServing**: \{ `kind`: `"unmanaged"`  } | \{ `kind`: `"transitioning"` ; `publisher`: `string` | `null` ; `producer`: `string` | `null` ; `retired`: `boolean` ; `isInitial`: `boolean`  } | \{ `kind`: `"serving"` | `"withdrawn"` ; `publisher`: `string` ; `producer`: `string` ; `group`: `string` ; `selection`: `string` ; `run`: `string` ; `evidence`: [`PublicationEvidence`](/api/modules/server#publicationevidence)  }

***

### PublisherScanRefusal

Ƭ **PublisherScanRefusal**: `"manifestFailed"` | `"manifestInvalid"` | `"undeclaredProducer"` | `"relationOwnedElsewhere"` | `"servingUnverifiable"`

Why the native publisher scan cannot use the producer's declaration.

***

### PublicationStatus

Ƭ **PublicationStatus**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `serving` | [`PublicationServing`](/api/modules/server#publicationserving) \| `null` | - |
| `publishedAt` | `string` \| `null` | - |
| `scan` | `null` \| \{ `refusal`: [`PublisherScanRefusal`](/api/modules/server#publisherscanrefusal)  } | Set while the native scan refuses the declaration producing this relation, so no preparation can start or continue. |
| `preparation` | `null` \| \{ `state`: \{ `kind`: `"open"` \| `"sealed"` \| `"validating"` \| `"validated"`  } \| \{ `kind`: `"published"` ; `revision`: `string`  } \| \{ `kind`: `"refused"` ; `reason`: `string`  } ; `rows`: `number` ; `pages`: `number`  } | - |

***

### SerializedPublished

Ƭ **SerializedPublished**: `Object`

The wire form of one published-relation declaration, exactly as the
deployment compiler decodes it.

#### Type declaration

| Name | Type |
| :- | :- |
| `version` | `1` |
| `producer` | `string` |
| `member` | `string` |

***

### PublisherDefinition

Ƭ **PublisherDefinition**: `Object`

A publisher a business program declares.

A published relation's rows are the engine's to write. Something has to tell
the engine what to write, and it cannot be a syscall: opening a receipt
grants no authority, and a guest mutation's transaction carries the guest's
identity. So the direction is inverted. The program declares three internal
queries, the engine reads them under its own identity, and it verifies every
byte it is handed before any of it reaches a relation.

* `manifest`, a query answering which runs are ready to publish: for each,
  the producer, the execution basis the transform ran under, how many steps
  it took and the output members with their row and byte counts. It is read
  inside the engine's scan transaction, so the rows it reads become the
  publisher's region set: a committed write that makes a run ready is what
  wakes the driver, and between runs nothing runs.
* `steps`, a query paging one ready run's step records -- each step's state,
  its input digest, its continuation and the sealed receipt token the engine
  re-opens for itself.
* `page`, a query paging one output member's staged rows in key order.

All three names are resolved against the deployment at push -- a declaration
naming a function the deployment does not declare is refused there -- and
they are resolved again in the transaction that drives a step, because a
publisher outlives the push that created it.

The separate `rebuild` internal mutation records desired state after an
ownership transition. It uses the ordinary commit path and receives no
publication authority; the native driver still owns the binding switch.

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export const warehouse = definePublisher({
  producer: "warehouse",
  manifest: internal.etl.readyPublications,
  steps: internal.etl.publicationSteps,
  page: internal.etl.publicationPage,
  rebuild: internal.etl.deployment,
});
```

#### Type declaration

| Name | Type |
| :- | :- |
| `isPublisher` | `true` |

***

### ReadAccessRequest

Ƭ **ReadAccessRequest**: [`Infer`](/api/modules/values#infer)\<typeof `requests`>\[`number`]

One native object or searched-domain authorization obligation.

***

### ReadAccessArgs

Ƭ **ReadAccessArgs**: `Object`

The complete batch passed to a scoped read authorization query.

#### Type declaration

| Name | Type |
| :- | :- |
| `requests` | [`ReadAccessRequest`](/api/modules/server#readaccessrequest)\[] |

***

### ReadAccessResult

Ƭ **ReadAccessResult**: `null` | \{ `validUntil`: `number` ; `reason?`: `string`  } | \{ `reason`: `string`  }

One request's result: `null` permits it with no clock-dependent expiry,
`{ validUntil }` permits it until then. A permission may also say why it
permits, `{ reason }` or `{ validUntil, reason }`: a string of at most 256
UTF-8 bytes, which permits exactly as the same result without it. The
engine records it on its audit line of an audited table (`.access(\{ audit:
true \})`, which covers the table's read, disclose and write rules) and
never shows it to the caller; a longer or non-string reason refuses.

Throw to refuse. A rule says why it refuses with
`throw new BijectionError({ kind: "AccessRefused", why })`, which the audit
line records (cut to 256 bytes); the caller of a rule that declares its
inputs sees only the engine's fixed refusal.

***

### ReadAccessResults

Ƭ **ReadAccessResults**: [`ReadAccessResult`](/api/modules/server#readaccessresult)\[]

What every rule returns: one result per item it decides, in order -- per
request for a read or disclosure rule, per change for a table's write rule
(`.govern`, `[]` for no change), and a one-element list for an integration
command's rule. The engine refuses the batch unless every item has a
permitting result, so an item a rule never looked at is refused rather
than permitted. A bare `null`, and a rule that falls off its end (which
reaches the engine as `null`), refuses. A rule that permits without
looking must say so for each item.

***

### DisclosureArgs

Ƭ **DisclosureArgs**: `Object`

Native fixed-output disclosure request.

#### Type declaration

| Name | Type |
| :- | :- |
| `requests` | [`ReadAccessRequest`](/api/modules/server#readaccessrequest)\[] |
| `destination` | [`Infer`](/api/modules/values#infer)\<typeof `destination`> |

***

### GenericMutationCtxWithTable

Ƭ **GenericMutationCtxWithTable**\<`DataModel`>: `Omit`\<[`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`DataModel`>, `"db"`> & \{ `db`: [`GenericDatabaseWriterWithTable`](/api/interfaces/server.GenericDatabaseWriterWithTable)\<`DataModel`>  }

A set of services for use within Bijection mutation functions.

The mutation context is passed as the first argument to any Bijection mutation
function run on the server.

You should generally use the `MutationCtx` type from
`"./_generated/server"`.

#### Type parameters

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

***

### GenericQueryCtxWithTable

Ƭ **GenericQueryCtxWithTable**\<`DataModel`>: `Omit`\<[`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`DataModel`>, `"db"`> & \{ `db`: [`GenericDatabaseReaderWithTable`](/api/interfaces/server.GenericDatabaseReaderWithTable)\<`DataModel`>  }

A set of services for use within Bijection query functions.

The query context is passed as the first argument to any Bijection query
function run on the server.

This differs from the MutationCtx because all of the services are
read-only.

#### Type parameters

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

***

### DefaultFunctionArgs

Ƭ **DefaultFunctionArgs**: `Record`\<`string`, `unknown`>

The default arguments type for a Bijection query, mutation, or action function.

Bijection functions always take an arguments object that maps the argument
names to their values.

***

### ArgsArray

Ƭ **ArgsArray**: `OneArgArray` | `NoArgsArray`

An array of arguments to a Bijection function.

Bijection functions can take either a single [DefaultFunctionArgs](/api/modules/server#defaultfunctionargs) object or no
args at all.

***

### ArgsArrayToObject

Ƭ **ArgsArrayToObject**\<`Args`>: `Args` extends `OneArgArray`\<infer ArgsObject> ? `ArgsObject` : `EmptyObject`

Convert an [ArgsArray](/api/modules/server#argsarray) into a single object type.

Empty arguments arrays are converted to EmptyObject.

#### Type parameters

| Name | Type |
| :- | :- |
| `Args` | extends [`ArgsArray`](/api/modules/server#argsarray) |

***

### FunctionVisibility

Ƭ **FunctionVisibility**: `"public"` | `"internal"`

A type representing the visibility of a Bijection function.

***

### RegisteredMutation

Ƭ **RegisteredMutation**\<`Visibility`, `Args`, `Returns`>: \{ `isBijectionFunction`: `true` ; `isMutation`: `true`  } & `VisibilityProperties`\<`Visibility`>

A mutation function that is part of this app.

You can create a mutation by wrapping your function in
[mutationGeneric](/api/modules/server#mutationgeneric) or [internalMutationGeneric](/api/modules/server#internalmutationgeneric) and exporting it.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `Returns` | `Returns` |

***

### RegisteredQuery

Ƭ **RegisteredQuery**\<`Visibility`, `Args`, `Returns`>: \{ `isBijectionFunction`: `true` ; `isQuery`: `true`  } & `VisibilityProperties`\<`Visibility`>

A query function that is part of this app.

You can create a query by wrapping your function in
[queryGeneric](/api/modules/server#querygeneric) or [internalQueryGeneric](/api/modules/server#internalquerygeneric) and exporting it.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `Returns` | `Returns` |

***

### RegisteredAction

Ƭ **RegisteredAction**\<`Visibility`, `Args`, `Returns`>: \{ `isBijectionFunction`: `true` ; `isAction`: `true`  } & `VisibilityProperties`\<`Visibility`>

An action that is part of this app.

You can create an action by wrapping your function in
[actionGeneric](/api/modules/server#actiongeneric) or [internalActionGeneric](/api/modules/server#internalactiongeneric) and exporting it.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `Returns` | `Returns` |

***

### PublicHttpAction

Ƭ **PublicHttpAction**: `Object`

An HTTP action that is part of this app's public API.

You can create public HTTP actions by wrapping your function in
[httpActionGeneric](/api/modules/server#httpactiongeneric) and exporting it.

#### Type declaration

| Name | Type |
| :- | :- |
| `isHttp` | `true` |

***

### UnvalidatedFunction

Ƭ **UnvalidatedFunction**\<`Ctx`, `Args`, `Returns`>: (`ctx`: `Ctx`, ...`args`: `Args`) => `Returns` | \{ `handler`: (`ctx`: `Ctx`, ...`args`: `Args`) => `Returns`  }

**`Deprecated`**

\-- See the type definition for `MutationBuilder` or similar for
the types used for defining Bijection functions.

The definition of a Bijection query, mutation, or action function without
argument validation.

Bijection functions always take a context object as their first argument
and an (optional) args object as their second argument.

This can be written as a function like:

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { query } from "./_generated/server";

export const func = query(({ db }, { arg }) => {...});
```

or as an object like:

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { query } from "./_generated/server";

export const func = query({
  handler: ({ db }, { arg }) => {...},
});
```

See [ValidatedFunction](/api/interfaces/server.ValidatedFunction) to add argument validation.

#### Type parameters

| Name | Type |
| :- | :- |
| `Ctx` | `Ctx` |
| `Args` | extends [`ArgsArray`](/api/modules/server#argsarray) |
| `Returns` | `Returns` |

***

### ReturnValueForOptionalValidator

Ƭ **ReturnValueForOptionalValidator**\<`ReturnsValidator`>: \[`ReturnsValidator`] extends \[[`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>] ? [`ValidatorTypeToReturnType`](/api/modules/server#validatortypetoreturntype)\<[`Infer`](/api/modules/values#infer)\<`ReturnsValidator`>> : \[`ReturnsValidator`] extends \[[`PropertyValidators`](/api/modules/values#propertyvalidators)] ? [`ValidatorTypeToReturnType`](/api/modules/server#validatortypetoreturntype)\<[`ObjectType`](/api/modules/values#objecttype)\<`ReturnsValidator`>> : `any`

There are multiple syntaxes for defining a Bijection function:

```
 - query(async (ctx, args) => {...})
 - query({ handler: async (ctx, args) => {...} })
 - query({ args: { a: v.string }, handler: async (ctx, args) => {...} } })
 - query({ args: { a: v.string }, returns: v.string(), handler: async (ctx, args) => {...} } })
```

In each of these, we want to correctly infer the type for the arguments and
return value, preferring the type derived from a validator if it's provided.

To avoid having a separate overload for each, which would show up in error messages,
we use the type params -- ArgsValidator, ReturnsValidator, ReturnValue, OneOrZeroArgs.

The type for ReturnValue and OneOrZeroArgs are constrained by the type or ArgsValidator and
ReturnsValidator if they're present, and inferred from any explicit type annotations to the
arguments or return value of the function.

Below are a few utility types to get the appropriate type constraints based on
an optional validator.

Additional tricks:

* We use Validator | void instead of Validator | undefined because the latter does
  not work with `strictNullChecks` since it's equivalent to just `Validator`.
* We use a tuple type of length 1 to avoid distribution over the union
  [https://github.com/microsoft/TypeScript/issues/29368#issuecomment-453529532](https://github.com/microsoft/TypeScript/issues/29368#issuecomment-453529532)

#### Type parameters

| Name | Type |
| :- | :- |
| `ReturnsValidator` | extends [`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) \| `void` |

***

### ArgsArrayForOptionalValidator

Ƭ **ArgsArrayForOptionalValidator**\<`ArgsValidator`>: \[`ArgsValidator`] extends \[[`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>] ? `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> : \[`ArgsValidator`] extends \[[`PropertyValidators`](/api/modules/values#propertyvalidators)] ? `OneArgArray`\<[`ObjectType`](/api/modules/values#objecttype)\<`ArgsValidator`>> : [`ArgsArray`](/api/modules/server#argsarray)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends [`GenericValidator`](/api/modules/values#genericvalidator) \| [`PropertyValidators`](/api/modules/values#propertyvalidators) \| `void` |

***

### DefaultArgsForOptionalValidator

Ƭ **DefaultArgsForOptionalValidator**\<`ArgsValidator`>: \[`ArgsValidator`] extends \[[`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`>] ? \[[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>] : \[`ArgsValidator`] extends \[[`PropertyValidators`](/api/modules/values#propertyvalidators)] ? \[[`ObjectType`](/api/modules/values#objecttype)\<`ArgsValidator`>] : `OneArgArray`

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends [`GenericValidator`](/api/modules/values#genericvalidator) \| [`PropertyValidators`](/api/modules/values#propertyvalidators) \| `void` |

***

### MutationBuilder

Ƭ **MutationBuilder**\<`DataModel`, `Visibility`>: \<ArgsValidator, ReturnsValidator, ReturnValue, OneOrZeroArgs>(`mutation`: \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } | (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`) => [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

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

#### Type declaration

▸ \<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`mutation`): [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Internal type helper used by Bijection code generation.

Used to give [mutationGeneric](/api/modules/server#mutationgeneric) a type specific to your data model.

##### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

##### Parameters

| Name | Type |
| :- | :- |
| `mutation` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

##### Returns

[`RegisteredMutation`](/api/modules/server#registeredmutation)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### MutationBuilderWithTable

Ƭ **MutationBuilderWithTable**\<`DataModel`, `Visibility`>: \<ArgsValidator, ReturnsValidator, ReturnValue, OneOrZeroArgs>(`mutation`: \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericMutationCtxWithTable`](/api/modules/server#genericmutationctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } | (`ctx`: [`GenericMutationCtxWithTable`](/api/modules/server#genericmutationctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`) => [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

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

#### Type declaration

▸ \<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`mutation`): [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Internal type helper used by Bijection code generation.

Used to give [mutationGeneric](/api/modules/server#mutationgeneric) a type specific to your data model.

##### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

##### Parameters

| Name | Type |
| :- | :- |
| `mutation` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericMutationCtxWithTable`](/api/modules/server#genericmutationctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericMutationCtxWithTable`](/api/modules/server#genericmutationctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

##### Returns

[`RegisteredMutation`](/api/modules/server#registeredmutation)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### QueryBuilder

Ƭ **QueryBuilder**\<`DataModel`, `Visibility`>: \<ArgsValidator, ReturnsValidator, ReturnValue, OneOrZeroArgs>(`query`: \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`) => [`RegisteredQuery`](/api/modules/server#registeredquery)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

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

#### Type declaration

▸ \<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`query`): [`RegisteredQuery`](/api/modules/server#registeredquery)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Internal type helper used by Bijection code generation.

Used to give [queryGeneric](/api/modules/server#querygeneric) a type specific to your data model.

##### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

##### Parameters

| Name | Type |
| :- | :- |
| `query` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

##### Returns

[`RegisteredQuery`](/api/modules/server#registeredquery)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### QueryBuilderWithTable

Ƭ **QueryBuilderWithTable**\<`DataModel`, `Visibility`>: \<ArgsValidator, ReturnsValidator, ReturnValue, OneOrZeroArgs>(`query`: \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericQueryCtxWithTable`](/api/modules/server#genericqueryctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } | (`ctx`: [`GenericQueryCtxWithTable`](/api/modules/server#genericqueryctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`) => [`RegisteredQuery`](/api/modules/server#registeredquery)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

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

#### Type declaration

▸ \<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`query`): [`RegisteredQuery`](/api/modules/server#registeredquery)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Internal type helper used by Bijection code generation.

Used to give [queryGeneric](/api/modules/server#querygeneric) a type specific to your data model.

##### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

##### Parameters

| Name | Type |
| :- | :- |
| `query` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericQueryCtxWithTable`](/api/modules/server#genericqueryctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericQueryCtxWithTable`](/api/modules/server#genericqueryctxwithtable)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

##### Returns

[`RegisteredQuery`](/api/modules/server#registeredquery)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### ActionBuilder

Ƭ **ActionBuilder**\<`DataModel`, `Visibility`>: \<ArgsValidator, ReturnsValidator, ReturnValue, OneOrZeroArgs>(`func`: \{ `args?`: `ArgsValidator` ; `capabilities?`: \{ `functions`: readonly [`FunctionReference`](/api/modules/server#functionreference)\<`"query"` | `"mutation"` | `"action"`, `"public"` | `"internal"`>\[]  } ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } | (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`) => [`RegisteredAction`](/api/modules/server#registeredaction)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

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

#### Type declaration

▸ \<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`func`): [`RegisteredAction`](/api/modules/server#registeredaction)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Internal type helper used by Bijection code generation.

Used to give [actionGeneric](/api/modules/server#actiongeneric) a type specific to your data model.

##### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

##### Parameters

| Name | Type |
| :- | :- |
| `func` | \{ `args?`: `ArgsValidator` ; `capabilities?`: \{ `functions`: readonly [`FunctionReference`](/api/modules/server#functionreference)\<`"query"` \| `"mutation"` \| `"action"`, `"public"` \| `"internal"`>\[]  } ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`DataModel`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

##### Returns

[`RegisteredAction`](/api/modules/server#registeredaction)\<`Visibility`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### HttpActionBuilder

Ƭ **HttpActionBuilder**: (`func`: (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`any`>, `request`: `Request`) => `Promise`\<`Response`>) => [`PublicHttpAction`](/api/modules/server#publichttpaction)

#### Type declaration

▸ (`func`): [`PublicHttpAction`](/api/modules/server#publichttpaction)

Internal type helper used by Bijection code generation.

Used to give [httpActionGeneric](/api/modules/server#httpactiongeneric) a type specific to your data model
and functions.

##### Parameters

| Name | Type |
| :- | :- |
| `func` | (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`any`>, `request`: `Request`) => `Promise`\<`Response`> |

##### Returns

[`PublicHttpAction`](/api/modules/server#publichttpaction)

***

### RoutableMethod

Ƭ **RoutableMethod**: typeof [`ROUTABLE_HTTP_METHODS`](/api/modules/server#routable_http_methods)\[`number`]

A type representing the methods supported by Bijection HTTP actions.

HEAD is handled by Bijection by running GET and stripping the body.
CONNECT is not supported and will not be supported.
TRACE is not supported and will not be supported.

***

### RouteSpecWithPath

Ƭ **RouteSpecWithPath**: `Object`

A type representing a route to an HTTP action using an exact request URL path match.

Used by [HttpRouter](/api/classes/server.HttpRouter) to route requests to HTTP actions.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `path` | `string` | Exact HTTP request path to route. |
| `method` | [`RoutableMethod`](/api/modules/server#routablemethod) | HTTP method ("GET", "POST", ...) to route. |
| `handler` | [`PublicHttpAction`](/api/modules/server#publichttpaction) | The HTTP action to execute. |

***

### RouteSpecWithPathPrefix

Ƭ **RouteSpecWithPathPrefix**: `Object`

A type representing a route to an HTTP action using a request URL path prefix match.

Used by [HttpRouter](/api/classes/server.HttpRouter) to route requests to HTTP actions.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `pathPrefix` | `string` | An HTTP request path prefix to route. Requests with a path starting with this value will be routed to the HTTP action. |
| `method` | [`RoutableMethod`](/api/modules/server#routablemethod) | HTTP method ("GET", "POST", ...) to route. |
| `handler` | [`PublicHttpAction`](/api/modules/server#publichttpaction) | The HTTP action to execute. |

***

### RouteSpec

Ƭ **RouteSpec**: [`RouteSpecWithPath`](/api/modules/server#routespecwithpath) | [`RouteSpecWithPathPrefix`](/api/modules/server#routespecwithpathprefix)

A type representing a route to an HTTP action.

Used by [HttpRouter](/api/classes/server.HttpRouter) to route requests to HTTP actions.

***

### SchedulableFunctionReference

Ƭ **SchedulableFunctionReference**: [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"` | `"action"`, `"public"` | `"internal"`>

A [FunctionReference](/api/modules/server#functionreference) that can be scheduled to run in the future.

Schedulable functions are mutations and actions that are public or internal.

***

### SystemFieldValidators

Ƭ **SystemFieldValidators**\<`TableName`>: `Object`

The validators for the system fields Bijection adds to every document.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |

#### Type declaration

| Name | Type |
| :- | :- |
| `_id` | [`VId`](/api/classes/values.VId)\<[`GenericId`](/api/modules/values#genericid)\<`TableName`>> |
| `_creationTime` | [`VFloat64`](/api/classes/values.VFloat64)\<`number`> |

***

### DocValidator

Ƭ **DocValidator**\<`TableName`, `DocumentType`>: `DocumentType` extends [`VUnion`](/api/classes/values.VUnion)\<`any`, infer Members, `any`, `any`> ? \{ \[Index in keyof Members]: WithSystemFieldValidators\<TableName, Members\[Index]> } extends infer NewMembers ? [`VUnion`](/api/classes/values.VUnion)\<`WithSystemFieldValidators`\<`TableName`, `Members`\[`number`]>\[`"type"`], `NewMembers`> : `never` : `WithSystemFieldValidators`\<`TableName`, `DocumentType`>

The validator for whole documents of a table: the table's own validator with
the `_id` and `_creationTime` system fields added.

For a table defined with a union, the system fields are added to each member
of the union.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |
| `DocumentType` | extends [`Validator`](/api/modules/values#validator)\<`any`, `any`, `any`> |

***

### GenericSchema

Ƭ **GenericSchema**: `Record`\<`string`, [`TableDefinition`](/api/classes/server.TableDefinition)\<`any`, `any`, `any`, `any`, `boolean`>>

A type describing the schema of a Bijection project.

This should be constructed using [defineSchema](/api/modules/server#defineschema), [defineTable](/api/modules/server#definetable),
and [v](/api/modules/values#v).

***

### DataModelFromSchemaDefinition

Ƭ **DataModelFromSchemaDefinition**\<`SchemaDef`>: `MaybeMakeLooseDataModel`\<\{ \[TableName in keyof SchemaDef\["tables"] & string]: SchemaDef\["tables"]\[TableName] extends ViewDefinition\<infer From, infer Plan, infer ViewIndexes> ? ViewDataModelEntry\<SchemaDef\["tables"], From, Plan, ViewIndexes> : SchemaDef\["tables"]\[TableName] extends PublishedDefinition\<infer Row, infer PublishedIndexes> ? PublishedDataModelEntry\<Expand\<IdField\<TableName> & ExtractDocument\<Row>>, keyof IdField\<TableName> | ExtractFieldPaths\<Row>, PublishedIndexes> : SchemaDef\["tables"]\[TableName] extends TableDefinition\<infer DocumentType, infer Indexes, infer SearchIndexes, infer VectorIndexes, infer IsSource> ? Object & SourceWritability\<IsSource> : never }, `SchemaDef`\[`"strictTableNameTypes"`]>

Internal type used in Bijection code generation!

Convert a [SchemaDefinition](/api/classes/server.SchemaDefinition) into a [GenericDataModel](/api/modules/server#genericdatamodel).

#### Type parameters

| Name | Type |
| :- | :- |
| `SchemaDef` | extends [`SchemaDefinition`](/api/classes/server.SchemaDefinition)\<`any`, `boolean`> |

***

### SystemTableNames

Ƭ **SystemTableNames**: [`TableNamesInDataModel`](/api/modules/server#tablenamesindatamodel)\<[`SystemDataModel`](/api/interfaces/server.SystemDataModel)>

***

### GoverningResult

Ƭ **GoverningResult**: `null` | \{ `validUntil`: `number`  }

The result a rule gives ONE item it decides: a read or disclosure request,
a table change or a command. A rule never returns it bare: it returns one
per item, in order ([ReadAccessResults](/api/modules/server#readaccessresults)), so a rule that falls off its
end (`return;`, which reaches the engine as `null`) or returns early refuses
instead of permitting what it never decided. Null permits the item with no
clock-dependent expiry. A rule observing time must return its complete
validity bound unless native enforcement independently establishes that
bound. validUntil is finite safe-integer epoch milliseconds, strictly after
the evaluation clock and at most 366 days ahead. The native committer must
commit strictly before it. Throw to deny.

***

### ReadAccess

Ƭ **ReadAccess**: `Object`

Read authorization using an ordinary same-component query.
The query receives the native batch described by [readAccessArgs](/api/modules/server#readaccessargs)
and returns one result per request ([ReadAccessResults](/api/modules/server#readaccessresults)); a decision
about the whole relation is written `requests.map(() => decision)`. It runs
as the original caller. Declared policy inputs are private to native policy
execution, not disclosure grants. In a query, an index range withholds the
rows the rule refuses and answers as if they did not exist; every other
refused read, and every refused read in a mutation, refuses the whole
answer. Refusal never redacts properties.

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `read` | [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"public"` \| `"internal"`, [`ReadAccessArgs`](/api/modules/server#readaccessargs-2), [`ReadAccessResults`](/api/modules/server#readaccessresults)> | - |
| `disclose?` | [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"public"` \| `"internal"`, [`DisclosureArgs`](/api/modules/server#disclosureargs-2), [`ReadAccessResults`](/api/modules/server#readaccessresults)> | Independently authorizes a fixed release to another destination. Omission refuses protected writes and HTTP disclosure. Uses the same private inputs; ordinary table releases are checked against pre-change authority. |
| `reads` | readonly `string`\[] | - |
| `rowsFollowRange?` | readonly \{ `index`: `string` ; `field`: `string` ; `markings?`: `string`  }\[] | The ranges whose decision decides every row they deliver: a range read through `index` with `field` pinned by an equality. The author's statement that no row of such a range narrows what the range permits. A result that would exceed the read evidence bound then keeps one covering demand per such range instead of one per row. Releases that must recheck each row's content refuse such a result, so it is read again. A text or vector search whose filter pins `field` runs over that range's rows alone, ranked from them, and presents the range's demand; a text search also presents a covering demand standing for the rows it ranked among (one per marking set with `markings`). `index` must be an index of the table led by `field`. The access model reports the ranges of its types that qualify. A covering demand reaches `read` and `disclose` with `target.covers: true`. Tests and development builds check the statement: when either rule permits such a demand, every row it covers is decided too by that rule (with the same destination), and a row refused (or permitted for less time) fails the function with `RowsFollowRangeViolated`. A release build trusts it unless `BIJECTION_CHECK_DECLARED_RANGES` is set. |
| `audit?` | `boolean` | Record every decision of this table's rules in the deployment's audit log: each read `read` decides (`access.read.*`), each release `disclose` decides (`access.disclose.*`) and each change the table's `.govern` rule decides (`access.write.*`). A line names the caller, the rule, what it decided -- the requests, the destination's kind and table, or each change's id, operation and changed field names, never a value -- whether it permitted, and the reason the rule gave. A refused decision's lines name no row and no value. The engine writes the record, so nothing the function does can skip it. This is the table's one audit declaration: a table whose writes should be audited declares `.access` with `audit`, since `.govern` has no flag of its own. |
| `appliesDelegation?` | `boolean` | The author's statement that `read` applies a delegated caller's narrowing claims (`delegatedScope`, `delegatedPermissions`), as the access model's rules do. The engine never reads those claims: a caller carrying one is refused on every table whose read rule does not declare this, including a table without a rule. |

***

### TableChange

Ƭ **TableChange**\<`Document`>: `Object`

One net local document change passed to a table's final governing query.
Documents include their ordinary system fields. Null denotes absence.

#### Type parameters

| Name | Type |
| :- | :- |
| `Document` | extends `Object` |

#### Type declaration

| Name | Type |
| :- | :- |
| `id` | `Document`\[`"_id"`] |
| `before` | `Document` \| `null` |
| `after` | `Document` \| `null` |

***

### LinkEndpointFields

Ƭ **LinkEndpointFields**\<`DocumentType`>: `DocumentType` extends \{ `fields`: infer Fields  } ? \{ \[Field in keyof Fields]: Fields\[Field] extends Object ? Field : never }\[keyof `Fields`] & `string` : `never`

Required ID fields in a table validator eligible as relationship endpoints.

#### Type parameters

| Name |
| :- |
| `DocumentType` |

***

### DocumentFields

Ƭ **DocumentFields**\<`Document`>: `Document` extends `unknown` ? keyof `Document` & `string` : `never`

Top-level properties available in any variant of a document.

#### Type parameters

| Name |
| :- |
| `Document` |

***

### SelectedDocument

Ƭ **SelectedDocument**\<`Document`, `Fields`>: `Document` extends `unknown` ? `Pick`\<`Document`, `Extract`\<`Fields` | `"_id"` | `"_creationTime"`, keyof `Document`>> : `never`

Selected document properties, retaining identity and creation time.

#### Type parameters

| Name | Type |
| :- | :- |
| `Document` | `Document` |
| `Fields` | extends `string` |

***

### StorageId

Ƭ **StorageId**: `string`

**`Deprecated`**

This ID format is no longer returned by stable file storage APIs. Use `Id<"_storage">` instead.

The old ID format used by Bijection file storage.

⚠️ Security warning: Anyone that has knows to this ID can download the underlying file
from `https://<deployment>.bijection.cloud/api/storage/<storageId>`.
(Note that it’s safe to share the new ID format, `Id<"_storage">`, to anyone).

***

### FileStorageId

Ƭ **FileStorageId**: [`GenericId`](/api/modules/values#genericid)\<`"_storage"`> | [`StorageId`](/api/modules/server#storageid)

**`Deprecated`**

This type is only necessary for backwards compatibility with Bijection versions that
pre-date `bijection@1.6.0`. Use `Id<"_storage">` instead.

***

### FileMetadata

Ƭ **FileMetadata**: `Object`

**`Deprecated`**

This type is only returned by [storage.getUrl](/api/interfaces/server.BijectionStorageReader#geturl).
To get the details of a document, use `ctx.db.system.get("_storage", storageId)` instead.

Metadata for a single file as returned by [storage.getMetadata](/api/interfaces/server.BijectionStorageReader#getmetadata).

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `storageId` | [`StorageId`](/api/modules/server#storageid) | ID for referencing the file (eg. via [storage.getUrl](/api/interfaces/server.BijectionStorageReader#geturl)) This is an older ID format that is no longer returned by stable file storage APIs. Consider using `Id<"_storage">` instead. ⚠️ Security warning: Anyone that has knows to this ID can download the underlying file from `https://<deployment>.bijection.cloud/api/storage/<storageId>`. (Note that it’s safe to share the new ID format, `Id<"_storage">`, to anyone). |
| `sha256` | `string` | Hex encoded sha256 checksum of file contents |
| `size` | `number` | Size of the file in bytes |
| `contentType` | `string` \| `null` | ContentType of the file if it was provided on upload |

***

### SystemFields

Ƭ **SystemFields**: `Object`

The fields that Bijection automatically adds to documents, not including `_id`.

This is an object type mapping field name to field type.

#### Type declaration

| Name | Type |
| :- | :- |
| `_creationTime` | `number` |

***

### IdField

Ƭ **IdField**\<`TableName`>: `Object`

The `_id` field that Bijection automatically adds to documents.

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |

#### Type declaration

| Name | Type |
| :- | :- |
| `_id` | [`GenericId`](/api/modules/values#genericid)\<`TableName`> |

***

### WithoutSystemFields

Ƭ **WithoutSystemFields**\<`Document`>: [`Expand`](/api/modules/server#expand)\<[`BetterOmit`](/api/modules/server#betteromit)\<`Document`, keyof [`SystemFields`](/api/modules/server#systemfields) | `"_id"`>>

A Bijection document with the system fields like `_id` and `_creationTime` omitted.

#### Type parameters

| Name | Type |
| :- | :- |
| `Document` | extends [`GenericDocument`](/api/modules/server#genericdocument) |

***

### WithOptionalSystemFields

Ƭ **WithOptionalSystemFields**\<`Document`>: [`Expand`](/api/modules/server#expand)\<[`WithoutSystemFields`](/api/modules/server#withoutsystemfields)\<`Document`> & `Partial`\<`Pick`\<`Document`, keyof [`SystemFields`](/api/modules/server#systemfields) | `"_id"`>>>

A Bijection document with the system fields like `_id` and `_creationTime` optional.

#### Type parameters

| Name | Type |
| :- | :- |
| `Document` | extends [`GenericDocument`](/api/modules/server#genericdocument) |

***

### SystemIndexes

Ƭ **SystemIndexes**: `Object`

The indexes that Bijection automatically adds to every table.

This is an object mapping index names to index field paths.

#### Type declaration

| Name | Type |
| :- | :- |
| `by_id` | \[`"_id"`] |
| `by_creation_time` | \[`"_creationTime"`] |

***

### IndexTiebreakerField

Ƭ **IndexTiebreakerField**: `"_creationTime"`

Bijection automatically appends "\_creationTime" to the end of every index to
break ties if all of the other fields are identical.

***

### VectorSearch

Ƭ **VectorSearch**\<`DataModel`, `TableName`, `IndexName`>: (`tableName`: `TableName`, `indexName`: `IndexName`, `query`: [`VectorSearchQuery`](/api/interfaces/server.VectorSearchQuery)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>, `IndexName`>) => `Promise`\<\{ `_id`: [`GenericId`](/api/modules/values#genericid)\<`TableName`> ; `_score`: `number`  }\[]>

#### Type parameters

| Name | Type |
| :- | :- |
| `DataModel` | extends [`GenericDataModel`](/api/modules/server#genericdatamodel) |
| `TableName` | extends [`TableNamesInDataModel`](/api/modules/server#tablenamesindatamodel)\<`DataModel`> |
| `IndexName` | extends [`VectorIndexNames`](/api/modules/server#vectorindexnames)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>> |

#### Type declaration

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

##### Parameters

| Name | Type |
| :- | :- |
| `tableName` | `TableName` |
| `indexName` | `IndexName` |
| `query` | [`VectorSearchQuery`](/api/interfaces/server.VectorSearchQuery)\<[`NamedTableInfo`](/api/modules/server#namedtableinfo)\<`DataModel`, `TableName`>, `IndexName`> |

##### Returns

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

***

### ViewLimits

Ƭ **ViewLimits**: `Object`

The bounded work requested by a view. Deployment also enforces server caps.

#### Type declaration

| Name | Type |
| :- | :- |
| `max_rows` | `number` |
| `max_bytes` | `number` |

***

### ViewKey

Ƭ **ViewKey**\<`From`>: `Object`

#### Type parameters

| Name | Type |
| :- | :- |
| `From` | extends `string` = `string` |

#### Type declaration

| Name | Type |
| :- | :- |
| `from` | `From` |
| `field` | `"_id"` |

***

### ViewWindow

Ƭ **ViewWindow**: `Object`

Rolling latest-N rows within each group at the pinned read basis. Values
sort ascending by these fields, then the complete row; the greatest rows
enter the frame. Strings sort lexically. This does not expire by wall time.

#### Type declaration

| Name | Type |
| :- | :- |
| `order_by` | readonly `string`\[] |
| `rows` | `number` |

***

### ViewPlan

Ƭ **ViewPlan**: \{ `kind`: `"scan"` ; `table`: `string`  } | \{ `kind`: `"alias"` ; `input`: [`ViewPlan`](/api/modules/server#viewplan) ; `alias`: `string`  } | \{ `kind`: `"filter"` ; `input`: [`ViewPlan`](/api/modules/server#viewplan) ; `predicate`: [`JSONValue`](/api/modules/values#jsonvalue)  } | \{ `kind`: `"select"` ; `input`: [`ViewPlan`](/api/modules/server#viewplan) ; `fields`: `Record`\<`string`, [`JSONValue`](/api/modules/values#jsonvalue)>  } | \{ `kind`: `"join"` ; `input`: [`ViewPlan`](/api/modules/server#viewplan) ; `right`: [`ViewPlan`](/api/modules/server#viewplan) ; `join`: `"left"` | `"inner"` ; `left`: `string`\[] ; `right_field`: `string`\[] ; `index?`: `string` ; `cardinality`: `"one"` | `"many"`  } | \{ `kind`: `"group"` ; `input`: [`ViewPlan`](/api/modules/server#viewplan) ; `fields`: `string`\[] ; `aggregates`: `Record`\<`string`, `ViewAggregate`> ; `window?`: [`ViewWindow`](/api/modules/server#viewwindow)  }

Canonical relational declaration; scalar expressions use the ordinary query wire format.

***

### SerializedView

Ƭ **SerializedView**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `version` | `1` |
| `mode` | `"virtual"` \| `"materialized"` |
| `key` | [`ViewKey`](/api/modules/server#viewkey) |
| `expression` | [`ViewPlan`](/api/modules/server#viewplan) |
| `limits` | [`ViewLimits`](/api/modules/server#viewlimits) |

***

### ViewJoinOptions

Ƭ **ViewJoinOptions**: `Object`

#### Type declaration

| Name | Type | Description |
| :- | :- | :- |
| `left` | `string` \| readonly `string`\[] | Equalities in index order. Both sides must name the complete grouped key. |
| `right` | `string` \| readonly `string`\[] | - |
| `index?` | `string` | Required for a base-table join except its built-in ID index. Group inputs use their group key. |
| `cardinality?` | `"one"` \| `"many"` | - |

***

### BarrierInstant

Ƭ **BarrierInstant**: `Object`

The instant a `common` barrier requires every named source to have reached.

There is deliberately no literal-revision form here. An engine revision does
not fit a JavaScript `number` exactly, and a barrier written against a
rounded revision would compare against an instant nobody chose. A decision
that needs a literal revision states it where revisions are exact; from
TypeScript, a barrier is anchored on a source's own publication.

#### Type declaration

| Name | Type |
| :- | :- |
| `kind` | `"publication_of"` |
| `of` | [`SourceScope`](/api/modules/server#sourcescope) |

***

### SourceScope

Ƭ **SourceScope**: `Object`

One installed source and the scope of it a decision reads. A barrier names a
source the way the rest of the engine does; it introduces no new identity.

#### Type declaration

| Name | Type |
| :- | :- |
| `source` | `string` |
| `scope` | `string` |

***

### SourceBarrier

Ƭ **SourceBarrier**: \{ `kind`: `"none"`  } | \{ `kind`: `"each_latest"`  } | \{ `kind`: `"complete_versions"`  } | \{ `kind`: `"common"` ; `at`: [`BarrierInstant`](/api/modules/server#barrierinstant)  }

The barrier a decision declares over the source-bound relations it reads.

***

### WaitDefinition

Ƭ **WaitDefinition**: `Object`

A durable wait a business program declares.

A business-time boundary -- a price validity lapsing, a supplier's ship-by
promise falling due, a temporary override ending -- changes nothing about
the rows it is about when it passes. Something has to commit. Until now the
only way a program could say so was a cron sweeping on an interval, which
makes the interval the deadline's precision and runs whether or not anything
is due.

A declaration names two of the deployment's own internal functions and
nothing else:

* `due`, a query answering when this concern's next boundary is, as epoch
  milliseconds, or `null` when there is none. It is read through the
  ordinary reader, so the rows it reads become the wait's region set: a
  committed write that moves the answer is what re-arms the wait, and
  between boundaries nothing runs.
* `then`, a mutation the engine schedules through the ordinary scheduler in
  the transaction that settles the wait.

Both names are resolved against the deployment at push -- a declaration
naming a function the deployment does not declare is refused there -- and
`then` is resolved AGAIN in the transaction that releases the work, because
a wait row outlives the push that created it and the deployment current when
the boundary arrives is the one whose authority the release runs under.

Both are internal, which is the program saying these entry points belong to
the engine rather than to any client that can reach the deployment.

A declaration may also name `keys`, an internal query returning at most 32
stable instance keys (strings of 1 to 128 bytes). Each key is then its own
standing wait: its `due` runs in its own transaction, so one instance's
reads never become another's, and `due` and `then` receive `{ key }`. A key
the query stops listing is retired. `keys` should read only routing that
grants nothing by itself; `then` still rechecks the instance's own state,
because a key can be removed between the boundary and the continuation.

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
export const priceValidity = defineWait({
  due: internal.catalogue.nextPriceExpiry,
  then: internal.catalogue.expirePrices,
});
```

#### Type declaration

| Name | Type |
| :- | :- |
| `isWait` | `true` |

***

### Expand

Ƭ **Expand**\<`ObjectType`>: `ObjectType` extends `Record`\<`any`, `any`> ? \{ \[Key in keyof ObjectType]: ObjectType\[Key] } : `never`

Hack! This type causes TypeScript to simplify how it renders object types.

It is functionally the identity for object types, but in practice it can
simplify expressions like `A & B`.

#### Type parameters

| Name | Type |
| :- | :- |
| `ObjectType` | extends `Record`\<`any`, `any`> |

***

### BetterOmit

Ƭ **BetterOmit**\<`T`, `K`>: \{ \[Property in keyof T as Property extends K ? never : Property]: T\[Property] }

An `Omit<>` type that:

1. Applies to each element of a union.
2. Preserves the index signature of the underlying type.

#### Type parameters

| Name | Type |
| :- | :- |
| `T` | `T` |
| `K` | extends keyof `T` |

## Variables

### anyApi

• `Const` **anyApi**: [`AnyApi`](/api/modules/server#anyapi)

A utility for constructing [FunctionReference](/api/modules/server#functionreference)s in projects that
are not using code generation.

You can create a reference to a function like:

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const reference = anyApi.myModule.myFunction;
```

This supports accessing any path regardless of what directories and modules
are in your project. All function references are typed as
AnyFunctionReference.

If you're using code generation, use `api` from `bijection/_generated/api`
instead. It will be more type-safe and produce better auto-complete
in your editor.

***

### execution

• `Const` **execution**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `acquireSnapshot` | (`key`: `string`, `handle`: `string`) => `Promise`\<`string`> |
| `useSnapshot` | (`lease`: `string`) => `Promise`\<`null`> |
| `releaseSnapshot` | (`lease`: `string`) => `Promise`\<`null`> |
| `limitTransaction` | (`limits`: [`TransactionLimits`](/api/interfaces/server.TransactionLimits)) => `Promise`\<`null`> |
| `begin` | () => `Promise`\<\{ `code`: `string` ; `name`: `string` ; `resources`: `ExecutionResources`  }> |
| `basis` | (`handle`: `string`) => `Promise`\<\{ `code`: `string` ; `name`: `string`  }> |
| `seal` | (`payload`: `string`) => `Promise`\<`string`> |
| `sealCaptured` | (`payload`: `string`) => `Promise`\<`string`> |
| `open` | (`token`: `string`, `payload`: `string`) => `Promise`\<\{ `code`: `string` ; `name`: `string` ; `scheduled`: `string` ; `digest`: `string` ; `verifiedCapturesDigest?`: `string` ; `verifiedCapturesComplete?`: `boolean` ; `resources`: `ExecutionResources`  }> |

***

### ROOT\_TYPE

• `Const` **ROOT\_TYPE**: `"root"`

The one object every tree hangs from. A type without a parent is a child
of the root, so an administrator of everything is an ordinary role on an
ordinary object, and a whole-table read is a scope pinned at the root.

***

### ROOT\_KEY

• `Const` **ROOT\_KEY**: `"*"`

The key of the single root object.

***

### log

• `Const` **log**: `Log`

***

### paginationOptsValidator

• `Const` **paginationOptsValidator**: [`VObject`](/api/classes/values.VObject)\<\{ `id`: `undefined` | `number` ; `endCursor`: `undefined` | `null` | `string` ; `maximumRowsRead`: `undefined` | `number` ; `maximumBytesRead`: `undefined` | `number` ; `numItems`: `number` ; `cursor`: `null` | `string`  }, \{ `numItems`: [`VFloat64`](/api/classes/values.VFloat64)\<`number`, `"required"`> ; `cursor`: [`VUnion`](/api/classes/values.VUnion)\<`null` | `string`, \[[`VString`](/api/classes/values.VString)\<`string`, `"required"`>, [`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>], `"required"`, `never`> ; `endCursor`: [`VUnion`](/api/classes/values.VUnion)\<`undefined` | `null` | `string`, \[[`VString`](/api/classes/values.VString)\<`string`, `"required"`>, [`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>], `"optional"`, `never`> ; `id`: [`VFloat64`](/api/classes/values.VFloat64)\<`undefined` | `number`, `"optional"`> ; `maximumRowsRead`: [`VFloat64`](/api/classes/values.VFloat64)\<`undefined` | `number`, `"optional"`> ; `maximumBytesRead`: [`VFloat64`](/api/classes/values.VFloat64)\<`undefined` | `number`, `"optional"`>  }, `"required"`, `"id"` | `"numItems"` | `"cursor"` | `"endCursor"` | `"maximumRowsRead"` | `"maximumBytesRead"`>

A [Validator](/api/modules/values#validator) for [PaginationOptions](/api/interfaces/server.PaginationOptions).

Use this as the args validator in paginated query functions so that clients
can pass pagination options.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { query } from "./_generated/server";
import { paginationOptsValidator } from "bijection/server";
import { v } from "bijection/values";

export const listMessages = query({
  args: {
    channelId: v.id("channels"),
    paginationOpts: paginationOptsValidator,
  },
  handler: async (ctx, args) => {
    return await ctx.db
      .query("messages")
      .withIndex("by_channel", (q) => q.eq("channelId", args.channelId))
      .order("desc")
      .paginate(args.paginationOpts);
  },
});
```

On the client, use `usePaginatedQuery` from `"bijection/react"`:

```tsx theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const { results, status, loadMore } = usePaginatedQuery(
  api.messages.listMessages,
  { channelId },
  { initialNumItems: 25 },
);
```

**`See`**

[https://docs.bijection.com/database/pagination](/database/pagination)

***

### publications

• `Const` **publications**: `Object`

#### Type declaration

| Name | Type |
| :- | :- |
| `consuming` | \<T>(`fn`: `T`, `declaration`: [`PublicationConsumption`](/api/modules/server#publicationconsumption)) => `T` |
| `isCurrentTransition` | (`input`: \{ `publisher`: `string` ; `producer`: `string` ; `tables`: `string`\[] ; `epoch`: `string` ; `transitionId`: `string`  }) => `Promise`\<`boolean`> |
| `require` | (`requirement`: [`PublicationRequirement`](/api/modules/server#publicationrequirement)) => `Promise`\<`null`> |
| `readiness` | (`requirement`: [`PublicationRequirement`](/api/modules/server#publicationrequirement)) => `Promise`\<[`PublicationReadiness`](/api/modules/server#publicationreadiness)> |
| `checkpoint` | (`input`: \{ `table`: `string` ; `source?`: `string`  }) => `Promise`\<`string`> |
| `acceptedCheckpoint` | (`input`: \{ `operation`: `string` ; `invocation_id`: `string` ; `table`: `string`  }) => `Promise`\<`string`> |
| `capture` | (`input`: \{ `table`: `string` ; `source?`: \{ `id`: `string` ; `index`: `string`  } ; `publication?`: `PublicationSelection` ; `partitionField?`: `string` ; `cursor`: `null` \| `string` ; `limit`: `number`  }) => `Promise`\<[`PublicationCapture`](/api/modules/server#publicationcapture)> |
| `partitionPlan` | (`input`: \{ `pages`: `string`\[] ; `partitionField`: `string`  }) => `Promise`\<`string`> |
| `authorizeMemberRead` | (`input`: \{ `table`: `string` ; `producer`: `string` ; `member`: `string`  }) => `Promise`\<`null`> |
| `requirePublisherQuery` | (`role`: `"page"` \| `"manifest"` \| `"steps"`, `owner?`: \{ `publisher`: \{ `manifest`: `string` ; `steps`: `string` ; `page`: `string`  } ; `run?`: `string` ; `selection?`: `string` ; `member?`: `string`  }) => `Promise`\<`null`> |
| `status` | (`table`: `string`, `selection`: `null` \| `string`) => `Promise`\<[`PublicationStatus`](/api/modules/server#publicationstatus)> |

***

### readAccessArgs

• `Const` **readAccessArgs**: `Object`

Arguments for an ordinary query used by `.access({ read, reads })`.
The native reader constructs the complete batch. Calling the query directly
does not grant private policy-input access or authorize another database read.

`properties: null` requires the whole document. Otherwise properties include
selected fields and fields contributing to membership, filtering and order,
including `_id` and `_creationTime`. Nested paths require their whole top-level
property. Query equalities are guaranteed index bounds, not guessed filters.
An omitted equality value denotes absence; null remains an explicit value.

A query target with `covers: true` stands for rows the engine does not
present as requests of their own: a maintained total, a count, a table
change token, a whole relation's status, a range folded past the read
evidence bound (`rowsFollowRange`) or a retained obligation kept in place of
per-row requests. Its result decides every row it covers. Without the key,
any row the read returned arrives as a request of its own.

#### Type declaration

| Name | Type |
| :- | :- |
| `requests` | [`VArray`](/api/classes/values.VArray)\<\{ `table`: `string` ; `properties`: `null` \| `string`\[] ; `target`: \{ kind: "object"; id: string; } \| \{ covers?: true; kind: "query"; equalities: \{ value?: Value; field: string; }\[]; }  }\[], [`VObject`](/api/classes/values.VObject)\<\{ `table`: `string` ; `properties`: `null` \| `string`\[] ; `target`: \{ kind: "object"; id: string; } \| \{ covers?: true; kind: "query"; equalities: \{ value?: Value; field: string; }\[]; }  }, \{ `table`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `properties`: [`VUnion`](/api/classes/values.VUnion)\<`null` \| `string`\[], \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VArray`](/api/classes/values.VArray)\<`string`\[], [`VString`](/api/classes/values.VString)\<`string`, `"required"`>, `"required"`>], `"required"`, `never`> ; `target`: [`VUnion`](/api/classes/values.VUnion)\<\{ `kind`: `"object"` ; `id`: `string`  } \| \{ `covers`: `undefined` \| `true` ; `kind`: `"query"` ; `equalities`: \{ value?: Value; field: string; }\[]  }, \[[`VObject`](/api/classes/values.VObject)\<\{ `kind`: `"object"` ; `id`: `string`  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"object"`, `"required"`> ; `id`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`>  }, `"required"`, `"kind"` \| `"id"`>, [`VObject`](/api/classes/values.VObject)\<\{ `covers`: `undefined` \| `true` ; `kind`: `"query"` ; `equalities`: \{ value?: Value; field: string; }\[]  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"query"`, `"required"`> ; `equalities`: [`VArray`](/api/classes/values.VArray)\<\{ `value`: `undefined` \| [`Value`](/api/modules/values#value) ; `field`: `string`  }\[], [`VObject`](/api/classes/values.VObject)\<\{ `value`: `undefined` \| [`Value`](/api/modules/values#value) ; `field`: `string`  }, \{ `field`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `value`: [`VAny`](/api/classes/values.VAny)\<`undefined` \| [`Value`](/api/modules/values#value), `"optional"`, `string`>  }, `"required"`, `"value"` \| `"field"` \| \`value.\$\{string}\`>, `"required"`> ; `covers`: [`VLiteral`](/api/classes/values.VLiteral)\<`undefined` \| `true`, `"optional"`>  }, `"required"`, `"kind"` \| `"equalities"` \| `"covers"`>], `"required"`, `"kind"` \| `"id"` \| `"equalities"` \| `"covers"`>  }, `"required"`, `"table"` \| `"properties"` \| `"target"` \| `"target.kind"` \| `"target.id"` \| `"target.equalities"` \| `"target.covers"`>, `"required"`> |

***

### readAccessResults

• `Const` **readAccessResults**: [`VArray`](/api/classes/values.VArray)\<(`null` | \{ `reason`: `undefined` | `string` ; `validUntil`: `number`  } | \{ `reason`: `string`  })\[], [`VUnion`](/api/classes/values.VUnion)\<`null` | \{ `reason`: `undefined` | `string` ; `validUntil`: `number`  } | \{ `reason`: `string`  }, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VObject`](/api/classes/values.VObject)\<\{ `reason`: `undefined` | `string` ; `validUntil`: `number`  }, \{ `validUntil`: [`VFloat64`](/api/classes/values.VFloat64)\<`number`, `"required"`> ; `reason`: [`VString`](/api/classes/values.VString)\<`undefined` | `string`, `"optional"`>  }, `"required"`, `"validUntil"` | `"reason"`>, [`VObject`](/api/classes/values.VObject)\<\{ `reason`: `string`  }, \{ `reason`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`>  }, `"required"`, `"reason"`>], `"required"`, `"validUntil"` | `"reason"`>, `"required"`>

The return validator of every rule: read, disclose, a table's write rule
(`.govern`) and an integration command's rule. A command rule gives no
reason; one that defers with `recheckAt` declares that member beside
`null` and `{ validUntil }`.

***

### disclosureArgs

• `Const` **disclosureArgs**: `Object`

Arguments for the source's optional `.access({ disclose })` query. The host
supplies actual information dependencies and the exact fixed destination.
A table release gives the resulting record its destination table's policy;
it does not grant future reads of the source or retract previously released
bytes when a source grant is later revoked.

#### Type declaration

| Name | Type |
| :- | :- |
| `requests` | [`VArray`](/api/classes/values.VArray)\<\{ `table`: `string` ; `properties`: `null` \| `string`\[] ; `target`: \{ kind: "object"; id: string; } \| \{ covers?: true; kind: "query"; equalities: \{ value?: Value; field: string; }\[]; }  }\[], [`VObject`](/api/classes/values.VObject)\<\{ `table`: `string` ; `properties`: `null` \| `string`\[] ; `target`: \{ kind: "object"; id: string; } \| \{ covers?: true; kind: "query"; equalities: \{ value?: Value; field: string; }\[]; }  }, \{ `table`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `properties`: [`VUnion`](/api/classes/values.VUnion)\<`null` \| `string`\[], \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VArray`](/api/classes/values.VArray)\<`string`\[], [`VString`](/api/classes/values.VString)\<`string`, `"required"`>, `"required"`>], `"required"`, `never`> ; `target`: [`VUnion`](/api/classes/values.VUnion)\<\{ `kind`: `"object"` ; `id`: `string`  } \| \{ `covers`: `undefined` \| `true` ; `kind`: `"query"` ; `equalities`: \{ value?: Value; field: string; }\[]  }, \[[`VObject`](/api/classes/values.VObject)\<\{ `kind`: `"object"` ; `id`: `string`  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"object"`, `"required"`> ; `id`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`>  }, `"required"`, `"kind"` \| `"id"`>, [`VObject`](/api/classes/values.VObject)\<\{ `covers`: `undefined` \| `true` ; `kind`: `"query"` ; `equalities`: \{ value?: Value; field: string; }\[]  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"query"`, `"required"`> ; `equalities`: [`VArray`](/api/classes/values.VArray)\<\{ `value`: `undefined` \| [`Value`](/api/modules/values#value) ; `field`: `string`  }\[], [`VObject`](/api/classes/values.VObject)\<\{ `value`: `undefined` \| [`Value`](/api/modules/values#value) ; `field`: `string`  }, \{ `field`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `value`: [`VAny`](/api/classes/values.VAny)\<`undefined` \| [`Value`](/api/modules/values#value), `"optional"`, `string`>  }, `"required"`, `"value"` \| `"field"` \| \`value.\$\{string}\`>, `"required"`> ; `covers`: [`VLiteral`](/api/classes/values.VLiteral)\<`undefined` \| `true`, `"optional"`>  }, `"required"`, `"kind"` \| `"equalities"` \| `"covers"`>], `"required"`, `"kind"` \| `"id"` \| `"equalities"` \| `"covers"`>  }, `"required"`, `"table"` \| `"properties"` \| `"target"` \| `"target.kind"` \| `"target.id"` \| `"target.equalities"` \| `"target.covers"`>, `"required"`> |
| `destination` | [`VUnion`](/api/classes/values.VUnion)\<\{ `kind`: `"table"` ; `changes`: \{ id: string; before: any; after: any; }\[] ; `table`: `string` ; `component`: `null` \| `string`  } \| \{ `kind`: `"http"` ; `url`: `string` ; `method`: `string`  } \| \{ `kind`: `"command"` ; `target`: `string` ; `component`: `null` \| `string` ; `command`: `string` ; `integration`: `string` ; `contract`: `string` ; `phase`: `"acceptance"` \| `"send"` \| `"reconcile"` ; `args`: `any`  } \| \{ `kind`: `"storageShare"` ; `storageId`: `string` ; `shareId`: `string` ; `sha256`: `string` ; `size`: `number` ; `recipient`: `string` ; `expiresAt`: `number`  } \| \{ `kind`: `"storageRevoke"` ; `storageId`: `string` ; `shareId`: `string` ; `recipient`: `string`  } \| \{ `kind`: `"custody"` ; `component`: `null` \| `string`  }, \[[`VObject`](/api/classes/values.VObject)\<\{ `kind`: `"table"` ; `changes`: \{ id: string; before: any; after: any; }\[] ; `table`: `string` ; `component`: `null` \| `string`  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"table"`, `"required"`> ; `component`: [`VUnion`](/api/classes/values.VUnion)\<`null` \| `string`, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VString`](/api/classes/values.VString)\<`string`, `"required"`>], `"required"`, `never`> ; `table`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `changes`: [`VArray`](/api/classes/values.VArray)\<\{ `id`: `string` ; `before`: `any` ; `after`: `any`  }\[], [`VObject`](/api/classes/values.VObject)\<\{ `id`: `string` ; `before`: `any` ; `after`: `any`  }, \{ `id`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `before`: [`VUnion`](/api/classes/values.VUnion)\<`any`, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VAny`](/api/classes/values.VAny)\<`any`, `"required"`, `string`>], `"required"`, `string`> ; `after`: [`VUnion`](/api/classes/values.VUnion)\<`any`, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VAny`](/api/classes/values.VAny)\<`any`, `"required"`, `string`>], `"required"`, `string`>  }, `"required"`, `"id"` \| `"before"` \| `"after"` \| \`before.$\{string}\` \| \`after.$\{string}\`>, `"required"`>  }, `"required"`, `"kind"` \| `"changes"` \| `"table"` \| `"component"`>, [`VObject`](/api/classes/values.VObject)\<\{ `kind`: `"http"` ; `url`: `string` ; `method`: `string`  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"http"`, `"required"`> ; `url`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `method`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`>  }, `"required"`, `"kind"` \| `"url"` \| `"method"`>, [`VObject`](/api/classes/values.VObject)\<\{ `kind`: `"command"` ; `target`: `string` ; `component`: `null` \| `string` ; `command`: `string` ; `integration`: `string` ; `contract`: `string` ; `phase`: `"acceptance"` \| `"send"` \| `"reconcile"` ; `args`: `any`  }, \{ `kind`: [`VLiteral`](/api/classes/values.VLiteral)\<`"command"`, `"required"`> ; `component`: [`VUnion`](/api/classes/values.VUnion)\<`null` \| `string`, \[[`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>, [`VString`](/api/classes/values.VString)\<`string`, `"required"`>], `"required"`, `never`> ; `integration`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `command`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `target`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `contract`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `phase`: [`VUnion`](/api/classes/values.VUnion)\<`"acceptance"` \| `"send"` \| `"reconcile"`, \[[`VLiteral`](/api/classes/values.VLiteral)\<`"acceptance"`, `"required"`>, [`VLiteral`](/api/classes/values.VLiteral)\<`"send"`, `"required"`>, [`VLiteral`](/api/classes/values.VLiteral)\<`"reconcile"`, `"required"`>], `"required"`, `never`> ; `args`: [`VAny`](/api/classes/values.VAny)\<`any`, `"required"`, `string`>  }, `"required"`, `"kind"` \| `"target"` \| `"component"` \| `"command"` \| `"integration"` \| `"contract"` \| `"phase"` \| `"args"` \| \`args.$\{string}\`\>], ``"required"``, ``"kind"`` \| ``"changes"`` \| ``"table"`` \| ``"target"`` \| ``"component"`` \| ``"url"`` \| ``"method"`` \| ``"command"`` \| ``"integration"`` \| ``"contract"`` \| ``"phase"`` \| ``"args"`` \| \`args.$\{string}\` \| `"storageId"` \| `"shareId"` \| `"sha256"` \| `"size"` \| `"recipient"` \| `"expiresAt"`> |

***

### ROUTABLE\_HTTP\_METHODS

• `Const` **ROUTABLE\_HTTP\_METHODS**: readonly \[`"GET"`, `"POST"`, `"PUT"`, `"DELETE"`, `"OPTIONS"`, `"PATCH"`]

A list of the methods supported by Bijection HTTP actions.

HEAD is handled by Bijection by running GET and stripping the body.
CONNECT is not supported and will not be supported.
TRACE is not supported and will not be supported.

***

### q

• `Const` **q**: `Object`

Declarative relational and scalar operators, evaluated by the engine.

#### Type declaration

| Name | Type |
| :- | :- |
| `eq` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `neq` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `lt` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `lte` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `gt` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `gte` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `add` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`T`> |
| `sub` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`T`> |
| `mul` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`T`> |
| `div` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`T`> |
| `mod` | \<T>(`l`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>, `r`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`T`> |
| `neg` | \<T>(`x`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`T`>) => [`Expression`](/api/classes/server.Expression)\<`T`> |
| `and` | (...`exprs`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`boolean`>\[]) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `or` | (...`exprs`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`boolean`>\[]) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `not` | (`x`: [`ExpressionOrValue`](/api/modules/server#expressionorvalue)\<`boolean`>) => [`Expression`](/api/classes/server.Expression)\<`boolean`> |
| `table` | \<Name>(`table`: `Name`) => [`ViewQuery`](/api/classes/server.ViewQuery)\<`Scan`\<`Name`>> |
| `field` | \<Path>(`path`: `Path`) => `ViewField`\<`Path`> |
| `count` | () => \{ `kind`: `"count"`  } |
| `sum` | \<Field>(`field`: `Field`) => \{ `kind`: `"sum"` ; `field`: `Field`  } |
| `decimalSum` | \<Field>(`field`: `Field`, `scale`: `number`) => \{ `kind`: `"decimal_sum"` ; `field`: `Field` ; `scale`: `number`  } |
| `countDistinct` | \<Field>(`field`: `Field`) => \{ `kind`: `"count_distinct"` ; `field`: `Field`  } |
| `percentile` | \<Field>(`field`: `Field`, `basisPoints`: `number`) => \{ `kind`: `"percentile"` ; `field`: `Field` ; `basis_points`: `number` = basisPoints; `decimal_scale`: `null` = null } |
| `decimalPercentile` | \<Field>(`field`: `Field`, `basisPoints`: `number`, `scale`: `number`) => \{ `kind`: `"percentile"` ; `field`: `Field` ; `basis_points`: `number` = basisPoints; `decimal_scale`: `number` = scale } |

***

### sourceBarrier

• `Const` **sourceBarrier**: `Object`

The barriers, as declared data. The wire shape is exactly what the
engine decodes; `views.barrier.test.ts` and the Rust decoder each pin it
against independent literals.

#### Type declaration

| Name | Type |
| :- | :- |
| `none` | () => [`SourceBarrier`](/api/modules/server#sourcebarrier) |
| `eachLatest` | () => [`SourceBarrier`](/api/modules/server#sourcebarrier) |
| `completeVersions` | () => [`SourceBarrier`](/api/modules/server#sourcebarrier) |
| `publishedWith` | (`source`: `string`, `scope`: `string`) => [`SourceBarrier`](/api/modules/server#sourcebarrier) |

## Functions

### getFunctionName

▸ **getFunctionName**(`functionReference`): `string`

Get the name of a function from a [FunctionReference](/api/modules/server#functionreference).

The name is a string like "myDir/myModule:myFunction". If the exported name
of the function is `"default"`, the function name is omitted
(e.g. "myDir/myModule").

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `functionReference` | [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `any`, `any`, `any`, `undefined` \| `string`> \| [`FunctionReference_future`](/api/modules/server#functionreference_future)\<`any`, `any`, `any`, `any`, `undefined` \| `string`> | A [FunctionReference](/api/modules/server#functionreference) to get the name of. |

#### Returns

`string`

A string of the function's name.

***

### makeFunctionReference

▸ **makeFunctionReference**\<`type`, `args`, `ret`>(`name`): [`FunctionReference`](/api/modules/server#functionreference)\<`type`, `"public"`, `args`, `ret`>

FunctionReferences generally come from generated code, but in custom clients
it may be useful to be able to build one manually.

Real function references are empty objects at runtime, but the same interface
can be implemented with an object for tests and clients which don't use
code generation.

#### Type parameters

| Name | Type |
| :- | :- |
| `type` | extends [`FunctionType`](/api/modules/server#functiontype) |
| `args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) = `any` |
| `ret` | `any` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `name` | `string` | The identifier of the function. E.g. `path/to/file:functionName` |

#### Returns

[`FunctionReference`](/api/modules/server#functionreference)\<`type`, `"public"`, `args`, `ret`>

***

### filterApi

▸ **filterApi**\<`API`, `Predicate`>(`api`): [`FilterApi`](/api/modules/server#filterapi)\<`API`, `Predicate`>

Given an api of type API and a FunctionReference subtype, return an api object
containing only the function references that match.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const q = filterApi<typeof api, FunctionReference<"query">>(api)
```

#### Type parameters

| Name |
| :- |
| `API` |
| `Predicate` |

#### Parameters

| Name | Type |
| :- | :- |
| `api` | `API` |

#### Returns

[`FilterApi`](/api/modules/server#filterapi)\<`API`, `Predicate`>

***

### getMany

▸ **getMany**(`_ctx`, `table`, `ids`): `Promise`\<`AppPointRead`\[]>

Read several objects of one table or view by identifier, each answered on
its own: `object`, `absent`, or `restricted` when the engine refused that
object's read for the caller. At most 100 distinct identifiers, answered in
order; an identifier that is not one of this table's is refused as
`db.get` refuses it.

In a query, one refused object answers `restricted` and the rest of the
answer stands. Everywhere else (a mutation, a policy) these are ordinary
point reads, and a refused one refuses the whole call as `db.get` does.
Every other read of the query is still decided with the whole answer,
except that a query's index range withholds the rows the caller may not
read, as if they did not exist.

#### Parameters

| Name | Type |
| :- | :- |
| `_ctx` | [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)> |
| `table` | `string` |
| `ids` | `string`\[] |

#### Returns

`Promise`\<`AppPointRead`\[]>

***

### applicationQueries

▸ **applicationQueries**(`definition`): `Object`

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.collections` | `Record`\<`string`, `AppPresentation`> | - |
| `definition.operations` | `Record`\<`string`, `AppPresentation`> | - |
| `definition.authorize` | (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>) => `Promise`\<`void`> | Refuse (throw) unless the caller is a current member of this product. It is run for every query with the caller's own context. It is also run to decide whether the OWNER of a shared saved view is still a member, with `ctx.auth` answering for that owner as the state row retains them (token identifier, issuer and subject only) while every other context member still acts for the reader. The callback must therefore decide from `ctx.auth` and the deployment environment alone: a database read inside it would answer for the reader, not the owner. An error the callback throws itself means "not a member" and hides the view; an error raised by an engine call it makes (a refused or over-budget read) fails the query. |
| `definition.features?` | `AppFeature`\[] | Capabilities exposed beside collections and operations. Each entry is disclosure metadata whose module enforces its own access. |
| `definition.stateTable?` | `string` | Customer-owned table with the indexes by\_owner\_key (`["owner", "key"]`) and by\_shared (`["is_shared", "key"]`); see `ApplicationStateAccess`. |
| `definition.people?` | [`ApplicationPeople`](/api/modules/server#applicationpeople) | Who the application's people are; see `ApplicationPeople`. Required to declare notifications: the caller's own person is their recipient. |
| `definition.notifications?` | [`ApplicationNotifications`](/api/modules/server#applicationnotifications) | - |
| `definition.series?` | `ApplicationSeries` | Readers of declared geotemporal series properties, by collection and property; see `AppSeriesReader` (`@bijection/datasets/geotemporal` builds one). |
| `definition.places?` | [`ApplicationPlaces`](/api/modules/server#applicationplaces) | Location search for maps: a durable request and its reactive answer; see `ApplicationPlaces`. |
| `definition.mapValues?` | [`ApplicationMapValues`](/api/modules/server#applicationmapvalues) | Values the program computes for map styling, by name; see `ApplicationMapValues`. |
| `definition.spatialIndexes?` | [`AppSpatialIndexes`](/api/modules/server#appspatialindexes) | Spatial indexes the program answers regions, nearest objects and cell summaries with, by collection and declared geometry property; see `AppSpatialIndex` (`@bijection/datasets/appSpatial` builds one). |
| `definition.maps?` | `ApplicationMaps` | Deployment map settings, basemaps and who administers them; see `ApplicationMaps`. |
| `definition.readable?` | `Record`\<`string`, (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>) => `Promise`\<`boolean`>> | Collections the program withholds whole from a caller it does not clear, each with its decision: a collection every row of which derives from marked data, such as a marked series' fence events. A collection declined for the caller is left out of their catalog and counted in `restricted_collections`, and every read naming it is refused: a listing, a count or a facet of it is never a short answer. It is a leaf: no other collection's relation or connection type, the people, a notification kind or a map value names it, so nothing served refers to what is left out. A decision is the caller's, from `ctx` (its reads are the caller's), like `authorize`. |
| `definition.sourceControl?` | [`ApplicationSourceControl`](/api/modules/server#applicationsourcecontrol) | Who may ask for a sync of a source, or a check of its connection (`requestSourceSync`, `requestConnectionCheck`): the caller's decision, from `ctx`, for one source of an exposed synced collection. Absent, nobody may; reading sync history (`sourceSyncs`) needs only read access. See `ApplicationSourceControl`. |

#### Returns

`Object`

| Name | Type | Description |
| :- | :- | :- |
| `workspaceState` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{}, `Promise`\<`AppWorkspaceState`>> | - |
| `saveView` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `name`: `string` ; `view`: `any` ; `revision`: `number` ; `is_shared`: `boolean`  }, `Promise`\<`null`>> | - |
| `deleteView` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `revision`: `number`  }, `Promise`\<`null`>> | - |
| `savePreferences` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `preferences`: \{ theme?: "system" \| "light" \| "dark"; density?: "compact" \| "comfortable"; locale?: string; timeZone?: string; pinnedApps?: string\[]; recentObjects?: \{ id: string; collection: string; }\[]; railGroups?: Record\<...>; } ; `revision`: `number`  }, `Promise`\<`null`>> | - |
| `savedGraph` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `string`  }, `Promise`\<`AppSavedGraph`>> | - |
| `saveGraph` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `name`: `string` ; `graph`: `any` ; `revision`: `number`  }, `Promise`\<\{ `id`: `string` ; `revision`: `number`  }>> | - |
| `deleteGraph` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `revision`: `number`  }, `Promise`\<`null`>> | - |
| `catalog` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{}, `Promise`\<`AppCatalog`>> | - |
| `objects` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `collection`: `string` ; `ids`: `string`\[]  }, `Promise`\<(`null` \| [`GenericDocument`](/api/modules/server#genericdocument))\[]>> | - |
| `labels` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `objects`: \{ id: string; collection: string; }\[]  }, `Promise`\<`AppObjectLabel`\[]>> | - |
| `search` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `text`: `string`  }, `Promise`\<\{ `collection`: `string` = type.name; `label`: `string` ; `mode`: `AppSearchMode` ; `is_complete`: `boolean` ; `objects`: \{ `collection`: `string` = type.name; `id`: [`Value`](/api/modules/values#value) = row.\_id; `title`: `string`  }\[]  }\[]>> | - |
| `facets` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `within`: `undefined` \| \{ mode?: "contains" \| "within" \| "intersects" \| "disjoint"; field: string; region: any; } ; `search`: `undefined` \| `string` ; `related`: `undefined` \| \{ match?: "any" \| "all"; has?: "some" \| "none"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; relation: string; }\[] ; `order`: `undefined` \| `"asc"` \| `"desc"` ; `filters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `ids`: `undefined` \| `string`\[] ; `nearest`: `any` ; `filterMode`: `undefined` \| `"any"` \| `"all"` ; `groups`: `undefined` \| \{ match: "any" \| "all"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; }\[] ; `asOf`: `undefined` \| `string` ; `analysisFilters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `orderBy`: `undefined` \| `string` ; `histogram`: `undefined` \| `string` ; `collection`: `string`  }, `Promise`\<`AppFacets`>> | - |
| `connections` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `where`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `order`: `undefined` \| `"asc"` \| `"desc"` ; `id`: `string` ; `collection`: `string` ; `paginationOpts`: \{ id?: number; endCursor?: string \| null; maximumRowsRead?: number; maximumBytesRead?: number; numItems: number; cursor: string \| null; } ; `relation`: `string`  }, `Promise`\<`AppPage`>> | - |
| `browse` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `within`: `undefined` \| \{ mode?: "contains" \| "within" \| "intersects" \| "disjoint"; field: string; region: any; } ; `search`: `undefined` \| `string` ; `related`: `undefined` \| \{ match?: "any" \| "all"; has?: "some" \| "none"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; relation: string; }\[] ; `order`: `undefined` \| `"asc"` \| `"desc"` ; `filters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `ids`: `undefined` \| `string`\[] ; `nearest`: `any` ; `filterMode`: `undefined` \| `"any"` \| `"all"` ; `groups`: `undefined` \| \{ match: "any" \| "all"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; }\[] ; `asOf`: `undefined` \| `string` ; `analysisFilters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `orderBy`: `undefined` \| `string` ; `collection`: `string` ; `paginationOpts`: \{ id?: number; endCursor?: string \| null; maximumRowsRead?: number; maximumBytesRead?: number; numItems: number; cursor: string \| null; }  }, `Promise`\<`AppPage`>> | - |
| `summary` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `within`: `undefined` \| \{ mode?: "contains" \| "within" \| "intersects" \| "disjoint"; field: string; region: any; } ; `search`: `undefined` \| `string` ; `related`: `undefined` \| \{ match?: "any" \| "all"; has?: "some" \| "none"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; relation: string; }\[] ; `order`: `undefined` \| `"asc"` \| `"desc"` ; `filters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `ids`: `undefined` \| `string`\[] ; `nearest`: `any` ; `measure`: `undefined` \| `string` ; `filterMode`: `undefined` \| `"any"` \| `"all"` ; `groups`: `undefined` \| \{ match: "any" \| "all"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; }\[] ; `asOf`: `undefined` \| `string` ; `analysisFilters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `cells`: `undefined` \| \{ system: "geohash" \| "h3"; resolution: number; } ; `bucket`: `undefined` \| `"day"` \| `"month"` \| `"week"` ; `pivotBy`: `undefined` \| `string` ; `orderBy`: `undefined` \| `string` ; `top`: `undefined` \| `number` ; `collection`: `string` ; `groupBy`: `string`  }, `Promise`\<`AppSummary`>> | - |
| `analysis` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `within`: `undefined` \| \{ mode?: "contains" \| "within" \| "intersects" \| "disjoint"; field: string; region: any; } ; `search`: `undefined` \| `string` ; `related`: `undefined` \| \{ match?: "any" \| "all"; has?: "some" \| "none"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; relation: string; }\[] ; `order`: `undefined` \| `"asc"` \| `"desc"` ; `filters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `ids`: `undefined` \| `string`\[] ; `nearest`: `any` ; `measure`: `undefined` \| `string` ; `filterMode`: `undefined` \| `"any"` \| `"all"` ; `groups`: `undefined` \| \{ match: "any" \| "all"; filters: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; }\[] ; `asOf`: `undefined` \| `string` ; `analysisFilters`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `cells`: `undefined` \| \{ system: "geohash" \| "h3"; resolution: number; } ; `groupBy`: `undefined` \| `string` ; `bucket`: `undefined` \| `"day"` \| `"month"` \| `"week"` ; `pivotBy`: `undefined` \| `string` ; `orderBy`: `undefined` \| `string` ; `top`: `undefined` \| `number` ; `collection`: `string` ; `paginationOpts`: \{ id?: number; endCursor?: string \| null; maximumRowsRead?: number; maximumBytesRead?: number; numItems: number; cursor: string \| null; }  }, `Promise`\<`AppAnalysis`>> | - |
| `get` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `string` ; `collection`: `string`  }, `Promise`\<`null` \| [`GenericDocument`](/api/modules/server#genericdocument)>> | - |
| `getMany` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `collection`: `string` ; `ids`: `string`\[]  }, `Promise`\<`AppPointRead`\[]>> | - |
| `related` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `where`: `undefined` \| \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[] ; `id`: `string` ; `field`: `string` ; `collection`: `string` ; `paginationOpts`: \{ id?: number; endCursor?: string \| null; maximumRowsRead?: number; maximumBytesRead?: number; numItems: number; cursor: string \| null; } ; `relationship`: `string`  }, `Promise`\<`AppPage`>> | - |
| `searchAround` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `string` ; `collection`: `string` ; `hops`: \{ where?: \{ operator?: "contains" \| "eq" \| "gt" \| "gte" \| "lt" \| "lte" \| "in" \| "has\_any" \| "has\_none" \| "relative" \| "neq" \| "not\_in" \| "between" \| "is\_empty" \| "is\_not\_empty"; value: any; field: string; }\[]; relation: string; }\[]  }, `Promise`\<`AppSearchAround`>> | Search Around: from one starting object, follow one to three declared relations, keeping at each hop the distinct targets that match that hop's `where` (see `AppSearchAround` and the relationships page). One request is one query at one basis. Every read is an ordinary read under the caller's authority, so the engine decides disclosure for the whole answer: a refused read anywhere refuses this starting object's answer, and the caller counts it as restricted without learning what it would have reached. The one exception is an incoming hop's relation range, which withholds the targets the caller may not read, so the hop answers as if they did not exist. An incoming hop reads the declared relation index with `where` as a native filter; an outgoing hop point-reads the one referenced object and evaluates the same predicate over it. Both leave their dependencies in the read set, so a subscription is invalidated by any write that changes the answer. Bounds: `SEARCH_AROUND_FANOUT` matches per reached object and hop, `SEARCH_AROUND_OBJECTS` distinct objects per hop, `SEARCH_RANGE_ROWS` + 1 rows visited per incoming range, `SEARCH_VISITS` rows per request and the read-subject budget. Each hop may spend an equal share of what remains, and each reached object an equal share of its hop's (at least two rows while the hop can pay), an unused share carrying forward. A hop stopped by any bound, or following an incomplete hop, is reported incomplete: it is never an error and never a total. |
| `accessRequests` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{}, `Promise`\<`AppAccessRequestPage`>> | The access requests this caller may see among the exposed operations: their own, and those they may currently decide. Read only: filing, withdrawing and deciding go to the deployment's native `POST /api/access_requests` with the caller's own token, so no function in this program can make those writes for anyone. |
| `activity` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `target`: `undefined` \| \{ id: string; view: string; } ; `cursor`: `null` \| `string` ; `is_held`: `boolean`  }, `Promise`\<`AppActivityPage`>> | - |
| `dependencyStatus` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `undefined` \| `string` ; `collection`: `string`  }, `Promise`\<`AppDependencyStatus`>> | - |
| `sourceSyncs` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `source`: `undefined` \| `string` ; `collection`: `string`  }, `Promise`\<`AppSourceSyncsPage`>> | - |
| `requestSourceSync` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `source`: `string` ; `collection`: `string`  }, `Promise`\<`AppSourceSyncRequest`>> | - |
| `requestConnectionCheck` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `source`: `string` ; `collection`: `string`  }, `Promise`\<`AppConnectionCheckRequest`>> | - |
| `mapSettings` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{}, `Promise`\<`AppMapSettingsView`>> | - |
| `saveMapSettings` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `revision`: `number` ; `settings`: `any`  }, `Promise`\<\{ `revision`: `number`  }>> | - |
| `overlayLayers` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{}, `Promise`\<`AppOverlayListing`\[]>> | - |
| `overlayLayer` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `string`  }, `Promise`\<`AppSavedOverlay`>> | - |
| `saveOverlayLayer` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `name`: `string` ; `revision`: `number` ; `sharing`: `any` ; `overlay`: `any`  }, `Promise`\<\{ `id`: `string`  }>> | - |
| `deleteOverlayLayer` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `revision`: `number`  }, `Promise`\<`null`>> | - |
| `recordMapExport` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `kind`: `string` ; `map`: `null` \| `string` ; `name`: `string` ; `layers`: `any`\[]  }, `Promise`\<\{ `id`: `string`  }>> | - |
| `mapExports` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `cursor`: `null` \| `string`  }, `Promise`\<\{ `page`: `AppMapExport`\[] ; `cursor`: `null` \| `string`  }>> | - |
| `mapTile` | [`RegisteredAction`](/api/modules/server#registeredaction)\<`"public"`, \{ `x`: `number` ; `y`: `number` ; `basemap`: `string` ; `z`: `number`  }, `Promise`\<`AppMapTile`>> | - |
| `savedMap` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `string`  }, `Promise`\<`AppSavedMap`>> | - |
| `saveMap` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `name`: `string` ; `document`: `any` ; `revision`: `number` ; `sharing`: `any`  }, `Promise`\<\{ `id`: `string`  }>> | - |
| `deleteMap` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `id`: `string` ; `revision`: `number`  }, `Promise`\<`null`>> | - |
| `mediaUrls` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `property`: `string` ; `collection`: `string` ; `ids`: `string`\[]  }, `Promise`\<\{ `urls`: `Record`\<`string`, `null` \| `string`> ; `restricted`: `number`  }>> | - |
| `notifications` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `kind`: `undefined` \| `string` ; `status`: `"all"` \| `"unread"` \| `"archived"` ; `paginationOpts`: \{ id?: number; endCursor?: string \| null; maximumRowsRead?: number; maximumBytesRead?: number; numItems: number; cursor: string \| null; }  }, `Promise`\<`AppNotificationPage`>> | - |
| `updateNotification` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `is_read`: `undefined` \| `boolean` ; `is_archived`: `undefined` \| `boolean` ; `id`: `string`  }, `Promise`\<`null`>> | - |
| `markNotificationsRead` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `ids`: `string`\[]  }, `Promise`\<`null`>> | Mark up to MAX\_RESOLVED\_NOTIFICATIONS of the caller's own notifications read in one transaction. Every id is checked exactly as `updateNotification` checks one (ownership, then resolution under current reads, three read subjects each), and any id that fails refuses the whole request, so either all of them are marked or none is. A row already read is left unwritten. |
| `observeScope` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"internal"`, \{ `mode`: `"validate"` \| `"observe"` ; `properties`: `string`\[] ; `limit`: `number` ; `scope`: `any` ; `measure`: `null` \| \{ kind: "count"; } \| \{ kind: "sum"; property: string; } ; `asOf`: `string`  }, `Promise`\<`AppObservation`>> | - |
| `placeSearch` | [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, \{ `text`: `string`  }, `Promise`\<\{ `id`: `string`  }>> | - |
| `placeResult` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `id`: `string`  }, `Promise`\<`null` \| [`AppPlaceSearch`](/api/modules/server#appplacesearch)>> | - |
| `mapValues` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `name`: `string` ; `ids`: `string`\[]  }, `Promise`\<\{ `values`: `Record`\<`string`, `null` \| `string` \| `number`> ; `restricted`: `number`  }>> | - |
| `seriesLatest` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `measures`: `undefined` \| `string`\[] ; `property`: `string` ; `collection`: `string` ; `ids`: `string`\[]  }, `Promise`\<`AppSeriesLatest`>> | The latest point of up to SERIES\_LATEST\_IDS objects' declared series property (a map layer's positions). The objects are read first in one restrictable point read: each one the caller may not read is counted in `restricted` and gets no series data, and the rest of the answer stands. An object whose series the type's markings withhold from the caller (seriesReadable) is counted in `restricted` too. Each reader call runs in this query with the caller's context, so a new report invalidates the subscription. |
| `seriesSearch` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `limit`: `undefined` \| `number` ; `property`: `string` ; `to`: `string` ; `area`: `any` ; `from`: `string` ; `collection`: `string`  }, `Promise`\<`AppSeriesSearchResult`>> | The objects whose recorded track of a declared series property within `[from, to]` (at most a day) meets a drawn area, through the reader's `search`. The matched objects are then read in one restrictable point read: each one the caller may not read is counted in `restricted` and not named, and each named object must hold the matched series id in its declared id property. The reader runs in this query with the caller's context, so a new report in the window invalidates it. |
| `seriesMeasure` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `to`: `undefined` \| `string` ; `maxPoints`: `undefined` \| `number` ; `property`: `string` ; `id`: `string` ; `from`: `string` ; `collection`: `string` ; `measure`: `string`  }, `Promise`\<`AppSeriesMeasure`>> | One measure of an object's declared series property over a window (at most SERIES\_MAX\_WINDOW\_MS; `to` omitted is an open window whose tail grows with each committed report), at most `maxPoints` points downsampled by the reader. The object is read first through the authorized `get`, then the markings guard (seriesReadable): a caller it does not clear reads `withheld` with nothing else. The measure is a built-in or one the property declares; any other is refused. |
| `series` | [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, \{ `to`: `undefined` \| `string` ; `from`: `undefined` \| `string` ; `maxPoints`: `undefined` \| `number` ; `log`: `undefined` \| `number` ; `property`: `string` ; `id`: `string` ; `collection`: `string`  }, `Promise`\<`AppSeriesResult`>> | - |

***

### applicationNotificationRow

▸ **applicationNotificationRow**(`args`): `Object`

One delivery row, as the notification table stores it: `recipient` a person
id and `event` the occurrence reference `kind` resolves, each at most
APP\_NOTICE\_REFERENCE\_MAX characters. The row holds references only,
never content.

#### Parameters

| Name | Type |
| :- | :- |
| `args` | `Object` |
| `args.recipient` | `string` |
| `args.kind` | `string` |
| `args.event` | `string` |

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `recipient` | `string` |
| `event_id` | `string` |
| `kind` | `string` |
| `is_read` | `false` |
| `is_archived` | `false` |

***

### applicationPerson

▸ **applicationPerson**(`people`, `ctx`): `Promise`\<`string` | `null`>

The caller's own person, as `people.self` answers it, normalized to an id
of the people collection; null without people or when the caller is not
one of them. An answer that is not such an id (at most
APP\_NOTICE\_REFERENCE\_MAX characters) is refused. Call it after
`authorize`: it is the one resolution of "who is the caller" that the
application's own queries and a capability's exposure helpers share.

#### Parameters

| Name | Type |
| :- | :- |
| `people` | `undefined` \| [`ApplicationPeople`](/api/modules/server#applicationpeople) |
| `ctx` | [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)> |

#### Returns

`Promise`\<`string` | `null`>

***

### createFunctionHandle

▸ **createFunctionHandle**\<`Type`, `Args`, `ReturnType`>(`functionReference`): `Promise`\<[`FunctionHandle`](/api/modules/server#functionhandle)\<`Type`, `Args`, `ReturnType`>>

Create a serializable reference to a Bijection function.
Passing a this reference to another component allows that component to call this
function during the current function execution or at any later time.
Function handles are used like `api.folder.function` FunctionReferences,
e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.

A function reference is stable across code pushes but it's possible
the Bijection function it refers to might no longer exist.

This is a feature of components, which are in beta.
This API is unstable and may change in subsequent releases.

#### Type parameters

| Name | Type |
| :- | :- |
| `Type` | extends [`FunctionType`](/api/modules/server#functiontype) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `ReturnType` | `ReturnType` |

#### Parameters

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

#### Returns

`Promise`\<[`FunctionHandle`](/api/modules/server#functionhandle)\<`Type`, `Args`, `ReturnType`>>

***

### defineComponent

▸ **defineComponent**\<`Exports`, `Env`>(`name`, `options?`): [`ComponentDefinition`](/api/modules/server#componentdefinition)\<`Exports`, `Env`>

Define a component, a piece of a Bijection deployment with namespaced resources.

Optionally define typed environment variables that will be available via
the `env` export from `_generated/server` in all Bijection functions within
this component. Values are passed by the parent via
`app.use(component, { env: { ... } })`.

#### Type parameters

| Name | Type |
| :- | :- |
| `Exports` | extends `ComponentExports` = `any` |
| `Env` | extends [`EnvDefinition`](/api/modules/server#envdefinition) = \{} |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `name` | `string` | Name must be alphanumeric plus underscores. Typically these are lowercase with underscores like `"onboarding_flow_tracker"`. This is a feature of components, which are in beta. This API is unstable and may change in subsequent releases. |
| `options?` | `Object` | - |
| `options.env?` | `Env` | - |

#### Returns

[`ComponentDefinition`](/api/modules/server#componentdefinition)\<`Exports`, `Env`>

***

### defineApp

▸ **defineApp**\<`Env`>(`options?`): [`AppDefinition`](/api/modules/server#appdefinition)\<`Env`>

Attach components, reuseable pieces of a Bijection deployment, to this Bijection app.

Optionally define typed environment variables that will be available via
the `env` export from `_generated/server` in all Bijection functions.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { defineApp } from "bijection/server";
import { v } from "bijection/values";

const app = defineApp({
  env: {
    OPENAI_API_KEY: v.string(),
    DEBUG_MODE: v.optional(v.string()),
  },
});
export default app;
```

This is a feature of components, which are in beta.
This API is unstable and may change in subsequent releases.

#### Type parameters

| Name | Type |
| :- | :- |
| `Env` | extends [`EnvDefinition`](/api/modules/server#envdefinition) = [`EnvDefinition`](/api/modules/server#envdefinition) |

#### Parameters

| Name | Type |
| :- | :- |
| `options?` | `Object` |
| `options.httpPrefix?` | `string` |
| `options.env?` | `Env` |

#### Returns

[`AppDefinition`](/api/modules/server#appdefinition)\<`Env`>

***

### componentsGeneric

▸ **componentsGeneric**(): [`AnyChildComponents`](/api/modules/server#anychildcomponents)

#### Returns

[`AnyChildComponents`](/api/modules/server#anychildcomponents)

***

### getFunctionAddress

▸ **getFunctionAddress**(`functionReference`): \{ `functionHandle`: `string` = functionReference; `reference?`: `undefined` = referencePath; `name?`: `undefined` = body.name } | \{ `functionHandle?`: `undefined` = functionReference; `name`: `any` ; `reference?`: `undefined` = referencePath } | \{ `functionHandle?`: `undefined` = functionReference; `reference`: `string` = referencePath; `name?`: `undefined` = body.name }

#### Parameters

| Name | Type |
| :- | :- |
| `functionReference` | `any` |

#### Returns

\{ `functionHandle`: `string` = functionReference; `reference?`: `undefined` = referencePath; `name?`: `undefined` = body.name } | \{ `functionHandle?`: `undefined` = functionReference; `name`: `any` ; `reference?`: `undefined` = referencePath } | \{ `functionHandle?`: `undefined` = functionReference; `reference`: `string` = referencePath; `name?`: `undefined` = body.name }

***

### bijectionQueryGeneric

▸ **bijectionQueryGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`definition`): [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `capabilities?`: `undefined` ; `handler`: (`ctx`: [`BijectionQueryCtx`](/api/interfaces/server.BijectionQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`BijectionQueryCtx`](/api/interfaces/server.BijectionQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### bijectionInternalQueryGeneric

▸ **bijectionInternalQueryGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`definition`): [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `capabilities?`: `undefined` ; `handler`: (`ctx`: [`BijectionQueryCtx`](/api/interfaces/server.BijectionQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`BijectionQueryCtx`](/api/interfaces/server.BijectionQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredQuery`](/api/modules/server#registeredquery)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### bijectionMutationGeneric

▸ **bijectionMutationGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`definition`): [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `capabilities?`: `undefined` ; `handler`: (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### bijectionInternalMutationGeneric

▸ **bijectionInternalMutationGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`definition`): [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `capabilities?`: `undefined` ; `handler`: (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### bijectionActionGeneric

▸ **bijectionActionGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`definition`): [`RegisteredAction`](/api/modules/server#registeredaction)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `capabilities?`: \{ `functions`: readonly [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `"public"` \| `"internal"`>\[]  } ; `handler`: (`ctx`: [`BijectionActionCtx`](/api/interfaces/server.BijectionActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`BijectionActionCtx`](/api/interfaces/server.BijectionActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredAction`](/api/modules/server#registeredaction)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### bijectionInternalActionGeneric

▸ **bijectionInternalActionGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`definition`): [`RegisteredAction`](/api/modules/server#registeredaction)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `capabilities?`: \{ `functions`: readonly [`FunctionReference`](/api/modules/server#functionreference)\<`any`, `"public"` \| `"internal"`>\[]  } ; `handler`: (`ctx`: [`BijectionActionCtx`](/api/interfaces/server.BijectionActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`BijectionActionCtx`](/api/interfaces/server.BijectionActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredAction`](/api/modules/server#registeredaction)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

***

### cronJobs

▸ **cronJobs**(): [`Crons`](/api/classes/server.Crons)

Create a CronJobs object to schedule recurring tasks.

```js theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
// bijection/crons.js
import { cronJobs } from 'bijection/server';
import { api } from "./_generated/api";

const crons = cronJobs();
crons.weekly(
  "weekly re-engagement email",
  {
    hourUTC: 17, // (9:30am Pacific/10:30am Daylight Savings Pacific)
    minuteUTC: 30,
  },
  api.emails.send
)
export default crons;
```

#### Returns

[`Crons`](/api/classes/server.Crons)

***

### externalCallStatus

▸ **externalCallStatus**(`_ctx`, `id`): `Promise`\<[`ExternalCallStatus`](/api/modules/server#externalcallstatus)>

The status of a governed call this component submitted with
`ctx.externalCalls.submit`. A tracked read: a query that asks is re-run when
the call settles. A call another component submitted, or an id that names
nothing, is refused as not found.

#### Parameters

| Name | Type |
| :- | :- |
| `_ctx` | [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)> \| [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)> |
| `id` | [`ExternalCallId`](/api/modules/server#externalcallid) |

#### Returns

`Promise`\<[`ExternalCallStatus`](/api/modules/server#externalcallstatus)>

***

### bothAccessResults

▸ **bothAccessResults**(`...results`): [`GoverningResult`](/api/modules/server#governingresult)

Combine rule results: `null` only when none carries a bound, otherwise
the earliest `validUntil`. A result's `reason` says why it permitted and
bounds nothing.

#### Parameters

| Name | Type |
| :- | :- |
| `...results` | [`ReadAccessResult`](/api/modules/server#readaccessresult)\[] |

#### Returns

[`GoverningResult`](/api/modules/server#governingresult)

***

### defineAccessModel

▸ **defineAccessModel**(`definition`): `Object`

Declare the access model. Throws on an inconsistent declaration.

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | [`AccessModelDefinition`](/api/modules/server#accessmodeldefinition) |

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `inputs` | () => `string`\[] |
| `grantsTableName` | `string` |
| `grantsTable` | () => [`TableDefinition`](/api/classes/server.TableDefinition)\<[`VObject`](/api/classes/values.VObject)\<\{ `reason`: `undefined` \| `string` ; `expiresAt`: `undefined` \| `number` ; `subjectPermission`: `undefined` \| `string` ; `object`: `string` ; `type`: `string` ; `subject`: `string` ; `role`: `string` ; `subjectKind`: `"group"` \| `"user"` ; `subjectType`: `string`  }, \{ `type`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `object`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `role`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `subjectKind`: [`VUnion`](/api/classes/values.VUnion)\<`"group"` \| `"user"`, \[[`VLiteral`](/api/classes/values.VLiteral)\<`"user"`, `"required"`>, [`VLiteral`](/api/classes/values.VLiteral)\<`"group"`, `"required"`>], `"required"`, `never`> ; `subjectType`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `subject`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `subjectPermission`: [`VString`](/api/classes/values.VString)\<`undefined` \| `string`, `"optional"`> ; `expiresAt`: [`VFloat64`](/api/classes/values.VFloat64)\<`undefined` \| `number`, `"optional"`> ; `reason`: [`VString`](/api/classes/values.VString)\<`undefined` \| `string`, `"optional"`>  }, `"required"`, `"object"` \| `"type"` \| `"subject"` \| `"reason"` \| `"expiresAt"` \| `"role"` \| `"subjectKind"` \| `"subjectType"` \| `"subjectPermission"`>, \{ `by_subject`: \[`"subjectKind"`, `"subjectType"`, `"subject"`, `"subjectPermission"`, `"type"`, `"object"`, `"_creationTime"`] ; `by_object`: \[`"type"`, `"object"`, `"subjectKind"`, `"role"`, `"subject"`, `"_creationTime"`] ; `by_role`: \[`"role"`, `"type"`, `"object"`, `"_creationTime"`]  }, \{}, \{}, `false`> |
| `read` | (`type`: `string`) => (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: [`ReadAccessArgs`](/api/modules/server#readaccessargs-2)) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `disclose` | (`type`: `string`, `options`: \{ `alsoTo?`: readonly `string`\[]  }) => (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `args`: [`DisclosureArgs`](/api/modules/server#disclosureargs-2)) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `write` | (`type`: `string`) => (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: \{ `changes`: [`TableChange`](/api/modules/server#tablechange)\<`any`>\[]  }) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `grantsRead` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: [`ReadAccessArgs`](/api/modules/server#readaccessargs-2)) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `grantsWrite` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: \{ `changes`: [`TableChange`](/api/modules/server#tablechange)\<[`GrantDocument`](/api/modules/server#grantdocument)>\[]  }) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `grantsDisclose` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: [`DisclosureArgs`](/api/modules/server#disclosureargs-2)) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `roleDefinitionsTable` | () => [`TableDefinition`](/api/classes/server.TableDefinition)\<[`VObject`](/api/classes/values.VObject)\<\{ `maxDuration`: `undefined` \| `number` ; `type`: `string` ; `name`: `string` ; `permissions`: `string`\[] ; `scope`: `string`  }, \{ `scope`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `type`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `name`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `permissions`: [`VArray`](/api/classes/values.VArray)\<`string`\[], [`VString`](/api/classes/values.VString)\<`string`, `"required"`>, `"required"`> ; `maxDuration`: [`VFloat64`](/api/classes/values.VFloat64)\<`undefined` \| `number`, `"optional"`>  }, `"required"`, `"type"` \| `"name"` \| `"permissions"` \| `"scope"` \| `"maxDuration"`>, \{ `by_scope`: \[`"scope"`, `"type"`, `"name"`, `"_creationTime"`]  }, \{}, \{}, `false`> |
| `roleDefinitionsRead` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: [`ReadAccessArgs`](/api/modules/server#readaccessargs-2)) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `roleDefinitionsWrite` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: \{ `changes`: [`TableChange`](/api/modules/server#tablechange)\<[`RoleDefinitionDocument`](/api/modules/server#roledefinitiondocument)>\[]  }) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `roleDefinitionsDisclose` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `__namedParameters`: [`DisclosureArgs`](/api/modules/server#disclosureargs-2)) => `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)> |
| `can` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `permission`: `string`, `type`: `string`, `key`: `string`) => `Promise`\<[`GoverningResult`](/api/modules/server#governingresult)> |
| `audited` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `permission`: `string`, `type`: `string`, `key`: `string`) => `Promise`\<[`GoverningResult`](/api/modules/server#governingresult)> |
| `permissionsOn` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `type`: `string`, `key`: `string`) => `Promise`\<`string`\[]> |
| `explain` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `permission`: `string`, `type`: `string`, `key`: `string`) => `Promise`\<\{ `allowed`: `boolean` ; `path?`: [`AccessPath`](/api/modules/server#accesspath) ; `refusedBy?`: `string`  }> |
| `visible` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `type`: `string`, `options`: \{ `permission?`: `string` ; `limit?`: `number`  }) => `Promise`\<`string`\[]> |
| `holders` | (`ctx`: [`AccessCtx`](/api/modules/server#accessctx), `type`: `string`, `key`: `string`) => `Promise`\<\{ `on`: `string` ; `grants`: [`GrantDocument`](/api/modules/server#grantdocument)\[] ; `rowGrants`: \{ `field`: `string` ; `role`: `string` ; `keys`: `string`\[]  }\[] ; `directories`: \{ `table`: `string` ; `role`: `string`  }\[]  }\[]> |
| `grant` | (`ctx`: [`AccessMutationCtx`](/api/modules/server#accessmutationctx), `input`: [`GrantInput`](/api/modules/server#grantinput), `options`: [`GrantOptions`](/api/modules/server#grantoptions)) => `Promise`\<[`GenericId`](/api/modules/values#genericid)\<`string`>> |
| `recertify` | (`ctx`: [`AccessMutationCtx`](/api/modules/server#accessmutationctx), `id`: [`GenericId`](/api/modules/values#genericid)\<`string`>, `renewal`: \{ `expiresAt`: `number` ; `reason?`: `string`  }, `options`: [`GrantOptions`](/api/modules/server#grantoptions) & \{ `expire`: [`GrantMutation`](/api/modules/server#grantmutation)  }) => `Promise`\<[`GenericId`](/api/modules/values#genericid)\<`string`>> |
| `reviewDue` | (`ctx`: \{ `db`: [`GenericDatabaseReader`](/api/interfaces/server.GenericDatabaseReader)\<`any`> ; `audit?`: (`body`: [`AuditLogBody`](/api/modules/server#auditlogbody)) => `Promise`\<`void`>  }, `__namedParameters`: \{ `id`: [`GenericId`](/api/modules/values#genericid)\<`string`>  }) => `Promise`\<[`GrantDocument`](/api/modules/server#grantdocument) \| `null`> |
| `expireGrant` | (`ctx`: \{ `db`: [`GenericDatabaseWriter`](/api/interfaces/server.GenericDatabaseWriter)\<`any`> ; `audit?`: (`body`: [`AuditLogBody`](/api/modules/server#auditlogbody)) => `Promise`\<`void`>  }, `__namedParameters`: \{ `id`: [`GenericId`](/api/modules/values#genericid)\<`string`>  }) => `Promise`\<`null`> |
| `revokeAll` | (`ctx`: \{ `db`: [`GenericDatabaseWriter`](/api/interfaces/server.GenericDatabaseWriter)\<`any`> ; `audit?`: (`body`: [`AuditLogBody`](/api/modules/server#auditlogbody)) => `Promise`\<`void`>  }, `type`: `string`, `key`: `string`) => `Promise`\<`number`> |
| `both` | (...`results`: [`ReadAccessResult`](/api/modules/server#readaccessresult)\[]) => [`GoverningResult`](/api/modules/server#governingresult) |
| `rowsFollowRange` | (`type`: `string`) => \{ `index`: `string` = t.parent.index; `field`: `string` = t.parent.field; `markings?`: `string` = t.restrictionField.name }\[] |
| `cedar` | () => [`AccessCedarPolicies`](/api/modules/server#accesscedarpolicies) |
| `cedarEntities` | (`tables`: `Record`\<`string`, readonly `Record`\<`string`, `unknown`>\[]>, `now`: `number`, `coverage?`: (`sourceId`: `string`, `table`: `string`) => `null` \| [`AccessDirectoryCoverage`](/api/modules/server#accessdirectorycoverage)) => [`AccessCedarEntities`](/api/modules/server#accesscedarentities) |
| `cedarContext` | (`identity`: `null` \| [`UserIdentity`](/api/interfaces/server.UserIdentity)) => `Record`\<`string`, `unknown`> |
| `describe` | () => \{ `grants`: `string` = m.grants; `categories`: \{} ; `groups`: \{ `types`: `string`\[] ; `depth`: `number` = m.depth } ; `directories`: \{ `table`: `string` ; `index`: `string` ; `type`: `string` ; `role`: `string` ; `object`: `string` ; `member`: `string` ; `maxAge`: `number`  }\[] ; `users`: `null` \| \{ `table`: `string` ; `index`: `string` ; `user`: `string`  } ; `roleDefinitions`: `null` \| \{ `table`: `string` ; `scope`: `string`  } ; `claims`: \{} ; `conditions`: \{ `name`: `string` = c.name; `on`: `null` \| `string`\[] ; `claims`: `string`\[]  }\[] ; `requestScope`: \{ `objects?`: `string` ; `permissions?`: `string`  } ; `audit`: `boolean` = m.audit; `types`: \{ `name`: `string` = t.name; `table`: `undefined` \| `string` = t.table; `parent`: `null` \| `string` ; `parentField`: `null` \| `string` ; `permissions`: `string`\[] ; `visibility`: `string` = t.visibility; `rowGrants`: \{ `field`: `string` ; `role`: `string` ; `members?`: \{ `type`: `string` ; `permission`: `string`  }  }\[] ; `restrictions`: \{ `root`: `null` \| \{ `type`: `string` ; `category`: `string`  } ; `field`: `null` \| \{ `name`: `string` ; `type`: `string`  }  } ; `category`: `null` \| `string` \| \{ `from`: `"key"`  }  }\[] ; `roles`: \{ `name`: `string` = r.name; `permissions`: `string`\[] ; `maxDuration`: `undefined` \| `number` = r.maxDuration; `justification`: `boolean` = r.justification; `selfGrant`: `null` \| `string`  }\[]  } |

***

### getServiceToken

▸ **getServiceToken**(`service`): `Promise`\<`string`>

Get a short-lived credential for calling a Bijection-managed service.

This function can only be called while an action is running. The credential
is scoped to the current deployment and should be sent as a bearer token.
The action runtime caches and refreshes credentials as needed, so call
this function whenever making a service request.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `service` | `"ai-gateway"` | The service the credential may access. |

#### Returns

`Promise`\<`string`>

A JWT to send as `Authorization: Bearer <token>`. Keep it inside
the action: don't return it to clients or store it in environment
variables.

***

### getServiceUrl

▸ **getServiceUrl**(`service`): `Promise`\<`string`>

Get the base URL of a Bijection-managed service.

This function can only be called while an action is running. Pair it with
[getServiceToken](/api/modules/server#getservicetoken) to reach the service.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `service` | `"ai-gateway"` | The service to address. |

#### Returns

`Promise`\<`string`>

The service's origin, without a trailing slash.

***

### mutationGeneric

▸ **mutationGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`mutation`): [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Define a mutation in this Bijection app's public API.

You should generally use the `mutation` function from
`"./_generated/server"`.

Mutations can read from and write to the database, and are accessible from
the client. They run **transactionally**, all database reads and writes
within a single mutation are atomic and isolated from other mutations.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { mutation } from "./_generated/server";
import { v } from "bijection/values";

export const createTask = mutation({
  args: { text: v.string() },
  returns: v.id("tasks"),
  handler: async (ctx, args) => {
    const taskId = await ctx.db.insert("tasks", {
      text: args.text,
      completed: false,
    });
    return taskId;
  },
});
```

**Best practice:** Always include `args` and `returns` validators on all
mutations. If the function doesn't return a value, use `returns: v.null()`.
Argument validation is critical for security since public mutations are
exposed to the internet.

**Common mistake:** Mutations cannot call third-party APIs or use `fetch`.
They must be deterministic. Use actions for external API calls.

**Common mistake:** Do not use `mutation` for sensitive internal functions
that should not be called by clients. Use `internalMutation` instead.

**`See`**

[https://docs.bijection.com/functions/mutation-functions](/functions/mutation-functions)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `mutation` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

The wrapped mutation. Include this as an `export` to name it and make it accessible.

***

### internalMutationGeneric

▸ **internalMutationGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`mutation`): [`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Define a mutation that is only accessible from other Bijection functions (but not from the client).

You should generally use the `internalMutation` function from
`"./_generated/server"`.

Internal mutations can read from and write to the database but are **not**
exposed as part of your app's public API. They can only be called by other
Bijection functions using `ctx.runMutation` or by the scheduler. Like public
mutations, they run transactionally.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { internalMutation } from "./_generated/server";
import { v } from "bijection/values";

// This mutation can only be called from other Bijection functions:
export const markTaskCompleted = internalMutation({
  args: { taskId: v.id("tasks") },
  returns: v.null(),
  handler: async (ctx, args) => {
    await ctx.db.patch("tasks", args.taskId, { completed: true });
    return null;
  },
});
```

**Best practice:** Use `internalMutation` for any mutation that should not
be directly callable by clients, such as write-back functions from actions
or scheduled background work. Reference it via the `internal` object:
`await ctx.runMutation(internal.myModule.markTaskCompleted, { taskId })`.

**`See`**

[https://docs.bijection.com/functions/internal-functions](/functions/internal-functions)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `mutation` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericMutationCtx`](/api/interfaces/server.GenericMutationCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredMutation`](/api/modules/server#registeredmutation)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

The wrapped mutation. Include this as an `export` to name it and make it accessible.

***

### queryGeneric

▸ **queryGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`query`): [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Define a query in this Bijection app's public API.

You should generally use the `query` function from
`"./_generated/server"`.

Queries can read from the database and are accessible from the client. They
are **reactive**, when used with `useQuery` in React, the component
automatically re-renders whenever the underlying data changes. Queries
cannot modify the database.
Query results are automatically cached by the Bijection client and kept
consistent via WebSocket subscriptions.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { query } from "./_generated/server";
import { v } from "bijection/values";

export const listTasks = query({
  args: { completed: v.optional(v.boolean()) },
  returns: v.array(v.object({
    _id: v.id("tasks"),
    _creationTime: v.number(),
    text: v.string(),
    completed: v.boolean(),
  })),
  handler: async (ctx, args) => {
    if (args.completed !== undefined) {
      return await ctx.db
        .query("tasks")
        .withIndex("by_completed", (q) => q.eq("completed", args.completed))
        .collect();
    }
    return await ctx.db.query("tasks").collect();
  },
});
```

**Best practice:** Always include `args` and `returns` validators. Use
`.withIndex()` instead of `.filter()` for efficient database queries.
Queries should be fast since they run on every relevant data change.

**Common mistake:** Queries are pure reads, they cannot write to the
database, call external APIs, or schedule functions. Use actions for HTTP
calls and mutations for database writes and scheduling.

**`See`**

[https://docs.bijection.com/functions/query-functions](/functions/query-functions)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `query` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredQuery`](/api/modules/server#registeredquery)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

The wrapped query. Include this as an `export` to name it and make it accessible.

***

### internalQueryGeneric

▸ **internalQueryGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`query`): [`RegisteredQuery`](/api/modules/server#registeredquery)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Define a query that is only accessible from other Bijection functions (but not from the client).

You should generally use the `internalQuery` function from
`"./_generated/server"`.

Internal queries can read from the database but are **not** exposed as part
of your app's public API. They can only be called by other Bijection functions
using `ctx.runQuery`. This is useful for loading data in actions or for
helper queries that shouldn't be client-facing.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { internalQuery } from "./_generated/server";
import { v } from "bijection/values";

// Only callable from other Bijection functions:
export const getUser = internalQuery({
  args: { userId: v.id("users") },
  returns: v.union(
    v.object({
      _id: v.id("users"),
      _creationTime: v.number(),
      name: v.string(),
      email: v.string(),
    }),
    v.null(),
  ),
  handler: async (ctx, args) => {
    return await ctx.db.get("users", args.userId);
  },
});
```

**Best practice:** Use `internalQuery` for data-loading in actions via
`ctx.runQuery(internal.myModule.getUser, { userId })`.

**`See`**

[https://docs.bijection.com/functions/internal-functions](/functions/internal-functions)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type |
| :- | :- |
| `query` | \{ `args?`: `ArgsValidator` ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericQueryCtx`](/api/interfaces/server.GenericQueryCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` |

#### Returns

[`RegisteredQuery`](/api/modules/server#registeredquery)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

The wrapped query. Include this as an `export` to name it and make it accessible.

***

### actionGeneric

▸ **actionGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`func`): [`RegisteredAction`](/api/modules/server#registeredaction)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Define an action in this Bijection app's public API.

Actions can call third-party APIs, use Node.js libraries, and perform other
side effects. Unlike queries and mutations, actions do **not** have direct
database access (`ctx.db` is not available). Instead, use `ctx.runQuery`
and `ctx.runMutation` to read and write data.

You should generally use the `action` function from
`"./_generated/server"`.

Actions are accessible from the client and run outside of the database
transaction, so they are not atomic. They are best for integrating with
external services.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
// Add "use node"; at the top of the file if using Node.js built-in modules.
import { action } from "./_generated/server";
import { v } from "bijection/values";
import { internal } from "./_generated/api";

export const generateSummary = action({
  args: { text: v.string() },
  returns: v.string(),
  handler: async (ctx, args) => {
    // Call an external API:
    const response = await fetch("https://api.example.com/summarize", {
      method: "POST",
      body: JSON.stringify({ text: args.text }),
    });
    const { summary } = await response.json();

    // Write results back via a mutation:
    await ctx.runMutation(internal.myModule.saveSummary, {
      text: args.text,
      summary,
    });

    return summary;
  },
});
```

**Best practice:** Minimize the number of `ctx.runQuery` and
`ctx.runMutation` calls from actions. Each call is a separate transaction,
so splitting logic across multiple calls introduces the risk of race
conditions. Try to batch reads/writes into single query/mutation calls.

**`"use node"` runtime:** Actions run in Bijection's default JavaScript
runtime, which supports `fetch` and most NPM packages. Only add
`"use node";` at the top of the file if a third-party library specifically
requires Node.js built-in APIs, it is a last resort, not the default.
Node.js actions have slower cold starts, and **only actions can be defined
in `"use node"` files** (no queries or mutations), so prefer the default
runtime whenever possible.

**Common mistake:** Do not try to access `ctx.db` in an action, it is
not available. Use `ctx.runQuery` and `ctx.runMutation` instead.

**`See`**

[https://docs.bijection.com/functions/actions](/functions/actions)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `func` | \{ `args?`: `ArgsValidator` ; `capabilities?`: \{ `functions`: readonly [`FunctionReference`](/api/modules/server#functionreference)\<`"query"` \| `"mutation"` \| `"action"`, `"public"` \| `"internal"`>\[]  } ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` | The function. It receives a [GenericActionCtx](/api/interfaces/server.GenericActionCtx) as its first argument. |

#### Returns

[`RegisteredAction`](/api/modules/server#registeredaction)\<`"public"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

The wrapped function. Include this as an `export` to name it and make it accessible.

***

### internalActionGeneric

▸ **internalActionGeneric**\<`ArgsValidator`, `ReturnsValidator`, `ReturnValue`, `OneOrZeroArgs`>(`func`): [`RegisteredAction`](/api/modules/server#registeredaction)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

Define an action that is only accessible from other Bijection functions (but not from the client).

You should generally use the `internalAction` function from
`"./_generated/server"`.

Internal actions behave like public actions (they can call external APIs and
use Node.js libraries) but are **not** exposed in your app's public API. They
can only be called by other Bijection functions using `ctx.runAction` or via the
scheduler.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { internalAction } from "./_generated/server";
import { v } from "bijection/values";

export const sendEmail = internalAction({
  args: { to: v.string(), subject: v.string(), body: v.string() },
  returns: v.null(),
  handler: async (ctx, args) => {
    // Call an external email service (fetch works in the default runtime):
    await fetch("https://api.email-service.com/send", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(args),
    });
    return null;
  },
});
```

**Best practice:** Use `internalAction` for background work scheduled from
mutations: `await ctx.scheduler.runAfter(0, internal.myModule.sendEmail, { ... })`.
Only use `ctx.runAction` from another action if you need to cross runtimes
(e.g., default Bijection runtime to Node.js). Otherwise, extract shared code
into a helper function.

**`"use node"` runtime:** Only add `"use node";` at the top of the file
as a last resort when a third-party library requires Node.js APIs. Node.js
actions have slower cold starts, and **only actions can be defined in
`"use node"` files** (no queries or mutations).

**`See`**

[https://docs.bijection.com/functions/internal-functions](/functions/internal-functions)

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnsValidator` | extends `void` \| [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `ReturnValue` | extends `any` = `any` |
| `OneOrZeroArgs` | extends [`ArgsArray`](/api/modules/server#argsarray) \| `OneArgArray`\<[`Infer`](/api/modules/values#infer)\<`ArgsValidator`>> \| `OneArgArray`\<[`Expand`](/api/modules/server#expand)\<\{ \[Property in string \| number \| symbol]?: Exclude\<Infer\<ArgsValidator\[Property]>, undefined> } & \{ \[Property in string \| number \| symbol]: Infer\<ArgsValidator\[Property]> }>> = [`DefaultArgsForOptionalValidator`](/api/modules/server#defaultargsforoptionalvalidator)\<`ArgsValidator`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `func` | \{ `args?`: `ArgsValidator` ; `capabilities?`: \{ `functions`: readonly [`FunctionReference`](/api/modules/server#functionreference)\<`"query"` \| `"mutation"` \| `"action"`, `"public"` \| `"internal"`>\[]  } ; `returns?`: `ReturnsValidator` ; `handler`: (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue`  } \| (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<`any`>, ...`args`: `OneOrZeroArgs`) => `ReturnValue` | The function. It receives a [GenericActionCtx](/api/interfaces/server.GenericActionCtx) as its first argument. |

#### Returns

[`RegisteredAction`](/api/modules/server#registeredaction)\<`"internal"`, [`ArgsArrayToObject`](/api/modules/server#argsarraytoobject)\<`OneOrZeroArgs`>, `ReturnValue`>

The wrapped function. Include this as an `export` to name it and make it accessible.

***

### httpActionGeneric

▸ **httpActionGeneric**(`func`): [`PublicHttpAction`](/api/modules/server#publichttpaction)

Define a Bijection HTTP action.

HTTP actions handle raw HTTP requests and return HTTP responses. They are
registered by routing URL paths to them in `bijection/http.ts` using
[HttpRouter](/api/classes/server.HttpRouter). Like regular actions, they can call external APIs and
use `ctx.runQuery` / `ctx.runMutation` but do not have direct `ctx.db` access.

**`Example`**

```typescript theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
// bijection/http.ts
import { httpRouter } from "bijection/server";
import { httpAction } from "./_generated/server";

const http = httpRouter();

http.route({
  path: "/api/webhook",
  method: "POST",
  handler: httpAction(async (ctx, request) => {
    const body = await request.json();
    // Process the webhook payload...
    return new Response(JSON.stringify({ ok: true }), {
      status: 200,
      headers: { "Content-Type": "application/json" },
    });
  }),
});

export default http;
```

**Best practice:** HTTP actions are registered at the exact path specified.
For example, `path: "/api/webhook"` registers at `/api/webhook`.

**`See`**

[https://docs.bijection.com/functions/http-actions](/functions/http-actions)

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `func` | (`ctx`: [`GenericActionCtx`](/api/interfaces/server.GenericActionCtx)\<[`GenericDataModel`](/api/modules/server#genericdatamodel)>, `request`: `Request`) => `Promise`\<`Response`> | The function. It receives a [GenericActionCtx](/api/interfaces/server.GenericActionCtx) as its first argument, and a `Request` object as its second. |

#### Returns

[`PublicHttpAction`](/api/modules/server#publichttpaction)

The wrapped function. Route a URL path to this function in `bijection/http.ts`.

***

### setupPattern

▸ **setupPattern**(`pattern`): `RegExp`

Compile a declared pattern the one way both sides compile it: anchored
whole, never partially matched.

#### Parameters

| Name | Type |
| :- | :- |
| `pattern` | `string` |

#### Returns

`RegExp`

***

### validateSetupDeclaration

▸ **validateSetupDeclaration**(`setup`): [`SetupDeclaration`](/api/modules/server#setupdeclaration)

Check the declaration itself, at definition time.

Everything here is a defect in the definition rather than in a supplied
value, so it throws: the module never loads with a declaration the backend
would refuse, and an author sees it at `bijection dev` rather than at the
first connection.

#### Parameters

| Name | Type |
| :- | :- |
| `setup` | [`SetupDeclaration`](/api/modules/server#setupdeclaration) |

#### Returns

[`SetupDeclaration`](/api/modules/server#setupdeclaration)

***

### checkSetupValue

▸ **checkSetupValue**(`field`, `value`): [`SetupRefusal`](/api/modules/server#setuprefusal) | `undefined`

Check one supplied value against one field. `undefined` is admitted.

The same rules the backend applies, in the same order, so a form that says
"that is not a subdomain" and a server that refuses the request are saying
the same thing. It never decides anything: the backend re-checks every value
it is given.

#### Parameters

| Name | Type |
| :- | :- |
| `field` | [`SetupField`](/api/modules/server#setupfield) |
| `value` | `string` |

#### Returns

[`SetupRefusal`](/api/modules/server#setuprefusal) | `undefined`

***

### renderSetupBaseUrl

▸ **renderSetupBaseUrl**(`field`, `value`): `string`

The address a `base_url` field renders.

#### Parameters

| Name | Type |
| :- | :- |
| `field` | [`SetupField`](/api/modules/server#setupfield) |
| `value` | `string` |

#### Returns

`string`

***

### describeSetupRefusal

▸ **describeSetupRefusal**(`refusal`): `string`

Say why a value was refused, in one line, for a form or a prompt.

#### Parameters

| Name | Type |
| :- | :- |
| `refusal` | [`SetupRefusal`](/api/modules/server#setuprefusal) |

#### Returns

`string`

***

### setupFieldsToAsk

▸ **setupFieldsToAsk**(`requirements`): [`SetupRequirement`](/api/modules/server#setuprequirement)\[]

The fields a person still has to answer, in declaration order.

Secrets are not among them: they are provisioned through the credential
path, and a form that rendered an input for one would be inviting a secret
into a request that has no business carrying it. An already configured
administrator field is not among them either -- that is the whole point of
the `configured` flag.

#### Parameters

| Name | Type |
| :- | :- |
| `requirements` | readonly [`SetupRequirement`](/api/modules/server#setuprequirement)\[] |

#### Returns

[`SetupRequirement`](/api/modules/server#setuprequirement)\[]

***

### accountSetupFields

▸ **accountSetupFields**(`requirements`): [`SetupRequirement`](/api/modules/server#setuprequirement)\[]

The fields a CONNECTING ACCOUNT answers, in declaration order.

An account connecting its own installation answers what its own installation
decides -- its instance, its region, its workspace -- and nothing about the
deployment. An administrator field is deployment configuration: the person
consenting has no way to know it, the deployment already states it, and the
backend refuses it from this direction by name. Filtering it out here is what
keeps a consent screen from asking a customer to configure somebody else's
deployment; the backend still decides.

#### Parameters

| Name | Type |
| :- | :- |
| `requirements` | readonly [`SetupRequirement`](/api/modules/server#setuprequirement)\[] |

#### Returns

[`SetupRequirement`](/api/modules/server#setuprequirement)\[]

***

### admitIntegration

▸ **admitIntegration**\<`T`>(`definition`): `T`

Admit an integration definition authored outside this deployment component.

A definition's module/export address is assigned by the compiler and names a
module of the deployment being installed. A definition imported from a
package or a sibling directory is not such a module, so it has no address of
its own and cannot be bound by `.source(...)`. Re-exporting it through this
function from a module of the component gives it that module's address:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
import { admitIntegration } from "bijection/server";
import { storefront as slice } from "../commerce-providers/storefront";
export const storefront = admitIntegration(slice);
```

The definition is returned unchanged, so the address belongs to the admitted
definition and never to a copy of it; the deployment independently checks
that the address resolves to this same object. Admitting one definition
twice, or admitting one that already carries an address, is refused by the
definition itself, which is what keeps one authored collection bound to one
table per component.

#### Type parameters

| Name | Type |
| :- | :- |
| `T` | extends `Object` |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `T` |

#### Returns

`T`

***

### defineIntegration

▸ **defineIntegration**\<`S`, `A`, `H`>(`definition`): `Object`

Define source collections, sync routines and external command contracts.
Compiler addresses are references, never capabilities or trusted evidence.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Record`\<`string`, `Fields`> |
| `A` | extends `Record`\<`string`, `Fields`> |
| `H` | extends `HttpContracts` = \{} |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |

#### Returns

`Object`

***

### defineNativeIntegration

▸ **defineNativeIntegration**\<`S`, `H`, `A`>(`definition`): \{ `commands`: \{ readonly \[K in string | number | symbol]: CommandHandle\<ObjectType\<A\[K]>> } ; `isIntegration`: `true` ; `discover?`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: \{ `resume`: `null` | `string` ; `next_page_reference`: `null` | `string`  }) => `Promise`\<\{ `resources`: \{ `id`: `string` ; `label`: `null` | `string`  }\[] ; `next_page`: `null` | `string` ; `evidence`: `string`  }> = definition.discover; `invokeIntegration`: (`handler`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, ...`args`: `any`\[]) => `unknown`, `argsStr`: `string`) => `Promise`\<`string`> ; `[attachment]`: (`next`: [`IntegrationAddress`](/api/modules/server#integrationaddress)) => `void` ; `exportIntegration`: () => `string`  } & \{ readonly \[K in string | number | symbol]: SourceHandle\<S\[K]> }

Native protocols use the same analyzed source handles as HTTP integrations.
Their read entrypoints are implemented by the host; there are no guest
callbacks with hidden network or evidence authority.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Record`\<`string`, `Fields`> |
| `H` | extends `HttpContracts` = \{} |
| `A` | extends `Record`\<`string`, `Fields`> = \{} |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.transport` | [`AcquisitionTransport`](/api/modules/server#acquisitiontransport) | - |
| `definition.http?` | `H` | - |
| `definition.discover?` | (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: \{ `resume`: `null` \| `string` ; `next_page_reference`: `null` \| `string`  }) => `Promise`\<\{ `resources`: \{ `id`: `string` ; `label`: `null` \| `string`  }\[] ; `next_page`: `null` \| `string` ; `evidence`: `string`  }> | - |
| `definition.collections` | \{ \[K in string \| number \| symbol]: Object } | - |
| `definition.commands?` | \{ \[K in string \| number \| symbol]: TransportCommandDefinition\<A\[K], S> } | - |
| `definition.every?` | `SyncEvery` | SQL sources without a cadence are available for pinned inspection only. They do not schedule or admit acquisition. |

#### Returns

\{ `commands`: \{ readonly \[K in string | number | symbol]: CommandHandle\<ObjectType\<A\[K]>> } ; `isIntegration`: `true` ; `discover?`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, `input`: \{ `resume`: `null` | `string` ; `next_page_reference`: `null` | `string`  }) => `Promise`\<\{ `resources`: \{ `id`: `string` ; `label`: `null` | `string`  }\[] ; `next_page`: `null` | `string` ; `evidence`: `string`  }> = definition.discover; `invokeIntegration`: (`handler`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<`H`>, ...`args`: `any`\[]) => `unknown`, `argsStr`: `string`) => `Promise`\<`string`> ; `[attachment]`: (`next`: [`IntegrationAddress`](/api/modules/server#integrationaddress)) => `void` ; `exportIntegration`: () => `string`  } & \{ readonly \[K in string | number | symbol]: SourceHandle\<S\[K]> }

***

### definePostgresIntegration

▸ **definePostgresIntegration**\<`S`>(`definition`): \{ `commands`: \{} ; `isIntegration`: `true` ; `discover?`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<\{}>, `input`: \{ `resume`: `null` | `string` ; `next_page_reference`: `null` | `string`  }) => `Promise`\<\{ `resources`: \{ `id`: `string` ; `label`: `null` | `string`  }\[] ; `next_page`: `null` | `string` ; `evidence`: `string`  }> = definition.discover; `invokeIntegration`: (`handler`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<\{}>, ...`args`: `any`\[]) => `unknown`, `argsStr`: `string`) => `Promise`\<`string`> ; `[attachment]`: (`next`: [`IntegrationAddress`](/api/modules/server#integrationaddress)) => `void` ; `exportIntegration`: () => `string`  } & \{ readonly \[K in string | number | symbol]: SourceHandle\<S\[K]> }

Read selected PostgreSQL tables through one consistent initial snapshot and
atomic committed transactions. PostgreSQL installation is private.

#### Type parameters

| Name | Type |
| :- | :- |
| `S` | extends `Record`\<`string`, `Fields`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |
| `definition.collections` | `S` |
| `definition.every?` | `SyncEvery` |
| `definition.freshness?` | `SyncEvery` |

#### Returns

\{ `commands`: \{} ; `isIntegration`: `true` ; `discover?`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<\{}>, `input`: \{ `resume`: `null` | `string` ; `next_page_reference`: `null` | `string`  }) => `Promise`\<\{ `resources`: \{ `id`: `string` ; `label`: `null` | `string`  }\[] ; `next_page`: `null` | `string` ; `evidence`: `string`  }> = definition.discover; `invokeIntegration`: (`handler`: (`ctx`: [`IntegrationContext`](/api/modules/server#integrationcontext)\<\{}>, ...`args`: `any`\[]) => `unknown`, `argsStr`: `string`) => `Promise`\<`string`> ; `[attachment]`: (`next`: [`IntegrationAddress`](/api/modules/server#integrationaddress)) => `void` ; `exportIntegration`: () => `string`  } & \{ readonly \[K in string | number | symbol]: SourceHandle\<S\[K]> }

***

### defineMailIntegration

▸ **defineMailIntegration**(`definition`): `ReturnType`\<typeof [`defineNativeIntegration`](/api/modules/server#definenativeintegration)>

Read mail through the integration scheduler and retained native evidence.
Account, credentials and selected folders are private installation settings.
Initial capture establishes a baseline; it does not manufacture arrivals.
Message identity is independent of folder/label membership.

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |
| `definition.provider` | `"imap"` |
| `definition.every?` | `SyncEvery` |

#### Returns

`ReturnType`\<typeof [`defineNativeIntegration`](/api/modules/server#definenativeintegration)>

***

### defineOperationInterface

▸ **defineOperationInterface**\<`Args`, `Returns`>(`definition`): [`OperationInterfaceDefinition`](/api/modules/server#operationinterfacedefinition)\<[`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`Args`>>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`Returns`>>>

Declare a targeted operation shape. Each concrete operation explicitly
implements it and supplies a required `target` ID argument. Query this export
to discover currently readable public implementations in its component.

#### Type parameters

| Name | Type |
| :- | :- |
| `Args` | extends [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `Returns` | extends [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |
| `definition.name` | `string` |
| `definition.args` | `Args` |
| `definition.returns` | `Returns` |

#### Returns

[`OperationInterfaceDefinition`](/api/modules/server#operationinterfacedefinition)\<[`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`Args`>>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`Returns`>>>

***

### operationImplementationReference

▸ **operationImplementationReference**\<`Args`, `Result`>(`implementation`): [`OperationReference`](/api/modules/server#operationreference)\<`"public"`, `Args` & \{ `target`: [`GenericId`](/api/modules/values#genericid)\<`string`>  }, `Result`>

Bind the discovered concrete contract to an ordinary operation reference.
Retain this reference with a request key for recovery; do not resolve the
interface again to retry already accepted work.

#### Type parameters

| Name | Type |
| :- | :- |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `Result` | `Result` |

#### Parameters

| Name | Type |
| :- | :- |
| `implementation` | [`OperationImplementation`](/api/modules/server#operationimplementation)\<`Args`, `Result`> |

#### Returns

[`OperationReference`](/api/modules/server#operationreference)\<`"public"`, `Args` & \{ `target`: [`GenericId`](/api/modules/values#genericid)\<`string`>  }, `Result`>

***

### makeOperationReference

▸ **makeOperationReference**\<`Visibility`, `Args`, `LocalResult`>(`name`, `definition`, `functions?`): `Promise`\<[`OperationReference`](/api/modules/server#operationreference)\<`Visibility`, `Args`, `LocalResult`>>

Construct a reference from a checked declaration or validator description.
Types are inferred from the same description used to calculate the runtime
contract. Generated references do not require this asynchronous step.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `LocalResult` | `LocalResult` |

#### Parameters

| Name | Type |
| :- | :- |
| `name` | `string` |
| `definition` | [`OperationDefinition`](/api/modules/server#operationdefinition)\<`Visibility`, `Args`, `LocalResult`> |
| `functions?` | [`OperationFunctionReferences`](/api/modules/server#operationfunctionreferences)\<`Visibility`, `Args`, `LocalResult`> |

#### Returns

`Promise`\<[`OperationReference`](/api/modules/server#operationreference)\<`Visibility`, `Args`, `LocalResult`>>

▸ **makeOperationReference**\<`ArgsValidator`, `ReturnsValidator`, `Visibility`>(`name`, `definition`, `functions?`): `Promise`\<[`OperationReference`](/api/modules/server#operationreference)\<`Visibility`, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ArgsValidator`>>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>>

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends [`PropertyValidators`](/api/modules/values#propertyvalidators) \| [`VObject`](/api/classes/values.VObject)\<[`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs), [`PropertyValidators`](/api/modules/values#propertyvalidators), `"required"`, `string`> |
| `ReturnsValidator` | extends [`Validator`](/api/modules/values#validator)\<`any`, `"required"`, `any`> \| [`PropertyValidators`](/api/modules/values#propertyvalidators) |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) = `"public"` |

#### Parameters

| Name | Type |
| :- | :- |
| `name` | `string` |
| `definition` | `Object` |
| `definition.visibility?` | `Visibility` |
| `definition.on` | `string` |
| `definition.target?` | `Object` |
| `definition.target.argument` | `string` |
| `definition.interfaces?` | [`OperationInterfaceContract`](/api/modules/server#operationinterfacecontract)\[] |
| `definition.consumes?` | [`PublicationConsumption`](/api/modules/server#publicationconsumption) |
| `definition.args` | `ArgsValidator` |
| `definition.returns` | `ReturnsValidator` |
| `functions?` | [`OperationFunctionReferences`](/api/modules/server#operationfunctionreferences)\<`Visibility`, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ArgsValidator`>>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>> |

#### Returns

`Promise`\<[`OperationReference`](/api/modules/server#operationreference)\<`Visibility`, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ArgsValidator`>>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>>

***

### getOperationContract

▸ **getOperationContract**(`operation`): [`OperationContractMetadata`](/api/modules/server#operationcontractmetadata)

Read the expected contract carried by an operation reference.

#### Parameters

| Name | Type |
| :- | :- |
| `operation` | [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`, `undefined` \| `string`> |

#### Returns

[`OperationContractMetadata`](/api/modules/server#operationcontractmetadata)

***

### operationInvocationArgs

▸ **operationInvocationArgs**\<`Operation`>(`operation`, `request_key`, `args`): `Object`

Build the ordinary request envelope from the reference's checked contract.
The caller must retain the original key and arguments across uncertain outcomes.

#### Type parameters

| Name | Type |
| :- | :- |
| `Operation` | extends [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`, `undefined` \| `string`> |

#### Parameters

| Name | Type |
| :- | :- |
| `operation` | `Operation` |
| `request_key` | `string` |
| `args` | [`OperationArgs`](/api/modules/server#operationargs)\<`Operation`> |

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `request_key` | `string` |
| `args` | [`OperationArgs`](/api/modules/server#operationargs)\<`Operation`> |
| `expected_contract` | `string` |

***

### operationStatusArgs

▸ **operationStatusArgs**(`operation`, `invocation_id`): `Object`

#### Parameters

| Name | Type |
| :- | :- |
| `operation` | [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`, `undefined` \| `string`> |
| `invocation_id` | [`OperationInvocationId`](/api/modules/server#operationinvocationid) |

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `invocation_id` | `string` |
| `expected_contract` | `string` |

***

### operationPreviewArgs

▸ **operationPreviewArgs**\<`Operation`>(`operation`, `args`): `Object`

Preview uses the same business arguments and contract as invocation, without
creating or consuming a business acceptance identity.

#### Type parameters

| Name | Type |
| :- | :- |
| `Operation` | extends [`OperationReference`](/api/modules/server#operationreference)\<`any`, `any`, `any`, `undefined` \| `string`> |

#### Parameters

| Name | Type |
| :- | :- |
| `operation` | `Operation` |
| `args` | [`OperationArgs`](/api/modules/server#operationargs)\<`Operation`> |

#### Returns

`Object`

| Name | Type |
| :- | :- |
| `args` | [`OperationArgs`](/api/modules/server#operationargs)\<`Operation`> |
| `expected_contract` | `string` |

***

### apiWithOperations

▸ **apiWithOperations**(`manifest`, `visibility`): [`AnyApi`](/api/modules/server#anyapi)

Overlay analyzed operation references while retaining the inherited runtime
API for every ordinary function. The generator supplies the paired types.

#### Parameters

| Name | Type |
| :- | :- |
| `manifest` | `Record`\<`string`, [`OperationContractMetadata`](/api/modules/server#operationcontractmetadata)> |
| `visibility` | [`FunctionVisibility`](/api/modules/server#functionvisibility) |

#### Returns

[`AnyApi`](/api/modules/server#anyapi)

***

### componentsWithOperations

▸ **componentsWithOperations**(`manifest`): [`AnyComponents`](/api/modules/server#anycomponents)

Pair installed-component contracts with their explicit native export paths.
Ordinary references retain the inherited component proxy behavior. Generated
`components` objects call this; the generator supplies the paired types.

#### Parameters

| Name | Type |
| :- | :- |
| `manifest` | [`ComponentOperationManifest`](/api/modules/server#componentoperationmanifest) |

#### Returns

[`AnyComponents`](/api/modules/server#anycomponents)

***

### operationFunctionReference

▸ **operationFunctionReference**\<`Visibility`, `Args`, `LocalResult`, `Member`>(`operation`, `member`): [`OperationFunctionReferences`](/api/modules/server#operationfunctionreferences)\<`Visibility`, `Args`, `LocalResult`>\[`Member`]

Resolve one companion of an operation reference to the ordinary function
reference that serves it: `invoke`, `preview` and `revise` are mutations,
`recover` and `status` are queries. Pass the result with the matching
argument helper to a client or `ctx.runMutation` / `ctx.runQuery`.

Explicit companion references carried by the reference are used as given;
otherwise the address is derived from the operation's own path. A component
operation must carry explicit companions, and a function handle cannot name
one. The reference must carry a generated contract. This only names a
function: native analysis owns which companions exist, and calling one still
requires its grants.

#### Type parameters

| Name | Type |
| :- | :- |
| `Visibility` | extends [`FunctionVisibility`](/api/modules/server#functionvisibility) |
| `Args` | extends [`DefaultFunctionArgs`](/api/modules/server#defaultfunctionargs) |
| `LocalResult` | `LocalResult` |
| `Member` | extends keyof [`OperationFunctionReferences`](/api/modules/server#operationfunctionreferences)\<`Visibility`, `Args`, `LocalResult`> |

#### Parameters

| Name | Type |
| :- | :- |
| `operation` | [`OperationReference`](/api/modules/server#operationreference)\<`Visibility`, `Args`, `LocalResult`, `undefined` \| `string`> |
| `member` | `Member` |

#### Returns

[`OperationFunctionReferences`](/api/modules/server#operationfunctionreferences)\<`Visibility`, `Args`, `LocalResult`>\[`Member`]

***

### defineOperation

▸ **defineOperation**\<`ArgsValidator`, `ReturnsValidator`>(`definition`): [`OperationDefinition`](/api/modules/server#operationdefinition)\<`"public"`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

Declare a public business operation. Preparation uses an ordinary mutation;
native admission owns request recovery and the committed acceptance receipt.

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `OperationArgsValidator` |
| `ReturnsValidator` | extends `OperationReturnValidator` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.on` | [`ViewDefinition`](/api/classes/server.ViewDefinition)\<`any`, `any`, `any`> \| [`TableDefinition`](/api/classes/server.TableDefinition)\<`any`, `any`, `any`, `any`, `false`> | - |
| `definition.target?` | `Object` | Explicit selected-object argument; discovery never guesses from names. |
| `definition.target.argument` | `string` | - |
| `definition.implements?` | readonly [`OperationInterfaceDefinition`](/api/modules/server#operationinterfacedefinition)\<`any`, `any`>\[] | - |
| `definition.consumes?` | [`PublicationConsumption`](/api/modules/server#publicationconsumption) | - |
| `definition.args` | `ArgsValidator` | - |
| `definition.returns` | `ReturnsValidator` | Defines the public local result type and validates preparation, independently of a particular handler's narrower result or any remote outcome. |
| `definition.prepare` | (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`any`>, `args`: `OperationArgsFromValidator`\<`ArgsValidator`>) => [`ReturnValueForOptionalValidator`](/api/modules/server#returnvalueforoptionalvalidator)\<`ReturnsValidator`> | - |

#### Returns

[`OperationDefinition`](/api/modules/server#operationdefinition)\<`"public"`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

***

### defineInternalOperation

▸ **defineInternalOperation**\<`ArgsValidator`, `ReturnsValidator`>(`definition`): [`OperationDefinition`](/api/modules/server#operationdefinition)\<`"internal"`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

Declare an operation callable only from authorized server execution.
Internal visibility does not grant permission to its effects.

#### Type parameters

| Name | Type |
| :- | :- |
| `ArgsValidator` | extends `OperationArgsValidator` |
| `ReturnsValidator` | extends `OperationReturnValidator` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.on` | [`ViewDefinition`](/api/classes/server.ViewDefinition)\<`any`, `any`, `any`> \| [`TableDefinition`](/api/classes/server.TableDefinition)\<`any`, `any`, `any`, `any`, `false`> | - |
| `definition.target?` | `Object` | Explicit selected-object argument; discovery never guesses from names. |
| `definition.target.argument` | `string` | - |
| `definition.implements?` | readonly [`OperationInterfaceDefinition`](/api/modules/server#operationinterfacedefinition)\<`any`, `any`>\[] | - |
| `definition.consumes?` | [`PublicationConsumption`](/api/modules/server#publicationconsumption) | - |
| `definition.args` | `ArgsValidator` | - |
| `definition.returns` | `ReturnsValidator` | Defines the public local result type and validates preparation, independently of a particular handler's narrower result or any remote outcome. |
| `definition.prepare` | (`ctx`: [`BijectionMutationCtx`](/api/interfaces/server.BijectionMutationCtx)\<`any`>, `args`: `OperationArgsFromValidator`\<`ArgsValidator`>) => [`ReturnValueForOptionalValidator`](/api/modules/server#returnvalueforoptionalvalidator)\<`ReturnsValidator`> | - |

#### Returns

[`OperationDefinition`](/api/modules/server#operationdefinition)\<`"internal"`, `OperationArgsFromValidator`\<`ArgsValidator`>, [`Infer`](/api/modules/values#infer)\<[`AsObjectValidator`](/api/modules/values#asobjectvalidator-2)\<`ReturnsValidator`>>>

***

### paginationResultValidator

▸ **paginationResultValidator**\<`T`>(`itemValidator`): [`VObject`](/api/classes/values.VObject)\<\{ `splitCursor`: `undefined` | `null` | `string` ; `pageStatus`: `undefined` | `null` | `"SplitRecommended"` | `"SplitRequired"` ; `page`: `T`\[`"type"`]\[] ; `continueCursor`: `string` ; `isDone`: `boolean`  }, \{ `page`: [`VArray`](/api/classes/values.VArray)\<`T`\[`"type"`]\[], `T`, `"required"`> ; `continueCursor`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `isDone`: [`VBoolean`](/api/classes/values.VBoolean)\<`boolean`, `"required"`> ; `splitCursor`: [`VUnion`](/api/classes/values.VUnion)\<`undefined` | `null` | `string`, \[[`VString`](/api/classes/values.VString)\<`string`, `"required"`>, [`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>], `"optional"`, `never`> ; `pageStatus`: [`VUnion`](/api/classes/values.VUnion)\<`undefined` | `null` | `"SplitRecommended"` | `"SplitRequired"`, \[[`VLiteral`](/api/classes/values.VLiteral)\<`"SplitRecommended"`, `"required"`>, [`VLiteral`](/api/classes/values.VLiteral)\<`"SplitRequired"`, `"required"`>, [`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>], `"optional"`, `never`>  }, `"required"`, `"page"` | `"continueCursor"` | `"isDone"` | `"splitCursor"` | `"pageStatus"`>

A [Validator](/api/modules/values#validator) factory for [PaginationResult](/api/interfaces/server.PaginationResult).

Create a validator for the result of calling [paginate](/api/interfaces/server.OrderedQuery#paginate)
with a given item validator.

For example:

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const paginationResultValidator = paginationResultValidator(v.object({
  _id: v.id("users"),
  _creationTime: v.number(),
  name: v.string(),
}));
```

#### Type parameters

| Name | Type |
| :- | :- |
| `T` | extends [`Validator`](/api/modules/values#validator)\<[`Value`](/api/modules/values#value), `"required"`, `string`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `itemValidator` | `T` | A validator for the items in the page |

#### Returns

[`VObject`](/api/classes/values.VObject)\<\{ `splitCursor`: `undefined` | `null` | `string` ; `pageStatus`: `undefined` | `null` | `"SplitRecommended"` | `"SplitRequired"` ; `page`: `T`\[`"type"`]\[] ; `continueCursor`: `string` ; `isDone`: `boolean`  }, \{ `page`: [`VArray`](/api/classes/values.VArray)\<`T`\[`"type"`]\[], `T`, `"required"`> ; `continueCursor`: [`VString`](/api/classes/values.VString)\<`string`, `"required"`> ; `isDone`: [`VBoolean`](/api/classes/values.VBoolean)\<`boolean`, `"required"`> ; `splitCursor`: [`VUnion`](/api/classes/values.VUnion)\<`undefined` | `null` | `string`, \[[`VString`](/api/classes/values.VString)\<`string`, `"required"`>, [`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>], `"optional"`, `never`> ; `pageStatus`: [`VUnion`](/api/classes/values.VUnion)\<`undefined` | `null` | `"SplitRecommended"` | `"SplitRequired"`, \[[`VLiteral`](/api/classes/values.VLiteral)\<`"SplitRecommended"`, `"required"`>, [`VLiteral`](/api/classes/values.VLiteral)\<`"SplitRequired"`, `"required"`>, [`VNull`](/api/classes/values.VNull)\<`null`, `"required"`>], `"optional"`, `never`>  }, `"required"`, `"page"` | `"continueCursor"` | `"isDone"` | `"splitCursor"` | `"pageStatus"`>

A validator for the pagination result

***

### definePublished

▸ **definePublished**\<`Row`>(`definition`): [`PublishedDefinition`](/api/classes/server.PublishedDefinition)\<`Row`>

Declare a table whose rows one producer publishes.

#### Type parameters

| Name | Type |
| :- | :- |
| `Row` | extends [`Validator`](/api/modules/values#validator)\<`Record`\<`string`, `any`>, `"required"`, `any`> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |
| `definition.producer` | `string` |
| `definition.member` | `string` |
| `definition.row` | `Row` |

#### Returns

[`PublishedDefinition`](/api/classes/server.PublishedDefinition)\<`Row`>

▸ **definePublished**\<`Row`>(`definition`): [`PublishedDefinition`](/api/classes/server.PublishedDefinition)\<[`VObject`](/api/classes/values.VObject)\<[`ObjectType`](/api/modules/values#objecttype)\<`Row`>, `Row`>>

Declare a table whose rows one producer publishes.

#### Type parameters

| Name | Type |
| :- | :- |
| `Row` | extends `Record`\<`string`, [`GenericValidator`](/api/modules/values#genericvalidator)> |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |
| `definition.producer` | `string` |
| `definition.member` | `string` |
| `definition.row` | `Row` |

#### Returns

[`PublishedDefinition`](/api/classes/server.PublishedDefinition)\<[`VObject`](/api/classes/values.VObject)\<[`ObjectType`](/api/modules/values#objecttype)\<`Row`>, `Row`>>

***

### definePublisher

▸ **definePublisher**(`definition`): [`PublisherDefinition`](/api/modules/server#publisherdefinition)

Declare a publisher over this deployment's own functions.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.producer` | `string` | Explicit output group producer, used to reserve ownership at deploy. |
| `definition.manifest` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"internal"`, `any`, `any`> | An internal query answering which runs are ready to publish. |
| `definition.steps` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"internal"`, `any`, `any`> | An internal query paging one ready run's sealed step records. |
| `definition.page` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"internal"`, `any`, `any`> | An internal query paging one output member's staged rows. |
| `definition.rebuild` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `"internal"`, `any`, `any`> | Called once after a deployment reserves a new owner epoch. It records authored rebuild intent through the ordinary mutation path. |
| `definition.transition?` | `PublisherTransition` | Required when moving, changing membership, or retiring a published group. |

#### Returns

[`PublisherDefinition`](/api/modules/server#publisherdefinition)

***

### decideEach

▸ **decideEach**\<`R`>(`requests`, `decide`): `Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)>

Decide each request of a batch on its own, in order. A return inside
`decide` settles only its own request; a throw refuses the batch.

#### Type parameters

| Name |
| :- |
| `R` |

#### Parameters

| Name | Type |
| :- | :- |
| `requests` | readonly `R`\[] |
| `decide` | (`request`: `R`) => [`ReadAccessResult`](/api/modules/server#readaccessresult) \| `Promise`\<[`ReadAccessResult`](/api/modules/server#readaccessresult)> |

#### Returns

`Promise`\<[`ReadAccessResults`](/api/modules/server#readaccessresults)>

***

### httpRouter

▸ **httpRouter**(): [`HttpRouter`](/api/classes/server.HttpRouter)

Return a new [HttpRouter](/api/classes/server.HttpRouter) object.

#### Returns

[`HttpRouter`](/api/classes/server.HttpRouter)

***

### defineTable

▸ **defineTable**\<`DocumentSchema`>(`documentSchema`): [`TableDefinition`](/api/classes/server.TableDefinition)\<`DocumentSchema`>

Define a table in a schema.

You can either specify the schema of your documents as an object like

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
defineTable({
  field: v.string()
});
```

or as a schema type like

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
defineTable(
 v.union(
   v.object({...}),
   v.object({...})
 )
);
```

#### Type parameters

| Name | Type |
| :- | :- |
| `DocumentSchema` | extends [`Validator`](/api/modules/values#validator)\<`Record`\<`string`, `any`>, `"required"`, `any`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `documentSchema` | `DocumentSchema` | The type of documents stored in this table. |

#### Returns

[`TableDefinition`](/api/classes/server.TableDefinition)\<`DocumentSchema`>

A [TableDefinition](/api/classes/server.TableDefinition) for the table.

▸ **defineTable**\<`DocumentSchema`>(`documentSchema`): [`TableDefinition`](/api/classes/server.TableDefinition)\<[`VObject`](/api/classes/values.VObject)\<[`ObjectType`](/api/modules/values#objecttype)\<`DocumentSchema`>, `DocumentSchema`>>

Define a table in a schema.

You can either specify the schema of your documents as an object like

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
defineTable({
  field: v.string()
});
```

or as a schema type like

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
defineTable(
 v.union(
   v.object({...}),
   v.object({...})
 )
);
```

#### Type parameters

| Name | Type |
| :- | :- |
| `DocumentSchema` | extends `Record`\<`string`, [`GenericValidator`](/api/modules/values#genericvalidator)> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `documentSchema` | `DocumentSchema` | The type of documents stored in this table. |

#### Returns

[`TableDefinition`](/api/classes/server.TableDefinition)\<[`VObject`](/api/classes/values.VObject)\<[`ObjectType`](/api/modules/values#objecttype)\<`DocumentSchema`>, `DocumentSchema`>>

A [TableDefinition](/api/classes/server.TableDefinition) for the table.

***

### docValidator

▸ **docValidator**\<`TableName`, `Table`>(`tableName`, `table`): [`DocValidator`](/api/modules/server#docvalidator)\<`TableName`, `Table`\[`"validator"`]>

Build the validator for whole documents of a table, by adding the `_id` and
`_creationTime` system fields to the table's own validator.

Prefer [doc](/api/classes/server.SchemaDefinition#doc) when you have the schema in hand: it
checks the table name against the schema.

**`Example`**

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const messageDoc = docValidator("messages", schema.tables.messages);

export const get = query({
  args: { id: v.id("messages") },
  returns: v.union(messageDoc, v.null()),
  handler: (ctx, args) => ctx.db.get(args.id),
});
```

#### Type parameters

| Name | Type |
| :- | :- |
| `TableName` | extends `string` |
| `Table` | extends [`TableDefinition`](/api/classes/server.TableDefinition)\<`any`, `any`, `any`, `any`, `boolean`, `Table`> |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `tableName` | `TableName` | The name of the table, used for the `_id` validator. |
| `table` | `Table` | The [TableDefinition](/api/classes/server.TableDefinition) for that table. |

#### Returns

[`DocValidator`](/api/modules/server#docvalidator)\<`TableName`, `Table`\[`"validator"`]>

A validator matching documents of the table.

***

### defineSchema

▸ **defineSchema**\<`Schema`, `StrictTableNameTypes`>(`schema`, `options?`): [`SchemaDefinition`](/api/classes/server.SchemaDefinition)\<`Schema`, `StrictTableNameTypes`>

Define the schema of this Bijection project.

This should be exported as the default export from a `schema.ts` file in
your `bijection/` directory. The schema enables runtime validation of documents
and provides end-to-end TypeScript type safety.

Every document in Bijection automatically has two system fields:

* `_id` - a unique document ID with validator `v.id("tableName")`
* `_creationTime` - a creation timestamp with validator `v.number()`

You do not need to include these in your schema definition, they are added
automatically.

**`Example`**

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
// bijection/schema.ts
import { defineSchema, defineTable } from "bijection/server";
import { v } from "bijection/values";

export default defineSchema({
  users: defineTable({
    name: v.string(),
    email: v.string(),
  }).index("by_email", ["email"]),

  messages: defineTable({
    body: v.string(),
    userId: v.id("users"),
    channelId: v.id("channels"),
  }).index("by_channel", ["channelId"]),

  channels: defineTable({
    name: v.string(),
  }),

  // Discriminated union table:
  results: defineTable(
    v.union(
      v.object({ kind: v.literal("error"), message: v.string() }),
      v.object({ kind: v.literal("success"), value: v.number() }),
    )
  ),
});
```

**Best practice:** Always include all index fields in the index name. For
example, an index on `["field1", "field2"]` should be named
`"by_field1_field2"`.

**`See`**

[https://docs.bijection.com/database/schemas](/database/schemas)

#### Type parameters

| Name | Type |
| :- | :- |
| `Schema` | extends [`GenericSchema`](/api/modules/server#genericschema) |
| `StrictTableNameTypes` | extends `boolean` = `true` |

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `schema` | `Schema` & `ViewInputsInSchema`\<`Schema`> | A map from table name to [TableDefinition](/api/classes/server.TableDefinition) for all of the tables in this project. |
| `options?` | [`DefineSchemaOptions`](/api/interfaces/server.DefineSchemaOptions)\<`StrictTableNameTypes`> | Optional configuration. See [DefineSchemaOptions](/api/interfaces/server.DefineSchemaOptions) for a full description. |

#### Returns

[`SchemaDefinition`](/api/classes/server.SchemaDefinition)\<`Schema`, `StrictTableNameTypes`>

The schema.

***

### getTableChangeToken

▸ **getTableChangeToken**(`table`): `Promise`\<`string`>

Observe committed changes anywhere in a table, including deletions and
updates outside a sampled page. The opaque token is not source provenance.
Current table access applies, and this read is reactive without scanning rows.

#### Parameters

| Name | Type |
| :- | :- |
| `table` | `string` |

#### Returns

`Promise`\<`string`>

***

### defineView

▸ **defineView**\<`From`, `Plan`>(`definition`): [`ViewDefinition`](/api/classes/server.ViewDefinition)\<`From`, `Plan`>

#### Type parameters

| Name | Type |
| :- | :- |
| `From` | extends `string` |
| `Plan` | `Plan` |

#### Parameters

| Name | Type |
| :- | :- |
| `definition` | `Object` |
| `definition.key` | [`ViewKey`](/api/modules/server#viewkey)\<`From`> |
| `definition.expression` | [`ViewQuery`](/api/classes/server.ViewQuery)\<`Plan`> |
| `definition.limits?` | [`ViewLimits`](/api/modules/server#viewlimits) |

#### Returns

[`ViewDefinition`](/api/classes/server.ViewDefinition)\<`From`, `Plan`>

***

### defineWait

▸ **defineWait**(`definition`): [`WaitDefinition`](/api/modules/server#waitdefinition)

Declare a durable wait over this deployment's own functions.

#### Parameters

| Name | Type | Description |
| :- | :- | :- |
| `definition` | `Object` | - |
| `definition.keys?` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"internal"`, `any`, `any`> | An internal query listing at most 32 stable instance keys. Each key's `due` runs in its own transaction; `due` and `then` receive `{ key }`. |
| `definition.due` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"query"`, `"internal"`, `any`, `any`> | An internal query returning the next boundary in epoch milliseconds, or `null` when the program has no next boundary for this concern. |
| `definition.then` | `string` \| [`FunctionReference`](/api/modules/server#functionreference)\<`"mutation"`, `"internal"`, `any`, `any`> | An internal mutation the engine schedules when the boundary is reached. |

#### Returns

[`WaitDefinition`](/api/modules/server#waitdefinition)
