@opengis/fastify-table 2.0.40 → 2.0.42

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.
@@ -1,5 +1,5 @@
1
- import redisClients from './funcs/redisClients.js';
2
- import getRedis from './funcs/getRedis.js';
1
+ import redisClients from "./funcs/redisClients.js";
2
+ import getRedis from "./funcs/getRedis.js";
3
3
  if (!redisClients[0]) {
4
4
  getRedis({ db: 0 });
5
5
  }
@@ -1,5 +1,5 @@
1
1
  declare function getRedis({ db, host, port, }?: {
2
- db?: number;
2
+ db: number;
3
3
  host?: string;
4
4
  port?: number;
5
5
  }): any;
@@ -1 +1 @@
1
- {"version":3,"file":"getRedis.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/redis/funcs/getRedis.ts"],"names":[],"mappings":"AAOA,iBAAS,QAAQ,CACf,EACE,EAAE,EACF,IAAyB,EACzB,IAAyB,GAC1B,GAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACH,OAsBd;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"getRedis.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/redis/funcs/getRedis.ts"],"names":[],"mappings":"AAOA,iBAAS,QAAQ,CACf,EACE,EAAE,EACF,IAAI,EACJ,IAAI,GACL,GAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACH,OAsBd;AAED,eAAe,QAAQ,CAAC"}
@@ -3,18 +3,18 @@ import { Redis } from "ioredis";
3
3
  // import Redis from 'ioredis';
4
4
  import config from "../../../../config.js";
5
5
  import redisClients from "./redisClients.js";
6
- function getRedis({ db, host = config.redis?.host, port = config.redis?.port, } = { db: 0 }) {
6
+ function getRedis({ db, host, port, } = { db: 0 }) {
7
7
  if (!config.redis && !host)
8
8
  return null;
9
- const key = [host, port, db].join("-");
9
+ const key = host || port ? [host, port, db].join("-") : db;
10
10
  if (redisClients[key]) {
11
11
  return redisClients[key];
12
12
  }
13
13
  const redisConfig = {
14
14
  db,
15
15
  keyPrefix: `${config.db}:`,
16
- host: config.redis?.host || host || "127.0.0.1",
17
- port: config.redis?.port || port || 6379, // Redis port
16
+ host: host || config.redis?.host || "127.0.0.1",
17
+ port: port || config.redis?.port || 6379, // Redis port
18
18
  family: 4, // 4 (IPv4) or 6 (IPv6)
19
19
  closeClient: true,
20
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.40",
3
+ "version": "2.0.42",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [