---
title: "nuxt-backend/functions"
description: "Every export of nuxt-backend/functions, with its signature and where it is defined."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/functions"
---
# nuxt-backend/functions

## Interfaces

### FunctionOrganization

Defined in: [src/convex/integrations/functions.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts)

The workspace context injected by the `org` tier.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="id">
        
      </a>
      
       <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="role">
        
      </a>
      
       <code>
        role
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The caller's role within the workspace (owner/admin/member or custom).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FunctionsRateLimiter

Defined in: [src/convex/integrations/functions.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts)

A rate limiter compatible with `setupRateLimiter(...)` from `nuxt-backend/rate-limit`.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="limit">
        
      </a>
      
       <code>
        limit
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        name
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        unknown
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### CreateFunctionsOptions

Defined in: [src/convex/integrations/functions.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="adminroles">
        
      </a>
      
       <code>
        adminRoles?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      App-wide roles that pass the <code>
        admin
      </code>
      
       tier. Default <code>
        ['admin']
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ratelimiter">
        
      </a>
      
       <code>
        rateLimiter?
      </code>
    </td>
    
    <td>
      <a href="#functionsratelimiter">
        <code>
          FunctionsRateLimiter
        </code>
      </a>
    </td>
    
    <td>
      Rate limiter to guard write tiers (<code>
        setupRateLimiter(...)
      </code>
      
      ).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="limits">
        
      </a>
      
       <code>
        limits?
      </code>
    </td>
    
    <td>
      <code>
        Partial
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        "admin"
      </code>
      
       | <code>
        "authed"
      </code>
      
       | <code>
        "org"
      </code>
      
      , <code>
        string
      </code>
      
      >>
    </td>
    
    <td>
      Named rate limits per tier, consumed on <strong>
        mutations and actions
      </strong>
      
       (keyed by user id; queries are reads and can't consume a limit). E.g. <code>
        { authed: 'apiWrites' }
      </code>
      
       with a matching limit in <code>
        setupRateLimiter
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### BackendErrorCode

```ts
type BackendErrorCode = keyof typeof BACKEND_ERRORS;
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

One of the catalog's codes.

---

### BackendErrorData

```ts
type BackendErrorData<C> = Infer<typeof BACKEND_ERRORS[C]["data"]>;
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

The fields a code carries beside it.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
    
    <th>
      Default type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-c">
        
      </a>
      
       <code>
        C
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#backenderrorcode">
        <code>
          BackendErrorCode
        </code>
      </a>
    </td>
    
    <td>
      <a href="#backenderrorcode">
        <code>
          BackendErrorCode
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendError

```ts
type BackendError = { [C in BackendErrorCode]: { code: C; data: Partial<BackendErrorData<C>>; message: string } }[BackendErrorCode];
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

A refusal read back by [getBackendError](#getbackenderror): its code, its fields, and a
sentence to show — `data.message` when the throw site wrote one for the
person, else the code's English label. Every field is optional here, the
required ones too: the reader keeps only the fields that fit the catalog,
and an auth route or an older deployment may send fewer.

---

### BackendErrorPayload

```ts
type BackendErrorPayload<C> = {
  code: C;
} & BackendErrorData<C> & {
[key: string]: Value | undefined;
};
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

What a `backendError()` carries to the client: the code and its fields, flat.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
    
    <th>
      Default type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-c-1">
        
      </a>
      
       <code>
        C
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#backenderrorcode">
        <code>
          BackendErrorCode
        </code>
      </a>
    </td>
    
    <td>
      <a href="#backenderrorcode">
        <code>
          BackendErrorCode
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        code
      </code>
    </td>
    
    <td>
      <code>
        C
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### BackendErrorArgs

```ts
type BackendErrorArgs<C> = Record<string, never> extends BackendErrorData<C> ? [data?: BackendErrorData<C>, detail?: string] : [data: BackendErrorData<C>, detail?: string];
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

What `backendError` takes after the code: the code's data, optional for a
code whose fields are all optional, then the English detail for the log.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-c-2">
        
      </a>
      
       <code>
        C
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#backenderrorcode">
        <code>
          BackendErrorCode
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

## Variables

### BACKEND_ERRORS

```ts
const BACKEND_ERRORS: {
  unauthenticated: {
     status: 401;
     data: VObject<{
        message?: string;
      }, {
        message: VString<string | undefined, "optional">;
     }, "required", "message">;
  };
  forbidden: {
     status: 403;
     data: VObject<{
        message?: string;
        reason: string;
      }, {
        reason: VString<string, "required">;
        message: VString<string | undefined, "optional">;
     }, "required", "message" | "reason">;
  };
  no_workspace: {
     status: 409;
     data: VObject<{
        message?: string;
      }, {
        message: VString<string | undefined, "optional">;
     }, "required", "message">;
  };
  rate_limited: {
     status: 429;
     data: VObject<{
        message?: string;
        retryAfter?: number;
        limit?: string;
      }, {
        retryAfter: VFloat64<number | undefined, "optional">;
        limit: VString<string | undefined, "optional">;
        message: VString<string | undefined, "optional">;
     }, "required", "message" | "retryAfter" | "limit">;
  };
  insufficient_credits: {
     status: 402;
     data: VObject<{
        message?: string;
        meter?: string;
        balance: number;
        need: number;
      }, {
        meter: VString<string | undefined, "optional">;
        balance: VFloat64<number, "required">;
        need: VFloat64<number, "required">;
        message: VString<string | undefined, "optional">;
     }, "required", "message" | "meter" | "balance" | "need">;
  };
  invalid_input: {
     status: 400;
     data: VObject<{
        message?: string;
        field: string;
      }, {
        field: VString<string, "required">;
        message: VString<string | undefined, "optional">;
     }, "required", "message" | "field">;
  };
  not_ready: {
     status: 409;
     data: VObject<{
        message?: string;
        reason: string;
      }, {
        reason: VString<string, "required">;
        message: VString<string | undefined, "optional">;
     }, "required", "message" | "reason">;
  };
  unavailable: {
     status: 503;
     data: VObject<{
        message?: string;
        reason: string;
        service: string;
      }, {
        service: VString<string, "required">;
        reason: VString<string, "required">;
        message: VString<string | undefined, "optional">;
     }, "required", "message" | "reason" | "service">;
  };
};
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

Every code the package throws, with the HTTP status an auth route answers
it with and the validator its data is checked against where it is thrown.
Codes and their fields are stable (STABILITY.md); a feature adds a code, it
never renames one.

- `unauthenticated` — nobody is signed in, or the session is gone.
- `forbidden` — signed in, but not allowed; `reason` says why (`banned`,
`role`, `permission`, `not_member`, `workspace_role`, `admin_only`,
`not_owner`, `impersonating`, `sign_in_refused`, `customer_taken`,
`not_billing_manager`, `gift_refused`, `gift_refunded`, `not_recipient`,
`no_email`).
- `no_workspace` — the call needs an active workspace and there is none.
- `rate_limited` — a named limit is spent; `retryAfter` is in milliseconds.
- `insufficient_credits` — the balance can't cover the spend.
- `invalid_input` — an argument the call refuses; `field` names it.
- `not_ready` — there is nothing to act on yet, and retrying will not
change that: `reason` says what has to happen first (`no_customer`,
`not_synced`, `no_catalog`, `not_paid`).
- `unavailable` — a service can't serve the call; `service` and
`reason` say which and why. Only `provider_refused` may pass on a retry;
the others need the deployment fixed. Nothing throws service `backend`
with reason `unexpected`: it is how a composable's `error` reads a
failure without a code (a crash, an app's own error), and says nothing
about whether a service is down.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default value
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="property-unauthenticated">
        
      </a>
      
       <code>
        unauthenticated
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        401
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unauthenticated.status
      </code>
    </td>
    
    <td>
      <code>
        401
      </code>
    </td>
    
    <td>
      <code>
        401
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unauthenticated.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-forbidden">
        
      </a>
      
       <code>
        forbidden
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        403
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        reason
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "reason"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        forbidden.status
      </code>
    </td>
    
    <td>
      <code>
        403
      </code>
    </td>
    
    <td>
      <code>
        403
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        forbidden.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        reason
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "reason"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-no_workspace">
        
      </a>
      
       <code>
        no_workspace
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        409
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        no_workspace.status
      </code>
    </td>
    
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        no_workspace.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-rate_limited">
        
      </a>
      
       <code>
        rate_limited
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        429
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        retryAfter?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        limit?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        retryAfter
      </code>
      
      : <code>
        VFloat64
      </code>
      
      <<code>
        number
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; <code>
        limit
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "retryAfter"
      </code>
      
       | <code>
        "limit"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rate_limited.status
      </code>
    </td>
    
    <td>
      <code>
        429
      </code>
    </td>
    
    <td>
      <code>
        429
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rate_limited.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        retryAfter?
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        limit?
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        retryAfter
      </code>
      
      : <code>
        VFloat64
      </code>
      
      <<code>
        number
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; <code>
        limit
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "retryAfter"
      </code>
      
       | <code>
        "limit"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-insufficient_credits">
        
      </a>
      
       <code>
        insufficient_credits
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        402
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meter?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        need
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        meter
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; <code>
        balance
      </code>
      
      : <code>
        VFloat64
      </code>
      
      <<code>
        number
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        need
      </code>
      
      : <code>
        VFloat64
      </code>
      
      <<code>
        number
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "meter"
      </code>
      
       | <code>
        "balance"
      </code>
      
       | <code>
        "need"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        insufficient_credits.status
      </code>
    </td>
    
    <td>
      <code>
        402
      </code>
    </td>
    
    <td>
      <code>
        402
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        insufficient_credits.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        meter?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        balance
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        need
      </code>
      
      : <code>
        number
      </code>
      
      ; }, { <code>
        meter
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; <code>
        balance
      </code>
      
      : <code>
        VFloat64
      </code>
      
      <<code>
        number
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        need
      </code>
      
      : <code>
        VFloat64
      </code>
      
      <<code>
        number
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "meter"
      </code>
      
       | <code>
        "balance"
      </code>
      
       | <code>
        "need"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-invalid_input">
        
      </a>
      
       <code>
        invalid_input
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        400
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        field
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        field
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "field"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        invalid_input.status
      </code>
    </td>
    
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        invalid_input.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        field
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        field
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "field"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-not_ready">
        
      </a>
      
       <code>
        not_ready
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        409
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        reason
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "reason"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        not_ready.status
      </code>
    </td>
    
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        not_ready.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        reason
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "reason"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-unavailable">
        
      </a>
      
       <code>
        unavailable
      </code>
    </td>
    
    <td>
      { <code>
        status
      </code>
      
      : <code>
        503
      </code>
      
      ; <code>
        data
      </code>
      
      : <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        service
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        service
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        reason
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "reason"
      </code>
      
       | <code>
        "service"
      </code>
      
      >; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unavailable.status
      </code>
    </td>
    
    <td>
      <code>
        503
      </code>
    </td>
    
    <td>
      <code>
        503
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unavailable.data
      </code>
    </td>
    
    <td>
      <code>
        VObject
      </code>
      
      <{ <code>
        message?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        reason
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        service
      </code>
      
      : <code>
        string
      </code>
      
      ; }, { <code>
        service
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        reason
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >; <code>
        message
      </code>
      
      : <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >; }, <code>
        "required"
      </code>
      
      , <code>
        "message"
      </code>
      
       | <code>
        "reason"
      </code>
      
       | <code>
        "service"
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts" rel="nofollow">
        src/convex/errors.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### backendError()

```ts
function backendError<C>(code, ...args): ConvexError<BackendErrorPayload<C>>;
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

Build the error for a refusal: `throw backendError('forbidden', { reason: 'role' })`. The data is checked against the code's validator, so a throw
site cannot send a field the catalog does not list. `detail` is the
English sentence the deployment log shows as the error's message; it never
reaches the person in production.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-c-3">
        
      </a>
      
       <code>
        C
      </code>
      
       <em>
        extends
      </em>
      
       | <code>
        "unauthenticated"
      </code>
      
       | <code>
        "forbidden"
      </code>
      
       | <code>
        "no_workspace"
      </code>
      
       | <code>
        "rate_limited"
      </code>
      
       | <code>
        "insufficient_credits"
      </code>
      
       | <code>
        "invalid_input"
      </code>
      
       | <code>
        "not_ready"
      </code>
      
       | <code>
        "unavailable"
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        code
      </code>
    </td>
    
    <td>
      <code>
        C
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      ...<code>
        args
      </code>
    </td>
    
    <td>
      <a href="#backenderrorargs">
        <code>
          BackendErrorArgs
        </code>
      </a>
      
      <<code>
        C
      </code>
      
      >
    </td>
  </tr>
</tbody>
</table>

#### Returns

`ConvexError`<[`BackendErrorPayload`](#backenderrorpayload)<`C`>>

#### Example

```ts
import { backendError } from 'nuxt-backend/functions'

if (project.ownerId !== ctx.user.id) throw backendError('forbidden', { reason: 'not_owner' })
if (!name.trim()) throw backendError('invalid_input', { field: 'name' }, 'A project needs a name.')
```

---

### getBackendError()

```ts
function getBackendError(error): BackendError | null;
```

Defined in: [src/convex/errors.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/errors.ts)

Read a refusal out of anything a call threw or resolved with: a
`backendError()` from a Convex function, the rate limiter's own
`RateLimited` error, an auth client's `{ data, error }` result or its
`error`, a Better Auth `APIError`, and any of these as an `Error`'s
`cause`. `null` for anything else — a crash, an app's own error — so the
caller keeps its own fallback.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`BackendError`](#backenderror) | `null`

#### Example

```ts
try {
  await transform({ text })
}
catch (error) {
  const refusal = getBackendError(error)
  // Every field may be absent on the read side: check the one you use.
  if (refusal?.code === 'insufficient_credits' && refusal.data.need !== undefined) offerTopUp(refusal.data.need)
  else message.value = refusal?.message ?? 'Something went wrong.'
}
```

---

### createFunctions()

```ts
function createFunctions<DM>(
   builders, 
   authorization, 
   options?
): {
  authed: {
     query: CustomBuilder<"query", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
     mutation: CustomBuilder<"mutation", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericMutationCtx<DM>, "public", Record<string, any>>;
     action: CustomBuilder<"action", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericActionCtx<DM>, "public", Record<string, any>>;
  };
  org: {
     query: CustomBuilder<"query", Record<string, never>, {
        user: AuthorizationUser;
        organization: {
           id: string;
           role: string;
        };
     }, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
     mutation: CustomBuilder<"mutation", Record<string, never>, {
        user: AuthorizationUser;
        organization: {
           id: string;
           role: string;
        };
     }, Record<string, never>, GenericMutationCtx<DM>, "public", Record<string, any>>;
     action: CustomBuilder<"action", Record<string, never>, {
        user: AuthorizationUser;
        organization: {
           id: string;
           role: string;
        };
     }, Record<string, never>, GenericActionCtx<DM>, "public", Record<string, any>>;
  };
  admin: {
     query: CustomBuilder<"query", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
     mutation: CustomBuilder<"mutation", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericMutationCtx<DM>, "public", Record<string, any>>;
     action: CustomBuilder<"action", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericActionCtx<DM>, "public", Record<string, any>>;
  };
  withRole: (role) => {
     query: CustomBuilder<"query", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericQueryCtx<DM>, "public", Record<string, any>>;
     mutation: CustomBuilder<"mutation", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericMutationCtx<DM>, "public", Record<string, any>>;
     action: CustomBuilder<"action", Record<string, never>, {
        user: AuthorizationUser;
     }, Record<string, never>, GenericActionCtx<DM>, "public", Record<string, any>>;
  };
};
```

Defined in: [src/convex/integrations/functions.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts)

Pre-authorized function builders over your `_generated/server` builders —
grouped by tier, each a drop-in `{ query, mutation, action }`:

```ts
const { authed, org, admin, withRole } = createFunctions({ query, mutation, action }, authorization)

export const me = authed.query({           // ctx.user (requireUser)
  args: {},
  handler: async (ctx) => ctx.user,
})
export const createProject = org.mutation({ // + ctx.organization (fresh membership)
  args: { name: v.string() },
  handler: async (ctx, { name }) =>
    ctx.db.insert('projects', { name, organizationId: ctx.organization.id }),
})
export const purge = admin.action({ ... })   // requireRole(adminRoles)
export const review = withRole('editor').query({ ... })
```

The `org` tier verifies membership with a fresh member-table read on every
call (a removed member is locked out immediately, not at JWT expiry).
`authed`/`admin`/`withRole` are claims-based — see `requireRole`'s `fresh`
option when you need stronger guarantees. Pass your `withTriggers`-wrapped
`mutation` to keep aggregate triggers composing.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-dm">
        
      </a>
      
       <code>
        DM
      </code>
      
       <em>
        extends
      </em>
      
       <code>
        GenericDataModel
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        builders
      </code>
    </td>
    
    <td>
      <code>
        Builders
      </code>
      
      <<code>
        DM
      </code>
      
      >
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        authorization
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorization">
        <code>
          Authorization
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#createfunctionsoptions">
        <code>
          CreateFunctionsOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        authed
      </code>
    </td>
    
    <td>
      { <code>
        query
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        mutation
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        action
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; }
    </td>
    
    <td>
      Signed-in (and not banned): injects <code>
        ctx.user
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        authed.query
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        authed.mutation
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        authed.action
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        org
      </code>
    </td>
    
    <td>
      { <code>
        query
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; <code>
        organization
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        role
      </code>
      
      : <code>
        string
      </code>
      
      ; }; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        mutation
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; <code>
        organization
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        role
      </code>
      
      : <code>
        string
      </code>
      
      ; }; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        action
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; <code>
        organization
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        role
      </code>
      
      : <code>
        string
      </code>
      
      ; }; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; }
    </td>
    
    <td>
      Workspace member (fresh check): injects <code>
        ctx.user
      </code>
      
       + <code>
        ctx.organization
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        org.query
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; <code>
        organization
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        role
      </code>
      
      : <code>
        string
      </code>
      
      ; }; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        org.mutation
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; <code>
        organization
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        role
      </code>
      
      : <code>
        string
      </code>
      
      ; }; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        org.action
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; <code>
        organization
      </code>
      
      : { <code>
        id
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        role
      </code>
      
      : <code>
        string
      </code>
      
      ; }; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        admin
      </code>
    </td>
    
    <td>
      { <code>
        query
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        mutation
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        action
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; }
    </td>
    
    <td>
      App-wide admin (<code>
        adminRoles
      </code>
      
      ): injects <code>
        ctx.user
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        admin.query
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        admin.mutation
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        admin.action
      </code>
    </td>
    
    <td>
      <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        withRole()
      </code>
    </td>
    
    <td>
      (<code>
        role
      </code>
      
      ) => { <code>
        query
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "query"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericQueryCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        mutation
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "mutation"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericMutationCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; <code>
        action
      </code>
      
      : <code>
        CustomBuilder
      </code>
      
      <<code>
        "action"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, { <code>
        user
      </code>
      
      : <a href="https://nuxt-backend.dev/docs/reference/api/authorization#authorizationuser">
        <code>
          AuthorizationUser
        </code>
      </a>
      
      ; }, <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        GenericActionCtx
      </code>
      
      <<code>
        DM
      </code>
      
      >, <code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        any
      </code>
      
      >>; }
    </td>
    
    <td>
      Custom app-wide role tier: <code>
        withRole('editor').query(...)
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/functions.ts" rel="nofollow">
        src/convex/integrations/functions.ts
      </a>
    </td>
  </tr>
</tbody>
</table>


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
