@actual-app/api 6.0.1 → 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.
package/dist/app/bundle.api.js
CHANGED
|
@@ -51159,6 +51159,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
51159
51159
|
id: f('id'),
|
|
51160
51160
|
name: f('string'),
|
|
51161
51161
|
is_income: f('boolean'),
|
|
51162
|
+
hidden: f('boolean'),
|
|
51162
51163
|
group: f('id', {
|
|
51163
51164
|
ref: 'category_groups'
|
|
51164
51165
|
}),
|
|
@@ -51169,6 +51170,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
51169
51170
|
id: f('id'),
|
|
51170
51171
|
name: f('string'),
|
|
51171
51172
|
is_income: f('boolean'),
|
|
51173
|
+
hidden: f('boolean'),
|
|
51172
51174
|
sort_order: f('float'),
|
|
51173
51175
|
tombstone: f('boolean')
|
|
51174
51176
|
},
|
|
@@ -51958,14 +51960,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
51958
51960
|
/* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.ts");
|
|
51959
51961
|
/* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../undo */ "./packages/loot-core/src/server/undo.ts");
|
|
51960
51962
|
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./actions */ "./packages/loot-core/src/server/budget/actions.ts");
|
|
51961
|
-
/* harmony import */ var
|
|
51963
|
+
/* harmony import */ var _cleanup_template__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cleanup-template */ "./packages/loot-core/src/server/budget/cleanup-template.ts");
|
|
51964
|
+
/* harmony import */ var _goaltemplates__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./goaltemplates */ "./packages/loot-core/src/server/budget/goaltemplates.ts");
|
|
51962
51965
|
let app = Object(_app__WEBPACK_IMPORTED_MODULE_0__["createApp"])();
|
|
51963
51966
|
app.method('budget/budget-amount', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["setBudget"])));
|
|
51964
51967
|
app.method('budget/copy-previous-month', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["copyPreviousMonth"])));
|
|
51965
51968
|
app.method('budget/set-zero', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["setZero"])));
|
|
51966
51969
|
app.method('budget/set-3month-avg', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["set3MonthAvg"])));
|
|
51967
|
-
app.method('budget/apply-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(
|
|
51968
|
-
app.method('budget/overwrite-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(
|
|
51970
|
+
app.method('budget/apply-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_goaltemplates__WEBPACK_IMPORTED_MODULE_5__["applyTemplate"])));
|
|
51971
|
+
app.method('budget/overwrite-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_goaltemplates__WEBPACK_IMPORTED_MODULE_5__["overwriteTemplate"])));
|
|
51972
|
+
app.method('budget/cleanup-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_cleanup_template__WEBPACK_IMPORTED_MODULE_4__["cleanupTemplate"])));
|
|
51969
51973
|
app.method('budget/hold-for-next-month', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["holdForNextMonth"])));
|
|
51970
51974
|
app.method('budget/reset-hold', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["resetHold"])));
|
|
51971
51975
|
app.method('budget/cover-overspending', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_actions__WEBPACK_IMPORTED_MODULE_3__["coverOverspending"])));
|
|
@@ -52333,6 +52337,645 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52333
52337
|
}
|
|
52334
52338
|
/***/
|
|
52335
52339
|
}),
|
|
52340
|
+
/***/ "./packages/loot-core/src/server/budget/cleanup-template.pegjs":
|
|
52341
|
+
/*!*********************************************************************!*\
|
|
52342
|
+
!*** ./packages/loot-core/src/server/budget/cleanup-template.pegjs ***!
|
|
52343
|
+
\*********************************************************************/
|
|
52344
|
+
/*! no static exports found */
|
|
52345
|
+
/***/ (function (module, exports, __webpack_require__) {
|
|
52346
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; // Generated by Peggy 3.0.2.
|
|
52347
|
+
//
|
|
52348
|
+
// https://peggyjs.org/
|
|
52349
|
+
(function (root, factory) {
|
|
52350
|
+
if (true) {
|
|
52351
|
+
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
52352
|
+
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
52353
|
+
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
52354
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
52355
|
+
}
|
|
52356
|
+
else { }
|
|
52357
|
+
})(this, function () {
|
|
52358
|
+
"use strict";
|
|
52359
|
+
function peg$subclass(child, parent) {
|
|
52360
|
+
function C() { this.constructor = child; }
|
|
52361
|
+
C.prototype = parent.prototype;
|
|
52362
|
+
child.prototype = new C();
|
|
52363
|
+
}
|
|
52364
|
+
function peg$SyntaxError(message, expected, found, location) {
|
|
52365
|
+
var self = Error.call(this, message);
|
|
52366
|
+
// istanbul ignore next Check is a necessary evil to support older environments
|
|
52367
|
+
if (Object.setPrototypeOf) {
|
|
52368
|
+
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
52369
|
+
}
|
|
52370
|
+
self.expected = expected;
|
|
52371
|
+
self.found = found;
|
|
52372
|
+
self.location = location;
|
|
52373
|
+
self.name = "SyntaxError";
|
|
52374
|
+
return self;
|
|
52375
|
+
}
|
|
52376
|
+
peg$subclass(peg$SyntaxError, Error);
|
|
52377
|
+
function peg$padEnd(str, targetLength, padString) {
|
|
52378
|
+
padString = padString || " ";
|
|
52379
|
+
if (str.length > targetLength) {
|
|
52380
|
+
return str;
|
|
52381
|
+
}
|
|
52382
|
+
targetLength -= str.length;
|
|
52383
|
+
padString += padString.repeat(targetLength);
|
|
52384
|
+
return str + padString.slice(0, targetLength);
|
|
52385
|
+
}
|
|
52386
|
+
peg$SyntaxError.prototype.format = function (sources) {
|
|
52387
|
+
var str = "Error: " + this.message;
|
|
52388
|
+
if (this.location) {
|
|
52389
|
+
var src = null;
|
|
52390
|
+
var k;
|
|
52391
|
+
for (k = 0; k < sources.length; k++) {
|
|
52392
|
+
if (sources[k].source === this.location.source) {
|
|
52393
|
+
src = sources[k].text.split(/\r\n|\n|\r/g);
|
|
52394
|
+
break;
|
|
52395
|
+
}
|
|
52396
|
+
}
|
|
52397
|
+
var s = this.location.start;
|
|
52398
|
+
var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
|
|
52399
|
+
? this.location.source.offset(s)
|
|
52400
|
+
: s;
|
|
52401
|
+
var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
|
|
52402
|
+
if (src) {
|
|
52403
|
+
var e = this.location.end;
|
|
52404
|
+
var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
|
|
52405
|
+
var line = src[s.line - 1];
|
|
52406
|
+
var last = s.line === e.line ? e.column : line.length + 1;
|
|
52407
|
+
var hatLen = (last - s.column) || 1;
|
|
52408
|
+
str += "\n --> " + loc + "\n"
|
|
52409
|
+
+ filler + " |\n"
|
|
52410
|
+
+ offset_s.line + " | " + line + "\n"
|
|
52411
|
+
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
|
|
52412
|
+
+ peg$padEnd("", hatLen, "^");
|
|
52413
|
+
}
|
|
52414
|
+
else {
|
|
52415
|
+
str += "\n at " + loc;
|
|
52416
|
+
}
|
|
52417
|
+
}
|
|
52418
|
+
return str;
|
|
52419
|
+
};
|
|
52420
|
+
peg$SyntaxError.buildMessage = function (expected, found) {
|
|
52421
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
|
52422
|
+
literal: function (expectation) {
|
|
52423
|
+
return "\"" + literalEscape(expectation.text) + "\"";
|
|
52424
|
+
},
|
|
52425
|
+
class: function (expectation) {
|
|
52426
|
+
var escapedParts = expectation.parts.map(function (part) {
|
|
52427
|
+
return Array.isArray(part)
|
|
52428
|
+
? classEscape(part[0]) + "-" + classEscape(part[1])
|
|
52429
|
+
: classEscape(part);
|
|
52430
|
+
});
|
|
52431
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
52432
|
+
},
|
|
52433
|
+
any: function () {
|
|
52434
|
+
return "any character";
|
|
52435
|
+
},
|
|
52436
|
+
end: function () {
|
|
52437
|
+
return "end of input";
|
|
52438
|
+
},
|
|
52439
|
+
other: function (expectation) {
|
|
52440
|
+
return expectation.description;
|
|
52441
|
+
}
|
|
52442
|
+
};
|
|
52443
|
+
function hex(ch) {
|
|
52444
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
52445
|
+
}
|
|
52446
|
+
function literalEscape(s) {
|
|
52447
|
+
return s
|
|
52448
|
+
.replace(/\\/g, "\\\\")
|
|
52449
|
+
.replace(/"/g, "\\\"")
|
|
52450
|
+
.replace(/\0/g, "\\0")
|
|
52451
|
+
.replace(/\t/g, "\\t")
|
|
52452
|
+
.replace(/\n/g, "\\n")
|
|
52453
|
+
.replace(/\r/g, "\\r")
|
|
52454
|
+
.replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
|
|
52455
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
|
|
52456
|
+
}
|
|
52457
|
+
function classEscape(s) {
|
|
52458
|
+
return s
|
|
52459
|
+
.replace(/\\/g, "\\\\")
|
|
52460
|
+
.replace(/\]/g, "\\]")
|
|
52461
|
+
.replace(/\^/g, "\\^")
|
|
52462
|
+
.replace(/-/g, "\\-")
|
|
52463
|
+
.replace(/\0/g, "\\0")
|
|
52464
|
+
.replace(/\t/g, "\\t")
|
|
52465
|
+
.replace(/\n/g, "\\n")
|
|
52466
|
+
.replace(/\r/g, "\\r")
|
|
52467
|
+
.replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
|
|
52468
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
|
|
52469
|
+
}
|
|
52470
|
+
function describeExpectation(expectation) {
|
|
52471
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
52472
|
+
}
|
|
52473
|
+
function describeExpected(expected) {
|
|
52474
|
+
var descriptions = expected.map(describeExpectation);
|
|
52475
|
+
var i, j;
|
|
52476
|
+
descriptions.sort();
|
|
52477
|
+
if (descriptions.length > 0) {
|
|
52478
|
+
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
52479
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
52480
|
+
descriptions[j] = descriptions[i];
|
|
52481
|
+
j++;
|
|
52482
|
+
}
|
|
52483
|
+
}
|
|
52484
|
+
descriptions.length = j;
|
|
52485
|
+
}
|
|
52486
|
+
switch (descriptions.length) {
|
|
52487
|
+
case 1:
|
|
52488
|
+
return descriptions[0];
|
|
52489
|
+
case 2:
|
|
52490
|
+
return descriptions[0] + " or " + descriptions[1];
|
|
52491
|
+
default:
|
|
52492
|
+
return descriptions.slice(0, -1).join(", ")
|
|
52493
|
+
+ ", or "
|
|
52494
|
+
+ descriptions[descriptions.length - 1];
|
|
52495
|
+
}
|
|
52496
|
+
}
|
|
52497
|
+
function describeFound(found) {
|
|
52498
|
+
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
|
52499
|
+
}
|
|
52500
|
+
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
52501
|
+
};
|
|
52502
|
+
function peg$parse(input, options) {
|
|
52503
|
+
options = options !== undefined ? options : {};
|
|
52504
|
+
var peg$FAILED = {};
|
|
52505
|
+
var peg$source = options.grammarSource;
|
|
52506
|
+
var peg$startRuleFunctions = { expr: peg$parseexpr };
|
|
52507
|
+
var peg$startRuleFunction = peg$parseexpr;
|
|
52508
|
+
var peg$c0 = "source";
|
|
52509
|
+
var peg$c1 = "sink";
|
|
52510
|
+
var peg$c2 = " ";
|
|
52511
|
+
var peg$r0 = /^[0-9]/;
|
|
52512
|
+
var peg$e0 = peg$literalExpectation("source", false);
|
|
52513
|
+
var peg$e1 = peg$literalExpectation("sink", false);
|
|
52514
|
+
var peg$e2 = peg$otherExpectation("space");
|
|
52515
|
+
var peg$e3 = peg$literalExpectation(" ", false);
|
|
52516
|
+
var peg$e4 = peg$otherExpectation("digit");
|
|
52517
|
+
var peg$e5 = peg$classExpectation([["0", "9"]], false, false);
|
|
52518
|
+
var peg$e6 = peg$otherExpectation("weight");
|
|
52519
|
+
var peg$f0 = function () { return { type: 'source' }; };
|
|
52520
|
+
var peg$f1 = function (weight) { return { type: 'sink', weight: +weight || 1 }; };
|
|
52521
|
+
var peg$f2 = function (weight) { return +weight; };
|
|
52522
|
+
var peg$currPos = 0;
|
|
52523
|
+
var peg$savedPos = 0;
|
|
52524
|
+
var peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
52525
|
+
var peg$maxFailPos = 0;
|
|
52526
|
+
var peg$maxFailExpected = [];
|
|
52527
|
+
var peg$silentFails = 0;
|
|
52528
|
+
var peg$result;
|
|
52529
|
+
if ("startRule" in options) {
|
|
52530
|
+
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
52531
|
+
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
52532
|
+
}
|
|
52533
|
+
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
52534
|
+
}
|
|
52535
|
+
function text() {
|
|
52536
|
+
return input.substring(peg$savedPos, peg$currPos);
|
|
52537
|
+
}
|
|
52538
|
+
function offset() {
|
|
52539
|
+
return peg$savedPos;
|
|
52540
|
+
}
|
|
52541
|
+
function range() {
|
|
52542
|
+
return {
|
|
52543
|
+
source: peg$source,
|
|
52544
|
+
start: peg$savedPos,
|
|
52545
|
+
end: peg$currPos
|
|
52546
|
+
};
|
|
52547
|
+
}
|
|
52548
|
+
function location() {
|
|
52549
|
+
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
52550
|
+
}
|
|
52551
|
+
function expected(description, location) {
|
|
52552
|
+
location = location !== undefined
|
|
52553
|
+
? location
|
|
52554
|
+
: peg$computeLocation(peg$savedPos, peg$currPos);
|
|
52555
|
+
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
|
|
52556
|
+
}
|
|
52557
|
+
function error(message, location) {
|
|
52558
|
+
location = location !== undefined
|
|
52559
|
+
? location
|
|
52560
|
+
: peg$computeLocation(peg$savedPos, peg$currPos);
|
|
52561
|
+
throw peg$buildSimpleError(message, location);
|
|
52562
|
+
}
|
|
52563
|
+
function peg$literalExpectation(text, ignoreCase) {
|
|
52564
|
+
return { type: "literal", text: text, ignoreCase: ignoreCase };
|
|
52565
|
+
}
|
|
52566
|
+
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
52567
|
+
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
|
52568
|
+
}
|
|
52569
|
+
function peg$anyExpectation() {
|
|
52570
|
+
return { type: "any" };
|
|
52571
|
+
}
|
|
52572
|
+
function peg$endExpectation() {
|
|
52573
|
+
return { type: "end" };
|
|
52574
|
+
}
|
|
52575
|
+
function peg$otherExpectation(description) {
|
|
52576
|
+
return { type: "other", description: description };
|
|
52577
|
+
}
|
|
52578
|
+
function peg$computePosDetails(pos) {
|
|
52579
|
+
var details = peg$posDetailsCache[pos];
|
|
52580
|
+
var p;
|
|
52581
|
+
if (details) {
|
|
52582
|
+
return details;
|
|
52583
|
+
}
|
|
52584
|
+
else {
|
|
52585
|
+
p = pos - 1;
|
|
52586
|
+
while (!peg$posDetailsCache[p]) {
|
|
52587
|
+
p--;
|
|
52588
|
+
}
|
|
52589
|
+
details = peg$posDetailsCache[p];
|
|
52590
|
+
details = {
|
|
52591
|
+
line: details.line,
|
|
52592
|
+
column: details.column
|
|
52593
|
+
};
|
|
52594
|
+
while (p < pos) {
|
|
52595
|
+
if (input.charCodeAt(p) === 10) {
|
|
52596
|
+
details.line++;
|
|
52597
|
+
details.column = 1;
|
|
52598
|
+
}
|
|
52599
|
+
else {
|
|
52600
|
+
details.column++;
|
|
52601
|
+
}
|
|
52602
|
+
p++;
|
|
52603
|
+
}
|
|
52604
|
+
peg$posDetailsCache[pos] = details;
|
|
52605
|
+
return details;
|
|
52606
|
+
}
|
|
52607
|
+
}
|
|
52608
|
+
function peg$computeLocation(startPos, endPos, offset) {
|
|
52609
|
+
var startPosDetails = peg$computePosDetails(startPos);
|
|
52610
|
+
var endPosDetails = peg$computePosDetails(endPos);
|
|
52611
|
+
var res = {
|
|
52612
|
+
source: peg$source,
|
|
52613
|
+
start: {
|
|
52614
|
+
offset: startPos,
|
|
52615
|
+
line: startPosDetails.line,
|
|
52616
|
+
column: startPosDetails.column
|
|
52617
|
+
},
|
|
52618
|
+
end: {
|
|
52619
|
+
offset: endPos,
|
|
52620
|
+
line: endPosDetails.line,
|
|
52621
|
+
column: endPosDetails.column
|
|
52622
|
+
}
|
|
52623
|
+
};
|
|
52624
|
+
if (offset && peg$source && (typeof peg$source.offset === "function")) {
|
|
52625
|
+
res.start = peg$source.offset(res.start);
|
|
52626
|
+
res.end = peg$source.offset(res.end);
|
|
52627
|
+
}
|
|
52628
|
+
return res;
|
|
52629
|
+
}
|
|
52630
|
+
function peg$fail(expected) {
|
|
52631
|
+
if (peg$currPos < peg$maxFailPos) {
|
|
52632
|
+
return;
|
|
52633
|
+
}
|
|
52634
|
+
if (peg$currPos > peg$maxFailPos) {
|
|
52635
|
+
peg$maxFailPos = peg$currPos;
|
|
52636
|
+
peg$maxFailExpected = [];
|
|
52637
|
+
}
|
|
52638
|
+
peg$maxFailExpected.push(expected);
|
|
52639
|
+
}
|
|
52640
|
+
function peg$buildSimpleError(message, location) {
|
|
52641
|
+
return new peg$SyntaxError(message, null, null, location);
|
|
52642
|
+
}
|
|
52643
|
+
function peg$buildStructuredError(expected, found, location) {
|
|
52644
|
+
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
|
|
52645
|
+
}
|
|
52646
|
+
function peg$parseexpr() {
|
|
52647
|
+
var s0, s1, s2, s3;
|
|
52648
|
+
s0 = peg$currPos;
|
|
52649
|
+
s1 = peg$parsesource();
|
|
52650
|
+
if (s1 !== peg$FAILED) {
|
|
52651
|
+
peg$savedPos = s0;
|
|
52652
|
+
s1 = peg$f0();
|
|
52653
|
+
}
|
|
52654
|
+
s0 = s1;
|
|
52655
|
+
if (s0 === peg$FAILED) {
|
|
52656
|
+
s0 = peg$currPos;
|
|
52657
|
+
s1 = peg$parsesink();
|
|
52658
|
+
if (s1 !== peg$FAILED) {
|
|
52659
|
+
s2 = peg$parse_();
|
|
52660
|
+
if (s2 === peg$FAILED) {
|
|
52661
|
+
s2 = null;
|
|
52662
|
+
}
|
|
52663
|
+
s3 = peg$parseweight();
|
|
52664
|
+
if (s3 === peg$FAILED) {
|
|
52665
|
+
s3 = null;
|
|
52666
|
+
}
|
|
52667
|
+
peg$savedPos = s0;
|
|
52668
|
+
s0 = peg$f1(s3);
|
|
52669
|
+
}
|
|
52670
|
+
else {
|
|
52671
|
+
peg$currPos = s0;
|
|
52672
|
+
s0 = peg$FAILED;
|
|
52673
|
+
}
|
|
52674
|
+
}
|
|
52675
|
+
return s0;
|
|
52676
|
+
}
|
|
52677
|
+
function peg$parsesource() {
|
|
52678
|
+
var s0;
|
|
52679
|
+
if (input.substr(peg$currPos, 6) === peg$c0) {
|
|
52680
|
+
s0 = peg$c0;
|
|
52681
|
+
peg$currPos += 6;
|
|
52682
|
+
}
|
|
52683
|
+
else {
|
|
52684
|
+
s0 = peg$FAILED;
|
|
52685
|
+
if (peg$silentFails === 0) {
|
|
52686
|
+
peg$fail(peg$e0);
|
|
52687
|
+
}
|
|
52688
|
+
}
|
|
52689
|
+
return s0;
|
|
52690
|
+
}
|
|
52691
|
+
function peg$parsesink() {
|
|
52692
|
+
var s0;
|
|
52693
|
+
if (input.substr(peg$currPos, 4) === peg$c1) {
|
|
52694
|
+
s0 = peg$c1;
|
|
52695
|
+
peg$currPos += 4;
|
|
52696
|
+
}
|
|
52697
|
+
else {
|
|
52698
|
+
s0 = peg$FAILED;
|
|
52699
|
+
if (peg$silentFails === 0) {
|
|
52700
|
+
peg$fail(peg$e1);
|
|
52701
|
+
}
|
|
52702
|
+
}
|
|
52703
|
+
return s0;
|
|
52704
|
+
}
|
|
52705
|
+
function peg$parse_() {
|
|
52706
|
+
var s0, s1;
|
|
52707
|
+
peg$silentFails++;
|
|
52708
|
+
s0 = [];
|
|
52709
|
+
if (input.charCodeAt(peg$currPos) === 32) {
|
|
52710
|
+
s1 = peg$c2;
|
|
52711
|
+
peg$currPos++;
|
|
52712
|
+
}
|
|
52713
|
+
else {
|
|
52714
|
+
s1 = peg$FAILED;
|
|
52715
|
+
if (peg$silentFails === 0) {
|
|
52716
|
+
peg$fail(peg$e3);
|
|
52717
|
+
}
|
|
52718
|
+
}
|
|
52719
|
+
if (s1 !== peg$FAILED) {
|
|
52720
|
+
while (s1 !== peg$FAILED) {
|
|
52721
|
+
s0.push(s1);
|
|
52722
|
+
if (input.charCodeAt(peg$currPos) === 32) {
|
|
52723
|
+
s1 = peg$c2;
|
|
52724
|
+
peg$currPos++;
|
|
52725
|
+
}
|
|
52726
|
+
else {
|
|
52727
|
+
s1 = peg$FAILED;
|
|
52728
|
+
if (peg$silentFails === 0) {
|
|
52729
|
+
peg$fail(peg$e3);
|
|
52730
|
+
}
|
|
52731
|
+
}
|
|
52732
|
+
}
|
|
52733
|
+
}
|
|
52734
|
+
else {
|
|
52735
|
+
s0 = peg$FAILED;
|
|
52736
|
+
}
|
|
52737
|
+
peg$silentFails--;
|
|
52738
|
+
if (s0 === peg$FAILED) {
|
|
52739
|
+
s1 = peg$FAILED;
|
|
52740
|
+
if (peg$silentFails === 0) {
|
|
52741
|
+
peg$fail(peg$e2);
|
|
52742
|
+
}
|
|
52743
|
+
}
|
|
52744
|
+
return s0;
|
|
52745
|
+
}
|
|
52746
|
+
function peg$parsed() {
|
|
52747
|
+
var s0, s1;
|
|
52748
|
+
peg$silentFails++;
|
|
52749
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
52750
|
+
s0 = input.charAt(peg$currPos);
|
|
52751
|
+
peg$currPos++;
|
|
52752
|
+
}
|
|
52753
|
+
else {
|
|
52754
|
+
s0 = peg$FAILED;
|
|
52755
|
+
if (peg$silentFails === 0) {
|
|
52756
|
+
peg$fail(peg$e5);
|
|
52757
|
+
}
|
|
52758
|
+
}
|
|
52759
|
+
peg$silentFails--;
|
|
52760
|
+
if (s0 === peg$FAILED) {
|
|
52761
|
+
s1 = peg$FAILED;
|
|
52762
|
+
if (peg$silentFails === 0) {
|
|
52763
|
+
peg$fail(peg$e4);
|
|
52764
|
+
}
|
|
52765
|
+
}
|
|
52766
|
+
return s0;
|
|
52767
|
+
}
|
|
52768
|
+
function peg$parseweight() {
|
|
52769
|
+
var s0, s1, s2, s3;
|
|
52770
|
+
peg$silentFails++;
|
|
52771
|
+
s0 = peg$currPos;
|
|
52772
|
+
s1 = peg$currPos;
|
|
52773
|
+
s2 = [];
|
|
52774
|
+
s3 = peg$parsed();
|
|
52775
|
+
if (s3 !== peg$FAILED) {
|
|
52776
|
+
while (s3 !== peg$FAILED) {
|
|
52777
|
+
s2.push(s3);
|
|
52778
|
+
s3 = peg$parsed();
|
|
52779
|
+
}
|
|
52780
|
+
}
|
|
52781
|
+
else {
|
|
52782
|
+
s2 = peg$FAILED;
|
|
52783
|
+
}
|
|
52784
|
+
if (s2 !== peg$FAILED) {
|
|
52785
|
+
s1 = input.substring(s1, peg$currPos);
|
|
52786
|
+
}
|
|
52787
|
+
else {
|
|
52788
|
+
s1 = s2;
|
|
52789
|
+
}
|
|
52790
|
+
if (s1 !== peg$FAILED) {
|
|
52791
|
+
peg$savedPos = s0;
|
|
52792
|
+
s1 = peg$f2(s1);
|
|
52793
|
+
}
|
|
52794
|
+
s0 = s1;
|
|
52795
|
+
peg$silentFails--;
|
|
52796
|
+
if (s0 === peg$FAILED) {
|
|
52797
|
+
s1 = peg$FAILED;
|
|
52798
|
+
if (peg$silentFails === 0) {
|
|
52799
|
+
peg$fail(peg$e6);
|
|
52800
|
+
}
|
|
52801
|
+
}
|
|
52802
|
+
return s0;
|
|
52803
|
+
}
|
|
52804
|
+
peg$result = peg$startRuleFunction();
|
|
52805
|
+
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
52806
|
+
return peg$result;
|
|
52807
|
+
}
|
|
52808
|
+
else {
|
|
52809
|
+
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
52810
|
+
peg$fail(peg$endExpectation());
|
|
52811
|
+
}
|
|
52812
|
+
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
|
|
52813
|
+
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
52814
|
+
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
|
|
52815
|
+
}
|
|
52816
|
+
}
|
|
52817
|
+
return {
|
|
52818
|
+
SyntaxError: peg$SyntaxError,
|
|
52819
|
+
parse: peg$parse
|
|
52820
|
+
};
|
|
52821
|
+
});
|
|
52822
|
+
/***/
|
|
52823
|
+
}),
|
|
52824
|
+
/***/ "./packages/loot-core/src/server/budget/cleanup-template.ts":
|
|
52825
|
+
/*!******************************************************************!*\
|
|
52826
|
+
!*** ./packages/loot-core/src/server/budget/cleanup-template.ts ***!
|
|
52827
|
+
\******************************************************************/
|
|
52828
|
+
/*! exports provided: cleanupTemplate */
|
|
52829
|
+
/***/ (function (module, __webpack_exports__, __webpack_require__) {
|
|
52830
|
+
"use strict";
|
|
52831
|
+
__webpack_require__.r(__webpack_exports__);
|
|
52832
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cleanupTemplate", function () { return cleanupTemplate; });
|
|
52833
|
+
/* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.ts");
|
|
52834
|
+
/* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.ts");
|
|
52835
|
+
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "./packages/loot-core/src/server/budget/actions.ts");
|
|
52836
|
+
/* harmony import */ var _cleanup_template_pegjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./cleanup-template.pegjs */ "./packages/loot-core/src/server/budget/cleanup-template.pegjs");
|
|
52837
|
+
/* harmony import */ var _cleanup_template_pegjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/ __webpack_require__.n(_cleanup_template_pegjs__WEBPACK_IMPORTED_MODULE_3__);
|
|
52838
|
+
function cleanupTemplate(_ref) {
|
|
52839
|
+
let { month } = _ref;
|
|
52840
|
+
return processCleanup(month);
|
|
52841
|
+
}
|
|
52842
|
+
async function processCleanup(month) {
|
|
52843
|
+
let num_sources = 0;
|
|
52844
|
+
let num_sinks = 0;
|
|
52845
|
+
let total_weight = 0;
|
|
52846
|
+
let errors = [];
|
|
52847
|
+
let sinkCategory = [];
|
|
52848
|
+
let category_templates = await getCategoryTemplates();
|
|
52849
|
+
let categories = await _db__WEBPACK_IMPORTED_MODULE_1__["all"]('SELECT * FROM v_categories WHERE tombstone = 0');
|
|
52850
|
+
let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__["sheetForMonth"](month);
|
|
52851
|
+
for (let c = 0; c < categories.length; c++) {
|
|
52852
|
+
let category = categories[c];
|
|
52853
|
+
let template = category_templates[category.id];
|
|
52854
|
+
if (template) {
|
|
52855
|
+
if (template.filter(t => t.type === 'source').length > 0) {
|
|
52856
|
+
let balance = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `leftover-${category.id}`);
|
|
52857
|
+
let budgeted = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `budget-${category.id}`);
|
|
52858
|
+
await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["setBudget"])({
|
|
52859
|
+
category: category.id,
|
|
52860
|
+
month,
|
|
52861
|
+
amount: budgeted - balance
|
|
52862
|
+
});
|
|
52863
|
+
num_sources += 1;
|
|
52864
|
+
}
|
|
52865
|
+
if (template.filter(t => t.type === 'sink').length > 0) {
|
|
52866
|
+
sinkCategory.push({
|
|
52867
|
+
cat: category,
|
|
52868
|
+
temp: template
|
|
52869
|
+
});
|
|
52870
|
+
num_sinks += 1;
|
|
52871
|
+
total_weight += template[0].weight;
|
|
52872
|
+
}
|
|
52873
|
+
}
|
|
52874
|
+
}
|
|
52875
|
+
//funds all underfunded categories first unless the overspending rollover is checked
|
|
52876
|
+
let db_month = parseInt(month.replace('-', ''));
|
|
52877
|
+
for (let c = 0; c < categories.length; c++) {
|
|
52878
|
+
let category = categories[c];
|
|
52879
|
+
let budgetAvailable = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `to-budget`);
|
|
52880
|
+
let balance = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `leftover-${category.id}`);
|
|
52881
|
+
let budgeted = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `budget-${category.id}`);
|
|
52882
|
+
let to_budget = budgeted + Math.abs(balance);
|
|
52883
|
+
let categoryId = category.id;
|
|
52884
|
+
let carryover = await _db__WEBPACK_IMPORTED_MODULE_1__["first"](`SELECT carryover FROM zero_budgets WHERE month = ? and category = ?`, [db_month, categoryId]);
|
|
52885
|
+
if (balance < 0 && Math.abs(balance) <= budgetAvailable && !category.is_income && carryover.carryover === 0) {
|
|
52886
|
+
await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["setBudget"])({
|
|
52887
|
+
category: category.id,
|
|
52888
|
+
month,
|
|
52889
|
+
amount: to_budget
|
|
52890
|
+
});
|
|
52891
|
+
}
|
|
52892
|
+
}
|
|
52893
|
+
let budgetAvailable = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `to-budget`);
|
|
52894
|
+
if (budgetAvailable <= 0) {
|
|
52895
|
+
errors.push('No funds are available to reallocate.');
|
|
52896
|
+
}
|
|
52897
|
+
for (let c = 0; c < sinkCategory.length; c++) {
|
|
52898
|
+
let budgeted = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `budget-${sinkCategory[c].cat.id}`);
|
|
52899
|
+
let categoryId = sinkCategory[c].cat.id;
|
|
52900
|
+
let weight = sinkCategory[c].temp.filter(w => w.type === 'sink')[0].weight;
|
|
52901
|
+
let to_budget = budgeted + Math.round(weight / total_weight * budgetAvailable);
|
|
52902
|
+
if (c === sinkCategory.length - 1) {
|
|
52903
|
+
let currentBudgetAvailable = await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["getSheetValue"])(sheetName, `to-budget`);
|
|
52904
|
+
if (to_budget > currentBudgetAvailable) {
|
|
52905
|
+
to_budget = budgeted + currentBudgetAvailable;
|
|
52906
|
+
}
|
|
52907
|
+
}
|
|
52908
|
+
await Object(_actions__WEBPACK_IMPORTED_MODULE_2__["setBudget"])({
|
|
52909
|
+
category: categoryId,
|
|
52910
|
+
month,
|
|
52911
|
+
amount: to_budget
|
|
52912
|
+
});
|
|
52913
|
+
}
|
|
52914
|
+
if (num_sources === 0) {
|
|
52915
|
+
if (errors.length) {
|
|
52916
|
+
return {
|
|
52917
|
+
type: 'error',
|
|
52918
|
+
sticky: true,
|
|
52919
|
+
message: `There were errors interpreting some templates:`,
|
|
52920
|
+
pre: errors.join('\n\n')
|
|
52921
|
+
};
|
|
52922
|
+
}
|
|
52923
|
+
else {
|
|
52924
|
+
return {
|
|
52925
|
+
type: 'message',
|
|
52926
|
+
message: 'All categories were up to date.'
|
|
52927
|
+
};
|
|
52928
|
+
}
|
|
52929
|
+
}
|
|
52930
|
+
else {
|
|
52931
|
+
let applied = `Successfully returned funds from ${num_sources} ${num_sources === 1 ? 'source' : 'sources'} and funded ${num_sinks} sinking ${num_sinks === 1 ? 'fund' : 'funds'}.`;
|
|
52932
|
+
if (errors.length) {
|
|
52933
|
+
return {
|
|
52934
|
+
sticky: true,
|
|
52935
|
+
message: `${applied} There were errors interpreting some templates:`,
|
|
52936
|
+
pre: errors.join('\n\n')
|
|
52937
|
+
};
|
|
52938
|
+
}
|
|
52939
|
+
else {
|
|
52940
|
+
return {
|
|
52941
|
+
type: 'message',
|
|
52942
|
+
message: applied
|
|
52943
|
+
};
|
|
52944
|
+
}
|
|
52945
|
+
}
|
|
52946
|
+
}
|
|
52947
|
+
const TEMPLATE_PREFIX = '#cleanup ';
|
|
52948
|
+
async function getCategoryTemplates() {
|
|
52949
|
+
let templates = {};
|
|
52950
|
+
let notes = await _db__WEBPACK_IMPORTED_MODULE_1__["all"](`SELECT * FROM notes WHERE lower(note) like '%${TEMPLATE_PREFIX}%'`);
|
|
52951
|
+
for (let n = 0; n < notes.length; n++) {
|
|
52952
|
+
let lines = notes[n].note.split('\n');
|
|
52953
|
+
let template_lines = [];
|
|
52954
|
+
for (let l = 0; l < lines.length; l++) {
|
|
52955
|
+
let line = lines[l].trim();
|
|
52956
|
+
if (!line.toLowerCase().startsWith(TEMPLATE_PREFIX))
|
|
52957
|
+
continue;
|
|
52958
|
+
let expression = line.slice(TEMPLATE_PREFIX.length);
|
|
52959
|
+
try {
|
|
52960
|
+
let parsed = Object(_cleanup_template_pegjs__WEBPACK_IMPORTED_MODULE_3__["parse"])(expression);
|
|
52961
|
+
template_lines.push(parsed);
|
|
52962
|
+
}
|
|
52963
|
+
catch (e) {
|
|
52964
|
+
template_lines.push({
|
|
52965
|
+
type: 'error',
|
|
52966
|
+
line,
|
|
52967
|
+
error: e
|
|
52968
|
+
});
|
|
52969
|
+
}
|
|
52970
|
+
}
|
|
52971
|
+
if (template_lines.length) {
|
|
52972
|
+
templates[notes[n].id] = template_lines;
|
|
52973
|
+
}
|
|
52974
|
+
}
|
|
52975
|
+
return templates;
|
|
52976
|
+
}
|
|
52977
|
+
/***/
|
|
52978
|
+
}),
|
|
52336
52979
|
/***/ "./packages/loot-core/src/server/budget/goal-template.pegjs":
|
|
52337
52980
|
/*!******************************************************************!*\
|
|
52338
52981
|
!*** ./packages/loot-core/src/server/budget/goal-template.pegjs ***!
|
|
@@ -52524,7 +53167,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52524
53167
|
var peg$c20 = ".";
|
|
52525
53168
|
var peg$c21 = "%";
|
|
52526
53169
|
var peg$r0 = /^[0-9]/;
|
|
52527
|
-
var peg$r1 = /^[
|
|
53170
|
+
var peg$r1 = /^[1-9]/;
|
|
53171
|
+
var peg$r2 = /^[^\r\n\t]/;
|
|
52528
53172
|
var peg$e0 = peg$otherExpectation("repeat interval");
|
|
52529
53173
|
var peg$e1 = peg$literalExpectation("month", true);
|
|
52530
53174
|
var peg$e2 = peg$literalExpectation("months", true);
|
|
@@ -52550,18 +53194,19 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52550
53194
|
var peg$e22 = peg$otherExpectation("digit");
|
|
52551
53195
|
var peg$e23 = peg$classExpectation([["0", "9"]], false, false);
|
|
52552
53196
|
var peg$e24 = peg$otherExpectation("number");
|
|
52553
|
-
var peg$e25 = peg$
|
|
52554
|
-
var peg$e26 = peg$
|
|
52555
|
-
var peg$e27 = peg$
|
|
52556
|
-
var peg$e28 = peg$
|
|
52557
|
-
var peg$e29 = peg$
|
|
52558
|
-
var peg$e30 = peg$otherExpectation("
|
|
52559
|
-
var peg$e31 = peg$
|
|
52560
|
-
var peg$e32 = peg$
|
|
52561
|
-
var peg$e33 = peg$otherExpectation("
|
|
52562
|
-
var peg$e34 = peg$
|
|
52563
|
-
var peg$e35 = peg$
|
|
52564
|
-
var peg$e36 = peg$
|
|
53197
|
+
var peg$e25 = peg$classExpectation([["1", "9"]], false, false);
|
|
53198
|
+
var peg$e26 = peg$otherExpectation("amount");
|
|
53199
|
+
var peg$e27 = peg$literalExpectation(".", false);
|
|
53200
|
+
var peg$e28 = peg$otherExpectation("percentage");
|
|
53201
|
+
var peg$e29 = peg$literalExpectation("%", false);
|
|
53202
|
+
var peg$e30 = peg$otherExpectation("year");
|
|
53203
|
+
var peg$e31 = peg$otherExpectation("month");
|
|
53204
|
+
var peg$e32 = peg$literalExpectation("-", false);
|
|
53205
|
+
var peg$e33 = peg$otherExpectation("day");
|
|
53206
|
+
var peg$e34 = peg$otherExpectation("currency symbol");
|
|
53207
|
+
var peg$e35 = peg$anyExpectation();
|
|
53208
|
+
var peg$e36 = peg$otherExpectation("Name");
|
|
53209
|
+
var peg$e37 = peg$classExpectation(["\r", "\n", "\t"], true, false);
|
|
52565
53210
|
var peg$f0 = function (priority, percent, category) { return { type: 'percentage', percent: +percent, category, priority: +priority }; };
|
|
52566
53211
|
var peg$f1 = function (priority, amount, weeks, starting, limit) { return { type: 'week', amount, weeks, starting, limit, priority: +priority }; };
|
|
52567
53212
|
var peg$f2 = function (priority, amount, month, from, repeat) {
|
|
@@ -52716,24 +53361,28 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52716
53361
|
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
|
|
52717
53362
|
}
|
|
52718
53363
|
function peg$parseexpr() {
|
|
52719
|
-
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
|
|
53364
|
+
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
|
|
52720
53365
|
s0 = peg$currPos;
|
|
52721
53366
|
s1 = peg$parsepriority();
|
|
52722
53367
|
if (s1 === peg$FAILED) {
|
|
52723
53368
|
s1 = null;
|
|
52724
53369
|
}
|
|
52725
|
-
s2 = peg$
|
|
52726
|
-
if (s2
|
|
52727
|
-
|
|
52728
|
-
|
|
52729
|
-
|
|
52730
|
-
|
|
52731
|
-
|
|
52732
|
-
|
|
52733
|
-
|
|
52734
|
-
|
|
53370
|
+
s2 = peg$parse_();
|
|
53371
|
+
if (s2 === peg$FAILED) {
|
|
53372
|
+
s2 = null;
|
|
53373
|
+
}
|
|
53374
|
+
s3 = peg$parsepercent();
|
|
53375
|
+
if (s3 !== peg$FAILED) {
|
|
53376
|
+
s4 = peg$parse_();
|
|
53377
|
+
if (s4 !== peg$FAILED) {
|
|
53378
|
+
s5 = peg$parseof();
|
|
53379
|
+
if (s5 !== peg$FAILED) {
|
|
53380
|
+
s6 = peg$parse_();
|
|
53381
|
+
if (s6 !== peg$FAILED) {
|
|
53382
|
+
s7 = peg$parsename();
|
|
53383
|
+
if (s7 !== peg$FAILED) {
|
|
52735
53384
|
peg$savedPos = s0;
|
|
52736
|
-
s0 = peg$f0(s1,
|
|
53385
|
+
s0 = peg$f0(s1, s3, s7);
|
|
52737
53386
|
}
|
|
52738
53387
|
else {
|
|
52739
53388
|
peg$currPos = s0;
|
|
@@ -52765,30 +53414,34 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52765
53414
|
if (s1 === peg$FAILED) {
|
|
52766
53415
|
s1 = null;
|
|
52767
53416
|
}
|
|
52768
|
-
s2 = peg$
|
|
52769
|
-
if (s2
|
|
52770
|
-
|
|
52771
|
-
|
|
52772
|
-
|
|
52773
|
-
|
|
52774
|
-
|
|
52775
|
-
|
|
52776
|
-
|
|
52777
|
-
|
|
52778
|
-
|
|
52779
|
-
|
|
52780
|
-
|
|
52781
|
-
|
|
52782
|
-
|
|
52783
|
-
|
|
52784
|
-
|
|
52785
|
-
|
|
52786
|
-
|
|
52787
|
-
|
|
52788
|
-
|
|
53417
|
+
s2 = peg$parse_();
|
|
53418
|
+
if (s2 === peg$FAILED) {
|
|
53419
|
+
s2 = null;
|
|
53420
|
+
}
|
|
53421
|
+
s3 = peg$parseamount();
|
|
53422
|
+
if (s3 !== peg$FAILED) {
|
|
53423
|
+
s4 = peg$parse_();
|
|
53424
|
+
if (s4 !== peg$FAILED) {
|
|
53425
|
+
s5 = peg$parserepeatEvery();
|
|
53426
|
+
if (s5 !== peg$FAILED) {
|
|
53427
|
+
s6 = peg$parse_();
|
|
53428
|
+
if (s6 !== peg$FAILED) {
|
|
53429
|
+
s7 = peg$parseweekCount();
|
|
53430
|
+
if (s7 !== peg$FAILED) {
|
|
53431
|
+
s8 = peg$parse_();
|
|
53432
|
+
if (s8 !== peg$FAILED) {
|
|
53433
|
+
s9 = peg$parsestarting();
|
|
53434
|
+
if (s9 !== peg$FAILED) {
|
|
53435
|
+
s10 = peg$parse_();
|
|
53436
|
+
if (s10 !== peg$FAILED) {
|
|
53437
|
+
s11 = peg$parsedate();
|
|
53438
|
+
if (s11 !== peg$FAILED) {
|
|
53439
|
+
s12 = peg$parselimit();
|
|
53440
|
+
if (s12 === peg$FAILED) {
|
|
53441
|
+
s12 = null;
|
|
52789
53442
|
}
|
|
52790
53443
|
peg$savedPos = s0;
|
|
52791
|
-
s0 = peg$f1(s1,
|
|
53444
|
+
s0 = peg$f1(s1, s3, s7, s11, s12);
|
|
52792
53445
|
}
|
|
52793
53446
|
else {
|
|
52794
53447
|
peg$currPos = s0;
|
|
@@ -52840,56 +53493,60 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52840
53493
|
if (s1 === peg$FAILED) {
|
|
52841
53494
|
s1 = null;
|
|
52842
53495
|
}
|
|
52843
|
-
s2 = peg$
|
|
52844
|
-
if (s2
|
|
52845
|
-
|
|
52846
|
-
|
|
52847
|
-
|
|
52848
|
-
|
|
52849
|
-
|
|
52850
|
-
|
|
52851
|
-
|
|
52852
|
-
|
|
52853
|
-
|
|
52854
|
-
|
|
52855
|
-
|
|
53496
|
+
s2 = peg$parse_();
|
|
53497
|
+
if (s2 === peg$FAILED) {
|
|
53498
|
+
s2 = null;
|
|
53499
|
+
}
|
|
53500
|
+
s3 = peg$parseamount();
|
|
53501
|
+
if (s3 !== peg$FAILED) {
|
|
53502
|
+
s4 = peg$parse_();
|
|
53503
|
+
if (s4 !== peg$FAILED) {
|
|
53504
|
+
s5 = peg$parseby();
|
|
53505
|
+
if (s5 !== peg$FAILED) {
|
|
53506
|
+
s6 = peg$parse_();
|
|
53507
|
+
if (s6 !== peg$FAILED) {
|
|
53508
|
+
s7 = peg$parsemonth();
|
|
53509
|
+
if (s7 !== peg$FAILED) {
|
|
53510
|
+
s8 = peg$parsespendFrom();
|
|
53511
|
+
if (s8 === peg$FAILED) {
|
|
53512
|
+
s8 = null;
|
|
52856
53513
|
}
|
|
52857
|
-
|
|
52858
|
-
|
|
52859
|
-
if (
|
|
52860
|
-
|
|
52861
|
-
if (
|
|
52862
|
-
|
|
52863
|
-
if (
|
|
52864
|
-
|
|
52865
|
-
if (
|
|
52866
|
-
|
|
52867
|
-
|
|
53514
|
+
s9 = peg$currPos;
|
|
53515
|
+
s10 = peg$parse_();
|
|
53516
|
+
if (s10 !== peg$FAILED) {
|
|
53517
|
+
s11 = peg$parserepeatEvery();
|
|
53518
|
+
if (s11 !== peg$FAILED) {
|
|
53519
|
+
s12 = peg$parse_();
|
|
53520
|
+
if (s12 !== peg$FAILED) {
|
|
53521
|
+
s13 = peg$parserepeat();
|
|
53522
|
+
if (s13 !== peg$FAILED) {
|
|
53523
|
+
s10 = [s10, s11, s12, s13];
|
|
53524
|
+
s9 = s10;
|
|
52868
53525
|
}
|
|
52869
53526
|
else {
|
|
52870
|
-
peg$currPos =
|
|
52871
|
-
|
|
53527
|
+
peg$currPos = s9;
|
|
53528
|
+
s9 = peg$FAILED;
|
|
52872
53529
|
}
|
|
52873
53530
|
}
|
|
52874
53531
|
else {
|
|
52875
|
-
peg$currPos =
|
|
52876
|
-
|
|
53532
|
+
peg$currPos = s9;
|
|
53533
|
+
s9 = peg$FAILED;
|
|
52877
53534
|
}
|
|
52878
53535
|
}
|
|
52879
53536
|
else {
|
|
52880
|
-
peg$currPos =
|
|
52881
|
-
|
|
53537
|
+
peg$currPos = s9;
|
|
53538
|
+
s9 = peg$FAILED;
|
|
52882
53539
|
}
|
|
52883
53540
|
}
|
|
52884
53541
|
else {
|
|
52885
|
-
peg$currPos =
|
|
52886
|
-
|
|
53542
|
+
peg$currPos = s9;
|
|
53543
|
+
s9 = peg$FAILED;
|
|
52887
53544
|
}
|
|
52888
|
-
if (
|
|
52889
|
-
|
|
53545
|
+
if (s9 === peg$FAILED) {
|
|
53546
|
+
s9 = null;
|
|
52890
53547
|
}
|
|
52891
53548
|
peg$savedPos = s0;
|
|
52892
|
-
s0 = peg$f2(s1,
|
|
53549
|
+
s0 = peg$f2(s1, s3, s7, s8, s9);
|
|
52893
53550
|
}
|
|
52894
53551
|
else {
|
|
52895
53552
|
peg$currPos = s0;
|
|
@@ -52921,14 +53578,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52921
53578
|
if (s1 === peg$FAILED) {
|
|
52922
53579
|
s1 = null;
|
|
52923
53580
|
}
|
|
52924
|
-
s2 = peg$
|
|
52925
|
-
if (s2
|
|
52926
|
-
|
|
52927
|
-
|
|
52928
|
-
|
|
53581
|
+
s2 = peg$parse_();
|
|
53582
|
+
if (s2 === peg$FAILED) {
|
|
53583
|
+
s2 = null;
|
|
53584
|
+
}
|
|
53585
|
+
s3 = peg$parseamount();
|
|
53586
|
+
if (s3 !== peg$FAILED) {
|
|
53587
|
+
s4 = peg$parselimit();
|
|
53588
|
+
if (s4 === peg$FAILED) {
|
|
53589
|
+
s4 = null;
|
|
52929
53590
|
}
|
|
52930
53591
|
peg$savedPos = s0;
|
|
52931
|
-
s0 = peg$f3(s1,
|
|
53592
|
+
s0 = peg$f3(s1, s3, s4);
|
|
52932
53593
|
}
|
|
52933
53594
|
else {
|
|
52934
53595
|
peg$currPos = s0;
|
|
@@ -52940,10 +53601,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52940
53601
|
if (s1 === peg$FAILED) {
|
|
52941
53602
|
s1 = null;
|
|
52942
53603
|
}
|
|
52943
|
-
s2 = peg$
|
|
52944
|
-
if (s2
|
|
53604
|
+
s2 = peg$parse_();
|
|
53605
|
+
if (s2 === peg$FAILED) {
|
|
53606
|
+
s2 = null;
|
|
53607
|
+
}
|
|
53608
|
+
s3 = peg$parselimit();
|
|
53609
|
+
if (s3 !== peg$FAILED) {
|
|
52945
53610
|
peg$savedPos = s0;
|
|
52946
|
-
s0 = peg$f4(s1,
|
|
53611
|
+
s0 = peg$f4(s1, s3);
|
|
52947
53612
|
}
|
|
52948
53613
|
else {
|
|
52949
53614
|
peg$currPos = s0;
|
|
@@ -52955,18 +53620,22 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
52955
53620
|
if (s1 === peg$FAILED) {
|
|
52956
53621
|
s1 = null;
|
|
52957
53622
|
}
|
|
52958
|
-
s2 = peg$
|
|
52959
|
-
if (s2
|
|
52960
|
-
|
|
52961
|
-
|
|
52962
|
-
|
|
52963
|
-
|
|
52964
|
-
|
|
53623
|
+
s2 = peg$parse_();
|
|
53624
|
+
if (s2 === peg$FAILED) {
|
|
53625
|
+
s2 = null;
|
|
53626
|
+
}
|
|
53627
|
+
s3 = peg$parseschedule();
|
|
53628
|
+
if (s3 !== peg$FAILED) {
|
|
53629
|
+
s4 = peg$parse_();
|
|
53630
|
+
if (s4 !== peg$FAILED) {
|
|
53631
|
+
s5 = peg$parsefull();
|
|
53632
|
+
if (s5 === peg$FAILED) {
|
|
53633
|
+
s5 = null;
|
|
52965
53634
|
}
|
|
52966
|
-
|
|
52967
|
-
if (
|
|
53635
|
+
s6 = peg$parsename();
|
|
53636
|
+
if (s6 !== peg$FAILED) {
|
|
52968
53637
|
peg$savedPos = s0;
|
|
52969
|
-
s0 = peg$f5(s1,
|
|
53638
|
+
s0 = peg$f5(s1, s5, s6);
|
|
52970
53639
|
}
|
|
52971
53640
|
else {
|
|
52972
53641
|
peg$currPos = s0;
|
|
@@ -53010,7 +53679,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53010
53679
|
s0 = s1;
|
|
53011
53680
|
if (s0 === peg$FAILED) {
|
|
53012
53681
|
s0 = peg$currPos;
|
|
53013
|
-
s1 = peg$
|
|
53682
|
+
s1 = peg$parsepositive();
|
|
53014
53683
|
if (s1 !== peg$FAILED) {
|
|
53015
53684
|
s2 = peg$parse_();
|
|
53016
53685
|
if (s2 !== peg$FAILED) {
|
|
@@ -53061,7 +53730,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53061
53730
|
s0 = s1;
|
|
53062
53731
|
if (s0 === peg$FAILED) {
|
|
53063
53732
|
s0 = peg$currPos;
|
|
53064
|
-
s1 = peg$
|
|
53733
|
+
s1 = peg$parsepositive();
|
|
53065
53734
|
if (s1 !== peg$FAILED) {
|
|
53066
53735
|
s2 = peg$parse_();
|
|
53067
53736
|
if (s2 !== peg$FAILED) {
|
|
@@ -53630,6 +54299,60 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53630
54299
|
}
|
|
53631
54300
|
return s0;
|
|
53632
54301
|
}
|
|
54302
|
+
function peg$parsepositive() {
|
|
54303
|
+
var s0, s1, s2, s3, s4;
|
|
54304
|
+
s0 = peg$currPos;
|
|
54305
|
+
s1 = peg$currPos;
|
|
54306
|
+
if (peg$r1.test(input.charAt(peg$currPos))) {
|
|
54307
|
+
s2 = input.charAt(peg$currPos);
|
|
54308
|
+
peg$currPos++;
|
|
54309
|
+
}
|
|
54310
|
+
else {
|
|
54311
|
+
s2 = peg$FAILED;
|
|
54312
|
+
if (peg$silentFails === 0) {
|
|
54313
|
+
peg$fail(peg$e25);
|
|
54314
|
+
}
|
|
54315
|
+
}
|
|
54316
|
+
if (s2 !== peg$FAILED) {
|
|
54317
|
+
s3 = [];
|
|
54318
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
54319
|
+
s4 = input.charAt(peg$currPos);
|
|
54320
|
+
peg$currPos++;
|
|
54321
|
+
}
|
|
54322
|
+
else {
|
|
54323
|
+
s4 = peg$FAILED;
|
|
54324
|
+
if (peg$silentFails === 0) {
|
|
54325
|
+
peg$fail(peg$e23);
|
|
54326
|
+
}
|
|
54327
|
+
}
|
|
54328
|
+
while (s4 !== peg$FAILED) {
|
|
54329
|
+
s3.push(s4);
|
|
54330
|
+
if (peg$r0.test(input.charAt(peg$currPos))) {
|
|
54331
|
+
s4 = input.charAt(peg$currPos);
|
|
54332
|
+
peg$currPos++;
|
|
54333
|
+
}
|
|
54334
|
+
else {
|
|
54335
|
+
s4 = peg$FAILED;
|
|
54336
|
+
if (peg$silentFails === 0) {
|
|
54337
|
+
peg$fail(peg$e23);
|
|
54338
|
+
}
|
|
54339
|
+
}
|
|
54340
|
+
}
|
|
54341
|
+
s2 = [s2, s3];
|
|
54342
|
+
s1 = s2;
|
|
54343
|
+
}
|
|
54344
|
+
else {
|
|
54345
|
+
peg$currPos = s1;
|
|
54346
|
+
s1 = peg$FAILED;
|
|
54347
|
+
}
|
|
54348
|
+
if (s1 !== peg$FAILED) {
|
|
54349
|
+
s0 = input.substring(s0, peg$currPos);
|
|
54350
|
+
}
|
|
54351
|
+
else {
|
|
54352
|
+
s0 = s1;
|
|
54353
|
+
}
|
|
54354
|
+
return s0;
|
|
54355
|
+
}
|
|
53633
54356
|
function peg$parseamount() {
|
|
53634
54357
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
53635
54358
|
peg$silentFails++;
|
|
@@ -53664,7 +54387,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53664
54387
|
else {
|
|
53665
54388
|
s7 = peg$FAILED;
|
|
53666
54389
|
if (peg$silentFails === 0) {
|
|
53667
|
-
peg$fail(peg$
|
|
54390
|
+
peg$fail(peg$e27);
|
|
53668
54391
|
}
|
|
53669
54392
|
}
|
|
53670
54393
|
if (s7 !== peg$FAILED) {
|
|
@@ -53720,7 +54443,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53720
54443
|
if (s0 === peg$FAILED) {
|
|
53721
54444
|
s1 = peg$FAILED;
|
|
53722
54445
|
if (peg$silentFails === 0) {
|
|
53723
|
-
peg$fail(peg$
|
|
54446
|
+
peg$fail(peg$e26);
|
|
53724
54447
|
}
|
|
53725
54448
|
}
|
|
53726
54449
|
return s0;
|
|
@@ -53759,7 +54482,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53759
54482
|
else {
|
|
53760
54483
|
s3 = peg$FAILED;
|
|
53761
54484
|
if (peg$silentFails === 0) {
|
|
53762
|
-
peg$fail(peg$
|
|
54485
|
+
peg$fail(peg$e29);
|
|
53763
54486
|
}
|
|
53764
54487
|
}
|
|
53765
54488
|
if (s3 !== peg$FAILED) {
|
|
@@ -53779,7 +54502,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53779
54502
|
if (s0 === peg$FAILED) {
|
|
53780
54503
|
s1 = peg$FAILED;
|
|
53781
54504
|
if (peg$silentFails === 0) {
|
|
53782
|
-
peg$fail(peg$
|
|
54505
|
+
peg$fail(peg$e28);
|
|
53783
54506
|
}
|
|
53784
54507
|
}
|
|
53785
54508
|
return s0;
|
|
@@ -53829,7 +54552,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53829
54552
|
if (s0 === peg$FAILED) {
|
|
53830
54553
|
s1 = peg$FAILED;
|
|
53831
54554
|
if (peg$silentFails === 0) {
|
|
53832
|
-
peg$fail(peg$
|
|
54555
|
+
peg$fail(peg$e30);
|
|
53833
54556
|
}
|
|
53834
54557
|
}
|
|
53835
54558
|
return s0;
|
|
@@ -53848,7 +54571,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53848
54571
|
else {
|
|
53849
54572
|
s3 = peg$FAILED;
|
|
53850
54573
|
if (peg$silentFails === 0) {
|
|
53851
|
-
peg$fail(peg$
|
|
54574
|
+
peg$fail(peg$e32);
|
|
53852
54575
|
}
|
|
53853
54576
|
}
|
|
53854
54577
|
if (s3 !== peg$FAILED) {
|
|
@@ -53888,7 +54611,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53888
54611
|
if (s0 === peg$FAILED) {
|
|
53889
54612
|
s1 = peg$FAILED;
|
|
53890
54613
|
if (peg$silentFails === 0) {
|
|
53891
|
-
peg$fail(peg$
|
|
54614
|
+
peg$fail(peg$e31);
|
|
53892
54615
|
}
|
|
53893
54616
|
}
|
|
53894
54617
|
return s0;
|
|
@@ -53924,7 +54647,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53924
54647
|
if (s0 === peg$FAILED) {
|
|
53925
54648
|
s1 = peg$FAILED;
|
|
53926
54649
|
if (peg$silentFails === 0) {
|
|
53927
|
-
peg$fail(peg$
|
|
54650
|
+
peg$fail(peg$e33);
|
|
53928
54651
|
}
|
|
53929
54652
|
}
|
|
53930
54653
|
return s0;
|
|
@@ -53942,7 +54665,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53942
54665
|
else {
|
|
53943
54666
|
s3 = peg$FAILED;
|
|
53944
54667
|
if (peg$silentFails === 0) {
|
|
53945
|
-
peg$fail(peg$
|
|
54668
|
+
peg$fail(peg$e32);
|
|
53946
54669
|
}
|
|
53947
54670
|
}
|
|
53948
54671
|
if (s3 !== peg$FAILED) {
|
|
@@ -53984,7 +54707,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
53984
54707
|
else {
|
|
53985
54708
|
s1 = peg$FAILED;
|
|
53986
54709
|
if (peg$silentFails === 0) {
|
|
53987
|
-
peg$fail(peg$
|
|
54710
|
+
peg$fail(peg$e35);
|
|
53988
54711
|
}
|
|
53989
54712
|
}
|
|
53990
54713
|
if (s1 !== peg$FAILED) {
|
|
@@ -54013,7 +54736,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54013
54736
|
if (s0 === peg$FAILED) {
|
|
54014
54737
|
s1 = peg$FAILED;
|
|
54015
54738
|
if (peg$silentFails === 0) {
|
|
54016
|
-
peg$fail(peg$
|
|
54739
|
+
peg$fail(peg$e34);
|
|
54017
54740
|
}
|
|
54018
54741
|
}
|
|
54019
54742
|
return s0;
|
|
@@ -54023,27 +54746,27 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54023
54746
|
peg$silentFails++;
|
|
54024
54747
|
s0 = peg$currPos;
|
|
54025
54748
|
s1 = [];
|
|
54026
|
-
if (peg$
|
|
54749
|
+
if (peg$r2.test(input.charAt(peg$currPos))) {
|
|
54027
54750
|
s2 = input.charAt(peg$currPos);
|
|
54028
54751
|
peg$currPos++;
|
|
54029
54752
|
}
|
|
54030
54753
|
else {
|
|
54031
54754
|
s2 = peg$FAILED;
|
|
54032
54755
|
if (peg$silentFails === 0) {
|
|
54033
|
-
peg$fail(peg$
|
|
54756
|
+
peg$fail(peg$e37);
|
|
54034
54757
|
}
|
|
54035
54758
|
}
|
|
54036
54759
|
if (s2 !== peg$FAILED) {
|
|
54037
54760
|
while (s2 !== peg$FAILED) {
|
|
54038
54761
|
s1.push(s2);
|
|
54039
|
-
if (peg$
|
|
54762
|
+
if (peg$r2.test(input.charAt(peg$currPos))) {
|
|
54040
54763
|
s2 = input.charAt(peg$currPos);
|
|
54041
54764
|
peg$currPos++;
|
|
54042
54765
|
}
|
|
54043
54766
|
else {
|
|
54044
54767
|
s2 = peg$FAILED;
|
|
54045
54768
|
if (peg$silentFails === 0) {
|
|
54046
|
-
peg$fail(peg$
|
|
54769
|
+
peg$fail(peg$e37);
|
|
54047
54770
|
}
|
|
54048
54771
|
}
|
|
54049
54772
|
}
|
|
@@ -54061,7 +54784,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54061
54784
|
if (s0 === peg$FAILED) {
|
|
54062
54785
|
s1 = peg$FAILED;
|
|
54063
54786
|
if (peg$silentFails === 0) {
|
|
54064
|
-
peg$fail(peg$
|
|
54787
|
+
peg$fail(peg$e36);
|
|
54065
54788
|
}
|
|
54066
54789
|
}
|
|
54067
54790
|
return s0;
|
|
@@ -54127,6 +54850,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54127
54850
|
errorNotice
|
|
54128
54851
|
};
|
|
54129
54852
|
}
|
|
54853
|
+
function getCorrectedDate(dateString) {
|
|
54854
|
+
let newDate = new Date(dateString);
|
|
54855
|
+
newDate = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMinutes"])(newDate, newDate.getTimezoneOffset());
|
|
54856
|
+
return newDate;
|
|
54857
|
+
}
|
|
54130
54858
|
async function processTemplate(month, force) {
|
|
54131
54859
|
let num_applied = 0;
|
|
54132
54860
|
let errors = [];
|
|
@@ -54282,7 +55010,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54282
55010
|
return templates;
|
|
54283
55011
|
}
|
|
54284
55012
|
async function applyCategoryTemplate(category, template_lines, month, priority, force) {
|
|
54285
|
-
let current_month =
|
|
55013
|
+
let current_month = getCorrectedDate(`${month}-01`);
|
|
54286
55014
|
let errors = [];
|
|
54287
55015
|
let all_schedule_names = await _db__WEBPACK_IMPORTED_MODULE_4__["all"]('SELECT name from schedules WHERE name NOT NULL AND tombstone = 0');
|
|
54288
55016
|
all_schedule_names = all_schedule_names.map(v => v.name);
|
|
@@ -54291,12 +55019,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54291
55019
|
switch (template.type) {
|
|
54292
55020
|
case 'by':
|
|
54293
55021
|
case 'spend':
|
|
54294
|
-
let target_month =
|
|
55022
|
+
let target_month = getCorrectedDate(`${template.month}-01`);
|
|
54295
55023
|
let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(target_month, current_month);
|
|
54296
55024
|
let repeat = template.annual ? (template.repeat || 1) * 12 : template.repeat;
|
|
54297
55025
|
let spend_from;
|
|
54298
55026
|
if (template.type === 'spend') {
|
|
54299
|
-
spend_from =
|
|
55027
|
+
spend_from = getCorrectedDate(`${template.from}-01`);
|
|
54300
55028
|
}
|
|
54301
55029
|
while (num_months < 0 && repeat) {
|
|
54302
55030
|
target_month = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(target_month, repeat);
|
|
@@ -54327,7 +55055,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54327
55055
|
if (template_lines.length > 1) {
|
|
54328
55056
|
template_lines = template_lines.sort((a, b) => {
|
|
54329
55057
|
if (a.type === 'by' && !a.annual) {
|
|
54330
|
-
return Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(
|
|
55058
|
+
return Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(getCorrectedDate(`${a.month}-01`), getCorrectedDate(`${b.month}-01`));
|
|
54331
55059
|
}
|
|
54332
55060
|
else {
|
|
54333
55061
|
return a.type.localeCompare(b.type);
|
|
@@ -54384,7 +55112,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54384
55112
|
{
|
|
54385
55113
|
// by has 'amount' and 'month' params
|
|
54386
55114
|
let target = 0;
|
|
54387
|
-
let target_month =
|
|
55115
|
+
let target_month = getCorrectedDate(`${template_lines[l].month}-01`);
|
|
54388
55116
|
let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(target_month, current_month);
|
|
54389
55117
|
let repeat = template.type === 'by' ? template.repeat : (template.repeat || 1) * 12;
|
|
54390
55118
|
while (num_months < 0 && repeat) {
|
|
@@ -54402,7 +55130,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54402
55130
|
target = 0;
|
|
54403
55131
|
remainder = Math.abs(remainder);
|
|
54404
55132
|
}
|
|
54405
|
-
let diff = num_months
|
|
55133
|
+
let diff = num_months >= 0 ? Math.round(target / (num_months + 1)) : 0;
|
|
54406
55134
|
if (diff >= 0) {
|
|
54407
55135
|
if (to_budget + diff < budgetAvailable || !priority) {
|
|
54408
55136
|
to_budget += diff;
|
|
@@ -54432,7 +55160,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54432
55160
|
hold = template.limit.hold;
|
|
54433
55161
|
}
|
|
54434
55162
|
}
|
|
54435
|
-
let w =
|
|
55163
|
+
let w = getCorrectedDate(template.starting);
|
|
54436
55164
|
let next_month = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(current_month, 1);
|
|
54437
55165
|
while (w.getTime() < next_month.getTime()) {
|
|
54438
55166
|
if (w.getTime() >= current_month.getTime()) {
|
|
@@ -54452,8 +55180,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54452
55180
|
case 'spend':
|
|
54453
55181
|
{
|
|
54454
55182
|
// spend has 'amount' and 'from' and 'month' params
|
|
54455
|
-
let from_month =
|
|
54456
|
-
let to_month =
|
|
55183
|
+
let from_month = getCorrectedDate(`${template.from}-01`);
|
|
55184
|
+
let to_month = getCorrectedDate(`${template.month}-01`);
|
|
54457
55185
|
let already_budgeted = last_month_balance;
|
|
54458
55186
|
let first_month = true;
|
|
54459
55187
|
for (let m = from_month; Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(current_month, m) > 0; m = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(m, 1)) {
|
|
@@ -54529,7 +55257,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54529
55257
|
let conditions = rule.serialize().conditions;
|
|
54530
55258
|
let { date: dateCond, amount: amountCond } = Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_2__["extractScheduleConds"])(conditions);
|
|
54531
55259
|
let next_date_string = Object(_schedules_app__WEBPACK_IMPORTED_MODULE_5__["getNextDate"])(dateCond, current_month);
|
|
54532
|
-
let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(
|
|
55260
|
+
let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(getCorrectedDate(next_date_string), current_month);
|
|
54533
55261
|
if (template.full === true) {
|
|
54534
55262
|
if (num_months === 1) {
|
|
54535
55263
|
to_budget = -Object(_shared_schedules__WEBPACK_IMPORTED_MODULE_2__["getScheduledAmount"])(amountCond.value);
|
|
@@ -54548,16 +55276,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
|
|
|
54548
55276
|
target = 0;
|
|
54549
55277
|
remainder = Math.abs(remainder);
|
|
54550
55278
|
}
|
|
54551
|
-
let diff = num_months
|
|
55279
|
+
let diff = num_months >= 0 ? Math.round(target / (num_months + 1)) : 0;
|
|
54552
55280
|
if (num_months < 0) {
|
|
54553
55281
|
errors.push(`Non-repeating schedule ${template.name} was due on ${next_date_string}, which is in the past.`);
|
|
54554
55282
|
return {
|
|
54555
55283
|
errors
|
|
54556
55284
|
};
|
|
54557
55285
|
}
|
|
54558
|
-
else if (num_months
|
|
54559
|
-
if (diff >= 0 && num_months
|
|
55286
|
+
else if (num_months >= 0) {
|
|
55287
|
+
if (diff >= 0 && num_months >= 0 && to_budget + diff < budgetAvailable || !priority) {
|
|
54560
55288
|
to_budget += diff;
|
|
55289
|
+
if (l === template_lines.length - 1)
|
|
55290
|
+
to_budget -= spent;
|
|
54561
55291
|
}
|
|
54562
55292
|
else {
|
|
54563
55293
|
if (budgetAvailable > 0)
|