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.
- package/dist/IDBIndex.d.ts.map +1 -1
- package/dist/indexeddbshim-Key.js +1 -1
- package/dist/indexeddbshim-Key.js.map +1 -1
- package/dist/indexeddbshim-Key.min.js +1 -1
- package/dist/indexeddbshim-Key.min.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +15 -5
- package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.js +15 -5
- package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js +2 -2
- package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
- package/dist/indexeddbshim-node.cjs +15 -5
- package/dist/indexeddbshim-node.cjs.map +1 -1
- package/dist/indexeddbshim-noninvasive.js +15 -5
- package/dist/indexeddbshim-noninvasive.js.map +1 -1
- package/dist/indexeddbshim-noninvasive.min.js +2 -2
- package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
- package/dist/indexeddbshim.js +15 -5
- package/dist/indexeddbshim.js.map +1 -1
- package/dist/indexeddbshim.min.js +2 -2
- package/dist/indexeddbshim.min.js.map +1 -1
- package/dist/util.d.ts +1 -0
- package/dist/util.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/IDBIndex.js +17 -4
- package/src/util.js +2 -1
package/dist/util.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export function escapeIndexNameForSQL(index: string): string;
|
|
|
40
40
|
*/
|
|
41
41
|
export function escapeIndexNameForSQLKeyColumn(index: string): string;
|
|
42
42
|
/**
|
|
43
|
+
* @todo Didn't need to escape `%`. Do we still need this escape?
|
|
43
44
|
* @param {string} str
|
|
44
45
|
* @returns {string}
|
|
45
46
|
*/
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.js"],"names":[],"mappings":"sBAKa,MAAM;;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.js"],"names":[],"mappings":"sBAKa,MAAM;;uBAkfN,GAAG;AAxchB;;;;GAIG;AACH,2CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,4CAHW,MAAM,GACJ,MAAM,CAUlB;AAuBD;;;;GAIG;AACH,qDAJW,MAAM,GAEJ,MAAM,CAoClB;AAmBD;;;;GAIG;AACH,uDAHW,MAAM,GACJ,MAAM,CAkClB;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,6CAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;GAGG;AACH,sDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;GAIG;AACH,mCAHW,MAAM,GACJ,MAAM,CAKlB;AAzID;;;GAGG;AACH,8BAHW,MAAM,GACJ,MAAM,CAIlB;AAqID;;GAEG;AAGH;;;;;GAKG;AACH,gCAJW,QAAQ,QACR,QAAQ,GACN,OAAO,CAInB;AAED;;;;GAIG;AACH,2BAHW,QAAQ,GACN,GAAG,IAAI,MAAM,CAIzB;AAED;;;;GAIG;AACH,4BAHW,MAAM,GACJ,OAAO,CAInB;AAED;;;;GAIG;AACH,4BAHW,MAAM,GACJ,OAAO,CAKnB;AAED;;;;GAIG;AACH,8BAHW,MAAM,GACJ,OAAO,CAKnB;AAED;;;;GAIG;AACH,4BAHW,MAAM,GACJ,OAAO,CAKnB;AAED;;;;GAIG;AACH,8BAHW,QAAQ,GACN,OAAO,CAOnB;AAED;;;;GAIG;AACH,gCAHW,QAAQ,GACN,OAAO,CAKnB;AAED;;;;;GAKG;AACH,0CAJW,MAAM,SACN,MAAM,EAAE,GACN,IAAI,CAkBhB;AAED;;;;;GAKG;AACH,kDAJW,MAAM,SACN,MAAM,EAAE,GACN,IAAI,CAchB;AAED;;;;;;;GAOG;AACH,8CANW,MAAM,GAAG;IACnB,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,aACO,MAAM,EAAE,GACN,IAAI,CA2BhB;AAED;;;;;;;;GAQG;AACH,8CAPW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,WACf,IAAI,GAAC;IACf,CAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,GACS,IAAI,CA8BhB;AAgCD;;;;GAIG;AACH,wCAHW,MAAM,GAAC,MAAM,EAAE,GACb,OAAO,CAWnB;AAED;;;;;GAKG;AACH,qCALW,MAAM,QACN,oBAAoB,GAAC,eAAe,GAElC,MAAM,CAyBlB;AAED;;GAEG;AAEH;;;;GAIG;AACH,sCAJW,QAAQ,sCAEN,MAAM,CAIlB;AAWD;;;;GAIG;AACH,gDAHW,QAAQ,GACN,MAAM,GAAC,MAAM,EAAE,CAW3B;AAED;;;GAGG;AACH,6BAHW,QAAQ,GACN,CAAC,IAAI,IAAI,GAAC,SAAS,CAI/B"}
|
package/package.json
CHANGED
package/src/IDBIndex.js
CHANGED
|
@@ -847,8 +847,10 @@ function executeFetchIndexData (
|
|
|
847
847
|
(check) => rowKey.includes(check)
|
|
848
848
|
)) || // More precise than our SQL
|
|
849
849
|
Key.isMultiEntryMatch(
|
|
850
|
-
|
|
851
|
-
|
|
850
|
+
// Added `JSON.stringify` as was having problems with
|
|
851
|
+
// `JSON.stringify` encoding added to nested
|
|
852
|
+
// array keys
|
|
853
|
+
JSON.stringify(encodedKey).slice(1, -1),
|
|
852
854
|
row[escapedIndexNameForKeyCol]
|
|
853
855
|
)
|
|
854
856
|
)) {
|
|
@@ -933,9 +935,20 @@ function buildFetchIndexDataSQL (
|
|
|
933
935
|
sql.push(')');
|
|
934
936
|
} else if (index.multiEntry) {
|
|
935
937
|
sql.push('AND', util.escapeIndexNameForSQL(index.name), "LIKE ? ESCAPE '^'");
|
|
936
|
-
|
|
938
|
+
|
|
939
|
+
if (Array.isArray(range)) {
|
|
940
|
+
// Todo: For nesting deeper than one level, we probably need to
|
|
941
|
+
// run `JSON.stringify` again
|
|
942
|
+
sqlValues.push('%' + util.sqlLIKEEscape(
|
|
943
|
+
JSON.stringify(
|
|
944
|
+
/** @type {string} */ (Key.encode(range, index.multiEntry))
|
|
945
|
+
).slice(1, -1)
|
|
946
|
+
) + '%');
|
|
947
|
+
} else {
|
|
948
|
+
sqlValues.push('%' + util.sqlLIKEEscape(
|
|
937
949
|
/** @type {string} */ (Key.encode(range, index.multiEntry))
|
|
938
|
-
|
|
950
|
+
) + '%');
|
|
951
|
+
}
|
|
939
952
|
} else {
|
|
940
953
|
const convertedRange = convertValueToKeyRange(range, nullDisallowed);
|
|
941
954
|
setSQLForKeyRange(convertedRange, util.escapeIndexNameForSQL(index.name), sql, sqlValues, true, false);
|
package/src/util.js
CHANGED
|
@@ -211,12 +211,13 @@ function escapeIndexNameForSQLKeyColumn (index) {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
+
* @todo Didn't need to escape `%`. Do we still need this escape?
|
|
214
215
|
* @param {string} str
|
|
215
216
|
* @returns {string}
|
|
216
217
|
*/
|
|
217
218
|
function sqlLIKEEscape (str) {
|
|
218
219
|
// https://www.sqlite.org/lang_expr.html#like
|
|
219
|
-
return
|
|
220
|
+
return str.replaceAll('^', '^^');
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
/**
|