hono 3.7.2 → 3.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,13 @@ var getRequestContext = (event) => {
6
6
  return event.requestContext;
7
7
  };
8
8
  var handle = (app) => {
9
- return async (event) => {
9
+ return async (event, lambdaContext) => {
10
10
  const req = createRequest(event);
11
11
  const requestContext = getRequestContext(event);
12
- const res = await app.fetch(req, { requestContext });
12
+ const res = await app.fetch(req, {
13
+ requestContext,
14
+ lambdaContext
15
+ });
13
16
  return createResult(res);
14
17
  };
15
18
  };
File without changes
@@ -36,10 +36,13 @@ const getRequestContext = (event) => {
36
36
  return event.requestContext;
37
37
  };
38
38
  const handle = (app) => {
39
- return async (event) => {
39
+ return async (event, lambdaContext) => {
40
40
  const req = createRequest(event);
41
41
  const requestContext = getRequestContext(event);
42
- const res = await app.fetch(req, { requestContext });
42
+ const res = await app.fetch(req, {
43
+ requestContext,
44
+ lambdaContext
45
+ });
43
46
  return createResult(res);
44
47
  };
45
48
  };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -1,6 +1,7 @@
1
1
  import type { Hono } from '../../hono';
2
2
  import type { Env, Schema } from '../../types';
3
3
  import type { ApiGatewayRequestContext, LambdaFunctionUrlRequestContext } from './custom-context';
4
+ import type { LambdaContext } from './types';
4
5
  interface APIGatewayProxyEventV2 {
5
6
  httpMethod: string;
6
7
  headers: Record<string, string | undefined>;
@@ -36,7 +37,7 @@ interface APIGatewayProxyResult {
36
37
  /**
37
38
  * Accepts events from API Gateway/ELB(`APIGatewayProxyEvent`) and directly through Function Url(`APIGatewayProxyEventV2`)
38
39
  */
39
- export declare const handle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => (event: APIGatewayProxyEvent | APIGatewayProxyEventV2 | LambdaFunctionUrlEvent) => Promise<APIGatewayProxyResult>;
40
+ export declare const handle: <E extends Env = Env, S extends Schema = {}, BasePath extends string = "/">(app: Hono<E, S, BasePath>) => (event: APIGatewayProxyEvent | APIGatewayProxyEventV2 | LambdaFunctionUrlEvent, lambdaContext?: LambdaContext) => Promise<APIGatewayProxyResult>;
40
41
  export declare const isContentTypeBinary: (contentType: string) => boolean;
41
42
  export declare const isContentEncodingBinary: (contentEncoding: string | null) => boolean;
42
43
  export {};
@@ -1,2 +1,3 @@
1
1
  export { handle } from './handler';
2
2
  export type { ApiGatewayRequestContext, LambdaFunctionUrlRequestContext } from './custom-context';
3
+ export type { LambdaContext } from './types';
@@ -0,0 +1,40 @@
1
+ export interface CognitoIdentity {
2
+ cognitoIdentityId: string;
3
+ cognitoIdentityPoolId: string;
4
+ }
5
+ export interface ClientContext {
6
+ client: ClientContextClient;
7
+ Custom?: any;
8
+ env: ClientContextEnv;
9
+ }
10
+ export interface ClientContextClient {
11
+ installationId: string;
12
+ appTitle: string;
13
+ appVersionName: string;
14
+ appVersionCode: string;
15
+ appPackageName: string;
16
+ }
17
+ export interface ClientContextEnv {
18
+ platformVersion: string;
19
+ platform: string;
20
+ make: string;
21
+ model: string;
22
+ locale: string;
23
+ }
24
+ /**
25
+ * {@link Handler} context parameter.
26
+ * See {@link https://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html AWS documentation}.
27
+ */
28
+ export interface LambdaContext {
29
+ callbackWaitsForEmptyEventLoop: boolean;
30
+ functionName: string;
31
+ functionVersion: string;
32
+ invokedFunctionArn: string;
33
+ memoryLimitInMB: string;
34
+ awsRequestId: string;
35
+ logGroupName: string;
36
+ logStreamName: string;
37
+ identity?: CognitoIdentity | undefined;
38
+ clientContext?: ClientContext | undefined;
39
+ getRemainingTimeInMillis(): number;
40
+ }
@@ -128,7 +128,7 @@ export declare type ValidationTargets = {
128
128
  header: Record<string, string>;
129
129
  cookie: Record<string, string>;
130
130
  };
131
- declare type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer _Pattern}` ? Name : NameWithPattern;
131
+ declare type ParamKeyName<NameWithPattern> = NameWithPattern extends `${infer Name}{${infer Rest}` ? Rest extends `${infer _Pattern}?` ? `${Name}?` : Name : NameWithPattern;
132
132
  declare type ParamKey<Component> = Component extends `:${infer NameWithPattern}` ? ParamKeyName<NameWithPattern> : never;
133
133
  export declare type ParamKeys<Path> = Path extends `${infer Component}/${infer Rest}` ? ParamKey<Component> | ParamKeys<Rest> : ParamKey<Path>;
134
134
  export declare type ParamKeyToRecord<T extends string> = T extends `${infer R}?` ? Record<R, string | undefined> : {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "3.7.2",
3
+ "version": "3.7.3",
4
4
  "description": "Ultrafast web framework for the Edges",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",