@actual-app/api 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app/bundle.api.js CHANGED
@@ -47643,7 +47643,16 @@ async function asyncTransaction(db, fn) {
47643
47643
  }
47644
47644
  }
47645
47645
  function openDatabase(pathOrBuffer) {
47646
- return new better_sqlite3__WEBPACK_IMPORTED_MODULE_0___default.a(pathOrBuffer);
47646
+ let db = new better_sqlite3__WEBPACK_IMPORTED_MODULE_0___default.a(pathOrBuffer);
47647
+ // Define Unicode-aware LOWER and UPPER implementation.
47648
+ // This is necessary because better-sqlite3 uses SQLite build without ICU support.
47649
+ db.function('UNICODE_LOWER', {
47650
+ deterministic: true
47651
+ }, arg => arg === null || arg === void 0 ? void 0 : arg.toLowerCase());
47652
+ db.function('UNICODE_UPPER', {
47653
+ deterministic: true
47654
+ }, arg => arg === null || arg === void 0 ? void 0 : arg.toUpperCase());
47655
+ return db;
47647
47656
  }
47648
47657
  function closeDatabase(db) {
47649
47658
  return db.close();
@@ -48083,7 +48092,7 @@ __webpack_require__.r(__webpack_exports__);
48083
48092
  async function createPayee(description) {
48084
48093
  // Check to make sure no payee already exists with exactly the same
48085
48094
  // name
48086
- let row = await _db__WEBPACK_IMPORTED_MODULE_0__["first"](`SELECT id FROM payees WHERE LOWER(name) = ? AND tombstone = 0`, [description.toLowerCase()]);
48095
+ let row = await _db__WEBPACK_IMPORTED_MODULE_0__["first"](`SELECT id FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0`, [description.toLowerCase()]);
48087
48096
  if (row) {
48088
48097
  return row.id;
48089
48098
  } else {
@@ -52391,7 +52400,7 @@ const compileFunction = saveStack('function', (state, func) => {
52391
52400
  {
52392
52401
  validateArgLength(args, 1);
52393
52402
  let [arg1] = valArray(state, args, ['string']);
52394
- return typed(`LOWER(${arg1})`, 'string');
52403
+ return typed(`UNICODE_LOWER(${arg1})`, 'string');
52395
52404
  }
52396
52405
 
52397
52406
  // integer/float functions
@@ -58323,7 +58332,7 @@ async function getOrphanedPayees() {
58323
58332
  return rows.map(row => row.id);
58324
58333
  }
58325
58334
  async function getPayeeByName(name) {
58326
- return first(`SELECT * FROM payees WHERE LOWER(name) = ? AND tombstone = 0`, [name.toLowerCase()]);
58335
+ return first(`SELECT * FROM payees WHERE UNICODE_LOWER(name) = ? AND tombstone = 0`, [name.toLowerCase()]);
58327
58336
  }
58328
58337
  function insertPayeeRule(rule) {
58329
58338
  rule = _models__WEBPACK_IMPORTED_MODULE_6__["payeeRuleModel"].validate(rule);