@actual-app/api 24.12.0 → 25.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/@types/loot-core/client/state-types/app.d.ts +6 -1
  2. package/@types/loot-core/client/state-types/modals.d.ts +50 -0
  3. package/@types/loot-core/server/accounts/transaction-rules.d.ts +4 -3
  4. package/@types/loot-core/server/admin/app.d.ts +12 -0
  5. package/@types/loot-core/server/admin/types/handlers.d.ts +41 -0
  6. package/@types/loot-core/server/budget/categoryTemplate.d.ts +3 -2
  7. package/@types/loot-core/server/budget/goalsSchedule.d.ts +7 -5
  8. package/@types/loot-core/server/cloud-storage.d.ts +9 -0
  9. package/@types/loot-core/server/db/index.d.ts +1 -0
  10. package/@types/loot-core/server/main-app.d.ts +1 -1
  11. package/@types/loot-core/server/post.d.ts +2 -0
  12. package/@types/loot-core/server/tools/types/handlers.d.ts +3 -0
  13. package/@types/loot-core/server/util/budget-name.d.ts +6 -2
  14. package/@types/loot-core/shared/errors.d.ts +3 -0
  15. package/@types/loot-core/shared/query.d.ts +13 -12
  16. package/@types/loot-core/shared/util.d.ts +7 -1
  17. package/@types/loot-core/types/budget.d.ts +1 -0
  18. package/@types/loot-core/types/file.d.ts +7 -0
  19. package/@types/loot-core/types/handlers.d.ts +2 -0
  20. package/@types/loot-core/types/models/dashboard.d.ts +12 -1
  21. package/@types/loot-core/types/models/index.d.ts +1 -0
  22. package/@types/loot-core/types/models/openid.d.ts +7 -0
  23. package/@types/loot-core/types/models/rule.d.ts +5 -1
  24. package/@types/loot-core/types/models/user.d.ts +26 -0
  25. package/@types/loot-core/types/models/userAccess.d.ts +9 -0
  26. package/@types/loot-core/types/prefs.d.ts +4 -1
  27. package/@types/loot-core/types/server-handlers.d.ts +89 -12
  28. package/dist/app/bundle.api.js +1476 -735
  29. package/dist/methods.js +4 -1
  30. package/dist/package.json +2 -2
  31. package/package.json +2 -2
@@ -34184,7 +34184,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
34184
34184
  'isNot',
34185
34185
  'doesNotContain',
34186
34186
  'notOneOf',
34187
- 'and'
34187
+ 'and',
34188
+ 'onBudget',
34189
+ 'offBudget'
34188
34190
  ],
34189
34191
  nullable: true,
34190
34192
  parse(op, value, fieldName) {
@@ -34429,6 +34431,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
34429
34431
  console.log('invalid regexp in matches condition', e);
34430
34432
  return false;
34431
34433
  }
34434
+ case 'onBudget':
34435
+ if (!object._account) {
34436
+ return false;
34437
+ }
34438
+ return object._account.offbudget === 0;
34439
+ case 'offBudget':
34440
+ if (!object._account) {
34441
+ return false;
34442
+ }
34443
+ return object._account.offbudget === 1;
34432
34444
  default:
34433
34445
  }
34434
34446
  return false;
@@ -34752,7 +34764,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
34752
34764
  contains: 0,
34753
34765
  doesNotContain: 0,
34754
34766
  matches: 0,
34755
- hasTags: 0
34767
+ hasTags: 0,
34768
+ onBudget: 0,
34769
+ offBudget: 0
34756
34770
  };
34757
34771
  function computeScore(rule) {
34758
34772
  const initialScore = rule.conditions.reduce((score, condition) => {
@@ -34956,11 +34970,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
34956
34970
  /* harmony import */ var _transaction_rules__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.ts");
34957
34971
  /* harmony import */ var _transactions__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./transactions */ "./packages/loot-core/src/server/accounts/transactions.ts");
34958
34972
  // @ts-strict-ignore
34959
- function BankSyncError(type, code) {
34973
+ function BankSyncError(type, code, details) {
34960
34974
  return {
34961
34975
  type: 'BankSyncError',
34962
34976
  category: type,
34963
- code
34977
+ code,
34978
+ details
34964
34979
  };
34965
34980
  }
34966
34981
  function makeSplitTransaction(trans, subtransactions) {
@@ -35046,7 +35061,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
35046
35061
  'X-ACTUAL-TOKEN': userToken
35047
35062
  });
35048
35063
  if (res.error_code) {
35049
- throw BankSyncError(res.error_type, res.error_code);
35064
+ const errorDetails = {
35065
+ rateLimitHeaders: res.rateLimitHeaders
35066
+ };
35067
+ throw BankSyncError(res.error_type, res.error_code, errorDetails);
35050
35068
  }
35051
35069
  if (includeBalance) {
35052
35070
  const { transactions: { all }, balances, startingBalance } = res;
@@ -35076,6 +35094,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
35076
35094
  }, {
35077
35095
  'X-ACTUAL-TOKEN': userToken
35078
35096
  }, 60000);
35097
+ if (Object.keys(res).length === 0) {
35098
+ throw BankSyncError('NO_DATA', 'NO_DATA');
35099
+ }
35079
35100
  if (res.error_code) {
35080
35101
  throw BankSyncError(res.error_type, res.error_code);
35081
35102
  }
@@ -35350,10 +35371,15 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
35350
35371
  const transactionNormalization = isBankSyncAccount ? normalizeBankSyncTransactions : normalizeTransactions;
35351
35372
  const { normalized, payeesToCreate } = await transactionNormalization(transactions, acctId);
35352
35373
  // The first pass runs the rules, and preps data for fuzzy matching
35374
+ const accounts = await _db__WEBPACK_IMPORTED_MODULE_6__.getAccounts();
35375
+ const accountsMap = new Map(accounts.map((account) => [
35376
+ account.id,
35377
+ account
35378
+ ]));
35353
35379
  const transactionsStep1 = [];
35354
35380
  for (const { payee_name, trans: originalTrans, subtransactions } of normalized) {
35355
35381
  // Run the rules
35356
- const trans = await (0, _transaction_rules__WEBPACK_IMPORTED_MODULE_13__.runRules)(originalTrans);
35382
+ const trans = await (0, _transaction_rules__WEBPACK_IMPORTED_MODULE_13__.runRules)(originalTrans, accountsMap);
35357
35383
  let match = null;
35358
35384
  let fuzzyDataset = null;
35359
35385
  // First, match with an existing transaction's imported_id. This
@@ -35471,9 +35497,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
35471
35497
  const { normalized, payeesToCreate } = await normalizeTransactions(transactions, acctId, {
35472
35498
  rawPayeeName: true
35473
35499
  });
35500
+ const accounts = await _db__WEBPACK_IMPORTED_MODULE_6__.getAccounts();
35501
+ const accountsMap = new Map(accounts.map((account) => [
35502
+ account.id,
35503
+ account
35504
+ ]));
35474
35505
  for (const { trans: originalTrans, subtransactions } of normalized) {
35475
35506
  // Run the rules
35476
- const trans = await (0, _transaction_rules__WEBPACK_IMPORTED_MODULE_13__.runRules)(originalTrans);
35507
+ const trans = await (0, _transaction_rules__WEBPACK_IMPORTED_MODULE_13__.runRules)(originalTrans, accountsMap);
35477
35508
  const finalTransaction = {
35478
35509
  id: (0, uuid__WEBPACK_IMPORTED_MODULE_16__["default"])(),
35479
35510
  ...trans,
@@ -36063,10 +36094,20 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36063
36094
  }
36064
36095
  }
36065
36096
  // Runner
36066
- async function runRules(trans) {
36097
+ async function runRules(trans, accounts = null) {
36098
+ let accountsMap = null;
36099
+ if (accounts === null) {
36100
+ accountsMap = new Map((await _db__WEBPACK_IMPORTED_MODULE_5__.getAccounts()).map((account) => [
36101
+ account.id,
36102
+ account
36103
+ ]));
36104
+ }
36105
+ else {
36106
+ accountsMap = accounts;
36107
+ }
36067
36108
  let finalTrans = await prepareTransactionForRules({
36068
36109
  ...trans
36069
- });
36110
+ }, accountsMap);
36070
36111
  const rules = (0, _rules__WEBPACK_IMPORTED_MODULE_10__.rankRules)((0, _shared_util__WEBPACK_IMPORTED_MODULE_3__.fastSetMerge)(firstcharIndexer.getApplicableRules(trans), payeeIndexer.getApplicableRules(trans)));
36071
36112
  for (let i = 0; i < rules.length; i++) {
36072
36113
  finalTrans = rules[i].apply(finalTrans);
@@ -36074,6 +36115,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36074
36115
  return await finalizeTransactionForRules(finalTrans);
36075
36116
  }
36076
36117
  function conditionSpecialCases(cond) {
36118
+ if (!cond) {
36119
+ return cond;
36120
+ }
36077
36121
  //special cases that require multiple conditions
36078
36122
  if (cond.op === 'is' && cond.field === 'category' && cond.value === null) {
36079
36123
  return new _rules__WEBPACK_IMPORTED_MODULE_10__.Condition('and', cond.field, [
@@ -36408,6 +36452,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36408
36452
  return {
36409
36453
  $and: getValue(value).map((subExpr) => mapConditionToActualQL(subExpr))
36410
36454
  };
36455
+ case 'onBudget':
36456
+ return {
36457
+ 'account.offbudget': false
36458
+ };
36459
+ case 'offBudget':
36460
+ return {
36461
+ 'account.offbudget': true
36462
+ };
36411
36463
  default:
36412
36464
  throw new Error('Unhandled operator: ' + op);
36413
36465
  }
@@ -36444,7 +36496,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36444
36496
  // An error happened while parsing
36445
36497
  return null;
36446
36498
  }
36447
- const transactionsForRules = await Promise.all(transactions.map(prepareTransactionForRules));
36499
+ const accounts = await _db__WEBPACK_IMPORTED_MODULE_5__.getAccounts();
36500
+ const transactionsForRules = await Promise.all(transactions.map((transactions) => prepareTransactionForRules(transactions, new Map(accounts.map((account) => [
36501
+ account.id,
36502
+ account
36503
+ ])))));
36448
36504
  const updated = transactionsForRules.flatMap((trans) => {
36449
36505
  return (0, _shared_transactions__WEBPACK_IMPORTED_MODULE_2__.ungroupTransaction)((0, _rules__WEBPACK_IMPORTED_MODULE_10__.execActions)(parsedActions, trans));
36450
36506
  });
@@ -36652,7 +36708,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36652
36708
  }
36653
36709
  });
36654
36710
  }
36655
- async function prepareTransactionForRules(trans) {
36711
+ async function prepareTransactionForRules(trans, accounts = null) {
36656
36712
  const r = {
36657
36713
  ...trans
36658
36714
  };
@@ -36662,6 +36718,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36662
36718
  r.payee_name = payee.name;
36663
36719
  }
36664
36720
  }
36721
+ if (trans.account) {
36722
+ if (accounts !== null && accounts.has(trans.account)) {
36723
+ r._account = accounts.get(trans.account);
36724
+ }
36725
+ else {
36726
+ r._account = await (0, _db__WEBPACK_IMPORTED_MODULE_5__.getAccount)(trans.account);
36727
+ }
36728
+ }
36665
36729
  return r;
36666
36730
  }
36667
36731
  async function finalizeTransactionForRules(trans) {
@@ -36869,7 +36933,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
36869
36933
  const { offbudget: toOffBudget } = await _db__WEBPACK_IMPORTED_MODULE_0__.first('SELECT offbudget FROM accounts WHERE id = ?', [
36870
36934
  transferAcct
36871
36935
  ]);
36872
- // If the transfer is between two on-budget or two off-budget accounts,
36936
+ // If the transfer is between two on budget or two off budget accounts,
36873
36937
  // we should clear the category, because the category is not relevant
36874
36938
  if (fromOffBudget === toOffBudget) {
36875
36939
  await _db__WEBPACK_IMPORTED_MODULE_0__.updateTransaction({
@@ -37152,6 +37216,191 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
37152
37216
  }
37153
37217
  /***/
37154
37218
  }),
37219
+ /***/ "./packages/loot-core/src/server/admin/app.ts":
37220
+ /*!****************************************************!*\
37221
+ !*** ./packages/loot-core/src/server/admin/app.ts ***!
37222
+ \****************************************************/
37223
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
37224
+ "use strict";
37225
+ __webpack_require__.r(__webpack_exports__);
37226
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
37227
+ /* harmony export */ app: () => ( /* binding */app)
37228
+ /* harmony export */
37229
+ });
37230
+ /* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts");
37231
+ /* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.ts");
37232
+ /* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../post */ "./packages/loot-core/src/server/post.ts");
37233
+ /* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../server-config */ "./packages/loot-core/src/server/server-config.ts");
37234
+ // @ts-strict-ignore
37235
+ // Expose functions to the client
37236
+ const app = (0, _app__WEBPACK_IMPORTED_MODULE_1__.createApp)();
37237
+ app.method('user-delete-all', async function (ids) {
37238
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37239
+ if (userToken) {
37240
+ try {
37241
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.del)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/users', {
37242
+ ids
37243
+ }, {
37244
+ 'X-ACTUAL-TOKEN': userToken
37245
+ });
37246
+ if (res) {
37247
+ return res;
37248
+ }
37249
+ }
37250
+ catch (err) {
37251
+ return {
37252
+ error: err.reason
37253
+ };
37254
+ }
37255
+ }
37256
+ return {
37257
+ someDeletionsFailed: true
37258
+ };
37259
+ });
37260
+ app.method('users-get', async function () {
37261
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37262
+ if (userToken) {
37263
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/users/', {
37264
+ headers: {
37265
+ 'X-ACTUAL-TOKEN': userToken
37266
+ }
37267
+ });
37268
+ if (res) {
37269
+ try {
37270
+ const list = JSON.parse(res);
37271
+ return list;
37272
+ }
37273
+ catch (err) {
37274
+ return {
37275
+ error: 'Failed to parse response: ' + err.message
37276
+ };
37277
+ }
37278
+ }
37279
+ }
37280
+ return null;
37281
+ });
37282
+ app.method('user-add', async function (user) {
37283
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37284
+ if (userToken) {
37285
+ try {
37286
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/users/', user, {
37287
+ 'X-ACTUAL-TOKEN': userToken
37288
+ });
37289
+ return res;
37290
+ }
37291
+ catch (err) {
37292
+ return {
37293
+ error: err.reason
37294
+ };
37295
+ }
37296
+ }
37297
+ return null;
37298
+ });
37299
+ app.method('user-update', async function (user) {
37300
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37301
+ if (userToken) {
37302
+ try {
37303
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.patch)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/users/', user, {
37304
+ 'X-ACTUAL-TOKEN': userToken
37305
+ });
37306
+ return res;
37307
+ }
37308
+ catch (err) {
37309
+ return {
37310
+ error: err.reason
37311
+ };
37312
+ }
37313
+ }
37314
+ return null;
37315
+ });
37316
+ app.method('access-add', async function (access) {
37317
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37318
+ if (userToken) {
37319
+ try {
37320
+ await (0, _post__WEBPACK_IMPORTED_MODULE_2__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/access/', access, {
37321
+ 'X-ACTUAL-TOKEN': userToken
37322
+ });
37323
+ return {};
37324
+ }
37325
+ catch (err) {
37326
+ return {
37327
+ error: err.reason
37328
+ };
37329
+ }
37330
+ }
37331
+ return null;
37332
+ });
37333
+ app.method('access-delete-all', async function ({ fileId, ids }) {
37334
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37335
+ if (userToken) {
37336
+ try {
37337
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.del)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + `/admin/access?fileId=${fileId}`, {
37338
+ token: userToken,
37339
+ ids
37340
+ });
37341
+ if (res) {
37342
+ return res;
37343
+ }
37344
+ }
37345
+ catch (err) {
37346
+ return {
37347
+ error: err.reason
37348
+ };
37349
+ }
37350
+ }
37351
+ return {
37352
+ someDeletionsFailed: true
37353
+ };
37354
+ });
37355
+ app.method('access-get-available-users', async function (fileId) {
37356
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37357
+ if (userToken) {
37358
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.get)(`${(0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/access/users'}?fileId=${fileId}`, {
37359
+ headers: {
37360
+ 'X-ACTUAL-TOKEN': userToken
37361
+ }
37362
+ });
37363
+ if (res) {
37364
+ try {
37365
+ return JSON.parse(res);
37366
+ }
37367
+ catch (err) {
37368
+ return {
37369
+ error: 'Failed to parse response: ' + err.message
37370
+ };
37371
+ }
37372
+ }
37373
+ }
37374
+ return [];
37375
+ });
37376
+ app.method('transfer-ownership', async function ({ fileId, newUserId }) {
37377
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_0__.getItem('user-token');
37378
+ if (userToken) {
37379
+ try {
37380
+ await (0, _post__WEBPACK_IMPORTED_MODULE_2__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/access/transfer-ownership/', {
37381
+ fileId,
37382
+ newUserId
37383
+ }, {
37384
+ 'X-ACTUAL-TOKEN': userToken
37385
+ });
37386
+ }
37387
+ catch (err) {
37388
+ return {
37389
+ error: err.reason
37390
+ };
37391
+ }
37392
+ }
37393
+ return {};
37394
+ });
37395
+ app.method('owner-created', async function () {
37396
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_2__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_3__.getServer)().BASE_SERVER + '/admin/owner-created/');
37397
+ if (res) {
37398
+ return JSON.parse(res);
37399
+ }
37400
+ return null;
37401
+ });
37402
+ /***/
37403
+ }),
37155
37404
  /***/ "./packages/loot-core/src/server/api-models.ts":
37156
37405
  /*!*****************************************************!*\
37157
37406
  !*** ./packages/loot-core/src/server/api-models.ts ***!
@@ -37257,7 +37506,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
37257
37506
  groupId: file.groupId,
37258
37507
  name: file.name,
37259
37508
  encryptKeyId: file.encryptKeyId,
37260
- hasKey: file.hasKey
37509
+ hasKey: file.hasKey,
37510
+ owner: file.owner,
37511
+ usersWithAccess: file.usersWithAccess
37261
37512
  };
37262
37513
  },
37263
37514
  fromExternal(file) {
@@ -41239,11 +41490,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41239
41490
  */ //-----------------------------------------------------------------------------
41240
41491
  // Class interface
41241
41492
  // set up the class and check all templates
41242
- static async init(templates, categoryID, month) {
41493
+ static async init(templates, category, month) {
41243
41494
  // get all the needed setup values
41244
41495
  const lastMonthSheet = _shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(_shared_months__WEBPACK_IMPORTED_MODULE_0__.subMonths(month, 1));
41245
- const lastMonthBalance = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(lastMonthSheet, `leftover-${categoryID}`);
41246
- const carryover = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetBoolean)(lastMonthSheet, `carryover-${categoryID}`);
41496
+ const lastMonthBalance = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(lastMonthSheet, `leftover-${category.id}`);
41497
+ const carryover = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetBoolean)(lastMonthSheet, `carryover-${category.id}`);
41247
41498
  let fromLastMonth;
41248
41499
  if (lastMonthBalance < 0 && !carryover) {
41249
41500
  fromLastMonth = 0;
@@ -41255,7 +41506,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41255
41506
  await CategoryTemplate.checkByAndScheduleAndSpend(templates, month);
41256
41507
  await CategoryTemplate.checkPercentage(templates);
41257
41508
  // call the private constructor
41258
- return new CategoryTemplate(templates, categoryID, month, fromLastMonth);
41509
+ return new CategoryTemplate(templates, category, month, fromLastMonth);
41259
41510
  }
41260
41511
  getPriorities() {
41261
41512
  return this.priorities;
@@ -41328,8 +41579,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41328
41579
  }
41329
41580
  case 'schedule':
41330
41581
  {
41331
- const budgeted = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(_shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(this.month), `leftover-${this.categoryID}`);
41332
- const ret = await (0, _goalsSchedule__WEBPACK_IMPORTED_MODULE_4__.goalsSchedule)(scheduleFlag, t, this.month, budgeted, remainder, this.fromLastMonth, toBudget, [], this.categoryID);
41582
+ const budgeted = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(_shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(this.month), `leftover-${this.category.id}`);
41583
+ const ret = await (0, _goalsSchedule__WEBPACK_IMPORTED_MODULE_4__.goalsSchedule)(scheduleFlag, t, this.month, budgeted, remainder, this.fromLastMonth, toBudget, [], this.category);
41333
41584
  toBudget = ret.to_budget;
41334
41585
  remainder = ret.remainder;
41335
41586
  scheduleFlag = ret.scheduleFlag;
@@ -41389,7 +41640,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41389
41640
  longGoal: this.isLongGoal
41390
41641
  };
41391
41642
  }
41392
- constructor(templates, categoryID, month, fromLastMonth) {
41643
+ constructor(templates, category, month, fromLastMonth) {
41393
41644
  this.templates = [];
41394
41645
  this.remainder = [];
41395
41646
  this.goals = [];
@@ -41405,7 +41656,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41405
41656
  this.limitAmount = 0;
41406
41657
  this.limitCheck = false;
41407
41658
  this.limitHold = false;
41408
- this.categoryID = categoryID;
41659
+ this.category = category;
41409
41660
  this.month = month;
41410
41661
  this.fromLastMonth = fromLastMonth;
41411
41662
  // sort the template lines into regular template, goals, and remainder templates
@@ -41568,7 +41819,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41568
41819
  }
41569
41820
  async runCopy(template) {
41570
41821
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(_shared_months__WEBPACK_IMPORTED_MODULE_0__.subMonths(this.month, template.lookBack));
41571
- return await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `budget-${this.categoryID}`);
41822
+ return await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `budget-${this.category.id}`);
41572
41823
  }
41573
41824
  runWeek(template) {
41574
41825
  let toBudget = 0;
@@ -41585,21 +41836,31 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41585
41836
  return toBudget;
41586
41837
  }
41587
41838
  async runSpend(template) {
41588
- const fromMonth = `${template.from}`;
41589
- const toMonth = `${template.month}`;
41839
+ let fromMonth = `${template.from}`;
41840
+ let toMonth = `${template.month}`;
41590
41841
  let alreadyBudgeted = this.fromLastMonth;
41591
41842
  let firstMonth = true;
41843
+ //update months if needed
41844
+ const repeat = template.annual ? (template.repeat || 1) * 12 : template.repeat;
41845
+ let m = _shared_months__WEBPACK_IMPORTED_MODULE_0__.differenceInCalendarMonths(toMonth, this.month);
41846
+ if (repeat && m < 0) {
41847
+ while (m < 0) {
41848
+ toMonth = _shared_months__WEBPACK_IMPORTED_MODULE_0__.addMonths(toMonth, repeat);
41849
+ fromMonth = _shared_months__WEBPACK_IMPORTED_MODULE_0__.addMonths(fromMonth, repeat);
41850
+ m = _shared_months__WEBPACK_IMPORTED_MODULE_0__.differenceInCalendarMonths(toMonth, this.month);
41851
+ }
41852
+ }
41592
41853
  for (let m = fromMonth; _shared_months__WEBPACK_IMPORTED_MODULE_0__.differenceInCalendarMonths(this.month, m) > 0; m = _shared_months__WEBPACK_IMPORTED_MODULE_0__.addMonths(m, 1)) {
41593
41854
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(m);
41594
41855
  if (firstMonth) {
41595
41856
  //TODO figure out if I already found these values and can pass them in
41596
- const spent = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `sum-amount-${this.categoryID}`);
41597
- const balance = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `leftover-${this.categoryID}`);
41857
+ const spent = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `sum-amount-${this.category.id}`);
41858
+ const balance = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `leftover-${this.category.id}`);
41598
41859
  alreadyBudgeted = balance - spent;
41599
41860
  firstMonth = false;
41600
41861
  }
41601
41862
  else {
41602
- alreadyBudgeted += await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `budget-${this.categoryID}`);
41863
+ alreadyBudgeted += await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `budget-${this.category.id}`);
41603
41864
  }
41604
41865
  }
41605
41866
  const numMonths = _shared_months__WEBPACK_IMPORTED_MODULE_0__.differenceInCalendarMonths(toMonth, this.month);
@@ -41640,7 +41901,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
41640
41901
  let sum = 0;
41641
41902
  for (let i = 1; i <= template.numMonths; i++) {
41642
41903
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(_shared_months__WEBPACK_IMPORTED_MODULE_0__.subMonths(this.month, i));
41643
- sum += await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `sum-amount-${this.categoryID}`);
41904
+ sum += await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `sum-amount-${this.category.id}`);
41644
41905
  }
41645
41906
  return -Math.round(sum / template.numMonths);
41646
41907
  }
@@ -42305,9 +42566,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42305
42566
  async function goalsSchedule(scheduleFlag, template_lines, current_month, balance, remainder, last_month_balance, to_budget, errors, category) {
42306
42567
  if (!scheduleFlag) {
42307
42568
  scheduleFlag = true;
42308
- const template = template_lines.filter((t) => t.type === 'schedule');
42569
+ const scheduleTemplates = template_lines.filter((t) => t.type === 'schedule');
42309
42570
  //in the case of multiple templates per category, schedules may have wrong priority level
42310
- const t = await createScheduleList(template, current_month, category);
42571
+ const t = await createScheduleList(scheduleTemplates, current_month, category);
42311
42572
  errors = errors.concat(t.errors);
42312
42573
  const isPayMonthOf = (c) => c.full || c.target_frequency === 'monthly' && c.target_interval === 1 && c.num_months === 0 || c.target_frequency === 'weekly' && c.target_interval >= 0 && c.num_months === 0 || c.target_frequency === 'daily' || (0, _actions__WEBPACK_IMPORTED_MODULE_4__.isReflectBudget)();
42313
42574
  const t_payMonthOf = t.t.filter(isPayMonthOf);
@@ -42464,7 +42725,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42464
42725
  const isReflect = (0, _actions__WEBPACK_IMPORTED_MODULE_3__.isReflectBudget)();
42465
42726
  const categoriesLong = await getCategories();
42466
42727
  categoriesLong.forEach((c) => {
42467
- if (!isReflect && !c.is_income) {
42728
+ if (isReflect || !c.is_income) {
42468
42729
  categories.push(c);
42469
42730
  }
42470
42731
  });
@@ -42481,7 +42742,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42481
42742
  const budgetList = [];
42482
42743
  const goalList = [];
42483
42744
  for (let i = 0; i < categories.length; i++) {
42484
- const id = categories[i].id;
42745
+ const category = categories[i];
42746
+ const { id } = category;
42485
42747
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_0__.sheetForMonth(month);
42486
42748
  const templates = categoryTemplates[id];
42487
42749
  const budgeted = await (0, _actions__WEBPACK_IMPORTED_MODULE_3__.getSheetValue)(sheetName, `budget-${id}`);
@@ -42492,7 +42754,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42492
42754
  // gather needed priorities
42493
42755
  // gather remainder weights
42494
42756
  try {
42495
- const obj = await _categoryTemplate__WEBPACK_IMPORTED_MODULE_4__.CategoryTemplate.init(templates, id, month);
42757
+ const obj = await _categoryTemplate__WEBPACK_IMPORTED_MODULE_4__.CategoryTemplate.init(templates, category, month);
42496
42758
  availBudget += budgeted;
42497
42759
  availBudget += obj.getLimitExcess();
42498
42760
  const p = obj.getPriorities();
@@ -42553,11 +42815,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42553
42815
  catObjects.forEach((o) => {
42554
42816
  const ret = o.getValues();
42555
42817
  budgetList.push({
42556
- category: o.categoryID,
42818
+ category: o.category.id,
42557
42819
  budgeted: ret.budgeted
42558
42820
  });
42559
42821
  goalList.push({
42560
- category: o.categoryID,
42822
+ category: o.category.id,
42561
42823
  goal: ret.goal,
42562
42824
  longGoal: ret.longGoal ? 1 : null
42563
42825
  });
@@ -42873,6 +43135,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42873
43135
  /* harmony export */ checkKey: () => ( /* binding */checkKey),
42874
43136
  /* harmony export */ download: () => ( /* binding */download),
42875
43137
  /* harmony export */ exportBuffer: () => ( /* binding */exportBuffer),
43138
+ /* harmony export */ getRemoteFile: () => ( /* binding */getRemoteFile),
42876
43139
  /* harmony export */ importBuffer: () => ( /* binding */importBuffer),
42877
43140
  /* harmony export */ listRemoteFiles: () => ( /* binding */listRemoteFiles),
42878
43141
  /* harmony export */ possiblyUpload: () => ( /* binding */possiblyUpload),
@@ -42899,6 +43162,20 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
42899
43162
  const UPLOAD_FREQUENCY_IN_DAYS = 7;
42900
43163
  async function checkHTTPStatus(res) {
42901
43164
  if (res.status !== 200) {
43165
+ if (res.status === 403) {
43166
+ try {
43167
+ const text = await res.text();
43168
+ const data = JSON.parse(text)?.data;
43169
+ if (data?.reason === 'token-expired') {
43170
+ await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1__.removeItem('user-token');
43171
+ throw new _errors__WEBPACK_IMPORTED_MODULE_7__.HTTPError(403, 'token-expired');
43172
+ }
43173
+ }
43174
+ catch (e) {
43175
+ if (e instanceof _errors__WEBPACK_IMPORTED_MODULE_7__.HTTPError)
43176
+ throw e;
43177
+ }
43178
+ }
42902
43179
  return res.text().then((str) => {
42903
43180
  throw new _errors__WEBPACK_IMPORTED_MODULE_7__.HTTPError(res.status, str);
42904
43181
  });
@@ -43197,6 +43474,33 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
43197
43474
  hasKey: _encryption__WEBPACK_IMPORTED_MODULE_6__.hasKey(file.encryptKeyId)
43198
43475
  }));
43199
43476
  }
43477
+ async function getRemoteFile(fileId) {
43478
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1__.getItem('user-token');
43479
+ if (!userToken) {
43480
+ return null;
43481
+ }
43482
+ let res;
43483
+ try {
43484
+ res = await fetchJSON((0, _server_config__WEBPACK_IMPORTED_MODULE_11__.getServer)().SYNC_SERVER + '/get-user-file-info', {
43485
+ headers: {
43486
+ 'X-ACTUAL-TOKEN': userToken,
43487
+ 'X-ACTUAL-FILE-ID': fileId
43488
+ }
43489
+ });
43490
+ }
43491
+ catch (e) {
43492
+ console.log('Unexpected error fetching file from server', e);
43493
+ return null;
43494
+ }
43495
+ if (res.status === 'error') {
43496
+ console.log('Error fetching file from server', res);
43497
+ return null;
43498
+ }
43499
+ return {
43500
+ ...res.data,
43501
+ hasKey: _encryption__WEBPACK_IMPORTED_MODULE_6__.hasKey(res.data.encryptKeyId)
43502
+ };
43503
+ }
43200
43504
  async function download(fileId) {
43201
43505
  const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_1__.getItem('user-token');
43202
43506
  const syncServer = (0, _server_config__WEBPACK_IMPORTED_MODULE_11__.getServer)().SYNC_SERVER;
@@ -43321,7 +43625,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
43321
43625
  'spending-card',
43322
43626
  'custom-report',
43323
43627
  'markdown-card',
43324
- 'summary-card'
43628
+ 'summary-card',
43629
+ 'calendar-card'
43325
43630
  ].includes(widget.type)) {
43326
43631
  throw new _errors__WEBPACK_IMPORTED_MODULE_8__.ValidationError(`Invalid widget.${idx}.type value ${widget.type}.`);
43327
43632
  }
@@ -43474,6 +43779,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
43474
43779
  /* harmony export */ first: () => ( /* binding */first),
43475
43780
  /* harmony export */ firstSync: () => ( /* binding */firstSync),
43476
43781
  /* harmony export */ fromDateRepr: () => ( /* reexport safe */_models__WEBPACK_IMPORTED_MODULE_7__.fromDateRepr),
43782
+ /* harmony export */ getAccount: () => ( /* binding */getAccount),
43477
43783
  /* harmony export */ getAccounts: () => ( /* binding */getAccounts),
43478
43784
  /* harmony export */ getCategories: () => ( /* binding */getCategories),
43479
43785
  /* harmony export */ getCategoriesGrouped: () => ( /* binding */getCategoriesGrouped),
@@ -43889,6 +44195,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
43889
44195
  id
43890
44196
  ]);
43891
44197
  }
44198
+ async function getAccount(id) {
44199
+ return first(`SELECT * FROM accounts WHERE id = ?`, [
44200
+ id
44201
+ ]);
44202
+ }
43892
44203
  async function insertPayee(payee) {
43893
44204
  payee = _models__WEBPACK_IMPORTED_MODULE_7__.payeeModel.validate(payee);
43894
44205
  let id;
@@ -45575,7 +45886,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45575
45886
  /* harmony import */ var _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @actual-app/api/injected */ "./packages/api/injected.js");
45576
45887
  /* harmony import */ var _actual_app_crdt__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @actual-app/crdt */ "@actual-app/crdt");
45577
45888
  /* harmony import */ var _actual_app_crdt__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__.n(_actual_app_crdt__WEBPACK_IMPORTED_MODULE_2__);
45578
- /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-node/v4.js");
45889
+ /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-node/v4.js");
45579
45890
  /* harmony import */ var _mocks_budget__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mocks/budget */ "./packages/loot-core/src/mocks/budget.ts");
45580
45891
  /* harmony import */ var _platform_exceptions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../platform/exceptions */ "./packages/loot-core/src/platform/exceptions/index.electron.ts");
45581
45892
  /* harmony import */ var _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../platform/server/asyncStorage */ "./packages/loot-core/src/platform/server/asyncStorage/index.electron.ts");
@@ -45594,45 +45905,46 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45594
45905
  /* harmony import */ var _accounts_sync__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./accounts/sync */ "./packages/loot-core/src/server/accounts/sync.ts");
45595
45906
  /* harmony import */ var _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./accounts/transaction-rules */ "./packages/loot-core/src/server/accounts/transaction-rules.ts");
45596
45907
  /* harmony import */ var _accounts_transactions__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./accounts/transactions */ "./packages/loot-core/src/server/accounts/transactions.ts");
45597
- /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./api */ "./packages/loot-core/src/server/api.ts");
45598
- /* harmony import */ var _aql__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./aql */ "./packages/loot-core/src/server/aql/index.ts");
45599
- /* harmony import */ var _backups__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./backups */ "./packages/loot-core/src/server/backups.ts");
45600
- /* harmony import */ var _budget_app__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./budget/app */ "./packages/loot-core/src/server/budget/app.ts");
45601
- /* harmony import */ var _budget_base__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./budget/base */ "./packages/loot-core/src/server/budget/base.ts");
45602
- /* harmony import */ var _cloud_storage__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./cloud-storage */ "./packages/loot-core/src/server/cloud-storage.ts");
45603
- /* harmony import */ var _dashboard_app__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./dashboard/app */ "./packages/loot-core/src/server/dashboard/app.ts");
45604
- /* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./db */ "./packages/loot-core/src/server/db/index.ts");
45605
- /* harmony import */ var _db_mappings__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./db/mappings */ "./packages/loot-core/src/server/db/mappings.ts");
45606
- /* harmony import */ var _encryption__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./encryption */ "./packages/loot-core/src/server/encryption.ts");
45607
- /* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./errors */ "./packages/loot-core/src/server/errors.ts");
45608
- /* harmony import */ var _filters_app__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./filters/app */ "./packages/loot-core/src/server/filters/app.ts");
45609
- /* harmony import */ var _importers__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./importers */ "./packages/loot-core/src/server/importers/index.ts");
45610
- /* harmony import */ var _main_app__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./main-app */ "./packages/loot-core/src/server/main-app.ts");
45611
- /* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./mutators */ "./packages/loot-core/src/server/mutators.ts");
45612
- /* harmony import */ var _notes_app__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./notes/app */ "./packages/loot-core/src/server/notes/app.ts");
45613
- /* harmony import */ var _platform__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./platform */ "./packages/loot-core/src/server/platform.ts");
45614
- /* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./post */ "./packages/loot-core/src/server/post.ts");
45615
- /* harmony import */ var _preferences_app__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./preferences/app */ "./packages/loot-core/src/server/preferences/app.ts");
45616
- /* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.ts");
45617
- /* harmony import */ var _reports_app__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./reports/app */ "./packages/loot-core/src/server/reports/app.ts");
45618
- /* harmony import */ var _rules_app__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./rules/app */ "./packages/loot-core/src/server/rules/app.ts");
45619
- /* harmony import */ var _schedules_app__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./schedules/app */ "./packages/loot-core/src/server/schedules/app.ts");
45620
- /* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./server-config */ "./packages/loot-core/src/server/server-config.ts");
45621
- /* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./sheet */ "./packages/loot-core/src/server/sheet.ts");
45622
- /* harmony import */ var _spreadsheet_util__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.ts");
45623
- /* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.ts");
45624
- /* harmony import */ var _sync_migrate__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./sync/migrate */ "./packages/loot-core/src/server/sync/migrate.ts");
45625
- /* harmony import */ var _tools_app__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./tools/app */ "./packages/loot-core/src/server/tools/app.ts");
45626
- /* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./undo */ "./packages/loot-core/src/server/undo.ts");
45627
- /* harmony import */ var _update__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./update */ "./packages/loot-core/src/server/update.ts");
45628
- /* harmony import */ var _util_budget_name__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./util/budget-name */ "./packages/loot-core/src/server/util/budget-name.ts");
45908
+ /* harmony import */ var _admin_app__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./admin/app */ "./packages/loot-core/src/server/admin/app.ts");
45909
+ /* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./api */ "./packages/loot-core/src/server/api.ts");
45910
+ /* harmony import */ var _aql__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./aql */ "./packages/loot-core/src/server/aql/index.ts");
45911
+ /* harmony import */ var _backups__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./backups */ "./packages/loot-core/src/server/backups.ts");
45912
+ /* harmony import */ var _budget_app__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./budget/app */ "./packages/loot-core/src/server/budget/app.ts");
45913
+ /* harmony import */ var _budget_base__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./budget/base */ "./packages/loot-core/src/server/budget/base.ts");
45914
+ /* harmony import */ var _cloud_storage__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./cloud-storage */ "./packages/loot-core/src/server/cloud-storage.ts");
45915
+ /* harmony import */ var _dashboard_app__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./dashboard/app */ "./packages/loot-core/src/server/dashboard/app.ts");
45916
+ /* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./db */ "./packages/loot-core/src/server/db/index.ts");
45917
+ /* harmony import */ var _db_mappings__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./db/mappings */ "./packages/loot-core/src/server/db/mappings.ts");
45918
+ /* harmony import */ var _encryption__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./encryption */ "./packages/loot-core/src/server/encryption.ts");
45919
+ /* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./errors */ "./packages/loot-core/src/server/errors.ts");
45920
+ /* harmony import */ var _filters_app__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./filters/app */ "./packages/loot-core/src/server/filters/app.ts");
45921
+ /* harmony import */ var _importers__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./importers */ "./packages/loot-core/src/server/importers/index.ts");
45922
+ /* harmony import */ var _main_app__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./main-app */ "./packages/loot-core/src/server/main-app.ts");
45923
+ /* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./mutators */ "./packages/loot-core/src/server/mutators.ts");
45924
+ /* harmony import */ var _notes_app__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./notes/app */ "./packages/loot-core/src/server/notes/app.ts");
45925
+ /* harmony import */ var _platform__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./platform */ "./packages/loot-core/src/server/platform.ts");
45926
+ /* harmony import */ var _post__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./post */ "./packages/loot-core/src/server/post.ts");
45927
+ /* harmony import */ var _preferences_app__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./preferences/app */ "./packages/loot-core/src/server/preferences/app.ts");
45928
+ /* harmony import */ var _prefs__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./prefs */ "./packages/loot-core/src/server/prefs.ts");
45929
+ /* harmony import */ var _reports_app__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./reports/app */ "./packages/loot-core/src/server/reports/app.ts");
45930
+ /* harmony import */ var _rules_app__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./rules/app */ "./packages/loot-core/src/server/rules/app.ts");
45931
+ /* harmony import */ var _schedules_app__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./schedules/app */ "./packages/loot-core/src/server/schedules/app.ts");
45932
+ /* harmony import */ var _server_config__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./server-config */ "./packages/loot-core/src/server/server-config.ts");
45933
+ /* harmony import */ var _sheet__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./sheet */ "./packages/loot-core/src/server/sheet.ts");
45934
+ /* harmony import */ var _spreadsheet_util__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./spreadsheet/util */ "./packages/loot-core/src/server/spreadsheet/util.ts");
45935
+ /* harmony import */ var _sync__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./sync */ "./packages/loot-core/src/server/sync/index.ts");
45936
+ /* harmony import */ var _sync_migrate__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./sync/migrate */ "./packages/loot-core/src/server/sync/migrate.ts");
45937
+ /* harmony import */ var _tools_app__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./tools/app */ "./packages/loot-core/src/server/tools/app.ts");
45938
+ /* harmony import */ var _undo__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./undo */ "./packages/loot-core/src/server/undo.ts");
45939
+ /* harmony import */ var _update__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./update */ "./packages/loot-core/src/server/update.ts");
45940
+ /* harmony import */ var _util_budget_name__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./util/budget-name */ "./packages/loot-core/src/server/util/budget-name.ts");
45629
45941
  // @ts-strict-ignore
45630
45942
  const DEMO_BUDGET_ID = '_demo-budget';
45631
45943
  const TEST_BUDGET_ID = '_test-budget';
45632
45944
  // util
45633
45945
  function onSheetChange({ names }) {
45634
45946
  const nodes = names.map((name) => {
45635
- const node = _sheet__WEBPACK_IMPORTED_MODULE_45__.get()._getNode(name);
45947
+ const node = _sheet__WEBPACK_IMPORTED_MODULE_46__.get()._getNode(name);
45636
45948
  return {
45637
45949
  name: node.name,
45638
45950
  value: node.value
@@ -45644,14 +45956,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45644
45956
  // need to work around the type system here because the object
45645
45957
  // is /currently/ empty but we promise to fill it in later
45646
45958
  let handlers = {};
45647
- handlers['undo'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function () {
45648
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.undo)();
45959
+ handlers['undo'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function () {
45960
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.undo)();
45649
45961
  });
45650
- handlers['redo'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(function () {
45651
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.redo)();
45962
+ handlers['redo'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(function () {
45963
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.redo)();
45652
45964
  });
45653
- handlers['transactions-batch-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ added, deleted, updated, learnCategories }) {
45654
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45965
+ handlers['transactions-batch-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ added, deleted, updated, learnCategories }) {
45966
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
45655
45967
  const result = await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_20__.batchUpdateTransactions)({
45656
45968
  added,
45657
45969
  updated,
@@ -45661,7 +45973,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45661
45973
  return result;
45662
45974
  });
45663
45975
  });
45664
- handlers['transaction-add'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function (transaction) {
45976
+ handlers['transaction-add'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function (transaction) {
45665
45977
  await handlers['transactions-batch-update']({
45666
45978
  added: [
45667
45979
  transaction
@@ -45669,7 +45981,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45669
45981
  });
45670
45982
  return {};
45671
45983
  });
45672
- handlers['transaction-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function (transaction) {
45984
+ handlers['transaction-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function (transaction) {
45673
45985
  await handlers['transactions-batch-update']({
45674
45986
  updated: [
45675
45987
  transaction
@@ -45677,7 +45989,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45677
45989
  });
45678
45990
  return {};
45679
45991
  });
45680
- handlers['transaction-delete'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function (transaction) {
45992
+ handlers['transaction-delete'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function (transaction) {
45681
45993
  await handlers['transactions-batch-update']({
45682
45994
  deleted: [
45683
45995
  transaction
@@ -45696,12 +46008,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45696
46008
  };
45697
46009
  handlers['get-categories'] = async function () {
45698
46010
  return {
45699
- grouped: await _db__WEBPACK_IMPORTED_MODULE_28__.getCategoriesGrouped(),
45700
- list: await _db__WEBPACK_IMPORTED_MODULE_28__.getCategories()
46011
+ grouped: await _db__WEBPACK_IMPORTED_MODULE_29__.getCategoriesGrouped(),
46012
+ list: await _db__WEBPACK_IMPORTED_MODULE_29__.getCategories()
45701
46013
  };
45702
46014
  };
45703
46015
  handlers['get-earliest-transaction'] = async function () {
45704
- const { data } = await (0, _aql__WEBPACK_IMPORTED_MODULE_22__.runQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_12__.q)('transactions').options({
46016
+ const { data } = await (0, _aql__WEBPACK_IMPORTED_MODULE_23__.runQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_12__.q)('transactions').options({
45705
46017
  splits: 'none'
45706
46018
  }).orderBy({
45707
46019
  date: 'asc'
@@ -45709,16 +46021,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45709
46021
  return data[0] || null;
45710
46022
  };
45711
46023
  handlers['get-budget-bounds'] = async function () {
45712
- return _budget_base__WEBPACK_IMPORTED_MODULE_25__.createAllBudgets();
46024
+ return _budget_base__WEBPACK_IMPORTED_MODULE_26__.createAllBudgets();
45713
46025
  };
45714
46026
  handlers['envelope-budget-month'] = async function ({ month }) {
45715
- const groups = await _db__WEBPACK_IMPORTED_MODULE_28__.getCategoriesGrouped();
46027
+ const groups = await _db__WEBPACK_IMPORTED_MODULE_29__.getCategoriesGrouped();
45716
46028
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_11__.sheetForMonth(month);
45717
46029
  function value(name) {
45718
- const v = _sheet__WEBPACK_IMPORTED_MODULE_45__.getCellValue(sheetName, name);
46030
+ const v = _sheet__WEBPACK_IMPORTED_MODULE_46__.getCellValue(sheetName, name);
45719
46031
  return {
45720
46032
  value: v === '' ? 0 : v,
45721
- name: (0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_46__.resolveName)(sheetName, name)
46033
+ name: (0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_47__.resolveName)(sheetName, name)
45722
46034
  };
45723
46035
  }
45724
46036
  let values = [
@@ -45760,13 +46072,13 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45760
46072
  return values;
45761
46073
  };
45762
46074
  handlers['tracking-budget-month'] = async function ({ month }) {
45763
- const groups = await _db__WEBPACK_IMPORTED_MODULE_28__.getCategoriesGrouped();
46075
+ const groups = await _db__WEBPACK_IMPORTED_MODULE_29__.getCategoriesGrouped();
45764
46076
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_11__.sheetForMonth(month);
45765
46077
  function value(name) {
45766
- const v = _sheet__WEBPACK_IMPORTED_MODULE_45__.getCellValue(sheetName, name);
46078
+ const v = _sheet__WEBPACK_IMPORTED_MODULE_46__.getCellValue(sheetName, name);
45767
46079
  return {
45768
46080
  value: v === '' ? 0 : v,
45769
- name: (0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_46__.resolveName)(sheetName, name)
46081
+ name: (0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_47__.resolveName)(sheetName, name)
45770
46082
  };
45771
46083
  }
45772
46084
  let values = [
@@ -45799,12 +46111,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45799
46111
  }
45800
46112
  return values;
45801
46113
  };
45802
- handlers['category-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ name, groupId, isIncome, hidden }) {
45803
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46114
+ handlers['category-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ name, groupId, isIncome, hidden }) {
46115
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
45804
46116
  if (!groupId) {
45805
- throw (0, _errors__WEBPACK_IMPORTED_MODULE_31__.APIError)('Creating a category: groupId is required');
46117
+ throw (0, _errors__WEBPACK_IMPORTED_MODULE_32__.APIError)('Creating a category: groupId is required');
45806
46118
  }
45807
- return _db__WEBPACK_IMPORTED_MODULE_28__.insertCategory({
46119
+ return _db__WEBPACK_IMPORTED_MODULE_29__.insertCategory({
45808
46120
  name: name.trim(),
45809
46121
  cat_group: groupId,
45810
46122
  is_income: isIncome ? 1 : 0,
@@ -45812,10 +46124,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45812
46124
  });
45813
46125
  });
45814
46126
  });
45815
- handlers['category-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function (category) {
45816
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46127
+ handlers['category-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function (category) {
46128
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
45817
46129
  try {
45818
- await _db__WEBPACK_IMPORTED_MODULE_28__.updateCategory({
46130
+ await _db__WEBPACK_IMPORTED_MODULE_29__.updateCategory({
45819
46131
  ...category,
45820
46132
  name: category.name.trim()
45821
46133
  });
@@ -45833,19 +46145,19 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45833
46145
  return {};
45834
46146
  });
45835
46147
  });
45836
- handlers['category-move'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, groupId, targetId }) {
45837
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45838
- await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.batchMessages)(async () => {
45839
- await _db__WEBPACK_IMPORTED_MODULE_28__.moveCategory(id, groupId, targetId);
46148
+ handlers['category-move'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, groupId, targetId }) {
46149
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46150
+ await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.batchMessages)(async () => {
46151
+ await _db__WEBPACK_IMPORTED_MODULE_29__.moveCategory(id, groupId, targetId);
45840
46152
  });
45841
46153
  return 'ok';
45842
46154
  });
45843
46155
  });
45844
- handlers['category-delete'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, transferId }) {
45845
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46156
+ handlers['category-delete'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, transferId }) {
46157
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
45846
46158
  let result = {};
45847
- await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.batchMessages)(async () => {
45848
- const row = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT is_income FROM categories WHERE id = ?', [
46159
+ await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.batchMessages)(async () => {
46160
+ const row = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT is_income FROM categories WHERE id = ?', [
45849
46161
  id
45850
46162
  ]);
45851
46163
  if (!row) {
@@ -45854,7 +46166,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45854
46166
  };
45855
46167
  return;
45856
46168
  }
45857
- const transfer = transferId && await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT is_income FROM categories WHERE id = ?', [
46169
+ const transfer = transferId && await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT is_income FROM categories WHERE id = ?', [
45858
46170
  transferId
45859
46171
  ]);
45860
46172
  if (!row || transferId && !transfer) {
@@ -45873,12 +46185,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45873
46185
  // TODO: We should do this for income too if it's a reflect budget
45874
46186
  if (row.is_income === 0) {
45875
46187
  if (transferId) {
45876
- await _budget_base__WEBPACK_IMPORTED_MODULE_25__.doTransfer([
46188
+ await _budget_base__WEBPACK_IMPORTED_MODULE_26__.doTransfer([
45877
46189
  id
45878
46190
  ], transferId);
45879
46191
  }
45880
46192
  }
45881
- await _db__WEBPACK_IMPORTED_MODULE_28__.deleteCategory({
46193
+ await _db__WEBPACK_IMPORTED_MODULE_29__.deleteCategory({
45882
46194
  id
45883
46195
  }, transferId);
45884
46196
  });
@@ -45886,46 +46198,46 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45886
46198
  });
45887
46199
  });
45888
46200
  handlers['get-category-groups'] = async function () {
45889
- return await _db__WEBPACK_IMPORTED_MODULE_28__.getCategoriesGrouped();
46201
+ return await _db__WEBPACK_IMPORTED_MODULE_29__.getCategoriesGrouped();
45890
46202
  };
45891
- handlers['category-group-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ name, isIncome }) {
45892
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45893
- return _db__WEBPACK_IMPORTED_MODULE_28__.insertCategoryGroup({
46203
+ handlers['category-group-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ name, isIncome }) {
46204
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46205
+ return _db__WEBPACK_IMPORTED_MODULE_29__.insertCategoryGroup({
45894
46206
  name,
45895
46207
  is_income: isIncome ? 1 : 0
45896
46208
  });
45897
46209
  });
45898
46210
  });
45899
- handlers['category-group-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function (group) {
45900
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45901
- return _db__WEBPACK_IMPORTED_MODULE_28__.updateCategoryGroup(group);
46211
+ handlers['category-group-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function (group) {
46212
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46213
+ return _db__WEBPACK_IMPORTED_MODULE_29__.updateCategoryGroup(group);
45902
46214
  });
45903
46215
  });
45904
- handlers['category-group-move'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, targetId }) {
45905
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45906
- await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.batchMessages)(async () => {
45907
- await _db__WEBPACK_IMPORTED_MODULE_28__.moveCategoryGroup(id, targetId);
46216
+ handlers['category-group-move'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, targetId }) {
46217
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46218
+ await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.batchMessages)(async () => {
46219
+ await _db__WEBPACK_IMPORTED_MODULE_29__.moveCategoryGroup(id, targetId);
45908
46220
  });
45909
46221
  return 'ok';
45910
46222
  });
45911
46223
  });
45912
- handlers['category-group-delete'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, transferId }) {
45913
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45914
- const groupCategories = await _db__WEBPACK_IMPORTED_MODULE_28__.all('SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0', [
46224
+ handlers['category-group-delete'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, transferId }) {
46225
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46226
+ const groupCategories = await _db__WEBPACK_IMPORTED_MODULE_29__.all('SELECT id FROM categories WHERE cat_group = ? AND tombstone = 0', [
45915
46227
  id
45916
46228
  ]);
45917
- return (0, _sync__WEBPACK_IMPORTED_MODULE_47__.batchMessages)(async () => {
46229
+ return (0, _sync__WEBPACK_IMPORTED_MODULE_48__.batchMessages)(async () => {
45918
46230
  if (transferId) {
45919
- await _budget_base__WEBPACK_IMPORTED_MODULE_25__.doTransfer(groupCategories.map((c) => c.id), transferId);
46231
+ await _budget_base__WEBPACK_IMPORTED_MODULE_26__.doTransfer(groupCategories.map((c) => c.id), transferId);
45920
46232
  }
45921
- await _db__WEBPACK_IMPORTED_MODULE_28__.deleteCategoryGroup({
46233
+ await _db__WEBPACK_IMPORTED_MODULE_29__.deleteCategoryGroup({
45922
46234
  id
45923
46235
  }, transferId);
45924
46236
  });
45925
46237
  });
45926
46238
  });
45927
46239
  handlers['must-category-transfer'] = async function ({ id }) {
45928
- const res = await _db__WEBPACK_IMPORTED_MODULE_28__.runQuery(`SELECT count(t.id) as count FROM transactions t
46240
+ const res = await _db__WEBPACK_IMPORTED_MODULE_29__.runQuery(`SELECT count(t.id) as count FROM transactions t
45929
46241
  LEFT JOIN category_mapping cm ON cm.id = t.category
45930
46242
  WHERE cm.transferId = ? AND t.tombstone = 0`, [
45931
46243
  id
@@ -45938,28 +46250,28 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45938
46250
  // If there are any non-zero budget values, also force the user to
45939
46251
  // transfer the category.
45940
46252
  return [
45941
- ..._sheet__WEBPACK_IMPORTED_MODULE_45__.get().meta().createdMonths
46253
+ ..._sheet__WEBPACK_IMPORTED_MODULE_46__.get().meta().createdMonths
45942
46254
  ].some((month) => {
45943
46255
  const sheetName = _shared_months__WEBPACK_IMPORTED_MODULE_11__.sheetForMonth(month);
45944
- const value = _sheet__WEBPACK_IMPORTED_MODULE_45__.get().getCellValue(sheetName, 'budget-' + id);
46256
+ const value = _sheet__WEBPACK_IMPORTED_MODULE_46__.get().getCellValue(sheetName, 'budget-' + id);
45945
46257
  return value != null && value !== 0;
45946
46258
  });
45947
46259
  };
45948
- handlers['payee-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ name }) {
45949
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45950
- return _db__WEBPACK_IMPORTED_MODULE_28__.insertPayee({
46260
+ handlers['payee-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ name }) {
46261
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46262
+ return _db__WEBPACK_IMPORTED_MODULE_29__.insertPayee({
45951
46263
  name
45952
46264
  });
45953
46265
  });
45954
46266
  });
45955
46267
  handlers['common-payees-get'] = async function () {
45956
- return _db__WEBPACK_IMPORTED_MODULE_28__.getCommonPayees();
46268
+ return _db__WEBPACK_IMPORTED_MODULE_29__.getCommonPayees();
45957
46269
  };
45958
46270
  handlers['payees-get'] = async function () {
45959
- return _db__WEBPACK_IMPORTED_MODULE_28__.getPayees();
46271
+ return _db__WEBPACK_IMPORTED_MODULE_29__.getPayees();
45960
46272
  };
45961
46273
  handlers['payees-get-orphaned'] = async function () {
45962
- return _db__WEBPACK_IMPORTED_MODULE_28__.syncGetOrphanedPayees();
46274
+ return _db__WEBPACK_IMPORTED_MODULE_29__.syncGetOrphanedPayees();
45963
46275
  };
45964
46276
  handlers['payees-get-rule-counts'] = async function () {
45965
46277
  const payeeCounts = {};
@@ -45971,31 +46283,31 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
45971
46283
  });
45972
46284
  return payeeCounts;
45973
46285
  };
45974
- handlers['payees-merge'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ targetId, mergeIds }) {
45975
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45976
- return _db__WEBPACK_IMPORTED_MODULE_28__.mergePayees(targetId, mergeIds);
46286
+ handlers['payees-merge'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ targetId, mergeIds }) {
46287
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46288
+ return _db__WEBPACK_IMPORTED_MODULE_29__.mergePayees(targetId, mergeIds);
45977
46289
  }, {
45978
46290
  targetId,
45979
46291
  mergeIds
45980
46292
  });
45981
46293
  });
45982
- handlers['payees-batch-change'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ added, deleted, updated }) {
45983
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
45984
- return (0, _sync__WEBPACK_IMPORTED_MODULE_47__.batchMessages)(async () => {
46294
+ handlers['payees-batch-change'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ added, deleted, updated }) {
46295
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46296
+ return (0, _sync__WEBPACK_IMPORTED_MODULE_48__.batchMessages)(async () => {
45985
46297
  if (deleted) {
45986
- await Promise.all(deleted.map((p) => _db__WEBPACK_IMPORTED_MODULE_28__.deletePayee(p)));
46298
+ await Promise.all(deleted.map((p) => _db__WEBPACK_IMPORTED_MODULE_29__.deletePayee(p)));
45987
46299
  }
45988
46300
  if (added) {
45989
- await Promise.all(added.map((p) => _db__WEBPACK_IMPORTED_MODULE_28__.insertPayee(p)));
46301
+ await Promise.all(added.map((p) => _db__WEBPACK_IMPORTED_MODULE_29__.insertPayee(p)));
45990
46302
  }
45991
46303
  if (updated) {
45992
- await Promise.all(updated.map((p) => _db__WEBPACK_IMPORTED_MODULE_28__.updatePayee(p)));
46304
+ await Promise.all(updated.map((p) => _db__WEBPACK_IMPORTED_MODULE_29__.updatePayee(p)));
45993
46305
  }
45994
46306
  });
45995
46307
  });
45996
46308
  });
45997
46309
  handlers['payees-check-orphaned'] = async function ({ ids }) {
45998
- const orphaned = new Set(await _db__WEBPACK_IMPORTED_MODULE_28__.getOrphanedPayees());
46310
+ const orphaned = new Set(await _db__WEBPACK_IMPORTED_MODULE_29__.getOrphanedPayees());
45999
46311
  return ids.filter((id) => orphaned.has(id));
46000
46312
  };
46001
46313
  handlers['payees-get-rules'] = async function ({ id }) {
@@ -46005,37 +46317,21 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46005
46317
  return _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__.conditionsToAQL(conditions);
46006
46318
  };
46007
46319
  handlers['getCell'] = async function ({ sheetName, name }) {
46008
- // Fields is no longer used - hardcode
46009
- const fields = [
46010
- 'name',
46011
- 'value'
46012
- ];
46013
- const node = _sheet__WEBPACK_IMPORTED_MODULE_45__.get()._getNode((0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_46__.resolveName)(sheetName, name));
46014
- if (fields) {
46015
- const res = {};
46016
- fields.forEach((field) => {
46017
- if (field === 'run') {
46018
- res[field] = node._run ? node._run.toString() : null;
46019
- }
46020
- else {
46021
- res[field] = node[field];
46022
- }
46023
- });
46024
- return res;
46025
- }
46026
- else {
46027
- return node;
46028
- }
46320
+ const node = _sheet__WEBPACK_IMPORTED_MODULE_46__.get()._getNode((0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_47__.resolveName)(sheetName, name));
46321
+ return {
46322
+ name: node.name,
46323
+ value: node.value
46324
+ };
46029
46325
  };
46030
46326
  handlers['getCells'] = async function ({ names }) {
46031
46327
  return names.map((name) => ({
46032
- value: _sheet__WEBPACK_IMPORTED_MODULE_45__.get()._getNode(name).value
46328
+ value: _sheet__WEBPACK_IMPORTED_MODULE_46__.get()._getNode(name).value
46033
46329
  }));
46034
46330
  };
46035
46331
  handlers['getCellNamesInSheet'] = async function ({ sheetName }) {
46036
46332
  const names = [];
46037
- for (const name of _sheet__WEBPACK_IMPORTED_MODULE_45__.get().getNodes().keys()) {
46038
- const { sheet: nodeSheet, name: nodeName } = (0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_46__.unresolveName)(name);
46333
+ for (const name of _sheet__WEBPACK_IMPORTED_MODULE_46__.get().getNodes().keys()) {
46334
+ const { sheet: nodeSheet, name: nodeName } = (0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_47__.unresolveName)(name);
46039
46335
  if (nodeSheet === sheetName) {
46040
46336
  names.push(nodeName);
46041
46337
  }
@@ -46043,7 +46339,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46043
46339
  return names;
46044
46340
  };
46045
46341
  handlers['debugCell'] = async function ({ sheetName, name }) {
46046
- const node = _sheet__WEBPACK_IMPORTED_MODULE_45__.get().getNode((0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_46__.resolveName)(sheetName, name));
46342
+ const node = _sheet__WEBPACK_IMPORTED_MODULE_46__.get().getNode((0, _spreadsheet_util__WEBPACK_IMPORTED_MODULE_47__.resolveName)(sheetName, name));
46047
46343
  return {
46048
46344
  ...node,
46049
46345
  _run: node._run && node._run.toString()
@@ -46052,18 +46348,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46052
46348
  handlers['create-query'] = async function ({ sheetName, name, query }) {
46053
46349
  // Always run it regardless of cache. We don't know anything has changed
46054
46350
  // between the cache value being saved and now
46055
- _sheet__WEBPACK_IMPORTED_MODULE_45__.get().createQuery(sheetName, name, query);
46351
+ _sheet__WEBPACK_IMPORTED_MODULE_46__.get().createQuery(sheetName, name, query);
46056
46352
  return 'ok';
46057
46353
  };
46058
46354
  handlers['query'] = async function (query) {
46059
46355
  if (query.table == null) {
46060
46356
  throw new Error('query has no table, did you forgot to call `.serialize`?');
46061
46357
  }
46062
- return (0, _aql__WEBPACK_IMPORTED_MODULE_22__.runQuery)(query);
46358
+ return (0, _aql__WEBPACK_IMPORTED_MODULE_23__.runQuery)(query);
46063
46359
  };
46064
- handlers['account-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, name }) {
46065
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46066
- await _db__WEBPACK_IMPORTED_MODULE_28__.update('accounts', {
46360
+ handlers['account-update'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, name }) {
46361
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46362
+ await _db__WEBPACK_IMPORTED_MODULE_29__.update('accounts', {
46067
46363
  id,
46068
46364
  name
46069
46365
  });
@@ -46071,20 +46367,20 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46071
46367
  });
46072
46368
  });
46073
46369
  handlers['accounts-get'] = async function () {
46074
- return _db__WEBPACK_IMPORTED_MODULE_28__.getAccounts();
46370
+ return _db__WEBPACK_IMPORTED_MODULE_29__.getAccounts();
46075
46371
  };
46076
46372
  handlers['account-balance'] = async function ({ id, cutoff }) {
46077
- const { balance } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0 AND date <= ?', [
46373
+ const { balance } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0 AND date <= ?', [
46078
46374
  id,
46079
- _db__WEBPACK_IMPORTED_MODULE_28__.toDateRepr((0, _shared_months__WEBPACK_IMPORTED_MODULE_11__.dayFromDate)(cutoff))
46375
+ _db__WEBPACK_IMPORTED_MODULE_29__.toDateRepr((0, _shared_months__WEBPACK_IMPORTED_MODULE_11__.dayFromDate)(cutoff))
46080
46376
  ]);
46081
46377
  return balance ? balance : 0;
46082
46378
  };
46083
46379
  handlers['account-properties'] = async function ({ id }) {
46084
- const { balance } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0', [
46380
+ const { balance } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT sum(amount) as balance FROM transactions WHERE acct = ? AND isParent = 0 AND tombstone = 0', [
46085
46381
  id
46086
46382
  ]);
46087
- const { count } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0', [
46383
+ const { count } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT count(id) as count FROM transactions WHERE acct = ? AND tombstone = 0', [
46088
46384
  id
46089
46385
  ]);
46090
46386
  return {
@@ -46096,11 +46392,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46096
46392
  let id;
46097
46393
  const bank = await _accounts_link__WEBPACK_IMPORTED_MODULE_15__.findOrCreateBank(account.institution, requisitionId);
46098
46394
  if (upgradingId) {
46099
- const accRow = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT * FROM accounts WHERE id = ?', [
46395
+ const accRow = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT * FROM accounts WHERE id = ?', [
46100
46396
  upgradingId
46101
46397
  ]);
46102
46398
  id = accRow.id;
46103
- await _db__WEBPACK_IMPORTED_MODULE_28__.update('accounts', {
46399
+ await _db__WEBPACK_IMPORTED_MODULE_29__.update('accounts', {
46104
46400
  id,
46105
46401
  account_id: account.account_id,
46106
46402
  bank: bank.id,
@@ -46108,8 +46404,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46108
46404
  });
46109
46405
  }
46110
46406
  else {
46111
- id = (0, uuid__WEBPACK_IMPORTED_MODULE_53__["default"])();
46112
- await _db__WEBPACK_IMPORTED_MODULE_28__.insertWithUUID('accounts', {
46407
+ id = (0, uuid__WEBPACK_IMPORTED_MODULE_54__["default"])();
46408
+ await _db__WEBPACK_IMPORTED_MODULE_29__.insertWithUUID('accounts', {
46113
46409
  id,
46114
46410
  account_id: account.account_id,
46115
46411
  mask: account.mask,
@@ -46119,7 +46415,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46119
46415
  offbudget: offBudget ? 1 : 0,
46120
46416
  account_sync_source: 'goCardless'
46121
46417
  });
46122
- await _db__WEBPACK_IMPORTED_MODULE_28__.insertPayee({
46418
+ await _db__WEBPACK_IMPORTED_MODULE_29__.insertPayee({
46123
46419
  name: '',
46124
46420
  transfer_acct: id
46125
46421
  });
@@ -46140,11 +46436,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46140
46436
  };
46141
46437
  const bank = await _accounts_link__WEBPACK_IMPORTED_MODULE_15__.findOrCreateBank(institution, externalAccount.orgDomain ?? externalAccount.orgId);
46142
46438
  if (upgradingId) {
46143
- const accRow = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT * FROM accounts WHERE id = ?', [
46439
+ const accRow = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT * FROM accounts WHERE id = ?', [
46144
46440
  upgradingId
46145
46441
  ]);
46146
46442
  id = accRow.id;
46147
- await _db__WEBPACK_IMPORTED_MODULE_28__.update('accounts', {
46443
+ await _db__WEBPACK_IMPORTED_MODULE_29__.update('accounts', {
46148
46444
  id,
46149
46445
  account_id: externalAccount.account_id,
46150
46446
  bank: bank.id,
@@ -46152,8 +46448,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46152
46448
  });
46153
46449
  }
46154
46450
  else {
46155
- id = (0, uuid__WEBPACK_IMPORTED_MODULE_53__["default"])();
46156
- await _db__WEBPACK_IMPORTED_MODULE_28__.insertWithUUID('accounts', {
46451
+ id = (0, uuid__WEBPACK_IMPORTED_MODULE_54__["default"])();
46452
+ await _db__WEBPACK_IMPORTED_MODULE_29__.insertWithUUID('accounts', {
46157
46453
  id,
46158
46454
  account_id: externalAccount.account_id,
46159
46455
  name: externalAccount.name,
@@ -46162,7 +46458,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46162
46458
  offbudget: offBudget ? 1 : 0,
46163
46459
  account_sync_source: 'simpleFin'
46164
46460
  });
46165
- await _db__WEBPACK_IMPORTED_MODULE_28__.insertPayee({
46461
+ await _db__WEBPACK_IMPORTED_MODULE_29__.insertPayee({
46166
46462
  name: '',
46167
46463
  transfer_acct: id
46168
46464
  });
@@ -46176,20 +46472,20 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46176
46472
  });
46177
46473
  return 'ok';
46178
46474
  };
46179
- handlers['account-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ name, balance, offBudget, closed }) {
46180
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46181
- const id = await _db__WEBPACK_IMPORTED_MODULE_28__.insertAccount({
46475
+ handlers['account-create'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ name, balance, offBudget, closed }) {
46476
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46477
+ const id = await _db__WEBPACK_IMPORTED_MODULE_29__.insertAccount({
46182
46478
  name,
46183
46479
  offbudget: offBudget ? 1 : 0,
46184
46480
  closed: closed ? 1 : 0
46185
46481
  });
46186
- await _db__WEBPACK_IMPORTED_MODULE_28__.insertPayee({
46482
+ await _db__WEBPACK_IMPORTED_MODULE_29__.insertPayee({
46187
46483
  name: '',
46188
46484
  transfer_acct: id
46189
46485
  });
46190
46486
  if (balance != null && balance !== 0) {
46191
46487
  const payee = await (0, _accounts_payees__WEBPACK_IMPORTED_MODULE_17__.getStartingBalancePayee)();
46192
- await _db__WEBPACK_IMPORTED_MODULE_28__.insertTransaction({
46488
+ await _db__WEBPACK_IMPORTED_MODULE_29__.insertTransaction({
46193
46489
  account: id,
46194
46490
  amount: (0, _shared_util__WEBPACK_IMPORTED_MODULE_13__.amountToInteger)(balance),
46195
46491
  category: offBudget ? null : payee.category,
@@ -46202,15 +46498,15 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46202
46498
  return id;
46203
46499
  });
46204
46500
  });
46205
- handlers['account-close'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, transferAccountId, categoryId, forced }) {
46501
+ handlers['account-close'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, transferAccountId, categoryId, forced }) {
46206
46502
  // Unlink the account if it's linked. This makes sure to remove it from
46207
46503
  // bank-sync providers. (This should not be undo-able, as it mutates the
46208
46504
  // remote server and the user will have to link the account again)
46209
46505
  await handlers['account-unlink']({
46210
46506
  id
46211
46507
  });
46212
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46213
- const account = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT * FROM accounts WHERE id = ? AND tombstone = 0', [
46508
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46509
+ const account = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT * FROM accounts WHERE id = ? AND tombstone = 0', [
46214
46510
  id
46215
46511
  ]);
46216
46512
  // Do nothing if the account doesn't exist or it's already been
@@ -46223,18 +46519,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46223
46519
  });
46224
46520
  // If there are no transactions, we can simply delete the account
46225
46521
  if (numTransactions === 0) {
46226
- await _db__WEBPACK_IMPORTED_MODULE_28__.deleteAccount({
46522
+ await _db__WEBPACK_IMPORTED_MODULE_29__.deleteAccount({
46227
46523
  id
46228
46524
  });
46229
46525
  }
46230
46526
  else if (forced) {
46231
- const rows = await _db__WEBPACK_IMPORTED_MODULE_28__.runQuery('SELECT id, transfer_id FROM v_transactions WHERE account = ?', [
46527
+ const rows = await _db__WEBPACK_IMPORTED_MODULE_29__.runQuery('SELECT id, transfer_id FROM v_transactions WHERE account = ?', [
46232
46528
  id
46233
46529
  ], true);
46234
- const { id: payeeId } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT id FROM payees WHERE transfer_acct = ?', [
46530
+ const { id: payeeId } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT id FROM payees WHERE transfer_acct = ?', [
46235
46531
  id
46236
46532
  ]);
46237
- await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.batchMessages)(async () => {
46533
+ await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.batchMessages)(async () => {
46238
46534
  // TODO: what this should really do is send a special message that
46239
46535
  // automatically marks the tombstone value for all transactions
46240
46536
  // within an account... or something? This is problematic
@@ -46242,40 +46538,40 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46242
46538
  // should be marked as deleted.
46243
46539
  rows.forEach((row) => {
46244
46540
  if (row.transfer_id) {
46245
- _db__WEBPACK_IMPORTED_MODULE_28__.updateTransaction({
46541
+ _db__WEBPACK_IMPORTED_MODULE_29__.updateTransaction({
46246
46542
  id: row.transfer_id,
46247
46543
  payee: null,
46248
46544
  transfer_id: null
46249
46545
  });
46250
46546
  }
46251
- _db__WEBPACK_IMPORTED_MODULE_28__.deleteTransaction({
46547
+ _db__WEBPACK_IMPORTED_MODULE_29__.deleteTransaction({
46252
46548
  id: row.id
46253
46549
  });
46254
46550
  });
46255
- _db__WEBPACK_IMPORTED_MODULE_28__.deleteAccount({
46551
+ _db__WEBPACK_IMPORTED_MODULE_29__.deleteAccount({
46256
46552
  id
46257
46553
  });
46258
- _db__WEBPACK_IMPORTED_MODULE_28__.deleteTransferPayee({
46554
+ _db__WEBPACK_IMPORTED_MODULE_29__.deleteTransferPayee({
46259
46555
  id: payeeId
46260
46556
  });
46261
46557
  });
46262
46558
  }
46263
46559
  else {
46264
46560
  if (balance !== 0 && transferAccountId == null) {
46265
- throw (0, _errors__WEBPACK_IMPORTED_MODULE_31__.APIError)('balance is non-zero: transferAccountId is required');
46561
+ throw (0, _errors__WEBPACK_IMPORTED_MODULE_32__.APIError)('balance is non-zero: transferAccountId is required');
46266
46562
  }
46267
- await _db__WEBPACK_IMPORTED_MODULE_28__.update('accounts', {
46563
+ await _db__WEBPACK_IMPORTED_MODULE_29__.update('accounts', {
46268
46564
  id,
46269
46565
  closed: 1
46270
46566
  });
46271
46567
  // If there is a balance we need to transfer it to the specified
46272
46568
  // account (and possibly categorize it)
46273
46569
  if (balance !== 0) {
46274
- const { id: payeeId } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT id FROM payees WHERE transfer_acct = ?', [
46570
+ const { id: payeeId } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT id FROM payees WHERE transfer_acct = ?', [
46275
46571
  transferAccountId
46276
46572
  ]);
46277
46573
  await handlers['transaction-add']({
46278
- id: (0, uuid__WEBPACK_IMPORTED_MODULE_53__["default"])(),
46574
+ id: (0, uuid__WEBPACK_IMPORTED_MODULE_54__["default"])(),
46279
46575
  payee: payeeId,
46280
46576
  amount: -balance,
46281
46577
  account: id,
@@ -46287,17 +46583,17 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46287
46583
  }
46288
46584
  });
46289
46585
  });
46290
- handlers['account-reopen'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id }) {
46291
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46292
- await _db__WEBPACK_IMPORTED_MODULE_28__.update('accounts', {
46586
+ handlers['account-reopen'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id }) {
46587
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46588
+ await _db__WEBPACK_IMPORTED_MODULE_29__.update('accounts', {
46293
46589
  id,
46294
46590
  closed: 0
46295
46591
  });
46296
46592
  });
46297
46593
  });
46298
- handlers['account-move'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id, targetId }) {
46299
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46300
- await _db__WEBPACK_IMPORTED_MODULE_28__.moveAccount(id, targetId);
46594
+ handlers['account-move'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id, targetId }) {
46595
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46596
+ await _db__WEBPACK_IMPORTED_MODULE_29__.moveAccount(id, targetId);
46301
46597
  });
46302
46598
  });
46303
46599
  let stopPolling = false;
@@ -46309,7 +46605,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46309
46605
  };
46310
46606
  }
46311
46607
  try {
46312
- return await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().BASE_SERVER + '/secret', {
46608
+ return await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/secret', {
46313
46609
  name,
46314
46610
  value
46315
46611
  }, {
@@ -46317,9 +46613,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46317
46613
  });
46318
46614
  }
46319
46615
  catch (error) {
46320
- console.error(error);
46321
46616
  return {
46322
- error: 'failed'
46617
+ error: 'failed',
46618
+ reason: error.reason
46323
46619
  };
46324
46620
  }
46325
46621
  };
@@ -46331,7 +46627,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46331
46627
  };
46332
46628
  }
46333
46629
  try {
46334
- return await (0, _post__WEBPACK_IMPORTED_MODULE_38__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().BASE_SERVER + '/secret/' + name, {
46630
+ return await (0, _post__WEBPACK_IMPORTED_MODULE_39__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/secret/' + name, {
46335
46631
  'X-ACTUAL-TOKEN': userToken
46336
46632
  });
46337
46633
  }
@@ -46358,7 +46654,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46358
46654
  cb('timeout');
46359
46655
  return;
46360
46656
  }
46361
- const data = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().GOCARDLESS_SERVER + '/get-accounts', {
46657
+ const data = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().GOCARDLESS_SERVER + '/get-accounts', {
46362
46658
  upgradingAccountId,
46363
46659
  requisitionId
46364
46660
  }, {
@@ -46398,7 +46694,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46398
46694
  error: 'unauthorized'
46399
46695
  };
46400
46696
  }
46401
- return (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().GOCARDLESS_SERVER + '/status', {}, {
46697
+ return (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().GOCARDLESS_SERVER + '/status', {}, {
46402
46698
  'X-ACTUAL-TOKEN': userToken
46403
46699
  });
46404
46700
  };
@@ -46409,7 +46705,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46409
46705
  error: 'unauthorized'
46410
46706
  };
46411
46707
  }
46412
- return (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SIMPLEFIN_SERVER + '/status', {}, {
46708
+ return (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIMPLEFIN_SERVER + '/status', {}, {
46413
46709
  'X-ACTUAL-TOKEN': userToken
46414
46710
  });
46415
46711
  };
@@ -46421,7 +46717,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46421
46717
  };
46422
46718
  }
46423
46719
  try {
46424
- return await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SIMPLEFIN_SERVER + '/accounts', {}, {
46720
+ return await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIMPLEFIN_SERVER + '/accounts', {}, {
46425
46721
  'X-ACTUAL-TOKEN': userToken
46426
46722
  }, 60000);
46427
46723
  }
@@ -46438,7 +46734,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46438
46734
  error: 'unauthorized'
46439
46735
  };
46440
46736
  }
46441
- return (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().GOCARDLESS_SERVER + '/get-banks', {
46737
+ return (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().GOCARDLESS_SERVER + '/get-banks', {
46442
46738
  country,
46443
46739
  showDemo: (0, _shared_environment__WEBPACK_IMPORTED_MODULE_10__.isNonProductionEnvironment)()
46444
46740
  }, {
@@ -46457,7 +46753,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46457
46753
  };
46458
46754
  }
46459
46755
  try {
46460
- return await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().GOCARDLESS_SERVER + '/create-web-token', {
46756
+ return await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().GOCARDLESS_SERVER + '/create-web-token', {
46461
46757
  upgradingAccountId,
46462
46758
  institutionId,
46463
46759
  accessValidForDays
@@ -46476,7 +46772,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46476
46772
  const { added, updated } = res;
46477
46773
  newTransactions.push(...added);
46478
46774
  matchedTransactions.push(...updated);
46479
- if (added.length > 0 || updated.length > 0) {
46775
+ if (added.length > 0) {
46480
46776
  updatedAccounts.push(acct.id);
46481
46777
  }
46482
46778
  }
@@ -46490,7 +46786,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46490
46786
  code: err.code
46491
46787
  };
46492
46788
  }
46493
- if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_31__.PostError && err.reason !== 'internal') {
46789
+ if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_32__.PostError && err.reason !== 'internal') {
46494
46790
  return {
46495
46791
  accountId: acct.id,
46496
46792
  message: err.reason ? err.reason : `Account “${acct.name}” is not linked properly. Please link it again.`
@@ -46507,8 +46803,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46507
46803
  'user-id',
46508
46804
  'user-key'
46509
46805
  ]);
46510
- const accounts = await _db__WEBPACK_IMPORTED_MODULE_28__.runQuery(`
46511
- SELECT a.*, b.bank_id as bankId
46806
+ const accounts = await _db__WEBPACK_IMPORTED_MODULE_29__.runQuery(`
46807
+ SELECT a.*, b.bank_id as bankId
46512
46808
  FROM accounts a
46513
46809
  LEFT JOIN banks b ON a.bank = b.id
46514
46810
  WHERE a.tombstone = 0 AND a.closed = 0
@@ -46553,7 +46849,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46553
46849
  };
46554
46850
  };
46555
46851
  handlers['simplefin-batch-sync'] = async function ({ ids = [] }) {
46556
- const accounts = await _db__WEBPACK_IMPORTED_MODULE_28__.runQuery(`SELECT a.*, b.bank_id as bankId FROM accounts a
46852
+ const accounts = await _db__WEBPACK_IMPORTED_MODULE_29__.runQuery(`SELECT a.*, b.bank_id as bankId FROM accounts a
46557
46853
  LEFT JOIN banks b ON a.bank = b.id
46558
46854
  WHERE
46559
46855
  a.tombstone = 0
@@ -46561,36 +46857,53 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46561
46857
  AND a.account_sync_source = 'simpleFin'
46562
46858
  ${ids.length ? `AND a.id IN (${ids.map(() => '?').join(', ')})` : ''}
46563
46859
  ORDER BY a.offbudget, a.sort_order`, ids.length ? ids : [], true);
46564
- console.group('Bank Sync operation for all SimpleFin accounts');
46565
- const res = await _accounts_sync__WEBPACK_IMPORTED_MODULE_18__.SimpleFinBatchSync(accounts.map((a) => ({
46566
- id: a.id,
46567
- accountId: a.account_id
46568
- })));
46569
46860
  const retVal = [];
46570
- for (const account of res) {
46571
- const errors = [];
46572
- const newTransactions = [];
46573
- const matchedTransactions = [];
46574
- const updatedAccounts = [];
46575
- if (account.res.error_code) {
46576
- errors.push(handleSyncError({
46577
- type: 'BankSyncError',
46578
- category: account.res.error_type,
46579
- code: account.res.error_code
46580
- }, accounts.find((a) => a.id === account.accountId)));
46861
+ console.group('Bank Sync operation for all SimpleFin accounts');
46862
+ try {
46863
+ const res = await _accounts_sync__WEBPACK_IMPORTED_MODULE_18__.SimpleFinBatchSync(accounts.map((a) => ({
46864
+ id: a.id,
46865
+ accountId: a.account_id
46866
+ })));
46867
+ for (const account of res) {
46868
+ const errors = [];
46869
+ const newTransactions = [];
46870
+ const matchedTransactions = [];
46871
+ const updatedAccounts = [];
46872
+ if (account.res.error_code) {
46873
+ errors.push(handleSyncError({
46874
+ type: 'BankSyncError',
46875
+ category: account.res.error_type,
46876
+ code: account.res.error_code
46877
+ }, accounts.find((a) => a.id === account.accountId)));
46878
+ }
46879
+ else {
46880
+ handleSyncResponse(account.res, accounts.find((a) => a.id === account.accountId), newTransactions, matchedTransactions, updatedAccounts);
46881
+ }
46882
+ retVal.push({
46883
+ accountId: account.accountId,
46884
+ res: {
46885
+ errors,
46886
+ newTransactions,
46887
+ matchedTransactions,
46888
+ updatedAccounts
46889
+ }
46890
+ });
46581
46891
  }
46582
- else {
46583
- handleSyncResponse(account.res, accounts.find((a) => a.id === account.accountId), newTransactions, matchedTransactions, updatedAccounts);
46892
+ }
46893
+ catch (err) {
46894
+ const errors = [];
46895
+ for (const account of accounts) {
46896
+ retVal.push({
46897
+ accountId: account.accountId,
46898
+ res: {
46899
+ errors,
46900
+ newTransactions: [],
46901
+ matchedTransactions: [],
46902
+ updatedAccounts: []
46903
+ }
46904
+ });
46905
+ errors.push(handleSyncError(err, account));
46584
46906
  }
46585
- retVal.push({
46586
- accountId: account.accountId,
46587
- res: {
46588
- errors,
46589
- newTransactions,
46590
- matchedTransactions,
46591
- updatedAccounts
46592
- }
46593
- });
46594
46907
  }
46595
46908
  if (retVal.some((a) => a.res.updatedAccounts.length > 0)) {
46596
46909
  _platform_server_connection__WEBPACK_IMPORTED_MODULE_6__.send('sync-event', {
@@ -46603,16 +46916,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46603
46916
  console.groupEnd();
46604
46917
  return retVal;
46605
46918
  };
46606
- handlers['transactions-import'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(function ({ accountId, transactions, isPreview }) {
46607
- return (0, _undo__WEBPACK_IMPORTED_MODULE_50__.withUndo)(async () => {
46919
+ handlers['transactions-import'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(function ({ accountId, transactions, isPreview }) {
46920
+ return (0, _undo__WEBPACK_IMPORTED_MODULE_51__.withUndo)(async () => {
46608
46921
  if (typeof accountId !== 'string') {
46609
- throw (0, _errors__WEBPACK_IMPORTED_MODULE_31__.APIError)('transactions-import: accountId must be an id');
46922
+ throw (0, _errors__WEBPACK_IMPORTED_MODULE_32__.APIError)('transactions-import: accountId must be an id');
46610
46923
  }
46611
46924
  try {
46612
46925
  return await _accounts_sync__WEBPACK_IMPORTED_MODULE_18__.reconcileTransactions(accountId, transactions, false, true, isPreview);
46613
46926
  }
46614
46927
  catch (err) {
46615
- if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_31__.TransactionError) {
46928
+ if (err instanceof _errors__WEBPACK_IMPORTED_MODULE_32__.TransactionError) {
46616
46929
  return {
46617
46930
  errors: [
46618
46931
  {
@@ -46628,18 +46941,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46628
46941
  }
46629
46942
  });
46630
46943
  });
46631
- handlers['account-unlink'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function ({ id }) {
46632
- const { bank: bankId } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT bank FROM accounts WHERE id = ?', [
46944
+ handlers['account-unlink'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function ({ id }) {
46945
+ const { bank: bankId } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT bank FROM accounts WHERE id = ?', [
46633
46946
  id
46634
46947
  ]);
46635
46948
  if (!bankId) {
46636
46949
  return 'ok';
46637
46950
  }
46638
- const accRow = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT * FROM accounts WHERE id = ?', [
46951
+ const accRow = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT * FROM accounts WHERE id = ?', [
46639
46952
  id
46640
46953
  ]);
46641
46954
  const isGoCardless = accRow.account_sync_source === 'goCardless';
46642
- await _db__WEBPACK_IMPORTED_MODULE_28__.updateAccount({
46955
+ await _db__WEBPACK_IMPORTED_MODULE_29__.updateAccount({
46643
46956
  id,
46644
46957
  account_id: null,
46645
46958
  bank: null,
@@ -46651,7 +46964,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46651
46964
  if (isGoCardless === false) {
46652
46965
  return;
46653
46966
  }
46654
- const { count } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT COUNT(*) as count FROM accounts WHERE bank = ?', [
46967
+ const { count } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT COUNT(*) as count FROM accounts WHERE bank = ?', [
46655
46968
  bankId
46656
46969
  ]);
46657
46970
  // No more accounts are associated with this bank. We can remove
@@ -46661,11 +46974,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46661
46974
  return 'ok';
46662
46975
  }
46663
46976
  if (count === 0) {
46664
- const { bank_id: requisitionId } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT bank_id FROM banks WHERE id = ?', [
46977
+ const { bank_id: requisitionId } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT bank_id FROM banks WHERE id = ?', [
46665
46978
  bankId
46666
46979
  ]);
46667
46980
  try {
46668
- await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().GOCARDLESS_SERVER + '/remove-account', {
46981
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().GOCARDLESS_SERVER + '/remove-account', {
46669
46982
  requisitionId
46670
46983
  }, {
46671
46984
  'X-ACTUAL-TOKEN': userToken
@@ -46723,51 +47036,51 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46723
47036
  };
46724
47037
  };
46725
47038
  handlers['save-prefs'] = async function (prefsToSet) {
46726
- const { cloudFileId } = _prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs();
47039
+ const { cloudFileId } = _prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs();
46727
47040
  // Need to sync the budget name on the server as well
46728
47041
  if (prefsToSet.budgetName && cloudFileId) {
46729
47042
  const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
46730
- await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SYNC_SERVER + '/update-user-filename', {
47043
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SYNC_SERVER + '/update-user-filename', {
46731
47044
  token: userToken,
46732
47045
  fileId: cloudFileId,
46733
47046
  name: prefsToSet.budgetName
46734
47047
  });
46735
47048
  }
46736
- await _prefs__WEBPACK_IMPORTED_MODULE_40__.savePrefs(prefsToSet);
47049
+ await _prefs__WEBPACK_IMPORTED_MODULE_41__.savePrefs(prefsToSet);
46737
47050
  return 'ok';
46738
47051
  };
46739
47052
  handlers['load-prefs'] = async function () {
46740
- return _prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs();
47053
+ return _prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs();
46741
47054
  };
46742
47055
  handlers['sync-reset'] = async function () {
46743
- return await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.resetSync)();
47056
+ return await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.resetSync)();
46744
47057
  };
46745
47058
  handlers['sync-repair'] = async function () {
46746
- await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.repairSync)();
47059
+ await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.repairSync)();
46747
47060
  };
46748
47061
  // A user can only enable/change their key with the file loaded. This
46749
47062
  // will change in the future: during onboarding the user should be
46750
47063
  // able to enable encryption. (Imagine if they are importing data from
46751
47064
  // another source, they should be able to encrypt first)
46752
47065
  handlers['key-make'] = async function ({ password }) {
46753
- if (!_prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs()) {
47066
+ if (!_prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs()) {
46754
47067
  throw new Error('user-set-key must be called with file loaded');
46755
47068
  }
46756
- const salt = _encryption__WEBPACK_IMPORTED_MODULE_30__.randomBytes(32).toString('base64');
46757
- const id = (0, uuid__WEBPACK_IMPORTED_MODULE_53__["default"])();
46758
- const key = await _encryption__WEBPACK_IMPORTED_MODULE_30__.createKey({
47069
+ const salt = _encryption__WEBPACK_IMPORTED_MODULE_31__.randomBytes(32).toString('base64');
47070
+ const id = (0, uuid__WEBPACK_IMPORTED_MODULE_54__["default"])();
47071
+ const key = await _encryption__WEBPACK_IMPORTED_MODULE_31__.createKey({
46759
47072
  id,
46760
47073
  password,
46761
47074
  salt
46762
47075
  });
46763
47076
  // Load the key
46764
- await _encryption__WEBPACK_IMPORTED_MODULE_30__.loadKey(key);
47077
+ await _encryption__WEBPACK_IMPORTED_MODULE_31__.loadKey(key);
46765
47078
  // Make some test data to use if the key is valid or not
46766
- const testContent = await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.makeTestMessage)(key.getId());
47079
+ const testContent = await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.makeTestMessage)(key.getId());
46767
47080
  // Changing your key necessitates a sync reset as well. This will
46768
47081
  // clear all existing encrypted data from the server so you won't
46769
47082
  // have a mix of data encrypted with different keys.
46770
- return await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.resetSync)({
47083
+ return await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.resetSync)({
46771
47084
  key,
46772
47085
  salt,
46773
47086
  testContent: JSON.stringify({
@@ -46781,11 +47094,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46781
47094
  handlers['key-test'] = async function ({ fileId, password }) {
46782
47095
  const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
46783
47096
  if (fileId == null) {
46784
- fileId = _prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs().cloudFileId;
47097
+ fileId = _prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs().cloudFileId;
46785
47098
  }
46786
47099
  let res;
46787
47100
  try {
46788
- res = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SYNC_SERVER + '/user-get-key', {
47101
+ res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SYNC_SERVER + '/user-get-key', {
46789
47102
  token: userToken,
46790
47103
  fileId
46791
47104
  });
@@ -46808,19 +47121,19 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46808
47121
  };
46809
47122
  }
46810
47123
  test = JSON.parse(test);
46811
- const key = await _encryption__WEBPACK_IMPORTED_MODULE_30__.createKey({
47124
+ const key = await _encryption__WEBPACK_IMPORTED_MODULE_31__.createKey({
46812
47125
  id,
46813
47126
  password,
46814
47127
  salt
46815
47128
  });
46816
- _encryption__WEBPACK_IMPORTED_MODULE_30__.loadKey(key);
47129
+ _encryption__WEBPACK_IMPORTED_MODULE_31__.loadKey(key);
46817
47130
  try {
46818
- await _encryption__WEBPACK_IMPORTED_MODULE_30__.decrypt(Buffer.from(test.value, 'base64'), test.meta);
47131
+ await _encryption__WEBPACK_IMPORTED_MODULE_31__.decrypt(Buffer.from(test.value, 'base64'), test.meta);
46819
47132
  }
46820
47133
  catch (e) {
46821
47134
  console.log(e);
46822
47135
  // Unload the key, it's invalid
46823
- _encryption__WEBPACK_IMPORTED_MODULE_30__.unloadKey(key);
47136
+ _encryption__WEBPACK_IMPORTED_MODULE_31__.unloadKey(key);
46824
47137
  return {
46825
47138
  error: {
46826
47139
  reason: 'decrypt-failure'
@@ -46834,8 +47147,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46834
47147
  // Save the key id in prefs if the are loaded. If they aren't, we
46835
47148
  // are testing a key to download a file and when the file is
46836
47149
  // actually downloaded it will update the prefs with the latest key id
46837
- if (_prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs()) {
46838
- await _prefs__WEBPACK_IMPORTED_MODULE_40__.savePrefs({
47150
+ if (_prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs()) {
47151
+ await _prefs__WEBPACK_IMPORTED_MODULE_41__.savePrefs({
46839
47152
  encryptKeyId: key.getId()
46840
47153
  });
46841
47154
  }
@@ -46845,13 +47158,13 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46845
47158
  return Boolean(await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('did-bootstrap'));
46846
47159
  };
46847
47160
  handlers['subscribe-needs-bootstrap'] = async function ({ url } = {}) {
46848
- if (url && !(0, _server_config__WEBPACK_IMPORTED_MODULE_44__.isValidBaseURL)(url)) {
47161
+ if (url && !(0, _server_config__WEBPACK_IMPORTED_MODULE_45__.isValidBaseURL)(url)) {
46849
47162
  return {
46850
47163
  error: 'get-server-failure'
46851
47164
  };
46852
47165
  }
46853
47166
  try {
46854
- if (!(0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)(url)) {
47167
+ if (!(0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)(url)) {
46855
47168
  return {
46856
47169
  bootstrapped: true,
46857
47170
  hasServer: false
@@ -46865,7 +47178,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46865
47178
  }
46866
47179
  let res;
46867
47180
  try {
46868
- res = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)(url).SIGNUP_SERVER + '/needs-bootstrap');
47181
+ res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)(url).SIGNUP_SERVER + '/needs-bootstrap');
46869
47182
  }
46870
47183
  catch (err) {
46871
47184
  return {
@@ -46887,32 +47200,49 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46887
47200
  }
46888
47201
  return {
46889
47202
  bootstrapped: res.data.bootstrapped,
46890
- loginMethod: res.data.loginMethod || 'password',
47203
+ availableLoginMethods: res.data.availableLoginMethods || [
47204
+ {
47205
+ method: 'password',
47206
+ active: true,
47207
+ displayName: 'Password'
47208
+ }
47209
+ ],
47210
+ multiuser: res.data.multiuser || false,
46891
47211
  hasServer: true
46892
47212
  };
46893
47213
  };
46894
- handlers['subscribe-bootstrap'] = async function ({ password }) {
47214
+ handlers['subscribe-bootstrap'] = async function (loginConfig) {
47215
+ try {
47216
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIGNUP_SERVER + '/bootstrap', loginConfig);
47217
+ }
47218
+ catch (err) {
47219
+ return {
47220
+ error: err.reason || 'network-failure'
47221
+ };
47222
+ }
47223
+ return {};
47224
+ };
47225
+ handlers['subscribe-get-login-methods'] = async function () {
46895
47226
  let res;
46896
47227
  try {
46897
- res = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SIGNUP_SERVER + '/bootstrap', {
46898
- password
46899
- });
47228
+ res = await fetch((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIGNUP_SERVER + '/login-methods').then((res) => res.json());
46900
47229
  }
46901
47230
  catch (err) {
46902
47231
  return {
46903
47232
  error: err.reason || 'network-failure'
46904
47233
  };
46905
47234
  }
46906
- if (res.token) {
46907
- await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.setItem('user-token', res.token);
46908
- return {};
47235
+ if (res.methods) {
47236
+ return {
47237
+ methods: res.methods
47238
+ };
46909
47239
  }
46910
47240
  return {
46911
47241
  error: 'internal'
46912
47242
  };
46913
47243
  };
46914
47244
  handlers['subscribe-get-user'] = async function () {
46915
- if (!(0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)()) {
47245
+ if (!(0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)()) {
46916
47246
  if (!await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('did-bootstrap')) {
46917
47247
  return null;
46918
47248
  }
@@ -46925,22 +47255,34 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46925
47255
  return null;
46926
47256
  }
46927
47257
  try {
46928
- const res = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SIGNUP_SERVER + '/validate', {
47258
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIGNUP_SERVER + '/validate', {
46929
47259
  headers: {
46930
47260
  'X-ACTUAL-TOKEN': userToken
46931
47261
  }
46932
47262
  });
46933
- const { status, reason } = JSON.parse(res);
47263
+ let tokenExpired = false;
47264
+ const { status, reason, data: { userName = null, permission = '', userId = null, displayName = null, loginMethod = null } = {} } = JSON.parse(res) || {};
46934
47265
  if (status === 'error') {
46935
47266
  if (reason === 'unauthorized') {
46936
47267
  return null;
46937
47268
  }
46938
- return {
46939
- offline: true
46940
- };
47269
+ else if (reason === 'token-expired') {
47270
+ tokenExpired = true;
47271
+ }
47272
+ else {
47273
+ return {
47274
+ offline: true
47275
+ };
47276
+ }
46941
47277
  }
46942
47278
  return {
46943
- offline: false
47279
+ offline: false,
47280
+ userName,
47281
+ permission,
47282
+ userId,
47283
+ displayName,
47284
+ loginMethod,
47285
+ tokenExpired
46944
47286
  };
46945
47287
  }
46946
47288
  catch (e) {
@@ -46958,7 +47300,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46958
47300
  };
46959
47301
  }
46960
47302
  try {
46961
- await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SIGNUP_SERVER + '/change-password', {
47303
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIGNUP_SERVER + '/change-password', {
46962
47304
  token: userToken,
46963
47305
  password
46964
47306
  });
@@ -46970,22 +47312,24 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46970
47312
  }
46971
47313
  return {};
46972
47314
  };
46973
- handlers['subscribe-sign-in'] = async function ({ password, loginMethod }) {
46974
- if (typeof loginMethod !== 'string' || loginMethod == null) {
46975
- loginMethod = 'password';
47315
+ handlers['subscribe-sign-in'] = async function (loginInfo) {
47316
+ if (typeof loginInfo.loginMethod !== 'string' || loginInfo.loginMethod == null) {
47317
+ loginInfo.loginMethod = 'password';
46976
47318
  }
46977
47319
  let res;
46978
47320
  try {
46979
- res = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().SIGNUP_SERVER + '/login', {
46980
- loginMethod,
46981
- password
46982
- });
47321
+ res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().SIGNUP_SERVER + '/login', loginInfo);
46983
47322
  }
46984
47323
  catch (err) {
46985
47324
  return {
46986
47325
  error: err.reason || 'network-failure'
46987
47326
  };
46988
47327
  }
47328
+ if (res.redirect_url) {
47329
+ return {
47330
+ redirect_url: res.redirect_url
47331
+ };
47332
+ }
46989
47333
  if (!res.token) {
46990
47334
  throw new Error('login: User token not set');
46991
47335
  }
@@ -46993,7 +47337,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
46993
47337
  return {};
46994
47338
  };
46995
47339
  handlers['subscribe-sign-out'] = async function () {
46996
- _encryption__WEBPACK_IMPORTED_MODULE_30__.unloadAllKeys();
47340
+ _encryption__WEBPACK_IMPORTED_MODULE_31__.unloadAllKeys();
46997
47341
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.multiRemove([
46998
47342
  'user-token',
46999
47343
  'encrypt-keys',
@@ -47002,15 +47346,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47002
47346
  ]);
47003
47347
  return 'ok';
47004
47348
  };
47349
+ handlers['subscribe-set-token'] = async function ({ token }) {
47350
+ await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.setItem('user-token', token);
47351
+ };
47005
47352
  handlers['get-server-version'] = async function () {
47006
- if (!(0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)()) {
47353
+ if (!(0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)()) {
47007
47354
  return {
47008
47355
  error: 'no-server'
47009
47356
  };
47010
47357
  }
47011
47358
  let version;
47012
47359
  try {
47013
- const res = await (0, _post__WEBPACK_IMPORTED_MODULE_38__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().BASE_SERVER + '/info');
47360
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/info');
47014
47361
  const info = JSON.parse(res);
47015
47362
  version = info.build.version;
47016
47363
  }
@@ -47024,7 +47371,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47024
47371
  };
47025
47372
  };
47026
47373
  handlers['get-server-url'] = async function () {
47027
- return (0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)() && (0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)().BASE_SERVER;
47374
+ return (0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)() && (0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER;
47028
47375
  };
47029
47376
  handlers['set-server-url'] = async function ({ url, validate = true }) {
47030
47377
  if (url == null) {
@@ -47034,7 +47381,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47034
47381
  url = url.replace(/\/+$/, '');
47035
47382
  if (validate) {
47036
47383
  // Validate the server is running
47037
- const result = await (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.runHandler)(handlers['subscribe-needs-bootstrap'], {
47384
+ const result = await (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.runHandler)(handlers['subscribe-needs-bootstrap'], {
47038
47385
  url
47039
47386
  });
47040
47387
  if ('error' in result) {
@@ -47046,11 +47393,17 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47046
47393
  }
47047
47394
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.setItem('server-url', url);
47048
47395
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.setItem('did-bootstrap', true);
47049
- (0, _server_config__WEBPACK_IMPORTED_MODULE_44__.setServer)(url);
47396
+ (0, _server_config__WEBPACK_IMPORTED_MODULE_45__.setServer)(url);
47050
47397
  return {};
47051
47398
  };
47052
47399
  handlers['sync'] = async function () {
47053
- return (0, _sync__WEBPACK_IMPORTED_MODULE_47__.fullSync)();
47400
+ return (0, _sync__WEBPACK_IMPORTED_MODULE_48__.fullSync)();
47401
+ };
47402
+ handlers['validate-budget-name'] = async function ({ name }) {
47403
+ return (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_53__.validateBudgetName)(name);
47404
+ };
47405
+ handlers['unique-budget-name'] = async function ({ name }) {
47406
+ return (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_53__.uniqueBudgetName)(name);
47054
47407
  };
47055
47408
  handlers['get-budgets'] = async function () {
47056
47409
  const paths = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.listDir(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getDocumentDir());
@@ -47081,6 +47434,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47081
47434
  ...prefs.groupId ? {
47082
47435
  groupId: prefs.groupId
47083
47436
  } : {},
47437
+ ...prefs.owner ? {
47438
+ owner: prefs.owner
47439
+ } : {},
47084
47440
  name: prefs.budgetName || '(no name)'
47085
47441
  };
47086
47442
  }
@@ -47090,23 +47446,26 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47090
47446
  return budgets;
47091
47447
  };
47092
47448
  handlers['get-remote-files'] = async function () {
47093
- return _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.listRemoteFiles();
47449
+ return _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.listRemoteFiles();
47450
+ };
47451
+ handlers['get-user-file-info'] = async function (fileId) {
47452
+ return _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.getRemoteFile(fileId);
47094
47453
  };
47095
- handlers['reset-budget-cache'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.mutator)(async function () {
47454
+ handlers['reset-budget-cache'] = (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.mutator)(async function () {
47096
47455
  // Recomputing everything will update the cache
47097
- await _sheet__WEBPACK_IMPORTED_MODULE_45__.loadUserBudgets(_db__WEBPACK_IMPORTED_MODULE_28__);
47098
- _sheet__WEBPACK_IMPORTED_MODULE_45__.get().recomputeAll();
47099
- await _sheet__WEBPACK_IMPORTED_MODULE_45__.waitOnSpreadsheet();
47456
+ await _sheet__WEBPACK_IMPORTED_MODULE_46__.loadUserBudgets(_db__WEBPACK_IMPORTED_MODULE_29__);
47457
+ _sheet__WEBPACK_IMPORTED_MODULE_46__.get().recomputeAll();
47458
+ await _sheet__WEBPACK_IMPORTED_MODULE_46__.waitOnSpreadsheet();
47100
47459
  });
47101
47460
  handlers['upload-budget'] = async function ({ id } = {}) {
47102
47461
  if (id) {
47103
- if (_prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs()) {
47462
+ if (_prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs()) {
47104
47463
  throw new Error('upload-budget: id given but prefs already loaded');
47105
47464
  }
47106
- await _prefs__WEBPACK_IMPORTED_MODULE_40__.loadPrefs(id);
47465
+ await _prefs__WEBPACK_IMPORTED_MODULE_41__.loadPrefs(id);
47107
47466
  }
47108
47467
  try {
47109
- await _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.upload();
47468
+ await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.upload();
47110
47469
  }
47111
47470
  catch (e) {
47112
47471
  console.log(e);
@@ -47124,7 +47483,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47124
47483
  }
47125
47484
  finally {
47126
47485
  if (id) {
47127
- _prefs__WEBPACK_IMPORTED_MODULE_40__.unloadPrefs();
47486
+ _prefs__WEBPACK_IMPORTED_MODULE_41__.unloadPrefs();
47128
47487
  }
47129
47488
  }
47130
47489
  return {};
@@ -47132,14 +47491,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47132
47491
  handlers['download-budget'] = async function ({ fileId }) {
47133
47492
  let result;
47134
47493
  try {
47135
- result = await _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.download(fileId);
47494
+ result = await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.download(fileId);
47136
47495
  }
47137
47496
  catch (e) {
47138
47497
  if (e.type === 'FileDownloadError') {
47139
47498
  if (e.reason === 'file-exists' && e.meta.id) {
47140
- await _prefs__WEBPACK_IMPORTED_MODULE_40__.loadPrefs(e.meta.id);
47141
- const name = _prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs().budgetName;
47142
- _prefs__WEBPACK_IMPORTED_MODULE_40__.unloadPrefs();
47499
+ await _prefs__WEBPACK_IMPORTED_MODULE_41__.loadPrefs(e.meta.id);
47500
+ const name = _prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs().budgetName;
47501
+ _prefs__WEBPACK_IMPORTED_MODULE_41__.unloadPrefs();
47143
47502
  e.meta = {
47144
47503
  ...e.meta,
47145
47504
  name
@@ -47172,12 +47531,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47172
47531
  };
47173
47532
  // open and sync, but don’t close
47174
47533
  handlers['sync-budget'] = async function () {
47175
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.setSyncingMode)('enabled');
47176
- const result = await (0, _sync__WEBPACK_IMPORTED_MODULE_47__.initialFullSync)();
47534
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.setSyncingMode)('enabled');
47535
+ const result = await (0, _sync__WEBPACK_IMPORTED_MODULE_48__.initialFullSync)();
47177
47536
  return result;
47178
47537
  };
47179
47538
  handlers['load-budget'] = async function ({ id }) {
47180
- const currentPrefs = _prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs();
47539
+ const currentPrefs = _prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs();
47181
47540
  if (currentPrefs) {
47182
47541
  if (currentPrefs.id === id) {
47183
47542
  // If it's already loaded, do nothing
@@ -47207,11 +47566,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47207
47566
  message: 'Closing budget'
47208
47567
  });
47209
47568
  // The spreadsheet may be running, wait for it to complete
47210
- await _sheet__WEBPACK_IMPORTED_MODULE_45__.waitOnSpreadsheet();
47211
- _sheet__WEBPACK_IMPORTED_MODULE_45__.unloadSpreadsheet();
47212
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.clearFullSyncTimeout)();
47213
- await _main_app__WEBPACK_IMPORTED_MODULE_34__.app.stopServices();
47214
- await _db__WEBPACK_IMPORTED_MODULE_28__.closeDatabase();
47569
+ await _sheet__WEBPACK_IMPORTED_MODULE_46__.waitOnSpreadsheet();
47570
+ _sheet__WEBPACK_IMPORTED_MODULE_46__.unloadSpreadsheet();
47571
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.clearFullSyncTimeout)();
47572
+ await _main_app__WEBPACK_IMPORTED_MODULE_35__.app.stopServices();
47573
+ await _db__WEBPACK_IMPORTED_MODULE_29__.closeDatabase();
47215
47574
  try {
47216
47575
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.setItem('lastBudget', '');
47217
47576
  }
@@ -47220,23 +47579,98 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47220
47579
  // budget. We want to unload whatever has already been loaded but
47221
47580
  // be resilient to anything failing
47222
47581
  }
47223
- _prefs__WEBPACK_IMPORTED_MODULE_40__.unloadPrefs();
47224
- (0, _backups__WEBPACK_IMPORTED_MODULE_23__.stopBackupService)();
47582
+ _prefs__WEBPACK_IMPORTED_MODULE_41__.unloadPrefs();
47583
+ await (0, _backups__WEBPACK_IMPORTED_MODULE_24__.stopBackupService)();
47225
47584
  return 'ok';
47226
47585
  };
47227
47586
  handlers['delete-budget'] = async function ({ id, cloudFileId }) {
47228
47587
  // If it's a cloud file, you can delete it from the server by
47229
47588
  // passing its cloud id
47230
47589
  if (cloudFileId) {
47231
- await _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.removeFile(cloudFileId).catch(() => { });
47590
+ await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.removeFile(cloudFileId).catch(() => { });
47232
47591
  }
47233
47592
  // If a local file exists, you can delete it by passing its local id
47234
47593
  if (id) {
47235
- const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getBudgetDir(id);
47236
- await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.removeDirRecursively(budgetDir);
47594
+ // opening and then closing the database is a hack to be able to delete
47595
+ // the budget file if it hasn't been opened yet. This needs a better
47596
+ // way, but works for now.
47597
+ try {
47598
+ await _db__WEBPACK_IMPORTED_MODULE_29__.openDatabase(id);
47599
+ await _db__WEBPACK_IMPORTED_MODULE_29__.closeDatabase();
47600
+ const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getBudgetDir(id);
47601
+ await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.removeDirRecursively(budgetDir);
47602
+ }
47603
+ catch (e) {
47604
+ return 'fail';
47605
+ }
47237
47606
  }
47238
47607
  return 'ok';
47239
47608
  };
47609
+ handlers['duplicate-budget'] = async function ({ id, newName, cloudSync, open }) {
47610
+ if (!id)
47611
+ throw new Error('Unable to duplicate a budget that is not local.');
47612
+ const { valid, message } = await (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_53__.validateBudgetName)(newName);
47613
+ if (!valid)
47614
+ throw new Error(message);
47615
+ const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getBudgetDir(id);
47616
+ const newId = await (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_53__.idFromBudgetName)(newName);
47617
+ // copy metadata from current budget
47618
+ // replace id with new budget id and budgetName with new budget name
47619
+ const metadataText = await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.readFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(budgetDir, 'metadata.json'));
47620
+ const metadata = JSON.parse(metadataText);
47621
+ metadata.id = newId;
47622
+ metadata.budgetName = newName;
47623
+ [
47624
+ 'cloudFileId',
47625
+ 'groupId',
47626
+ 'lastUploaded',
47627
+ 'encryptKeyId',
47628
+ 'lastSyncedTimestamp'
47629
+ ].forEach((item) => {
47630
+ if (metadata[item])
47631
+ delete metadata[item];
47632
+ });
47633
+ try {
47634
+ const newBudgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getBudgetDir(newId);
47635
+ await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.mkdir(newBudgetDir);
47636
+ // write metadata for new budget
47637
+ await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.writeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(newBudgetDir, 'metadata.json'), JSON.stringify(metadata));
47638
+ await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(budgetDir, 'db.sqlite'), _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(newBudgetDir, 'db.sqlite'));
47639
+ }
47640
+ catch (error) {
47641
+ // Clean up any partially created files
47642
+ try {
47643
+ const newBudgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getBudgetDir(newId);
47644
+ if (await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.exists(newBudgetDir)) {
47645
+ await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.removeDirRecursively(newBudgetDir);
47646
+ }
47647
+ }
47648
+ catch { } // Ignore cleanup errors
47649
+ throw new Error(`Failed to duplicate budget: ${error.message}`);
47650
+ }
47651
+ // load in and validate
47652
+ const { error } = await loadBudget(newId);
47653
+ if (error) {
47654
+ console.log('Error duplicating budget: ' + error);
47655
+ return error;
47656
+ }
47657
+ if (cloudSync) {
47658
+ try {
47659
+ await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.upload();
47660
+ }
47661
+ catch (error) {
47662
+ console.warn('Failed to sync duplicated budget to cloud:', error);
47663
+ // Ignore any errors uploading. If they are offline they should
47664
+ // still be able to create files.
47665
+ }
47666
+ }
47667
+ handlers['close-budget']();
47668
+ if (open === 'original')
47669
+ await loadBudget(id);
47670
+ if (open === 'copy')
47671
+ await loadBudget(newId);
47672
+ return newId;
47673
+ };
47240
47674
  handlers['create-budget'] = async function ({ budgetName, avoidUpload, testMode, testBudgetId } = {}) {
47241
47675
  let id;
47242
47676
  if (testMode) {
@@ -47249,19 +47683,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47249
47683
  else {
47250
47684
  // Generate budget name if not given
47251
47685
  if (!budgetName) {
47252
- // Unfortunately we need to load all of the existing files first
47253
- // so we can detect conflicting names.
47254
- const files = await handlers['get-budgets']();
47255
- budgetName = await (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_52__.uniqueFileName)(files);
47686
+ budgetName = await (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_53__.uniqueBudgetName)();
47256
47687
  }
47257
- id = await (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_52__.idFromFileName)(budgetName);
47688
+ id = await (0, _util_budget_name__WEBPACK_IMPORTED_MODULE_53__.idFromBudgetName)(budgetName);
47258
47689
  }
47259
47690
  const budgetDir = _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getBudgetDir(id);
47260
47691
  await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.mkdir(budgetDir);
47261
47692
  // Create the initial database
47262
47693
  await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.copyFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.bundledDatabasePath, _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(budgetDir, 'db.sqlite'));
47263
47694
  // Create the initial prefs file
47264
- await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.writeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(budgetDir, 'metadata.json'), JSON.stringify(_prefs__WEBPACK_IMPORTED_MODULE_40__.getDefaultPrefs(id, budgetName)));
47695
+ await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.writeFile(_platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.join(budgetDir, 'metadata.json'), JSON.stringify(_prefs__WEBPACK_IMPORTED_MODULE_41__.getDefaultPrefs(id, budgetName)));
47265
47696
  // Load it in
47266
47697
  const { error } = await loadBudget(id);
47267
47698
  if (error) {
@@ -47272,7 +47703,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47272
47703
  }
47273
47704
  if (!avoidUpload && !testMode) {
47274
47705
  try {
47275
- await _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.upload();
47706
+ await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.upload();
47276
47707
  }
47277
47708
  catch (e) {
47278
47709
  // Ignore any errors uploading. If they are offline they should
@@ -47290,7 +47721,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47290
47721
  throw new Error(`File not found at the provided path: ${filepath}`);
47291
47722
  }
47292
47723
  const buffer = Buffer.from(await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.readFile(filepath, 'binary'));
47293
- const results = await (0, _importers__WEBPACK_IMPORTED_MODULE_33__.handleBudgetImport)(type, filepath, buffer);
47724
+ const results = await (0, _importers__WEBPACK_IMPORTED_MODULE_34__.handleBudgetImport)(type, filepath, buffer);
47294
47725
  return results || {};
47295
47726
  }
47296
47727
  catch (err) {
@@ -47304,7 +47735,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47304
47735
  handlers['export-budget'] = async function () {
47305
47736
  try {
47306
47737
  return {
47307
- data: await _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.exportBuffer()
47738
+ data: await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.exportBuffer()
47308
47739
  };
47309
47740
  }
47310
47741
  catch (err) {
@@ -47315,6 +47746,116 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47315
47746
  };
47316
47747
  }
47317
47748
  };
47749
+ handlers['enable-openid'] = async function (loginConfig) {
47750
+ try {
47751
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
47752
+ if (!userToken) {
47753
+ return {
47754
+ error: 'unauthorized'
47755
+ };
47756
+ }
47757
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/openid/enable', loginConfig, {
47758
+ 'X-ACTUAL-TOKEN': userToken
47759
+ });
47760
+ }
47761
+ catch (err) {
47762
+ return {
47763
+ error: err.reason || 'network-failure'
47764
+ };
47765
+ }
47766
+ return {};
47767
+ };
47768
+ handlers['enable-password'] = async function (loginConfig) {
47769
+ try {
47770
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
47771
+ if (!userToken) {
47772
+ return {
47773
+ error: 'unauthorized'
47774
+ };
47775
+ }
47776
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/openid/disable', loginConfig, {
47777
+ 'X-ACTUAL-TOKEN': userToken
47778
+ });
47779
+ }
47780
+ catch (err) {
47781
+ return {
47782
+ error: err.reason || 'network-failure'
47783
+ };
47784
+ }
47785
+ return {};
47786
+ };
47787
+ handlers['get-openid-config'] = async function () {
47788
+ try {
47789
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/openid/config');
47790
+ if (res) {
47791
+ const config = JSON.parse(res);
47792
+ return {
47793
+ openId: config
47794
+ };
47795
+ }
47796
+ return null;
47797
+ }
47798
+ catch (err) {
47799
+ return {
47800
+ error: 'config-fetch-failed'
47801
+ };
47802
+ }
47803
+ };
47804
+ handlers['enable-openid'] = async function (loginConfig) {
47805
+ try {
47806
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
47807
+ if (!userToken) {
47808
+ return {
47809
+ error: 'unauthorized'
47810
+ };
47811
+ }
47812
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/openid/enable', loginConfig, {
47813
+ 'X-ACTUAL-TOKEN': userToken
47814
+ });
47815
+ }
47816
+ catch (err) {
47817
+ return {
47818
+ error: err.reason || 'network-failure'
47819
+ };
47820
+ }
47821
+ return {};
47822
+ };
47823
+ handlers['enable-password'] = async function (loginConfig) {
47824
+ try {
47825
+ const userToken = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
47826
+ if (!userToken) {
47827
+ return {
47828
+ error: 'unauthorized'
47829
+ };
47830
+ }
47831
+ await (0, _post__WEBPACK_IMPORTED_MODULE_39__.post)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/openid/disable', loginConfig, {
47832
+ 'X-ACTUAL-TOKEN': userToken
47833
+ });
47834
+ }
47835
+ catch (err) {
47836
+ return {
47837
+ error: err.reason || 'network-failure'
47838
+ };
47839
+ }
47840
+ return {};
47841
+ };
47842
+ handlers['get-openid-config'] = async function () {
47843
+ try {
47844
+ const res = await (0, _post__WEBPACK_IMPORTED_MODULE_39__.get)((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)().BASE_SERVER + '/openid/config');
47845
+ if (res) {
47846
+ const config = JSON.parse(res);
47847
+ return {
47848
+ openId: config
47849
+ };
47850
+ }
47851
+ return null;
47852
+ }
47853
+ catch (err) {
47854
+ return {
47855
+ error: 'config-fetch-failed'
47856
+ };
47857
+ }
47858
+ };
47318
47859
  async function loadBudget(id) {
47319
47860
  let dir;
47320
47861
  try {
@@ -47336,8 +47877,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47336
47877
  };
47337
47878
  }
47338
47879
  try {
47339
- await _prefs__WEBPACK_IMPORTED_MODULE_40__.loadPrefs(id);
47340
- await _db__WEBPACK_IMPORTED_MODULE_28__.openDatabase(id);
47880
+ await _prefs__WEBPACK_IMPORTED_MODULE_41__.loadPrefs(id);
47881
+ await _db__WEBPACK_IMPORTED_MODULE_29__.openDatabase(id);
47341
47882
  }
47342
47883
  catch (e) {
47343
47884
  (0, _platform_exceptions__WEBPACK_IMPORTED_MODULE_4__.captureBreadcrumb)({
@@ -47351,14 +47892,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47351
47892
  }
47352
47893
  // Older versions didn't tag the file with the current user, so do
47353
47894
  // so now
47354
- if (!_prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs().userId) {
47895
+ if (!_prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs().userId) {
47355
47896
  const userId = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('user-token');
47356
- _prefs__WEBPACK_IMPORTED_MODULE_40__.savePrefs({
47897
+ _prefs__WEBPACK_IMPORTED_MODULE_41__.savePrefs({
47357
47898
  userId
47358
47899
  });
47359
47900
  }
47360
47901
  try {
47361
- await (0, _update__WEBPACK_IMPORTED_MODULE_51__.updateVersion)();
47902
+ await (0, _update__WEBPACK_IMPORTED_MODULE_52__.updateVersion)();
47362
47903
  }
47363
47904
  catch (e) {
47364
47905
  console.warn('Error updating', e);
@@ -47384,8 +47925,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47384
47925
  await handlers['close-budget']();
47385
47926
  return result;
47386
47927
  }
47387
- await _db__WEBPACK_IMPORTED_MODULE_28__.loadClock();
47388
- if (_prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs().resetClock) {
47928
+ await _db__WEBPACK_IMPORTED_MODULE_29__.loadClock();
47929
+ if (_prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs().resetClock) {
47389
47930
  // If we need to generate a fresh clock, we need to generate a new
47390
47931
  // client id. This happens when the database is transferred to a
47391
47932
  // new device.
@@ -47393,18 +47934,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47393
47934
  // TODO: The client id should be stored elsewhere. It shouldn't
47394
47935
  // work this way, but it's fine for now.
47395
47936
  _actual_app_crdt__WEBPACK_IMPORTED_MODULE_2__.getClock().timestamp.setNode(_actual_app_crdt__WEBPACK_IMPORTED_MODULE_2__.makeClientId());
47396
- await _db__WEBPACK_IMPORTED_MODULE_28__.runQuery('INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)', [
47937
+ await _db__WEBPACK_IMPORTED_MODULE_29__.runQuery('INSERT OR REPLACE INTO messages_clock (id, clock) VALUES (1, ?)', [
47397
47938
  _actual_app_crdt__WEBPACK_IMPORTED_MODULE_2__.serializeClock(_actual_app_crdt__WEBPACK_IMPORTED_MODULE_2__.getClock())
47398
47939
  ]);
47399
- await _prefs__WEBPACK_IMPORTED_MODULE_40__.savePrefs({
47940
+ await _prefs__WEBPACK_IMPORTED_MODULE_41__.savePrefs({
47400
47941
  resetClock: false
47401
47942
  });
47402
47943
  }
47403
- if (!_platform__WEBPACK_IMPORTED_MODULE_37__.isWeb && !_platform__WEBPACK_IMPORTED_MODULE_37__.isMobile && "development" !== 'test') {
47404
- (0, _backups__WEBPACK_IMPORTED_MODULE_23__.startBackupService)(id);
47944
+ if (!_platform__WEBPACK_IMPORTED_MODULE_38__.isWeb && !_platform__WEBPACK_IMPORTED_MODULE_38__.isMobile && "development" !== 'test') {
47945
+ await (0, _backups__WEBPACK_IMPORTED_MODULE_24__.startBackupService)(id);
47405
47946
  }
47406
47947
  try {
47407
- await _sheet__WEBPACK_IMPORTED_MODULE_45__.loadSpreadsheet(_db__WEBPACK_IMPORTED_MODULE_28__, onSheetChange);
47948
+ await _sheet__WEBPACK_IMPORTED_MODULE_46__.loadSpreadsheet(_db__WEBPACK_IMPORTED_MODULE_29__, onSheetChange);
47408
47949
  }
47409
47950
  catch (e) {
47410
47951
  (0, _platform_exceptions__WEBPACK_IMPORTED_MODULE_4__.captureException)(e);
@@ -47414,56 +47955,56 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47414
47955
  };
47415
47956
  }
47416
47957
  // This is a bit leaky, but we need to set the initial budget type
47417
- const { value: budgetType = 'rollover' } = await _db__WEBPACK_IMPORTED_MODULE_28__.first('SELECT value from preferences WHERE id = ?', [
47958
+ const { value: budgetType = 'rollover' } = await _db__WEBPACK_IMPORTED_MODULE_29__.first('SELECT value from preferences WHERE id = ?', [
47418
47959
  'budgetType'
47419
47960
  ]) ?? {};
47420
- _sheet__WEBPACK_IMPORTED_MODULE_45__.get().meta().budgetType = budgetType;
47421
- await _budget_base__WEBPACK_IMPORTED_MODULE_25__.createAllBudgets();
47961
+ _sheet__WEBPACK_IMPORTED_MODULE_46__.get().meta().budgetType = budgetType;
47962
+ await _budget_base__WEBPACK_IMPORTED_MODULE_26__.createAllBudgets();
47422
47963
  // Load all the in-memory state
47423
- await _db_mappings__WEBPACK_IMPORTED_MODULE_29__.loadMappings();
47964
+ await _db_mappings__WEBPACK_IMPORTED_MODULE_30__.loadMappings();
47424
47965
  await _accounts_transaction_rules__WEBPACK_IMPORTED_MODULE_19__.loadRules();
47425
- await _sync_migrate__WEBPACK_IMPORTED_MODULE_48__.listen();
47426
- await _main_app__WEBPACK_IMPORTED_MODULE_34__.app.startServices();
47427
- (0, _undo__WEBPACK_IMPORTED_MODULE_50__.clearUndo)();
47966
+ await _sync_migrate__WEBPACK_IMPORTED_MODULE_49__.listen();
47967
+ await _main_app__WEBPACK_IMPORTED_MODULE_35__.app.startServices();
47968
+ (0, _undo__WEBPACK_IMPORTED_MODULE_51__.clearUndo)();
47428
47969
  // Ensure that syncing is enabled
47429
47970
  if (true) {
47430
47971
  if (id === DEMO_BUDGET_ID) {
47431
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.setSyncingMode)('disabled');
47972
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.setSyncingMode)('disabled');
47432
47973
  }
47433
47974
  else {
47434
- if ((0, _server_config__WEBPACK_IMPORTED_MODULE_44__.getServer)()) {
47435
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.setSyncingMode)('enabled');
47975
+ if ((0, _server_config__WEBPACK_IMPORTED_MODULE_45__.getServer)()) {
47976
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.setSyncingMode)('enabled');
47436
47977
  }
47437
47978
  else {
47438
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.setSyncingMode)('disabled');
47979
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.setSyncingMode)('disabled');
47439
47980
  }
47440
47981
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.setItem('lastBudget', id);
47441
47982
  // Only upload periodically on desktop
47442
- if (!_platform__WEBPACK_IMPORTED_MODULE_37__.isMobile) {
47443
- await _cloud_storage__WEBPACK_IMPORTED_MODULE_26__.possiblyUpload();
47983
+ if (!_platform__WEBPACK_IMPORTED_MODULE_38__.isMobile) {
47984
+ await _cloud_storage__WEBPACK_IMPORTED_MODULE_27__.possiblyUpload();
47444
47985
  }
47445
47986
  }
47446
47987
  }
47447
- _main_app__WEBPACK_IMPORTED_MODULE_34__.app.events.emit('load-budget', {
47988
+ _main_app__WEBPACK_IMPORTED_MODULE_35__.app.events.emit('load-budget', {
47448
47989
  id
47449
47990
  });
47450
47991
  return {};
47451
47992
  }
47452
47993
  handlers['upload-file-web'] = async function ({ filename, contents }) {
47453
- if (!_platform__WEBPACK_IMPORTED_MODULE_37__.isWeb) {
47994
+ if (!_platform__WEBPACK_IMPORTED_MODULE_38__.isWeb) {
47454
47995
  return null;
47455
47996
  }
47456
47997
  await _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.writeFile('/uploads/' + filename, contents);
47457
47998
  return {};
47458
47999
  };
47459
48000
  handlers['backups-get'] = async function ({ id }) {
47460
- return (0, _backups__WEBPACK_IMPORTED_MODULE_23__.getAvailableBackups)(id);
48001
+ return (0, _backups__WEBPACK_IMPORTED_MODULE_24__.getAvailableBackups)(id);
47461
48002
  };
47462
48003
  handlers['backup-load'] = async function ({ id, backupId }) {
47463
- await (0, _backups__WEBPACK_IMPORTED_MODULE_23__.loadBackup)(id, backupId);
48004
+ await (0, _backups__WEBPACK_IMPORTED_MODULE_24__.loadBackup)(id, backupId);
47464
48005
  };
47465
48006
  handlers['backup-make'] = async function ({ id }) {
47466
- await (0, _backups__WEBPACK_IMPORTED_MODULE_23__.makeBackup)(id);
48007
+ await (0, _backups__WEBPACK_IMPORTED_MODULE_24__.makeBackup)(id);
47467
48008
  };
47468
48009
  handlers['get-last-opened-backup'] = async function () {
47469
48010
  const id = await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.getItem('lastBudget');
@@ -47478,18 +48019,18 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47478
48019
  return null;
47479
48020
  };
47480
48021
  handlers['app-focused'] = async function () {
47481
- if (_prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs() && _prefs__WEBPACK_IMPORTED_MODULE_40__.getPrefs().id) {
48022
+ if (_prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs() && _prefs__WEBPACK_IMPORTED_MODULE_41__.getPrefs().id) {
47482
48023
  // First we sync
47483
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.fullSync)();
48024
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.fullSync)();
47484
48025
  }
47485
48026
  };
47486
- handlers = (0, _api__WEBPACK_IMPORTED_MODULE_21__.installAPI)(handlers);
47487
- _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_1__.override((name, args) => (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.runHandler)(_main_app__WEBPACK_IMPORTED_MODULE_34__.app.handlers[name], args));
48027
+ handlers = (0, _api__WEBPACK_IMPORTED_MODULE_22__.installAPI)(handlers);
48028
+ _actual_app_api_injected__WEBPACK_IMPORTED_MODULE_1__.override((name, args) => (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.runHandler)(_main_app__WEBPACK_IMPORTED_MODULE_35__.app.handlers[name], args));
47488
48029
  // A hack for now until we clean up everything
47489
- _main_app__WEBPACK_IMPORTED_MODULE_34__.app.handlers = handlers;
47490
- _main_app__WEBPACK_IMPORTED_MODULE_34__.app.combine(_schedules_app__WEBPACK_IMPORTED_MODULE_43__.app, _budget_app__WEBPACK_IMPORTED_MODULE_24__.app, _dashboard_app__WEBPACK_IMPORTED_MODULE_27__.app, _notes_app__WEBPACK_IMPORTED_MODULE_36__.app, _preferences_app__WEBPACK_IMPORTED_MODULE_39__.app, _tools_app__WEBPACK_IMPORTED_MODULE_49__.app, _filters_app__WEBPACK_IMPORTED_MODULE_32__.app, _reports_app__WEBPACK_IMPORTED_MODULE_41__.app, _rules_app__WEBPACK_IMPORTED_MODULE_42__.app);
48030
+ _main_app__WEBPACK_IMPORTED_MODULE_35__.app.handlers = handlers;
48031
+ _main_app__WEBPACK_IMPORTED_MODULE_35__.app.combine(_schedules_app__WEBPACK_IMPORTED_MODULE_44__.app, _budget_app__WEBPACK_IMPORTED_MODULE_25__.app, _dashboard_app__WEBPACK_IMPORTED_MODULE_28__.app, _notes_app__WEBPACK_IMPORTED_MODULE_37__.app, _preferences_app__WEBPACK_IMPORTED_MODULE_40__.app, _tools_app__WEBPACK_IMPORTED_MODULE_50__.app, _filters_app__WEBPACK_IMPORTED_MODULE_33__.app, _reports_app__WEBPACK_IMPORTED_MODULE_42__.app, _rules_app__WEBPACK_IMPORTED_MODULE_43__.app, _admin_app__WEBPACK_IMPORTED_MODULE_21__.app);
47491
48032
  function getDefaultDocumentDir() {
47492
- if (_platform__WEBPACK_IMPORTED_MODULE_37__.isMobile) {
48033
+ if (_platform__WEBPACK_IMPORTED_MODULE_38__.isMobile) {
47493
48034
  // On mobile, unfortunately we need to be backwards compatible
47494
48035
  // with the old folder structure which does not store files inside
47495
48036
  // of an `Actual` directory. In the future, if we really care, we
@@ -47536,7 +48077,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47536
48077
  const keys = JSON.parse(keysStr);
47537
48078
  // Load all the keys
47538
48079
  await Promise.all(Object.keys(keys).map((fileId) => {
47539
- return _encryption__WEBPACK_IMPORTED_MODULE_30__.loadKey(keys[fileId]);
48080
+ return _encryption__WEBPACK_IMPORTED_MODULE_31__.loadKey(keys[fileId]);
47540
48081
  }));
47541
48082
  }
47542
48083
  catch (e) {
@@ -47548,15 +48089,15 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47548
48089
  if (!url) {
47549
48090
  await _platform_server_asyncStorage__WEBPACK_IMPORTED_MODULE_5__.removeItem('user-token');
47550
48091
  }
47551
- (0, _server_config__WEBPACK_IMPORTED_MODULE_44__.setServer)(url);
47552
- _platform_server_connection__WEBPACK_IMPORTED_MODULE_6__.init(socketName, _main_app__WEBPACK_IMPORTED_MODULE_34__.app.handlers);
48092
+ (0, _server_config__WEBPACK_IMPORTED_MODULE_45__.setServer)(url);
48093
+ _platform_server_connection__WEBPACK_IMPORTED_MODULE_6__.init(socketName, _main_app__WEBPACK_IMPORTED_MODULE_35__.app.handlers);
47553
48094
  // Allow running DB queries locally
47554
- global.$query = _aql__WEBPACK_IMPORTED_MODULE_22__.runQuery;
48095
+ global.$query = _aql__WEBPACK_IMPORTED_MODULE_23__.runQuery;
47555
48096
  global.$q = _shared_query__WEBPACK_IMPORTED_MODULE_12__.q;
47556
48097
  if (isDev) {
47557
- global.$send = (name, args) => (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.runHandler)(_main_app__WEBPACK_IMPORTED_MODULE_34__.app.handlers[name], args);
47558
- global.$db = _db__WEBPACK_IMPORTED_MODULE_28__;
47559
- global.$setSyncingMode = _sync__WEBPACK_IMPORTED_MODULE_47__.setSyncingMode;
48098
+ global.$send = (name, args) => (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.runHandler)(_main_app__WEBPACK_IMPORTED_MODULE_35__.app.handlers[name], args);
48099
+ global.$db = _db__WEBPACK_IMPORTED_MODULE_29__;
48100
+ global.$setSyncingMode = _sync__WEBPACK_IMPORTED_MODULE_48__.setSyncingMode;
47560
48101
  }
47561
48102
  }
47562
48103
  // eslint-disable-next-line import/no-unused-modules
@@ -47580,9 +48121,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47580
48121
  ]);
47581
48122
  _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__._setDocumentDir(dataDir || process.cwd());
47582
48123
  if (serverURL) {
47583
- (0, _server_config__WEBPACK_IMPORTED_MODULE_44__.setServer)(serverURL);
48124
+ (0, _server_config__WEBPACK_IMPORTED_MODULE_45__.setServer)(serverURL);
47584
48125
  if (config.password) {
47585
- await (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.runHandler)(handlers['subscribe-sign-in'], {
48126
+ await (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.runHandler)(handlers['subscribe-sign-in'], {
47586
48127
  password: config.password
47587
48128
  });
47588
48129
  }
@@ -47590,9 +48131,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47590
48131
  else {
47591
48132
  // This turns off all server URLs. In this mode we don't want any
47592
48133
  // access to the server, we are doing things locally
47593
- (0, _server_config__WEBPACK_IMPORTED_MODULE_44__.setServer)(null);
47594
- _main_app__WEBPACK_IMPORTED_MODULE_34__.app.events.on('load-budget', () => {
47595
- (0, _sync__WEBPACK_IMPORTED_MODULE_47__.setSyncingMode)('offline');
48134
+ (0, _server_config__WEBPACK_IMPORTED_MODULE_45__.setServer)(null);
48135
+ _main_app__WEBPACK_IMPORTED_MODULE_35__.app.events.on('load-budget', () => {
48136
+ (0, _sync__WEBPACK_IMPORTED_MODULE_48__.setSyncingMode)('offline');
47596
48137
  });
47597
48138
  }
47598
48139
  return lib;
@@ -47603,12 +48144,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
47603
48144
  getDataDir: _platform_server_fs__WEBPACK_IMPORTED_MODULE_7__.getDataDir,
47604
48145
  sendMessage: (msg, args) => _platform_server_connection__WEBPACK_IMPORTED_MODULE_6__.send(msg, args),
47605
48146
  send: async (name, args) => {
47606
- const res = await (0, _mutators__WEBPACK_IMPORTED_MODULE_35__.runHandler)(_main_app__WEBPACK_IMPORTED_MODULE_34__.app.handlers[name], args);
48147
+ const res = await (0, _mutators__WEBPACK_IMPORTED_MODULE_36__.runHandler)(_main_app__WEBPACK_IMPORTED_MODULE_35__.app.handlers[name], args);
47607
48148
  return res;
47608
48149
  },
47609
- on: (name, func) => _main_app__WEBPACK_IMPORTED_MODULE_34__.app.events.on(name, func),
48150
+ on: (name, func) => _main_app__WEBPACK_IMPORTED_MODULE_35__.app.events.on(name, func),
47610
48151
  q: _shared_query__WEBPACK_IMPORTED_MODULE_12__.q,
47611
- db: _db__WEBPACK_IMPORTED_MODULE_28__
48152
+ db: _db__WEBPACK_IMPORTED_MODULE_29__
47612
48153
  };
47613
48154
  /***/
47614
48155
  }),
@@ -48047,7 +48588,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
48047
48588
  "use strict";
48048
48589
  __webpack_require__.r(__webpack_exports__);
48049
48590
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
48591
+ /* harmony export */ del: () => ( /* binding */del),
48050
48592
  /* harmony export */ get: () => ( /* binding */get),
48593
+ /* harmony export */ patch: () => ( /* binding */patch),
48051
48594
  /* harmony export */ post: () => ( /* binding */post),
48052
48595
  /* harmony export */ postBinary: () => ( /* binding */postBinary)
48053
48596
  /* harmony export */
@@ -48079,7 +48622,45 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
48079
48622
  throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError(text);
48080
48623
  }
48081
48624
  }
48082
- async function post(url, data, headers = {}, timeout = null) {
48625
+ async function post(url, data, headers = {}, timeout = null) {
48626
+ let text;
48627
+ let res;
48628
+ try {
48629
+ const controller = new AbortController();
48630
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
48631
+ const signal = timeout ? controller.signal : null;
48632
+ res = await (0, _platform_server_fetch__WEBPACK_IMPORTED_MODULE_0__.fetch)(url, {
48633
+ method: 'POST',
48634
+ body: JSON.stringify(data),
48635
+ signal,
48636
+ headers: {
48637
+ ...headers,
48638
+ 'Content-Type': 'application/json'
48639
+ }
48640
+ });
48641
+ clearTimeout(timeoutId);
48642
+ text = await res.text();
48643
+ }
48644
+ catch (err) {
48645
+ throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError('network-failure');
48646
+ }
48647
+ throwIfNot200(res, text);
48648
+ try {
48649
+ res = JSON.parse(text);
48650
+ }
48651
+ catch (err) {
48652
+ // Something seriously went wrong. TODO handle errors
48653
+ throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError('parse-json', {
48654
+ meta: text
48655
+ });
48656
+ }
48657
+ if (res.status !== 'ok') {
48658
+ console.log('API call failed: ' + url + '\nData: ' + JSON.stringify(data, null, 2) + '\nResponse: ' + JSON.stringify(res, null, 2));
48659
+ throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError(res.description || res.reason || 'unknown');
48660
+ }
48661
+ return res.data;
48662
+ }
48663
+ async function del(url, data, headers = {}, timeout = null) {
48083
48664
  let text;
48084
48665
  let res;
48085
48666
  try {
@@ -48087,7 +48668,45 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
48087
48668
  const timeoutId = setTimeout(() => controller.abort(), timeout);
48088
48669
  const signal = timeout ? controller.signal : null;
48089
48670
  res = await (0, _platform_server_fetch__WEBPACK_IMPORTED_MODULE_0__.fetch)(url, {
48090
- method: 'POST',
48671
+ method: 'DELETE',
48672
+ body: JSON.stringify(data),
48673
+ signal,
48674
+ headers: {
48675
+ ...headers,
48676
+ 'Content-Type': 'application/json'
48677
+ }
48678
+ });
48679
+ clearTimeout(timeoutId);
48680
+ text = await res.text();
48681
+ }
48682
+ catch (err) {
48683
+ throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError('network-failure');
48684
+ }
48685
+ throwIfNot200(res, text);
48686
+ try {
48687
+ res = JSON.parse(text);
48688
+ }
48689
+ catch (err) {
48690
+ // Something seriously went wrong. TODO handle errors
48691
+ throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError('parse-json', {
48692
+ meta: text
48693
+ });
48694
+ }
48695
+ if (res.status !== 'ok') {
48696
+ console.log('API call failed: ' + url + '\nData: ' + JSON.stringify(data, null, 2) + '\nResponse: ' + JSON.stringify(res, null, 2));
48697
+ throw new _errors__WEBPACK_IMPORTED_MODULE_1__.PostError(res.description || res.reason || 'unknown');
48698
+ }
48699
+ return res.data;
48700
+ }
48701
+ async function patch(url, data, headers = {}, timeout = null) {
48702
+ let text;
48703
+ let res;
48704
+ try {
48705
+ const controller = new AbortController();
48706
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
48707
+ const signal = timeout ? controller.signal : null;
48708
+ res = await (0, _platform_server_fetch__WEBPACK_IMPORTED_MODULE_0__.fetch)(url, {
48709
+ method: 'PATCH',
48091
48710
  body: JSON.stringify(data),
48092
48711
  signal,
48093
48712
  headers: {
@@ -51336,65 +51955,77 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
51336
51955
  /* harmony export */ app: () => ( /* binding */app)
51337
51956
  /* harmony export */
51338
51957
  });
51339
- /* harmony import */ var _accounts_transactions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../accounts/transactions */ "./packages/loot-core/src/server/accounts/transactions.ts");
51340
- /* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.ts");
51341
- /* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.ts");
51342
- /* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.ts");
51958
+ /* harmony import */ var _shared_query__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../shared/query */ "./packages/loot-core/src/shared/query.ts");
51959
+ /* harmony import */ var _accounts_transactions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../accounts/transactions */ "./packages/loot-core/src/server/accounts/transactions.ts");
51960
+ /* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../app */ "./packages/loot-core/src/server/app.ts");
51961
+ /* harmony import */ var _aql__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../aql */ "./packages/loot-core/src/server/aql/index.ts");
51962
+ /* harmony import */ var _db__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../db */ "./packages/loot-core/src/server/db/index.ts");
51963
+ /* harmony import */ var _mutators__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../mutators */ "./packages/loot-core/src/server/mutators.ts");
51343
51964
  // @ts-strict-ignore
51344
- const app = (0, _app__WEBPACK_IMPORTED_MODULE_1__.createApp)();
51965
+ const app = (0, _app__WEBPACK_IMPORTED_MODULE_2__.createApp)();
51345
51966
  app.method('tools/fix-split-transactions', async () => {
51346
51967
  // 1. Check for child transactions that have a blank payee, and set
51347
51968
  // the payee to whatever the parent has
51348
- const blankPayeeRows = await _db__WEBPACK_IMPORTED_MODULE_2__.all(`
51969
+ const blankPayeeRows = await _db__WEBPACK_IMPORTED_MODULE_4__.all(`
51349
51970
  SELECT t.*, p.payee AS parentPayee FROM v_transactions_internal t
51350
51971
  LEFT JOIN v_transactions_internal p ON t.parent_id = p.id
51351
51972
  WHERE t.is_child = 1 AND t.payee IS NULL AND p.payee IS NOT NULL
51352
51973
  `);
51353
- await (0, _mutators__WEBPACK_IMPORTED_MODULE_3__.runMutator)(async () => {
51974
+ await (0, _mutators__WEBPACK_IMPORTED_MODULE_5__.runMutator)(async () => {
51354
51975
  const updated = blankPayeeRows.map((row) => ({
51355
51976
  id: row.id,
51356
51977
  payee: row.parentPayee
51357
51978
  }));
51358
- await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_0__.batchUpdateTransactions)({
51979
+ await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_1__.batchUpdateTransactions)({
51359
51980
  updated
51360
51981
  });
51361
51982
  });
51362
51983
  // 2. Make sure the "cleared" flag is synced up with the parent
51363
51984
  // transactions
51364
- const clearedRows = await _db__WEBPACK_IMPORTED_MODULE_2__.all(`
51985
+ const clearedRows = await _db__WEBPACK_IMPORTED_MODULE_4__.all(`
51365
51986
  SELECT t.id, p.cleared FROM v_transactions_internal t
51366
51987
  LEFT JOIN v_transactions_internal p ON t.parent_id = p.id
51367
51988
  WHERE t.is_child = 1 AND t.cleared != p.cleared
51368
51989
  `);
51369
- await (0, _mutators__WEBPACK_IMPORTED_MODULE_3__.runMutator)(async () => {
51990
+ await (0, _mutators__WEBPACK_IMPORTED_MODULE_5__.runMutator)(async () => {
51370
51991
  const updated = clearedRows.map((row) => ({
51371
51992
  id: row.id,
51372
51993
  cleared: row.cleared === 1
51373
51994
  }));
51374
- await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_0__.batchUpdateTransactions)({
51995
+ await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_1__.batchUpdateTransactions)({
51375
51996
  updated
51376
51997
  });
51377
51998
  });
51378
51999
  // 3. Mark the `tombstone` field as true on any child transactions
51379
52000
  // that have a dead parent
51380
- const deletedRows = await _db__WEBPACK_IMPORTED_MODULE_2__.all(`
52001
+ const deletedRows = await _db__WEBPACK_IMPORTED_MODULE_4__.all(`
51381
52002
  SELECT t.* FROM v_transactions_internal t
51382
52003
  LEFT JOIN v_transactions_internal p ON t.parent_id = p.id
51383
52004
  WHERE t.is_child = 1 AND t.tombstone = 0 AND (p.tombstone = 1 OR p.id IS NULL)
51384
52005
  `);
51385
- await (0, _mutators__WEBPACK_IMPORTED_MODULE_3__.runMutator)(async () => {
52006
+ await (0, _mutators__WEBPACK_IMPORTED_MODULE_5__.runMutator)(async () => {
51386
52007
  const updated = deletedRows.map((row) => ({
51387
52008
  id: row.id,
51388
52009
  tombstone: 1
51389
52010
  }));
51390
- await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_0__.batchUpdateTransactions)({
52011
+ await (0, _accounts_transactions__WEBPACK_IMPORTED_MODULE_1__.batchUpdateTransactions)({
51391
52012
  updated
51392
52013
  });
51393
52014
  });
52015
+ const splitTransactions = (await (0, _aql__WEBPACK_IMPORTED_MODULE_3__.runQuery)((0, _shared_query__WEBPACK_IMPORTED_MODULE_0__.q)('transactions').options({
52016
+ splits: 'grouped'
52017
+ }).filter({
52018
+ is_parent: true
52019
+ }).select('*'))).data;
52020
+ const mismatchedSplits = splitTransactions.filter((t) => {
52021
+ const subValue = t.subtransactions.reduce((acc, st) => acc + st.amount, 0);
52022
+ return subValue !== t.amount;
52023
+ });
51394
52024
  return {
51395
52025
  numBlankPayees: blankPayeeRows.length,
51396
52026
  numCleared: clearedRows.length,
51397
- numDeleted: deletedRows.length
52027
+ numDeleted: deletedRows.length,
52028
+ mismatchedSplits
51398
52029
  };
51399
52030
  });
51400
52031
  /***/
@@ -51693,27 +52324,47 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
51693
52324
  "use strict";
51694
52325
  __webpack_require__.r(__webpack_exports__);
51695
52326
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
51696
- /* harmony export */ idFromFileName: () => ( /* binding */idFromFileName),
51697
- /* harmony export */ uniqueFileName: () => ( /* binding */uniqueFileName)
52327
+ /* harmony export */ idFromBudgetName: () => ( /* binding */idFromBudgetName),
52328
+ /* harmony export */ uniqueBudgetName: () => ( /* binding */uniqueBudgetName),
52329
+ /* harmony export */ validateBudgetName: () => ( /* binding */validateBudgetName)
51698
52330
  /* harmony export */
51699
52331
  });
51700
- /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-node/v4.js");
52332
+ /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-node/v4.js");
51701
52333
  /* harmony import */ var _platform_server_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../platform/server/fs */ "./packages/loot-core/src/platform/server/fs/index.electron.ts");
51702
- // @ts-strict-ignore
51703
- async function uniqueFileName(existingFiles) {
51704
- const initialName = 'My Finances';
52334
+ /* harmony import */ var _main__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../main */ "./packages/loot-core/src/server/main.ts");
52335
+ async function uniqueBudgetName(initialName = 'My Finances') {
52336
+ const budgets = await _main__WEBPACK_IMPORTED_MODULE_1__.handlers['get-budgets']();
51705
52337
  let idx = 1;
51706
52338
  // If there is a conflict, keep appending an index until there is no
51707
52339
  // conflict and we have a unique name
51708
52340
  let newName = initialName;
51709
- while (existingFiles.find((file) => file.name === newName)) {
52341
+ while (budgets.find((file) => file.name === newName)) {
51710
52342
  newName = `${initialName} ${idx}`;
51711
52343
  idx++;
51712
52344
  }
51713
52345
  return newName;
51714
52346
  }
51715
- async function idFromFileName(name) {
51716
- let id = name.replace(/( |[^A-Za-z0-9])/g, '-') + '-' + (0, uuid__WEBPACK_IMPORTED_MODULE_1__["default"])().slice(0, 7);
52347
+ async function validateBudgetName(name) {
52348
+ const trimmedName = name.trim();
52349
+ const uniqueName = await uniqueBudgetName(trimmedName);
52350
+ let message = null;
52351
+ if (trimmedName === '')
52352
+ message = 'Budget name cannot be blank';
52353
+ if (trimmedName.length > 100) {
52354
+ message = 'Budget name is too long (max length 100)';
52355
+ }
52356
+ if (uniqueName !== trimmedName) {
52357
+ message = `“${name}” already exists, try “${uniqueName}” instead`;
52358
+ }
52359
+ return message ? {
52360
+ valid: false,
52361
+ message
52362
+ } : {
52363
+ valid: true
52364
+ };
52365
+ }
52366
+ async function idFromBudgetName(name) {
52367
+ let id = name.replace(/( |[^A-Za-z0-9])/g, '-') + '-' + (0, uuid__WEBPACK_IMPORTED_MODULE_2__["default"])().slice(0, 7);
51717
52368
  // Make sure the id is unique. There's a chance one could already
51718
52369
  // exist (although very unlikely now that we append unique
51719
52370
  // characters onto the id)
@@ -51949,9 +52600,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
51949
52600
  /* harmony export */ getBankSyncError: () => ( /* binding */getBankSyncError),
51950
52601
  /* harmony export */ getCreateKeyError: () => ( /* binding */getCreateKeyError),
51951
52602
  /* harmony export */ getDownloadError: () => ( /* binding */getDownloadError),
52603
+ /* harmony export */ getOpenIdErrors: () => ( /* binding */getOpenIdErrors),
52604
+ /* harmony export */ getSecretsError: () => ( /* binding */getSecretsError),
51952
52605
  /* harmony export */ getSyncError: () => ( /* binding */getSyncError),
51953
52606
  /* harmony export */ getTestKeyError: () => ( /* binding */getTestKeyError),
51954
- /* harmony export */ getUploadError: () => ( /* binding */getUploadError)
52607
+ /* harmony export */ getUploadError: () => ( /* binding */getUploadError),
52608
+ /* harmony export */ getUserAccessErrors: () => ( /* binding */getUserAccessErrors)
51955
52609
  /* harmony export */
51956
52610
  });
51957
52611
  /* harmony import */ var i18next__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! i18next */ "./node_modules/i18next/dist/esm/i18next.js");
@@ -52045,6 +52699,50 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52045
52699
  this.cause = cause;
52046
52700
  }
52047
52701
  }
52702
+ function getUserAccessErrors(reason) {
52703
+ switch (reason) {
52704
+ case 'unauthorized':
52705
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('You are not logged in.');
52706
+ case 'token-expired':
52707
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('Login expired, please login again.');
52708
+ case 'user-cant-be-empty':
52709
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('Please select a user.');
52710
+ case 'invalid-file-id':
52711
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('This file is invalid.');
52712
+ case 'file-denied':
52713
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('You don`t have permissions over this file.');
52714
+ case 'user-already-have-access':
52715
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('User already has access.');
52716
+ default:
52717
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('An internal error occurred, sorry! Visit https://actualbudget.org/contact/ for support. (ref: {{reason}})', {
52718
+ reason
52719
+ });
52720
+ }
52721
+ }
52722
+ function getSecretsError(error, reason) {
52723
+ switch (reason) {
52724
+ case 'unauthorized':
52725
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('You are not logged in.');
52726
+ case 'not-admin':
52727
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('You have to be admin to set secrets');
52728
+ default:
52729
+ return error;
52730
+ }
52731
+ }
52732
+ function getOpenIdErrors(reason) {
52733
+ switch (reason) {
52734
+ case 'unauthorized':
52735
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('You are not logged in.');
52736
+ case 'configuration-error':
52737
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('This configuration is not valid. Please check it again.');
52738
+ case 'unable-to-change-file-config-enabled':
52739
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('Unable to enable OpenID. Please update the config.json file in this case.');
52740
+ default:
52741
+ return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('An internal error occurred, sorry! Visit https://actualbudget.org/contact/ for support. (ref: {{reason}})', {
52742
+ reason
52743
+ });
52744
+ }
52745
+ }
52048
52746
  /***/
52049
52747
  }),
52050
52748
  /***/ "./packages/loot-core/src/shared/months.ts":
@@ -52537,19 +53235,22 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52537
53235
  exprs
52538
53236
  ];
52539
53237
  }
52540
- const query = new Query({
53238
+ return new Query({
52541
53239
  ...this.state,
52542
- selectExpressions: exprs
53240
+ selectExpressions: exprs,
53241
+ calculation: false
52543
53242
  });
52544
- query.state.calculation = false;
52545
- return query;
52546
53243
  }
52547
53244
  calculate(expr) {
52548
- const query = this.select({
52549
- result: expr
53245
+ return new Query({
53246
+ ...this.state,
53247
+ selectExpressions: [
53248
+ {
53249
+ result: expr
53250
+ }
53251
+ ],
53252
+ calculation: true
52550
53253
  });
52551
- query.state.calculation = true;
52552
- return query;
52553
53254
  }
52554
53255
  groupBy(exprs) {
52555
53256
  if (!Array.isArray(exprs)) {
@@ -52621,6 +53322,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52621
53322
  serialize() {
52622
53323
  return this.state;
52623
53324
  }
53325
+ serializeAsString() {
53326
+ return JSON.stringify(this.serialize());
53327
+ }
52624
53328
  }
52625
53329
  function getPrimaryOrderBy(query, defaultOrderBy) {
52626
53330
  const orderExprs = query.serialize().orderExpressions;
@@ -52702,7 +53406,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52702
53406
  'oneOf',
52703
53407
  'isNot',
52704
53408
  'doesNotContain',
52705
- 'notOneOf'
53409
+ 'notOneOf',
53410
+ 'onBudget',
53411
+ 'offBudget'
52706
53412
  ],
52707
53413
  nullable: true
52708
53414
  },
@@ -52750,7 +53456,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52750
53456
  ])
52751
53457
  },
52752
53458
  payee: {
52753
- type: 'id'
53459
+ type: 'id',
53460
+ disallowedOps: new Set([
53461
+ 'onBudget',
53462
+ 'offBudget'
53463
+ ])
52754
53464
  },
52755
53465
  payee_name: {
52756
53466
  type: 'string'
@@ -52766,6 +53476,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52766
53476
  },
52767
53477
  category: {
52768
53478
  type: 'id',
53479
+ disallowedOps: new Set([
53480
+ 'onBudget',
53481
+ 'offBudget'
53482
+ ]),
52769
53483
  internalOps: new Set([
52770
53484
  'and'
52771
53485
  ])
@@ -52897,6 +53611,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
52897
53611
  return (0, i18next__WEBPACK_IMPORTED_MODULE_0__.t)('and');
52898
53612
  case 'or':
52899
53613
  return 'or';
53614
+ case 'onBudget':
53615
+ return 'is on budget';
53616
+ case 'offBudget':
53617
+ return 'is off budget';
52900
53618
  default:
52901
53619
  return '';
52902
53620
  }
@@ -53351,6 +54069,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
53351
54069
  };
53352
54070
  }
53353
54071
  function getScheduledAmount(amount, inverse = false) {
54072
+ // this check is temporary, and required at the moment as a schedule rule
54073
+ // allows the amount condition to be deleted which causes a crash
54074
+ if (amount == null)
54075
+ return 0;
53354
54076
  if (typeof amount === 'number') {
53355
54077
  return inverse ? -amount : amount;
53356
54078
  }
@@ -53736,10 +54458,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
53736
54458
  /* harmony export */ hasFieldsChanged: () => ( /* binding */hasFieldsChanged),
53737
54459
  /* harmony export */ integerToAmount: () => ( /* binding */integerToAmount),
53738
54460
  /* harmony export */ integerToCurrency: () => ( /* binding */integerToCurrency),
53739
- /* harmony export */ isNumberFormat: () => ( /* binding */isNumberFormat),
53740
54461
  /* harmony export */ last: () => ( /* binding */last),
53741
54462
  /* harmony export */ looselyParseAmount: () => ( /* binding */looselyParseAmount),
53742
54463
  /* harmony export */ numberFormats: () => ( /* binding */numberFormats),
54464
+ /* harmony export */ parseNumberFormat: () => ( /* binding */parseNumberFormat),
53743
54465
  /* harmony export */ partitionByField: () => ( /* binding */partitionByField),
53744
54466
  /* harmony export */ safeNumber: () => ( /* binding */safeNumber),
53745
54467
  /* harmony export */ setIn: () => ( /* binding */setIn),
@@ -53973,6 +54695,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
53973
54695
  format: 'comma-dot',
53974
54696
  hideFraction: false
53975
54697
  };
54698
+ function parseNumberFormat({ format, hideFraction }) {
54699
+ return {
54700
+ format: isNumberFormat(format) ? format : 'comma-dot',
54701
+ hideFraction: String(hideFraction) === 'true'
54702
+ };
54703
+ }
53976
54704
  function setNumberFormat(config) {
53977
54705
  numberFormatConfig = config;
53978
54706
  }
@@ -54485,7 +55213,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
54485
55213
  (function () {
54486
55214
  "use strict";
54487
55215
  var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA, hasProp = {}.hasOwnProperty;
54488
- builder = __webpack_require__(/*! xmlbuilder */ "./node_modules/xmlbuilder/lib/index.js");
55216
+ builder = __webpack_require__(/*! xmlbuilder */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/index.js");
54489
55217
  defaults = (__webpack_require__(/*! ./defaults */ "./node_modules/xml2js/lib/defaults.js").defaults);
54490
55218
  requiresCDATA = function (entry) {
54491
55219
  return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
@@ -55159,10 +55887,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55159
55887
  }).call(this);
55160
55888
  /***/
55161
55889
  }),
55162
- /***/ "./node_modules/xmlbuilder/lib/DocumentPosition.js":
55163
- /*!*********************************************************!*\
55164
- !*** ./node_modules/xmlbuilder/lib/DocumentPosition.js ***!
55165
- \*********************************************************/
55890
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/DocumentPosition.js":
55891
+ /*!*****************************************************************************!*\
55892
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/DocumentPosition.js ***!
55893
+ \*****************************************************************************/
55166
55894
  /***/ (function (module) {
55167
55895
  // Generated by CoffeeScript 1.12.7
55168
55896
  (function () {
@@ -55177,10 +55905,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55177
55905
  }).call(this);
55178
55906
  /***/
55179
55907
  }),
55180
- /***/ "./node_modules/xmlbuilder/lib/NodeType.js":
55181
- /*!*************************************************!*\
55182
- !*** ./node_modules/xmlbuilder/lib/NodeType.js ***!
55183
- \*************************************************/
55908
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js":
55909
+ /*!*********************************************************************!*\
55910
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js ***!
55911
+ \*********************************************************************/
55184
55912
  /***/ (function (module) {
55185
55913
  // Generated by CoffeeScript 1.12.7
55186
55914
  (function () {
@@ -55206,10 +55934,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55206
55934
  }).call(this);
55207
55935
  /***/
55208
55936
  }),
55209
- /***/ "./node_modules/xmlbuilder/lib/Utility.js":
55210
- /*!************************************************!*\
55211
- !*** ./node_modules/xmlbuilder/lib/Utility.js ***!
55212
- \************************************************/
55937
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js":
55938
+ /*!********************************************************************!*\
55939
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js ***!
55940
+ \********************************************************************/
55213
55941
  /***/ (function (module) {
55214
55942
  // Generated by CoffeeScript 1.12.7
55215
55943
  (function () {
@@ -55285,10 +56013,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55285
56013
  }).call(this);
55286
56014
  /***/
55287
56015
  }),
55288
- /***/ "./node_modules/xmlbuilder/lib/WriterState.js":
55289
- /*!****************************************************!*\
55290
- !*** ./node_modules/xmlbuilder/lib/WriterState.js ***!
55291
- \****************************************************/
56016
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/WriterState.js":
56017
+ /*!************************************************************************!*\
56018
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/WriterState.js ***!
56019
+ \************************************************************************/
55292
56020
  /***/ (function (module) {
55293
56021
  // Generated by CoffeeScript 1.12.7
55294
56022
  (function () {
@@ -55301,16 +56029,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55301
56029
  }).call(this);
55302
56030
  /***/
55303
56031
  }),
55304
- /***/ "./node_modules/xmlbuilder/lib/XMLAttribute.js":
55305
- /*!*****************************************************!*\
55306
- !*** ./node_modules/xmlbuilder/lib/XMLAttribute.js ***!
55307
- \*****************************************************/
56032
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLAttribute.js":
56033
+ /*!*************************************************************************!*\
56034
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLAttribute.js ***!
56035
+ \*************************************************************************/
55308
56036
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55309
56037
  // Generated by CoffeeScript 1.12.7
55310
56038
  (function () {
55311
56039
  var NodeType, XMLAttribute, XMLNode;
55312
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
55313
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
56040
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
56041
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
55314
56042
  module.exports = XMLAttribute = (function () {
55315
56043
  function XMLAttribute(parent, name, value) {
55316
56044
  this.parent = parent;
@@ -55400,10 +56128,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55400
56128
  }).call(this);
55401
56129
  /***/
55402
56130
  }),
55403
- /***/ "./node_modules/xmlbuilder/lib/XMLCData.js":
55404
- /*!*************************************************!*\
55405
- !*** ./node_modules/xmlbuilder/lib/XMLCData.js ***!
55406
- \*************************************************/
56131
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCData.js":
56132
+ /*!*********************************************************************!*\
56133
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCData.js ***!
56134
+ \*********************************************************************/
55407
56135
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55408
56136
  // Generated by CoffeeScript 1.12.7
55409
56137
  (function () {
@@ -55411,8 +56139,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55411
56139
  if (hasProp.call(parent, key))
55412
56140
  child[key] = parent[key];
55413
56141
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55414
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
55415
- XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xmlbuilder/lib/XMLCharacterData.js");
56142
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
56143
+ XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCharacterData.js");
55416
56144
  module.exports = XMLCData = (function (superClass) {
55417
56145
  extend(XMLCData, superClass);
55418
56146
  function XMLCData(parent, text) {
@@ -55435,10 +56163,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55435
56163
  }).call(this);
55436
56164
  /***/
55437
56165
  }),
55438
- /***/ "./node_modules/xmlbuilder/lib/XMLCharacterData.js":
55439
- /*!*********************************************************!*\
55440
- !*** ./node_modules/xmlbuilder/lib/XMLCharacterData.js ***!
55441
- \*********************************************************/
56166
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCharacterData.js":
56167
+ /*!*****************************************************************************!*\
56168
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCharacterData.js ***!
56169
+ \*****************************************************************************/
55442
56170
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55443
56171
  // Generated by CoffeeScript 1.12.7
55444
56172
  (function () {
@@ -55446,7 +56174,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55446
56174
  if (hasProp.call(parent, key))
55447
56175
  child[key] = parent[key];
55448
56176
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55449
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
56177
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
55450
56178
  module.exports = XMLCharacterData = (function (superClass) {
55451
56179
  extend(XMLCharacterData, superClass);
55452
56180
  function XMLCharacterData(parent) {
@@ -55506,10 +56234,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55506
56234
  }).call(this);
55507
56235
  /***/
55508
56236
  }),
55509
- /***/ "./node_modules/xmlbuilder/lib/XMLComment.js":
55510
- /*!***************************************************!*\
55511
- !*** ./node_modules/xmlbuilder/lib/XMLComment.js ***!
55512
- \***************************************************/
56237
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLComment.js":
56238
+ /*!***********************************************************************!*\
56239
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLComment.js ***!
56240
+ \***********************************************************************/
55513
56241
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55514
56242
  // Generated by CoffeeScript 1.12.7
55515
56243
  (function () {
@@ -55517,8 +56245,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55517
56245
  if (hasProp.call(parent, key))
55518
56246
  child[key] = parent[key];
55519
56247
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55520
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
55521
- XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xmlbuilder/lib/XMLCharacterData.js");
56248
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
56249
+ XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCharacterData.js");
55522
56250
  module.exports = XMLComment = (function (superClass) {
55523
56251
  extend(XMLComment, superClass);
55524
56252
  function XMLComment(parent, text) {
@@ -55541,16 +56269,16 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55541
56269
  }).call(this);
55542
56270
  /***/
55543
56271
  }),
55544
- /***/ "./node_modules/xmlbuilder/lib/XMLDOMConfiguration.js":
55545
- /*!************************************************************!*\
55546
- !*** ./node_modules/xmlbuilder/lib/XMLDOMConfiguration.js ***!
55547
- \************************************************************/
56272
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMConfiguration.js":
56273
+ /*!********************************************************************************!*\
56274
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMConfiguration.js ***!
56275
+ \********************************************************************************/
55548
56276
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55549
56277
  // Generated by CoffeeScript 1.12.7
55550
56278
  (function () {
55551
56279
  var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
55552
- XMLDOMErrorHandler = __webpack_require__(/*! ./XMLDOMErrorHandler */ "./node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js");
55553
- XMLDOMStringList = __webpack_require__(/*! ./XMLDOMStringList */ "./node_modules/xmlbuilder/lib/XMLDOMStringList.js");
56280
+ XMLDOMErrorHandler = __webpack_require__(/*! ./XMLDOMErrorHandler */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js");
56281
+ XMLDOMStringList = __webpack_require__(/*! ./XMLDOMStringList */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMStringList.js");
55554
56282
  module.exports = XMLDOMConfiguration = (function () {
55555
56283
  function XMLDOMConfiguration() {
55556
56284
  var clonedSelf;
@@ -55604,10 +56332,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55604
56332
  }).call(this);
55605
56333
  /***/
55606
56334
  }),
55607
- /***/ "./node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js":
55608
- /*!***********************************************************!*\
55609
- !*** ./node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js ***!
55610
- \***********************************************************/
56335
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js":
56336
+ /*!*******************************************************************************!*\
56337
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMErrorHandler.js ***!
56338
+ \*******************************************************************************/
55611
56339
  /***/ (function (module) {
55612
56340
  // Generated by CoffeeScript 1.12.7
55613
56341
  (function () {
@@ -55622,10 +56350,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55622
56350
  }).call(this);
55623
56351
  /***/
55624
56352
  }),
55625
- /***/ "./node_modules/xmlbuilder/lib/XMLDOMImplementation.js":
55626
- /*!*************************************************************!*\
55627
- !*** ./node_modules/xmlbuilder/lib/XMLDOMImplementation.js ***!
55628
- \*************************************************************/
56353
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMImplementation.js":
56354
+ /*!*********************************************************************************!*\
56355
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMImplementation.js ***!
56356
+ \*********************************************************************************/
55629
56357
  /***/ (function (module) {
55630
56358
  // Generated by CoffeeScript 1.12.7
55631
56359
  (function () {
@@ -55652,10 +56380,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55652
56380
  }).call(this);
55653
56381
  /***/
55654
56382
  }),
55655
- /***/ "./node_modules/xmlbuilder/lib/XMLDOMStringList.js":
55656
- /*!*********************************************************!*\
55657
- !*** ./node_modules/xmlbuilder/lib/XMLDOMStringList.js ***!
55658
- \*********************************************************/
56383
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMStringList.js":
56384
+ /*!*****************************************************************************!*\
56385
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMStringList.js ***!
56386
+ \*****************************************************************************/
55659
56387
  /***/ (function (module) {
55660
56388
  // Generated by CoffeeScript 1.12.7
55661
56389
  (function () {
@@ -55680,10 +56408,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55680
56408
  }).call(this);
55681
56409
  /***/
55682
56410
  }),
55683
- /***/ "./node_modules/xmlbuilder/lib/XMLDTDAttList.js":
55684
- /*!******************************************************!*\
55685
- !*** ./node_modules/xmlbuilder/lib/XMLDTDAttList.js ***!
55686
- \******************************************************/
56411
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDAttList.js":
56412
+ /*!**************************************************************************!*\
56413
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDAttList.js ***!
56414
+ \**************************************************************************/
55687
56415
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55688
56416
  // Generated by CoffeeScript 1.12.7
55689
56417
  (function () {
@@ -55691,8 +56419,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55691
56419
  if (hasProp.call(parent, key))
55692
56420
  child[key] = parent[key];
55693
56421
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55694
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
55695
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56422
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56423
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
55696
56424
  module.exports = XMLDTDAttList = (function (superClass) {
55697
56425
  extend(XMLDTDAttList, superClass);
55698
56426
  function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
@@ -55735,10 +56463,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55735
56463
  }).call(this);
55736
56464
  /***/
55737
56465
  }),
55738
- /***/ "./node_modules/xmlbuilder/lib/XMLDTDElement.js":
55739
- /*!******************************************************!*\
55740
- !*** ./node_modules/xmlbuilder/lib/XMLDTDElement.js ***!
55741
- \******************************************************/
56466
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDElement.js":
56467
+ /*!**************************************************************************!*\
56468
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDElement.js ***!
56469
+ \**************************************************************************/
55742
56470
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55743
56471
  // Generated by CoffeeScript 1.12.7
55744
56472
  (function () {
@@ -55746,8 +56474,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55746
56474
  if (hasProp.call(parent, key))
55747
56475
  child[key] = parent[key];
55748
56476
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55749
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
55750
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56477
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56478
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
55751
56479
  module.exports = XMLDTDElement = (function (superClass) {
55752
56480
  extend(XMLDTDElement, superClass);
55753
56481
  function XMLDTDElement(parent, name, value) {
@@ -55773,10 +56501,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55773
56501
  }).call(this);
55774
56502
  /***/
55775
56503
  }),
55776
- /***/ "./node_modules/xmlbuilder/lib/XMLDTDEntity.js":
55777
- /*!*****************************************************!*\
55778
- !*** ./node_modules/xmlbuilder/lib/XMLDTDEntity.js ***!
55779
- \*****************************************************/
56504
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDEntity.js":
56505
+ /*!*************************************************************************!*\
56506
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDEntity.js ***!
56507
+ \*************************************************************************/
55780
56508
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55781
56509
  // Generated by CoffeeScript 1.12.7
55782
56510
  (function () {
@@ -55784,9 +56512,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55784
56512
  if (hasProp.call(parent, key))
55785
56513
  child[key] = parent[key];
55786
56514
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55787
- isObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js").isObject);
55788
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
55789
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56515
+ isObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js").isObject);
56516
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56517
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
55790
56518
  module.exports = XMLDTDEntity = (function (superClass) {
55791
56519
  extend(XMLDTDEntity, superClass);
55792
56520
  function XMLDTDEntity(parent, pe, name, value) {
@@ -55864,10 +56592,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55864
56592
  }).call(this);
55865
56593
  /***/
55866
56594
  }),
55867
- /***/ "./node_modules/xmlbuilder/lib/XMLDTDNotation.js":
55868
- /*!*******************************************************!*\
55869
- !*** ./node_modules/xmlbuilder/lib/XMLDTDNotation.js ***!
55870
- \*******************************************************/
56595
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDNotation.js":
56596
+ /*!***************************************************************************!*\
56597
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDNotation.js ***!
56598
+ \***************************************************************************/
55871
56599
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55872
56600
  // Generated by CoffeeScript 1.12.7
55873
56601
  (function () {
@@ -55875,8 +56603,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55875
56603
  if (hasProp.call(parent, key))
55876
56604
  child[key] = parent[key];
55877
56605
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55878
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
55879
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56606
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56607
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
55880
56608
  module.exports = XMLDTDNotation = (function (superClass) {
55881
56609
  extend(XMLDTDNotation, superClass);
55882
56610
  function XMLDTDNotation(parent, name, value) {
@@ -55914,10 +56642,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55914
56642
  }).call(this);
55915
56643
  /***/
55916
56644
  }),
55917
- /***/ "./node_modules/xmlbuilder/lib/XMLDeclaration.js":
55918
- /*!*******************************************************!*\
55919
- !*** ./node_modules/xmlbuilder/lib/XMLDeclaration.js ***!
55920
- \*******************************************************/
56645
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDeclaration.js":
56646
+ /*!***************************************************************************!*\
56647
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDeclaration.js ***!
56648
+ \***************************************************************************/
55921
56649
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55922
56650
  // Generated by CoffeeScript 1.12.7
55923
56651
  (function () {
@@ -55925,9 +56653,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55925
56653
  if (hasProp.call(parent, key))
55926
56654
  child[key] = parent[key];
55927
56655
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55928
- isObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js").isObject);
55929
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
55930
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56656
+ isObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js").isObject);
56657
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56658
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
55931
56659
  module.exports = XMLDeclaration = (function (superClass) {
55932
56660
  extend(XMLDeclaration, superClass);
55933
56661
  function XMLDeclaration(parent, version, encoding, standalone) {
@@ -55956,10 +56684,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55956
56684
  }).call(this);
55957
56685
  /***/
55958
56686
  }),
55959
- /***/ "./node_modules/xmlbuilder/lib/XMLDocType.js":
55960
- /*!***************************************************!*\
55961
- !*** ./node_modules/xmlbuilder/lib/XMLDocType.js ***!
55962
- \***************************************************/
56687
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocType.js":
56688
+ /*!***********************************************************************!*\
56689
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocType.js ***!
56690
+ \***********************************************************************/
55963
56691
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
55964
56692
  // Generated by CoffeeScript 1.12.7
55965
56693
  (function () {
@@ -55967,14 +56695,14 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
55967
56695
  if (hasProp.call(parent, key))
55968
56696
  child[key] = parent[key];
55969
56697
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
55970
- isObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js").isObject);
55971
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
55972
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
55973
- XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ "./node_modules/xmlbuilder/lib/XMLDTDAttList.js");
55974
- XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ "./node_modules/xmlbuilder/lib/XMLDTDEntity.js");
55975
- XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ "./node_modules/xmlbuilder/lib/XMLDTDElement.js");
55976
- XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ "./node_modules/xmlbuilder/lib/XMLDTDNotation.js");
55977
- XMLNamedNodeMap = __webpack_require__(/*! ./XMLNamedNodeMap */ "./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js");
56698
+ isObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js").isObject);
56699
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56700
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
56701
+ XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDAttList.js");
56702
+ XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDEntity.js");
56703
+ XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDElement.js");
56704
+ XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDNotation.js");
56705
+ XMLNamedNodeMap = __webpack_require__(/*! ./XMLNamedNodeMap */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js");
55978
56706
  module.exports = XMLDocType = (function (superClass) {
55979
56707
  extend(XMLDocType, superClass);
55980
56708
  function XMLDocType(parent, pubID, sysID) {
@@ -56119,10 +56847,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56119
56847
  }).call(this);
56120
56848
  /***/
56121
56849
  }),
56122
- /***/ "./node_modules/xmlbuilder/lib/XMLDocument.js":
56123
- /*!****************************************************!*\
56124
- !*** ./node_modules/xmlbuilder/lib/XMLDocument.js ***!
56125
- \****************************************************/
56850
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocument.js":
56851
+ /*!************************************************************************!*\
56852
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocument.js ***!
56853
+ \************************************************************************/
56126
56854
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
56127
56855
  // Generated by CoffeeScript 1.12.7
56128
56856
  (function () {
@@ -56130,13 +56858,13 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56130
56858
  if (hasProp.call(parent, key))
56131
56859
  child[key] = parent[key];
56132
56860
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
56133
- isPlainObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js").isPlainObject);
56134
- XMLDOMImplementation = __webpack_require__(/*! ./XMLDOMImplementation */ "./node_modules/xmlbuilder/lib/XMLDOMImplementation.js");
56135
- XMLDOMConfiguration = __webpack_require__(/*! ./XMLDOMConfiguration */ "./node_modules/xmlbuilder/lib/XMLDOMConfiguration.js");
56136
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
56137
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56138
- XMLStringifier = __webpack_require__(/*! ./XMLStringifier */ "./node_modules/xmlbuilder/lib/XMLStringifier.js");
56139
- XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ "./node_modules/xmlbuilder/lib/XMLStringWriter.js");
56861
+ isPlainObject = (__webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js").isPlainObject);
56862
+ XMLDOMImplementation = __webpack_require__(/*! ./XMLDOMImplementation */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMImplementation.js");
56863
+ XMLDOMConfiguration = __webpack_require__(/*! ./XMLDOMConfiguration */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMConfiguration.js");
56864
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
56865
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
56866
+ XMLStringifier = __webpack_require__(/*! ./XMLStringifier */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js");
56867
+ XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringWriter.js");
56140
56868
  module.exports = XMLDocument = (function (superClass) {
56141
56869
  extend(XMLDocument, superClass);
56142
56870
  function XMLDocument(options) {
@@ -56324,33 +57052,33 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56324
57052
  }).call(this);
56325
57053
  /***/
56326
57054
  }),
56327
- /***/ "./node_modules/xmlbuilder/lib/XMLDocumentCB.js":
56328
- /*!******************************************************!*\
56329
- !*** ./node_modules/xmlbuilder/lib/XMLDocumentCB.js ***!
56330
- \******************************************************/
57055
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocumentCB.js":
57056
+ /*!**************************************************************************!*\
57057
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocumentCB.js ***!
57058
+ \**************************************************************************/
56331
57059
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
56332
57060
  // Generated by CoffeeScript 1.12.7
56333
57061
  (function () {
56334
57062
  var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref, hasProp = {}.hasOwnProperty;
56335
- ref = __webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js"), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
56336
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56337
- XMLDocument = __webpack_require__(/*! ./XMLDocument */ "./node_modules/xmlbuilder/lib/XMLDocument.js");
56338
- XMLElement = __webpack_require__(/*! ./XMLElement */ "./node_modules/xmlbuilder/lib/XMLElement.js");
56339
- XMLCData = __webpack_require__(/*! ./XMLCData */ "./node_modules/xmlbuilder/lib/XMLCData.js");
56340
- XMLComment = __webpack_require__(/*! ./XMLComment */ "./node_modules/xmlbuilder/lib/XMLComment.js");
56341
- XMLRaw = __webpack_require__(/*! ./XMLRaw */ "./node_modules/xmlbuilder/lib/XMLRaw.js");
56342
- XMLText = __webpack_require__(/*! ./XMLText */ "./node_modules/xmlbuilder/lib/XMLText.js");
56343
- XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ "./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js");
56344
- XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ "./node_modules/xmlbuilder/lib/XMLDeclaration.js");
56345
- XMLDocType = __webpack_require__(/*! ./XMLDocType */ "./node_modules/xmlbuilder/lib/XMLDocType.js");
56346
- XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ "./node_modules/xmlbuilder/lib/XMLDTDAttList.js");
56347
- XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ "./node_modules/xmlbuilder/lib/XMLDTDEntity.js");
56348
- XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ "./node_modules/xmlbuilder/lib/XMLDTDElement.js");
56349
- XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ "./node_modules/xmlbuilder/lib/XMLDTDNotation.js");
56350
- XMLAttribute = __webpack_require__(/*! ./XMLAttribute */ "./node_modules/xmlbuilder/lib/XMLAttribute.js");
56351
- XMLStringifier = __webpack_require__(/*! ./XMLStringifier */ "./node_modules/xmlbuilder/lib/XMLStringifier.js");
56352
- XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ "./node_modules/xmlbuilder/lib/XMLStringWriter.js");
56353
- WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xmlbuilder/lib/WriterState.js");
57063
+ ref = __webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js"), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
57064
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
57065
+ XMLDocument = __webpack_require__(/*! ./XMLDocument */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocument.js");
57066
+ XMLElement = __webpack_require__(/*! ./XMLElement */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLElement.js");
57067
+ XMLCData = __webpack_require__(/*! ./XMLCData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCData.js");
57068
+ XMLComment = __webpack_require__(/*! ./XMLComment */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLComment.js");
57069
+ XMLRaw = __webpack_require__(/*! ./XMLRaw */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLRaw.js");
57070
+ XMLText = __webpack_require__(/*! ./XMLText */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLText.js");
57071
+ XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js");
57072
+ XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDeclaration.js");
57073
+ XMLDocType = __webpack_require__(/*! ./XMLDocType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocType.js");
57074
+ XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDAttList.js");
57075
+ XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDEntity.js");
57076
+ XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDElement.js");
57077
+ XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDNotation.js");
57078
+ XMLAttribute = __webpack_require__(/*! ./XMLAttribute */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLAttribute.js");
57079
+ XMLStringifier = __webpack_require__(/*! ./XMLStringifier */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js");
57080
+ XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringWriter.js");
57081
+ WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/WriterState.js");
56354
57082
  module.exports = XMLDocumentCB = (function () {
56355
57083
  function XMLDocumentCB(options, onData, onEnd) {
56356
57084
  var writerOptions;
@@ -56810,10 +57538,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56810
57538
  }).call(this);
56811
57539
  /***/
56812
57540
  }),
56813
- /***/ "./node_modules/xmlbuilder/lib/XMLDummy.js":
56814
- /*!*************************************************!*\
56815
- !*** ./node_modules/xmlbuilder/lib/XMLDummy.js ***!
56816
- \*************************************************/
57541
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDummy.js":
57542
+ /*!*********************************************************************!*\
57543
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDummy.js ***!
57544
+ \*********************************************************************/
56817
57545
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
56818
57546
  // Generated by CoffeeScript 1.12.7
56819
57547
  (function () {
@@ -56821,8 +57549,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56821
57549
  if (hasProp.call(parent, key))
56822
57550
  child[key] = parent[key];
56823
57551
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
56824
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
56825
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
57552
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
57553
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
56826
57554
  module.exports = XMLDummy = (function (superClass) {
56827
57555
  extend(XMLDummy, superClass);
56828
57556
  function XMLDummy(parent) {
@@ -56840,10 +57568,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56840
57568
  }).call(this);
56841
57569
  /***/
56842
57570
  }),
56843
- /***/ "./node_modules/xmlbuilder/lib/XMLElement.js":
56844
- /*!***************************************************!*\
56845
- !*** ./node_modules/xmlbuilder/lib/XMLElement.js ***!
56846
- \***************************************************/
57571
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLElement.js":
57572
+ /*!***********************************************************************!*\
57573
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLElement.js ***!
57574
+ \***********************************************************************/
56847
57575
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
56848
57576
  // Generated by CoffeeScript 1.12.7
56849
57577
  (function () {
@@ -56851,11 +57579,11 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
56851
57579
  if (hasProp.call(parent, key))
56852
57580
  child[key] = parent[key];
56853
57581
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
56854
- ref = __webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js"), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
56855
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
56856
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
56857
- XMLAttribute = __webpack_require__(/*! ./XMLAttribute */ "./node_modules/xmlbuilder/lib/XMLAttribute.js");
56858
- XMLNamedNodeMap = __webpack_require__(/*! ./XMLNamedNodeMap */ "./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js");
57582
+ ref = __webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js"), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
57583
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
57584
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
57585
+ XMLAttribute = __webpack_require__(/*! ./XMLAttribute */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLAttribute.js");
57586
+ XMLNamedNodeMap = __webpack_require__(/*! ./XMLNamedNodeMap */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js");
56859
57587
  module.exports = XMLElement = (function (superClass) {
56860
57588
  extend(XMLElement, superClass);
56861
57589
  function XMLElement(parent, name, attributes) {
@@ -57109,10 +57837,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57109
57837
  }).call(this);
57110
57838
  /***/
57111
57839
  }),
57112
- /***/ "./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js":
57113
- /*!********************************************************!*\
57114
- !*** ./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js ***!
57115
- \********************************************************/
57840
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js":
57841
+ /*!****************************************************************************!*\
57842
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js ***!
57843
+ \****************************************************************************/
57116
57844
  /***/ (function (module) {
57117
57845
  // Generated by CoffeeScript 1.12.7
57118
57846
  (function () {
@@ -57161,15 +57889,15 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57161
57889
  }).call(this);
57162
57890
  /***/
57163
57891
  }),
57164
- /***/ "./node_modules/xmlbuilder/lib/XMLNode.js":
57165
- /*!************************************************!*\
57166
- !*** ./node_modules/xmlbuilder/lib/XMLNode.js ***!
57167
- \************************************************/
57892
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js":
57893
+ /*!********************************************************************!*\
57894
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js ***!
57895
+ \********************************************************************/
57168
57896
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
57169
57897
  // Generated by CoffeeScript 1.12.7
57170
57898
  (function () {
57171
57899
  var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1, hasProp = {}.hasOwnProperty;
57172
- ref1 = __webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js"), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
57900
+ ref1 = __webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js"), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
57173
57901
  XMLElement = null;
57174
57902
  XMLCData = null;
57175
57903
  XMLComment = null;
@@ -57194,19 +57922,19 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57194
57922
  this.children = [];
57195
57923
  this.baseURI = null;
57196
57924
  if (!XMLElement) {
57197
- XMLElement = __webpack_require__(/*! ./XMLElement */ "./node_modules/xmlbuilder/lib/XMLElement.js");
57198
- XMLCData = __webpack_require__(/*! ./XMLCData */ "./node_modules/xmlbuilder/lib/XMLCData.js");
57199
- XMLComment = __webpack_require__(/*! ./XMLComment */ "./node_modules/xmlbuilder/lib/XMLComment.js");
57200
- XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ "./node_modules/xmlbuilder/lib/XMLDeclaration.js");
57201
- XMLDocType = __webpack_require__(/*! ./XMLDocType */ "./node_modules/xmlbuilder/lib/XMLDocType.js");
57202
- XMLRaw = __webpack_require__(/*! ./XMLRaw */ "./node_modules/xmlbuilder/lib/XMLRaw.js");
57203
- XMLText = __webpack_require__(/*! ./XMLText */ "./node_modules/xmlbuilder/lib/XMLText.js");
57204
- XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ "./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js");
57205
- XMLDummy = __webpack_require__(/*! ./XMLDummy */ "./node_modules/xmlbuilder/lib/XMLDummy.js");
57206
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
57207
- XMLNodeList = __webpack_require__(/*! ./XMLNodeList */ "./node_modules/xmlbuilder/lib/XMLNodeList.js");
57208
- XMLNamedNodeMap = __webpack_require__(/*! ./XMLNamedNodeMap */ "./node_modules/xmlbuilder/lib/XMLNamedNodeMap.js");
57209
- DocumentPosition = __webpack_require__(/*! ./DocumentPosition */ "./node_modules/xmlbuilder/lib/DocumentPosition.js");
57925
+ XMLElement = __webpack_require__(/*! ./XMLElement */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLElement.js");
57926
+ XMLCData = __webpack_require__(/*! ./XMLCData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCData.js");
57927
+ XMLComment = __webpack_require__(/*! ./XMLComment */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLComment.js");
57928
+ XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDeclaration.js");
57929
+ XMLDocType = __webpack_require__(/*! ./XMLDocType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocType.js");
57930
+ XMLRaw = __webpack_require__(/*! ./XMLRaw */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLRaw.js");
57931
+ XMLText = __webpack_require__(/*! ./XMLText */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLText.js");
57932
+ XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js");
57933
+ XMLDummy = __webpack_require__(/*! ./XMLDummy */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDummy.js");
57934
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
57935
+ XMLNodeList = __webpack_require__(/*! ./XMLNodeList */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNodeList.js");
57936
+ XMLNamedNodeMap = __webpack_require__(/*! ./XMLNamedNodeMap */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNamedNodeMap.js");
57937
+ DocumentPosition = __webpack_require__(/*! ./DocumentPosition */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/DocumentPosition.js");
57210
57938
  }
57211
57939
  }
57212
57940
  Object.defineProperty(XMLNode.prototype, 'nodeName', {
@@ -57897,10 +58625,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57897
58625
  }).call(this);
57898
58626
  /***/
57899
58627
  }),
57900
- /***/ "./node_modules/xmlbuilder/lib/XMLNodeList.js":
57901
- /*!****************************************************!*\
57902
- !*** ./node_modules/xmlbuilder/lib/XMLNodeList.js ***!
57903
- \****************************************************/
58628
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNodeList.js":
58629
+ /*!************************************************************************!*\
58630
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNodeList.js ***!
58631
+ \************************************************************************/
57904
58632
  /***/ (function (module) {
57905
58633
  // Generated by CoffeeScript 1.12.7
57906
58634
  (function () {
@@ -57925,10 +58653,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57925
58653
  }).call(this);
57926
58654
  /***/
57927
58655
  }),
57928
- /***/ "./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js":
57929
- /*!*****************************************************************!*\
57930
- !*** ./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js ***!
57931
- \*****************************************************************/
58656
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js":
58657
+ /*!*************************************************************************************!*\
58658
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js ***!
58659
+ \*************************************************************************************/
57932
58660
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
57933
58661
  // Generated by CoffeeScript 1.12.7
57934
58662
  (function () {
@@ -57936,8 +58664,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57936
58664
  if (hasProp.call(parent, key))
57937
58665
  child[key] = parent[key];
57938
58666
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
57939
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
57940
- XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xmlbuilder/lib/XMLCharacterData.js");
58667
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
58668
+ XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCharacterData.js");
57941
58669
  module.exports = XMLProcessingInstruction = (function (superClass) {
57942
58670
  extend(XMLProcessingInstruction, superClass);
57943
58671
  function XMLProcessingInstruction(parent, target, value) {
@@ -57972,10 +58700,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57972
58700
  }).call(this);
57973
58701
  /***/
57974
58702
  }),
57975
- /***/ "./node_modules/xmlbuilder/lib/XMLRaw.js":
57976
- /*!***********************************************!*\
57977
- !*** ./node_modules/xmlbuilder/lib/XMLRaw.js ***!
57978
- \***********************************************/
58703
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLRaw.js":
58704
+ /*!*******************************************************************!*\
58705
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLRaw.js ***!
58706
+ \*******************************************************************/
57979
58707
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
57980
58708
  // Generated by CoffeeScript 1.12.7
57981
58709
  (function () {
@@ -57983,8 +58711,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
57983
58711
  if (hasProp.call(parent, key))
57984
58712
  child[key] = parent[key];
57985
58713
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
57986
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
57987
- XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xmlbuilder/lib/XMLNode.js");
58714
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
58715
+ XMLNode = __webpack_require__(/*! ./XMLNode */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLNode.js");
57988
58716
  module.exports = XMLRaw = (function (superClass) {
57989
58717
  extend(XMLRaw, superClass);
57990
58718
  function XMLRaw(parent, text) {
@@ -58006,10 +58734,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58006
58734
  }).call(this);
58007
58735
  /***/
58008
58736
  }),
58009
- /***/ "./node_modules/xmlbuilder/lib/XMLStreamWriter.js":
58010
- /*!********************************************************!*\
58011
- !*** ./node_modules/xmlbuilder/lib/XMLStreamWriter.js ***!
58012
- \********************************************************/
58737
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStreamWriter.js":
58738
+ /*!****************************************************************************!*\
58739
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStreamWriter.js ***!
58740
+ \****************************************************************************/
58013
58741
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
58014
58742
  // Generated by CoffeeScript 1.12.7
58015
58743
  (function () {
@@ -58017,9 +58745,9 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58017
58745
  if (hasProp.call(parent, key))
58018
58746
  child[key] = parent[key];
58019
58747
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
58020
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
58021
- XMLWriterBase = __webpack_require__(/*! ./XMLWriterBase */ "./node_modules/xmlbuilder/lib/XMLWriterBase.js");
58022
- WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xmlbuilder/lib/WriterState.js");
58748
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
58749
+ XMLWriterBase = __webpack_require__(/*! ./XMLWriterBase */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLWriterBase.js");
58750
+ WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/WriterState.js");
58023
58751
  module.exports = XMLStreamWriter = (function (superClass) {
58024
58752
  extend(XMLStreamWriter, superClass);
58025
58753
  function XMLStreamWriter(stream, options) {
@@ -58173,10 +58901,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58173
58901
  }).call(this);
58174
58902
  /***/
58175
58903
  }),
58176
- /***/ "./node_modules/xmlbuilder/lib/XMLStringWriter.js":
58177
- /*!********************************************************!*\
58178
- !*** ./node_modules/xmlbuilder/lib/XMLStringWriter.js ***!
58179
- \********************************************************/
58904
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringWriter.js":
58905
+ /*!****************************************************************************!*\
58906
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringWriter.js ***!
58907
+ \****************************************************************************/
58180
58908
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
58181
58909
  // Generated by CoffeeScript 1.12.7
58182
58910
  (function () {
@@ -58184,7 +58912,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58184
58912
  if (hasProp.call(parent, key))
58185
58913
  child[key] = parent[key];
58186
58914
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
58187
- XMLWriterBase = __webpack_require__(/*! ./XMLWriterBase */ "./node_modules/xmlbuilder/lib/XMLWriterBase.js");
58915
+ XMLWriterBase = __webpack_require__(/*! ./XMLWriterBase */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLWriterBase.js");
58188
58916
  module.exports = XMLStringWriter = (function (superClass) {
58189
58917
  extend(XMLStringWriter, superClass);
58190
58918
  function XMLStringWriter(options) {
@@ -58209,10 +58937,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58209
58937
  }).call(this);
58210
58938
  /***/
58211
58939
  }),
58212
- /***/ "./node_modules/xmlbuilder/lib/XMLStringifier.js":
58213
- /*!*******************************************************!*\
58214
- !*** ./node_modules/xmlbuilder/lib/XMLStringifier.js ***!
58215
- \*******************************************************/
58940
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js":
58941
+ /*!***************************************************************************!*\
58942
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringifier.js ***!
58943
+ \***************************************************************************/
58216
58944
  /***/ (function (module) {
58217
58945
  // Generated by CoffeeScript 1.12.7
58218
58946
  (function () {
@@ -58425,10 +59153,10 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58425
59153
  }).call(this);
58426
59154
  /***/
58427
59155
  }),
58428
- /***/ "./node_modules/xmlbuilder/lib/XMLText.js":
58429
- /*!************************************************!*\
58430
- !*** ./node_modules/xmlbuilder/lib/XMLText.js ***!
58431
- \************************************************/
59156
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLText.js":
59157
+ /*!********************************************************************!*\
59158
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLText.js ***!
59159
+ \********************************************************************/
58432
59160
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
58433
59161
  // Generated by CoffeeScript 1.12.7
58434
59162
  (function () {
@@ -58436,8 +59164,8 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58436
59164
  if (hasProp.call(parent, key))
58437
59165
  child[key] = parent[key];
58438
59166
  } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
58439
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
58440
- XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xmlbuilder/lib/XMLCharacterData.js");
59167
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
59168
+ XMLCharacterData = __webpack_require__(/*! ./XMLCharacterData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCharacterData.js");
58441
59169
  module.exports = XMLText = (function (superClass) {
58442
59170
  extend(XMLText, superClass);
58443
59171
  function XMLText(parent, text) {
@@ -58489,30 +59217,30 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58489
59217
  }).call(this);
58490
59218
  /***/
58491
59219
  }),
58492
- /***/ "./node_modules/xmlbuilder/lib/XMLWriterBase.js":
58493
- /*!******************************************************!*\
58494
- !*** ./node_modules/xmlbuilder/lib/XMLWriterBase.js ***!
58495
- \******************************************************/
59220
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLWriterBase.js":
59221
+ /*!**************************************************************************!*\
59222
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLWriterBase.js ***!
59223
+ \**************************************************************************/
58496
59224
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
58497
59225
  // Generated by CoffeeScript 1.12.7
58498
59226
  (function () {
58499
59227
  var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign, hasProp = {}.hasOwnProperty;
58500
- assign = (__webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js").assign);
58501
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
58502
- XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ "./node_modules/xmlbuilder/lib/XMLDeclaration.js");
58503
- XMLDocType = __webpack_require__(/*! ./XMLDocType */ "./node_modules/xmlbuilder/lib/XMLDocType.js");
58504
- XMLCData = __webpack_require__(/*! ./XMLCData */ "./node_modules/xmlbuilder/lib/XMLCData.js");
58505
- XMLComment = __webpack_require__(/*! ./XMLComment */ "./node_modules/xmlbuilder/lib/XMLComment.js");
58506
- XMLElement = __webpack_require__(/*! ./XMLElement */ "./node_modules/xmlbuilder/lib/XMLElement.js");
58507
- XMLRaw = __webpack_require__(/*! ./XMLRaw */ "./node_modules/xmlbuilder/lib/XMLRaw.js");
58508
- XMLText = __webpack_require__(/*! ./XMLText */ "./node_modules/xmlbuilder/lib/XMLText.js");
58509
- XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ "./node_modules/xmlbuilder/lib/XMLProcessingInstruction.js");
58510
- XMLDummy = __webpack_require__(/*! ./XMLDummy */ "./node_modules/xmlbuilder/lib/XMLDummy.js");
58511
- XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ "./node_modules/xmlbuilder/lib/XMLDTDAttList.js");
58512
- XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ "./node_modules/xmlbuilder/lib/XMLDTDElement.js");
58513
- XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ "./node_modules/xmlbuilder/lib/XMLDTDEntity.js");
58514
- XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ "./node_modules/xmlbuilder/lib/XMLDTDNotation.js");
58515
- WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xmlbuilder/lib/WriterState.js");
59228
+ assign = (__webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js").assign);
59229
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
59230
+ XMLDeclaration = __webpack_require__(/*! ./XMLDeclaration */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDeclaration.js");
59231
+ XMLDocType = __webpack_require__(/*! ./XMLDocType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocType.js");
59232
+ XMLCData = __webpack_require__(/*! ./XMLCData */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLCData.js");
59233
+ XMLComment = __webpack_require__(/*! ./XMLComment */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLComment.js");
59234
+ XMLElement = __webpack_require__(/*! ./XMLElement */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLElement.js");
59235
+ XMLRaw = __webpack_require__(/*! ./XMLRaw */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLRaw.js");
59236
+ XMLText = __webpack_require__(/*! ./XMLText */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLText.js");
59237
+ XMLProcessingInstruction = __webpack_require__(/*! ./XMLProcessingInstruction */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js");
59238
+ XMLDummy = __webpack_require__(/*! ./XMLDummy */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDummy.js");
59239
+ XMLDTDAttList = __webpack_require__(/*! ./XMLDTDAttList */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDAttList.js");
59240
+ XMLDTDElement = __webpack_require__(/*! ./XMLDTDElement */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDElement.js");
59241
+ XMLDTDEntity = __webpack_require__(/*! ./XMLDTDEntity */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDEntity.js");
59242
+ XMLDTDNotation = __webpack_require__(/*! ./XMLDTDNotation */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDTDNotation.js");
59243
+ WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/WriterState.js");
58516
59244
  module.exports = XMLWriterBase = (function () {
58517
59245
  function XMLWriterBase(options) {
58518
59246
  var key, ref, value;
@@ -58894,22 +59622,22 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
58894
59622
  }).call(this);
58895
59623
  /***/
58896
59624
  }),
58897
- /***/ "./node_modules/xmlbuilder/lib/index.js":
58898
- /*!**********************************************!*\
58899
- !*** ./node_modules/xmlbuilder/lib/index.js ***!
58900
- \**********************************************/
59625
+ /***/ "./node_modules/xml2js/node_modules/xmlbuilder/lib/index.js":
59626
+ /*!******************************************************************!*\
59627
+ !*** ./node_modules/xml2js/node_modules/xmlbuilder/lib/index.js ***!
59628
+ \******************************************************************/
58901
59629
  /***/ (function (module, __unused_webpack_exports, __webpack_require__) {
58902
59630
  // Generated by CoffeeScript 1.12.7
58903
59631
  (function () {
58904
59632
  var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
58905
- ref = __webpack_require__(/*! ./Utility */ "./node_modules/xmlbuilder/lib/Utility.js"), assign = ref.assign, isFunction = ref.isFunction;
58906
- XMLDOMImplementation = __webpack_require__(/*! ./XMLDOMImplementation */ "./node_modules/xmlbuilder/lib/XMLDOMImplementation.js");
58907
- XMLDocument = __webpack_require__(/*! ./XMLDocument */ "./node_modules/xmlbuilder/lib/XMLDocument.js");
58908
- XMLDocumentCB = __webpack_require__(/*! ./XMLDocumentCB */ "./node_modules/xmlbuilder/lib/XMLDocumentCB.js");
58909
- XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ "./node_modules/xmlbuilder/lib/XMLStringWriter.js");
58910
- XMLStreamWriter = __webpack_require__(/*! ./XMLStreamWriter */ "./node_modules/xmlbuilder/lib/XMLStreamWriter.js");
58911
- NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xmlbuilder/lib/NodeType.js");
58912
- WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xmlbuilder/lib/WriterState.js");
59633
+ ref = __webpack_require__(/*! ./Utility */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/Utility.js"), assign = ref.assign, isFunction = ref.isFunction;
59634
+ XMLDOMImplementation = __webpack_require__(/*! ./XMLDOMImplementation */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDOMImplementation.js");
59635
+ XMLDocument = __webpack_require__(/*! ./XMLDocument */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocument.js");
59636
+ XMLDocumentCB = __webpack_require__(/*! ./XMLDocumentCB */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLDocumentCB.js");
59637
+ XMLStringWriter = __webpack_require__(/*! ./XMLStringWriter */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStringWriter.js");
59638
+ XMLStreamWriter = __webpack_require__(/*! ./XMLStreamWriter */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/XMLStreamWriter.js");
59639
+ NodeType = __webpack_require__(/*! ./NodeType */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/NodeType.js");
59640
+ WriterState = __webpack_require__(/*! ./WriterState */ "./node_modules/xml2js/node_modules/xmlbuilder/lib/WriterState.js");
58913
59641
  module.exports.create = function (name, xmldec, doctype, options) {
58914
59642
  var doc, root;
58915
59643
  if (name == null) {
@@ -59941,12 +60669,12 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
59941
60669
  var peg$e33 = peg$otherExpectation("number");
59942
60670
  var peg$e34 = peg$classExpectation([["1", "9"]], false, false);
59943
60671
  var peg$e35 = peg$otherExpectation("amount");
59944
- var peg$e36 = peg$literalExpectation(".", false);
59945
- var peg$e37 = peg$otherExpectation("percentage");
59946
- var peg$e38 = peg$literalExpectation("%", false);
59947
- var peg$e39 = peg$otherExpectation("year");
59948
- var peg$e40 = peg$otherExpectation("month");
59949
- var peg$e41 = peg$literalExpectation("-", false);
60672
+ var peg$e36 = peg$literalExpectation("-", false);
60673
+ var peg$e37 = peg$literalExpectation(".", false);
60674
+ var peg$e38 = peg$otherExpectation("percentage");
60675
+ var peg$e39 = peg$literalExpectation("%", false);
60676
+ var peg$e40 = peg$otherExpectation("year");
60677
+ var peg$e41 = peg$otherExpectation("month");
59950
60678
  var peg$e42 = peg$otherExpectation("day");
59951
60679
  var peg$e43 = peg$otherExpectation("currency symbol");
59952
60680
  var peg$e44 = peg$anyExpectation();
@@ -61592,7 +62320,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61592
62320
  return s0;
61593
62321
  }
61594
62322
  function peg$parseamount() {
61595
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
62323
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
61596
62324
  peg$silentFails++;
61597
62325
  s0 = peg$currPos;
61598
62326
  s1 = peg$parsecurrencySymbol();
@@ -61605,58 +62333,71 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61605
62333
  }
61606
62334
  s3 = peg$currPos;
61607
62335
  s4 = peg$currPos;
61608
- s5 = [];
61609
- s6 = peg$parsed();
61610
- if (s6 !== peg$FAILED) {
61611
- while (s6 !== peg$FAILED) {
61612
- s5.push(s6);
61613
- s6 = peg$parsed();
61614
- }
62336
+ if (input.charCodeAt(peg$currPos) === 45) {
62337
+ s5 = peg$c24;
62338
+ peg$currPos++;
61615
62339
  }
61616
62340
  else {
61617
62341
  s5 = peg$FAILED;
62342
+ if (peg$silentFails === 0) {
62343
+ peg$fail(peg$e36);
62344
+ }
62345
+ }
62346
+ if (s5 === peg$FAILED) {
62347
+ s5 = null;
62348
+ }
62349
+ s6 = [];
62350
+ s7 = peg$parsed();
62351
+ if (s7 !== peg$FAILED) {
62352
+ while (s7 !== peg$FAILED) {
62353
+ s6.push(s7);
62354
+ s7 = peg$parsed();
62355
+ }
62356
+ }
62357
+ else {
62358
+ s6 = peg$FAILED;
61618
62359
  }
61619
- if (s5 !== peg$FAILED) {
61620
- s6 = peg$currPos;
62360
+ if (s6 !== peg$FAILED) {
62361
+ s7 = peg$currPos;
61621
62362
  if (input.charCodeAt(peg$currPos) === 46) {
61622
- s7 = peg$c29;
62363
+ s8 = peg$c29;
61623
62364
  peg$currPos++;
61624
62365
  }
61625
62366
  else {
61626
- s7 = peg$FAILED;
62367
+ s8 = peg$FAILED;
61627
62368
  if (peg$silentFails === 0) {
61628
- peg$fail(peg$e36);
62369
+ peg$fail(peg$e37);
61629
62370
  }
61630
62371
  }
61631
- if (s7 !== peg$FAILED) {
61632
- s8 = peg$currPos;
61633
- s9 = peg$parsed();
61634
- if (s9 !== peg$FAILED) {
61635
- s10 = peg$parsed();
61636
- if (s10 === peg$FAILED) {
61637
- s10 = null;
62372
+ if (s8 !== peg$FAILED) {
62373
+ s9 = peg$currPos;
62374
+ s10 = peg$parsed();
62375
+ if (s10 !== peg$FAILED) {
62376
+ s11 = peg$parsed();
62377
+ if (s11 === peg$FAILED) {
62378
+ s11 = null;
61638
62379
  }
61639
- s9 = [s9, s10];
61640
- s8 = s9;
62380
+ s10 = [s10, s11];
62381
+ s9 = s10;
61641
62382
  }
61642
62383
  else {
61643
- peg$currPos = s8;
61644
- s8 = peg$FAILED;
62384
+ peg$currPos = s9;
62385
+ s9 = peg$FAILED;
61645
62386
  }
61646
- if (s8 === peg$FAILED) {
61647
- s8 = null;
62387
+ if (s9 === peg$FAILED) {
62388
+ s9 = null;
61648
62389
  }
61649
- s7 = [s7, s8];
61650
- s6 = s7;
62390
+ s8 = [s8, s9];
62391
+ s7 = s8;
61651
62392
  }
61652
62393
  else {
61653
- peg$currPos = s6;
61654
- s6 = peg$FAILED;
62394
+ peg$currPos = s7;
62395
+ s7 = peg$FAILED;
61655
62396
  }
61656
- if (s6 === peg$FAILED) {
61657
- s6 = null;
62397
+ if (s7 === peg$FAILED) {
62398
+ s7 = null;
61658
62399
  }
61659
- s5 = [s5, s6];
62400
+ s5 = [s5, s6, s7];
61660
62401
  s4 = s5;
61661
62402
  }
61662
62403
  else {
@@ -61712,7 +62453,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61712
62453
  else {
61713
62454
  s5 = peg$FAILED;
61714
62455
  if (peg$silentFails === 0) {
61715
- peg$fail(peg$e36);
62456
+ peg$fail(peg$e37);
61716
62457
  }
61717
62458
  }
61718
62459
  if (s5 !== peg$FAILED) {
@@ -61765,7 +62506,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61765
62506
  else {
61766
62507
  s3 = peg$FAILED;
61767
62508
  if (peg$silentFails === 0) {
61768
- peg$fail(peg$e38);
62509
+ peg$fail(peg$e39);
61769
62510
  }
61770
62511
  }
61771
62512
  if (s3 !== peg$FAILED) {
@@ -61785,7 +62526,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61785
62526
  if (s0 === peg$FAILED) {
61786
62527
  s1 = peg$FAILED;
61787
62528
  if (peg$silentFails === 0) {
61788
- peg$fail(peg$e37);
62529
+ peg$fail(peg$e38);
61789
62530
  }
61790
62531
  }
61791
62532
  return s0;
@@ -61835,7 +62576,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61835
62576
  if (s0 === peg$FAILED) {
61836
62577
  s1 = peg$FAILED;
61837
62578
  if (peg$silentFails === 0) {
61838
- peg$fail(peg$e39);
62579
+ peg$fail(peg$e40);
61839
62580
  }
61840
62581
  }
61841
62582
  return s0;
@@ -61854,7 +62595,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61854
62595
  else {
61855
62596
  s3 = peg$FAILED;
61856
62597
  if (peg$silentFails === 0) {
61857
- peg$fail(peg$e41);
62598
+ peg$fail(peg$e36);
61858
62599
  }
61859
62600
  }
61860
62601
  if (s3 !== peg$FAILED) {
@@ -61894,7 +62635,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61894
62635
  if (s0 === peg$FAILED) {
61895
62636
  s1 = peg$FAILED;
61896
62637
  if (peg$silentFails === 0) {
61897
- peg$fail(peg$e40);
62638
+ peg$fail(peg$e41);
61898
62639
  }
61899
62640
  }
61900
62641
  return s0;
@@ -61948,7 +62689,7 @@ CREATE TABLE kvcache_key (id INTEGER PRIMARY KEY, key REAL);
61948
62689
  else {
61949
62690
  s3 = peg$FAILED;
61950
62691
  if (peg$silentFails === 0) {
61951
- peg$fail(peg$e41);
62692
+ peg$fail(peg$e36);
61952
62693
  }
61953
62694
  }
61954
62695
  if (s3 !== peg$FAILED) {