@actual-app/api 6.0.0 → 6.1.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.
Files changed (28) hide show
  1. package/dist/app/bundle.api.js +16317 -24484
  2. package/dist/app/query.js +67 -81
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.js +22 -73
  5. package/dist/methods.js +48 -125
  6. package/dist/migrations/1632571489012_remove_cache.js +93 -119
  7. package/dist/migrations/1685007876842_add_category_hidden.sql +6 -0
  8. package/dist/test.js +4 -52
  9. package/package.json +5 -5
  10. package/migrations/1632571489012_remove_cache.js +0 -135
  11. /package/{default-db.sqlite → dist/default-db.sqlite} +0 -0
  12. /package/{migrations → dist/migrations}/1548957970627_remove-db-version.sql +0 -0
  13. /package/{migrations → dist/migrations}/1550601598648_payees.sql +0 -0
  14. /package/{migrations → dist/migrations}/1555786194328_remove_category_group_unique.sql +0 -0
  15. /package/{migrations → dist/migrations}/1561751833510_indexes.sql +0 -0
  16. /package/{migrations → dist/migrations}/1567699552727_budget.sql +0 -0
  17. /package/{migrations → dist/migrations}/1582384163573_cleared.sql +0 -0
  18. /package/{migrations → dist/migrations}/1597756566448_rules.sql +0 -0
  19. /package/{migrations → dist/migrations}/1608652596043_parent_field.sql +0 -0
  20. /package/{migrations → dist/migrations}/1608652596044_trans_views.sql +0 -0
  21. /package/{migrations → dist/migrations}/1612625548236_optimize.sql +0 -0
  22. /package/{migrations → dist/migrations}/1614782639336_trans_views2.sql +0 -0
  23. /package/{migrations → dist/migrations}/1615745967948_meta.sql +0 -0
  24. /package/{migrations → dist/migrations}/1616167010796_accounts_order.sql +0 -0
  25. /package/{migrations → dist/migrations}/1618975177358_schedules.sql +0 -0
  26. /package/{migrations → dist/migrations}/1679728867040_rules_conditions.sql +0 -0
  27. /package/{migrations → dist/migrations}/1681115033845_add_schedule_name.sql +0 -0
  28. /package/{migrations → dist/migrations}/1682974838138_remove_payee_rules.sql +0 -0
package/dist/app/query.js CHANGED
@@ -1,102 +1,88 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __read = (this && this.__read) || function (o, n) {
14
- var m = typeof Symbol === "function" && o[Symbol.iterator];
15
- if (!m) return o;
16
- var i = m.call(o), r, ar = [], e;
17
- try {
18
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class Query {
4
+ constructor(state) {
5
+ this.state = {
6
+ filterExpressions: state.filterExpressions || [],
7
+ selectExpressions: state.selectExpressions || [],
8
+ groupExpressions: state.groupExpressions || [],
9
+ orderExpressions: state.orderExpressions || [],
10
+ calculation: false,
11
+ rawMode: false,
12
+ withDead: false,
13
+ validateRefs: true,
14
+ limit: null,
15
+ offset: null,
16
+ ...state,
17
+ };
19
18
  }
20
- catch (error) { e = { error: error }; }
21
- finally {
22
- try {
23
- if (r && !r.done && (m = i["return"])) m.call(i);
24
- }
25
- finally { if (e) throw e.error; }
19
+ filter(expr) {
20
+ return new Query({
21
+ ...this.state,
22
+ filterExpressions: [...this.state.filterExpressions, expr],
23
+ });
26
24
  }
27
- return ar;
28
- };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
- if (ar || !(i in from)) {
32
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
- ar[i] = from[i];
34
- }
25
+ unfilter(exprs) {
26
+ let exprSet = new Set(exprs);
27
+ return new Query({
28
+ ...this.state,
29
+ filterExpressions: this.state.filterExpressions.filter(expr => !exprSet.has(Object.keys(expr)[0])),
30
+ });
35
31
  }
36
- return to.concat(ar || Array.prototype.slice.call(from));
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var Query = /** @class */ (function () {
40
- function Query(state) {
41
- this.state = __assign({ filterExpressions: state.filterExpressions || [], selectExpressions: state.selectExpressions || [], groupExpressions: state.groupExpressions || [], orderExpressions: state.orderExpressions || [], calculation: false, rawMode: false, withDead: false, validateRefs: true, limit: null, offset: null }, state);
42
- }
43
- Query.prototype.filter = function (expr) {
44
- return new Query(__assign(__assign({}, this.state), { filterExpressions: __spreadArray(__spreadArray([], __read(this.state.filterExpressions), false), [expr], false) }));
45
- };
46
- Query.prototype.unfilter = function (exprs) {
47
- var exprSet = new Set(exprs);
48
- return new Query(__assign(__assign({}, this.state), { filterExpressions: this.state.filterExpressions.filter(function (expr) { return !exprSet.has(Object.keys(expr)[0]); }) }));
49
- };
50
- Query.prototype.select = function (exprs) {
51
- if (exprs === void 0) { exprs = []; }
32
+ select(exprs = []) {
52
33
  if (!Array.isArray(exprs)) {
53
34
  exprs = [exprs];
54
35
  }
55
- var query = new Query(__assign(__assign({}, this.state), { selectExpressions: exprs }));
36
+ let query = new Query({ ...this.state, selectExpressions: exprs });
56
37
  query.state.calculation = false;
57
38
  return query;
58
- };
59
- Query.prototype.calculate = function (expr) {
60
- var query = this.select({ result: expr });
39
+ }
40
+ calculate(expr) {
41
+ let query = this.select({ result: expr });
61
42
  query.state.calculation = true;
62
43
  return query;
63
- };
64
- Query.prototype.groupBy = function (exprs) {
44
+ }
45
+ groupBy(exprs) {
65
46
  if (!Array.isArray(exprs)) {
66
47
  exprs = [exprs];
67
48
  }
68
- return new Query(__assign(__assign({}, this.state), { groupExpressions: __spreadArray(__spreadArray([], __read(this.state.groupExpressions), false), __read(exprs), false) }));
69
- };
70
- Query.prototype.orderBy = function (exprs) {
49
+ return new Query({
50
+ ...this.state,
51
+ groupExpressions: [...this.state.groupExpressions, ...exprs],
52
+ });
53
+ }
54
+ orderBy(exprs) {
71
55
  if (!Array.isArray(exprs)) {
72
56
  exprs = [exprs];
73
57
  }
74
- return new Query(__assign(__assign({}, this.state), { orderExpressions: __spreadArray(__spreadArray([], __read(this.state.orderExpressions), false), __read(exprs), false) }));
75
- };
76
- Query.prototype.limit = function (num) {
77
- return new Query(__assign(__assign({}, this.state), { limit: num }));
78
- };
79
- Query.prototype.offset = function (num) {
80
- return new Query(__assign(__assign({}, this.state), { offset: num }));
81
- };
82
- Query.prototype.raw = function () {
83
- return new Query(__assign(__assign({}, this.state), { rawMode: true }));
84
- };
85
- Query.prototype.withDead = function () {
86
- return new Query(__assign(__assign({}, this.state), { withDead: true }));
87
- };
88
- Query.prototype.withoutValidatedRefs = function () {
89
- return new Query(__assign(__assign({}, this.state), { validateRefs: false }));
90
- };
91
- Query.prototype.options = function (opts) {
92
- return new Query(__assign(__assign({}, this.state), { tableOptions: opts }));
93
- };
94
- Query.prototype.serialize = function () {
58
+ return new Query({
59
+ ...this.state,
60
+ orderExpressions: [...this.state.orderExpressions, ...exprs],
61
+ });
62
+ }
63
+ limit(num) {
64
+ return new Query({ ...this.state, limit: num });
65
+ }
66
+ offset(num) {
67
+ return new Query({ ...this.state, offset: num });
68
+ }
69
+ raw() {
70
+ return new Query({ ...this.state, rawMode: true });
71
+ }
72
+ withDead() {
73
+ return new Query({ ...this.state, withDead: true });
74
+ }
75
+ withoutValidatedRefs() {
76
+ return new Query({ ...this.state, validateRefs: false });
77
+ }
78
+ options(opts) {
79
+ return new Query({ ...this.state, tableOptions: opts });
80
+ }
81
+ serialize() {
95
82
  return this.state;
96
- };
97
- return Query;
98
- }());
83
+ }
84
+ }
99
85
  function q(table) {
100
- return new Query({ table: table });
86
+ return new Query({ table });
101
87
  }
102
88
  exports.default = q;
package/dist/index.d.ts CHANGED
@@ -2,4 +2,5 @@ export function init(config?: {}): Promise<any>;
2
2
  export function shutdown(): Promise<void>;
3
3
  export const internal: any;
4
4
  export * as methods from "./methods";
5
+ export * from "./methods";
5
6
  export * as utils from "./utils";
package/dist/index.js CHANGED
@@ -22,89 +22,38 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
60
27
  };
61
28
  var __importDefault = (this && this.__importDefault) || function (mod) {
62
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
30
  };
64
31
  Object.defineProperty(exports, "__esModule", { value: true });
65
32
  exports.shutdown = exports.init = exports.utils = exports.methods = exports.internal = void 0;
66
- var node_fetch_1 = __importDefault(require("node-fetch"));
67
- var bundle = __importStar(require("./app/bundle.api"));
68
- var injected = __importStar(require("./injected"));
69
- var actualApp;
33
+ const node_fetch_1 = __importDefault(require("node-fetch"));
34
+ const bundle = __importStar(require("./app/bundle.api"));
35
+ const injected = __importStar(require("./injected"));
36
+ let actualApp;
70
37
  exports.internal = bundle.lib;
38
+ // DEPRECATED: remove the next line in @actual-app/api v7
71
39
  exports.methods = __importStar(require("./methods"));
40
+ __exportStar(require("./methods"), exports);
72
41
  exports.utils = __importStar(require("./utils"));
73
- function init(config) {
74
- if (config === void 0) { config = {}; }
75
- return __awaiter(this, void 0, void 0, function () {
76
- return __generator(this, function (_a) {
77
- switch (_a.label) {
78
- case 0:
79
- if (actualApp) {
80
- return [2 /*return*/];
81
- }
82
- global.fetch = node_fetch_1.default;
83
- return [4 /*yield*/, bundle.init(config)];
84
- case 1:
85
- _a.sent();
86
- actualApp = bundle.lib;
87
- injected.override(bundle.lib.send);
88
- return [2 /*return*/, bundle.lib];
89
- }
90
- });
91
- });
42
+ async function init(config = {}) {
43
+ if (actualApp) {
44
+ return;
45
+ }
46
+ global.fetch = node_fetch_1.default;
47
+ await bundle.init(config);
48
+ actualApp = bundle.lib;
49
+ injected.override(bundle.lib.send);
50
+ return bundle.lib;
92
51
  }
93
52
  exports.init = init;
94
- function shutdown() {
95
- return __awaiter(this, void 0, void 0, function () {
96
- return __generator(this, function (_a) {
97
- switch (_a.label) {
98
- case 0:
99
- if (!actualApp) return [3 /*break*/, 2];
100
- return [4 /*yield*/, actualApp.send('close-budget')];
101
- case 1:
102
- _a.sent();
103
- actualApp = null;
104
- _a.label = 2;
105
- case 2: return [2 /*return*/];
106
- }
107
- });
108
- });
53
+ async function shutdown() {
54
+ if (actualApp) {
55
+ await actualApp.send('close-budget');
56
+ actualApp = null;
57
+ }
109
58
  }
110
59
  exports.shutdown = shutdown;
package/dist/methods.js CHANGED
@@ -22,122 +22,45 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
- function verb(n) { return function (v) { return step([n, v]); }; }
38
- function step(op) {
39
- if (f) throw new TypeError("Generator is already executing.");
40
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
- if (y = 0, t) op = [op[0] & 2, t.value];
43
- switch (op[0]) {
44
- case 0: case 1: t = op; break;
45
- case 4: _.label++; return { value: op[1], done: false };
46
- case 5: _.label++; y = op[1]; op = [0]; continue;
47
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
- default:
49
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
- if (t[2]) _.ops.pop();
54
- _.trys.pop(); continue;
55
- }
56
- op = body.call(thisArg, _);
57
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
- }
60
- };
61
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
62
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
27
  };
64
28
  Object.defineProperty(exports, "__esModule", { value: true });
65
29
  exports.deletePayee = exports.updatePayee = exports.createPayee = exports.getPayees = exports.deleteCategory = exports.updateCategory = exports.createCategory = exports.getCategories = exports.deleteCategoryGroup = exports.updateCategoryGroup = exports.createCategoryGroup = exports.deleteAccount = exports.reopenAccount = exports.closeAccount = exports.updateAccount = exports.createAccount = exports.getAccounts = exports.deleteTransaction = exports.updateTransaction = exports.filterTransactions = exports.getTransactions = exports.importTransactions = exports.addTransactions = exports.setBudgetCarryover = exports.setBudgetAmount = exports.getBudgetMonth = exports.getBudgetMonths = exports.runQuery = exports.batchBudgetUpdates = exports.downloadBudget = exports.loadBudget = exports.runImport = exports.q = void 0;
66
- var injected = __importStar(require("./injected"));
30
+ const injected = __importStar(require("./injected"));
67
31
  var query_1 = require("./app/query");
68
32
  Object.defineProperty(exports, "q", { enumerable: true, get: function () { return __importDefault(query_1).default; } });
69
33
  function send(name, args) {
70
34
  return injected.send(name, args);
71
35
  }
72
- function runImport(name, func) {
73
- return __awaiter(this, void 0, void 0, function () {
74
- var e_1;
75
- return __generator(this, function (_a) {
76
- switch (_a.label) {
77
- case 0: return [4 /*yield*/, send('api/start-import', { budgetName: name })];
78
- case 1:
79
- _a.sent();
80
- _a.label = 2;
81
- case 2:
82
- _a.trys.push([2, 4, , 6]);
83
- return [4 /*yield*/, func()];
84
- case 3:
85
- _a.sent();
86
- return [3 /*break*/, 6];
87
- case 4:
88
- e_1 = _a.sent();
89
- return [4 /*yield*/, send('api/abort-import')];
90
- case 5:
91
- _a.sent();
92
- throw e_1;
93
- case 6: return [4 /*yield*/, send('api/finish-import')];
94
- case 7:
95
- _a.sent();
96
- return [2 /*return*/];
97
- }
98
- });
99
- });
36
+ async function runImport(name, func) {
37
+ await send('api/start-import', { budgetName: name });
38
+ try {
39
+ await func();
40
+ }
41
+ catch (e) {
42
+ await send('api/abort-import');
43
+ throw e;
44
+ }
45
+ await send('api/finish-import');
100
46
  }
101
47
  exports.runImport = runImport;
102
- function loadBudget(budgetId) {
103
- return __awaiter(this, void 0, void 0, function () {
104
- return __generator(this, function (_a) {
105
- return [2 /*return*/, send('api/load-budget', { id: budgetId })];
106
- });
107
- });
48
+ async function loadBudget(budgetId) {
49
+ return send('api/load-budget', { id: budgetId });
108
50
  }
109
51
  exports.loadBudget = loadBudget;
110
- function downloadBudget(syncId, _a) {
111
- var _b = _a === void 0 ? {} : _a, password = _b.password;
112
- return __awaiter(this, void 0, void 0, function () {
113
- return __generator(this, function (_c) {
114
- return [2 /*return*/, send('api/download-budget', { syncId: syncId, password: password })];
115
- });
116
- });
52
+ async function downloadBudget(syncId, { password } = {}) {
53
+ return send('api/download-budget', { syncId, password });
117
54
  }
118
55
  exports.downloadBudget = downloadBudget;
119
- function batchBudgetUpdates(func) {
120
- return __awaiter(this, void 0, void 0, function () {
121
- return __generator(this, function (_a) {
122
- switch (_a.label) {
123
- case 0: return [4 /*yield*/, send('api/batch-budget-start')];
124
- case 1:
125
- _a.sent();
126
- _a.label = 2;
127
- case 2:
128
- _a.trys.push([2, , 4, 6]);
129
- return [4 /*yield*/, func()];
130
- case 3:
131
- _a.sent();
132
- return [3 /*break*/, 6];
133
- case 4: return [4 /*yield*/, send('api/batch-budget-end')];
134
- case 5:
135
- _a.sent();
136
- return [7 /*endfinally*/];
137
- case 6: return [2 /*return*/];
138
- }
139
- });
140
- });
56
+ async function batchBudgetUpdates(func) {
57
+ await send('api/batch-budget-start');
58
+ try {
59
+ await func();
60
+ }
61
+ finally {
62
+ await send('api/batch-budget-end');
63
+ }
141
64
  }
142
65
  exports.batchBudgetUpdates = batchBudgetUpdates;
143
66
  function runQuery(query) {
@@ -149,39 +72,39 @@ function getBudgetMonths() {
149
72
  }
150
73
  exports.getBudgetMonths = getBudgetMonths;
151
74
  function getBudgetMonth(month) {
152
- return send('api/budget-month', { month: month });
75
+ return send('api/budget-month', { month });
153
76
  }
154
77
  exports.getBudgetMonth = getBudgetMonth;
155
78
  function setBudgetAmount(month, categoryId, value) {
156
- return send('api/budget-set-amount', { month: month, categoryId: categoryId, amount: value });
79
+ return send('api/budget-set-amount', { month, categoryId, amount: value });
157
80
  }
158
81
  exports.setBudgetAmount = setBudgetAmount;
159
82
  function setBudgetCarryover(month, categoryId, flag) {
160
- return send('api/budget-set-carryover', { month: month, categoryId: categoryId, flag: flag });
83
+ return send('api/budget-set-carryover', { month, categoryId, flag });
161
84
  }
162
85
  exports.setBudgetCarryover = setBudgetCarryover;
163
86
  function addTransactions(accountId, transactions) {
164
- return send('api/transactions-add', { accountId: accountId, transactions: transactions });
87
+ return send('api/transactions-add', { accountId, transactions });
165
88
  }
166
89
  exports.addTransactions = addTransactions;
167
90
  function importTransactions(accountId, transactions) {
168
- return send('api/transactions-import', { accountId: accountId, transactions: transactions });
91
+ return send('api/transactions-import', { accountId, transactions });
169
92
  }
170
93
  exports.importTransactions = importTransactions;
171
94
  function getTransactions(accountId, startDate, endDate) {
172
- return send('api/transactions-get', { accountId: accountId, startDate: startDate, endDate: endDate });
95
+ return send('api/transactions-get', { accountId, startDate, endDate });
173
96
  }
174
97
  exports.getTransactions = getTransactions;
175
98
  function filterTransactions(accountId, text) {
176
- return send('api/transactions-filter', { accountId: accountId, text: text });
99
+ return send('api/transactions-filter', { accountId, text });
177
100
  }
178
101
  exports.filterTransactions = filterTransactions;
179
102
  function updateTransaction(id, fields) {
180
- return send('api/transaction-update', { id: id, fields: fields });
103
+ return send('api/transaction-update', { id, fields });
181
104
  }
182
105
  exports.updateTransaction = updateTransaction;
183
106
  function deleteTransaction(id) {
184
- return send('api/transaction-delete', { id: id });
107
+ return send('api/transaction-delete', { id });
185
108
  }
186
109
  exports.deleteTransaction = deleteTransaction;
187
110
  function getAccounts() {
@@ -189,39 +112,39 @@ function getAccounts() {
189
112
  }
190
113
  exports.getAccounts = getAccounts;
191
114
  function createAccount(account, initialBalance) {
192
- return send('api/account-create', { account: account, initialBalance: initialBalance });
115
+ return send('api/account-create', { account, initialBalance });
193
116
  }
194
117
  exports.createAccount = createAccount;
195
118
  function updateAccount(id, fields) {
196
- return send('api/account-update', { id: id, fields: fields });
119
+ return send('api/account-update', { id, fields });
197
120
  }
198
121
  exports.updateAccount = updateAccount;
199
122
  function closeAccount(id, transferAccountId, transferCategoryId) {
200
123
  return send('api/account-close', {
201
- id: id,
202
- transferAccountId: transferAccountId,
203
- transferCategoryId: transferCategoryId,
124
+ id,
125
+ transferAccountId,
126
+ transferCategoryId,
204
127
  });
205
128
  }
206
129
  exports.closeAccount = closeAccount;
207
130
  function reopenAccount(id) {
208
- return send('api/account-reopen', { id: id });
131
+ return send('api/account-reopen', { id });
209
132
  }
210
133
  exports.reopenAccount = reopenAccount;
211
134
  function deleteAccount(id) {
212
- return send('api/account-delete', { id: id });
135
+ return send('api/account-delete', { id });
213
136
  }
214
137
  exports.deleteAccount = deleteAccount;
215
138
  function createCategoryGroup(group) {
216
- return send('api/category-group-create', { group: group });
139
+ return send('api/category-group-create', { group });
217
140
  }
218
141
  exports.createCategoryGroup = createCategoryGroup;
219
142
  function updateCategoryGroup(id, fields) {
220
- return send('api/category-group-update', { id: id, fields: fields });
143
+ return send('api/category-group-update', { id, fields });
221
144
  }
222
145
  exports.updateCategoryGroup = updateCategoryGroup;
223
146
  function deleteCategoryGroup(id, transferCategoryId) {
224
- return send('api/category-group-delete', { id: id, transferCategoryId: transferCategoryId });
147
+ return send('api/category-group-delete', { id, transferCategoryId });
225
148
  }
226
149
  exports.deleteCategoryGroup = deleteCategoryGroup;
227
150
  function getCategories() {
@@ -229,15 +152,15 @@ function getCategories() {
229
152
  }
230
153
  exports.getCategories = getCategories;
231
154
  function createCategory(category) {
232
- return send('api/category-create', { category: category });
155
+ return send('api/category-create', { category });
233
156
  }
234
157
  exports.createCategory = createCategory;
235
158
  function updateCategory(id, fields) {
236
- return send('api/category-update', { id: id, fields: fields });
159
+ return send('api/category-update', { id, fields });
237
160
  }
238
161
  exports.updateCategory = updateCategory;
239
162
  function deleteCategory(id, transferCategoryId) {
240
- return send('api/category-delete', { id: id, transferCategoryId: transferCategoryId });
163
+ return send('api/category-delete', { id, transferCategoryId });
241
164
  }
242
165
  exports.deleteCategory = deleteCategory;
243
166
  function getPayees() {
@@ -245,14 +168,14 @@ function getPayees() {
245
168
  }
246
169
  exports.getPayees = getPayees;
247
170
  function createPayee(payee) {
248
- return send('api/payee-create', { payee: payee });
171
+ return send('api/payee-create', { payee });
249
172
  }
250
173
  exports.createPayee = createPayee;
251
174
  function updatePayee(id, fields) {
252
- return send('api/payee-update', { id: id, fields: fields });
175
+ return send('api/payee-update', { id, fields });
253
176
  }
254
177
  exports.updatePayee = updatePayee;
255
178
  function deletePayee(id) {
256
- return send('api/payee-delete', { id: id });
179
+ return send('api/payee-delete', { id });
257
180
  }
258
181
  exports.deletePayee = deletePayee;