@wxn0brp/db-storage-sqlite 0.110.3 → 0.110.4

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/find.js +9 -5
  2. package/package.json +5 -5
package/dist/find.js CHANGED
@@ -4,10 +4,12 @@ import { toSqlValue } from "./index.js";
4
4
  export async function find(slv, config) {
5
5
  const { collection, search } = config;
6
6
  let sqlResult = [];
7
- const baseKeys = Object.keys(search)
8
- .filter(k => search[k] !== undefined)
9
- .filter(k => !k.startsWith("$"))
10
- .filter(k => typeof search[k] !== "object");
7
+ const baseKeys = typeof search === "object" && search !== null && !Array.isArray(search)
8
+ ? Object.keys(search)
9
+ .filter(k => search[k] !== undefined)
10
+ .filter(k => !k.startsWith("$"))
11
+ .filter(k => typeof search[k] !== "object")
12
+ : [];
11
13
  if (typeof search === "function" || baseKeys.length === 0) {
12
14
  const stmt = await slv._prepare(`SELECT * FROM ${collection}`);
13
15
  sqlResult = await Promise.resolve(stmt.all());
@@ -18,6 +20,8 @@ export async function find(slv, config) {
18
20
  const stmt = await slv._prepare(baseSql);
19
21
  sqlResult = await Promise.resolve(stmt.all(...baseValues));
20
22
  }
21
- const result = sqlResult.filter(entry => findObj(entry, search));
23
+ const result = sqlResult
24
+ .map(entry => findObj(config, entry))
25
+ .filter(Boolean);
22
26
  return findUtil(config, result, []);
23
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wxn0brp/db-storage-sqlite",
3
- "version": "0.110.3",
3
+ "version": "0.110.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "A pure SQLite storage adapter for the ValtheraDB database library",
@@ -22,14 +22,14 @@
22
22
  "@types/better-sqlite3": "^7.6.13",
23
23
  "@types/bun": "*",
24
24
  "@types/node": "*",
25
- "@wxn0brp/db-core": "^0.11.0-alpha.4",
26
- "better-sqlite3": "^12.9.0",
25
+ "@wxn0brp/db-core": "^0.11.0",
26
+ "better-sqlite3": "^12.10.0",
27
27
  "tsc-alias": "^1",
28
28
  "typescript": "^6"
29
29
  },
30
30
  "peerDependencies": {
31
- "@wxn0brp/db-core": "^0.11.0-alpha.4",
32
- "better-sqlite3": "^12.9.0"
31
+ "@wxn0brp/db-core": "^0.11.0",
32
+ "better-sqlite3": "^12.10.0"
33
33
  },
34
34
  "peerDependenciesMeta": {
35
35
  "@wxn0brp/db-core": {