@graphql-mesh/cache-redis 1.0.0-alpha-20230523153903-5443a1139 → 1.0.0-alpha-20230523154127-518d8667d

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/cjs/index.js CHANGED
@@ -10,7 +10,6 @@ function interpolateStrWithEnv(str) {
10
10
  }
11
11
  class RedisCache {
12
12
  constructor(options) {
13
- var _a, _b, _c;
14
13
  if (options.url) {
15
14
  const redisUrl = new URL(interpolateStrWithEnv(options.url));
16
15
  redisUrl.searchParams.set('lazyConnect', 'true');
@@ -19,12 +18,12 @@ class RedisCache {
19
18
  if (!['redis:', 'rediss:'].includes(redisUrl.protocol)) {
20
19
  throw new Error('Redis URL must use either redis:// or rediss://');
21
20
  }
22
- this.client = new ioredis_1.default(redisUrl === null || redisUrl === void 0 ? void 0 : redisUrl.toString());
21
+ this.client = new ioredis_1.default(redisUrl?.toString());
23
22
  }
24
23
  else {
25
- const parsedHost = interpolateStrWithEnv((_a = options.host) === null || _a === void 0 ? void 0 : _a.toString());
26
- const parsedPort = interpolateStrWithEnv((_b = options.port) === null || _b === void 0 ? void 0 : _b.toString());
27
- const parsedPassword = interpolateStrWithEnv((_c = options.password) === null || _c === void 0 ? void 0 : _c.toString());
24
+ const parsedHost = interpolateStrWithEnv(options.host?.toString());
25
+ const parsedPort = interpolateStrWithEnv(options.port?.toString());
26
+ const parsedPassword = interpolateStrWithEnv(options.password?.toString());
28
27
  if (parsedHost) {
29
28
  this.client = new ioredis_1.default({
30
29
  host: parsedHost,
@@ -46,7 +45,7 @@ class RedisCache {
46
45
  }
47
46
  async set(key, value, options) {
48
47
  const stringifiedValue = JSON.stringify(value);
49
- if (options === null || options === void 0 ? void 0 : options.ttl) {
48
+ if (options?.ttl) {
50
49
  await this.client.set(key, stringifiedValue, 'EX', options.ttl);
51
50
  }
52
51
  else {
package/esm/index.js CHANGED
@@ -7,7 +7,6 @@ function interpolateStrWithEnv(str) {
7
7
  }
8
8
  export default class RedisCache {
9
9
  constructor(options) {
10
- var _a, _b, _c;
11
10
  if (options.url) {
12
11
  const redisUrl = new URL(interpolateStrWithEnv(options.url));
13
12
  redisUrl.searchParams.set('lazyConnect', 'true');
@@ -16,12 +15,12 @@ export default class RedisCache {
16
15
  if (!['redis:', 'rediss:'].includes(redisUrl.protocol)) {
17
16
  throw new Error('Redis URL must use either redis:// or rediss://');
18
17
  }
19
- this.client = new Redis(redisUrl === null || redisUrl === void 0 ? void 0 : redisUrl.toString());
18
+ this.client = new Redis(redisUrl?.toString());
20
19
  }
21
20
  else {
22
- const parsedHost = interpolateStrWithEnv((_a = options.host) === null || _a === void 0 ? void 0 : _a.toString());
23
- const parsedPort = interpolateStrWithEnv((_b = options.port) === null || _b === void 0 ? void 0 : _b.toString());
24
- const parsedPassword = interpolateStrWithEnv((_c = options.password) === null || _c === void 0 ? void 0 : _c.toString());
21
+ const parsedHost = interpolateStrWithEnv(options.host?.toString());
22
+ const parsedPort = interpolateStrWithEnv(options.port?.toString());
23
+ const parsedPassword = interpolateStrWithEnv(options.password?.toString());
25
24
  if (parsedHost) {
26
25
  this.client = new Redis({
27
26
  host: parsedHost,
@@ -43,7 +42,7 @@ export default class RedisCache {
43
42
  }
44
43
  async set(key, value, options) {
45
44
  const stringifiedValue = JSON.stringify(value);
46
- if (options === null || options === void 0 ? void 0 : options.ttl) {
45
+ if (options?.ttl) {
47
46
  await this.client.set(key, stringifiedValue, 'EX', options.ttl);
48
47
  }
49
48
  else {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@graphql-mesh/cache-redis",
3
- "version": "1.0.0-alpha-20230523153903-5443a1139",
3
+ "version": "1.0.0-alpha-20230523154127-518d8667d",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@graphql-mesh/cross-helpers": "0.4.0-alpha-20230523153903-5443a1139",
7
- "@graphql-mesh/types": "1.0.0-alpha-20230523153903-5443a1139",
8
- "@graphql-mesh/utils": "1.0.0-alpha-20230523153903-5443a1139",
6
+ "@graphql-mesh/cross-helpers": "0.4.0-alpha-20230523154127-518d8667d",
7
+ "@graphql-mesh/types": "1.0.0-alpha-20230523154127-518d8667d",
8
+ "@graphql-mesh/utils": "1.0.0-alpha-20230523154127-518d8667d",
9
9
  "graphql": "*",
10
10
  "tslib": "^2.4.0"
11
11
  },
12
12
  "dependencies": {
13
- "@graphql-mesh/string-interpolation": "0.5.0-alpha-20230523153903-5443a1139",
13
+ "@graphql-mesh/string-interpolation": "0.5.0-alpha-20230523154127-518d8667d",
14
14
  "ioredis": "5.3.2",
15
15
  "ioredis-mock": "8.7.0"
16
16
  },
@@ -20,6 +20,9 @@
20
20
  "directory": "packages/cache/redis"
21
21
  },
22
22
  "license": "MIT",
23
+ "engines": {
24
+ "node": ">=16.0.0"
25
+ },
23
26
  "main": "cjs/index.js",
24
27
  "module": "esm/index.js",
25
28
  "typings": "typings/index.d.ts",