Giter Club home page Giter Club logo

node-api's People

Contributors

infiniteluke avatar j-f1 avatar jlongster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-api's Issues

Install with npm fails

I'm not sure how to diagnose what the problem is, but I tried installing this with npm and with yarn, both fail, and maybe the problem is with better-sqlite3? I'm not sure. I tried the npm install on macos and on debian and both fail with the same error:

npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm ERR! code 1
npm ERR! path /home/username/dev/actual-api/node_modules/better-sqlite3
npm ERR! command failed
npm ERR! command sh -c prebuild-install || npm run build-release
npm ERR! > [email protected] build-release
npm ERR! > node-gyp rebuild --release
npm ERR!
npm ERR! make: Entering directory '/home/username/dev/actual-api/node_modules/better-sqlite3/build'
npm ERR!   TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm ERR!   ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm ERR!   TOUCH Release/obj.target/deps/locate_sqlite3.stamp
npm ERR!   CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
npm ERR! rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm ERR! make: Leaving directory '/home/username/dev/actual-api/node_modules/better-sqlite3/build'
npm ERR! prebuild-install warn install No prebuilt binaries found (target=19.1.0 runtime=node arch=x64 libc= platform=linux)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/username/dev/actual-api/node_modules/better-sqlite3/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/username/.cache/node-gyp/19.1.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/username/.cache/node-gyp/19.1.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/username/.cache/node-gyp/19.1.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/username/dev/actual-api/node_modules/better-sqlite3',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: cc: Command not found
npm ERR! make: *** [deps/sqlite3.target.mk:203: Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 4.19.0-6-amd64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd /home/username/dev/actual-api/node_modules/better-sqlite3
npm ERR! gyp ERR! node -v v19.1.0
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok

addTransaction is not defined

I get the following error when requiring @actual-app/api:

ReferenceError: addTransaction is not defined
    at Object.<anonymous> (<snip>/node_modules/@actual-app/api/api.js:169:3)

Expose `.d.ts`?

Summary

Are there any plans to expose types for the node package?

Would you accept contributions for this?

(If so - would you rather a static .d.ts or adding a tsc build step to the loop? A @types/* package?)

Error: [API Error] Can't convert to integer: "-22450"

Hi James,

My importing script which has been working fine for the last year and a half has stopped working after upgrading Actual today due to an issue parsing the amount of a transaction.

The error (for a payment transaction):

Error: [API Error] Can't convert to integer: "-22450"
    at /.../node_modules/@actual-app/api/connection.js:26:13
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

And this test in javascript worked just fine

parseInt("-22450"); // => -22450

Which begs the question, did you introduce another way one has to define a payment transaction if so could you point me in the right direction please? I checked on https://actualbudget.com/docs/developers/API/#importtransactions but it either wasn't written there or hasn't jumped out a me enough.

The Version of Actual I got running is 0.1.130, sadly I cannot recall what the previous version was which I had running but I haven't been upgrading since November 2020.

And using "@actual-app/api": "1.1.2" as the dependency.

Have a nice day,
Regards, Philipp

issue with update transactions

when i run update transactions i get the following error:

  Error: [API Error] Tried to edit unknown transaction id: undefined
      at Promise.catch.err (/Users/mohammad/node_modules/@actual-app/api/connection.js:26:13)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:160:7)

the code im using is as follows:

let api = require('@actual-app/api');
async function run() {
  let budget = await api.getAccounts();
  let f= await api.addTransactions('REDACTED',[{date:'2020-01-02'}])
  let e= await api.getTransactions('REDACTED','2020-01-01','2022-01-20');
  let g= await api.updateTransaction(e[e.length-1]["id"],{})
}
api.runWithBudget('My-Finances-b1bae9d', run);

other methods such as api.deleteTransaction() work fine so i know the id i am using is correct.

Unable to use this with self-hosted actual

Now that actual is open-source, I'm trying to use this node-api with the self-hosted version.
The documentation states that I must first be running actual locally. However, with the self-hosted version of actual the closest I get to running it locally is by going to the site where it is hosted in the browser.

I see that connection.js is trying to make a socket connection to my locally running actual. However, it fails since actual is just loaded in firefox, despite the fact that these are both local.

I also tried running this node-api on the server were actual is installed, and it too fails.

Error: Couldn't connect to Actual. Please run the app first.
    at init (/Users/username/node_modules/@actual-app/api/connection.js:44:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _run (/Users/username/node_modules/@actual-app/api/connection.js:90:5)

Is there still a way to use the api with the self-hosted version of actual?
@jlongster
Thanks!

[API Error] no such table: spreadsheet_cells

๐Ÿ‘‹

I'm trying to run the nYNAB importer but I'm getting an error "[API Error] no such table: spreadsheet_cells" โ€“ I'm not able to find the word "spreadsheet_cells" in any code or installed npm module, so I think this must be coming from the app itself. Any help on what to do to get around this?

Connection issues when Actual is started after API client

I am experiencing connection issues when the API client is invoked before Actual has started.

The problem occurs when doing the following

  1. Try to connect to the API before Actual has started
  2. Start Actual
  3. Retry the connection
  4. The connection is never established

I have not investigated further, but I think this line might be a problem

if (initialized) {

Maybe an unsuccessful connection attempt returns something that evaluates as truthy?

I am not sure if this is the best solution, but applying this patch fixes the problem

--- a/node_modules/@actual-app/api/connection.js
+++ b/node_modules/@actual-app/api/connection.js
@@ -41,6 +41,7 @@ async function init(socketName) {
     // TODO: This could spawn Actual automatically. The ideal solution
     // would be to bundle the entire backend and embed it directly
     // into the distributed library.
+    initialized = false;
     throw new Error("Couldn't connect to Actual. Please run the app first.");
   }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.