@ikonintegration/ikapi 4.0.0-alpha2 → 4.0.0-alpha4

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 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: require('./routes/tenant/config').get },
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/ikapi",
3
- "version": "4.0.0-alpha2",
3
+ "version": "4.0.0-alpha4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -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 = require('redis'); }
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 { isV4 = !!require('redis').createCluster; }
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);
@@ -1,6 +1,6 @@
1
1
  import nodemailer from "nodemailer";
2
2
  import Email from 'email-templates';
3
- import AWSSES from "@aws-sdk/client-ses";
3
+ import { SES } from "@aws-sdk/client-ses";
4
4
  //
5
5
  import { defaultProvider } from '@aws-sdk/credential-provider-node';
6
6
  import Utils from "./../API/IKUtils.js";
@@ -15,8 +15,8 @@ export default class IKMailer {
15
15
  //
16
16
  this.transporter = nodemailer.createTransport({
17
17
  SES: {
18
- ses: new AWSSES.SESClient({ apiVersion: "2010-12-01", ...configObj, defaultProvider }),
19
- aws: AWSSES
18
+ ses: new SES.SESClient({ apiVersion: "2010-12-01", ...configObj, defaultProvider }),
19
+ aws: SES
20
20
  }
21
21
  });
22
22
  }