inibase 1.0.0-rc.97 → 1.0.0-rc.98
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/index.js +24 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -605,15 +605,15 @@ export default class Inibase {
|
|
|
605
605
|
(await File.isExists(join(tablePath, `${(prefix ?? "") + field.key}${this.getFileExtension(tableName)}`)))) {
|
|
606
606
|
const itemsIDs = await File.get(join(tablePath, `${(prefix ?? "") + field.key}${this.getFileExtension(tableName)}`), linesNumber, field.type, field.children, this.salt);
|
|
607
607
|
if (itemsIDs) {
|
|
608
|
-
const searchableIDs =
|
|
609
|
-
for (const [
|
|
610
|
-
if (!RETURN[
|
|
611
|
-
RETURN[
|
|
612
|
-
if (
|
|
613
|
-
searchableIDs
|
|
608
|
+
const searchableIDs = new Map();
|
|
609
|
+
for (const [lineNumber, lineContent] of Object.entries(itemsIDs)) {
|
|
610
|
+
if (!RETURN[lineNumber])
|
|
611
|
+
RETURN[lineNumber] = {};
|
|
612
|
+
if (lineContent !== null && lineContent !== undefined)
|
|
613
|
+
searchableIDs.set(lineNumber, lineContent);
|
|
614
614
|
}
|
|
615
|
-
if (
|
|
616
|
-
const items = await this.get(field.table,
|
|
615
|
+
if (searchableIDs.size) {
|
|
616
|
+
const items = await this.get(field.table, Array.from(new Set(Array.from(searchableIDs.values()).flat())), {
|
|
617
617
|
...options,
|
|
618
618
|
perPage: Number.POSITIVE_INFINITY,
|
|
619
619
|
columns: options.columns
|
|
@@ -621,10 +621,10 @@ export default class Inibase {
|
|
|
621
621
|
.map((column) => column.replace(`${field.key}.`, "")),
|
|
622
622
|
});
|
|
623
623
|
if (items) {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
624
|
+
for (const [lineNumber, lineContent,] of searchableIDs.entries()) {
|
|
625
|
+
const foundedItems = items.filter(({ id }) => lineContent.includes(id));
|
|
626
|
+
if (foundedItems)
|
|
627
|
+
RETURN[lineNumber][field.key] = foundedItems;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
630
630
|
}
|
|
@@ -660,15 +660,15 @@ export default class Inibase {
|
|
|
660
660
|
(await File.isExists(join(tablePath, `${(prefix ?? "") + field.key}${this.getFileExtension(tableName)}`)))) {
|
|
661
661
|
const itemsIDs = await File.get(join(tablePath, `${(prefix ?? "") + field.key}${this.getFileExtension(tableName)}`), linesNumber, field.type, field.children, this.salt);
|
|
662
662
|
if (itemsIDs) {
|
|
663
|
-
const searchableIDs =
|
|
664
|
-
for (const [
|
|
665
|
-
if (!RETURN[
|
|
666
|
-
RETURN[
|
|
667
|
-
if (
|
|
668
|
-
searchableIDs
|
|
663
|
+
const searchableIDs = new Map();
|
|
664
|
+
for (const [lineNumber, lineContent] of Object.entries(itemsIDs)) {
|
|
665
|
+
if (!RETURN[lineNumber])
|
|
666
|
+
RETURN[lineNumber] = {};
|
|
667
|
+
if (lineContent !== null && lineContent !== undefined)
|
|
668
|
+
searchableIDs.set(lineNumber, lineContent);
|
|
669
669
|
}
|
|
670
|
-
if (
|
|
671
|
-
const items = await this.get(field.table,
|
|
670
|
+
if (searchableIDs.size) {
|
|
671
|
+
const items = await this.get(field.table, Array.from(new Set(searchableIDs.values())), {
|
|
672
672
|
...options,
|
|
673
673
|
perPage: Number.POSITIVE_INFINITY,
|
|
674
674
|
columns: options.columns
|
|
@@ -676,10 +676,10 @@ export default class Inibase {
|
|
|
676
676
|
.map((column) => column.replace(`${field.key}.`, "")),
|
|
677
677
|
});
|
|
678
678
|
if (items) {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
679
|
+
for (const [lineNumber, lineContent,] of searchableIDs.entries()) {
|
|
680
|
+
const foundedItem = items.find(({ id }) => id === lineContent);
|
|
681
|
+
if (foundedItem)
|
|
682
|
+
RETURN[lineNumber][field.key] = foundedItem;
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
685
|
}
|