This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fetch from 'node-fetch'; | |
| const { | |
| BASE_URL, | |
| AUDIENCE, | |
| AUTH0_CLIENT_ID, | |
| AUTH0_CLIENT_SECRET, | |
| TOKEN_ISSUER | |
| } = process.env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| jwtAuth: { | |
| handler: 'handler.jwtAuth', | |
| }, | |
| createList: { | |
| handler: 'handler.createList', | |
| events: [ | |
| { | |
| http: { | |
| method: 'POST', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| APIGatewayAuthorizerEvent, | |
| Context, | |
| Callback | |
| } from 'aws-lambda'; | |
| import AuthService from "../../services/auth.service"; | |
| export const jwtAuth = async (event: APIGatewayAuthorizerEvent, _context: Context, callback: Callback) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jwt, { VerifyOptions, JwtHeader } from 'jsonwebtoken'; | |
| import jwks from 'jwks-rsa'; | |
| import { APIGatewayAuthorizerEvent, PolicyDocument } from 'aws-lambda'; | |
| interface IPayload { | |
| iss: string; | |
| sub: string; | |
| aud: string; | |
| iat: number; | |
| exp: number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "compilerOptions": { | |
| "lib": ["es2017"], | |
| "removeComments": true, | |
| "moduleResolution": "node", | |
| "noUnusedLocals": true, | |
| "noUnusedParameters": true, | |
| "sourceMap": true, | |
| "target": "es2017", | |
| "outDir": "./dist", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as chai from 'chai'; | |
| import handler from '../../../lib/actions/handler'; | |
| const expect = chai.expect; | |
| const requestData = { | |
| name: 12344567 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as chai from 'chai'; | |
| import handler from '../../../lib/actions/handler'; | |
| type Response = { | |
| data: any; | |
| message: string; | |
| status: string; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fetch from 'node-fetch'; | |
| const BASE_URL = process.env.BASE_URL; | |
| const post = (data = {}, url = '') => { | |
| return new Promise((resolve, reject) => { | |
| return fetch(BASE_URL + url, { | |
| method: 'post', | |
| body: JSON.stringify(data), | |
| headers: { 'Content-Type': 'application/json' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as chai from 'chai'; | |
| import { validateAgainstConstraints, createChunks } from '../../../src/utils/util'; | |
| const expect = chai.expect; | |
| describe('Util Functions', () => { | |
| describe('validateAgainstConstraints function', () => { | |
| const mockData = { |
NewerOlder