@h4ad/serverless-adapter 2.17.0 → 3.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 (436) hide show
  1. package/README.md +7 -0
  2. package/lib/@types/binary-settings.d.ts +3 -5
  3. package/lib/@types/binary-settings.d.ts.map +1 -0
  4. package/lib/@types/binary-settings.js +2 -11
  5. package/lib/@types/binary-settings.js.map +1 -1
  6. package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +1 -1
  7. package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts.map +1 -0
  8. package/lib/@types/digital-ocean/digital-ocean-http-event.js +2 -7
  9. package/lib/@types/digital-ocean/digital-ocean-http-event.js.map +1 -1
  10. package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts +1 -1
  11. package/lib/@types/digital-ocean/digital-ocean-http-response.d.ts.map +1 -0
  12. package/lib/@types/digital-ocean/digital-ocean-http-response.js +2 -7
  13. package/lib/@types/digital-ocean/digital-ocean-http-response.js.map +1 -1
  14. package/lib/@types/digital-ocean/index.d.ts +1 -0
  15. package/lib/@types/digital-ocean/index.d.ts.map +1 -0
  16. package/lib/@types/digital-ocean/index.js +2 -18
  17. package/lib/@types/digital-ocean/index.js.map +1 -1
  18. package/lib/@types/headers.d.ts +4 -6
  19. package/lib/@types/headers.d.ts.map +1 -0
  20. package/lib/@types/headers.js +2 -11
  21. package/lib/@types/headers.js.map +1 -1
  22. package/lib/@types/helpers.d.ts +2 -2
  23. package/lib/@types/helpers.d.ts.map +1 -0
  24. package/lib/@types/helpers.js +2 -6
  25. package/lib/@types/helpers.js.map +1 -1
  26. package/lib/@types/huawei/huawei-api-gateway-event.d.ts +3 -6
  27. package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
  28. package/lib/@types/huawei/huawei-api-gateway-event.js +2 -14
  29. package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -1
  30. package/lib/@types/huawei/huawei-api-gateway-response.d.ts +1 -1
  31. package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
  32. package/lib/@types/huawei/huawei-api-gateway-response.js +2 -7
  33. package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -1
  34. package/lib/@types/huawei/huawei-context.d.ts +16 -31
  35. package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
  36. package/lib/@types/huawei/huawei-context.js +2 -36
  37. package/lib/@types/huawei/huawei-context.js.map +1 -1
  38. package/lib/@types/huawei/index.d.ts +1 -0
  39. package/lib/@types/huawei/index.d.ts.map +1 -0
  40. package/lib/@types/huawei/index.js +2 -20
  41. package/lib/@types/huawei/index.js.map +1 -1
  42. package/lib/@types/index.d.ts +1 -0
  43. package/lib/@types/index.d.ts.map +1 -0
  44. package/lib/@types/index.js +2 -20
  45. package/lib/@types/index.js.map +1 -1
  46. package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts +2 -2
  47. package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts.map +1 -0
  48. package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js +2 -86
  49. package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js.map +1 -1
  50. package/lib/adapters/apollo-server/index.d.ts +1 -0
  51. package/lib/adapters/apollo-server/index.d.ts.map +1 -0
  52. package/lib/adapters/apollo-server/index.js +2 -18
  53. package/lib/adapters/apollo-server/index.js.map +1 -1
  54. package/lib/adapters/aws/alb.adapter.d.ts +6 -1
  55. package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
  56. package/lib/adapters/aws/alb.adapter.js +2 -129
  57. package/lib/adapters/aws/alb.adapter.js.map +1 -1
  58. package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +6 -1
  59. package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
  60. package/lib/adapters/aws/api-gateway-v1.adapter.js +2 -140
  61. package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -1
  62. package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +6 -1
  63. package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
  64. package/lib/adapters/aws/api-gateway-v2.adapter.js +2 -134
  65. package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -1
  66. package/lib/adapters/aws/base/aws-simple-adapter.d.ts +3 -5
  67. package/lib/adapters/aws/base/aws-simple-adapter.d.ts.map +1 -0
  68. package/lib/adapters/aws/base/aws-simple-adapter.js +2 -99
  69. package/lib/adapters/aws/base/aws-simple-adapter.js.map +1 -1
  70. package/lib/adapters/aws/base/index.d.ts +1 -0
  71. package/lib/adapters/aws/base/index.d.ts.map +1 -0
  72. package/lib/adapters/aws/base/index.js +2 -18
  73. package/lib/adapters/aws/base/index.js.map +1 -1
  74. package/lib/adapters/aws/dynamodb.adapter.d.ts +1 -1
  75. package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
  76. package/lib/adapters/aws/dynamodb.adapter.js +2 -64
  77. package/lib/adapters/aws/dynamodb.adapter.js.map +1 -1
  78. package/lib/adapters/aws/event-bridge.adapter.d.ts +2 -3
  79. package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
  80. package/lib/adapters/aws/event-bridge.adapter.js +2 -75
  81. package/lib/adapters/aws/event-bridge.adapter.js.map +1 -1
  82. package/lib/adapters/aws/index.d.ts +2 -0
  83. package/lib/adapters/aws/index.d.ts.map +1 -0
  84. package/lib/adapters/aws/index.js +2 -27
  85. package/lib/adapters/aws/index.js.map +1 -1
  86. package/lib/adapters/aws/lambda-edge.adapter.d.ts +5 -9
  87. package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
  88. package/lib/adapters/aws/lambda-edge.adapter.js +2 -284
  89. package/lib/adapters/aws/lambda-edge.adapter.js.map +1 -1
  90. package/lib/adapters/aws/request-lambda-edge.adapter.d.ts +131 -0
  91. package/lib/adapters/aws/request-lambda-edge.adapter.d.ts.map +1 -0
  92. package/lib/adapters/aws/request-lambda-edge.adapter.js +2 -0
  93. package/lib/adapters/aws/request-lambda-edge.adapter.js.map +1 -0
  94. package/lib/adapters/aws/s3.adapter.d.ts +2 -2
  95. package/lib/adapters/aws/s3.adapter.d.ts.map +1 -0
  96. package/lib/adapters/aws/s3.adapter.js +2 -63
  97. package/lib/adapters/aws/s3.adapter.js.map +1 -1
  98. package/lib/adapters/aws/sns.adapter.d.ts +2 -2
  99. package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
  100. package/lib/adapters/aws/sns.adapter.js +2 -63
  101. package/lib/adapters/aws/sns.adapter.js.map +1 -1
  102. package/lib/adapters/aws/sqs.adapter.d.ts +2 -2
  103. package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
  104. package/lib/adapters/aws/sqs.adapter.js +2 -64
  105. package/lib/adapters/aws/sqs.adapter.js.map +1 -1
  106. package/lib/adapters/azure/http-trigger-v4.adapter.d.ts +1 -1
  107. package/lib/adapters/azure/http-trigger-v4.adapter.d.ts.map +1 -0
  108. package/lib/adapters/azure/http-trigger-v4.adapter.js +2 -202
  109. package/lib/adapters/azure/http-trigger-v4.adapter.js.map +1 -1
  110. package/lib/adapters/azure/index.d.ts +1 -0
  111. package/lib/adapters/azure/index.d.ts.map +1 -0
  112. package/lib/adapters/azure/index.js +2 -18
  113. package/lib/adapters/azure/index.js.map +1 -1
  114. package/lib/adapters/digital-ocean/http-function.adapter.d.ts +1 -1
  115. package/lib/adapters/digital-ocean/http-function.adapter.d.ts.map +1 -0
  116. package/lib/adapters/digital-ocean/http-function.adapter.js +2 -118
  117. package/lib/adapters/digital-ocean/http-function.adapter.js.map +1 -1
  118. package/lib/adapters/digital-ocean/index.d.ts +1 -0
  119. package/lib/adapters/digital-ocean/index.d.ts.map +1 -0
  120. package/lib/adapters/digital-ocean/index.js +2 -18
  121. package/lib/adapters/digital-ocean/index.js.map +1 -1
  122. package/lib/adapters/dummy/dummy.adapter.d.ts +1 -0
  123. package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
  124. package/lib/adapters/dummy/dummy.adapter.js +2 -54
  125. package/lib/adapters/dummy/dummy.adapter.js.map +1 -1
  126. package/lib/adapters/dummy/index.d.ts +1 -0
  127. package/lib/adapters/dummy/index.d.ts.map +1 -0
  128. package/lib/adapters/dummy/index.js +2 -18
  129. package/lib/adapters/dummy/index.js.map +1 -1
  130. package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +1 -1
  131. package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
  132. package/lib/adapters/huawei/huawei-api-gateway.adapter.js +2 -126
  133. package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -1
  134. package/lib/adapters/huawei/index.d.ts +1 -0
  135. package/lib/adapters/huawei/index.d.ts.map +1 -0
  136. package/lib/adapters/huawei/index.js +2 -18
  137. package/lib/adapters/huawei/index.js.map +1 -1
  138. package/lib/contracts/adapter.contract.d.ts +1 -4
  139. package/lib/contracts/adapter.contract.d.ts.map +1 -0
  140. package/lib/contracts/adapter.contract.js +2 -18
  141. package/lib/contracts/adapter.contract.js.map +1 -1
  142. package/lib/contracts/framework.contract.d.ts +1 -1
  143. package/lib/contracts/framework.contract.d.ts.map +1 -0
  144. package/lib/contracts/framework.contract.js +2 -7
  145. package/lib/contracts/framework.contract.js.map +1 -1
  146. package/lib/contracts/handler.contract.d.ts +2 -3
  147. package/lib/contracts/handler.contract.d.ts.map +1 -0
  148. package/lib/contracts/handler.contract.js +2 -13
  149. package/lib/contracts/handler.contract.js.map +1 -1
  150. package/lib/contracts/index.d.ts +1 -0
  151. package/lib/contracts/index.d.ts.map +1 -0
  152. package/lib/contracts/index.js +2 -21
  153. package/lib/contracts/index.js.map +1 -1
  154. package/lib/contracts/resolver.contract.d.ts +4 -7
  155. package/lib/contracts/resolver.contract.d.ts.map +1 -0
  156. package/lib/contracts/resolver.contract.js +2 -15
  157. package/lib/contracts/resolver.contract.js.map +1 -1
  158. package/lib/core/base-handler.d.ts +1 -0
  159. package/lib/core/base-handler.d.ts.map +1 -0
  160. package/lib/core/base-handler.js +2 -67
  161. package/lib/core/base-handler.js.map +1 -1
  162. package/lib/core/constants.d.ts +4 -4
  163. package/lib/core/constants.d.ts.map +1 -0
  164. package/lib/core/constants.js +2 -33
  165. package/lib/core/constants.js.map +1 -1
  166. package/lib/core/current-invoke.d.ts +2 -2
  167. package/lib/core/current-invoke.d.ts.map +1 -0
  168. package/lib/core/current-invoke.js +2 -46
  169. package/lib/core/current-invoke.js.map +1 -1
  170. package/lib/core/event-body.d.ts +1 -0
  171. package/lib/core/event-body.d.ts.map +1 -0
  172. package/lib/core/event-body.js +2 -31
  173. package/lib/core/event-body.js.map +1 -1
  174. package/lib/core/headers.d.ts +26 -0
  175. package/lib/core/headers.d.ts.map +1 -0
  176. package/lib/core/headers.js +3 -97
  177. package/lib/core/headers.js.map +1 -1
  178. package/lib/core/index.d.ts +1 -0
  179. package/lib/core/index.d.ts.map +1 -0
  180. package/lib/core/index.js +2 -28
  181. package/lib/core/index.js.map +1 -1
  182. package/lib/core/is-binary.d.ts +8 -7
  183. package/lib/core/is-binary.d.ts.map +1 -0
  184. package/lib/core/is-binary.js +2 -118
  185. package/lib/core/is-binary.js.map +1 -1
  186. package/lib/core/logger.d.ts +5 -8
  187. package/lib/core/logger.d.ts.map +1 -0
  188. package/lib/core/logger.js +2 -115
  189. package/lib/core/logger.js.map +1 -1
  190. package/lib/core/no-op.d.ts +1 -0
  191. package/lib/core/no-op.d.ts.map +1 -0
  192. package/lib/core/no-op.js +2 -12
  193. package/lib/core/no-op.js.map +1 -1
  194. package/lib/core/optional.d.ts +1 -0
  195. package/lib/core/optional.d.ts.map +1 -0
  196. package/lib/core/optional.js +2 -31
  197. package/lib/core/optional.js.map +1 -1
  198. package/lib/core/path.d.ts +17 -0
  199. package/lib/core/path.d.ts.map +1 -0
  200. package/lib/core/path.js +2 -68
  201. package/lib/core/path.js.map +1 -1
  202. package/lib/core/stream.d.ts +1 -0
  203. package/lib/core/stream.d.ts.map +1 -0
  204. package/lib/core/stream.js +2 -63
  205. package/lib/core/stream.js.map +1 -1
  206. package/lib/frameworks/apollo-server/apollo-server.framework.d.ts +2 -4
  207. package/lib/frameworks/apollo-server/apollo-server.framework.d.ts.map +1 -0
  208. package/lib/frameworks/apollo-server/apollo-server.framework.js +2 -87
  209. package/lib/frameworks/apollo-server/apollo-server.framework.js.map +1 -1
  210. package/lib/frameworks/apollo-server/index.d.ts +1 -0
  211. package/lib/frameworks/apollo-server/index.d.ts.map +1 -0
  212. package/lib/frameworks/apollo-server/index.js +2 -18
  213. package/lib/frameworks/apollo-server/index.js.map +1 -1
  214. package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +2 -2
  215. package/lib/frameworks/body-parser/base-body-parser.framework.d.ts.map +1 -0
  216. package/lib/frameworks/body-parser/base-body-parser.framework.js +2 -66
  217. package/lib/frameworks/body-parser/base-body-parser.framework.js.map +1 -1
  218. package/lib/frameworks/body-parser/index.d.ts +1 -0
  219. package/lib/frameworks/body-parser/index.d.ts.map +1 -0
  220. package/lib/frameworks/body-parser/index.js +2 -22
  221. package/lib/frameworks/body-parser/index.js.map +1 -1
  222. package/lib/frameworks/body-parser/json-body-parser.framework.d.ts +2 -2
  223. package/lib/frameworks/body-parser/json-body-parser.framework.d.ts.map +1 -0
  224. package/lib/frameworks/body-parser/json-body-parser.framework.js +2 -29
  225. package/lib/frameworks/body-parser/json-body-parser.framework.js.map +1 -1
  226. package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts +2 -2
  227. package/lib/frameworks/body-parser/raw-body-parser.framework.d.ts.map +1 -0
  228. package/lib/frameworks/body-parser/raw-body-parser.framework.js +2 -29
  229. package/lib/frameworks/body-parser/raw-body-parser.framework.js.map +1 -1
  230. package/lib/frameworks/body-parser/text-body-parser.framework.d.ts +2 -2
  231. package/lib/frameworks/body-parser/text-body-parser.framework.d.ts.map +1 -0
  232. package/lib/frameworks/body-parser/text-body-parser.framework.js +2 -29
  233. package/lib/frameworks/body-parser/text-body-parser.framework.js.map +1 -1
  234. package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts +2 -2
  235. package/lib/frameworks/body-parser/urlencoded-body-parser.framework.d.ts.map +1 -0
  236. package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js +2 -29
  237. package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js.map +1 -1
  238. package/lib/frameworks/cors/cors.framework.d.ts +2 -2
  239. package/lib/frameworks/cors/cors.framework.d.ts.map +1 -0
  240. package/lib/frameworks/cors/cors.framework.js +3 -145
  241. package/lib/frameworks/cors/cors.framework.js.map +1 -1
  242. package/lib/frameworks/cors/index.d.ts +1 -0
  243. package/lib/frameworks/cors/index.d.ts.map +1 -0
  244. package/lib/frameworks/cors/index.js +2 -18
  245. package/lib/frameworks/cors/index.js.map +1 -1
  246. package/lib/frameworks/deepkit/http-deepkit.framework.d.ts +1 -0
  247. package/lib/frameworks/deepkit/http-deepkit.framework.d.ts.map +1 -0
  248. package/lib/frameworks/deepkit/http-deepkit.framework.js +2 -33
  249. package/lib/frameworks/deepkit/http-deepkit.framework.js.map +1 -1
  250. package/lib/frameworks/deepkit/index.d.ts +1 -0
  251. package/lib/frameworks/deepkit/index.d.ts.map +1 -0
  252. package/lib/frameworks/deepkit/index.js +2 -18
  253. package/lib/frameworks/deepkit/index.js.map +1 -1
  254. package/lib/frameworks/express/express.framework.d.ts +1 -0
  255. package/lib/frameworks/express/express.framework.d.ts.map +1 -0
  256. package/lib/frameworks/express/express.framework.js +2 -22
  257. package/lib/frameworks/express/express.framework.js.map +1 -1
  258. package/lib/frameworks/express/index.d.ts +1 -0
  259. package/lib/frameworks/express/index.d.ts.map +1 -0
  260. package/lib/frameworks/express/index.js +2 -18
  261. package/lib/frameworks/express/index.js.map +1 -1
  262. package/lib/frameworks/fastify/fastify.framework.d.ts +1 -0
  263. package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
  264. package/lib/frameworks/fastify/fastify.framework.js +2 -23
  265. package/lib/frameworks/fastify/fastify.framework.js.map +1 -1
  266. package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts +1 -0
  267. package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts.map +1 -0
  268. package/lib/frameworks/fastify/helpers/no-op-content-parser.js +2 -27
  269. package/lib/frameworks/fastify/helpers/no-op-content-parser.js.map +1 -1
  270. package/lib/frameworks/fastify/index.d.ts +1 -0
  271. package/lib/frameworks/fastify/index.d.ts.map +1 -0
  272. package/lib/frameworks/fastify/index.js +2 -18
  273. package/lib/frameworks/fastify/index.js.map +1 -1
  274. package/lib/frameworks/hapi/hapi.framework.d.ts +2 -1
  275. package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
  276. package/lib/frameworks/hapi/hapi.framework.js +2 -23
  277. package/lib/frameworks/hapi/hapi.framework.js.map +1 -1
  278. package/lib/frameworks/hapi/index.d.ts +1 -0
  279. package/lib/frameworks/hapi/index.d.ts.map +1 -0
  280. package/lib/frameworks/hapi/index.js +2 -18
  281. package/lib/frameworks/hapi/index.js.map +1 -1
  282. package/lib/frameworks/koa/index.d.ts +1 -0
  283. package/lib/frameworks/koa/index.d.ts.map +1 -0
  284. package/lib/frameworks/koa/index.js +2 -18
  285. package/lib/frameworks/koa/index.js.map +1 -1
  286. package/lib/frameworks/koa/koa.framework.d.ts +1 -0
  287. package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
  288. package/lib/frameworks/koa/koa.framework.js +2 -22
  289. package/lib/frameworks/koa/koa.framework.js.map +1 -1
  290. package/lib/frameworks/lazy/index.d.ts +1 -0
  291. package/lib/frameworks/lazy/index.d.ts.map +1 -0
  292. package/lib/frameworks/lazy/index.js +2 -18
  293. package/lib/frameworks/lazy/index.js.map +1 -1
  294. package/lib/frameworks/lazy/lazy.framework.d.ts +1 -0
  295. package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
  296. package/lib/frameworks/lazy/lazy.framework.js +2 -82
  297. package/lib/frameworks/lazy/lazy.framework.js.map +1 -1
  298. package/lib/frameworks/trpc/index.d.ts +1 -0
  299. package/lib/frameworks/trpc/index.d.ts.map +1 -0
  300. package/lib/frameworks/trpc/index.js +2 -18
  301. package/lib/frameworks/trpc/index.js.map +1 -1
  302. package/lib/frameworks/trpc/trpc.framework.d.ts +5 -7
  303. package/lib/frameworks/trpc/trpc.framework.d.ts.map +1 -0
  304. package/lib/frameworks/trpc/trpc.framework.js +2 -153
  305. package/lib/frameworks/trpc/trpc.framework.js.map +1 -1
  306. package/lib/handlers/aws/aws-stream.handler.d.ts +12 -6
  307. package/lib/handlers/aws/aws-stream.handler.d.ts.map +1 -0
  308. package/lib/handlers/aws/aws-stream.handler.js +2 -169
  309. package/lib/handlers/aws/aws-stream.handler.js.map +1 -1
  310. package/lib/handlers/aws/index.d.ts +1 -0
  311. package/lib/handlers/aws/index.d.ts.map +1 -0
  312. package/lib/handlers/aws/index.js +2 -18
  313. package/lib/handlers/aws/index.js.map +1 -1
  314. package/lib/handlers/azure/azure.handler.d.ts +1 -1
  315. package/lib/handlers/azure/azure.handler.d.ts.map +1 -0
  316. package/lib/handlers/azure/azure.handler.js +2 -74
  317. package/lib/handlers/azure/azure.handler.js.map +1 -1
  318. package/lib/handlers/azure/index.d.ts +1 -0
  319. package/lib/handlers/azure/index.d.ts.map +1 -0
  320. package/lib/handlers/azure/index.js +2 -18
  321. package/lib/handlers/azure/index.js.map +1 -1
  322. package/lib/handlers/base/index.d.ts +1 -0
  323. package/lib/handlers/base/index.d.ts.map +1 -0
  324. package/lib/handlers/base/index.js +2 -18
  325. package/lib/handlers/base/index.js.map +1 -1
  326. package/lib/handlers/base/raw-request.d.ts +1 -0
  327. package/lib/handlers/base/raw-request.d.ts.map +1 -0
  328. package/lib/handlers/base/raw-request.js +2 -65
  329. package/lib/handlers/base/raw-request.js.map +1 -1
  330. package/lib/handlers/default/default.handler.d.ts +1 -0
  331. package/lib/handlers/default/default.handler.d.ts.map +1 -0
  332. package/lib/handlers/default/default.handler.js +2 -191
  333. package/lib/handlers/default/default.handler.js.map +1 -1
  334. package/lib/handlers/default/index.d.ts +1 -0
  335. package/lib/handlers/default/index.d.ts.map +1 -0
  336. package/lib/handlers/default/index.js +2 -18
  337. package/lib/handlers/default/index.js.map +1 -1
  338. package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +1 -0
  339. package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts.map +1 -0
  340. package/lib/handlers/digital-ocean/digital-ocean.handler.js +2 -34
  341. package/lib/handlers/digital-ocean/digital-ocean.handler.js.map +1 -1
  342. package/lib/handlers/digital-ocean/index.d.ts +1 -0
  343. package/lib/handlers/digital-ocean/index.d.ts.map +1 -0
  344. package/lib/handlers/digital-ocean/index.js +2 -18
  345. package/lib/handlers/digital-ocean/index.js.map +1 -1
  346. package/lib/handlers/firebase/http-firebase-v2.handler.d.ts +1 -0
  347. package/lib/handlers/firebase/http-firebase-v2.handler.d.ts.map +1 -0
  348. package/lib/handlers/firebase/http-firebase-v2.handler.js +2 -50
  349. package/lib/handlers/firebase/http-firebase-v2.handler.js.map +1 -1
  350. package/lib/handlers/firebase/http-firebase.handler.d.ts +1 -0
  351. package/lib/handlers/firebase/http-firebase.handler.d.ts.map +1 -0
  352. package/lib/handlers/firebase/http-firebase.handler.js +2 -27
  353. package/lib/handlers/firebase/http-firebase.handler.js.map +1 -1
  354. package/lib/handlers/firebase/index.d.ts +1 -0
  355. package/lib/handlers/firebase/index.d.ts.map +1 -0
  356. package/lib/handlers/firebase/index.js +2 -19
  357. package/lib/handlers/firebase/index.js.map +1 -1
  358. package/lib/handlers/gcp/gcp.handler.d.ts +2 -1
  359. package/lib/handlers/gcp/gcp.handler.d.ts.map +1 -0
  360. package/lib/handlers/gcp/gcp.handler.js +2 -40
  361. package/lib/handlers/gcp/gcp.handler.js.map +1 -1
  362. package/lib/handlers/gcp/index.d.ts +1 -0
  363. package/lib/handlers/gcp/index.d.ts.map +1 -0
  364. package/lib/handlers/gcp/index.js +2 -18
  365. package/lib/handlers/gcp/index.js.map +1 -1
  366. package/lib/handlers/huawei/http-huawei.handler.d.ts +2 -2
  367. package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
  368. package/lib/handlers/huawei/http-huawei.handler.js +2 -106
  369. package/lib/handlers/huawei/http-huawei.handler.js.map +1 -1
  370. package/lib/handlers/huawei/index.d.ts +1 -0
  371. package/lib/handlers/huawei/index.d.ts.map +1 -0
  372. package/lib/handlers/huawei/index.js +2 -18
  373. package/lib/handlers/huawei/index.js.map +1 -1
  374. package/lib/index.d.ts +1 -0
  375. package/lib/index.d.ts.map +1 -0
  376. package/lib/index.doc.js +2 -0
  377. package/lib/index.doc.js.map +1 -0
  378. package/lib/index.js +2 -22
  379. package/lib/index.js.map +1 -1
  380. package/lib/network/index.d.ts +1 -0
  381. package/lib/network/index.d.ts.map +1 -0
  382. package/lib/network/index.js +2 -21
  383. package/lib/network/index.js.map +1 -1
  384. package/lib/network/request.d.ts +1 -1
  385. package/lib/network/request.d.ts.map +1 -0
  386. package/lib/network/request.js +2 -46
  387. package/lib/network/request.js.map +1 -1
  388. package/lib/network/response-stream.d.ts +1 -1
  389. package/lib/network/response-stream.d.ts.map +1 -0
  390. package/lib/network/response-stream.js +7 -88
  391. package/lib/network/response-stream.js.map +1 -1
  392. package/lib/network/response.d.ts +1 -1
  393. package/lib/network/response.d.ts.map +1 -0
  394. package/lib/network/response.js +4 -127
  395. package/lib/network/response.js.map +1 -1
  396. package/lib/network/utils.d.ts +2 -0
  397. package/lib/network/utils.d.ts.map +1 -0
  398. package/lib/network/utils.js +2 -21
  399. package/lib/network/utils.js.map +1 -1
  400. package/lib/resolvers/aws-context/aws-context.resolver.d.ts +1 -0
  401. package/lib/resolvers/aws-context/aws-context.resolver.d.ts.map +1 -0
  402. package/lib/resolvers/aws-context/aws-context.resolver.js +2 -59
  403. package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -1
  404. package/lib/resolvers/aws-context/index.d.ts +1 -0
  405. package/lib/resolvers/aws-context/index.d.ts.map +1 -0
  406. package/lib/resolvers/aws-context/index.js +2 -18
  407. package/lib/resolvers/aws-context/index.js.map +1 -1
  408. package/lib/resolvers/callback/callback.resolver.d.ts +2 -2
  409. package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
  410. package/lib/resolvers/callback/callback.resolver.js +2 -53
  411. package/lib/resolvers/callback/callback.resolver.js.map +1 -1
  412. package/lib/resolvers/callback/index.d.ts +1 -0
  413. package/lib/resolvers/callback/index.d.ts.map +1 -0
  414. package/lib/resolvers/callback/index.js +2 -18
  415. package/lib/resolvers/callback/index.js.map +1 -1
  416. package/lib/resolvers/dummy/dummy.resolver.d.ts +1 -0
  417. package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
  418. package/lib/resolvers/dummy/dummy.resolver.js +2 -24
  419. package/lib/resolvers/dummy/dummy.resolver.js.map +1 -1
  420. package/lib/resolvers/dummy/index.d.ts +1 -0
  421. package/lib/resolvers/dummy/index.d.ts.map +1 -0
  422. package/lib/resolvers/dummy/index.js +2 -18
  423. package/lib/resolvers/dummy/index.js.map +1 -1
  424. package/lib/resolvers/promise/index.d.ts +1 -0
  425. package/lib/resolvers/promise/index.d.ts.map +1 -0
  426. package/lib/resolvers/promise/index.js +2 -18
  427. package/lib/resolvers/promise/index.js.map +1 -1
  428. package/lib/resolvers/promise/promise.resolver.d.ts +1 -0
  429. package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
  430. package/lib/resolvers/promise/promise.resolver.js +2 -48
  431. package/lib/resolvers/promise/promise.resolver.js.map +1 -1
  432. package/lib/serverless-adapter.d.ts +1 -0
  433. package/lib/serverless-adapter.d.ts.map +1 -0
  434. package/lib/serverless-adapter.js +2 -176
  435. package/lib/serverless-adapter.js.map +1 -1
  436. package/package.json +60 -79
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.contract.js","sourceRoot":"","sources":["../../src/contracts/adapter.contract.ts"],"names":[],"mappings":";;;0CAEqD,WAAW;wCAAX,WAAW;+BACxC,SAAS;yCAEC,qBAAqB;;AADvD,wCAAgD"}
1
+ {"version":3,"file":"adapter.contract.js","sources":["../../src/contracts/adapter.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { BothValueHeaders, SingleValueHeaders } from '../@types';\nimport { ILogger } from '../core';\nimport { ServerlessResponse } from '../network';\nimport { DelegatedResolver } from './resolver.contract';\n\n//#endregion\n\n/**\n * The request interface used to bridge any event source to the framework.\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface AdapterRequest {\n /**\n * The HTTP Method to use to create the request to the framework\n */\n method: string;\n\n /**\n * The path to use to create the request to the framework\n */\n path: string;\n\n /**\n * The headers to use to create the request to the framework\n */\n headers: SingleValueHeaders;\n\n /**\n * The body as buffer to use to create the request to the framework\n */\n body?: Buffer;\n\n /**\n * The remote address (client ip) to use to create the request to the framework\n */\n remoteAddress?: string;\n\n /**\n * The address of the event source (used in Lambda\\@edge)\n *\n * @deprecated It is no longer used in the library and will be removed in the next major release.\n */\n host?: string;\n\n /**\n * The address of the event source (used in Lambda\\@edge)\n *\n * @deprecated It is no longer used in the library and will be removed in the next major release.\n */\n hostname?: string;\n}\n\n/**\n * The props of the method that get the response from the framework and transform it into a format that the event source can handle\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface GetResponseAdapterProps<TEvent> {\n /**\n * The event sent by the serverless\n */\n event: TEvent;\n\n /**\n * The framework {@link ServerlessResponse | response}.\n *\n * @remarks It can be optional, as this method can be used when an error occurs during the handling of the request by the framework.\n */\n response?: ServerlessResponse;\n\n /**\n * The framework response status code\n */\n statusCode: number;\n\n /**\n * The framework response body\n */\n body: string;\n\n /**\n * The framework response headers\n */\n headers: BothValueHeaders;\n\n /**\n * Indicates whether the response is base64 encoded or not\n */\n isBase64Encoded: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The props of the method that handle the response when an error occurs while forwarding the request to the framework\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface OnErrorProps<TEvent, TResponse> {\n /**\n * The event sent by the serverless\n */\n event: TEvent;\n\n /**\n * The error throwed during forwarding\n */\n error: Error;\n\n /**\n * The instance of the resolver\n */\n delegatedResolver: DelegatedResolver<TResponse>;\n\n /**\n * Indicates whether to forward the (error.stack) or not to the client\n */\n respondWithErrors: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n}\n\n/**\n * The interface that represents a contract between the adapter and the actual implementation of the adapter.\n *\n * @breadcrumb Contracts / AdapterContract\n * @public\n */\nexport interface AdapterContract<TEvent, TContext, TResponse> {\n /**\n * Get the adapter name\n */\n getAdapterName(): string;\n\n /**\n * Decide if this adapter can handle a request based in the event payload\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by the serverless\n * @param log - The instance of logger\n */\n canHandle(event: unknown, context: TContext, log: ILogger): boolean;\n\n /**\n * Maps the serverless payload to an actual request that a framework can handle\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by the serverless\n * @param log - The instance of logger\n */\n getRequest(event: TEvent, context: TContext, log: ILogger): AdapterRequest;\n\n /**\n * Maps the response of the framework to a payload that serverless can handle\n *\n * @param props - The props sent by serverless\n */\n getResponse(props: GetResponseAdapterProps<TEvent>): TResponse;\n\n /**\n * When an error occurs while forwarding the request to the framework\n *\n * @remarks You must call resolver.fail or resolver.succeed when implementing this method.\n */\n onErrorWhileForwarding(props: OnErrorProps<TEvent, TResponse>): void;\n}\n"],"names":[],"mappings":"kiBAAA,yBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,wBAAA"}
@@ -16,4 +16,4 @@ export interface FrameworkContract<TApp> {
16
16
  */
17
17
  sendRequest(app: TApp, request: IncomingMessage, response: ServerResponse): void;
18
18
  }
19
- export declare type __ΩFrameworkContract = any[];
19
+ //# sourceMappingURL=framework.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/framework.contract.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI;IACrC;;;;;;OAMG;IACH,WAAW,CACT,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,GACvB,IAAI,CAAC;CACT"}
@@ -1,7 +1,2 @@
1
- "use strict";
2
- //#region Imports
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.__ΩFrameworkContract = void 0;
5
- const __ΩFrameworkContract = ['TApp', 'app', 'request', 'response', 'sendRequest', 'b!PPe#!2"!2#!2$$1%M'];
6
- exports.__ΩFrameworkContract = __ΩFrameworkContract;
7
- //# sourceMappingURL=framework.contract.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),framework_contract_exports={};module.exports=__toCommonJS(framework_contract_exports);
2
+ //# sourceMappingURL=framework.contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"framework.contract.js","sourceRoot":"","sources":["../../src/contracts/framework.contract.ts"],"names":[],"mappings":";AAAA,iBAAiB"}
1
+ {"version":3,"file":"framework.contract.js","sources":["../../src/contracts/framework.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { IncomingMessage, ServerResponse } from 'http';\n\n//#endregion\n\n/**\n * The interface that represents a contract between the framework and the framework implementation\n *\n * @breadcrumb Contracts\n * @public\n */\nexport interface FrameworkContract<TApp> {\n /**\n * Send the request and response objects to the framework\n *\n * @param app - The instance of your app (Express, Fastify, Koa, etc...)\n * @param request - The request object that will be forward to your app\n * @param response - The response object that will be forward to your app to output the response\n */\n sendRequest(\n app: TApp,\n request: IncomingMessage,\n response: ServerResponse,\n ): void;\n}\n"],"names":[],"mappings":"kiBAAA,2BAAA,CAAA,EAAA,OAAA,QAAA,aAAA,0BAAA"}
@@ -9,7 +9,7 @@ import { ResolverContract } from './resolver.contract';
9
9
  * @breadcrumb Contracts / HandlerContract
10
10
  * @public
11
11
  */
12
- export declare type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;
12
+ export type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;
13
13
  /**
14
14
  * The interface that represents the contract between the handler and the real implementation
15
15
  *
@@ -22,5 +22,4 @@ export interface HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, T
22
22
  */
23
23
  getHandler(app: TApp, framework: FrameworkContract<TApp>, adapters: AdapterContract<TEvent, TContext, TResponse>[], resolverFactory: ResolverContract<TEvent, TContext, TCallback, TResponse, TReturn>, binarySettings: BinarySettings, respondWithErrors: boolean, log: ILogger): ServerlessHandler<TReturn>;
24
24
  }
25
- export declare type __ΩServerlessHandler = any[];
26
- export declare type __ΩHandlerContract = any[];
25
+ //# sourceMappingURL=handler.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/handler.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvD;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAC9B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO;IAEP;;OAEG;IACH,UAAU,CACR,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,eAAe,EAAE,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACR,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC,CAAC;CAC/B"}
@@ -1,13 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__ΩHandlerContract = exports.__ΩServerlessHandler = void 0;
4
- const { __ΩFrameworkContract } = require('./framework.contract');
5
- const { __ΩAdapterContract } = require('./adapter.contract');
6
- const { __ΩResolverContract } = require('./resolver.contract');
7
- const { __ΩBinarySettings } = require('../@types');
8
- const { __ΩILogger } = require('../core');
9
- const __ΩServerlessHandler = ['TReturn', 'args', '', 'b!P"@2"e"!/#'];
10
- exports.__ΩServerlessHandler = __ΩServerlessHandler;
11
- const __ΩHandlerContract = ['TApp', 'TEvent', 'TContext', 'TCallback', 'TResponse', 'TReturn', 'app', () => __ΩFrameworkContract, 'framework', () => __ΩAdapterContract, 'adapters', () => __ΩResolverContract, 'resolverFactory', () => __ΩBinarySettings, 'binarySettings', 'respondWithErrors', () => __ΩILogger, 'log', () => __ΩServerlessHandler, 'getHandler', 'b!b"b#b$b%b&PPe#!2\'e#!o("2)e#"e##e#%o*$F2+e#"e##e#$e#%e#&o,&2-n.2/)20n122e#&o3"14M'];
12
- exports.__ΩHandlerContract = __ΩHandlerContract;
13
- //# sourceMappingURL=handler.contract.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),handler_contract_exports={};module.exports=__toCommonJS(handler_contract_exports);
2
+ //# sourceMappingURL=handler.contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.contract.js","sourceRoot":"","sources":["../../src/contracts/handler.contract.ts"],"names":[],"mappings":";;;yCAKkC,sBAAsB;uCADxB,oBAAoB;wCAEnB,qBAAqB;sCAJvB,WAAW;+BAClB,SAAS"}
1
+ {"version":3,"file":"handler.contract.js","sources":["../../src/contracts/handler.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { BinarySettings } from '../@types';\nimport { ILogger } from '../core';\nimport { AdapterContract } from './adapter.contract';\nimport { FrameworkContract } from './framework.contract';\nimport { ResolverContract } from './resolver.contract';\n\n//#endregion\n\n/**\n * The function used to handle serverless requests\n *\n * @breadcrumb Contracts / HandlerContract\n * @public\n */\nexport type ServerlessHandler<TReturn> = (...args: any[]) => TReturn;\n\n/**\n * The interface that represents the contract between the handler and the real implementation\n *\n * @breadcrumb Contracts / HandlerContract\n * @public\n */\nexport interface HandlerContract<\n TApp,\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> {\n /**\n * Get the handler that will handle serverless requests\n */\n getHandler(\n app: TApp,\n framework: FrameworkContract<TApp>,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n resolverFactory: ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn\n >,\n binarySettings: BinarySettings,\n respondWithErrors: boolean,\n log: ILogger,\n ): ServerlessHandler<TReturn>;\n}\n"],"names":[],"mappings":"kiBAAA,yBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,wBAAA"}
@@ -2,3 +2,4 @@ export * from './adapter.contract';
2
2
  export * from './framework.contract';
3
3
  export * from './handler.contract';
4
4
  export * from './resolver.contract';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -1,21 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./adapter.contract"), exports);
18
- __exportStar(require("./framework.contract"), exports);
19
- __exportStar(require("./handler.contract"), exports);
20
- __exportStar(require("./resolver.contract"), exports);
21
- //# sourceMappingURL=index.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__reExport=(target,mod,secondTarget)=>(__copyProps(target,mod,"default"),secondTarget&&__copyProps(secondTarget,mod,"default")),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),contracts_exports={};module.exports=__toCommonJS(contracts_exports);__reExport(contracts_exports,require("./adapter.contract"),module.exports);__reExport(contracts_exports,require("./framework.contract"),module.exports);__reExport(contracts_exports,require("./handler.contract"),module.exports);__reExport(contracts_exports,require("./resolver.contract"),module.exports);
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC"}
1
+ {"version":3,"file":"index.js","sources":["../../src/contracts/index.ts"],"sourcesContent":["export * from './adapter.contract';\nexport * from './framework.contract';\nexport * from './handler.contract';\nexport * from './resolver.contract';\n"],"names":[],"mappings":"kqBAAA,kBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,iBAAA,EAAA,WAAA,kBAAc,QAAd,oBAAA,EAAA,OAAA,OAAA,EACA,WAAA,kBAAc,QADd,sBAAA,EAAA,OAAA,OAAA,EAEA,WAAA,kBAAc,QAFd,oBAAA,EAAA,OAAA,OAAA,EAGA,WAAA,kBAAc,QAHd,qBAAA,EAAA,OAAA,OAAA"}
@@ -6,7 +6,7 @@ import { AdapterContract } from './adapter.contract';
6
6
  * @breadcrumb Contracts / ResolverContract
7
7
  * @public
8
8
  */
9
- export declare type Resolver<TResponse, TReturn> = {
9
+ export type Resolver<TResponse, TReturn> = {
10
10
  /**
11
11
  * The method that will perform the task of forwarding the request to the framework and waiting for the promise to be resolved with the response
12
12
  *
@@ -20,7 +20,7 @@ export declare type Resolver<TResponse, TReturn> = {
20
20
  * @breadcrumb Contracts / ResolverContract
21
21
  * @public
22
22
  */
23
- export declare type DelegatedResolver<TResponse> = {
23
+ export type DelegatedResolver<TResponse> = {
24
24
  /**
25
25
  * Send the success response to the client
26
26
  *
@@ -40,7 +40,7 @@ export declare type DelegatedResolver<TResponse> = {
40
40
  * @breadcrumb Contracts / ResolverContract
41
41
  * @public
42
42
  */
43
- export declare type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
43
+ export type ResolverProps<TEvent, TContext, TCallback, TResponse> = {
44
44
  /**
45
45
  * The event sent by the serverless environment
46
46
  */
@@ -80,7 +80,4 @@ export interface ResolverContract<TEvent, TContext, TCallback, TResponse, TRetur
80
80
  */
81
81
  createResolver(props: ResolverProps<TEvent, TContext, TCallback, TResponse>): Resolver<TResponse, TReturn>;
82
82
  }
83
- export declare type __ΩResolver = any[];
84
- export declare type __ΩDelegatedResolver = any[];
85
- export declare type __ΩResolverProps = any[];
86
- export declare type __ΩResolverContract = any[];
83
+ //# sourceMappingURL=resolver.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.contract.d.ts","sourceRoot":"","sources":["../../src/contracts/resolver.contract.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,SAAS,EAAE,OAAO,IAAI;IACzC;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;CAC9C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,IAAI;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,IAAI,CAAC;IAEvC;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,IAAI;IAClE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEtD;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO;IAEP;;;;OAIG;IACH,cAAc,CACZ,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,GAC3D,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CACjC"}
@@ -1,15 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.__ΩResolverContract = exports.__ΩResolverProps = exports.__ΩDelegatedResolver = exports.__ΩResolver = void 0;
4
- const { __ΩILogger } = require('../core');
5
- const { __ΩAdapterContract } = require('./adapter.contract');
6
- const __ΩError = ['name', 'message', 'stack', 'P&4!&4"&4#8M'];
7
- const __ΩResolver = ['TResponse', 'TReturn', '', 'task', 'run', 'b!b"PPPe$!`/#2$e#"1%M'];
8
- exports.__ΩResolver = __ΩResolver;
9
- const __ΩDelegatedResolver = ['TResponse', 'response', '', 'succeed', () => __ΩError, 'error', 'fail', 'b!PPe#!2"$/#4$Pn%2&$/#4\'M'];
10
- exports.__ΩDelegatedResolver = __ΩDelegatedResolver;
11
- const __ΩResolverProps = ['TEvent', 'TContext', 'TCallback', 'TResponse', 'event', 'respondWithErrors', () => __ΩILogger, 'log', () => __ΩAdapterContract, 'adapter', 'context', 'callback', 'b!b"b#b$Pe"!4%)4&n\'4(e"!e""e"$o)$4*e""4+8e"#4,8M'];
12
- exports.__ΩResolverProps = __ΩResolverProps;
13
- const __ΩResolverContract = ['TEvent', 'TContext', 'TCallback', 'TResponse', 'TReturn', () => __ΩResolverProps, 'props', () => __ΩResolver, 'createResolver', 'b!b"b#b$b%PPe#!e#"e##e#$o&%2\'e#$e#%o(#1)M'];
14
- exports.__ΩResolverContract = __ΩResolverContract;
15
- //# sourceMappingURL=resolver.contract.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),resolver_contract_exports={};module.exports=__toCommonJS(resolver_contract_exports);
2
+ //# sourceMappingURL=resolver.contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.contract.js","sourceRoot":"","sources":["../../src/contracts/resolver.contract.ts"],"names":[],"mappings":";;;+BAEwB,SAAS;uCACD,oBAAoB"}
1
+ {"version":3,"file":"resolver.contract.js","sources":["../../src/contracts/resolver.contract.ts"],"sourcesContent":["//#region Imports\n\nimport { ILogger } from '../core';\nimport { AdapterContract } from './adapter.contract';\n\n//#endregion\n\n/**\n * The type that represents a resolver used to send the response, error or success, to the client\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type Resolver<TResponse, TReturn> = {\n /**\n * The method that will perform the task of forwarding the request to the framework and waiting for the promise to be resolved with the response\n *\n * @param task - The task to be executed\n */\n run(task: () => Promise<TResponse>): TReturn;\n};\n\n/**\n * The type that represents a delegate resolver that is passed to the adapter to handle what to do when an error occurs during forwarding.\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type DelegatedResolver<TResponse> = {\n /**\n * Send the success response to the client\n *\n * @param success - The serverless response\n */\n succeed: (response: TResponse) => void;\n\n /**\n * Send the error response to the client\n *\n * @param error - The error object\n */\n fail: (error: Error) => void;\n};\n\n/**\n * The createResolver contract props\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport type ResolverProps<TEvent, TContext, TCallback, TResponse> = {\n /**\n * The event sent by the serverless environment\n */\n event: TEvent;\n\n /**\n * Indicates whether to forward the (error.stack) or not to the client\n */\n respondWithErrors: boolean;\n\n /**\n * The instance of the logger\n */\n log: ILogger;\n\n /**\n * The instance of the adapter\n */\n adapter: AdapterContract<TEvent, TContext, TResponse>;\n\n /**\n * The context sent by serverless\n */\n context?: TContext;\n\n /**\n * The callback sent by serverless\n */\n callback?: TCallback;\n};\n\n/**\n * The interface that represents the contract used to send the response to the client\n *\n * @breadcrumb Contracts / ResolverContract\n * @public\n */\nexport interface ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> {\n /**\n * Create the resolver based on the context, callback or promise\n *\n * @param props - The props used to create the resolver\n */\n createResolver(\n props: ResolverProps<TEvent, TContext, TCallback, TResponse>,\n ): Resolver<TResponse, TReturn>;\n}\n"],"names":[],"mappings":"kiBAAA,0BAAA,CAAA,EAAA,OAAA,QAAA,aAAA,yBAAA"}
@@ -29,3 +29,4 @@ export declare abstract class BaseHandler<TApp, TEvent, TContext, TCallback, TRe
29
29
  */
30
30
  protected getServerlessRequestResponseFromAdapterRequest(requestValues: AdapterRequest): [request: ServerlessRequest, response: ServerlessResponse];
31
31
  }
32
+ //# sourceMappingURL=base-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../src/core/base-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC;;;;;GAKG;AACH,8BAAsB,WAAW,CAC/B,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACP,YACE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;IAIxE;;OAEG;aACa,UAAU,CACxB,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAClC,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,eAAe,EAAE,gBAAgB,CAC/B,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,CACR,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,OAAO,GACX,iBAAiB,CAAC,OAAO,CAAC;IAM7B;;;;;;;OAOG;IACH,SAAS,CAAC,2BAA2B,CACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACxD,GAAG,EAAE,OAAO,GACX,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC;IAsB/C;;;;OAIG;IACH,SAAS,CAAC,8CAA8C,CACtD,aAAa,EAAE,cAAc,GAC5B,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,CAAC;CAiB9D"}
@@ -1,67 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseHandler = void 0;
4
- const { __ΩFrameworkContract } = require('../contracts');
5
- const { __ΩAdapterContract } = require('../contracts');
6
- const { __ΩResolverContract } = require('../contracts');
7
- const { __ΩBinarySettings } = require('../@types');
8
- const { __ΩILogger } = require('./index');
9
- const { __ΩServerlessHandler } = require('../contracts');
10
- const { __ΩAdapterRequest } = require('../contracts');
11
- function __assignType(fn, args) {
12
- fn.__type = args;
13
- return fn;
14
- }
15
- const network_1 = require("../network");
16
- //#endregion
17
- /**
18
- * The abstract class that represents the base class for a handler
19
- *
20
- * @breadcrumb Core
21
- * @public
22
- */
23
- class BaseHandler {
24
- //#endregion
25
- //#region Protected Methods
26
- /**
27
- * Get the adapter to handle a specific event and context
28
- *
29
- * @param event - The event sent by serverless
30
- * @param context - The context sent by serverless
31
- * @param adapters - The list of adapters
32
- * @param log - The instance of logger
33
- */
34
- getAdapterByEventAndContext(event, context, adapters, log) {
35
- const resolvedAdapters = adapters.filter(__assignType(adapter => adapter.canHandle(event, context, log), ['adapter', '', 'P"2!"/"']));
36
- if (resolvedAdapters.length === 0) {
37
- throw new Error("SERVERLESS_ADAPTER: Couldn't find adapter to handle this event.");
38
- }
39
- if (resolvedAdapters.length > 1) {
40
- throw new Error(`SERVERLESS_ADAPTER: Two or more adapters was resolved by the event, the adapters are: ${adapters
41
- .map(__assignType(adapter => adapter.getAdapterName(), ['adapter', '', 'P"2!"/"']))
42
- .join(', ')}.`);
43
- }
44
- return resolvedAdapters[0];
45
- }
46
- /**
47
- * Get serverless request and response frmo the adapter request
48
- *
49
- * @param requestValues - The request values from adapter
50
- */
51
- getServerlessRequestResponseFromAdapterRequest(requestValues) {
52
- const request = new network_1.ServerlessRequest({
53
- method: requestValues.method,
54
- headers: requestValues.headers,
55
- body: requestValues.body,
56
- remoteAddress: requestValues.remoteAddress,
57
- url: requestValues.path,
58
- });
59
- const response = new network_1.ServerlessResponse({
60
- method: requestValues.method,
61
- });
62
- return [request, response];
63
- }
64
- }
65
- exports.BaseHandler = BaseHandler;
66
- BaseHandler.__type = ['TApp', 'TEvent', 'TContext', 'TCallback', 'TResponse', 'TReturn', 'app', () => __ΩFrameworkContract, 'framework', () => __ΩAdapterContract, 'adapters', () => __ΩResolverContract, 'resolverFactory', () => __ΩBinarySettings, 'binarySettings', 'respondWithErrors', () => __ΩILogger, 'log', () => __ΩServerlessHandler, 'getHandler', 'event', 'context', () => __ΩAdapterContract, () => __ΩILogger, () => __ΩAdapterContract, 'getAdapterByEventAndContext', () => __ΩAdapterRequest, 'requestValues', () => network_1.ServerlessRequest, 'request', () => network_1.ServerlessResponse, 'response', 'getServerlessRequestResponseFromAdapterRequest', 'b!b"b#b$b%b&Pe"!2\'e"!o("2)e""e"#e"%o*$F2+e""e"#e"$e"%e"&o,&2-n.2/)20n122e"&o3"04=Pe""25e"#26e""e"#e"%o7$F2+n822e""e"#e"%o9$0:<Pn;2<PP7=I>P7?I@G0A<5e!!e!"e!#e!$e!%e!&6\''];
67
- //# sourceMappingURL=base-handler.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),base_handler_exports={};__export(base_handler_exports,{BaseHandler:()=>BaseHandler});module.exports=__toCommonJS(base_handler_exports);var import_network=require("../network");class BaseHandler{getAdapterByEventAndContext(event,context,adapters,log){const resolvedAdapters=adapters.filter(adapter=>adapter.canHandle(event,context,log));if(resolvedAdapters.length===0)throw new Error("SERVERLESS_ADAPTER: Couldn't find adapter to handle this event.");if(resolvedAdapters.length>1)throw new Error(`SERVERLESS_ADAPTER: Two or more adapters was resolved by the event, the adapters are: ${adapters.map(adapter=>adapter.getAdapterName()).join(", ")}.`);return resolvedAdapters[0]}getServerlessRequestResponseFromAdapterRequest(requestValues){const request=new import_network.ServerlessRequest({method:requestValues.method,headers:requestValues.headers,body:requestValues.body,remoteAddress:requestValues.remoteAddress,url:requestValues.path}),response=new import_network.ServerlessResponse({method:requestValues.method});return[request,response]}}
2
+ //# sourceMappingURL=base-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-handler.js","sourceRoot":"","sources":["../../src/core/base-handler.ts"],"names":[],"mappings":";;;yCAUO,cAAc;uCAAd,cAAc;wCAAd,cAAc;sCARU,WAAW;+BAUlB,SAAS;yCAF1B,cAAc;sCAAd,cAAc;;;;;AACrB,wCAAmE;AAGnE,YAAY;AAEZ;;;;;GAKG;AACH,MAAsB,WAAW;IA+B/B,YAAY;IAEZ,2BAA2B;IAE3B;;;;;;;OAOG;IACO,2BAA2B,CACnC,KAAa,EACb,OAAiB,EACjB,QAAwD,EACxD,GAAY;QAEZ,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,cAAC,OAAO,CAAC,EAAE,CACjD,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,8BACvC,CAAC;QAEF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;SACH;QAED,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,yFAAyF,QAAQ;iBAC9F,GAAG,cAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,cAAc,EAAE,8BAAC;iBACxC,IAAI,CAAC,IAAI,CAAC,GAAG,CACjB,CAAC;SACH;QAED,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACO,8CAA8C,CACtD,aAA6B;QAE7B,MAAM,OAAO,GAAG,IAAI,2BAAiB,CAAC;YACpC,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,OAAO,EAAE,aAAa,CAAC,OAAO;YAC9B,IAAI,EAAE,aAAa,CAAC,IAAI;YACxB,aAAa,EAAE,aAAa,CAAC,aAAa;YAC1C,GAAG,EAAE,aAAa,CAAC,IAAI;SACxB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,4BAAkB,CAAC;YACtC,MAAM,EAAE,aAAa,CAAC,MAAM;SAC7B,CAAC,CAAC;QAEH,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7B,CAAC;;AA3FH,kCA8FC"}
1
+ {"version":3,"file":"base-handler.js","sources":["../../src/core/base-handler.ts"],"sourcesContent":["//#region Imports\n\nimport { BinarySettings } from '../@types';\nimport {\n AdapterContract,\n AdapterRequest,\n FrameworkContract,\n HandlerContract,\n ResolverContract,\n ServerlessHandler,\n} from '../contracts';\nimport { ServerlessRequest, ServerlessResponse } from '../network';\nimport { ILogger } from './index';\n\n//#endregion\n\n/**\n * The abstract class that represents the base class for a handler\n *\n * @breadcrumb Core\n * @public\n */\nexport abstract class BaseHandler<\n TApp,\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn,\n> implements\n HandlerContract<TApp, TEvent, TContext, TCallback, TResponse, TReturn>\n{\n //#region Public Methods\n\n /**\n * Get the handler that will handle serverless requests\n */\n public abstract getHandler(\n app: TApp,\n framework: FrameworkContract<TApp>,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n resolverFactory: ResolverContract<\n TEvent,\n TContext,\n TCallback,\n TResponse,\n TReturn\n >,\n binarySettings: BinarySettings,\n respondWithErrors: boolean,\n log: ILogger,\n ): ServerlessHandler<TReturn>;\n\n //#endregion\n\n //#region Protected Methods\n\n /**\n * Get the adapter to handle a specific event and context\n *\n * @param event - The event sent by serverless\n * @param context - The context sent by serverless\n * @param adapters - The list of adapters\n * @param log - The instance of logger\n */\n protected getAdapterByEventAndContext(\n event: TEvent,\n context: TContext,\n adapters: AdapterContract<TEvent, TContext, TResponse>[],\n log: ILogger,\n ): AdapterContract<TEvent, TContext, TResponse> {\n const resolvedAdapters = adapters.filter(adapter =>\n adapter.canHandle(event, context, log),\n );\n\n if (resolvedAdapters.length === 0) {\n throw new Error(\n \"SERVERLESS_ADAPTER: Couldn't find adapter to handle this event.\",\n );\n }\n\n if (resolvedAdapters.length > 1) {\n throw new Error(\n `SERVERLESS_ADAPTER: Two or more adapters was resolved by the event, the adapters are: ${adapters\n .map(adapter => adapter.getAdapterName())\n .join(', ')}.`,\n );\n }\n\n return resolvedAdapters[0];\n }\n\n /**\n * Get serverless request and response frmo the adapter request\n *\n * @param requestValues - The request values from adapter\n */\n protected getServerlessRequestResponseFromAdapterRequest(\n requestValues: AdapterRequest,\n ): [request: ServerlessRequest, response: ServerlessResponse] {\n const request = new ServerlessRequest({\n method: requestValues.method,\n headers: requestValues.headers,\n body: requestValues.body,\n remoteAddress: requestValues.remoteAddress,\n url: requestValues.path,\n });\n\n const response = new ServerlessResponse({\n method: requestValues.method,\n });\n\n return [request, response];\n }\n\n //#endregion\n}\n"],"names":[],"mappings":"ooBAAA,qBAAA,CAAA,EAAA,SAAA,qBAAA,CAAA,YAAA,IAAA,WAAA,CAAA,EAAA,OAAA,QAAA,aAAA,oBAAA,EAWA,IAAsD,eAAA,QAAA,YAAA,EAW/C,MAAe,WAStB,CAkCY,4BACR,MACA,QACA,SACA,IAC8C,CAC9C,MAAM,iBAAmB,SAAS,OAChC,SAAA,QAAQ,UAAU,MAAO,QAAS,GAAG,CAAA,EAGnC,GAAA,iBAAiB,SAAW,EAC9B,MAAM,IAAI,MACR,iEAAA,EAIA,GAAA,iBAAiB,OAAS,EAC5B,MAAM,IAAI,MACR,yFAAyF,SACtF,IAAI,SAAW,QAAQ,eAAe,CAAC,EACvC,KAAK,IAAI,IAAA,EAIhB,OAAO,iBAAiB,CAAC,CAC3B,CAOU,+CACR,cAC4D,CACtD,MAAA,QAAU,IAAI,eAAkB,kBAAA,CACpC,OAAQ,cAAc,OACtB,QAAS,cAAc,QACvB,KAAM,cAAc,KACpB,cAAe,cAAc,cAC7B,IAAK,cAAc,IAAA,CACpB,EAEK,SAAW,IAAI,eAAmB,mBAAA,CACtC,OAAQ,cAAc,MAAA,CACvB,EAEM,MAAA,CAAC,QAAS,QAAQ,CAC3B,CAGF"}
@@ -10,17 +10,17 @@ export declare const DEFAULT_BINARY_ENCODINGS: string[];
10
10
  * Default content types that are treated as binary, they are compared with the `Content-Type` header.
11
11
  *
12
12
  * @breadcrumb Core / Constants
13
- * @defaultValue [new RegExp('^image/.*$'), new RegExp('^video/.*$'), 'application/pdf']
13
+ * @defaultValue ['image/png', 'image/jpeg', 'image/jpg', 'image/avif', 'image/bmp', 'image/x-png', 'image/gif', 'image/webp', 'video/mp4', 'application/pdf']
14
14
  * @public
15
15
  */
16
- export declare const DEFAULT_BINARY_CONTENT_TYPES: (string | RegExp)[];
16
+ export declare const DEFAULT_BINARY_CONTENT_TYPES: string[];
17
17
  /**
18
18
  * Type alias for empty response and can be used on some adapters when the adapter does not need to return a response.
19
19
  *
20
20
  * @breadcrumb Core / Constants
21
21
  * @public
22
22
  */
23
- export declare type IEmptyResponse = {};
23
+ export type IEmptyResponse = {};
24
24
  /**
25
25
  * Constant for empty response and can be used on some adapters when the adapter does not need to return a response.
26
26
  *
@@ -28,4 +28,4 @@ export declare type IEmptyResponse = {};
28
28
  * @public
29
29
  */
30
30
  export declare const EmptyResponse: IEmptyResponse;
31
- export declare type __ΩIEmptyResponse = any[];
31
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAA8B,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,EAWhD,CAAC;AAEF;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,cAAmB,CAAC"}
@@ -1,33 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmptyResponse = exports.__ΩIEmptyResponse = exports.DEFAULT_BINARY_CONTENT_TYPES = exports.DEFAULT_BINARY_ENCODINGS = void 0;
4
- /**
5
- * Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.
6
- *
7
- * @breadcrumb Core / Constants
8
- * @defaultValue ['gzip', 'deflate', 'br']
9
- * @public
10
- */
11
- exports.DEFAULT_BINARY_ENCODINGS = ['gzip', 'deflate', 'br'];
12
- /**
13
- * Default content types that are treated as binary, they are compared with the `Content-Type` header.
14
- *
15
- * @breadcrumb Core / Constants
16
- * @defaultValue [new RegExp('^image/.*$'), new RegExp('^video/.*$'), 'application/pdf']
17
- * @public
18
- */
19
- exports.DEFAULT_BINARY_CONTENT_TYPES = [
20
- new RegExp('^image/.*$'),
21
- new RegExp('^video/.*$'),
22
- 'application/pdf',
23
- ];
24
- const __ΩIEmptyResponse = ['PM'];
25
- exports.__ΩIEmptyResponse = __ΩIEmptyResponse;
26
- /**
27
- * Constant for empty response and can be used on some adapters when the adapter does not need to return a response.
28
- *
29
- * @breadcrumb Core / Constants
30
- * @public
31
- */
32
- exports.EmptyResponse = {};
33
- //# sourceMappingURL=constants.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),constants_exports={};__export(constants_exports,{DEFAULT_BINARY_CONTENT_TYPES:()=>DEFAULT_BINARY_CONTENT_TYPES,DEFAULT_BINARY_ENCODINGS:()=>DEFAULT_BINARY_ENCODINGS,EmptyResponse:()=>EmptyResponse});module.exports=__toCommonJS(constants_exports);const DEFAULT_BINARY_ENCODINGS=["gzip","deflate","br"],DEFAULT_BINARY_CONTENT_TYPES=["image/png","image/jpeg","image/jpg","image/avif","image/bmp","image/x-png","image/gif","image/webp","video/mp4","application/pdf"],EmptyResponse={};
2
+ //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAa,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAE5E;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAwB;IAC/D,IAAI,MAAM,CAAC,YAAY,CAAC;IACxB,IAAI,MAAM,CAAC,YAAY,CAAC;IACxB,iBAAiB;CAClB,CAAC;;;AAWF;;;;;GAKG;AACU,QAAA,aAAa,GAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"constants.js","sources":["../../src/core/constants.ts"],"sourcesContent":["/**\n * Default encodings that are treated as binary, they are compared with the `Content-Encoding` header.\n *\n * @breadcrumb Core / Constants\n * @defaultValue ['gzip', 'deflate', 'br']\n * @public\n */\nexport const DEFAULT_BINARY_ENCODINGS: string[] = ['gzip', 'deflate', 'br'];\n\n/**\n * Default content types that are treated as binary, they are compared with the `Content-Type` header.\n *\n * @breadcrumb Core / Constants\n * @defaultValue ['image/png', 'image/jpeg', 'image/jpg', 'image/avif', 'image/bmp', 'image/x-png', 'image/gif', 'image/webp', 'video/mp4', 'application/pdf']\n * @public\n */\nexport const DEFAULT_BINARY_CONTENT_TYPES: string[] = [\n 'image/png',\n 'image/jpeg',\n 'image/jpg',\n 'image/avif',\n 'image/bmp',\n 'image/x-png',\n 'image/gif',\n 'image/webp',\n 'video/mp4',\n 'application/pdf',\n];\n\n/**\n * Type alias for empty response and can be used on some adapters when the adapter does not need to return a response.\n *\n * @breadcrumb Core / Constants\n * @public\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type IEmptyResponse = {};\n\n/**\n * Constant for empty response and can be used on some adapters when the adapter does not need to return a response.\n *\n * @breadcrumb Core / Constants\n * @public\n */\nexport const EmptyResponse: IEmptyResponse = {};\n"],"names":[],"mappings":"ooBAAA,kBAAA,CAAA,EAAA,SAAA,kBAAA,CAAA,6BAAA,IAAA,6BAAA,yBAAA,IAAA,yBAAA,cAAA,IAAA,aAAA,CAAA,EAAA,OAAA,QAAA,aAAA,iBAAA,EAOO,MAAM,yBAAqC,CAAC,OAAQ,UAAW,IAAI,EAS7D,6BAAyC,CACpD,YACA,aACA,YACA,aACA,YACA,cACA,YACA,aACA,YACA,iBACF,EAiBa,cAAgC,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * @breadcrumb Core / Current Invoke
5
5
  * @public
6
6
  */
7
- export declare type CurrentInvoke<TEvent, TContext> = {
7
+ export type CurrentInvoke<TEvent, TContext> = {
8
8
  /**
9
9
  * The event created by the serverless trigger
10
10
  *
@@ -45,4 +45,4 @@ export declare function getCurrentInvoke<TEvent = any, TContext = any>(): Curren
45
45
  * @public
46
46
  */
47
47
  export declare function setCurrentInvoke<TEvent = any, TContext = any>({ event, context, }: CurrentInvoke<TEvent, TContext>): void;
48
- export declare type __ΩCurrentInvoke = any[];
48
+ //# sourceMappingURL=current-invoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"current-invoke.d.ts","sourceRoot":"","sources":["../../src/core/current-invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,IAAI;IAC5C;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;OAIG;IACH,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;CAC1B,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,KAAK,aAAa,CAC7E,MAAM,EACN,QAAQ,CACT,CAEA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,EAC7D,KAAK,EACL,OAAO,GACR,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,QAGjC"}
@@ -1,46 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setCurrentInvoke = exports.getCurrentInvoke = exports.__ΩCurrentInvoke = void 0;
4
- const __ΩCurrentInvoke = ['TEvent', 'TContext', 'event', 'context', 'b!b"PPe#!,J4#Pe#",J4$M'];
5
- exports.__ΩCurrentInvoke = __ΩCurrentInvoke;
6
- const currentInvoke = {
7
- context: null,
8
- event: null,
9
- };
10
- /**
11
- * Get the reference to the event created by the serverless trigger or context created by the serverless environment.
12
- *
13
- * @example
14
- * ```typescript
15
- * import type { ALBEvent, Context } from 'aws-lambda';
16
- *
17
- * // inside the method that handles the aws alb request.
18
- * const { event, context } = getCurrentInvoke<ALBEvent, Context>();
19
- * ```
20
- *
21
- * @breadcrumb Core / Current Invoke
22
- * @public
23
- */
24
- function getCurrentInvoke() {
25
- return currentInvoke;
26
- }
27
- exports.getCurrentInvoke = getCurrentInvoke;
28
- getCurrentInvoke.__type = [() => __ΩCurrentInvoke, 'getCurrentInvoke', 'P""o!#/"'];
29
- /**
30
- * Method that saves to the event created by the serverless trigger or context created by the serverless environment.
31
- *
32
- * @remarks This method MUST NOT be called by you, this method MUST only be used internally in this library.
33
- *
34
- * @param event - The event created by the serverless trigger
35
- * @param context - The context created by the serverless environment
36
- *
37
- * @breadcrumb Core / Current Invoke
38
- * @public
39
- */
40
- function setCurrentInvoke({ event, context, }) {
41
- currentInvoke.event = event;
42
- currentInvoke.context = context;
43
- }
44
- exports.setCurrentInvoke = setCurrentInvoke;
45
- setCurrentInvoke.__type = [() => __ΩCurrentInvoke, 'param0', 'setCurrentInvoke', 'P""o!#2""/#'];
46
- //# sourceMappingURL=current-invoke.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),current_invoke_exports={};__export(current_invoke_exports,{getCurrentInvoke:()=>getCurrentInvoke,setCurrentInvoke:()=>setCurrentInvoke});module.exports=__toCommonJS(current_invoke_exports);const currentInvoke={context:null,event:null};function getCurrentInvoke(){return currentInvoke}function setCurrentInvoke({event,context}){currentInvoke.event=event,currentInvoke.context=context}
2
+ //# sourceMappingURL=current-invoke.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"current-invoke.js","sourceRoot":"","sources":["../../src/core/current-invoke.ts"],"names":[],"mappings":";;;;;AAsBA,MAAM,aAAa,GAA4B;IAC7C,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB;IAI9B,OAAO,aAAa,CAAC;AACvB,CAAC;AALD,4CAKC;;AAED;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB,CAA+B,EAC7D,KAAK,EACL,OAAO,GACyB;IAChC,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;IAC5B,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;AAClC,CAAC;AAND,4CAMC"}
1
+ {"version":3,"file":"current-invoke.js","sources":["../../src/core/current-invoke.ts"],"sourcesContent":["/**\n * The type that represents the object that handles the references to the event created by the serverless trigger or context created by the serverless environment.\n *\n * @breadcrumb Core / Current Invoke\n * @public\n */\nexport type CurrentInvoke<TEvent, TContext> = {\n /**\n * The event created by the serverless trigger\n *\n * @remarks It's only null when you call {@link getCurrentInvoke} outside this library's pipeline.\n */\n event: TEvent | null;\n\n /**\n * The context created by the serverless environment\n *\n * @remarks It's only null when you call {@link getCurrentInvoke} outside this library's pipeline.\n */\n context: TContext | null;\n};\n\nconst currentInvoke: CurrentInvoke<any, any> = {\n context: null,\n event: null,\n};\n\n/**\n * Get the reference to the event created by the serverless trigger or context created by the serverless environment.\n *\n * @example\n * ```typescript\n * import type { ALBEvent, Context } from 'aws-lambda';\n *\n * // inside the method that handles the aws alb request.\n * const { event, context } = getCurrentInvoke<ALBEvent, Context>();\n * ```\n *\n * @breadcrumb Core / Current Invoke\n * @public\n */\nexport function getCurrentInvoke<TEvent = any, TContext = any>(): CurrentInvoke<\n TEvent,\n TContext\n> {\n return currentInvoke;\n}\n\n/**\n * Method that saves to the event created by the serverless trigger or context created by the serverless environment.\n *\n * @remarks This method MUST NOT be called by you, this method MUST only be used internally in this library.\n *\n * @param event - The event created by the serverless trigger\n * @param context - The context created by the serverless environment\n *\n * @breadcrumb Core / Current Invoke\n * @public\n */\nexport function setCurrentInvoke<TEvent = any, TContext = any>({\n event,\n context,\n}: CurrentInvoke<TEvent, TContext>) {\n currentInvoke.event = event;\n currentInvoke.context = context;\n}\n"],"names":[],"mappings":"ooBAAA,uBAAA,CAAA,EAAA,SAAA,uBAAA,CAAA,iBAAA,IAAA,iBAAA,iBAAA,IAAA,gBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,sBAAA,EAsBA,MAAM,cAAyC,CAC7C,QAAS,KACT,MAAO,IACT,EAgBO,SAAS,kBAGd,CACO,OAAA,aACT,CAaO,SAAS,iBAA+C,CAC7D,MACA,OACF,EAAoC,CAClC,cAAc,MAAQ,MACtB,cAAc,QAAU,OAC1B"}
@@ -19,3 +19,4 @@
19
19
  * @public
20
20
  */
21
21
  export declare function getEventBodyAsBuffer(body: string, isBase64Encoded: boolean): [body: Buffer, contentLength: number];
22
+ //# sourceMappingURL=event-body.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-body.d.ts","sourceRoot":"","sources":["../../src/core/event-body.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,OAAO,GACvB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAOvC"}
@@ -1,31 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEventBodyAsBuffer = void 0;
4
- /**
5
- * Get the event body as buffer from body string with content length
6
- *
7
- * @example
8
- * ```typescript
9
- * const body = '{}';
10
- * const [buffer, contentLength] = getEventBodyAsBuffer(body, false);
11
- * console.log(buffer);
12
- * // <Buffer 7b 7d>
13
- * console.log(contentLength);
14
- * // 2
15
- * ```
16
- *
17
- * @param body - The body string that can be encoded or not
18
- * @param isBase64Encoded - Tells if body string is encoded in base64
19
- *
20
- * @breadcrumb Core
21
- * @public
22
- */
23
- function getEventBodyAsBuffer(body, isBase64Encoded) {
24
- const encoding = isBase64Encoded ? 'base64' : 'utf8';
25
- const buffer = Buffer.from(body, encoding);
26
- const contentLength = Buffer.byteLength(buffer, encoding);
27
- return [buffer, contentLength];
28
- }
29
- exports.getEventBodyAsBuffer = getEventBodyAsBuffer;
30
- getEventBodyAsBuffer.__type = ['body', 'isBase64Encoded', 'contentLength', 'getEventBodyAsBuffer', 'P&2!)2"P!I!\'I#G/$'];
31
- //# sourceMappingURL=event-body.js.map
1
+ "use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),event_body_exports={};__export(event_body_exports,{getEventBodyAsBuffer:()=>getEventBodyAsBuffer});module.exports=__toCommonJS(event_body_exports);function getEventBodyAsBuffer(body,isBase64Encoded){const encoding=isBase64Encoded?"base64":"utf8",buffer=Buffer.from(body,encoding),contentLength=Buffer.byteLength(buffer,encoding);return[buffer,contentLength]}
2
+ //# sourceMappingURL=event-body.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-body.js","sourceRoot":"","sources":["../../src/core/event-body.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,oBAAoB,CAClC,IAAY,EACZ,eAAwB;IAExB,MAAM,QAAQ,GAAmB,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAErE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE1D,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACjC,CAAC;AAVD,oDAUC"}
1
+ {"version":3,"file":"event-body.js","sources":["../../src/core/event-body.ts"],"sourcesContent":["/**\n * Get the event body as buffer from body string with content length\n *\n * @example\n * ```typescript\n * const body = '{}';\n * const [buffer, contentLength] = getEventBodyAsBuffer(body, false);\n * console.log(buffer);\n * // <Buffer 7b 7d>\n * console.log(contentLength);\n * // 2\n * ```\n *\n * @param body - The body string that can be encoded or not\n * @param isBase64Encoded - Tells if body string is encoded in base64\n *\n * @breadcrumb Core\n * @public\n */\nexport function getEventBodyAsBuffer(\n body: string,\n isBase64Encoded: boolean,\n): [body: Buffer, contentLength: number] {\n const encoding: BufferEncoding = isBase64Encoded ? 'base64' : 'utf8';\n\n const buffer = Buffer.from(body, encoding);\n const contentLength = Buffer.byteLength(buffer, encoding);\n\n return [buffer, contentLength];\n}\n"],"names":[],"mappings":"ooBAAA,mBAAA,CAAA,EAAA,SAAA,mBAAA,CAAA,qBAAA,IAAA,oBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,kBAAA,EAmBO,SAAS,qBACd,KACA,gBACuC,CACjC,MAAA,SAA2B,gBAAkB,SAAW,OAExD,OAAS,OAAO,KAAK,KAAM,QAAQ,EACnC,cAAgB,OAAO,WAAW,OAAQ,QAAQ,EAEjD,MAAA,CAAC,OAAQ,aAAa,CAC/B"}
@@ -35,6 +35,31 @@ export declare function getFlattenedHeadersMap(headersMap: BothValueHeaders, sep
35
35
  * @public
36
36
  */
37
37
  export declare function getMultiValueHeadersMap(headersMap: BothValueHeaders): Record<string, string[]>;
38
+ /**
39
+ * The wrapper that holds the information about single value headers and cookies
40
+ *
41
+ * @breadcrumb Core / Headers
42
+ * @public
43
+ */
44
+ export type FlattenedHeadersAndCookies = {
45
+ /**
46
+ * Just the single value headers
47
+ */
48
+ headers: Record<string, string>;
49
+ /**
50
+ * The list of cookies
51
+ */
52
+ cookies: string[];
53
+ };
54
+ /**
55
+ * Transforms a header map into a single value headers and cookies
56
+ *
57
+ * @param headersMap - The initial headers
58
+ *
59
+ * @breadcrumb Core / Headers
60
+ * @public
61
+ */
62
+ export declare function getFlattenedHeadersMapAndCookies(headersMap: BothValueHeaders): FlattenedHeadersAndCookies;
38
63
  /**
39
64
  * Parse HTTP Raw Headers
40
65
  * Attribution to {@link https://github.com/kesla/parse-headers/blob/master/parse-headers.js}
@@ -45,3 +70,4 @@ export declare function getMultiValueHeadersMap(headersMap: BothValueHeaders): R
45
70
  * @public
46
71
  */
47
72
  export declare function parseHeaders(headers: string): Record<string, string | string[]>;
73
+ //# sourceMappingURL=headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../src/core/headers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,gBAAgB,EAC5B,SAAS,GAAE,MAAY,EACvB,YAAY,GAAE,OAAe,GAC5B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,gBAAgB,GAC3B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAU1B;AAED;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,gBAAgB,GAC3B,0BAA0B,CAuB5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAkBnC"}