indexeddbshim 15.1.0 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v15.0.4 - 9/11/2024 */
1
+ /*! indexeddbshim - v15.2.0 - 9/11/2024 */
2
2
 
3
3
  (function (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -1851,12 +1851,13 @@
1851
1851
  }
1852
1852
 
1853
1853
  /**
1854
+ * @todo Didn't need to escape `%`. Do we still need this escape?
1854
1855
  * @param {string} str
1855
1856
  * @returns {string}
1856
1857
  */
1857
1858
  function sqlLIKEEscape(str) {
1858
1859
  // https://www.sqlite.org/lang_expr.html#like
1859
- return sqlEscape(str).replaceAll('^', '^^');
1860
+ return str.replaceAll('^', '^^');
1860
1861
  }
1861
1862
 
1862
1863
  /**
@@ -7970,8 +7971,11 @@
7970
7971
  return rowKey.includes(check);
7971
7972
  }) ||
7972
7973
  // More precise than our SQL
7973
- isMultiEntryMatch(/** @type {string} */
7974
- encodedKey, row[escapedIndexNameForKeyCol]))) {
7974
+ isMultiEntryMatch(
7975
+ // Added `JSON.stringify` as was having problems with
7976
+ // `JSON.stringify` encoding added to nested
7977
+ // array keys
7978
+ JSON.stringify(encodedKey).slice(1, -1), row[escapedIndexNameForKeyCol]))) {
7975
7979
  recordCount++;
7976
7980
  record = row;
7977
7981
  } else if (!hasKey && !multiChecks) {
@@ -8047,7 +8051,13 @@
8047
8051
  sql.push(')');
8048
8052
  } else if (index.multiEntry) {
8049
8053
  sql.push('AND', escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
8050
- sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
8054
+ if (Array.isArray(range)) {
8055
+ // Todo: For nesting deeper than one level, we probably need to
8056
+ // run `JSON.stringify` again
8057
+ sqlValues.push('%' + sqlLIKEEscape(JSON.stringify(/** @type {string} */_encode(range, index.multiEntry)).slice(1, -1)) + '%');
8058
+ } else {
8059
+ sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
8060
+ }
8051
8061
  } else {
8052
8062
  var convertedRange = convertValueToKeyRange(range, nullDisallowed);
8053
8063
  setSQLForKeyRange(convertedRange, escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);