@graphql-mesh/cache-localforage 1.0.0-alpha-20230523155104-df277a22b → 1.0.0-alpha-20230523160518-5443a1139

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
@@ -6,15 +6,15 @@ const InMemoryLRUDriver_js_1 = require("./InMemoryLRUDriver.js");
6
6
  localforage_1.default.defineDriver((0, InMemoryLRUDriver_js_1.createInMemoryLRUDriver)()).catch(err => console.error('Failed at defining InMemoryLRU driver', err));
7
7
  class LocalforageCache {
8
8
  constructor(config) {
9
- const driverNames = config?.driver || ['INDEXEDDB', 'WEBSQL', 'LOCALSTORAGE', 'INMEMORY_LRU'];
9
+ const driverNames = (config === null || config === void 0 ? void 0 : config.driver) || ['INDEXEDDB', 'WEBSQL', 'LOCALSTORAGE', 'INMEMORY_LRU'];
10
10
  this.localforage = localforage_1.default.createInstance({
11
- name: config?.name || 'graphql-mesh-cache',
12
- storeName: config?.storeName || 'graphql-mesh-cache-store',
11
+ name: (config === null || config === void 0 ? void 0 : config.name) || 'graphql-mesh-cache',
12
+ storeName: (config === null || config === void 0 ? void 0 : config.storeName) || 'graphql-mesh-cache-store',
13
13
  // @ts-expect-error - Weird error
14
- driver: driverNames.map(driverName => localforage_1.default[driverName] ?? driverName),
15
- size: config?.size,
16
- version: config?.version,
17
- description: config?.description,
14
+ driver: driverNames.map(driverName => { var _a; return (_a = localforage_1.default[driverName]) !== null && _a !== void 0 ? _a : driverName; }),
15
+ size: config === null || config === void 0 ? void 0 : config.size,
16
+ version: config === null || config === void 0 ? void 0 : config.version,
17
+ description: config === null || config === void 0 ? void 0 : config.description,
18
18
  });
19
19
  }
20
20
  async get(key) {
@@ -30,7 +30,7 @@ class LocalforageCache {
30
30
  }
31
31
  async set(key, value, options) {
32
32
  const jobs = [this.localforage.setItem(key, value)];
33
- if (options?.ttl) {
33
+ if (options === null || options === void 0 ? void 0 : options.ttl) {
34
34
  jobs.push(this.localforage.setItem(`${key}.expiresAt`, Date.now() + options.ttl * 1000));
35
35
  }
36
36
  await Promise.all(jobs);
package/esm/index.js CHANGED
@@ -3,15 +3,15 @@ import { createInMemoryLRUDriver } from './InMemoryLRUDriver.js';
3
3
  LocalForage.defineDriver(createInMemoryLRUDriver()).catch(err => console.error('Failed at defining InMemoryLRU driver', err));
4
4
  export default class LocalforageCache {
5
5
  constructor(config) {
6
- const driverNames = config?.driver || ['INDEXEDDB', 'WEBSQL', 'LOCALSTORAGE', 'INMEMORY_LRU'];
6
+ const driverNames = (config === null || config === void 0 ? void 0 : config.driver) || ['INDEXEDDB', 'WEBSQL', 'LOCALSTORAGE', 'INMEMORY_LRU'];
7
7
  this.localforage = LocalForage.createInstance({
8
- name: config?.name || 'graphql-mesh-cache',
9
- storeName: config?.storeName || 'graphql-mesh-cache-store',
8
+ name: (config === null || config === void 0 ? void 0 : config.name) || 'graphql-mesh-cache',
9
+ storeName: (config === null || config === void 0 ? void 0 : config.storeName) || 'graphql-mesh-cache-store',
10
10
  // @ts-expect-error - Weird error
11
- driver: driverNames.map(driverName => LocalForage[driverName] ?? driverName),
12
- size: config?.size,
13
- version: config?.version,
14
- description: config?.description,
11
+ driver: driverNames.map(driverName => { var _a; return (_a = LocalForage[driverName]) !== null && _a !== void 0 ? _a : driverName; }),
12
+ size: config === null || config === void 0 ? void 0 : config.size,
13
+ version: config === null || config === void 0 ? void 0 : config.version,
14
+ description: config === null || config === void 0 ? void 0 : config.description,
15
15
  });
16
16
  }
17
17
  async get(key) {
@@ -27,7 +27,7 @@ export default class LocalforageCache {
27
27
  }
28
28
  async set(key, value, options) {
29
29
  const jobs = [this.localforage.setItem(key, value)];
30
- if (options?.ttl) {
30
+ if (options === null || options === void 0 ? void 0 : options.ttl) {
31
31
  jobs.push(this.localforage.setItem(`${key}.expiresAt`, Date.now() + options.ttl * 1000));
32
32
  }
33
33
  await Promise.all(jobs);
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@graphql-mesh/cache-localforage",
3
- "version": "1.0.0-alpha-20230523155104-df277a22b",
3
+ "version": "1.0.0-alpha-20230523160518-5443a1139",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@graphql-mesh/types": "1.0.0-alpha-20230523155104-df277a22b",
7
- "@graphql-mesh/utils": "1.0.0-alpha-20230523155104-df277a22b",
6
+ "@graphql-mesh/types": "1.0.0-alpha-20230523160518-5443a1139",
7
+ "@graphql-mesh/utils": "1.0.0-alpha-20230523160518-5443a1139",
8
8
  "graphql": "*",
9
9
  "tslib": "^2.4.0"
10
10
  },
@@ -17,9 +17,6 @@
17
17
  "directory": "packages/cache/localforage"
18
18
  },
19
19
  "license": "MIT",
20
- "engines": {
21
- "node": ">=16.0.0"
22
- },
23
20
  "main": "cjs/index.js",
24
21
  "module": "esm/index.js",
25
22
  "typings": "typings/index.d.ts",