@h4ad/serverless-adapter 2.3.0 → 2.4.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 (272) hide show
  1. package/README.md +4 -260
  2. package/lib/@types/binary-settings.d.ts +24 -6
  3. package/lib/@types/binary-settings.d.ts.map +1 -0
  4. package/lib/@types/binary-settings.js +1 -0
  5. package/lib/@types/binary-settings.js.map +1 -0
  6. package/lib/@types/headers.d.ts +16 -3
  7. package/lib/@types/headers.d.ts.map +1 -0
  8. package/lib/@types/headers.js +1 -0
  9. package/lib/@types/headers.js.map +1 -0
  10. package/lib/@types/helpers.d.ts +4 -0
  11. package/lib/@types/helpers.d.ts.map +1 -0
  12. package/lib/@types/helpers.js +1 -0
  13. package/lib/@types/helpers.js.map +1 -0
  14. package/lib/@types/huawei/huawei-api-gateway-event.d.ts +62 -0
  15. package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
  16. package/lib/@types/huawei/huawei-api-gateway-event.js +2 -0
  17. package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -0
  18. package/lib/@types/huawei/huawei-api-gateway-response.d.ts +20 -0
  19. package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
  20. package/lib/@types/huawei/huawei-api-gateway-response.js +2 -0
  21. package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -0
  22. package/lib/@types/huawei/huawei-context.d.ts +157 -0
  23. package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
  24. package/lib/@types/huawei/huawei-context.js +1 -0
  25. package/lib/@types/huawei/huawei-context.js.map +1 -0
  26. package/lib/@types/huawei/index.d.ts +1 -0
  27. package/lib/@types/huawei/index.d.ts.map +1 -0
  28. package/lib/@types/huawei/index.js +6 -1
  29. package/lib/@types/huawei/index.js.map +1 -0
  30. package/lib/@types/index.d.ts +2 -1
  31. package/lib/@types/index.d.ts.map +1 -0
  32. package/lib/@types/index.js +7 -2
  33. package/lib/@types/index.js.map +1 -0
  34. package/lib/adapters/aws/alb.adapter.d.ts +18 -10
  35. package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
  36. package/lib/adapters/aws/alb.adapter.js +14 -9
  37. package/lib/adapters/aws/alb.adapter.js.map +1 -0
  38. package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +20 -12
  39. package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
  40. package/lib/adapters/aws/api-gateway-v1.adapter.js +19 -14
  41. package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -0
  42. package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +19 -11
  43. package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
  44. package/lib/adapters/aws/api-gateway-v2.adapter.js +15 -10
  45. package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -0
  46. package/lib/adapters/aws/dynamodb.adapter.d.ts +18 -10
  47. package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
  48. package/lib/adapters/aws/dynamodb.adapter.js +13 -8
  49. package/lib/adapters/aws/dynamodb.adapter.js.map +1 -0
  50. package/lib/adapters/aws/event-bridge.adapter.d.ts +21 -10
  51. package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
  52. package/lib/adapters/aws/event-bridge.adapter.js +13 -8
  53. package/lib/adapters/aws/event-bridge.adapter.js.map +1 -0
  54. package/lib/adapters/aws/index.d.ts +1 -0
  55. package/lib/adapters/aws/index.d.ts.map +1 -0
  56. package/lib/adapters/aws/index.js +6 -1
  57. package/lib/adapters/aws/index.js.map +1 -0
  58. package/lib/adapters/aws/lambda-edge.adapter.d.ts +76 -46
  59. package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
  60. package/lib/adapters/aws/lambda-edge.adapter.js +40 -24
  61. package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -0
  62. package/lib/adapters/aws/sns.adapter.d.ts +18 -10
  63. package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
  64. package/lib/adapters/aws/sns.adapter.js +13 -8
  65. package/lib/adapters/aws/sns.adapter.js.map +1 -0
  66. package/lib/adapters/aws/sqs.adapter.d.ts +18 -10
  67. package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
  68. package/lib/adapters/aws/sqs.adapter.js +13 -8
  69. package/lib/adapters/aws/sqs.adapter.js.map +1 -0
  70. package/lib/adapters/dummy/dummy.adapter.d.ts +9 -5
  71. package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
  72. package/lib/adapters/dummy/dummy.adapter.js +9 -5
  73. package/lib/adapters/dummy/dummy.adapter.js.map +1 -0
  74. package/lib/adapters/dummy/index.d.ts +1 -0
  75. package/lib/adapters/dummy/index.d.ts.map +1 -0
  76. package/lib/adapters/dummy/index.js +6 -1
  77. package/lib/adapters/dummy/index.js.map +1 -0
  78. package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +19 -12
  79. package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
  80. package/lib/adapters/huawei/huawei-api-gateway.adapter.js +14 -9
  81. package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -0
  82. package/lib/adapters/huawei/index.d.ts +1 -0
  83. package/lib/adapters/huawei/index.d.ts.map +1 -0
  84. package/lib/adapters/huawei/index.js +6 -1
  85. package/lib/adapters/huawei/index.js.map +1 -0
  86. package/lib/contracts/adapter.contract.d.ts +30 -30
  87. package/lib/contracts/adapter.contract.d.ts.map +1 -0
  88. package/lib/contracts/adapter.contract.js +2 -0
  89. package/lib/contracts/adapter.contract.js.map +1 -0
  90. package/lib/contracts/framework.contract.d.ts +7 -3
  91. package/lib/contracts/framework.contract.d.ts.map +1 -0
  92. package/lib/contracts/framework.contract.js +1 -0
  93. package/lib/contracts/framework.contract.js.map +1 -0
  94. package/lib/contracts/handler.contract.d.ts +7 -0
  95. package/lib/contracts/handler.contract.d.ts.map +1 -0
  96. package/lib/contracts/handler.contract.js +1 -0
  97. package/lib/contracts/handler.contract.js.map +1 -0
  98. package/lib/contracts/index.d.ts +1 -0
  99. package/lib/contracts/index.d.ts.map +1 -0
  100. package/lib/contracts/index.js +6 -1
  101. package/lib/contracts/index.js.map +1 -0
  102. package/lib/contracts/resolver.contract.d.ts +17 -4
  103. package/lib/contracts/resolver.contract.d.ts.map +1 -0
  104. package/lib/contracts/resolver.contract.js +1 -0
  105. package/lib/contracts/resolver.contract.js.map +1 -0
  106. package/lib/core/base-handler.d.ts +9 -5
  107. package/lib/core/base-handler.d.ts.map +1 -0
  108. package/lib/core/base-handler.js +9 -5
  109. package/lib/core/base-handler.js.map +1 -0
  110. package/lib/core/constants.d.ts +27 -0
  111. package/lib/core/constants.d.ts.map +1 -0
  112. package/lib/core/constants.js +21 -0
  113. package/lib/core/constants.js.map +1 -0
  114. package/lib/core/current-invoke.d.ts +17 -6
  115. package/lib/core/current-invoke.d.ts.map +1 -0
  116. package/lib/core/current-invoke.js +12 -4
  117. package/lib/core/current-invoke.js.map +1 -0
  118. package/lib/core/event-body.d.ts +9 -3
  119. package/lib/core/event-body.d.ts.map +1 -0
  120. package/lib/core/event-body.js +9 -3
  121. package/lib/core/event-body.js.map +1 -0
  122. package/lib/core/headers.d.ts +17 -6
  123. package/lib/core/headers.d.ts.map +1 -0
  124. package/lib/core/headers.js +17 -6
  125. package/lib/core/headers.js.map +1 -0
  126. package/lib/core/index.d.ts +1 -0
  127. package/lib/core/index.d.ts.map +1 -0
  128. package/lib/core/index.js +6 -1
  129. package/lib/core/index.js.map +1 -0
  130. package/lib/core/is-binary.d.ts +29 -11
  131. package/lib/core/is-binary.d.ts.map +1 -0
  132. package/lib/core/is-binary.js +29 -11
  133. package/lib/core/is-binary.js.map +1 -0
  134. package/lib/core/logger.d.ts +22 -5
  135. package/lib/core/logger.d.ts.map +1 -0
  136. package/lib/core/logger.js +8 -3
  137. package/lib/core/logger.js.map +1 -0
  138. package/lib/core/no-op.d.ts +4 -0
  139. package/lib/core/no-op.d.ts.map +1 -0
  140. package/lib/core/no-op.js +4 -0
  141. package/lib/core/no-op.js.map +1 -0
  142. package/lib/core/optional.d.ts +8 -3
  143. package/lib/core/optional.d.ts.map +1 -0
  144. package/lib/core/optional.js +8 -3
  145. package/lib/core/optional.js.map +1 -0
  146. package/lib/core/path.d.ts +14 -5
  147. package/lib/core/path.d.ts.map +1 -0
  148. package/lib/core/path.js +14 -5
  149. package/lib/core/path.js.map +1 -0
  150. package/lib/core/stream.d.ts +5 -1
  151. package/lib/core/stream.d.ts.map +1 -0
  152. package/lib/core/stream.js +6 -2
  153. package/lib/core/stream.js.map +1 -0
  154. package/lib/frameworks/express/express.framework.d.ts +5 -1
  155. package/lib/frameworks/express/express.framework.d.ts.map +1 -0
  156. package/lib/frameworks/express/express.framework.js +5 -1
  157. package/lib/frameworks/express/express.framework.js.map +1 -0
  158. package/lib/frameworks/express/index.d.ts +1 -0
  159. package/lib/frameworks/express/index.d.ts.map +1 -0
  160. package/lib/frameworks/express/index.js +6 -1
  161. package/lib/frameworks/express/index.js.map +1 -0
  162. package/lib/frameworks/fastify/fastify.framework.d.ts +5 -1
  163. package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
  164. package/lib/frameworks/fastify/fastify.framework.js +5 -1
  165. package/lib/frameworks/fastify/fastify.framework.js.map +1 -0
  166. package/lib/frameworks/fastify/index.d.ts +1 -0
  167. package/lib/frameworks/fastify/index.d.ts.map +1 -0
  168. package/lib/frameworks/fastify/index.js +6 -1
  169. package/lib/frameworks/fastify/index.js.map +1 -0
  170. package/lib/frameworks/hapi/hapi.framework.d.ts +5 -1
  171. package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
  172. package/lib/frameworks/hapi/hapi.framework.js +5 -1
  173. package/lib/frameworks/hapi/hapi.framework.js.map +1 -0
  174. package/lib/frameworks/hapi/index.d.ts +1 -0
  175. package/lib/frameworks/hapi/index.d.ts.map +1 -0
  176. package/lib/frameworks/hapi/index.js +6 -1
  177. package/lib/frameworks/hapi/index.js.map +1 -0
  178. package/lib/frameworks/koa/index.d.ts +1 -0
  179. package/lib/frameworks/koa/index.d.ts.map +1 -0
  180. package/lib/frameworks/koa/index.js +6 -1
  181. package/lib/frameworks/koa/index.js.map +1 -0
  182. package/lib/frameworks/koa/koa.framework.d.ts +5 -1
  183. package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
  184. package/lib/frameworks/koa/koa.framework.js +5 -1
  185. package/lib/frameworks/koa/koa.framework.js.map +1 -0
  186. package/lib/frameworks/lazy/index.d.ts +2 -0
  187. package/lib/frameworks/lazy/index.d.ts.map +1 -0
  188. package/lib/frameworks/lazy/index.js +17 -0
  189. package/lib/frameworks/lazy/index.js.map +1 -0
  190. package/lib/frameworks/lazy/lazy.framework.d.ts +7 -2
  191. package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
  192. package/lib/frameworks/lazy/lazy.framework.js +7 -2
  193. package/lib/frameworks/lazy/lazy.framework.js.map +1 -0
  194. package/lib/frameworks/trpc/index.d.ts +2 -0
  195. package/lib/frameworks/trpc/index.d.ts.map +1 -0
  196. package/lib/frameworks/trpc/index.js +18 -0
  197. package/lib/frameworks/trpc/index.js.map +1 -0
  198. package/lib/frameworks/trpc/trpc.framework.d.ts +152 -0
  199. package/lib/frameworks/trpc/trpc.framework.d.ts.map +1 -0
  200. package/lib/frameworks/trpc/trpc.framework.js +119 -0
  201. package/lib/frameworks/trpc/trpc.framework.js.map +1 -0
  202. package/lib/handlers/default/default.handler.d.ts +36 -32
  203. package/lib/handlers/default/default.handler.d.ts.map +1 -0
  204. package/lib/handlers/default/default.handler.js +36 -32
  205. package/lib/handlers/default/default.handler.js.map +1 -0
  206. package/lib/handlers/default/index.d.ts +1 -0
  207. package/lib/handlers/default/index.d.ts.map +1 -0
  208. package/lib/handlers/default/index.js +6 -1
  209. package/lib/handlers/default/index.js.map +1 -0
  210. package/lib/handlers/huawei/http-huawei.handler.d.ts +14 -4
  211. package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
  212. package/lib/handlers/huawei/http-huawei.handler.js +15 -4
  213. package/lib/handlers/huawei/http-huawei.handler.js.map +1 -0
  214. package/lib/handlers/huawei/index.d.ts +1 -0
  215. package/lib/handlers/huawei/index.d.ts.map +1 -0
  216. package/lib/handlers/huawei/index.js +6 -1
  217. package/lib/handlers/huawei/index.js.map +1 -0
  218. package/lib/index.d.ts +1 -0
  219. package/lib/index.d.ts.map +1 -0
  220. package/lib/index.js +6 -1
  221. package/lib/index.js.map +1 -0
  222. package/lib/network/index.d.ts +1 -0
  223. package/lib/network/index.d.ts.map +1 -0
  224. package/lib/network/index.js +6 -1
  225. package/lib/network/index.js.map +1 -0
  226. package/lib/network/request.d.ts +28 -0
  227. package/lib/network/request.d.ts.map +1 -0
  228. package/lib/network/request.js +7 -0
  229. package/lib/network/request.js.map +1 -0
  230. package/lib/network/response.d.ts +18 -1
  231. package/lib/network/response.d.ts.map +1 -0
  232. package/lib/network/response.js +9 -1
  233. package/lib/network/response.js.map +1 -0
  234. package/lib/resolvers/aws-context/aws-context.resolver.d.ts +7 -9
  235. package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +1 -0
  236. package/lib/resolvers/aws-context/aws-context.resolver.js +7 -9
  237. package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -0
  238. package/lib/resolvers/aws-context/index.d.ts +1 -0
  239. package/lib/resolvers/aws-context/index.d.ts.map +1 -0
  240. package/lib/resolvers/aws-context/index.js +6 -1
  241. package/lib/resolvers/aws-context/index.js.map +1 -0
  242. package/lib/resolvers/callback/callback.resolver.d.ts +9 -2
  243. package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
  244. package/lib/resolvers/callback/callback.resolver.js +6 -2
  245. package/lib/resolvers/callback/callback.resolver.js.map +1 -0
  246. package/lib/resolvers/callback/index.d.ts +1 -0
  247. package/lib/resolvers/callback/index.d.ts.map +1 -0
  248. package/lib/resolvers/callback/index.js +6 -1
  249. package/lib/resolvers/callback/index.js.map +1 -0
  250. package/lib/resolvers/dummy/dummy.resolver.d.ts +5 -1
  251. package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
  252. package/lib/resolvers/dummy/dummy.resolver.js +5 -1
  253. package/lib/resolvers/dummy/dummy.resolver.js.map +1 -0
  254. package/lib/resolvers/dummy/index.d.ts +1 -0
  255. package/lib/resolvers/dummy/index.d.ts.map +1 -0
  256. package/lib/resolvers/dummy/index.js +6 -1
  257. package/lib/resolvers/dummy/index.js.map +1 -0
  258. package/lib/resolvers/promise/index.d.ts +1 -0
  259. package/lib/resolvers/promise/index.d.ts.map +1 -0
  260. package/lib/resolvers/promise/index.js +6 -1
  261. package/lib/resolvers/promise/index.js.map +1 -0
  262. package/lib/resolvers/promise/promise.resolver.d.ts +5 -1
  263. package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
  264. package/lib/resolvers/promise/promise.resolver.js +5 -1
  265. package/lib/resolvers/promise/promise.resolver.js.map +1 -0
  266. package/lib/serverless-adapter.d.ts +17 -12
  267. package/lib/serverless-adapter.d.ts.map +1 -0
  268. package/lib/serverless-adapter.js +17 -12
  269. package/lib/serverless-adapter.js.map +1 -0
  270. package/package.json +29 -4
  271. package/lib/@types/proxy-params.d.ts +0 -8
  272. package/lib/@types/proxy-params.js +0 -2
@@ -1,124 +1,153 @@
1
1
  import type { CloudFrontRequest, Context } from 'aws-lambda';
2
2
  import type { CloudFrontEvent, CloudFrontHeaders } from 'aws-lambda/common/cloudfront';
3
3
  import type { CloudFrontRequestEvent, CloudFrontRequestResult } from 'aws-lambda/trigger/cloudfront-request';
4
- import { BothValueHeaders, SingleValueHeaders } from '../../@types';
5
- import { Concrete } from '../../@types/helpers';
4
+ import { BothValueHeaders, Concrete, SingleValueHeaders } from '../../@types';
6
5
  import { AdapterContract, AdapterRequest, GetResponseAdapterProps, OnErrorProps } from '../../contracts';
7
6
  /**
8
7
  * The type alias to indicate where we get the default value of query string to create the request.
8
+ *
9
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
10
+ * @public
9
11
  */
10
12
  export declare type DefaultQueryString = CloudFrontRequestEvent['Records'][number]['cf']['request']['querystring'];
11
13
  /**
12
14
  * The type alias to indicate where we get the default value of path to create the request.
15
+ *
16
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
17
+ * @public
13
18
  */
14
19
  export declare type DefaultForwardPath = CloudFrontRequestEvent['Records'][number]['cf']['request']['uri'];
15
20
  /**
16
- * Represents the body of the new version of Lambda@edge, which uses the `body` property inside `request` as the body (library) of the request.
21
+ * Represents the body of the new version of Lambda\@edge, which uses the `body` property inside `request` as the body (library) of the request.
22
+ *
23
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
24
+ * @public
17
25
  */
18
26
  export declare type NewLambdaEdgeBody = CloudFrontRequestEvent['Records'][number]['cf']['request']['body'];
19
27
  /**
20
- * 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.
28
+ * 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.
29
+ *
30
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
31
+ * @public
21
32
  */
22
33
  export declare type OldLambdaEdgeBody = Concrete<CloudFrontRequestEvent['Records'][number]['cf']['request']>['body']['data'];
23
34
  /**
24
- * 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.
35
+ * 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.
36
+ *
37
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
38
+ * @public
25
39
  */
26
40
  export declare const DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS: (string | RegExp)[];
27
41
  /**
28
42
  * The default max response size in bytes of viewer request and viewer response.
29
43
  *
30
- * @default 1024 * 40 = 40960 = 40KB
44
+ * @defaultValue 1024 * 40 = 40960 = 40KB
31
45
  *
32
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Reference}
46
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
47
+ *
48
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
49
+ * @public
33
50
  */
34
51
  export declare const DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES: number;
35
52
  /**
36
53
  * The default max response size in bytes of origin request and origin response.
37
54
  *
38
- * @default 1024 * 1024 = 1048576 = 1MB
55
+ * @defaultValue 1024 * 1024 = 1048576 = 1MB
56
+ *
57
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
39
58
  *
40
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Reference}
59
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
60
+ * @public
41
61
  */
42
62
  export declare const DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES: number;
43
63
  /**
44
64
  * The options to customize the {@link LambdaEdgeAdapter}.
65
+ *
66
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
67
+ * @public
45
68
  */
46
69
  export interface LambdaEdgeAdapterOptions {
47
70
  /**
48
71
  * The max response size in bytes of viewer request and viewer response.
49
72
  *
50
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Reference}
73
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
51
74
  *
52
- * @default {@link DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES}
75
+ * @defaultValue {@link DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES}
53
76
  */
54
77
  viewerMaxResponseSizeInBytes?: number;
55
78
  /**
56
79
  * The max response size in bytes of origin request and origin response.
57
80
  *
58
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Reference}
81
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
59
82
  *
60
- * @default {@link DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES}
83
+ * @defaultValue {@link DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES}
61
84
  */
62
85
  originMaxResponseSizeInBytes?: number;
63
86
  /**
64
- * The function called when the response size exceed the max limits of the Lambda@edge
87
+ * The function called when the response size exceed the max limits of the Lambda\@edge
65
88
  *
66
- * @param response The response from framework that exceed the limit of Lambda@edge
67
- * @default undefined
89
+ * @param response - The response from framework that exceed the limit of Lambda\@edge
90
+ * @defaultValue undefined
68
91
  */
69
92
  onResponseSizeExceedLimit?: (response: CloudFrontRequestResult) => CloudFrontRequestResult;
70
93
  /**
71
94
  * Return the path to be used to create a request to the framework
72
95
  *
73
- * @note You MUST append the query params from {@link DefaultQueryString}, you can use the helper {@link getPathWithQueryStringParams}.
96
+ * @remarks You MUST append the query params from {@link DefaultQueryString}, you can use the helper {@link getPathWithQueryStringParams}.
74
97
  *
75
- * @param event The event sent by the serverless
76
- * @default The value from {@link DefaultForwardPath}
98
+ * @param event - The event sent by the serverless
99
+ * @defaultValue The value from {@link DefaultForwardPath}
77
100
  */
78
101
  getPathFromEvent?: (event: CloudFrontRequestEvent['Records'][number]) => string;
79
102
  /**
80
- * The headers that will be stripped from the headers object because Lambda@edge will fail if these headers are passed in the response.
103
+ * The headers that will be stripped from the headers object because Lambda\@edge will fail if these headers are passed in the response.
81
104
  *
82
- * @note 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`)
105
+ * @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`)
83
106
  *
84
- * @default To get the full list, see {@link DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS}.
107
+ * @defaultValue To get the full list, see {@link DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS}.
85
108
  */
86
109
  disallowedHeaders?: (string | RegExp)[];
87
110
  /**
88
111
  * If you want to change how we check against the header if it should be stripped, you can pass a function to this property.
89
112
  *
90
- * @param header The header of the response
91
- * @default The default method is implemented to test the header against the list {@link disallowedHeaders}.
113
+ * @param header - The header of the response
114
+ * @defaultValue The default method is implemented to test the header against the list {@link LambdaEdgeAdapterOptions.disallowedHeaders}.
92
115
  */
93
116
  shouldStripHeader?: (header: string) => boolean;
94
117
  /**
95
- * By default, the {@link CloudFrontRequestResult} has the `headers` property, but we also have the headers sent by the framework too.
118
+ * By default, the {@link aws-lambda#CloudFrontRequestResult} has the `headers` property, but we also have the headers sent by the framework too.
96
119
  * So this setting tells us how to handle this case, if you pass `true` to this property, we will use the framework headers.
97
- * Otherwise, we will forward the body back to cloudfront without modifying or trying to set the `headers` property inside {@link CloudFrontRequestResult}.
120
+ * Otherwise, we will forward the body back to cloudfront without modifying or trying to set the `headers` property inside {@link aws-lambda#CloudFrontRequestResult}.
98
121
  *
99
- * @default false
122
+ * @defaultValue false
100
123
  */
101
124
  shouldUseHeadersFromFramework?: boolean;
102
125
  }
103
126
  /**
104
- * The adapter to handle requests from AWS Lambda@Edge.
127
+ * The adapter to handle requests from AWS Lambda\@Edge.
105
128
  *
106
- * 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}.
107
- * 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 CloudFrontRequestResult}.
129
+ * 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}.
130
+ * 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}.
108
131
  * 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.
109
132
  *
110
- * {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html Lambda edge docs}
111
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html Event Reference}
133
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html | Lambda edge docs}
134
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html | Event Reference}
112
135
  *
113
- * @example```typescript
136
+ * @example
137
+ * ```typescript
138
+ * const getPathFromEvent = () => '/lambda/edge'; // will forward all requests to the same endpoint
139
+ * const adapter = new LambdaEdgeAdapter({ getPathFromEvent });
114
140
  * ```
141
+ *
142
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
143
+ * @public
115
144
  */
116
145
  export declare class LambdaEdgeAdapter implements AdapterContract<CloudFrontRequestEvent, Context, CloudFrontRequestResult> {
117
146
  protected readonly options?: LambdaEdgeAdapterOptions | undefined;
118
147
  /**
119
148
  * Default constructor
120
149
  *
121
- * @param options The options to customize the {@link LambdaEdgeAdapter}
150
+ * @param options - The options to customize the {@link LambdaEdgeAdapter}
122
151
  */
123
152
  constructor(options?: LambdaEdgeAdapterOptions | undefined);
124
153
  /**
@@ -126,54 +155,55 @@ export declare class LambdaEdgeAdapter implements AdapterContract<CloudFrontRequ
126
155
  */
127
156
  protected readonly cachedDisallowedHeaders: RegExp[];
128
157
  /**
129
- * @inheritDoc
158
+ * {@inheritDoc}
130
159
  */
131
160
  getAdapterName(): string;
132
161
  /**
133
- * @inheritDoc
162
+ * {@inheritDoc}
134
163
  */
135
164
  canHandle(event: unknown): event is CloudFrontRequestEvent;
136
165
  /**
137
- * @inheritDoc
166
+ * {@inheritDoc}
138
167
  */
139
168
  getRequest(event: CloudFrontRequestEvent): AdapterRequest;
140
169
  /**
141
- * @inheritDoc
170
+ * {@inheritDoc}
142
171
  */
143
172
  getResponse(props: GetResponseAdapterProps<CloudFrontRequestEvent>): CloudFrontRequestResult;
144
173
  /**
145
- * @inheritDoc
174
+ * {@inheritDoc}
146
175
  */
147
176
  onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<CloudFrontRequestEvent, CloudFrontRequestResult>): void;
148
177
  /**
149
178
  * Returns the headers with the flattened (non-list) values of the cloudfront request headers
150
179
  *
151
- * @param cloudFrontRequest The cloudfront request
180
+ * @param cloudFrontRequest - The cloudfront request
152
181
  */
153
182
  protected getFlattenedHeadersFromCloudfrontRequest(cloudFrontRequest: CloudFrontRequest): SingleValueHeaders;
154
183
  /**
155
- * Returns the framework response in the format required by the Lambda@edge.
184
+ * Returns the framework response in the format required by the Lambda\@edge.
156
185
  *
157
- * @param body The body of the response
158
- * @param frameworkHeaders The headers from the framework
186
+ * @param body - The body of the response
187
+ * @param frameworkHeaders - The headers from the framework
159
188
  */
160
189
  protected getResponseToLambdaEdge({ body, headers: frameworkHeaders, }: GetResponseAdapterProps<CloudFrontRequestEvent>): CloudFrontRequestResult;
161
190
  /**
162
191
  * Returns headers in Cloudfront Response format.
163
192
  *
164
- * @param originalHeaders The original version of the request sent by the framework
193
+ * @param originalHeaders - The original version of the request sent by the framework
165
194
  */
166
195
  protected getHeadersForCloudfrontResponse(originalHeaders: BothValueHeaders): CloudFrontHeaders;
167
196
  /**
168
197
  * Returns the information if we should remove the response header
169
198
  *
170
- * @param headerKey The header that will be tested
199
+ * @param headerKey - The header that will be tested
171
200
  */
172
201
  protected shouldStripHeader(headerKey: string): boolean;
173
202
  /**
174
203
  * Determines whether the event is from origin or is from viewer.
175
204
  *
176
- * @param content The event sent by AWS or the response sent by the framework
205
+ * @param content - The event sent by AWS or the response sent by the framework
177
206
  */
178
207
  protected isEventTypeOrigin(content: CloudFrontEvent['config']): boolean;
179
208
  }
209
+ //# sourceMappingURL=lambda-edge.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CAAC,sBAAsB,CAAC,GACrD,uBAAuB;IAgC1B;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,GAClB,EAAE,YAAY,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,GAAG,IAAI;IAQvE;;;;OAIG;IACH,SAAS,CAAC,wCAAwC,CAChD,iBAAiB,EAAE,iBAAiB,GACnC,kBAAkB;IAUrB;;;;;OAKG;IACH,SAAS,CAAC,uBAAuB,CAAC,EAChC,IAAI,EACJ,OAAO,EAAE,gBAAgB,GAC1B,EAAE,uBAAuB,CAAC,sBAAsB,CAAC,GAAG,uBAAuB;IA6B5E;;;;OAIG;IACH,SAAS,CAAC,+BAA+B,CACvC,eAAe,EAAE,gBAAgB,GAChC,iBAAiB;IA6BpB;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAevD;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,OAAO;CAKzE"}
@@ -4,7 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.LambdaEdgeAdapter = exports.DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES = exports.DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES = exports.DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS = void 0;
5
5
  const core_1 = require("../../core");
6
6
  /**
7
- * 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.
7
+ * 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.
8
+ *
9
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
10
+ * @public
8
11
  */
9
12
  exports.DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS = [
10
13
  'Connection',
@@ -28,38 +31,50 @@ exports.DEFAULT_LAMBDA_EDGE_DISALLOWED_HEADERS = [
28
31
  /**
29
32
  * The default max response size in bytes of viewer request and viewer response.
30
33
  *
31
- * @default 1024 * 40 = 40960 = 40KB
34
+ * @defaultValue 1024 * 40 = 40960 = 40KB
35
+ *
36
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
32
37
  *
33
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Reference}
38
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
39
+ * @public
34
40
  */
35
41
  exports.DEFAULT_VIEWER_MAX_RESPONSE_SIZE_IN_BYTES = 1024 * 40;
36
42
  /**
37
43
  * The default max response size in bytes of origin request and origin response.
38
44
  *
39
- * @default 1024 * 1024 = 1048576 = 1MB
45
+ * @defaultValue 1024 * 1024 = 1048576 = 1MB
40
46
  *
41
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html Reference}
47
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-limits.html | Reference}
48
+ *
49
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter / Constants
50
+ * @public
42
51
  */
43
52
  exports.DEFAULT_ORIGIN_MAX_RESPONSE_SIZE_IN_BYTES = 1024 * 1024;
44
53
  /**
45
- * The adapter to handle requests from AWS Lambda@Edge.
54
+ * The adapter to handle requests from AWS Lambda\@Edge.
46
55
  *
47
- * 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}.
48
- * 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 CloudFrontRequestResult}.
56
+ * 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}.
57
+ * 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}.
49
58
  * 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.
50
59
  *
51
- * {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html Lambda edge docs}
52
- * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html Event Reference}
60
+ * {@link https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html | Lambda edge docs}
61
+ * {@link https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html | Event Reference}
53
62
  *
54
- * @example```typescript
63
+ * @example
64
+ * ```typescript
65
+ * const getPathFromEvent = () => '/lambda/edge'; // will forward all requests to the same endpoint
66
+ * const adapter = new LambdaEdgeAdapter({ getPathFromEvent });
55
67
  * ```
68
+ *
69
+ * @breadcrumb Adapters / AWS / LambdaEdgeAdapter
70
+ * @public
56
71
  */
57
72
  class LambdaEdgeAdapter {
58
73
  //#region Constructor
59
74
  /**
60
75
  * Default constructor
61
76
  *
62
- * @param options The options to customize the {@link LambdaEdgeAdapter}
77
+ * @param options - The options to customize the {@link LambdaEdgeAdapter}
63
78
  */
64
79
  constructor(options) {
65
80
  var _a;
@@ -74,13 +89,13 @@ class LambdaEdgeAdapter {
74
89
  //#endregion
75
90
  //#region Public Methods
76
91
  /**
77
- * @inheritDoc
92
+ * {@inheritDoc}
78
93
  */
79
94
  getAdapterName() {
80
95
  return LambdaEdgeAdapter.name;
81
96
  }
82
97
  /**
83
- * @inheritDoc
98
+ * {@inheritDoc}
84
99
  */
85
100
  canHandle(event) {
86
101
  var _a, _b, _c;
@@ -97,7 +112,7 @@ class LambdaEdgeAdapter {
97
112
  return validEventTypes.includes(eventType);
98
113
  }
99
114
  /**
100
- * @inheritDoc
115
+ * {@inheritDoc}
101
116
  */
102
117
  getRequest(event) {
103
118
  var _a;
@@ -129,7 +144,7 @@ class LambdaEdgeAdapter {
129
144
  };
130
145
  }
131
146
  /**
132
- * @inheritDoc
147
+ * {@inheritDoc}
133
148
  */
134
149
  getResponse(props) {
135
150
  var _a, _b, _c;
@@ -149,7 +164,7 @@ class LambdaEdgeAdapter {
149
164
  return response;
150
165
  }
151
166
  /**
152
- * @inheritDoc
167
+ * {@inheritDoc}
153
168
  */
154
169
  onErrorWhileForwarding({ error, delegatedResolver, }) {
155
170
  delegatedResolver.fail(error);
@@ -159,7 +174,7 @@ class LambdaEdgeAdapter {
159
174
  /**
160
175
  * Returns the headers with the flattened (non-list) values of the cloudfront request headers
161
176
  *
162
- * @param cloudFrontRequest The cloudfront request
177
+ * @param cloudFrontRequest - The cloudfront request
163
178
  */
164
179
  getFlattenedHeadersFromCloudfrontRequest(cloudFrontRequest) {
165
180
  const headers = {};
@@ -169,10 +184,10 @@ class LambdaEdgeAdapter {
169
184
  return headers;
170
185
  }
171
186
  /**
172
- * Returns the framework response in the format required by the Lambda@edge.
187
+ * Returns the framework response in the format required by the Lambda\@edge.
173
188
  *
174
- * @param body The body of the response
175
- * @param frameworkHeaders The headers from the framework
189
+ * @param body - The body of the response
190
+ * @param frameworkHeaders - The headers from the framework
176
191
  */
177
192
  getResponseToLambdaEdge({ body, headers: frameworkHeaders, }) {
178
193
  var _a;
@@ -194,7 +209,7 @@ class LambdaEdgeAdapter {
194
209
  /**
195
210
  * Returns headers in Cloudfront Response format.
196
211
  *
197
- * @param originalHeaders The original version of the request sent by the framework
212
+ * @param originalHeaders - The original version of the request sent by the framework
198
213
  */
199
214
  getHeadersForCloudfrontResponse(originalHeaders) {
200
215
  const originalHeadersEntries = Object.entries(originalHeaders);
@@ -222,7 +237,7 @@ class LambdaEdgeAdapter {
222
237
  /**
223
238
  * Returns the information if we should remove the response header
224
239
  *
225
- * @param headerKey The header that will be tested
240
+ * @param headerKey - The header that will be tested
226
241
  */
227
242
  shouldStripHeader(headerKey) {
228
243
  var _a;
@@ -239,10 +254,11 @@ class LambdaEdgeAdapter {
239
254
  /**
240
255
  * Determines whether the event is from origin or is from viewer.
241
256
  *
242
- * @param content The event sent by AWS or the response sent by the framework
257
+ * @param content - The event sent by AWS or the response sent by the framework
243
258
  */
244
259
  isEventTypeOrigin(content) {
245
260
  return content.eventType.includes('origin');
246
261
  }
247
262
  }
248
263
  exports.LambdaEdgeAdapter = LambdaEdgeAdapter;
264
+ //# sourceMappingURL=lambda-edge.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lambda-edge.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/lambda-edge.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAmBjB,qCAIoB;AAyCpB;;;;;GAKG;AACU,QAAA,sCAAsC,GAAwB;IACzE,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,mBAAmB;IACnB,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,oBAAoB;IACpB,SAAS;IACT,kBAAkB;IAClB,mBAAmB;IACnB,WAAW;CACZ,CAAC;AAEF;;;;;;;;;GASG;AACU,QAAA,yCAAyC,GAAG,IAAI,GAAG,EAAE,CAAC;AAEnE;;;;;;;;;GASG;AACU,QAAA,yCAAyC,GAAG,IAAI,GAAG,IAAI,CAAC;AA4ErE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAa,iBAAiB;IAI5B,qBAAqB;IAErB;;;;OAIG;IACH,YAA+B,OAAkC;;QAAlC,YAAO,GAAP,OAAO,CAA2B;QAC/D,MAAM,iBAAiB,GAAG,IAAA,4BAAqB,EAC7C,MAAA,IAAI,CAAC,OAAO,0CAAE,iBAAiB,EAC/B,8CAAsC,CACvC,CAAC;QAEF,IAAI,CAAC,uBAAuB,GAAG,iBAAiB,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;YACtE,IAAI,gBAAgB,YAAY,MAAM;g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C,CAAC;YAEJ,OAAO,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;SAC1C;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACO,iBAAiB,CAAC,SAAiB;;QAC3C,IAAI,MAAA,IAAI,CAAC,OAAO,0CAAE,iBAAiB;YACjC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAEnD,MAAM,kBAAkB,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAEnD,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,uBAAuB,EAAE;YACxD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC;gBAAE,SAAS;YAEtD,OAAO,IAAI,CAAC;SACb;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACO,iBAAiB,CAAC,OAAkC;QAC5D,OAAO,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;CAGF;AA3RD,8CA2RC"}
@@ -3,18 +3,21 @@ import { AdapterContract, AdapterRequest, OnErrorProps } from '../../contracts';
3
3
  import { IEmptyResponse } from '../../core';
4
4
  /**
5
5
  * The options to customize the {@link SNSAdapter}
6
+ *
7
+ * @breadcrumb Adapters / AWS / SNSAdapter
8
+ * @public
6
9
  */
7
10
  export interface SNSAdapterOptions {
8
11
  /**
9
12
  * The path that will be used to create a request to be forwarded to the framework.
10
13
  *
11
- * @default /sns
14
+ * @defaultValue /sns
12
15
  */
13
16
  snsForwardPath?: string;
14
17
  /**
15
18
  * The http method that will be used to create a request to be forwarded to the framework.
16
19
  *
17
- * @default POST
20
+ * @defaultValue POST
18
21
  */
19
22
  snsForwardMethod?: string;
20
23
  }
@@ -23,40 +26,45 @@ export interface SNSAdapterOptions {
23
26
  *
24
27
  * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
25
28
  *
26
- * {@link https://docs.aws.amazon.com/pt_br/lambda/latest/dg/with-sns.html Event Reference}
29
+ * {@link https://docs.aws.amazon.com/pt_br/lambda/latest/dg/with-sns.html | Event Reference}
27
30
  *
28
- * @example```typescript
31
+ * @example
32
+ * ```typescript
29
33
  * const snsForwardPath = '/your/route/sns'; // default /sns
30
34
  * const snsForwardMethod = 'POST'; // default POST
31
35
  * const adapter = new SNSAdapter({ snsForwardPath, snsForwardMethod });
32
36
  * ```
37
+ *
38
+ * @breadcrumb Adapters / AWS / SNSAdapter
39
+ * @public
33
40
  */
34
41
  export declare class SNSAdapter implements AdapterContract<SNSEvent, Context, IEmptyResponse> {
35
42
  protected readonly options?: SNSAdapterOptions | undefined;
36
43
  /**
37
44
  * Default constructor
38
45
  *
39
- * @param options The options to customize the {@link SNSAdapter}
46
+ * @param options - The options to customize the {@link SNSAdapter}
40
47
  */
41
48
  constructor(options?: SNSAdapterOptions | undefined);
42
49
  /**
43
- * @inheritDoc
50
+ * {@inheritDoc}
44
51
  */
45
52
  getAdapterName(): string;
46
53
  /**
47
- * @inheritDoc
54
+ * {@inheritDoc}
48
55
  */
49
56
  canHandle(event: unknown): event is SNSEvent;
50
57
  /**
51
- * @inheritDoc
58
+ * {@inheritDoc}
52
59
  */
53
60
  getRequest(event: SNSEvent): AdapterRequest;
54
61
  /**
55
- * @inheritDoc
62
+ * {@inheritDoc}
56
63
  */
57
64
  getResponse(): IEmptyResponse;
58
65
  /**
59
- * @inheritDoc
66
+ * {@inheritDoc}
60
67
  */
61
68
  onErrorWhileForwarding({ error, delegatedResolver, }: OnErrorProps<SNSEvent, IEmptyResponse>): void;
62
69
  }
70
+ //# sourceMappingURL=sns.adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns.adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/aws/sns.adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAEL,cAAc,EAGf,MAAM,YAAY,CAAC;AAIpB;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,UACX,YAAW,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC;IASjD,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;IALvC;;;;OAIG;gBAC4B,OAAO,CAAC,+BAAmB;IAM1D;;OAEG;IACI,cAAc,IAAI,MAAM;IAI/B;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ;IAUnD;;OAEG;IACI,UAAU,CAAC,KAAK,EAAE,QAAQ,GAAG,cAAc;IA0BlD;;OAEG;IACI,WAAW,IAAI,cAAc;IAIpC;;OAEG;IACI,sBAAsB,CAAC,EAC5B,KAAK,EACL,iBAAiB,GAClB,EAAE,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,IAAI;CAKjD"}
@@ -8,20 +8,24 @@ const core_1 = require("../../core");
8
8
  *
9
9
  * The option of `responseWithErrors` is ignored by this adapter and we always call `resolver.fail` with the error.
10
10
  *
11
- * {@link https://docs.aws.amazon.com/pt_br/lambda/latest/dg/with-sns.html Event Reference}
11
+ * {@link https://docs.aws.amazon.com/pt_br/lambda/latest/dg/with-sns.html | Event Reference}
12
12
  *
13
- * @example```typescript
13
+ * @example
14
+ * ```typescript
14
15
  * const snsForwardPath = '/your/route/sns'; // default /sns
15
16
  * const snsForwardMethod = 'POST'; // default POST
16
17
  * const adapter = new SNSAdapter({ snsForwardPath, snsForwardMethod });
17
18
  * ```
19
+ *
20
+ * @breadcrumb Adapters / AWS / SNSAdapter
21
+ * @public
18
22
  */
19
23
  class SNSAdapter {
20
24
  //#region Constructor
21
25
  /**
22
26
  * Default constructor
23
27
  *
24
- * @param options The options to customize the {@link SNSAdapter}
28
+ * @param options - The options to customize the {@link SNSAdapter}
25
29
  */
26
30
  constructor(options) {
27
31
  this.options = options;
@@ -29,13 +33,13 @@ class SNSAdapter {
29
33
  //#endregion
30
34
  //#region Public Methods
31
35
  /**
32
- * @inheritDoc
36
+ * {@inheritDoc}
33
37
  */
34
38
  getAdapterName() {
35
39
  return SNSAdapter.name;
36
40
  }
37
41
  /**
38
- * @inheritDoc
42
+ * {@inheritDoc}
39
43
  */
40
44
  canHandle(event) {
41
45
  var _a;
@@ -46,7 +50,7 @@ class SNSAdapter {
46
50
  return eventSource === 'aws:sns';
47
51
  }
48
52
  /**
49
- * @inheritDoc
53
+ * {@inheritDoc}
50
54
  */
51
55
  getRequest(event) {
52
56
  var _a, _b;
@@ -66,16 +70,17 @@ class SNSAdapter {
66
70
  };
67
71
  }
68
72
  /**
69
- * @inheritDoc
73
+ * {@inheritDoc}
70
74
  */
71
75
  getResponse() {
72
76
  return core_1.EmptyResponse;
73
77
  }
74
78
  /**
75
- * @inheritDoc
79
+ * {@inheritDoc}
76
80
  */
77
81
  onErrorWhileForwarding({ error, delegatedResolver, }) {
78
82
  delegatedResolver.fail(error);
79
83
  }
80
84
  }
81
85
  exports.SNSAdapter = SNSAdapter;
86
+ //# sourceMappingURL=sns.adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sns.adapter.js","sourceRoot":"","sources":["../../../src/adapters/aws/sns.adapter.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;AAIjB,qCAKoB;AA0BpB;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,UAAU;IAGrB,qBAAqB;IAErB;;;;OAIG;IACH,YAA+B,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;IAAG,CAAC;IAE9D,YAAY;IAEZ,wBAAwB;IAExB;;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