[![npm][npm-badge]][npm-badge-url]
[![license][npm-license]][npm-license-url]

[npm-badge]: https://img.shields.io/npm/v/@junobuild/functions
[npm-badge-url]: https://www.npmjs.com/package/@junobuild/functions
[npm-license]: https://img.shields.io/npm/l/@junobuild/functions
[npm-license-url]: https://github.com/junobuild/juno-js/blob/main/LICENSE

# Juno Functions

JavaScript and TypeScript utilities for [Juno] Serverless Functions.

<!-- TSDOC_START -->

### :toolbox: Functions

- [createFunctionSchema](#gear-createfunctionschema)
- [QueryFnSchema](#gear-queryfnschema)
- [QueryFnOrObjectSchema](#gear-queryfnorobjectschema)
- [defineQuery](#gear-definequery)
- [defineQuery](#gear-definequery)
- [defineQuery](#gear-definequery)
- [defineQuery](#gear-definequery)
- [UpdateFnSchema](#gear-updatefnschema)
- [UpdateFnOrObjectSchema](#gear-updatefnorobjectschema)
- [defineUpdate](#gear-defineupdate)
- [defineUpdate](#gear-defineupdate)
- [defineUpdate](#gear-defineupdate)
- [defineUpdate](#gear-defineupdate)
- [HookContextSchema](#gear-hookcontextschema)
- [AssertFunctionSchema](#gear-assertfunctionschema)
- [RunFunctionSchema](#gear-runfunctionschema)
- [DocContextSchema](#gear-doccontextschema)
- [AssertFnSchema](#gear-assertfnschema)
- [AssertFnOrObjectSchema](#gear-assertfnorobjectschema)
- [defineAssert](#gear-defineassert)
- [defineAssert](#gear-defineassert)
- [defineAssert](#gear-defineassert)
- [defineAssert](#gear-defineassert)
- [HookFnSchema](#gear-hookfnschema)
- [HookFnOrObjectSchema](#gear-hookfnorobjectschema)
- [defineHook](#gear-definehook)
- [defineHook](#gear-definehook)
- [defineHook](#gear-definehook)
- [defineHook](#gear-definehook)
- [createListResultsSchema](#gear-createlistresultsschema)
- [decodeDocData](#gear-decodedocdata)
- [encodeDocData](#gear-encodedocdata)
- [normalizeCaller](#gear-normalizecaller)
- [getAdminAccessKeys](#gear-getadminaccesskeys)
- [getAccessKeys](#gear-getaccesskeys)
- [isWriteAccessKey](#gear-iswriteaccesskey)
- [isValidAccessKey](#gear-isvalidaccesskey)
- [isAdminController](#gear-isadmincontroller)
- [setDocStore](#gear-setdocstore)
- [deleteDocStore](#gear-deletedocstore)
- [getDocStore](#gear-getdocstore)
- [listDocsStore](#gear-listdocsstore)
- [countCollectionDocsStore](#gear-countcollectiondocsstore)
- [countDocsStore](#gear-countdocsstore)
- [deleteDocsStore](#gear-deletedocsstore)
- [deleteFilteredDocsStore](#gear-deletefiltereddocsstore)
- [callerIsAdmin](#gear-callerisadmin)
- [callerHasWritePermission](#gear-callerhaswritepermission)
- [callerIsAccessKey](#gear-callerisaccesskey)
- [countCollectionAssetsStore](#gear-countcollectionassetsstore)
- [countAssetsStore](#gear-countassetsstore)
- [setAssetHandler](#gear-setassethandler)
- [deleteAssetStore](#gear-deleteassetstore)
- [deleteAssetsStore](#gear-deleteassetsstore)
- [deleteFilteredAssetsStore](#gear-deletefilteredassetsstore)
- [setAssetTokenStore](#gear-setassettokenstore)
- [getAssetStore](#gear-getassetstore)
- [listAssetsStore](#gear-listassetsstore)
- [getContentChunksStore](#gear-getcontentchunksstore)
- [call](#gear-call)
- [msgCaller](#gear-msgcaller)
- [caller](#gear-caller)
- [httpRequest](#gear-httprequest)
- [canisterSelf](#gear-canisterself)
- [id](#gear-id)
- [satelliteSelf](#gear-satelliteself)
- [time](#gear-time)

#### :gear: createFunctionSchema

Wraps a Zod function schema so that parsing returns the **original function**
instead of Zod's wrapped validator.

## Why?

In Zod v4, `z.function({...})` normally returns a wrapper that validates
both arguments and the return value **every time the function is called**.
If your function's return type is `void | Promise<void>`, Zod tries to
validate it synchronously, which can throw
"Encountered Promise during synchronous parse"
when the implementation is async.

By using `.implement`, we tell Zod: “this is the function that satisfies
the schema.” That way the schema still validates the function shape at
parse time, but the returned value is the **original function** you passed
in — no runtime wrapper, no sync/async mismatch.

Reference:
https://github.com/colinhacks/zod/issues/4143#issuecomment-2845134912

Note: We need the function for this library, see following comment
https://github.com/colinhacks/zod/issues/4143#issuecomment-3335735535

| Function               | Type                                                                                                              |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `createFunctionSchema` | `<T extends z.ZodFunction>(schema: T) => ZodCustom<Parameters<T["implement"]>[0], Parameters<T["implement"]>[0]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/utils/zod.utils.ts#L27)

#### :gear: QueryFnSchema

| Function        | Type                                                                                                            |
| --------------- | --------------------------------------------------------------------------------------------------------------- |
| `QueryFnSchema` | `<T extends z.ZodTypeAny>(querySchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L66)

#### :gear: QueryFnOrObjectSchema

| Function                | Type                                                                                                                                                                                         |
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `QueryFnOrObjectSchema` | `<T extends z.ZodTypeAny>(querySchema: T) => ZodUnion<readonly [T, ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>, $InferInnerFunctionType<...>>]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L76)

#### :gear: defineQuery

| Function      | Type                                                                                                                                                                                                                                                                                                                               |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineQuery` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: Query<TArgs, TResult>): QueryDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: QueryFn<...>): (env: Record<...>) => QueryDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(qu...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L86)

#### :gear: defineQuery

| Function      | Type                                                                                                                                                                                                                                                                                                                               |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineQuery` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: Query<TArgs, TResult>): QueryDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: QueryFn<...>): (env: Record<...>) => QueryDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(qu...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L89)

#### :gear: defineQuery

| Function      | Type                                                                                                                                                                                                                                                                                                                               |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineQuery` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: Query<TArgs, TResult>): QueryDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: QueryFn<...>): (env: Record<...>) => QueryDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(qu...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L92)

#### :gear: defineQuery

| Function      | Type                                                                                                                                                                                                                                                                                                                               |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineQuery` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: Query<TArgs, TResult>): QueryDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(query: QueryFn<...>): (env: Record<...>) => QueryDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(qu...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L95)

#### :gear: UpdateFnSchema

| Function         | Type                                                                                                             |
| ---------------- | ---------------------------------------------------------------------------------------------------------------- |
| `UpdateFnSchema` | `<T extends z.ZodTypeAny>(updateSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L66)

#### :gear: UpdateFnOrObjectSchema

| Function                 | Type                                                                                                                                                                                          |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UpdateFnOrObjectSchema` | `<T extends z.ZodTypeAny>(updateSchema: T) => ZodUnion<readonly [T, ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>, $InferInnerFunctionType<...>>]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L76)

#### :gear: defineUpdate

| Function       | Type                                                                                                                                                                                                                                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineUpdate` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: Update<TArgs, TResult>): UpdateDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: UpdateFn<...>): (env: Record<...>) => UpdateDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawSha...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L86)

#### :gear: defineUpdate

| Function       | Type                                                                                                                                                                                                                                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineUpdate` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: Update<TArgs, TResult>): UpdateDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: UpdateFn<...>): (env: Record<...>) => UpdateDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawSha...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L89)

#### :gear: defineUpdate

| Function       | Type                                                                                                                                                                                                                                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineUpdate` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: Update<TArgs, TResult>): UpdateDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: UpdateFn<...>): (env: Record<...>) => UpdateDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawSha...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L92)

#### :gear: defineUpdate

| Function       | Type                                                                                                                                                                                                                                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineUpdate` | `{ <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: Update<TArgs, TResult>): UpdateDefinition<TArgs, TResult>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawShape>(update: UpdateFn<...>): (env: Record<...>) => UpdateDefinition<...>; <TArgs extends z.ZodRawShape, TResult extends z.ZodRawSha...` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L95)

#### :gear: HookContextSchema

| Function            | Type                                                                                                                                               |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HookContextSchema` | `<T extends z.ZodTypeAny>(dataSchema: T) => ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: T; }, $strict>` |

References:

- HookContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L8)

#### :gear: AssertFunctionSchema

| Function               | Type                                                                                                                                                                    |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodCustom<$InferInnerFunctionType<ZodTuple<[T], null>, ZodVoid>, $InferInnerFunctionType<ZodTuple<[T], null>, ZodVoid>>` |

References:

- AssertFunction

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L37)

#### :gear: RunFunctionSchema

| Function            | Type                                                                                                                                                                            |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RunFunctionSchema` | `<T extends z.ZodTypeAny>(contextSchema: T) => ZodCustom<$InferInnerFunctionType<ZodTuple<[T], null>, ZodUnion<[ZodPromise<ZodVoid>, ZodVoid]>>, $InferInnerFunctionType<...>>` |

References:

- RunFunction

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L52)

#### :gear: DocContextSchema

| Function           | Type                                                                                                                 |
| ------------------ | -------------------------------------------------------------------------------------------------------------------- |
| `DocContextSchema` | `<T extends z.ZodTypeAny>(dataSchema: T) => ZodObject<{ collection: ZodString; key: ZodString; data: T; }, $strict>` |

References:

- DocContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L17)

#### :gear: AssertFnSchema

| Function         | Type                                                                                                             |
| ---------------- | ---------------------------------------------------------------------------------------------------------------- |
| `AssertFnSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L97)

#### :gear: AssertFnOrObjectSchema

| Function                 | Type                                                                                                                                                                                          |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertFnOrObjectSchema` | `<T extends z.ZodTypeAny>(assertSchema: T) => ZodUnion<readonly [T, ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>, $InferInnerFunctionType<...>>]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L104)

#### :gear: defineAssert

| Function       | Type                                                                                                                                                                |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L108)

#### :gear: defineAssert

| Function       | Type                                                                                                                                                                |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L109)

#### :gear: defineAssert

| Function       | Type                                                                                                                                                                |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L110)

#### :gear: defineAssert

| Function       | Type                                                                                                                                                                |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineAssert` | `{ <T extends Assert>(assert: T): T; <T extends Assert>(assert: AssertFn<T>): AssertFn<T>; <T extends Assert>(assert: AssertFnOrObject<T>): AssertFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L111)

#### :gear: HookFnSchema

| Function       | Type                                                                                                           |
| -------------- | -------------------------------------------------------------------------------------------------------------- |
| `HookFnSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodFunction<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L171)

#### :gear: HookFnOrObjectSchema

| Function               | Type                                                                                                                                                                                        |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HookFnOrObjectSchema` | `<T extends z.ZodTypeAny>(hookSchema: T) => ZodUnion<readonly [T, ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodRecord<ZodString, ZodString>], null>, T>, $InferInnerFunctionType<...>>]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L175)

#### :gear: defineHook

| Function     | Type                                                                                                                                            |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L179)

#### :gear: defineHook

| Function     | Type                                                                                                                                            |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L180)

#### :gear: defineHook

| Function     | Type                                                                                                                                            |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L181)

#### :gear: defineHook

| Function     | Type                                                                                                                                            |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `defineHook` | `{ <T extends Hook>(hook: T): T; <T extends Hook>(hook: HookFn<T>): HookFn<T>; <T extends Hook>(hook: HookFnOrObject<T>): HookFnOrObject<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L182)

#### :gear: createListResultsSchema

Represents a list result.

| Function                  | Type                                                                                                                                                                                                                                         |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `createListResultsSchema` | `<T extends z.ZodTypeAny>(itemData: T) => ZodObject<{ items: ZodArray<ZodTuple<[ZodString, T], null>>; items_length: ZodBigInt; items_page: ZodOptional<ZodBigInt>; matches_length: ZodBigInt; matches_pages: ZodOptional<...>; }, $strict>` |

References:

- JsListResults

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L128)

#### :gear: decodeDocData

Decodes the raw data of a document into a JavaScript object.

| Function        | Type                      |
| --------------- | ------------------------- |
| `decodeDocData` | `<T>(data: RawData) => T` |

Parameters:

- `data`: - The raw data to be decoded.

Returns:

The parsed JavaScript object.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/serializer.sdk.ts#L11)

#### :gear: encodeDocData

Encodes a JavaScript object into a raw data format to be applied to a document.

| Function        | Type                      |
| --------------- | ------------------------- |
| `encodeDocData` | `<T>(data: T) => RawData` |

Parameters:

- `data`: - The data to be encoded.

Returns:

The serialized raw data.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/serializer.sdk.ts#L21)

#### :gear: normalizeCaller

Normalizes a user ID into a raw `Uint8Array` representation.

| Function          | Type                            |
| ----------------- | ------------------------------- |
| `normalizeCaller` | `(caller: any) => RawPrincipal` |

Parameters:

- `caller`: - The caller identity, either a raw `Uint8Array`
  or a `Principal` instance.

Returns:

The raw user ID as a `Uint8Array`.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/utils/caller.utils.ts#L12)

#### :gear: getAdminAccessKeys

Gets the list of admin access keys from the Satellite.

| Function             | Type               |
| -------------------- | ------------------ |
| `getAdminAccessKeys` | `() => AccessKeys` |

Returns:

The list of admin acces keys.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/access-keys.sdk.ts#L15)

#### :gear: getAccessKeys

Gets the list of access keys from the Satellite.

| Function        | Type               |
| --------------- | ------------------ |
| `getAccessKeys` | `() => AccessKeys` |

Returns:

The list of all access keys.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/access-keys.sdk.ts#L24)

#### :gear: isWriteAccessKey

Checks if the given id exists among the provided access keys.

| Function           | Type                                        |
| ------------------ | ------------------------------------------- |
| `isWriteAccessKey` | `(params: AccessKeyCheckParams) => boolean` |

Parameters:

- `params`: - The parameters including the id
  and the list of access keys to verify against.

Returns:

Whether the id is an access key with write permission.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/access-keys.sdk.ts#L36)

#### :gear: isValidAccessKey

Checks if the given id exists among the provided access keys.

| Function           | Type                                        |
| ------------------ | ------------------------------------------- |
| `isValidAccessKey` | `(params: AccessKeyCheckParams) => boolean` |

Parameters:

- `params`: - The parameters including the id
  and the list of access keys to verify against.

Returns:

Whether the id is an access key.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/access-keys.sdk.ts#L56)

#### :gear: isAdminController

Checks if the given id is an admin among the provided access keys and a controller as known on the Internet Computer.

| Function            | Type                                        |
| ------------------- | ------------------------------------------- |
| `isAdminController` | `(params: AccessKeyCheckParams) => boolean` |

Parameters:

- `params`: - The parameters including the id
  and the list of access keys to verify against.

Returns:

Whether the id is an admin and a controller of the Satellite on the Internet Computer.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/access-keys.sdk.ts#L76)

#### :gear: setDocStore

Stores or updates a document in the datastore.

The data must have been encoded - using encodeDocData - before calling this function.

| Function      | Type                                                   |
| ------------- | ------------------------------------------------------ |
| `setDocStore` | `(params: SetDocStoreParams) => DocContext<DocUpsert>` |

Parameters:

- `params`: - The parameters required to store the document,
  including the caller, collection, key, and document data.

Returns:

The context of the stored or updated document,
including its key, collection, and both the previous and current versions of the document.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L39)

#### :gear: deleteDocStore

Deletes a document from the datastore.

| Function         | Type                                                      |
| ---------------- | --------------------------------------------------------- |
| `deleteDocStore` | `(params: DeleteDocStoreParams) => DocContext<OptionDoc>` |

Parameters:

- `params`: - The parameters required to delete the document,
  including the caller, collection, key, and the expected version of the document.

Returns:

The context of the deleted document,
including its key, collection, and optionally the previous document data if it existed.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L61)

#### :gear: getDocStore

Retrieve a document from the datastore.

| Function      | Type                                       |
| ------------- | ------------------------------------------ |
| `getDocStore` | `(params: GetDocStoreParams) => OptionDoc` |

Parameters:

- `params`: - The parameters required to get the document.

Returns:

The document if found, or undefined if not.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L81)

#### :gear: listDocsStore

Lists documents from the datastore using optional filtering, pagination, and ordering parameters.

| Function        | Type                                            |
| --------------- | ----------------------------------------------- |
| `listDocsStore` | `(params: ListStoreParams) => ListResults<Doc>` |

Parameters:

- `params`: - The parameters required to perform the list operation.

Returns:

A list result containing matching documents and pagination metadata.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L101)

#### :gear: countCollectionDocsStore

Counts the number of documents in a specific collection.

| Function                   | Type                                   |
| -------------------------- | -------------------------------------- |
| `countCollectionDocsStore` | `(params: CollectionParams) => bigint` |

Parameters:

- `params`: - The parameters required to count documents in the collection.

Returns:

The total number of documents in the specified collection.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L121)

#### :gear: countDocsStore

Counts the number of documents in a collection matching specific filters and owned by a specific caller.

| Function         | Type                                  |
| ---------------- | ------------------------------------- |
| `countDocsStore` | `(params: ListStoreParams) => bigint` |

Parameters:

- `params`: - The parameters required to perform the filtered count.

Returns:

The number of documents that match the provided filters.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L139)

#### :gear: deleteDocsStore

Delete documents in a specific collection of the Datastore.

| Function          | Type                                 |
| ----------------- | ------------------------------------ |
| `deleteDocsStore` | `(params: CollectionParams) => void` |

Parameters:

- `params`: - The parameters required to delete documents in the collection.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L157)

#### :gear: deleteFilteredDocsStore

Delete documents in a collection matching specific filters and owned by a specific caller.

| Function                  | Type                                                   |
| ------------------------- | ------------------------------------------------------ |
| `deleteFilteredDocsStore` | `(params: ListStoreParams) => DocContext<OptionDoc>[]` |

Parameters:

- `params`: - The parameters required to perform the filtered deletion.

Returns:

The context resulting of the deletion of documents that match the provided filters.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/db.sdk.ts#L175)

#### :gear: callerIsAdmin

Guard that succeeds if the caller is an admin access key of this satellite.

| Function        | Type         |
| --------------- | ------------ |
| `callerIsAdmin` | `() => void` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/guards.sdk.ts#L10)

#### :gear: callerHasWritePermission

Guard that succeeds if the caller is an access key with write permission.

| Function                   | Type               |
| -------------------------- | ------------------ |
| `callerHasWritePermission` | `() => AccessKeys` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/guards.sdk.ts#L21)

#### :gear: callerIsAccessKey

Guard that succeeds if the caller is any recognized access key of this satellite.

| Function            | Type               |
| ------------------- | ------------------ |
| `callerIsAccessKey` | `() => AccessKeys` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/guards.sdk.ts#L31)

#### :gear: countCollectionAssetsStore

Counts the number of assets in a specific collection.

| Function                     | Type                                   |
| ---------------------------- | -------------------------------------- |
| `countCollectionAssetsStore` | `(params: CollectionParams) => bigint` |

Parameters:

- `params`: - The parameters required to count assets in the collection.

Returns:

The total number of assets in the specified collection.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L37)

#### :gear: countAssetsStore

Counts the number of assets in a collection matching specific filters and owned by a specific caller.

| Function           | Type                                  |
| ------------------ | ------------------------------------- |
| `countAssetsStore` | `(params: ListStoreParams) => bigint` |

Parameters:

- `params`: - The parameters required to perform the filtered count.

Returns:

The number of assets that match the provided filters.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L55)

#### :gear: setAssetHandler

Sets or updates an asset in the storage.

| Function          | Type                                      |
| ----------------- | ----------------------------------------- |
| `setAssetHandler` | `(params: SetAssetHandlerParams) => void` |

Parameters:

- `params`: - The parameters required to set or update an asset.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L73)

#### :gear: deleteAssetStore

Deletes an asset from the storage.

| Function           | Type                                           |
| ------------------ | ---------------------------------------------- |
| `deleteAssetStore` | `(params: GetAssetStoreParams) => OptionAsset` |

Parameters:

- `params`: - The parameters required to delete the asset.

Returns:

The potentially deleted asset.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L91)

#### :gear: deleteAssetsStore

Delete assets in a specific collection of the Storage.

| Function            | Type                                 |
| ------------------- | ------------------------------------ |
| `deleteAssetsStore` | `(params: CollectionParams) => void` |

Parameters:

- `params`: - The parameters required to delete assets in the collection.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L109)

#### :gear: deleteFilteredAssetsStore

Delete assets in a collection matching specific filters and owned by a specific caller.

| Function                    | Type                                         |
| --------------------------- | -------------------------------------------- |
| `deleteFilteredAssetsStore` | `(params: ListStoreParams) => OptionAsset[]` |

Parameters:

- `params`: - The parameters required to perform the filtered deletion.

Returns:

The potential asset resulting of the deletion that match the provided filters.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L127)

#### :gear: setAssetTokenStore

Set or update an access token for an asset in a collection's store.

| Function             | Type                                         |
| -------------------- | -------------------------------------------- |
| `setAssetTokenStore` | `(params: SetAssetTokenStoreParams) => void` |

Parameters:

- `params`: - The parameters required to set the token of the asset.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L147)

#### :gear: getAssetStore

Retrieve an asset from the storage.

| Function        | Type                                           |
| --------------- | ---------------------------------------------- |
| `getAssetStore` | `(params: GetAssetStoreParams) => OptionAsset` |

Parameters:

- `params`: - The parameters required to get the asset.

Returns:

The asset if found, or undefined if not.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L167)

#### :gear: listAssetsStore

Lists assets (without content) from the storage using optional filtering, pagination, and ordering parameters.

| Function          | Type                                                       |
| ----------------- | ---------------------------------------------------------- |
| `listAssetsStore` | `(params: ListStoreParams) => ListResults<AssetNoContent>` |

Parameters:

- `params`: - The parameters required to perform the list operation.

Returns:

A list result containing matching assets and pagination metadata.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L187)

#### :gear: getContentChunksStore

Retrieves content chunks of an asset.

This function fetches a content chunk of a given asset encoding using the specified parameters.

| Function                | Type                                                         |
| ----------------------- | ------------------------------------------------------------ |
| `getContentChunksStore` | `(params: GetContentChunksStoreParams) => Blob or undefined` |

Parameters:

- `params`: - The parameters including encoding, chunk index, and memory type.

Returns:

The content chunk if found, or `undefined` if not.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/storage.sdk.ts#L209)

#### :gear: call

Makes an asynchronous call to a canister on the Internet Computer.

This function encodes the provided arguments using Candid, performs the canister call,
and decodes the response based on the expected result types.

| Function | Type                                    |
| -------- | --------------------------------------- |
| `call`   | `<T>(params: CallParams) => Promise<T>` |

Parameters:

- `params`: - The parameters required for the canister call

Returns:

A promise resolving to the decoded result of the call.
Returns `undefined` if the canister response is empty.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/call.ic-cdk.ts#L20)

#### :gear: msgCaller

Retrieves the caller's Principal ID.

This function is a JavaScript binding for the Rust function
[`ic_cdk::api::msg_caller()`](https://docs.rs/ic-cdk/latest/ic_cdk/api/fn.msg_caller.html), which returns
the Principal of the caller of the current call.

| Function    | Type              |
| ----------- | ----------------- |
| `msgCaller` | `() => Principal` |

Returns:

The Principal ID of the caller.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/caller.ic-cdk.ts#L12)

#### :gear: caller

| Function | Type              |
| -------- | ----------------- |
| `caller` | `() => Principal` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/caller.ic-cdk.ts#L21)

#### :gear: httpRequest

Performs an HTTP request from a Juno serverless function.

| Function      | Type                                                    |
| ------------- | ------------------------------------------------------- |
| `httpRequest` | `(args: HttpRequestArgs) => Promise<HttpRequestResult>` |

Parameters:

- `args`: - The HTTP request parameters

Returns:

A promise resolving to the HTTP response.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/http-request.ic-cdk.ts#L17)

#### :gear: canisterSelf

Retrieves the Satellite's Principal ID.

This function is a JavaScript binding for the Rust function
[`ic_cdk::api::canister_self()`](https://docs.rs/ic-cdk/latest/ic_cdk/api/fn.canister_self.html), which returns
the Principal of the executing canister.

| Function       | Type              |
| -------------- | ----------------- |
| `canisterSelf` | `() => Principal` |

Returns:

The Principal ID of the Satellite.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/id.ic-cdk.ts#L12)

#### :gear: id

| Function | Type              |
| -------- | ----------------- |
| `id`     | `() => Principal` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/id.ic-cdk.ts#L24)

#### :gear: satelliteSelf

Retrieves the Satellite's Principal ID.

| Function        | Type              |
| --------------- | ----------------- |
| `satelliteSelf` | `() => Principal` |

Returns:

The Principal ID of the Satellite.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/id.ic-cdk.ts#L31)

#### :gear: time

Gets current timestamp, in nanoseconds since the epoch (1970-01-01)

This function is a JavaScript binding for the Rust function
[`ic_cdk::time()`](https://docs.rs/ic-cdk/latest/ic_cdk/api/fn.time.html), which returns
the system time publicly exposed and verified part of the IC state tree

| Function | Type           |
| -------- | -------------- |
| `time`   | `() => bigint` |

Returns:

The current timestamp.

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/time.ic-cdk.ts#L10)

### :wrench: Constants

- [SatelliteEnvSchema](#gear-satelliteenvschema)
- [JUNO_FUNCTION_TYPE](#gear-juno_function_type)
- [CustomFunctionGuardSchema](#gear-customfunctionguardschema)
- [CustomFunctionWithArgsAndResultSchema](#gear-customfunctionwithargsandresultschema)
- [CustomFunctionWithArgsSchema](#gear-customfunctionwithargsschema)
- [CustomFunctionWithResultSchema](#gear-customfunctionwithresultschema)
- [CustomFunctionWithoutArgsAndResultSchema](#gear-customfunctionwithoutargsandresultschema)
- [CustomFunctionSchema](#gear-customfunctionschema)
- [QuerySchema](#gear-queryschema)
- [UpdateSchema](#gear-updateschema)
- [RawPrincipalSchema](#gear-rawprincipalschema)
- [TimestampSchema](#gear-timestampschema)
- [VersionSchema](#gear-versionschema)
- [RawUserIdSchema](#gear-rawuseridschema)
- [UserIdSchema](#gear-useridschema)
- [CollectionSchema](#gear-collectionschema)
- [KeySchema](#gear-keyschema)
- [DescriptionSchema](#gear-descriptionschema)
- [CollectionsSchema](#gear-collectionsschema)
- [RawDataSchema](#gear-rawdataschema)
- [DocSchema](#gear-docschema)
- [OptionDocSchema](#gear-optiondocschema)
- [SetDocSchema](#gear-setdocschema)
- [DelDocSchema](#gear-deldocschema)
- [DocUpsertSchema](#gear-docupsertschema)
- [DocAssertSetSchema](#gear-docassertsetschema)
- [DocAssertDeleteSchema](#gear-docassertdeleteschema)
- [OnSetDocContextSchema](#gear-onsetdoccontextschema)
- [OnSetManyDocsContextSchema](#gear-onsetmanydocscontextschema)
- [OnDeleteDocContextSchema](#gear-ondeletedoccontextschema)
- [OnDeleteManyDocsContextSchema](#gear-ondeletemanydocscontextschema)
- [OnDeleteFilteredDocsContextSchema](#gear-ondeletefiltereddocscontextschema)
- [AssertSetDocContextSchema](#gear-assertsetdoccontextschema)
- [AssertDeleteDocContextSchema](#gear-assertdeletedoccontextschema)
- [HeaderFieldsSchema](#gear-headerfieldsschema)
- [BlobSchema](#gear-blobschema)
- [AssetKeySchema](#gear-assetkeyschema)
- [AssetEncodingSchema](#gear-assetencodingschema)
- [AssetSchema](#gear-assetschema)
- [AssetNoContentSchema](#gear-assetnocontentschema)
- [BatchSchema](#gear-batchschema)
- [CommitBatchSchema](#gear-commitbatchschema)
- [FullPathSchema](#gear-fullpathschema)
- [AssetAccessTokenSchema](#gear-assetaccesstokenschema)
- [OptionAssetSchema](#gear-optionassetschema)
- [AssetAssertUploadSchema](#gear-assetassertuploadschema)
- [OnUploadAssetContextSchema](#gear-onuploadassetcontextschema)
- [OnDeleteAssetContextSchema](#gear-ondeleteassetcontextschema)
- [OnDeleteManyAssetsContextSchema](#gear-ondeletemanyassetscontextschema)
- [OnDeleteFilteredAssetsContextSchema](#gear-ondeletefilteredassetscontextschema)
- [AssertUploadAssetContextSchema](#gear-assertuploadassetcontextschema)
- [AssertDeleteAssetContextSchema](#gear-assertdeleteassetcontextschema)
- [AssertSetDocSchema](#gear-assertsetdocschema)
- [AssertDeleteDocSchema](#gear-assertdeletedocschema)
- [AssertUploadAssetSchema](#gear-assertuploadassetschema)
- [AssertDeleteAssetSchema](#gear-assertdeleteassetschema)
- [AssertSchema](#gear-assertschema)
- [OnSetDocSchema](#gear-onsetdocschema)
- [OnSetManyDocsSchema](#gear-onsetmanydocsschema)
- [OnDeleteDocSchema](#gear-ondeletedocschema)
- [OnDeleteManyDocsSchema](#gear-ondeletemanydocsschema)
- [OnDeleteFilteredDocsSchema](#gear-ondeletefiltereddocsschema)
- [OnUploadAssetSchema](#gear-onuploadassetschema)
- [OnDeleteAssetSchema](#gear-ondeleteassetschema)
- [OnDeleteManyAssetsSchema](#gear-ondeletemanyassetsschema)
- [OnDeleteFilteredAssetsSchema](#gear-ondeletefilteredassetsschema)
- [HookSchema](#gear-hookschema)
- [TimestampMatcherSchema](#gear-timestampmatcherschema)
- [ListMatcherSchema](#gear-listmatcherschema)
- [ListPaginateSchema](#gear-listpaginateschema)
- [ListOrderFieldSchema](#gear-listorderfieldschema)
- [ListOrderSchema](#gear-listorderschema)
- [ListParamsSchema](#gear-listparamsschema)
- [AccessKeyScopeSchema](#gear-accesskeyscopeschema)
- [AccessKeyKindSchema](#gear-accesskeykindschema)
- [MetadataSchema](#gear-metadataschema)
- [AccessKeySchema](#gear-accesskeyschema)
- [AccessKeyRecordSchema](#gear-accesskeyrecordschema)
- [AccessKeysSchema](#gear-accesskeysschema)
- [AccessKeyCheckParamsSchema](#gear-accesskeycheckparamsschema)
- [CollectionParamsSchema](#gear-collectionparamsschema)
- [ListStoreParamsSchema](#gear-liststoreparamsschema)
- [GetDocStoreParamsSchema](#gear-getdocstoreparamsschema)
- [SetDocStoreParamsSchema](#gear-setdocstoreparamsschema)
- [DeleteDocStoreParamsSchema](#gear-deletedocstoreparamsschema)
- [CountCollectionDocsStoreParamsSchema](#gear-countcollectiondocsstoreparamsschema)
- [CountDocsStoreParamsSchema](#gear-countdocsstoreparamsschema)
- [ListDocsStoreParamsSchema](#gear-listdocsstoreparamsschema)
- [DeleteDocsStoreParamsSchema](#gear-deletedocsstoreparamsschema)
- [DeleteFilteredDocsStoreParamsSchema](#gear-deletefiltereddocsstoreparamsschema)
- [MemorySchema](#gear-memoryschema)
- [GetAssetStoreParamsSchema](#gear-getassetstoreparamsschema)
- [CountCollectionAssetsStoreParamsSchema](#gear-countcollectionassetsstoreparamsschema)
- [CountAssetsStoreParamsSchema](#gear-countassetsstoreparamsschema)
- [SetAssetHandlerParamsSchema](#gear-setassethandlerparamsschema)
- [DeleteAssetsStoreParamsSchema](#gear-deleteassetsstoreparamsschema)
- [DeleteFilteredAssetsStoreParamsSchema](#gear-deletefilteredassetsstoreparamsschema)
- [DeleteAssetStoreParamsSchema](#gear-deleteassetstoreparamsschema)
- [SetAssetTokenStoreParamsSchema](#gear-setassettokenstoreparamsschema)
- [ListAssetsStoreParamsSchema](#gear-listassetsstoreparamsschema)
- [GetContentChunksStoreParamsSchema](#gear-getcontentchunksstoreparamsschema)
- [IDLTypeSchema](#gear-idltypeschema)
- [CallArgSchema](#gear-callargschema)
- [CallArgsSchema](#gear-callargsschema)
- [CallResultSchema](#gear-callresultschema)
- [CallParamsSchema](#gear-callparamsschema)
- [HttpHeaderSchema](#gear-httpheaderschema)
- [HttpMethodSchema](#gear-httpmethodschema)
- [HttpRequestArgsSchema](#gear-httprequestargsschema)
- [HttpRequestResultSchema](#gear-httprequestresultschema)
- [TransformArgsSchema](#gear-transformargsschema)

#### :gear: SatelliteEnvSchema

| Constant             | Type                              |
| -------------------- | --------------------------------- |
| `SatelliteEnvSchema` | `ZodRecord<ZodString, ZodString>` |

References:

- SatelliteEnv

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.env.ts#L6)

#### :gear: JUNO_FUNCTION_TYPE

Internal constant used by Juno's tooling to discover serverless functions.
Not intended for direct use by developers.

| Constant             | Type                                                                                      |
| -------------------- | ----------------------------------------------------------------------------------------- |
| `JUNO_FUNCTION_TYPE` | `{ readonly QUERY: "__juno_function_query"; readonly UPDATE: "__juno_function_update"; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/constants.ts#L5)

#### :gear: CustomFunctionGuardSchema

| Constant                    | Type                                                                                                                |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `CustomFunctionGuardSchema` | `ZodCustom<$InferInnerFunctionType<$ZodFunctionArgs, ZodVoid>, $InferInnerFunctionType<$ZodFunctionArgs, ZodVoid>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L15)

#### :gear: CustomFunctionWithArgsAndResultSchema

| Constant                                | Type                                                                                                                                                 |
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CustomFunctionWithArgsAndResultSchema` | `ZodObject<{ args: ZodCustom<ZodObject<$ZodLooseShape, $strip>, ZodObject<$ZodLooseShape, $strip>>; ... 4 more ...; type: ZodEnum<...>; }, $strict>` |

References:

- CustomFunctionWithArgsAndResult

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L32)

#### :gear: CustomFunctionWithArgsSchema

| Constant                       | Type                                                                                                                                                                                                             |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CustomFunctionWithArgsSchema` | `ZodObject<{ args: ZodCustom<ZodObject<$ZodLooseShape, $strip>, ZodObject<$ZodLooseShape, $strip>>; handler: ZodCustom<...>; guard: ZodOptional<...>; hidden: ZodOptional<...>; type: ZodEnum<...>; }, $strict>` |

References:

- CustomFunctionWithArgs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L48)

#### :gear: CustomFunctionWithResultSchema

| Constant                         | Type                                                                                                                                                                                                               |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `CustomFunctionWithResultSchema` | `ZodObject<{ result: ZodCustom<ZodObject<$ZodLooseShape, $strip>, ZodObject<$ZodLooseShape, $strip>>; handler: ZodCustom<...>; guard: ZodOptional<...>; hidden: ZodOptional<...>; type: ZodEnum<...>; }, $strict>` |

References:

- CustomFunctionWithResult

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L63)

#### :gear: CustomFunctionWithoutArgsAndResultSchema

| Constant                                   | Type                                                                                                                                                                                                                                               |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CustomFunctionWithoutArgsAndResultSchema` | `ZodObject<{ handler: ZodCustom<$InferInnerFunctionType<ZodTuple<[], null>, ZodUnion<readonly [ZodVoid, ZodPromise<ZodVoid>]>>, $InferInnerFunctionType<...>>; guard: ZodOptional<...>; hidden: ZodOptional<...>; type: ZodEnum<...>; }, $strict>` |

References:

- CustomFunctionWithoutArgsAndResult

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L78)

#### :gear: CustomFunctionSchema

| Constant               | Type                                                                                                                                                                                                                      |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CustomFunctionSchema` | `ZodUnion<readonly [ZodObject<{ args: ZodCustom<ZodObject<$ZodLooseShape, $strip>, ZodObject<$ZodLooseShape, $strip>>; ... 4 more ...; type: ZodEnum<...>; }, $strict>, ZodObject<...>, ZodObject<...>, ZodObject<...>]>` |

References:

- CustomFunction

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L92)

#### :gear: QuerySchema

| Constant      | Type                                                                                                                                                                                                                                                                                                                               |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `QuerySchema` | `ZodUnion<readonly [ZodObject<{ type: ZodLiteral<"__juno_function_query">; args: ZodCustom<ZodObject<$ZodLooseShape, $strip>, ZodObject<$ZodLooseShape, $strip>>; result: ZodCustom<...>; handler: ZodCustom<...>; guard: ZodOptional<...>; hidden: ZodOptional<...>; }, $strict>, ZodObject<...>, ZodObject<...>, ZodObject<....` |

References:

- Query

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L23)

#### :gear: UpdateSchema

| Constant       | Type                                                                                                                                                                                                                                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UpdateSchema` | `ZodUnion<readonly [ZodObject<{ type: ZodLiteral<"__juno_function_update">; args: ZodCustom<ZodObject<$ZodLooseShape, $strip>, ZodObject<$ZodLooseShape, $strip>>; result: ZodCustom<...>; handler: ZodCustom<...>; guard: ZodOptional<...>; hidden: ZodOptional<...>; }, $strict>, ZodObject<...>, ZodObject<...>, ZodObject<...` |

References:

- Update

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L23)

#### :gear: RawPrincipalSchema

| Constant             | Type                                                          |
| -------------------- | ------------------------------------------------------------- |
| `RawPrincipalSchema` | `ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>` |

References:

- RawPrincipal

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/principal.ts#L6)

#### :gear: TimestampSchema

| Constant          | Type        |
| ----------------- | ----------- |
| `TimestampSchema` | `ZodBigInt` |

References:

- Timestamp

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L8)

#### :gear: VersionSchema

| Constant        | Type        |
| --------------- | ----------- |
| `VersionSchema` | `ZodBigInt` |

References:

- Version

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L20)

#### :gear: RawUserIdSchema

| Constant          | Type                                                          |
| ----------------- | ------------------------------------------------------------- |
| `RawUserIdSchema` | `ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>` |

References:

- RawUserId

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L32)

#### :gear: UserIdSchema

| Constant       | Type                                                   |
| -------------- | ------------------------------------------------------ |
| `UserIdSchema` | `ZodPipe<ZodCustom<any, any>, ZodTransform<any, any>>` |

References:

- UserId

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L44)

#### :gear: CollectionSchema

| Constant           | Type        |
| ------------------ | ----------- |
| `CollectionSchema` | `ZodString` |

References:

- Collection

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L56)

#### :gear: KeySchema

| Constant    | Type        |
| ----------- | ----------- |
| `KeySchema` | `ZodString` |

References:

- Key

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L66)

#### :gear: DescriptionSchema

| Constant            | Type        |
| ------------------- | ----------- |
| `DescriptionSchema` | `ZodString` |

References:

- Description

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L76)

#### :gear: CollectionsSchema

| Constant            | Type                                                                     |
| ------------------- | ------------------------------------------------------------------------ |
| `CollectionsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; }, $strict>` |

References:

- Collections

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L7)

#### :gear: RawDataSchema

| Constant        | Type                                                          |
| --------------- | ------------------------------------------------------------- |
| `RawDataSchema` | `ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>` |

References:

- RawData

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L17)

#### :gear: DocSchema

| Constant    | Type                                                                                                                                                                                                                                                             |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DocSchema` | `ZodObject<{ owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; created_at: ZodBigInt; updated_at: ZodBigInt; version: ZodOptional<...>; }, $strict>` |

References:

- Doc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L29)

#### :gear: OptionDocSchema

| Constant          | Type                                                                                                                                                                                                                                                                          |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OptionDocSchema` | `ZodOptional<ZodObject<{ owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; created_at: ZodBigInt; updated_at: ZodBigInt; version: ZodOptional<...>; }, $strict>>` |

References:

- OptionDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L79)

#### :gear: SetDocSchema

| Constant       | Type                                                                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `SetDocSchema` | `ZodObject<{ data: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; description: ZodOptional<ZodString>; version: ZodOptional<...>; }, $strict>` |

References:

- SetDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L89)

#### :gear: DelDocSchema

| Constant       | Type                                                       |
| -------------- | ---------------------------------------------------------- |
| `DelDocSchema` | `ZodObject<{ version: ZodOptional<ZodBigInt>; }, $strict>` |

References:

- DelDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L121)

#### :gear: DocUpsertSchema

| Constant          | Type                                                                                                                                                                                                                                                                                                                               |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DocUpsertSchema` | `ZodObject<{ before: ZodOptional<ZodObject<{ owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; created_at: ZodBigInt; updated_at: ZodBigInt; version: ZodOptional<...>; }, $strict>>; after: ZodObject<...>; }, $s...` |

References:

- DocUpsert

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L14)

#### :gear: DocAssertSetSchema

| Constant             | Type                                                                                                                                                                                                                                                                                                                               |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DocAssertSetSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; created_at: ZodBigInt; updated_at: ZodBigInt; version: ZodOptional<...>; }, $strict>>; proposed: ZodObject<...>; }...` |

References:

- DocAssertSet

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L41)

#### :gear: DocAssertDeleteSchema

| Constant                | Type                                                                                                                                                                                                                                                                                                                               |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DocAssertDeleteSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; created_at: ZodBigInt; updated_at: ZodBigInt; version: ZodOptional<...>; }, $strict>>; proposed: ZodObject<...>; }...` |

References:

- DocAssertDelete

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L71)

#### :gear: OnSetDocContextSchema

| Constant                | Type                                                                                                                                                                                       |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `OnSetDocContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ collection: ZodString; key: ZodString; data: ZodObject<...>; }, $strict>; }, $strict>` |

References:

- OnSetDocContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L52)

#### :gear: OnSetManyDocsContextSchema

| Constant                     | Type                                                                                                                                                                                                 |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnSetManyDocsContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<ZodObject<{ collection: ZodString; key: ZodString; data: ZodObject<...>; }, $strict>>; }, $strict>` |

References:

- OnSetManyDocsContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L65)

#### :gear: OnDeleteDocContextSchema

| Constant                   | Type                                                                                                                                                                                         |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteDocContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ collection: ZodString; key: ZodString; data: ZodOptional<...>; }, $strict>; }, $strict>` |

References:

- OnDeleteDocContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L80)

#### :gear: OnDeleteManyDocsContextSchema

| Constant                        | Type                                                                                                                                                                                                   |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `OnDeleteManyDocsContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<ZodObject<{ collection: ZodString; key: ZodString; data: ZodOptional<...>; }, $strict>>; }, $strict>` |

References:

- OnDeleteManyDocsContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L93)

#### :gear: OnDeleteFilteredDocsContextSchema

| Constant                            | Type                                                                                                                                                                                                   |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `OnDeleteFilteredDocsContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<ZodObject<{ collection: ZodString; key: ZodString; data: ZodOptional<...>; }, $strict>>; }, $strict>` |

References:

- OnDeleteFilteredDocsContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L108)

#### :gear: AssertSetDocContextSchema

| Constant                    | Type                                                                                                                                                                                       |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `AssertSetDocContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ collection: ZodString; key: ZodString; data: ZodObject<...>; }, $strict>; }, $strict>` |

References:

- AssertSetDocContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L123)

#### :gear: AssertDeleteDocContextSchema

| Constant                       | Type                                                                                                                                                                                       |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `AssertDeleteDocContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ collection: ZodString; key: ZodString; data: ZodObject<...>; }, $strict>; }, $strict>` |

References:

- AssertDeleteDocContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L136)

#### :gear: HeaderFieldsSchema

| Constant             | Type                                               |
| -------------------- | -------------------------------------------------- |
| `HeaderFieldsSchema` | `ZodArray<ZodTuple<[ZodString, ZodString], null>>` |

References:

- HeaderFields

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L29)

#### :gear: BlobSchema

| Constant     | Type                                                          |
| ------------ | ------------------------------------------------------------- |
| `BlobSchema` | `ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>` |

References:

- Blob

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L39)

#### :gear: AssetKeySchema

| Constant         | Type                                                                                                                                                                                                              |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssetKeySchema` | `ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; }, $strict>` |

References:

- AssetKey

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L71)

#### :gear: AssetEncodingSchema

| Constant              | Type                                                                                                                                                                                  |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssetEncodingSchema` | `ZodObject<{ modified: ZodBigInt; content_chunks: ZodArray<ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; total_length: ZodBigInt; sha256: ZodCustom<...>; }, $strip>` |

References:

- AssetEncoding

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L121)

#### :gear: AssetSchema

| Constant      | Type                                                                                                                                                                                                                                                                                       |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `AssetSchema` | `ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>` |

References:

- Asset

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L176)

#### :gear: AssetNoContentSchema

| Constant               | Type                                                                                                                                                                                                                                                                                      |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssetNoContentSchema` | `ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; }, $strict>; ... 4 more ...; encodings: ZodArray<...>; }, $strict>` |

References:

- AssetNoContent

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L225)

#### :gear: BatchSchema

| Constant      | Type                                                                                                                                                                                                                                                                                                                               |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BatchSchema` | `ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; }, $strict>; reference_id: ZodOptional<...>; expires_at: ZodBigInt; encoding_type: ZodOptional<...>; }, ...` |

References:

- Batch

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L251)

#### :gear: CommitBatchSchema

| Constant            | Type                                                                                                                                      |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `CommitBatchSchema` | `ZodObject<{ batch_id: ZodBigInt; headers: ZodArray<ZodTuple<[ZodString, ZodString], null>>; chunk_ids: ZodArray<ZodBigInt>; }, $strict>` |

References:

- CommitBatch

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L308)

#### :gear: FullPathSchema

| Constant         | Type        |
| ---------------- | ----------- |
| `FullPathSchema` | `ZodString` |

References:

- FullPath

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L339)

#### :gear: AssetAccessTokenSchema

| Constant                 | Type                     |
| ------------------------ | ------------------------ |
| `AssetAccessTokenSchema` | `ZodOptional<ZodString>` |

References:

- AssetAccessToken

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L352)

#### :gear: OptionAssetSchema

| Constant            | Type                                                                                                                                                                                                                                                                                                    |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OptionAssetSchema` | `ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>>` |

References:

- OptionAsset

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L365)

#### :gear: AssetAssertUploadSchema

| Constant                  | Type                                                                                                                                                                                                                                                                                                                               |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssetAssertUploadSchema` | `ZodObject<{ current: ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<...>; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>>; batch: ZodObject<...>; commit_batch: Z...` |

References:

- AssetAssertUpload

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/payload.ts#L14)

#### :gear: OnUploadAssetContextSchema

| Constant                     | Type                                                                                                                                                                                                                                                                   |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnUploadAssetContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ key: ZodObject<{ name: ZodString; ... 4 more ...; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>; }, $strict>` |

References:

- OnUploadAssetContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L9)

#### :gear: OnDeleteAssetContextSchema

| Constant                     | Type                                                                                                                                                                                                                                                                                |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteAssetContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; ... 4 more ...; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>>; }, $strict>` |

References:

- OnDeleteAssetContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L21)

#### :gear: OnDeleteManyAssetsContextSchema

| Constant                          | Type                                                                                                                                                                                                                                                                                          |
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteManyAssetsContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; ... 4 more ...; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>>>; }, $strict>` |

References:

- OnDeleteManyAssetsContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L35)

#### :gear: OnDeleteFilteredAssetsContextSchema

| Constant                              | Type                                                                                                                                                                                                                                                                                          |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteFilteredAssetsContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; ... 4 more ...; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>>>; }, $strict>` |

References:

- OnDeleteFilteredAssetsContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L47)

#### :gear: AssertUploadAssetContextSchema

| Constant                         | Type                                                                                                                                                                                                                                                                                                                               |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertUploadAssetContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ current: ZodOptional<ZodObject<{ key: ZodObject<{ name: ZodString; ... 4 more ...; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>>; batch: ZodObject<...>; commit_batc...` |

References:

- AssertUploadAssetContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L61)

#### :gear: AssertDeleteAssetContextSchema

| Constant                         | Type                                                                                                                                                                                                                                                                   |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertDeleteAssetContextSchema` | `ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<{ key: ZodObject<{ name: ZodString; ... 4 more ...; description: ZodOptional<...>; }, $strict>; ... 4 more ...; version: ZodOptional<...>; }, $strict>; }, $strict>` |

References:

- AssertDeleteAssetContext

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L73)

#### :gear: AssertSetDocSchema

| Constant             | Type                                                                                                                                                                                                                                                                                              |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertSetDocSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; assert: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodVoid>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- AssertSetDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L45)

#### :gear: AssertDeleteDocSchema

| Constant                | Type                                                                                                                                                                                                                                                                                              |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertDeleteDocSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; assert: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodVoid>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- AssertDeleteDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L55)

#### :gear: AssertUploadAssetSchema

| Constant                  | Type                                                                                                                                                                                                                                                                                              |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertUploadAssetSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; assert: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodVoid>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- AssertUploadAsset

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L65)

#### :gear: AssertDeleteAssetSchema

| Constant                  | Type                                                                                                                                                                                                                                                                                              |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertDeleteAssetSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; assert: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodVoid>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- AssertDeleteAsset

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L75)

#### :gear: AssertSchema

| Constant       | Type                                                                                                                                                                                                                                                                                                                               |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AssertSchema` | `ZodUnion<readonly [ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; assert: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodVoid>, $InferInnerFunctionType<...>>; }, $strict>, ZodObject...` |

References:

- Assert

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L85)

#### :gear: OnSetDocSchema

| Constant         | Type                                                                                                                                                                                                                                                                                                 |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnSetDocSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnSetDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L55)

#### :gear: OnSetManyDocsSchema

| Constant              | Type                                                                                                                                                                                                                                                                                                |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnSetManyDocsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnSetManyDocs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L65)

#### :gear: OnDeleteDocSchema

| Constant            | Type                                                                                                                                                                                                                                                                                                 |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteDocSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnDeleteDoc

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L75)

#### :gear: OnDeleteManyDocsSchema

| Constant                 | Type                                                                                                                                                                                                                                                                                                |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteManyDocsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnDeleteManyDocs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L85)

#### :gear: OnDeleteFilteredDocsSchema

| Constant                     | Type                                                                                                                                                                                                                                                                                                |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteFilteredDocsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnDeleteFilteredDocs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L95)

#### :gear: OnUploadAssetSchema

| Constant              | Type                                                                                                                                                                                                                                                                                                 |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnUploadAssetSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnUploadAsset

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L105)

#### :gear: OnDeleteAssetSchema

| Constant              | Type                                                                                                                                                                                                                                                                                                   |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `OnDeleteAssetSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodOptional<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnDeleteAsset

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L115)

#### :gear: OnDeleteManyAssetsSchema

| Constant                   | Type                                                                                                                                                                                                                                                                                                |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteManyAssetsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnDeleteManyAssets

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L125)

#### :gear: OnDeleteFilteredAssetsSchema

| Constant                       | Type                                                                                                                                                                                                                                                                                                |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnDeleteFilteredAssetsSchema` | `ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodArray<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>` |

References:

- OnDeleteFilteredAssets

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L135)

#### :gear: HookSchema

| Constant     | Type                                                                                                                                                                                                                                                                                                                               |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HookSchema` | `ZodUnion<readonly [ZodObject<{ collections: ZodReadonly<ZodArray<ZodString>>; run: ZodCustom<$InferInnerFunctionType<ZodTuple<[ZodObject<{ caller: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>; data: ZodObject<...>; }, $strict>], null>, ZodUnion<...>>, $InferInnerFunctionType<...>>; }, $strict>, ... 7 ...` |

References:

- Hook

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L145)

#### :gear: TimestampMatcherSchema

| Constant                 | Type                                                                                                                                                                           |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `TimestampMatcherSchema` | `ZodUnion<readonly [ZodObject<{ equal: ZodBigInt; }, $strip>, ZodObject<{ greater_than: ZodBigInt; }, $strip>, ZodObject<{ less_than: ZodBigInt; }, $strip>, ZodObject<...>]>` |

References:

- TimestampMatcher

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L16)

#### :gear: ListMatcherSchema

| Constant            | Type                                                                                                                                                                                                                                                              |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ListMatcherSchema` | `ZodObject<{ key: ZodOptional<ZodString>; description: ZodOptional<ZodString>; created_at: ZodOptional<ZodUnion<readonly [ZodObject<{ equal: ZodBigInt; }, $strip>, ZodObject<...>, ZodObject<...>, ZodObject<...>]>>; updated_at: ZodOptional<...>; }, $strict>` |

References:

- ListMatcher

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L35)

#### :gear: ListPaginateSchema

| Constant             | Type                                                                                          |
| -------------------- | --------------------------------------------------------------------------------------------- |
| `ListPaginateSchema` | `ZodObject<{ start_after: ZodOptional<ZodString>; limit: ZodOptional<ZodBigInt>; }, $strict>` |

References:

- ListPaginate

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L57)

#### :gear: ListOrderFieldSchema

| Constant               | Type                                                                             |
| ---------------------- | -------------------------------------------------------------------------------- |
| `ListOrderFieldSchema` | `ZodEnum<{ keys: "keys"; created_at: "created_at"; updated_at: "updated_at"; }>` |

References:

- ListOrderField

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L75)

#### :gear: ListOrderSchema

| Constant          | Type                                                                                                                               |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `ListOrderSchema` | `ZodObject<{ desc: ZodBoolean; field: ZodEnum<{ keys: "keys"; created_at: "created_at"; updated_at: "updated_at"; }>; }, $strict>` |

References:

- ListOrder

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L85)

#### :gear: ListParamsSchema

| Constant           | Type                                                                                                                                                                                                                                                                                                                               |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ListParamsSchema` | `ZodObject<{ matcher: ZodOptional<ZodObject<{ key: ZodOptional<ZodString>; description: ZodOptional<ZodString>; created_at: ZodOptional<ZodUnion<readonly [ZodObject<{ equal: ZodBigInt; }, $strip>, ZodObject<...>, ZodObject<...>, ZodObject<...>]>>; updated_at: ZodOptional<...>; }, $strict>>; paginate: ZodOptional<...>...` |

References:

- ListParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L103)

#### :gear: AccessKeyScopeSchema

| Constant               | Type                                                             |
| ---------------------- | ---------------------------------------------------------------- |
| `AccessKeyScopeSchema` | `ZodEnum<{ write: "write"; admin: "admin"; submit: "submit"; }>` |

References:

- AccessKeyScope

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L15)

#### :gear: AccessKeyKindSchema

| Constant              | Type                                                           |
| --------------------- | -------------------------------------------------------------- |
| `AccessKeyKindSchema` | `ZodEnum<{ automation: "automation"; emulator: "emulator"; }>` |

References:

- AccessKeyKind

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L25)

#### :gear: MetadataSchema

| Constant         | Type                                     |
| ---------------- | ---------------------------------------- |
| `MetadataSchema` | `ZodTuple<[ZodString, ZodString], null>` |

References:

- MetadataSchema

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L35)

#### :gear: AccessKeySchema

| Constant          | Type                                                                                                                                                                                                           |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AccessKeySchema` | `ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; created_at: ZodBigInt; updated_at: ZodBigInt; expires_at: ZodOptional<...>; scope: ZodEnum<...>; kind: ZodOptional<...>; }, $strict>` |

References:

- AccessKeySchema

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L45)

#### :gear: AccessKeyRecordSchema

| Constant                | Type                                                                                                                                                                                                         |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `AccessKeyRecordSchema` | `ZodTuple<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; ... 4 more ...; kind: ZodOptional<...>; }, $strict>], null>` |

References:

- AccessKeyRecordSchema

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L94)

#### :gear: AccessKeysSchema

| Constant           | Type                                                                                                                                                                                                                   |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AccessKeysSchema` | `ZodArray<ZodTuple<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; ... 4 more ...; kind: ZodOptional<...>; }, $strict>], null>>` |

References:

- AccessKeysSchema

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L104)

#### :gear: AccessKeyCheckParamsSchema

| Constant                     | Type                                                                                                                                                                              |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AccessKeyCheckParamsSchema` | `ZodObject<{ id: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<ZodCustom<any, any>, ZodTransform<...>>]>; accessKeys: ZodArray<...>; }, $strip>` |

References:

- AccessKeyCheckParamsSchema

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L114)

#### :gear: CollectionParamsSchema

| Constant                 | Type                                             |
| ------------------------ | ------------------------------------------------ |
| `CollectionParamsSchema` | `ZodObject<{ collection: ZodString; }, $strict>` |

References:

- CollectionParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/params.ts#L15)

#### :gear: ListStoreParamsSchema

| Constant                | Type                                                                                                                                                                    |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ListStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- ListStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/params.ts#L34)

#### :gear: GetDocStoreParamsSchema

| Constant                  | Type                                                                                                                                                            |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GetDocStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; key: ZodString; }, $strict>` |

References:

- GetDocStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L20)

#### :gear: SetDocStoreParamsSchema

| Constant                  | Type                                                                                                                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `SetDocStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; key: ZodString; doc: ZodObject<...>; }, $strict>` |

References:

- SetDocStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L43)

#### :gear: DeleteDocStoreParamsSchema

| Constant                     | Type                                                                                                                                                                                 |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `DeleteDocStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; key: ZodString; doc: ZodObject<...>; }, $strict>` |

References:

- DeleteDocStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L63)

#### :gear: CountCollectionDocsStoreParamsSchema

| Constant                               | Type                                             |
| -------------------------------------- | ------------------------------------------------ |
| `CountCollectionDocsStoreParamsSchema` | `ZodObject<{ collection: ZodString; }, $strict>` |

References:

- CountCollectionDocsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L83)

#### :gear: CountDocsStoreParamsSchema

| Constant                     | Type                                                                                                                                                                    |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CountDocsStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- CountDocsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L93)

#### :gear: ListDocsStoreParamsSchema

| Constant                    | Type                                                                                                                                                                    |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ListDocsStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- ListDocsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L103)

#### :gear: DeleteDocsStoreParamsSchema

| Constant                      | Type                                             |
| ----------------------------- | ------------------------------------------------ |
| `DeleteDocsStoreParamsSchema` | `ZodObject<{ collection: ZodString; }, $strict>` |

References:

- DeleteDocsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L113)

#### :gear: DeleteFilteredDocsStoreParamsSchema

| Constant                              | Type                                                                                                                                                                    |
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DeleteFilteredDocsStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- DeleteFilteredDocsParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L123)

#### :gear: MemorySchema

| Constant       | Type                                           |
| -------------- | ---------------------------------------------- |
| `MemorySchema` | `ZodEnum<{ heap: "heap"; stable: "stable"; }>` |

References:

- Memory

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/collections.ts#L6)

#### :gear: GetAssetStoreParamsSchema

| Constant                    | Type                                                                                                                                                                  |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GetAssetStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; full_path: ZodString; }, $strict>` |

References:

- GetAssetStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L28)

#### :gear: CountCollectionAssetsStoreParamsSchema

| Constant                                 | Type                                             |
| ---------------------------------------- | ------------------------------------------------ |
| `CountCollectionAssetsStoreParamsSchema` | `ZodObject<{ collection: ZodString; }, $strict>` |

References:

- CountCollectionAssetsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L51)

#### :gear: CountAssetsStoreParamsSchema

| Constant                       | Type                                                                                                                                                                    |
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CountAssetsStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- CountAssetsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L61)

#### :gear: SetAssetHandlerParamsSchema

| Constant                      | Type                                                                                                                                                                                                                                                                                             |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `SetAssetHandlerParamsSchema` | `ZodObject<{ key: ZodObject<{ name: ZodString; full_path: ZodString; token: ZodOptional<ZodString>; collection: ZodString; owner: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; description: ZodOptional<...>; }, $strict>; content: ZodCustom<...>; headers: ZodArray<...>; }, $strict>` |

References:

- SetAssetHandlerParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L71)

#### :gear: DeleteAssetsStoreParamsSchema

| Constant                        | Type                                             |
| ------------------------------- | ------------------------------------------------ |
| `DeleteAssetsStoreParamsSchema` | `ZodObject<{ collection: ZodString; }, $strict>` |

References:

- DeleteAssetsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L102)

#### :gear: DeleteFilteredAssetsStoreParamsSchema

| Constant                                | Type                                                                                                                                                                    |
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DeleteFilteredAssetsStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- DeleteFilteredAssetsParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L112)

#### :gear: DeleteAssetStoreParamsSchema

| Constant                       | Type                                                                                                                                                                  |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DeleteAssetStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; full_path: ZodString; }, $strict>` |

References:

- DeleteAssetStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L122)

#### :gear: SetAssetTokenStoreParamsSchema

| Constant                         | Type                                                                                                                                                                                           |
| -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SetAssetTokenStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; full_path: ZodString; token: ZodOptional<...>; }, $strict>` |

References:

- SetAssetTokenStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L132)

#### :gear: ListAssetsStoreParamsSchema

| Constant                      | Type                                                                                                                                                                    |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ListAssetsStoreParamsSchema` | `ZodObject<{ collection: ZodString; caller: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<...>]>; params: ZodObject<...>; }, $strict>` |

References:

- ListAssetsStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L150)

#### :gear: GetContentChunksStoreParamsSchema

| Constant                            | Type                                                                                                                                                                                                                                                                   |
| ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GetContentChunksStoreParamsSchema` | `ZodObject<{ encoding: ZodObject<{ modified: ZodBigInt; content_chunks: ZodArray<ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>; total_length: ZodBigInt; sha256: ZodCustom<...>; }, $strip>; chunk_index: ZodBigInt; memory: ZodEnum<...>; }, $strict>` |

References:

- GetContentChunksStoreParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L160)

#### :gear: IDLTypeSchema

| Constant        | Type                                              |
| --------------- | ------------------------------------------------- |
| `IDLTypeSchema` | `ZodCustom<IDL.Type<unknown>, IDL.Type<unknown>>` |

References:

- IDLType

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L10)

#### :gear: CallArgSchema

| Constant        | Type                                                                            |
| --------------- | ------------------------------------------------------------------------------- |
| `CallArgSchema` | `ZodTuple<[ZodCustom<IDL.Type<unknown>, IDL.Type<unknown>>, ZodUnknown], null>` |

References:

- CallArg

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L22)

#### :gear: CallArgsSchema

Schema for encoding the call arguments.

| Constant         | Type                                                                                      |
| ---------------- | ----------------------------------------------------------------------------------------- |
| `CallArgsSchema` | `ZodArray<ZodTuple<[ZodCustom<IDL.Type<unknown>, IDL.Type<unknown>>, ZodUnknown], null>>` |

References:

- CallArgs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L34)

#### :gear: CallResultSchema

| Constant           | Type                                              |
| ------------------ | ------------------------------------------------- |
| `CallResultSchema` | `ZodCustom<IDL.Type<unknown>, IDL.Type<unknown>>` |

References:

- CallResult

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L50)

#### :gear: CallParamsSchema

| Constant           | Type                                                                                                                                                                                                                                |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CallParamsSchema` | `ZodObject<{ canisterId: ZodUnion<[ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, ZodPipe<ZodCustom<any, any>, ZodTransform<...>>]>; method: ZodString; args: ZodOptional<...>; result: ZodOptional<...>; }, $strip>` |

References:

- CallParams

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L60)

#### :gear: HttpHeaderSchema

| Constant           | Type                                                        |
| ------------------ | ----------------------------------------------------------- |
| `HttpHeaderSchema` | `ZodObject<{ name: ZodString; value: ZodString; }, $strip>` |

References:

- HttpHeader

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L6)

#### :gear: HttpMethodSchema

| Constant           | Type                                                   |
| ------------------ | ------------------------------------------------------ |
| `HttpMethodSchema` | `ZodEnum<{ GET: "GET"; POST: "POST"; HEAD: "HEAD"; }>` |

References:

- HttpMethod

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L14)

#### :gear: HttpRequestArgsSchema

| Constant                | Type                                                                                                                                                                                                                                                                                                                    |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `HttpRequestArgsSchema` | `ZodObject<{ url: ZodURL; method: ZodEnum<{ GET: "GET"; POST: "POST"; HEAD: "HEAD"; }>; headers: ZodOptional<ZodArray<ZodObject<{ name: ZodString; value: ZodString; }, $strip>>>; body: ZodOptional<...>; maxResponseBytes: ZodOptional<...>; transform: ZodOptional<...>; isReplicated: ZodOptional<...>; }, $strip>` |

References:

- HttpRequestArgs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L19)

#### :gear: HttpRequestResultSchema

| Constant                  | Type                                                                                                                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `HttpRequestResultSchema` | `ZodObject<{ status: ZodBigInt; headers: ZodArray<ZodObject<{ name: ZodString; value: ZodString; }, $strip>>; body: ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<...>>; }, $strip>` |

References:

- HttpRequestResult

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L32)

#### :gear: TransformArgsSchema

| Constant              | Type                                                                                                                                                                                                       |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TransformArgsSchema` | `ZodObject<{ response: ZodObject<{ status: ZodBigInt; headers: ZodArray<ZodObject<{ name: ZodString; value: ZodString; }, $strip>>; body: ZodCustom<...>; }, $strip>; context: ZodCustom<...>; }, $strip>` |

References:

- TransformArgs

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L41)

### :factory: CallResponseLengthError

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/types/errors.ts#L1)

### :tropical_drink: Interfaces

- [CustomFunctionWithArgsAndResult](#gear-customfunctionwithargsandresult)
- [CustomFunctionWithArgs](#gear-customfunctionwithargs)
- [CustomFunctionWithResult](#gear-customfunctionwithresult)
- [CustomFunctionWithoutArgsAndResult](#gear-customfunctionwithoutargsandresult)
- [Collections](#gear-collections)
- [HookContext](#gear-hookcontext)
- [Doc](#gear-doc)
- [SetDoc](#gear-setdoc)
- [DelDoc](#gear-deldoc)
- [DocUpsert](#gear-docupsert)
- [DocAssertSet](#gear-docassertset)
- [DocAssertDelete](#gear-docassertdelete)
- [DocContext](#gear-doccontext)
- [AssetKey](#gear-assetkey)
- [AssetEncoding](#gear-assetencoding)
- [Asset](#gear-asset)
- [Batch](#gear-batch)
- [CommitBatch](#gear-commitbatch)
- [AssetAssertUpload](#gear-assetassertupload)
- [ListMatcher](#gear-listmatcher)
- [ListPaginate](#gear-listpaginate)
- [ListOrder](#gear-listorder)
- [ListParams](#gear-listparams)
- [ListResults](#gear-listresults)
- [AccessKey](#gear-accesskey)
- [AccessKeyCheckParams](#gear-accesskeycheckparams)
- [CollectionParams](#gear-collectionparams)
- [SetAssetHandlerParams](#gear-setassethandlerparams)
- [GetContentChunksStoreParams](#gear-getcontentchunksstoreparams)
- [CallParams](#gear-callparams)
- [HttpHeader](#gear-httpheader)
- [HttpRequestArgs](#gear-httprequestargs)
- [HttpRequestResult](#gear-httprequestresult)
- [TransformArgs](#gear-transformargs)

#### :gear: CustomFunctionWithArgsAndResult

A serverless function with both input arguments and an output result.

| Property  | Type                                                                                                                   | Description                                                                                         |
| --------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `args`    | `ZodObject<TArgs, $strip>`                                                                                             | A Zod schema describing the input arguments.                                                        |
| `result`  | `ZodObject<TResult, $strip>`                                                                                           | A Zod schema describing the output result.                                                          |
| `handler` | `(args: $InferObjectOutput<TArgs, {}>) => $InferObjectOutput<TResult, {}> or Promise<$InferObjectOutput<TResult, {}>>` | The function handler. Can be synchronous or asynchronous. param: args - The input arguments.returns |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L127)

#### :gear: CustomFunctionWithArgs

A serverless function with input arguments but no output result.

| Property  | Type                                                             | Description                                                                                         |
| --------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `args`    | `ZodObject<TArgs, $strip>`                                       | A Zod schema describing the input arguments.                                                        |
| `handler` | `(args: $InferObjectOutput<TArgs, {}>) => void or Promise<void>` | The function handler. Can be synchronous or asynchronous. param: args - The input arguments.returns |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L157)

#### :gear: CustomFunctionWithResult

A serverless function with an output result but no input arguments.

| Property  | Type                                                                                | Description                                                       |
| --------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| `result`  | `ZodObject<TResult, $strip>`                                                        | A Zod schema describing the output result.                        |
| `handler` | `() => $InferObjectOutput<TResult, {}> or Promise<$InferObjectOutput<TResult, {}>>` | The function handler. Can be synchronous or asynchronous. returns |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L177)

#### :gear: CustomFunctionWithoutArgsAndResult

A serverless function with no input arguments and no output result.

| Property  | Type                          | Description                                                       |
| --------- | ----------------------------- | ----------------------------------------------------------------- |
| `handler` | `() => void or Promise<void>` | The function handler. Can be synchronous or asynchronous. returns |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L196)

#### :gear: Collections

Defines the collections where a hook or assertion should run.

| Property      | Type                | Description                                                                                                        |
| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `collections` | `readonly string[]` | An array of collection names where the hook or assertion will run. If empty, no hooks or assertions are triggered. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/collections.ts#L16)

#### :gear: HookContext

Represents the context provided to hooks, containing information about the caller and related data.

| Property | Type           | Description                                                                     |
| -------- | -------------- | ------------------------------------------------------------------------------- |
| `caller` | `RawPrincipal` | The user who originally triggered the function that in turn triggered the hook. |
| `data`   | `T`            | The data associated with the hook execution.                                    |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L22)

#### :gear: Doc

Represents a document stored in a collection.

| Property      | Type                  | Description                                                                                                             |
| ------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `owner`       | `RawPrincipal`        | The user who owns this document.                                                                                        |
| `data`        | `RawData`             | The raw data of the document.                                                                                           |
| `description` | `string or undefined` | An optional description of the document.                                                                                |
| `created_at`  | `bigint`              | The timestamp when the document was first created.                                                                      |
| `updated_at`  | `bigint`              | The timestamp when the document was last updated.                                                                       |
| `version`     | `bigint or undefined` | The version number of the document, used for consistency checks. If not provided, it's assumed to be the first version. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L43)

#### :gear: SetDoc

Represents the proposed version of a document to be created or updated.
This can be validated before allowing the operation.

| Property      | Type                  | Description                                        |
| ------------- | --------------------- | -------------------------------------------------- |
| `data`        | `RawData`             | The raw data of the document.                      |
| `description` | `string or undefined` | An optional description of the document.           |
| `version`     | `bigint or undefined` | The expected version number to ensure consistency. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L101)

#### :gear: DelDoc

Represents the proposed version of a document to be deleted.
This can be validated before allowing the operation.

| Property  | Type                  | Description                                        |
| --------- | --------------------- | -------------------------------------------------- |
| `version` | `bigint or undefined` | The expected version number to ensure consistency. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L131)

#### :gear: DocUpsert

Represents a document update operation.

This is used in hooks where a document is either being created or updated.

| Property | Type               | Description                                                                                  |
| -------- | ------------------ | -------------------------------------------------------------------------------------------- |
| `before` | `Doc or undefined` | The previous version of the document before the update. Undefined if this is a new document. |
| `after`  | `Doc`              | The new version of the document after the update.                                            |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L26)

#### :gear: DocAssertSet

Represents a validation check before setting a document.

The developer can compare the `current` and `proposed` versions and
throw an error if their validation fails.

| Property   | Type               | Description                                                                                    |
| ---------- | ------------------ | ---------------------------------------------------------------------------------------------- |
| `current`  | `Doc or undefined` | The current version of the document before the operation. Undefined if this is a new document. |
| `proposed` | `SetDoc`           | The proposed version of the document. This can be validated before allowing the operation.     |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L54)

#### :gear: DocAssertDelete

Represents a validation check before deleting a document.

The developer can compare the `current` and `proposed` versions and
throw an error if their validation fails.

| Property   | Type               | Description                                                                                         |
| ---------- | ------------------ | --------------------------------------------------------------------------------------------------- |
| `current`  | `Doc or undefined` | The current version of the document before the operation. Undefined if the document does not exist. |
| `proposed` | `DelDoc`           | The proposed version of the document. This can be validated before allowing the operation.          |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/payload.ts#L84)

#### :gear: DocContext

Represents the context of a document operation within a collection.

| Property     | Type     | Description                                              |
| ------------ | -------- | -------------------------------------------------------- |
| `collection` | `string` | The name of the collection where the document is stored. |
| `key`        | `string` | The key identifying the document within the collection.  |
| `data`       | `T`      | The data associated with the document operation.         |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L32)

#### :gear: AssetKey

Metadata identifying an asset within a collection and the storage system.

| Property      | Type                  | Description                                                                                                                 |
| ------------- | --------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `name`        | `string`              | The name of the asset (e.g., "logo.png").                                                                                   |
| `full_path`   | `string`              | The full relative path of the asset (e.g., "/images/logo.png").                                                             |
| `token`       | `string or undefined` | Optional access token for the asset. If set, can be used using a query parameter e.g. /full_path/?token=1223-3345-5564-3333 |
| `collection`  | `string`              | The collection to which this asset belongs.                                                                                 |
| `owner`       | `RawPrincipal`        | The owner of the asset.                                                                                                     |
| `description` | `string or undefined` | Optional description of the asset for indexing/search.                                                                      |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L85)

#### :gear: AssetEncoding

Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression).

| Property         | Type          | Description                                     |
| ---------------- | ------------- | ----------------------------------------------- |
| `modified`       | `bigint`      | Timestamp when the encoding was last modified.  |
| `content_chunks` | `BlobOrKey[]` | Chunks of binary content or references to them. |
| `total_length`   | `bigint`      | Total byte size of the encoded content.         |
| `sha256`         | `Hash`        | SHA-256 hash of the encoded content.            |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L131)

#### :gear: Asset

A stored asset including its metadata, encodings, and timestamps.

| Property     | Type                              | Description                                                                                    |
| ------------ | --------------------------------- | ---------------------------------------------------------------------------------------------- |
| `key`        | `AssetKey`                        | Metadata about the asset's identity and ownership.                                             |
| `headers`    | `HeaderField[]`                   | Optional HTTP headers associated with the asset.                                               |
| `encodings`  | `[EncodingType, AssetEncoding][]` | A mapping from encoding types (e.g., "identity", "gzip") to the corresponding encoded version. |
| `created_at` | `bigint`                          | Timestamp when the asset was created.                                                          |
| `updated_at` | `bigint`                          | Timestamp when the asset was last updated.                                                     |
| `version`    | `bigint or undefined`             | Optional version number of the asset.                                                          |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L190)

#### :gear: Batch

Represents a batch of chunks to be uploaded and committed to an asset.

| Property        | Type                        | Description                                       |
| --------------- | --------------------------- | ------------------------------------------------- |
| `key`           | `AssetKey`                  | The metadata key for the asset being uploaded.    |
| `reference_id`  | `bigint or undefined`       | Optional reference ID for tracking or validation. |
| `expires_at`    | `bigint`                    | Timestamp when this batch expires.                |
| `encoding_type` | `EncodingType or undefined` | Optional encoding format (e.g., "gzip").          |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L263)

#### :gear: CommitBatch

Represents the final step in uploading an asset, committing the batch to storage.

| Property    | Type            | Description                                       |
| ----------- | --------------- | ------------------------------------------------- |
| `batch_id`  | `bigint`        | The ID of the batch being committed.              |
| `headers`   | `HeaderField[]` | HTTP headers associated with this asset.          |
| `chunk_ids` | `bigint[]`      | List of chunk IDs that make up the asset content. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L319)

#### :gear: AssetAssertUpload

Represents a validation context before uploading an asset.

| Property       | Type                 | Description                                       |
| -------------- | -------------------- | ------------------------------------------------- |
| `current`      | `Asset or undefined` | The current asset already stored (if any).        |
| `batch`        | `Batch`              | The batch metadata being uploaded.                |
| `commit_batch` | `CommitBatch`        | The commit data describing headers and chunk ids. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/payload.ts#L25)

#### :gear: ListMatcher

Matcher used to filter list results.

| Property      | Type                            | Description |
| ------------- | ------------------------------- | ----------- |
| `key`         | `string or undefined`           |             |
| `description` | `string or undefined`           |             |
| `created_at`  | `TimestampMatcher or undefined` |             |
| `updated_at`  | `TimestampMatcher or undefined` |             |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L47)

#### :gear: ListPaginate

Optional pagination controls for listing.

| Property      | Type                  | Description |
| ------------- | --------------------- | ----------- |
| `start_after` | `string or undefined` |             |
| `limit`       | `bigint or undefined` |             |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L67)

#### :gear: ListOrder

Ordering strategy for listing documents.

| Property | Type             | Description |
| -------- | ---------------- | ----------- |
| `desc`   | `boolean`        |             |
| `field`  | `ListOrderField` |             |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L95)

#### :gear: ListParams

Full set of listing parameters.

| Property   | Type                        | Description |
| ---------- | --------------------------- | ----------- |
| `matcher`  | `ListMatcher or undefined`  |             |
| `paginate` | `ListPaginate or undefined` |             |
| `order`    | `ListOrder or undefined`    |             |
| `owner`    | `RawPrincipal or undefined` |             |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L115)

#### :gear: ListResults

List results, parameterized by type of returned item.

| Property         | Type                  | Description |
| ---------------- | --------------------- | ----------- |
| `items`          | `[string, T][]`       |             |
| `items_length`   | `bigint`              |             |
| `items_page`     | `bigint or undefined` |             |
| `matches_length` | `bigint`              |             |
| `matches_pages`  | `bigint or undefined` |             |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L142)

#### :gear: AccessKey

Represents an access key with access scope and associated metadata.

| Property     | Type                                      | Description                                                        |
| ------------ | ----------------------------------------- | ------------------------------------------------------------------ |
| `metadata`   | `[string, string][]`                      | A list of key-value metadata pairs associated with the access key. |
| `created_at` | `bigint`                                  | The timestamp when the access key was created.                     |
| `updated_at` | `bigint`                                  | The timestamp when the access key was last updated.                |
| `expires_at` | `bigint or undefined`                     | Optional expiration timestamp for the access key.                  |
| `scope`      | `"write" or "admin" or "submit"`          | The scope assigned to the access key.                              |
| `kind`       | `"automation" or "emulator" or undefined` | An optional kind identifier of the access key.                     |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L59)

#### :gear: AccessKeyCheckParams

Represents the parameters required to perform an access key checks.

| Property     | Type         | Description                                     |
| ------------ | ------------ | ----------------------------------------------- |
| `id`         | `any`        | The identity to verify against the access keys. |
| `accessKeys` | `AccessKeys` | The list of access keys to check against.       |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L122)

#### :gear: CollectionParams

The parameters required to scope an operation to a collection.

| Property     | Type     | Description                           |
| ------------ | -------- | ------------------------------------- |
| `collection` | `string` | The name of the collection to target. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/params.ts#L24)

#### :gear: SetAssetHandlerParams

The parameters required to set (or update) an asset.

| Property  | Type           | Description                      |
| --------- | -------------- | -------------------------------- |
| `key`     | `AssetKey`     | The key identifying the asset.   |
| `content` | `Blob`         | The binary content of the asset. |
| `headers` | `HeaderFields` | Associated HTTP headers.         |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L82)

#### :gear: GetContentChunksStoreParams

The parameters required to retrieve a specific chunk from an asset.

| Property      | Type                 | Description                                 |
| ------------- | -------------------- | ------------------------------------------- |
| `encoding`    | `AssetEncoding`      | The encoding of the chunks.                 |
| `chunk_index` | `bigint`             | The index of the chunk to retrieve.         |
| `memory`      | `"heap" or "stable"` | The memory type to retrieve the chunk from. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L171)

#### :gear: CallParams

Type representing the parameters required to make a canister call.

| Property     | Type                                          | Description                                                       |
| ------------ | --------------------------------------------- | ----------------------------------------------------------------- |
| `canisterId` | `any`                                         | The target canister's ID.                                         |
| `method`     | `string`                                      | The name of the method to call. Minimum one character.            |
| `args`       | `[IDL.Type<unknown>, unknown][] or undefined` | The arguments, including types and values, for the canister call. |
| `result`     | `any`                                         | The expected result type used for decoding the response.          |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L70)

#### :gear: HttpHeader

An HTTP header consisting of a name and value.

| Property | Type     | Description       |
| -------- | -------- | ----------------- |
| `name`   | `string` | The header name.  |
| `value`  | `string` | The header value. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L49)

#### :gear: HttpRequestArgs

The arguments for an HTTP request.

| Property           | Type                                   | Description                                                                                                                                                                                                                                                                           |
| ------------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url`              | `string`                               | The requested URL.                                                                                                                                                                                                                                                                    |
| `method`           | `HttpMethod`                           | The HTTP method.                                                                                                                                                                                                                                                                      |
| `headers`          | `HttpHeader[] or undefined`            | List of HTTP request headers and their corresponding values.                                                                                                                                                                                                                          |
| `body`             | `Uint8Array<ArrayBuffer> or undefined` | Optionally provide request body.                                                                                                                                                                                                                                                      |
| `maxResponseBytes` | `bigint or undefined`                  | The maximal size of the response in bytes.                                                                                                                                                                                                                                            |
| `transform`        | `string or undefined`                  | The name of a query function used to transform the response before consensus - for example, to trim headers. If provided, a corresponding query must be declared using {@link defineQuery }.                                                                                          |
| `isReplicated`     | `boolean or undefined`                 | Whether all nodes should perform the request and agree on the response, or just one node. Using a single node is cheaper but the response is not verified by others - suitable when you trust the data source or consistency is not critical. Defaults to all nodes if not specified. |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L69)

#### :gear: HttpRequestResult

The result of an HTTP request.

| Property  | Type                      | Description                                                   |
| --------- | ------------------------- | ------------------------------------------------------------- |
| `status`  | `bigint`                  | The response status (e.g. 200, 404).                          |
| `headers` | `HttpHeader[]`            | List of HTTP response headers and their corresponding values. |
| `body`    | `Uint8Array<ArrayBuffer>` | The response's body.                                          |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L112)

#### :gear: TransformArgs

The arguments passed to an HTTP response transform function.

| Property   | Type                      | Description                              |
| ---------- | ------------------------- | ---------------------------------------- |
| `response` | `HttpRequestResult`       | The raw HTTP response to be transformed. |
| `context`  | `Uint8Array<ArrayBuffer>` | Context for response transformation      |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L132)

### :cocktail: Types

- [SatelliteEnv](#gear-satelliteenv)
- [CustomFunctionType](#gear-customfunctiontype)
- [CustomFunction](#gear-customfunction)
- [Query](#gear-query)
- [QueryDefinition](#gear-querydefinition)
- [QueryFn](#gear-queryfn)
- [QueryFnOrObject](#gear-queryfnorobject)
- [Update](#gear-update)
- [UpdateDefinition](#gear-updatedefinition)
- [UpdateFn](#gear-updatefn)
- [UpdateFnOrObject](#gear-updatefnorobject)
- [RawPrincipal](#gear-rawprincipal)
- [Timestamp](#gear-timestamp)
- [Version](#gear-version)
- [RawUserId](#gear-rawuserid)
- [UserId](#gear-userid)
- [Collection](#gear-collection)
- [Key](#gear-key)
- [Description](#gear-description)
- [AssertFunction](#gear-assertfunction)
- [RunFunction](#gear-runfunction)
- [RawData](#gear-rawdata)
- [OptionDoc](#gear-optiondoc)
- [OnSetDocContext](#gear-onsetdoccontext)
- [OnSetManyDocsContext](#gear-onsetmanydocscontext)
- [OnDeleteDocContext](#gear-ondeletedoccontext)
- [OnDeleteManyDocsContext](#gear-ondeletemanydocscontext)
- [OnDeleteFilteredDocsContext](#gear-ondeletefiltereddocscontext)
- [AssertSetDocContext](#gear-assertsetdoccontext)
- [AssertDeleteDocContext](#gear-assertdeletedoccontext)
- [HeaderField](#gear-headerfield)
- [HeaderFields](#gear-headerfields)
- [Blob](#gear-blob)
- [BlobOrKey](#gear-bloborkey)
- [Hash](#gear-hash)
- [AssetEncodingNoContent](#gear-assetencodingnocontent)
- [EncodingType](#gear-encodingtype)
- [AssetNoContent](#gear-assetnocontent)
- [ReferenceId](#gear-referenceid)
- [ChunkId](#gear-chunkid)
- [BatchId](#gear-batchid)
- [FullPath](#gear-fullpath)
- [AssetAccessToken](#gear-assetaccesstoken)
- [OptionAsset](#gear-optionasset)
- [OnUploadAssetContext](#gear-onuploadassetcontext)
- [OnDeleteAssetContext](#gear-ondeleteassetcontext)
- [OnDeleteManyAssetsContext](#gear-ondeletemanyassetscontext)
- [OnDeleteFilteredAssetsContext](#gear-ondeletefilteredassetscontext)
- [AssertUploadAssetContext](#gear-assertuploadassetcontext)
- [AssertDeleteAssetContext](#gear-assertdeleteassetcontext)
- [OnAssert](#gear-onassert)
- [AssertSetDoc](#gear-assertsetdoc)
- [AssertDeleteDoc](#gear-assertdeletedoc)
- [AssertUploadAsset](#gear-assertuploadasset)
- [AssertDeleteAsset](#gear-assertdeleteasset)
- [Assert](#gear-assert)
- [AssertFn](#gear-assertfn)
- [AssertFnOrObject](#gear-assertfnorobject)
- [OnHook](#gear-onhook)
- [OnSetDoc](#gear-onsetdoc)
- [OnSetManyDocs](#gear-onsetmanydocs)
- [OnDeleteDoc](#gear-ondeletedoc)
- [OnDeleteManyDocs](#gear-ondeletemanydocs)
- [OnDeleteFilteredDocs](#gear-ondeletefiltereddocs)
- [OnUploadAsset](#gear-onuploadasset)
- [OnDeleteAsset](#gear-ondeleteasset)
- [OnDeleteManyAssets](#gear-ondeletemanyassets)
- [OnDeleteFilteredAssets](#gear-ondeletefilteredassets)
- [Hook](#gear-hook)
- [HookFn](#gear-hookfn)
- [HookFnOrObject](#gear-hookfnorobject)
- [TimestampMatcher](#gear-timestampmatcher)
- [ListOrderField](#gear-listorderfield)
- [AccessKeyScope](#gear-accesskeyscope)
- [AccessKeyKind](#gear-accesskeykind)
- [Metadata](#gear-metadata)
- [AccessKeyRecord](#gear-accesskeyrecord)
- [AccessKeys](#gear-accesskeys)
- [ListStoreParams](#gear-liststoreparams)
- [GetDocStoreParams](#gear-getdocstoreparams)
- [SetDocStoreParams](#gear-setdocstoreparams)
- [DeleteDocStoreParams](#gear-deletedocstoreparams)
- [CountCollectionDocsStoreParams](#gear-countcollectiondocsstoreparams)
- [CountDocsStoreParams](#gear-countdocsstoreparams)
- [ListDocsStoreParams](#gear-listdocsstoreparams)
- [DeleteDocsStoreParams](#gear-deletedocsstoreparams)
- [DeleteFilteredDocsStoreParams](#gear-deletefiltereddocsstoreparams)
- [Memory](#gear-memory)
- [GetAssetStoreParams](#gear-getassetstoreparams)
- [CountCollectionAssetsStoreParams](#gear-countcollectionassetsstoreparams)
- [CountAssetsStoreParams](#gear-countassetsstoreparams)
- [DeleteAssetsStoreParams](#gear-deleteassetsstoreparams)
- [DeleteFilteredAssetsStoreParams](#gear-deletefilteredassetsstoreparams)
- [DeleteAssetStoreParams](#gear-deleteassetstoreparams)
- [SetAssetTokenStoreParams](#gear-setassettokenstoreparams)
- [ListAssetsStoreParams](#gear-listassetsstoreparams)
- [IDLType](#gear-idltype)
- [CallArg](#gear-callarg)
- [CallArgs](#gear-callargs)
- [CallResult](#gear-callresult)
- [HttpMethod](#gear-httpmethod)

#### :gear: SatelliteEnv

Placeholder for future environment-specific configurations.

Currently unused, but it may support features such as:

- Defining the execution mode (e.g., staging or production).
- Providing environment-specific values like `ckBtcLedgerId` for test or production.

| Type           | Type                                 |
| -------------- | ------------------------------------ |
| `SatelliteEnv` | `z.infer<typeof SatelliteEnvSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.env.ts#L15)

#### :gear: CustomFunctionType

The type of a serverless function. Not exposed to the developer. It allows the CLI
to discover the functions when parsing the code.

| Type                 | Type                                                           |
| -------------------- | -------------------------------------------------------------- |
| `CustomFunctionType` | `(typeof JUNO_FUNCTION_TYPE)[keyof typeof JUNO_FUNCTION_TYPE]` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L9)

#### :gear: CustomFunction

A serverless function definition. The four variants cover all combinations
of optional input arguments and output result.

| Type             | Type |
| ---------------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `CustomFunction` | `    | CustomFunctionWithArgsAndResult<TArgs, TResult> or CustomFunctionWithArgs<TArgs> or CustomFunctionWithResult<TResult> or CustomFunctionWithoutArgsAndResult` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/schemas/function.ts#L212)

#### :gear: Query

The input shape for defining a query serverless function.
Does not include `type`, which is injected by `defineQuery`.

| Type    | Type |
| ------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Query` | `    | Omit<CustomFunctionWithArgsAndResult<TArgs, TResult>, 'type'> or Omit<CustomFunctionWithArgs<TArgs>, 'type'> or Omit<CustomFunctionWithResult<TResult>, 'type'> or Omit<CustomFunctionWithoutArgsAndResult, 'type'>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L46)

#### :gear: QueryDefinition

A query function definition with `type` injected by `defineQuery`.
Queries are read-only functions that do not modify state.

| Type              | Type                                                                   |
| ----------------- | ---------------------------------------------------------------------- |
| `QueryDefinition` | `Query<TArgs, TResult> and { type: typeof JUNO_FUNCTION_TYPE.QUERY; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L59)

#### :gear: QueryFn

A factory function that receives the satellite environment and returns a query definition.

| Type      | Type                                             |
| --------- | ------------------------------------------------ |
| `QueryFn` | `( env: SatelliteEnv ) => Query<TArgs, TResult>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L72)

#### :gear: QueryFnOrObject

A query definition or a factory function that returns one.

| Type              | Type |
| ----------------- | ---- | ------------------------------------------------- |
| `QueryFnOrObject` | `    | Query<TArgs, TResult> or QueryFn<TArgs, TResult>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/query.ts#L82)

#### :gear: Update

The input shape for defining an update serverless function.
Does not include `type`, which is injected by `defineUpdate`.

| Type     | Type |
| -------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Update` | `    | Omit<CustomFunctionWithArgsAndResult<TArgs, TResult>, 'type'> or Omit<CustomFunctionWithArgs<TArgs>, 'type'> or Omit<CustomFunctionWithResult<TResult>, 'type'> or Omit<CustomFunctionWithoutArgsAndResult, 'type'>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L46)

#### :gear: UpdateDefinition

A update function definition with `type` injected by `defineUpdate`.
Queries are read-only functions that do not modify state.

| Type               | Type                                                                     |
| ------------------ | ------------------------------------------------------------------------ |
| `UpdateDefinition` | `Update<TArgs, TResult> and { type: typeof JUNO_FUNCTION_TYPE.UPDATE; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L59)

#### :gear: UpdateFn

A factory function that receives the satellite environment and returns an update definition.

| Type       | Type                                              |
| ---------- | ------------------------------------------------- |
| `UpdateFn` | `( env: SatelliteEnv ) => Update<TArgs, TResult>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L72)

#### :gear: UpdateFnOrObject

A update definition or a factory function that returns one.

| Type               | Type |
| ------------------ | ---- | --------------------------------------------------- |
| `UpdateFnOrObject` | `    | Update<TArgs, TResult> or UpdateFn<TArgs, TResult>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/functions/update.ts#L82)

#### :gear: RawPrincipal

Represents a raw principal - a Uint8Array representation of a Principal.

| Type           | Type         |
| -------------- | ------------ |
| `RawPrincipal` | `Uint8Array` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/principal.ts#L11)

#### :gear: Timestamp

Represents a timestamp in nanoseconds since the Unix epoch.

Used for tracking when events occur, such as document creation and updates.

| Type        | Type                              |
| ----------- | --------------------------------- |
| `Timestamp` | `z.infer<typeof TimestampSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L15)

#### :gear: Version

Represents a version number for tracking changes.

This is typically incremented with each update to ensure consistency.

| Type      | Type                            |
| --------- | ------------------------------- |
| `Version` | `z.infer<typeof VersionSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L27)

#### :gear: RawUserId

Represents a raw user identifier.

This is a principal associated with a user.

| Type        | Type           |
| ----------- | -------------- |
| `RawUserId` | `RawPrincipal` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L39)

#### :gear: UserId

Represents a user identifier.

This is a principal associated with a user.

| Type     | Type                           |
| -------- | ------------------------------ |
| `UserId` | `z.infer<typeof UserIdSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L51)

#### :gear: Collection

A collection name where data are stored.

| Type         | Type                               |
| ------------ | ---------------------------------- |
| `Collection` | `z.infer<typeof CollectionSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L61)

#### :gear: Key

A key identifier within a collection.

| Type  | Type                        |
| ----- | --------------------------- |
| `Key` | `z.infer<typeof KeySchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L71)

#### :gear: Description

Represents a description with a maximum length of 1024 characters.
Used for document and asset fields which can be useful for search purpose.

| Type          | Type                                |
| ------------- | ----------------------------------- |
| `Description` | `z.infer<typeof DescriptionSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/satellite.ts#L82)

#### :gear: AssertFunction

Defines the `assert` function schema for assertions.

The function takes a context argument and returns `void`.

| Type             | Type                   |
| ---------------- | ---------------------- |
| `AssertFunction` | `(context: T) => void` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L47)

#### :gear: RunFunction

Defines the `run` function schema for hooks.

The function takes a context argument and returns either a `Promise<void>` or `void`.

| Type          | Type                                    |
| ------------- | --------------------------------------- |
| `RunFunction` | `(context: T) => void or Promise<void>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/context.ts#L64)

#### :gear: RawData

Represents raw binary data.

This is used to store structured data in a document.

| Type      | Type         |
| --------- | ------------ |
| `RawData` | `Uint8Array` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L24)

#### :gear: OptionDoc

A shorthand for a document that might or not be defined.

| Type        | Type               |
| ----------- | ------------------ |
| `OptionDoc` | `Doc or undefined` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/db.ts#L84)

#### :gear: OnSetDocContext

The context provided to the `onSetDoc` hook.

This context contains information about the document being created or updated,
along with details about the user who triggered the operation.

| Type              | Type                                 |
| ----------------- | ------------------------------------ |
| `OnSetDocContext` | `HookContext<DocContext<DocUpsert>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L60)

#### :gear: OnSetManyDocsContext

The context provided to the `onSetManyDocs` hook.

This context contains information about multiple documents being created or updated
in a single operation, along with details about the user who triggered it.

| Type                   | Type                                   |
| ---------------------- | -------------------------------------- |
| `OnSetManyDocsContext` | `HookContext<DocContext<DocUpsert>[]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L75)

#### :gear: OnDeleteDocContext

The context provided to the `onDeleteDoc` hook.

This context contains information about a single document being deleted,
along with details about the user who triggered the operation.

| Type                 | Type                                 |
| -------------------- | ------------------------------------ |
| `OnDeleteDocContext` | `HookContext<DocContext<OptionDoc>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L88)

#### :gear: OnDeleteManyDocsContext

The context provided to the `onDeleteManyDocs` hook.

This context contains information about multiple documents being deleted,
along with details about the user who triggered the operation.

| Type                      | Type                                   |
| ------------------------- | -------------------------------------- |
| `OnDeleteManyDocsContext` | `HookContext<DocContext<OptionDoc>[]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L103)

#### :gear: OnDeleteFilteredDocsContext

The context provided to the `onDeleteFilteredDocs` hook.

This context contains information about documents deleted as a result of a filter,
along with details about the user who triggered the operation.

| Type                          | Type                                   |
| ----------------------------- | -------------------------------------- |
| `OnDeleteFilteredDocsContext` | `HookContext<DocContext<OptionDoc>[]>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L118)

#### :gear: AssertSetDocContext

The context provided to the `assertDeleteDoc` hook.

This context contains information about the document being validated before
it is created or updated. If validation fails, the developer should throw an error.

| Type                  | Type                                    |
| --------------------- | --------------------------------------- |
| `AssertSetDocContext` | `HookContext<DocContext<DocAssertSet>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L131)

#### :gear: AssertDeleteDocContext

The context provided to the `assertDeleteDoc` hook.

This context contains information about the document being validated before
it is deleted. If validation fails, the developer should throw an error.

| Type                     | Type                                       |
| ------------------------ | ------------------------------------------ |
| `AssertDeleteDocContext` | `HookContext<DocContext<DocAssertDelete>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/db/context.ts#L146)

#### :gear: HeaderField

Represents a single HTTP header as a tuple of name and value.

| Type          | Type               |
| ------------- | ------------------ |
| `HeaderField` | `[string, string]` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L24)

#### :gear: HeaderFields

Represents a list of HTTP headers.

| Type           | Type            |
| -------------- | --------------- |
| `HeaderFields` | `HeaderField[]` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L34)

#### :gear: Blob

Binary content used in asset encoding.

| Type   | Type         |
| ------ | ------------ |
| `Blob` | `Uint8Array` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L44)

#### :gear: BlobOrKey

When stable memory is used, chunks are saved within a StableBTreeMap and their keys - StableEncodingChunkKey - are saved for reference as serialized values

| Type        | Type         |
| ----------- | ------------ |
| `BlobOrKey` | `Uint8Array` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L54)

#### :gear: Hash

Represents a SHA-256 hash as a 32-byte binary value.

| Type   | Type         |
| ------ | ------------ |
| `Hash` | `Uint8Array` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L66)

#### :gear: AssetEncodingNoContent

Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression), without the chunks.

| Type                     | Type                                    |
| ------------------------ | --------------------------------------- |
| `AssetEncodingNoContent` | `Omit<AssetEncoding, 'content_chunks'>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L161)

#### :gear: EncodingType

A string identifier representing a specific encoding format (e.g., "gzip", "identity").

| Type           | Type                                                      |
| -------------- | --------------------------------------------------------- |
| `EncodingType` | `'identity' or 'gzip' or 'compress' or 'deflate' or 'br'` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L171)

#### :gear: AssetNoContent

A stored asset including its metadata, encodings without chunks, and timestamps.

| Type             | Type                                                                                    |
| ---------------- | --------------------------------------------------------------------------------------- |
| `AssetNoContent` | `Omit<Asset, 'encodings'> and { encodings: [EncodingType, AssetEncodingNoContent][]; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L234)

#### :gear: ReferenceId

A unique reference identifier for batches.

| Type          | Type |
| ------------- | ---- |
| `ReferenceId` |      |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L246)

#### :gear: ChunkId

A unique identifier representing a single chunk of data.

| Type      | Type |
| --------- | ---- |
| `ChunkId` |      |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L293)

#### :gear: BatchId

A unique identifier representing a batch of upload.

| Type      | Type |
| --------- | ---- |
| `BatchId` |      |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L303)

#### :gear: FullPath

Represents the relative path of an asset in storage.
For assets that are not part of the frontend app, the collection must be included at the root of the path.

Example: `/images/a-sun-above-the-mountains.png`

| Type       | Type |
| ---------- | ---- |
| `FullPath` |      |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L347)

#### :gear: AssetAccessToken

An optional access token that can be used to make an asset private on the web.
Private as in practically unguessable (if complex enough and not shared of course).

Example: `/images/a-sun-above-the-mountains.png?token=a-super-long-unguessable-not-shared-id`

| Type               | Type                  |
| ------------------ | --------------------- |
| `AssetAccessToken` | `string or undefined` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L360)

#### :gear: OptionAsset

A shorthand for an asset that might or not be defined.

| Type          | Type                 |
| ------------- | -------------------- |
| `OptionAsset` | `Asset or undefined` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/storage.ts#L370)

#### :gear: OnUploadAssetContext

Context for the `onUploadAsset` hook.

This context contains information about the asset that was uploaded.

| Type                   | Type                 |
| ---------------------- | -------------------- |
| `OnUploadAssetContext` | `HookContext<Asset>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L16)

#### :gear: OnDeleteAssetContext

Context for the `onDeleteAsset` hook.

This context contains information about a single asset being deleted, along with details about the user who triggered the operation.

If undefined, the asset did not exist.

| Type                   | Type                              |
| ---------------------- | --------------------------------- |
| `OnDeleteAssetContext` | `HookContext<Asset or undefined>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L30)

#### :gear: OnDeleteManyAssetsContext

Context for the `onDeleteManyAssets` hook.

This context contains information about multiple assets being potentially deleted, along with details about the user who triggered the operation.

| Type                        | Type                                     |
| --------------------------- | ---------------------------------------- |
| `OnDeleteManyAssetsContext` | `HookContext<Array<Asset or undefined>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L42)

#### :gear: OnDeleteFilteredAssetsContext

Context for the `onDeleteFilteredAssets` hook.

This context contains information about documents deleted as a result of a filter, along with details about the user who triggered the operation.

| Type                            | Type                                     |
| ------------------------------- | ---------------------------------------- |
| `OnDeleteFilteredAssetsContext` | `HookContext<Array<Asset or undefined>>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L56)

#### :gear: AssertUploadAssetContext

Context for the `assertUploadAsset` hook.

This context contains information about the asset being validated before it is uploaded. If validation fails, the developer should throw an error.

| Type                       | Type                             |
| -------------------------- | -------------------------------- |
| `AssertUploadAssetContext` | `HookContext<AssetAssertUpload>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L68)

#### :gear: AssertDeleteAssetContext

Context for the `assertDeleteAsset` hook.

This context contains information about the asset being validated before it is deleted. If validation fails, the developer should throw an error.

| Type                       | Type                 |
| -------------------------- | -------------------- |
| `AssertDeleteAssetContext` | `HookContext<Asset>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/schemas/storage/context.ts#L80)

#### :gear: OnAssert

A generic schema for defining assertions related to collections.

| Type       | Type                                             |
| ---------- | ------------------------------------------------ |
| `OnAssert` | `Collections and { assert: AssertFunction<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L38)

#### :gear: AssertSetDoc

An assertion that runs when a document is created or updated.

| Type           | Type                            |
| -------------- | ------------------------------- |
| `AssertSetDoc` | `OnAssert<AssertSetDocContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L50)

#### :gear: AssertDeleteDoc

An assertion that runs when a document is deleted.

| Type              | Type                               |
| ----------------- | ---------------------------------- |
| `AssertDeleteDoc` | `OnAssert<AssertDeleteDocContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L60)

#### :gear: AssertUploadAsset

An assertion that runs before an asset is uploaded.

| Type                | Type                                 |
| ------------------- | ------------------------------------ |
| `AssertUploadAsset` | `OnAssert<AssertUploadAssetContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L70)

#### :gear: AssertDeleteAsset

An assertion that runs before an asset is deleted.

| Type                | Type                                 |
| ------------------- | ------------------------------------ |
| `AssertDeleteAsset` | `OnAssert<AssertDeleteAssetContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L80)

#### :gear: Assert

All assertions definitions.

| Type     | Type                                                                        |
| -------- | --------------------------------------------------------------------------- |
| `Assert` | `AssertSetDoc or AssertDeleteDoc or AssertUploadAsset or AssertDeleteAsset` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L95)

#### :gear: AssertFn

| Type       | Type                                                |
| ---------- | --------------------------------------------------- |
| `AssertFn` | `(assert: z.infer<typeof SatelliteEnvSchema>) => T` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L102)

#### :gear: AssertFnOrObject

| Type               | Type               |
| ------------------ | ------------------ |
| `AssertFnOrObject` | `T or AssertFn<T>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/assertions.ts#L106)

#### :gear: OnHook

A generic schema for defining hooks related to collections.

| Type     | Type                                                                                                                                                                                                                                                                               |
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `OnHook` | `Collections and { /** * A function that runs when the hook is triggered for the specified collections. * * @param {T} context - Contains information about the affected document(s). * @returns {Promise<void>} Resolves when the operation completes. */ run: RunFunction<T>; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L42)

#### :gear: OnSetDoc

A hook that runs when a document is created or updated.

| Type       | Type                      |
| ---------- | ------------------------- |
| `OnSetDoc` | `OnHook<OnSetDocContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L60)

#### :gear: OnSetManyDocs

A hook that runs when multiple documents are created or updated.

| Type            | Type                           |
| --------------- | ------------------------------ |
| `OnSetManyDocs` | `OnHook<OnSetManyDocsContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L70)

#### :gear: OnDeleteDoc

A hook that runs when a single document is deleted.

| Type          | Type                         |
| ------------- | ---------------------------- |
| `OnDeleteDoc` | `OnHook<OnDeleteDocContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L80)

#### :gear: OnDeleteManyDocs

A hook that runs when multiple documents are deleted.

| Type               | Type                              |
| ------------------ | --------------------------------- |
| `OnDeleteManyDocs` | `OnHook<OnDeleteManyDocsContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L90)

#### :gear: OnDeleteFilteredDocs

A hook that runs when a filtered set of documents is deleted based on query conditions.

| Type                   | Type                                  |
| ---------------------- | ------------------------------------- |
| `OnDeleteFilteredDocs` | `OnHook<OnDeleteFilteredDocsContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L100)

#### :gear: OnUploadAsset

A hook that runs when a single asset is uploaded.

| Type            | Type                           |
| --------------- | ------------------------------ |
| `OnUploadAsset` | `OnHook<OnUploadAssetContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L110)

#### :gear: OnDeleteAsset

A hook that runs when a single asset is potentially deleted.

| Type            | Type                           |
| --------------- | ------------------------------ |
| `OnDeleteAsset` | `OnHook<OnDeleteAssetContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L120)

#### :gear: OnDeleteManyAssets

A hook that runs when multiple assets are potentially deleted.

| Type                 | Type                                |
| -------------------- | ----------------------------------- |
| `OnDeleteManyAssets` | `OnHook<OnDeleteManyAssetsContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L130)

#### :gear: OnDeleteFilteredAssets

A hook that runs when a filtered set of assets is deleted based on query conditions.

| Type                     | Type                                    |
| ------------------------ | --------------------------------------- |
| `OnDeleteFilteredAssets` | `OnHook<OnDeleteFilteredAssetsContext>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L140)

#### :gear: Hook

All hooks definitions.

| Type   | Type |
| ------ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Hook` | `    | OnSetDoc or OnSetManyDocs or OnDeleteDoc or OnDeleteManyDocs or OnDeleteFilteredDocs or OnUploadAsset or OnDeleteAsset or OnDeleteManyAssets or OnDeleteFilteredAssets` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L160)

#### :gear: HookFn

| Type     | Type                                              |
| -------- | ------------------------------------------------- |
| `HookFn` | `(hook: z.infer<typeof SatelliteEnvSchema>) => T` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L173)

#### :gear: HookFnOrObject

| Type             | Type             |
| ---------------- | ---------------- |
| `HookFnOrObject` | `T or HookFn<T>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/hooks/hooks.ts#L177)

#### :gear: TimestampMatcher

TimestampMatcher matches a timestamp field using a specific strategy.

| Type               | Type |
| ------------------ | ---- | --------------------------------------------------------------------------------------------------------------- |
| `TimestampMatcher` | `    | {equal: Timestamp} or {greater_than: Timestamp} or {less_than: Timestamp} or {between: [Timestamp, Timestamp]}` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L26)

#### :gear: ListOrderField

Enum representing possible fields to order by.

| Type             | Type                                     |
| ---------------- | ---------------------------------------- |
| `ListOrderField` | `'keys' or 'updated_at' or 'created_at'` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/schemas/list.ts#L80)

#### :gear: AccessKeyScope

Represents the permission scope of an access key.

| Type             | Type                                   |
| ---------------- | -------------------------------------- |
| `AccessKeyScope` | `z.infer<typeof AccessKeyScopeSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L20)

#### :gear: AccessKeyKind

Represents a specific kind of access key. Meant for informational purposes.

| Type            | Type                                  |
| --------------- | ------------------------------------- |
| `AccessKeyKind` | `z.infer<typeof AccessKeyKindSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L30)

#### :gear: Metadata

Represents a single metadata entry as a key-value tuple.

| Type       | Type                             |
| ---------- | -------------------------------- |
| `Metadata` | `z.infer<typeof MetadataSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L40)

#### :gear: AccessKeyRecord

Represents a tuple containing the principal ID and associated access key data.

| Type              | Type                                    |
| ----------------- | --------------------------------------- |
| `AccessKeyRecord` | `z.infer<typeof AccessKeyRecordSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L99)

#### :gear: AccessKeys

Represents a list of access keys.

| Type         | Type                          |
| ------------ | ----------------------------- |
| `AccessKeys` | `[RawPrincipal, AccessKey][]` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/access-keys.ts#L109)

#### :gear: ListStoreParams

The parameters required to list documents from the datastore respectively assets from the storage.

| Type              | Type                                                                                                                                                                                                              |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ListStoreParams` | `CollectionParams and { /** * The identity of the caller requesting the list operation. */ caller: RawUserId or UserId;  /** * Optional filtering, ordering, and pagination parameters. */ params: ListParams; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/params.ts#L42)

#### :gear: GetDocStoreParams

Represents the base parameters required to access the datastore and modify a document.

| Type                | Type                                                                                                                                                                                         |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GetDocStoreParams` | `CollectionParams and { /** * The caller who initiate the document operation. */ caller: RawUserId or UserId;  /** * The key identifying the document within the collection. */ key: Key; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L28)

#### :gear: SetDocStoreParams

Represents the parameters required to store or update a document.

This includes the document data along with metadata such as the caller,
collection, and key.

| Type                | Type                                                                                                                                  |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `SetDocStoreParams` | `GetDocStoreParams and { /** * The data, optional description and version required to create or update a document. */ doc: SetDoc; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L53)

#### :gear: DeleteDocStoreParams

Represents the parameters required to delete a document.

This includes the document version along with metadata such as the caller,
collection, and key.

| Type                   | Type                                                                                         |
| ---------------------- | -------------------------------------------------------------------------------------------- |
| `DeleteDocStoreParams` | `GetDocStoreParams and { /** * The version required to delete a document. */ doc: DelDoc; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L73)

#### :gear: CountCollectionDocsStoreParams

The parameters required to count documents from the datastore.

| Type                             | Type               |
| -------------------------------- | ------------------ |
| `CountCollectionDocsStoreParams` | `CollectionParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L88)

#### :gear: CountDocsStoreParams

The parameters required to count documents from the datastore.

| Type                   | Type              |
| ---------------------- | ----------------- |
| `CountDocsStoreParams` | `ListStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L98)

#### :gear: ListDocsStoreParams

The parameters required to list documents from the datastore.

| Type                  | Type              |
| --------------------- | ----------------- |
| `ListDocsStoreParams` | `ListStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L108)

#### :gear: DeleteDocsStoreParams

The parameters required to delete the documents from a collection of the datastore.

| Type                    | Type               |
| ----------------------- | ------------------ |
| `DeleteDocsStoreParams` | `CollectionParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L118)

#### :gear: DeleteFilteredDocsStoreParams

The parameters required to delete documents from the datastore.

| Type                            | Type              |
| ------------------------------- | ----------------- |
| `DeleteFilteredDocsStoreParams` | `ListStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/db.ts#L128)

#### :gear: Memory

Memory type used to select storage or datastore location.

| Type     | Type                           |
| -------- | ------------------------------ |
| `Memory` | `z.infer<typeof MemorySchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/collections.ts#L11)

#### :gear: GetAssetStoreParams

Represents the base parameters required to access the storage and modify an asset.

| Type                  | Type                                                                                                                                                                                                       |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GetAssetStoreParams` | `CollectionParams and { /** * The caller who initiate the document operation. */ caller: RawUserId or UserId;  /** * The full_path identifying the asset within the collection. */ full_path: FullPath; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L36)

#### :gear: CountCollectionAssetsStoreParams

The parameters required to count documents from the storage.

| Type                               | Type               |
| ---------------------------------- | ------------------ |
| `CountCollectionAssetsStoreParams` | `CollectionParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L56)

#### :gear: CountAssetsStoreParams

The parameters required to count documents from the storage.

| Type                     | Type              |
| ------------------------ | ----------------- |
| `CountAssetsStoreParams` | `ListStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L66)

#### :gear: DeleteAssetsStoreParams

The parameters required to delete the assets from a collection of the storage.

| Type                      | Type               |
| ------------------------- | ------------------ |
| `DeleteAssetsStoreParams` | `CollectionParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L107)

#### :gear: DeleteFilteredAssetsStoreParams

The parameters required to delete assets from the storage.

| Type                              | Type              |
| --------------------------------- | ----------------- |
| `DeleteFilteredAssetsStoreParams` | `ListStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L117)

#### :gear: DeleteAssetStoreParams

Represents the parameters required to delete an asset.

| Type                     | Type                  |
| ------------------------ | --------------------- |
| `DeleteAssetStoreParams` | `GetAssetStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L127)

#### :gear: SetAssetTokenStoreParams

Represents the parameters required to delete an asset.

| Type                       | Type                                                                                                                                                                      |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SetAssetTokenStoreParams` | `GetAssetStoreParams and { /** * The token to apply to the asset. * Setting `undefined` removes the protection and makes the asset public. */ token: AssetAccessToken; }` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L139)

#### :gear: ListAssetsStoreParams

The parameters required to list documents from the datastore.

| Type                    | Type              |
| ----------------------- | ----------------- |
| `ListAssetsStoreParams` | `ListStoreParams` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/storage.ts#L155)

#### :gear: IDLType

Custom validation function to verify if a value is an instance of `IDL.Type` from `@icp-sdk/core/candid`.

| Type      | Type                            |
| --------- | ------------------------------- |
| `IDLType` | `z.infer<typeof IDLTypeSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L17)

#### :gear: CallArg

A call argument consisting of its IDL type and corresponding value.

| Type      | Type                            |
| --------- | ------------------------------- |
| `CallArg` | `z.infer<typeof CallArgSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L27)

#### :gear: CallArgs

Represents the arguments for a canister call on the IC.

Requests and responses on the IC are encoded using Candid.
This schema ensures that each argument is provided with both its type and value
for proper encoding.

The order of arguments is preserved for the function call.

| Type       | Type                             |
| ---------- | -------------------------------- |
| `CallArgs` | `z.infer<typeof CallArgsSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L45)

#### :gear: CallResult

Defines the type used to decode the result of a canister call.

| Type         | Type                               |
| ------------ | ---------------------------------- |
| `CallResult` | `z.infer<typeof CallResultSchema>` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/call.ts#L55)

#### :gear: HttpMethod

The HTTP method for the request.

| Type         | Type                        |
| ------------ | --------------------------- |
| `HttpMethod` | `'GET' or 'POST' or 'HEAD'` |

[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/ic-cdk/schemas/http-request.ts#L64)

<!-- TSDOC_END -->

## License

MIT © [David Dal Busco](mailto:david.dalbusco@outlook.com)

[juno]: https://juno.build
