33 lines
810 B
TypeScript
33 lines
810 B
TypeScript
|
import * as actual from "@actual-app/api"
|
||
|
import {
|
||
|
ACTUAL_DATA_DIR,
|
||
|
ACTUAL_PASSWORD,
|
||
|
ACTUAL_SERVER_URL,
|
||
|
ACTUAL_SYNC_ID,
|
||
|
} from "../config.ts"
|
||
|
|
||
|
export async function init() {
|
||
|
return await actual.init({
|
||
|
// Budget data will be cached locally here, in subdirectories for each file.
|
||
|
dataDir: ACTUAL_DATA_DIR,
|
||
|
// This is the URL of your running server
|
||
|
serverURL: ACTUAL_SERVER_URL,
|
||
|
// This is the password you use to log into the server
|
||
|
password: ACTUAL_PASSWORD,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export async function downloadBudget() {
|
||
|
const something = await actual.downloadBudget(ACTUAL_SYNC_ID)
|
||
|
console.log("downloadBudget", something)
|
||
|
return something
|
||
|
}
|
||
|
|
||
|
export async function getAccounts() {
|
||
|
return await actual.getAccounts()
|
||
|
}
|
||
|
|
||
|
export async function shutdown() {
|
||
|
await actual.shutdown()
|
||
|
}
|