@convex-dev/crons 0.1.9 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +18 -16
  2. package/dist/{commonjs/client → client}/index.d.ts +5 -5
  3. package/dist/client/index.d.ts.map +1 -0
  4. package/dist/client/index.js.map +1 -0
  5. package/dist/client/utils.d.ts +8 -0
  6. package/dist/client/utils.d.ts.map +1 -0
  7. package/dist/client/utils.js +2 -0
  8. package/dist/{commonjs/client → client}/utils.js.map +1 -1
  9. package/dist/component/_generated/api.d.ts +34 -0
  10. package/dist/component/_generated/api.d.ts.map +1 -0
  11. package/{src → dist}/component/_generated/api.js +11 -7
  12. package/dist/component/_generated/api.js.map +1 -0
  13. package/dist/component/_generated/component.d.ts +79 -0
  14. package/dist/component/_generated/component.d.ts.map +1 -0
  15. package/dist/component/_generated/component.js +11 -0
  16. package/dist/component/_generated/component.js.map +1 -0
  17. package/dist/component/_generated/dataModel.d.ts +46 -0
  18. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  19. package/dist/component/_generated/dataModel.js +11 -0
  20. package/dist/component/_generated/dataModel.js.map +1 -0
  21. package/{src → dist}/component/_generated/server.d.ts +10 -42
  22. package/dist/component/_generated/server.d.ts.map +1 -0
  23. package/dist/{commonjs/component → component}/_generated/server.js +9 -7
  24. package/dist/component/_generated/server.js.map +1 -0
  25. package/dist/{commonjs/component → component}/convex.config.d.ts +1 -1
  26. package/dist/component/convex.config.d.ts.map +1 -0
  27. package/dist/component/convex.config.js.map +1 -0
  28. package/dist/{commonjs/component → component}/public.d.ts +2 -2
  29. package/dist/component/public.d.ts.map +1 -0
  30. package/dist/{commonjs/component → component}/public.js +9 -8
  31. package/dist/component/public.js.map +1 -0
  32. package/dist/{commonjs/component → component}/schema.d.ts +2 -2
  33. package/dist/component/schema.d.ts.map +1 -0
  34. package/dist/{commonjs/component → component}/schema.js +3 -3
  35. package/dist/component/schema.js.map +1 -0
  36. package/package.json +60 -41
  37. package/src/client/index.ts +10 -10
  38. package/src/client/utils.ts +0 -32
  39. package/src/component/_generated/api.ts +50 -0
  40. package/src/component/_generated/component.ts +79 -0
  41. package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +1 -5
  42. package/src/component/_generated/server.ts +156 -0
  43. package/src/component/public.ts +26 -19
  44. package/src/component/schema.ts +1 -1
  45. package/src/test.ts +18 -0
  46. package/dist/commonjs/client/index.d.ts.map +0 -1
  47. package/dist/commonjs/client/index.js.map +0 -1
  48. package/dist/commonjs/client/utils.d.ts +0 -15
  49. package/dist/commonjs/client/utils.d.ts.map +0 -1
  50. package/dist/commonjs/client/utils.js +0 -3
  51. package/dist/commonjs/component/_generated/api.d.ts +0 -12
  52. package/dist/commonjs/component/_generated/api.d.ts.map +0 -1
  53. package/dist/commonjs/component/_generated/api.js +0 -24
  54. package/dist/commonjs/component/_generated/api.js.map +0 -1
  55. package/dist/commonjs/component/_generated/server.d.ts +0 -64
  56. package/dist/commonjs/component/_generated/server.d.ts.map +0 -1
  57. package/dist/commonjs/component/_generated/server.js.map +0 -1
  58. package/dist/commonjs/component/convex.config.d.ts.map +0 -1
  59. package/dist/commonjs/component/convex.config.js.map +0 -1
  60. package/dist/commonjs/component/public.d.ts.map +0 -1
  61. package/dist/commonjs/component/public.js.map +0 -1
  62. package/dist/commonjs/component/schema.d.ts.map +0 -1
  63. package/dist/commonjs/component/schema.js.map +0 -1
  64. package/dist/commonjs/package.json +0 -3
  65. package/dist/esm/client/index.d.ts +0 -89
  66. package/dist/esm/client/index.d.ts.map +0 -1
  67. package/dist/esm/client/index.js +0 -104
  68. package/dist/esm/client/index.js.map +0 -1
  69. package/dist/esm/client/utils.d.ts +0 -15
  70. package/dist/esm/client/utils.d.ts.map +0 -1
  71. package/dist/esm/client/utils.js +0 -3
  72. package/dist/esm/client/utils.js.map +0 -1
  73. package/dist/esm/component/_generated/api.d.ts +0 -12
  74. package/dist/esm/component/_generated/api.d.ts.map +0 -1
  75. package/dist/esm/component/_generated/api.js +0 -24
  76. package/dist/esm/component/_generated/api.js.map +0 -1
  77. package/dist/esm/component/_generated/server.d.ts +0 -64
  78. package/dist/esm/component/_generated/server.d.ts.map +0 -1
  79. package/dist/esm/component/_generated/server.js +0 -76
  80. package/dist/esm/component/_generated/server.js.map +0 -1
  81. package/dist/esm/component/convex.config.d.ts +0 -3
  82. package/dist/esm/component/convex.config.d.ts.map +0 -1
  83. package/dist/esm/component/convex.config.js +0 -3
  84. package/dist/esm/component/convex.config.js.map +0 -1
  85. package/dist/esm/component/public.d.ts +0 -119
  86. package/dist/esm/component/public.d.ts.map +0 -1
  87. package/dist/esm/component/public.js +0 -226
  88. package/dist/esm/component/public.js.map +0 -1
  89. package/dist/esm/component/schema.d.ts +0 -49
  90. package/dist/esm/component/schema.d.ts.map +0 -1
  91. package/dist/esm/component/schema.js +0 -21
  92. package/dist/esm/component/schema.js.map +0 -1
  93. package/dist/esm/package.json +0 -3
  94. package/src/component/_generated/api.d.ts +0 -98
  95. package/src/component/_generated/server.js +0 -94
  96. /package/dist/{commonjs/client → client}/index.js +0 -0
  97. /package/dist/{commonjs/component → component}/convex.config.js +0 -0
@@ -0,0 +1,156 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated utilities for implementing server-side Convex query and mutation functions.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type {
12
+ ActionBuilder,
13
+ HttpActionBuilder,
14
+ MutationBuilder,
15
+ QueryBuilder,
16
+ GenericActionCtx,
17
+ GenericMutationCtx,
18
+ GenericQueryCtx,
19
+ GenericDatabaseReader,
20
+ GenericDatabaseWriter,
21
+ } from "convex/server";
22
+ import {
23
+ actionGeneric,
24
+ httpActionGeneric,
25
+ queryGeneric,
26
+ mutationGeneric,
27
+ internalActionGeneric,
28
+ internalMutationGeneric,
29
+ internalQueryGeneric,
30
+ } from "convex/server";
31
+ import type { DataModel } from "./dataModel.js";
32
+
33
+ /**
34
+ * Define a query in this Convex app's public API.
35
+ *
36
+ * This function will be allowed to read your Convex database and will be accessible from the client.
37
+ *
38
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
39
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
40
+ */
41
+ export const query: QueryBuilder<DataModel, "public"> = queryGeneric;
42
+
43
+ /**
44
+ * Define a query that is only accessible from other Convex functions (but not from the client).
45
+ *
46
+ * This function will be allowed to read from your Convex database. It will not be accessible from the client.
47
+ *
48
+ * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
49
+ * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
50
+ */
51
+ export const internalQuery: QueryBuilder<DataModel, "internal"> =
52
+ internalQueryGeneric;
53
+
54
+ /**
55
+ * Define a mutation in this Convex app's public API.
56
+ *
57
+ * This function will be allowed to modify your Convex database and will be accessible from the client.
58
+ *
59
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
60
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
61
+ */
62
+ export const mutation: MutationBuilder<DataModel, "public"> = mutationGeneric;
63
+
64
+ /**
65
+ * Define a mutation that is only accessible from other Convex functions (but not from the client).
66
+ *
67
+ * This function will be allowed to modify your Convex database. It will not be accessible from the client.
68
+ *
69
+ * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
70
+ * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
71
+ */
72
+ export const internalMutation: MutationBuilder<DataModel, "internal"> =
73
+ internalMutationGeneric;
74
+
75
+ /**
76
+ * Define an action in this Convex app's public API.
77
+ *
78
+ * An action is a function which can execute any JavaScript code, including non-deterministic
79
+ * code and code with side-effects, like calling third-party services.
80
+ * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
81
+ * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
82
+ *
83
+ * @param func - The action. It receives an {@link ActionCtx} as its first argument.
84
+ * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
85
+ */
86
+ export const action: ActionBuilder<DataModel, "public"> = actionGeneric;
87
+
88
+ /**
89
+ * Define an action that is only accessible from other Convex functions (but not from the client).
90
+ *
91
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument.
92
+ * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
93
+ */
94
+ export const internalAction: ActionBuilder<DataModel, "internal"> =
95
+ internalActionGeneric;
96
+
97
+ /**
98
+ * Define an HTTP action.
99
+ *
100
+ * The wrapped function will be used to respond to HTTP requests received
101
+ * by a Convex deployment if the requests matches the path and method where
102
+ * this action is routed. Be sure to route your httpAction in `convex/http.js`.
103
+ *
104
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument
105
+ * and a Fetch API `Request` object as its second.
106
+ * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
107
+ */
108
+ export const httpAction: HttpActionBuilder = httpActionGeneric;
109
+
110
+ /**
111
+ * A set of services for use within Convex query functions.
112
+ *
113
+ * The query context is passed as the first argument to any Convex query
114
+ * function run on the server.
115
+ *
116
+ * If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
117
+ */
118
+ export type QueryCtx = GenericQueryCtx<DataModel>;
119
+
120
+ /**
121
+ * A set of services for use within Convex mutation functions.
122
+ *
123
+ * The mutation context is passed as the first argument to any Convex mutation
124
+ * function run on the server.
125
+ *
126
+ * If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
127
+ */
128
+ export type MutationCtx = GenericMutationCtx<DataModel>;
129
+
130
+ /**
131
+ * A set of services for use within Convex action functions.
132
+ *
133
+ * The action context is passed as the first argument to any Convex action
134
+ * function run on the server.
135
+ */
136
+ export type ActionCtx = GenericActionCtx<DataModel>;
137
+
138
+ /**
139
+ * An interface to read from the database within Convex query functions.
140
+ *
141
+ * The two entry points are {@link DatabaseReader.get}, which fetches a single
142
+ * document by its {@link Id}, or {@link DatabaseReader.query}, which starts
143
+ * building a query.
144
+ */
145
+ export type DatabaseReader = GenericDatabaseReader<DataModel>;
146
+
147
+ /**
148
+ * An interface to read from and write to the database within Convex mutation
149
+ * functions.
150
+ *
151
+ * Convex guarantees that all writes within a single mutation are
152
+ * executed atomically, so you never have to worry about partial writes leaving
153
+ * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
154
+ * for the guarantees Convex provides your functions.
155
+ */
156
+ export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
@@ -2,16 +2,16 @@
2
2
  //
3
3
  // See ../client/index.ts for the public API.
4
4
 
5
- import { FunctionHandle } from "convex/server";
5
+ import type { FunctionHandle } from "convex/server";
6
6
  import { v } from "convex/values";
7
7
  import {
8
- MutationCtx,
8
+ type MutationCtx,
9
9
  mutation,
10
10
  query,
11
11
  internalMutation,
12
12
  } from "./_generated/server.js";
13
13
  import { internal } from "./_generated/api.js";
14
- import { Doc, Id } from "./_generated/dataModel.js";
14
+ import type { Doc, Id } from "./_generated/dataModel.js";
15
15
  import parser from "cron-parser";
16
16
  import schema from "./schema.js";
17
17
 
@@ -99,7 +99,7 @@ export const register = mutation({
99
99
  schedule,
100
100
  });
101
101
  console.log(
102
- `Scheduling cron "${name}" (${id}) on schedule ${JSON.stringify(schedule)}`
102
+ `Scheduling cron "${name}" (${id}) on schedule ${JSON.stringify(schedule)}`,
103
103
  );
104
104
 
105
105
  await scheduleNextRun(ctx, id, new Date(), schedule);
@@ -124,15 +124,15 @@ async function scheduleNextRun(
124
124
  ctx: MutationCtx,
125
125
  id: Id<"crons">,
126
126
  lastScheduled: Date,
127
- schedule: Schedule
127
+ schedule: Schedule,
128
128
  ) {
129
129
  const nextRun = calculateNextRun(lastScheduled, schedule);
130
130
  const schedulerJobId = await ctx.scheduler.runAt(
131
131
  nextRun,
132
132
  internal.public.rescheduler,
133
- { id }
133
+ { id },
134
134
  );
135
- await ctx.db.patch(id, { schedulerJobId });
135
+ await ctx.db.patch("crons", id, { schedulerJobId });
136
136
  }
137
137
 
138
138
  function calculateNextRun(lastScheduled: Date, schedule: Schedule): Date {
@@ -177,14 +177,14 @@ export const get = query({
177
177
  args: {
178
178
  identifier: v.union(
179
179
  v.object({ id: v.id("crons") }),
180
- v.object({ name: v.string() })
180
+ v.object({ name: v.string() }),
181
181
  ),
182
182
  },
183
183
  returns: v.union(cronInfoValidator, v.null()),
184
184
  handler: async (ctx, { identifier }) => {
185
185
  const cron =
186
186
  "id" in identifier
187
- ? await ctx.db.get(identifier.id)
187
+ ? await ctx.db.get("crons", identifier.id)
188
188
  : await ctx.db
189
189
  .query("crons")
190
190
  .withIndex("name", (q) => q.eq("name", identifier.name))
@@ -209,14 +209,14 @@ export const del = mutation({
209
209
  args: {
210
210
  identifier: v.union(
211
211
  v.object({ id: v.id("crons") }),
212
- v.object({ name: v.string() })
212
+ v.object({ name: v.string() }),
213
213
  ),
214
214
  },
215
215
  returns: v.null(),
216
216
  handler: async (ctx, { identifier }) => {
217
217
  let cron: Doc<"crons"> | null;
218
218
  if ("id" in identifier) {
219
- cron = await ctx.db.get(identifier.id);
219
+ cron = await ctx.db.get("crons", identifier.id);
220
220
  if (!cron) {
221
221
  throw new Error(`Cron ${identifier.id} not found`);
222
222
  }
@@ -239,7 +239,7 @@ export const del = mutation({
239
239
  await ctx.scheduler.cancel(cron.executionJobId);
240
240
  }
241
241
  console.log(`Deleting cron ${cron._id}`);
242
- await ctx.db.delete(cron._id);
242
+ await ctx.db.delete("crons", cron._id);
243
243
  },
244
244
  });
245
245
 
@@ -257,7 +257,7 @@ export const rescheduler = internalMutation({
257
257
  returns: v.null(),
258
258
  handler: async (ctx, { id }) => {
259
259
  // Cron job is the logical concept we're rescheduling repeatedly.
260
- const cronJob = await ctx.db.get(id);
260
+ const cronJob = await ctx.db.get("crons", id);
261
261
  if (!cronJob) {
262
262
  throw Error(`Cron ${id} not found`);
263
263
  }
@@ -267,7 +267,10 @@ export const rescheduler = internalMutation({
267
267
 
268
268
  // Scheduler job is the job that's running right now, that we use to trigger
269
269
  // repeated executions.
270
- const schedulerJob = await ctx.db.system.get(cronJob.schedulerJobId);
270
+ const schedulerJob = await ctx.db.system.get(
271
+ "_scheduled_functions",
272
+ cronJob.schedulerJobId,
273
+ );
271
274
  if (!schedulerJob) {
272
275
  throw Error(`Scheduler job ${cronJob.schedulerJobId} not found`);
273
276
  }
@@ -276,14 +279,17 @@ export const rescheduler = internalMutation({
276
279
  schedulerJob.state.kind !== "inProgress"
277
280
  ) {
278
281
  throw Error(
279
- `We are running in job ${schedulerJob._id} but state is ${schedulerJob.state.kind}`
282
+ `We are running in job ${schedulerJob._id} but state is ${schedulerJob.state.kind}`,
280
283
  );
281
284
  }
282
285
 
283
286
  // Execution job is the previous job used to actually do the work of the cron.
284
287
  let stillRunning = false;
285
288
  if (cronJob.executionJobId) {
286
- const executionJob = await ctx.db.system.get(cronJob.executionJobId);
289
+ const executionJob = await ctx.db.system.get(
290
+ "_scheduled_functions",
291
+ cronJob.executionJobId,
292
+ );
287
293
  if (
288
294
  executionJob &&
289
295
  (executionJob.state.kind === "pending" ||
@@ -296,18 +302,19 @@ export const rescheduler = internalMutation({
296
302
  console.log(`Cron ${cronJob._id} still running, skipping this run.`);
297
303
  } else {
298
304
  console.log(`Running cron ${cronJob._id}.`);
299
- await ctx.scheduler.runAfter(
305
+ const executionJobId = await ctx.scheduler.runAfter(
300
306
  0,
301
307
  cronJob.functionHandle as FunctionHandle<"mutation" | "action">,
302
- cronJob.args
308
+ cronJob.args,
303
309
  );
310
+ await ctx.db.patch("crons", id, { executionJobId });
304
311
  }
305
312
 
306
313
  await scheduleNextRun(
307
314
  ctx,
308
315
  id,
309
316
  new Date(schedulerJob.scheduledTime),
310
- cronJob.schedule
317
+ cronJob.schedule,
311
318
  );
312
319
  },
313
320
  });
@@ -16,7 +16,7 @@ export default defineSchema({
16
16
  kind: v.literal("cron"),
17
17
  cronspec: v.string(), // "* * * * *"
18
18
  tz: v.optional(v.string()), // optional timezone, e.g. "America/New_York"
19
- })
19
+ }),
20
20
  ),
21
21
  schedulerJobId: v.optional(v.id("_scheduled_functions")), // job to wait for the next execution
22
22
  executionJobId: v.optional(v.id("_scheduled_functions")), // async job to run the function
package/src/test.ts ADDED
@@ -0,0 +1,18 @@
1
+ /// <reference types="vite/client" />
2
+ import type { TestConvex } from "convex-test";
3
+ import type { GenericSchema, SchemaDefinition } from "convex/server";
4
+ import schema from "./component/schema.js";
5
+ const modules = import.meta.glob("./component/**/*.ts");
6
+
7
+ /**
8
+ * Register the component with the test convex instance.
9
+ * @param t - The test convex instance, e.g. from calling `convexTest`.
10
+ * @param name - The name of the component, as registered in convex.config.ts.
11
+ */
12
+ export function register(
13
+ t: TestConvex<SchemaDefinition<GenericSchema, boolean>>,
14
+ name: string = "crons",
15
+ ) {
16
+ t.registerComponent(name, schema, modules);
17
+ }
18
+ export default { register, schema, modules };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EAEZ,4BAA4B,EAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjE,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,qBAAa,KAAK;IAwCJ,OAAO,CAAC,SAAS;IAvC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;gBACiB,SAAS,EAAE,MAAM,CAAC,OAAO,GAAG,CAAC;IAEjD;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,CAAC,SAAS,4BAA4B,EACnD,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAA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C,GAAgB;QACzB,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC1B,GAAG,IAAI;YACP,cAAc,EAAE,IAAI,CAAC,cAEpB;SACF,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG,CACP,GAAgB,EAChB,UAA6C;QAE7C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;QAC3E,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,OAAO,IAAI,CAAC;SACb;QACD,OAAO;YACL,GAAG,IAAI;YACP,cAAc,EAAE,IAAI,CAAC,cAEpB;SACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CACV,GAAmB,EACnB,UAA6C;QAE7C,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACpE,CAAC;CACF"}
@@ -1,15 +0,0 @@
1
- import type { Expand, FunctionReference, GenericDataModel, GenericMutationCtx, GenericQueryCtx } from "convex/server";
2
- import type { GenericId } from "convex/values";
3
- export type RunQueryCtx = {
4
- runQuery: GenericQueryCtx<GenericDataModel>["runQuery"];
5
- };
6
- export type RunMutationCtx = {
7
- runMutation: GenericMutationCtx<GenericDataModel>["runMutation"];
8
- };
9
- export type OpaqueIds<T> = T extends GenericId<infer _T> ? string : T extends (infer U)[] ? OpaqueIds<U>[] : T extends object ? {
10
- [K in keyof T]: OpaqueIds<T[K]>;
11
- } : T;
12
- export type UseApi<API> = Expand<{
13
- [mod in keyof API]: API[mod] extends FunctionReference<infer FType, "public", infer FArgs, infer FReturnType, infer FComponentPath> ? FunctionReference<FType, "internal", OpaqueIds<FArgs>, OpaqueIds<FReturnType>, FComponentPath> : UseApi<API[mod]>;
14
- }>;
15
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/client/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;CACzD,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,aAAa,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,IACrB,CAAC,SAAS,SAAS,CAAC,MAAM,EAAE,CAAC,GACzB,MAAM,GACN,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GACnB,SAAS,CAAC,CAAC,CAAC,EAAE,GACd,CAAC,SAAS,MAAM,GACd;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACnC,CAAC,CAAC;AAEZ,MAAM,MAAM,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC;KAC9B,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,iBAAiB,CACpD,MAAM,KAAK,EACX,QAAQ,EACR,MAAM,KAAK,EACX,MAAM,WAAW,EACjB,MAAM,cAAc,CACrB,GACG,iBAAiB,CACf,KAAK,EACL,UAAU,EACV,SAAS,CAAC,KAAK,CAAC,EAChB,SAAS,CAAC,WAAW,CAAC,EACtB,cAAc,CACf,GACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACrB,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- // Type utilities for component clients.
2
- export {};
3
- //# sourceMappingURL=utils.js.map
@@ -1,12 +0,0 @@
1
- /**
2
- * A utility for referencing Convex functions in your app's API.
3
- *
4
- * Usage:
5
- * ```js
6
- * const myFunctionReference = api.myModule.myFunction;
7
- * ```
8
- */
9
- export const api: import("convex/server").AnyApi;
10
- export const internal: import("convex/server").AnyApi;
11
- export const components: import("convex/server").AnyChildComponents;
12
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/component/_generated/api.js"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AACH,iDAA0B;AAC1B,sDAA+B;AAC/B,oEAA8C"}
@@ -1,24 +0,0 @@
1
- /* prettier-ignore-start */
2
- /* eslint-disable */
3
- /**
4
- * Generated `api` utility.
5
- *
6
- * THIS CODE IS AUTOMATICALLY GENERATED.
7
- *
8
- * To regenerate, run `npx convex dev`.
9
- * @module
10
- */
11
- import { anyApi, componentsGeneric } from "convex/server";
12
- /**
13
- * A utility for referencing Convex functions in your app's API.
14
- *
15
- * Usage:
16
- * ```js
17
- * const myFunctionReference = api.myModule.myFunction;
18
- * ```
19
- */
20
- export const api = anyApi;
21
- export const internal = anyApi;
22
- export const components = componentsGeneric();
23
- /* prettier-ignore-end */
24
- //# sourceMappingURL=api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/component/_generated/api.js"],"names":[],"mappings":"AAAA,2BAA2B;AAE3B,oBAAoB;AACpB;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC;AAC1B,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC/B,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;AAE9C,yBAAyB"}
@@ -1,64 +0,0 @@
1
- /**
2
- * Define a query in this Convex app's public API.
3
- *
4
- * This function will be allowed to read your Convex database and will be accessible from the client.
5
- *
6
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
7
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
8
- */
9
- export const query: import("convex/server").QueryBuilder<any, "public">;
10
- /**
11
- * Define a query that is only accessible from other Convex functions (but not from the client).
12
- *
13
- * This function will be allowed to read from your Convex database. It will not be accessible from the client.
14
- *
15
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
16
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
17
- */
18
- export const internalQuery: import("convex/server").QueryBuilder<any, "internal">;
19
- /**
20
- * Define a mutation in this Convex app's public API.
21
- *
22
- * This function will be allowed to modify your Convex database and will be accessible from the client.
23
- *
24
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
25
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
26
- */
27
- export const mutation: import("convex/server").MutationBuilder<any, "public">;
28
- /**
29
- * Define a mutation that is only accessible from other Convex functions (but not from the client).
30
- *
31
- * This function will be allowed to modify your Convex database. It will not be accessible from the client.
32
- *
33
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
34
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
35
- */
36
- export const internalMutation: import("convex/server").MutationBuilder<any, "internal">;
37
- /**
38
- * Define an action in this Convex app's public API.
39
- *
40
- * An action is a function which can execute any JavaScript code, including non-deterministic
41
- * code and code with side-effects, like calling third-party services.
42
- * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
43
- * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
44
- *
45
- * @param func - The action. It receives an {@link ActionCtx} as its first argument.
46
- * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
47
- */
48
- export const action: import("convex/server").ActionBuilder<any, "public">;
49
- /**
50
- * Define an action that is only accessible from other Convex functions (but not from the client).
51
- *
52
- * @param func - The function. It receives an {@link ActionCtx} as its first argument.
53
- * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
54
- */
55
- export const internalAction: import("convex/server").ActionBuilder<any, "internal">;
56
- /**
57
- * Define a Convex HTTP action.
58
- *
59
- * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object
60
- * as its second.
61
- * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
62
- */
63
- export const httpAction: (func: (ctx: import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, request: Request) => Promise<Response>) => import("convex/server").PublicHttpAction;
64
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/component/_generated/server.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,wEAAkC;AAElC;;;;;;;GAOG;AACH,kFAAkD;AAElD;;;;;;;GAOG;AACH,8EAAwC;AAExC;;;;;;;GAOG;AACH,wFAAwD;AAExD;;;;;;;;;;GAUG;AACH,0EAAoC;AAEpC;;;;;GAKG;AACH,oFAAoD;AAEpD;;;;;;GAMG;AACH,8MAA4C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../src/component/_generated/server.js"],"names":[],"mappings":"AAAA,2BAA2B;AAE3B,oBAAoB;AACpB;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE5C,yBAAyB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../../src/component/convex.config.ts"],"names":[],"mappings":";AAEA,wBAAwC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAe,eAAe,CAAC,OAAO,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/component/public.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAc/C,MAAM,MAAM,QAAQ,GAChB;IACE,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,GACD;IACE,oDAAoD;IACpD,IAAI,EAAE,UAAU,CAAC;IACjB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAGN,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,cAAc,CAAC,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cAAc,CAAC,CAAC;YACrE,IACE,YAAY;gBACZ,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;oBACpC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,EAC3C;gBACA,YAAY,GAAG,IAAI,CAAC;aACrB;SACF;QACD,IAAI,YAAY,EAAE;YAChB,OAAO,CAAC,GAAG,CAAC,QAAQ,OAAO,CAAC,GAAG,oCAAoC,CAAC,CAAC;SACtE;aAAM;YACL,OAAO,CAAC,GAAG,CAAC,gBAAgB,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;YAC5C,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,CAC1B,CAAC,EACD,OAAO,CAAC,cAAuD,EAC/D,OAAO,CAAC,IAAI,CACb,CAAC;SACH;QAED,MAAM,eAAe,CACnB,GAAG,EACH,EAAE,EACF,IAAI,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EACpC,OAAO,CAAC,QAAQ,CACjB,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAoBG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,eAAe,YAAY,CAAC;IAC1B,oBAAoB;IACpB,KAAK,EAAE,WAAW,CAAC;QACjB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;QACnC,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;YAC3B,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,eAAe;SACjC,CAAC,EACF,CAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;YACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;YACpB,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,6CAA6C;SAC1E,CAAC,CACH;QACD,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC;QACxD,cAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,gCAAgC;KAC3F,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;CAC3B,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,89 +0,0 @@
1
- import { FunctionArgs, SchedulableFunctionReference } from "convex/server";
2
- import { api } from "../component/_generated/api.js";
3
- import { CronInfo, Schedule } from "../component/public.js";
4
- import { RunMutationCtx, RunQueryCtx, UseApi } from "./utils.js";
5
- export type { CronInfo };
6
- export declare class Crons {
7
- private component;
8
- /**
9
- * Implementation of crons in user space.
10
- *
11
- * Supports intervals in ms as well as cron schedules with the same format as
12
- * the unix `cron` command:
13
- *
14
- * ```
15
- * * * * * * *
16
- * ┬ ┬ ┬ ┬ ┬ ┬
17
- * │ │ │ │ │ |
18
- * │ │ │ │ │ └── day of week (0 - 7, 1L - 7L) (0 or 7 is Sun)
19
- * │ │ │ │ └───── month (1 - 12)
20
- * │ │ │ └──────── day of month (1 - 31, L)
21
- * │ │ └─────────── hour (0 - 23)
22
- * │ └────────────── minute (0 - 59)
23
- * └───────────────── second (0 - 59, optional)
24
- * ```
25
- *
26
- * Crons can be registered at runtime via the `register` function.
27
- *
28
- * If you'd like to statically define cronjobs like in the built-in `crons.ts`
29
- * Convex feature you can do so via an init script that idempotently registers a
30
- * cron with a given name. e.g., in an `init.ts` file that gets run on every
31
- * deploy via `convex dev --run init`:
32
- *
33
- * ```ts
34
- * const crons = new Crons(components.crons);
35
- * ...
36
- * if ((await crons.get(ctx, { name: "daily" })) === null) {
37
- * await crons.register(
38
- * ctx,
39
- * { kind: "cron", cronspec: "0 0 * * *" },
40
- * internal.example.logStuff,
41
- * { message: "daily cron" },
42
- * "daily"
43
- * );
44
- * }
45
- * ```
46
- */
47
- constructor(component: UseApi<typeof api>);
48
- /**
49
- * Schedule a mutation or action to run on a cron schedule or interval.
50
- *
51
- * @param ctx - The mutation context from the calling Convex mutation.
52
- * @param schedule - Either a cron specification string or an interval in
53
- * milliseconds. For intervals, ms must be >= 1000.
54
- * @param func - A function reference to the mutation or action to schedule.
55
- * @param args - The arguments to the function.
56
- * @param name - Optional unique name for the cron. Will throw if a name is
57
- * provided and a cron with the same name already exists.
58
- * @returns A string identifier for the cron job.
59
- */
60
- register<F extends SchedulableFunctionReference>(ctx: RunMutationCtx, schedule: Schedule, func: F, args: FunctionArgs<F>, name?: string): Promise<string>;
61
- /**
62
- * List all user space cron jobs.
63
- *
64
- * @returns List of `cron` table rows.
65
- */
66
- list(ctx: RunQueryCtx): Promise<CronInfo[]>;
67
- /**
68
- * Get an existing cron job by id or name.
69
- *
70
- * @param identifier - Either the ID or name of the cron job.
71
- * @returns Cron job document.
72
- */
73
- get(ctx: RunQueryCtx, identifier: {
74
- id: string;
75
- } | {
76
- name: string;
77
- }): Promise<CronInfo | null>;
78
- /**
79
- * Delete and deschedule a cron job by id or name.
80
- *
81
- * @param identifier - Either the ID or name of the cron job.
82
- */
83
- delete(ctx: RunMutationCtx, identifier: {
84
- id: string;
85
- } | {
86
- name: string;
87
- }): Promise<null>;
88
- }
89
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EAEZ,4BAA4B,EAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjE,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB,qBAAa,KAAK;IAwCJ,OAAO,CAAC,SAAS;IAvC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;gBACiB,SAAS,EAAE,MAAM,CAAC,OAAO,GAAG,CAAC;IAEjD;;;;;;;;;;;OAWG;IACG,QAAQ,CAAC,CAAC,SAAS,4BAA4B,EACnD,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EACrB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC;IASlB;;;;OAIG;IACG,IAAI,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUjD;;;;;OAKG;IACG,GAAG,CACP,GAAG,EAAE,WAAW,EAChB,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAa3B;;;;OAIG;IACG,MAAM,CACV,GAAG,EAAE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