inibase 1.1.28 → 1.1.30
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 +2 -3
- package/dist/index.js +22 -14
- package/package.json +1 -1
package/dist/file.js
CHANGED
|
@@ -159,9 +159,8 @@ const decodeHelper = (value, field) => {
|
|
|
159
159
|
return isNumber(value) &&
|
|
160
160
|
(!field.table ||
|
|
161
161
|
!field.databasePath ||
|
|
162
|
-
|
|
163
|
-
.decodeID
|
|
164
|
-
field.key !== "id"))
|
|
162
|
+
!globalConfig[field.databasePath].tables?.get(field.table)?.config
|
|
163
|
+
.decodeID)
|
|
165
164
|
? encodeID(value)
|
|
166
165
|
: value;
|
|
167
166
|
default:
|
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()))
|
|
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
|
-
|
|
901
|
-
|
|
902
|
-
?
|
|
903
|
-
?
|
|
904
|
-
|
|
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:
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
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;
|
|
@@ -1010,6 +1017,7 @@ export default class Inibase {
|
|
|
1010
1017
|
databasePath: this.databasePath,
|
|
1011
1018
|
table: field.table ?? tableName,
|
|
1012
1019
|
}, options.perPage, (options.page - 1) * options.perPage + 1, true);
|
|
1020
|
+
console.log(searchResult, totalLines, linesNumbers);
|
|
1013
1021
|
if (searchResult) {
|
|
1014
1022
|
const formatedSearchResult = Object.fromEntries(Object.entries(searchResult).map(([id, value]) => {
|
|
1015
1023
|
const nestedObj = {};
|