inibase 1.2.5 → 1.2.7

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/file.js CHANGED
@@ -558,7 +558,7 @@ export const search = async (filePath, operator, comparedAtValue, logicalOperato
558
558
  if (offset && linesNumbers.size < offset)
559
559
  continue;
560
560
  // Check if the limit has been reached.
561
- if (limit && linesNumbers.size >= limit + (offset ?? 0)) {
561
+ if (limit && linesNumbers.size > limit + (offset ? offset - 1 : 0)) {
562
562
  if (readWholeFile)
563
563
  continue;
564
564
  break;
package/dist/index.js CHANGED
@@ -1019,7 +1019,8 @@ export default class Inibase {
1019
1019
  ...field,
1020
1020
  databasePath: this.databasePath,
1021
1021
  table: field.table ?? tableName,
1022
- }, options.perPage, (options.page - 1) * options.perPage + 1, true);
1022
+ }, options.perPage, (options.page - 1) * options.perPage +
1023
+ (options.page > 1 ? 1 : 0), true);
1023
1024
  if (searchResult) {
1024
1025
  const formatedSearchResult = Object.fromEntries(Object.entries(searchResult).map(([id, value]) => {
1025
1026
  const nestedObj = {};
@@ -1106,6 +1107,7 @@ export default class Inibase {
1106
1107
  options.columns.push("id");
1107
1108
  }
1108
1109
  // Default values for page and perPage
1110
+ options.columns = options.columns || [];
1109
1111
  options.page = options.page || 1;
1110
1112
  options.perPage = options.perPage || 15;
1111
1113
  let RETURN;
@@ -1309,6 +1311,7 @@ export default class Inibase {
1309
1311
  Utils.isFieldType(field, "table")), Object.keys(LineNumberDataObj).map(Number), options)));
1310
1312
  if (globalConfig[this.databasePath].tables.get(tableName).config.cache)
1311
1313
  await writeFile(cachedFilePath, Object.keys(LineNumberDataObj).join(","));
1314
+ this.totalItems.delete(`${tableName}-*`);
1312
1315
  }
1313
1316
  }
1314
1317
  if (!RETURN ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",