inibase 1.4.8 → 1.5.0

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 +18 -10
  2. package/package.json +5 -3
package/dist/index.js CHANGED
@@ -228,7 +228,7 @@ export default class Inibase {
228
228
  table.schema?.length) {
229
229
  const replaceOldPathes = Utils.findChangedProperties(this.schemaToIdsPath(tableName, table.schema), this.schemaToIdsPath(tableName, schema));
230
230
  if (replaceOldPathes)
231
- await Promise.all(Object.entries(replaceOldPathes).map(async ([oldPath, newPath]) => {
231
+ await Promise.allSettled(Object.entries(replaceOldPathes).map(async ([oldPath, newPath]) => {
232
232
  if (await File.isExists(join(tablePath, oldPath))) {
233
233
  // if newPath is null, it means the field was removed
234
234
  if (newPath === null)
@@ -555,7 +555,7 @@ export default class Inibase {
555
555
  return null;
556
556
  }
557
557
  default:
558
- return typeof value === 'string' ? value.trim() : value;
558
+ return typeof value === "string" ? value.trim() : value;
559
559
  }
560
560
  return null;
561
561
  }
@@ -1451,7 +1451,9 @@ export default class Inibase {
1451
1451
  }
1452
1452
  finally {
1453
1453
  if (renameList.length)
1454
- await Promise.allSettled(renameList.map(async ([tempPath, _]) => unlink(tempPath)));
1454
+ await Promise.allSettled(renameList
1455
+ .filter(([_, filePath]) => filePath)
1456
+ .map(async ([tempPath, _]) => unlink(tempPath)));
1455
1457
  await File.unlock(join(tablePath, ".tmp"), keys);
1456
1458
  }
1457
1459
  }
@@ -1497,7 +1499,9 @@ export default class Inibase {
1497
1499
  }
1498
1500
  finally {
1499
1501
  if (renameList.length)
1500
- await Promise.allSettled(renameList.map(async ([tempPath, _]) => unlink(tempPath)));
1502
+ await Promise.allSettled(renameList
1503
+ .filter(([_, filePath]) => filePath)
1504
+ .map(async ([tempPath, _]) => unlink(tempPath)));
1501
1505
  await File.unlock(join(tablePath, ".tmp"));
1502
1506
  }
1503
1507
  }
@@ -1536,7 +1540,9 @@ export default class Inibase {
1536
1540
  }
1537
1541
  finally {
1538
1542
  if (renameList.length)
1539
- await Promise.allSettled(renameList.map(async ([tempPath, _]) => unlink(tempPath)));
1543
+ await Promise.allSettled(renameList
1544
+ .filter(([_, filePath]) => filePath)
1545
+ .map(async ([tempPath, _]) => unlink(tempPath)));
1540
1546
  await File.unlock(join(tablePath, ".tmp"), keys);
1541
1547
  }
1542
1548
  }
@@ -1581,7 +1587,7 @@ export default class Inibase {
1581
1587
  .name.split("-")
1582
1588
  .map(Number);
1583
1589
  }
1584
- await Promise.all((await readdir(tablePath))
1590
+ await Promise.allSettled((await readdir(tablePath))
1585
1591
  ?.filter((fileName) => fileName.endsWith(this.getFileExtension(tableName)))
1586
1592
  .map(async (file) => unlink(join(tablePath, file))));
1587
1593
  if (globalConfig[this.databasePath].tables.get(tableName).config.cache)
@@ -1615,13 +1621,13 @@ export default class Inibase {
1615
1621
  }
1616
1622
  if (pagination[1] &&
1617
1623
  pagination[1] - (Array.isArray(where) ? where.length : 1) > 0) {
1618
- await Promise.all(files.map(async (file) => renameList.push(await File.remove(join(tablePath, file), where))));
1619
- await Promise.all(renameList
1624
+ await Promise.allSettled(files.map(async (file) => renameList.push(await File.remove(join(tablePath, file), where))));
1625
+ await Promise.allSettled(renameList
1620
1626
  .filter(([_, filePath]) => filePath)
1621
1627
  .map(async ([tempPath, filePath]) => rename(tempPath, filePath)));
1622
1628
  }
1623
1629
  else
1624
- await Promise.all((await readdir(tablePath))
1630
+ await Promise.allSettled((await readdir(tablePath))
1625
1631
  ?.filter((fileName) => fileName.endsWith(this.getFileExtension(tableName)))
1626
1632
  .map(async (file) => unlink(join(tablePath, file))));
1627
1633
  if (globalConfig[this.databasePath].tables.get(tableName).config.cache)
@@ -1631,7 +1637,9 @@ export default class Inibase {
1631
1637
  }
1632
1638
  finally {
1633
1639
  if (renameList.length)
1634
- await Promise.allSettled(renameList.map(async ([tempPath, _]) => unlink(tempPath)));
1640
+ await Promise.allSettled(renameList
1641
+ .filter(([_, filePath]) => filePath)
1642
+ .map(async ([tempPath, _]) => unlink(tempPath)));
1635
1643
  await File.unlock(join(tablePath, ".tmp"));
1636
1644
  }
1637
1645
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inibase",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Karim Amahtil",
@@ -68,7 +68,7 @@
68
68
  }
69
69
  },
70
70
  "devDependencies": {
71
- "@biomejs/biome": "1.9.4",
71
+ "@biomejs/biome": "2.3.10",
72
72
  "@types/bun": "^1.2.10",
73
73
  "@types/node": "^22.15.2",
74
74
  "lefthook": "^1.11.11",
@@ -78,7 +78,9 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "dotenv": "^16.5.0",
81
- "inison": "^2.0.1",
81
+ "inison": "^2.0.1"
82
+ },
83
+ "optionalDependencies": {
82
84
  "re2": "^1.22.1"
83
85
  },
84
86
  "scripts": {