Skip to content
Myr

refactor(aws-lambda): merge custom-context into types (#2889)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* refactor(aws-lambda): merge custom-context into types so they are excluded from coverage * refactor: custom-context.ts is not needed since it is hidden by reexport

authored by TATSUNO “Taz” Yasuhiro · committed by GitHub · parent 786f9e2 · Browse files · 5 files+97 added−95 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+97 added−95 removed

  • tests:+4 added−4 removed
  • other:+93 added−91 removed

5 files+97 added−95 removed

modified:runtime_tests/lambda/index.test.ts+4 added-4 removed
1import { Readable } from 'stream'2import { handle, streamHandle } from '../../src/adapter/aws-lambda/handler'3import type { LambdaEvent } from '../../src/adapter/aws-lambda/handler'4import type {5 ApiGatewayRequestContext,6 ApiGatewayRequestContextV2,5} from '../../src/adapter/aws-lambda/custom-context'6import { handle, streamHandle } from '../../src/adapter/aws-lambda/handler'7import type { LambdaEvent } from '../../src/adapter/aws-lambda/handler'8import type { LambdaContext } from '../../src/adapter/aws-lambda/types'7 LambdaContext,8} from '../../src/adapter/aws-lambda/types'9import { getCookie, setCookie } from '../../src/helper/cookie'10import { streamSSE } from '../../src/helper/streaming'11import { Hono } from '../../src/hono'12import { basicAuth } from '../../src/middleware/basic-auth'
957 unmodified lines
deleted:src/adapter/aws-lambda/custom-context.ts-87 removed
1interface ClientCert {2 clientCertPem: string3 subjectDN: string4 issuerDN: string5 serialNumber: string6 validity: {7 notBefore: string8 notAfter: string9 }10}1112interface Identity {13 accessKey?: string14 accountId?: string15 caller?: string16 cognitoAuthenticationProvider?: string17 cognitoAuthenticationType?: string18 cognitoIdentityId?: string19 cognitoIdentityPoolId?: string20 principalOrgId?: string21 sourceIp: string22 user?: string23 userAgent: string24 userArn?: string25 clientCert?: ClientCert26}2728export interface ApiGatewayRequestContext {29 accountId: string30 apiId: string31 authorizer: {32 claims?: unknown33 scopes?: unknown34 }35 domainName: string36 domainPrefix: string37 extendedRequestId: string38 httpMethod: string39 identity: Identity40 path: string41 protocol: string42 requestId: string43 requestTime: string44 requestTimeEpoch: number45 resourceId?: string46 resourcePath: string47 stage: string48}4950interface Authorizer {51 iam?: {52 accessKey: string53 accountId: string54 callerId: string55 cognitoIdentity: null56 principalOrgId: null57 userArn: string58 userId: string59 }60}6162export interface ApiGatewayRequestContextV2 {63 accountId: string64 apiId: string65 authentication: null66 authorizer: Authorizer67 domainName: string68 domainPrefix: string69 http: {70 method: string71 path: string72 protocol: string73 sourceIp: string74 userAgent: string75 }76 requestId: string77 routeKey: string78 stage: string79 time: string80 timeEpoch: number81}8283export interface ALBRequestContext {84 elb: {85 targetGroupArn: string86 }87}
modified:src/adapter/aws-lambda/handler.ts+3 added-2 removed
4 unmodified lines
5import type {6 ALBRequestContext,7 ApiGatewayRequestContext,8 ApiGatewayRequestContextV2,9} from './custom-context'10import type { Handler, LambdaContext } from './types'9 Handler,10 LambdaContext,11} from './types'1213// eslint-disable-next-line @typescript-eslint/ban-ts-comment14// @ts-ignore15globalThis.crypto ??= crypto
461 unmodified lines
modified:src/adapter/aws-lambda/index.ts+2 added-2 removed
modified:src/adapter/aws-lambda/types.ts+88 added