Fixed empty strings making their way into schedule externalId
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/core": patch
|
||||
---
|
||||
|
||||
Make optional schedule object fields nullish
|
||||
@@ -58,8 +58,8 @@ export class TriggerScheduledTaskService extends BaseService {
|
||||
const payload = {
|
||||
scheduleId: instance.taskSchedule.friendlyId,
|
||||
timestamp: instance.nextScheduledTimestamp,
|
||||
lastTimestamp: instance.lastScheduledTimestamp,
|
||||
externalId: instance.taskSchedule.externalId,
|
||||
lastTimestamp: instance.lastScheduledTimestamp ?? undefined,
|
||||
externalId: instance.taskSchedule.externalId ?? undefined,
|
||||
upcoming: nextScheduledTimestamps(
|
||||
instance.taskSchedule.generatorExpression,
|
||||
instance.nextScheduledTimestamp!,
|
||||
|
||||
@@ -111,7 +111,7 @@ export class UpsertTaskScheduleService extends BaseService {
|
||||
options.deduplicationKey !== undefined && options.deduplicationKey !== "",
|
||||
generatorExpression: options.cron,
|
||||
generatorDescription: cronstrue.toString(options.cron),
|
||||
externalId: options.externalId,
|
||||
externalId: options.externalId ? options.externalId : undefined,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ export class UpsertTaskScheduleService extends BaseService {
|
||||
data: {
|
||||
generatorExpression: options.cron,
|
||||
generatorDescription: cronstrue.toString(options.cron),
|
||||
externalId: options.externalId,
|
||||
externalId: options.externalId ? options.externalId : null,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -240,19 +240,19 @@ export const ScheduleObject = z.object({
|
||||
id: z.string(),
|
||||
task: z.string(),
|
||||
active: z.boolean(),
|
||||
deduplicationKey: z.string().optional(),
|
||||
externalId: z.string().optional(),
|
||||
deduplicationKey: z.string().nullish(),
|
||||
externalId: z.string().nullish(),
|
||||
generator: z.object({
|
||||
type: z.literal("CRON"),
|
||||
expression: z.string(),
|
||||
description: z.string(),
|
||||
}),
|
||||
nextRun: z.coerce.date().optional(),
|
||||
nextRun: z.coerce.date().nullish(),
|
||||
environments: z.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
type: z.string(),
|
||||
userName: z.string().optional(),
|
||||
userName: z.string().nullish(),
|
||||
})
|
||||
),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user