inibase 1.1.28 → 1.1.29

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -890,27 +890,32 @@ export default class Inibase {
890
890
  searchableIDs.set(lineNumber, lineContent);
891
891
  }
892
892
  if (searchableIDs.size) {
893
- const items = await this.get(field.table, Array.from(new Set(Array.from(searchableIDs.values()).flat())).flat(), {
893
+ const items = await this.get(field.table, Array.from(new Set(Array.from(searchableIDs.values()).flat()))
894
+ .flat()
895
+ .filter((item) => item), {
894
896
  ...options,
895
897
  perPage: Number.POSITIVE_INFINITY,
896
898
  columns: options.columns
897
899
  ?.filter((column) => column.includes(`${field.key}.`))
898
900
  .map((column) => column.replace(`${field.key}.`, "")),
899
901
  });
900
- for (const [lineNumber, lineContent] of searchableIDs.entries()) {
901
- RETURN[lineNumber][field.key] = Array.isArray(lineContent)
902
- ? Utils.isArrayOfArrays(lineContent)
903
- ? lineContent.map((item) => items
904
- ? items.find(({ id }) => item === id)
902
+ const formatLineContent = (lineContent) => Array.isArray(lineContent)
903
+ ? lineContent.map((singleContent) => singleContent
904
+ ? Array.isArray(singleContent)
905
+ ? singleContent.map(formatLineContent)
906
+ : items
907
+ ? items.find(({ id }) => singleContent === id)
905
908
  : {
906
- id: item,
907
- })
908
- : lineContent.flatMap((item) => items
909
- ? items.find(({ id }) => item === id)
910
- : { id: item })
911
- : (items?.find(({ id }) => id === lineContent) ?? {
912
- id: lineContent,
913
- });
909
+ id: singleContent,
910
+ }
911
+ : singleContent)
912
+ : (items?.find(({ id }) => lineContent === id) ?? {
913
+ id: lineContent,
914
+ });
915
+ for (const [lineNumber, lineContent] of searchableIDs.entries()) {
916
+ if (!lineContent)
917
+ continue;
918
+ RETURN[lineNumber][field.key] = formatLineContent(lineContent);
914
919
  }
915
920
  }
916
921
  }
@@ -948,6 +953,8 @@ export default class Inibase {
948
953
  let index = -1;
949
954
  for await (const [key, value] of Object.entries(criteria)) {
950
955
  const field = Utils.getField(key, globalConfig[this.databasePath].tables.get(tableName).schema);
956
+ if (!field)
957
+ continue;
951
958
  index++;
952
959
  let searchOperator = undefined;
953
960
  let searchComparedAtValue = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",