Skip to content

Commit 97a89ae

Browse files
committed
add missing documentation
1 parent 227c690 commit 97a89ae

File tree

7 files changed

+213
-386
lines changed

7 files changed

+213
-386
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
66

7+
## [1.1.4]  (2019-09-10)
8+
9+
### Added
10+
11+
- Added missing wrapper documentation
12+
713
## [1.1.3]  (2019-09-10)
814

915
### Changed

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,26 @@ interface ApiSignature {
9696
}
9797
```
9898

99-
\*Note that each callback helper functions (success, invalid, redirect, error) includes CORS-enabling header information.
99+
\*Note that each callback helper functions (success, invalid, redirect, error) includes CORS-enabling header information
100100

101101
## CloudFormation Custom Resource
102102

103103
### Sample implementation
104104

105-
// TODO CloudFormation wrapper implementation example
105+
```ts
106+
import { cloudFormation } from '@manwaring/lambda-wrapper';
107+
108+
export const handler = cloudFormation(({ event, success, failure }) => {
109+
try {
110+
const { BucketName } = event.ResourceProperties;
111+
success();
112+
} catch (err) {
113+
failure(err);
114+
}
115+
});
116+
```
117+
118+
\*Note that currently the method wrapped by cloudFormation cannot be async - for reasons that aren't entirely clear to me when the method is async the requests to update CloudFormation with the correct action status fail, leaving a stack in the 'pending' state
106119

107120
### Properties and methods available on wrapper signature
108121

@@ -118,7 +131,18 @@ interface CloudFormationSignature {
118131

119132
### Sample implementation
120133

121-
// TODO DynamoDB stream wrapper implementation example
134+
```ts
135+
import { dynamodbStream } from '@manwaring/lambda-wrapper';
136+
137+
export const handler = dynamodbStream(async ({ newVersions, success, error }) => {
138+
try {
139+
newVersions.forEach(version => console.log(version));
140+
return success(newVersions);
141+
} catch (err) {
142+
return error(err);
143+
}
144+
});
145+
```
122146

123147
### Properties and methods available on wrapper signature
124148

@@ -179,7 +203,18 @@ interface AuthorizerSignature {
179203

180204
### Sample implementation
181205

182-
// TODO SNS event wrapper implementation example
206+
```ts
207+
import { sns } from '@manwaring/lambda-wrapper';
208+
209+
export const handler = sns(async ({ message, success, error }) => {
210+
try {
211+
console.log(message);
212+
return success();
213+
} catch (err) {
214+
return error(err);
215+
}
216+
});
217+
```
183218

184219
### Properties and methods available on wrapper signature
185220

examples/ts/app/cloudformation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { cloudFormation } from '@manwaring/lambda-wrapper';
22
import 'source-map-support/register';
33

4-
export const handler = cloudFormation(({ success, failure }) => {
4+
export const handler = cloudFormation(({ event, success, failure }) => {
55
try {
6-
success();
6+
success(event.ResourceProperties.BucketName);
77
} catch (err) {
88
failure(err);
99
}

examples/ts/app/native-send.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

examples/ts/app/send.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)