This is a Typescript Library to check the type AppsyncIdentity before use. It
checks whether an AppsyncIdentity
from
aws-lambda
types defined at
DefinitelyTyped.
It uses custom type guards, so that Typescript is able to do type narrowing within the control flow. This custom guards are also available in production, as Javascript projects, meaning the checks work at both development and runtime.
if (isIAMAppsyncIdentity(identity)) {
// do something with IAM Identity
}
if (isCognitoAppsyncIdentity(identity)) {
// do something with Cognito Identity
}
if (isAppSyncIdentityOIDC(identity)) {
// do something with OIDC Identity
}
if (isAppSyncIdentityLambda(identity)) {
// do something with Lambda Authorization
}