@actual-app/api 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app/query.js CHANGED
@@ -23,7 +23,7 @@ class Query {
23
23
  });
24
24
  }
25
25
  unfilter(exprs) {
26
- let exprSet = new Set(exprs);
26
+ const exprSet = new Set(exprs);
27
27
  return new Query({
28
28
  ...this.state,
29
29
  filterExpressions: this.state.filterExpressions.filter(expr => !exprSet.has(Object.keys(expr)[0])),
@@ -33,12 +33,12 @@ class Query {
33
33
  if (!Array.isArray(exprs)) {
34
34
  exprs = [exprs];
35
35
  }
36
- let query = new Query({ ...this.state, selectExpressions: exprs });
36
+ const query = new Query({ ...this.state, selectExpressions: exprs });
37
37
  query.state.calculation = false;
38
38
  return query;
39
39
  }
40
40
  calculate(expr) {
41
- let query = this.select({ result: expr });
41
+ const query = this.select({ result: expr });
42
42
  query.state.calculation = true;
43
43
  return query;
44
44
  }
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ exports.shutdown = exports.init = exports.utils = exports.methods = exports.inte
31
31
  // eslint-disable-next-line import/extensions
32
32
  const bundle = __importStar(require("./app/bundle.api.js"));
33
33
  const injected = __importStar(require("./injected"));
34
+ const validateNodeVersion_1 = require("./validateNodeVersion");
34
35
  let actualApp;
35
36
  exports.internal = bundle.lib;
36
37
  // DEPRECATED: remove the next line in @actual-app/api v7
@@ -41,6 +42,7 @@ async function init(config = {}) {
41
42
  if (actualApp) {
42
43
  return;
43
44
  }
45
+ (0, validateNodeVersion_1.validateNodeVersion)();
44
46
  global.fetch = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args));
45
47
  await bundle.init(config);
46
48
  actualApp = bundle.lib;
package/dist/methods.d.ts CHANGED
@@ -10,7 +10,10 @@ export function getBudgetMonths(): any;
10
10
  export function getBudgetMonth(month: any): any;
11
11
  export function setBudgetAmount(month: any, categoryId: any, value: any): any;
12
12
  export function setBudgetCarryover(month: any, categoryId: any, flag: any): any;
13
- export function addTransactions(accountId: any, transactions: any): any;
13
+ export function addTransactions(accountId: any, transactions: any, { learnCategories, runTransfers }?: {
14
+ learnCategories?: boolean;
15
+ runTransfers?: boolean;
16
+ }): any;
14
17
  export function importTransactions(accountId: any, transactions: any): any;
15
18
  export function getTransactions(accountId: any, startDate: any, endDate: any): any;
16
19
  export function filterTransactions(accountId: any, text: any): any;
package/dist/methods.js CHANGED
@@ -87,8 +87,13 @@ function setBudgetCarryover(month, categoryId, flag) {
87
87
  return send('api/budget-set-carryover', { month, categoryId, flag });
88
88
  }
89
89
  exports.setBudgetCarryover = setBudgetCarryover;
90
- function addTransactions(accountId, transactions) {
91
- return send('api/transactions-add', { accountId, transactions });
90
+ function addTransactions(accountId, transactions, { learnCategories = false, runTransfers = false } = {}) {
91
+ return send('api/transactions-add', {
92
+ accountId,
93
+ transactions,
94
+ learnCategories,
95
+ runTransfers,
96
+ });
92
97
  }
93
98
  exports.addTransactions = addTransactions;
94
99
  function importTransactions(accountId, transactions) {
@@ -0,0 +1,5 @@
1
+ BEGIN TRANSACTION;
2
+
3
+ ALTER TABLE schedules_next_date ADD COLUMN tombstone INTEGER DEFAULT 0;
4
+
5
+ COMMIT;
@@ -0,0 +1,7 @@
1
+ BEGIN TRANSACTION;
2
+
3
+ ALTER TABLE zero_budgets ADD column goal INTEGER DEFAULT null;
4
+ ALTER TABLE reflect_budgets ADD column goal INTEGER DEFAULT null;
5
+ ALTER TABLE categories ADD column goal_def TEXT DEFAULT null;
6
+
7
+ COMMIT;
@@ -0,0 +1,5 @@
1
+ BEGIN TRANSACTION;
2
+
3
+ ALTER TABLE transactions ADD COLUMN reconciled INTEGER DEFAULT 0;
4
+
5
+ COMMIT;
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@actual-app/api",
3
+ "version": "6.3.0",
4
+ "license": "MIT",
5
+ "description": "An API for Actual",
6
+ "engines": {
7
+ "node": ">=18.12.0"
8
+ },
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "scripts": {
15
+ "build:app": "yarn workspace loot-core build:api",
16
+ "build:node": "tsc --p tsconfig.dist.json",
17
+ "build:migrations": "cp migrations/*.sql dist/migrations",
18
+ "build:default-db": "cp default-db.sqlite dist/",
19
+ "build": "rm -rf dist && yarn run build:app && yarn run build:node && yarn run build:migrations && yarn run build:default-db"
20
+ },
21
+ "dependencies": {
22
+ "better-sqlite3": "^9.1.1",
23
+ "compare-versions": "^6.1.0",
24
+ "node-fetch": "^3.3.2",
25
+ "uuid": "^9.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/uuid": "^9.0.2",
29
+ "typescript": "^5.0.2"
30
+ }
31
+ }
@@ -0,0 +1 @@
1
+ export function validateNodeVersion(): void;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.validateNodeVersion = void 0;
27
+ const compare_versions_1 = require("compare-versions");
28
+ const packageJson = __importStar(require("./package.json"));
29
+ function validateNodeVersion() {
30
+ if (process?.versions?.node) {
31
+ const nodeVersion = process?.versions?.node;
32
+ const minimumNodeVersion = packageJson.engines.node;
33
+ if (!(0, compare_versions_1.satisfies)(nodeVersion, minimumNodeVersion)) {
34
+ throw new Error(`@actual-app/api requires a node version ${minimumNodeVersion}. Found that you are using: ${nodeVersion}. Please upgrade to a higher version`);
35
+ }
36
+ }
37
+ }
38
+ exports.validateNodeVersion = validateNodeVersion;
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "6.2.0",
3
+ "version": "6.3.0",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
+ "engines": {
7
+ "node": ">=18.12.0"
8
+ },
6
9
  "main": "dist/index.js",
7
10
  "types": "dist/index.d.ts",
8
11
  "files": [
@@ -16,7 +19,8 @@
16
19
  "build": "rm -rf dist && yarn run build:app && yarn run build:node && yarn run build:migrations && yarn run build:default-db"
17
20
  },
18
21
  "dependencies": {
19
- "better-sqlite3": "^8.2.0",
22
+ "better-sqlite3": "^9.1.1",
23
+ "compare-versions": "^6.1.0",
20
24
  "node-fetch": "^3.3.2",
21
25
  "uuid": "^9.0.0"
22
26
  },