@actual-app/api 5.1.2 → 6.0.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/bundle.api.d.ts +3 -0
- package/dist/app/bundle.api.js +74496 -0
- package/dist/app/query.d.ts +19 -0
- package/dist/app/query.js +102 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +110 -0
- package/dist/injected.d.ts +2 -0
- package/dist/injected.js +8 -0
- package/dist/methods.d.ts +35 -0
- package/dist/methods.js +258 -0
- package/dist/migrations/1632571489012_remove_cache.d.ts +1 -0
- package/dist/migrations/1632571489012_remove_cache.js +129 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +79 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +11 -0
- package/migrations/1681115033845_add_schedule_name.sql +5 -0
- package/migrations/1682974838138_remove_payee_rules.sql +5 -0
- package/package.json +11 -9
- package/app/bundle.api.js +0 -68617
- package/app/bundle.api.js.map +0 -1
- package/app/query.js +0 -104
- package/index.js +0 -34
- package/injected.js +0 -5
- package/methods.js +0 -212
- package/utils.js +0 -9
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default function q(table: any): Query;
|
|
2
|
+
declare class Query {
|
|
3
|
+
constructor(state: any);
|
|
4
|
+
state: any;
|
|
5
|
+
filter(expr: any): Query;
|
|
6
|
+
unfilter(exprs: any): Query;
|
|
7
|
+
select(exprs?: any[]): Query;
|
|
8
|
+
calculate(expr: any): Query;
|
|
9
|
+
groupBy(exprs: any): Query;
|
|
10
|
+
orderBy(exprs: any): Query;
|
|
11
|
+
limit(num: any): Query;
|
|
12
|
+
offset(num: any): Query;
|
|
13
|
+
raw(): Query;
|
|
14
|
+
withDead(): Query;
|
|
15
|
+
withoutValidatedRefs(): Query;
|
|
16
|
+
options(opts: any): Query;
|
|
17
|
+
serialize(): any;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
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);
|
|
19
|
+
}
|
|
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; }
|
|
26
|
+
}
|
|
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
|
+
}
|
|
35
|
+
}
|
|
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 = []; }
|
|
52
|
+
if (!Array.isArray(exprs)) {
|
|
53
|
+
exprs = [exprs];
|
|
54
|
+
}
|
|
55
|
+
var query = new Query(__assign(__assign({}, this.state), { selectExpressions: exprs }));
|
|
56
|
+
query.state.calculation = false;
|
|
57
|
+
return query;
|
|
58
|
+
};
|
|
59
|
+
Query.prototype.calculate = function (expr) {
|
|
60
|
+
var query = this.select({ result: expr });
|
|
61
|
+
query.state.calculation = true;
|
|
62
|
+
return query;
|
|
63
|
+
};
|
|
64
|
+
Query.prototype.groupBy = function (exprs) {
|
|
65
|
+
if (!Array.isArray(exprs)) {
|
|
66
|
+
exprs = [exprs];
|
|
67
|
+
}
|
|
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) {
|
|
71
|
+
if (!Array.isArray(exprs)) {
|
|
72
|
+
exprs = [exprs];
|
|
73
|
+
}
|
|
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 () {
|
|
95
|
+
return this.state;
|
|
96
|
+
};
|
|
97
|
+
return Query;
|
|
98
|
+
}());
|
|
99
|
+
function q(table) {
|
|
100
|
+
return new Query({ table: table });
|
|
101
|
+
}
|
|
102
|
+
exports.default = q;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
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;
|
|
70
|
+
exports.internal = bundle.lib;
|
|
71
|
+
exports.methods = __importStar(require("./methods"));
|
|
72
|
+
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
|
+
});
|
|
92
|
+
}
|
|
93
|
+
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
|
+
});
|
|
109
|
+
}
|
|
110
|
+
exports.shutdown = shutdown;
|
package/dist/injected.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// TODO: comment on why it works this way
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.override = exports.send = void 0;
|
|
5
|
+
function override(sendImplementation) {
|
|
6
|
+
exports.send = sendImplementation;
|
|
7
|
+
}
|
|
8
|
+
exports.override = override;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function runImport(name: any, func: any): Promise<void>;
|
|
2
|
+
export function loadBudget(budgetId: any): Promise<any>;
|
|
3
|
+
export function downloadBudget(syncId: any, { password }?: {
|
|
4
|
+
password: any;
|
|
5
|
+
}): Promise<any>;
|
|
6
|
+
export function batchBudgetUpdates(func: any): Promise<void>;
|
|
7
|
+
export function runQuery(query: any): any;
|
|
8
|
+
export function getBudgetMonths(): any;
|
|
9
|
+
export function getBudgetMonth(month: any): any;
|
|
10
|
+
export function setBudgetAmount(month: any, categoryId: any, value: any): any;
|
|
11
|
+
export function setBudgetCarryover(month: any, categoryId: any, flag: any): any;
|
|
12
|
+
export function addTransactions(accountId: any, transactions: any): any;
|
|
13
|
+
export function importTransactions(accountId: any, transactions: any): any;
|
|
14
|
+
export function getTransactions(accountId: any, startDate: any, endDate: any): any;
|
|
15
|
+
export function filterTransactions(accountId: any, text: any): any;
|
|
16
|
+
export function updateTransaction(id: any, fields: any): any;
|
|
17
|
+
export function deleteTransaction(id: any): any;
|
|
18
|
+
export function getAccounts(): any;
|
|
19
|
+
export function createAccount(account: any, initialBalance: any): any;
|
|
20
|
+
export function updateAccount(id: any, fields: any): any;
|
|
21
|
+
export function closeAccount(id: any, transferAccountId: any, transferCategoryId: any): any;
|
|
22
|
+
export function reopenAccount(id: any): any;
|
|
23
|
+
export function deleteAccount(id: any): any;
|
|
24
|
+
export function createCategoryGroup(group: any): any;
|
|
25
|
+
export function updateCategoryGroup(id: any, fields: any): any;
|
|
26
|
+
export function deleteCategoryGroup(id: any, transferCategoryId: any): any;
|
|
27
|
+
export function getCategories(): any;
|
|
28
|
+
export function createCategory(category: any): any;
|
|
29
|
+
export function updateCategory(id: any, fields: any): any;
|
|
30
|
+
export function deleteCategory(id: any, transferCategoryId: any): any;
|
|
31
|
+
export function getPayees(): any;
|
|
32
|
+
export function createPayee(payee: any): any;
|
|
33
|
+
export function updatePayee(id: any, fields: any): any;
|
|
34
|
+
export function deletePayee(id: any): any;
|
|
35
|
+
export { default as q } from "./app/query";
|
package/dist/methods.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
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
|
+
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
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"));
|
|
67
|
+
var query_1 = require("./app/query");
|
|
68
|
+
Object.defineProperty(exports, "q", { enumerable: true, get: function () { return __importDefault(query_1).default; } });
|
|
69
|
+
function send(name, args) {
|
|
70
|
+
return injected.send(name, args);
|
|
71
|
+
}
|
|
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
|
+
});
|
|
100
|
+
}
|
|
101
|
+
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
|
+
});
|
|
108
|
+
}
|
|
109
|
+
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
|
+
});
|
|
117
|
+
}
|
|
118
|
+
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
|
+
});
|
|
141
|
+
}
|
|
142
|
+
exports.batchBudgetUpdates = batchBudgetUpdates;
|
|
143
|
+
function runQuery(query) {
|
|
144
|
+
return send('api/query', { query: query.serialize() });
|
|
145
|
+
}
|
|
146
|
+
exports.runQuery = runQuery;
|
|
147
|
+
function getBudgetMonths() {
|
|
148
|
+
return send('api/budget-months');
|
|
149
|
+
}
|
|
150
|
+
exports.getBudgetMonths = getBudgetMonths;
|
|
151
|
+
function getBudgetMonth(month) {
|
|
152
|
+
return send('api/budget-month', { month: month });
|
|
153
|
+
}
|
|
154
|
+
exports.getBudgetMonth = getBudgetMonth;
|
|
155
|
+
function setBudgetAmount(month, categoryId, value) {
|
|
156
|
+
return send('api/budget-set-amount', { month: month, categoryId: categoryId, amount: value });
|
|
157
|
+
}
|
|
158
|
+
exports.setBudgetAmount = setBudgetAmount;
|
|
159
|
+
function setBudgetCarryover(month, categoryId, flag) {
|
|
160
|
+
return send('api/budget-set-carryover', { month: month, categoryId: categoryId, flag: flag });
|
|
161
|
+
}
|
|
162
|
+
exports.setBudgetCarryover = setBudgetCarryover;
|
|
163
|
+
function addTransactions(accountId, transactions) {
|
|
164
|
+
return send('api/transactions-add', { accountId: accountId, transactions: transactions });
|
|
165
|
+
}
|
|
166
|
+
exports.addTransactions = addTransactions;
|
|
167
|
+
function importTransactions(accountId, transactions) {
|
|
168
|
+
return send('api/transactions-import', { accountId: accountId, transactions: transactions });
|
|
169
|
+
}
|
|
170
|
+
exports.importTransactions = importTransactions;
|
|
171
|
+
function getTransactions(accountId, startDate, endDate) {
|
|
172
|
+
return send('api/transactions-get', { accountId: accountId, startDate: startDate, endDate: endDate });
|
|
173
|
+
}
|
|
174
|
+
exports.getTransactions = getTransactions;
|
|
175
|
+
function filterTransactions(accountId, text) {
|
|
176
|
+
return send('api/transactions-filter', { accountId: accountId, text: text });
|
|
177
|
+
}
|
|
178
|
+
exports.filterTransactions = filterTransactions;
|
|
179
|
+
function updateTransaction(id, fields) {
|
|
180
|
+
return send('api/transaction-update', { id: id, fields: fields });
|
|
181
|
+
}
|
|
182
|
+
exports.updateTransaction = updateTransaction;
|
|
183
|
+
function deleteTransaction(id) {
|
|
184
|
+
return send('api/transaction-delete', { id: id });
|
|
185
|
+
}
|
|
186
|
+
exports.deleteTransaction = deleteTransaction;
|
|
187
|
+
function getAccounts() {
|
|
188
|
+
return send('api/accounts-get');
|
|
189
|
+
}
|
|
190
|
+
exports.getAccounts = getAccounts;
|
|
191
|
+
function createAccount(account, initialBalance) {
|
|
192
|
+
return send('api/account-create', { account: account, initialBalance: initialBalance });
|
|
193
|
+
}
|
|
194
|
+
exports.createAccount = createAccount;
|
|
195
|
+
function updateAccount(id, fields) {
|
|
196
|
+
return send('api/account-update', { id: id, fields: fields });
|
|
197
|
+
}
|
|
198
|
+
exports.updateAccount = updateAccount;
|
|
199
|
+
function closeAccount(id, transferAccountId, transferCategoryId) {
|
|
200
|
+
return send('api/account-close', {
|
|
201
|
+
id: id,
|
|
202
|
+
transferAccountId: transferAccountId,
|
|
203
|
+
transferCategoryId: transferCategoryId,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
exports.closeAccount = closeAccount;
|
|
207
|
+
function reopenAccount(id) {
|
|
208
|
+
return send('api/account-reopen', { id: id });
|
|
209
|
+
}
|
|
210
|
+
exports.reopenAccount = reopenAccount;
|
|
211
|
+
function deleteAccount(id) {
|
|
212
|
+
return send('api/account-delete', { id: id });
|
|
213
|
+
}
|
|
214
|
+
exports.deleteAccount = deleteAccount;
|
|
215
|
+
function createCategoryGroup(group) {
|
|
216
|
+
return send('api/category-group-create', { group: group });
|
|
217
|
+
}
|
|
218
|
+
exports.createCategoryGroup = createCategoryGroup;
|
|
219
|
+
function updateCategoryGroup(id, fields) {
|
|
220
|
+
return send('api/category-group-update', { id: id, fields: fields });
|
|
221
|
+
}
|
|
222
|
+
exports.updateCategoryGroup = updateCategoryGroup;
|
|
223
|
+
function deleteCategoryGroup(id, transferCategoryId) {
|
|
224
|
+
return send('api/category-group-delete', { id: id, transferCategoryId: transferCategoryId });
|
|
225
|
+
}
|
|
226
|
+
exports.deleteCategoryGroup = deleteCategoryGroup;
|
|
227
|
+
function getCategories() {
|
|
228
|
+
return send('api/categories-get', { grouped: false });
|
|
229
|
+
}
|
|
230
|
+
exports.getCategories = getCategories;
|
|
231
|
+
function createCategory(category) {
|
|
232
|
+
return send('api/category-create', { category: category });
|
|
233
|
+
}
|
|
234
|
+
exports.createCategory = createCategory;
|
|
235
|
+
function updateCategory(id, fields) {
|
|
236
|
+
return send('api/category-update', { id: id, fields: fields });
|
|
237
|
+
}
|
|
238
|
+
exports.updateCategory = updateCategory;
|
|
239
|
+
function deleteCategory(id, transferCategoryId) {
|
|
240
|
+
return send('api/category-delete', { id: id, transferCategoryId: transferCategoryId });
|
|
241
|
+
}
|
|
242
|
+
exports.deleteCategory = deleteCategory;
|
|
243
|
+
function getPayees() {
|
|
244
|
+
return send('api/payees-get');
|
|
245
|
+
}
|
|
246
|
+
exports.getPayees = getPayees;
|
|
247
|
+
function createPayee(payee) {
|
|
248
|
+
return send('api/payee-create', { payee: payee });
|
|
249
|
+
}
|
|
250
|
+
exports.createPayee = createPayee;
|
|
251
|
+
function updatePayee(id, fields) {
|
|
252
|
+
return send('api/payee-update', { id: id, fields: fields });
|
|
253
|
+
}
|
|
254
|
+
exports.updatePayee = updatePayee;
|
|
255
|
+
function deletePayee(id) {
|
|
256
|
+
return send('api/payee-delete', { id: id });
|
|
257
|
+
}
|
|
258
|
+
exports.deletePayee = deletePayee;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function runMigration(db: any, uuid: any): Promise<void>;
|