@okrlinkhub/agent-factory 2.0.3 → 3.0.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.
- package/README.md +102 -0
- package/dist/client/index.d.ts +53 -21
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +74 -3
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +2 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +119 -2
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/identity.d.ts +6 -6
- package/dist/component/lib.d.ts +2 -1
- package/dist/component/lib.d.ts.map +1 -1
- package/dist/component/lib.js +2 -1
- package/dist/component/lib.js.map +1 -1
- package/dist/component/messageTemplates.d.ts +37 -0
- package/dist/component/messageTemplates.d.ts.map +1 -0
- package/dist/component/messageTemplates.js +177 -0
- package/dist/component/messageTemplates.js.map +1 -0
- package/dist/component/pushing.d.ts +37 -37
- package/dist/component/queue.d.ts +113 -90
- package/dist/component/queue.d.ts.map +1 -1
- package/dist/component/queue.js +122 -47
- package/dist/component/queue.js.map +1 -1
- package/dist/component/scheduler.d.ts +23 -23
- package/dist/component/schema.d.ts +86 -44
- package/dist/component/schema.d.ts.map +1 -1
- package/dist/component/schema.js +19 -1
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +76 -3
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +159 -2
- package/src/component/lib.test.ts +125 -0
- package/src/component/lib.ts +8 -0
- package/src/component/messageTemplates.ts +205 -0
- package/src/component/queue.ts +165 -49
- package/src/component/schema.ts +22 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation, query } from "./_generated/server.js";
|
|
3
|
+
const messageTemplateViewValidator = v.object({
|
|
4
|
+
_id: v.id("messageTemplates"),
|
|
5
|
+
templateKey: v.string(),
|
|
6
|
+
title: v.string(),
|
|
7
|
+
text: v.string(),
|
|
8
|
+
tags: v.array(v.string()),
|
|
9
|
+
usageCount: v.number(),
|
|
10
|
+
enabled: v.boolean(),
|
|
11
|
+
createdBy: v.string(),
|
|
12
|
+
updatedBy: v.string(),
|
|
13
|
+
createdAt: v.number(),
|
|
14
|
+
updatedAt: v.number(),
|
|
15
|
+
});
|
|
16
|
+
function normalizeTemplateKey(value) {
|
|
17
|
+
return value.trim().toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
function buildTemplateKeyBase(title) {
|
|
20
|
+
const normalized = title
|
|
21
|
+
.trim()
|
|
22
|
+
.toLowerCase()
|
|
23
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
24
|
+
.replace(/^-+|-+$/g, "");
|
|
25
|
+
return normalized || "message-template";
|
|
26
|
+
}
|
|
27
|
+
function normalizeTitle(value) {
|
|
28
|
+
return value.trim();
|
|
29
|
+
}
|
|
30
|
+
function normalizeText(value) {
|
|
31
|
+
return value.trim();
|
|
32
|
+
}
|
|
33
|
+
function normalizeTags(tags) {
|
|
34
|
+
return Array.from(new Set(tags
|
|
35
|
+
.map((tag) => tag.trim().toLowerCase())
|
|
36
|
+
.filter((tag) => tag.length > 0))).sort((left, right) => left.localeCompare(right));
|
|
37
|
+
}
|
|
38
|
+
function validateMessageTemplateFields(input) {
|
|
39
|
+
if (input.title !== undefined && input.title.length === 0) {
|
|
40
|
+
throw new Error("Template title is required");
|
|
41
|
+
}
|
|
42
|
+
if (input.text !== undefined && input.text.length === 0) {
|
|
43
|
+
throw new Error("Template text is required");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function resolveUniqueTemplateKey(ctx, title, currentTemplateId) {
|
|
47
|
+
const baseKey = buildTemplateKeyBase(title);
|
|
48
|
+
let candidate = baseKey;
|
|
49
|
+
let suffix = 2;
|
|
50
|
+
while (true) {
|
|
51
|
+
const existing = await ctx.db
|
|
52
|
+
.query("messageTemplates")
|
|
53
|
+
.withIndex("by_templateKey", (q) => q.eq("templateKey", candidate))
|
|
54
|
+
.unique();
|
|
55
|
+
if (!existing || String(existing._id) === currentTemplateId) {
|
|
56
|
+
return candidate;
|
|
57
|
+
}
|
|
58
|
+
candidate = `${baseKey}-${suffix}`;
|
|
59
|
+
suffix += 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export const createMessageTemplate = mutation({
|
|
63
|
+
args: {
|
|
64
|
+
title: v.string(),
|
|
65
|
+
text: v.string(),
|
|
66
|
+
tags: v.array(v.string()),
|
|
67
|
+
enabled: v.optional(v.boolean()),
|
|
68
|
+
actorUserId: v.string(),
|
|
69
|
+
nowMs: v.optional(v.number()),
|
|
70
|
+
},
|
|
71
|
+
returns: v.id("messageTemplates"),
|
|
72
|
+
handler: async (ctx, args) => {
|
|
73
|
+
const title = normalizeTitle(args.title);
|
|
74
|
+
const text = normalizeText(args.text);
|
|
75
|
+
const tags = normalizeTags(args.tags);
|
|
76
|
+
validateMessageTemplateFields({ title, text });
|
|
77
|
+
const templateKey = normalizeTemplateKey(await resolveUniqueTemplateKey(ctx, title));
|
|
78
|
+
const nowMs = args.nowMs ?? Date.now();
|
|
79
|
+
return await ctx.db.insert("messageTemplates", {
|
|
80
|
+
templateKey,
|
|
81
|
+
title,
|
|
82
|
+
text,
|
|
83
|
+
tags,
|
|
84
|
+
usageCount: 0,
|
|
85
|
+
enabled: args.enabled ?? true,
|
|
86
|
+
createdBy: args.actorUserId,
|
|
87
|
+
updatedBy: args.actorUserId,
|
|
88
|
+
createdAt: nowMs,
|
|
89
|
+
updatedAt: nowMs,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
export const updateMessageTemplate = mutation({
|
|
94
|
+
args: {
|
|
95
|
+
templateId: v.id("messageTemplates"),
|
|
96
|
+
title: v.optional(v.string()),
|
|
97
|
+
text: v.optional(v.string()),
|
|
98
|
+
tags: v.optional(v.array(v.string())),
|
|
99
|
+
enabled: v.optional(v.boolean()),
|
|
100
|
+
actorUserId: v.string(),
|
|
101
|
+
nowMs: v.optional(v.number()),
|
|
102
|
+
},
|
|
103
|
+
returns: v.boolean(),
|
|
104
|
+
handler: async (ctx, args) => {
|
|
105
|
+
const template = await ctx.db.get(args.templateId);
|
|
106
|
+
if (!template)
|
|
107
|
+
return false;
|
|
108
|
+
const title = args.title !== undefined ? normalizeTitle(args.title) : template.title;
|
|
109
|
+
const text = args.text !== undefined ? normalizeText(args.text) : template.text;
|
|
110
|
+
const tags = args.tags !== undefined ? normalizeTags(args.tags) : template.tags;
|
|
111
|
+
validateMessageTemplateFields({ title, text });
|
|
112
|
+
const templateKey = title !== template.title
|
|
113
|
+
? normalizeTemplateKey(await resolveUniqueTemplateKey(ctx, title, String(template._id)))
|
|
114
|
+
: template.templateKey;
|
|
115
|
+
const nowMs = args.nowMs ?? Date.now();
|
|
116
|
+
await ctx.db.patch(template._id, {
|
|
117
|
+
templateKey,
|
|
118
|
+
title,
|
|
119
|
+
text,
|
|
120
|
+
tags,
|
|
121
|
+
enabled: args.enabled ?? template.enabled,
|
|
122
|
+
updatedBy: args.actorUserId,
|
|
123
|
+
updatedAt: nowMs,
|
|
124
|
+
});
|
|
125
|
+
return true;
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
export const deleteMessageTemplate = mutation({
|
|
129
|
+
args: {
|
|
130
|
+
templateId: v.id("messageTemplates"),
|
|
131
|
+
},
|
|
132
|
+
returns: v.boolean(),
|
|
133
|
+
handler: async (ctx, args) => {
|
|
134
|
+
const template = await ctx.db.get(args.templateId);
|
|
135
|
+
if (!template)
|
|
136
|
+
return false;
|
|
137
|
+
await ctx.db.delete(template._id);
|
|
138
|
+
return true;
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
export const listMessageTemplatesByCompany = query({
|
|
142
|
+
args: {
|
|
143
|
+
includeDisabled: v.optional(v.boolean()),
|
|
144
|
+
limit: v.optional(v.number()),
|
|
145
|
+
},
|
|
146
|
+
returns: v.array(messageTemplateViewValidator),
|
|
147
|
+
handler: async (ctx, args) => {
|
|
148
|
+
const includeDisabled = args.includeDisabled ?? false;
|
|
149
|
+
const limit = Math.max(1, Math.min(args.limit ?? 100, 200));
|
|
150
|
+
const rows = includeDisabled
|
|
151
|
+
? await ctx.db.query("messageTemplates").take(limit)
|
|
152
|
+
: await ctx.db
|
|
153
|
+
.query("messageTemplates")
|
|
154
|
+
.withIndex("by_enabled", (q) => q.eq("enabled", true))
|
|
155
|
+
.take(limit);
|
|
156
|
+
rows.sort((left, right) => {
|
|
157
|
+
if (right.usageCount !== left.usageCount) {
|
|
158
|
+
return right.usageCount - left.usageCount;
|
|
159
|
+
}
|
|
160
|
+
return right.updatedAt - left.updatedAt;
|
|
161
|
+
});
|
|
162
|
+
return rows.map((row) => ({
|
|
163
|
+
_id: row._id,
|
|
164
|
+
templateKey: row.templateKey,
|
|
165
|
+
title: row.title,
|
|
166
|
+
text: row.text,
|
|
167
|
+
tags: row.tags,
|
|
168
|
+
usageCount: row.usageCount,
|
|
169
|
+
enabled: row.enabled,
|
|
170
|
+
createdBy: row.createdBy,
|
|
171
|
+
updatedBy: row.updatedBy,
|
|
172
|
+
createdAt: row.createdAt,
|
|
173
|
+
updatedAt: row.updatedAt,
|
|
174
|
+
}));
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=messageTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageTemplates.js","sourceRoot":"","sources":["../../src/component/messageTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAGzD,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC;IAC7B,WAAW,EAAE,CAAC,CAA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AC1C,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACxB,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,SAAS,EAAE,GAAG,CAAC,SAAS;SACzB,CAAC,CAAC,CAAC;IACN,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Id } from "./_generated/dataModel.js";
|
|
2
2
|
export declare const createPushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
3
|
-
enabled?: boolean | undefined;
|
|
4
3
|
nowMs?: number | undefined;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
title: string;
|
|
4
|
+
enabled?: boolean | undefined;
|
|
5
|
+
actorUserId: string;
|
|
8
6
|
text: string;
|
|
7
|
+
title: string;
|
|
8
|
+
companyId: string;
|
|
9
9
|
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
10
10
|
suggestedTimes: ({
|
|
11
11
|
kind: "daily";
|
|
@@ -19,12 +19,13 @@ export declare const createPushTemplate: import("convex/server").RegisteredMutat
|
|
|
19
19
|
time: string;
|
|
20
20
|
dayOfMonth: number | "last";
|
|
21
21
|
})[];
|
|
22
|
-
|
|
22
|
+
templateKey: string;
|
|
23
23
|
}, Promise<import("convex/values").GenericId<"messagePushTemplates">>>;
|
|
24
24
|
export declare const updatePushTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
25
|
+
nowMs?: number | undefined;
|
|
25
26
|
enabled?: boolean | undefined;
|
|
26
|
-
title?: string | undefined;
|
|
27
27
|
text?: string | undefined;
|
|
28
|
+
title?: string | undefined;
|
|
28
29
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
29
30
|
suggestedTimes?: ({
|
|
30
31
|
kind: "daily";
|
|
@@ -38,7 +39,6 @@ export declare const updatePushTemplate: import("convex/server").RegisteredMutat
|
|
|
38
39
|
time: string;
|
|
39
40
|
dayOfMonth: number | "last";
|
|
40
41
|
})[] | undefined;
|
|
41
|
-
nowMs?: number | undefined;
|
|
42
42
|
actorUserId: string;
|
|
43
43
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
44
44
|
}, Promise<boolean>>;
|
|
@@ -74,6 +74,7 @@ export declare const listPushTemplatesByCompany: import("convex/server").Registe
|
|
|
74
74
|
updatedAt: number;
|
|
75
75
|
}[]>>;
|
|
76
76
|
export declare const createPushJobFromTemplate: import("convex/server").RegisteredMutation<"public", {
|
|
77
|
+
nowMs?: number | undefined;
|
|
77
78
|
enabled?: boolean | undefined;
|
|
78
79
|
schedule?: {
|
|
79
80
|
kind: "manual";
|
|
@@ -89,21 +90,19 @@ export declare const createPushJobFromTemplate: import("convex/server").Register
|
|
|
89
90
|
time: string;
|
|
90
91
|
dayOfMonth: number | "last";
|
|
91
92
|
} | undefined;
|
|
92
|
-
nowMs?: number | undefined;
|
|
93
93
|
consumerUserId: string;
|
|
94
94
|
companyId: string;
|
|
95
95
|
timezone: string;
|
|
96
96
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
97
97
|
}, Promise<import("convex/values").GenericId<"messagePushJobs">>>;
|
|
98
98
|
export declare const createPushJobCustom: import("convex/server").RegisteredMutation<"public", {
|
|
99
|
-
enabled?: boolean | undefined;
|
|
100
99
|
nowMs?: number | undefined;
|
|
100
|
+
enabled?: boolean | undefined;
|
|
101
101
|
consumerUserId: string;
|
|
102
|
-
companyId: string;
|
|
103
|
-
title: string;
|
|
104
102
|
text: string;
|
|
103
|
+
title: string;
|
|
104
|
+
companyId: string;
|
|
105
105
|
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
106
|
-
timezone: string;
|
|
107
106
|
schedule: {
|
|
108
107
|
kind: "manual";
|
|
109
108
|
} | {
|
|
@@ -118,13 +117,14 @@ export declare const createPushJobCustom: import("convex/server").RegisteredMuta
|
|
|
118
117
|
time: string;
|
|
119
118
|
dayOfMonth: number | "last";
|
|
120
119
|
};
|
|
120
|
+
timezone: string;
|
|
121
121
|
}, Promise<import("convex/values").GenericId<"messagePushJobs">>>;
|
|
122
122
|
export declare const updatePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
123
|
+
nowMs?: number | undefined;
|
|
123
124
|
enabled?: boolean | undefined;
|
|
124
|
-
title?: string | undefined;
|
|
125
125
|
text?: string | undefined;
|
|
126
|
+
title?: string | undefined;
|
|
126
127
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
127
|
-
timezone?: string | undefined;
|
|
128
128
|
schedule?: {
|
|
129
129
|
kind: "manual";
|
|
130
130
|
} | {
|
|
@@ -139,7 +139,7 @@ export declare const updatePushJob: import("convex/server").RegisteredMutation<"
|
|
|
139
139
|
time: string;
|
|
140
140
|
dayOfMonth: number | "last";
|
|
141
141
|
} | undefined;
|
|
142
|
-
|
|
142
|
+
timezone?: string | undefined;
|
|
143
143
|
jobId: import("convex/values").GenericId<"messagePushJobs">;
|
|
144
144
|
}, Promise<boolean>>;
|
|
145
145
|
export declare const deletePushJob: import("convex/server").RegisteredMutation<"public", {
|
|
@@ -185,34 +185,34 @@ export declare const listPushJobsForUser: import("convex/server").RegisteredQuer
|
|
|
185
185
|
updatedAt: number;
|
|
186
186
|
}[]>>;
|
|
187
187
|
export declare const triggerPushJobNow: import("convex/server").RegisteredMutation<"public", {
|
|
188
|
+
nowMs?: number | undefined;
|
|
188
189
|
providerConfig?: {
|
|
189
|
-
kind: "fly" | "runpod" | "ecs";
|
|
190
190
|
appName: string;
|
|
191
|
-
|
|
191
|
+
kind: "fly" | "runpod" | "ecs";
|
|
192
192
|
organizationSlug: string;
|
|
193
193
|
image: string;
|
|
194
|
+
region: string;
|
|
194
195
|
volumeName: string;
|
|
195
196
|
volumePath: string;
|
|
196
197
|
volumeSizeGb: number;
|
|
197
198
|
} | undefined;
|
|
198
|
-
nowMs?: number | undefined;
|
|
199
199
|
jobId: import("convex/values").GenericId<"messagePushJobs">;
|
|
200
200
|
}, Promise<{
|
|
201
201
|
enqueuedMessageId: Id<"messageQueue">;
|
|
202
202
|
runKey: string;
|
|
203
203
|
}>>;
|
|
204
204
|
export declare const dispatchDuePushJobs: import("convex/server").RegisteredMutation<"public", {
|
|
205
|
+
nowMs?: number | undefined;
|
|
205
206
|
providerConfig?: {
|
|
206
|
-
kind: "fly" | "runpod" | "ecs";
|
|
207
207
|
appName: string;
|
|
208
|
-
|
|
208
|
+
kind: "fly" | "runpod" | "ecs";
|
|
209
209
|
organizationSlug: string;
|
|
210
210
|
image: string;
|
|
211
|
+
region: string;
|
|
211
212
|
volumeName: string;
|
|
212
213
|
volumePath: string;
|
|
213
214
|
volumeSizeGb: number;
|
|
214
215
|
} | undefined;
|
|
215
|
-
nowMs?: number | undefined;
|
|
216
216
|
limit?: number | undefined;
|
|
217
217
|
}, Promise<{
|
|
218
218
|
scanned: number;
|
|
@@ -221,20 +221,20 @@ export declare const dispatchDuePushJobs: import("convex/server").RegisteredMuta
|
|
|
221
221
|
failed: number;
|
|
222
222
|
}>>;
|
|
223
223
|
export declare const sendBroadcastToAllActiveAgents: import("convex/server").RegisteredMutation<"public", {
|
|
224
|
+
nowMs?: number | undefined;
|
|
224
225
|
providerConfig?: {
|
|
225
|
-
kind: "fly" | "runpod" | "ecs";
|
|
226
226
|
appName: string;
|
|
227
|
-
|
|
227
|
+
kind: "fly" | "runpod" | "ecs";
|
|
228
228
|
organizationSlug: string;
|
|
229
229
|
image: string;
|
|
230
|
+
region: string;
|
|
230
231
|
volumeName: string;
|
|
231
232
|
volumePath: string;
|
|
232
233
|
volumeSizeGb: number;
|
|
233
234
|
} | undefined;
|
|
234
|
-
nowMs?: number | undefined;
|
|
235
|
-
companyId: string;
|
|
236
|
-
title: string;
|
|
237
235
|
text: string;
|
|
236
|
+
title: string;
|
|
237
|
+
companyId: string;
|
|
238
238
|
requestedBy: string;
|
|
239
239
|
}, Promise<{
|
|
240
240
|
broadcastId: import("convex/values").GenericId<"messagePushBroadcasts">;
|
|
@@ -289,6 +289,7 @@ export declare const listPushJobsForAgent: import("convex/server").RegisteredQue
|
|
|
289
289
|
updatedAt: number;
|
|
290
290
|
}[]>>;
|
|
291
291
|
export declare const createPushJobFromTemplateForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
292
|
+
nowMs?: number | undefined;
|
|
292
293
|
enabled?: boolean | undefined;
|
|
293
294
|
schedule?: {
|
|
294
295
|
kind: "manual";
|
|
@@ -304,7 +305,6 @@ export declare const createPushJobFromTemplateForAgent: import("convex/server").
|
|
|
304
305
|
time: string;
|
|
305
306
|
dayOfMonth: number | "last";
|
|
306
307
|
} | undefined;
|
|
307
|
-
nowMs?: number | undefined;
|
|
308
308
|
agentKey: string;
|
|
309
309
|
consumerUserId: string;
|
|
310
310
|
companyId: string;
|
|
@@ -312,15 +312,14 @@ export declare const createPushJobFromTemplateForAgent: import("convex/server").
|
|
|
312
312
|
templateId: import("convex/values").GenericId<"messagePushTemplates">;
|
|
313
313
|
}, Promise<import("convex/values").GenericId<"messagePushJobs">>>;
|
|
314
314
|
export declare const createPushJobCustomForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
315
|
-
enabled?: boolean | undefined;
|
|
316
315
|
nowMs?: number | undefined;
|
|
316
|
+
enabled?: boolean | undefined;
|
|
317
317
|
agentKey: string;
|
|
318
318
|
consumerUserId: string;
|
|
319
|
-
companyId: string;
|
|
320
|
-
title: string;
|
|
321
319
|
text: string;
|
|
320
|
+
title: string;
|
|
321
|
+
companyId: string;
|
|
322
322
|
periodicity: "manual" | "daily" | "weekly" | "monthly";
|
|
323
|
-
timezone: string;
|
|
324
323
|
schedule: {
|
|
325
324
|
kind: "manual";
|
|
326
325
|
} | {
|
|
@@ -335,13 +334,14 @@ export declare const createPushJobCustomForAgent: import("convex/server").Regist
|
|
|
335
334
|
time: string;
|
|
336
335
|
dayOfMonth: number | "last";
|
|
337
336
|
};
|
|
337
|
+
timezone: string;
|
|
338
338
|
}, Promise<import("convex/values").GenericId<"messagePushJobs">>>;
|
|
339
339
|
export declare const updatePushJobForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
340
|
+
nowMs?: number | undefined;
|
|
340
341
|
enabled?: boolean | undefined;
|
|
341
|
-
title?: string | undefined;
|
|
342
342
|
text?: string | undefined;
|
|
343
|
+
title?: string | undefined;
|
|
343
344
|
periodicity?: "manual" | "daily" | "weekly" | "monthly" | undefined;
|
|
344
|
-
timezone?: string | undefined;
|
|
345
345
|
schedule?: {
|
|
346
346
|
kind: "manual";
|
|
347
347
|
} | {
|
|
@@ -356,23 +356,23 @@ export declare const updatePushJobForAgent: import("convex/server").RegisteredMu
|
|
|
356
356
|
time: string;
|
|
357
357
|
dayOfMonth: number | "last";
|
|
358
358
|
} | undefined;
|
|
359
|
-
|
|
359
|
+
timezone?: string | undefined;
|
|
360
360
|
agentKey: string;
|
|
361
361
|
consumerUserId: string;
|
|
362
362
|
jobId: import("convex/values").GenericId<"messagePushJobs">;
|
|
363
363
|
}, Promise<boolean>>;
|
|
364
364
|
export declare const triggerPushJobNowForAgent: import("convex/server").RegisteredMutation<"public", {
|
|
365
|
+
nowMs?: number | undefined;
|
|
365
366
|
providerConfig?: {
|
|
366
|
-
kind: "fly" | "runpod" | "ecs";
|
|
367
367
|
appName: string;
|
|
368
|
-
|
|
368
|
+
kind: "fly" | "runpod" | "ecs";
|
|
369
369
|
organizationSlug: string;
|
|
370
370
|
image: string;
|
|
371
|
+
region: string;
|
|
371
372
|
volumeName: string;
|
|
372
373
|
volumePath: string;
|
|
373
374
|
volumeSizeGb: number;
|
|
374
375
|
} | undefined;
|
|
375
|
-
nowMs?: number | undefined;
|
|
376
376
|
agentKey: string;
|
|
377
377
|
consumerUserId: string;
|
|
378
378
|
jobId: import("convex/values").GenericId<"messagePushJobs">;
|