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) :
@@ -1831,12 +1831,13 @@
1831
1831
  }
1832
1832
 
1833
1833
  /**
1834
+ * @todo Didn't need to escape `%`. Do we still need this escape?
1834
1835
  * @param {string} str
1835
1836
  * @returns {string}
1836
1837
  */
1837
1838
  function sqlLIKEEscape(str) {
1838
1839
  // https://www.sqlite.org/lang_expr.html#like
1839
- return sqlEscape(str).replaceAll('^', '^^');
1840
+ return str.replaceAll('^', '^^');
1840
1841
  }
1841
1842
 
1842
1843
  /**
@@ -7950,8 +7951,11 @@
7950
7951
  return rowKey.includes(check);
7951
7952
  }) ||
7952
7953
  // More precise than our SQL
7953
- isMultiEntryMatch(/** @type {string} */
7954
- encodedKey, row[escapedIndexNameForKeyCol]))) {
7954
+ isMultiEntryMatch(
7955
+ // Added `JSON.stringify` as was having problems with
7956
+ // `JSON.stringify` encoding added to nested
7957
+ // array keys
7958
+ JSON.stringify(encodedKey).slice(1, -1), row[escapedIndexNameForKeyCol]))) {
7955
7959
  recordCount++;
7956
7960
  record = row;
7957
7961
  } else if (!hasKey && !multiChecks) {
@@ -8027,7 +8031,13 @@
8027
8031
  sql.push(')');
8028
8032
  } else if (index.multiEntry) {
8029
8033
  sql.push('AND', escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
8030
- sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
8034
+ if (Array.isArray(range)) {
8035
+ // Todo: For nesting deeper than one level, we probably need to
8036
+ // run `JSON.stringify` again
8037
+ sqlValues.push('%' + sqlLIKEEscape(JSON.stringify(/** @type {string} */_encode(range, index.multiEntry)).slice(1, -1)) + '%');
8038
+ } else {
8039
+ sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */_encode(range, index.multiEntry)) + '%');
8040
+ }
8031
8041
  } else {
8032
8042
  var convertedRange = convertValueToKeyRange(range, nullDisallowed);
8033
8043
  setSQLForKeyRange(convertedRange, escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);