40 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-11-15 22:55:53 +01:00
// Learn more at https://docs.deno.com/runtime/manual/examples/module_metadata#concepts
import { downloadBudget, getAccounts, init, shutdown } from "@/actual.ts"
import * as actual from "@actual-app/api"
// TODO actual api does not work with Deno or Bun, because of better-sqlite3. Use Node LTS ☹
async function main() {
console.log("Before init")
await init()
console.log("After init")
console.log("Downloading budget")
await downloadBudget()
console.log("Downloaded budget")
await actual.getBudgetMonth("2024-11")
actual
.getTransactions(
"8e54a5d9-2155-47ff-9b5e-3f87415c2d10",
new Date("01-01-2024"),
new Date("12-12-2024"),
)
.then((transactions) => {
console.log("Transactions", transactions)
})
.catch((error) => {
console.error("Error", error)
})
console.log("Getting accounts")
const accounts = await getAccounts()
console.log("Accounts", accounts)
console.log("Before shutdown")
await shutdown()
console.log("After shutdown")
}
void main()