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 (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1846,12 +1846,13 @@
1846
1846
  }
1847
1847
 
1848
1848
  /**
1849
+ * @todo Didn't need to escape `%`. Do we still need this escape?
1849
1850
  * @param {string} str
1850
1851
  * @returns {string}
1851
1852
  */
1852
1853
  function sqlLIKEEscape(str) {
1853
1854
  // https://www.sqlite.org/lang_expr.html#like
1854
- return sqlEscape(str).replaceAll('^', '^^');
1855
+ return str.replaceAll('^', '^^');
1855
1856
  }
1856
1857
 
1857
1858
  /**
@@ -7965,8 +7966,11 @@
7965
7966
  return rowKey.includes(check);
7966
7967
  }) ||
7967
7968
  // More precise than our SQL
7968
- isMultiEntryMatch(/** @type {string} */
7969
- encodedKey, row[escapedIndexNameForKeyCol]))) {
7969
+ isMultiEntryMatch(
7970
+ // Added `JSON.stringify` as was having problems with
7971
+ // `JSON.stringify` encoding added to nested
7972
+ // array keys
7973
+ JSON.stringify(encodedKey).slice(1, -1), row[escapedIndexNameForKeyCol]))) {
7970
7974
  recordCount++;
7971
7975
  record = row;
7972
7976
  } else if (!hasKey && !multiChecks) {
@@ -8042,7 +8046,13 @@
8042
8046
  sql.push(')');
8043
8047
  } else if (index.multiEntry) {
8044
8048
  sql.push('AND', escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
8045
- sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
8049
+ if (Array.isArray(range)) {
8050
+ // Todo: For nesting deeper than one level, we probably need to
8051
+ // run `JSON.stringify` again
8052
+ sqlValues.push('%' + sqlLIKEEscape(JSON.stringify(/** @type {string} */_encode(range, index.multiEntry)).slice(1, -1)) + '%');
8053
+ } else {
8054
+ sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
8055
+ }
8046
8056
  } else {
8047
8057
  var convertedRange = convertValueToKeyRange(range, nullDisallowed);
8048
8058
  setSQLForKeyRange(convertedRange, escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);