Skip to content

refactor(event-handler): mark identity field as unknown in event #3922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion packages/event-handler/src/types/appsync-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,19 @@ type RouteOptions<T extends boolean | undefined = false> = {

// #region Events

/**
* Event type for AppSync Events.
*
* For strongly typed validation and parsing at runtime, check out the `@aws-lambda-powertools/parser` package.
*/
type AppSyncEventsEvent = {
identity: null;
/**
* The `identity` field is marked as `unknown` because it varies based on the authentication type used in AppSync.
* When using an API key, it will be `null`. When using IAM, it will contain the AWS credentials of the user. When using Cognito,
* it will contain the Cognito user pool information. When using a Lambda authorizer, it will contain the information returned
* by the authorizer.
*/
identity: unknown;
result: null;
request: {
headers: Record<string, string>;
Expand Down Expand Up @@ -228,6 +239,9 @@ type AppSyncEventsEvent = {
* }
* ]
* }
*
* For strongly typed validation and parsing at runtime, check out the `@aws-lambda-powertools/parser` package.
*
* ```
*/
type AppSyncEventsPublishEvent = AppSyncEventsEvent & {
Expand Down Expand Up @@ -271,6 +285,8 @@ type AppSyncEventsPublishEvent = AppSyncEventsEvent & {
* "events": null
* }
* ```
*
* For strongly typed validation and parsing at runtime, check out the `@aws-lambda-powertools/parser` package.
*/
type AppSyncEventsSubscribeEvent = AppSyncEventsEvent & {
info: {
Expand Down