@actual-app/api 26.3.0 → 26.4.0-nightly.20260305

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 (205) hide show
  1. package/@types/app/bundle.api.d.ts +10 -9
  2. package/@types/app/bundle.api.d.ts.map +1 -0
  3. package/@types/app/query.d.ts +1 -0
  4. package/@types/app/query.d.ts.map +1 -0
  5. package/@types/index.d.ts +2 -1
  6. package/@types/index.d.ts.map +1 -0
  7. package/@types/injected.d.ts +1 -0
  8. package/@types/injected.d.ts.map +1 -0
  9. package/@types/methods.d.ts +8 -10
  10. package/@types/methods.d.ts.map +1 -0
  11. package/@types/migrations/1632571489012_remove_cache.d.ts +1 -0
  12. package/@types/migrations/1632571489012_remove_cache.d.ts.map +1 -0
  13. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts +1 -0
  14. package/@types/migrations/1722717601000_reports_move_selected_categories.d.ts.map +1 -0
  15. package/@types/migrations/1722804019000_create_dashboard_table.d.ts +1 -0
  16. package/@types/migrations/1722804019000_create_dashboard_table.d.ts.map +1 -0
  17. package/@types/migrations/1723665565000_prefs.d.ts +1 -0
  18. package/@types/migrations/1723665565000_prefs.d.ts.map +1 -0
  19. package/@types/migrations/1765518577215_multiple_dashboards.d.ts +1 -0
  20. package/@types/migrations/1765518577215_multiple_dashboards.d.ts.map +1 -0
  21. package/@types/utils.d.ts +1 -0
  22. package/@types/utils.d.ts.map +1 -0
  23. package/@types/validateNodeVersion.d.ts +1 -0
  24. package/@types/validateNodeVersion.d.ts.map +1 -0
  25. package/@types/vitest.config.d.ts +1 -0
  26. package/@types/vitest.config.d.ts.map +1 -0
  27. package/dist/.tsbuildinfo +1 -0
  28. package/dist/app/bundle.api.js +275 -230
  29. package/dist/package.json +1 -1
  30. package/package.json +1 -1
  31. package/@types/loot-core/src/mocks/budget.d.ts +0 -2
  32. package/@types/loot-core/src/mocks/index.d.ts +0 -10
  33. package/@types/loot-core/src/mocks/random.d.ts +0 -1
  34. package/@types/loot-core/src/mocks/util.d.ts +0 -8
  35. package/@types/loot-core/src/platform/exceptions/index.d.ts +0 -2
  36. package/@types/loot-core/src/platform/server/asyncStorage/index-types.d.ts +0 -19
  37. package/@types/loot-core/src/platform/server/asyncStorage/index.d.ts +0 -11
  38. package/@types/loot-core/src/platform/server/connection/index-types.d.ts +0 -11
  39. package/@types/loot-core/src/platform/server/connection/index.d.ts +0 -5
  40. package/@types/loot-core/src/platform/server/fetch/index.d.ts +0 -1
  41. package/@types/loot-core/src/platform/server/fs/index.d.ts +0 -22
  42. package/@types/loot-core/src/platform/server/fs/path-join.d.ts +0 -1
  43. package/@types/loot-core/src/platform/server/fs/shared.d.ts +0 -3
  44. package/@types/loot-core/src/platform/server/indexeddb/index.d.ts +0 -15
  45. package/@types/loot-core/src/platform/server/log/index.d.ts +0 -11
  46. package/@types/loot-core/src/platform/server/sqlite/index.d.ts +0 -53
  47. package/@types/loot-core/src/platform/server/sqlite/normalise.d.ts +0 -1
  48. package/@types/loot-core/src/platform/server/sqlite/unicodeLike.d.ts +0 -1
  49. package/@types/loot-core/src/server/accounts/app.d.ts +0 -159
  50. package/@types/loot-core/src/server/accounts/link.d.ts +0 -6
  51. package/@types/loot-core/src/server/accounts/payees.d.ts +0 -5
  52. package/@types/loot-core/src/server/accounts/sync.d.ts +0 -25
  53. package/@types/loot-core/src/server/accounts/title/index.d.ts +0 -3
  54. package/@types/loot-core/src/server/accounts/title/lower-case.d.ts +0 -1
  55. package/@types/loot-core/src/server/accounts/title/specials.d.ts +0 -1
  56. package/@types/loot-core/src/server/admin/app.d.ts +0 -70
  57. package/@types/loot-core/src/server/api-models.d.ts +0 -94
  58. package/@types/loot-core/src/server/api.d.ts +0 -2
  59. package/@types/loot-core/src/server/api.test.d.ts +0 -1
  60. package/@types/loot-core/src/server/app.d.ts +0 -24
  61. package/@types/loot-core/src/server/aql/compiler.d.ts +0 -56
  62. package/@types/loot-core/src/server/aql/exec.d.ts +0 -17
  63. package/@types/loot-core/src/server/aql/index.d.ts +0 -13
  64. package/@types/loot-core/src/server/aql/schema/executors.d.ts +0 -3
  65. package/@types/loot-core/src/server/aql/schema/index.d.ts +0 -427
  66. package/@types/loot-core/src/server/aql/schema-helpers.d.ts +0 -8
  67. package/@types/loot-core/src/server/aql/views.d.ts +0 -1
  68. package/@types/loot-core/src/server/auth/app.d.ts +0 -144
  69. package/@types/loot-core/src/server/budget/actions.d.ts +0 -85
  70. package/@types/loot-core/src/server/budget/app.d.ts +0 -118
  71. package/@types/loot-core/src/server/budget/base.d.ts +0 -18
  72. package/@types/loot-core/src/server/budget/category-template-context.d.ts +0 -54
  73. package/@types/loot-core/src/server/budget/cleanup-template.d.ts +0 -11
  74. package/@types/loot-core/src/server/budget/envelope.d.ts +0 -7
  75. package/@types/loot-core/src/server/budget/goal-template.d.ts +0 -38
  76. package/@types/loot-core/src/server/budget/report.d.ts +0 -5
  77. package/@types/loot-core/src/server/budget/schedule-template.d.ts +0 -8
  78. package/@types/loot-core/src/server/budget/statements.d.ts +0 -9
  79. package/@types/loot-core/src/server/budget/template-notes.d.ts +0 -13
  80. package/@types/loot-core/src/server/budget/util.d.ts +0 -4
  81. package/@types/loot-core/src/server/budgetfiles/app.d.ts +0 -137
  82. package/@types/loot-core/src/server/budgetfiles/backups.d.ts +0 -16
  83. package/@types/loot-core/src/server/cloud-storage.d.ts +0 -40
  84. package/@types/loot-core/src/server/dashboard/app.d.ts +0 -54
  85. package/@types/loot-core/src/server/db/index.d.ts +0 -138
  86. package/@types/loot-core/src/server/db/mappings.d.ts +0 -3
  87. package/@types/loot-core/src/server/db/sort.d.ts +0 -11
  88. package/@types/loot-core/src/server/db/types/index.d.ts +0 -287
  89. package/@types/loot-core/src/server/db/util.d.ts +0 -2
  90. package/@types/loot-core/src/server/encryption/app.d.ts +0 -40
  91. package/@types/loot-core/src/server/encryption/encryption-internals.d.ts +0 -22
  92. package/@types/loot-core/src/server/encryption/index.d.ts +0 -40
  93. package/@types/loot-core/src/server/errors.d.ts +0 -92
  94. package/@types/loot-core/src/server/filters/app.d.ts +0 -26
  95. package/@types/loot-core/src/server/importers/actual.d.ts +0 -3
  96. package/@types/loot-core/src/server/importers/index.d.ts +0 -4
  97. package/@types/loot-core/src/server/importers/ynab4-types.d.ts +0 -135
  98. package/@types/loot-core/src/server/importers/ynab4.d.ts +0 -4
  99. package/@types/loot-core/src/server/importers/ynab5-types.d.ts +0 -181
  100. package/@types/loot-core/src/server/importers/ynab5.d.ts +0 -4
  101. package/@types/loot-core/src/server/main-app.d.ts +0 -17
  102. package/@types/loot-core/src/server/main.d.ts +0 -50
  103. package/@types/loot-core/src/server/main.test.d.ts +0 -1
  104. package/@types/loot-core/src/server/migrate/migrations.d.ts +0 -9
  105. package/@types/loot-core/src/server/models.d.ts +0 -39
  106. package/@types/loot-core/src/server/mutators.d.ts +0 -17
  107. package/@types/loot-core/src/server/notes/app.d.ts +0 -23
  108. package/@types/loot-core/src/server/payees/app.d.ts +0 -48
  109. package/@types/loot-core/src/server/polyfills.d.ts +0 -1
  110. package/@types/loot-core/src/server/post.d.ts +0 -5
  111. package/@types/loot-core/src/server/preferences/app.d.ts +0 -43
  112. package/@types/loot-core/src/server/prefs.d.ts +0 -15
  113. package/@types/loot-core/src/server/reports/app.d.ts +0 -35
  114. package/@types/loot-core/src/server/rules/action.d.ts +0 -24
  115. package/@types/loot-core/src/server/rules/app.d.ts +0 -67
  116. package/@types/loot-core/src/server/rules/condition.d.ts +0 -59
  117. package/@types/loot-core/src/server/rules/customFunctions.d.ts +0 -13
  118. package/@types/loot-core/src/server/rules/handlebars-helpers.d.ts +0 -1
  119. package/@types/loot-core/src/server/rules/index.d.ts +0 -11
  120. package/@types/loot-core/src/server/rules/rule-indexer.d.ts +0 -17
  121. package/@types/loot-core/src/server/rules/rule-utils.d.ts +0 -19
  122. package/@types/loot-core/src/server/rules/rule.d.ts +0 -24
  123. package/@types/loot-core/src/server/schedules/app.d.ts +0 -62
  124. package/@types/loot-core/src/server/schedules/find-schedules.d.ts +0 -1
  125. package/@types/loot-core/src/server/server-config.d.ts +0 -12
  126. package/@types/loot-core/src/server/sheet.d.ts +0 -12
  127. package/@types/loot-core/src/server/sheet.test.d.ts +0 -1
  128. package/@types/loot-core/src/server/spreadsheet/app.d.ts +0 -38
  129. package/@types/loot-core/src/server/spreadsheet/globals.d.ts +0 -1
  130. package/@types/loot-core/src/server/spreadsheet/graph-data-structure.d.ts +0 -15
  131. package/@types/loot-core/src/server/spreadsheet/spreadsheet.d.ts +0 -87
  132. package/@types/loot-core/src/server/spreadsheet/util.d.ts +0 -5
  133. package/@types/loot-core/src/server/sync/app.d.ts +0 -38
  134. package/@types/loot-core/src/server/sync/encoder.d.ts +0 -9
  135. package/@types/loot-core/src/server/sync/index.d.ts +0 -47
  136. package/@types/loot-core/src/server/sync/make-test-message.d.ts +0 -9
  137. package/@types/loot-core/src/server/sync/migrate.d.ts +0 -2
  138. package/@types/loot-core/src/server/sync/repair.d.ts +0 -6
  139. package/@types/loot-core/src/server/sync/reset.d.ts +0 -6
  140. package/@types/loot-core/src/server/sync/utils.d.ts +0 -3
  141. package/@types/loot-core/src/server/tags/app.d.ts +0 -32
  142. package/@types/loot-core/src/server/tools/app.d.ts +0 -30
  143. package/@types/loot-core/src/server/transactions/app.d.ts +0 -64
  144. package/@types/loot-core/src/server/transactions/export/export-to-csv.d.ts +0 -2
  145. package/@types/loot-core/src/server/transactions/import/ofx2json.d.ts +0 -15
  146. package/@types/loot-core/src/server/transactions/import/parse-file.d.ts +0 -27
  147. package/@types/loot-core/src/server/transactions/import/qif2json.d.ts +0 -26
  148. package/@types/loot-core/src/server/transactions/import/xmlcamt2json.d.ts +0 -10
  149. package/@types/loot-core/src/server/transactions/index.d.ts +0 -18
  150. package/@types/loot-core/src/server/transactions/merge.d.ts +0 -2
  151. package/@types/loot-core/src/server/transactions/transaction-rules.d.ts +0 -57
  152. package/@types/loot-core/src/server/transactions/transfer.d.ts +0 -26
  153. package/@types/loot-core/src/server/undo.d.ts +0 -14
  154. package/@types/loot-core/src/server/update.d.ts +0 -1
  155. package/@types/loot-core/src/server/util/budget-name.d.ts +0 -6
  156. package/@types/loot-core/src/server/util/custom-sync-mapping.d.ts +0 -4
  157. package/@types/loot-core/src/server/util/rschedule.d.ts +0 -7
  158. package/@types/loot-core/src/shared/async.d.ts +0 -4
  159. package/@types/loot-core/src/shared/currencies.d.ts +0 -11
  160. package/@types/loot-core/src/shared/dashboard.d.ts +0 -2
  161. package/@types/loot-core/src/shared/environment.d.ts +0 -4
  162. package/@types/loot-core/src/shared/errors.d.ts +0 -25
  163. package/@types/loot-core/src/shared/locale.d.ts +0 -2
  164. package/@types/loot-core/src/shared/months.d.ts +0 -71
  165. package/@types/loot-core/src/shared/normalisation.d.ts +0 -1
  166. package/@types/loot-core/src/shared/platform.d.ts +0 -5
  167. package/@types/loot-core/src/shared/query.d.ts +0 -46
  168. package/@types/loot-core/src/shared/rules.d.ts +0 -40
  169. package/@types/loot-core/src/shared/schedules.d.ts +0 -36
  170. package/@types/loot-core/src/shared/transactions.d.ts +0 -68
  171. package/@types/loot-core/src/shared/util.d.ts +0 -95
  172. package/@types/loot-core/src/types/api-handlers.d.ts +0 -199
  173. package/@types/loot-core/src/types/budget.d.ts +0 -8
  174. package/@types/loot-core/src/types/handlers.d.ts +0 -23
  175. package/@types/loot-core/src/types/models/account.d.ts +0 -21
  176. package/@types/loot-core/src/types/models/bank-sync.d.ts +0 -16
  177. package/@types/loot-core/src/types/models/bank.d.ts +0 -6
  178. package/@types/loot-core/src/types/models/category-group.d.ts +0 -10
  179. package/@types/loot-core/src/types/models/category.d.ts +0 -14
  180. package/@types/loot-core/src/types/models/dashboard.d.ts +0 -126
  181. package/@types/loot-core/src/types/models/gocardless.d.ts +0 -71
  182. package/@types/loot-core/src/types/models/import-transaction.d.ts +0 -45
  183. package/@types/loot-core/src/types/models/index.d.ts +0 -21
  184. package/@types/loot-core/src/types/models/note.d.ts +0 -4
  185. package/@types/loot-core/src/types/models/openid.d.ts +0 -8
  186. package/@types/loot-core/src/types/models/payee.d.ts +0 -9
  187. package/@types/loot-core/src/types/models/pluggyai.d.ts +0 -17
  188. package/@types/loot-core/src/types/models/reports.d.ts +0 -124
  189. package/@types/loot-core/src/types/models/rule.d.ts +0 -86
  190. package/@types/loot-core/src/types/models/schedule.d.ts +0 -47
  191. package/@types/loot-core/src/types/models/simplefin.d.ts +0 -24
  192. package/@types/loot-core/src/types/models/tags.d.ts +0 -6
  193. package/@types/loot-core/src/types/models/templates.d.ts +0 -109
  194. package/@types/loot-core/src/types/models/transaction-filter.d.ts +0 -8
  195. package/@types/loot-core/src/types/models/transaction.d.ts +0 -37
  196. package/@types/loot-core/src/types/models/user-access.d.ts +0 -9
  197. package/@types/loot-core/src/types/models/user.d.ts +0 -22
  198. package/@types/loot-core/src/types/prefs.d.ts +0 -94
  199. package/@types/loot-core/src/types/server-events.d.ts +0 -61
  200. package/@types/loot-core/src/types/server-handlers.d.ts +0 -30
  201. package/@types/loot-core/src/types/util.d.ts +0 -13
  202. package/@types/loot-core/typings/pegjs.d.ts +0 -1
  203. package/@types/loot-core/typings/process-worker.d.ts +0 -9
  204. package/@types/loot-core/typings/vite-plugin-peggy-loader.d.ts +0 -1
  205. package/@types/loot-core/typings/window.d.ts +0 -45
@@ -119,13 +119,13 @@ const db$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
119
119
  return getAccount;
120
120
  },
121
121
  get getAccounts() {
122
- return getAccounts$2;
122
+ return getAccounts$1;
123
123
  },
124
124
  get getAllTags() {
125
125
  return getAllTags;
126
126
  },
127
127
  get getCategories() {
128
- return getCategories$3;
128
+ return getCategories$2;
129
129
  },
130
130
  get getCategoriesGrouped() {
131
131
  return getCategoriesGrouped;
@@ -152,7 +152,7 @@ const db$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
152
152
  return getPayeeByName;
153
153
  },
154
154
  get getPayees() {
155
- return getPayees$2;
155
+ return getPayees$1;
156
156
  },
157
157
  get getTags() {
158
158
  return getTags$1;
@@ -3515,10 +3515,6 @@ if (typeof global !== "undefined") {
3515
3515
  global.require = globalThis.require;
3516
3516
  }
3517
3517
  }
3518
- let send$2;
3519
- function override(sendImplementation) {
3520
- send$2 = sendImplementation;
3521
- }
3522
3518
  var errCode;
3523
3519
  var hasRequiredErrCode;
3524
3520
  function requireErrCode() {
@@ -6563,6 +6559,9 @@ function isAfter$1(date, dateToCompare) {
6563
6559
  function isBefore$1(date, dateToCompare) {
6564
6560
  return +toDate(date) < +toDate(dateToCompare);
6565
6561
  }
6562
+ function isFriday(date, options) {
6563
+ return toDate(date, options?.in).getDay() === 5;
6564
+ }
6566
6565
  function transpose(date, constructor) {
6567
6566
  const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0);
6568
6567
  date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
@@ -15787,7 +15786,7 @@ async function execCategoryGroupsWithCategories(compilerState, queryState, sqlPi
15787
15786
  if (categoriesOption === "none") {
15788
15787
  return categoryGroups;
15789
15788
  }
15790
- const { data: categories } = await aqlQuery$1(q("categories").filter({
15789
+ const { data: categories } = await aqlQuery(q("categories").filter({
15791
15790
  group: { $oneof: categoryGroups.map((cg) => cg.id) }
15792
15791
  }).select("*"));
15793
15792
  return categoryGroups.map((group) => {
@@ -15856,7 +15855,7 @@ function aqlCompiledQuery(queryState, sqlPieces, compilerState, params) {
15856
15855
  executors: schemaExecutors
15857
15856
  });
15858
15857
  }
15859
- function aqlQuery$1(query, params) {
15858
+ function aqlQuery(query, params) {
15860
15859
  if (query instanceof Query) {
15861
15860
  query = query.serialize();
15862
15861
  }
@@ -16593,6 +16592,7 @@ const currencies = [
16593
16592
  { code: "SGD", name: "Singapore Dollar", symbol: "S$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
16594
16593
  { code: "THB", name: "Thai Baht", symbol: "฿", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
16595
16594
  { code: "TRY", name: "Turkish Lira", symbol: "₺", decimalPlaces: 2, numberFormat: "dot-comma", symbolFirst: true },
16595
+ { code: "TWD", name: "New Taiwan Dollar", symbol: "NT$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
16596
16596
  { code: "UAH", name: "Ukrainian Hryvnia", symbol: "₴", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false },
16597
16597
  { code: "USD", name: "US Dollar", symbol: "$", decimalPlaces: 2, numberFormat: "comma-dot", symbolFirst: true },
16598
16598
  { code: "UZS", name: "Uzbek Soum", symbol: "UZS", decimalPlaces: 2, numberFormat: "space-comma", symbolFirst: false }
@@ -56232,7 +56232,7 @@ async function addMovementNotes({ month, amount, to, from, currencyCode }) {
56232
56232
  const existingMonthBudgetNotes = addNewLine(firstSync(`SELECT n.note FROM notes n WHERE n.id = ?`, [monthBudgetNotesId])?.note);
56233
56233
  const locale = getLocale(await getItem("language"));
56234
56234
  const displayDay = format$1(currentDate(), "MMMM dd", locale);
56235
- const categories = await getCategories$3([from, to].filter((c) => c !== "to-budget" && c !== "overbudgeted"));
56235
+ const categories = await getCategories$2([from, to].filter((c) => c !== "to-budget" && c !== "overbudgeted"));
56236
56236
  const fromCategoryName = from === "to-budget" ? "To Budget" : categories.find((c) => c.id === from)?.name;
56237
56237
  const toCategoryName = to === "to-budget" ? "To Budget" : to === "overbudgeted" ? "Overbudgeted" : categories.find((c) => c.id === to)?.name;
56238
56238
  const note = `Reassigned ${displayAmount} from ${fromCategoryName} → ${toCategoryName} on ${displayDay}`;
@@ -56296,7 +56296,7 @@ function createBlankMonth(categories, sheetName, months) {
56296
56296
  get$3().createStatic(sheetName, "buffered", 0);
56297
56297
  categories.forEach((cat) => createBlankCategory(cat, months));
56298
56298
  }
56299
- function createCategory$4(cat, sheetName, prevSheetName) {
56299
+ function createCategory$3(cat, sheetName, prevSheetName) {
56300
56300
  if (!cat.is_income) {
56301
56301
  get$3().createStatic(sheetName, `budget-${cat.id}`, 0);
56302
56302
  if (get$3().getCellValue(sheetName, `budget-${cat.id}`) == null) {
@@ -56325,7 +56325,7 @@ function createCategory$4(cat, sheetName, prevSheetName) {
56325
56325
  });
56326
56326
  }
56327
56327
  }
56328
- function createCategoryGroup$3(group, sheetName) {
56328
+ function createCategoryGroup$2(group, sheetName) {
56329
56329
  get$3().createDynamic(sheetName, "group-sum-amount-" + group.id, {
56330
56330
  initialValue: 0,
56331
56331
  dependencies: group.categories.map((cat) => `sum-amount-${cat.id}`),
@@ -56486,7 +56486,7 @@ function handleCategoryChange$1(months, oldValue, newValue) {
56486
56486
  const prevSheetName = sheetForMonth(prevMonth$1);
56487
56487
  const sheetName = sheetForMonth(month);
56488
56488
  const { start, end } = bounds(month);
56489
- createCategory$2(newValue, sheetName, prevSheetName, start, end);
56489
+ createCategory$1(newValue, sheetName, prevSheetName, start, end);
56490
56490
  const id2 = newValue.id;
56491
56491
  const groupId = newValue.cat_group;
56492
56492
  get$3().addDependencies(sheetName, "last-month-overspent", [
@@ -56547,13 +56547,13 @@ function handleCategoryGroupChange$1(months, oldValue, newValue) {
56547
56547
  months.forEach((month) => {
56548
56548
  const sheetName = sheetForMonth(month);
56549
56549
  const categories = runQuery("SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?", [group.id], true);
56550
- createCategoryGroup$3({ ...group, categories }, sheetName);
56550
+ createCategoryGroup$2({ ...group, categories }, sheetName);
56551
56551
  addDeps(sheetName, group.id);
56552
56552
  });
56553
56553
  }
56554
56554
  }
56555
56555
  }
56556
- async function createCategory$3(cat, sheetName, prevSheetName) {
56556
+ async function createCategory$2(cat, sheetName, prevSheetName) {
56557
56557
  get$3().createStatic(sheetName, `budget-${cat.id}`, 0);
56558
56558
  if (get$3().getCellValue(sheetName, `budget-${cat.id}`) == null) {
56559
56559
  get$3().set(resolveName(sheetName, `budget-${cat.id}`), 0);
@@ -56588,7 +56588,7 @@ async function createCategory$3(cat, sheetName, prevSheetName) {
56588
56588
  });
56589
56589
  get$3().createStatic(sheetName, `carryover-${cat.id}`, false);
56590
56590
  }
56591
- function createCategoryGroup$2(group, sheetName) {
56591
+ function createCategoryGroup$1(group, sheetName) {
56592
56592
  get$3().createDynamic(sheetName, "group-sum-amount-" + group.id, {
56593
56593
  initialValue: 0,
56594
56594
  dependencies: group.categories.filter((cat) => !cat.hidden).map((cat) => `sum-amount-${cat.id}`),
@@ -56686,7 +56686,7 @@ function handleCategoryChange(months, oldValue, newValue) {
56686
56686
  const prevSheetName = sheetForMonth(prevMonth$1);
56687
56687
  const sheetName = sheetForMonth(month);
56688
56688
  const { start, end } = bounds(month);
56689
- createCategory$2(newValue, sheetName, prevSheetName, start, end);
56689
+ createCategory$1(newValue, sheetName, prevSheetName, start, end);
56690
56690
  const id2 = newValue.id;
56691
56691
  const groupId = newValue.cat_group;
56692
56692
  addDeps(sheetName, groupId, id2);
@@ -56749,7 +56749,7 @@ function handleCategoryGroupChange(months, oldValue, newValue) {
56749
56749
  months.forEach((month) => {
56750
56750
  const sheetName = sheetForMonth(month);
56751
56751
  const categories = runQuery("SELECT * FROM categories WHERE tombstone = 0 AND cat_group = ?", [group.id], true);
56752
- createCategoryGroup$2({ ...group, categories }, sheetName);
56752
+ createCategoryGroup$1({ ...group, categories }, sheetName);
56753
56753
  addDeps(sheetName, group.id);
56754
56754
  });
56755
56755
  }
@@ -56780,7 +56780,7 @@ function getBudgetRange(start, end) {
56780
56780
  end = addMonths(end, 12);
56781
56781
  return { start, end, range: rangeInclusive(start, end) };
56782
56782
  }
56783
- function createCategory$2(cat, sheetName, prevSheetName, start, end) {
56783
+ function createCategory$1(cat, sheetName, prevSheetName, start, end) {
56784
56784
  get$3().createDynamic(sheetName, "sum-amount-" + cat.id, {
56785
56785
  initialValue: 0,
56786
56786
  run: () => {
@@ -56794,10 +56794,10 @@ function createCategory$2(cat, sheetName, prevSheetName, start, end) {
56794
56794
  }
56795
56795
  });
56796
56796
  if (getBudgetType() === "envelope") {
56797
- createCategory$4(cat, sheetName, prevSheetName);
56797
+ createCategory$3(cat, sheetName, prevSheetName);
56798
56798
  }
56799
56799
  else {
56800
- void createCategory$3(cat, sheetName, prevSheetName);
56800
+ void createCategory$2(cat, sheetName, prevSheetName);
56801
56801
  }
56802
56802
  }
56803
56803
  function handleAccountChange(months, oldValue, newValue) {
@@ -56912,7 +56912,7 @@ async function doTransfer(categoryIds, transferId) {
56912
56912
  });
56913
56913
  }
56914
56914
  async function createBudget$2(months) {
56915
- const { data: groups } = await aqlQuery$1(q("category_groups").select("*"));
56915
+ const { data: groups } = await aqlQuery(q("category_groups").select("*"));
56916
56916
  const categories = groups.flatMap((group) => group.categories);
56917
56917
  startTransaction();
56918
56918
  const meta = get$3().meta();
@@ -56928,14 +56928,14 @@ async function createBudget$2(months) {
56928
56928
  const sheetName = sheetForMonth(month);
56929
56929
  const prevSheetName = sheetForMonth(prevMonth$1);
56930
56930
  categories.forEach((cat) => {
56931
- createCategory$2(cat, sheetName, prevSheetName, start, end);
56931
+ createCategory$1(cat, sheetName, prevSheetName, start, end);
56932
56932
  });
56933
56933
  groups.forEach((group) => {
56934
56934
  if (budgetType === "envelope") {
56935
- createCategoryGroup$3(group, sheetName);
56935
+ createCategoryGroup$2(group, sheetName);
56936
56936
  }
56937
56937
  else {
56938
- createCategoryGroup$2(group, sheetName);
56938
+ createCategoryGroup$1(group, sheetName);
56939
56939
  }
56940
56940
  });
56941
56941
  if (budgetType === "envelope") {
@@ -56986,9 +56986,6 @@ async function setType(type2) {
56986
56986
  get$3().endCacheBarrier();
56987
56987
  return bounds2;
56988
56988
  }
56989
- const app$j = createApp();
56990
- app$j.events.on("sync", (event) => {
56991
- });
56992
56989
  const runningMethods = /* @__PURE__ */ new Set();
56993
56990
  let currentContext = null;
56994
56991
  const mutatingMethods = /* @__PURE__ */ new WeakMap();
@@ -57054,6 +57051,12 @@ function getMutatorContext() {
57054
57051
  }
57055
57052
  return currentContext;
57056
57053
  }
57054
+ const app$j = createApp();
57055
+ app$j.events.on("sync", (event) => {
57056
+ });
57057
+ async function send(name, args) {
57058
+ return runHandler(app$j.handlers[name], args, { name });
57059
+ }
57057
57060
  const fetch$1 = globalThis.fetch;
57058
57061
  function throwIfNot200(res, text) {
57059
57062
  if (res.status !== 200) {
@@ -61602,7 +61605,7 @@ function insertWithSchema(table, row) {
61602
61605
  function updateWithSchema(table, fields) {
61603
61606
  return update(table, convertForUpdate(schema, schemaConfig, table, fields));
61604
61607
  }
61605
- async function getCategories$3(ids) {
61608
+ async function getCategories$2(ids) {
61606
61609
  const whereIn2 = ids ? `c.id IN (${toSqlQueryParameters(ids)}) AND` : "";
61607
61610
  const query = `SELECT c.* FROM categories c WHERE ${whereIn2} c.tombstone = 0 ORDER BY c.sort_order, c.id`;
61608
61611
  return ids ? await all(query, [...ids]) : await all(query);
@@ -61768,7 +61771,7 @@ async function mergePayees$1(target, ids) {
61768
61771
  ])));
61769
61772
  });
61770
61773
  }
61771
- function getPayees$2() {
61774
+ function getPayees$1() {
61772
61775
  return all(`
61773
61776
  SELECT p.*, COALESCE(a.name, p.name) AS name FROM payees p
61774
61777
  LEFT JOIN accounts a ON (p.transfer_acct = a.id AND a.tombstone = 0)
@@ -61822,7 +61825,7 @@ async function getOrphanedPayees$1() {
61822
61825
  async function getPayeeByName(name) {
61823
61826
  return first$2(`SELECT * FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0`, [name.toLowerCase()]);
61824
61827
  }
61825
- function getAccounts$2() {
61828
+ function getAccounts$1() {
61826
61829
  return all(`SELECT a.*, b.name as bankName, b.id as bankId FROM accounts a
61827
61830
  LEFT JOIN banks b ON a.bank = b.id
61828
61831
  WHERE a.tombstone = 0
@@ -61924,7 +61927,7 @@ async function findOrCreateBank(institution, requisitionId) {
61924
61927
  await insertWithUUID("banks", bankData);
61925
61928
  return bankData;
61926
61929
  }
61927
- async function createPayee$2(description) {
61930
+ async function createPayee$1(description) {
61928
61931
  const row = await first$2(`SELECT id FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0`, [description.toLowerCase()]);
61929
61932
  if (row) {
61930
61933
  return row.id;
@@ -61943,7 +61946,7 @@ async function getStartingBalancePayee() {
61943
61946
  if (category === null) {
61944
61947
  category = await first$2("SELECT * FROM categories WHERE is_income = 1 AND tombstone = 0");
61945
61948
  }
61946
- const id2 = await createPayee$2("Starting Balance");
61949
+ const id2 = await createPayee$1("Starting Balance");
61947
61950
  return {
61948
61951
  id: id2,
61949
61952
  category: category ? category.id : null
@@ -103852,7 +103855,6 @@ function getHasTransactionsQuery(schedules) {
103852
103855
  function recurConfigToRSchedule(config2) {
103853
103856
  const base = {
103854
103857
  start: parseDate$1(config2.start),
103855
- // @ts-expect-error: issues with https://gitlab.com/john.carroll.p/rschedule/-/issues/86
103856
103858
  frequency: config2.frequency.toUpperCase(),
103857
103859
  byHourOfDay: [12]
103858
103860
  };
@@ -108740,7 +108742,7 @@ async function insertRule(rule) {
108740
108742
  rule = ruleModel.validate(rule);
108741
108743
  return insertWithUUID("rules", ruleModel.fromJS(rule));
108742
108744
  }
108743
- async function updateRule$2(rule) {
108745
+ async function updateRule$1(rule) {
108744
108746
  rule = ruleModel.validate(rule, { update: true });
108745
108747
  return update("rules", ruleModel.fromJS(rule));
108746
108748
  }
@@ -108799,7 +108801,7 @@ async function getAllRuleIdsFromSchedules(excluding) {
108799
108801
  async function runRules$1(trans, accounts = null) {
108800
108802
  let accountsMap = null;
108801
108803
  if (accounts === null) {
108802
- accountsMap = new Map((await getAccounts$2()).map((account) => [account.id, account]));
108804
+ accountsMap = new Map((await getAccounts$1()).map((account) => [account.id, account]));
108803
108805
  }
108804
108806
  else {
108805
108807
  accountsMap = accounts;
@@ -109092,7 +109094,7 @@ async function applyActions(transactions, actions) {
109092
109094
  if (parsedActions.length !== actions.length) {
109093
109095
  return null;
109094
109096
  }
109095
- const accounts = await getAccounts$2();
109097
+ const accounts = await getAccounts$1();
109096
109098
  const accountsMap = new Map(accounts.map((account) => [account.id, account]));
109097
109099
  const transactionsForRules = await Promise.all(transactions.map((transactions2) => prepareTransactionForRules(transactions2, accountsMap)));
109098
109100
  const updated = transactionsForRules.flatMap((trans) => {
@@ -109146,7 +109148,7 @@ async function updatePayeeRenameRule(fromNames, to) {
109146
109148
  ...renameRule,
109147
109149
  conditions: [{ ...condition, value: newValue }]
109148
109150
  };
109149
- await updateRule$2(rule);
109151
+ await updateRule$1(rule);
109150
109152
  return renameRule.id;
109151
109153
  }
109152
109154
  else {
@@ -109217,7 +109219,7 @@ async function updateCategoryRules(transactions) {
109217
109219
  for (const rule of ruleSetters) {
109218
109220
  const action = rule.actions[0];
109219
109221
  if (action.value !== category) {
109220
- await updateRule$2({
109222
+ await updateRule$1({
109221
109223
  ...rule,
109222
109224
  actions: [{ ...action, value: category }]
109223
109225
  });
@@ -109277,7 +109279,7 @@ async function prepareTransactionForRules(trans, accounts = null) {
109277
109279
  }
109278
109280
  ]
109279
109281
  };
109280
- const { data: balance } = await aqlQuery$1(query.filter({ $or: [{ date: { $lt: dateBoundary } }, sameDayFilter] }).calculate({ $sum: "$amount" }));
109282
+ const { data: balance } = await aqlQuery(query.filter({ $or: [{ date: { $lt: dateBoundary } }, sameDayFilter] }).calculate({ $sum: "$amount" }));
109281
109283
  r.balance = balance ?? 0;
109282
109284
  }
109283
109285
  if (trans.category) {
@@ -109728,7 +109730,7 @@ async function updateAccountBalance(id2, balance) {
109728
109730
  ]);
109729
109731
  }
109730
109732
  async function getAccountOldestTransaction(id2) {
109731
- return (await aqlQuery$1(q("transactions").filter({
109733
+ return (await aqlQuery(q("transactions").filter({
109732
109734
  account: id2,
109733
109735
  date: { $lte: currentDay() }
109734
109736
  }).select("date").orderBy("date").limit(1))).data?.[0];
@@ -109911,9 +109913,9 @@ async function normalizeTransactions(transactions, acctId, { rawPayeeName = fals
109911
109913
  async function normalizeBankSyncTransactions(transactions, acctId) {
109912
109914
  const payeesToCreate = /* @__PURE__ */ new Map();
109913
109915
  const [customMappingsRaw, importPending, importNotes] = await Promise.all([
109914
- aqlQuery$1(q("preferences").filter({ id: `custom-sync-mappings-${acctId}` }).select("value")).then((data) => data?.data?.[0]?.value),
109915
- aqlQuery$1(q("preferences").filter({ id: `sync-import-pending-${acctId}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true"),
109916
- aqlQuery$1(q("preferences").filter({ id: `sync-import-notes-${acctId}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true")
109916
+ aqlQuery(q("preferences").filter({ id: `custom-sync-mappings-${acctId}` }).select("value")).then((data) => data?.data?.[0]?.value),
109917
+ aqlQuery(q("preferences").filter({ id: `sync-import-pending-${acctId}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true"),
109918
+ aqlQuery(q("preferences").filter({ id: `sync-import-notes-${acctId}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true")
109917
109919
  ]);
109918
109920
  const mappings = customMappingsRaw ? mappingsFromString(customMappingsRaw) : defaultMappings;
109919
109921
  const normalized = [];
@@ -110086,11 +110088,11 @@ async function reconcileTransactions(acctId, transactions, isBankSyncAccount = f
110086
110088
  }
110087
110089
  async function matchTransactions(acctId, transactions, isBankSyncAccount = false, strictIdChecking = true) {
110088
110090
  logger.log("Performing transaction reconciliation matching");
110089
- const reimportDeleted = await aqlQuery$1(q("preferences").filter({ id: `sync-reimport-deleted-${acctId}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true");
110091
+ const reimportDeleted = await aqlQuery(q("preferences").filter({ id: `sync-reimport-deleted-${acctId}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true");
110090
110092
  const hasMatched = /* @__PURE__ */ new Set();
110091
110093
  const transactionNormalization = isBankSyncAccount ? normalizeBankSyncTransactions : normalizeTransactions;
110092
110094
  const { normalized, payeesToCreate } = await transactionNormalization(transactions, acctId);
110093
- const accounts = await getAccounts$2();
110095
+ const accounts = await getAccounts$1();
110094
110096
  const accountsMap = new Map(accounts.map((account) => [account.id, account]));
110095
110097
  const transactionsStep1 = [];
110096
110098
  for (const { payee_name, trans: originalTrans, subtransactions } of normalized) {
@@ -110168,10 +110170,10 @@ async function matchTransactions(acctId, transactions, isBankSyncAccount = false
110168
110170
  transactionsStep3
110169
110171
  };
110170
110172
  }
110171
- async function addTransactions$1(acctId, transactions, { runTransfers = true, learnCategories = false } = {}) {
110173
+ async function addTransactions(acctId, transactions, { runTransfers = true, learnCategories = false } = {}) {
110172
110174
  const added = [];
110173
110175
  const { normalized, payeesToCreate } = await normalizeTransactions(transactions, acctId, { rawPayeeName: true });
110174
- const accounts = await getAccounts$2();
110176
+ const accounts = await getAccounts$1();
110175
110177
  const accountsMap = new Map(accounts.map((account) => [account.id, account]));
110176
110178
  for (const { trans: originalTrans, subtransactions } of normalized) {
110177
110179
  const trans = await runRules$1(originalTrans, accountsMap);
@@ -110208,8 +110210,8 @@ async function addTransactions$1(acctId, transactions, { runTransfers = true, le
110208
110210
  }
110209
110211
  async function processBankSyncDownload(download2, id2, acctRow, initialSync = false, customStartingBalance, customStartingDate) {
110210
110212
  const useStrictIdChecking = !acctRow.account_sync_source;
110211
- const importTransactions2 = await aqlQuery$1(q("preferences").filter({ id: `sync-import-transactions-${id2}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true");
110212
- const updateDates = await aqlQuery$1(q("preferences").filter({ id: `sync-update-dates-${id2}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "false") === "true");
110213
+ const importTransactions2 = await aqlQuery(q("preferences").filter({ id: `sync-import-transactions-${id2}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "true") === "true");
110214
+ const updateDates = await aqlQuery(q("preferences").filter({ id: `sync-update-dates-${id2}` }).select("value")).then((data) => String(data?.data?.[0]?.value ?? "false") === "true");
110213
110215
  const { transactions: originalTransactions, startingBalance: currentBalance } = download2;
110214
110216
  if (initialSync) {
110215
110217
  const { transactions: transactions2 } = download2;
@@ -110321,8 +110323,8 @@ async function updateAccount({ id: id2, name, last_reconciled }) {
110321
110323
  });
110322
110324
  return {};
110323
110325
  }
110324
- async function getAccounts$1() {
110325
- const dbAccounts = await getAccounts$2();
110326
+ async function getAccounts() {
110327
+ const dbAccounts = await getAccounts$1();
110326
110328
  return dbAccounts.map((dbAccount) => ({
110327
110329
  id: dbAccount.id,
110328
110330
  name: dbAccount.name,
@@ -110468,7 +110470,7 @@ async function linkPluggyAiAccount({ externalAccount, upgradingId, offBudget = f
110468
110470
  await syncAccount(void 0, void 0, id2, externalAccount.account_id, bank.bank_id, startingDate, startingBalance);
110469
110471
  return "ok";
110470
110472
  }
110471
- async function createAccount$1({ name, balance = 0, offBudget = false, closed = false }) {
110473
+ async function createAccount({ name, balance = 0, offBudget = false, closed = false }) {
110472
110474
  const id2 = await insertAccount({
110473
110475
  name,
110474
110476
  offbudget: offBudget ? 1 : 0,
@@ -111002,13 +111004,13 @@ async function unlinkAccount({ id: id2 }) {
111002
111004
  }
111003
111005
  const app$i = createApp();
111004
111006
  app$i.method("account-update", mutator(undoable(updateAccount)));
111005
- app$i.method("accounts-get", getAccounts$1);
111007
+ app$i.method("accounts-get", getAccounts);
111006
111008
  app$i.method("account-balance", getAccountBalance);
111007
111009
  app$i.method("account-properties", getAccountProperties);
111008
111010
  app$i.method("gocardless-accounts-link", linkGoCardlessAccount);
111009
111011
  app$i.method("simplefin-accounts-link", linkSimpleFinAccount);
111010
111012
  app$i.method("pluggyai-accounts-link", linkPluggyAiAccount);
111011
- app$i.method("account-create", mutator(undoable(createAccount$1)));
111013
+ app$i.method("account-create", mutator(undoable(createAccount)));
111012
111014
  app$i.method("account-close", mutator(closeAccount));
111013
111015
  app$i.method("account-reopen", mutator(undoable(reopenAccount)));
111014
111016
  app$i.method("account-move", mutator(undoable(moveAccount)));
@@ -111593,7 +111595,7 @@ handlers["api/abort-import"] = async function () {
111593
111595
  };
111594
111596
  handlers["api/query"] = async function ({ query }) {
111595
111597
  checkFileOpen();
111596
- return aqlQuery$1(query);
111598
+ return aqlQuery(query);
111597
111599
  };
111598
111600
  handlers["api/budget-months"] = async function () {
111599
111601
  checkFileOpen();
@@ -111603,7 +111605,7 @@ handlers["api/budget-months"] = async function () {
111603
111605
  handlers["api/budget-month"] = async function ({ month }) {
111604
111606
  checkFileOpen();
111605
111607
  await validateMonth(month);
111606
- const { data: groups } = await aqlQuery$1(q("category_groups").select("*"));
111608
+ const { data: groups } = await aqlQuery(q("category_groups").select("*"));
111607
111609
  const sheetName = sheetForMonth(month);
111608
111610
  function value(name) {
111609
111611
  const v = get$3().getCellValue(sheetName, name);
@@ -111701,7 +111703,7 @@ handlers["api/transactions-import"] = withMutation(async function ({ accountId,
111701
111703
  });
111702
111704
  handlers["api/transactions-add"] = withMutation(async function ({ accountId, transactions, runTransfers = false, learnCategories = false }) {
111703
111705
  checkFileOpen();
111704
- await addTransactions$1(accountId, transactions, {
111706
+ await addTransactions(accountId, transactions, {
111705
111707
  runTransfers,
111706
111708
  learnCategories
111707
111709
  });
@@ -111709,7 +111711,7 @@ handlers["api/transactions-add"] = withMutation(async function ({ accountId, tra
111709
111711
  });
111710
111712
  handlers["api/transactions-get"] = async function ({ accountId, startDate, endDate }) {
111711
111713
  checkFileOpen();
111712
- const { data } = await aqlQuery$1(q("transactions").filter({
111714
+ const { data } = await aqlQuery(q("transactions").filter({
111713
111715
  $and: [
111714
111716
  accountId && { account: accountId },
111715
111717
  startDate && { date: { $gte: startDate } },
@@ -111720,7 +111722,7 @@ handlers["api/transactions-get"] = async function ({ accountId, startDate, endDa
111720
111722
  };
111721
111723
  handlers["api/transaction-update"] = withMutation(async function ({ id: id2, fields }) {
111722
111724
  checkFileOpen();
111723
- const { data } = await aqlQuery$1(q("transactions").filter({ id: id2 }).select("*").options({ splits: "grouped" }));
111725
+ const { data } = await aqlQuery(q("transactions").filter({ id: id2 }).select("*").options({ splits: "grouped" }));
111724
111726
  const transactions = ungroupTransactions(data);
111725
111727
  if (transactions.length === 0) {
111726
111728
  return [];
@@ -111730,7 +111732,7 @@ handlers["api/transaction-update"] = withMutation(async function ({ id: id2, fie
111730
111732
  });
111731
111733
  handlers["api/transaction-delete"] = withMutation(async function ({ id: id2 }) {
111732
111734
  checkFileOpen();
111733
- const { data } = await aqlQuery$1(q("transactions").filter({ id: id2 }).select("*").options({ splits: "grouped" }));
111735
+ const { data } = await aqlQuery(q("transactions").filter({ id: id2 }).select("*").options({ splits: "grouped" }));
111734
111736
  const transactions = ungroupTransactions(data);
111735
111737
  if (transactions.length === 0) {
111736
111738
  return [];
@@ -111912,7 +111914,7 @@ handlers["api/rule-delete"] = withMutation(async function (id2) {
111912
111914
  });
111913
111915
  handlers["api/schedules-get"] = async function () {
111914
111916
  checkFileOpen();
111915
- const { data } = await aqlQuery$1(q("schedules").select("*"));
111917
+ const { data } = await aqlQuery(q("schedules").select("*"));
111916
111918
  const schedules = data;
111917
111919
  return schedules.map((schedule) => scheduleModel.toExternal(schedule));
111918
111920
  };
@@ -111930,7 +111932,7 @@ handlers["api/schedule-create"] = withMutation(async function (schedule) {
111930
111932
  });
111931
111933
  handlers["api/schedule-update"] = withMutation(async function ({ id: id2, fields, resetNextDate }) {
111932
111934
  checkFileOpen();
111933
- const { data } = await aqlQuery$1(q("schedules").filter({ id: id2 }).select("*"));
111935
+ const { data } = await aqlQuery(q("schedules").filter({ id: id2 }).select("*"));
111934
111936
  if (!data || data.length === 0) {
111935
111937
  throw APIError(`Schedule ${id2} not found`);
111936
111938
  }
@@ -111946,7 +111948,7 @@ handlers["api/schedule-update"] = withMutation(async function ({ id: id2, fields
111946
111948
  switch (typedKey) {
111947
111949
  case "name": {
111948
111950
  const newName = String(value);
111949
- const { data: existing } = await aqlQuery$1(q("schedules").filter({ name: newName }).select("*"));
111951
+ const { data: existing } = await aqlQuery(q("schedules").filter({ name: newName }).select("*"));
111950
111952
  if (!existing || existing.length === 0 || existing[0].id === sched.id) {
111951
111953
  sched.name = newName;
111952
111954
  conditionsUpdated = true;
@@ -112069,7 +112071,7 @@ handlers["api/get-id-by-name"] = async function ({ type: type2, name }) {
112069
112071
  if (!allowedTypes.includes(type2)) {
112070
112072
  throw APIError("Provide a valid type");
112071
112073
  }
112072
- const { data } = await aqlQuery$1(q(type2).filter({ name }).select("*"));
112074
+ const { data } = await aqlQuery(q(type2).filter({ name }).select("*"));
112073
112075
  if (!data || data.length === 0) {
112074
112076
  throw APIError(`Not found: ${type2} with name ${name}`);
112075
112077
  }
@@ -117229,7 +117231,7 @@ function takeDates(config2) {
117229
117231
  return schedule.occurrences({ take: 3 }).toArray().map((d2) => d2.date);
117230
117232
  }
117231
117233
  async function getTransactions(date, account) {
117232
- const { data } = await aqlQuery$1(q("transactions").filter({
117234
+ const { data } = await aqlQuery(q("transactions").filter({
117233
117235
  account,
117234
117236
  schedule: null,
117235
117237
  // Don't match transfers
@@ -117385,7 +117387,7 @@ async function findStartDate(schedule) {
117385
117387
  currentConfig = null;
117386
117388
  break;
117387
117389
  }
117388
- const { data } = await aqlQuery$1(q("transactions").filter({ $and: filters }).select("*"));
117390
+ const { data } = await aqlQuery(q("transactions").filter({ $and: filters }).select("*"));
117389
117391
  if (data.length === 0) {
117390
117392
  currentConfig = prevConfig;
117391
117393
  break;
@@ -117401,7 +117403,7 @@ async function findStartDate(schedule) {
117401
117403
  return schedule;
117402
117404
  }
117403
117405
  async function findSchedules() {
117404
- const { data: accounts } = await aqlQuery$1(q("accounts").filter({ closed: false }).select("*"));
117406
+ const { data: accounts } = await aqlQuery(q("accounts").filter({ closed: false }).select("*"));
117405
117407
  let allSchedules = [];
117406
117408
  for (const account of accounts) {
117407
117409
  const latestTrans = await first$2("SELECT date FROM v_transactions WHERE account = ? AND parent_id IS NULL ORDER BY date DESC LIMIT 1", [account.id]);
@@ -117463,11 +117465,11 @@ async function getRuleForSchedule(id2) {
117463
117465
  if (id2 == null) {
117464
117466
  throw new Error("Schedule not attached to a rule");
117465
117467
  }
117466
- const { data: ruleId } = await aqlQuery$1(q("schedules").filter({ id: id2 }).calculate("rule"));
117468
+ const { data: ruleId } = await aqlQuery(q("schedules").filter({ id: id2 }).calculate("rule"));
117467
117469
  return getRules$1().find((rule) => rule.id === ruleId);
117468
117470
  }
117469
117471
  async function fixRuleForSchedule(id2) {
117470
- const { data: ruleId } = await aqlQuery$1(q("schedules").filter({ id: id2 }).calculate("rule"));
117472
+ const { data: ruleId } = await aqlQuery(q("schedules").filter({ id: id2 }).calculate("rule"));
117471
117473
  if (ruleId) {
117472
117474
  await delete_("rules", ruleId);
117473
117475
  }
@@ -117483,7 +117485,7 @@ async function fixRuleForSchedule(id2) {
117483
117485
  await updateWithSchema("schedules", { id: id2, rule: newId });
117484
117486
  return getRules$1().find((rule) => rule.id === newId);
117485
117487
  }
117486
- async function setNextDate({ id: id2, start, conditions, reset }) {
117488
+ async function setNextDate({ id: id2, start, conditions, reset, skipRequested }) {
117487
117489
  if (conditions == null) {
117488
117490
  const rule = await getRuleForSchedule(id2);
117489
117491
  if (rule == null) {
@@ -117492,7 +117494,17 @@ async function setNextDate({ id: id2, start, conditions, reset }) {
117492
117494
  conditions = rule.serialize().conditions;
117493
117495
  }
117494
117496
  const { date: dateCond } = extractScheduleConds(conditions);
117495
- const { data: nextDate } = await aqlQuery$1(q("schedules").filter({ id: id2 }).calculate("next_date"));
117497
+ let { data: nextDate } = await aqlQuery(q("schedules").filter({ id: id2 }).calculate("next_date"));
117498
+ if (skipRequested === true) {
117499
+ const skipWeekend = dateCond.value?.skipWeekend;
117500
+ const weekendSolveMode = dateCond.value?.weekendSolveMode;
117501
+ if (weekendSolveMode === "before" && skipWeekend === true) {
117502
+ const parsedNextDate = parseDate$1(nextDate);
117503
+ if (isFriday(parsedNextDate) || isWeekend(parsedNextDate)) {
117504
+ nextDate = dayFromDate(nextMonday(parsedNextDate));
117505
+ }
117506
+ }
117507
+ }
117496
117508
  if (dateCond) {
117497
117509
  const newNextDate = getNextDate(dateCond, start ? start(nextDate) : /* @__PURE__ */ new Date());
117498
117510
  if (newNextDate !== nextDate) {
@@ -117519,7 +117531,7 @@ async function checkIfScheduleExists(name, scheduleId) {
117519
117531
  }
117520
117532
  return true;
117521
117533
  }
117522
- async function createSchedule$1({ schedule = null, conditions = [] } = {}) {
117534
+ async function createSchedule({ schedule = null, conditions = [] } = {}) {
117523
117535
  const scheduleId = schedule?.id || v4();
117524
117536
  const { date: dateCond } = extractScheduleConds(conditions);
117525
117537
  if (dateCond == null) {
@@ -117580,7 +117592,7 @@ async function updateSchedule({ schedule, conditions, resetNextDate }) {
117580
117592
  if (conditions) {
117581
117593
  const oldConditions = rule.serialize().conditions;
117582
117594
  const newConditions = updateConditions(oldConditions, conditions);
117583
- await updateRule$2({ id: rule.id, conditions: newConditions });
117595
+ await updateRule$1({ id: rule.id, conditions: newConditions });
117584
117596
  const stripType = ({ type: _type, ...fields }) => fields;
117585
117597
  if (resetNextDate || !deepEqual(oldConditions.find((c) => c.field === "account"), oldConditions.find((c) => c.field === "account")) || !deepEqual(stripType(oldConditions.find((c) => c.field === "date") || {}), stripType(newConditions.find((c) => c.field === "date") || {}))) {
117586
117598
  await setNextDate({
@@ -117598,7 +117610,7 @@ async function updateSchedule({ schedule, conditions, resetNextDate }) {
117598
117610
  return schedule.id;
117599
117611
  }
117600
117612
  async function deleteSchedule({ id: id2 }) {
117601
- const { data: ruleId } = await aqlQuery$1(q("schedules").filter({ id: id2 }).calculate("rule"));
117613
+ const { data: ruleId } = await aqlQuery(q("schedules").filter({ id: id2 }).calculate("rule"));
117602
117614
  await batchMessages(async () => {
117603
117615
  await delete_("rules", ruleId);
117604
117616
  await delete_("schedules", id2);
@@ -117609,7 +117621,8 @@ async function skipNextDate({ id: id2 }) {
117609
117621
  id: id2,
117610
117622
  start: (nextDate) => {
117611
117623
  return addDays$1(parseDate$1(nextDate), 1);
117612
- }
117624
+ },
117625
+ skipRequested: true
117613
117626
  });
117614
117627
  }
117615
117628
  function discoverSchedules() {
@@ -117664,7 +117677,7 @@ function onApplySync(oldValues, newValues) {
117664
117677
  });
117665
117678
  }
117666
117679
  async function postTransactionForSchedule({ id: id2, today }) {
117667
- const { data } = await aqlQuery$1(q("schedules").filter({ id: id2 }).select("*"));
117680
+ const { data } = await aqlQuery(q("schedules").filter({ id: id2 }).select("*"));
117668
117681
  const schedule = data[0];
117669
117682
  if (schedule == null || schedule._account == null) {
117670
117683
  return;
@@ -117678,15 +117691,15 @@ async function postTransactionForSchedule({ id: id2, today }) {
117678
117691
  cleared: false
117679
117692
  };
117680
117693
  if (transaction2.account) {
117681
- await addTransactions$1(transaction2.account, [transaction2]);
117694
+ await addTransactions(transaction2.account, [transaction2]);
117682
117695
  }
117683
117696
  }
117684
117697
  async function advanceSchedulesService(syncSuccess) {
117685
- const { data: schedules } = await aqlQuery$1(q("schedules").filter({ completed: false, "_account.closed": false }).select("*"));
117686
- const { data: hasTransData } = await aqlQuery$1(getHasTransactionsQuery(schedules));
117698
+ const { data: schedules } = await aqlQuery(q("schedules").filter({ completed: false, "_account.closed": false }).select("*"));
117699
+ const { data: hasTransData } = await aqlQuery(getHasTransactionsQuery(schedules));
117687
117700
  const hasTrans = new Set(hasTransData.filter(Boolean).map((row) => row.schedule));
117688
117701
  const failedToPost = [];
117689
- const { data: upcomingLength } = await aqlQuery$1(q("preferences").filter({ id: "upcomingScheduledTransactionLength" }).select("value"));
117702
+ const { data: upcomingLength } = await aqlQuery(q("preferences").filter({ id: "upcomingScheduledTransactionLength" }).select("value"));
117690
117703
  for (const schedule of schedules) {
117691
117704
  const status = getStatus(schedule.next_date, schedule.completed, hasTrans.has(schedule.id), upcomingLength[0]?.value ?? "7");
117692
117705
  if (status === "paid") {
@@ -117718,7 +117731,7 @@ async function advanceSchedulesService(syncSuccess) {
117718
117731
  }
117719
117732
  }
117720
117733
  const app$f = createApp();
117721
- app$f.method("schedule/create", mutator(undoable(createSchedule$1)));
117734
+ app$f.method("schedule/create", mutator(undoable(createSchedule)));
117722
117735
  app$f.method("schedule/update", mutator(undoable(updateSchedule)));
117723
117736
  app$f.method("schedule/delete", mutator(undoable(deleteSchedule)));
117724
117737
  app$f.method("schedule/skip-next-date", mutator(undoable(skipNextDate)));
@@ -121032,8 +121045,8 @@ class CategoryTemplateContext {
121032
121045
  }
121033
121046
  await CategoryTemplateContext.checkByAndScheduleAndSpend(templates, month);
121034
121047
  await CategoryTemplateContext.checkPercentage(templates);
121035
- const hideDecimal = await aqlQuery$1(q("preferences").filter({ id: "hideFraction" }).select("*"));
121036
- const currencyPref = await aqlQuery$1(q("preferences").filter({ id: "defaultCurrencyCode" }).select("*"));
121048
+ const hideDecimal = await aqlQuery(q("preferences").filter({ id: "hideFraction" }).select("*"));
121049
+ const currencyPref = await aqlQuery(q("preferences").filter({ id: "defaultCurrencyCode" }).select("*"));
121037
121050
  const currencyCode = currencyPref.data.length > 0 ? currencyPref.data[0].value : "";
121038
121051
  return new CategoryTemplateContext(templates, category, month, fromLastMonth, budgeted, currencyCode, hideDecimal.data.length > 0 ? hideDecimal.data[0].value === "true" : false);
121039
121052
  }
@@ -121268,7 +121281,7 @@ class CategoryTemplateContext {
121268
121281
  if (pt2.length === 0)
121269
121282
  return;
121270
121283
  const reqCategories = pt2.map((t2) => t2.category.toLowerCase());
121271
- const availCategories = await getCategories$3();
121284
+ const availCategories = await getCategories$2();
121272
121285
  const availNames = availCategories.filter((c) => c.is_income).map((c) => c.name.toLocaleLowerCase());
121273
121286
  reqCategories.forEach((n) => {
121274
121287
  if (n === "available funds" || n === "all income")
@@ -121457,7 +121470,7 @@ class CategoryTemplateContext {
121457
121470
  monthlyIncome = availableFunds;
121458
121471
  }
121459
121472
  else {
121460
- const incomeCat = (await getCategories$3()).find((c) => c.is_income && c.name.toLowerCase() === cat);
121473
+ const incomeCat = (await getCategories$2()).find((c) => c.is_income && c.name.toLowerCase() === cat);
121461
121474
  if (!incomeCat) {
121462
121475
  throw new Error(`Income category "${template.category}" not found for percentage template`);
121463
121476
  }
@@ -121551,14 +121564,14 @@ async function overwriteTemplate({ month }) {
121551
121564
  return ret;
121552
121565
  }
121553
121566
  async function applyMultipleCategoryTemplates({ month, categoryIds }) {
121554
- const { data: categoryData } = await aqlQuery$1(q("categories").filter({ id: { $oneof: categoryIds } }).select("*"));
121567
+ const { data: categoryData } = await aqlQuery(q("categories").filter({ id: { $oneof: categoryIds } }).select("*"));
121555
121568
  await storeNoteTemplates();
121556
121569
  const categoryTemplates = await getTemplates((c) => categoryIds.includes(c.id));
121557
121570
  const ret = await processTemplate(month, true, categoryTemplates, categoryData);
121558
121571
  return ret;
121559
121572
  }
121560
121573
  async function applySingleCategoryTemplate({ month, category }) {
121561
- const { data: categoryData } = await aqlQuery$1(q("categories").filter({ id: category }).select("*"));
121574
+ const { data: categoryData } = await aqlQuery(q("categories").filter({ id: category }).select("*"));
121562
121575
  await storeNoteTemplates();
121563
121576
  const categoryTemplates = await getTemplates((c) => c.id === category);
121564
121577
  const ret = await processTemplate(month, true, categoryTemplates, categoryData);
@@ -121567,12 +121580,12 @@ async function applySingleCategoryTemplate({ month, category }) {
121567
121580
  function runCheckTemplates() {
121568
121581
  return checkTemplateNotes();
121569
121582
  }
121570
- async function getCategories$2() {
121571
- const { data: categoryGroups } = await aqlQuery$1(q("category_groups").filter({ hidden: false }).select("*"));
121583
+ async function getCategories$1() {
121584
+ const { data: categoryGroups } = await aqlQuery(q("category_groups").filter({ hidden: false }).select("*"));
121572
121585
  return categoryGroups.flatMap((g) => g.categories || []).filter((c) => !c.hidden);
121573
121586
  }
121574
121587
  async function getTemplates(filter2 = () => true) {
121575
- const { data: categoriesWithGoalDef } = await aqlQuery$1(q("categories").filter({ goal_def: { $ne: null } }).select("*"));
121588
+ const { data: categoriesWithGoalDef } = await aqlQuery(q("categories").filter({ goal_def: { $ne: null } }).select("*"));
121576
121589
  const categoryTemplates = {};
121577
121590
  for (const categoryWithGoalDef of categoriesWithGoalDef.filter(filter2)) {
121578
121591
  categoryTemplates[categoryWithGoalDef.id] = JSON.parse(categoryWithGoalDef.goal_def);
@@ -121608,7 +121621,7 @@ async function setGoals(month, templateGoal) {
121608
121621
  async function processTemplate(month, force, categoryTemplates, categories = []) {
121609
121622
  const isReflect = isReflectBudget();
121610
121623
  if (!categories.length) {
121611
- categories = (await getCategories$2()).filter((c) => isReflect || !c.is_income);
121624
+ categories = (await getCategories$1()).filter((c) => isReflect || !c.is_income);
121612
121625
  }
121613
121626
  const templateContexts = [];
121614
121627
  let availBudget = await getSheetValue(sheetForMonth(month), `to-budget`);
@@ -121722,16 +121735,16 @@ app$e.method("budget/cover-overbudgeted", mutator(undoable(coverOverbudgeted)));
121722
121735
  app$e.method("budget/transfer-category", mutator(undoable(transferCategory)));
121723
121736
  app$e.method("budget/set-carryover", mutator(undoable(setCategoryCarryover)));
121724
121737
  app$e.method("budget/reset-income-carryover", mutator(undoable(resetIncomeCarryover)));
121725
- app$e.method("get-categories", getCategories$1);
121738
+ app$e.method("get-categories", getCategories);
121726
121739
  app$e.method("get-budget-bounds", getBudgetBounds);
121727
121740
  app$e.method("envelope-budget-month", envelopeBudgetMonth);
121728
121741
  app$e.method("tracking-budget-month", trackingBudgetMonth);
121729
- app$e.method("category-create", mutator(undoable(createCategory$1)));
121742
+ app$e.method("category-create", mutator(undoable(createCategory)));
121730
121743
  app$e.method("category-update", mutator(undoable(updateCategory)));
121731
121744
  app$e.method("category-move", mutator(undoable(moveCategory)));
121732
121745
  app$e.method("category-delete", mutator(undoable(deleteCategory)));
121733
121746
  app$e.method("get-category-groups", getCategoryGroups);
121734
- app$e.method("category-group-create", mutator(undoable(createCategoryGroup$1)));
121747
+ app$e.method("category-group-create", mutator(undoable(createCategoryGroup)));
121735
121748
  app$e.method("category-group-update", mutator(undoable(updateCategoryGroup)));
121736
121749
  app$e.method("category-group-move", mutator(undoable(moveCategoryGroup)));
121737
121750
  app$e.method("category-group-delete", mutator(undoable(deleteCategoryGroup)));
@@ -121740,7 +121753,7 @@ app$e.method("budget/get-category-automations", getTemplatesForCategory);
121740
121753
  app$e.method("budget/set-category-automations", mutator(undoable(storeTemplates)));
121741
121754
  app$e.method("budget/store-note-templates", mutator(storeNoteTemplates));
121742
121755
  app$e.method("budget/render-note-templates", unparse);
121743
- async function getCategories$1() {
121756
+ async function getCategories() {
121744
121757
  const categoryGroups = await getCategoryGroups();
121745
121758
  return {
121746
121759
  grouped: categoryGroups,
@@ -121834,7 +121847,7 @@ async function trackingBudgetMonth({ month }) {
121834
121847
  }
121835
121848
  return values2;
121836
121849
  }
121837
- async function createCategory$1({ name, groupId, isIncome, hidden }) {
121850
+ async function createCategory({ name, groupId, isIncome, hidden }) {
121838
121851
  if (!groupId) {
121839
121852
  throw APIError("Creating a category: groupId is required");
121840
121853
  }
@@ -121886,10 +121899,10 @@ async function deleteCategory({ id: id2, transferId }) {
121886
121899
  });
121887
121900
  }
121888
121901
  async function getCategoryGroups() {
121889
- const { data: categoryGroups } = await aqlQuery$1(q("category_groups").select("*"));
121902
+ const { data: categoryGroups } = await aqlQuery(q("category_groups").select("*"));
121890
121903
  return categoryGroups;
121891
121904
  }
121892
- async function createCategoryGroup$1({ name, isIncome, hidden }) {
121905
+ async function createCategoryGroup({ name, isIncome, hidden }) {
121893
121906
  return await insertCategoryGroup({
121894
121907
  name,
121895
121908
  is_income: isIncome ? 1 : 0,
@@ -122112,7 +122125,7 @@ async function fillPrimaryChecking(handlers2, account, payees, groups) {
122112
122125
  category: getStartingBalanceCat(incomeGroup.categories),
122113
122126
  starting_balance_flag: true
122114
122127
  });
122115
- return addTransactions$1(account.id, transactions);
122128
+ return addTransactions(account.id, transactions);
122116
122129
  }
122117
122130
  async function fillChecking(handlers2, account, payees, groups) {
122118
122131
  const { incomePayee, expensePayees, incomeGroup, expenseCategories } = extractCommonThings(payees, groups);
@@ -122363,7 +122376,7 @@ async function createBudget$1(accounts, payees, groups) {
122363
122376
  const sheetName = sheetForMonth(currentMonth());
122364
122377
  const toBudget = getCellValue(sheetName, "to-budget");
122365
122378
  if (toBudget < 0) {
122366
- await addTransactions$1(primaryAccount.id, [
122379
+ await addTransactions(primaryAccount.id, [
122367
122380
  {
122368
122381
  amount: -toBudget,
122369
122382
  category: category("Income").id,
@@ -122508,9 +122521,9 @@ async function createTestBudget(handlers2) {
122508
122521
  }));
122509
122522
  setSyncingMode("import");
122510
122523
  const primaryAccount = accounts.find((a3) => a3.name = "Bank of America");
122511
- const { data: primaryBalance } = await aqlQuery$1(q("transactions").filter({ account: primaryAccount.id }).calculate({ $sum: "$amount" }).serialize());
122524
+ const { data: primaryBalance } = await aqlQuery(q("transactions").filter({ account: primaryAccount.id }).calculate({ $sum: "$amount" }).serialize());
122512
122525
  if (primaryBalance < 0) {
122513
- const { data: results } = await aqlQuery$1(q("transactions").filter({ account: primaryAccount.id, amount: { $gt: 0 } }).limit(1).select(["id", "amount"]).serialize());
122526
+ const { data: results } = await aqlQuery(q("transactions").filter({ account: primaryAccount.id, amount: { $gt: 0 } }).limit(1).select(["id", "amount"]).serialize());
122514
122527
  const lastDeposit = results[0];
122515
122528
  await runHandler(handlers2["transaction-update"], {
122516
122529
  ...lastDeposit,
@@ -122649,62 +122662,6 @@ async function importActual(_filepath, buffer) {
122649
122662
  await upload().catch(() => {
122650
122663
  });
122651
122664
  }
122652
- function send(name, args) {
122653
- return send$2(name, args);
122654
- }
122655
- async function batchBudgetUpdates(func) {
122656
- await send("api/batch-budget-start");
122657
- try {
122658
- await func();
122659
- }
122660
- finally {
122661
- await send("api/batch-budget-end");
122662
- }
122663
- }
122664
- function aqlQuery(query) {
122665
- return send("api/query", { query: query.serialize() });
122666
- }
122667
- function setBudgetAmount(month, categoryId, value) {
122668
- return send("api/budget-set-amount", { month, categoryId, amount: value });
122669
- }
122670
- function setBudgetCarryover(month, categoryId, flag) {
122671
- return send("api/budget-set-carryover", { month, categoryId, flag });
122672
- }
122673
- function addTransactions(accountId, transactions, { learnCategories = false, runTransfers = false } = {}) {
122674
- return send("api/transactions-add", {
122675
- accountId,
122676
- transactions,
122677
- learnCategories,
122678
- runTransfers
122679
- });
122680
- }
122681
- function getAccounts() {
122682
- return send("api/accounts-get");
122683
- }
122684
- function createAccount(account, initialBalance) {
122685
- return send("api/account-create", { account, initialBalance });
122686
- }
122687
- function createCategoryGroup(group) {
122688
- return send("api/category-group-create", { group });
122689
- }
122690
- function getCategories() {
122691
- return send("api/categories-get", { grouped: false });
122692
- }
122693
- function createCategory(category) {
122694
- return send("api/category-create", { category });
122695
- }
122696
- function getPayees$1() {
122697
- return send("api/payees-get");
122698
- }
122699
- function createPayee$1(payee) {
122700
- return send("api/payee-create", { payee });
122701
- }
122702
- function updateRule$1(rule) {
122703
- return send("api/rule-update", { rule });
122704
- }
122705
- function createSchedule(schedule) {
122706
- return send("api/schedule-create", schedule);
122707
- }
122708
122665
  function slash(path2) {
122709
122666
  const isExtendedLengthPath = path2.startsWith("\\\\?\\");
122710
122667
  if (isExtendedLengthPath) {
@@ -122716,10 +122673,12 @@ async function importAccounts$1(data, entityIdMap) {
122716
122673
  const accounts = sortByKey(data.accounts, "sortableIndex");
122717
122674
  return Promise.all(accounts.map(async (account) => {
122718
122675
  if (!account.isTombstone) {
122719
- const id2 = await createAccount({
122720
- name: account.accountName,
122721
- offbudget: account.onBudget ? false : true,
122722
- closed: account.hidden ? true : false
122676
+ const id2 = await send("api/account-create", {
122677
+ account: {
122678
+ name: account.accountName,
122679
+ offbudget: account.onBudget ? false : true,
122680
+ closed: account.hidden ? true : false
122681
+ }
122723
122682
  });
122724
122683
  entityIdMap.set(account.entityId, id2);
122725
122684
  }
@@ -122729,13 +122688,18 @@ async function importCategories$1(data, entityIdMap) {
122729
122688
  const masterCategories = sortByKey(data.masterCategories, "sortableIndex");
122730
122689
  await Promise.all(masterCategories.map(async (masterCategory) => {
122731
122690
  if (masterCategory.type === "OUTFLOW" && !masterCategory.isTombstone && masterCategory.subCategories && masterCategory.subCategories.some((cat) => !cat.isTombstone)) {
122732
- const id2 = await createCategoryGroup({
122733
- name: masterCategory.name,
122734
- is_income: false
122691
+ const id2 = await send("api/category-group-create", {
122692
+ group: {
122693
+ name: masterCategory.name,
122694
+ is_income: false
122695
+ }
122735
122696
  });
122736
122697
  entityIdMap.set(masterCategory.entityId, id2);
122737
122698
  if (masterCategory.note) {
122738
- send$2("notes-save", { id: id2, note: masterCategory.note });
122699
+ void send("notes-save", {
122700
+ id: id2,
122701
+ note: masterCategory.note
122702
+ });
122739
122703
  }
122740
122704
  if (masterCategory.subCategories) {
122741
122705
  const subCategories = sortByKey(masterCategory.subCategories, "sortableIndex");
@@ -122748,13 +122712,18 @@ async function importCategories$1(data, entityIdMap) {
122748
122712
  categoryNameParts.pop();
122749
122713
  categoryName = categoryNameParts.join("/").trim();
122750
122714
  }
122751
- const id22 = await createCategory({
122752
- name: categoryName,
122753
- group_id: entityIdMap.get(category.masterCategoryId)
122715
+ const id22 = await send("api/category-create", {
122716
+ category: {
122717
+ name: categoryName,
122718
+ group_id: entityIdMap.get(category.masterCategoryId)
122719
+ }
122754
122720
  });
122755
122721
  entityIdMap.set(category.entityId, id22);
122756
122722
  if (category.note) {
122757
- send$2("notes-save", { id: id22, note: category.note });
122723
+ void send("notes-save", {
122724
+ id: id22,
122725
+ note: category.note
122726
+ });
122758
122727
  }
122759
122728
  }
122760
122729
  }
@@ -122765,19 +122734,23 @@ async function importCategories$1(data, entityIdMap) {
122765
122734
  async function importPayees$1(data, entityIdMap) {
122766
122735
  for (const payee of data.payees) {
122767
122736
  if (!payee.isTombstone) {
122768
- const id2 = await createPayee$1({
122769
- name: payee.name,
122770
- transfer_acct: entityIdMap.get(payee.targetAccountId) || null
122737
+ const id2 = await send("api/payee-create", {
122738
+ payee: {
122739
+ name: payee.name,
122740
+ transfer_acct: entityIdMap.get(payee.targetAccountId) || null
122741
+ }
122771
122742
  });
122772
122743
  entityIdMap.set(payee.entityId, id2);
122773
122744
  }
122774
122745
  }
122775
122746
  }
122776
122747
  async function importTransactions$1(data, entityIdMap) {
122777
- const categories = await getCategories();
122748
+ const categories = await send("api/categories-get", {
122749
+ grouped: false
122750
+ });
122778
122751
  const incomeCategoryId = categories.find((cat) => cat.name === "Income").id;
122779
- const accounts = await getAccounts();
122780
- const payees = await getPayees$1();
122752
+ const accounts = await send("api/accounts-get");
122753
+ const payees = await send("api/payees-get");
122781
122754
  function getCategory2(id2) {
122782
122755
  if (id2 == null || id2 === "Category/__Split__") {
122783
122756
  return null;
@@ -122848,8 +122821,11 @@ async function importTransactions$1(data, entityIdMap) {
122848
122821
  };
122849
122822
  return newTransaction;
122850
122823
  }).filter((x2) => x2);
122851
- await addTransactions(entityIdMap.get(accountId), toImport, {
122852
- learnCategories: true
122824
+ await send("api/transactions-add", {
122825
+ accountId: entityIdMap.get(accountId),
122826
+ transactions: toImport,
122827
+ learnCategories: true,
122828
+ runTransfers: false
122853
122829
  });
122854
122830
  }));
122855
122831
  }
@@ -122871,7 +122847,8 @@ function fillInBudgets(data, categoryBudgets) {
122871
122847
  }
122872
122848
  async function importBudgets$1(data, entityIdMap) {
122873
122849
  const budgets = sortByKey(data.monthlyBudgets, "month");
122874
- await batchBudgetUpdates(async () => {
122850
+ await send("api/batch-budget-start");
122851
+ try {
122875
122852
  for (const budget of budgets) {
122876
122853
  const filled = fillInBudgets(data, budget.monthlySubCategoryBudgets.filter((b) => !b.isTombstone));
122877
122854
  await Promise.all(filled.map(async (catBudget) => {
@@ -122881,16 +122858,31 @@ async function importBudgets$1(data, entityIdMap) {
122881
122858
  if (!catId) {
122882
122859
  return;
122883
122860
  }
122884
- await setBudgetAmount(month, catId, amount);
122861
+ await send("api/budget-set-amount", {
122862
+ month,
122863
+ categoryId: catId,
122864
+ amount
122865
+ });
122885
122866
  if (catBudget.overspendingHandling === "AffectsBuffer") {
122886
- await setBudgetCarryover(month, catId, false);
122867
+ await send("api/budget-set-carryover", {
122868
+ month,
122869
+ categoryId: catId,
122870
+ flag: false
122871
+ });
122887
122872
  }
122888
122873
  else if (catBudget.overspendingHandling === "Confined") {
122889
- await setBudgetCarryover(month, catId, true);
122874
+ await send("api/budget-set-carryover", {
122875
+ month,
122876
+ categoryId: catId,
122877
+ flag: true
122878
+ });
122890
122879
  }
122891
122880
  }));
122892
122881
  }
122893
- });
122882
+ }
122883
+ finally {
122884
+ await send("api/batch-budget-end");
122885
+ }
122894
122886
  }
122895
122887
  function estimateRecentness(str) {
122896
122888
  return str.split(",").reduce((total, version) => {
@@ -123182,17 +123174,21 @@ function buildRuleUpdate(rule, actions) {
123182
123174
  function importAccounts(data, entityIdMap) {
123183
123175
  return Promise.all(data.accounts.map(async (account) => {
123184
123176
  if (!account.deleted) {
123185
- const id2 = await createAccount({
123186
- name: account.name,
123187
- offbudget: account.on_budget ? false : true,
123188
- closed: account.closed
123177
+ const id2 = await send("api/account-create", {
123178
+ account: {
123179
+ name: account.name,
123180
+ offbudget: account.on_budget ? false : true,
123181
+ closed: account.closed
123182
+ }
123189
123183
  });
123190
123184
  entityIdMap.set(account.id, id2);
123191
123185
  }
123192
123186
  }));
123193
123187
  }
123194
123188
  async function importCategories(data, entityIdMap) {
123195
- const categories = await getCategories();
123189
+ const categories = await send("api/categories-get", {
123190
+ grouped: false
123191
+ });
123196
123192
  const incomeCatId = findIdByName(categories, "Income");
123197
123193
  const ynabIncomeCategories = ["To be Budgeted", "Inflow: Ready to Assign"];
123198
123194
  function checkSpecialCat(cat) {
@@ -123217,7 +123213,9 @@ async function importCategories(data, entityIdMap) {
123217
123213
  while (true) {
123218
123214
  const name = count === 0 ? baseName : `${baseName} (${count})`;
123219
123215
  try {
123220
- const id2 = await createCategoryGroup({ ...params, name });
123216
+ const id2 = await send("api/category-group-create", {
123217
+ group: { ...params, name }
123218
+ });
123221
123219
  return { id: id2, name };
123222
123220
  }
123223
123221
  catch (e) {
@@ -123235,7 +123233,9 @@ async function importCategories(data, entityIdMap) {
123235
123233
  while (true) {
123236
123234
  const name = count === 0 ? baseName : `${baseName} (${count})`;
123237
123235
  try {
123238
- const id2 = await createCategory({ ...params, name });
123236
+ const id2 = await send("api/category-create", {
123237
+ category: { ...params, name }
123238
+ });
123239
123239
  return { id: id2, name };
123240
123240
  }
123241
123241
  catch (e) {
@@ -123259,7 +123259,10 @@ async function importCategories(data, entityIdMap) {
123259
123259
  groupId = createdGroup.id;
123260
123260
  entityIdMap.set(group.id, groupId);
123261
123261
  if (group.note) {
123262
- send$2("notes-save", { id: groupId, note: group.note });
123262
+ void send("notes-save", {
123263
+ id: groupId,
123264
+ note: group.note
123265
+ });
123263
123266
  }
123264
123267
  }
123265
123268
  if (equalsIgnoreCase(group.name, "Income")) {
@@ -123290,7 +123293,7 @@ async function importCategories(data, entityIdMap) {
123290
123293
  });
123291
123294
  entityIdMap.set(cat.id, createdCategory.id);
123292
123295
  if (cat.note) {
123293
- send$2("notes-save", {
123296
+ void send("notes-save", {
123294
123297
  id: createdCategory.id,
123295
123298
  note: cat.note
123296
123299
  });
@@ -123305,8 +123308,8 @@ async function importCategories(data, entityIdMap) {
123305
123308
  function importPayees(data, entityIdMap) {
123306
123309
  return Promise.all(data.payees.map(async (payee) => {
123307
123310
  if (!payee.deleted) {
123308
- const id2 = await createPayee$1({
123309
- name: payee.name
123311
+ const id2 = await send("api/payee-create", {
123312
+ payee: { name: payee.name }
123310
123313
  });
123311
123314
  entityIdMap.set(payee.id, id2);
123312
123315
  }
@@ -123340,7 +123343,7 @@ async function importFlagsAsTags(data, flagNameConflicts) {
123340
123343
  return;
123341
123344
  }
123342
123345
  await Promise.all([...tagsToCreate.entries()].map(async ([tag, color]) => {
123343
- await send$2("tags-create", {
123346
+ await send("tags-create", {
123344
123347
  tag,
123345
123348
  color,
123346
123349
  description: "Imported from YNAB"
@@ -123348,8 +123351,10 @@ async function importFlagsAsTags(data, flagNameConflicts) {
123348
123351
  }));
123349
123352
  }
123350
123353
  async function importTransactions(data, entityIdMap, flagNameConflicts) {
123351
- const payees = await getPayees$1();
123352
- const categories = await getCategories();
123354
+ const payees = await send("api/payees-get");
123355
+ const categories = await send("api/categories-get", {
123356
+ grouped: false
123357
+ });
123353
123358
  const incomeCatId = findIdByName(categories, "Income");
123354
123359
  const startingBalanceCatId = findIdByName(categories, "Starting Balances");
123355
123360
  const startingPayeeYNAB = findIdByName(data.payees, "Starting Balance");
@@ -123501,8 +123506,11 @@ async function importTransactions(data, entityIdMap, flagNameConflicts) {
123501
123506
  }
123502
123507
  return newTransaction;
123503
123508
  }).filter((x2) => x2);
123504
- await addTransactions(entityIdMap.get(accountId), toImport, {
123505
- learnCategories: true
123509
+ await send("api/transactions-add", {
123510
+ accountId: entityIdMap.get(accountId),
123511
+ transactions: toImport,
123512
+ learnCategories: true,
123513
+ runTransfers: false
123506
123514
  });
123507
123515
  }));
123508
123516
  }
@@ -123512,7 +123520,7 @@ async function importScheduledTransactions(data, entityIdMap, flagNameConflicts)
123512
123520
  if (scheduledTransactions.length === 0) {
123513
123521
  return;
123514
123522
  }
123515
- const payees = await getPayees$1();
123523
+ const payees = await send("api/payees-get");
123516
123524
  const payeesByTransferAcct = payees.filter((payee) => payee?.transfer_acct).map((payee) => [payee.transfer_acct, payee]);
123517
123525
  const payeeTransferAcctHashMap = new Map(payeesByTransferAcct);
123518
123526
  const scheduleCategoryMap = /* @__PURE__ */ new Map();
@@ -123523,7 +123531,10 @@ async function importScheduledTransactions(data, entityIdMap, flagNameConflicts)
123523
123531
  let count = 1;
123524
123532
  while (true) {
123525
123533
  try {
123526
- return await createSchedule({ ...params, name: params.name });
123534
+ return await send("api/schedule-create", {
123535
+ ...params,
123536
+ name: params.name
123537
+ });
123527
123538
  }
123528
123539
  catch (e) {
123529
123540
  if (count >= MAX_RETRY) {
@@ -123536,11 +123547,15 @@ async function importScheduledTransactions(data, entityIdMap, flagNameConflicts)
123536
123547
  }
123537
123548
  }
123538
123549
  async function getRuleForSchedule2(scheduleId) {
123539
- const { data: ruleId } = await aqlQuery(q("schedules").filter({ id: scheduleId }).calculate("rule"));
123550
+ const { data: ruleId } = await send("api/query", {
123551
+ query: q("schedules").filter({ id: scheduleId }).calculate("rule").serialize()
123552
+ });
123540
123553
  if (!ruleId) {
123541
123554
  return null;
123542
123555
  }
123543
- const { data: ruleData } = await aqlQuery(q("rules").filter({ id: ruleId }).select("*"));
123556
+ const { data: ruleData } = await send("api/query", {
123557
+ query: q("rules").filter({ id: ruleId }).select("*").serialize()
123558
+ });
123544
123559
  const ruleRow = ruleData?.[0];
123545
123560
  if (!ruleRow) {
123546
123561
  return null;
@@ -123587,7 +123602,9 @@ async function importScheduledTransactions(data, entityIdMap, flagNameConflicts)
123587
123602
  field: "notes",
123588
123603
  value: scheduleNotes
123589
123604
  });
123590
- await updateRule$1(buildRuleUpdate(rule, actions));
123605
+ await send("api/rule-update", {
123606
+ rule: buildRuleUpdate(rule, actions)
123607
+ });
123591
123608
  }
123592
123609
  }
123593
123610
  const scheduledSubtransactions = scheduledSubtransactionsGrouped.get(scheduled.id)?.filter((subtransaction) => !subtransaction.deleted) || [];
@@ -123613,7 +123630,9 @@ async function importScheduledTransactions(data, entityIdMap, flagNameConflicts)
123613
123630
  field: "category",
123614
123631
  value: categoryId
123615
123632
  });
123616
- await updateRule$1(buildRuleUpdate(rule, actions));
123633
+ await send("api/rule-update", {
123634
+ rule: buildRuleUpdate(rule, actions)
123635
+ });
123617
123636
  }
123618
123637
  for (const [scheduleId, subtransactions] of scheduleSplitsMap.entries()) {
123619
123638
  const rule = await getRuleForSchedule2(scheduleId);
@@ -123680,7 +123699,9 @@ async function importScheduledTransactions(data, entityIdMap, flagNameConflicts)
123680
123699
  }
123681
123700
  }
123682
123701
  });
123683
- await updateRule$1(buildRuleUpdate(rule, actions));
123702
+ await send("api/rule-update", {
123703
+ rule: buildRuleUpdate(rule, actions)
123704
+ });
123684
123705
  }
123685
123706
  }
123686
123707
  }
@@ -123688,7 +123709,8 @@ async function importBudgets(data, entityIdMap) {
123688
123709
  const budgets = sortByKey(data.months, "month");
123689
123710
  const internalCatIdYnab = findIdByName(data.category_groups, "Internal Master Category");
123690
123711
  const creditcardCatIdYnab = findIdByName(data.category_groups, "Credit Card Payments");
123691
- await batchBudgetUpdates(async () => {
123712
+ await send("api/batch-budget-start");
123713
+ try {
123692
123714
  for (const budget of budgets) {
123693
123715
  const month = monthFromDate(budget.month);
123694
123716
  await Promise.all(budget.categories.map(async (catBudget) => {
@@ -123697,10 +123719,17 @@ async function importBudgets(data, entityIdMap) {
123697
123719
  if (!catId || catBudget.category_group_id === internalCatIdYnab || catBudget.category_group_id === creditcardCatIdYnab) {
123698
123720
  return;
123699
123721
  }
123700
- await setBudgetAmount(month, catId, amount);
123722
+ await send("api/budget-set-amount", {
123723
+ month,
123724
+ categoryId: catId,
123725
+ amount
123726
+ });
123701
123727
  }));
123702
123728
  }
123703
- });
123729
+ }
123730
+ finally {
123731
+ await send("api/batch-budget-end");
123732
+ }
123704
123733
  }
123705
123734
  function parseFile$1(buffer) {
123706
123735
  let data = JSON.parse(buffer.toString());
@@ -124742,7 +124771,7 @@ async function getBackups$1(id2) {
124742
124771
  let paths = [];
124743
124772
  if (await exists(backupDir)) {
124744
124773
  paths = await listDir(backupDir);
124745
- paths = paths.filter((file) => file.match(/\.sqlite$/));
124774
+ paths = paths.filter((file) => file.match(/\.zip$/));
124746
124775
  }
124747
124776
  const backups = await Promise.all(paths.map(async (path2) => {
124748
124777
  const mtime = await getModifiedTime(join$1(backupDir, path2));
@@ -124807,16 +124836,31 @@ async function makeBackup$1(id2) {
124807
124836
  if (await exists(join$1(budgetDir, LATEST_BACKUP_FILENAME))) {
124808
124837
  await removeFile$1(join$1(getBudgetDir(id2), LATEST_BACKUP_FILENAME));
124809
124838
  }
124810
- const backupId = `${v4()}.sqlite`;
124839
+ const backupId = `${format$2(/* @__PURE__ */ new Date(), "yyyy-MM-dd_HH-mm-ss")}.zip`;
124811
124840
  const backupPath = join$1(budgetDir, "backups", backupId);
124812
124841
  if (!await exists(join$1(budgetDir, "backups"))) {
124813
124842
  await mkdir(join$1(budgetDir, "backups"));
124814
124843
  }
124815
- await copyFile(join$1(budgetDir, "db.sqlite"), backupPath);
124816
- const db2 = await openDatabase$1(backupPath);
124817
- runQuery$1(db2, "DELETE FROM messages_crdt");
124818
- runQuery$1(db2, "DELETE FROM messages_clock");
124819
- closeDatabase$1(db2);
124844
+ const tempDbPath = join$1(budgetDir, "backups", `db.${Date.now()}.sqlite.tmp`);
124845
+ await copyFile(join$1(budgetDir, "db.sqlite"), tempDbPath);
124846
+ let db2;
124847
+ try {
124848
+ db2 = await openDatabase$1(tempDbPath);
124849
+ runQuery$1(db2, "DELETE FROM messages_crdt");
124850
+ runQuery$1(db2, "DELETE FROM messages_clock");
124851
+ const zip2 = new AdmZip();
124852
+ zip2.addLocalFile(tempDbPath, "", "db.sqlite");
124853
+ zip2.addLocalFile(join$1(budgetDir, "metadata.json"));
124854
+ zip2.writeZip(backupPath);
124855
+ }
124856
+ finally {
124857
+ if (db2) {
124858
+ closeDatabase$1(db2);
124859
+ }
124860
+ if (await exists(tempDbPath)) {
124861
+ await removeFile$1(tempDbPath);
124862
+ }
124863
+ }
124820
124864
  const toRemove = await updateBackups(await getBackups$1(id2));
124821
124865
  for (const id22 of toRemove) {
124822
124866
  await removeFile$1(join$1(budgetDir, "backups", id22));
@@ -124859,7 +124903,9 @@ async function loadBackup$1(id2, backupId) {
124859
124903
  catch {
124860
124904
  }
124861
124905
  unloadPrefs();
124862
- await copyFile(join$1(budgetDir, "backups", backupId), join$1(budgetDir, "db.sqlite"));
124906
+ const zip2 = new AdmZip(join$1(budgetDir, "backups", backupId));
124907
+ zip2.extractEntryTo("db.sqlite", budgetDir, false, true);
124908
+ zip2.extractEntryTo("metadata.json", budgetDir, false, true);
124863
124909
  }
124864
124910
  }
124865
124911
  function startBackupService(id2) {
@@ -127016,7 +127062,7 @@ function sort(reports) {
127016
127062
  }) : 0);
127017
127063
  }
127018
127064
  async function getReports() {
127019
- const { data } = await aqlQuery$1(q("custom_reports").select("*"));
127065
+ const { data } = await aqlQuery(q("custom_reports").select("*"));
127020
127066
  return sort(data.map(reportModel.toJS));
127021
127067
  }
127022
127068
  async function reportNameExists(name, reportId, newItem) {
@@ -127139,7 +127185,7 @@ async function renameDashboardPage({ id: id2, name }) {
127139
127185
  await updateWithSchema("dashboard_pages", { id: id2, name });
127140
127186
  }
127141
127187
  async function updateDashboard(widgets) {
127142
- const { data: dbWidgets } = await aqlQuery$1(q("dashboard").filter({ id: { $oneof: widgets.map(({ id: id2 }) => id2) } }).select("*"));
127188
+ const { data: dbWidgets } = await aqlQuery(q("dashboard").filter({ id: { $oneof: widgets.map(({ id: id2 }) => id2) } }).select("*"));
127143
127189
  const dbWidgetMap = new Map(dbWidgets.map((widget) => [widget.id, widget]));
127144
127190
  await Promise.all(widgets.filter((widget) => !isMatch(dbWidgetMap.get(widget.id) ?? {}, widget)).map((widget) => update("dashboard", widget)));
127145
127191
  }
@@ -127485,7 +127531,7 @@ async function getCommonPayees() {
127485
127531
  return (await getCommonPayees$1()).map(payeeModel$1.fromDb);
127486
127532
  }
127487
127533
  async function getPayees() {
127488
- return (await getPayees$2()).map(payeeModel$1.fromDb);
127534
+ return (await getPayees$1()).map(payeeModel$1.fromDb);
127489
127535
  }
127490
127536
  async function getOrphanedPayees() {
127491
127537
  return await syncGetOrphanedPayees();
@@ -127720,7 +127766,7 @@ async function updateRule(rule) {
127720
127766
  if (error) {
127721
127767
  return { error };
127722
127768
  }
127723
- await updateRule$2(rule);
127769
+ await updateRule$1(rule);
127724
127770
  return rule;
127725
127771
  }
127726
127772
  async function deleteRule(id2) {
@@ -127891,7 +127937,7 @@ async function fixSplitTransactions() {
127891
127937
  const updated = deletedRows.map((row) => ({ id: row.id, tombstone: true }));
127892
127938
  await batchUpdateTransactions({ updated });
127893
127939
  });
127894
- const splitTransactions = (await aqlQuery$1(q("transactions").options({ splits: "grouped" }).filter({
127940
+ const splitTransactions = (await aqlQuery(q("transactions").options({ splits: "grouped" }).filter({
127895
127941
  is_parent: true
127896
127942
  }).select("*"))).data;
127897
127943
  const mismatchedSplits = splitTransactions.filter((t2) => {
@@ -128575,7 +128621,7 @@ async function exportToCSV(transactions, accounts, categoryGroups, payees) {
128575
128621
  return stringify(transactionsForExport, { header: true });
128576
128622
  }
128577
128623
  async function exportQueryToCSV(query) {
128578
- const { data: transactions } = await aqlQuery$1(query.select([
128624
+ const { data: transactions } = await aqlQuery(query.select([
128579
128625
  { Id: "id" },
128580
128626
  { Account: "account.name" },
128581
128627
  { Date: "date" },
@@ -136718,7 +136764,7 @@ async function mergeTransactions(transactions) {
136718
136764
  reconciled: keep.reconciled || drop2.reconciled
136719
136765
  });
136720
136766
  }
136721
- const { data: transactionsToDelete } = await aqlQuery$1(q("transactions").filter({ id: drop2.id }).select("*").options({ splits: "grouped" }));
136767
+ const { data: transactionsToDelete } = await aqlQuery(q("transactions").filter({ id: drop2.id }).select("*").options({ splits: "grouped" }));
136722
136768
  const ungroupedTransactions = ungroupTransactions(transactionsToDelete);
136723
136769
  if (ungroupedTransactions.length > 0) {
136724
136770
  const { diff: diff2 } = deleteTransaction$1(ungroupedTransactions, drop2.id);
@@ -136778,11 +136824,11 @@ async function exportTransactionsQuery({ query: queryState }) {
136778
136824
  return exportQueryToCSV(new Query(queryState));
136779
136825
  }
136780
136826
  async function getEarliestTransaction() {
136781
- const { data } = await aqlQuery$1(q("transactions").options({ splits: "none" }).orderBy({ date: "asc" }).select("*").limit(1));
136827
+ const { data } = await aqlQuery(q("transactions").options({ splits: "none" }).orderBy({ date: "asc" }).select("*").limit(1));
136782
136828
  return data[0] || null;
136783
136829
  }
136784
136830
  async function getLatestTransaction() {
136785
- const { data } = await aqlQuery$1(q("transactions").options({ splits: "none" }).orderBy({ date: "desc" }).select("*").limit(1));
136831
+ const { data } = await aqlQuery(q("transactions").options({ splits: "none" }).orderBy({ date: "desc" }).select("*").limit(1));
136786
136832
  return data[0] || null;
136787
136833
  }
136788
136834
  const app = createApp();
@@ -136810,7 +136856,7 @@ exports.handlers["query"] = async function (query) {
136810
136856
  if (query["table"] == null) {
136811
136857
  throw new Error("query has no table, did you forgot to call `.serialize`?");
136812
136858
  }
136813
- return aqlQuery$1(query);
136859
+ return aqlQuery(query);
136814
136860
  };
136815
136861
  exports.handlers["get-server-version"] = async function () {
136816
136862
  if (!getServer()) {
@@ -136856,7 +136902,6 @@ exports.handlers["app-focused"] = async function () {
136856
136902
  }
136857
136903
  };
136858
136904
  exports.handlers = installAPI(exports.handlers);
136859
- override((name, args) => runHandler(app$j.handlers[name], args));
136860
136905
  app$j.handlers = exports.handlers;
136861
136906
  app$j.combine(app$g, app$f, app$e, app$b, app$8, app$6, app$1, app$9, app$c, app$5, app$h, app, app$i, app$7, app$4, app$3, app$d, app$a, app$2);
136862
136907
  function getDefaultDocumentDir() {
@@ -136906,7 +136951,7 @@ async function initApp(isDev, socketName) {
136906
136951
  }
136907
136952
  setServer(url);
136908
136953
  init$2(socketName, app$j.handlers);
136909
- global.$query = aqlQuery$1;
136954
+ global.$query = aqlQuery;
136910
136955
  global.$q = q;
136911
136956
  if (isDev) {
136912
136957
  global.$send = (name, args) => runHandler(app$j.handlers[name], args);