From 5516ebdd3f873cc71f7146fc5bbdcca639004265 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 3 Feb 2024 17:41:49 +0000 Subject: [PATCH 1/3] :sparkles: allow running AQL against local database --- packages/loot-core/src/server/main.ts | 6 ++++-- upcoming-release-notes/2323.md | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 upcoming-release-notes/2323.md diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts index d0ecf74a040..2d3320bc52a 100644 --- a/packages/loot-core/src/server/main.ts +++ b/packages/loot-core/src/server/main.ts @@ -2352,10 +2352,12 @@ export async function initApp(isDev, socketName) { }); } + // Allow running DB queries locally + global.$query = aqlQuery; + global.$q = q; + if (isDev) { global.$send = (name, args) => runHandler(app.handlers[name], args); - global.$query = aqlQuery; - global.$q = q; global.$db = db; global.$setSyncingMode = setSyncingMode; } diff --git a/upcoming-release-notes/2323.md b/upcoming-release-notes/2323.md new file mode 100644 index 00000000000..695ed13c97d --- /dev/null +++ b/upcoming-release-notes/2323.md @@ -0,0 +1,16 @@ +--- +category: Enhancements +authors: [MatissJanis] +--- + +Allow running DB queries against the local database outside of dev-mode. + +Read more in: https://actualbudget.org/docs/api/actual-ql/ + +Sample: + +```javascript +window + .$query(window.$q('accounts').select('*')) + .then(({ data }) => console.log(data)); +``` From 65d822320058367028d88d5b39bc198b1a668d8f Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 3 Feb 2024 17:43:55 +0000 Subject: [PATCH 2/3] Release notes --- upcoming-release-notes/{2323.md => 2326.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename upcoming-release-notes/{2323.md => 2326.md} (100%) diff --git a/upcoming-release-notes/2323.md b/upcoming-release-notes/2326.md similarity index 100% rename from upcoming-release-notes/2323.md rename to upcoming-release-notes/2326.md From ff7a9720b598c388905c6fb3acdd2ed5942d62e9 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Sat, 3 Feb 2024 17:45:11 +0000 Subject: [PATCH 3/3] Release notes --- upcoming-release-notes/2326.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/upcoming-release-notes/2326.md b/upcoming-release-notes/2326.md index 695ed13c97d..4c8ccfdbd31 100644 --- a/upcoming-release-notes/2326.md +++ b/upcoming-release-notes/2326.md @@ -3,14 +3,4 @@ category: Enhancements authors: [MatissJanis] --- -Allow running DB queries against the local database outside of dev-mode. - -Read more in: https://actualbudget.org/docs/api/actual-ql/ - -Sample: - -```javascript -window - .$query(window.$q('accounts').select('*')) - .then(({ data }) => console.log(data)); -``` +Allow running DB queries against the local database outside of dev-mode. Read more in [AQL docs](https://actualbudget.org/docs/api/actual-ql/)