Skip to content

Commit 27a6470

Browse files
authored
refactor(event-handler): mark identity field as unknown in event (aws-powertools#3922)
1 parent 6fef7bc commit 27a6470

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/event-handler/src/types/appsync-events.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,19 @@ type RouteOptions<T extends boolean | undefined = false> = {
161161

162162
// #region Events
163163

164+
/**
165+
* Event type for AppSync Events.
166+
*
167+
* For strongly typed validation and parsing at runtime, check out the `@aws-lambda-powertools/parser` package.
168+
*/
164169
type AppSyncEventsEvent = {
165-
identity: null;
170+
/**
171+
* The `identity` field is marked as `unknown` because it varies based on the authentication type used in AppSync.
172+
* When using an API key, it will be `null`. When using IAM, it will contain the AWS credentials of the user. When using Cognito,
173+
* it will contain the Cognito user pool information. When using a Lambda authorizer, it will contain the information returned
174+
* by the authorizer.
175+
*/
176+
identity: unknown;
166177
result: null;
167178
request: {
168179
headers: Record<string, string>;
@@ -228,6 +239,9 @@ type AppSyncEventsEvent = {
228239
* }
229240
* ]
230241
* }
242+
*
243+
* For strongly typed validation and parsing at runtime, check out the `@aws-lambda-powertools/parser` package.
244+
*
231245
* ```
232246
*/
233247
type AppSyncEventsPublishEvent = AppSyncEventsEvent & {
@@ -271,6 +285,8 @@ type AppSyncEventsPublishEvent = AppSyncEventsEvent & {
271285
* "events": null
272286
* }
273287
* ```
288+
*
289+
* For strongly typed validation and parsing at runtime, check out the `@aws-lambda-powertools/parser` package.
274290
*/
275291
type AppSyncEventsSubscribeEvent = AppSyncEventsEvent & {
276292
info: {

0 commit comments

Comments
 (0)