4
4
*
5
5
* THIS CODE IS AUTOMATICALLY GENERATED.
6
6
*
7
- * Generated by convex@0.9.2 .
7
+ * Generated by convex@0.13.0 .
8
8
* To regenerate, run `npx convex codegen`.
9
9
* @module
10
10
*/
11
11
12
12
import {
13
- ActionBuilderForAPI ,
14
- HttpEndpointBuilderForAPI ,
13
+ ActionBuilder ,
14
+ HttpActionBuilderForAPI ,
15
15
MutationBuilder ,
16
- QueryBuilderForDataModel ,
16
+ QueryBuilder ,
17
+ CronJobsForAPI ,
17
18
ActionCtx as GenericActionCtx ,
18
- HttpEndpointCtx as GenericHttpEndpointCtx ,
19
19
MutationCtx as GenericMutationCtx ,
20
20
QueryCtx as GenericQueryCtx ,
21
21
DatabaseReader as GenericDatabaseReader ,
@@ -24,6 +24,30 @@ import {
24
24
import type { DataModel } from "./dataModel.js" ;
25
25
import type { API } from "./api.js" ;
26
26
27
+ /**
28
+ * Returns a cron job scheduler, used to schedule Convex functions to run on a recurring basis.
29
+ *
30
+ * ```js
31
+ * // convex/crons.js
32
+ * import { cronJobs } from './_generated/server';
33
+ *
34
+ * const crons = cronJobs();
35
+ * crons.weekly(
36
+ * "weekly re-engagement email",
37
+ * {
38
+ * hourUTC: 17, // (9:30am Pacific/10:30am Daylight Savings Pacific)
39
+ * minuteUTC: 30,
40
+ * },
41
+ * "sendEmails"
42
+ * )
43
+ * export default crons;
44
+ * ```
45
+ *
46
+ * @returns The cron job scheduler object. Create this object in `convex/crons.js` and export it
47
+ * as the default export.
48
+ */
49
+ export declare const cronJobs : CronJobsForAPI < API > ;
50
+
27
51
/**
28
52
* Define a query in this Convex app's public API.
29
53
*
@@ -32,7 +56,17 @@ import type { API } from "./api.js";
32
56
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
33
57
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
34
58
*/
35
- export declare const query : QueryBuilderForDataModel < DataModel > ;
59
+ export declare const query : QueryBuilder < DataModel , "public" > ;
60
+
61
+ /**
62
+ * Define a query that is only accessible from other Convex functions (but not from the client).
63
+ *
64
+ * This function will be allowed to read from your Convex database. It will not be accessible from the client.
65
+ *
66
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
67
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
68
+ */
69
+ export declare const internalQuery : QueryBuilder < DataModel , "internal" > ;
36
70
37
71
/**
38
72
* Define a mutation in this Convex app's public API.
@@ -42,34 +76,54 @@ export declare const query: QueryBuilderForDataModel<DataModel>;
42
76
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
43
77
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
44
78
*/
45
- export declare const mutation : MutationBuilder < DataModel , API > ;
79
+ export declare const mutation : MutationBuilder < DataModel , API , "public" > ;
80
+
81
+ /**
82
+ * Define a mutation that is only accessible from other Convex functions (but not from the client).
83
+ *
84
+ * This function will be allowed to modify your Convex database. It will not be accessible from the client.
85
+ *
86
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
87
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
88
+ */
89
+ export declare const internalMutation : MutationBuilder <
90
+ DataModel ,
91
+ API ,
92
+ "internal"
93
+ > ;
46
94
47
95
/**
48
96
* Define an action in this Convex app's public API.
49
97
*
50
98
* An action is a function which can execute any JavaScript code, including non-deterministic
51
- * code and code with side-effects. Actions are often used to call into third-party services.
52
- * Actions execute in a Node.js environment and can interact with the database indirectly by
53
- * calling queries and mutations via the provided {@link ActionCtx} object. Actions need to be defined
54
- * in the `/convex/actions directory`. Queries and mutations, on the other hand, must be defined
55
- * outside of the `/convex/actions directory`.
99
+ * code and code with side-effects, like calling third-party services.
100
+ * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
101
+ * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
56
102
*
57
- * @param func - The action. It receives a {@link ActionCtx} as its first argument.
103
+ * @param func - The action. It receives an {@link ActionCtx} as its first argument.
58
104
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
59
105
*/
60
- export declare const action : ActionBuilderForAPI < API > ;
106
+ export declare const action : ActionBuilder < API , "public" > ;
107
+
108
+ /**
109
+ * Define an action that is only accessible from other Convex functions (but not from the client).
110
+ *
111
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument.
112
+ * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
113
+ */
114
+ export declare const internalAction : ActionBuilder < API , "internal" > ;
61
115
62
116
/**
63
- * Define an HTTP endpoint .
117
+ * Define an HTTP action .
64
118
*
65
119
* This function will be used to respond to HTTP requests received by a Convex
66
- * deployment if the requests matches the path and method where this endpoint
67
- * is routed. Be sure to route your endpoint in `convex/http.js`.
120
+ * deployment if the requests matches the path and method where this action
121
+ * is routed. Be sure to route your action in `convex/http.js`.
68
122
*
69
- * @param func - The endpoint function. It receives a {@link HttpEndpointCtx } as its first argument.
70
- * @returns The wrapped endpoint function. Import this function from `convex/http.js` and route it to hook it up.
123
+ * @param func - The function. It receives an {@link ActionCtx } as its first argument.
124
+ * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
71
125
*/
72
- export declare const httpEndpoint : HttpEndpointBuilderForAPI < API > ;
126
+ export declare const httpAction : HttpActionBuilderForAPI < API > ;
73
127
74
128
/**
75
129
* A set of services for use within Convex query functions.
@@ -98,14 +152,6 @@ export type MutationCtx = GenericMutationCtx<DataModel, API>;
98
152
*/
99
153
export type ActionCtx = GenericActionCtx < API > ;
100
154
101
- /**
102
- * A set of services for use within Convex HTTP endpoints.
103
- *
104
- * The HttpEndpointCtx is passed as the first argument to any Convex HTTP
105
- * endpoint run on the server.
106
- */
107
- export type HttpEndpointCtx = GenericHttpEndpointCtx < API > ;
108
-
109
155
/**
110
156
* An interface to read from the database within Convex query functions.
111
157
*
0 commit comments