npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

amatino

v0.0.16

Published

Javascript Node.js bindings library for the Amatino API - Double entry accounting as a service

Downloads

20

Readme

Amatino JS

Amatino is an accounting engine. It stores, organises, and retrieves financial information via an HTTP API. Amatino JS is a library for interacting with the Amatino API from within a Node.js application. By using Amatino JS, a Node.js developer can utilise Amatino services without needing to deal with raw HTTP requests.

About Amatino

Amatino gives you a full set of tools to store, organise and retrieve financial information. You don't need to set up databases or write any of your own double-entry accounting logic. All you need is this library, an Amatino account (Try free for two weeks!), and you are off and running.

Under construction

Right now, the Amatino API offers a full range of accounting services via HTTP requests. However, this Amatino JS library is under construction. Its capabilities are limited to a subset of Amatino services.

To facilitate the use of those services not yet supported, Amatino JS includes the AmatinoAlpha class. AmatinoAlpha is a thin wrapper around asynchronous HTTP requests to the Amatino API. It facilitates testing and experimentation with the Amatino API without having to resort to raw HTTP request manipulation and HMAC computation.

Amatino JS will eventually offer expressive, object-oriented interfaces for all Amatino API services. To be notified when Amatino JS enters a Beta state, with all capabilities available, sign up to the Amatino Development Newsletter or follow @AmatinoAPI on Twitter.

In the mean time, you may wish to review Amatino's HTTP documentation to see what capabilities you can expect from Amatino JS in the future.

Installation

Amatino JS may be installed via NPM.

$ npm install amatino

To use Amatino JS, you will need an active Amatino subscription. You can start a free trial at https://amatino.io/subscribe.

Amatino JS requires Node version 10.4 or greater.

Documentation

Amatino JS is documented via its GitHub Wiki. Each class entry includes comprehensive description of properties and methods, and examples of their usage. For example, check out the Entity class.

Example Usage

All interactions with Amatino start with a Session. Creating a Session is analogous to 'logging in' to the service. We create a Session like so:

const _ = Session.createWithEmail(
  "[email protected]",
  "high entropy passphrase",
  (error, session) => {
    console.log(session.userId) // E.g. logs "46892412"
});

We can then use that Session to utilise Amatino services. For example, we can create an Entity. Entities are objects, beings, and constructs that we wish to describe with financial information. For example, companies, people, or projects.

const _ = Entity.create(
  session, // from the Session.createWithEmail() example above
  "My First Entity",
  "Cayman Islands holding company",
  null,
  (error, entity) => {
    console.log(entity.name) // Logs "My First Entity"
});

Within Entities, we structure financial information into Accounts. For example, a bank account, revenue from sales of goods and services, a credit card, or shareholder equity.

const _ = Account.createWithGlobalUnitDenomination(
  session,
  entity, // from the Entity.create() example above
  "Subscription income",
  Type.revenue,
  null,
  5, // Happens to be the ID for U.S. Dollars
  null,
  "Sweet loot from accounting software subscriptions",
  null,
  (error, account) => {
    console.log(account.name) // Logs 'Subscription income'
]);

We can then store Transactions: Exchanges of value between Accounts.

Transaction.create(
  session,
  entity,
  new Date(),
  "Recognition receipt of sweet loot",
  5,
  null,
  [
    new Entry(Side.credit, '', subscriptionRevenue, "420"),
    new Entry(Side.debit, '', customerDeposits, "42"),
    new Entry(Side.debit, '', cash, "388")
  ],
  (error, transaction) => {
    console.log("Stored " + transaction.description);
  }
);

Objects such as Balances, Recursive Ledgers, Positions, and Trees then provide you with powerful tools to manipulate and retrieve financial data. Those and other objects are not yet available in Amatino JS (We're racing to add them as soon as possible).

In the mean time, the AmatinoAlpha object allows you to experiment with as-yet unsupported services without dealing with raw HTTP requests or HMACs. It lacks the expressive syntax, input validation, and error handling that characterise supported objects such as Transaction.

Initialise an AmatinoAlpha instance like so:

const Amatino = require('amatino');

let _ = Amatino.AmatinoAlpha.createWithEmail(
  '[email protected]',
  'high entropy passphrase',
  (error, amatinoAlpha) => {
    // Do stuff with amatinoAlpha
  }
);

Requests may then be made like so:

let _ = amatinoAlpha.request(
  '/entities',
  'POST',
  null,
  [{
    'name': 'My First Entity',
    'description': null,
    'region_id': null
  }],
  (error, responseData) => {
    const newEntity = responseData[0];
    // Do stuff with newEntity
  }
);

Wherein the parameters passed to request() are the HTTP path, method, url parameters ('query string'), and body laid out in the Amatino API HTTP documentation.

For example, the above request created an Entity. The requirements for Entity creation are available at https://amatino.io/documentation/entities#action-Create.

For more examples of AmatinoAlpha usage, see the getting started guide.

Running tests

Amatino JS features a unit test suite. You can execute the test suite like so:

$ npm test

The test suite requires the presence of two environment variables: AMATINO_TEST_EMAIL and AMATINO_TEST_SECRET. These variables must be populated with the email address and passphrase of an Amatino user account with a valid subscription. For example:

$ export [email protected]
$ export AMATINO_TEST_SECRET="some high entropy passphrase"

JavaScript API stability & versioning

Amatino JS obeys the Semantic Version convention. Until v1.0.0, the JavaSript API should be considered unstable and liable to change at any time.

Watch out! API currently unstable!

You can see available versions in GitHub's releases section or under NPM's 'Versions' heading.

Tell us what your think/want/like/hate

Please join us on the Amatino discussion forums and give us your feedback. We would love to hear from you. Amatino is in its earliest stages of development, and your feedback will influence the direction it moves in.

Pull requests, comments, issues, forking, and so on are also most welcome on Github!

Useful links

Get in contact

To quickly speak to a human about Amatino, email [email protected] or yell at him on Twitter (@hugh_jeremy).