Add cron trigger table (#14110)

This Pr begins the extensibility journey
- adds a `core.cronTrigger` table
- add a oneToMany relation between core.serverlessFunction and
`core.cronTrigger` (one serverlessFunction can be triggered by multiple
cronTriggers)
- add a job to trigger a serverless function
- adds a cron to trigger serverlessFunction (via the trigger job) based
on the core.cronTrigger.setting.pattern
- adds a command to register the cron
- add the command in `cron-register-all.command.ts`
This commit is contained in:
martmull
2025-08-28 14:47:48 +02:00
committed by GitHub
parent 85e6fe8849
commit 9b41a3be54
17 changed files with 279 additions and 14 deletions
@@ -14,6 +14,7 @@ import { WorkflowCleanWorkflowRunsCommand } from 'src/modules/workflow/workflow-
import { WorkflowHandleStaledRunsCronCommand } from 'src/modules/workflow/workflow-runner/workflow-run-queue/cron/command/workflow-handle-staled-runs.cron.command';
import { WorkflowRunEnqueueCronCommand } from 'src/modules/workflow/workflow-runner/workflow-run-queue/cron/command/workflow-run-enqueue.cron.command';
import { WorkflowCronTriggerCronCommand } from 'src/modules/workflow/workflow-trigger/automated-trigger/crons/commands/workflow-cron-trigger.cron.command';
import { CronTriggerCronCommand } from 'src/engine/metadata-modules/trigger/crons/commands/cron-trigger.cron.command';
@Command({
name: 'cron:register:all',
@@ -35,6 +36,7 @@ export class CronRegisterAllCommand extends CommandRunner {
private readonly workflowRunEnqueueCronCommand: WorkflowRunEnqueueCronCommand,
private readonly workflowHandleStaledRunsCronCommand: WorkflowHandleStaledRunsCronCommand,
private readonly workflowCleanWorkflowRunsCronCommand: WorkflowCleanWorkflowRunsCommand,
private readonly cronTriggerCronCommand: CronTriggerCronCommand,
) {
super();
}
@@ -91,6 +93,10 @@ export class CronRegisterAllCommand extends CommandRunner {
name: 'WorkflowCleanWorkflowRuns',
command: this.workflowCleanWorkflowRunsCronCommand,
},
{
name: 'CronTrigger',
command: this.cronTriggerCronCommand,
},
];
let successCount = 0;
@@ -21,6 +21,7 @@ import { CalendarEventImportManagerModule } from 'src/modules/calendar/calendar-
import { MessagingImportManagerModule } from 'src/modules/messaging/message-import-manager/messaging-import-manager.module';
import { WorkflowRunQueueModule } from 'src/modules/workflow/workflow-runner/workflow-run-queue/workflow-run-queue.module';
import { AutomatedTriggerModule } from 'src/modules/workflow/workflow-trigger/automated-trigger/automated-trigger.module';
import { TriggerModule } from 'src/engine/metadata-modules/trigger/trigger.module';
import { DataSeedWorkspaceCommand } from './data-seed-dev-workspace.command';
@@ -45,6 +46,7 @@ import { DataSeedWorkspaceCommand } from './data-seed-dev-workspace.command';
WorkspaceCacheStorageModule,
ApiKeyModule,
FeatureFlagModule,
TriggerModule,
],
providers: [
DataSeedWorkspaceCommand,