@h4ad/serverless-adapter 4.0.0 → 4.1.0

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