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
  'use strict';
4
4
 
@@ -1313,12 +1313,13 @@ function escapeIndexNameForSQLKeyColumn(index) {
1313
1313
  }
1314
1314
 
1315
1315
  /**
1316
+ * @todo Didn't need to escape `%`. Do we still need this escape?
1316
1317
  * @param {string} str
1317
1318
  * @returns {string}
1318
1319
  */
1319
1320
  function sqlLIKEEscape(str) {
1320
1321
  // https://www.sqlite.org/lang_expr.html#like
1321
- return sqlEscape(str).replaceAll('^', '^^');
1322
+ return str.replaceAll('^', '^^');
1322
1323
  }
1323
1324
 
1324
1325
  /**
@@ -7151,8 +7152,11 @@ function executeFetchIndexData(count, unboundedDisallowed, index, hasKey, range,
7151
7152
  */
7152
7153
  check => rowKey.includes(check)) ||
7153
7154
  // More precise than our SQL
7154
- isMultiEntryMatch(/** @type {string} */
7155
- encodedKey, row[escapedIndexNameForKeyCol]))) {
7155
+ isMultiEntryMatch(
7156
+ // Added `JSON.stringify` as was having problems with
7157
+ // `JSON.stringify` encoding added to nested
7158
+ // array keys
7159
+ JSON.stringify(encodedKey).slice(1, -1), row[escapedIndexNameForKeyCol]))) {
7156
7160
  recordCount++;
7157
7161
  record = row;
7158
7162
  } else if (!hasKey && !multiChecks) {
@@ -7225,7 +7229,13 @@ function buildFetchIndexDataSQL(nullDisallowed, index, range, opType, multiCheck
7225
7229
  sql.push(')');
7226
7230
  } else if (index.multiEntry) {
7227
7231
  sql.push('AND', escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
7228
- sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */encode$1(range, index.multiEntry)) + '%');
7232
+ if (Array.isArray(range)) {
7233
+ // Todo: For nesting deeper than one level, we probably need to
7234
+ // run `JSON.stringify` again
7235
+ sqlValues.push('%' + sqlLIKEEscape(JSON.stringify(/** @type {string} */encode$1(range, index.multiEntry)).slice(1, -1)) + '%');
7236
+ } else {
7237
+ sqlValues.push('%' + sqlLIKEEscape(/** @type {string} */encode$1(range, index.multiEntry)) + '%');
7238
+ }
7229
7239
  } else {
7230
7240
  const convertedRange = convertValueToKeyRange(range, nullDisallowed);
7231
7241
  setSQLForKeyRange(convertedRange, escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);