@cloudlessopenlabs/awsx
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -5,2 +5,9 @@ # Changelog | ||
## [0.2.0](https://github.com/cloudlesslabs/awsx/compare/v0.1.2...v0.2.0) (2022-09-19) | ||
### Features | ||
* Add support for SNS ([78e2faf](https://github.com/cloudlesslabs/awsx/commit/78e2faf46aa49e07db468eadf2abc08eff5a1845)) | ||
### [0.1.2](https://github.com/cloudlesslabs/awsx/compare/v0.1.1...v0.1.2) (2022-07-20) | ||
@@ -7,0 +14,0 @@ |
{ | ||
"name": "@cloudlessopenlabs/awsx", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "NodeJS wrapper APIs around the AWS SDK.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -29,7 +29,9 @@ # CLOUDLESS LABS - AWSX | ||
> - [`s3.bucket.setWebsite`](#s3bucketsetWebsite) | ||
> - [`s3.object.get`](#s3bucketfilesget) | ||
> - [`s3.object.put`](#s3bucketfilesput) | ||
> - [`s3.object.upload`](#s3bucketfilesupload) | ||
> - [`s3.object.sync`](#s3bucketfilessync) | ||
> - [`s3.object.remove`](#s3bucketfilesremove) | ||
> - [`s3.object.get`](#s3objectget) | ||
> - [`s3.object.put`](#s3objectput) | ||
> - [`s3.object.upload`](#s3objectupload) | ||
> - [`s3.object.sync`](#s3objectsync) | ||
> - [`s3.object.remove`](#s3objectremove) | ||
> - [SNS](#sns) | ||
> - [`topic.publish`](#topicpublish) | ||
> * [Annexes](#annexes) | ||
@@ -691,2 +693,41 @@ > - [Cloudfront distribution with S3 static website bucket](#cloudfront-distribution-with-s3-static-website-bucket) | ||
## SNS | ||
### `topic.publish` | ||
```js | ||
const { error: { catchErrors, wrapErrors, mergeErrors } } = require('puffy-core') | ||
const { sns } = require('@cloudlessopenlabs/awsx') | ||
const topic = new sns.Topic('arn::your-topic-arn') | ||
const main = () => catchErrors((async () => { | ||
// Supports sending string message "as-is" | ||
const [errors01, resp01] = await topic.publish('hello world') | ||
// Supports sending an object, as long as the object contains the required 'body' property. | ||
const [errors02, resp02] = await topic.publish({ body:'Hello world', attributes: { hello:'world' } }) | ||
// Supports sending SMSes | ||
const [errors03, resp03] = await topic.publish('Hello world', { | ||
phone:'+61420876543', | ||
// subject: 'Hello from me', // Optional | ||
// type: 'promotional' // Optional. Valid values: 'promotional', 'transactional' | ||
}) | ||
if (errors01 || errors02 || errors03) | ||
throw wrapErrors(errors01 || errors02 || errors03) | ||
else { | ||
console.log(resp01) | ||
console.log(resp02) | ||
console.log(resp03) | ||
} | ||
} | ||
})()) | ||
main().then(([errors]) => { | ||
if (errors) | ||
console.error(mergeErrors(errors).stack) | ||
else | ||
console.log('All good') | ||
}) | ||
``` | ||
# Annexes | ||
@@ -693,0 +734,0 @@ ## Cloudfront distribution with S3 static website bucket |
@@ -14,3 +14,4 @@ /** | ||
resource: require('./resource'), | ||
s3: require('./s3') | ||
s3: require('./s3'), | ||
sns: require('./sns') | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95370
14
1792
847