@ikonintegration/ikapi 4.0.0-alpha2 → 4.0.0-alpha3
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/README.md +2 -1
- package/package.json +1 -1
- package/src/Cache/Redis/IKRedis.js +8 -5
package/README.md
CHANGED
|
@@ -14,9 +14,10 @@ Ikon nodejs API foundation
|
|
|
14
14
|
- Router
|
|
15
15
|
|
|
16
16
|
````
|
|
17
|
+
import * as Config from './routes/tenant/config.js';
|
|
17
18
|
|
|
18
19
|
const routes = [
|
|
19
|
-
{ route: '/tenant/config', method: 'GET', handler:
|
|
20
|
+
{ route: '/tenant/config', method: 'GET', handler: Config.get },
|
|
20
21
|
];
|
|
21
22
|
//Main handler
|
|
22
23
|
export const handler = async (event, context) => {
|
package/package.json
CHANGED
|
@@ -73,15 +73,18 @@ export default class IKCache_Redis extends IKCache {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
/* Private */
|
|
76
|
-
_isRedisClientAvailable() {
|
|
76
|
+
async _isRedisClientAvailable() {
|
|
77
77
|
let response = true;
|
|
78
|
-
try { const test =
|
|
78
|
+
try { const test = await import('redis'); }
|
|
79
79
|
catch (e) { response = false; }
|
|
80
80
|
return response;
|
|
81
81
|
}
|
|
82
|
-
_isRedisClientV4() {
|
|
82
|
+
async _isRedisClientV4() {
|
|
83
83
|
let isV4 = false;
|
|
84
|
-
try {
|
|
84
|
+
try {
|
|
85
|
+
const test = await import('redis');
|
|
86
|
+
isV4 = !!test.createCluster;
|
|
87
|
+
}
|
|
85
88
|
catch (e) { }
|
|
86
89
|
return isV4;
|
|
87
90
|
}
|
|
@@ -93,7 +96,7 @@ export default class IKCache_Redis extends IKCache {
|
|
|
93
96
|
} else if (this.connection) return this.connection; //already connected
|
|
94
97
|
|
|
95
98
|
//Check if redis client is available
|
|
96
|
-
if (!this._isRedisClientAvailable()) throw new Error('Redis client is not available! Please, run "npm i -S redis".');
|
|
99
|
+
if (!(await this._isRedisClientAvailable())) throw new Error('Redis client is not available! Please, run "npm i -S redis".');
|
|
97
100
|
|
|
98
101
|
//Prepare
|
|
99
102
|
const localConsole = (this.transaction ? this.transaction.logger : console);
|