Skip to content

Commit

Permalink
✨ allow running AQL against local database
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Feb 3, 2024
1 parent e3a8366 commit 5516ebd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/loot-core/src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
16 changes: 16 additions & 0 deletions upcoming-release-notes/2323.md
Original file line number Diff line number Diff line change
@@ -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));
```

0 comments on commit 5516ebd

Please sign in to comment.