Skip to content

Commit e009036

Browse files
authored
Feature/update runtime (#71)
1 parent a71767d commit e009036

12 files changed

+519
-266
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*Issue #, if available:*
22

33
*Description of changes:*
4+
5+
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

.pre-commit-config.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
repos:
22
- repo: https://github.com/pre-commit/mirrors-isort
3-
rev: v4.3.17
3+
rev: v5.10.1
44
hooks:
55
- id: isort
66
# language_version: python3.6
77
- repo: https://github.com/ambv/black
8-
rev: stable
8+
rev: 22.6.0
99
hooks:
1010
- id: black
1111
# language_version: python3.6
@@ -35,18 +35,18 @@ repos:
3535
- id: check-merge-conflict
3636
- id: check-yaml
3737
- repo: https://github.com/pre-commit/pygrep-hooks
38-
rev: v1.3.0
38+
rev: v1.9.0
3939
hooks:
4040
- id: python-check-blanket-noqa
4141
- id: python-check-mock-methods
4242
- id: python-no-log-warn
4343
- repo: https://github.com/PyCQA/bandit
44-
rev: 1.6.2
44+
rev: 1.7.1
4545
hooks:
4646
- id: bandit
4747
files: "^python/"
4848
- repo: https://github.com/pre-commit/mirrors-eslint
49-
rev: v6.8.0
49+
rev: v8.7.0
5050
hooks:
5151
- id: eslint
5252
args: [--fix]

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ information to effectively respond to your bug report or contribution.
1111

1212
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
1313

14-
When filing an issue, please check [existing open](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/issues), or [recently closed](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
14+
When filing an issue, please check [existing open](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin/issues), or [recently closed](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
1515
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
1616

1717
* A reproducible test case or series of steps
@@ -41,7 +41,7 @@ GitHub provides additional document on [forking a repository](https://help.githu
4141

4242

4343
## Finding contributions to work on
44-
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/labels/help%20wanted) issues is a great place to start.
44+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin/labels/help%20wanted) issues is a great place to start.
4545

4646

4747
## Security issue notifications
@@ -50,6 +50,6 @@ If you discover a potential security issue in this project we ask that you notif
5050

5151
## Licensing
5252

53-
See the [LICENSE](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
53+
See the [LICENSE](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
5454

5555
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.

Pipfile.lock

+472-239
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ We're excited to share our progress with adding new languages to the CloudFormat
44

55
## AWS CloudFormation Resource Provider TypeScript Plugin
66

7-
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/eduardomourar/cloudformation-cli-typescript-plugin/ci/master)](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/actions?query=branch%3Amaster+workflow%3Aci) [![Codecov](https://img.shields.io/codecov/c/gh/eduardomourar/cloudformation-cli-typescript-plugin)](https://codecov.io/gh/eduardomourar/cloudformation-cli-typescript-plugin) [![GitHub release](https://img.shields.io/github/v/release/eduardomourar/cloudformation-cli-typescript-plugin?include_prereleases)](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin/releases) [![Node.js version](https://img.shields.io/badge/dynamic/json?color=brightgreen&url=https://raw.githubusercontent.com/eduardomourar/cloudformation-cli-typescript-plugin/master/package.json&query=$.engines.node&label=nodejs)](https://nodejs.org/)
7+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/aws-cloudformation/cloudformation-cli-typescript-plugin/ci/master)](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin/actions?query=branch%3Amaster+workflow%3Aci) [![Codecov](https://img.shields.io/codecov/c/gh/aws-cloudformation/cloudformation-cli-typescript-plugin)](https://codecov.io/gh/aws-cloudformation/cloudformation-cli-typescript-plugin) [![PyPI version](https://img.shields.io/pypi/v/cloudformation-cli-typescript-plugin)](https://pypi.org/project/cloudformation-cli-typescript-plugin) [![NPM version](https://img.shields.io/npm/v/@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib)](https://www.npmjs.com/package/@amazon-web-services-cloudformation/cloudformation-cli-typescript-lib) [![Node.js version](https://img.shields.io/badge/dynamic/json?color=brightgreen&url=https://raw.githubusercontent.com/aws-cloudformation/cloudformation-cli-typescript-plugin/master/package.json&query=$.engines.node&label=nodejs)](https://nodejs.org/)
88

99
The CloudFormation CLI (cfn) allows you to author your own resource providers that can be used by CloudFormation.
1010

@@ -13,7 +13,7 @@ This plugin library helps to provide TypeScript runtime bindings for the executi
1313
Usage
1414
-----
1515

16-
If you are using this package to build resource providers for CloudFormation, install the [CloudFormation CLI TypeScript Plugin](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin) - this will automatically install the [CloudFormation CLI](https://github.com/aws-cloudformation/cloudformation-cli)! A Python virtual environment is recommended.
16+
If you are using this package to build resource providers for CloudFormation, install the [CloudFormation CLI TypeScript Plugin](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin) - this will automatically install the [CloudFormation CLI](https://github.com/aws-cloudformation/cloudformation-cli)! A Python virtual environment is recommended.
1717

1818
**Prerequisites**
1919

package-lock.json

+13-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"test:debug": "npx --node-arg=--inspect jest --runInBand"
2323
},
2424
"engines": {
25-
"node": ">=12.0.0",
25+
"node": ">=14.0.0",
2626
"npm": ">=6.9.0"
2727
},
2828
"repository": {
@@ -44,7 +44,7 @@
4444
"uuid": "^7.0.2"
4545
},
4646
"devDependencies": {
47-
"@tsconfig/node12": "^1.0.7",
47+
"@tsconfig/node14": "^1.0.1",
4848
"@types/jest": "^26.0.15",
4949
"@types/node": "^12.0.0",
5050
"@types/uuid": "^7.0.0",

python/rpdk/typescript/codegen.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def validate_no(value):
3636
class TypescriptLanguagePlugin(LanguagePlugin):
3737
MODULE_NAME = __name__
3838
NAME = "typescript"
39-
RUNTIME = "nodejs12.x"
39+
RUNTIME = "nodejs14.x"
4040
ENTRY_POINT = "dist/handlers.entrypoint"
4141
TEST_ENTRY_POINT = "dist/handlers.testEntrypoint"
4242
CODE_URI = "./"
@@ -121,9 +121,7 @@ def _copy_resource(path, resource_name=None):
121121
_render_template(
122122
project.root / "package.json",
123123
name=project.hypenated_name,
124-
description="AWS custom resource provider named {}.".format(
125-
project.type_name
126-
),
124+
description=f"AWS custom resource provider named {project.type_name}.",
127125
lib_name=SUPPORT_LIB_NAME,
128126
lib_path=self._lib_path,
129127
)

python/rpdk/typescript/templates/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ const progress = ProgressEvent.builder<ProgressEvent<ResourceModel>>()
3434
.build()
3535
```
3636

37-
While importing the [{{ lib_name }}](https://github.com/eduardomourar/cloudformation-cli-typescript-plugin) library, failures can be passed back to CloudFormation by either raising an exception from `exceptions`, or setting the ProgressEvent's `status` to `OperationStatus.Failed` and `errorCode` to one of `HandlerErrorCode`. There is a static helper function, `ProgressEvent.failed`, for this common case.
37+
While importing the [{{ lib_name }}](https://github.com/aws-cloudformation/cloudformation-cli-typescript-plugin) library, failures can be passed back to CloudFormation by either raising an exception from `exceptions`, or setting the ProgressEvent's `status` to `OperationStatus.Failed` and `errorCode` to one of `HandlerErrorCode`. There is a static helper function, `ProgressEvent.failed`, for this common case.
3838

3939
Keep in mind, during runtime all logs will be delivered to CloudWatch if you use the `log()` method from `LoggerProxy` class.

python/rpdk/typescript/templates/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"class-transformer": "0.3.1"
1818
},
1919
"devDependencies": {
20-
"@types/node": "^12.0.0",
20+
"@types/node": "^14.0.0",
2121
"typescript": "^4.1.2"
2222
},
2323
"optionalDependencies": {

tests/lib/resource.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,21 @@ describe('when getting resource', () => {
787787
);
788788
});
789789

790+
test('invoke handler does not provide response', async () => {
791+
expect.assertions(1);
792+
const mockHandler: jest.Mock = jest.fn().mockResolvedValue(null);
793+
const resource = new Resource(TYPE_NAME, MockModel);
794+
resource.addHandler(Action.Create, mockHandler);
795+
const callbackContext = {};
796+
try {
797+
await resource['invokeHandler'](null, null, Action.Create, callbackContext);
798+
} catch (e) {
799+
expect(e).toMatchObject({
800+
message: 'Handler failed to provide a response.',
801+
});
802+
}
803+
});
804+
790805
test('parse test request invalid request', () => {
791806
const resource = getResource();
792807
const parseTestRequest = () => {

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "@tsconfig/node12/tsconfig.json",
2+
"extends": "@tsconfig/node14/tsconfig.json",
33
"compilerOptions": {
44
"strict": true,
55
"noImplicitAny": false,

0 commit comments

Comments
 (0)