@bitblit/ratchet-epsilon-common 4.0.99-alpha → 4.0.103-alpha

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 (443) hide show
  1. package/bin/cli.js +10 -0
  2. package/{dist/types → lib}/background/background-dynamo-log-table-handler.d.ts +3 -3
  3. package/{dist/es → lib}/background/background-dynamo-log-table-handler.js +6 -2
  4. package/{dist/types → lib}/background/background-execution-event.d.ts +1 -1
  5. package/{dist/types → lib}/background/background-execution-listener.d.ts +1 -1
  6. package/{dist/types → lib}/background/background-handler.d.ts +5 -9
  7. package/{dist/es → lib}/background/background-handler.js +15 -7
  8. package/{dist/types → lib}/background/background-http-adapter-handler.d.ts +7 -11
  9. package/{dist/es → lib}/background/background-http-adapter-handler.js +13 -8
  10. package/{dist/types → lib}/background/background-queue-response-internal.d.ts +1 -1
  11. package/{dist/types → lib}/background/background-validator.d.ts +5 -8
  12. package/{dist/es → lib}/background/background-validator.js +5 -3
  13. package/{dist/es → lib}/background/epsilon-background-process-error.js +6 -1
  14. package/{dist/types → lib}/background/internal-background-entry.d.ts +1 -1
  15. package/{dist/types → lib}/background/manager/abstract-background-manager.d.ts +3 -10
  16. package/{dist/es → lib}/background/manager/abstract-background-manager.js +5 -4
  17. package/{dist/types → lib}/background/manager/aws-sqs-sns-background-manager.d.ts +4 -11
  18. package/{dist/es → lib}/background/manager/aws-sqs-sns-background-manager.js +9 -5
  19. package/{dist/types → lib}/background/manager/background-manager-like.d.ts +2 -9
  20. package/lib/background/manager/background-manager.spec.js +73 -0
  21. package/{dist/types → lib}/background/manager/single-thread-local-background-manager.d.ts +3 -10
  22. package/{dist/es → lib}/background/manager/single-thread-local-background-manager.js +6 -6
  23. package/{dist/types → lib}/background/s3-background-transaction-logger.d.ts +2 -2
  24. package/{dist/es → lib}/background/s3-background-transaction-logger.js +6 -3
  25. package/{dist/types → lib}/build/ratchet-epsilon-common-info.d.ts +1 -1
  26. package/{dist/types → lib}/built-in/background/echo-processor.d.ts +2 -2
  27. package/{dist/es → lib}/built-in/background/echo-processor.js +4 -3
  28. package/{dist/types → lib}/built-in/background/log-and-enqueue-echo-processor.d.ts +2 -2
  29. package/{dist/es → lib}/built-in/background/log-and-enqueue-echo-processor.js +2 -2
  30. package/{dist/types → lib}/built-in/background/log-message-background-error-processor.d.ts +2 -2
  31. package/{dist/es → lib}/built-in/background/log-message-background-error-processor.js +1 -1
  32. package/{dist/types → lib}/built-in/background/no-op-processor.d.ts +2 -2
  33. package/{dist/es → lib}/built-in/background/no-op-processor.js +1 -1
  34. package/{dist/types → lib}/built-in/background/retry-processor.d.ts +2 -2
  35. package/{dist/es → lib}/built-in/background/retry-processor.js +8 -4
  36. package/{dist/types → lib}/built-in/background/sample-delay-processor.d.ts +2 -2
  37. package/{dist/es → lib}/built-in/background/sample-delay-processor.js +2 -1
  38. package/{dist/types → lib}/built-in/background/sample-input-validated-processor.d.ts +3 -3
  39. package/{dist/es → lib}/built-in/background/sample-input-validated-processor.js +1 -1
  40. package/{dist/es → lib}/built-in/built-in-trace-id-generators.js +2 -2
  41. package/{dist/types → lib}/built-in/daemon/daemon-authorizer-function.d.ts +2 -2
  42. package/{dist/types → lib}/built-in/daemon/daemon-config.d.ts +2 -2
  43. package/{dist/types → lib}/built-in/daemon/daemon-group-selection-function.d.ts +1 -1
  44. package/{dist/types → lib}/built-in/daemon/daemon-handler.d.ts +6 -12
  45. package/{dist/es → lib}/built-in/daemon/daemon-handler.js +9 -8
  46. package/lib/built-in/daemon/daemon-process-state-list.d.ts +5 -0
  47. package/{dist/types → lib}/built-in/http/apollo-filter.d.ts +2 -2
  48. package/{dist/es → lib}/built-in/http/apollo-filter.js +6 -5
  49. package/{dist/types → lib}/built-in/http/built-in-auth-filters.d.ts +3 -3
  50. package/{dist/es → lib}/built-in/http/built-in-auth-filters.js +5 -5
  51. package/{dist/types → lib}/built-in/http/built-in-authorizers.d.ts +2 -2
  52. package/{dist/es → lib}/built-in/http/built-in-authorizers.js +1 -1
  53. package/{dist/types → lib}/built-in/http/built-in-filters.d.ts +2 -2
  54. package/{dist/es → lib}/built-in/http/built-in-filters.js +9 -9
  55. package/{dist/types → lib}/built-in/http/built-in-handlers.d.ts +2 -2
  56. package/{dist/es → lib}/built-in/http/built-in-handlers.js +10 -10
  57. package/{dist/types → lib}/built-in/http/log-level-manipulation-filter.d.ts +1 -4
  58. package/{dist/es → lib}/built-in/http/log-level-manipulation-filter.js +2 -2
  59. package/{dist/types → lib}/built-in/http/run-handler-as-filter.d.ts +5 -5
  60. package/{dist/es → lib}/built-in/http/run-handler-as-filter.js +8 -8
  61. package/lib/built-in/http/run-handler-as-filter.spec.js +40 -0
  62. package/{dist/types → lib}/cli-bootstrap/ratchet-cli-handler.d.ts +2 -2
  63. package/{dist/es → lib}/cli-bootstrap/ratchet-cli-handler.js +6 -6
  64. package/lib/cli-bootstrap/run-background-process-from-command-line.d.ts +3 -0
  65. package/{dist/es → lib}/cli-bootstrap/run-background-process-from-command-line.js +2 -2
  66. package/{dist/types → lib}/config/background/background-config.d.ts +4 -4
  67. package/{dist/types → lib}/config/background/background-error-processor.d.ts +1 -1
  68. package/{dist/types → lib}/config/background/background-processor.d.ts +1 -1
  69. package/{dist/types → lib}/config/background/background-transaction-log.d.ts +1 -1
  70. package/{dist/types → lib}/config/background/background-transaction-logger.d.ts +1 -1
  71. package/lib/config/cron/cron-background-entry.d.ts +6 -0
  72. package/{dist/types → lib}/config/cron/cron-config.d.ts +1 -1
  73. package/{dist/types → lib}/config/dynamo-db-config.d.ts +1 -1
  74. package/{dist/types → lib}/config/epsilon-config.d.ts +8 -8
  75. package/{dist/types → lib}/config/epsilon-logger-config.d.ts +3 -2
  76. package/{dist/types → lib}/config/http/authorizer-function.d.ts +3 -3
  77. package/{dist/types → lib}/config/http/extended-api-gateway-event.d.ts +1 -1
  78. package/{dist/types → lib}/config/http/filter-chain-context.d.ts +4 -4
  79. package/{dist/types → lib}/config/http/filter-function.d.ts +1 -1
  80. package/{dist/types → lib}/config/http/handler-function.d.ts +1 -1
  81. package/{dist/types → lib}/config/http/http-config.d.ts +5 -5
  82. package/{dist/types → lib}/config/http/http-processing-config.d.ts +2 -2
  83. package/{dist/types → lib}/config/http/mapped-http-processing-config.d.ts +1 -1
  84. package/{dist/types → lib}/config/inter-api/inter-api-config.d.ts +2 -2
  85. package/lib/config/inter-api/inter-api-process-mapping.d.ts +6 -0
  86. package/{dist/types → lib}/config/open-api/open-api-document.d.ts +2 -2
  87. package/{dist/types → lib}/config/s3-config.d.ts +1 -1
  88. package/{dist/types → lib}/config/sns-config.d.ts +1 -1
  89. package/{dist/es → lib}/epsilon-build-properties.js +1 -1
  90. package/{dist/types → lib}/epsilon-constants.d.ts +1 -1
  91. package/{dist/es → lib}/epsilon-constants.js +14 -13
  92. package/{dist/types → lib}/epsilon-global-handler.d.ts +3 -6
  93. package/{dist/es → lib}/epsilon-global-handler.js +29 -24
  94. package/{dist/types → lib}/epsilon-instance.d.ts +6 -11
  95. package/lib/epsilon-logging-extension-processor.d.ts +6 -0
  96. package/{dist/es → lib}/epsilon-logging-extension-processor.js +1 -1
  97. package/{dist/types → lib}/http/auth/api-gateway-adapter-authentication-handler.d.ts +0 -10
  98. package/{dist/es → lib}/http/auth/api-gateway-adapter-authentication-handler.js +4 -3
  99. package/{dist/types → lib}/http/auth/auth0-web-token-manipulator.d.ts +2 -2
  100. package/{dist/es → lib}/http/auth/auth0-web-token-manipulator.js +6 -1
  101. package/{dist/types → lib}/http/auth/basic-auth-token.d.ts +0 -3
  102. package/{dist/types → lib}/http/auth/google-web-token-manipulator.d.ts +2 -2
  103. package/{dist/es → lib}/http/auth/google-web-token-manipulator.js +6 -3
  104. package/lib/http/auth/google-web-token-manipulator.spec.js +10 -0
  105. package/{dist/types → lib}/http/auth/jwt-ratchet-local-web-token-manipulator.d.ts +3 -5
  106. package/{dist/es → lib}/http/auth/jwt-ratchet-local-web-token-manipulator.js +5 -3
  107. package/{dist/types → lib}/http/auth/local-web-token-manipulator.d.ts +4 -5
  108. package/{dist/es → lib}/http/auth/local-web-token-manipulator.js +9 -5
  109. package/lib/http/auth/local-web-token-manipulator.spec.js +24 -0
  110. package/{dist/types → lib}/http/auth/web-token-manipulator.d.ts +1 -4
  111. package/{dist/types → lib}/http/error/bad-gateway.d.ts +1 -1
  112. package/{dist/es → lib}/http/error/bad-gateway.js +2 -2
  113. package/{dist/types → lib}/http/error/bad-request-error.d.ts +1 -1
  114. package/{dist/es → lib}/http/error/bad-request-error.js +2 -2
  115. package/{dist/types → lib}/http/error/conflict-error.d.ts +1 -1
  116. package/{dist/es → lib}/http/error/conflict-error.js +2 -2
  117. package/{dist/es → lib}/http/error/epsilon-http-error.js +9 -3
  118. package/lib/http/error/epsilon-http-error.spec.js +11 -0
  119. package/{dist/types → lib}/http/error/forbidden-error.d.ts +1 -1
  120. package/{dist/es → lib}/http/error/forbidden-error.js +2 -2
  121. package/{dist/types → lib}/http/error/gateway-timeout.d.ts +1 -1
  122. package/{dist/es → lib}/http/error/gateway-timeout.js +2 -2
  123. package/{dist/types → lib}/http/error/method-not-allowed-error.d.ts +1 -1
  124. package/{dist/es → lib}/http/error/method-not-allowed-error.js +2 -2
  125. package/{dist/types → lib}/http/error/misconfigured-error.d.ts +1 -1
  126. package/{dist/es → lib}/http/error/misconfigured-error.js +2 -2
  127. package/{dist/types → lib}/http/error/not-found-error.d.ts +1 -1
  128. package/{dist/es → lib}/http/error/not-found-error.js +2 -2
  129. package/{dist/types → lib}/http/error/not-implemented.d.ts +1 -1
  130. package/{dist/es → lib}/http/error/not-implemented.js +2 -2
  131. package/{dist/types → lib}/http/error/request-timeout-error.d.ts +1 -1
  132. package/{dist/es → lib}/http/error/request-timeout-error.js +2 -2
  133. package/{dist/types → lib}/http/error/service-unavailable.d.ts +1 -1
  134. package/{dist/es → lib}/http/error/service-unavailable.js +2 -2
  135. package/{dist/types → lib}/http/error/too-many-requests-error.d.ts +1 -1
  136. package/{dist/es → lib}/http/error/too-many-requests-error.js +2 -2
  137. package/{dist/types → lib}/http/error/unauthorized-error.d.ts +1 -1
  138. package/{dist/es → lib}/http/error/unauthorized-error.js +2 -2
  139. package/{dist/types → lib}/http/event-util.d.ts +3 -25
  140. package/{dist/es → lib}/http/event-util.js +9 -8
  141. package/lib/http/event-util.spec.js +157 -0
  142. package/{dist/types → lib}/http/response-util.d.ts +2 -2
  143. package/{dist/es → lib}/http/response-util.js +2 -2
  144. package/lib/http/response-util.spec.d.ts +1 -0
  145. package/lib/http/response-util.spec.js +88 -0
  146. package/lib/http/route/epsilon-router.d.ts +8 -0
  147. package/lib/http/route/epsilon-router.js +1 -0
  148. package/lib/http/route/extended-auth-response-context.js +1 -0
  149. package/{dist/types → lib}/http/route/route-mapping.d.ts +3 -3
  150. package/lib/http/route/route-mapping.js +1 -0
  151. package/lib/http/route/route-validator-config.js +1 -0
  152. package/{dist/types → lib}/http/route/router-util.d.ts +9 -12
  153. package/{dist/es → lib}/http/route/router-util.js +10 -10
  154. package/lib/http/route/router-util.spec.d.ts +1 -0
  155. package/lib/http/route/router-util.spec.js +23 -0
  156. package/{dist/types → lib}/http/web-handler.d.ts +4 -7
  157. package/{dist/es → lib}/http/web-handler.js +11 -10
  158. package/lib/http/web-handler.spec.d.ts +1 -0
  159. package/lib/http/web-handler.spec.js +32 -0
  160. package/{dist/types → lib}/http/web-v2-handler.d.ts +2 -5
  161. package/{dist/es → lib}/http/web-v2-handler.js +3 -2
  162. package/lib/index.d.ts +1 -0
  163. package/lib/index.js +1 -0
  164. package/lib/inter-api/inter-api-entry.js +1 -0
  165. package/{dist/types → lib}/inter-api/inter-api-util.d.ts +3 -3
  166. package/{dist/es → lib}/inter-api/inter-api-util.js +6 -5
  167. package/lib/inter-api/inter-api-util.spec.d.ts +1 -0
  168. package/lib/inter-api/inter-api-util.spec.js +61 -0
  169. package/{dist/types → lib}/inter-api-manager.d.ts +2 -5
  170. package/{dist/es → lib}/inter-api-manager.js +5 -3
  171. package/{dist/types → lib}/lambda-event-handler/cron-epsilon-lambda-event-handler.d.ts +5 -5
  172. package/{dist/es → lib}/lambda-event-handler/cron-epsilon-lambda-event-handler.js +5 -4
  173. package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.d.ts +1 -0
  174. package/lib/lambda-event-handler/cron-epsilon-lambda-event-handler.spec.js +50 -0
  175. package/{dist/types → lib}/lambda-event-handler/dynamo-epsilon-lambda-event-handler.d.ts +2 -2
  176. package/{dist/es → lib}/lambda-event-handler/dynamo-epsilon-lambda-event-handler.js +4 -3
  177. package/{dist/types → lib}/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.d.ts +2 -2
  178. package/{dist/es → lib}/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.js +4 -3
  179. package/{dist/types → lib}/lambda-event-handler/inter-api-epsilon-lambda-event-handler.d.ts +2 -2
  180. package/{dist/es → lib}/lambda-event-handler/inter-api-epsilon-lambda-event-handler.js +2 -1
  181. package/{dist/types → lib}/lambda-event-handler/s3-epsilon-lambda-event-handler.d.ts +2 -2
  182. package/{dist/es → lib}/lambda-event-handler/s3-epsilon-lambda-event-handler.js +4 -3
  183. package/{dist/types → lib}/local-container-server.d.ts +1 -4
  184. package/{dist/es → lib}/local-container-server.js +8 -4
  185. package/lib/local-server-cert.js +67 -0
  186. package/{dist/types → lib}/local-server.d.ts +2 -5
  187. package/{dist/es → lib}/local-server.js +11 -8
  188. package/lib/open-api-util/open-api-doc-modifications.js +1 -0
  189. package/{dist/types → lib}/open-api-util/open-api-doc-modifier.d.ts +1 -4
  190. package/{dist/es → lib}/open-api-util/open-api-doc-modifier.js +2 -1
  191. package/lib/open-api-util/open-api-doc-modifier.spec.d.ts +1 -0
  192. package/lib/open-api-util/open-api-doc-modifier.spec.js +16 -0
  193. package/{dist/es → lib}/open-api-util/yaml-combiner.js +2 -2
  194. package/lib/open-api-util/yaml-combiner.spec.d.ts +1 -0
  195. package/lib/open-api-util/yaml-combiner.spec.js +22 -0
  196. package/{dist/types → lib}/sample/sample-server-components.d.ts +2 -2
  197. package/{dist/es → lib}/sample/sample-server-components.js +25 -24
  198. package/lib/sample/sample-server-static-files.js +593 -0
  199. package/{dist/types → lib}/sample/test-error-server.d.ts +1 -4
  200. package/{dist/es → lib}/sample/test-error-server.js +4 -2
  201. package/{dist/types → lib}/util/context-util.d.ts +3 -3
  202. package/{dist/es → lib}/util/context-util.js +11 -5
  203. package/{dist/types → lib}/util/cron-util.d.ts +2 -2
  204. package/{dist/es → lib}/util/cron-util.js +3 -3
  205. package/lib/util/cron-util.spec.d.ts +1 -0
  206. package/lib/util/cron-util.spec.js +124 -0
  207. package/{dist/types → lib}/util/epsilon-config-parser.d.ts +6 -6
  208. package/{dist/es → lib}/util/epsilon-config-parser.js +9 -9
  209. package/package.json +16 -19
  210. package/dist/cjs/background/background-dynamo-log-table-handler.js +0 -38
  211. package/dist/cjs/background/background-entry.js +0 -2
  212. package/dist/cjs/background/background-execution-event-type.js +0 -11
  213. package/dist/cjs/background/background-execution-event.js +0 -2
  214. package/dist/cjs/background/background-execution-listener.js +0 -2
  215. package/dist/cjs/background/background-handler.js +0 -269
  216. package/dist/cjs/background/background-http-adapter-handler.js +0 -127
  217. package/dist/cjs/background/background-meta-response-internal.js +0 -2
  218. package/dist/cjs/background/background-process-handling.js +0 -8
  219. package/dist/cjs/background/background-process-log-table-entry.js +0 -2
  220. package/dist/cjs/background/background-queue-response-internal.js +0 -2
  221. package/dist/cjs/background/background-validator.js +0 -88
  222. package/dist/cjs/background/epsilon-background-process-error.js +0 -93
  223. package/dist/cjs/background/internal-background-entry.js +0 -2
  224. package/dist/cjs/background/manager/abstract-background-manager.js +0 -92
  225. package/dist/cjs/background/manager/aws-sqs-sns-background-manager.js +0 -153
  226. package/dist/cjs/background/manager/background-manager-like.js +0 -2
  227. package/dist/cjs/background/manager/single-thread-local-background-manager.js +0 -49
  228. package/dist/cjs/background/s3-background-transaction-logger.js +0 -54
  229. package/dist/cjs/build/ratchet-epsilon-common-info.js +0 -18
  230. package/dist/cjs/built-in/background/echo-processor.js +0 -18
  231. package/dist/cjs/built-in/background/log-and-enqueue-echo-processor.js +0 -16
  232. package/dist/cjs/built-in/background/log-message-background-error-processor.js +0 -10
  233. package/dist/cjs/built-in/background/no-op-processor.js +0 -13
  234. package/dist/cjs/built-in/background/retry-processor.js +0 -41
  235. package/dist/cjs/built-in/background/sample-delay-processor.js +0 -16
  236. package/dist/cjs/built-in/background/sample-input-validated-processor-data.js +0 -2
  237. package/dist/cjs/built-in/background/sample-input-validated-processor.js +0 -16
  238. package/dist/cjs/built-in/built-in-trace-id-generators.js +0 -25
  239. package/dist/cjs/built-in/daemon/daemon-authorizer-function.js +0 -2
  240. package/dist/cjs/built-in/daemon/daemon-config.js +0 -2
  241. package/dist/cjs/built-in/daemon/daemon-group-selection-function.js +0 -2
  242. package/dist/cjs/built-in/daemon/daemon-handler.js +0 -62
  243. package/dist/cjs/built-in/daemon/daemon-process-state-list.js +0 -2
  244. package/dist/cjs/built-in/http/apollo-filter.js +0 -63
  245. package/dist/cjs/built-in/http/built-in-auth-filters.js +0 -115
  246. package/dist/cjs/built-in/http/built-in-authorizers.js +0 -43
  247. package/dist/cjs/built-in/http/built-in-filters.js +0 -222
  248. package/dist/cjs/built-in/http/built-in-handlers.js +0 -73
  249. package/dist/cjs/built-in/http/log-level-manipulation-filter.js +0 -20
  250. package/dist/cjs/built-in/http/run-handler-as-filter.js +0 -64
  251. package/dist/cjs/cli-bootstrap/ratchet-cli-handler.js +0 -24
  252. package/dist/cjs/cli-bootstrap/run-background-process-from-command-line.js +0 -26
  253. package/dist/cjs/config/background/background-aws-config.js +0 -2
  254. package/dist/cjs/config/background/background-config.js +0 -2
  255. package/dist/cjs/config/background/background-error-processor.js +0 -2
  256. package/dist/cjs/config/background/background-processor.js +0 -2
  257. package/dist/cjs/config/background/background-transaction-log.js +0 -2
  258. package/dist/cjs/config/background/background-transaction-logger.js +0 -2
  259. package/dist/cjs/config/cron/abstract-cron-entry.js +0 -2
  260. package/dist/cjs/config/cron/cron-background-entry.js +0 -2
  261. package/dist/cjs/config/cron/cron-config.js +0 -2
  262. package/dist/cjs/config/dynamo-db-config.js +0 -2
  263. package/dist/cjs/config/epsilon-config.js +0 -2
  264. package/dist/cjs/config/epsilon-lambda-event-handler.js +0 -2
  265. package/dist/cjs/config/epsilon-logger-config.js +0 -2
  266. package/dist/cjs/config/generic-aws-event-handler-function.js +0 -2
  267. package/dist/cjs/config/http/authorizer-function.js +0 -2
  268. package/dist/cjs/config/http/epsilon-authorization-context.js +0 -2
  269. package/dist/cjs/config/http/extended-api-gateway-event.js +0 -2
  270. package/dist/cjs/config/http/filter-chain-context.js +0 -2
  271. package/dist/cjs/config/http/filter-function.js +0 -2
  272. package/dist/cjs/config/http/handler-function.js +0 -2
  273. package/dist/cjs/config/http/http-config.js +0 -2
  274. package/dist/cjs/config/http/http-processing-config.js +0 -2
  275. package/dist/cjs/config/http/mapped-http-processing-config.js +0 -2
  276. package/dist/cjs/config/http/null-returned-object-handling.js +0 -9
  277. package/dist/cjs/config/inter-api/inter-api-aws-config.js +0 -2
  278. package/dist/cjs/config/inter-api/inter-api-config.js +0 -2
  279. package/dist/cjs/config/inter-api/inter-api-process-mapping.js +0 -2
  280. package/dist/cjs/config/logging-trace-id-generator.js +0 -2
  281. package/dist/cjs/config/open-api/open-api-document-components.js +0 -2
  282. package/dist/cjs/config/open-api/open-api-document-path.js +0 -2
  283. package/dist/cjs/config/open-api/open-api-document.js +0 -2
  284. package/dist/cjs/config/s3-config.js +0 -2
  285. package/dist/cjs/config/sns-config.js +0 -2
  286. package/dist/cjs/epsilon-build-properties.js +0 -28
  287. package/dist/cjs/epsilon-constants.js +0 -49
  288. package/dist/cjs/epsilon-global-handler.js +0 -155
  289. package/dist/cjs/epsilon-instance.js +0 -2
  290. package/dist/cjs/epsilon-logging-extension-processor.js +0 -19
  291. package/dist/cjs/http/auth/api-gateway-adapter-authentication-handler.js +0 -75
  292. package/dist/cjs/http/auth/auth0-web-token-manipulator.js +0 -62
  293. package/dist/cjs/http/auth/basic-auth-token.js +0 -2
  294. package/dist/cjs/http/auth/google-web-token-manipulator.js +0 -72
  295. package/dist/cjs/http/auth/jwt-ratchet-local-web-token-manipulator.js +0 -29
  296. package/dist/cjs/http/auth/local-web-token-manipulator.js +0 -74
  297. package/dist/cjs/http/auth/web-token-manipulator.js +0 -2
  298. package/dist/cjs/http/error/bad-gateway.js +0 -12
  299. package/dist/cjs/http/error/bad-request-error.js +0 -12
  300. package/dist/cjs/http/error/conflict-error.js +0 -12
  301. package/dist/cjs/http/error/epsilon-http-error.js +0 -132
  302. package/dist/cjs/http/error/forbidden-error.js +0 -12
  303. package/dist/cjs/http/error/gateway-timeout.js +0 -12
  304. package/dist/cjs/http/error/method-not-allowed-error.js +0 -12
  305. package/dist/cjs/http/error/misconfigured-error.js +0 -12
  306. package/dist/cjs/http/error/not-found-error.js +0 -12
  307. package/dist/cjs/http/error/not-implemented.js +0 -12
  308. package/dist/cjs/http/error/request-timeout-error.js +0 -12
  309. package/dist/cjs/http/error/service-unavailable.js +0 -12
  310. package/dist/cjs/http/error/too-many-requests-error.js +0 -12
  311. package/dist/cjs/http/error/unauthorized-error.js +0 -12
  312. package/dist/cjs/http/event-util.js +0 -180
  313. package/dist/cjs/http/response-util.js +0 -146
  314. package/dist/cjs/http/route/epsilon-router.js +0 -2
  315. package/dist/cjs/http/route/extended-auth-response-context.js +0 -2
  316. package/dist/cjs/http/route/route-mapping.js +0 -2
  317. package/dist/cjs/http/route/route-validator-config.js +0 -2
  318. package/dist/cjs/http/route/router-util.js +0 -238
  319. package/dist/cjs/http/web-handler.js +0 -122
  320. package/dist/cjs/http/web-v2-handler.js +0 -25
  321. package/dist/cjs/index.js +0 -135
  322. package/dist/cjs/inter-api/inter-api-entry.js +0 -2
  323. package/dist/cjs/inter-api/inter-api-util.js +0 -62
  324. package/dist/cjs/inter-api-manager.js +0 -67
  325. package/dist/cjs/lambda-event-handler/cron-epsilon-lambda-event-handler.js +0 -76
  326. package/dist/cjs/lambda-event-handler/dynamo-epsilon-lambda-event-handler.js +0 -36
  327. package/dist/cjs/lambda-event-handler/generic-sns-epsilon-lambda-event-handler.js +0 -32
  328. package/dist/cjs/lambda-event-handler/inter-api-epsilon-lambda-event-handler.js +0 -26
  329. package/dist/cjs/lambda-event-handler/s3-epsilon-lambda-event-handler.js +0 -44
  330. package/dist/cjs/local-container-server.js +0 -77
  331. package/dist/cjs/local-server-cert.js +0 -71
  332. package/dist/cjs/local-server.js +0 -164
  333. package/dist/cjs/open-api-util/open-api-doc-modifications.js +0 -2
  334. package/dist/cjs/open-api-util/open-api-doc-modifier.js +0 -83
  335. package/dist/cjs/open-api-util/yaml-combiner.js +0 -32
  336. package/dist/cjs/sample/sample-server-components.js +0 -188
  337. package/dist/cjs/sample/sample-server-static-files.js +0 -597
  338. package/dist/cjs/sample/test-error-server.js +0 -47
  339. package/dist/cjs/util/aws-util.js +0 -69
  340. package/dist/cjs/util/context-util.js +0 -104
  341. package/dist/cjs/util/cron-util.js +0 -72
  342. package/dist/cjs/util/epsilon-config-parser.js +0 -71
  343. package/dist/es/index.js +0 -132
  344. package/dist/es/local-server-cert.js +0 -67
  345. package/dist/es/sample/sample-server-static-files.js +0 -593
  346. package/dist/tsconfig.cjs.tsbuildinfo +0 -1
  347. package/dist/tsconfig.es.tsbuildinfo +0 -1
  348. package/dist/tsconfig.types.tsbuildinfo +0 -1
  349. package/dist/types/built-in/daemon/daemon-process-state-list.d.ts +0 -8
  350. package/dist/types/cli-bootstrap/run-background-process-from-command-line.d.ts +0 -12
  351. package/dist/types/config/cron/cron-background-entry.d.ts +0 -15
  352. package/dist/types/config/inter-api/inter-api-process-mapping.d.ts +0 -11
  353. package/dist/types/epsilon-logging-extension-processor.d.ts +0 -5
  354. package/dist/types/http/route/epsilon-router.d.ts +0 -8
  355. package/dist/types/index.d.ts +0 -135
  356. package/includes/cli.js +0 -12
  357. /package/{dist/types → lib}/background/background-entry.d.ts +0 -0
  358. /package/{dist/es → lib}/background/background-entry.js +0 -0
  359. /package/{dist/types → lib}/background/background-execution-event-type.d.ts +0 -0
  360. /package/{dist/es → lib}/background/background-execution-event-type.js +0 -0
  361. /package/{dist/es → lib}/background/background-execution-event.js +0 -0
  362. /package/{dist/es → lib}/background/background-execution-listener.js +0 -0
  363. /package/{dist/types → lib}/background/background-meta-response-internal.d.ts +0 -0
  364. /package/{dist/es → lib}/background/background-meta-response-internal.js +0 -0
  365. /package/{dist/types → lib}/background/background-process-handling.d.ts +0 -0
  366. /package/{dist/es → lib}/background/background-process-handling.js +0 -0
  367. /package/{dist/types → lib}/background/background-process-log-table-entry.d.ts +0 -0
  368. /package/{dist/es → lib}/background/background-process-log-table-entry.js +0 -0
  369. /package/{dist/es → lib}/background/background-queue-response-internal.js +0 -0
  370. /package/{dist/types → lib}/background/epsilon-background-process-error.d.ts +0 -0
  371. /package/{dist/es → lib}/background/internal-background-entry.js +0 -0
  372. /package/{dist/es → lib}/background/manager/background-manager-like.js +0 -0
  373. /package/{dist/es/built-in/background/sample-input-validated-processor-data.js → lib/background/manager/background-manager.spec.d.ts} +0 -0
  374. /package/{dist/es → lib}/build/ratchet-epsilon-common-info.js +0 -0
  375. /package/{dist/types → lib}/built-in/background/sample-input-validated-processor-data.d.ts +0 -0
  376. /package/{dist/es/built-in/daemon/daemon-authorizer-function.js → lib/built-in/background/sample-input-validated-processor-data.js} +0 -0
  377. /package/{dist/types → lib}/built-in/built-in-trace-id-generators.d.ts +0 -0
  378. /package/{dist/es/built-in/daemon/daemon-config.js → lib/built-in/daemon/daemon-authorizer-function.js} +0 -0
  379. /package/{dist/es/built-in/daemon/daemon-group-selection-function.js → lib/built-in/daemon/daemon-config.js} +0 -0
  380. /package/{dist/es/built-in/daemon/daemon-process-state-list.js → lib/built-in/daemon/daemon-group-selection-function.js} +0 -0
  381. /package/{dist/es/config/background/background-aws-config.js → lib/built-in/daemon/daemon-process-state-list.js} +0 -0
  382. /package/{dist/es/config/background/background-config.js → lib/built-in/http/run-handler-as-filter.spec.d.ts} +0 -0
  383. /package/{dist/types → lib}/config/background/background-aws-config.d.ts +0 -0
  384. /package/{dist/es/config/background/background-error-processor.js → lib/config/background/background-aws-config.js} +0 -0
  385. /package/{dist/es/config/background/background-processor.js → lib/config/background/background-config.js} +0 -0
  386. /package/{dist/es/config/background/background-transaction-log.js → lib/config/background/background-error-processor.js} +0 -0
  387. /package/{dist/es/config/background/background-transaction-logger.js → lib/config/background/background-processor.js} +0 -0
  388. /package/{dist/es/config/cron/abstract-cron-entry.js → lib/config/background/background-transaction-log.js} +0 -0
  389. /package/{dist/es/config/cron/cron-background-entry.js → lib/config/background/background-transaction-logger.js} +0 -0
  390. /package/{dist/types → lib}/config/cron/abstract-cron-entry.d.ts +0 -0
  391. /package/{dist/es/config/cron/cron-config.js → lib/config/cron/abstract-cron-entry.js} +0 -0
  392. /package/{dist/es/config/dynamo-db-config.js → lib/config/cron/cron-background-entry.js} +0 -0
  393. /package/{dist/es/config/epsilon-config.js → lib/config/cron/cron-config.js} +0 -0
  394. /package/{dist/es/config/epsilon-lambda-event-handler.js → lib/config/dynamo-db-config.js} +0 -0
  395. /package/{dist/es/config/epsilon-logger-config.js → lib/config/epsilon-config.js} +0 -0
  396. /package/{dist/types → lib}/config/epsilon-lambda-event-handler.d.ts +0 -0
  397. /package/{dist/es/config/generic-aws-event-handler-function.js → lib/config/epsilon-lambda-event-handler.js} +0 -0
  398. /package/{dist/es/config/http/authorizer-function.js → lib/config/epsilon-logger-config.js} +0 -0
  399. /package/{dist/types → lib}/config/generic-aws-event-handler-function.d.ts +0 -0
  400. /package/{dist/es/config/http/epsilon-authorization-context.js → lib/config/generic-aws-event-handler-function.js} +0 -0
  401. /package/{dist/es/config/http/extended-api-gateway-event.js → lib/config/http/authorizer-function.js} +0 -0
  402. /package/{dist/types → lib}/config/http/epsilon-authorization-context.d.ts +0 -0
  403. /package/{dist/es/config/http/filter-chain-context.js → lib/config/http/epsilon-authorization-context.js} +0 -0
  404. /package/{dist/es/config/http/filter-function.js → lib/config/http/extended-api-gateway-event.js} +0 -0
  405. /package/{dist/es/config/http/handler-function.js → lib/config/http/filter-chain-context.js} +0 -0
  406. /package/{dist/es/config/http/http-config.js → lib/config/http/filter-function.js} +0 -0
  407. /package/{dist/es/config/http/http-processing-config.js → lib/config/http/handler-function.js} +0 -0
  408. /package/{dist/es/config/http/mapped-http-processing-config.js → lib/config/http/http-config.js} +0 -0
  409. /package/{dist/es/config/inter-api/inter-api-aws-config.js → lib/config/http/http-processing-config.js} +0 -0
  410. /package/{dist/es/config/inter-api/inter-api-config.js → lib/config/http/mapped-http-processing-config.js} +0 -0
  411. /package/{dist/types → lib}/config/http/null-returned-object-handling.d.ts +0 -0
  412. /package/{dist/es → lib}/config/http/null-returned-object-handling.js +0 -0
  413. /package/{dist/types → lib}/config/inter-api/inter-api-aws-config.d.ts +0 -0
  414. /package/{dist/es/config/inter-api/inter-api-process-mapping.js → lib/config/inter-api/inter-api-aws-config.js} +0 -0
  415. /package/{dist/es/config/logging-trace-id-generator.js → lib/config/inter-api/inter-api-config.js} +0 -0
  416. /package/{dist/es/config/open-api/open-api-document-components.js → lib/config/inter-api/inter-api-process-mapping.js} +0 -0
  417. /package/{dist/types → lib}/config/logging-trace-id-generator.d.ts +0 -0
  418. /package/{dist/es/config/open-api/open-api-document-path.js → lib/config/logging-trace-id-generator.js} +0 -0
  419. /package/{dist/types → lib}/config/open-api/open-api-document-components.d.ts +0 -0
  420. /package/{dist/es/config/open-api/open-api-document.js → lib/config/open-api/open-api-document-components.js} +0 -0
  421. /package/{dist/types → lib}/config/open-api/open-api-document-path.d.ts +0 -0
  422. /package/{dist/es/config/s3-config.js → lib/config/open-api/open-api-document-path.js} +0 -0
  423. /package/{dist/es/config/sns-config.js → lib/config/open-api/open-api-document.js} +0 -0
  424. /package/{dist/es/epsilon-instance.js → lib/config/s3-config.js} +0 -0
  425. /package/{dist/es/http/auth/basic-auth-token.js → lib/config/sns-config.js} +0 -0
  426. /package/{dist/types → lib}/epsilon-build-properties.d.ts +0 -0
  427. /package/{dist/es/http/auth/web-token-manipulator.js → lib/epsilon-instance.js} +0 -0
  428. /package/{dist/es/http/route/epsilon-router.js → lib/http/auth/basic-auth-token.js} +0 -0
  429. /package/{dist/es/http/route/extended-auth-response-context.js → lib/http/auth/google-web-token-manipulator.spec.d.ts} +0 -0
  430. /package/{dist/es/http/route/route-mapping.js → lib/http/auth/local-web-token-manipulator.spec.d.ts} +0 -0
  431. /package/{dist/es/http/route/route-validator-config.js → lib/http/auth/web-token-manipulator.js} +0 -0
  432. /package/{dist/types → lib}/http/error/epsilon-http-error.d.ts +0 -0
  433. /package/{dist/es/inter-api/inter-api-entry.js → lib/http/error/epsilon-http-error.spec.d.ts} +0 -0
  434. /package/{dist/es/open-api-util/open-api-doc-modifications.js → lib/http/event-util.spec.d.ts} +0 -0
  435. /package/{dist/types → lib}/http/route/extended-auth-response-context.d.ts +0 -0
  436. /package/{dist/types → lib}/http/route/route-validator-config.d.ts +0 -0
  437. /package/{dist/types → lib}/inter-api/inter-api-entry.d.ts +0 -0
  438. /package/{dist/types → lib}/local-server-cert.d.ts +0 -0
  439. /package/{dist/types → lib}/open-api-util/open-api-doc-modifications.d.ts +0 -0
  440. /package/{dist/types → lib}/open-api-util/yaml-combiner.d.ts +0 -0
  441. /package/{dist/types → lib}/sample/sample-server-static-files.d.ts +0 -0
  442. /package/{dist/types → lib}/util/aws-util.d.ts +0 -0
  443. /package/{dist/es → lib}/util/aws-util.js +0 -0
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EpsilonConstants = void 0;
4
- const ratchet_common_1 = require("@bitblit/ratchet-common");
5
- class EpsilonConstants {
6
- constructor() { }
7
- static load(filePath, className) {
8
- ratchet_common_1.Logger.info('Searching for %s : %s : %s', filePath, className, __dirname);
9
- let rval = null;
10
- const val = require(filePath);
11
- if (val) {
12
- ratchet_common_1.Logger.debug('Found %s - pulling object : %j : %s', filePath, Object.keys(val), className);
13
- rval = val[className];
14
- }
15
- return rval;
16
- }
17
- static async findDynamicImportEpsilonGlobalHandlerProvider() {
18
- const importPath = process.env[EpsilonConstants.EPSILON_FINDER_DYNAMIC_IMPORT_PATH_ENV_NAME] ||
19
- EpsilonConstants.DEFAULT_EPSILON_FINDER_DYNAMIC_IMPORT_PATH;
20
- const fnName = process.env[EpsilonConstants.EPSILON_FINDER_FUNCTION_NAME_ENV_NAME] || EpsilonConstants.DEFAULT_EPSILON_FINDER_FUNCTION_NAME;
21
- ratchet_common_1.Logger.debug('Using epsilon finder dynamic import path : %s / %s', importPath, fnName);
22
- let provider = null;
23
- try {
24
- provider = this.load(importPath, fnName);
25
- }
26
- catch (err) {
27
- ratchet_common_1.Logger.error('Error loading provider : %s / %s : %s', importPath, fnName, err, err);
28
- }
29
- let rval = null;
30
- if (provider) {
31
- ratchet_common_1.Logger.debug('Type2 is : %s', typeof provider);
32
- ratchet_common_1.Logger.info('Got3 : %s : %s', provider, typeof provider);
33
- rval = provider();
34
- ratchet_common_1.Logger.info('Rval3 is %s', rval);
35
- }
36
- return rval;
37
- }
38
- }
39
- exports.EpsilonConstants = EpsilonConstants;
40
- EpsilonConstants.EPSILON_FINDER_DYNAMIC_IMPORT_PATH_ENV_NAME = 'EPSILON_FINDER_DYNAMIC_IMPORT_PATH';
41
- EpsilonConstants.EPSILON_FINDER_FUNCTION_NAME_ENV_NAME = 'EPSILON_FINDER_FUNCTION_NAME';
42
- EpsilonConstants.DEFAULT_EPSILON_FINDER_DYNAMIC_IMPORT_PATH = 'epsilon-global-handler-provider.js';
43
- EpsilonConstants.DEFAULT_EPSILON_FINDER_FUNCTION_NAME = 'findEpsilonGlobalHandler';
44
- EpsilonConstants.AUTH_HEADER_PREFIX = 'Bearer ';
45
- EpsilonConstants.AUTH_HEADER_NAME = 'Authorization';
46
- EpsilonConstants.BACKGROUND_SQS_TYPE_FIELD = 'BACKGROUND_TYPE';
47
- EpsilonConstants.BACKGROUND_SNS_START_MARKER = 'BACKGROUND_START_MARKER';
48
- EpsilonConstants.BACKGROUND_SNS_IMMEDIATE_RUN_FLAG = 'BACKGROUND_IMMEDIATE_RUN_FLAG';
49
- EpsilonConstants.INTER_API_SNS_EVENT = 'EPSILON_INTER_API_EVENT';
@@ -1,155 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EpsilonGlobalHandler = void 0;
4
- const ratchet_common_1 = require("@bitblit/ratchet-common");
5
- const event_util_1 = require("./http/event-util");
6
- const ratchet_common_2 = require("@bitblit/ratchet-common");
7
- const ratchet_common_3 = require("@bitblit/ratchet-common");
8
- const response_util_1 = require("./http/response-util");
9
- const epsilon_http_error_1 = require("./http/error/epsilon-http-error");
10
- const request_timeout_error_1 = require("./http/error/request-timeout-error");
11
- const ratchet_common_4 = require("@bitblit/ratchet-common");
12
- const context_util_1 = require("./util/context-util");
13
- const web_v2_handler_1 = require("./http/web-v2-handler");
14
- const inter_api_epsilon_lambda_event_handler_1 = require("./lambda-event-handler/inter-api-epsilon-lambda-event-handler");
15
- const generic_sns_epsilon_lambda_event_handler_1 = require("./lambda-event-handler/generic-sns-epsilon-lambda-event-handler");
16
- const cron_epsilon_lambda_event_handler_1 = require("./lambda-event-handler/cron-epsilon-lambda-event-handler");
17
- const s3_epsilon_lambda_event_handler_1 = require("./lambda-event-handler/s3-epsilon-lambda-event-handler");
18
- const dynamo_epsilon_lambda_event_handler_1 = require("./lambda-event-handler/dynamo-epsilon-lambda-event-handler");
19
- const epsilon_logging_extension_processor_1 = require("./epsilon-logging-extension-processor");
20
- class EpsilonGlobalHandler {
21
- constructor(_epsilon) {
22
- this._epsilon = _epsilon;
23
- this.handlers = null;
24
- if (!EpsilonGlobalHandler.LOGGER_CONFIGURED) {
25
- EpsilonGlobalHandler.configureDefaultLogger();
26
- ratchet_common_1.Logger.info('EpsilonLoggingConfiguration:Default logger configured');
27
- }
28
- else {
29
- ratchet_common_1.Logger.info('EpsilonLoggingConfiguration:Skipping default logger config - already configured');
30
- }
31
- this.handlers = [
32
- this._epsilon.webHandler,
33
- new web_v2_handler_1.WebV2Handler(this._epsilon.webHandler),
34
- this._epsilon.backgroundHandler,
35
- new inter_api_epsilon_lambda_event_handler_1.InterApiEpsilonLambdaEventHandler(this._epsilon),
36
- new generic_sns_epsilon_lambda_event_handler_1.GenericSnsEpsilonLambdaEventHandler(this._epsilon),
37
- new cron_epsilon_lambda_event_handler_1.CronEpsilonLambdaEventHandler(this._epsilon),
38
- new s3_epsilon_lambda_event_handler_1.S3EpsilonLambdaEventHandler(this._epsilon),
39
- new dynamo_epsilon_lambda_event_handler_1.DynamoEpsilonLambdaEventHandler(this._epsilon),
40
- ];
41
- }
42
- static set globalInstanceProvider(input) {
43
- EpsilonGlobalHandler.GLOBAL_INSTANCE_PROVIDER = input;
44
- }
45
- static get globalInstanceProvider() {
46
- return EpsilonGlobalHandler.GLOBAL_INSTANCE_PROVIDER;
47
- }
48
- static configureDefaultLogger(overrides) {
49
- var _a, _b, _c, _d, _e;
50
- const output = overrides ? Object.assign({}, overrides) : {};
51
- output.initialLevel = (_a = output.initialLevel) !== null && _a !== void 0 ? _a : ratchet_common_4.LoggerLevelName.info;
52
- output.formatType = (_b = output.formatType) !== null && _b !== void 0 ? _b : ratchet_common_4.LogMessageFormatType.StructuredJson;
53
- output.globalVars = (_c = output.globalVars) !== null && _c !== void 0 ? _c : {};
54
- output.outputFunction = (_d = output.outputFunction) !== null && _d !== void 0 ? _d : ratchet_common_4.LoggerOutputFunction.StdOut;
55
- output.ringBufferSize = (_e = output.ringBufferSize) !== null && _e !== void 0 ? _e : 0;
56
- const src = output.preProcessors || [];
57
- output.preProcessors = src.concat([new epsilon_logging_extension_processor_1.EpsilonLoggingExtensionProcessor()]);
58
- const pre = ratchet_common_1.Logger.getOptions();
59
- ratchet_common_1.Logger.changeDefaultOptions(output, true);
60
- const post = ratchet_common_1.Logger.getOptions();
61
- EpsilonGlobalHandler.LOGGER_CONFIGURED = true;
62
- ratchet_common_1.Logger.info('EpsilonLoggingConfiguration: Updated');
63
- ratchet_common_1.Logger.dumpOptionsIntoLog();
64
- }
65
- get epsilon() {
66
- return this._epsilon;
67
- }
68
- async processSingleBackgroundByParts(type, data, overrideTraceId, overrideTraceDepth) {
69
- return this.processSingleBackgroundEntry(this._epsilon.backgroundManager.createEntry(type, data), overrideTraceId, overrideTraceDepth);
70
- }
71
- async processSingleBackgroundEntry(e, overrideTraceId, overrideTraceDepth) {
72
- let rval = false;
73
- if (e === null || e === void 0 ? void 0 : e.type) {
74
- const internal = this._epsilon.backgroundManager.wrapEntryForInternal(e, overrideTraceId, overrideTraceDepth);
75
- rval = await this._epsilon.backgroundHandler.processSingleBackgroundEntry(internal);
76
- ratchet_common_1.Logger.info('Direct processed request %j to %s', e, rval);
77
- }
78
- else {
79
- ratchet_common_1.Logger.error('Cannot process null/unnamed background entry');
80
- }
81
- return rval;
82
- }
83
- async lambdaHandler(event, context) {
84
- let rval = null;
85
- try {
86
- if (this.epsilon.config.disableLastResortTimeout || !context || !context.getRemainingTimeInMillis()) {
87
- rval = await this.innerLambdaHandler(event, context);
88
- }
89
- else {
90
- const tmp = await ratchet_common_3.PromiseRatchet.timeout(this.innerLambdaHandler(event, context), 'EpsilonLastResortTimeout', context.getRemainingTimeInMillis() - 1000);
91
- if (ratchet_common_2.TimeoutToken.isTimeoutToken(tmp)) {
92
- tmp.writeToLog();
93
- rval = response_util_1.ResponseUtil.errorResponse(epsilon_http_error_1.EpsilonHttpError.wrapError(new request_timeout_error_1.RequestTimeoutError('Timed out')));
94
- }
95
- else {
96
- rval = tmp;
97
- }
98
- }
99
- }
100
- finally {
101
- context_util_1.ContextUtil.clearContext();
102
- }
103
- return rval;
104
- }
105
- async innerLambdaHandler(event, context) {
106
- var _a, _b, _c, _d, _e, _f;
107
- context_util_1.ContextUtil.initContext(this._epsilon, event, context, 'TBD');
108
- let rval = null;
109
- let errorHandler = EpsilonGlobalHandler.defaultProcessUncaughtError;
110
- try {
111
- if (!this._epsilon) {
112
- ratchet_common_1.Logger.error('Config not found, abandoning');
113
- return false;
114
- }
115
- const logLevel = event_util_1.EventUtil.calcLogLevelViaEventOrEnvParam(ratchet_common_1.Logger.getLevel(), event, this._epsilon.config.loggerConfig);
116
- ratchet_common_1.Logger.setLevel(logLevel);
117
- if (this._epsilon.config.loggerConfig &&
118
- this._epsilon.config.loggerConfig.queryParamTracePrefixName &&
119
- event.queryStringParameters &&
120
- event.queryStringParameters[this._epsilon.config.loggerConfig.queryParamTracePrefixName]) {
121
- ratchet_common_1.Logger.info('Setting trace prefix to %s', event.queryStringParameters[this._epsilon.config.loggerConfig.queryParamTracePrefixName]);
122
- ratchet_common_1.Logger.updateTracePrefix(event.queryStringParameters[this._epsilon.config.loggerConfig.queryParamTracePrefixName]);
123
- }
124
- let found = false;
125
- for (let i = 0; i < this.handlers.length && !found; i++) {
126
- const handler = this.handlers[i];
127
- if (handler.handlesEvent(event)) {
128
- found = true;
129
- errorHandler = handler.processUncaughtError || errorHandler;
130
- const label = handler.extractLabel(event, context);
131
- context_util_1.ContextUtil.setProcessLabel(label);
132
- ratchet_common_1.Logger.logByLevel(((_c = (_b = (_a = this._epsilon) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.loggerConfig) === null || _c === void 0 ? void 0 : _c.epsilonStartEndMessageLogLevel) || ratchet_common_4.LoggerLevelName.info, 'EvtStart: %s', label);
133
- rval = await handler.processEvent(event, context);
134
- ratchet_common_1.Logger.logByLevel(((_f = (_e = (_d = this._epsilon) === null || _d === void 0 ? void 0 : _d.config) === null || _e === void 0 ? void 0 : _e.loggerConfig) === null || _f === void 0 ? void 0 : _f.epsilonStartEndMessageLogLevel) || ratchet_common_4.LoggerLevelName.info, 'EvtEnd: %s', label);
135
- ratchet_common_1.Logger.silly('EvtEnd:Value: %s Value: %j', label, rval);
136
- }
137
- }
138
- }
139
- catch (err) {
140
- rval = await errorHandler(event, context, err);
141
- }
142
- return rval;
143
- }
144
- static async defaultProcessUncaughtError(event, context, err) {
145
- ratchet_common_1.Logger.error('Error slipped out to outer edge (Default). Logging and returning log : %s', err, err);
146
- const rval = {
147
- statusCode: 500,
148
- body: JSON.stringify({ error: ratchet_common_4.ErrorRatchet.safeStringifyErr(err) }),
149
- isBase64Encoded: false,
150
- };
151
- return rval;
152
- }
153
- }
154
- exports.EpsilonGlobalHandler = EpsilonGlobalHandler;
155
- EpsilonGlobalHandler.LOGGER_CONFIGURED = false;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EpsilonLoggingExtensionProcessor = void 0;
4
- const context_util_1 = require("./util/context-util");
5
- class EpsilonLoggingExtensionProcessor {
6
- process(msg) {
7
- msg.params = Object.assign({}, msg.params || {}, context_util_1.ContextUtil.fetchLogVariables());
8
- msg.params['tester'] = Date.now();
9
- msg.params['awsRequestId'] = context_util_1.ContextUtil.currentRequestId();
10
- msg.params['traceId'] = context_util_1.ContextUtil.currentTraceId();
11
- msg.params['traceDepth'] = context_util_1.ContextUtil.currentTraceDepth();
12
- msg.params['procLabel'] = context_util_1.ContextUtil.currentProcessLabel();
13
- return msg;
14
- }
15
- label() {
16
- return 'EpsilonLoggingExtensionProcessor';
17
- }
18
- }
19
- exports.EpsilonLoggingExtensionProcessor = EpsilonLoggingExtensionProcessor;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiGatewayAdapterAuthenticationHandler = void 0;
4
- const ratchet_common_1 = require("@bitblit/ratchet-common");
5
- const local_web_token_manipulator_1 = require("./local-web-token-manipulator");
6
- const epsilon_constants_1 = require("../../epsilon-constants");
7
- class ApiGatewayAdapterAuthenticationHandler {
8
- constructor(issuer, encryptionKeys) {
9
- this.webTokenManipulator = new local_web_token_manipulator_1.LocalWebTokenManipulator([encryptionKeys], issuer);
10
- }
11
- lambdaHandler(event, context, callback) {
12
- ratchet_common_1.Logger.info('Got event : %j', event);
13
- const srcString = ApiGatewayAdapterAuthenticationHandler.extractTokenStringFromAuthorizerEvent(event);
14
- if (srcString) {
15
- const methodArn = event.methodArn;
16
- this.webTokenManipulator
17
- .parseAndValidateJWTStringAsync(srcString)
18
- .then((parsed) => {
19
- if (parsed) {
20
- callback(null, this.createPolicy(methodArn, srcString, parsed));
21
- }
22
- else {
23
- ratchet_common_1.Logger.info('Invalid bearer token');
24
- callback(new Error('Unauthorized'));
25
- }
26
- })
27
- .catch((err) => {
28
- ratchet_common_1.Logger.error('Exception parsing token : %s', err);
29
- callback(new Error('Unauthorized'));
30
- });
31
- }
32
- else {
33
- ratchet_common_1.Logger.info('Token not supplied');
34
- callback(new Error('Unauthorized'));
35
- }
36
- }
37
- createPolicy(methodArn, srcString, userOb) {
38
- const tmp = methodArn.split(':');
39
- const apiGatewayArnTmp = tmp[5].split('/');
40
- const awsAccountId = tmp[4];
41
- const region = tmp[3];
42
- const stage = apiGatewayArnTmp[1];
43
- const restApiId = apiGatewayArnTmp[0];
44
- const response = {
45
- principalId: 'user',
46
- policyDocument: {
47
- Version: '2012-10-17',
48
- Statement: [
49
- {
50
- Action: 'execute-api:Invoke',
51
- Effect: 'Allow',
52
- Resource: ['arn:aws:execute-api:' + region + ':' + awsAccountId + ':' + restApiId + '/' + stage + '/*/*'],
53
- },
54
- ],
55
- },
56
- context: {
57
- userJSON: JSON.stringify(userOb),
58
- srcData: srcString,
59
- },
60
- };
61
- return response;
62
- }
63
- static extractTokenStringFromAuthorizerEvent(event) {
64
- ratchet_common_1.Logger.silly('Extracting token from event : %j', event);
65
- let rval = null;
66
- if (event && event.authorizationToken) {
67
- const token = event.authorizationToken;
68
- if (token && token.startsWith(epsilon_constants_1.EpsilonConstants.AUTH_HEADER_PREFIX)) {
69
- rval = token.substring(epsilon_constants_1.EpsilonConstants.AUTH_HEADER_PREFIX.length);
70
- }
71
- }
72
- return rval;
73
- }
74
- }
75
- exports.ApiGatewayAdapterAuthenticationHandler = ApiGatewayAdapterAuthenticationHandler;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Auth0WebTokenManipulator = void 0;
4
- const tslib_1 = require("tslib");
5
- const ratchet_common_1 = require("@bitblit/ratchet-common");
6
- const jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
7
- const jwks_rsa_1 = tslib_1.__importDefault(require("jwks-rsa"));
8
- class Auth0WebTokenManipulator {
9
- constructor(clientId, jwksUri, issuer) {
10
- this.clientId = clientId;
11
- this.jwksUri = jwksUri;
12
- this.issuer = issuer;
13
- }
14
- async extractTokenFromAuthorizationHeader(authHeader) {
15
- let tokenString = ratchet_common_1.StringRatchet.trimToEmpty(authHeader);
16
- if (tokenString.toLowerCase().startsWith('bearer ')) {
17
- tokenString = tokenString.substring(7);
18
- }
19
- const validated = tokenString ? await this.parseAndValidateAuth0Token(tokenString, false) : null;
20
- return validated;
21
- }
22
- async parseAndValidateAuth0Token(auth0Token, allowExpired = false) {
23
- var _a;
24
- ratchet_common_1.Logger.debug('Validating Auth0 token : %s', ratchet_common_1.StringRatchet.obscure(auth0Token, 4));
25
- const fullToken = jsonwebtoken_1.default.decode(auth0Token, { complete: true });
26
- const kid = (_a = fullToken === null || fullToken === void 0 ? void 0 : fullToken.header) === null || _a === void 0 ? void 0 : _a.kid;
27
- const nowEpochSeconds = Math.floor(new Date().getTime() / 1000);
28
- const pubKey = await this.fetchSigningKey(kid);
29
- const validated = jsonwebtoken_1.default.verify(auth0Token, pubKey, {
30
- audience: this.clientId,
31
- issuer: this.issuer,
32
- ignoreExpiration: allowExpired,
33
- clockTimestamp: nowEpochSeconds,
34
- });
35
- return validated;
36
- }
37
- async fetchSigningKey(kid) {
38
- const jClient = await this.fetchJwksClient();
39
- return new Promise((res, rej) => {
40
- jClient.getSigningKey(kid, (err, key) => {
41
- if (err) {
42
- rej(err);
43
- }
44
- else {
45
- res(key.publicKey || key.rsaPublicKey);
46
- }
47
- });
48
- });
49
- }
50
- async fetchJwksClient() {
51
- if (!this.jwksClient) {
52
- this.jwksClient = (0, jwks_rsa_1.default)({
53
- cache: true,
54
- cacheMaxEntries: 5,
55
- cacheMaxAge: 1000 * 60 * 60 * 10,
56
- jwksUri: this.jwksUri,
57
- });
58
- }
59
- return this.jwksClient;
60
- }
61
- }
62
- exports.Auth0WebTokenManipulator = Auth0WebTokenManipulator;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,72 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleWebTokenManipulator = void 0;
4
- const tslib_1 = require("tslib");
5
- const ratchet_common_1 = require("@bitblit/ratchet-common");
6
- const ratchet_common_2 = require("@bitblit/ratchet-common");
7
- const jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
8
- const jwks_rsa_1 = tslib_1.__importDefault(require("jwks-rsa"));
9
- const cross_fetch_1 = tslib_1.__importDefault(require("cross-fetch"));
10
- class GoogleWebTokenManipulator {
11
- constructor(clientId) {
12
- this.clientId = clientId;
13
- }
14
- async extractTokenFromAuthorizationHeader(authHeader) {
15
- let tokenString = ratchet_common_2.StringRatchet.trimToEmpty(authHeader);
16
- if (tokenString.toLowerCase().startsWith('bearer ')) {
17
- tokenString = tokenString.substring(7);
18
- }
19
- const validated = !!tokenString ? await this.parseAndValidateGoogleToken(tokenString, false) : null;
20
- return validated;
21
- }
22
- async parseAndValidateGoogleToken(googleToken, allowExpired = false) {
23
- ratchet_common_1.Logger.debug('Auth : %s', ratchet_common_2.StringRatchet.obscure(googleToken, 4));
24
- const fullToken = jsonwebtoken_1.default.decode(googleToken, { complete: true });
25
- const kid = fullToken.header.kid;
26
- const nowEpochSeconds = Math.floor(new Date().getTime() / 1000);
27
- const pubKey = await this.fetchSigningKey(kid);
28
- const validated = jsonwebtoken_1.default.verify(googleToken, pubKey, {
29
- audience: this.clientId,
30
- issuer: ['https://accounts.google.com', 'accounts.google.com'],
31
- ignoreExpiration: allowExpired,
32
- clockTimestamp: nowEpochSeconds,
33
- });
34
- return validated;
35
- }
36
- async fetchSigningKey(kid) {
37
- const jClient = await this.fetchJwksClient();
38
- return new Promise((res, rej) => {
39
- jClient.getSigningKey(kid, (err, key) => {
40
- if (err) {
41
- rej(err);
42
- }
43
- else {
44
- res(key.publicKey || key.rsaPublicKey);
45
- }
46
- });
47
- });
48
- }
49
- async fetchJwksClient() {
50
- if (!this.jwksClient) {
51
- const discDoc = await this.fetchGoogleDiscoveryDocument();
52
- const client = (0, jwks_rsa_1.default)({
53
- cache: true,
54
- cacheMaxEntries: 5,
55
- cacheMaxAge: 1000 * 60 * 60 * 10,
56
- jwksUri: discDoc.jwks_uri,
57
- });
58
- this.jwksClient = client;
59
- }
60
- return this.jwksClient;
61
- }
62
- async fetchGoogleDiscoveryDocument() {
63
- if (!this.cacheGoogleDiscoveryDocument) {
64
- const resp = await (0, cross_fetch_1.default)(GoogleWebTokenManipulator.GOOGLE_DISCOVERY_DOCUMENT);
65
- const doc = await resp.json();
66
- this.cacheGoogleDiscoveryDocument = doc;
67
- }
68
- return this.cacheGoogleDiscoveryDocument;
69
- }
70
- }
71
- exports.GoogleWebTokenManipulator = GoogleWebTokenManipulator;
72
- GoogleWebTokenManipulator.GOOGLE_DISCOVERY_DOCUMENT = 'https://accounts.google.com/.well-known/openid-configuration';
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JwtRatchetLocalWebTokenManipulator = void 0;
4
- const ratchet_common_1 = require("@bitblit/ratchet-common");
5
- const ratchet_common_2 = require("@bitblit/ratchet-common");
6
- const ratchet_common_3 = require("@bitblit/ratchet-common");
7
- class JwtRatchetLocalWebTokenManipulator {
8
- constructor(_jwtRatchet, _issuer) {
9
- this._jwtRatchet = _jwtRatchet;
10
- this._issuer = _issuer;
11
- ratchet_common_2.RequireRatchet.notNullOrUndefined(_jwtRatchet, '_jwtRatchet');
12
- ratchet_common_2.RequireRatchet.notNullOrUndefined(ratchet_common_1.StringRatchet.trimToNull(_issuer), '_issuer');
13
- }
14
- get jwtRatchet() {
15
- return this._jwtRatchet;
16
- }
17
- get issuer() {
18
- return this._issuer;
19
- }
20
- async extractTokenFromAuthorizationHeader(header) {
21
- let tokenString = ratchet_common_1.StringRatchet.trimToEmpty(header);
22
- if (tokenString.toLowerCase().startsWith('bearer ')) {
23
- tokenString = tokenString.substring(7);
24
- }
25
- const validated = !!tokenString ? await this.jwtRatchet.decodeToken(tokenString, ratchet_common_3.ExpiredJwtHandling.THROW_EXCEPTION) : null;
26
- return validated;
27
- }
28
- }
29
- exports.JwtRatchetLocalWebTokenManipulator = JwtRatchetLocalWebTokenManipulator;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LocalWebTokenManipulator = void 0;
4
- const ratchet_common_1 = require("@bitblit/ratchet-common");
5
- const unauthorized_error_1 = require("../error/unauthorized-error");
6
- const ratchet_common_2 = require("@bitblit/ratchet-common");
7
- const ratchet_common_3 = require("@bitblit/ratchet-common");
8
- const ratchet_common_4 = require("@bitblit/ratchet-common");
9
- class LocalWebTokenManipulator {
10
- constructor(encryptionKeys, issuer) {
11
- this.encryptionKeys = encryptionKeys;
12
- this.issuer = issuer;
13
- ratchet_common_3.RequireRatchet.notNullOrUndefined(encryptionKeys, 'encryptionKeys');
14
- ratchet_common_3.RequireRatchet.noNullOrUndefinedValuesInArray(encryptionKeys, encryptionKeys.length);
15
- this._ratchet = new ratchet_common_4.JwtRatchet(Promise.resolve(encryptionKeys));
16
- }
17
- withExtraDecryptionKeys(keys) {
18
- ratchet_common_3.RequireRatchet.notNullOrUndefined(keys, 'keys');
19
- ratchet_common_3.RequireRatchet.noNullOrUndefinedValuesInArray(keys, keys.length);
20
- this._ratchet = new ratchet_common_4.JwtRatchet(this._ratchet.encryptionKeyPromise, Promise.resolve(keys), this._ratchet.jtiGenerator, this._ratchet.decryptOnlyKeyUseLogLevel, this._ratchet.parseFailureLogLevel);
21
- return this;
22
- }
23
- withParseFailureLogLevel(logLevel) {
24
- this._ratchet = new ratchet_common_4.JwtRatchet(this._ratchet.encryptionKeyPromise, this._ratchet.decryptKeysPromise, this._ratchet.jtiGenerator, this._ratchet.decryptOnlyKeyUseLogLevel, logLevel);
25
- return this;
26
- }
27
- withOldKeyUseLogLevel(logLevel) {
28
- this._ratchet = new ratchet_common_4.JwtRatchet(this._ratchet.encryptionKeyPromise, this._ratchet.decryptKeysPromise, this._ratchet.jtiGenerator, logLevel, this._ratchet.parseFailureLogLevel);
29
- return this;
30
- }
31
- get jwtRatchet() {
32
- return this._ratchet;
33
- }
34
- get selectRandomEncryptionKey() {
35
- return this._ratchet.selectRandomEncryptionKey();
36
- }
37
- createRefreshedJWTString(tokenString, expirationSeconds, allowExpired) {
38
- return this._ratchet.refreshJWTString(tokenString, allowExpired || false, expirationSeconds);
39
- }
40
- async parseAndValidateJWTStringAsync(tokenString) {
41
- const payload = await this._ratchet.decodeToken(tokenString, ratchet_common_4.ExpiredJwtHandling.ADD_FLAG);
42
- if (ratchet_common_4.JwtRatchet.hasExpiredFlag(payload)) {
43
- throw new unauthorized_error_1.UnauthorizedError('Failing JWT token read/validate - token expired on ' + payload.exp);
44
- }
45
- else {
46
- return payload;
47
- }
48
- }
49
- async createJWTStringAsync(principal, userObject, roles = ['USER'], expirationSeconds = 3600, proxyUser = null) {
50
- ratchet_common_1.Logger.info('Creating JWT token for %s that expires in %s', principal, expirationSeconds);
51
- const now = new Date().getTime();
52
- const expires = now + expirationSeconds * 1000;
53
- const tokenData = {
54
- exp: expires,
55
- iss: this.issuer,
56
- sub: principal,
57
- iat: now,
58
- user: userObject,
59
- proxy: proxyUser,
60
- roles: roles,
61
- };
62
- const token = await this._ratchet.createTokenString(tokenData, expirationSeconds);
63
- return token;
64
- }
65
- async extractTokenFromAuthorizationHeader(header) {
66
- let tokenString = ratchet_common_2.StringRatchet.trimToEmpty(header);
67
- if (tokenString.toLowerCase().startsWith('bearer ')) {
68
- tokenString = tokenString.substring(7);
69
- }
70
- const validated = !!tokenString ? await this.parseAndValidateJWTStringAsync(tokenString) : null;
71
- return validated;
72
- }
73
- }
74
- exports.LocalWebTokenManipulator = LocalWebTokenManipulator;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BadGateway = void 0;
4
- const epsilon_http_error_1 = require("./epsilon-http-error");
5
- class BadGateway extends epsilon_http_error_1.EpsilonHttpError {
6
- constructor(...errors) {
7
- super(...errors);
8
- this.withHttpStatusCode(BadGateway.HTTP_CODE);
9
- }
10
- }
11
- exports.BadGateway = BadGateway;
12
- BadGateway.HTTP_CODE = 502;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BadRequestError = void 0;
4
- const epsilon_http_error_1 = require("./epsilon-http-error");
5
- class BadRequestError extends epsilon_http_error_1.EpsilonHttpError {
6
- constructor(...errors) {
7
- super(...errors);
8
- this.withHttpStatusCode(BadRequestError.HTTP_CODE);
9
- }
10
- }
11
- exports.BadRequestError = BadRequestError;
12
- BadRequestError.HTTP_CODE = 400;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConflictError = void 0;
4
- const epsilon_http_error_1 = require("./epsilon-http-error");
5
- class ConflictError extends epsilon_http_error_1.EpsilonHttpError {
6
- constructor(...errors) {
7
- super(...errors);
8
- this.withHttpStatusCode(ConflictError.HTTP_CODE);
9
- }
10
- }
11
- exports.ConflictError = ConflictError;
12
- ConflictError.HTTP_CODE = 409;