@cocreate/indexeddb 1.17.1 → 1.17.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [1.17.2](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.17.1...v1.17.2) (2023-11-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump dependencies for latest features ([df1aa3a](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/df1aa3a5053e068f6f47a66d1d388314c202607c))
7
+ * isFIlter condition ([9fcbb15](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/9fcbb158dad0c8fab4bc09c6701ad2d0c868ab03))
8
+ * limit handling ([43fe9c6](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/43fe9c6d2029aa1486488c944c51c9ba342e4ebf))
9
+ * set $filter.index ([ab739a5](https://github.com/CoCreate-app/CoCreate-indexeddb/commit/ab739a5b41fe5a2ab10e799f328650e9f14a46d1))
10
+
1
11
  ## [1.17.1](https://github.com/CoCreate-app/CoCreate-indexeddb/compare/v1.17.0...v1.17.1) (2023-11-09)
2
12
 
3
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/indexeddb",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
4
  "description": "A simple indexeddb component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "indexeddb",
@@ -58,6 +58,6 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/utils": "^1.26.2"
61
+ "@cocreate/utils": "^1.27.1"
62
62
  }
63
63
  }
package/src/index.js CHANGED
@@ -418,7 +418,7 @@ async function processObject(data, newData, database, array, type) {
418
418
  data[type] = [data[type]]
419
419
 
420
420
  let isFilter
421
- if (data.$filter && data.$filter.query)
421
+ if (data.$filter)
422
422
  isFilter = true
423
423
 
424
424
  let arrayExist = db.objectStoreNames.contains(array)
@@ -656,7 +656,7 @@ function openCursor(objectStore, range, direction, data, newData, isFilter, limi
656
656
  matchedLength++
657
657
  }
658
658
 
659
- if (!limit || limit && (limit < newData.length || limit < matchedLength)) {
659
+ if (!limit || limit && (limit > newData.length || limit > matchedLength)) {
660
660
  cursor.continue();
661
661
  } else if (cursor.close) {
662
662
  cursor.close()
@@ -858,9 +858,11 @@ function createData(data, newData, type) {
858
858
 
859
859
  data[type].push(...newData)
860
860
 
861
- if (data.$filter && data.$filter.sort)
862
- data[type] = sortData(data[type], data.$filter.sort)
863
-
861
+ if (data.$filter) {
862
+ if (data.$filter.sort)
863
+ data[type] = sortData(data[type], data.$filter.sort)
864
+ data.$filter.index += data[type].length
865
+ }
864
866
 
865
867
  return data
866
868
  }