Comparing version 2.6.3 to 2.6.4
@@ -29,7 +29,7 @@ import AWS = require('aws-sdk'); | ||
* Publish a JSON message (object) in a endpoint. | ||
* @param {Object} message the message to send (an object) | ||
* @param {any} message the message to send (an object) | ||
* @param {string} endpoint endpoint of a topic or a subscription | ||
* @return {Promise<AWS.SNS.PublishResponse>} | ||
*/ | ||
publish(message: Object, endpoint: string): Promise<AWS.SNS.PublishResponse>; | ||
publish(message: any, endpoint: string): Promise<AWS.SNS.PublishResponse>; | ||
} |
@@ -81,3 +81,3 @@ "use strict"; | ||
* Publish a JSON message (object) in a endpoint. | ||
* @param {Object} message the message to send (an object) | ||
* @param {any} message the message to send (an object) | ||
* @param {string} endpoint endpoint of a topic or a subscription | ||
@@ -88,3 +88,4 @@ * @return {Promise<AWS.SNS.PublishResponse>} | ||
return new Promise((resolve, reject) => { | ||
this.sns.publish({ MessageStructure: 'json', Message: JSON.stringify(message), TargetArn: endpoint }, (err, data) => { | ||
// note: the object must contain at least a top-level JSON key of "default" with a value that is a string | ||
this.sns.publish({ MessageStructure: 'json', Message: JSON.stringify({ default: message }), TargetArn: endpoint }, (err, data) => { | ||
IdeaX.logger('SNS PUBLISH IN TOPIC', err, JSON.stringify(data)); | ||
@@ -91,0 +92,0 @@ if (err) |
{ | ||
"name": "idea-aws", | ||
"version": "2.6.3", | ||
"version": "2.6.4", | ||
"description": "AWS wrappers to use in IDEA's back-ends", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -87,10 +87,11 @@ import AWS = require('aws-sdk'); | ||
* Publish a JSON message (object) in a endpoint. | ||
* @param {Object} message the message to send (an object) | ||
* @param {any} message the message to send (an object) | ||
* @param {string} endpoint endpoint of a topic or a subscription | ||
* @return {Promise<AWS.SNS.PublishResponse>} | ||
*/ | ||
public publish(message: Object, endpoint: string): Promise<AWS.SNS.PublishResponse> { | ||
public publish(message: any, endpoint: string): Promise<AWS.SNS.PublishResponse> { | ||
return new Promise((resolve, reject) => { | ||
// note: the object must contain at least a top-level JSON key of "default" with a value that is a string | ||
this.sns.publish( | ||
{ MessageStructure: 'json', Message: JSON.stringify(message), TargetArn: endpoint }, | ||
{ MessageStructure: 'json', Message: JSON.stringify({ default: message }), TargetArn: endpoint }, | ||
(err: Error, data: AWS.SNS.PublishResponse) => { | ||
@@ -97,0 +98,0 @@ IdeaX.logger('SNS PUBLISH IN TOPIC', err, JSON.stringify(data)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4007088
5385