@actual-app/api 5.0.0 → 5.1.1

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/app/query.js CHANGED
@@ -11,14 +11,14 @@ class Query {
11
11
  validateRefs: true,
12
12
  limit: null,
13
13
  offset: null,
14
- ...state
14
+ ...state,
15
15
  };
16
16
  }
17
17
 
18
18
  filter(expr) {
19
19
  return new Query({
20
20
  ...this.state,
21
- filterExpressions: [...this.state.filterExpressions, expr]
21
+ filterExpressions: [...this.state.filterExpressions, expr],
22
22
  });
23
23
  }
24
24
 
@@ -27,8 +27,8 @@ class Query {
27
27
  return new Query({
28
28
  ...this.state,
29
29
  filterExpressions: this.state.filterExpressions.filter(
30
- expr => !exprSet.has(Object.keys(expr)[0])
31
- )
30
+ expr => !exprSet.has(Object.keys(expr)[0]),
31
+ ),
32
32
  });
33
33
  }
34
34
 
@@ -55,7 +55,7 @@ class Query {
55
55
 
56
56
  return new Query({
57
57
  ...this.state,
58
- groupExpressions: [...this.state.groupExpressions, ...exprs]
58
+ groupExpressions: [...this.state.groupExpressions, ...exprs],
59
59
  });
60
60
  }
61
61
 
@@ -66,7 +66,7 @@ class Query {
66
66
 
67
67
  return new Query({
68
68
  ...this.state,
69
- orderExpressions: [...this.state.orderExpressions, ...exprs]
69
+ orderExpressions: [...this.state.orderExpressions, ...exprs],
70
70
  });
71
71
  }
72
72
 
@@ -99,24 +99,6 @@ class Query {
99
99
  }
100
100
  }
101
101
 
102
- function getPrimaryOrderBy(query, defaultOrderBy) {
103
- let orderExprs = query.serialize().orderExpressions;
104
- if (orderExprs.length === 0) {
105
- if (defaultOrderBy) {
106
- return { order: 'asc', ...defaultOrderBy };
107
- }
108
- return null;
109
- }
110
-
111
- let firstOrder = orderExprs[0];
112
- if (typeof firstOrder === 'string') {
113
- return { field: firstOrder, order: 'asc' };
114
- }
115
- // Handle this form: { field: 'desc' }
116
- let [field] = Object.keys(firstOrder);
117
- return { field, order: firstOrder[field] };
118
- }
119
-
120
102
  module.exports = function q(table) {
121
103
  return new Query({ table });
122
104
  };
package/methods.js CHANGED
@@ -105,10 +105,6 @@ function deleteAccount(id) {
105
105
  return send('api/account-delete', { id });
106
106
  }
107
107
 
108
- function getCategoryGroups() {
109
- return send('api/categories-get', { grouped: true });
110
- }
111
-
112
108
  function createCategoryGroup(group) {
113
109
  return send('api/category-group-create', { group });
114
110
  }
@@ -6,7 +6,7 @@ export default async function runMigration(db, uuid) {
6
6
  db.execQuery(`
7
7
  CREATE TABLE zero_budget_months
8
8
  (id TEXT PRIMARY KEY,
9
- buffered INTEGER DEFAULT 0);
9
+ buffered INTEGER DEFAULT 0);
10
10
 
11
11
  CREATE TABLE zero_budgets
12
12
  (id TEXT PRIMARY KEY,
@@ -34,12 +34,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
34
34
  let budget = db.runQuery(
35
35
  `SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!budget-%'`,
36
36
  [],
37
- true
37
+ true,
38
38
  );
39
39
  db.transaction(() => {
40
- budget.map(monthBudget => {
40
+ budget.forEach(monthBudget => {
41
41
  let match = monthBudget.name.match(
42
- /^(budget-report|budget)(\d+)!budget-(.+)$/
42
+ /^(budget-report|budget)(\d+)!budget-(.+)$/,
43
43
  );
44
44
  if (match == null) {
45
45
  console.log('Warning: invalid budget month name', monthBudget.name);
@@ -60,7 +60,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
60
60
  let carryover = db.runQuery(
61
61
  'SELECT * FROM spreadsheet_cells WHERE name = ?',
62
62
  [`${sheetName}!carryover-${cat}`],
63
- true
63
+ true,
64
64
  );
65
65
 
66
66
  let table = type === 'budget-report' ? 'reflect_budgets' : 'zero_budgets';
@@ -71,8 +71,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
71
71
  dbmonth,
72
72
  cat,
73
73
  amount,
74
- carryover.length > 0 && getValue(carryover[0]) === 'true' ? 1 : 0
75
- ]
74
+ carryover.length > 0 && getValue(carryover[0]) === 'true' ? 1 : 0,
75
+ ],
76
76
  );
77
77
  });
78
78
  });
@@ -81,10 +81,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
81
81
  let buffers = db.runQuery(
82
82
  `SELECT * FROM spreadsheet_cells WHERE name LIKE 'budget%!buffered'`,
83
83
  [],
84
- true
84
+ true,
85
85
  );
86
86
  db.transaction(() => {
87
- buffers.map(buffer => {
87
+ buffers.forEach(buffer => {
88
88
  let match = buffer.name.match(/^budget(\d+)!buffered$/);
89
89
  if (match) {
90
90
  let month = match[1].slice(0, 4) + '-' + match[1].slice(4);
@@ -95,7 +95,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
95
95
 
96
96
  db.runQuery(
97
97
  `INSERT INTO zero_budget_months (id, buffered) VALUES (?, ?)`,
98
- [month, amount]
98
+ [month, amount],
99
99
  );
100
100
  }
101
101
  });
@@ -105,7 +105,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
105
105
  let notes = db.runQuery(
106
106
  `SELECT * FROM spreadsheet_cells WHERE name LIKE 'notes!%'`,
107
107
  [],
108
- true
108
+ true,
109
109
  );
110
110
 
111
111
  let parseNote = str => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actual-app/api",
3
- "version": "5.0.0",
3
+ "version": "5.1.1",
4
4
  "license": "MIT",
5
5
  "description": "An API for Actual",
6
6
  "main": "index.js",
@@ -14,10 +14,11 @@
14
14
  "utils.js"
15
15
  ],
16
16
  "scripts": {
17
+ "lint": "eslint .",
17
18
  "build": "yarn workspace loot-core build:api"
18
19
  },
19
20
  "dependencies": {
20
- "better-sqlite3": "^7.5.0",
21
+ "better-sqlite3": "^8.2.0",
21
22
  "node-fetch": "^2.6.9",
22
23
  "uuid": "3.3.2"
23
24
  }