Functions hooks

Hand-written hooks for `Function`. CRUD comes from `functions.gen.ts`; this file adds the custom `invoke` op which the generator skips. Mirror to docs/client-functions.md / Worker Loader pattern: `invokeFunction` fires off the function as a Cloudflare Dynamic Worker and returns `{ ok, result, error, durationMs }`.

Hooks

useCreateFunction mutation

Create a function.

TypeScript
useCreateFunction(options?: MutationOpts<Function, CreateFunctionParams>)

Types: Function · CreateFunctionParams

useDeleteFunction mutation

Soft-delete a function.

TypeScript
useDeleteFunction(options?: MutationOpts<SuccessResponse, string>)

Types: SuccessResponse

useInvokeFunction composite

Invoke a function. The runner loads the matching version's source bundle into an isolate via the Worker Loader binding and returns the function's JSON response.

TypeScript
useInvokeFunction(options?: MutationOpts<InvokeFunctionResponse, InvokeFunctionParams>)

Types: InvokeFunctionResponse · InvokeFunctionParams

useListFunctions query

List functions.

TypeScript
useListFunctions(params?: Omit<ListFunctionsParams, | > & { filter?: FunctionFilter; orderBy?: FunctionOrderBy[]; } & FunctionShorthands, options?: QueryOpts<Page<Function>>)

Types: ListFunctionsParams · FunctionFilter · FunctionOrderBy · FunctionShorthands · Page · Function

usePurgeFunction composite

Permanently delete a soft-deleted function.

TypeScript
usePurgeFunction(options?: MutationOpts<SuccessResponse, PurgeFunctionParams>)

Types: SuccessResponse · PurgeFunctionParams

useRestoreFunction composite

Restore a soft-deleted function.

TypeScript
useRestoreFunction(options?: MutationOpts<Function, string>)

Types: Function

useRetrieveFunction query

Get a function by ID.

TypeScript
useRetrieveFunction(id: string, options?: QueryOpts<Function>)

Types: Function

useUpdateFunction mutation

Update a function.

TypeScript
useUpdateFunction(options?: MutationOpts<Function, UpdateFunctionParams>)

Types: Function · UpdateFunctionParams