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
Provenance
- Commit
ec3648d- Tree
68829cc- Author
TATSUNO “Taz” Yasuhiro <ytatsuno.jp@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
786f9e2
5 files changed+97 added−95 removed
modified:runtime_tests/lambda/index.test.ts+4 added-4 removed
1 import { Readable } from 'stream'2+import { handle, streamHandle } from '../../src/adapter/aws-lambda/handler'3+import type { LambdaEvent } from '../../src/adapter/aws-lambda/handler'4 import type {5 ApiGatewayRequestContext,6 ApiGatewayRequestContextV2,5-} from '../../src/adapter/aws-lambda/custom-context'6-import { handle, streamHandle } from '../../src/adapter/aws-lambda/handler'7-import type { LambdaEvent } from '../../src/adapter/aws-lambda/handler'8-import type { LambdaContext } from '../../src/adapter/aws-lambda/types'7+ LambdaContext,8+} from '../../src/adapter/aws-lambda/types'9 import { getCookie, setCookie } from '../../src/helper/cookie'10 import { streamSSE } from '../../src/helper/streaming'11 import { Hono } from '../../src/hono'12 import { basicAuth } from '../../src/middleware/basic-auth'957 unmodified linesdeleted:src/adapter/aws-lambda/custom-context.ts-87 removed
1-interface ClientCert {2- clientCertPem: string3- subjectDN: string4- issuerDN: string5- serialNumber: string6- validity: {7- notBefore: string8- notAfter: string9- }10-}11-12-interface 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-}27-28-export 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-}49-50-interface Authorizer {51- iam?: {52- accessKey: string53- accountId: string54- callerId: string55- cognitoIdentity: null56- principalOrgId: null57- userArn: string58- userId: string59- }60-}61-62-export 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-}82-83-export interface ALBRequestContext {84- elb: {85- targetGroupArn: string86- }87-}modified:src/adapter/aws-lambda/handler.ts+3 added-2 removed
4 unmodified lines5 import type {6 ALBRequestContext,7 ApiGatewayRequestContext,8 ApiGatewayRequestContextV2,9-} from './custom-context'10-import type { Handler, LambdaContext } from './types'9+ Handler,10+ LambdaContext,11+} from './types'12 13 // eslint-disable-next-line @typescript-eslint/ban-ts-comment14 // @ts-ignore15 globalThis.crypto ??= crypto461 unmodified linesmodified:src/adapter/aws-lambda/index.ts+2 added-2 removed
7 unmodified lines891011121312137 unmodified linesexport type { ApiGatewayRequestContext, ApiGatewayRequestContextV2, ALBRequestContext,} from './custom-context'export type { LambdaContext } from './types' LambdaContext,} from './types'modified:src/adapter/aws-lambda/types.ts+88 added
52 unmodified lines535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314452 unmodified lines event: TEvent, context: LambdaContext, callback: Callback<TResult>) => void | Promise<TResult>
interface ClientCert { clientCertPem: string subjectDN: string issuerDN: string serialNumber: string validity: { notBefore: string notAfter: string }}
interface Identity { accessKey?: string accountId?: string caller?: string cognitoAuthenticationProvider?: string cognitoAuthenticationType?: string cognitoIdentityId?: string cognitoIdentityPoolId?: string principalOrgId?: string sourceIp: string user?: string userAgent: string userArn?: string clientCert?: ClientCert}
export interface ApiGatewayRequestContext { accountId: string apiId: string authorizer: { claims?: unknown scopes?: unknown } domainName: string domainPrefix: string extendedRequestId: string httpMethod: string identity: Identity path: string protocol: string requestId: string requestTime: string requestTimeEpoch: number resourceId?: string resourcePath: string stage: string}
interface Authorizer { iam?: { accessKey: string accountId: string callerId: string cognitoIdentity: null principalOrgId: null userArn: string userId: string }}
export interface ApiGatewayRequestContextV2 { accountId: string apiId: string authentication: null authorizer: Authorizer domainName: string domainPrefix: string http: { method: string path: string protocol: string sourceIp: string userAgent: string } requestId: string routeKey: string stage: string time: string timeEpoch: number}
export interface ALBRequestContext { elb: { targetGroupArn: string }}