@h4ad/serverless-adapter 4.0.0 → 4.0.1

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.
Files changed (199) hide show
  1. package/lib/adapter.contract-EQE3rlgO.d.ts +278 -0
  2. package/lib/adapter.contract-y5xSjOjo.d.cts +278 -0
  3. package/lib/adapters/apollo-server/index.cjs +4 -0
  4. package/lib/adapters/apollo-server/index.cjs.map +1 -0
  5. package/lib/adapters/apollo-server/index.d.cts +61 -0
  6. package/lib/adapters/apollo-server/index.d.ts +61 -0
  7. package/lib/adapters/apollo-server/index.mjs +2 -0
  8. package/lib/adapters/apollo-server/index.mjs.map +1 -0
  9. package/lib/adapters/aws/index.cjs +4 -0
  10. package/lib/adapters/aws/index.cjs.map +1 -0
  11. package/lib/adapters/aws/index.d.cts +910 -0
  12. package/lib/adapters/aws/index.d.ts +910 -0
  13. package/lib/adapters/aws/index.mjs +2 -0
  14. package/lib/adapters/aws/index.mjs.map +1 -0
  15. package/lib/adapters/azure/index.cjs +4 -0
  16. package/lib/adapters/azure/index.cjs.map +1 -0
  17. package/lib/adapters/azure/index.d.cts +86 -0
  18. package/lib/adapters/azure/index.d.ts +86 -0
  19. package/lib/adapters/azure/index.mjs +2 -0
  20. package/lib/adapters/azure/index.mjs.map +1 -0
  21. package/lib/adapters/digital-ocean/index.cjs +4 -0
  22. package/lib/adapters/digital-ocean/index.cjs.map +1 -0
  23. package/lib/adapters/digital-ocean/index.d.cts +126 -0
  24. package/lib/adapters/digital-ocean/index.d.ts +126 -0
  25. package/lib/adapters/digital-ocean/index.mjs +2 -0
  26. package/lib/adapters/digital-ocean/index.mjs.map +1 -0
  27. package/lib/adapters/dummy/index.cjs +4 -0
  28. package/lib/adapters/dummy/index.cjs.map +1 -0
  29. package/lib/adapters/dummy/index.d.cts +37 -0
  30. package/lib/adapters/dummy/index.d.ts +37 -0
  31. package/lib/adapters/dummy/index.mjs +2 -0
  32. package/lib/adapters/dummy/index.mjs.map +1 -0
  33. package/lib/adapters/huawei/index.cjs +4 -0
  34. package/lib/adapters/huawei/index.cjs.map +1 -0
  35. package/lib/adapters/huawei/index.d.cts +365 -0
  36. package/lib/adapters/huawei/index.d.ts +365 -0
  37. package/lib/adapters/huawei/index.mjs +2 -0
  38. package/lib/adapters/huawei/index.mjs.map +1 -0
  39. package/lib/base-handler-fYEk59Xq.d.ts +35 -0
  40. package/lib/base-handler-peEBoKtZ.d.cts +35 -0
  41. package/lib/chunk-22SSVZU5.mjs +1 -0
  42. package/lib/chunk-22SSVZU5.mjs.map +1 -0
  43. package/lib/chunk-HU5XBQCP.mjs +10 -0
  44. package/lib/chunk-HU5XBQCP.mjs.map +1 -0
  45. package/lib/chunk-NSO4L3EI.mjs +2 -0
  46. package/lib/chunk-NSO4L3EI.mjs.map +1 -0
  47. package/lib/chunk-OYOJMOFP.mjs +2 -0
  48. package/lib/chunk-OYOJMOFP.mjs.map +1 -0
  49. package/lib/chunk-Y6H576RS.mjs +2 -0
  50. package/lib/chunk-Y6H576RS.mjs.map +1 -0
  51. package/lib/constants-0cgQlFSV.d.cts +32 -0
  52. package/lib/constants-0cgQlFSV.d.ts +32 -0
  53. package/lib/framework.contract-YnJ-fl1w.d.cts +20 -0
  54. package/lib/framework.contract-YnJ-fl1w.d.ts +20 -0
  55. package/lib/frameworks/apollo-server/index.cjs +4 -0
  56. package/lib/frameworks/apollo-server/index.cjs.map +1 -0
  57. package/lib/frameworks/apollo-server/index.d.cts +72 -0
  58. package/lib/frameworks/apollo-server/index.d.ts +72 -0
  59. package/lib/frameworks/apollo-server/index.mjs +2 -0
  60. package/lib/frameworks/apollo-server/index.mjs.map +1 -0
  61. package/lib/frameworks/body-parser/index.cjs +4 -0
  62. package/lib/frameworks/body-parser/index.cjs.map +1 -0
  63. package/lib/frameworks/body-parser/index.d.cts +159 -0
  64. package/lib/frameworks/body-parser/index.d.ts +159 -0
  65. package/lib/frameworks/body-parser/index.mjs +2 -0
  66. package/lib/frameworks/body-parser/index.mjs.map +1 -0
  67. package/lib/frameworks/cors/index.cjs +5 -0
  68. package/lib/frameworks/cors/index.cjs.map +1 -0
  69. package/lib/frameworks/cors/index.d.cts +79 -0
  70. package/lib/frameworks/cors/index.d.ts +79 -0
  71. package/lib/frameworks/cors/index.mjs +3 -0
  72. package/lib/frameworks/cors/index.mjs.map +1 -0
  73. package/lib/frameworks/deepkit/index.cjs +4 -0
  74. package/lib/frameworks/deepkit/index.cjs.map +1 -0
  75. package/lib/frameworks/deepkit/index.d.cts +21 -0
  76. package/lib/frameworks/deepkit/index.d.ts +21 -0
  77. package/lib/frameworks/deepkit/index.mjs +2 -0
  78. package/lib/frameworks/deepkit/index.mjs.map +1 -0
  79. package/lib/frameworks/express/index.cjs +2 -0
  80. package/lib/frameworks/express/index.cjs.map +1 -0
  81. package/lib/frameworks/express/index.d.cts +18 -0
  82. package/lib/frameworks/express/index.d.ts +18 -0
  83. package/lib/frameworks/express/index.mjs +2 -0
  84. package/lib/frameworks/express/index.mjs.map +1 -0
  85. package/lib/frameworks/fastify/index.cjs +2 -0
  86. package/lib/frameworks/fastify/index.cjs.map +1 -0
  87. package/lib/frameworks/fastify/index.d.cts +18 -0
  88. package/lib/frameworks/fastify/index.d.ts +18 -0
  89. package/lib/frameworks/fastify/index.mjs +2 -0
  90. package/lib/frameworks/fastify/index.mjs.map +1 -0
  91. package/lib/frameworks/hapi/index.cjs +2 -0
  92. package/lib/frameworks/hapi/index.cjs.map +1 -0
  93. package/lib/frameworks/hapi/index.d.cts +18 -0
  94. package/lib/frameworks/hapi/index.d.ts +18 -0
  95. package/lib/frameworks/hapi/index.mjs +2 -0
  96. package/lib/frameworks/hapi/index.mjs.map +1 -0
  97. package/lib/frameworks/koa/index.cjs +2 -0
  98. package/lib/frameworks/koa/index.cjs.map +1 -0
  99. package/lib/frameworks/koa/index.d.cts +18 -0
  100. package/lib/frameworks/koa/index.d.ts +18 -0
  101. package/lib/frameworks/koa/index.mjs +2 -0
  102. package/lib/frameworks/koa/index.mjs.map +1 -0
  103. package/lib/frameworks/lazy/index.cjs +4 -0
  104. package/lib/frameworks/lazy/index.cjs.map +1 -0
  105. package/lib/frameworks/lazy/index.d.cts +57 -0
  106. package/lib/frameworks/lazy/index.d.ts +57 -0
  107. package/lib/frameworks/lazy/index.mjs +2 -0
  108. package/lib/frameworks/lazy/index.mjs.map +1 -0
  109. package/lib/frameworks/trpc/index.cjs +4 -0
  110. package/lib/frameworks/trpc/index.cjs.map +1 -0
  111. package/lib/frameworks/trpc/index.d.cts +154 -0
  112. package/lib/frameworks/trpc/index.d.ts +154 -0
  113. package/lib/frameworks/trpc/index.mjs +2 -0
  114. package/lib/frameworks/trpc/index.mjs.map +1 -0
  115. package/lib/handler.contract-8Cb7qLSi.d.ts +66 -0
  116. package/lib/handler.contract-TQk8iM8f.d.cts +66 -0
  117. package/lib/handlers/aws/index.cjs +10 -0
  118. package/lib/handlers/aws/index.cjs.map +1 -0
  119. package/lib/handlers/aws/index.d.cts +96 -0
  120. package/lib/handlers/aws/index.d.ts +96 -0
  121. package/lib/handlers/aws/index.mjs +2 -0
  122. package/lib/handlers/aws/index.mjs.map +1 -0
  123. package/lib/handlers/azure/index.cjs +4 -0
  124. package/lib/handlers/azure/index.cjs.map +1 -0
  125. package/lib/handlers/azure/index.d.cts +53 -0
  126. package/lib/handlers/azure/index.d.ts +53 -0
  127. package/lib/handlers/azure/index.mjs +2 -0
  128. package/lib/handlers/azure/index.mjs.map +1 -0
  129. package/lib/handlers/default/index.cjs +4 -0
  130. package/lib/handlers/default/index.cjs.map +1 -0
  131. package/lib/handlers/default/index.d.cts +95 -0
  132. package/lib/handlers/default/index.d.ts +95 -0
  133. package/lib/handlers/default/index.mjs +2 -0
  134. package/lib/handlers/default/index.mjs.map +1 -0
  135. package/lib/handlers/digital-ocean/index.cjs +4 -0
  136. package/lib/handlers/digital-ocean/index.cjs.map +1 -0
  137. package/lib/handlers/digital-ocean/index.d.cts +25 -0
  138. package/lib/handlers/digital-ocean/index.d.ts +25 -0
  139. package/lib/handlers/digital-ocean/index.mjs +2 -0
  140. package/lib/handlers/digital-ocean/index.mjs.map +1 -0
  141. package/lib/handlers/firebase/index.cjs +4 -0
  142. package/lib/handlers/firebase/index.cjs.map +1 -0
  143. package/lib/handlers/firebase/index.d.cts +59 -0
  144. package/lib/handlers/firebase/index.d.ts +59 -0
  145. package/lib/handlers/firebase/index.mjs +2 -0
  146. package/lib/handlers/firebase/index.mjs.map +1 -0
  147. package/lib/handlers/gcp/index.cjs +4 -0
  148. package/lib/handlers/gcp/index.cjs.map +1 -0
  149. package/lib/handlers/gcp/index.d.cts +33 -0
  150. package/lib/handlers/gcp/index.d.ts +33 -0
  151. package/lib/handlers/gcp/index.mjs +2 -0
  152. package/lib/handlers/gcp/index.mjs.map +1 -0
  153. package/lib/handlers/huawei/index.cjs +4 -0
  154. package/lib/handlers/huawei/index.cjs.map +1 -0
  155. package/lib/handlers/huawei/index.d.cts +62 -0
  156. package/lib/handlers/huawei/index.d.ts +62 -0
  157. package/lib/handlers/huawei/index.mjs +2 -0
  158. package/lib/handlers/huawei/index.mjs.map +1 -0
  159. package/lib/headers-K2qbcurv.d.cts +38 -0
  160. package/lib/headers-K2qbcurv.d.ts +38 -0
  161. package/lib/index.cjs +10 -0
  162. package/lib/index.cjs.map +1 -0
  163. package/lib/index.d.cts +439 -0
  164. package/lib/index.d.ts +439 -0
  165. package/lib/index.mjs +2 -0
  166. package/lib/index.mjs.map +1 -0
  167. package/lib/logger-9me5n48P.d.cts +65 -0
  168. package/lib/logger-9me5n48P.d.ts +65 -0
  169. package/lib/path-yBwCb8C1.d.cts +64 -0
  170. package/lib/path-yBwCb8C1.d.ts +64 -0
  171. package/lib/raw-request-B2vPjAfE.d.cts +32 -0
  172. package/lib/raw-request-b6AYnkxd.d.ts +32 -0
  173. package/lib/request-DNNIV9ub.d.cts +44 -0
  174. package/lib/request-sVa4pxmx.d.ts +44 -0
  175. package/lib/resolvers/aws-context/index.cjs +2 -0
  176. package/lib/resolvers/aws-context/index.cjs.map +1 -0
  177. package/lib/resolvers/aws-context/index.d.cts +25 -0
  178. package/lib/resolvers/aws-context/index.d.ts +25 -0
  179. package/lib/resolvers/aws-context/index.mjs +2 -0
  180. package/lib/resolvers/aws-context/index.mjs.map +1 -0
  181. package/lib/resolvers/callback/index.cjs +2 -0
  182. package/lib/resolvers/callback/index.cjs.map +1 -0
  183. package/lib/resolvers/callback/index.d.cts +29 -0
  184. package/lib/resolvers/callback/index.d.ts +29 -0
  185. package/lib/resolvers/callback/index.mjs +2 -0
  186. package/lib/resolvers/callback/index.mjs.map +1 -0
  187. package/lib/resolvers/dummy/index.cjs +2 -0
  188. package/lib/resolvers/dummy/index.cjs.map +1 -0
  189. package/lib/resolvers/dummy/index.d.cts +20 -0
  190. package/lib/resolvers/dummy/index.d.ts +20 -0
  191. package/lib/resolvers/dummy/index.mjs +2 -0
  192. package/lib/resolvers/dummy/index.mjs.map +1 -0
  193. package/lib/resolvers/promise/index.cjs +2 -0
  194. package/lib/resolvers/promise/index.cjs.map +1 -0
  195. package/lib/resolvers/promise/index.d.cts +20 -0
  196. package/lib/resolvers/promise/index.d.ts +20 -0
  197. package/lib/resolvers/promise/index.mjs +2 -0
  198. package/lib/resolvers/promise/index.mjs.map +1 -0
  199. package/package.json +1 -1
@@ -0,0 +1,910 @@
1
+ import { ALBEvent, Context, ALBResult, APIGatewayProxyResult, APIGatewayProxyEventV2, SQSBatchItemFailure, DynamoDBStreamEvent, EventBridgeEvent, CloudFrontRequest, S3Event, SNSEvent, SQSEvent } from 'aws-lambda';
2
+ import { A as AdapterContract, a as AdapterRequest, G as GetResponseAdapterProps, O as OnErrorProps } from '../../adapter.contract-EQE3rlgO.js';
3
+ import { S as StripBasePathFn, C as Concrete } from '../../path-yBwCb8C1.js';
4
+ import { APIGatewayProxyEvent, APIGatewayProxyStructuredResultV2 } from 'aws-lambda/trigger/api-gateway-proxy';
5
+ import { I as IEmptyResponse } from '../../constants-0cgQlFSV.js';
6
+ import { CloudFrontHeaders, CloudFrontEvent, CloudFrontResultResponse } from 'aws-lambda/common/cloudfront';
7
+ import { CloudFrontRequestEvent, CloudFrontRequestResult } from 'aws-lambda/trigger/cloudfront-request';
8
+ import { S as SingleValueHeaders, B as BothValueHeaders } from '../../headers-K2qbcurv.js';
9
+ import 'http';
10
+ import 'node:http';
11
+ import '../../logger-9me5n48P.js';
12
+
13
+ /**
14
+ * The options to customize the {@link AlbAdapter}
15
+ *
16
+ * @breadcrumb Adapters / AWS / AlbAdapter
17
+ * @public
18
+ */
19
+ interface AlbAdapterOptions {
20
+ /**
21
+ * Strip base path for custom domains
22
+ *
23
+ * @defaultValue ''
24
+ */
25
+ stripBasePath?: string;
26
+ }
27
+ /**
28
+ * The adapter to handle requests from AWS ALB
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const stripBasePath = '/any/custom/base/path'; // default ''
33
+ * const adapter = new AlbAdapter({ stripBasePath });
34
+ * ```
35
+ *
36
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/services-alb.html | Event Reference}
37
+ *
38
+ * @breadcrumb Adapters / AWS / AlbAdapter
39
+ * @public
40
+ */
41
+ declare class AlbAdapter implements AdapterContract<ALBEvent, Context, ALBResult> {
42
+ protected readonly options?: AlbAdapterOptions | undefined;
43
+ /**
44
+ * Default constructor
45
+ *
46
+ * @param options - The options to customize the {@link AlbAdapter}
47
+ */
48
+ constructor(options?: AlbAdapterOptions | undefined);
49
+ /**
50
+ * Strip base path function
51
+ */
52
+ protected stripPathFn: StripBasePathFn;
53
+ /**
54
+ * {@inheritDoc}
55
+ */
56
+ getAdapterName(): string;
57
+ /**
58
+ * {@inheritDoc}
59
+ */
60
+ canHandle(event: unknown): event is ALBEvent;
61
+ /**
62
+ * {@inheritDoc}
63
+ */
64
+ getRequest(event: ALBEvent): AdapterRequest;
65
+ /**
66
+ * {@inheritDoc}
67
+ */
68
+ getResponse({ event, headers: responseHeaders, body, isBase64Encoded, statusCode, }: GetResponseAdapterProps<ALBEvent>): ALBResult;
69
+ /**
70
+ * {@inheritDoc}
71
+ */
72
+ onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<ALBEvent, ALBResult>): void;
73
+ /**
74
+ * Get path from event with query strings
75
+ *
76
+ * @param event - The event sent by serverless
77
+ */
78
+ protected getPathFromEvent(event: ALBEvent): string;
79
+ }
80
+
81
+ /**
82
+ * The options to customize the {@link ApiGatewayV1Adapter}
83
+ *
84
+ * @breadcrumb Adapters / AWS / ApiGatewayV1Adapter
85
+ * @public
86
+ */
87
+ interface ApiGatewayV1Options {
88
+ /**
89
+ * Strip base path for custom domains
90
+ *
91
+ * @defaultValue ''
92
+ */
93
+ stripBasePath?: string;
94
+ }
95
+ /**
96
+ * The adapter to handle requests from AWS Api Gateway V1
97
+ *
98
+ * As per {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html | know issues}, we throw an exception when you send the `transfer-encoding=chunked`, currently, API Gateway doesn't support chunked transfer.
99
+ *
100
+ * @remarks This adapter is not fully compatible with \@vendia/serverless-express, on \@vendia they filter `transfer-encoding=chunked` but we throw an exception.
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * const stripBasePath = '/any/custom/base/path'; // default ''
105
+ * const adapter = new ApiGatewayV1Adapter({ stripBasePath });
106
+ * ```
107
+ *
108
+ * {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html | Event Reference}
109
+ *
110
+ * @breadcrumb Adapters / AWS / ApiGatewayV1Adapter
111
+ * @public
112
+ */
113
+ declare class ApiGatewayV1Adapter implements AdapterContract<APIGatewayProxyEvent, Context, APIGatewayProxyResult> {
114
+ protected readonly options?: ApiGatewayV1Options | undefined;
115
+ /**
116
+ * Default constructor
117
+ *
118
+ * @param options - The options to customize the {@link ApiGatewayV1Adapter}
119
+ */
120
+ constructor(options?: ApiGatewayV1Options | undefined);
121
+ /**
122
+ * Strip base path function
123
+ */
124
+ protected stripPathFn: StripBasePathFn;
125
+ /**
126
+ * {@inheritDoc}
127
+ */
128
+ getAdapterName(): string;
129
+ /**
130
+ * {@inheritDoc}
131
+ */
132
+ canHandle(event: unknown): event is APIGatewayProxyEvent;
133
+ /**
134
+ * {@inheritDoc}
135
+ */
136
+ getRequest(event: APIGatewayProxyEvent): AdapterRequest;
137
+ /**
138
+ * {@inheritDoc}
139
+ */
140
+ getResponse({ headers: responseHeaders, body, isBase64Encoded, statusCode, response, }: GetResponseAdapterProps<APIGatewayProxyEvent>): APIGatewayProxyResult;
141
+ /**
142
+ * {@inheritDoc}
143
+ */
144
+ onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<APIGatewayProxyEvent, APIGatewayProxyResult>): void;
145
+ /**
146
+ * Get path from event with query strings
147
+ *
148
+ * @param event - The event sent by serverless
149
+ */
150
+ protected getPathFromEvent(event: APIGatewayProxyEvent): string;
151
+ }
152
+
153
+ /**
154
+ * The options to customize the {@link ApiGatewayV2Adapter}
155
+ *
156
+ * @breadcrumb Adapters / AWS / ApiGatewayV2Adapter
157
+ * @public
158
+ */
159
+ interface ApiGatewayV2Options {
160
+ /**
161
+ * Strip base path for custom domains
162
+ *
163
+ * @defaultValue ''
164
+ */
165
+ stripBasePath?: string;
166
+ }
167
+ /**
168
+ * The adapter to handle requests from AWS Api Gateway V2
169
+ *
170
+ * As per {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html | know issues}, we throw an exception when you send the `transfer-encoding=chunked`.
171
+ * But, if you use this adapter to accept requests from Function URL, you can accept the `transfer-encoding=chunked` changing the method of invocation from `BUFFERED` to `RESPONSE_STREAM`.
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const stripBasePath = '/any/custom/base/path'; // default ''
176
+ * const adapter = new ApiGatewayV2Adapter({ stripBasePath });
177
+ * ```
178
+ *
179
+ * {@link https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html | Event Reference}
180
+ *
181
+ * @breadcrumb Adapters / AWS / ApiGatewayV2Adapter
182
+ * @public
183
+ */
184
+ declare class ApiGatewayV2Adapter implements AdapterContract<APIGatewayProxyEventV2, Context, APIGatewayProxyStructuredResultV2> {
185
+ protected readonly options?: ApiGatewayV2Options | undefined;
186
+ /**
187
+ * Default constructor
188
+ *
189
+ * @param options - The options to customize the {@link ApiGatewayV2Adapter}
190
+ */
191
+ constructor(options?: ApiGatewayV2Options | undefined);
192
+ /**
193
+ * Strip base path function
194
+ */
195
+ protected stripPathFn: StripBasePathFn;
196
+ /**
197
+ * {@inheritDoc}
198
+ */
199
+ getAdapterName(): string;
200
+ /**
201
+ * {@inheritDoc}
202
+ */
203
+ canHandle(event: unknown): event is APIGatewayProxyEventV2;
204
+ /**
205
+ * {@inheritDoc}
206
+ */
207
+ getRequest(event: APIGatewayProxyEventV2): AdapterRequest;
208
+ /**
209
+ * {@inheritDoc}
210
+ */
211
+ getResponse({ headers: responseHeaders, body, isBase64Encoded, statusCode, response, }: GetResponseAdapterProps<APIGatewayProxyEventV2>): APIGatewayProxyStructuredResultV2;
212
+ /**
213
+ * {@inheritDoc}
214
+ */
215
+ onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, event, log, }: OnErrorProps<APIGatewayProxyEventV2, APIGatewayProxyStructuredResultV2>): void;
216
+ /**
217
+ * Get path from event with query strings
218
+ *
219
+ * @param event - The event sent by serverless
220
+ */
221
+ protected getPathFromEvent(event: APIGatewayProxyEventV2): string;
222
+ }
223
+
224
+ /**
225
+ * The options to customize the {@link AwsSimpleAdapter}
226
+ *
227
+ * @breadcrumb Adapters / AWS / AWS Simple Adapter
228
+ * @public
229
+ */
230
+ interface AWSSimpleAdapterOptions {
231
+ /**
232
+ * The path that will be used to create a request to be forwarded to the framework.
233
+ */
234
+ forwardPath: string;
235
+ /**
236
+ * The http method that will be used to create a request to be forwarded to the framework.
237
+ */
238
+ forwardMethod: string;
239
+ /**
240
+ * The AWS Service host that will be injected inside headers to developer being able to validate if request originate from the library.
241
+ */
242
+ host: string;
243
+ /**
244
+ * Tells if this adapter should support batch item failures.
245
+ */
246
+ batch?: true | false;
247
+ }
248
+ /**
249
+ * The batch item failure response expected from the API server
250
+ *
251
+ * @breadcrumb Adapters / AWS / AWS Simple Adapter
252
+ * @public
253
+ */
254
+ type BatchItemFailureResponse = SQSBatchItemFailure;
255
+ /**
256
+ * The possible options of response for {@link AwsSimpleAdapter}
257
+ *
258
+ * @breadcrumb Adapters / AWS / AWS Simple Adapter
259
+ * @public
260
+ */
261
+ type AWSSimpleAdapterResponseType = BatchItemFailureResponse | IEmptyResponse;
262
+ /**
263
+ * The abstract adapter to use to implement other simple AWS adapters
264
+ *
265
+ * @breadcrumb Adapters / AWS / AWS Simple Adapter
266
+ * @public
267
+ */
268
+ declare abstract class AwsSimpleAdapter<TEvent> implements AdapterContract<TEvent, Context, AWSSimpleAdapterResponseType> {
269
+ protected readonly options: AWSSimpleAdapterOptions;
270
+ /**
271
+ * Default constructor
272
+ *
273
+ * @param options - The options to customize the {@link AwsSimpleAdapter}
274
+ */
275
+ constructor(options: AWSSimpleAdapterOptions);
276
+ /**
277
+ * {@inheritDoc}
278
+ */
279
+ getAdapterName(): string;
280
+ /**
281
+ * {@inheritDoc}
282
+ */
283
+ canHandle(_: unknown): _ is TEvent;
284
+ /**
285
+ * {@inheritDoc}
286
+ */
287
+ getRequest(event: TEvent): AdapterRequest;
288
+ /**
289
+ * {@inheritDoc}
290
+ */
291
+ getResponse({ body, headers, isBase64Encoded, event, statusCode, }: GetResponseAdapterProps<TEvent>): AWSSimpleAdapterResponseType;
292
+ /**
293
+ * {@inheritDoc}
294
+ */
295
+ onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<TEvent, AWSSimpleAdapterResponseType>): void;
296
+ /**
297
+ * Check if the status code is invalid
298
+ *
299
+ * @param statusCode - The status code
300
+ */
301
+ protected hasInvalidStatusCode(statusCode: number): boolean;
302
+ }
303
+
304
+ /**
305
+ * The options to customize the {@link DynamoDBAdapter}
306
+ *
307
+ * @breadcrumb Adapters / AWS / DynamoDBAdapter
308
+ * @public
309
+ */
310
+ interface DynamoDBAdapterOptions extends Pick<AWSSimpleAdapterOptions, 'batch'> {
311
+ /**
312
+ * The path that will be used to create a request to be forwarded to the framework.
313
+ *
314
+ * @defaultValue /dynamo
315
+ */
316
+ dynamoDBForwardPath?: string;
317
+ /**
318
+ * The http method that will be used to create a request to be forwarded to the framework.
319
+ *
320
+ * @defaultValue POST
321
+ */
322
+ dynamoDBForwardMethod?: string;
323
+ }
324
+ /**
325
+ * The adapter to handle requests from AWS DynamoDB.
326
+ *
327
+ * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
328
+ *
329
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html | Event Reference}
330
+ *
331
+ * @example
332
+ * ```typescript
333
+ * const dynamoDBForwardPath = '/your/route/dynamo'; // default /dynamo
334
+ * const dynamoDBForwardMethod = 'POST'; // default POST
335
+ * const adapter = new DynamoDBAdapter({ dynamoDBForwardPath, dynamoDBForwardMethod });
336
+ * ```
337
+ *
338
+ * @breadcrumb Adapters / AWS / DynamoDBAdapter
339
+ * @public
340
+ */
341
+ declare class DynamoDBAdapter extends AwsSimpleAdapter<DynamoDBStreamEvent> {
342
+ /**
343
+ * Default constructor
344
+ *
345
+ * @param options - The options to customize the {@link DynamoDBAdapter}
346
+ */
347
+ constructor(options?: DynamoDBAdapterOptions);
348
+ /**
349
+ * {@inheritDoc}
350
+ */
351
+ getAdapterName(): string;
352
+ /**
353
+ * {@inheritDoc}
354
+ */
355
+ canHandle(event: unknown): event is DynamoDBStreamEvent;
356
+ }
357
+
358
+ /**
359
+ * The options to customize the {@link EventBridgeAdapter}
360
+ *
361
+ * @breadcrumb Adapters / AWS / EventBridgeAdapter
362
+ * @public
363
+ */
364
+ interface EventBridgeOptions {
365
+ /**
366
+ * The path that will be used to create a request to be forwarded to the framework.
367
+ *
368
+ * @defaultValue /eventbridge
369
+ */
370
+ eventBridgeForwardPath?: string;
371
+ /**
372
+ * The http method that will be used to create a request to be forwarded to the framework.
373
+ *
374
+ * @defaultValue POST
375
+ */
376
+ eventBridgeForwardMethod?: string;
377
+ }
378
+ /**
379
+ * Just a type alias to ignore generic types in the event
380
+ *
381
+ * @breadcrumb Adapters / AWS / EventBridgeAdapter
382
+ * @public
383
+ */
384
+ type EventBridgeEventAll = EventBridgeEvent<any, any>;
385
+ /**
386
+ * The adapter to handle requests from AWS EventBridge (Cloudwatch Events).
387
+ *
388
+ * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
389
+ *
390
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/services-cloudwatchevents.html | Event Reference}
391
+ *
392
+ * @example
393
+ * ```typescript
394
+ * const eventBridgeForwardPath = '/your/route/eventbridge'; // default /eventbridge
395
+ * const eventBridgeForwardMethod = 'POST'; // default POST
396
+ * const adapter = new EventBridgeAdapter({ eventBridgeForwardPath, eventBridgeForwardMethod });
397
+ * ```
398
+ *
399
+ * @breadcrumb Adapters / AWS / EventBridgeAdapter
400
+ * @public
401
+ */
402
+ declare class EventBridgeAdapter extends AwsSimpleAdapter<EventBridgeEventAll> {
403
+ /**
404
+ * Default constructor
405
+ *
406
+ * @param options - The options to customize the {@link EventBridgeAdapter}
407
+ */
408
+ constructor(options?: EventBridgeOptions);
409
+ /**
410
+ * {@inheritDoc}
411
+ */
412
+ getAdapterName(): string;
413
+ /**
414
+ * {@inheritDoc}
415
+ */
416
+ canHandle(event: unknown): event is EventBridgeEventAll;
417
+ }
418
+
419
+ /**
420
+ * The type alias to indicate where we get the default value of query string to create the request.
421
+ *
422
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
423
+ * @public
424
+ */
425
+ type DefaultQueryString = CloudFrontRequestEvent['Records'][number]['cf']['request']['querystring'];
426
+ /**
427
+ * The type alias to indicate where we get the default value of path to create the request.
428
+ *
429
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
430
+ * @public
431
+ */
432
+ type DefaultForwardPath = CloudFrontRequestEvent['Records'][number]['cf']['request']['uri'];
433
+ /**
434
+ * Represents the body of the new version of Lambda\@edge, which uses the `body` property inside `request` as the body (library) of the request.
435
+ *
436
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
437
+ * @public
438
+ */
439
+ type NewLambdaEdgeBody = CloudFrontRequestEvent['Records'][number]['cf']['request']['body'];
440
+ /**
441
+ * Represents the body of the old version of Lambda\@edge supported by \@vendia/serverless-express which returns the `data` property within `body` for the body (library) of the request.
442
+ *
443
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
444
+ * @public
445
+ */
446
+ type OldLambdaEdgeBody = Concrete<CloudFrontRequestEvent['Records'][number]['cf']['request']>['body']['data'];
447
+ /**
448
+ * The list was created based on {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-restrictions.html | these docs} in the "Disallowed Headers" section.
449
+ *
450
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
451
+ * @public
452
+ */
453
+ declare const DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS: (string | RegExp)[];
454
+ /**
455
+ * The default max response size in bytes of viewer request and viewer response.
456
+ *
457
+ * @defaultValue 1024 * 40 = 40960 = 40KB
458
+ *
459
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
460
+ *
461
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
462
+ * @public
463
+ */
464
+ declare const DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES: number;
465
+ /**
466
+ * The default max response size in bytes of origin request and origin response.
467
+ *
468
+ * @defaultValue 1024 * 1024 = 1048576 = 1MB
469
+ *
470
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
471
+ *
472
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
473
+ * @public
474
+ */
475
+ declare const DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES: number;
476
+ /**
477
+ * The options to customize the {@link LambdaEdgeAdapter}.
478
+ *
479
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
480
+ * @public
481
+ */
482
+ interface LambdaEdgeAdapterOptions {
483
+ /**
484
+ * The max response size in bytes of viewer request and viewer response.
485
+ *
486
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
487
+ *
488
+ * @defaultValue {@link DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES}
489
+ */
490
+ viewerMaxResponseSizeInBytes?: number;
491
+ /**
492
+ * The max response size in bytes of origin request and origin response.
493
+ *
494
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
495
+ *
496
+ * @defaultValue {@link DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES}
497
+ */
498
+ originMaxResponseSizeInBytes?: number;
499
+ /**
500
+ * The function called when the response size exceed the max limits of the Lambda\@edge
501
+ *
502
+ * @param response - The response from framework that exceed the limit of Lambda\@edge
503
+ * @defaultValue undefined
504
+ */
505
+ onResponseSizeExceedLimit?: (response: CloudFrontRequestResult) => CloudFrontRequestResult;
506
+ /**
507
+ * Return the path to be used to create a request to the framework
508
+ *
509
+ * @remarks You MUST append the query params from {@link DefaultQueryString}, you can use the helper {@link getPathWithQueryStringParams}.
510
+ *
511
+ * @param event - The event sent by the serverless
512
+ * @defaultValue The value from {@link DefaultForwardPath}
513
+ */
514
+ getPathFromEvent?: (event: CloudFrontRequestEvent['Records'][number]) => string;
515
+ /**
516
+ * The headers that will be stripped from the headers object because Lambda\@edge will fail if these headers are passed in the response.
517
+ *
518
+ * @remarks All headers will be compared with other headers using toLowerCase, but for the RegExp, if you modify this list, you must put the flag `/gmi` at the end of the RegExp (ex: `/(X-Amz-Cf-)(.*)/gim`)
519
+ *
520
+ * @defaultValue To get the full list, see {@link DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS}.
521
+ */
522
+ disallowedHeaders?: (string | RegExp)[];
523
+ /**
524
+ * If you want to change how we check against the header if it should be stripped, you can pass a function to this property.
525
+ *
526
+ * @param header - The header of the response
527
+ * @defaultValue The default method is implemented to test the header against the list {@link LambdaEdgeAdapterOptions.disallowedHeaders}.
528
+ */
529
+ shouldStripHeader?: (header: string) => boolean;
530
+ /**
531
+ * By default, the {@link aws-lambda#CloudFrontRequestResult} has the `headers` property, but we also have the headers sent by the framework too.
532
+ * So this setting tells us how to handle this case, if you pass `true` to this property, we will use the framework headers.
533
+ * Otherwise, we will forward the body back to cloudfront without modifying or trying to set the `headers` property inside {@link aws-lambda#CloudFrontRequestResult}.
534
+ *
535
+ * @defaultValue false
536
+ */
537
+ shouldUseHeadersFromFramework?: boolean;
538
+ }
539
+ /**
540
+ * The adapter to handle requests from AWS Lambda\@Edge.
541
+ *
542
+ * This adapter is not fully compatible with Lambda\@edge supported by \@vendia/serverless-express, the request body was modified to return {@link NewLambdaEdgeBody} instead {@link OldLambdaEdgeBody}.
543
+ * Also, the response has been modified to return entire body sent by the framework, in this form you MUST return the body from the framework in the format of {@link aws-lambda#CloudFrontRequestResult}.
544
+ * And when we get an error during the forwarding to the framework, we call `resolver.fail` instead of trying to return status 500 like the old implementation was.
545
+ *
546
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html | Lambda edge docs}
547
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html | Event Reference}
548
+ *
549
+ * @example
550
+ * ```typescript
551
+ * const getPathFromEvent = () => '/lambda/edge'; // will forward all requests to the same endpoint
552
+ * const adapter = new LambdaEdgeAdapter({ getPathFromEvent });
553
+ * ```
554
+ *
555
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
556
+ * @public
557
+ */
558
+ declare class LambdaEdgeAdapter implements AdapterContract<CloudFrontRequestEvent, Context, CloudFrontRequestResult> {
559
+ protected readonly options?: LambdaEdgeAdapterOptions | undefined;
560
+ /**
561
+ * Default constructor
562
+ *
563
+ * @param options - The options to customize the {@link LambdaEdgeAdapter}
564
+ */
565
+ constructor(options?: LambdaEdgeAdapterOptions | undefined);
566
+ /**
567
+ * This property is used to cache the disallowed headers in `RegExp` version, even if you provide a string in `disallowedHeader`, we will cache it in an instance of `RegExp`.
568
+ */
569
+ protected readonly cachedDisallowedHeaders: RegExp[];
570
+ /**
571
+ * {@inheritDoc}
572
+ */
573
+ getAdapterName(): string;
574
+ /**
575
+ * {@inheritDoc}
576
+ */
577
+ canHandle(event: unknown): event is CloudFrontRequestEvent;
578
+ /**
579
+ * {@inheritDoc}
580
+ */
581
+ getRequest(event: CloudFrontRequestEvent): AdapterRequest;
582
+ /**
583
+ * {@inheritDoc}
584
+ */
585
+ getResponse(props: GetResponseAdapterProps<CloudFrontRequestEvent>): CloudFrontRequestResult;
586
+ /**
587
+ * {@inheritDoc}
588
+ */
589
+ onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<CloudFrontRequestEvent, CloudFrontRequestResult>): void;
590
+ /**
591
+ * Returns the headers with the flattened (non-list) values of the cloudfront request headers
592
+ *
593
+ * @param cloudFrontRequest - The cloudfront request
594
+ */
595
+ protected getFlattenedHeadersFromCloudfrontRequest(cloudFrontRequest: CloudFrontRequest): SingleValueHeaders;
596
+ /**
597
+ * Returns the framework response in the format required by the Lambda\@edge.
598
+ *
599
+ * @param body - The body of the response
600
+ * @param frameworkHeaders - The headers from the framework
601
+ */
602
+ protected getResponseToLambdaEdge({ body, headers: frameworkHeaders, }: GetResponseAdapterProps<CloudFrontRequestEvent>): CloudFrontRequestResult;
603
+ /**
604
+ * Returns headers in Cloudfront Response format.
605
+ *
606
+ * @param originalHeaders - The original version of the request sent by the framework
607
+ */
608
+ protected getHeadersForCloudfrontResponse(originalHeaders: BothValueHeaders): CloudFrontHeaders;
609
+ /**
610
+ * Returns the information if we should remove the response header
611
+ *
612
+ * @param headerKey - The header that will be tested
613
+ */
614
+ protected shouldStripHeader(headerKey: string): boolean;
615
+ /**
616
+ * Determines whether the event is from origin or is from viewer.
617
+ *
618
+ * @param content - The event sent by AWS or the response sent by the framework
619
+ */
620
+ protected isEventTypeOrigin(content: CloudFrontEvent['config']): boolean;
621
+ }
622
+
623
+ /**
624
+ * The options to customize the {@link S3Adapter}
625
+ *
626
+ * @breadcrumb Adapters / AWS / S3Adapter
627
+ * @public
628
+ */
629
+ interface S3AdapterOptions {
630
+ /**
631
+ * The path that will be used to create a request to be forwarded to the framework.
632
+ *
633
+ * @defaultValue /s3
634
+ */
635
+ s3ForwardPath?: string;
636
+ /**
637
+ * The http method that will be used to create a request to be forwarded to the framework.
638
+ *
639
+ * @defaultValue POST
640
+ */
641
+ s3ForwardMethod?: string;
642
+ }
643
+ /**
644
+ * The adapter to handle requests from AWS S3.
645
+ *
646
+ * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
647
+ *
648
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html | Event Reference}
649
+ *
650
+ * @example
651
+ * ```typescript
652
+ * const s3ForwardPath = '/your/route/s3'; // default /s3
653
+ * const s3ForwardMethod = 'POST'; // default POST
654
+ * const adapter = new S3Adapter({ s3ForwardPath, s3ForwardMethod });
655
+ * ```
656
+ *
657
+ * @breadcrumb Adapters / AWS / S3Adapter
658
+ * @public
659
+ */
660
+ declare class S3Adapter extends AwsSimpleAdapter<S3Event> {
661
+ /**
662
+ * Default constructor
663
+ *
664
+ * @param options - The options to customize the {@link SNSAdapter}
665
+ */
666
+ constructor(options?: S3AdapterOptions);
667
+ /**
668
+ * {@inheritDoc}
669
+ */
670
+ getAdapterName(): string;
671
+ /**
672
+ * {@inheritDoc}
673
+ */
674
+ canHandle(event: unknown): event is S3Event;
675
+ }
676
+
677
+ /**
678
+ * The options to customize the {@link SNSAdapter}
679
+ *
680
+ * @breadcrumb Adapters / AWS / SNSAdapter
681
+ * @public
682
+ */
683
+ interface SNSAdapterOptions {
684
+ /**
685
+ * The path that will be used to create a request to be forwarded to the framework.
686
+ *
687
+ * @defaultValue /sns
688
+ */
689
+ snsForwardPath?: string;
690
+ /**
691
+ * The http method that will be used to create a request to be forwarded to the framework.
692
+ *
693
+ * @defaultValue POST
694
+ */
695
+ snsForwardMethod?: string;
696
+ }
697
+ /**
698
+ * The adapter to handle requests from AWS SNS.
699
+ *
700
+ * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
701
+ *
702
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html | Event Reference}
703
+ *
704
+ * @example
705
+ * ```typescript
706
+ * const snsForwardPath = '/your/route/sns'; // default /sns
707
+ * const snsForwardMethod = 'POST'; // default POST
708
+ * const adapter = new SNSAdapter({ snsForwardPath, snsForwardMethod });
709
+ * ```
710
+ *
711
+ * @breadcrumb Adapters / AWS / SNSAdapter
712
+ * @public
713
+ */
714
+ declare class SNSAdapter extends AwsSimpleAdapter<SNSEvent> {
715
+ /**
716
+ * Default constructor
717
+ *
718
+ * @param options - The options to customize the {@link SNSAdapter}
719
+ */
720
+ constructor(options?: SNSAdapterOptions);
721
+ /**
722
+ * {@inheritDoc}
723
+ */
724
+ getAdapterName(): string;
725
+ /**
726
+ * {@inheritDoc}
727
+ */
728
+ canHandle(event: unknown): event is SNSEvent;
729
+ }
730
+
731
+ /**
732
+ * The options to customize the {@link SQSAdapter}
733
+ *
734
+ * @breadcrumb Adapters / AWS / SQSAdapter
735
+ * @public
736
+ */
737
+ interface SQSAdapterOptions extends Pick<AWSSimpleAdapterOptions, 'batch'> {
738
+ /**
739
+ * The path that will be used to create a request to be forwarded to the framework.
740
+ *
741
+ * @defaultValue /sqs
742
+ */
743
+ sqsForwardPath?: string;
744
+ /**
745
+ * The http method that will be used to create a request to be forwarded to the framework.
746
+ *
747
+ * @defaultValue POST
748
+ */
749
+ sqsForwardMethod?: string;
750
+ }
751
+ /**
752
+ * The adapter to handle requests from AWS SQS.
753
+ *
754
+ * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
755
+ *
756
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html | Event Reference}
757
+ *
758
+ * @example
759
+ * ```typescript
760
+ * const sqsForwardPath = '/your/route/sqs'; // default /sqs
761
+ * const sqsForwardMethod = 'POST'; // default POST
762
+ * const adapter = new SQSAdapter({ sqsForwardPath, sqsForwardMethod });
763
+ * ```
764
+ *
765
+ * @breadcrumb Adapters / AWS / SQSAdapter
766
+ * @public
767
+ */
768
+ declare class SQSAdapter extends AwsSimpleAdapter<SQSEvent> {
769
+ /**
770
+ * Default constructor
771
+ *
772
+ * @param options - The options to customize the {@link SNSAdapter}
773
+ */
774
+ constructor(options?: SQSAdapterOptions);
775
+ /**
776
+ * {@inheritDoc}
777
+ */
778
+ getAdapterName(): string;
779
+ /**
780
+ * {@inheritDoc}
781
+ */
782
+ canHandle(event: unknown): event is SQSEvent;
783
+ }
784
+
785
+ /**
786
+ * The options to customize the {@link RequestLambdaEdgeAdapter}.
787
+ *
788
+ * @breadcrumb Adapters / AWS / RequestLambdaEdgeAdapter
789
+ * @public
790
+ */
791
+ interface RequestLambdaEdgeAdapterOptions {
792
+ /**
793
+ * Strip base path for custom paths, like `/api`.
794
+ *
795
+ * @defaultValue ''
796
+ */
797
+ stripBasePath?: string;
798
+ /**
799
+ * The max response size in bytes of viewer request and viewer response.
800
+ *
801
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
802
+ *
803
+ * @defaultValue {@link DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES}
804
+ */
805
+ viewerMaxResponseSizeInBytes?: number;
806
+ /**
807
+ * The max response size in bytes of origin request and origin response.
808
+ *
809
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
810
+ *
811
+ * @defaultValue {@link DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES}
812
+ */
813
+ originMaxResponseSizeInBytes?: number;
814
+ /**
815
+ * The function called when the response size exceed the max limits of the Lambda\@edge
816
+ *
817
+ * @param response - The response from framework that exceed the limit of Lambda\@edge
818
+ * @defaultValue undefined
819
+ */
820
+ onResponseSizeExceedLimit?: (response: CloudFrontRequestResult) => CloudFrontRequestResult;
821
+ /**
822
+ * The headers that will be stripped from the headers object because Lambda\@edge will fail if these headers are passed in the response.
823
+ *
824
+ * @remarks All headers will be compared with other headers using toLowerCase, but for the RegExp, if you modify this list, you must put the flag `/gmi` at the end of the RegExp (ex: `/(X-Amz-Cf-)(.*)/gim`)
825
+ *
826
+ * @defaultValue To get the full list, see {@link DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS}.
827
+ */
828
+ disallowedHeaders?: (string | RegExp)[];
829
+ /**
830
+ * If you want to change how we check against the header if it should be stripped, you can pass a function to this property.
831
+ *
832
+ * @param header - The header of the response
833
+ * @defaultValue The default method is implemented to test the header against the list {@link RequestLambdaEdgeAdapterOptions.disallowedHeaders}.
834
+ */
835
+ shouldStripHeader?: (header: string) => boolean;
836
+ }
837
+ /**
838
+ * The adapter to handle requests from AWS Lambda\@Edge of the type Viewer Request.
839
+ *
840
+ * The idea of this Adapter is to you be able to expose your framework to the Edge, like when you build for Cloudfront.
841
+ *
842
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html | Lambda edge docs}
843
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html | Event Reference}
844
+ *
845
+ * @example
846
+ * ```typescript
847
+ * const stripBasePath = '/api'; // in case you have configure the cloudfront to forward the path /api to your lambda
848
+ * const adapter = new RequestLambdaEdgeAdapter({ stripBasePath });
849
+ * ```
850
+ *
851
+ * @breadcrumb Adapters / AWS / RequestLambdaEdgeAdapter
852
+ * @public
853
+ */
854
+ declare class RequestLambdaEdgeAdapter implements AdapterContract<CloudFrontRequestEvent, Context, CloudFrontResultResponse> {
855
+ protected readonly options?: RequestLambdaEdgeAdapterOptions | undefined;
856
+ /**
857
+ * Default constructor
858
+ *
859
+ * @param options - The options to customize the {@link RequestLambdaEdgeAdapter}
860
+ */
861
+ constructor(options?: RequestLambdaEdgeAdapterOptions | undefined);
862
+ /**
863
+ * Strip base path function
864
+ */
865
+ protected readonly stripPathFn: StripBasePathFn;
866
+ /**
867
+ * This property is used to cache the disallowed headers in `RegExp` version, even if you provide a string in `disallowedHeader`, we will cache it in an instance of `RegExp`.
868
+ */
869
+ protected readonly cachedDisallowedHeaders: RegExp[];
870
+ /**
871
+ * {@inheritDoc}
872
+ */
873
+ getAdapterName(): string;
874
+ /**
875
+ * {@inheritDoc}
876
+ */
877
+ canHandle(event: unknown): event is CloudFrontRequestEvent;
878
+ /**
879
+ * {@inheritDoc}
880
+ */
881
+ getRequest(event: CloudFrontRequestEvent): AdapterRequest;
882
+ /**
883
+ * {@inheritDoc}
884
+ */
885
+ getResponse({ body, headers: frameworkHeaders, isBase64Encoded, statusCode, log, event, }: GetResponseAdapterProps<CloudFrontRequestEvent>): CloudFrontResultResponse;
886
+ /**
887
+ * {@inheritDoc}
888
+ */
889
+ onErrorWhileForwarding({ error, delegatedResolver, respondWithErrors, log, event, }: OnErrorProps<CloudFrontRequestEvent, CloudFrontRequestResult>): void;
890
+ /**
891
+ * Returns the headers with the flattened (non-list) values of the cloudfront request headers
892
+ *
893
+ * @param cloudFrontRequest - The cloudfront request
894
+ */
895
+ protected getFlattenedHeadersFromCloudfrontRequest(cloudFrontRequest: CloudFrontRequest): SingleValueHeaders;
896
+ /**
897
+ * Returns headers in Cloudfront Response format.
898
+ *
899
+ * @param originalHeaders - The original version of the request sent by the framework
900
+ */
901
+ protected getHeadersForCloudfrontResponse(originalHeaders: BothValueHeaders): CloudFrontHeaders;
902
+ /**
903
+ * Returns the information if we should remove the response header
904
+ *
905
+ * @param headerKey - The header that will be tested
906
+ */
907
+ protected shouldStripHeader(headerKey: string): boolean;
908
+ }
909
+
910
+ export { type AWSSimpleAdapterOptions, type AWSSimpleAdapterResponseType, AlbAdapter, type AlbAdapterOptions, ApiGatewayV1Adapter, type ApiGatewayV1Options, ApiGatewayV2Adapter, type ApiGatewayV2Options, AwsSimpleAdapter, type BatchItemFailureResponse, DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS, DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES, DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES, type DefaultForwardPath, type DefaultQueryString, DynamoDBAdapter, type DynamoDBAdapterOptions, EventBridgeAdapter, type EventBridgeEventAll, type EventBridgeOptions, LambdaEdgeAdapter, type LambdaEdgeAdapterOptions, type NewLambdaEdgeBody, type OldLambdaEdgeBody, RequestLambdaEdgeAdapter, type RequestLambdaEdgeAdapterOptions, S3Adapter, type S3AdapterOptions, SNSAdapter, type SNSAdapterOptions, SQSAdapter, type SQSAdapterOptions };