From e531fe1e825ef66111aee13c4e7ad2d636361769 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 21 Jun 2024 23:57:15 +0000 Subject: [PATCH] fix(functions): convert cron expression to timestamp In a previous version of Appwrite, there was a next attribute with the timestamp of when the function would be executed next. That was removed, but the Console has not been updated to show the correct timestamp. This PR installs cron-parser package and uses it to conver the schedule to a human readable timestamp. --- package-lock.json | 20 +++++++++++++++++++ package.json | 1 + .../project-[project]/functions/+page.svelte | 15 +++++++------- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea2919e1d..944d0f2e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@stripe/stripe-js": "^3.4.0", "ai": "^2.2.11", "analytics": "^0.8.9", + "cron-parser": "^4.9.0", "dayjs": "^1.11.9", "deep-equal": "^2.2.2", "dotenv": "^16.3.1", @@ -4020,6 +4021,17 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/cron-parser": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.9.0.tgz", + "integrity": "sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==", + "dependencies": { + "luxon": "^3.2.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -7019,6 +7031,14 @@ "yallist": "^3.0.2" } }, + "node_modules/luxon": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz", + "integrity": "sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==", + "engines": { + "node": ">=12" + } + }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", diff --git a/package.json b/package.json index 42ec216dd..4cd051ff0 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@stripe/stripe-js": "^3.4.0", "ai": "^2.2.11", "analytics": "^0.8.9", + "cron-parser": "^4.9.0", "dayjs": "^1.11.9", "deep-equal": "^2.2.2", "dotenv": "^16.3.1", diff --git a/src/routes/console/project-[project]/functions/+page.svelte b/src/routes/console/project-[project]/functions/+page.svelte index 989f8ebab..2a86c9150 100644 --- a/src/routes/console/project-[project]/functions/+page.svelte +++ b/src/routes/console/project-[project]/functions/+page.svelte @@ -1,24 +1,25 @@