aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

(custom-resources): provider-framework export request/response types for OnEventHandler and IsComplete Handler

Open pflorek opened this issue 3 years ago • 4 comments

Describe the feature

While leveraging the powerful provider-framework one needs the proper Event and Response types.

The single point of truth is here: https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/custom-resources/lib/provider-framework/types.d.ts#L53

Often People try to use import { CloudFormationCustomResourceEvent, CloudFormationCustomResourceDeleteEvent, CloudFormationCustomResourceUpdateEvent, CloudFormationCustomResourceCreateEvent } from "aws-lambda"; (which leads to a different understanding) or https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/aws-lambda/trigger/cdk-custom-resource.d.ts (which are outdated and have other names)

How can we export them as a lighweight package from aws-cdk-lib to import in a Lambda?

Use Case

I'm always frustrated when looking for the correct and up-to-date typings for a lambda handler

Proposed Solution

Publish the OnEvent and IsComplete Handler types as a package from sources

Other Information

Using the CFN CustomResource types lead to a different of the provider-framework

Acknowledgements

  • [X] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

CDK version used

2.48.0

Environment details (OS name and version, etc.)

MacOS

pflorek avatar Oct 29 '22 14:10 pflorek

@pflorek I'm doing

import type { OnEventRequest, OnEventResponse } from 'aws-cdk-lib/custom-resources/lib/provider-framework/types';

jogold avatar Nov 03 '22 13:11 jogold

I think a new package @aws-cdk/custom-resources-types would be most idiomatic.

rix0rrr avatar Nov 09 '22 12:11 rix0rrr

Any progress on this?

henrykie avatar Oct 07 '23 05:10 henrykie

I am also curious if there is any plan for this one?

mustafababil avatar Oct 17 '24 13:10 mustafababil