@actual-app/api 6.0.0 → 6.0.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/dist/app/bundle.api.js +15677 -24574
- package/dist/app/query.js +67 -81
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22 -73
- package/dist/methods.js +48 -125
- package/dist/migrations/1632571489012_remove_cache.js +93 -119
- package/dist/test.js +4 -52
- package/package.json +5 -5
- package/migrations/1632571489012_remove_cache.js +0 -135
- /package/{default-db.sqlite → dist/default-db.sqlite} +0 -0
- /package/{migrations → dist/migrations}/1548957970627_remove-db-version.sql +0 -0
- /package/{migrations → dist/migrations}/1550601598648_payees.sql +0 -0
- /package/{migrations → dist/migrations}/1555786194328_remove_category_group_unique.sql +0 -0
- /package/{migrations → dist/migrations}/1561751833510_indexes.sql +0 -0
- /package/{migrations → dist/migrations}/1567699552727_budget.sql +0 -0
- /package/{migrations → dist/migrations}/1582384163573_cleared.sql +0 -0
- /package/{migrations → dist/migrations}/1597756566448_rules.sql +0 -0
- /package/{migrations → dist/migrations}/1608652596043_parent_field.sql +0 -0
- /package/{migrations → dist/migrations}/1608652596044_trans_views.sql +0 -0
- /package/{migrations → dist/migrations}/1612625548236_optimize.sql +0 -0
- /package/{migrations → dist/migrations}/1614782639336_trans_views2.sql +0 -0
- /package/{migrations → dist/migrations}/1615745967948_meta.sql +0 -0
- /package/{migrations → dist/migrations}/1616167010796_accounts_order.sql +0 -0
- /package/{migrations → dist/migrations}/1618975177358_schedules.sql +0 -0
- /package/{migrations → dist/migrations}/1679728867040_rules_conditions.sql +0 -0
- /package/{migrations → dist/migrations}/1681115033845_add_schedule_name.sql +0 -0
- /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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
36
|
+
let query = new Query({ ...this.state, selectExpressions: exprs });
|
|
56
37
|
query.state.calculation = false;
|
|
57
38
|
return query;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
}
|
|
40
|
+
calculate(expr) {
|
|
41
|
+
let query = this.select({ result: expr });
|
|
61
42
|
query.state.calculation = true;
|
|
62
43
|
return query;
|
|
63
|
-
}
|
|
64
|
-
|
|
44
|
+
}
|
|
45
|
+
groupBy(exprs) {
|
|
65
46
|
if (!Array.isArray(exprs)) {
|
|
66
47
|
exprs = [exprs];
|
|
67
48
|
}
|
|
68
|
-
return new Query(
|
|
69
|
-
|
|
70
|
-
|
|
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(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return new Query(
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return new Query(
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return new Query(
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return new Query(
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return new Query(
|
|
93
|
-
}
|
|
94
|
-
|
|
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
|
-
|
|
98
|
-
}());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
99
85
|
function q(table) {
|
|
100
|
-
return new Query({ table
|
|
86
|
+
return new Query({ table });
|
|
101
87
|
}
|
|
102
88
|
exports.default = q;
|
package/dist/index.d.ts
CHANGED
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
|
|
26
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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 (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
|
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,
|
|
111
|
-
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
202
|
-
transferAccountId
|
|
203
|
-
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
179
|
+
return send('api/payee-delete', { id });
|
|
257
180
|
}
|
|
258
181
|
exports.deletePayee = deletePayee;
|