From 2660149fea6e34b3e7625d9d62abf9dda82b4f2c Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 13 Feb 2024 15:14:03 +0000 Subject: [PATCH] move constant to shared-core --- .../components/automation/SetupPanel/CronBuilder.svelte | 8 +++----- packages/server/src/automations/utils.ts | 3 +-- packages/shared-core/src/constants/index.ts | 2 ++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte b/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte index 35893970f8..c731b0afb0 100644 --- a/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte +++ b/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte @@ -2,15 +2,13 @@ import { Button, Select, Input, Label } from "@budibase/bbui" import { onMount, createEventDispatcher } from "svelte" import { flags } from "stores/backend" - import { helpers } from "@budibase/shared-core" + import { helpers, REBOOT_CRON } from "@budibase/shared-core" const dispatch = createEventDispatcher() export let value let error - const reboot = "@reboot" - $: { const exists = CRON_EXPRESSIONS.some(cron => cron.value === value) const customIndex = CRON_EXPRESSIONS.findIndex( @@ -25,7 +23,7 @@ } const onChange = e => { - if (value !== reboot) { + if (value !== REBOOT_CRON) { error = helpers.cron.validate(e.detail).err } if (e.detail === value || error) { @@ -62,7 +60,7 @@ if (!$flags.cloud) { CRON_EXPRESSIONS.push({ label: "Every Budibase Reboot", - value: reboot, + value: REBOOT_CRON, }) } }) diff --git a/packages/server/src/automations/utils.ts b/packages/server/src/automations/utils.ts index b1f463e363..360802df6a 100644 --- a/packages/server/src/automations/utils.ts +++ b/packages/server/src/automations/utils.ts @@ -16,10 +16,9 @@ import { } from "@budibase/types" import sdk from "../sdk" import { automationsEnabled } from "../features" -import { helpers } from "@budibase/shared-core" +import { helpers, REBOOT_CRON } from "@budibase/shared-core" import tracer from "dd-trace" -const REBOOT_CRON = "@reboot" const WH_STEP_ID = definitions.WEBHOOK.stepId const CRON_STEP_ID = definitions.CRON.stepId let Runner: Thread diff --git a/packages/shared-core/src/constants/index.ts b/packages/shared-core/src/constants/index.ts index a23913dd11..99fb5c2a73 100644 --- a/packages/shared-core/src/constants/index.ts +++ b/packages/shared-core/src/constants/index.ts @@ -99,6 +99,8 @@ export const SocketSessionTTL = 60 export const ValidQueryNameRegex = /^[^()]*$/ export const ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g +export const REBOOT_CRON = "@reboot" + export const InvalidFileExtensions = [ "7z", "action",