@keyv/postgres 2.2.0 → 2.2.1

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.cjs CHANGED
@@ -109,12 +109,8 @@ var KeyvPostgres = class extends import_node_events.default {
109
109
  async getMany(keys) {
110
110
  const getMany = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
111
111
  const rows = await this.query(getMany, [keys]);
112
- const results = [];
113
- for (const key of keys) {
114
- const rowIndex = rows?.findIndex((row) => row.key === key);
115
- results.push(rowIndex > -1 ? rows[rowIndex].value : void 0);
116
- }
117
- return results;
112
+ const rowsMap = new Map(rows.map((row) => [row.key, row]));
113
+ return keys.map((key) => rowsMap.get(key)?.value);
118
114
  }
119
115
  // biome-ignore lint/suspicious/noExplicitAny: type format
120
116
  async set(key, value) {
@@ -192,3 +188,4 @@ var index_default = KeyvPostgres;
192
188
  KeyvPostgres,
193
189
  createKeyv
194
190
  });
191
+ /* v8 ignore next -- @preserve */
package/dist/index.js CHANGED
@@ -73,12 +73,8 @@ var KeyvPostgres = class extends EventEmitter {
73
73
  async getMany(keys) {
74
74
  const getMany = `SELECT * FROM ${this.opts.schema}.${this.opts.table} WHERE key = ANY($1)`;
75
75
  const rows = await this.query(getMany, [keys]);
76
- const results = [];
77
- for (const key of keys) {
78
- const rowIndex = rows?.findIndex((row) => row.key === key);
79
- results.push(rowIndex > -1 ? rows[rowIndex].value : void 0);
80
- }
81
- return results;
76
+ const rowsMap = new Map(rows.map((row) => [row.key, row]));
77
+ return keys.map((key) => rowsMap.get(key)?.value);
82
78
  }
83
79
  // biome-ignore lint/suspicious/noExplicitAny: type format
84
80
  async set(key, value) {
@@ -156,3 +152,4 @@ export {
156
152
  createKeyv,
157
153
  index_default as default
158
154
  };
155
+ /* v8 ignore next -- @preserve */
package/package.json CHANGED
@@ -1,15 +1,21 @@
1
1
  {
2
2
  "name": "@keyv/postgres",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "PostgreSQL storage adapter for Keyv",
5
5
  "type": "module",
6
- "main": "dist/index.cjs",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "require": "./dist/index.cjs",
12
- "import": "./dist/index.js"
11
+ "require": {
12
+ "types": "./dist/index.d.cts",
13
+ "default": "./dist/index.cjs"
14
+ },
15
+ "import": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
13
19
  }
14
20
  },
15
21
  "repository": {
@@ -42,13 +48,13 @@
42
48
  "keyv": "^5.5.4"
43
49
  },
44
50
  "devDependencies": {
45
- "@biomejs/biome": "^2.2.6",
46
- "@types/pg": "^8.15.5",
47
- "@vitest/coverage-v8": "^3.2.4",
48
- "rimraf": "^6.0.1",
51
+ "@biomejs/biome": "^2.3.6",
52
+ "@types/pg": "^8.15.6",
53
+ "@vitest/coverage-v8": "^4.0.10",
54
+ "rimraf": "^6.1.0",
49
55
  "tsd": "^0.33.0",
50
- "vitest": "^3.2.4",
51
- "@keyv/test-suite": "^2.1.1"
56
+ "vitest": "^4.0.10",
57
+ "@keyv/test-suite": "^2.1.2"
52
58
  },
53
59
  "tsd": {
54
60
  "directory": "test"