import { ALBEvent , ALBResult , Context } from "aws-lambda" ; import { PKPass } from "passkit-generator" ; import { throwClientErrorWithoutModelName , createPassGenerator , } from "../shared" ; /**
 * Lambda for expirationDate example
 */ export async function expirationDate ( event , context ) { try { throwClientErrorWithoutModelName ( event ) ; } catch ( err ) { return err ; } const { modelName , ... passOptions } = event . queryStringParameters ; const passGenerator = createPassGenerator ( modelName , passOptions ) ; const pass = ( await passGenerator . next ( ) ) . value as PKPass ; const d = new Date ( ) ; d . setMinutes ( d . getMinutes ( ) + 2 ) ; ( pass as PKPass ) . setExpirationDate ( d ) ; console . log ( "EXPIRATION DATE EXPECTED:" , ( pass as PKPass ) . props [ "expirationDate" ] ) ; return ( await passGenerator . next ( pass as PKPass ) ) . value as ALBResult ; }