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 { OHLCV } from 'ccxt'; | |
| import { getInsertRecordParameterToTimeStream, writeBatchToTimestream } from './write'; | |
| import { SymbolAndCandles } from '../lambda/candle-fetcher/models'; | |
| import { | |
| _Record, | |
| Dimension, | |
| MeasureValue, | |
| MeasureValueType, TimestreamWriteClient, | |
| WriteRecordsCommand, WriteRecordsCommandOutput, | |
| WriteRecordsRequest, |
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 { | |
| _Record, | |
| Dimension, | |
| MeasureValue, | |
| MeasureValueType, TimestreamWriteClient, | |
| WriteRecordsCommand, WriteRecordsCommandOutput, | |
| WriteRecordsRequest, | |
| } from '@aws-sdk/client-timestream-write'; | |
| export const getInsertRecordParameterToTimeStream = ( |
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 { RemovalPolicy } from 'aws-cdk-lib'; | |
| import { CfnDatabase, CfnTable } from 'aws-cdk-lib/aws-timestream'; | |
| import { Construct } from 'constructs'; | |
| export interface TimeStreamConstructProps { | |
| databaseName: string; | |
| tableName: string; | |
| } | |
| export class TimeStreamConstruct extends Construct { |
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 const handler = async (event:any) => { | |
| // Get Authorization Header | |
| const jwtToken = getSafeOrThrow(event.headers.Authorization,'Missing authorizer on private API'); | |
| // Retrieve the email from Stytch User Pool | |
| const email = await fromJwtTokenToUserEmail(jwtToken); | |
| // Get user from the database | |
| const user = await getUserFromDatabase(email); |
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 const getStytchLoginLambdaIntegration = ( | |
| stack: Construct, | |
| id:string, | |
| options:InfrastructureOptions) => { | |
| const loginFunction = new NodejsFunction(stack, id, { | |
| architecture: Architecture.ARM_64, | |
| entry: `${__dirname}/login.ts`, | |
| logRetention: RetentionDays.ONE_WEEK, | |
| timeout: Duration.minutes(1), |
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 const getStytchTokenFromSessionIdLambdaIntegration = ( | |
| stack: Construct, | |
| id:string, | |
| options:InfrastructureOptions) => { | |
| const getToken = new NodejsFunction(stack, id, { | |
| architecture: Architecture.ARM_64, | |
| entry: `${__dirname}/token.ts`, | |
| logRetention: RetentionDays.ONE_WEEK, | |
| timeout: Duration.minutes(1), |
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 const getStytchRegisterLambdaIntegration = ( | |
| stack: Construct, | |
| id:string, | |
| options:InfrastructureOptions) => { | |
| const registerFunction = new NodejsFunction(stack, id, { | |
| architecture: Architecture.ARM_64, | |
| entry: `${__dirname}/register.ts`, | |
| logRetention: RetentionDays.ONE_WEEK, | |
| timeout: Duration.minutes(1), |
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
| <div #magic_stytch_login> | |
| </div> |
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 const getStytchAuthorizerIntegrationLambda = ( | |
| stack: Construct, | |
| id:string, | |
| options:InfrastructureOptions) => { | |
| const authorizerFn = new NodejsFunction(stack, id, { | |
| entry: `${__dirname}/check_stytch_authorizer.ts`, | |
| architecture: Architecture.ARM_64, | |
| environment:{ | |
| } | |
| }); |
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 {NodejsFunction} from "aws-cdk-lib/aws-lambda-nodejs"; | |
| import {HttpMethod} from "aws-cdk-lib/aws-events"; | |
| export interface ApiRestEndpoint { | |
| description: string, | |
| id: string, | |
| fun: NodejsFunction, | |
| https_methods: Array<HttpMethod>, | |
| path: string | |
| } |