plum-e2e 1.3.6 → 1.3.7

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.
@@ -28,7 +28,22 @@ const getAll = () => prisma.runner.findMany({ orderBy: { createdAt: 'asc' } });
28
28
  const create = ({ name, url, token, browser = 'chromium' }) =>
29
29
  prisma.runner.create({ data: { name, url, token, browser } });
30
30
 
31
- const remove = (id) => prisma.runner.delete({ where: { id } });
31
+ async function remove(id) {
32
+ // Scrub the deleted runner from any cron job's runnerIds string before
33
+ // deleting, since that field has no relational constraint.
34
+ const jobs = await prisma.cronJob.findMany({ select: { id: true, runnerIds: true } });
35
+ for (const job of jobs) {
36
+ const ids = job.runnerIds
37
+ .split(',')
38
+ .map((s) => s.trim())
39
+ .filter((s) => s && s !== id);
40
+ await prisma.cronJob.update({
41
+ where: { id: job.id },
42
+ data: { runnerIds: ids.length > 0 ? ids.join(',') : 'built-in' }
43
+ });
44
+ }
45
+ return prisma.runner.delete({ where: { id } });
46
+ }
32
47
 
33
48
  const update = (id, data) => prisma.runner.update({ where: { id }, data });
34
49
 
@@ -148,14 +148,16 @@
148
148
  function openEditModal(job) {
149
149
  isEditing = true;
150
150
  editTaskName = job.taskName;
151
+ const validIds = new Set(['built-in', ...availableRunners.map((r) => r.id)]);
151
152
  const storedIds = job.runnerIds ? job.runnerIds.split(',').map((s) => s.trim()) : ['built-in'];
153
+ const prunedIds = storedIds.filter((id) => validIds.has(id));
152
154
  form = {
153
155
  taskName: job.taskName,
154
156
  cronExpression: job.cronExpression,
155
157
  tags: job.tags,
156
158
  workers: job.workers ?? 1,
157
159
  browser: job.browser ?? 'chromium',
158
- runnerIds: storedIds
160
+ runnerIds: prunedIds.length > 0 ? prunedIds : ['built-in']
159
161
  };
160
162
  const isPreset = scheduleOptions.some((o) => o.value === job.cronExpression);
161
163
  useCustomCron = !isPreset;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plum-e2e",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/silverlunah/plum.git"