Comparing version 2.7.2 to 2.7.3
@@ -7,2 +7,3 @@ import AWS = require('aws-sdk'); | ||
protected sns: AWS.SNS; | ||
protected IDEA_DEFAULT_SNS_ENDPOINT: string; | ||
/** | ||
@@ -30,5 +31,5 @@ * Initialize a new SNS helper object. | ||
* @param object the JSON object to send | ||
* @param endpoint SNS endpoint | ||
* @param endpoint SNS endpoint (default: IDEA's endpoint) | ||
*/ | ||
publishJSON(object: object, endpoint: string): Promise<AWS.SNS.PublishResponse>; | ||
publishJSON(object: object, endpoint?: string): Promise<AWS.SNS.PublishResponse>; | ||
} |
@@ -13,2 +13,3 @@ "use strict"; | ||
constructor() { | ||
this.IDEA_DEFAULT_SNS_ENDPOINT = 'arn:aws:sns:eu-west-2:854501414358:idea_notifications'; | ||
this.sns = new AWS.SNS({ apiVersion: '2010-03-31', region: process.env['SNS_PUSH_REGION'] }); | ||
@@ -82,6 +83,7 @@ } | ||
* @param object the JSON object to send | ||
* @param endpoint SNS endpoint | ||
* @param endpoint SNS endpoint (default: IDEA's endpoint) | ||
*/ | ||
publishJSON(object, endpoint) { | ||
return new Promise((resolve, reject) => { | ||
endpoint = endpoint || this.IDEA_DEFAULT_SNS_ENDPOINT; | ||
this.sns.publish({ MessageStructure: 'json', Message: JSON.stringify({ default: JSON.stringify(object) }), TargetArn: endpoint }, (err, data) => { | ||
@@ -88,0 +90,0 @@ IdeaX.logger('SNS PUBLISH IN TOPIC', err, JSON.stringify(data)); |
{ | ||
"name": "idea-aws", | ||
"version": "2.7.2", | ||
"version": "2.7.3", | ||
"description": "AWS wrappers to use in IDEA's back-ends", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -10,2 +10,4 @@ import AWS = require('aws-sdk'); | ||
protected IDEA_DEFAULT_SNS_ENDPOINT = 'arn:aws:sns:eu-west-2:854501414358:idea_notifications'; | ||
/** | ||
@@ -88,6 +90,7 @@ * Initialize a new SNS helper object. | ||
* @param object the JSON object to send | ||
* @param endpoint SNS endpoint | ||
* @param endpoint SNS endpoint (default: IDEA's endpoint) | ||
*/ | ||
public publishJSON(object: object, endpoint: string): Promise<AWS.SNS.PublishResponse> { | ||
public publishJSON(object: object, endpoint?: string): Promise<AWS.SNS.PublishResponse> { | ||
return new Promise((resolve, reject) => { | ||
endpoint = endpoint || this.IDEA_DEFAULT_SNS_ENDPOINT; | ||
this.sns.publish( | ||
@@ -94,0 +97,0 @@ { MessageStructure: 'json', Message: JSON.stringify({ default: JSON.stringify(object) }), TargetArn: endpoint }, |
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
4012475
5364