@h4ad/serverless-adapter 3.0.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 +2 -2
  2. package/lib/@types/binary-settings.d.ts +41 -0
  3. package/lib/@types/binary-settings.d.ts.map +1 -0
  4. package/lib/@types/binary-settings.js +1 -1
  5. package/lib/@types/binary-settings.js.map +1 -1
  6. package/lib/@types/digital-ocean/digital-ocean-http-event.d.ts +37 -0
  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 +1 -1
  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 +22 -0
  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 +1 -1
  13. package/lib/@types/digital-ocean/digital-ocean-http-response.js.map +1 -1
  14. package/lib/@types/digital-ocean/index.d.ts +2 -0
  15. package/lib/@types/digital-ocean/index.d.ts.map +1 -0
  16. package/lib/@types/digital-ocean/index.js +1 -1
  17. package/lib/@types/digital-ocean/index.js.map +1 -1
  18. package/lib/@types/headers.d.ts +37 -0
  19. package/lib/@types/headers.d.ts.map +1 -0
  20. package/lib/@types/headers.js +1 -1
  21. package/lib/@types/headers.js.map +1 -1
  22. package/lib/@types/helpers.d.ts +10 -0
  23. package/lib/@types/helpers.d.ts.map +1 -0
  24. package/lib/@types/helpers.js +1 -1
  25. package/lib/@types/helpers.js.map +1 -1
  26. package/lib/@types/huawei/huawei-api-gateway-event.d.ts +81 -0
  27. package/lib/@types/huawei/huawei-api-gateway-event.d.ts.map +1 -0
  28. package/lib/@types/huawei/huawei-api-gateway-event.js +1 -1
  29. package/lib/@types/huawei/huawei-api-gateway-event.js.map +1 -1
  30. package/lib/@types/huawei/huawei-api-gateway-response.d.ts +27 -0
  31. package/lib/@types/huawei/huawei-api-gateway-response.d.ts.map +1 -0
  32. package/lib/@types/huawei/huawei-api-gateway-response.js +1 -1
  33. package/lib/@types/huawei/huawei-api-gateway-response.js.map +1 -1
  34. package/lib/@types/huawei/huawei-context.d.ts +188 -0
  35. package/lib/@types/huawei/huawei-context.d.ts.map +1 -0
  36. package/lib/@types/huawei/huawei-context.js +1 -1
  37. package/lib/@types/huawei/huawei-context.js.map +1 -1
  38. package/lib/@types/huawei/index.d.ts +4 -0
  39. package/lib/@types/huawei/index.d.ts.map +1 -0
  40. package/lib/@types/huawei/index.js +1 -1
  41. package/lib/@types/huawei/index.js.map +1 -1
  42. package/lib/@types/index.d.ts +4 -0
  43. package/lib/@types/index.d.ts.map +1 -0
  44. package/lib/@types/index.js +1 -1
  45. package/lib/@types/index.js.map +1 -1
  46. package/lib/adapters/apollo-server/apollo-server-mutation.adapter.d.ts +56 -0
  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 +1 -1
  49. package/lib/adapters/apollo-server/apollo-server-mutation.adapter.js.map +1 -1
  50. package/lib/adapters/apollo-server/index.d.ts +2 -0
  51. package/lib/adapters/apollo-server/index.d.ts.map +1 -0
  52. package/lib/adapters/apollo-server/index.js +1 -1
  53. package/lib/adapters/apollo-server/index.js.map +1 -1
  54. package/lib/adapters/aws/alb.adapter.d.ts +71 -0
  55. package/lib/adapters/aws/alb.adapter.d.ts.map +1 -0
  56. package/lib/adapters/aws/alb.adapter.js +1 -1
  57. package/lib/adapters/aws/alb.adapter.js.map +1 -1
  58. package/lib/adapters/aws/api-gateway-v1.adapter.d.ts +76 -0
  59. package/lib/adapters/aws/api-gateway-v1.adapter.d.ts.map +1 -0
  60. package/lib/adapters/aws/api-gateway-v1.adapter.js +1 -1
  61. package/lib/adapters/aws/api-gateway-v1.adapter.js.map +1 -1
  62. package/lib/adapters/aws/api-gateway-v2.adapter.d.ts +75 -0
  63. package/lib/adapters/aws/api-gateway-v2.adapter.d.ts.map +1 -0
  64. package/lib/adapters/aws/api-gateway-v2.adapter.js +1 -1
  65. package/lib/adapters/aws/api-gateway-v2.adapter.js.map +1 -1
  66. package/lib/adapters/aws/base/aws-simple-adapter.d.ts +83 -0
  67. package/lib/adapters/aws/base/aws-simple-adapter.d.ts.map +1 -0
  68. package/lib/adapters/aws/base/aws-simple-adapter.js +1 -1
  69. package/lib/adapters/aws/base/aws-simple-adapter.js.map +1 -1
  70. package/lib/adapters/aws/base/index.d.ts +2 -0
  71. package/lib/adapters/aws/base/index.d.ts.map +1 -0
  72. package/lib/adapters/aws/base/index.js +1 -1
  73. package/lib/adapters/aws/base/index.js.map +1 -1
  74. package/lib/adapters/aws/dynamodb.adapter.d.ts +56 -0
  75. package/lib/adapters/aws/dynamodb.adapter.d.ts.map +1 -0
  76. package/lib/adapters/aws/dynamodb.adapter.js +1 -1
  77. package/lib/adapters/aws/dynamodb.adapter.js.map +1 -1
  78. package/lib/adapters/aws/event-bridge.adapter.d.ts +63 -0
  79. package/lib/adapters/aws/event-bridge.adapter.d.ts.map +1 -0
  80. package/lib/adapters/aws/event-bridge.adapter.js +1 -1
  81. package/lib/adapters/aws/event-bridge.adapter.js.map +1 -1
  82. package/lib/adapters/aws/index.d.ts +12 -0
  83. package/lib/adapters/aws/index.d.ts.map +1 -0
  84. package/lib/adapters/aws/index.js +1 -1
  85. package/lib/adapters/aws/index.js.map +1 -1
  86. package/lib/adapters/aws/lambda-edge.adapter.d.ts +209 -0
  87. package/lib/adapters/aws/lambda-edge.adapter.d.ts.map +1 -0
  88. package/lib/adapters/aws/lambda-edge.adapter.js +1 -1
  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 +56 -0
  95. package/lib/adapters/aws/s3.adapter.d.ts.map +1 -0
  96. package/lib/adapters/aws/s3.adapter.js +1 -1
  97. package/lib/adapters/aws/s3.adapter.js.map +1 -1
  98. package/lib/adapters/aws/sns.adapter.d.ts +56 -0
  99. package/lib/adapters/aws/sns.adapter.d.ts.map +1 -0
  100. package/lib/adapters/aws/sns.adapter.js +1 -1
  101. package/lib/adapters/aws/sns.adapter.js.map +1 -1
  102. package/lib/adapters/aws/sqs.adapter.d.ts +56 -0
  103. package/lib/adapters/aws/sqs.adapter.d.ts.map +1 -0
  104. package/lib/adapters/aws/sqs.adapter.js +1 -1
  105. package/lib/adapters/aws/sqs.adapter.js.map +1 -1
  106. package/lib/adapters/azure/http-trigger-v4.adapter.d.ts +81 -0
  107. package/lib/adapters/azure/http-trigger-v4.adapter.d.ts.map +1 -0
  108. package/lib/adapters/azure/http-trigger-v4.adapter.js +1 -1
  109. package/lib/adapters/azure/http-trigger-v4.adapter.js.map +1 -1
  110. package/lib/adapters/azure/index.d.ts +2 -0
  111. package/lib/adapters/azure/index.d.ts.map +1 -0
  112. package/lib/adapters/azure/index.js +1 -1
  113. package/lib/adapters/azure/index.js.map +1 -1
  114. package/lib/adapters/digital-ocean/http-function.adapter.d.ts +65 -0
  115. package/lib/adapters/digital-ocean/http-function.adapter.d.ts.map +1 -0
  116. package/lib/adapters/digital-ocean/http-function.adapter.js +1 -1
  117. package/lib/adapters/digital-ocean/http-function.adapter.js.map +1 -1
  118. package/lib/adapters/digital-ocean/index.d.ts +2 -0
  119. package/lib/adapters/digital-ocean/index.d.ts.map +1 -0
  120. package/lib/adapters/digital-ocean/index.js +1 -1
  121. package/lib/adapters/digital-ocean/index.js.map +1 -1
  122. package/lib/adapters/dummy/dummy.adapter.d.ts +31 -0
  123. package/lib/adapters/dummy/dummy.adapter.d.ts.map +1 -0
  124. package/lib/adapters/dummy/dummy.adapter.js +1 -1
  125. package/lib/adapters/dummy/dummy.adapter.js.map +1 -1
  126. package/lib/adapters/dummy/index.d.ts +2 -0
  127. package/lib/adapters/dummy/index.d.ts.map +1 -0
  128. package/lib/adapters/dummy/index.js +1 -1
  129. package/lib/adapters/dummy/index.js.map +1 -1
  130. package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts +66 -0
  131. package/lib/adapters/huawei/huawei-api-gateway.adapter.d.ts.map +1 -0
  132. package/lib/adapters/huawei/huawei-api-gateway.adapter.js +1 -1
  133. package/lib/adapters/huawei/huawei-api-gateway.adapter.js.map +1 -1
  134. package/lib/adapters/huawei/index.d.ts +2 -0
  135. package/lib/adapters/huawei/index.d.ts.map +1 -0
  136. package/lib/adapters/huawei/index.js +1 -1
  137. package/lib/adapters/huawei/index.js.map +1 -1
  138. package/lib/contracts/adapter.contract.d.ts +152 -0
  139. package/lib/contracts/adapter.contract.d.ts.map +1 -0
  140. package/lib/contracts/adapter.contract.js +1 -1
  141. package/lib/contracts/adapter.contract.js.map +1 -1
  142. package/lib/contracts/framework.contract.d.ts +19 -0
  143. package/lib/contracts/framework.contract.d.ts.map +1 -0
  144. package/lib/contracts/framework.contract.js +1 -1
  145. package/lib/contracts/framework.contract.js.map +1 -1
  146. package/lib/contracts/handler.contract.d.ts +25 -0
  147. package/lib/contracts/handler.contract.d.ts.map +1 -0
  148. package/lib/contracts/handler.contract.js +1 -1
  149. package/lib/contracts/handler.contract.js.map +1 -1
  150. package/lib/contracts/index.d.ts +5 -0
  151. package/lib/contracts/index.d.ts.map +1 -0
  152. package/lib/contracts/index.js +1 -1
  153. package/lib/contracts/index.js.map +1 -1
  154. package/lib/contracts/resolver.contract.d.ts +83 -0
  155. package/lib/contracts/resolver.contract.d.ts.map +1 -0
  156. package/lib/contracts/resolver.contract.js +1 -1
  157. package/lib/contracts/resolver.contract.js.map +1 -1
  158. package/lib/core/base-handler.d.ts +32 -0
  159. package/lib/core/base-handler.d.ts.map +1 -0
  160. package/lib/core/base-handler.js +1 -1
  161. package/lib/core/base-handler.js.map +1 -1
  162. package/lib/core/constants.d.ts +31 -0
  163. package/lib/core/constants.d.ts.map +1 -0
  164. package/lib/core/constants.js +1 -1
  165. package/lib/core/constants.js.map +1 -1
  166. package/lib/core/current-invoke.d.ts +48 -0
  167. package/lib/core/current-invoke.d.ts.map +1 -0
  168. package/lib/core/current-invoke.js +1 -1
  169. package/lib/core/current-invoke.js.map +1 -1
  170. package/lib/core/event-body.d.ts +22 -0
  171. package/lib/core/event-body.d.ts.map +1 -0
  172. package/lib/core/event-body.js +1 -1
  173. package/lib/core/event-body.js.map +1 -1
  174. package/lib/core/headers.d.ts +73 -0
  175. package/lib/core/headers.d.ts.map +1 -0
  176. package/lib/core/headers.js +2 -2
  177. package/lib/core/headers.js.map +1 -1
  178. package/lib/core/index.d.ts +12 -0
  179. package/lib/core/index.d.ts.map +1 -0
  180. package/lib/core/index.js +1 -1
  181. package/lib/core/index.js.map +1 -1
  182. package/lib/core/is-binary.d.ts +73 -0
  183. package/lib/core/is-binary.d.ts.map +1 -0
  184. package/lib/core/is-binary.js +1 -1
  185. package/lib/core/is-binary.js.map +1 -1
  186. package/lib/core/logger.d.ts +64 -0
  187. package/lib/core/logger.d.ts.map +1 -0
  188. package/lib/core/logger.js +1 -1
  189. package/lib/core/logger.js.map +1 -1
  190. package/lib/core/no-op.d.ts +8 -0
  191. package/lib/core/no-op.d.ts.map +1 -0
  192. package/lib/core/no-op.js +1 -1
  193. package/lib/core/no-op.js.map +1 -1
  194. package/lib/core/optional.d.ts +22 -0
  195. package/lib/core/optional.d.ts.map +1 -0
  196. package/lib/core/optional.js +1 -1
  197. package/lib/core/optional.js.map +1 -1
  198. package/lib/core/path.d.ts +53 -0
  199. package/lib/core/path.d.ts.map +1 -0
  200. package/lib/core/path.js +1 -1
  201. package/lib/core/path.js.map +1 -1
  202. package/lib/core/stream.d.ts +21 -0
  203. package/lib/core/stream.d.ts.map +1 -0
  204. package/lib/core/stream.js +1 -1
  205. package/lib/core/stream.js.map +1 -1
  206. package/lib/frameworks/apollo-server/apollo-server.framework.d.ts +69 -0
  207. package/lib/frameworks/apollo-server/apollo-server.framework.d.ts.map +1 -0
  208. package/lib/frameworks/apollo-server/apollo-server.framework.js +1 -1
  209. package/lib/frameworks/apollo-server/apollo-server.framework.js.map +1 -1
  210. package/lib/frameworks/apollo-server/index.d.ts +2 -0
  211. package/lib/frameworks/apollo-server/index.d.ts.map +1 -0
  212. package/lib/frameworks/apollo-server/index.js +1 -1
  213. package/lib/frameworks/apollo-server/index.js.map +1 -1
  214. package/lib/frameworks/body-parser/base-body-parser.framework.d.ts +69 -0
  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 +1 -1
  217. package/lib/frameworks/body-parser/base-body-parser.framework.js.map +1 -1
  218. package/lib/frameworks/body-parser/index.d.ts +6 -0
  219. package/lib/frameworks/body-parser/index.d.ts.map +1 -0
  220. package/lib/frameworks/body-parser/index.js +1 -1
  221. package/lib/frameworks/body-parser/index.js.map +1 -1
  222. package/lib/frameworks/body-parser/json-body-parser.framework.d.ts +26 -0
  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 +1 -1
  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 +26 -0
  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 +1 -1
  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 +26 -0
  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 +1 -1
  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 +26 -0
  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 +1 -1
  237. package/lib/frameworks/body-parser/urlencoded-body-parser.framework.js.map +1 -1
  238. package/lib/frameworks/cors/cors.framework.d.ts +78 -0
  239. package/lib/frameworks/cors/cors.framework.d.ts.map +1 -0
  240. package/lib/frameworks/cors/cors.framework.js +2 -2
  241. package/lib/frameworks/cors/cors.framework.js.map +1 -1
  242. package/lib/frameworks/cors/index.d.ts +2 -0
  243. package/lib/frameworks/cors/index.d.ts.map +1 -0
  244. package/lib/frameworks/cors/index.js +1 -1
  245. package/lib/frameworks/cors/index.js.map +1 -1
  246. package/lib/frameworks/deepkit/http-deepkit.framework.d.ts +18 -0
  247. package/lib/frameworks/deepkit/http-deepkit.framework.d.ts.map +1 -0
  248. package/lib/frameworks/deepkit/http-deepkit.framework.js +1 -1
  249. package/lib/frameworks/deepkit/http-deepkit.framework.js.map +1 -1
  250. package/lib/frameworks/deepkit/index.d.ts +2 -0
  251. package/lib/frameworks/deepkit/index.d.ts.map +1 -0
  252. package/lib/frameworks/deepkit/index.js +1 -1
  253. package/lib/frameworks/deepkit/index.js.map +1 -1
  254. package/lib/frameworks/express/express.framework.d.ts +17 -0
  255. package/lib/frameworks/express/express.framework.d.ts.map +1 -0
  256. package/lib/frameworks/express/express.framework.js +1 -1
  257. package/lib/frameworks/express/express.framework.js.map +1 -1
  258. package/lib/frameworks/express/index.d.ts +2 -0
  259. package/lib/frameworks/express/index.d.ts.map +1 -0
  260. package/lib/frameworks/express/index.js +1 -1
  261. package/lib/frameworks/express/index.js.map +1 -1
  262. package/lib/frameworks/fastify/fastify.framework.d.ts +17 -0
  263. package/lib/frameworks/fastify/fastify.framework.d.ts.map +1 -0
  264. package/lib/frameworks/fastify/fastify.framework.js +1 -1
  265. package/lib/frameworks/fastify/fastify.framework.js.map +1 -1
  266. package/lib/frameworks/fastify/helpers/no-op-content-parser.d.ts +14 -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 +1 -1
  269. package/lib/frameworks/fastify/helpers/no-op-content-parser.js.map +1 -1
  270. package/lib/frameworks/fastify/index.d.ts +2 -0
  271. package/lib/frameworks/fastify/index.d.ts.map +1 -0
  272. package/lib/frameworks/fastify/index.js +1 -1
  273. package/lib/frameworks/fastify/index.js.map +1 -1
  274. package/lib/frameworks/hapi/hapi.framework.d.ts +17 -0
  275. package/lib/frameworks/hapi/hapi.framework.d.ts.map +1 -0
  276. package/lib/frameworks/hapi/hapi.framework.js +1 -1
  277. package/lib/frameworks/hapi/hapi.framework.js.map +1 -1
  278. package/lib/frameworks/hapi/index.d.ts +2 -0
  279. package/lib/frameworks/hapi/index.d.ts.map +1 -0
  280. package/lib/frameworks/hapi/index.js +1 -1
  281. package/lib/frameworks/hapi/index.js.map +1 -1
  282. package/lib/frameworks/koa/index.d.ts +2 -0
  283. package/lib/frameworks/koa/index.d.ts.map +1 -0
  284. package/lib/frameworks/koa/index.js +1 -1
  285. package/lib/frameworks/koa/index.js.map +1 -1
  286. package/lib/frameworks/koa/koa.framework.d.ts +17 -0
  287. package/lib/frameworks/koa/koa.framework.d.ts.map +1 -0
  288. package/lib/frameworks/koa/koa.framework.js +1 -1
  289. package/lib/frameworks/koa/koa.framework.js.map +1 -1
  290. package/lib/frameworks/lazy/index.d.ts +2 -0
  291. package/lib/frameworks/lazy/index.d.ts.map +1 -0
  292. package/lib/frameworks/lazy/index.js +1 -1
  293. package/lib/frameworks/lazy/index.js.map +1 -1
  294. package/lib/frameworks/lazy/lazy.framework.d.ts +56 -0
  295. package/lib/frameworks/lazy/lazy.framework.d.ts.map +1 -0
  296. package/lib/frameworks/lazy/lazy.framework.js +1 -1
  297. package/lib/frameworks/lazy/lazy.framework.js.map +1 -1
  298. package/lib/frameworks/trpc/index.d.ts +2 -0
  299. package/lib/frameworks/trpc/index.d.ts.map +1 -0
  300. package/lib/frameworks/trpc/index.js +1 -1
  301. package/lib/frameworks/trpc/index.js.map +1 -1
  302. package/lib/frameworks/trpc/trpc.framework.d.ts +153 -0
  303. package/lib/frameworks/trpc/trpc.framework.d.ts.map +1 -0
  304. package/lib/frameworks/trpc/trpc.framework.js +1 -1
  305. package/lib/frameworks/trpc/trpc.framework.js.map +1 -1
  306. package/lib/handlers/aws/aws-stream.handler.d.ts +89 -0
  307. package/lib/handlers/aws/aws-stream.handler.d.ts.map +1 -0
  308. package/lib/handlers/aws/aws-stream.handler.js +1 -1
  309. package/lib/handlers/aws/aws-stream.handler.js.map +1 -1
  310. package/lib/handlers/aws/index.d.ts +2 -0
  311. package/lib/handlers/aws/index.d.ts.map +1 -0
  312. package/lib/handlers/aws/index.js +1 -1
  313. package/lib/handlers/aws/index.js.map +1 -1
  314. package/lib/handlers/azure/azure.handler.d.ts +45 -0
  315. package/lib/handlers/azure/azure.handler.d.ts.map +1 -0
  316. package/lib/handlers/azure/azure.handler.js +1 -1
  317. package/lib/handlers/azure/azure.handler.js.map +1 -1
  318. package/lib/handlers/azure/index.d.ts +2 -0
  319. package/lib/handlers/azure/index.d.ts.map +1 -0
  320. package/lib/handlers/azure/index.js +1 -1
  321. package/lib/handlers/azure/index.js.map +1 -1
  322. package/lib/handlers/base/index.d.ts +2 -0
  323. package/lib/handlers/base/index.d.ts.map +1 -0
  324. package/lib/handlers/base/index.js +1 -1
  325. package/lib/handlers/base/index.js.map +1 -1
  326. package/lib/handlers/base/raw-request.d.ts +31 -0
  327. package/lib/handlers/base/raw-request.d.ts.map +1 -0
  328. package/lib/handlers/base/raw-request.js +1 -1
  329. package/lib/handlers/base/raw-request.js.map +1 -1
  330. package/lib/handlers/default/default.handler.d.ts +88 -0
  331. package/lib/handlers/default/default.handler.d.ts.map +1 -0
  332. package/lib/handlers/default/default.handler.js +1 -1
  333. package/lib/handlers/default/default.handler.js.map +1 -1
  334. package/lib/handlers/default/index.d.ts +2 -0
  335. package/lib/handlers/default/index.d.ts.map +1 -0
  336. package/lib/handlers/default/index.js +1 -1
  337. package/lib/handlers/default/index.js.map +1 -1
  338. package/lib/handlers/digital-ocean/digital-ocean.handler.d.ts +17 -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 +1 -1
  341. package/lib/handlers/digital-ocean/digital-ocean.handler.js.map +1 -1
  342. package/lib/handlers/digital-ocean/index.d.ts +2 -0
  343. package/lib/handlers/digital-ocean/index.d.ts.map +1 -0
  344. package/lib/handlers/digital-ocean/index.js +1 -1
  345. package/lib/handlers/digital-ocean/index.js.map +1 -1
  346. package/lib/handlers/firebase/http-firebase-v2.handler.d.ts +27 -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 +1 -1
  349. package/lib/handlers/firebase/http-firebase-v2.handler.js.map +1 -1
  350. package/lib/handlers/firebase/http-firebase.handler.d.ts +19 -0
  351. package/lib/handlers/firebase/http-firebase.handler.d.ts.map +1 -0
  352. package/lib/handlers/firebase/http-firebase.handler.js +1 -1
  353. package/lib/handlers/firebase/http-firebase.handler.js.map +1 -1
  354. package/lib/handlers/firebase/index.d.ts +3 -0
  355. package/lib/handlers/firebase/index.d.ts.map +1 -0
  356. package/lib/handlers/firebase/index.js +1 -1
  357. package/lib/handlers/firebase/index.js.map +1 -1
  358. package/lib/handlers/gcp/gcp.handler.d.ts +26 -0
  359. package/lib/handlers/gcp/gcp.handler.d.ts.map +1 -0
  360. package/lib/handlers/gcp/gcp.handler.js +1 -1
  361. package/lib/handlers/gcp/gcp.handler.js.map +1 -1
  362. package/lib/handlers/gcp/index.d.ts +2 -0
  363. package/lib/handlers/gcp/index.d.ts.map +1 -0
  364. package/lib/handlers/gcp/index.js +1 -1
  365. package/lib/handlers/gcp/index.js.map +1 -1
  366. package/lib/handlers/huawei/http-huawei.handler.d.ts +59 -0
  367. package/lib/handlers/huawei/http-huawei.handler.d.ts.map +1 -0
  368. package/lib/handlers/huawei/http-huawei.handler.js +1 -1
  369. package/lib/handlers/huawei/http-huawei.handler.js.map +1 -1
  370. package/lib/handlers/huawei/index.d.ts +2 -0
  371. package/lib/handlers/huawei/index.d.ts.map +1 -0
  372. package/lib/handlers/huawei/index.js +1 -1
  373. package/lib/handlers/huawei/index.js.map +1 -1
  374. package/lib/index.d.ts +6 -0
  375. package/lib/index.d.ts.map +1 -0
  376. package/lib/index.doc.js +1 -1
  377. package/lib/index.doc.js.map +1 -1
  378. package/lib/index.js +1 -1
  379. package/lib/index.js.map +1 -1
  380. package/lib/network/index.d.ts +5 -0
  381. package/lib/network/index.d.ts.map +1 -0
  382. package/lib/network/index.js +1 -1
  383. package/lib/network/index.js.map +1 -1
  384. package/lib/network/request.d.ts +44 -0
  385. package/lib/network/request.d.ts.map +1 -0
  386. package/lib/network/request.js +1 -1
  387. package/lib/network/request.js.map +1 -1
  388. package/lib/network/response-stream.d.ts +41 -0
  389. package/lib/network/response-stream.d.ts.map +1 -0
  390. package/lib/network/response-stream.js +4 -4
  391. package/lib/network/response-stream.js.map +1 -1
  392. package/lib/network/response.d.ts +48 -0
  393. package/lib/network/response.d.ts.map +1 -0
  394. package/lib/network/response.js +2 -2
  395. package/lib/network/response.js.map +1 -1
  396. package/lib/network/utils.d.ts +9 -0
  397. package/lib/network/utils.d.ts.map +1 -0
  398. package/lib/network/utils.js +1 -1
  399. package/lib/network/utils.js.map +1 -1
  400. package/lib/resolvers/aws-context/aws-context.resolver.d.ts +19 -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 +1 -1
  403. package/lib/resolvers/aws-context/aws-context.resolver.js.map +1 -1
  404. package/lib/resolvers/aws-context/index.d.ts +2 -0
  405. package/lib/resolvers/aws-context/index.d.ts.map +1 -0
  406. package/lib/resolvers/aws-context/index.js +1 -1
  407. package/lib/resolvers/aws-context/index.js.map +1 -1
  408. package/lib/resolvers/callback/callback.resolver.d.ts +23 -0
  409. package/lib/resolvers/callback/callback.resolver.d.ts.map +1 -0
  410. package/lib/resolvers/callback/callback.resolver.js +1 -1
  411. package/lib/resolvers/callback/callback.resolver.js.map +1 -1
  412. package/lib/resolvers/callback/index.d.ts +2 -0
  413. package/lib/resolvers/callback/index.d.ts.map +1 -0
  414. package/lib/resolvers/callback/index.js +1 -1
  415. package/lib/resolvers/callback/index.js.map +1 -1
  416. package/lib/resolvers/dummy/dummy.resolver.d.ts +14 -0
  417. package/lib/resolvers/dummy/dummy.resolver.d.ts.map +1 -0
  418. package/lib/resolvers/dummy/dummy.resolver.js +1 -1
  419. package/lib/resolvers/dummy/dummy.resolver.js.map +1 -1
  420. package/lib/resolvers/dummy/index.d.ts +2 -0
  421. package/lib/resolvers/dummy/index.d.ts.map +1 -0
  422. package/lib/resolvers/dummy/index.js +1 -1
  423. package/lib/resolvers/dummy/index.js.map +1 -1
  424. package/lib/resolvers/promise/index.d.ts +2 -0
  425. package/lib/resolvers/promise/index.d.ts.map +1 -0
  426. package/lib/resolvers/promise/index.js +1 -1
  427. package/lib/resolvers/promise/index.js.map +1 -1
  428. package/lib/resolvers/promise/promise.resolver.d.ts +14 -0
  429. package/lib/resolvers/promise/promise.resolver.d.ts.map +1 -0
  430. package/lib/resolvers/promise/promise.resolver.js +1 -1
  431. package/lib/resolvers/promise/promise.resolver.js.map +1 -1
  432. package/lib/serverless-adapter.d.ts +119 -0
  433. package/lib/serverless-adapter.d.ts.map +1 -0
  434. package/lib/serverless-adapter.js +1 -1
  435. package/lib/serverless-adapter.js.map +1 -1
  436. package/package.json +2 -3
@@ -1,2 +1,2 @@
1
- "use strict";var u=Object.defineProperty,_=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,s=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},i=(t,e,n,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!a.call(t,r)&&r!==n&&u(t,r,{get:()=>e[r],enumerable:!(p=_(e,r))||p.enumerable});return t},l=t=>i(u({},"__esModule",{value:!0}),t),v={};s(v,{getCurrentInvoke:()=>O,setCurrentInvoke:()=>y});module.exports=l(v);const o={context:null,event:null};function O(){return o}function y({event:t,context:e}){o.event=t,o.context=e}
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
2
  //# sourceMappingURL=current-invoke.js.map
@@ -1 +1 @@
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":["current_invoke_exports","__export","getCurrentInvoke","setCurrentInvoke","__toCommonJS","currentInvoke","event","context"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,iBAAA,IAAAE,EAAA,iBAAA,IAAAC,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAJ,CAAA,EAsBA,MAAMK,EAAyC,CAC7C,QAAS,KACT,MAAO,IACT,EAgBO,SAASH,GAGd,CACO,OAAAG,CACT,CAaO,SAASF,EAA+C,CAC7D,MAAAG,EACA,QAAAC,CACF,EAAoC,CAClCF,EAAc,MAAQC,EACtBD,EAAc,QAAUE,CAC1B"}
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"}
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ /**
3
+ * Get the event body as buffer from body string with content length
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const body = '{}';
8
+ * const [buffer, contentLength] = getEventBodyAsBuffer(body, false);
9
+ * console.log(buffer);
10
+ * // <Buffer 7b 7d>
11
+ * console.log(contentLength);
12
+ * // 2
13
+ * ```
14
+ *
15
+ * @param body - The body string that can be encoded or not
16
+ * @param isBase64Encoded - Tells if body string is encoded in base64
17
+ *
18
+ * @breadcrumb Core
19
+ * @public
20
+ */
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,2 +1,2 @@
1
- "use strict";var f=Object.defineProperty,u=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,s=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _(e))!a.call(t,o)&&o!==r&&f(t,o,{get:()=>e[o],enumerable:!(n=u(e,o))||n.enumerable});return t},v=t=>c(f({},"__esModule",{value:!0}),t),p={};s(p,{getEventBodyAsBuffer:()=>y});module.exports=v(p);function y(t,e){const r=e?"base64":"utf8",n=Buffer.from(t,r),o=Buffer.byteLength(n,r);return[n,o]}
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
2
  //# sourceMappingURL=event-body.js.map
@@ -1 +1 @@
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":["event_body_exports","__export","getEventBodyAsBuffer","__toCommonJS","body","isBase64Encoded","encoding","buffer","contentLength"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,qBAAA,IAAAE,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAH,CAAA,EAmBO,SAASE,EACdE,EACAC,EACuC,CACjC,MAAAC,EAA2BD,EAAkB,SAAW,OAExDE,EAAS,OAAO,KAAKH,EAAME,CAAQ,EACnCE,EAAgB,OAAO,WAAWD,EAAQD,CAAQ,EAEjD,MAAA,CAACC,EAAQC,CAAa,CAC/B"}
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"}
@@ -0,0 +1,73 @@
1
+ import { BothValueHeaders } from '../@types';
2
+ /**
3
+ * Transform a header map and make sure the value is not an array
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const headers = { 'accept-encoding': 'gzip', 'accept-language': ['en-US', 'en;q=0.9'] };
8
+ * const flattenedHeaders = getFlattenedHeadersMap(headers, ',', true);
9
+ * console.log(flattenedHeaders);
10
+ * // { 'accept-encoding': 'gzip', 'accept-language': 'en-US,en;q=0.9' }
11
+ * ```
12
+ *
13
+ * @param headersMap - The initial headers
14
+ * @param separator - The separator used when we join the array of header's value
15
+ * @param lowerCaseKey - Should put all keys in lowercase
16
+ *
17
+ * @breadcrumb Core / Headers
18
+ * @public
19
+ */
20
+ export declare function getFlattenedHeadersMap(headersMap: BothValueHeaders, separator?: string, lowerCaseKey?: boolean): Record<string, string>;
21
+ /**
22
+ * Transforms a header map into a multi-value map header.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const headers = { 'accept-encoding': 'gzip', 'connection': ['keep-alive'] };
27
+ * const multiValueHeaders = getMultiValueHeadersMap(headers);
28
+ * console.log(multiValueHeaders);
29
+ * // { 'accept-encoding': ['gzip'], 'connection': ['keep-alive'] }
30
+ * ```
31
+ *
32
+ * @param headersMap - The initial headers
33
+ *
34
+ * @breadcrumb Core / Headers
35
+ * @public
36
+ */
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;
63
+ /**
64
+ * Parse HTTP Raw Headers
65
+ * Attribution to {@link https://github.com/kesla/parse-headers/blob/master/parse-headers.js}
66
+ *
67
+ * @param headers - The raw headers
68
+ *
69
+ * @breadcrumb Core / Headers
70
+ * @public
71
+ */
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"}
@@ -1,3 +1,3 @@
1
- "use strict";var u=Object.defineProperty,p=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,f=(t,e)=>{for(var s in e)u(t,s,{get:e[s],enumerable:!0})},y=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of c(e))!d.call(t,o)&&o!==s&&u(t,o,{get:()=>e[o],enumerable:!(r=p(e,o))||r.enumerable});return t},_=t=>y(u({},"__esModule",{value:!0}),t),l={};f(l,{getFlattenedHeadersMap:()=>g,getFlattenedHeadersMapAndCookies:()=>w,getMultiValueHeadersMap:()=>O,parseHeaders:()=>k});module.exports=_(l);function g(t,e=",",s=!1){return Object.keys(t).reduce((r,o)=>{const i=s?o.toLowerCase():o,n=t[o];return Array.isArray(n)?r[i]=n.join(e):r[i]=(n??"")+"",r},{})}function O(t){return Object.keys(t).reduce((e,s)=>{const r=t[s];return e[s.toLowerCase()]=Array.isArray(r)?r.map(String):[String(r)],e},{})}function w(t){return Object.keys(t).reduce((e,s)=>{const r=t[s],o=s.toLowerCase();return Array.isArray(r)?o!=="set-cookie"?e.headers[s]=r.join(","):e.cookies.push(...r):o==="set-cookie"&&r!==void 0?e.cookies.push(r??""):e.headers[s]=String(r??""),e},{cookies:[],headers:{}})}function k(t){if(!t)return{};const e={},s=t.trim().split(`
2
- `);for(let r=0;r<s.length;r++){const o=s[r],i=o.indexOf(":"),n=o.slice(0,i).trim().toLowerCase(),a=o.slice(i+1).trim();typeof e[n]>"u"?e[n]=a:Array.isArray(e[n])?e[n].push(a):e[n]=[e[n],a]}return e}
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),headers_exports={};__export(headers_exports,{getFlattenedHeadersMap:()=>getFlattenedHeadersMap,getFlattenedHeadersMapAndCookies:()=>getFlattenedHeadersMapAndCookies,getMultiValueHeadersMap:()=>getMultiValueHeadersMap,parseHeaders:()=>parseHeaders});module.exports=__toCommonJS(headers_exports);function getFlattenedHeadersMap(headersMap,separator=",",lowerCaseKey=!1){return Object.keys(headersMap).reduce((acc,headerKey)=>{const newKey=lowerCaseKey?headerKey.toLowerCase():headerKey,headerValue=headersMap[headerKey];return Array.isArray(headerValue)?acc[newKey]=headerValue.join(separator):acc[newKey]=(headerValue??"")+"",acc},{})}function getMultiValueHeadersMap(headersMap){return Object.keys(headersMap).reduce((acc,headerKey)=>{const headerValue=headersMap[headerKey];return acc[headerKey.toLowerCase()]=Array.isArray(headerValue)?headerValue.map(String):[String(headerValue)],acc},{})}function getFlattenedHeadersMapAndCookies(headersMap){return Object.keys(headersMap).reduce((acc,headerKey)=>{const headerValue=headersMap[headerKey],lowerHeaderKey=headerKey.toLowerCase();return Array.isArray(headerValue)?lowerHeaderKey!=="set-cookie"?acc.headers[headerKey]=headerValue.join(","):acc.cookies.push(...headerValue):lowerHeaderKey==="set-cookie"&&headerValue!==void 0?acc.cookies.push(headerValue??""):acc.headers[headerKey]=String(headerValue??""),acc},{cookies:[],headers:{}})}function parseHeaders(headers){if(!headers)return{};const result={},headersArr=headers.trim().split(`
2
+ `);for(let i=0;i<headersArr.length;i++){const row=headersArr[i],index=row.indexOf(":"),key=row.slice(0,index).trim().toLowerCase(),value=row.slice(index+1).trim();typeof result[key]>"u"?result[key]=value:Array.isArray(result[key])?result[key].push(value):result[key]=[result[key],value]}return result}
3
3
  //# sourceMappingURL=headers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"headers.js","sources":["../../src/core/headers.ts"],"sourcesContent":["//#region Imports\n\nimport { BothValueHeaders } from '../@types';\n\n//#endregion\n\n/**\n * Transform a header map and make sure the value is not an array\n *\n * @example\n * ```typescript\n * const headers = { 'accept-encoding': 'gzip', 'accept-language': ['en-US', 'en;q=0.9'] };\n * const flattenedHeaders = getFlattenedHeadersMap(headers, ',', true);\n * console.log(flattenedHeaders);\n * // { 'accept-encoding': 'gzip', 'accept-language': 'en-US,en;q=0.9' }\n * ```\n *\n * @param headersMap - The initial headers\n * @param separator - The separator used when we join the array of header's value\n * @param lowerCaseKey - Should put all keys in lowercase\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function getFlattenedHeadersMap(\n headersMap: BothValueHeaders,\n separator: string = ',',\n lowerCaseKey: boolean = false,\n): Record<string, string> {\n return Object.keys(headersMap).reduce((acc, headerKey) => {\n const newKey = lowerCaseKey ? headerKey.toLowerCase() : headerKey;\n const headerValue = headersMap[headerKey];\n\n if (Array.isArray(headerValue)) acc[newKey] = headerValue.join(separator);\n else acc[newKey] = (headerValue ?? '') + '';\n\n return acc;\n }, {});\n}\n\n/**\n * Transforms a header map into a multi-value map header.\n *\n * @example\n * ```typescript\n * const headers = { 'accept-encoding': 'gzip', 'connection': ['keep-alive'] };\n * const multiValueHeaders = getMultiValueHeadersMap(headers);\n * console.log(multiValueHeaders);\n * // { 'accept-encoding': ['gzip'], 'connection': ['keep-alive'] }\n * ```\n *\n * @param headersMap - The initial headers\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function getMultiValueHeadersMap(\n headersMap: BothValueHeaders,\n): Record<string, string[]> {\n return Object.keys(headersMap).reduce((acc, headerKey) => {\n const headerValue = headersMap[headerKey];\n\n acc[headerKey.toLowerCase()] = Array.isArray(headerValue)\n ? headerValue.map(String)\n : [String(headerValue)];\n\n return acc;\n }, {});\n}\n\n/**\n * The wrapper that holds the information about single value headers and cookies\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport type FlattenedHeadersAndCookies = {\n /**\n * Just the single value headers\n */\n headers: Record<string, string>;\n\n /**\n * The list of cookies\n */\n cookies: string[];\n};\n\n/**\n * Transforms a header map into a single value headers and cookies\n *\n * @param headersMap - The initial headers\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function getFlattenedHeadersMapAndCookies(\n headersMap: BothValueHeaders,\n): FlattenedHeadersAndCookies {\n return Object.keys(headersMap).reduce(\n (acc, headerKey) => {\n const headerValue = headersMap[headerKey];\n const lowerHeaderKey = headerKey.toLowerCase();\n\n if (Array.isArray(headerValue)) {\n if (lowerHeaderKey !== 'set-cookie')\n acc.headers[headerKey] = headerValue.join(',');\n else acc.cookies.push(...headerValue);\n } else {\n if (lowerHeaderKey === 'set-cookie' && headerValue !== undefined)\n acc.cookies.push(headerValue ?? '');\n else acc.headers[headerKey] = String(headerValue ?? '');\n }\n\n return acc;\n },\n {\n cookies: [],\n headers: {},\n } as FlattenedHeadersAndCookies,\n );\n}\n\n/**\n * Parse HTTP Raw Headers\n * Attribution to {@link https://github.com/kesla/parse-headers/blob/master/parse-headers.js}\n *\n * @param headers - The raw headers\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function parseHeaders(\n headers: string,\n): Record<string, string | string[]> {\n if (!headers) return {};\n\n const result = {};\n const headersArr = headers.trim().split('\\n');\n\n for (let i = 0; i < headersArr.length; i++) {\n const row = headersArr[i];\n const index = row.indexOf(':');\n const key = row.slice(0, index).trim().toLowerCase();\n const value = row.slice(index + 1).trim();\n\n if (typeof result[key] === 'undefined') result[key] = value;\n else if (Array.isArray(result[key])) result[key].push(value);\n else result[key] = [result[key], value];\n }\n\n return result;\n}\n"],"names":["headers_exports","__export","getFlattenedHeadersMap","getFlattenedHeadersMapAndCookies","getMultiValueHeadersMap","parseHeaders","__toCommonJS","headersMap","separator","lowerCaseKey","acc","headerKey","newKey","headerValue","lowerHeaderKey","headers","result","headersArr","i","row","index","key","value"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,uBAAA,IAAAE,EAAA,iCAAA,IAAAC,EAAA,wBAAA,IAAAC,EAAA,aAAA,IAAAC,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAN,CAAA,EAwBO,SAASE,EACdK,EACAC,EAAoB,IACpBC,EAAwB,GACA,CACxB,OAAO,OAAO,KAAKF,CAAU,EAAE,OAAO,CAACG,EAAKC,IAAc,CACxD,MAAMC,EAASH,EAAeE,EAAU,YAAA,EAAgBA,EAClDE,EAAcN,EAAWI,CAAS,EAEpC,OAAA,MAAM,QAAQE,CAAW,EAAGH,EAAIE,CAAM,EAAIC,EAAY,KAAKL,CAAS,EAC/DE,EAAAE,CAAM,GAAKC,GAAe,IAAM,GAElCH,CACT,EAAG,CAAE,CAAA,CACP,CAkBO,SAASN,EACdG,EAC0B,CAC1B,OAAO,OAAO,KAAKA,CAAU,EAAE,OAAO,CAACG,EAAKC,IAAc,CAClD,MAAAE,EAAcN,EAAWI,CAAS,EAExC,OAAAD,EAAIC,EAAU,YAAA,CAAa,EAAI,MAAM,QAAQE,CAAW,EACpDA,EAAY,IAAI,MAAM,EACtB,CAAC,OAAOA,CAAW,CAAC,EAEjBH,CACT,EAAG,CAAE,CAAA,CACP,CA4BO,SAASP,EACdI,EAC4B,CACrB,OAAA,OAAO,KAAKA,CAAU,EAAE,OAC7B,CAACG,EAAKC,IAAc,CACZ,MAAAE,EAAcN,EAAWI,CAAS,EAClCG,EAAiBH,EAAU,cAE7B,OAAA,MAAM,QAAQE,CAAW,EACvBC,IAAmB,aACrBJ,EAAI,QAAQC,CAAS,EAAIE,EAAY,KAAK,GAAG,EACtCH,EAAA,QAAQ,KAAK,GAAGG,CAAW,EAEhCC,IAAmB,cAAgBD,IAAgB,OACjDH,EAAA,QAAQ,KAAKG,GAAe,EAAE,EAC/BH,EAAI,QAAQC,CAAS,EAAI,OAAOE,GAAe,EAAE,EAGjDH,CACT,EACA,CACE,QAAS,CAAC,EACV,QAAS,CAAC,CACZ,CAAA,CAEJ,CAWO,SAASL,EACdU,EACmC,CACnC,GAAI,CAACA,EAAS,MAAO,GAErB,MAAMC,EAAS,CAAA,EACTC,EAAaF,EAAQ,KAAK,EAAE,MAAM;AAAA,CAAI,EAE5C,QAASG,EAAI,EAAGA,EAAID,EAAW,OAAQC,IAAK,CACpC,MAAAC,EAAMF,EAAWC,CAAC,EAClBE,EAAQD,EAAI,QAAQ,GAAG,EACvBE,EAAMF,EAAI,MAAM,EAAGC,CAAK,EAAE,OAAO,cACjCE,EAAQH,EAAI,MAAMC,EAAQ,CAAC,EAAE,OAE/B,OAAOJ,EAAOK,CAAG,EAAM,IAAaL,EAAOK,CAAG,EAAIC,EAC7C,MAAM,QAAQN,EAAOK,CAAG,CAAC,EAAUL,EAAAK,CAAG,EAAE,KAAKC,CAAK,EACtDN,EAAOK,CAAG,EAAI,CAACL,EAAOK,CAAG,EAAGC,CAAK,EAGjC,OAAAN,CACT"}
1
+ {"version":3,"file":"headers.js","sources":["../../src/core/headers.ts"],"sourcesContent":["//#region Imports\n\nimport { BothValueHeaders } from '../@types';\n\n//#endregion\n\n/**\n * Transform a header map and make sure the value is not an array\n *\n * @example\n * ```typescript\n * const headers = { 'accept-encoding': 'gzip', 'accept-language': ['en-US', 'en;q=0.9'] };\n * const flattenedHeaders = getFlattenedHeadersMap(headers, ',', true);\n * console.log(flattenedHeaders);\n * // { 'accept-encoding': 'gzip', 'accept-language': 'en-US,en;q=0.9' }\n * ```\n *\n * @param headersMap - The initial headers\n * @param separator - The separator used when we join the array of header's value\n * @param lowerCaseKey - Should put all keys in lowercase\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function getFlattenedHeadersMap(\n headersMap: BothValueHeaders,\n separator: string = ',',\n lowerCaseKey: boolean = false,\n): Record<string, string> {\n return Object.keys(headersMap).reduce((acc, headerKey) => {\n const newKey = lowerCaseKey ? headerKey.toLowerCase() : headerKey;\n const headerValue = headersMap[headerKey];\n\n if (Array.isArray(headerValue)) acc[newKey] = headerValue.join(separator);\n else acc[newKey] = (headerValue ?? '') + '';\n\n return acc;\n }, {});\n}\n\n/**\n * Transforms a header map into a multi-value map header.\n *\n * @example\n * ```typescript\n * const headers = { 'accept-encoding': 'gzip', 'connection': ['keep-alive'] };\n * const multiValueHeaders = getMultiValueHeadersMap(headers);\n * console.log(multiValueHeaders);\n * // { 'accept-encoding': ['gzip'], 'connection': ['keep-alive'] }\n * ```\n *\n * @param headersMap - The initial headers\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function getMultiValueHeadersMap(\n headersMap: BothValueHeaders,\n): Record<string, string[]> {\n return Object.keys(headersMap).reduce((acc, headerKey) => {\n const headerValue = headersMap[headerKey];\n\n acc[headerKey.toLowerCase()] = Array.isArray(headerValue)\n ? headerValue.map(String)\n : [String(headerValue)];\n\n return acc;\n }, {});\n}\n\n/**\n * The wrapper that holds the information about single value headers and cookies\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport type FlattenedHeadersAndCookies = {\n /**\n * Just the single value headers\n */\n headers: Record<string, string>;\n\n /**\n * The list of cookies\n */\n cookies: string[];\n};\n\n/**\n * Transforms a header map into a single value headers and cookies\n *\n * @param headersMap - The initial headers\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function getFlattenedHeadersMapAndCookies(\n headersMap: BothValueHeaders,\n): FlattenedHeadersAndCookies {\n return Object.keys(headersMap).reduce(\n (acc, headerKey) => {\n const headerValue = headersMap[headerKey];\n const lowerHeaderKey = headerKey.toLowerCase();\n\n if (Array.isArray(headerValue)) {\n if (lowerHeaderKey !== 'set-cookie')\n acc.headers[headerKey] = headerValue.join(',');\n else acc.cookies.push(...headerValue);\n } else {\n if (lowerHeaderKey === 'set-cookie' && headerValue !== undefined)\n acc.cookies.push(headerValue ?? '');\n else acc.headers[headerKey] = String(headerValue ?? '');\n }\n\n return acc;\n },\n {\n cookies: [],\n headers: {},\n } as FlattenedHeadersAndCookies,\n );\n}\n\n/**\n * Parse HTTP Raw Headers\n * Attribution to {@link https://github.com/kesla/parse-headers/blob/master/parse-headers.js}\n *\n * @param headers - The raw headers\n *\n * @breadcrumb Core / Headers\n * @public\n */\nexport function parseHeaders(\n headers: string,\n): Record<string, string | string[]> {\n if (!headers) return {};\n\n const result = {};\n const headersArr = headers.trim().split('\\n');\n\n for (let i = 0; i < headersArr.length; i++) {\n const row = headersArr[i];\n const index = row.indexOf(':');\n const key = row.slice(0, index).trim().toLowerCase();\n const value = row.slice(index + 1).trim();\n\n if (typeof result[key] === 'undefined') result[key] = value;\n else if (Array.isArray(result[key])) result[key].push(value);\n else result[key] = [result[key], value];\n }\n\n return result;\n}\n"],"names":[],"mappings":"ooBAAA,gBAAA,CAAA,EAAA,SAAA,gBAAA,CAAA,uBAAA,IAAA,uBAAA,iCAAA,IAAA,iCAAA,wBAAA,IAAA,wBAAA,aAAA,IAAA,YAAA,CAAA,EAAA,OAAA,QAAA,aAAA,eAAA,EAwBO,SAAS,uBACd,WACA,UAAoB,IACpB,aAAwB,GACA,CACxB,OAAO,OAAO,KAAK,UAAU,EAAE,OAAO,CAAC,IAAK,YAAc,CACxD,MAAM,OAAS,aAAe,UAAU,YAAA,EAAgB,UAClD,YAAc,WAAW,SAAS,EAEpC,OAAA,MAAM,QAAQ,WAAW,EAAG,IAAI,MAAM,EAAI,YAAY,KAAK,SAAS,EAC/D,IAAA,MAAM,GAAK,aAAe,IAAM,GAElC,GACT,EAAG,CAAE,CAAA,CACP,CAkBO,SAAS,wBACd,WAC0B,CAC1B,OAAO,OAAO,KAAK,UAAU,EAAE,OAAO,CAAC,IAAK,YAAc,CAClD,MAAA,YAAc,WAAW,SAAS,EAExC,WAAI,UAAU,YAAA,CAAa,EAAI,MAAM,QAAQ,WAAW,EACpD,YAAY,IAAI,MAAM,EACtB,CAAC,OAAO,WAAW,CAAC,EAEjB,GACT,EAAG,CAAE,CAAA,CACP,CA4BO,SAAS,iCACd,WAC4B,CACrB,OAAA,OAAO,KAAK,UAAU,EAAE,OAC7B,CAAC,IAAK,YAAc,CACZ,MAAA,YAAc,WAAW,SAAS,EAClC,eAAiB,UAAU,cAE7B,OAAA,MAAM,QAAQ,WAAW,EACvB,iBAAmB,aACrB,IAAI,QAAQ,SAAS,EAAI,YAAY,KAAK,GAAG,EACtC,IAAA,QAAQ,KAAK,GAAG,WAAW,EAEhC,iBAAmB,cAAgB,cAAgB,OACjD,IAAA,QAAQ,KAAK,aAAe,EAAE,EAC/B,IAAI,QAAQ,SAAS,EAAI,OAAO,aAAe,EAAE,EAGjD,GACT,EACA,CACE,QAAS,CAAC,EACV,QAAS,CAAC,CACZ,CAAA,CAEJ,CAWO,SAAS,aACd,QACmC,CACnC,GAAI,CAAC,QAAS,MAAO,GAErB,MAAM,OAAS,CAAA,EACT,WAAa,QAAQ,KAAK,EAAE,MAAM;AAAA,CAAI,EAE5C,QAAS,EAAI,EAAG,EAAI,WAAW,OAAQ,IAAK,CACpC,MAAA,IAAM,WAAW,CAAC,EAClB,MAAQ,IAAI,QAAQ,GAAG,EACvB,IAAM,IAAI,MAAM,EAAG,KAAK,EAAE,OAAO,cACjC,MAAQ,IAAI,MAAM,MAAQ,CAAC,EAAE,OAE/B,OAAO,OAAO,GAAG,EAAM,IAAa,OAAO,GAAG,EAAI,MAC7C,MAAM,QAAQ,OAAO,GAAG,CAAC,EAAU,OAAA,GAAG,EAAE,KAAK,KAAK,EACtD,OAAO,GAAG,EAAI,CAAC,OAAO,GAAG,EAAG,KAAK,EAGjC,OAAA,MACT"}
@@ -0,0 +1,12 @@
1
+ export * from './base-handler';
2
+ export * from './constants';
3
+ export * from './current-invoke';
4
+ export * from './event-body';
5
+ export * from './headers';
6
+ export * from './is-binary';
7
+ export * from './logger';
8
+ export * from './no-op';
9
+ export * from './optional';
10
+ export * from './path';
11
+ export * from './stream';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
package/lib/core/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty,_=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,u=(o,t,s,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of x(t))!n.call(o,p)&&p!==s&&i(o,p,{get:()=>t[p],enumerable:!(a=_(t,p))||a.enumerable});return o},r=(o,t,s)=>(u(o,t,"default"),s&&u(s,t,"default")),q=o=>u(i({},"__esModule",{value:!0}),o),e={};module.exports=q(e);r(e,require("./base-handler"),module.exports);r(e,require("./constants"),module.exports);r(e,require("./current-invoke"),module.exports);r(e,require("./event-body"),module.exports);r(e,require("./headers"),module.exports);r(e,require("./is-binary"),module.exports);r(e,require("./logger"),module.exports);r(e,require("./no-op"),module.exports);r(e,require("./optional"),module.exports);r(e,require("./path"),module.exports);r(e,require("./stream"),module.exports);
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),core_exports={};module.exports=__toCommonJS(core_exports);__reExport(core_exports,require("./base-handler"),module.exports);__reExport(core_exports,require("./constants"),module.exports);__reExport(core_exports,require("./current-invoke"),module.exports);__reExport(core_exports,require("./event-body"),module.exports);__reExport(core_exports,require("./headers"),module.exports);__reExport(core_exports,require("./is-binary"),module.exports);__reExport(core_exports,require("./logger"),module.exports);__reExport(core_exports,require("./no-op"),module.exports);__reExport(core_exports,require("./optional"),module.exports);__reExport(core_exports,require("./path"),module.exports);__reExport(core_exports,require("./stream"),module.exports);
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/core/index.ts"],"sourcesContent":["export * from './base-handler';\nexport * from './constants';\nexport * from './current-invoke';\nexport * from './event-body';\nexport * from './headers';\nexport * from './is-binary';\nexport * from './logger';\nexport * from './no-op';\nexport * from './optional';\nexport * from './path';\nexport * from './stream';\n"],"names":["core_exports","__toCommonJS","__reExport"],"mappings":"6YAAAA,EAAA,CAAA,EAAA,OAAA,QAAAC,EAAAD,CAAA,EAAAE,EAAAF,EAAc,QAAd,gBAAA,EAAA,OAAA,OAAA,EACAE,EAAAF,EAAc,QADd,aAAA,EAAA,OAAA,OAAA,EAEAE,EAAAF,EAAc,QAFd,kBAAA,EAAA,OAAA,OAAA,EAGAE,EAAAF,EAAc,QAHd,cAAA,EAAA,OAAA,OAAA,EAIAE,EAAAF,EAAc,QAJd,WAAA,EAAA,OAAA,OAAA,EAKAE,EAAAF,EAAc,QALd,aAAA,EAAA,OAAA,OAAA,EAMAE,EAAAF,EAAc,QANd,UAAA,EAAA,OAAA,OAAA,EAOAE,EAAAF,EAAc,QAPd,SAAA,EAAA,OAAA,OAAA,EAQAE,EAAAF,EAAc,QARd,YAAA,EAAA,OAAA,OAAA,EASAE,EAAAF,EAAc,QATd,QAAA,EAAA,OAAA,OAAA,EAUAE,EAAAF,EAAc,QAVd,UAAA,EAAA,OAAA,OAAA"}
1
+ {"version":3,"file":"index.js","sources":["../../src/core/index.ts"],"sourcesContent":["export * from './base-handler';\nexport * from './constants';\nexport * from './current-invoke';\nexport * from './event-body';\nexport * from './headers';\nexport * from './is-binary';\nexport * from './logger';\nexport * from './no-op';\nexport * from './optional';\nexport * from './path';\nexport * from './stream';\n"],"names":[],"mappings":"kqBAAA,aAAA,CAAA,EAAA,OAAA,QAAA,aAAA,YAAA,EAAA,WAAA,aAAc,QAAd,gBAAA,EAAA,OAAA,OAAA,EACA,WAAA,aAAc,QADd,aAAA,EAAA,OAAA,OAAA,EAEA,WAAA,aAAc,QAFd,kBAAA,EAAA,OAAA,OAAA,EAGA,WAAA,aAAc,QAHd,cAAA,EAAA,OAAA,OAAA,EAIA,WAAA,aAAc,QAJd,WAAA,EAAA,OAAA,OAAA,EAKA,WAAA,aAAc,QALd,aAAA,EAAA,OAAA,OAAA,EAMA,WAAA,aAAc,QANd,UAAA,EAAA,OAAA,OAAA,EAOA,WAAA,aAAc,QAPd,SAAA,EAAA,OAAA,OAAA,EAQA,WAAA,aAAc,QARd,YAAA,EAAA,OAAA,OAAA,EASA,WAAA,aAAc,QATd,QAAA,EAAA,OAAA,OAAA,EAUA,WAAA,aAAc,QAVd,UAAA,EAAA,OAAA,OAAA"}
@@ -0,0 +1,73 @@
1
+ import { BinarySettings, BothValueHeaders } from '../@types';
2
+ /**
3
+ * The function that determines by the content encoding whether the response should be treated as binary
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * const headers = { 'content-encoding': 'gzip' };
8
+ * const isBinary = isContentEncodingBinary(headers, ['gzip']);
9
+ * console.log(isBinary);
10
+ * // true
11
+ * ```
12
+ *
13
+ * @param headers - The headers of the response
14
+ * @param binaryEncodingTypes - The list of content encodings that will be treated as binary
15
+ *
16
+ * @breadcrumb Core / isBinary
17
+ * @public
18
+ */
19
+ export declare function isContentEncodingBinary(headers: BothValueHeaders, binaryEncodingTypes: string[]): boolean;
20
+ /**
21
+ * The function that returns the content type of headers
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const headers = { 'content-type': 'application/json' };
26
+ * const contentType = getContentType(headers);
27
+ * console.log(contentType);
28
+ * // application/json
29
+ * ```
30
+ *
31
+ * @param headers - The headers of the response
32
+ *
33
+ * @breadcrumb Core / isBinary
34
+ * @public
35
+ */
36
+ export declare function getContentType(headers: BothValueHeaders): string;
37
+ /**
38
+ * The function that determines by the content type whether the response should be treated as binary
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const headers = { 'content-type': 'image/png' };
43
+ * const isBinary = isContentTypeBinary(headers, new Map([['image/png', true]]));
44
+ * console.log(isBinary);
45
+ * // true
46
+ * ```
47
+ *
48
+ * @param headers - The headers of the response
49
+ * @param binaryContentTypes - The list of content types that will be treated as binary
50
+ *
51
+ * @breadcrumb Core / isBinary
52
+ * @public
53
+ */
54
+ export declare function isContentTypeBinary(headers: BothValueHeaders, binaryContentTypes: string[]): boolean;
55
+ /**
56
+ * The function used to determine from the headers and the binary settings if a response should be encoded or not
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const headers = { 'content-type': 'image/png', 'content-encoding': 'gzip' };
61
+ * const isContentBinary = isBinary(headers, { contentEncodings: ['gzip'], contentTypes: ['image/png'] });
62
+ * console.log(isContentBinary);
63
+ * // true
64
+ * ```
65
+ *
66
+ * @param headers - The headers of the response
67
+ * @param binarySettings - The settings for the validation
68
+ *
69
+ * @breadcrumb Core / isBinary
70
+ * @public
71
+ */
72
+ export declare function isBinary(headers: BothValueHeaders, binarySettings: BinarySettings): boolean;
73
+ //# sourceMappingURL=is-binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-binary.d.ts","sourceRoot":"","sources":["../../src/core/is-binary.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,gBAAgB,EACzB,mBAAmB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAWT;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAchE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,gBAAgB,EACzB,kBAAkB,EAAE,MAAM,EAAE,WAO7B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAWT"}
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty,y=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,f=Object.prototype.hasOwnProperty,_=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},l=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of u(e))!f.call(n,o)&&o!==t&&i(n,o,{get:()=>e[o],enumerable:!(r=y(e,o))||r.enumerable});return n},O=n=>l(i({},"__esModule",{value:!0}),n),c={};_(c,{getContentType:()=>a,isBinary:()=>d,isContentEncodingBinary:()=>s,isContentTypeBinary:()=>p});module.exports=O(c);function s(n,e){let t=n["content-encoding"];return t?(Array.isArray(t)||(t=t.split(",")),t.some(r=>e.includes(r.trim()))):!1}function a(n){const e=n["content-type"],t=Array.isArray(e)?e[0]||"":e||"";if(!e)return"";const r=t.indexOf(";");return r===-1?t:t.slice(0,r)}function p(n,e){const t=a(n);return t?e.includes(t.trim()):!1}function d(n,e){return"isBinary"in e?e.isBinary===!1?!1:e.isBinary(n):s(n,e.contentEncodings)||p(n,e.contentTypes)}
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),is_binary_exports={};__export(is_binary_exports,{getContentType:()=>getContentType,isBinary:()=>isBinary,isContentEncodingBinary:()=>isContentEncodingBinary,isContentTypeBinary:()=>isContentTypeBinary});module.exports=__toCommonJS(is_binary_exports);function isContentEncodingBinary(headers,binaryEncodingTypes){let contentEncodings=headers["content-encoding"];return contentEncodings?(Array.isArray(contentEncodings)||(contentEncodings=contentEncodings.split(",")),contentEncodings.some(value=>binaryEncodingTypes.includes(value.trim()))):!1}function getContentType(headers){const contentTypeHeaderRaw=headers["content-type"],contentTypeHeader=Array.isArray(contentTypeHeaderRaw)?contentTypeHeaderRaw[0]||"":contentTypeHeaderRaw||"";if(!contentTypeHeaderRaw)return"";const contentTypeStart=contentTypeHeader.indexOf(";");return contentTypeStart===-1?contentTypeHeader:contentTypeHeader.slice(0,contentTypeStart)}function isContentTypeBinary(headers,binaryContentTypes){const contentType=getContentType(headers);return contentType?binaryContentTypes.includes(contentType.trim()):!1}function isBinary(headers,binarySettings){return"isBinary"in binarySettings?binarySettings.isBinary===!1?!1:binarySettings.isBinary(headers):isContentEncodingBinary(headers,binarySettings.contentEncodings)||isContentTypeBinary(headers,binarySettings.contentTypes)}
2
2
  //# sourceMappingURL=is-binary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-binary.js","sources":["../../src/core/is-binary.ts"],"sourcesContent":["// ATTRIBUTION: https://github.com/dougmoscrop/serverless-http\n\n//#region Imports\n\nimport { BinarySettings, BothValueHeaders } from '../@types';\n\n//#endregion\n\n/**\n * The function that determines by the content encoding whether the response should be treated as binary\n *\n * @example\n * ```typescript\n * const headers = { 'content-encoding': 'gzip' };\n * const isBinary = isContentEncodingBinary(headers, ['gzip']);\n * console.log(isBinary);\n * // true\n * ```\n *\n * @param headers - The headers of the response\n * @param binaryEncodingTypes - The list of content encodings that will be treated as binary\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function isContentEncodingBinary(\n headers: BothValueHeaders,\n binaryEncodingTypes: string[],\n): boolean {\n let contentEncodings = headers['content-encoding'];\n\n if (!contentEncodings) return false;\n\n if (!Array.isArray(contentEncodings))\n contentEncodings = contentEncodings.split(',');\n\n return contentEncodings.some(value =>\n binaryEncodingTypes.includes(value.trim()),\n );\n}\n\n/**\n * The function that returns the content type of headers\n *\n * @example\n * ```typescript\n * const headers = { 'content-type': 'application/json' };\n * const contentType = getContentType(headers);\n * console.log(contentType);\n * // application/json\n * ```\n *\n * @param headers - The headers of the response\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function getContentType(headers: BothValueHeaders): string {\n const contentTypeHeaderRaw = headers['content-type'];\n const contentTypeHeader = Array.isArray(contentTypeHeaderRaw)\n ? contentTypeHeaderRaw[0] || ''\n : contentTypeHeaderRaw || '';\n\n if (!contentTypeHeaderRaw) return '';\n\n // only compare mime type; ignore encoding part\n const contentTypeStart = contentTypeHeader.indexOf(';');\n\n if (contentTypeStart === -1) return contentTypeHeader;\n\n return contentTypeHeader.slice(0, contentTypeStart);\n}\n\n/**\n * The function that determines by the content type whether the response should be treated as binary\n *\n * @example\n * ```typescript\n * const headers = { 'content-type': 'image/png' };\n * const isBinary = isContentTypeBinary(headers, new Map([['image/png', true]]));\n * console.log(isBinary);\n * // true\n * ```\n *\n * @param headers - The headers of the response\n * @param binaryContentTypes - The list of content types that will be treated as binary\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function isContentTypeBinary(\n headers: BothValueHeaders,\n binaryContentTypes: string[],\n) {\n const contentType = getContentType(headers);\n\n if (!contentType) return false;\n\n return binaryContentTypes.includes(contentType.trim());\n}\n\n/**\n * The function used to determine from the headers and the binary settings if a response should be encoded or not\n *\n * @example\n * ```typescript\n * const headers = { 'content-type': 'image/png', 'content-encoding': 'gzip' };\n * const isContentBinary = isBinary(headers, { contentEncodings: ['gzip'], contentTypes: ['image/png'] });\n * console.log(isContentBinary);\n * // true\n * ```\n *\n * @param headers - The headers of the response\n * @param binarySettings - The settings for the validation\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function isBinary(\n headers: BothValueHeaders,\n binarySettings: BinarySettings,\n): boolean {\n if ('isBinary' in binarySettings) {\n if (binarySettings.isBinary === false) return false;\n\n return binarySettings.isBinary(headers);\n }\n\n return (\n isContentEncodingBinary(headers, binarySettings.contentEncodings) ||\n isContentTypeBinary(headers, binarySettings.contentTypes)\n );\n}\n"],"names":["is_binary_exports","__export","getContentType","isBinary","isContentEncodingBinary","isContentTypeBinary","__toCommonJS","headers","binaryEncodingTypes","contentEncodings","value","contentTypeHeaderRaw","contentTypeHeader","contentTypeStart","binaryContentTypes","contentType","binarySettings"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,eAAA,IAAAE,EAAA,SAAA,IAAAC,EAAA,wBAAA,IAAAC,EAAA,oBAAA,IAAAC,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAN,CAAA,EAyBO,SAASI,EACdG,EACAC,EACS,CACL,IAAAC,EAAmBF,EAAQ,kBAAkB,EAEjD,OAAKE,GAEA,MAAM,QAAQA,CAAgB,IACdA,EAAAA,EAAiB,MAAM,GAAG,GAExCA,EAAiB,KACtBC,GAAAF,EAAoB,SAASE,EAAM,MAAM,CAAA,GANb,EAQhC,CAkBO,SAASR,EAAeK,EAAmC,CAC1D,MAAAI,EAAuBJ,EAAQ,cAAc,EAC7CK,EAAoB,MAAM,QAAQD,CAAoB,EACxDA,EAAqB,CAAC,GAAK,GAC3BA,GAAwB,GAE5B,GAAI,CAACA,EAA6B,MAAA,GAG5B,MAAAE,EAAmBD,EAAkB,QAAQ,GAAG,EAEtD,OAAIC,IAAqB,GAAWD,EAE7BA,EAAkB,MAAM,EAAGC,CAAgB,CACpD,CAmBO,SAASR,EACdE,EACAO,EACA,CACM,MAAAC,EAAcb,EAAeK,CAAO,EAE1C,OAAKQ,EAEED,EAAmB,SAASC,EAAY,KAAM,CAAA,EAF5B,EAG3B,CAmBO,SAASZ,EACdI,EACAS,EACS,CACT,MAAI,aAAcA,EACZA,EAAe,WAAa,GAAc,GAEvCA,EAAe,SAAST,CAAO,EAItCH,EAAwBG,EAASS,EAAe,gBAAgB,GAChEX,EAAoBE,EAASS,EAAe,YAAY,CAE5D"}
1
+ {"version":3,"file":"is-binary.js","sources":["../../src/core/is-binary.ts"],"sourcesContent":["// ATTRIBUTION: https://github.com/dougmoscrop/serverless-http\n\n//#region Imports\n\nimport { BinarySettings, BothValueHeaders } from '../@types';\n\n//#endregion\n\n/**\n * The function that determines by the content encoding whether the response should be treated as binary\n *\n * @example\n * ```typescript\n * const headers = { 'content-encoding': 'gzip' };\n * const isBinary = isContentEncodingBinary(headers, ['gzip']);\n * console.log(isBinary);\n * // true\n * ```\n *\n * @param headers - The headers of the response\n * @param binaryEncodingTypes - The list of content encodings that will be treated as binary\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function isContentEncodingBinary(\n headers: BothValueHeaders,\n binaryEncodingTypes: string[],\n): boolean {\n let contentEncodings = headers['content-encoding'];\n\n if (!contentEncodings) return false;\n\n if (!Array.isArray(contentEncodings))\n contentEncodings = contentEncodings.split(',');\n\n return contentEncodings.some(value =>\n binaryEncodingTypes.includes(value.trim()),\n );\n}\n\n/**\n * The function that returns the content type of headers\n *\n * @example\n * ```typescript\n * const headers = { 'content-type': 'application/json' };\n * const contentType = getContentType(headers);\n * console.log(contentType);\n * // application/json\n * ```\n *\n * @param headers - The headers of the response\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function getContentType(headers: BothValueHeaders): string {\n const contentTypeHeaderRaw = headers['content-type'];\n const contentTypeHeader = Array.isArray(contentTypeHeaderRaw)\n ? contentTypeHeaderRaw[0] || ''\n : contentTypeHeaderRaw || '';\n\n if (!contentTypeHeaderRaw) return '';\n\n // only compare mime type; ignore encoding part\n const contentTypeStart = contentTypeHeader.indexOf(';');\n\n if (contentTypeStart === -1) return contentTypeHeader;\n\n return contentTypeHeader.slice(0, contentTypeStart);\n}\n\n/**\n * The function that determines by the content type whether the response should be treated as binary\n *\n * @example\n * ```typescript\n * const headers = { 'content-type': 'image/png' };\n * const isBinary = isContentTypeBinary(headers, new Map([['image/png', true]]));\n * console.log(isBinary);\n * // true\n * ```\n *\n * @param headers - The headers of the response\n * @param binaryContentTypes - The list of content types that will be treated as binary\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function isContentTypeBinary(\n headers: BothValueHeaders,\n binaryContentTypes: string[],\n) {\n const contentType = getContentType(headers);\n\n if (!contentType) return false;\n\n return binaryContentTypes.includes(contentType.trim());\n}\n\n/**\n * The function used to determine from the headers and the binary settings if a response should be encoded or not\n *\n * @example\n * ```typescript\n * const headers = { 'content-type': 'image/png', 'content-encoding': 'gzip' };\n * const isContentBinary = isBinary(headers, { contentEncodings: ['gzip'], contentTypes: ['image/png'] });\n * console.log(isContentBinary);\n * // true\n * ```\n *\n * @param headers - The headers of the response\n * @param binarySettings - The settings for the validation\n *\n * @breadcrumb Core / isBinary\n * @public\n */\nexport function isBinary(\n headers: BothValueHeaders,\n binarySettings: BinarySettings,\n): boolean {\n if ('isBinary' in binarySettings) {\n if (binarySettings.isBinary === false) return false;\n\n return binarySettings.isBinary(headers);\n }\n\n return (\n isContentEncodingBinary(headers, binarySettings.contentEncodings) ||\n isContentTypeBinary(headers, binarySettings.contentTypes)\n );\n}\n"],"names":[],"mappings":"ooBAAA,kBAAA,CAAA,EAAA,SAAA,kBAAA,CAAA,eAAA,IAAA,eAAA,SAAA,IAAA,SAAA,wBAAA,IAAA,wBAAA,oBAAA,IAAA,mBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,iBAAA,EAyBO,SAAS,wBACd,QACA,oBACS,CACL,IAAA,iBAAmB,QAAQ,kBAAkB,EAEjD,OAAK,kBAEA,MAAM,QAAQ,gBAAgB,IACd,iBAAA,iBAAiB,MAAM,GAAG,GAExC,iBAAiB,KACtB,OAAA,oBAAoB,SAAS,MAAM,MAAM,CAAA,GANb,EAQhC,CAkBO,SAAS,eAAe,QAAmC,CAC1D,MAAA,qBAAuB,QAAQ,cAAc,EAC7C,kBAAoB,MAAM,QAAQ,oBAAoB,EACxD,qBAAqB,CAAC,GAAK,GAC3B,sBAAwB,GAE5B,GAAI,CAAC,qBAA6B,MAAA,GAG5B,MAAA,iBAAmB,kBAAkB,QAAQ,GAAG,EAEtD,OAAI,mBAAqB,GAAW,kBAE7B,kBAAkB,MAAM,EAAG,gBAAgB,CACpD,CAmBO,SAAS,oBACd,QACA,mBACA,CACM,MAAA,YAAc,eAAe,OAAO,EAE1C,OAAK,YAEE,mBAAmB,SAAS,YAAY,KAAM,CAAA,EAF5B,EAG3B,CAmBO,SAAS,SACd,QACA,eACS,CACT,MAAI,aAAc,eACZ,eAAe,WAAa,GAAc,GAEvC,eAAe,SAAS,OAAO,EAItC,wBAAwB,QAAS,eAAe,gBAAgB,GAChE,oBAAoB,QAAS,eAAe,YAAY,CAE5D"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The type representing the possible log levels to choose from.
3
+ *
4
+ * @breadcrumb Core / Logger
5
+ * @public
6
+ */
7
+ export type LogLevels = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'none';
8
+ /**
9
+ * The options to customize {@link ILogger}
10
+ *
11
+ * @breadcrumb Core / Logger
12
+ * @public
13
+ */
14
+ export type LoggerOptions = {
15
+ /**
16
+ * Select the log level, {@link LogLevels | see more}.
17
+ *
18
+ * @defaultValue error
19
+ */
20
+ level: LogLevels;
21
+ };
22
+ /**
23
+ * The log function used in any level.
24
+ *
25
+ * @breadcrumb Core / Logger
26
+ * @public
27
+ */
28
+ export type LoggerFN = (message: any, ...additional: any[]) => void;
29
+ /**
30
+ * The interface representing the logger, you can provide a custom logger by implementing this interface.
31
+ *
32
+ * @breadcrumb Core / Logger
33
+ * @public
34
+ */
35
+ export type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;
36
+ /**
37
+ * The method used to create a simple logger instance to use in this library.
38
+ *
39
+ * @remarks Behind the scenes, this simple logger sends the message to the `console` methods.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const logger = createDefaultLogger();
44
+ *
45
+ * logger.error('An error happens.');
46
+ * // An error happens.
47
+ * ```
48
+ *
49
+ * @param level - Select the level of the log
50
+ *
51
+ * @breadcrumb Core / Logger
52
+ * @public
53
+ */
54
+ export declare function createDefaultLogger({ level }?: LoggerOptions): ILogger;
55
+ /**
56
+ * The method used to chck if logger was created by this library, or it was defined by the user.
57
+ *
58
+ * @param logger - The instance of the logger to check
59
+ *
60
+ * @breadcrumb Core / Logger
61
+ * @public
62
+ */
63
+ export declare function isInternalLogger(logger: ILogger): boolean;
64
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/core/logger.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,CAAC;AAEX;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAmDnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,KAAK,EAAE,GAAE,aAAkC,GAC5C,OAAO,CAkBT;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAEzD"}
@@ -1,2 +1,2 @@
1
- "use strict";var g=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,_=(r,e)=>{for(var o in e)g(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of u(e))!c.call(r,n)&&n!==o&&g(r,n,{get:()=>e[n],enumerable:!(a=i(e,n))||a.enumerable});return r},p=r=>f(g({},"__esModule",{value:!0}),r),l={};_(l,{createDefaultLogger:()=>w,isInternalLogger:()=>P});module.exports=p(l);var t=require("./no-op");const s=Symbol("InternalLogger"),b={debug:[["debug","debug"],["verbose","debug"],["info","info"],["error","error"],["warn","warn"]],verbose:[["verbose","debug"],["info","info"],["error","error"],["warn","warn"]],info:[["info","info"],["error","error"],["warn","warn"]],warn:[["warn","warn"],["error","error"]],error:[["error","error"]],none:[]},O=r=>typeof r=="function"?r():r,v=r=>(e,...o)=>console[r](e,...o.map(O));function w({level:r}={level:"error"}){const e=b[r];if(!e)throw new Error("Invalid log level");const o={[s]:!0,error:t.NO_OP,debug:t.NO_OP,info:t.NO_OP,verbose:t.NO_OP,warn:t.NO_OP};for(const[a,n]of e)o[a]=v(n);return o}function P(r){return!!r[s]}
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),logger_exports={};__export(logger_exports,{createDefaultLogger:()=>createDefaultLogger,isInternalLogger:()=>isInternalLogger});module.exports=__toCommonJS(logger_exports);var import_no_op=require("./no-op");const InternalLoggerSymbol=Symbol("InternalLogger"),logLevels={debug:[["debug","debug"],["verbose","debug"],["info","info"],["error","error"],["warn","warn"]],verbose:[["verbose","debug"],["info","info"],["error","error"],["warn","warn"]],info:[["info","info"],["error","error"],["warn","warn"]],warn:[["warn","warn"],["error","error"]],error:[["error","error"]],none:[]},lazyPrint=value=>typeof value=="function"?value():value,print=fn=>(message,...additional)=>console[fn](message,...additional.map(lazyPrint));function createDefaultLogger({level}={level:"error"}){const levels=logLevels[level];if(!levels)throw new Error("Invalid log level");const logger={[InternalLoggerSymbol]:!0,error:import_no_op.NO_OP,debug:import_no_op.NO_OP,info:import_no_op.NO_OP,verbose:import_no_op.NO_OP,warn:import_no_op.NO_OP};for(const[level2,consoleMethod]of levels)logger[level2]=print(consoleMethod);return logger}function isInternalLogger(logger){return!!logger[InternalLoggerSymbol]}
2
2
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sources":["../../src/core/logger.ts"],"sourcesContent":["import { NO_OP } from './no-op';\n\n/**\n * The type representing the possible log levels to choose from.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LogLevels =\n | 'debug'\n | 'verbose'\n | 'info'\n | 'warn'\n | 'error'\n | 'none';\n\n/**\n * The options to customize {@link ILogger}\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LoggerOptions = {\n /**\n * Select the log level, {@link LogLevels | see more}.\n *\n * @defaultValue error\n */\n level: LogLevels;\n};\n\n/**\n * The log function used in any level.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LoggerFN = (message: any, ...additional: any[]) => void;\n\n/**\n * The interface representing the logger, you can provide a custom logger by implementing this interface.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;\n\n/**\n * The symbol used to check against an ILogger instace to verify if that ILogger was created by this library\n *\n * @breadcrumb Core / Logger\n * @public\n */\nconst InternalLoggerSymbol = Symbol('InternalLogger');\n\nconst logLevels: Record<\n LogLevels,\n [level: LogLevels, consoleMethod: keyof Console][]\n> = {\n debug: [\n ['debug', 'debug'],\n ['verbose', 'debug'],\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n verbose: [\n ['verbose', 'debug'],\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n info: [\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n warn: [\n ['warn', 'warn'],\n ['error', 'error'],\n ],\n error: [['error', 'error']],\n none: [],\n};\n\nconst lazyPrint = value => {\n if (typeof value === 'function') return value();\n\n return value;\n};\n\nconst print =\n (fn: string) =>\n (message, ...additional) =>\n console[fn](message, ...additional.map(lazyPrint));\n\n/**\n * The method used to create a simple logger instance to use in this library.\n *\n * @remarks Behind the scenes, this simple logger sends the message to the `console` methods.\n *\n * @example\n * ```typescript\n * const logger = createDefaultLogger();\n *\n * logger.error('An error happens.');\n * // An error happens.\n * ```\n *\n * @param level - Select the level of the log\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport function createDefaultLogger(\n { level }: LoggerOptions = { level: 'error' },\n): ILogger {\n const levels = logLevels[level];\n\n if (!levels) throw new Error('Invalid log level');\n\n const logger = {\n [InternalLoggerSymbol]: true,\n error: NO_OP,\n debug: NO_OP,\n info: NO_OP,\n verbose: NO_OP,\n warn: NO_OP,\n } as ILogger;\n\n for (const [level, consoleMethod] of levels)\n logger[level] = print(consoleMethod);\n\n return logger;\n}\n\n/**\n * The method used to chck if logger was created by this library, or it was defined by the user.\n *\n * @param logger - The instance of the logger to check\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport function isInternalLogger(logger: ILogger): boolean {\n return !!logger[InternalLoggerSymbol];\n}\n"],"names":["logger_exports","__export","createDefaultLogger","isInternalLogger","__toCommonJS","import_no_op","InternalLoggerSymbol","logLevels","lazyPrint","value","print","fn","message","additional","level","levels","logger","consoleMethod"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,oBAAA,IAAAE,EAAA,iBAAA,IAAAC,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAJ,CAAA,EAAA,IAAsBK,EAAA,QAAA,SAAA,EAqDtB,MAAMC,EAAuB,OAAO,gBAAgB,EAE9CC,EAGF,CACF,MAAO,CACL,CAAC,QAAS,OAAO,EACjB,CAAC,UAAW,OAAO,EACnB,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,EACjB,CAAC,OAAQ,MAAM,CACjB,EACA,QAAS,CACP,CAAC,UAAW,OAAO,EACnB,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,EACjB,CAAC,OAAQ,MAAM,CACjB,EACA,KAAM,CACJ,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,EACjB,CAAC,OAAQ,MAAM,CACjB,EACA,KAAM,CACJ,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,CACnB,EACA,MAAO,CAAC,CAAC,QAAS,OAAO,CAAC,EAC1B,KAAM,CAAC,CACT,EAEMC,EAAqBC,GACrB,OAAOA,GAAU,WAAmBA,EAAM,EAEvCA,EAGHC,EACHC,GACD,CAACC,KAAYC,IACX,QAAQF,CAAE,EAAEC,EAAS,GAAGC,EAAW,IAAIL,CAAS,CAAC,EAoB9C,SAASN,EACd,CAAE,MAAAY,CAAA,EAAyB,CAAE,MAAO,SAC3B,CACH,MAAAC,EAASR,EAAUO,CAAK,EAE9B,GAAI,CAACC,EAAc,MAAA,IAAI,MAAM,mBAAmB,EAEhD,MAAMC,EAAS,CACb,CAACV,CAAoB,EAAG,GACxB,MAAOD,EAAA,MACP,MAAOA,EAAA,MACP,KAAMA,EAAA,MACN,QAASA,EAAA,MACT,KAAMA,EAAA,KAAA,EAGG,SAAA,CAACS,EAAOG,CAAa,IAAKF,EAC5BD,EAAAA,CAAK,EAAIJ,EAAMO,CAAa,EAE9B,OAAAD,CACT,CAUO,SAASb,EAAiBa,EAA0B,CAClD,MAAA,CAAC,CAACA,EAAOV,CAAoB,CACtC"}
1
+ {"version":3,"file":"logger.js","sources":["../../src/core/logger.ts"],"sourcesContent":["import { NO_OP } from './no-op';\n\n/**\n * The type representing the possible log levels to choose from.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LogLevels =\n | 'debug'\n | 'verbose'\n | 'info'\n | 'warn'\n | 'error'\n | 'none';\n\n/**\n * The options to customize {@link ILogger}\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LoggerOptions = {\n /**\n * Select the log level, {@link LogLevels | see more}.\n *\n * @defaultValue error\n */\n level: LogLevels;\n};\n\n/**\n * The log function used in any level.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type LoggerFN = (message: any, ...additional: any[]) => void;\n\n/**\n * The interface representing the logger, you can provide a custom logger by implementing this interface.\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;\n\n/**\n * The symbol used to check against an ILogger instace to verify if that ILogger was created by this library\n *\n * @breadcrumb Core / Logger\n * @public\n */\nconst InternalLoggerSymbol = Symbol('InternalLogger');\n\nconst logLevels: Record<\n LogLevels,\n [level: LogLevels, consoleMethod: keyof Console][]\n> = {\n debug: [\n ['debug', 'debug'],\n ['verbose', 'debug'],\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n verbose: [\n ['verbose', 'debug'],\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n info: [\n ['info', 'info'],\n ['error', 'error'],\n ['warn', 'warn'],\n ],\n warn: [\n ['warn', 'warn'],\n ['error', 'error'],\n ],\n error: [['error', 'error']],\n none: [],\n};\n\nconst lazyPrint = value => {\n if (typeof value === 'function') return value();\n\n return value;\n};\n\nconst print =\n (fn: string) =>\n (message, ...additional) =>\n console[fn](message, ...additional.map(lazyPrint));\n\n/**\n * The method used to create a simple logger instance to use in this library.\n *\n * @remarks Behind the scenes, this simple logger sends the message to the `console` methods.\n *\n * @example\n * ```typescript\n * const logger = createDefaultLogger();\n *\n * logger.error('An error happens.');\n * // An error happens.\n * ```\n *\n * @param level - Select the level of the log\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport function createDefaultLogger(\n { level }: LoggerOptions = { level: 'error' },\n): ILogger {\n const levels = logLevels[level];\n\n if (!levels) throw new Error('Invalid log level');\n\n const logger = {\n [InternalLoggerSymbol]: true,\n error: NO_OP,\n debug: NO_OP,\n info: NO_OP,\n verbose: NO_OP,\n warn: NO_OP,\n } as ILogger;\n\n for (const [level, consoleMethod] of levels)\n logger[level] = print(consoleMethod);\n\n return logger;\n}\n\n/**\n * The method used to chck if logger was created by this library, or it was defined by the user.\n *\n * @param logger - The instance of the logger to check\n *\n * @breadcrumb Core / Logger\n * @public\n */\nexport function isInternalLogger(logger: ILogger): boolean {\n return !!logger[InternalLoggerSymbol];\n}\n"],"names":["level"],"mappings":"ooBAAA,eAAA,CAAA,EAAA,SAAA,eAAA,CAAA,oBAAA,IAAA,oBAAA,iBAAA,IAAA,gBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,cAAA,EAAA,IAAsB,aAAA,QAAA,SAAA,EAqDtB,MAAM,qBAAuB,OAAO,gBAAgB,EAE9C,UAGF,CACF,MAAO,CACL,CAAC,QAAS,OAAO,EACjB,CAAC,UAAW,OAAO,EACnB,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,EACjB,CAAC,OAAQ,MAAM,CACjB,EACA,QAAS,CACP,CAAC,UAAW,OAAO,EACnB,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,EACjB,CAAC,OAAQ,MAAM,CACjB,EACA,KAAM,CACJ,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,EACjB,CAAC,OAAQ,MAAM,CACjB,EACA,KAAM,CACJ,CAAC,OAAQ,MAAM,EACf,CAAC,QAAS,OAAO,CACnB,EACA,MAAO,CAAC,CAAC,QAAS,OAAO,CAAC,EAC1B,KAAM,CAAC,CACT,EAEM,UAAqB,OACrB,OAAO,OAAU,WAAmB,MAAM,EAEvC,MAGH,MACH,IACD,CAAC,WAAY,aACX,QAAQ,EAAE,EAAE,QAAS,GAAG,WAAW,IAAI,SAAS,CAAC,EAoB9C,SAAS,oBACd,CAAE,KAAA,EAAyB,CAAE,MAAO,SAC3B,CACH,MAAA,OAAS,UAAU,KAAK,EAE9B,GAAI,CAAC,OAAc,MAAA,IAAI,MAAM,mBAAmB,EAEhD,MAAM,OAAS,CACb,CAAC,oBAAoB,EAAG,GACxB,MAAO,aAAA,MACP,MAAO,aAAA,MACP,KAAM,aAAA,MACN,QAAS,aAAA,MACT,KAAM,aAAA,KAAA,EAGG,SAAA,CAACA,OAAO,aAAa,IAAK,OAC5BA,OAAAA,MAAK,EAAI,MAAM,aAAa,EAE9B,OAAA,MACT,CAUO,SAAS,iBAAiB,OAA0B,CAClD,MAAA,CAAC,CAAC,OAAO,oBAAoB,CACtC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * No operation function is used when we need to pass a function, but we don't want to specify any behavior.
3
+ *
4
+ * @breadcrumb Core
5
+ * @public
6
+ */
7
+ export declare const NO_OP: (...args: any[]) => any;
8
+ //# sourceMappingURL=no-op.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-op.d.ts","sourceRoot":"","sources":["../../src/core/no-op.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAkB,CAAC"}
package/lib/core/no-op.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var _=Object.defineProperty,n=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,c=(r,e)=>{for(var o in e)_(r,o,{get:e[o],enumerable:!0})},v=(r,e,o,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of O(e))!s.call(r,t)&&t!==o&&_(r,t,{get:()=>e[t],enumerable:!(p=n(e,t))||p.enumerable});return r},P=r=>v(_({},"__esModule",{value:!0}),r),a={};c(a,{NO_OP:()=>u});module.exports=P(a);const u=()=>{};
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),no_op_exports={};__export(no_op_exports,{NO_OP:()=>NO_OP});module.exports=__toCommonJS(no_op_exports);const NO_OP=()=>{};
2
2
  //# sourceMappingURL=no-op.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-op.js","sources":["../../src/core/no-op.ts"],"sourcesContent":["/**\n * No operation function is used when we need to pass a function, but we don't want to specify any behavior.\n *\n * @breadcrumb Core\n * @public\n */\nexport const NO_OP: (...args: any[]) => any = () => void 0;\n"],"names":["no_op_exports","__export","NO_OP","__toCommonJS"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,MAAA,IAAAE,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAH,CAAA,EAMO,MAAME,EAAiC,IAAM"}
1
+ {"version":3,"file":"no-op.js","sources":["../../src/core/no-op.ts"],"sourcesContent":["/**\n * No operation function is used when we need to pass a function, but we don't want to specify any behavior.\n *\n * @breadcrumb Core\n * @public\n */\nexport const NO_OP: (...args: any[]) => any = () => void 0;\n"],"names":[],"mappings":"ooBAAA,cAAA,CAAA,EAAA,SAAA,cAAA,CAAA,MAAA,IAAA,KAAA,CAAA,EAAA,OAAA,QAAA,aAAA,aAAA,EAMO,MAAM,MAAiC,IAAM"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Return the defaultValue whether the value is undefined, otherwise, return the value.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * const value1 = getDefaultIfUndefined(undefined, true);
7
+ * const value2 = getDefaultIfUndefined(false, true);
8
+ *
9
+ * console.log(value1);
10
+ * // true
11
+ * console.log(value2);
12
+ * // false
13
+ * ```
14
+ *
15
+ * @param value - The value to be checked
16
+ * @param defaultValue - The default value when value is undefined
17
+ *
18
+ * @breadcrumb Core
19
+ * @public
20
+ */
21
+ export declare function getDefaultIfUndefined<T>(value: T | undefined, defaultValue: T): T;
22
+ //# sourceMappingURL=optional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optional.d.ts","sourceRoot":"","sources":["../../src/core/optional.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,CAAC,GAAG,SAAS,EACpB,YAAY,EAAE,CAAC,GACd,CAAC,CAIH"}
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty,_=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,f=Object.prototype.hasOwnProperty,i=(r,e)=>{for(var o in e)n(r,o,{get:e[o],enumerable:!0})},c=(r,e,o,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!f.call(r,t)&&t!==o&&n(r,t,{get:()=>e[t],enumerable:!(p=_(e,t))||p.enumerable});return r},s=r=>c(n({},"__esModule",{value:!0}),r),a={};i(a,{getDefaultIfUndefined:()=>v});module.exports=s(a);function v(r,e){return r===void 0?e:r}
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),optional_exports={};__export(optional_exports,{getDefaultIfUndefined:()=>getDefaultIfUndefined});module.exports=__toCommonJS(optional_exports);function getDefaultIfUndefined(value,defaultValue){return value===void 0?defaultValue:value}
2
2
  //# sourceMappingURL=optional.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"optional.js","sources":["../../src/core/optional.ts"],"sourcesContent":["/**\n * Return the defaultValue whether the value is undefined, otherwise, return the value.\n *\n * @example\n * ```typescript\n * const value1 = getDefaultIfUndefined(undefined, true);\n * const value2 = getDefaultIfUndefined(false, true);\n *\n * console.log(value1);\n * // true\n * console.log(value2);\n * // false\n * ```\n *\n * @param value - The value to be checked\n * @param defaultValue - The default value when value is undefined\n *\n * @breadcrumb Core\n * @public\n */\nexport function getDefaultIfUndefined<T>(\n value: T | undefined,\n defaultValue: T,\n): T {\n if (value === undefined) return defaultValue;\n\n return value;\n}\n"],"names":["optional_exports","__export","getDefaultIfUndefined","__toCommonJS","value","defaultValue"],"mappings":"qZAAAA,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,sBAAA,IAAAE,CAAA,CAAA,EAAA,OAAA,QAAAC,EAAAH,CAAA,EAoBO,SAASE,EACdE,EACAC,EACG,CACH,OAAID,IAAU,OAAkBC,EAEzBD,CACT"}
1
+ {"version":3,"file":"optional.js","sources":["../../src/core/optional.ts"],"sourcesContent":["/**\n * Return the defaultValue whether the value is undefined, otherwise, return the value.\n *\n * @example\n * ```typescript\n * const value1 = getDefaultIfUndefined(undefined, true);\n * const value2 = getDefaultIfUndefined(false, true);\n *\n * console.log(value1);\n * // true\n * console.log(value2);\n * // false\n * ```\n *\n * @param value - The value to be checked\n * @param defaultValue - The default value when value is undefined\n *\n * @breadcrumb Core\n * @public\n */\nexport function getDefaultIfUndefined<T>(\n value: T | undefined,\n defaultValue: T,\n): T {\n if (value === undefined) return defaultValue;\n\n return value;\n}\n"],"names":[],"mappings":"ooBAAA,iBAAA,CAAA,EAAA,SAAA,iBAAA,CAAA,sBAAA,IAAA,qBAAA,CAAA,EAAA,OAAA,QAAA,aAAA,gBAAA,EAoBO,SAAS,sBACd,MACA,aACG,CACH,OAAI,QAAU,OAAkB,aAEzB,KACT"}