@convex-dev/crons 0.1.9 → 0.2.0

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/component/convex.config.d.ts.map +1 -0
  26. package/dist/component/convex.config.js.map +1 -0
  27. package/dist/{commonjs/component → component}/public.d.ts +2 -2
  28. package/dist/component/public.d.ts.map +1 -0
  29. package/dist/component/public.js.map +1 -0
  30. package/dist/{commonjs/component → component}/schema.d.ts +2 -2
  31. package/dist/component/schema.d.ts.map +1 -0
  32. package/dist/{commonjs/component → component}/schema.js +3 -3
  33. package/dist/component/schema.js.map +1 -0
  34. package/package.json +56 -37
  35. package/src/client/index.ts +10 -10
  36. package/src/client/utils.ts +0 -32
  37. package/src/component/_generated/api.ts +50 -0
  38. package/src/component/_generated/component.ts +79 -0
  39. package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -4
  40. package/src/component/_generated/server.ts +161 -0
  41. package/src/component/public.ts +11 -11
  42. package/src/component/schema.ts +1 -1
  43. package/src/test.ts +18 -0
  44. package/dist/commonjs/client/index.d.ts.map +0 -1
  45. package/dist/commonjs/client/index.js.map +0 -1
  46. package/dist/commonjs/client/utils.d.ts +0 -15
  47. package/dist/commonjs/client/utils.d.ts.map +0 -1
  48. package/dist/commonjs/client/utils.js +0 -3
  49. package/dist/commonjs/component/_generated/api.d.ts +0 -12
  50. package/dist/commonjs/component/_generated/api.d.ts.map +0 -1
  51. package/dist/commonjs/component/_generated/api.js +0 -24
  52. package/dist/commonjs/component/_generated/api.js.map +0 -1
  53. package/dist/commonjs/component/_generated/server.d.ts +0 -64
  54. package/dist/commonjs/component/_generated/server.d.ts.map +0 -1
  55. package/dist/commonjs/component/_generated/server.js.map +0 -1
  56. package/dist/commonjs/component/convex.config.d.ts.map +0 -1
  57. package/dist/commonjs/component/convex.config.js.map +0 -1
  58. package/dist/commonjs/component/public.d.ts.map +0 -1
  59. package/dist/commonjs/component/public.js.map +0 -1
  60. package/dist/commonjs/component/schema.d.ts.map +0 -1
  61. package/dist/commonjs/component/schema.js.map +0 -1
  62. package/dist/commonjs/package.json +0 -3
  63. package/dist/esm/client/index.d.ts +0 -89
  64. package/dist/esm/client/index.d.ts.map +0 -1
  65. package/dist/esm/client/index.js +0 -104
  66. package/dist/esm/client/index.js.map +0 -1
  67. package/dist/esm/client/utils.d.ts +0 -15
  68. package/dist/esm/client/utils.d.ts.map +0 -1
  69. package/dist/esm/client/utils.js +0 -3
  70. package/dist/esm/client/utils.js.map +0 -1
  71. package/dist/esm/component/_generated/api.d.ts +0 -12
  72. package/dist/esm/component/_generated/api.d.ts.map +0 -1
  73. package/dist/esm/component/_generated/api.js +0 -24
  74. package/dist/esm/component/_generated/api.js.map +0 -1
  75. package/dist/esm/component/_generated/server.d.ts +0 -64
  76. package/dist/esm/component/_generated/server.d.ts.map +0 -1
  77. package/dist/esm/component/_generated/server.js +0 -76
  78. package/dist/esm/component/_generated/server.js.map +0 -1
  79. package/dist/esm/component/convex.config.d.ts +0 -3
  80. package/dist/esm/component/convex.config.d.ts.map +0 -1
  81. package/dist/esm/component/convex.config.js +0 -3
  82. package/dist/esm/component/convex.config.js.map +0 -1
  83. package/dist/esm/component/public.d.ts +0 -119
  84. package/dist/esm/component/public.d.ts.map +0 -1
  85. package/dist/esm/component/public.js +0 -226
  86. package/dist/esm/component/public.js.map +0 -1
  87. package/dist/esm/component/schema.d.ts +0 -49
  88. package/dist/esm/component/schema.d.ts.map +0 -1
  89. package/dist/esm/component/schema.js +0 -21
  90. package/dist/esm/component/schema.js.map +0 -1
  91. package/dist/esm/package.json +0 -3
  92. package/src/component/_generated/api.d.ts +0 -98
  93. package/src/component/_generated/server.js +0 -94
  94. /package/dist/{commonjs/client → client}/index.js +0 -0
  95. /package/dist/{commonjs/component → component}/convex.config.d.ts +0 -0
  96. /package/dist/{commonjs/component → component}/convex.config.js +0 -0
  97. /package/dist/{commonjs/component → component}/public.js +0 -0
@@ -1,76 +0,0 @@
1
- /* prettier-ignore-start */
2
- /* eslint-disable */
3
- /**
4
- * Generated utilities for implementing server-side Convex query and mutation functions.
5
- *
6
- * THIS CODE IS AUTOMATICALLY GENERATED.
7
- *
8
- * To regenerate, run `npx convex dev`.
9
- * @module
10
- */
11
- import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, componentsGeneric, } from "convex/server";
12
- /**
13
- * Define a query in this Convex app's public API.
14
- *
15
- * This function will be allowed to read your Convex database and will be accessible from the client.
16
- *
17
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
18
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
19
- */
20
- export const query = queryGeneric;
21
- /**
22
- * Define a query that is only accessible from other Convex functions (but not from the client).
23
- *
24
- * This function will be allowed to read from your Convex database. It will not be accessible from the client.
25
- *
26
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
27
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
28
- */
29
- export const internalQuery = internalQueryGeneric;
30
- /**
31
- * Define a mutation in this Convex app's public API.
32
- *
33
- * This function will be allowed to modify your Convex database and will be accessible from the client.
34
- *
35
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
36
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
37
- */
38
- export const mutation = mutationGeneric;
39
- /**
40
- * Define a mutation that is only accessible from other Convex functions (but not from the client).
41
- *
42
- * This function will be allowed to modify your Convex database. It will not be accessible from the client.
43
- *
44
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
45
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
46
- */
47
- export const internalMutation = internalMutationGeneric;
48
- /**
49
- * Define an action in this Convex app's public API.
50
- *
51
- * An action is a function which can execute any JavaScript code, including non-deterministic
52
- * code and code with side-effects, like calling third-party services.
53
- * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
54
- * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
55
- *
56
- * @param func - The action. It receives an {@link ActionCtx} as its first argument.
57
- * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
58
- */
59
- export const action = actionGeneric;
60
- /**
61
- * Define an action that is only accessible from other Convex functions (but not from the client).
62
- *
63
- * @param func - The function. It receives an {@link ActionCtx} as its first argument.
64
- * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
65
- */
66
- export const internalAction = internalActionGeneric;
67
- /**
68
- * Define a Convex HTTP action.
69
- *
70
- * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object
71
- * as its second.
72
- * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
73
- */
74
- export const httpAction = httpActionGeneric;
75
- /* prettier-ignore-end */
76
- //# sourceMappingURL=server.js.map
@@ -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,3 +0,0 @@
1
- declare const _default: import("convex/server").ComponentDefinition<any>;
2
- export default _default;
3
- //# sourceMappingURL=convex.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../../src/component/convex.config.ts"],"names":[],"mappings":";AAEA,wBAAwC"}
@@ -1,3 +0,0 @@
1
- import { defineComponent } from "convex/server";
2
- export default defineComponent("crons");
3
- //# sourceMappingURL=convex.config.js.map
@@ -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,119 +0,0 @@
1
- import { FunctionHandle } from "convex/server";
2
- export type Schedule = {
3
- /** A schedule using a cron specification string. */
4
- kind: "cron";
5
- /**
6
- * A cron specification string.
7
- * ```
8
- * * * * * * *
9
- * ┬ ┬ ┬ ┬ ┬ ┬
10
- * │ │ │ │ │ |
11
- * │ │ │ │ │ └── day of week (0 - 7, 1L - 7L) (0 or 7 is Sun)
12
- * │ │ │ │ └───── month (1 - 12)
13
- * │ │ │ └──────── day of month (1 - 31, L)
14
- * │ │ └─────────── hour (0 - 23)
15
- * │ └────────────── minute (0 - 59)
16
- * └───────────────── second (0 - 59, optional)
17
- * ```
18
- */
19
- cronspec: string;
20
- tz?: string;
21
- } | {
22
- /** A schedule using an interval in milliseconds. */
23
- kind: "interval";
24
- /** The interval in milliseconds. */
25
- ms: number;
26
- };
27
- export type CronInfo = {
28
- id: string;
29
- name?: string;
30
- functionHandle: FunctionHandle<"mutation" | "action">;
31
- args: Record<string, unknown>;
32
- schedule: Schedule;
33
- };
34
- /**
35
- * Schedule a mutation or action to run on a cron schedule or interval.
36
- *
37
- * @param name - Optional unique name for the job. Will throw if a name is
38
- * provided and a job with the same name already exists.
39
- * @param schedule - Either a cron specification string or an interval in
40
- * milliseconds. For intervals, ms must be >= 1000.
41
- * @param functionHandle - A {@link FunctionHandle} string for the function to
42
- * schedule.
43
- * @param args - The arguments to the function.
44
- * @returns The ID of the scheduled job.
45
- */
46
- export declare const register: import("convex/server").RegisteredMutation<"public", {
47
- name?: string | undefined;
48
- functionHandle: string;
49
- args: Record<string, any>;
50
- schedule: {
51
- kind: "interval";
52
- ms: number;
53
- } | {
54
- tz?: string | undefined;
55
- kind: "cron";
56
- cronspec: string;
57
- };
58
- }, Promise<import("convex/values").GenericId<"crons">>>;
59
- /**
60
- * List all user space cron jobs.
61
- *
62
- * @returns List of `cron` table rows.
63
- */
64
- export declare const list: import("convex/server").RegisteredQuery<"public", {}, Promise<{
65
- functionHandle: string;
66
- args: Record<string, any>;
67
- schedule: {
68
- kind: "interval";
69
- ms: number;
70
- } | {
71
- tz?: string | undefined;
72
- kind: "cron";
73
- cronspec: string;
74
- };
75
- name?: string | undefined;
76
- id: import("convex/values").GenericId<"crons">;
77
- }[]>>;
78
- /**
79
- * Get an existing cron job by id or name.
80
- *
81
- * @param identifier - Either the ID or name of the cron job.
82
- * @returns Cron job document or null if not found.
83
- */
84
- export declare const get: import("convex/server").RegisteredQuery<"public", {
85
- identifier: {
86
- id: import("convex/values").GenericId<"crons">;
87
- } | {
88
- name: string;
89
- };
90
- }, Promise<{
91
- functionHandle: string;
92
- args: Record<string, any>;
93
- schedule: {
94
- kind: "interval";
95
- ms: number;
96
- } | {
97
- tz?: string | undefined;
98
- kind: "cron";
99
- cronspec: string;
100
- };
101
- name?: string | undefined;
102
- id: import("convex/values").GenericId<"crons">;
103
- } | null>>;
104
- /**
105
- * Delete and deschedule a cron job by id or name.
106
- *
107
- * @param identifier - Either the ID or name of the cron job.
108
- */
109
- export declare const del: import("convex/server").RegisteredMutation<"public", {
110
- identifier: {
111
- id: import("convex/values").GenericId<"crons">;
112
- } | {
113
- name: string;
114
- };
115
- }, Promise<void>>;
116
- export declare const rescheduler: import("convex/server").RegisteredMutation<"internal", {
117
- id: import("convex/values").GenericId<"crons">;
118
- }, Promise<void>>;
119
- //# sourceMappingURL=public.d.ts.map
@@ -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,UAAU,GAAG,QAAQ,CAAC,CAAC;IACtD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AASF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;uDAiCnB,CAAC;AA0CH;;;;GAIG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;KAaf,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;UAyBd,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,GAAG;;;;;;iBAoCd,CAAC;AASH,eAAO,MAAM,WAAW;;iBA4DtB,CAAC"}
@@ -1,226 +0,0 @@
1
- // Implementation of crons in user space.
2
- //
3
- // See ../client/index.ts for the public API.
4
- import { v } from "convex/values";
5
- import { mutation, query, internalMutation, } from "./_generated/server.js";
6
- import { internal } from "./_generated/api.js";
7
- import parser from "cron-parser";
8
- import schema from "./schema.js";
9
- const scheduleValidator = schema.tables.crons.validator.fields.schedule;
10
- const cronInfoValidator = v.object({
11
- id: v.id("crons"),
12
- name: v.optional(v.string()),
13
- functionHandle: v.string(),
14
- args: v.record(v.string(), v.any()),
15
- schedule: scheduleValidator,
16
- });
17
- /**
18
- * Schedule a mutation or action to run on a cron schedule or interval.
19
- *
20
- * @param name - Optional unique name for the job. Will throw if a name is
21
- * provided and a job with the same name already exists.
22
- * @param schedule - Either a cron specification string or an interval in
23
- * milliseconds. For intervals, ms must be >= 1000.
24
- * @param functionHandle - A {@link FunctionHandle} string for the function to
25
- * schedule.
26
- * @param args - The arguments to the function.
27
- * @returns The ID of the scheduled job.
28
- */
29
- export const register = mutation({
30
- args: {
31
- name: v.optional(v.string()),
32
- schedule: scheduleValidator,
33
- functionHandle: v.string(),
34
- args: v.record(v.string(), v.any()),
35
- },
36
- returns: v.id("crons"),
37
- handler: async (ctx, { name, schedule, functionHandle, args }) => {
38
- if (name &&
39
- (await ctx.db
40
- .query("crons")
41
- .withIndex("name", (q) => q.eq("name", name))
42
- .unique())) {
43
- throw new Error(`Cron with name "${name}" already exists`);
44
- }
45
- validateSchedule(schedule);
46
- const id = await ctx.db.insert("crons", {
47
- functionHandle,
48
- args,
49
- name,
50
- schedule,
51
- });
52
- console.log(`Scheduling cron "${name}" (${id}) on schedule ${JSON.stringify(schedule)}`);
53
- await scheduleNextRun(ctx, id, new Date(), schedule);
54
- return id;
55
- },
56
- });
57
- function validateSchedule(schedule) {
58
- if (schedule.kind === "interval" && schedule.ms < 1000) {
59
- throw new Error("Interval must be >= 1000ms");
60
- }
61
- if (schedule.kind === "cron") {
62
- try {
63
- parser.parseExpression(schedule.cronspec, { tz: schedule.tz });
64
- }
65
- catch {
66
- throw new Error(`Invalid cronspec: "${schedule.cronspec}"`);
67
- }
68
- }
69
- }
70
- async function scheduleNextRun(ctx, id, lastScheduled, schedule) {
71
- const nextRun = calculateNextRun(lastScheduled, schedule);
72
- const schedulerJobId = await ctx.scheduler.runAt(nextRun, internal.public.rescheduler, { id });
73
- await ctx.db.patch(id, { schedulerJobId });
74
- }
75
- function calculateNextRun(lastScheduled, schedule) {
76
- if (schedule.kind === "interval") {
77
- return new Date(lastScheduled.getTime() + schedule.ms);
78
- }
79
- else {
80
- const cron = parser.parseExpression(schedule.cronspec, {
81
- currentDate: lastScheduled,
82
- tz: schedule.tz,
83
- });
84
- return cron.next().toDate();
85
- }
86
- }
87
- /**
88
- * List all user space cron jobs.
89
- *
90
- * @returns List of `cron` table rows.
91
- */
92
- export const list = query({
93
- args: {},
94
- returns: v.array(cronInfoValidator),
95
- handler: async (ctx) => {
96
- const crons = await ctx.db.query("crons").collect();
97
- return crons.map((cron) => ({
98
- id: cron._id,
99
- ...(cron.name && { name: cron.name }),
100
- functionHandle: cron.functionHandle,
101
- args: cron.args,
102
- schedule: cron.schedule,
103
- }));
104
- },
105
- });
106
- /**
107
- * Get an existing cron job by id or name.
108
- *
109
- * @param identifier - Either the ID or name of the cron job.
110
- * @returns Cron job document or null if not found.
111
- */
112
- export const get = query({
113
- args: {
114
- identifier: v.union(v.object({ id: v.id("crons") }), v.object({ name: v.string() })),
115
- },
116
- returns: v.union(cronInfoValidator, v.null()),
117
- handler: async (ctx, { identifier }) => {
118
- const cron = "id" in identifier
119
- ? await ctx.db.get(identifier.id)
120
- : await ctx.db
121
- .query("crons")
122
- .withIndex("name", (q) => q.eq("name", identifier.name))
123
- .unique();
124
- if (!cron)
125
- return null;
126
- return {
127
- id: cron._id,
128
- ...(cron.name && { name: cron.name }),
129
- functionHandle: cron.functionHandle,
130
- args: cron.args,
131
- schedule: cron.schedule,
132
- };
133
- },
134
- });
135
- /**
136
- * Delete and deschedule a cron job by id or name.
137
- *
138
- * @param identifier - Either the ID or name of the cron job.
139
- */
140
- export const del = mutation({
141
- args: {
142
- identifier: v.union(v.object({ id: v.id("crons") }), v.object({ name: v.string() })),
143
- },
144
- returns: v.null(),
145
- handler: async (ctx, { identifier }) => {
146
- let cron;
147
- if ("id" in identifier) {
148
- cron = await ctx.db.get(identifier.id);
149
- if (!cron) {
150
- throw new Error(`Cron ${identifier.id} not found`);
151
- }
152
- }
153
- else {
154
- cron = await ctx.db
155
- .query("crons")
156
- .withIndex("name", (q) => q.eq("name", identifier.name))
157
- .unique();
158
- if (!cron) {
159
- throw new Error(`Cron "${identifier.name}" not found`);
160
- }
161
- }
162
- if (!cron.schedulerJobId) {
163
- throw new Error(`Cron ${cron._id} not scheduled`);
164
- }
165
- console.log(`Canceling scheduler job ${cron.schedulerJobId}`);
166
- await ctx.scheduler.cancel(cron.schedulerJobId);
167
- if (cron.executionJobId) {
168
- console.log(`Canceling execution job ${cron.executionJobId}`);
169
- await ctx.scheduler.cancel(cron.executionJobId);
170
- }
171
- console.log(`Deleting cron ${cron._id}`);
172
- await ctx.db.delete(cron._id);
173
- },
174
- });
175
- // Continue rescheduling a cron job.
176
- //
177
- // This is the main worker function that does the scheduling but also schedules
178
- // the target function so that it runs in a different context. As a result this
179
- // function probably *shouldn't* fail since it isn't doing much, but under heavy
180
- // OCC contention it's possible it may eventually fail. In this case the cron
181
- // will be lost and we'll need a janitor job to recover it.
182
- export const rescheduler = internalMutation({
183
- args: {
184
- id: v.id("crons"),
185
- },
186
- returns: v.null(),
187
- handler: async (ctx, { id }) => {
188
- // Cron job is the logical concept we're rescheduling repeatedly.
189
- const cronJob = await ctx.db.get(id);
190
- if (!cronJob) {
191
- throw Error(`Cron ${id} not found`);
192
- }
193
- if (!cronJob.schedulerJobId) {
194
- throw Error(`Cron ${id} not scheduled`);
195
- }
196
- // Scheduler job is the job that's running right now, that we use to trigger
197
- // repeated executions.
198
- const schedulerJob = await ctx.db.system.get(cronJob.schedulerJobId);
199
- if (!schedulerJob) {
200
- throw Error(`Scheduler job ${cronJob.schedulerJobId} not found`);
201
- }
202
- if (schedulerJob.state.kind !== "pending" &&
203
- schedulerJob.state.kind !== "inProgress") {
204
- throw Error(`We are running in job ${schedulerJob._id} but state is ${schedulerJob.state.kind}`);
205
- }
206
- // Execution job is the previous job used to actually do the work of the cron.
207
- let stillRunning = false;
208
- if (cronJob.executionJobId) {
209
- const executionJob = await ctx.db.system.get(cronJob.executionJobId);
210
- if (executionJob &&
211
- (executionJob.state.kind === "pending" ||
212
- executionJob.state.kind === "inProgress")) {
213
- stillRunning = true;
214
- }
215
- }
216
- if (stillRunning) {
217
- console.log(`Cron ${cronJob._id} still running, skipping this run.`);
218
- }
219
- else {
220
- console.log(`Running cron ${cronJob._id}.`);
221
- await ctx.scheduler.runAfter(0, cronJob.functionHandle, cronJob.args);
222
- }
223
- await scheduleNextRun(ctx, id, new Date(schedulerJob.scheduledTime), cronJob.schedule);
224
- },
225
- });
226
- //# sourceM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AAO,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,49 +0,0 @@
1
- declare const _default: import("convex/server").SchemaDefinition<{
2
- crons: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
- name?: string | undefined;
4
- schedulerJobId?: import("convex/values").GenericId<"_scheduled_functions"> | undefined;
5
- executionJobId?: import("convex/values").GenericId<"_scheduled_functions"> | undefined;
6
- functionHandle: string;
7
- args: Record<string, any>;
8
- schedule: {
9
- kind: "interval";
10
- ms: number;
11
- } | {
12
- tz?: string | undefined;
13
- kind: "cron";
14
- cronspec: string;
15
- };
16
- }, {
17
- name: import("convex/values").VString<string | undefined, "optional">;
18
- functionHandle: import("convex/values").VString<string, "required">;
19
- args: import("convex/values").VRecord<Record<string, any>, import("convex/values").VString<string, "required">, import("convex/values").VAny<any, "required", string>, "required", string>;
20
- schedule: import("convex/values").VUnion<{
21
- kind: "interval";
22
- ms: number;
23
- } | {
24
- tz?: string | undefined;
25
- kind: "cron";
26
- cronspec: string;
27
- }, [import("convex/values").VObject<{
28
- kind: "interval";
29
- ms: number;
30
- }, {
31
- kind: import("convex/values").VLiteral<"interval", "required">;
32
- ms: import("convex/values").VFloat64<number, "required">;
33
- }, "required", "kind" | "ms">, import("convex/values").VObject<{
34
- tz?: string | undefined;
35
- kind: "cron";
36
- cronspec: string;
37
- }, {
38
- kind: import("convex/values").VLiteral<"cron", "required">;
39
- cronspec: import("convex/values").VString<string, "required">;
40
- tz: import("convex/values").VString<string | undefined, "optional">;
41
- }, "required", "kind" | "cronspec" | "tz">], "required", "kind" | "ms" | "cronspec" | "tz">;
42
- schedulerJobId: import("convex/values").VId<import("convex/values").GenericId<"_scheduled_functions"> | undefined, "optional">;
43
- executionJobId: import("convex/values").VId<import("convex/values").GenericId<"_scheduled_functions"> | undefined, "optional">;
44
- }, "required", "name" | "functionHandle" | "args" | "schedule" | "schedulerJobId" | "executionJobId" | `args.${string}` | "schedule.kind" | "schedule.ms" | "schedule.cronspec" | "schedule.tz">, {
45
- name: ["name", "_creationTime"];
46
- }, {}, {}>;
47
- }, true>;
48
- export default _default;
49
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAoBG"}
@@ -1,21 +0,0 @@
1
- import { defineSchema, defineTable } from "convex/server";
2
- import { v } from "convex/values";
3
- export default defineSchema({
4
- // User space crons.
5
- crons: defineTable({
6
- name: v.optional(v.string()),
7
- functionHandle: v.string(),
8
- args: v.record(v.string(), v.any()),
9
- schedule: v.union(v.object({
10
- kind: v.literal("interval"),
11
- ms: v.float64(), // milliseconds
12
- }), v.object({
13
- kind: v.literal("cron"),
14
- cronspec: v.string(),
15
- tz: v.optional(v.string()), // optional timezone, e.g. "America/New_York"
16
- })),
17
- schedulerJobId: v.optional(v.id("_scheduled_functions")),
18
- executionJobId: v.optional(v.id("_scheduled_functions")), // async job to run the function
19
- }).index("name", ["name"]),
20
- });
21
- //# sourceMappingURL=schema.js.map
@@ -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": "module"
3
- }
@@ -1,98 +0,0 @@
1
- /* prettier-ignore-start */
2
-
3
- /* eslint-disable */
4
- /**
5
- * Generated `api` utility.
6
- *
7
- * THIS CODE IS AUTOMATICALLY GENERATED.
8
- *
9
- * To regenerate, run `npx convex dev`.
10
- * @module
11
- */
12
-
13
- import type * as public from "../public.js";
14
-
15
- import type {
16
- ApiFromModules,
17
- FilterApi,
18
- FunctionReference,
19
- } from "convex/server";
20
- /**
21
- * A utility for referencing Convex functions in your app's API.
22
- *
23
- * Usage:
24
- * ```js
25
- * const myFunctionReference = api.myModule.myFunction;
26
- * ```
27
- */
28
- declare const fullApi: ApiFromModules<{
29
- public: typeof public;
30
- }>;
31
- export type Mounts = {
32
- public: {
33
- del: FunctionReference<
34
- "mutation",
35
- "public",
36
- { identifier: { id: string } | { name: string } },
37
- null
38
- >;
39
- get: FunctionReference<
40
- "query",
41
- "public",
42
- { identifier: { id: string } | { name: string } },
43
- {
44
- args: Record<string, any>;
45
- functionHandle: string;
46
- id: string;
47
- name?: string;
48
- schedule:
49
- | { kind: "interval"; ms: number }
50
- | { cronspec: string; kind: "cron" };
51
- } | null
52
- >;
53
- list: FunctionReference<
54
- "query",
55
- "public",
56
- {},
57
- Array<{
58
- args: Record<string, any>;
59
- functionHandle: string;
60
- id: string;
61
- name?: string;
62
- schedule:
63
- | { kind: "interval"; ms: number }
64
- | { cronspec: string; kind: "cron" };
65
- }>
66
- >;
67
- register: FunctionReference<
68
- "mutation",
69
- "public",
70
- {
71
- args: Record<string, any>;
72
- functionHandle: string;
73
- name?: string;
74
- schedule:
75
- | { kind: "interval"; ms: number }
76
- | { cronspec: string; kind: "cron" };
77
- },
78
- string
79
- >;
80
- };
81
- };
82
- // For now fullApiWithMounts is only fullApi which provides
83
- // jump-to-definition in component client code.
84
- // Use Mounts for the same type without the inference.
85
- declare const fullApiWithMounts: typeof fullApi;
86
-
87
- export declare const api: FilterApi<
88
- typeof fullApiWithMounts,
89
- FunctionReference<any, "public">
90
- >;
91
- export declare const internal: FilterApi<
92
- typeof fullApiWithMounts,
93
- FunctionReference<any, "internal">
94
- >;
95
-
96
- export declare const components: {};
97
-
98
- /* prettier-ignore-end */