@ikonintegration/ikapi 3.0.0-alpha4 → 3.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/ikapi",
3
- "version": "3.0.0-alpha4",
3
+ "version": "3.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -14,6 +14,7 @@
14
14
  "@aws-sdk/client-dynamodb": "^3.72.0",
15
15
  "@aws-sdk/client-ses": "^3.72.0",
16
16
  "@aws-sdk/client-sns": "^3.72.0",
17
+ "@aws-sdk/credential-provider-node": "^3.72.0",
17
18
  "@aws-sdk/node-http-handler": "^3.58.0",
18
19
  "@aws-sdk/util-dynamodb": "^3.72.0",
19
20
  "abind": "^1.0.5",
@@ -32,15 +32,15 @@ IKUtils.caseInsensitiveSetObjectForKey = function(obj, key, value) {
32
32
  IKUtils.encapsulateForDB = function(item) {
33
33
  if (Array.isArray(item)) return {L: item.map(_i => IKUtils.encapsulateForDB(_i))};
34
34
  else if (typeof item === 'object' && isNaN(parseInt(item))) {
35
- return {M: marshall(item, {removeUndefinedValues: true})};
36
- } else return convertToAttr(item);
35
+ return {M: marshall(item, {removeUndefinedValues: true, convertClassInstanceToMap: true })};
36
+ } else return convertToAttr(item, {removeUndefinedValues: true, convertClassInstanceToMap: true });
37
37
  }
38
38
  IKUtils.decapsulateForDB = function(item) {
39
39
  if (!item && item !== false) return null;
40
40
  if (Array.isArray(item)) {
41
41
  return item.map(_item => IKUtils.decapsulateForDB(_item));
42
42
  } else if (typeof item === 'object') {
43
- return unmarshall(item, { removeUndefinedValues: true });
43
+ return unmarshall(item, {removeUndefinedValues: true, convertClassInstanceToMap: true });
44
44
  } return item;
45
45
  }
46
46
  //Threads
@@ -18,8 +18,8 @@ export default class IKDBQueryPut extends IKDBQuery {
18
18
  (source[key].length > 0))) {
19
19
  //Check for object conversion
20
20
  let val;
21
- if (isObject) val = {"M": marshall(source[key])};
22
- else val = convertToAttr(source[key]);
21
+ if (isObject) val = {"M": marshall(source[key], {removeUndefinedValues: true, convertClassInstanceToMap: true })};
22
+ else val = convertToAttr(source[key], {removeUndefinedValues: true, convertClassInstanceToMap: true });
23
23
  //valid
24
24
  if (val != undefined) { this.putItems[key]= val; }
25
25
  // console.debug("Apppending key:", key, " val:", val);
@@ -1,7 +1,8 @@
1
1
  const nodemailer = require("nodemailer");
2
2
  const Email = require('email-templates');
3
+ const AWSSES = require("@aws-sdk/client-ses");
3
4
  //
4
- import { SESClient } from "@aws-sdk/client-ses";
5
+ import { defaultProvider } from '@aws-sdk/credential-provider-node';
5
6
  import Utils from "./../API/IKUtils";
6
7
  //
7
8
  export default class IKMailer {
@@ -13,7 +14,10 @@ export default class IKMailer {
13
14
  if (Utils.isOffline()) configObj = {region: region, accessKeyId: process.env.AWS_ACCESS_KEY_ID, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY};
14
15
  //
15
16
  this.transporter = nodemailer.createTransport({
16
- SES: new SESClient({ apiVersion: "2010-12-01", ...configObj })
17
+ SES: {
18
+ ses: new AWSSES.SESClient({ apiVersion: "2010-12-01", ...configObj, defaultProvider }),
19
+ aws: AWSSES
20
+ }
17
21
  });
18
22
  }
19
23
 
@@ -1,4 +1,4 @@
1
- import { SNSClient } from "@aws-sdk/client-sns";
1
+ import { SNSClient, PublishCommand } from "@aws-sdk/client-sns";
2
2
  import sha1 from 'sha1';
3
3
  //
4
4
  import Utils from "./../API/IKUtils";
@@ -24,7 +24,7 @@ export default class IKPublisher {
24
24
  TopicArn: topic,
25
25
  ...(additionalProps ? additionalProps : {}),
26
26
  };
27
- resp = await PUBLISHER_CONN.publish(params);
27
+ resp = await PUBLISHER_CONN.send(new PublishCommand(params));
28
28
  } catch (e) {
29
29
  console.error(`Error while publishing into topic ${topic} with error: ${e}`);
30
30
  }
@@ -37,7 +37,7 @@ export default class IKPublisher {
37
37
  //Configure when sending!
38
38
  let configObj = { region: this.region };
39
39
  if (Utils.isOffline()) configObj = { ...configObj, accessKeyId: process.env.AWS_ACCESS_KEY_ID, secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY };
40
- PUBLISHER_CONN = (new SNSClient({ apiVersion: '2010-03-31', ...config }));
40
+ PUBLISHER_CONN = (new SNSClient({ apiVersion: '2010-03-31', ...configObj }));
41
41
  PUBLISHER_CONN_HASH = sha1(this.region);
42
42
  }
43
43
  }