@actual-app/api 4.1.5 → 4.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/bundle.api.js CHANGED
@@ -11582,86 +11582,6 @@ module.exports = function (records, options = {}) {
11582
11582
 
11583
11583
  /***/ }),
11584
11584
 
11585
- /***/ "./node_modules/damerau-levenshtein/index.js":
11586
- /*!***************************************************!*\
11587
- !*** ./node_modules/damerau-levenshtein/index.js ***!
11588
- \***************************************************/
11589
- /*! no static exports found */
11590
- /***/ (function(module, exports) {
11591
-
11592
- // TheSpanishInquisition
11593
- // Cache the matrix. Note that if you not pass a limit this implementation will use a dynamically calculate one.
11594
- module.exports = function (__this, that, limit) {
11595
- var thisLength = __this.length,
11596
- thatLength = that.length,
11597
- matrix = []; // If the limit is not defined it will be calculate from this and that args.
11598
-
11599
- limit = (limit || (thatLength > thisLength ? thatLength : thisLength)) + 1;
11600
-
11601
- for (var i = 0; i < limit; i++) {
11602
- matrix[i] = [i];
11603
- matrix[i].length = limit;
11604
- }
11605
-
11606
- for (i = 0; i < limit; i++) {
11607
- matrix[0][i] = i;
11608
- }
11609
-
11610
- if (Math.abs(thisLength - thatLength) > (limit || 100)) {
11611
- return prepare(limit || 100);
11612
- }
11613
-
11614
- if (thisLength === 0) {
11615
- return prepare(thatLength);
11616
- }
11617
-
11618
- if (thatLength === 0) {
11619
- return prepare(thisLength);
11620
- } // Calculate matrix.
11621
-
11622
-
11623
- var j, this_i, that_j, cost, min, t;
11624
-
11625
- for (i = 1; i <= thisLength; ++i) {
11626
- this_i = __this[i - 1]; // Step 4
11627
-
11628
- for (j = 1; j <= thatLength; ++j) {
11629
- // Check the jagged ld total so far
11630
- if (i === j && matrix[i][j] > 4) return prepare(thisLength);
11631
- that_j = that[j - 1];
11632
- cost = this_i === that_j ? 0 : 1; // Step 5
11633
- // Calculate the minimum (much faster than Math.min(...)).
11634
-
11635
- min = matrix[i - 1][j] + 1; // Deletion.
11636
-
11637
- if ((t = matrix[i][j - 1] + 1) < min) min = t; // Insertion.
11638
-
11639
- if ((t = matrix[i - 1][j - 1] + cost) < min) min = t; // Substitution.
11640
- // Update matrix.
11641
-
11642
- matrix[i][j] = i > 1 && j > 1 && this_i === that[j - 2] && __this[i - 2] === that_j && (t = matrix[i - 2][j - 2] + cost) < min ? t : min; // Transposition.
11643
- }
11644
- }
11645
-
11646
- return prepare(matrix[thisLength][thatLength]);
11647
- /**
11648
- *
11649
- */
11650
-
11651
- function prepare(steps) {
11652
- var length = Math.max(thisLength, thatLength);
11653
- var relative = length === 0 ? 0 : steps / length;
11654
- var similarity = 1 - relative;
11655
- return {
11656
- steps: steps,
11657
- relative: relative,
11658
- similarity: similarity
11659
- };
11660
- }
11661
- };
11662
-
11663
- /***/ }),
11664
-
11665
11585
  /***/ "./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js":
11666
11586
  /*!*****************************************************************!*\
11667
11587
  !*** ./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js ***!
@@ -26399,7 +26319,7 @@ var is = __webpack_require__(/*! object-is */ "./node_modules/object-is/index.js
26399
26319
 
26400
26320
  var isRegex = __webpack_require__(/*! is-regex */ "./node_modules/is-regex/index.js");
26401
26321
 
26402
- var flags = __webpack_require__(/*! regexp.prototype.flags */ "./node_modules/regexp.prototype.flags/index.js");
26322
+ var flags = __webpack_require__(/*! regexp.prototype.flags */ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/index.js");
26403
26323
 
26404
26324
  var isArray = __webpack_require__(/*! isarray */ "./node_modules/deep-equal/node_modules/isarray/index.js");
26405
26325
 
@@ -26417,7 +26337,7 @@ var getIterator = __webpack_require__(/*! es-get-iterator */ "./node_modules/es-
26417
26337
 
26418
26338
  var getSideChannel = __webpack_require__(/*! side-channel */ "./node_modules/side-channel/index.js");
26419
26339
 
26420
- var whichTypedArray = __webpack_require__(/*! which-typed-array */ "./node_modules/which-typed-array/index.js");
26340
+ var whichTypedArray = __webpack_require__(/*! which-typed-array */ "./node_modules/deep-equal/node_modules/which-typed-array/index.js");
26421
26341
 
26422
26342
  var assign = __webpack_require__(/*! object.assign */ "./node_modules/object.assign/index.js");
26423
26343
 
@@ -26867,6 +26787,97 @@ module.exports = function deepEqual(a, b, opts) {
26867
26787
 
26868
26788
  /***/ }),
26869
26789
 
26790
+ /***/ "./node_modules/deep-equal/node_modules/is-typed-array/index.js":
26791
+ /*!**********************************************************************!*\
26792
+ !*** ./node_modules/deep-equal/node_modules/is-typed-array/index.js ***!
26793
+ \**********************************************************************/
26794
+ /*! no static exports found */
26795
+ /***/ (function(module, exports, __webpack_require__) {
26796
+
26797
+ "use strict";
26798
+
26799
+
26800
+ var forEach = __webpack_require__(/*! foreach */ "./node_modules/foreach/index.js");
26801
+
26802
+ var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js");
26803
+
26804
+ var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js");
26805
+
26806
+ var $toString = callBound('Object.prototype.toString');
26807
+
26808
+ var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
26809
+
26810
+ var g = typeof globalThis === 'undefined' ? global : globalThis;
26811
+ var typedArrays = availableTypedArrays();
26812
+
26813
+ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
26814
+ for (var i = 0; i < array.length; i += 1) {
26815
+ if (array[i] === value) {
26816
+ return i;
26817
+ }
26818
+ }
26819
+
26820
+ return -1;
26821
+ };
26822
+
26823
+ var $slice = callBound('String.prototype.slice');
26824
+ var toStrTags = {};
26825
+
26826
+ var gOPD = __webpack_require__(/*! es-abstract/helpers/getOwnPropertyDescriptor */ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js");
26827
+
26828
+ var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
26829
+
26830
+ if (hasToStringTag && gOPD && getPrototypeOf) {
26831
+ forEach(typedArrays, function (typedArray) {
26832
+ var arr = new g[typedArray]();
26833
+
26834
+ if (Symbol.toStringTag in arr) {
26835
+ var proto = getPrototypeOf(arr);
26836
+ var descriptor = gOPD(proto, Symbol.toStringTag);
26837
+
26838
+ if (!descriptor) {
26839
+ var superProto = getPrototypeOf(proto);
26840
+ descriptor = gOPD(superProto, Symbol.toStringTag);
26841
+ }
26842
+
26843
+ toStrTags[typedArray] = descriptor.get;
26844
+ }
26845
+ });
26846
+ }
26847
+
26848
+ var tryTypedArrays = function tryAllTypedArrays(value) {
26849
+ var anyTrue = false;
26850
+ forEach(toStrTags, function (getter, typedArray) {
26851
+ if (!anyTrue) {
26852
+ try {
26853
+ anyTrue = getter.call(value) === typedArray;
26854
+ } catch (e) {
26855
+ /**/
26856
+ }
26857
+ }
26858
+ });
26859
+ return anyTrue;
26860
+ };
26861
+
26862
+ module.exports = function isTypedArray(value) {
26863
+ if (!value || typeof value !== 'object') {
26864
+ return false;
26865
+ }
26866
+
26867
+ if (!hasToStringTag || !(Symbol.toStringTag in value)) {
26868
+ var tag = $slice($toString(value), 8, -1);
26869
+ return $indexOf(typedArrays, tag) > -1;
26870
+ }
26871
+
26872
+ if (!gOPD) {
26873
+ return false;
26874
+ }
26875
+
26876
+ return tryTypedArrays(value);
26877
+ };
26878
+
26879
+ /***/ }),
26880
+
26870
26881
  /***/ "./node_modules/deep-equal/node_modules/isarray/index.js":
26871
26882
  /*!***************************************************************!*\
26872
26883
  !*** ./node_modules/deep-equal/node_modules/isarray/index.js ***!
@@ -26882,6 +26893,242 @@ module.exports = Array.isArray || function (arr) {
26882
26893
 
26883
26894
  /***/ }),
26884
26895
 
26896
+ /***/ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/implementation.js":
26897
+ /*!***************************************************************************************!*\
26898
+ !*** ./node_modules/deep-equal/node_modules/regexp.prototype.flags/implementation.js ***!
26899
+ \***************************************************************************************/
26900
+ /*! no static exports found */
26901
+ /***/ (function(module, exports, __webpack_require__) {
26902
+
26903
+ "use strict";
26904
+
26905
+
26906
+ var $Object = Object;
26907
+ var $TypeError = TypeError;
26908
+
26909
+ module.exports = function flags() {
26910
+ if (this != null && this !== $Object(this)) {
26911
+ throw new $TypeError('RegExp.prototype.flags getter called on non-object');
26912
+ }
26913
+
26914
+ var result = '';
26915
+
26916
+ if (this.hasIndices) {
26917
+ result += 'd';
26918
+ }
26919
+
26920
+ if (this.global) {
26921
+ result += 'g';
26922
+ }
26923
+
26924
+ if (this.ignoreCase) {
26925
+ result += 'i';
26926
+ }
26927
+
26928
+ if (this.multiline) {
26929
+ result += 'm';
26930
+ }
26931
+
26932
+ if (this.dotAll) {
26933
+ result += 's';
26934
+ }
26935
+
26936
+ if (this.unicode) {
26937
+ result += 'u';
26938
+ }
26939
+
26940
+ if (this.sticky) {
26941
+ result += 'y';
26942
+ }
26943
+
26944
+ return result;
26945
+ };
26946
+
26947
+ /***/ }),
26948
+
26949
+ /***/ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/index.js":
26950
+ /*!******************************************************************************!*\
26951
+ !*** ./node_modules/deep-equal/node_modules/regexp.prototype.flags/index.js ***!
26952
+ \******************************************************************************/
26953
+ /*! no static exports found */
26954
+ /***/ (function(module, exports, __webpack_require__) {
26955
+
26956
+ "use strict";
26957
+
26958
+
26959
+ var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js");
26960
+
26961
+ var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js");
26962
+
26963
+ var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/implementation.js");
26964
+
26965
+ var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/polyfill.js");
26966
+
26967
+ var shim = __webpack_require__(/*! ./shim */ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/shim.js");
26968
+
26969
+ var flagsBound = callBind(getPolyfill());
26970
+ define(flagsBound, {
26971
+ getPolyfill: getPolyfill,
26972
+ implementation: implementation,
26973
+ shim: shim
26974
+ });
26975
+ module.exports = flagsBound;
26976
+
26977
+ /***/ }),
26978
+
26979
+ /***/ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/polyfill.js":
26980
+ /*!*********************************************************************************!*\
26981
+ !*** ./node_modules/deep-equal/node_modules/regexp.prototype.flags/polyfill.js ***!
26982
+ \*********************************************************************************/
26983
+ /*! no static exports found */
26984
+ /***/ (function(module, exports, __webpack_require__) {
26985
+
26986
+ "use strict";
26987
+
26988
+
26989
+ var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/implementation.js");
26990
+
26991
+ var supportsDescriptors = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js").supportsDescriptors;
26992
+
26993
+ var $gOPD = Object.getOwnPropertyDescriptor;
26994
+
26995
+ module.exports = function getPolyfill() {
26996
+ if (supportsDescriptors && /a/mig.flags === 'gim') {
26997
+ var descriptor = $gOPD(RegExp.prototype, 'flags');
26998
+
26999
+ if (descriptor && typeof descriptor.get === 'function' && typeof /a/.dotAll === 'boolean') {
27000
+ return descriptor.get;
27001
+ }
27002
+ }
27003
+
27004
+ return implementation;
27005
+ };
27006
+
27007
+ /***/ }),
27008
+
27009
+ /***/ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/shim.js":
27010
+ /*!*****************************************************************************!*\
27011
+ !*** ./node_modules/deep-equal/node_modules/regexp.prototype.flags/shim.js ***!
27012
+ \*****************************************************************************/
27013
+ /*! no static exports found */
27014
+ /***/ (function(module, exports, __webpack_require__) {
27015
+
27016
+ "use strict";
27017
+
27018
+
27019
+ var supportsDescriptors = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js").supportsDescriptors;
27020
+
27021
+ var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/deep-equal/node_modules/regexp.prototype.flags/polyfill.js");
27022
+
27023
+ var gOPD = Object.getOwnPropertyDescriptor;
27024
+ var defineProperty = Object.defineProperty;
27025
+ var TypeErr = TypeError;
27026
+ var getProto = Object.getPrototypeOf;
27027
+ var regex = /a/;
27028
+
27029
+ module.exports = function shimFlags() {
27030
+ if (!supportsDescriptors || !getProto) {
27031
+ throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
27032
+ }
27033
+
27034
+ var polyfill = getPolyfill();
27035
+ var proto = getProto(regex);
27036
+ var descriptor = gOPD(proto, 'flags');
27037
+
27038
+ if (!descriptor || descriptor.get !== polyfill) {
27039
+ defineProperty(proto, 'flags', {
27040
+ configurable: true,
27041
+ enumerable: false,
27042
+ get: polyfill
27043
+ });
27044
+ }
27045
+
27046
+ return polyfill;
27047
+ };
27048
+
27049
+ /***/ }),
27050
+
27051
+ /***/ "./node_modules/deep-equal/node_modules/which-typed-array/index.js":
27052
+ /*!*************************************************************************!*\
27053
+ !*** ./node_modules/deep-equal/node_modules/which-typed-array/index.js ***!
27054
+ \*************************************************************************/
27055
+ /*! no static exports found */
27056
+ /***/ (function(module, exports, __webpack_require__) {
27057
+
27058
+ "use strict";
27059
+
27060
+
27061
+ var forEach = __webpack_require__(/*! foreach */ "./node_modules/foreach/index.js");
27062
+
27063
+ var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js");
27064
+
27065
+ var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js");
27066
+
27067
+ var $toString = callBound('Object.prototype.toString');
27068
+
27069
+ var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
27070
+
27071
+ var g = typeof globalThis === 'undefined' ? global : globalThis;
27072
+ var typedArrays = availableTypedArrays();
27073
+ var $slice = callBound('String.prototype.slice');
27074
+ var toStrTags = {};
27075
+
27076
+ var gOPD = __webpack_require__(/*! es-abstract/helpers/getOwnPropertyDescriptor */ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js");
27077
+
27078
+ var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
27079
+
27080
+ if (hasToStringTag && gOPD && getPrototypeOf) {
27081
+ forEach(typedArrays, function (typedArray) {
27082
+ if (typeof g[typedArray] === 'function') {
27083
+ var arr = new g[typedArray]();
27084
+
27085
+ if (Symbol.toStringTag in arr) {
27086
+ var proto = getPrototypeOf(arr);
27087
+ var descriptor = gOPD(proto, Symbol.toStringTag);
27088
+
27089
+ if (!descriptor) {
27090
+ var superProto = getPrototypeOf(proto);
27091
+ descriptor = gOPD(superProto, Symbol.toStringTag);
27092
+ }
27093
+
27094
+ toStrTags[typedArray] = descriptor.get;
27095
+ }
27096
+ }
27097
+ });
27098
+ }
27099
+
27100
+ var tryTypedArrays = function tryAllTypedArrays(value) {
27101
+ var foundName = false;
27102
+ forEach(toStrTags, function (getter, typedArray) {
27103
+ if (!foundName) {
27104
+ try {
27105
+ var name = getter.call(value);
27106
+
27107
+ if (name === typedArray) {
27108
+ foundName = name;
27109
+ }
27110
+ } catch (e) {}
27111
+ }
27112
+ });
27113
+ return foundName;
27114
+ };
27115
+
27116
+ var isTypedArray = __webpack_require__(/*! is-typed-array */ "./node_modules/deep-equal/node_modules/is-typed-array/index.js");
27117
+
27118
+ module.exports = function whichTypedArray(value) {
27119
+ if (!isTypedArray(value)) {
27120
+ return false;
27121
+ }
27122
+
27123
+ if (!hasToStringTag || !(Symbol.toStringTag in value)) {
27124
+ return $slice($toString(value), 8, -1);
27125
+ }
27126
+
27127
+ return tryTypedArrays(value);
27128
+ };
27129
+
27130
+ /***/ }),
27131
+
26885
27132
  /***/ "./node_modules/define-properties/index.js":
26886
27133
  /*!*************************************************!*\
26887
27134
  !*** ./node_modules/define-properties/index.js ***!
@@ -36420,97 +36667,6 @@ if (hasSymbols) {
36420
36667
 
36421
36668
  /***/ }),
36422
36669
 
36423
- /***/ "./node_modules/is-typed-array/index.js":
36424
- /*!**********************************************!*\
36425
- !*** ./node_modules/is-typed-array/index.js ***!
36426
- \**********************************************/
36427
- /*! no static exports found */
36428
- /***/ (function(module, exports, __webpack_require__) {
36429
-
36430
- "use strict";
36431
-
36432
-
36433
- var forEach = __webpack_require__(/*! foreach */ "./node_modules/foreach/index.js");
36434
-
36435
- var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js");
36436
-
36437
- var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js");
36438
-
36439
- var $toString = callBound('Object.prototype.toString');
36440
-
36441
- var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
36442
-
36443
- var g = typeof globalThis === 'undefined' ? global : globalThis;
36444
- var typedArrays = availableTypedArrays();
36445
-
36446
- var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
36447
- for (var i = 0; i < array.length; i += 1) {
36448
- if (array[i] === value) {
36449
- return i;
36450
- }
36451
- }
36452
-
36453
- return -1;
36454
- };
36455
-
36456
- var $slice = callBound('String.prototype.slice');
36457
- var toStrTags = {};
36458
-
36459
- var gOPD = __webpack_require__(/*! es-abstract/helpers/getOwnPropertyDescriptor */ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js");
36460
-
36461
- var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
36462
-
36463
- if (hasToStringTag && gOPD && getPrototypeOf) {
36464
- forEach(typedArrays, function (typedArray) {
36465
- var arr = new g[typedArray]();
36466
-
36467
- if (Symbol.toStringTag in arr) {
36468
- var proto = getPrototypeOf(arr);
36469
- var descriptor = gOPD(proto, Symbol.toStringTag);
36470
-
36471
- if (!descriptor) {
36472
- var superProto = getPrototypeOf(proto);
36473
- descriptor = gOPD(superProto, Symbol.toStringTag);
36474
- }
36475
-
36476
- toStrTags[typedArray] = descriptor.get;
36477
- }
36478
- });
36479
- }
36480
-
36481
- var tryTypedArrays = function tryAllTypedArrays(value) {
36482
- var anyTrue = false;
36483
- forEach(toStrTags, function (getter, typedArray) {
36484
- if (!anyTrue) {
36485
- try {
36486
- anyTrue = getter.call(value) === typedArray;
36487
- } catch (e) {
36488
- /**/
36489
- }
36490
- }
36491
- });
36492
- return anyTrue;
36493
- };
36494
-
36495
- module.exports = function isTypedArray(value) {
36496
- if (!value || typeof value !== 'object') {
36497
- return false;
36498
- }
36499
-
36500
- if (!hasToStringTag || !(Symbol.toStringTag in value)) {
36501
- var tag = $slice($toString(value), 8, -1);
36502
- return $indexOf(typedArrays, tag) > -1;
36503
- }
36504
-
36505
- if (!gOPD) {
36506
- return false;
36507
- }
36508
-
36509
- return tryTypedArrays(value);
36510
- };
36511
-
36512
- /***/ }),
36513
-
36514
36670
  /***/ "./node_modules/is-weakmap/index.js":
36515
36671
  /*!******************************************!*\
36516
36672
  !*** ./node_modules/is-weakmap/index.js ***!
@@ -38990,161 +39146,6 @@ module.exports = function shimAssign() {
38990
39146
 
38991
39147
  /***/ }),
38992
39148
 
38993
- /***/ "./node_modules/regexp.prototype.flags/implementation.js":
38994
- /*!***************************************************************!*\
38995
- !*** ./node_modules/regexp.prototype.flags/implementation.js ***!
38996
- \***************************************************************/
38997
- /*! no static exports found */
38998
- /***/ (function(module, exports, __webpack_require__) {
38999
-
39000
- "use strict";
39001
-
39002
-
39003
- var $Object = Object;
39004
- var $TypeError = TypeError;
39005
-
39006
- module.exports = function flags() {
39007
- if (this != null && this !== $Object(this)) {
39008
- throw new $TypeError('RegExp.prototype.flags getter called on non-object');
39009
- }
39010
-
39011
- var result = '';
39012
-
39013
- if (this.hasIndices) {
39014
- result += 'd';
39015
- }
39016
-
39017
- if (this.global) {
39018
- result += 'g';
39019
- }
39020
-
39021
- if (this.ignoreCase) {
39022
- result += 'i';
39023
- }
39024
-
39025
- if (this.multiline) {
39026
- result += 'm';
39027
- }
39028
-
39029
- if (this.dotAll) {
39030
- result += 's';
39031
- }
39032
-
39033
- if (this.unicode) {
39034
- result += 'u';
39035
- }
39036
-
39037
- if (this.sticky) {
39038
- result += 'y';
39039
- }
39040
-
39041
- return result;
39042
- };
39043
-
39044
- /***/ }),
39045
-
39046
- /***/ "./node_modules/regexp.prototype.flags/index.js":
39047
- /*!******************************************************!*\
39048
- !*** ./node_modules/regexp.prototype.flags/index.js ***!
39049
- \******************************************************/
39050
- /*! no static exports found */
39051
- /***/ (function(module, exports, __webpack_require__) {
39052
-
39053
- "use strict";
39054
-
39055
-
39056
- var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js");
39057
-
39058
- var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js");
39059
-
39060
- var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/regexp.prototype.flags/implementation.js");
39061
-
39062
- var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/regexp.prototype.flags/polyfill.js");
39063
-
39064
- var shim = __webpack_require__(/*! ./shim */ "./node_modules/regexp.prototype.flags/shim.js");
39065
-
39066
- var flagsBound = callBind(getPolyfill());
39067
- define(flagsBound, {
39068
- getPolyfill: getPolyfill,
39069
- implementation: implementation,
39070
- shim: shim
39071
- });
39072
- module.exports = flagsBound;
39073
-
39074
- /***/ }),
39075
-
39076
- /***/ "./node_modules/regexp.prototype.flags/polyfill.js":
39077
- /*!*********************************************************!*\
39078
- !*** ./node_modules/regexp.prototype.flags/polyfill.js ***!
39079
- \*********************************************************/
39080
- /*! no static exports found */
39081
- /***/ (function(module, exports, __webpack_require__) {
39082
-
39083
- "use strict";
39084
-
39085
-
39086
- var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/regexp.prototype.flags/implementation.js");
39087
-
39088
- var supportsDescriptors = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js").supportsDescriptors;
39089
-
39090
- var $gOPD = Object.getOwnPropertyDescriptor;
39091
-
39092
- module.exports = function getPolyfill() {
39093
- if (supportsDescriptors && /a/mig.flags === 'gim') {
39094
- var descriptor = $gOPD(RegExp.prototype, 'flags');
39095
-
39096
- if (descriptor && typeof descriptor.get === 'function' && typeof /a/.dotAll === 'boolean') {
39097
- return descriptor.get;
39098
- }
39099
- }
39100
-
39101
- return implementation;
39102
- };
39103
-
39104
- /***/ }),
39105
-
39106
- /***/ "./node_modules/regexp.prototype.flags/shim.js":
39107
- /*!*****************************************************!*\
39108
- !*** ./node_modules/regexp.prototype.flags/shim.js ***!
39109
- \*****************************************************/
39110
- /*! no static exports found */
39111
- /***/ (function(module, exports, __webpack_require__) {
39112
-
39113
- "use strict";
39114
-
39115
-
39116
- var supportsDescriptors = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js").supportsDescriptors;
39117
-
39118
- var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/regexp.prototype.flags/polyfill.js");
39119
-
39120
- var gOPD = Object.getOwnPropertyDescriptor;
39121
- var defineProperty = Object.defineProperty;
39122
- var TypeErr = TypeError;
39123
- var getProto = Object.getPrototypeOf;
39124
- var regex = /a/;
39125
-
39126
- module.exports = function shimFlags() {
39127
- if (!supportsDescriptors || !getProto) {
39128
- throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
39129
- }
39130
-
39131
- var polyfill = getPolyfill();
39132
- var proto = getProto(regex);
39133
- var descriptor = gOPD(proto, 'flags');
39134
-
39135
- if (!descriptor || descriptor.get !== polyfill) {
39136
- defineProperty(proto, 'flags', {
39137
- configurable: true,
39138
- enumerable: false,
39139
- get: polyfill
39140
- });
39141
- }
39142
-
39143
- return polyfill;
39144
- };
39145
-
39146
- /***/ }),
39147
-
39148
39149
  /***/ "./node_modules/side-channel/index.js":
39149
39150
  /*!********************************************!*\
39150
39151
  !*** ./node_modules/side-channel/index.js ***!
@@ -39620,87 +39621,6 @@ module.exports = function whichCollection(value) {
39620
39621
 
39621
39622
  /***/ }),
39622
39623
 
39623
- /***/ "./node_modules/which-typed-array/index.js":
39624
- /*!*************************************************!*\
39625
- !*** ./node_modules/which-typed-array/index.js ***!
39626
- \*************************************************/
39627
- /*! no static exports found */
39628
- /***/ (function(module, exports, __webpack_require__) {
39629
-
39630
- "use strict";
39631
-
39632
-
39633
- var forEach = __webpack_require__(/*! foreach */ "./node_modules/foreach/index.js");
39634
-
39635
- var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js");
39636
-
39637
- var callBound = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js");
39638
-
39639
- var $toString = callBound('Object.prototype.toString');
39640
-
39641
- var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
39642
-
39643
- var g = typeof globalThis === 'undefined' ? global : globalThis;
39644
- var typedArrays = availableTypedArrays();
39645
- var $slice = callBound('String.prototype.slice');
39646
- var toStrTags = {};
39647
-
39648
- var gOPD = __webpack_require__(/*! es-abstract/helpers/getOwnPropertyDescriptor */ "./node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js");
39649
-
39650
- var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
39651
-
39652
- if (hasToStringTag && gOPD && getPrototypeOf) {
39653
- forEach(typedArrays, function (typedArray) {
39654
- if (typeof g[typedArray] === 'function') {
39655
- var arr = new g[typedArray]();
39656
-
39657
- if (Symbol.toStringTag in arr) {
39658
- var proto = getPrototypeOf(arr);
39659
- var descriptor = gOPD(proto, Symbol.toStringTag);
39660
-
39661
- if (!descriptor) {
39662
- var superProto = getPrototypeOf(proto);
39663
- descriptor = gOPD(superProto, Symbol.toStringTag);
39664
- }
39665
-
39666
- toStrTags[typedArray] = descriptor.get;
39667
- }
39668
- }
39669
- });
39670
- }
39671
-
39672
- var tryTypedArrays = function tryAllTypedArrays(value) {
39673
- var foundName = false;
39674
- forEach(toStrTags, function (getter, typedArray) {
39675
- if (!foundName) {
39676
- try {
39677
- var name = getter.call(value);
39678
-
39679
- if (name === typedArray) {
39680
- foundName = name;
39681
- }
39682
- } catch (e) {}
39683
- }
39684
- });
39685
- return foundName;
39686
- };
39687
-
39688
- var isTypedArray = __webpack_require__(/*! is-typed-array */ "./node_modules/is-typed-array/index.js");
39689
-
39690
- module.exports = function whichTypedArray(value) {
39691
- if (!isTypedArray(value)) {
39692
- return false;
39693
- }
39694
-
39695
- if (!hasToStringTag || !(Symbol.toStringTag in value)) {
39696
- return $slice($toString(value), 8, -1);
39697
- }
39698
-
39699
- return tryTypedArrays(value);
39700
- };
39701
-
39702
- /***/ }),
39703
-
39704
39624
  /***/ "./packages/api/app/query.js":
39705
39625
  /*!***********************************!*\
39706
39626
  !*** ./packages/api/app/query.js ***!
@@ -40222,6 +40142,12 @@ module.exports = {
40222
40142
  /*! no static exports found */
40223
40143
  /***/ (function(module, exports, __webpack_require__) {
40224
40144
 
40145
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
40146
+
40147
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
40148
+
40149
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
40150
+
40225
40151
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
40226
40152
 
40227
40153
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -40333,7 +40259,8 @@ function getCurrentMonth() {
40333
40259
 
40334
40260
 
40335
40261
  async function importAccounts(data, entityIdMap) {
40336
- return Promise.all(data.accounts.map(async account => {
40262
+ const accounts = sortByKey(data.accounts, 'sortableIndex');
40263
+ return Promise.all(accounts.map(async account => {
40337
40264
  if (!account.isTombstone) {
40338
40265
  const id = await actual.createAccount({
40339
40266
  type: mapAccountType(account.accountType),
@@ -40419,6 +40346,12 @@ async function importTransactions(data, entityIdMap) {
40419
40346
 
40420
40347
  for (let transaction of data.transactions) {
40421
40348
  entityIdMap.set(transaction.entityId, uuid.v4());
40349
+
40350
+ if (transaction.subTransactions) {
40351
+ for (let subTransaction of transaction.subTransactions) {
40352
+ entityIdMap.set(subTransaction.entityId, uuid.v4());
40353
+ }
40354
+ }
40422
40355
  }
40423
40356
 
40424
40357
  let sortOrder = 1;
@@ -40431,29 +40364,38 @@ async function importTransactions(data, entityIdMap) {
40431
40364
  }
40432
40365
 
40433
40366
  let id = entityIdMap.get(transaction.entityId);
40434
- let transferId = entityIdMap.get(transaction.transferTransactionId) || null;
40435
- let payee = null;
40436
40367
 
40437
- if (transferId) {
40438
- payee = payees.find(p => p.transfer_acct === entityIdMap.get(transaction.targetAccountId)).id;
40439
- } else {
40440
- payee = entityIdMap.get(transaction.payeeId);
40368
+ function transferProperties(t) {
40369
+ let transferId = entityIdMap.get(t.transferTransactionId) || null;
40370
+ let payee = null;
40371
+
40372
+ if (transferId) {
40373
+ payee = payees.find(p => p.transfer_acct === entityIdMap.get(t.targetAccountId)).id;
40374
+ } else {
40375
+ payee = entityIdMap.get(t.payeeId);
40376
+ }
40377
+
40378
+ return {
40379
+ transfer_id: transferId,
40380
+ payee
40381
+ };
40441
40382
  }
40442
40383
 
40443
- let newTransaction = {
40384
+ let newTransaction = _objectSpread({
40444
40385
  id,
40445
40386
  amount: amountToInteger(transaction.amount),
40446
40387
  category: isOffBudget(entityIdMap.get(accountId)) ? null : getCategory(transaction.categoryId),
40447
40388
  date: transaction.date,
40448
40389
  notes: transaction.memo || null,
40449
- payee,
40450
- transfer_id: transferId
40451
- };
40390
+ cleared: transaction.cleared === 'Cleared'
40391
+ }, transferProperties(transaction));
40392
+
40452
40393
  newTransaction.subtransactions = transaction.subTransactions && transaction.subTransactions.map((t, i) => {
40453
- return {
40394
+ return _objectSpread({
40454
40395
  amount: amountToInteger(t.amount),
40455
- category: getCategory(t.categoryId)
40456
- };
40396
+ category: getCategory(t.categoryId),
40397
+ notes: t.memo || null
40398
+ }, transferProperties(t));
40457
40399
  });
40458
40400
  return newTransaction;
40459
40401
  }).filter(x => x);
@@ -40486,11 +40428,7 @@ function fillInBudgets(data, categoryBudgets) {
40486
40428
 
40487
40429
  async function importBudgets(data, entityIdMap) {
40488
40430
  let budgets = sortByKey(data.monthlyBudgets, 'month');
40489
- let earliestMonth = monthFromDate(budgets[0].month);
40490
- let currentMonth = getCurrentMonth();
40491
40431
  await actual.batchBudgetUpdates(async () => {
40492
- const carryoverFlags = {};
40493
-
40494
40432
  for (let budget of budgets) {
40495
40433
  let filled = fillInBudgets(data, budget.monthlySubCategoryBudgets.filter(b => !b.isTombstone));
40496
40434
  await Promise.all(filled.map(async catBudget => {
@@ -40505,13 +40443,8 @@ async function importBudgets(data, entityIdMap) {
40505
40443
  await actual.setBudgetAmount(month, catId, amount);
40506
40444
 
40507
40445
  if (catBudget.overspendingHandling === 'AffectsBuffer') {
40508
- // Turn off the carryover flag so it doesn't propagate
40509
- // to future months
40510
- carryoverFlags[catId] = false;
40511
- } else if (catBudget.overspendingHandling === 'Confined' || carryoverFlags[catId]) {
40512
- // Overspending has switched to carryover, set the
40513
- // flag so it propagates to future months
40514
- carryoverFlags[catId] = true;
40446
+ await actual.setBudgetCarryover(month, catId, false);
40447
+ } else if (catBudget.overspendingHandling === 'Confined') {
40515
40448
  await actual.setBudgetCarryover(month, catId, true);
40516
40449
  }
40517
40450
  }));
@@ -41406,9 +41339,7 @@ async function fillChecking(handlers, account, payees, groups) {
41406
41339
  async function fillInvestment(handlers, account, payees, groups) {
41407
41340
  let _extractCommonThings3 = extractCommonThings(payees, groups),
41408
41341
  incomePayee = _extractCommonThings3.incomePayee,
41409
- expensePayees = _extractCommonThings3.expensePayees,
41410
- incomeGroup = _extractCommonThings3.incomeGroup,
41411
- expenseCategories = _extractCommonThings3.expenseCategories;
41342
+ incomeGroup = _extractCommonThings3.incomeGroup;
41412
41343
 
41413
41344
  let numTransactions = integer(10, 30);
41414
41345
  let transactions = [];
@@ -41487,9 +41418,7 @@ async function fillSavings(handlers, account, payees, groups) {
41487
41418
  async function fillMortgage(handlers, account, payees, groups) {
41488
41419
  let _extractCommonThings5 = extractCommonThings(payees, groups),
41489
41420
  incomePayee = _extractCommonThings5.incomePayee,
41490
- expensePayees = _extractCommonThings5.expensePayees,
41491
- incomeGroup = _extractCommonThings5.incomeGroup,
41492
- expenseCategories = _extractCommonThings5.expenseCategories;
41421
+ incomeGroup = _extractCommonThings5.incomeGroup;
41493
41422
 
41494
41423
  let numTransactions = integer(7, 10);
41495
41424
  let amount = integer(100000, 200000);
@@ -41524,9 +41453,7 @@ async function fillMortgage(handlers, account, payees, groups) {
41524
41453
  async function fillOther(handlers, account, payees, groups) {
41525
41454
  let _extractCommonThings6 = extractCommonThings(payees, groups),
41526
41455
  incomePayee = _extractCommonThings6.incomePayee,
41527
- expensePayees = _extractCommonThings6.expensePayees,
41528
- incomeGroup = _extractCommonThings6.incomeGroup,
41529
- expenseCategories = _extractCommonThings6.expenseCategories;
41456
+ incomeGroup = _extractCommonThings6.incomeGroup;
41530
41457
 
41531
41458
  let numTransactions = integer(3, 6);
41532
41459
  let category = incomeGroup.categories.find(c => c.name === 'Income');
@@ -41897,16 +41824,8 @@ __webpack_require__.r(__webpack_exports__);
41897
41824
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "captureBreadcrumb", function() { return captureBreadcrumb; });
41898
41825
  function captureException(exc) {
41899
41826
  console.log('[Exception]', exc);
41900
-
41901
- if (global.SentryClient) {
41902
- global.SentryClient.captureException(exc);
41903
- }
41904
- }
41905
- function captureBreadcrumb(breadcrumb) {
41906
- if (global.SentryClient) {
41907
- global.SentryClient.addBreadcrumb(breadcrumb);
41908
- }
41909
41827
  }
41828
+ function captureBreadcrumb(breadcrumb) {}
41910
41829
 
41911
41830
  /***/ }),
41912
41831
 
@@ -42968,14 +42887,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
42968
42887
 
42969
42888
 
42970
42889
 
42971
- function safeNumber(n) {
42972
- return isNaN(n) ? null : n;
42973
- }
42974
-
42975
- function safeParseInt(n) {
42976
- return safeNumber(parseInt(n));
42977
- }
42978
-
42979
42890
  function assert(test, type, msg) {
42980
42891
  if (!test) {
42981
42892
  throw new _errors__WEBPACK_IMPORTED_MODULE_5__["RuleError"](type, msg);
@@ -43637,7 +43548,6 @@ function migrateIds(rule, mappings) {
43637
43548
  } // This finds all the rules that reference the `id`
43638
43549
 
43639
43550
  function iterateIds(rules, fieldName, func) {
43640
- let counts = {};
43641
43551
  let i;
43642
43552
 
43643
43553
  ruleiter: for (i = 0; i < rules.length; i++) {
@@ -43738,8 +43648,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
43738
43648
 
43739
43649
 
43740
43650
 
43741
- const levenshtein = __webpack_require__(/*! damerau-levenshtein */ "./node_modules/damerau-levenshtein/index.js");
43742
-
43743
43651
  const dateFns = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js");
43744
43652
 
43745
43653
  const uuid = __webpack_require__(/*! ../../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js");
@@ -44039,7 +43947,6 @@ async function reconcileTransactions(acctId, transactions) {
44039
43947
  }); // Finally, generate & commit the changes
44040
43948
 
44041
43949
  for (let _ref2 of transactionsStep3) {
44042
- let payee_name = _ref2.payee_name;
44043
43950
  let trans = _ref2.trans;
44044
43951
  let subtransactions = _ref2.subtransactions;
44045
43952
  let match = _ref2.match;
@@ -44107,7 +44014,6 @@ async function addTransactions(acctId, transactions, {
44107
44014
  payeesToCreate = _await$normalizeTrans2.payeesToCreate;
44108
44015
 
44109
44016
  for (let _ref3 of normalized) {
44110
- let payee_name = _ref3.payee_name;
44111
44017
  let trans = _ref3.trans;
44112
44018
  let subtransactions = _ref3.subtransactions;
44113
44019
  // Run the rules
@@ -44602,7 +44508,6 @@ function onApplySync(oldValues, newValues) {
44602
44508
  function runRules(trans) {
44603
44509
  let finalTrans = _objectSpread({}, trans);
44604
44510
 
44605
- let allChanges = {};
44606
44511
  let rules = Object(_rules__WEBPACK_IMPORTED_MODULE_9__["rankRules"])(Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["fastSetMerge"])(firstcharIndexer.getApplicableRules(trans), payeeIndexer.getApplicableRules(trans)));
44607
44512
 
44608
44513
  for (let i = 0; i < rules.length; i++) {
@@ -44711,11 +44616,6 @@ function conditionsToAQL(conditions, {
44711
44616
  let dates = value.schedule.occurrences({
44712
44617
  take: recurDateBounds
44713
44618
  }).toArray().map(d => Object(_shared_months__WEBPACK_IMPORTED_MODULE_0__["dayFromDate"])(d.date));
44714
-
44715
- let compare = d => ({
44716
- $eq: d
44717
- });
44718
-
44719
44619
  return {
44720
44620
  $or: dates.map(d => {
44721
44621
  if (op === 'isapprox') {
@@ -44738,8 +44638,6 @@ function conditionsToAQL(conditions, {
44738
44638
  })
44739
44639
  };
44740
44640
  } else {
44741
- let date = value.date;
44742
-
44743
44641
  if (op === 'isapprox') {
44744
44642
  let fullDate = Object(_shared_months__WEBPACK_IMPORTED_MODULE_0__["parseDate"])(value.date);
44745
44643
  let high = Object(_shared_months__WEBPACK_IMPORTED_MODULE_0__["addDays"])(fullDate, 2);
@@ -45413,8 +45311,7 @@ async function getPayee(acct) {
45413
45311
  async function getTransferredAccount(transaction) {
45414
45312
  if (transaction.payee) {
45415
45313
  let _await$db$first = await _db__WEBPACK_IMPORTED_MODULE_0__["first"]('SELECT id, transfer_acct FROM v_payees WHERE id = ?', [transaction.payee]),
45416
- transfer_acct = _await$db$first.transfer_acct,
45417
- id = _await$db$first.id;
45314
+ transfer_acct = _await$db$first.transfer_acct;
45418
45315
 
45419
45316
  return transfer_acct;
45420
45317
  }
@@ -45499,21 +45396,26 @@ async function addTransfer(transaction, transferredAccount) {
45499
45396
  } : {});
45500
45397
  }
45501
45398
  async function removeTransfer(transaction) {
45502
- let transferTrans = await _db__WEBPACK_IMPORTED_MODULE_0__["getTransaction"](transaction.transfer_id);
45503
-
45504
- if (transferTrans.is_child) {
45505
- // If it's a child transaction, we don't delete it because that
45506
- // would invalidate the whole split transaction. Instead of turn
45507
- // it into a normal transaction
45508
- await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({
45509
- id: transaction.transfer_id,
45510
- transfer_id: null,
45511
- payee: null
45512
- });
45513
- } else {
45514
- await _db__WEBPACK_IMPORTED_MODULE_0__["deleteTransaction"]({
45515
- id: transaction.transfer_id
45516
- });
45399
+ let transferTrans = await _db__WEBPACK_IMPORTED_MODULE_0__["getTransaction"](transaction.transfer_id); // Perform operations on the transfer transaction only
45400
+ // if it is found. For example: when users delete both
45401
+ // (in & out) transfer transactions at the same time -
45402
+ // transfer transaction will not be found.
45403
+
45404
+ if (transferTrans) {
45405
+ if (transferTrans.is_child) {
45406
+ // If it's a child transaction, we don't delete it because that
45407
+ // would invalidate the whole split transaction. Instead of turn
45408
+ // it into a normal transaction
45409
+ await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({
45410
+ id: transaction.transfer_id,
45411
+ transfer_id: null,
45412
+ payee: null
45413
+ });
45414
+ } else {
45415
+ await _db__WEBPACK_IMPORTED_MODULE_0__["deleteTransaction"]({
45416
+ id: transaction.transfer_id
45417
+ });
45418
+ }
45517
45419
  }
45518
45420
 
45519
45421
  await _db__WEBPACK_IMPORTED_MODULE_0__["updateTransaction"]({
@@ -46674,7 +46576,6 @@ function makePath(state, path) {
46674
46576
 
46675
46577
  function resolvePath(state, path) {
46676
46578
  let paths = path.split('.');
46677
- let tableId;
46678
46579
  paths = paths.reduce((acc, name) => {
46679
46580
  let fullName = acc.context + '.' + name;
46680
46581
  return {
@@ -47073,19 +46974,6 @@ const compileExpr = saveStack('expr', (state, expr) => {
47073
46974
 
47074
46975
  return compileLiteral(expr);
47075
46976
  });
47076
-
47077
- function assertType(name, data, acceptedTypes) {
47078
- if (acceptedTypes.indexOf(data.type) === -1) {
47079
- throw new CompileError(`Invalid type of expression to ${name}, must be one of ${JSON.stringify(acceptedTypes)}: ${JSON.stringify(data.value)}`);
47080
- }
47081
- }
47082
-
47083
- function assertArgLength(name, args, len) {
47084
- if (args.length !== len) {
47085
- throw new CompileError(`Invalid number of args to ${name}: expected ${len} but received ${args.length}`)();
47086
- }
47087
- }
47088
-
47089
46977
  const compileFunction = saveStack('function', (state, func) => {
47090
46978
  let _Object$keys = Object.keys(func),
47091
46979
  _Object$keys2 = _slicedToArray(_Object$keys, 1),
@@ -47170,34 +47058,21 @@ const compileFunction = saveStack('function', (state, func) => {
47170
47058
  case '$neg':
47171
47059
  {
47172
47060
  validateArgLength(args, 1);
47173
-
47174
- let _valArray11 = valArray(state, args, ['float']),
47175
- _valArray12 = _slicedToArray(_valArray11, 1),
47176
- arg1 = _valArray12[0];
47177
-
47061
+ valArray(state, args, ['float']);
47178
47062
  return typed(`(-${val(state, args[0])})`, args[0].type);
47179
47063
  }
47180
47064
 
47181
47065
  case '$abs':
47182
47066
  {
47183
47067
  validateArgLength(args, 1);
47184
-
47185
- let _valArray13 = valArray(state, args, ['float']),
47186
- _valArray14 = _slicedToArray(_valArray13, 1),
47187
- arg1 = _valArray14[0];
47188
-
47068
+ valArray(state, args, ['float']);
47189
47069
  return typed(`ABS(${val(state, args[0])})`, args[0].type);
47190
47070
  }
47191
47071
 
47192
47072
  case '$idiv':
47193
47073
  {
47194
47074
  validateArgLength(args, 2);
47195
-
47196
- let _valArray15 = valArray(state, args, ['integer', 'integer']),
47197
- _valArray16 = _slicedToArray(_valArray15, 2),
47198
- arg1 = _valArray16[0],
47199
- arg2 = _valArray16[1];
47200
-
47075
+ valArray(state, args, ['integer', 'integer']);
47201
47076
  return typed(`(${val(state, args[0])} / ${val(state, args[1])})`, args[0].type);
47202
47077
  }
47203
47078
  // date functions
@@ -47223,9 +47098,9 @@ const compileFunction = saveStack('function', (state, func) => {
47223
47098
  case '$nocase':
47224
47099
  validateArgLength(args, 1);
47225
47100
 
47226
- let _valArray17 = valArray(state, args, ['string']),
47227
- _valArray18 = _slicedToArray(_valArray17, 1),
47228
- arg1 = _valArray18[0];
47101
+ let _valArray11 = valArray(state, args, ['string']),
47102
+ _valArray12 = _slicedToArray(_valArray11, 1),
47103
+ arg1 = _valArray12[0];
47229
47104
 
47230
47105
  return typed(`${arg1} COLLATE NOCASE`, args[0].type);
47231
47106
 
@@ -47268,40 +47143,40 @@ const compileOp = saveStack('op', (state, fieldRef, opData) => {
47268
47143
  switch (op) {
47269
47144
  case '$gte':
47270
47145
  {
47271
- let _valArray19 = valArray(state, [lhs, rhs], [null, lhs.type]),
47272
- _valArray20 = _slicedToArray(_valArray19, 2),
47273
- left = _valArray20[0],
47274
- right = _valArray20[1];
47146
+ let _valArray13 = valArray(state, [lhs, rhs], [null, lhs.type]),
47147
+ _valArray14 = _slicedToArray(_valArray13, 2),
47148
+ left = _valArray14[0],
47149
+ right = _valArray14[1];
47275
47150
 
47276
47151
  return `${left} >= ${right}`;
47277
47152
  }
47278
47153
 
47279
47154
  case '$lte':
47280
47155
  {
47281
- let _valArray21 = valArray(state, [lhs, rhs], [null, lhs.type]),
47282
- _valArray22 = _slicedToArray(_valArray21, 2),
47283
- left = _valArray22[0],
47284
- right = _valArray22[1];
47156
+ let _valArray15 = valArray(state, [lhs, rhs], [null, lhs.type]),
47157
+ _valArray16 = _slicedToArray(_valArray15, 2),
47158
+ left = _valArray16[0],
47159
+ right = _valArray16[1];
47285
47160
 
47286
47161
  return `${left} <= ${right}`;
47287
47162
  }
47288
47163
 
47289
47164
  case '$gt':
47290
47165
  {
47291
- let _valArray23 = valArray(state, [lhs, rhs], [null, lhs.type]),
47292
- _valArray24 = _slicedToArray(_valArray23, 2),
47293
- left = _valArray24[0],
47294
- right = _valArray24[1];
47166
+ let _valArray17 = valArray(state, [lhs, rhs], [null, lhs.type]),
47167
+ _valArray18 = _slicedToArray(_valArray17, 2),
47168
+ left = _valArray18[0],
47169
+ right = _valArray18[1];
47295
47170
 
47296
47171
  return `${left} > ${right}`;
47297
47172
  }
47298
47173
 
47299
47174
  case '$lt':
47300
47175
  {
47301
- let _valArray25 = valArray(state, [lhs, rhs], [null, lhs.type]),
47302
- _valArray26 = _slicedToArray(_valArray25, 2),
47303
- left = _valArray26[0],
47304
- right = _valArray26[1];
47176
+ let _valArray19 = valArray(state, [lhs, rhs], [null, lhs.type]),
47177
+ _valArray20 = _slicedToArray(_valArray19, 2),
47178
+ left = _valArray20[0],
47179
+ right = _valArray20[1];
47305
47180
 
47306
47181
  return `${left} < ${right}`;
47307
47182
  }
@@ -47312,10 +47187,10 @@ const compileOp = saveStack('op', (state, fieldRef, opData) => {
47312
47187
  return `${val(state, lhs)} IS NULL`;
47313
47188
  }
47314
47189
 
47315
- let _valArray27 = valArray(state, [lhs, rhs], [null, lhs.type]),
47316
- _valArray28 = _slicedToArray(_valArray27, 2),
47317
- left = _valArray28[0],
47318
- right = _valArray28[1];
47190
+ let _valArray21 = valArray(state, [lhs, rhs], [null, lhs.type]),
47191
+ _valArray22 = _slicedToArray(_valArray21, 2),
47192
+ left = _valArray22[0],
47193
+ right = _valArray22[1];
47319
47194
 
47320
47195
  if (rhs.type === 'param') {
47321
47196
  let orders = state.namedParameters.map(param => {
@@ -47333,10 +47208,10 @@ const compileOp = saveStack('op', (state, fieldRef, opData) => {
47333
47208
 
47334
47209
  case '$oneof':
47335
47210
  {
47336
- let _valArray29 = valArray(state, [lhs, rhs], [null, 'array']),
47337
- _valArray30 = _slicedToArray(_valArray29, 2),
47338
- left = _valArray30[0],
47339
- right = _valArray30[1]; // Dedupe the ids
47211
+ let _valArray23 = valArray(state, [lhs, rhs], [null, 'array']),
47212
+ _valArray24 = _slicedToArray(_valArray23, 2),
47213
+ left = _valArray24[0],
47214
+ right = _valArray24[1]; // Dedupe the ids
47340
47215
 
47341
47216
 
47342
47217
  let ids = [...new Set(right)];
@@ -47345,10 +47220,10 @@ const compileOp = saveStack('op', (state, fieldRef, opData) => {
47345
47220
 
47346
47221
  case '$like':
47347
47222
  {
47348
- let _valArray31 = valArray(state, [lhs, rhs], ['string', 'string']),
47349
- _valArray32 = _slicedToArray(_valArray31, 2),
47350
- left = _valArray32[0],
47351
- right = _valArray32[1];
47223
+ let _valArray25 = valArray(state, [lhs, rhs], ['string', 'string']),
47224
+ _valArray26 = _slicedToArray(_valArray25, 2),
47225
+ left = _valArray26[0],
47226
+ right = _valArray26[1];
47352
47227
 
47353
47228
  return `${left} LIKE ${right}`;
47354
47229
  }
@@ -47618,7 +47493,7 @@ function isAggregateQuery(queryState) {
47618
47493
  return queryState.selectExpressions.find(expr => {
47619
47494
  if (typeof expr !== 'string') {
47620
47495
  let _Object$entries$3 = _slicedToArray(Object.entries(expr)[0], 2),
47621
- name = _Object$entries$3[0],
47496
+ _ = _Object$entries$3[0],
47622
47497
  value = _Object$entries$3[1];
47623
47498
 
47624
47499
  return isAggregateFunction(value);
@@ -47673,15 +47548,13 @@ function compileQuery(queryState, schema, schemaConfig = {}) {
47673
47548
  groupExpressions = _customizeQuery.groupExpressions,
47674
47549
  orderExpressions = _customizeQuery.orderExpressions,
47675
47550
  limit = _customizeQuery.limit,
47676
- offset = _customizeQuery.offset,
47677
- calculation = _customizeQuery.calculation;
47551
+ offset = _customizeQuery.offset;
47678
47552
 
47679
47553
  let select = '';
47680
47554
  let where = '';
47681
47555
  let joins = '';
47682
47556
  let groupBy = '';
47683
47557
  let orderBy = '';
47684
- let dependences = [];
47685
47558
  let state = {
47686
47559
  schema,
47687
47560
  implicitTableName: tableName,
@@ -48221,8 +48094,7 @@ function isHappyPathQuery(queryState) {
48221
48094
  }
48222
48095
 
48223
48096
  async function execTransactionsGrouped(state, queryState, sql, params, splitType, outputTypes) {
48224
- let tableName = queryState.table,
48225
- withDead = queryState.withDead;
48097
+ let withDead = queryState.withDead;
48226
48098
  let whereDead = withDead ? '' : `AND ${sql.from}.tombstone = 0`;
48227
48099
 
48228
48100
  if (Object(_compiler__WEBPACK_IMPORTED_MODULE_2__["isAggregateQuery"])(queryState)) {
@@ -48290,7 +48162,6 @@ async function execTransactionsGrouped(state, queryState, sql, params, splitType
48290
48162
  WHERE ${where} ${whereDead}
48291
48163
  ${sql.orderBy}
48292
48164
  `;
48293
- let start = Date.now();
48294
48165
  let allRows = await _db__WEBPACK_IMPORTED_MODULE_0__["all"](finalSql); // Group the parents and children up
48295
48166
 
48296
48167
  let _allRows$reduce = allRows.reduce((acc, trans) => {
@@ -48558,9 +48429,7 @@ const schemaConfig = {
48558
48429
  },
48559
48430
 
48560
48431
  customizeQuery(queryState) {
48561
- let tableName = queryState.table,
48562
- _queryState$tableOpti = queryState.tableOptions,
48563
- tableOptions = _queryState$tableOpti === void 0 ? {} : _queryState$tableOpti;
48432
+ let tableName = queryState.table;
48564
48433
 
48565
48434
  function orderBy(orders) {
48566
48435
  // If order was specified, always add id as the last sort to make
@@ -49068,11 +48937,12 @@ function stopBackupService() {
49068
48937
  /*!*********************************************************!*\
49069
48938
  !*** ./packages/loot-core/src/server/budget/actions.js ***!
49070
48939
  \*********************************************************/
49071
- /*! exports provided: getBudget, setBudget, setBuffer, copyPreviousMonth, setZero, set3MonthAvg, holdForNextMonth, resetHold, coverOverspending, transferAvailable, transferCategory, setCategoryCarryover */
48940
+ /*! exports provided: getSheetValue, getBudget, setBudget, setBuffer, copyPreviousMonth, setZero, set3MonthAvg, holdForNextMonth, resetHold, coverOverspending, transferAvailable, transferCategory, setCategoryCarryover */
49072
48941
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
49073
48942
 
49074
48943
  "use strict";
49075
48944
  __webpack_require__.r(__webpack_exports__);
48945
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSheetValue", function() { return getSheetValue; });
49076
48946
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBudget", function() { return getBudget; });
49077
48947
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setBudget", function() { return setBudget; });
49078
48948
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setBuffer", function() { return setBuffer; });
@@ -49097,7 +48967,6 @@ __webpack_require__.r(__webpack_exports__);
49097
48967
 
49098
48968
 
49099
48969
 
49100
-
49101
48970
  async function getSheetValue(sheetName, cell) {
49102
48971
  const node = await _sheet__WEBPACK_IMPORTED_MODULE_4__["getCell"](sheetName, cell);
49103
48972
  return Object(_shared_util__WEBPACK_IMPORTED_MODULE_1__["safeNumber"])(typeof node.value === 'number' ? node.value : 0);
@@ -49106,7 +48975,6 @@ async function getSheetValue(sheetName, cell) {
49106
48975
  // and you shouldn't be allowed to pull non-existant money from
49107
48976
  // leftover.
49108
48977
 
49109
-
49110
48978
  function calcBufferedAmount(toBudget, buffered, amount) {
49111
48979
  amount = Math.min(Math.max(amount, -buffered), Math.max(toBudget, 0));
49112
48980
  return buffered + amount;
@@ -49126,13 +48994,6 @@ function isReflectBudget() {
49126
48994
  return budgetType === 'report';
49127
48995
  }
49128
48996
 
49129
- function isZeroBudget() {
49130
- let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_3__["getPrefs"](),
49131
- budgetType = _prefs$getPrefs2.budgetType;
49132
-
49133
- return budgetType === 'rollover';
49134
- }
49135
-
49136
48997
  function dbMonth(month) {
49137
48998
  return parseInt(month.replace('-', ''));
49138
48999
  }
@@ -49410,6 +49271,8 @@ __webpack_require__.r(__webpack_exports__);
49410
49271
  /* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.js");
49411
49272
  /* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../undo */ "./packages/loot-core/src/server/undo.js");
49412
49273
  /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./actions */ "./packages/loot-core/src/server/budget/actions.js");
49274
+ /* harmony import */ var _goaltemplates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./goaltemplates */ "./packages/loot-core/src/server/budget/goaltemplates.js");
49275
+
49413
49276
 
49414
49277
 
49415
49278
 
@@ -49419,6 +49282,8 @@ app.method('budget/budget-amount', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__
49419
49282
  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"])));
49420
49283
  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"])));
49421
49284
  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"])));
49285
+ app.method('budget/apply-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_goaltemplates__WEBPACK_IMPORTED_MODULE_4__["applyTemplate"])));
49286
+ app.method('budget/overwrite-goal-template', Object(_mutators__WEBPACK_IMPORTED_MODULE_1__["mutator"])(Object(_undo__WEBPACK_IMPORTED_MODULE_2__["undoable"])(_goaltemplates__WEBPACK_IMPORTED_MODULE_4__["overwriteTemplate"])));
49422
49287
  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"])));
49423
49288
  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"])));
49424
49289
  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"])));
@@ -49482,21 +49347,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
49482
49347
 
49483
49348
 
49484
49349
 
49485
-
49486
- function mergeUpdates(updates) {
49487
- const merged = {};
49488
- updates.forEach(update => {
49489
- Object.keys(update).forEach(sheet => {
49490
- if (merged[sheet]) {
49491
- merged[sheet] = _objectSpread(_objectSpread({}, merged[sheet]), update[sheet]);
49492
- } else {
49493
- merged[sheet] = update[sheet];
49494
- }
49495
- });
49496
- });
49497
- return merged;
49498
- }
49499
-
49500
49350
  function getBudgetType() {
49501
49351
  let meta = _sheet__WEBPACK_IMPORTED_MODULE_3__["get"]().meta();
49502
49352
  return meta.budgetType || 'rollover';
@@ -49877,6 +49727,436 @@ async function setType(type) {
49877
49727
 
49878
49728
  /***/ }),
49879
49729
 
49730
+ /***/ "./packages/loot-core/src/server/budget/goaltemplates.js":
49731
+ /*!***************************************************************!*\
49732
+ !*** ./packages/loot-core/src/server/budget/goaltemplates.js ***!
49733
+ \***************************************************************/
49734
+ /*! exports provided: applyTemplate, overwriteTemplate */
49735
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
49736
+
49737
+ "use strict";
49738
+ __webpack_require__.r(__webpack_exports__);
49739
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyTemplate", function() { return applyTemplate; });
49740
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "overwriteTemplate", function() { return overwriteTemplate; });
49741
+ /* harmony import */ var date_fns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! date-fns */ "./node_modules/date-fns/esm/index.js");
49742
+ /* harmony import */ var _shared_months__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shared/months */ "./packages/loot-core/src/shared/months.js");
49743
+ /* harmony import */ var _shared_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../shared/util */ "./packages/loot-core/src/shared/util.js");
49744
+ /* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.js");
49745
+ /* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./actions */ "./packages/loot-core/src/server/budget/actions.js");
49746
+
49747
+
49748
+
49749
+
49750
+
49751
+ async function applyTemplate({
49752
+ month
49753
+ }) {
49754
+ await processTemplate(month, false);
49755
+ }
49756
+ async function overwriteTemplate({
49757
+ month
49758
+ }) {
49759
+ await processTemplate(month, true);
49760
+ }
49761
+
49762
+ async function processTemplate(month, force) {
49763
+ let category_templates = await getCategoryTemplates();
49764
+ let categories = await _db__WEBPACK_IMPORTED_MODULE_3__["all"]('SELECT * FROM v_categories WHERE tombstone = 0');
49765
+ let num_applied = 0;
49766
+
49767
+ for (let c = 0; c < categories.length; c++) {
49768
+ let category = categories[c];
49769
+ let budgeted = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(_shared_months__WEBPACK_IMPORTED_MODULE_1__["sheetForMonth"](month), `budget-${category.id}`);
49770
+
49771
+ if (budgeted === 0 || force) {
49772
+ let template = category_templates[category.id];
49773
+
49774
+ if (template) {
49775
+ let to_budget = await applyCategoryTemplate(category, template, month, force);
49776
+
49777
+ if (to_budget != null) {
49778
+ num_applied++;
49779
+ await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["setBudget"])({
49780
+ category: category.id,
49781
+ month,
49782
+ amount: to_budget
49783
+ });
49784
+ }
49785
+ }
49786
+ }
49787
+ }
49788
+
49789
+ if (num_applied === 0) {
49790
+ console.log('All categories were up to date.');
49791
+ } else {
49792
+ console.log(`${num_applied} categories updated.`);
49793
+ }
49794
+ }
49795
+
49796
+ async function getCategoryTemplates() {
49797
+ const matches = [{
49798
+ type: 'simple',
49799
+ re: /^#template \$?(\-?\d+(\.\d{2})?)$/im,
49800
+ //eslint-disable-line
49801
+ params: ['monthly']
49802
+ }, {
49803
+ type: 'simple',
49804
+ re: /^#template up to \$?(\d+(\.\d{2})?)$/im,
49805
+ params: ['limit']
49806
+ }, {
49807
+ type: 'simple',
49808
+ re: /^#template \$?(\d+(\.\d{2})?) up to \$?(\d+(\.\d{2})?)$/im,
49809
+ params: ['monthly', null, 'limit']
49810
+ }, {
49811
+ type: 'by',
49812
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2})$/im,
49813
+ //eslint-disable-line
49814
+ params: ['amount', null, 'month']
49815
+ }, {
49816
+ type: 'by',
49817
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) repeat every (\d+) months$/im,
49818
+ //eslint-disable-line
49819
+ params: ['amount', null, 'month', 'repeat']
49820
+ }, {
49821
+ type: 'week',
49822
+ re: /^#template \$?(\d+(\.\d{2})?) repeat every week starting (\d{4}\-\d{2}\-\d{2})$/im,
49823
+ //eslint-disable-line
49824
+ params: ['amount', null, 'starting']
49825
+ }, {
49826
+ type: 'week',
49827
+ re: /^#template \$?(\d+(\.\d{2})?) repeat every week starting (\d{4}\-\d{2}\-\d{2}) up to \$?(\d+(\.\d{2})?)$/im,
49828
+ //eslint-disable-line
49829
+ params: ['amount', null, 'starting', 'limit']
49830
+ }, {
49831
+ type: 'weeks',
49832
+ re: /^#template \$?(\d+(\.\d{2})?) repeat every (\d+) weeks starting (\d{4}\-\d{2}\-\d{2})$/im,
49833
+ //eslint-disable-line
49834
+ params: ['amount', null, 'weeks', 'starting']
49835
+ }, {
49836
+ type: 'weeks',
49837
+ re: /^#template \$?(\d+(\.\d{2})?) repeat every (\d+) weeks starting (\d{4}\-\d{2}\-\d{2}) up to \$?(\d+(\.\d{2})?)$/im,
49838
+ //eslint-disable-line
49839
+ params: ['amount', null, 'weeks', 'starting', 'limit']
49840
+ }, {
49841
+ type: 'by_annual',
49842
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) repeat every year$/im,
49843
+ //eslint-disable-line
49844
+ params: ['amount', null, 'month']
49845
+ }, {
49846
+ type: 'by_annual',
49847
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) repeat every (\d+) years$/im,
49848
+ //eslint-disable-line
49849
+ params: ['amount', null, 'month', 'repeat']
49850
+ }, {
49851
+ type: 'spend',
49852
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) spend from (\d{4}\-\d{2})$/im,
49853
+ //eslint-disable-line
49854
+ params: ['amount', null, 'month', 'from']
49855
+ }, {
49856
+ type: 'spend',
49857
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) spend from (\d{4}\-\d{2}) repeat every (\d+) months$/im,
49858
+ //eslint-disable-line
49859
+ params: ['amount', null, 'month', 'from', 'repeat']
49860
+ }, {
49861
+ type: 'spend_annual',
49862
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) spend from (\d{4}\-\d{2}) repeat every year$/im,
49863
+ //eslint-disable-line
49864
+ params: ['amount', null, 'month', 'from']
49865
+ }, {
49866
+ type: 'spend_annual',
49867
+ re: /^#template \$?(\d+(\.\d{2})?) by (\d{4}\-\d{2}) spend from (\d{4}\-\d{2}) repeat every (\d+) years$/im,
49868
+ //eslint-disable-line
49869
+ params: ['amount', null, 'month', 'from', 'repeat']
49870
+ }, {
49871
+ type: 'percentage',
49872
+ re: /^#template (\d+(\.\d+)?)% of (.*)$/im,
49873
+ params: ['percent', null, 'category']
49874
+ }, {
49875
+ type: 'error',
49876
+ re: /^#template .*$/im,
49877
+ params: []
49878
+ }];
49879
+ let templates = {};
49880
+ let notes = await _db__WEBPACK_IMPORTED_MODULE_3__["all"](`SELECT * FROM notes WHERE note like '%#template%'`);
49881
+
49882
+ for (let n = 0; n < notes.length; n++) {
49883
+ let lines = notes[n].note.split('\n');
49884
+ let template_lines = [];
49885
+
49886
+ for (let l = 0; l < lines.length; l++) {
49887
+ for (let m = 0; m < matches.length; m++) {
49888
+ let arr = matches[m].re.exec(lines[l]);
49889
+
49890
+ if (arr) {
49891
+ let matched = {};
49892
+ matched.line = arr[0];
49893
+ matched.type = matches[m].type;
49894
+
49895
+ for (let p = 0; p < matches[m].params.length; p++) {
49896
+ let param_name = matches[m].params[p];
49897
+
49898
+ if (param_name) {
49899
+ matched[param_name] = arr[p + 1];
49900
+ }
49901
+ }
49902
+
49903
+ template_lines.push(matched);
49904
+ break;
49905
+ }
49906
+ }
49907
+ }
49908
+
49909
+ if (template_lines.length) {
49910
+ templates[notes[n].id] = template_lines;
49911
+ }
49912
+ }
49913
+
49914
+ return templates;
49915
+ }
49916
+
49917
+ async function applyCategoryTemplate(category, template_lines, month, force) {
49918
+ let current_month = new Date(`${month}-01`); // remove lines for past dates, calculate repeating dates
49919
+
49920
+ let got_by = false;
49921
+ template_lines = template_lines.filter(template => {
49922
+ //debugger;
49923
+ switch (template.type) {
49924
+ case 'by':
49925
+ case 'by_annual':
49926
+ case 'spend':
49927
+ case 'spend_annual':
49928
+ let target_month = new Date(`${template.month}-01`);
49929
+ let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(target_month, current_month);
49930
+ let repeat = template.type.includes('annual') ? (template.repeat || 1) * 12 : template.repeat;
49931
+ let spend_from;
49932
+
49933
+ if (template.type.includes('spend')) {
49934
+ spend_from = new Date(`${template.from}-01`);
49935
+ }
49936
+
49937
+ while (num_months < 0 && repeat) {
49938
+ target_month = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(target_month, repeat);
49939
+
49940
+ if (spend_from) {
49941
+ spend_from = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(spend_from, repeat);
49942
+ }
49943
+
49944
+ num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(target_month, current_month);
49945
+ }
49946
+
49947
+ if (num_months < 0) {
49948
+ console.log(`${category.name}: ${`${template.month} is in the past:`} ${template.line}`);
49949
+ return null;
49950
+ }
49951
+
49952
+ template.month = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["format"])(target_month, 'yyyy-MM');
49953
+
49954
+ if (spend_from) {
49955
+ template.from = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["format"])(spend_from, 'yyyy-MM');
49956
+ }
49957
+
49958
+ break;
49959
+
49960
+ default:
49961
+ }
49962
+
49963
+ return template;
49964
+ });
49965
+
49966
+ if (template_lines.length > 1) {
49967
+ template_lines = template_lines.sort((a, b) => {
49968
+ if (a.type.slice(0, 2) === b.type.slice(0, 2) && a.type.slice(0, 2) === 'by') {
49969
+ return Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(new Date(`${a.month}-01`), new Date(`${b.month}-01`));
49970
+ } else {
49971
+ return a.type.localeCompare(b.type);
49972
+ }
49973
+ }).filter(el => {
49974
+ if (el.type.slice(0, 2) === 'by') {
49975
+ if (!got_by) {
49976
+ got_by = true;
49977
+ return el;
49978
+ } else {
49979
+ return null;
49980
+ }
49981
+ } else {
49982
+ return el;
49983
+ }
49984
+ });
49985
+ }
49986
+
49987
+ let to_budget = 0;
49988
+ let limit;
49989
+ let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_1__["sheetForMonth"](month);
49990
+ let budgeted = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(sheetName, `budget-${category.id}`);
49991
+ let spent = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(sheetName, `sum-amount-${category.id}`);
49992
+ let balance = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(sheetName, `leftover-${category.id}`);
49993
+ let last_month_balance = balance - spent - budgeted;
49994
+
49995
+ for (let l = 0; l < template_lines.length; l++) {
49996
+ let template = template_lines[l];
49997
+
49998
+ switch (template.type) {
49999
+ case 'simple':
50000
+ {
50001
+ // simple has 'monthly' and/or 'limit' params
50002
+ if (template.limit != null) {
50003
+ if (limit != null) {
50004
+ console.log(`${category.name}: ${`More than one 'up to' limit found.`} ${template.line}`);
50005
+ return null;
50006
+ } else {
50007
+ limit = Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(template.limit);
50008
+ }
50009
+ }
50010
+
50011
+ if (template.monthly) {
50012
+ let monthly = Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(template.monthly);
50013
+ to_budget += monthly;
50014
+ } else {
50015
+ to_budget += limit;
50016
+ }
50017
+
50018
+ break;
50019
+ }
50020
+
50021
+ case 'by':
50022
+ case 'by_annual':
50023
+ {
50024
+ // by has 'amount' and 'month' params
50025
+ let target_month = new Date(`${template.month}-01`);
50026
+ let target = Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(template.amount);
50027
+ let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(target_month, current_month);
50028
+ let repeat = template.type === 'by' ? template.repeat : (template.repeat || 1) * 12;
50029
+
50030
+ while (num_months < 0 && repeat) {
50031
+ target_month = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(target_month, repeat);
50032
+ num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(target_month, current_month);
50033
+ }
50034
+
50035
+ let diff = target - last_month_balance;
50036
+
50037
+ if (diff >= 0 && num_months > -1) {
50038
+ to_budget += Math.round(diff / (num_months + 1));
50039
+ }
50040
+
50041
+ break;
50042
+ }
50043
+
50044
+ case 'week':
50045
+ case 'weeks':
50046
+ {
50047
+ // weeks has 'amount', 'starting' and optional 'limit' params
50048
+ // weeks has 'amount', 'starting', 'weeks' and optional 'limit' params
50049
+ let amount = Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(template.amount);
50050
+ let weeks = template.weeks != null ? Math.round(template.weeks) : 1;
50051
+
50052
+ if (template.limit != null) {
50053
+ if (limit != null) {
50054
+ console.log(`${category.name}: ${`More than one 'up to' limit found.`} ${template.line}`);
50055
+ return null;
50056
+ } else {
50057
+ limit = Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(template.limit);
50058
+ }
50059
+ }
50060
+
50061
+ let w = new Date(template.starting);
50062
+ let next_month = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addMonths"])(current_month, 1);
50063
+
50064
+ while (w.getTime() < next_month.getTime()) {
50065
+ if (w.getTime() >= current_month.getTime()) {
50066
+ to_budget += amount;
50067
+ }
50068
+
50069
+ w = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["addWeeks"])(w, weeks);
50070
+ }
50071
+
50072
+ break;
50073
+ }
50074
+
50075
+ case 'spend':
50076
+ case 'spend_annual':
50077
+ {
50078
+ // spend has 'amount' and 'from' and 'month' params
50079
+ let from_month = new Date(`${template.from}-01`);
50080
+ let to_month = new Date(`${template.month}-01`);
50081
+ let already_budgeted = last_month_balance;
50082
+ let first_month = true;
50083
+
50084
+ 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)) {
50085
+ let sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_1__["sheetForMonth"](Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["format"])(m, 'yyyy-MM'));
50086
+
50087
+ if (first_month) {
50088
+ let spent = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(sheetName, `sum-amount-${category.id}`);
50089
+ let balance = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(sheetName, `leftover-${category.id}`);
50090
+ already_budgeted = balance - spent;
50091
+ first_month = false;
50092
+ } else {
50093
+ let budgeted = await Object(_actions__WEBPACK_IMPORTED_MODULE_4__["getSheetValue"])(sheetName, `budget-${category.id}`);
50094
+ already_budgeted += budgeted;
50095
+ }
50096
+ }
50097
+
50098
+ let num_months = Object(date_fns__WEBPACK_IMPORTED_MODULE_0__["differenceInCalendarMonths"])(to_month, current_month);
50099
+ let target = Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["amountToInteger"])(template.amount);
50100
+
50101
+ if (num_months < 0) {
50102
+ console.log(`${category.name}: ${`${template.to} is in the past:`} ${template.line}`);
50103
+ return null;
50104
+ } else if (num_months === 0) {
50105
+ to_budget = target - already_budgeted;
50106
+ } else {
50107
+ to_budget = Math.round((target - already_budgeted) / (num_months + 1));
50108
+ }
50109
+
50110
+ break;
50111
+ }
50112
+
50113
+ case 'percentage':
50114
+ {
50115
+ /*
50116
+ let income_category = (await actual.getCategories()).filter(c => c.is_income == true && c.name == template.category);
50117
+ let func = (getBudgetMonthTestFunc || getBudgetMonth);
50118
+ let budget = await func(month);
50119
+ for (var g = 0; g < budget.categoryGroups.length; g++) {
50120
+ if (income_category.group_id == budget.categoryGroups[g].id) {
50121
+ for (var c = 0; c < budget.categoryGroups[g].categories.length; c++)
50122
+ if (income_category.id == budget.categoryGroups[g].categories[c].id) {
50123
+ let month_category = budget.categoryGroups[g].categories[c];
50124
+ }
50125
+ }
50126
+ }
50127
+ */
50128
+ break;
50129
+ }
50130
+
50131
+ case 'error':
50132
+ console.log(`${category.name}: ${`Failed to match:`} ${template.line}`);
50133
+ return null;
50134
+
50135
+ default:
50136
+ }
50137
+ }
50138
+
50139
+ if (limit != null) {
50140
+ if (to_budget + last_month_balance > limit) {
50141
+ to_budget = limit - last_month_balance;
50142
+ }
50143
+ }
50144
+
50145
+ if ((category.budgeted != null && category.budgeted !== 0 || to_budget === 0) && !force) {
50146
+ return null;
50147
+ } else if (category.budgeted === to_budget && force) {
50148
+ return null;
50149
+ } else {
50150
+ let str = category.name + ': ' + Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["integerToAmount"])(last_month_balance);
50151
+ str += ' + ' + Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["integerToAmount"])(to_budget) + ' = ' + Object(_shared_util__WEBPACK_IMPORTED_MODULE_2__["integerToAmount"])(last_month_balance + to_budget);
50152
+ str += ' ' + template_lines.map(x => x.line).join('\n');
50153
+ console.log(str);
50154
+ return to_budget;
50155
+ }
50156
+ }
50157
+
50158
+ /***/ }),
50159
+
49880
50160
  /***/ "./packages/loot-core/src/server/budget/report.js":
49881
50161
  /*!********************************************************!*\
49882
50162
  !*** ./packages/loot-core/src/server/budget/report.js ***!
@@ -50508,7 +50788,6 @@ async function upload() {
50508
50788
  });
50509
50789
  } catch (err) {
50510
50790
  console.log('Upload failure', err);
50511
- let reason = err instanceof _errors__WEBPACK_IMPORTED_MODULE_6__["PostError"] ? err.reason : 'network';
50512
50791
 
50513
50792
  if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_6__["PostError"]) {
50514
50793
  throw new _errors__WEBPACK_IMPORTED_MODULE_6__["FileUploadError"](err.reason === 'unauthorized' ? 'unauthorized' : err.reason || 'network');
@@ -50534,8 +50813,7 @@ async function possiblyUpload() {
50534
50813
  let _prefs$getPrefs5 = _prefs__WEBPACK_IMPORTED_MODULE_9__["getPrefs"](),
50535
50814
  cloudFileId = _prefs$getPrefs5.cloudFileId,
50536
50815
  groupId = _prefs$getPrefs5.groupId,
50537
- lastUploaded = _prefs$getPrefs5.lastUploaded,
50538
- id = _prefs$getPrefs5.id;
50816
+ lastUploaded = _prefs$getPrefs5.lastUploaded;
50539
50817
 
50540
50818
  let threshold = lastUploaded && _shared_months__WEBPACK_IMPORTED_MODULE_4__["addDays"](lastUploaded, UPLOAD_FREQUENCY_IN_DAYS);
50541
50819
  let currentDay = _shared_months__WEBPACK_IMPORTED_MODULE_4__["currentDay"](); // We only want to try to upload every UPLOAD_FREQUENCY_IN_DAYS days
@@ -51765,44 +52043,6 @@ async function getTransaction(id) {
51765
52043
  let rows = await selectWithSchema('transactions', 'SELECT * FROM v_transactions WHERE id = ?', [id]);
51766
52044
  return rows[0];
51767
52045
  }
51768
-
51769
- function _addFragmentForAccount(accountId, addWhere, options = {}) {
51770
- let _options$showClosed = options.showClosed,
51771
- showClosed = _options$showClosed === void 0 ? false : _options$showClosed,
51772
- _options$showOffbudge = options.showOffbudget,
51773
- showOffbudget = _options$showOffbudge === void 0 ? true : _options$showOffbudge;
51774
- let fragment = addWhere ? ' WHERE (' : ' AND ';
51775
- let params = [];
51776
-
51777
- if (accountId) {
51778
- if (accountId === 'offbudget') {
51779
- fragment += 'a.closed = 0 AND a.offbudget = 1 ';
51780
- } else if (accountId === 'budgeted') {
51781
- fragment += 'a.closed = 0 AND a.offbudget = 0 ';
51782
- } else if (accountId === 'uncategorized') {
51783
- fragment += `
51784
- t.category IS NULL AND a.offbudget = 0 AND isParent = 0 AND (
51785
- ta.offbudget IS NULL OR ta.offbudget = 1
51786
- )
51787
- `;
51788
- } else {
51789
- fragment += 'a.id = ? ';
51790
- params.push(accountId);
51791
- }
51792
- } else {
51793
- fragment += showClosed ? '1' : 'a.closed = 0';
51794
-
51795
- if (!showOffbudget) {
51796
- fragment += ' AND a.offbudget = 0';
51797
- }
51798
- }
51799
-
51800
- return {
51801
- fragment,
51802
- params
51803
- };
51804
- }
51805
-
51806
52046
  async function getTransactionsByDate(accountId, startDate, endDate, options = {}) {
51807
52047
  throw new Error('`getTransactionsByDate` is deprecated');
51808
52048
  }
@@ -52401,10 +52641,9 @@ __webpack_require__.r(__webpack_exports__);
52401
52641
  /* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.js");
52402
52642
  /* harmony import */ var _sync_migrate__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./sync/migrate */ "./packages/loot-core/src/server/sync/migrate.js");
52403
52643
  /* harmony import */ var _tools_app__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./tools/app */ "./packages/loot-core/src/server/tools/app.js");
52404
- /* harmony import */ var _tracking_events__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./tracking/events */ "./packages/loot-core/src/server/tracking/events.js");
52405
- /* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./undo */ "./packages/loot-core/src/server/undo.js");
52406
- /* harmony import */ var _update__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./update */ "./packages/loot-core/src/server/update.js");
52407
- /* harmony import */ var _util_budget_name__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./util/budget-name */ "./packages/loot-core/src/server/util/budget-name.js");
52644
+ /* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./undo */ "./packages/loot-core/src/server/undo.js");
52645
+ /* harmony import */ var _update__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./update */ "./packages/loot-core/src/server/update.js");
52646
+ /* harmony import */ var _util_budget_name__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./util/budget-name */ "./packages/loot-core/src/server/util/budget-name.js");
52408
52647
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
52409
52648
 
52410
52649
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -52469,7 +52708,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
52469
52708
 
52470
52709
 
52471
52710
 
52472
-
52473
52711
 
52474
52712
 
52475
52713
  const YNAB4 = __webpack_require__(/*! @actual-app/import-ynab4/importer */ "./packages/import-ynab4/importer.js");
@@ -52509,10 +52747,10 @@ function onSheetChange({
52509
52747
 
52510
52748
  let handlers = {};
52511
52749
  handlers['undo'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function () {
52512
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["undo"])();
52750
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["undo"])();
52513
52751
  });
52514
52752
  handlers['redo'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(function () {
52515
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["redo"])();
52753
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["redo"])();
52516
52754
  });
52517
52755
  handlers['transactions-batch-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function ({
52518
52756
  added,
@@ -52520,7 +52758,7 @@ handlers['transactions-batch-update'] = Object(_mutators__WEBPACK_IMPORTED_MODUL
52520
52758
  updated,
52521
52759
  learnCategories
52522
52760
  }) {
52523
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
52761
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52524
52762
  let result = await Object(_accounts_transactions__WEBPACK_IMPORTED_MODULE_20__["batchUpdateTransactions"])({
52525
52763
  added,
52526
52764
  updated,
@@ -52694,7 +52932,7 @@ handlers['category-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mu
52694
52932
  groupId,
52695
52933
  isIncome
52696
52934
  }) {
52697
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
52935
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52698
52936
  if (!groupId) {
52699
52937
  throw Object(_errors__WEBPACK_IMPORTED_MODULE_31__["APIError"])('Creating a category: groupId is required');
52700
52938
  }
@@ -52707,7 +52945,7 @@ handlers['category-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mu
52707
52945
  });
52708
52946
  });
52709
52947
  handlers['category-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function (category) {
52710
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
52948
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52711
52949
  try {
52712
52950
  await _db__WEBPACK_IMPORTED_MODULE_28__["updateCategory"](category);
52713
52951
  } catch (e) {
@@ -52730,7 +52968,7 @@ handlers['category-move'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["muta
52730
52968
  groupId,
52731
52969
  targetId
52732
52970
  }) {
52733
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
52971
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52734
52972
  await Object(_sync__WEBPACK_IMPORTED_MODULE_41__["batchMessages"])(async () => {
52735
52973
  await _db__WEBPACK_IMPORTED_MODULE_28__["moveCategory"](id, groupId, targetId);
52736
52974
  });
@@ -52741,7 +52979,7 @@ handlers['category-delete'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mu
52741
52979
  id,
52742
52980
  transferId
52743
52981
  }) {
52744
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
52982
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52745
52983
  let result = {};
52746
52984
  await Object(_sync__WEBPACK_IMPORTED_MODULE_41__["batchMessages"])(async () => {
52747
52985
  let row = await _db__WEBPACK_IMPORTED_MODULE_28__["first"]('SELECT is_income FROM categories WHERE id = ?', [id]);
@@ -52786,7 +53024,7 @@ handlers['category-group-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33
52786
53024
  name,
52787
53025
  isIncome
52788
53026
  }) {
52789
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53027
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52790
53028
  return _db__WEBPACK_IMPORTED_MODULE_28__["insertCategoryGroup"]({
52791
53029
  name,
52792
53030
  is_income: isIncome ? 1 : 0
@@ -52794,7 +53032,7 @@ handlers['category-group-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33
52794
53032
  });
52795
53033
  });
52796
53034
  handlers['category-group-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function (group) {
52797
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53035
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52798
53036
  return _db__WEBPACK_IMPORTED_MODULE_28__["updateCategoryGroup"](group);
52799
53037
  });
52800
53038
  });
@@ -52802,7 +53040,7 @@ handlers['category-group-move'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__
52802
53040
  id,
52803
53041
  targetId
52804
53042
  }) {
52805
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53043
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52806
53044
  await Object(_sync__WEBPACK_IMPORTED_MODULE_41__["batchMessages"])(async () => {
52807
53045
  await _db__WEBPACK_IMPORTED_MODULE_28__["moveCategoryGroup"](id, targetId);
52808
53046
  });
@@ -52813,7 +53051,7 @@ handlers['category-group-delete'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33
52813
53051
  id,
52814
53052
  transferId
52815
53053
  }) {
52816
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53054
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52817
53055
  const groupCategories = await _db__WEBPACK_IMPORTED_MODULE_28__["all"]('SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0', [id]);
52818
53056
  return Object(_sync__WEBPACK_IMPORTED_MODULE_41__["batchMessages"])(async () => {
52819
53057
  if (transferId) {
@@ -52851,7 +53089,7 @@ handlers['must-category-transfer'] = async function ({
52851
53089
  handlers['payee-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function ({
52852
53090
  name
52853
53091
  }) {
52854
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53092
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52855
53093
  return _db__WEBPACK_IMPORTED_MODULE_28__["insertPayee"]({
52856
53094
  name
52857
53095
  });
@@ -52864,7 +53102,6 @@ handlers['payees-get'] = async function () {
52864
53102
 
52865
53103
  handlers['payees-get-rule-counts'] = async function () {
52866
53104
  let payeeCounts = {};
52867
- let allRules = _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__["getRules"]();
52868
53105
  _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__["iterateIds"](_accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__["getRules"](), 'payee', (rule, id) => {
52869
53106
  if (payeeCounts[id] == null) {
52870
53107
  payeeCounts[id] = 0;
@@ -52879,7 +53116,7 @@ handlers['payees-merge'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutat
52879
53116
  targetId,
52880
53117
  mergeIds
52881
53118
  }) {
52882
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53119
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52883
53120
  return _db__WEBPACK_IMPORTED_MODULE_28__["mergePayees"](targetId, mergeIds);
52884
53121
  }, {
52885
53122
  targetId,
@@ -52891,7 +53128,7 @@ handlers['payees-batch-change'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__
52891
53128
  deleted,
52892
53129
  updated
52893
53130
  }) {
52894
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53131
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52895
53132
  return Object(_sync__WEBPACK_IMPORTED_MODULE_41__["batchMessages"])(async () => {
52896
53133
  if (deleted) {
52897
53134
  await Promise.all(deleted.map(p => _db__WEBPACK_IMPORTED_MODULE_28__["deletePayee"](p)));
@@ -52925,7 +53162,7 @@ handlers['payees-delete-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__[
52925
53162
  id,
52926
53163
  payee_id
52927
53164
  }) {
52928
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53165
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52929
53166
  return await _db__WEBPACK_IMPORTED_MODULE_28__["deletePayeeRule"]({
52930
53167
  id
52931
53168
  });
@@ -52934,14 +53171,14 @@ handlers['payees-delete-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__[
52934
53171
  });
52935
53172
  });
52936
53173
  handlers['payees-update-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function (rule) {
52937
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53174
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52938
53175
  return await _db__WEBPACK_IMPORTED_MODULE_28__["updatePayeeRule"](rule);
52939
53176
  }, {
52940
53177
  payeeId: rule.payee_id
52941
53178
  });
52942
53179
  });
52943
53180
  handlers['payees-add-rule'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function (rule) {
52944
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53181
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
52945
53182
  let id = await _db__WEBPACK_IMPORTED_MODULE_28__["insertPayeeRule"](rule);
52946
53183
  return _objectSpread(_objectSpread({}, rule), {}, {
52947
53184
  id
@@ -53175,7 +53412,7 @@ handlers['account-update'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mut
53175
53412
  id,
53176
53413
  name
53177
53414
  }) {
53178
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53415
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
53179
53416
  await _db__WEBPACK_IMPORTED_MODULE_28__["update"]('accounts', {
53180
53417
  id,
53181
53418
  name
@@ -53258,7 +53495,7 @@ handlers['account-create'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mut
53258
53495
  offBudget,
53259
53496
  closed
53260
53497
  }) {
53261
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53498
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
53262
53499
  const id = await _db__WEBPACK_IMPORTED_MODULE_28__["insertAccount"]({
53263
53500
  name,
53264
53501
  type,
@@ -53298,7 +53535,7 @@ handlers['account-close'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["muta
53298
53535
  await handlers['account-unlink']({
53299
53536
  id
53300
53537
  });
53301
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53538
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
53302
53539
  let account = await _db__WEBPACK_IMPORTED_MODULE_28__["first"]('SELECT * FROM accounts WHERE id = ? AND tombstone = 0', [id]); // Do nothing if the account doesn't exist or it's already been
53303
53540
  // closed
53304
53541
 
@@ -53380,7 +53617,7 @@ handlers['account-close'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["muta
53380
53617
  handlers['account-reopen'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutator"])(async function ({
53381
53618
  id
53382
53619
  }) {
53383
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53620
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
53384
53621
  await _db__WEBPACK_IMPORTED_MODULE_28__["update"]('accounts', {
53385
53622
  id,
53386
53623
  closed: 0
@@ -53391,7 +53628,7 @@ handlers['account-move'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["mutat
53391
53628
  id,
53392
53629
  targetId
53393
53630
  }) {
53394
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53631
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
53395
53632
  await _db__WEBPACK_IMPORTED_MODULE_28__["moveAccount"](id, targetId);
53396
53633
  });
53397
53634
  });
@@ -53480,9 +53717,6 @@ handlers['accounts-sync'] = async function ({
53480
53717
  let matchedTransactions = [];
53481
53718
  let updatedAccounts = [];
53482
53719
 
53483
- let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
53484
- groupId = _prefs$getPrefs.groupId;
53485
-
53486
53720
  for (var i = 0; i < accounts.length; i++) {
53487
53721
  const acct = accounts[i];
53488
53722
 
@@ -53543,7 +53777,7 @@ handlers['transactions-import'] = Object(_mutators__WEBPACK_IMPORTED_MODULE_33__
53543
53777
  accountId,
53544
53778
  transactions
53545
53779
  }) {
53546
- return Object(_undo__WEBPACK_IMPORTED_MODULE_45__["withUndo"])(async () => {
53780
+ return Object(_undo__WEBPACK_IMPORTED_MODULE_44__["withUndo"])(async () => {
53547
53781
  if (typeof accountId !== 'string') {
53548
53782
  throw Object(_errors__WEBPACK_IMPORTED_MODULE_31__["APIError"])('transactions-import: accountId must be an id');
53549
53783
  }
@@ -53641,11 +53875,6 @@ handlers['save-global-prefs'] = async function (prefs) {
53641
53875
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.setItem('max-months', '' + prefs.maxMonths);
53642
53876
  }
53643
53877
 
53644
- if ('trackUsage' in prefs) {
53645
- _tracking_events__WEBPACK_IMPORTED_MODULE_44__["toggle"](prefs.trackUsage);
53646
- await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.setItem('track-usage', '' + prefs.trackUsage);
53647
- }
53648
-
53649
53878
  if ('autoUpdate' in prefs) {
53650
53879
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.setItem('auto-update', '' + prefs.autoUpdate);
53651
53880
  process.send({
@@ -53668,8 +53897,8 @@ handlers['save-global-prefs'] = async function (prefs) {
53668
53897
  };
53669
53898
 
53670
53899
  handlers['load-global-prefs'] = async function () {
53671
- let _await$asyncStorage$m21 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.multiGet(['floating-sidebar', 'seen-tutorial', 'max-months', 'track-usage', 'auto-update', 'document-dir', 'encrypt-key']),
53672
- _await$asyncStorage$m22 = _slicedToArray(_await$asyncStorage$m21, 7),
53900
+ let _await$asyncStorage$m21 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.multiGet(['floating-sidebar', 'seen-tutorial', 'max-months', 'auto-update', 'document-dir', 'encrypt-key']),
53901
+ _await$asyncStorage$m22 = _slicedToArray(_await$asyncStorage$m21, 6),
53673
53902
  _await$asyncStorage$m23 = _slicedToArray(_await$asyncStorage$m22[0], 2),
53674
53903
  floatingSidebar = _await$asyncStorage$m23[1],
53675
53904
  _await$asyncStorage$m24 = _slicedToArray(_await$asyncStorage$m22[1], 2),
@@ -53677,20 +53906,16 @@ handlers['load-global-prefs'] = async function () {
53677
53906
  _await$asyncStorage$m25 = _slicedToArray(_await$asyncStorage$m22[2], 2),
53678
53907
  maxMonths = _await$asyncStorage$m25[1],
53679
53908
  _await$asyncStorage$m26 = _slicedToArray(_await$asyncStorage$m22[3], 2),
53680
- trackUsage = _await$asyncStorage$m26[1],
53909
+ autoUpdate = _await$asyncStorage$m26[1],
53681
53910
  _await$asyncStorage$m27 = _slicedToArray(_await$asyncStorage$m22[4], 2),
53682
- autoUpdate = _await$asyncStorage$m27[1],
53911
+ documentDir = _await$asyncStorage$m27[1],
53683
53912
  _await$asyncStorage$m28 = _slicedToArray(_await$asyncStorage$m22[5], 2),
53684
- documentDir = _await$asyncStorage$m28[1],
53685
- _await$asyncStorage$m29 = _slicedToArray(_await$asyncStorage$m22[6], 2),
53686
- encryptKey = _await$asyncStorage$m29[1];
53913
+ encryptKey = _await$asyncStorage$m28[1];
53687
53914
 
53688
53915
  return {
53689
53916
  floatingSidebar: floatingSidebar === 'true' ? true : false,
53690
53917
  seenTutorial: seenTutorial === 'true' ? true : false,
53691
53918
  maxMonths: Object(_shared_util__WEBPACK_IMPORTED_MODULE_12__["stringToInteger"])(maxMonths || ''),
53692
- // Default to true
53693
- trackUsage: trackUsage == null || trackUsage === 'true' ? true : false,
53694
53919
  autoUpdate: autoUpdate == null || autoUpdate === 'true' ? true : false,
53695
53920
  documentDir: documentDir || getDefaultDocumentDir(),
53696
53921
  keyId: encryptKey && JSON.parse(encryptKey).id
@@ -53698,8 +53923,8 @@ handlers['load-global-prefs'] = async function () {
53698
53923
  };
53699
53924
 
53700
53925
  handlers['save-prefs'] = async function (prefsToSet) {
53701
- let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
53702
- cloudFileId = _prefs$getPrefs2.cloudFileId; // Need to sync the budget name on the server as well
53926
+ let _prefs$getPrefs = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
53927
+ cloudFileId = _prefs$getPrefs.cloudFileId; // Need to sync the budget name on the server as well
53703
53928
 
53704
53929
 
53705
53930
  if (prefsToSet.budgetName && cloudFileId) {
@@ -53738,7 +53963,6 @@ handlers['key-make'] = async function ({
53738
53963
  throw new Error('user-set-key must be called with file loaded');
53739
53964
  }
53740
53965
 
53741
- let cloudFileId = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"]().cloudFileId;
53742
53966
  let salt = _encryption__WEBPACK_IMPORTED_MODULE_30__["default"].randomBytes(32).toString('base64');
53743
53967
  let id = uuid.v4Sync();
53744
53968
  let key = await _encryption__WEBPACK_IMPORTED_MODULE_30__["default"].createKey({
@@ -53965,10 +54189,9 @@ handlers['subscribe-change-password'] = async function ({
53965
54189
  password
53966
54190
  }) {
53967
54191
  let userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.getItem('user-token');
53968
- let res;
53969
54192
 
53970
54193
  try {
53971
- res = await Object(_post__WEBPACK_IMPORTED_MODULE_36__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_39__["getServer"])().SIGNUP_SERVER + '/change-password', {
54194
+ await Object(_post__WEBPACK_IMPORTED_MODULE_36__["post"])(Object(_server_config__WEBPACK_IMPORTED_MODULE_39__["getServer"])().SIGNUP_SERVER + '/change-password', {
53972
54195
  token: userToken,
53973
54196
  password
53974
54197
  });
@@ -54225,31 +54448,6 @@ handlers['load-budget'] = async function ({
54225
54448
  let res = await loadBudget(id, VERSION, {
54226
54449
  showUpdate: true
54227
54450
  });
54228
-
54229
- async function trackSizes() {
54230
- let getFileSize = async name => {
54231
- let dbFile = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.join(_platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id), name);
54232
-
54233
- try {
54234
- return await _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.size(dbFile);
54235
- } catch (err) {
54236
- return null;
54237
- }
54238
- };
54239
-
54240
- try {
54241
- let dbSize = await getFileSize('db.sqlite');
54242
- let cacheSize = await getFileSize('cache.sqlite');
54243
- _tracking_events__WEBPACK_IMPORTED_MODULE_44__["track"]('app:load-budget', {
54244
- size: dbSize,
54245
- cacheSize
54246
- });
54247
- } catch (err) {
54248
- console.warn(err);
54249
- }
54250
- }
54251
-
54252
- trackSizes();
54253
54451
  return res;
54254
54452
  };
54255
54453
 
@@ -54328,10 +54526,10 @@ handlers['create-budget'] = async function ({
54328
54526
  // Unfortunately we need to load all of the existing files first
54329
54527
  // so we can detect conflicting names.
54330
54528
  let files = await handlers['get-budgets']();
54331
- budgetName = await Object(_util_budget_name__WEBPACK_IMPORTED_MODULE_47__["uniqueFileName"])(files);
54529
+ budgetName = await Object(_util_budget_name__WEBPACK_IMPORTED_MODULE_46__["uniqueFileName"])(files);
54332
54530
  }
54333
54531
 
54334
- id = await Object(_util_budget_name__WEBPACK_IMPORTED_MODULE_47__["idFromFileName"])(budgetName);
54532
+ id = await Object(_util_budget_name__WEBPACK_IMPORTED_MODULE_46__["idFromFileName"])(budgetName);
54335
54533
  }
54336
54534
 
54337
54535
  let budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.getBudgetDir(id);
@@ -54510,22 +54708,21 @@ async function loadBudget(id, appVersion, {
54510
54708
 
54511
54709
 
54512
54710
  if (!_prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"]().userId) {
54513
- let _await$asyncStorage$m30 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.multiGet(['user-token']),
54514
- _await$asyncStorage$m31 = _slicedToArray(_await$asyncStorage$m30, 1),
54515
- _await$asyncStorage$m32 = _slicedToArray(_await$asyncStorage$m31[0], 2),
54516
- userId = _await$asyncStorage$m32[1];
54711
+ let _await$asyncStorage$m29 = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.multiGet(['user-token']),
54712
+ _await$asyncStorage$m30 = _slicedToArray(_await$asyncStorage$m29, 1),
54713
+ _await$asyncStorage$m31 = _slicedToArray(_await$asyncStorage$m30[0], 2),
54714
+ userId = _await$asyncStorage$m31[1];
54517
54715
 
54518
54716
  _prefs__WEBPACK_IMPORTED_MODULE_37__["savePrefs"]({
54519
54717
  userId
54520
54718
  });
54521
54719
  }
54522
54720
 
54523
- let _prefs$getPrefs3 = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
54524
- budgetVersion = _prefs$getPrefs3.budgetVersion,
54525
- budgetId = _prefs$getPrefs3.budgetId;
54721
+ let _prefs$getPrefs2 = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
54722
+ budgetVersion = _prefs$getPrefs2.budgetVersion;
54526
54723
 
54527
54724
  try {
54528
- await Object(_update__WEBPACK_IMPORTED_MODULE_46__["updateVersion"])(budgetVersion, showUpdate);
54725
+ await Object(_update__WEBPACK_IMPORTED_MODULE_45__["updateVersion"])(budgetVersion, showUpdate);
54529
54726
  } catch (e) {
54530
54727
  console.warn('Error updating', e);
54531
54728
  let result;
@@ -54589,7 +54786,7 @@ async function loadBudget(id, appVersion, {
54589
54786
  await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__["loadRules"]();
54590
54787
  await _sync_migrate__WEBPACK_IMPORTED_MODULE_42__["listen"]();
54591
54788
  await _main_app__WEBPACK_IMPORTED_MODULE_32__["default"].startServices();
54592
- Object(_undo__WEBPACK_IMPORTED_MODULE_45__["clearUndo"])(); // Ensure that syncing is enabled
54789
+ Object(_undo__WEBPACK_IMPORTED_MODULE_44__["clearUndo"])(); // Ensure that syncing is enabled
54593
54790
 
54594
54791
  if (!global.__TESTING__) {
54595
54792
  if (process.env.IS_BETA || id === DEMO_BUDGET_ID) {
@@ -54613,8 +54810,8 @@ async function loadBudget(id, appVersion, {
54613
54810
  }
54614
54811
 
54615
54812
  handlers['get-upgrade-notifications'] = async function () {
54616
- let _prefs$getPrefs4 = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
54617
- id = _prefs$getPrefs4.id;
54813
+ let _prefs$getPrefs3 = _prefs__WEBPACK_IMPORTED_MODULE_37__["getPrefs"](),
54814
+ id = _prefs$getPrefs3.id;
54618
54815
 
54619
54816
  if (id === TEST_BUDGET_ID || id === DEMO_BUDGET_ID) {
54620
54817
  return [];
@@ -54696,13 +54893,6 @@ handlers['app-focused'] = async function () {
54696
54893
  }
54697
54894
  };
54698
54895
 
54699
- handlers['track'] = async function ({
54700
- name,
54701
- props
54702
- }) {
54703
- _tracking_events__WEBPACK_IMPORTED_MODULE_44__["track"](name, props);
54704
- };
54705
-
54706
54896
  handlers = Object(_api__WEBPACK_IMPORTED_MODULE_21__["default"])(handlers);
54707
54897
 
54708
54898
  _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_1___default.a.send = (name, args) => Object(_mutators__WEBPACK_IMPORTED_MODULE_33__["runHandler"])(_main_app__WEBPACK_IMPORTED_MODULE_32__["default"].handlers[name], args); // A hack for now until we clean up everything
@@ -54755,7 +54945,6 @@ async function initApp(version, isDev, socketName) {
54755
54945
  VERSION = version;
54756
54946
  await _platform_server_sqlite__WEBPACK_IMPORTED_MODULE_7__["init"]();
54757
54947
  await Promise.all([_platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.init(), _platform_server_fs__WEBPACK_IMPORTED_MODULE_5___default.a.init()]);
54758
- await _tracking_events__WEBPACK_IMPORTED_MODULE_44__["init"]();
54759
54948
  await setupDocumentsDir();
54760
54949
  let keysStr = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.getItem('encrypt-keys');
54761
54950
 
@@ -54770,13 +54959,13 @@ async function initApp(version, isDev, socketName) {
54770
54959
  console.log('Error loading key', e);
54771
54960
  throw new Error('load-key-error');
54772
54961
  }
54773
- }
54962
+ } // if (isDev) {
54963
+ // const lastBudget = await asyncStorage.getItem('lastBudget');
54964
+ // if (lastBudget) {
54965
+ // loadBudget(lastBudget, VERSION);
54966
+ // }
54967
+ // }
54774
54968
 
54775
- if (isDev) {
54776
- const lastBudget = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.getItem('lastBudget'); // if (lastBudget) {
54777
- // loadBudget(lastBudget, VERSION);
54778
- // }
54779
- }
54780
54969
 
54781
54970
  const url = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.getItem('server-url');
54782
54971
 
@@ -54785,9 +54974,6 @@ async function initApp(version, isDev, socketName) {
54785
54974
  }
54786
54975
 
54787
54976
  connection.init(socketName, _main_app__WEBPACK_IMPORTED_MODULE_32__["default"].handlers);
54788
- _tracking_events__WEBPACK_IMPORTED_MODULE_44__["track"]('app:init', {
54789
- platform: _platform__WEBPACK_IMPORTED_MODULE_35__["default"].isMobile ? 'mobile' : _platform__WEBPACK_IMPORTED_MODULE_35__["default"].isWeb ? 'web' : 'desktop'
54790
- });
54791
54977
 
54792
54978
  if (!isDev && !_platform__WEBPACK_IMPORTED_MODULE_35__["default"].isMobile && !_platform__WEBPACK_IMPORTED_MODULE_35__["default"].isWeb) {
54793
54979
  let autoUpdate = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_4___default.a.getItem('auto-update');
@@ -55493,7 +55679,6 @@ function throwIfNot200(res, text) {
55493
55679
  async function post(url, data) {
55494
55680
  let text;
55495
55681
  let res;
55496
- let s = new Error().stack;
55497
55682
 
55498
55683
  try {
55499
55684
  res = await fetch(url, {
@@ -55912,14 +56097,14 @@ async function createSchedule({
55912
56097
  }]
55913
56098
  });
55914
56099
  let now = Date.now();
55915
- let nextDateId = await _db__WEBPACK_IMPORTED_MODULE_11__["insertWithUUID"]('schedules_next_date', {
56100
+ await _db__WEBPACK_IMPORTED_MODULE_11__["insertWithUUID"]('schedules_next_date', {
55916
56101
  schedule_id: scheduleId,
55917
56102
  local_next_date: nextDateRepr,
55918
56103
  local_next_date_ts: now,
55919
56104
  base_next_date: nextDateRepr,
55920
56105
  base_next_date_ts: now
55921
56106
  });
55922
- let id = await _db__WEBPACK_IMPORTED_MODULE_11__["insertWithSchema"]('schedules', _objectSpread(_objectSpread({}, schedule), {}, {
56107
+ await _db__WEBPACK_IMPORTED_MODULE_11__["insertWithSchema"]('schedules', _objectSpread(_objectSpread({}, schedule), {}, {
55923
56108
  id: scheduleId,
55924
56109
  rule: ruleId
55925
56110
  }));
@@ -55980,7 +56165,7 @@ async function updateSchedule({
55980
56165
  // might switch accounts from a closed one
55981
56166
 
55982
56167
 
55983
- if (resetNextDate || !deep_equal__WEBPACK_IMPORTED_MODULE_1___default()(oldConditions.find(c => c.field === 'account'), oldConditions.find(c => c.field === 'account')) || !deep_equal__WEBPACK_IMPORTED_MODULE_1___default()(stripType(oldConditions.find(c => c.field === 'date')), stripType(newConditions.find(c => c.field === 'date')))) {
56168
+ if (resetNextDate || !deep_equal__WEBPACK_IMPORTED_MODULE_1___default()(oldConditions.find(c => c.field === 'account'), oldConditions.find(c => c.field === 'account')) || !deep_equal__WEBPACK_IMPORTED_MODULE_1___default()(stripType(oldConditions.find(c => c.field === 'date') || {}), stripType(newConditions.find(c => c.field === 'date') || {}))) {
55984
56169
  await setNextDate({
55985
56170
  id: schedule.id,
55986
56171
  conditions: newConditions,
@@ -56078,10 +56263,8 @@ function trackJSONPaths() {
56078
56263
  }
56079
56264
 
56080
56265
  function onApplySync(oldValues, newValues) {
56081
- let found = false;
56082
56266
  newValues.forEach((items, table) => {
56083
56267
  if (table === 'rules') {
56084
- found = true;
56085
56268
  items.forEach(newValue => {
56086
56269
  onRuleUpdate(newValue);
56087
56270
  });
@@ -56315,7 +56498,6 @@ function matchSchedules(allOccurs, config, partialMatchRank = 0.5) {
56315
56498
  for (let trans of baseOccur.transactions) {
56316
56499
  let threshold = Object(_shared_rules__WEBPACK_IMPORTED_MODULE_3__["getApproxNumberThreshold"])(trans.amount);
56317
56500
  let payee = trans.payee;
56318
- let account = trans.account;
56319
56501
  let found = occurs.map(occur => {
56320
56502
  let matched = occur.transactions.find(t => t.amount >= trans.amount - threshold && t.amount <= trans.amount + threshold);
56321
56503
  matched = matched && matched.payee === payee ? matched : null;
@@ -56354,7 +56536,6 @@ function matchSchedules(allOccurs, config, partialMatchRank = 0.5) {
56354
56536
 
56355
56537
  async function schedulesForPattern(baseStart, numDays, baseConfig, accountId, partialMatchRank) {
56356
56538
  let schedules = [];
56357
- let i = 0;
56358
56539
 
56359
56540
  for (let i = 0; i < numDays; i++) {
56360
56541
  let start = date_fns__WEBPACK_IMPORTED_MODULE_0__["addDays"](baseStart, i);
@@ -57280,7 +57461,7 @@ class Spreadsheet {
57280
57461
  names: this.computeQueue
57281
57462
  }); // Cache the updated cells
57282
57463
 
57283
- if (this.saveCache) {
57464
+ if (typeof this.saveCache === 'function') {
57284
57465
  this.saveCache(this.computeQueue);
57285
57466
  }
57286
57467
 
@@ -57619,7 +57800,6 @@ function resolveNamesAsArrays(sheets) {
57619
57800
  Object.keys(sheets).forEach(sheetName => {
57620
57801
  const sheet = sheets[sheetName];
57621
57802
  sheet.forEach(name => {
57622
- const expr = sheet[name];
57623
57803
  cells.push(resolveName(sheetName, name));
57624
57804
  });
57625
57805
  });
@@ -58040,11 +58220,7 @@ function applyMessagesForImport(messages) {
58040
58220
  _db__WEBPACK_IMPORTED_MODULE_7__["transaction"](() => {
58041
58221
  for (let i = 0; i < messages.length; i++) {
58042
58222
  let msg = messages[i];
58043
- let dataset = msg.dataset,
58044
- row = msg.row,
58045
- column = msg.column,
58046
- timestamp = msg.timestamp,
58047
- value = msg.value;
58223
+ let dataset = msg.dataset;
58048
58224
 
58049
58225
  if (!msg.old) {
58050
58226
  try {
@@ -58480,7 +58656,6 @@ async function _fullSync(sinceTimestamp, count, prevDiffTime) {
58480
58656
  }
58481
58657
 
58482
58658
  let diffTime = _crdt__WEBPACK_IMPORTED_MODULE_6__["merkle"].diff(res.merkle, Object(_crdt__WEBPACK_IMPORTED_MODULE_6__["getClock"])().merkle);
58483
- let result = res.messages;
58484
58659
 
58485
58660
  if (diffTime !== null) {
58486
58661
  // This is a bit wonky, but we loop until we are in sync with the
@@ -58585,10 +58760,9 @@ __webpack_require__.r(__webpack_exports__);
58585
58760
 
58586
58761
 
58587
58762
 
58588
- function migrateParentIds(oldValues, newValues) {
58763
+ function migrateParentIds(_oldValues, newValues) {
58589
58764
  newValues.forEach((items, table) => {
58590
58765
  if (table === 'transactions') {
58591
- let old = oldValues.get(table);
58592
58766
  let toApply = [];
58593
58767
  items.forEach(newValue => {
58594
58768
  if (newValue.isChild === 1 && newValue.parent_id == null && newValue.id.includes('/')) {
@@ -60287,73 +60461,6 @@ app.method('tools/fix-split-transactions', async () => {
60287
60461
 
60288
60462
  /***/ }),
60289
60463
 
60290
- /***/ "./packages/loot-core/src/server/tracking/events.js":
60291
- /*!**********************************************************!*\
60292
- !*** ./packages/loot-core/src/server/tracking/events.js ***!
60293
- \**********************************************************/
60294
- /*! exports provided: toggle, init, login, track, setProfile */
60295
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
60296
-
60297
- "use strict";
60298
- __webpack_require__.r(__webpack_exports__);
60299
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toggle", function() { return toggle; });
60300
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
60301
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "login", function() { return login; });
60302
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "track", function() { return track; });
60303
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setProfile", function() { return setProfile; });
60304
- /* harmony import */ var _encryption_internals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encryption-internals */ "./packages/loot-core/src/server/encryption-internals.js");
60305
-
60306
- let currentUniqueId;
60307
- let mixpanel;
60308
- let isEnabled = true;
60309
- function toggle(trackUsage) {
60310
- isEnabled = trackUsage == null || trackUsage === 'true' ? true : false;
60311
- } // TODO: Figure out location, send to EU data centers if in EU
60312
- // {
60313
- // host: "api-eu.mixpanel.com",
60314
- // },
60315
- // This must stay up-to-date with all apps that hit mixpanel! That includes the
60316
- // website and server. If changing this, make sure to change it everywhere
60317
-
60318
- async function hash(userId) {
60319
- let hashed = await Object(_encryption_internals__WEBPACK_IMPORTED_MODULE_0__["sha256String"])(userId);
60320
- return `user-${hashed.replace(/[=/]/g, '')}`;
60321
- }
60322
-
60323
- function isAnonymous(id) {
60324
- return !id.startsWith('user-');
60325
- }
60326
-
60327
- async function init() {}
60328
- async function login(userId) {}
60329
- let BUFFERING = false;
60330
- let BUFFER = [];
60331
-
60332
- function startBuffering() {
60333
- BUFFERING = true;
60334
- BUFFER = [];
60335
- }
60336
-
60337
- function stopBuffering() {
60338
- for (let call of BUFFER) {
60339
- call[0](...call[1]);
60340
- }
60341
-
60342
- BUFFERING = false;
60343
- BUFFER = [];
60344
- }
60345
-
60346
- function buffered(func) {
60347
- return (...args) => {
60348
- if (false) {}
60349
- };
60350
- }
60351
-
60352
- const track = buffered((distinct_id, name, props) => {});
60353
- const setProfile = buffered((distinct_id, props) => {});
60354
-
60355
- /***/ }),
60356
-
60357
60464
  /***/ "./packages/loot-core/src/server/undo.js":
60358
60465
  /*!***********************************************!*\
60359
60466
  !*** ./packages/loot-core/src/server/undo.js ***!
@@ -61561,6 +61668,9 @@ function mapField(field, opts) {
61561
61668
  case 'amount-outflow':
61562
61669
  return 'amount (outflow)';
61563
61670
 
61671
+ case 'cleared':
61672
+ return 'cleared';
61673
+
61564
61674
  default:
61565
61675
  return field;
61566
61676
  }
@@ -61697,6 +61807,14 @@ function parse(item) {
61697
61807
  });
61698
61808
  }
61699
61809
 
61810
+ case 'boolean':
61811
+ {
61812
+ let parsed = item.value;
61813
+ return _objectSpread(_objectSpread({}, item), {}, {
61814
+ value: parsed
61815
+ });
61816
+ }
61817
+
61700
61818
  default:
61701
61819
  }
61702
61820
 
@@ -61731,6 +61849,14 @@ function unparse(_ref) {
61731
61849
  });
61732
61850
  }
61733
61851
 
61852
+ case 'boolean':
61853
+ {
61854
+ let unparsed = item.value == null ? false : item.value;
61855
+ return _objectSpread(_objectSpread({}, item), {}, {
61856
+ value: unparsed
61857
+ });
61858
+ }
61859
+
61734
61860
  default:
61735
61861
  }
61736
61862
 
@@ -61995,11 +62121,12 @@ function getScheduledAmount(amount) {
61995
62121
  /*!*******************************************************!*\
61996
62122
  !*** ./packages/loot-core/src/shared/transactions.js ***!
61997
62123
  \*******************************************************/
61998
- /*! exports provided: makeChild, recalculateSplit, findParentIndex, getSplit, ungroupTransactions, groupTransaction, ungroupTransaction, applyTransactionDiff, replaceTransactions, addSplitTransaction, updateTransaction, deleteTransaction, splitTransaction, realizeTempTransactions */
62124
+ /*! exports provided: isPreviewId, makeChild, recalculateSplit, findParentIndex, getSplit, ungroupTransactions, groupTransaction, ungroupTransaction, applyTransactionDiff, replaceTransactions, addSplitTransaction, updateTransaction, deleteTransaction, splitTransaction, realizeTempTransactions */
61999
62125
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
62000
62126
 
62001
62127
  "use strict";
62002
62128
  __webpack_require__.r(__webpack_exports__);
62129
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPreviewId", function() { return isPreviewId; });
62003
62130
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeChild", function() { return makeChild; });
62004
62131
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recalculateSplit", function() { return recalculateSplit; });
62005
62132
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findParentIndex", function() { return findParentIndex; });
@@ -62029,8 +62156,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
62029
62156
 
62030
62157
 
62031
62158
 
62032
- const uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js"); // The amount might be null when adding a new transaction
62159
+ const uuid = __webpack_require__(/*! ../platform/uuid */ "./packages/loot-core/src/platform/uuid/index.electron.js");
62033
62160
 
62161
+ function isPreviewId(id) {
62162
+ return id.indexOf('preview/') !== -1;
62163
+ } // The amount might be null when adding a new transaction
62034
62164
 
62035
62165
  function num(n) {
62036
62166
  return typeof n === 'number' ? n : 0;
@@ -62671,7 +62801,7 @@ const MAX_SAFE_NUMBER = 2 ** 51 - 1;
62671
62801
  const MIN_SAFE_NUMBER = -MAX_SAFE_NUMBER;
62672
62802
  function safeNumber(value) {
62673
62803
  if (!Number.isInteger(value)) {
62674
- throw new Error('safeNumber: number is not an integer: ' + value);
62804
+ throw new Error('safeNumber: number is not an integer: ' + JSON.stringify(value));
62675
62805
  }
62676
62806
 
62677
62807
  if (value > MAX_SAFE_NUMBER || value < MIN_SAFE_NUMBER) {