convex
Version:
Client for the Convex Cloud
51 lines • 2.67 kB
TypeScript
import { GenericAPI } from "../../api/index.js";
import { GenericDataModel } from "../data_model.js";
import { ActionCtx, HttpEndpointCtx, MutationCtx, PublicAction, PublicHttpEndpoint, PublicMutation, PublicQuery, QueryCtx } from "../registration.js";
/**
* Define a mutation in this Convex app's public API.
*
* This function will be allowed to modify your Convex database and will be accessible from the client.
*
* If you're using code generation, use the `mutation` function in
* `convex/_generated/server.d.ts` which is typed for your data model.
*
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
*
* @public
*/
export declare const mutationGeneric: <DataModel extends GenericDataModel, API extends GenericAPI, Args extends any[], Output>(func: (ctx: MutationCtx<DataModel, API>, ...args: Args) => Output) => PublicMutation<DataModel, API, Args, Output>;
/**
* Define a query in this Convex app's public API.
*
* This function will be allowed to read your Convex database and will be accessible from the client.
*
* If you're using code generation, use the `query` function in
* `convex/_generated/server.d.ts` which is typed for your data model.
*
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
*
* @public
*/
export declare const queryGeneric: <DataModel extends GenericDataModel, Args extends any[], Output>(func: (ctx: QueryCtx<DataModel>, ...args: Args) => Output) => PublicQuery<DataModel, Args, Output>;
/**
* Define an action in this Convex app's public API.
*
* @param func - The function. It receives a {@link ActionCtx} as its first argument.
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
*
* @public
*/
export declare const actionGeneric: <API extends GenericAPI, Args extends any[], Output>(func: (ctx: ActionCtx<API>, ...args: Args) => Output) => PublicAction<API, Args, Output>;
/**
* Define a Convex HTTP endpoint.
*
* @param func - The function. It receives an {@link HttpEndpointCtx} as its first argument, and a `Request` object
* as its second.
* @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
*
* @public
*/
export declare const httpEndpointGeneric: <API extends GenericAPI>(func: (ctx: HttpEndpointCtx<API>, request: Request) => Promise<Response>) => PublicHttpEndpoint<API>;
//# sourceMappingURL=registration_impl.d.ts.map