Skip to content

A Node.js API for MoneyMoney on Mac.

Notifications You must be signed in to change notification settings

NikxDa/node-moneymoney

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MoneyMoney

An AppleScript-based API for working with MoneyMoney on macOS, written in TypeScript.

Installation

Install this package via NPM:

$ npm i --save moneymoney

Features

The whole code is fully typed, making it easy to work with return types and see which options need to be passed. Not all AppleScript features are currently implemented, but they will be shortly. See the table below for details

Feature AppleScript API Node.js API
Export Accounts
Export Categories
Export Transactions
Export Portfolio 🚧
Create Bank Transfer
Create Batch Transfer 🚧
Create Direct Debit 🚧
Create Batch Direct Debit 🚧
Add Transaction
Update Transaction
Check Unlock Status

Usage

All available functions are exported from the moneymoney package. The whole API is Promise-based, meaning you need to await the returned promises before being able to work with the results.

Warning

All methods interfacing with MoneyMoney require the application to be unlocked. If the application is locked, a DatabaseLockedError will be thrown. You need to handle this error in your application yourself.

Example:

import { DatabaseLockedError, getTransactions } from "moneymoney";

async function handleDatabaseLocked(err) {
    if (err instanceof DatabaseLockedError) {
        console.log("Please unlock MoneyMoney to count the transactions.");
        return null;
    } else {
        throw err;
    }
}

async function countTransactions() {
    const transactions = await getTransactions({
        from: new Date(),
    }).catch(handleDatabaseLocked);

    if (transactions !== null) {
        console.log(`There are ${transactions.length} transactions.`);
    }
}

countTransactions();