@bitblit/ratchet-aws 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 (293) hide show
  1. package/{dist/types → lib}/batch/aws-batch-background-processor.d.ts +1 -5
  2. package/{dist/es → lib}/batch/aws-batch-background-processor.js +6 -1
  3. package/lib/batch/aws-batch-background-processor.spec.js +15 -0
  4. package/{dist/types → lib}/batch/aws-batch-ratchet.d.ts +0 -3
  5. package/{dist/es → lib}/batch/aws-batch-ratchet.js +5 -1
  6. package/lib/batch/aws-batch-ratchet.spec.js +33 -0
  7. package/{dist/types → lib}/build/ratchet-aws-info.d.ts +1 -1
  8. package/{dist/types → lib}/cache/dynamo-db-storage-provider.d.ts +3 -3
  9. package/{dist/es → lib}/cache/dynamo-db-storage-provider.js +3 -1
  10. package/{dist/types → lib}/cache/s3-storage-provider.d.ts +3 -3
  11. package/{dist/es → lib}/cache/s3-storage-provider.js +4 -1
  12. package/{dist/types → lib}/cache/simple-cache-storage-provider.d.ts +1 -1
  13. package/{dist/types → lib}/cache/simple-cache.d.ts +3 -3
  14. package/{dist/es → lib}/cache/simple-cache.js +4 -2
  15. package/lib/cache/simple-cache.spec.js +67 -0
  16. package/{dist/es → lib}/cloudwatch/cloud-watch-log-group-ratchet.js +4 -2
  17. package/lib/cloudwatch/cloud-watch-log-group-ratchet.spec.js +19 -0
  18. package/{dist/es → lib}/cloudwatch/cloud-watch-logs-ratchet.js +6 -5
  19. package/lib/cloudwatch/cloud-watch-logs-ratchet.spec.js +84 -0
  20. package/{dist/types → lib}/cloudwatch/cloud-watch-metrics-ratchet.d.ts +3 -3
  21. package/{dist/es → lib}/cloudwatch/cloud-watch-metrics-ratchet.js +3 -2
  22. package/lib/cloudwatch/cloud-watch-metrics-ratchet.spec.js +23 -0
  23. package/{dist/types → lib}/daemon/daemon-like.d.ts +3 -3
  24. package/{dist/types → lib}/daemon/daemon-process-state-public-token.d.ts +1 -1
  25. package/{dist/types → lib}/daemon/daemon-util.d.ts +5 -11
  26. package/{dist/es → lib}/daemon/daemon-util.js +3 -3
  27. package/lib/daemon/daemon-util.spec.d.ts +4 -0
  28. package/lib/daemon/daemon-util.spec.js +79 -0
  29. package/{dist/types → lib}/daemon/daemon.d.ts +5 -5
  30. package/{dist/es → lib}/daemon/daemon.js +12 -6
  31. package/{dist/types → lib}/dao/prototype-dao-provider.d.ts +1 -1
  32. package/{dist/types → lib}/dao/prototype-dao.d.ts +2 -2
  33. package/{dist/es → lib}/dao/prototype-dao.js +13 -9
  34. package/lib/dao/prototype-dao.spec.d.ts +8 -0
  35. package/lib/dao/prototype-dao.spec.js +26 -0
  36. package/{dist/types → lib}/dao/s3-prototype-dao-provider.d.ts +3 -3
  37. package/{dist/es → lib}/dao/s3-prototype-dao-provider.js +3 -1
  38. package/{dist/types → lib}/dao/s3-simple-dao.d.ts +2 -2
  39. package/{dist/es → lib}/dao/s3-simple-dao.js +4 -2
  40. package/{dist/types → lib}/dynamodb/dynamo-ratchet-like.d.ts +3 -3
  41. package/{dist/types → lib}/dynamodb/dynamo-ratchet.d.ts +4 -4
  42. package/{dist/es → lib}/dynamodb/dynamo-ratchet.js +7 -6
  43. package/lib/dynamodb/dynamo-ratchet.spec.js +156 -0
  44. package/{dist/es → lib}/dynamodb/dynamo-table-ratchet.js +5 -4
  45. package/{dist/es → lib}/dynamodb/hash-spreader.js +8 -1
  46. package/lib/dynamodb/hash-spreader.spec.js +17 -0
  47. package/{dist/types → lib}/ec2/ec2-ratchet.d.ts +0 -11
  48. package/{dist/es → lib}/ec2/ec2-ratchet.js +7 -3
  49. package/lib/ec2/ec2-ratchet.spec.js +31 -0
  50. package/{dist/types → lib}/environment/cascade-environment-service-provider.d.ts +1 -4
  51. package/{dist/es → lib}/environment/cascade-environment-service-provider.js +3 -2
  52. package/{dist/types → lib}/environment/env-var-environment-service-provider.d.ts +1 -5
  53. package/{dist/es → lib}/environment/env-var-environment-service-provider.js +5 -4
  54. package/{dist/types → lib}/environment/environment-service-config.d.ts +0 -3
  55. package/lib/environment/environment-service-provider.d.ts +3 -0
  56. package/{dist/types → lib}/environment/environment-service.d.ts +2 -5
  57. package/{dist/es → lib}/environment/environment-service.js +13 -11
  58. package/lib/environment/environment-service.spec.js +22 -0
  59. package/{dist/types → lib}/environment/fixed-environment-service-provider.d.ts +1 -4
  60. package/{dist/es → lib}/environment/fixed-environment-service-provider.js +3 -2
  61. package/{dist/types → lib}/environment/s3-environment-service-provider.d.ts +1 -4
  62. package/{dist/es → lib}/environment/s3-environment-service-provider.js +7 -5
  63. package/{dist/types → lib}/environment/ssm-environment-service-provider.d.ts +1 -5
  64. package/{dist/es → lib}/environment/ssm-environment-service-provider.js +9 -6
  65. package/{dist/types → lib}/expiring-code/dynamo-expiring-code-provider.d.ts +4 -4
  66. package/{dist/es → lib}/expiring-code/dynamo-expiring-code-provider.js +2 -0
  67. package/{dist/types → lib}/expiring-code/expiring-code-provider.d.ts +1 -1
  68. package/{dist/types → lib}/expiring-code/expiring-code-ratchet.d.ts +3 -6
  69. package/{dist/es → lib}/expiring-code/expiring-code-ratchet.js +3 -2
  70. package/lib/expiring-code/expiring-code-ratchet.spec.js +7 -0
  71. package/{dist/types → lib}/expiring-code/s3-expiring-code-provider.d.ts +3 -3
  72. package/{dist/es → lib}/expiring-code/s3-expiring-code-provider.js +4 -1
  73. package/lib/expiring-code/s3-expiring-code-provider.spec.js +46 -0
  74. package/{dist/types → lib}/iam/aws-credentials-ratchet.d.ts +0 -5
  75. package/{dist/es → lib}/iam/aws-credentials-ratchet.js +2 -1
  76. package/{dist/es → lib}/lambda/lambda-event-type-guards.js +1 -1
  77. package/{dist/types → lib}/model/cloud-watch-metrics-minute-level-dynamo-count-request.d.ts +2 -2
  78. package/lib/model/dynamo/doc-put-item-command-input.js +1 -0
  79. package/lib/model/dynamo/doc-query-command-input.js +1 -0
  80. package/lib/model/dynamo/doc-scan-command-input.js +1 -0
  81. package/lib/model/dynamo/doc-update-item-command-input.js +1 -0
  82. package/{dist/es → lib}/route53/route-53-ratchet.js +3 -1
  83. package/{dist/types → lib}/runtime-parameter/cached-stored-runtime-parameter.d.ts +1 -1
  84. package/lib/runtime-parameter/cached-stored-runtime-parameter.js +1 -0
  85. package/{dist/types → lib}/runtime-parameter/dynamo-runtime-parameter-provider.d.ts +3 -3
  86. package/{dist/es → lib}/runtime-parameter/dynamo-runtime-parameter-provider.js +4 -2
  87. package/lib/runtime-parameter/dynamo-runtime-parameter-provider.spec.d.ts +1 -0
  88. package/lib/runtime-parameter/dynamo-runtime-parameter-provider.spec.js +49 -0
  89. package/{dist/types → lib}/runtime-parameter/global-variable-override-runtime-parameter-provider.d.ts +2 -9
  90. package/{dist/es → lib}/runtime-parameter/global-variable-override-runtime-parameter-provider.js +10 -8
  91. package/lib/runtime-parameter/global-variable-override-runtime-parameter-provider.spec.d.ts +1 -0
  92. package/lib/runtime-parameter/global-variable-override-runtime-parameter-provider.spec.js +37 -0
  93. package/{dist/types → lib}/runtime-parameter/memory-runtime-parameter-provider.d.ts +2 -6
  94. package/{dist/es → lib}/runtime-parameter/memory-runtime-parameter-provider.js +2 -1
  95. package/{dist/types → lib}/runtime-parameter/runtime-parameter-provider.d.ts +1 -6
  96. package/lib/runtime-parameter/runtime-parameter-provider.js +1 -0
  97. package/{dist/types → lib}/runtime-parameter/runtime-parameter-ratchet.d.ts +2 -2
  98. package/{dist/es → lib}/runtime-parameter/runtime-parameter-ratchet.js +4 -3
  99. package/lib/runtime-parameter/runtime-parameter-ratchet.spec.d.ts +1 -0
  100. package/lib/runtime-parameter/runtime-parameter-ratchet.spec.js +39 -0
  101. package/lib/runtime-parameter/stored-runtime-parameter.js +1 -0
  102. package/{dist/types → lib}/s3/s3-cache-ratchet.d.ts +3 -4
  103. package/{dist/es → lib}/s3/s3-cache-ratchet.js +7 -5
  104. package/lib/s3/s3-cache-ratchet.spec.d.ts +1 -0
  105. package/lib/s3/s3-cache-ratchet.spec.js +97 -0
  106. package/{dist/types → lib}/s3/s3-cache-to-local-disk-ratchet.d.ts +2 -5
  107. package/{dist/es → lib}/s3/s3-cache-to-local-disk-ratchet.js +8 -3
  108. package/lib/s3/s3-cache-to-local-dist-ratchet.spec.d.ts +1 -0
  109. package/lib/s3/s3-cache-to-local-dist-ratchet.spec.js +22 -0
  110. package/{dist/es → lib}/s3/s3-location-sync-ratchet.js +4 -1
  111. package/{dist/es → lib}/s3/s3-ratchet.js +1 -1
  112. package/lib/s3/s3-ratchet.spec.d.ts +1 -0
  113. package/lib/s3/s3-ratchet.spec.js +20 -0
  114. package/lib/ses/email-attachment.d.ts +5 -0
  115. package/lib/ses/email-attachment.js +1 -0
  116. package/{dist/types → lib}/ses/mailer-config.d.ts +2 -5
  117. package/lib/ses/mailer-config.js +1 -0
  118. package/{dist/types → lib}/ses/mailer-like.d.ts +2 -9
  119. package/lib/ses/mailer-like.js +1 -0
  120. package/{dist/types → lib}/ses/mailer.d.ts +4 -11
  121. package/{dist/es → lib}/ses/mailer.js +8 -6
  122. package/lib/ses/mailer.spec.d.ts +1 -0
  123. package/lib/ses/mailer.spec.js +104 -0
  124. package/{dist/types → lib}/ses/ratchet-template-renderer.d.ts +0 -4
  125. package/lib/ses/ratchet-template-renderer.js +1 -0
  126. package/lib/ses/ready-to-send-email.d.ts +13 -0
  127. package/lib/ses/ready-to-send-email.js +1 -0
  128. package/{dist/types → lib}/ses/remote-handlebars-template-renderer.d.ts +1 -3
  129. package/{dist/es → lib}/ses/remote-handlebars-template-renderer.js +6 -2
  130. package/lib/ses/resolved-ready-to-send-email.d.ts +5 -0
  131. package/lib/ses/resolved-ready-to-send-email.js +1 -0
  132. package/{dist/es → lib}/sns/sns-ratchet.js +4 -2
  133. package/lib/sns/sns-ratchet.spec.d.ts +1 -0
  134. package/lib/sns/sns-ratchet.spec.js +17 -0
  135. package/{dist/types → lib}/sync-lock/dynamo-db-sync-lock.d.ts +2 -2
  136. package/{dist/es → lib}/sync-lock/dynamo-db-sync-lock.js +5 -1
  137. package/lib/sync-lock/dynamo-db-sync-lock.spec.d.ts +1 -0
  138. package/lib/sync-lock/dynamo-db-sync-lock.spec.js +30 -0
  139. package/{dist/types → lib}/sync-lock/memory-sync-lock.d.ts +1 -4
  140. package/{dist/es → lib}/sync-lock/memory-sync-lock.js +3 -4
  141. package/lib/sync-lock/sync-lock-provider.js +1 -0
  142. package/package.json +11 -12
  143. package/dist/cjs/batch/aws-batch-background-processor.js +0 -44
  144. package/dist/cjs/batch/aws-batch-ratchet.js +0 -55
  145. package/dist/cjs/build/ratchet-aws-info.js +0 -18
  146. package/dist/cjs/cache/dynamo-db-storage-provider.js +0 -111
  147. package/dist/cjs/cache/s3-storage-provider.js +0 -44
  148. package/dist/cjs/cache/simple-cache-object-wrapper.js +0 -2
  149. package/dist/cjs/cache/simple-cache-read-options.js +0 -2
  150. package/dist/cjs/cache/simple-cache-storage-provider.js +0 -2
  151. package/dist/cjs/cache/simple-cache.js +0 -66
  152. package/dist/cjs/cloudwatch/cloud-watch-log-group-ratchet.js +0 -73
  153. package/dist/cjs/cloudwatch/cloud-watch-logs-ratchet.js +0 -173
  154. package/dist/cjs/cloudwatch/cloud-watch-metrics-ratchet.js +0 -57
  155. package/dist/cjs/daemon/daemon-like.js +0 -2
  156. package/dist/cjs/daemon/daemon-process-create-options.js +0 -2
  157. package/dist/cjs/daemon/daemon-process-state-public-token.js +0 -2
  158. package/dist/cjs/daemon/daemon-process-state.js +0 -2
  159. package/dist/cjs/daemon/daemon-util.js +0 -152
  160. package/dist/cjs/daemon/daemon.js +0 -126
  161. package/dist/cjs/dao/prototype-dao-config.js +0 -2
  162. package/dist/cjs/dao/prototype-dao-db.js +0 -2
  163. package/dist/cjs/dao/prototype-dao-provider.js +0 -2
  164. package/dist/cjs/dao/prototype-dao.js +0 -88
  165. package/dist/cjs/dao/s3-prototype-dao-provider.js +0 -28
  166. package/dist/cjs/dao/s3-simple-dao.js +0 -78
  167. package/dist/cjs/dao/simple-dao-item.js +0 -2
  168. package/dist/cjs/dynamodb/dynamo-ratchet-like.js +0 -2
  169. package/dist/cjs/dynamodb/dynamo-ratchet.js +0 -667
  170. package/dist/cjs/dynamodb/dynamo-table-ratchet.js +0 -91
  171. package/dist/cjs/dynamodb/hash-spreader.js +0 -62
  172. package/dist/cjs/ec2/ec2-ratchet.js +0 -107
  173. package/dist/cjs/environment/cascade-environment-service-provider.js +0 -27
  174. package/dist/cjs/environment/env-var-environment-service-provider.js +0 -33
  175. package/dist/cjs/environment/environment-service-config.js +0 -2
  176. package/dist/cjs/environment/environment-service-provider.js +0 -2
  177. package/dist/cjs/environment/environment-service.js +0 -52
  178. package/dist/cjs/environment/fixed-environment-service-provider.js +0 -24
  179. package/dist/cjs/environment/s3-environment-service-provider.js +0 -29
  180. package/dist/cjs/environment/ssm-environment-service-provider.js +0 -61
  181. package/dist/cjs/expiring-code/dynamo-expiring-code-provider.js +0 -26
  182. package/dist/cjs/expiring-code/expiring-code-params.js +0 -2
  183. package/dist/cjs/expiring-code/expiring-code-provider.js +0 -2
  184. package/dist/cjs/expiring-code/expiring-code-ratchet.js +0 -37
  185. package/dist/cjs/expiring-code/expiring-code.js +0 -2
  186. package/dist/cjs/expiring-code/s3-expiring-code-provider.js +0 -49
  187. package/dist/cjs/iam/aws-credentials-ratchet.js +0 -21
  188. package/dist/cjs/index.js +0 -81
  189. package/dist/cjs/lambda/lambda-event-detector.js +0 -42
  190. package/dist/cjs/lambda/lambda-event-type-guards.js +0 -28
  191. package/dist/cjs/model/cloud-watch-metrics-minute-level-dynamo-count-request.js +0 -2
  192. package/dist/cjs/model/cloud-watch-metrics-unit.js +0 -33
  193. package/dist/cjs/model/dynamo/doc-put-item-command-input.js +0 -2
  194. package/dist/cjs/model/dynamo/doc-query-command-input.js +0 -2
  195. package/dist/cjs/model/dynamo/doc-scan-command-input.js +0 -2
  196. package/dist/cjs/model/dynamo/doc-update-item-command-input.js +0 -2
  197. package/dist/cjs/model/dynamo-count-result.js +0 -2
  198. package/dist/cjs/route53/route-53-ratchet.js +0 -57
  199. package/dist/cjs/runtime-parameter/cached-stored-runtime-parameter.js +0 -2
  200. package/dist/cjs/runtime-parameter/dynamo-runtime-parameter-provider.js +0 -38
  201. package/dist/cjs/runtime-parameter/global-variable-override-runtime-parameter-provider.js +0 -54
  202. package/dist/cjs/runtime-parameter/memory-runtime-parameter-provider.js +0 -30
  203. package/dist/cjs/runtime-parameter/runtime-parameter-provider.js +0 -2
  204. package/dist/cjs/runtime-parameter/runtime-parameter-ratchet.js +0 -74
  205. package/dist/cjs/runtime-parameter/stored-runtime-parameter.js +0 -2
  206. package/dist/cjs/s3/s3-cache-ratchet.js +0 -332
  207. package/dist/cjs/s3/s3-cache-to-local-disk-ratchet.js +0 -105
  208. package/dist/cjs/s3/s3-location-sync-ratchet.js +0 -142
  209. package/dist/cjs/s3/s3-ratchet.js +0 -26
  210. package/dist/cjs/ses/email-attachment.js +0 -2
  211. package/dist/cjs/ses/mailer-config.js +0 -2
  212. package/dist/cjs/ses/mailer-like.js +0 -2
  213. package/dist/cjs/ses/mailer.js +0 -208
  214. package/dist/cjs/ses/ratchet-template-renderer.js +0 -2
  215. package/dist/cjs/ses/ready-to-send-email.js +0 -2
  216. package/dist/cjs/ses/remote-handlebars-template-renderer.js +0 -79
  217. package/dist/cjs/ses/resolved-ready-to-send-email.js +0 -2
  218. package/dist/cjs/sns/sns-ratchet.js +0 -47
  219. package/dist/cjs/sync-lock/dynamo-db-sync-lock.js +0 -69
  220. package/dist/cjs/sync-lock/memory-sync-lock.js +0 -40
  221. package/dist/cjs/sync-lock/sync-lock-provider.js +0 -2
  222. package/dist/es/index.js +0 -78
  223. package/dist/tsconfig.cjs.tsbuildinfo +0 -1
  224. package/dist/tsconfig.es.tsbuildinfo +0 -1
  225. package/dist/tsconfig.types.tsbuildinfo +0 -1
  226. package/dist/types/environment/environment-service-provider.d.ts +0 -7
  227. package/dist/types/index.d.ts +0 -81
  228. package/dist/types/ses/email-attachment.d.ts +0 -23
  229. package/dist/types/ses/ready-to-send-email.d.ts +0 -66
  230. package/dist/types/ses/resolved-ready-to-send-email.d.ts +0 -16
  231. /package/{dist/es/cache/simple-cache-object-wrapper.js → lib/batch/aws-batch-background-processor.spec.d.ts} +0 -0
  232. /package/{dist/es/cache/simple-cache-read-options.js → lib/batch/aws-batch-ratchet.spec.d.ts} +0 -0
  233. /package/{dist/es → lib}/build/ratchet-aws-info.js +0 -0
  234. /package/{dist/types → lib}/cache/simple-cache-object-wrapper.d.ts +0 -0
  235. /package/{dist/es/cache/simple-cache-storage-provider.js → lib/cache/simple-cache-object-wrapper.js} +0 -0
  236. /package/{dist/types → lib}/cache/simple-cache-read-options.d.ts +0 -0
  237. /package/{dist/es/daemon/daemon-like.js → lib/cache/simple-cache-read-options.js} +0 -0
  238. /package/{dist/es/daemon/daemon-process-create-options.js → lib/cache/simple-cache-storage-provider.js} +0 -0
  239. /package/{dist/es/daemon/daemon-process-state-public-token.js → lib/cache/simple-cache.spec.d.ts} +0 -0
  240. /package/{dist/types → lib}/cloudwatch/cloud-watch-log-group-ratchet.d.ts +0 -0
  241. /package/{dist/es/daemon/daemon-process-state.js → lib/cloudwatch/cloud-watch-log-group-ratchet.spec.d.ts} +0 -0
  242. /package/{dist/types → lib}/cloudwatch/cloud-watch-logs-ratchet.d.ts +0 -0
  243. /package/{dist/es/dao/prototype-dao-config.js → lib/cloudwatch/cloud-watch-logs-ratchet.spec.d.ts} +0 -0
  244. /package/{dist/es/dao/prototype-dao-db.js → lib/cloudwatch/cloud-watch-metrics-ratchet.spec.d.ts} +0 -0
  245. /package/{dist/es/dao/prototype-dao-provider.js → lib/daemon/daemon-like.js} +0 -0
  246. /package/{dist/types → lib}/daemon/daemon-process-create-options.d.ts +0 -0
  247. /package/{dist/es/dao/simple-dao-item.js → lib/daemon/daemon-process-create-options.js} +0 -0
  248. /package/{dist/es/dynamodb/dynamo-ratchet-like.js → lib/daemon/daemon-process-state-public-token.js} +0 -0
  249. /package/{dist/types → lib}/daemon/daemon-process-state.d.ts +0 -0
  250. /package/{dist/es/environment/environment-service-config.js → lib/daemon/daemon-process-state.js} +0 -0
  251. /package/{dist/types → lib}/dao/prototype-dao-config.d.ts +0 -0
  252. /package/{dist/es/environment/environment-service-provider.js → lib/dao/prototype-dao-config.js} +0 -0
  253. /package/{dist/types → lib}/dao/prototype-dao-db.d.ts +0 -0
  254. /package/{dist/es/expiring-code/expiring-code-params.js → lib/dao/prototype-dao-db.js} +0 -0
  255. /package/{dist/es/expiring-code/expiring-code-provider.js → lib/dao/prototype-dao-provider.js} +0 -0
  256. /package/{dist/types → lib}/dao/simple-dao-item.d.ts +0 -0
  257. /package/{dist/es/expiring-code/expiring-code.js → lib/dao/simple-dao-item.js} +0 -0
  258. /package/{dist/es/model/cloud-watch-metrics-minute-level-dynamo-count-request.js → lib/dynamodb/dynamo-ratchet-like.js} +0 -0
  259. /package/{dist/es/model/dynamo-count-result.js → lib/dynamodb/dynamo-ratchet.spec.d.ts} +0 -0
  260. /package/{dist/types → lib}/dynamodb/dynamo-table-ratchet.d.ts +0 -0
  261. /package/{dist/types → lib}/dynamodb/hash-spreader.d.ts +0 -0
  262. /package/{dist/es/model/dynamo/doc-put-item-command-input.js → lib/dynamodb/hash-spreader.spec.d.ts} +0 -0
  263. /package/{dist/es/model/dynamo/doc-query-command-input.js → lib/ec2/ec2-ratchet.spec.d.ts} +0 -0
  264. /package/{dist/es/model/dynamo/doc-scan-command-input.js → lib/environment/environment-service-config.js} +0 -0
  265. /package/{dist/es/model/dynamo/doc-update-item-command-input.js → lib/environment/environment-service-provider.js} +0 -0
  266. /package/{dist/es/runtime-parameter/cached-stored-runtime-parameter.js → lib/environment/environment-service.spec.d.ts} +0 -0
  267. /package/{dist/types → lib}/expiring-code/expiring-code-params.d.ts +0 -0
  268. /package/{dist/es/runtime-parameter/runtime-parameter-provider.js → lib/expiring-code/expiring-code-params.js} +0 -0
  269. /package/{dist/es/runtime-parameter/stored-runtime-parameter.js → lib/expiring-code/expiring-code-provider.js} +0 -0
  270. /package/{dist/es/ses/email-attachment.js → lib/expiring-code/expiring-code-ratchet.spec.d.ts} +0 -0
  271. /package/{dist/types → lib}/expiring-code/expiring-code.d.ts +0 -0
  272. /package/{dist/es/ses/mailer-config.js → lib/expiring-code/expiring-code.js} +0 -0
  273. /package/{dist/es/ses/mailer-like.js → lib/expiring-code/s3-expiring-code-provider.spec.d.ts} +0 -0
  274. /package/{dist/es/ses/ratchet-template-renderer.js → lib/index.d.ts} +0 -0
  275. /package/{dist/es/ses/ready-to-send-email.js → lib/index.js} +0 -0
  276. /package/{dist/types → lib}/lambda/lambda-event-detector.d.ts +0 -0
  277. /package/{dist/es → lib}/lambda/lambda-event-detector.js +0 -0
  278. /package/{dist/types → lib}/lambda/lambda-event-type-guards.d.ts +0 -0
  279. /package/{dist/es/ses/resolved-ready-to-send-email.js → lib/model/cloud-watch-metrics-minute-level-dynamo-count-request.js} +0 -0
  280. /package/{dist/types → lib}/model/cloud-watch-metrics-unit.d.ts +0 -0
  281. /package/{dist/es → lib}/model/cloud-watch-metrics-unit.js +0 -0
  282. /package/{dist/types → lib}/model/dynamo/doc-put-item-command-input.d.ts +0 -0
  283. /package/{dist/types → lib}/model/dynamo/doc-query-command-input.d.ts +0 -0
  284. /package/{dist/types → lib}/model/dynamo/doc-scan-command-input.d.ts +0 -0
  285. /package/{dist/types → lib}/model/dynamo/doc-update-item-command-input.d.ts +0 -0
  286. /package/{dist/types → lib}/model/dynamo-count-result.d.ts +0 -0
  287. /package/{dist/es/sync-lock/sync-lock-provider.js → lib/model/dynamo-count-result.js} +0 -0
  288. /package/{dist/types → lib}/route53/route-53-ratchet.d.ts +0 -0
  289. /package/{dist/types → lib}/runtime-parameter/stored-runtime-parameter.d.ts +0 -0
  290. /package/{dist/types → lib}/s3/s3-location-sync-ratchet.d.ts +0 -0
  291. /package/{dist/types → lib}/s3/s3-ratchet.d.ts +0 -0
  292. /package/{dist/types → lib}/sns/sns-ratchet.d.ts +0 -0
  293. /package/{dist/types → lib}/sync-lock/sync-lock-provider.d.ts +0 -0
@@ -0,0 +1,97 @@
1
+ import { CopyObjectCommand, CreateMultipartUploadCommand, GetObjectCommand, HeadObjectCommand, PutObjectCommand, S3Client, UploadPartCommand, } from '@aws-sdk/client-s3';
2
+ import { S3CacheRatchet } from './s3-cache-ratchet.js';
3
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
4
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
5
+ import { StreamRatchet } from '@bitblit/ratchet-common/lib/stream/stream-ratchet.js';
6
+ import { mockClient } from 'aws-sdk-client-mock';
7
+ import { jest } from '@jest/globals';
8
+ jest.mock('@aws-sdk/s3-request-presigner', () => ({
9
+ getSignedUrl: jest.fn(() => Promise.resolve('https://test.link/test.jpg')),
10
+ }));
11
+ let mockS3 = null;
12
+ let mockS3OtherAccount = null;
13
+ describe('#fileExists', function () {
14
+ mockS3 = mockClient(S3Client);
15
+ mockS3OtherAccount = mockClient(S3Client);
16
+ beforeEach(() => {
17
+ mockS3.reset();
18
+ mockS3OtherAccount.reset();
19
+ });
20
+ it('should return false for files that do not exist', async () => {
21
+ mockS3.on(HeadObjectCommand).rejects({ statusCode: 404, $metadata: null });
22
+ const cache = new S3CacheRatchet(mockS3, 'test-bucket');
23
+ const out = await cache.fileExists('test-missing-file');
24
+ expect(out).toEqual(false);
25
+ });
26
+ xit('should create a expiring link', async () => {
27
+ const cache = new S3CacheRatchet(mockS3, 'test-bucket');
28
+ const out = await cache.preSignedDownloadUrlForCacheFile('test.jpg', 300);
29
+ expect(out).toEqual('https://test.link/test.jpg');
30
+ });
31
+ it('should copy an object', async () => {
32
+ mockS3.on(CopyObjectCommand).resolves({});
33
+ const cache = new S3CacheRatchet(mockS3, 'test-bucket');
34
+ const out = await cache.quietCopyFile('test.png', 'test2.png');
35
+ expect(out).toBeTruthy();
36
+ });
37
+ xit('should copy a file to s3', async () => {
38
+ mockS3.on(PutObjectCommand).resolves({});
39
+ mockS3.on(CreateMultipartUploadCommand).resolves({ UploadId: '1' });
40
+ mockS3.on(UploadPartCommand).resolves({ ETag: '1' });
41
+ const cache = new S3CacheRatchet(mockS3, 'test-bucket');
42
+ const stream = StreamRatchet.stringToWebReadableStream(StringRatchet.createRandomHexString(1024 * 1024 * 6));
43
+ const out = await cache.writeStreamToCacheFile('s3-cache-ratchet.spec.ts', stream, {
44
+ ContentType: 'text/typescript',
45
+ });
46
+ Logger.info('Calls: %j', mockS3.calls());
47
+ expect(out).toBeTruthy();
48
+ });
49
+ it('should pull a file as a string', async () => {
50
+ async function createNew() {
51
+ return {
52
+ Body: {
53
+ transformToByteArray: async () => Promise.resolve(StringRatchet.stringToUint8Array(JSON.stringify({ test: StringRatchet.createRandomHexString(128) }))),
54
+ transformToString: async () => Promise.resolve(JSON.stringify({ test: StringRatchet.createRandomHexString(128) })),
55
+ },
56
+ $metadata: null,
57
+ };
58
+ }
59
+ mockS3.on(GetObjectCommand).resolves(createNew());
60
+ const cache = new S3CacheRatchet(mockS3, 'test-bucket');
61
+ const fileName = 'test-file.json';
62
+ const outBuf = await cache.fetchCacheFileAsBuffer(fileName);
63
+ expect(outBuf).toBeTruthy();
64
+ expect(outBuf.length).toBeGreaterThan(100);
65
+ mockS3.reset();
66
+ mockS3.on(GetObjectCommand).resolves(createNew());
67
+ const outString = await cache.fetchCacheFileAsString(fileName);
68
+ expect(outString).toBeTruthy();
69
+ expect(outString.length).toBeGreaterThan(100);
70
+ mockS3.reset();
71
+ mockS3.on(GetObjectCommand).resolves(createNew());
72
+ const outObject = await cache.fetchCacheFileAsObject(fileName);
73
+ expect(outObject).toBeTruthy();
74
+ expect(outObject['test']).toBeTruthy();
75
+ });
76
+ xit('should sync 2 folders', async () => {
77
+ const cache1 = new S3CacheRatchet(mockS3, 'test1');
78
+ const cache2 = new S3CacheRatchet(mockS3, 'test2');
79
+ const out = await cache1.synchronize('src/', 'dst/', cache2);
80
+ expect(out).not.toBeNull();
81
+ }, 60_000);
82
+ xit('should list direct children past 1000', async () => {
83
+ const s3 = new S3Client({ region: 'us-east-1' });
84
+ const cache = new S3CacheRatchet(s3, 'test-bucket');
85
+ const out = await cache.directChildrenOfPrefix('test/aws/test-path-with-lots-of-childen/');
86
+ expect(out).toBeTruthy();
87
+ expect(out.length).toBeGreaterThan(1000);
88
+ Logger.info('Got: %s', out);
89
+ expect(out).toBeTruthy();
90
+ });
91
+ xit('should sync cross-account', async () => {
92
+ const cache1 = new S3CacheRatchet(mockS3, 'bucket1');
93
+ const cache2 = new S3CacheRatchet(mockS3OtherAccount, 'bucket2');
94
+ const res = await cache1.synchronize('test1/', 'test2/', cache2, true);
95
+ expect(res).not.toBeNull();
96
+ }, 50_000);
97
+ });
@@ -1,8 +1,5 @@
1
- /// <reference types="node" />
2
- import { S3CacheRatchet } from './s3-cache-ratchet';
3
- /**
4
- * Use this when you want a lambda to cache a remote S3 bucket locally on disk for faster access
5
- */
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { S3CacheRatchet } from './s3-cache-ratchet.js';
6
3
  export declare class S3CacheToLocalDiskRatchet {
7
4
  private s3;
8
5
  private tmpFolder;
@@ -1,13 +1,19 @@
1
1
  import crypto from 'crypto';
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
- import { Logger, RequireRatchet, StringRatchet } from '@bitblit/ratchet-common';
4
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
5
+ import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
6
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
5
7
  export class S3CacheToLocalDiskRatchet {
8
+ s3;
9
+ tmpFolder;
10
+ cacheTimeoutSeconds;
11
+ static DEFAULT_CACHE_TIMEOUT_SEC = 7 * 24 * 3600;
12
+ currentlyLoading = new Map();
6
13
  constructor(s3, tmpFolder, cacheTimeoutSeconds = S3CacheToLocalDiskRatchet.DEFAULT_CACHE_TIMEOUT_SEC) {
7
14
  this.s3 = s3;
8
15
  this.tmpFolder = tmpFolder;
9
16
  this.cacheTimeoutSeconds = cacheTimeoutSeconds;
10
- this.currentlyLoading = new Map();
11
17
  RequireRatchet.notNullOrUndefined(s3, 's3');
12
18
  RequireRatchet.notNullOrUndefined(StringRatchet.trimToNull(tmpFolder));
13
19
  RequireRatchet.true(fs.existsSync(tmpFolder), 'folder must exist : ' + tmpFolder);
@@ -97,4 +103,3 @@ export class S3CacheToLocalDiskRatchet {
97
103
  return rval;
98
104
  }
99
105
  }
100
- S3CacheToLocalDiskRatchet.DEFAULT_CACHE_TIMEOUT_SEC = 7 * 24 * 3600;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { S3CacheToLocalDiskRatchet } from './s3-cache-to-local-disk-ratchet.js';
2
+ import { tmpdir } from 'os';
3
+ import { JestRatchet } from '@bitblit/ratchet-jest/lib/jest/jest-ratchet.js';
4
+ import { jest } from '@jest/globals';
5
+ let mockS3CR;
6
+ describe('#S3CacheToLocalDiskRatchet', () => {
7
+ beforeEach(() => {
8
+ mockS3CR = JestRatchet.mock(jest.fn);
9
+ });
10
+ it('should download file and store in tmp', async () => {
11
+ mockS3CR.fetchCacheFileAsBuffer.mockResolvedValue(Buffer.from(JSON.stringify({ a: 'b' })));
12
+ const pth = 'test-path';
13
+ const svc = new S3CacheToLocalDiskRatchet(mockS3CR, tmpdir());
14
+ svc.removeCacheFileForKey(pth);
15
+ const proms = [];
16
+ for (let i = 0; i < 5; i++) {
17
+ proms.push(svc.getFileBuffer(pth));
18
+ }
19
+ const all = await Promise.all(proms);
20
+ expect(all.length).toEqual(5);
21
+ });
22
+ });
@@ -1,8 +1,11 @@
1
1
  import { CopyObjectCommand, GetObjectCommand, ListObjectsV2Command, } from '@aws-sdk/client-s3';
2
2
  import _ from 'lodash';
3
- import { Logger, PromiseRatchet, RequireRatchet } from '@bitblit/ratchet-common';
3
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
4
+ import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
5
+ import { PromiseRatchet } from '@bitblit/ratchet-common/lib/lang/promise-ratchet.js';
4
6
  import { Upload } from '@aws-sdk/lib-storage';
5
7
  export class S3LocationSyncRatchet {
8
+ config;
6
9
  constructor(config) {
7
10
  RequireRatchet.notNullOrUndefined(config, 'config');
8
11
  this.config = config;
@@ -1,4 +1,4 @@
1
- import { RequireRatchet } from '@bitblit/ratchet-common';
1
+ import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
2
2
  export class S3Ratchet {
3
3
  static checkS3UrlForValidity(value) {
4
4
  let rval = false;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { S3Client } from '@aws-sdk/client-s3';
2
+ import { S3Ratchet } from './s3-ratchet.js';
3
+ import { mockClient } from 'aws-sdk-client-mock';
4
+ let mockS3;
5
+ describe('#S3Ratchet', function () {
6
+ mockS3 = mockClient(S3Client);
7
+ beforeEach(() => {
8
+ mockS3.reset();
9
+ });
10
+ it('should checkS3UrlForValidity', async () => {
11
+ expect(S3Ratchet.checkS3UrlForValidity('s3://test/out/b.txt')).toBeTruthy();
12
+ expect(S3Ratchet.checkS3UrlForValidity('http://test/out/b.txt')).toBeFalsy();
13
+ });
14
+ it('should extractBucketFromURL', async () => {
15
+ expect(S3Ratchet.extractBucketFromURL('s3://test/out/b.txt')).toEqual('test');
16
+ });
17
+ it('should extractKeyFromURL', async () => {
18
+ expect(S3Ratchet.extractKeyFromURL('s3://test/out/b.txt')).toEqual('out/b.txt');
19
+ });
20
+ });
@@ -0,0 +1,5 @@
1
+ export interface EmailAttachment {
2
+ filename?: string;
3
+ contentType?: string;
4
+ base64Data?: string;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,5 @@
1
- import { RatchetTemplateRenderer } from './ratchet-template-renderer';
2
- import { S3CacheRatchet } from '../s3/s3-cache-ratchet';
3
- /**
4
- * Configuration options for generic mailer
5
- */
1
+ import { RatchetTemplateRenderer } from './ratchet-template-renderer.js';
2
+ import { S3CacheRatchet } from '../s3/s3-cache-ratchet.js';
6
3
  export interface MailerConfig {
7
4
  defaultSendingAddress?: string;
8
5
  autoBccAddresses?: string[];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,6 @@
1
- import { ReadyToSendEmail } from './ready-to-send-email';
1
+ import { ReadyToSendEmail } from './ready-to-send-email.js';
2
2
  import { SendRawEmailResponse } from '@aws-sdk/client-ses';
3
- import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email';
4
- /**
5
- * Generic Mail Sender for AWS.
6
- *
7
- * Params:
8
- * ses: AWS SES handler, properly configured
9
- * defaultSendingAddress:
10
- */
3
+ import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email.js';
11
4
  export interface MailerLike {
12
5
  fillEmailBody(rts: ReadyToSendEmail, context: any, htmlTemplateName: string, txtTemplateName?: string, layoutName?: string, partialNames?: string[]): Promise<ReadyToSendEmail>;
13
6
  fillEmailBodyAndSend(rts: ReadyToSendEmail, context: any, htmlTemplateName: string, txtTemplateName?: string, layoutName?: string, partialNames?: string[]): Promise<SendRawEmailResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,15 +1,8 @@
1
- import { ReadyToSendEmail } from './ready-to-send-email';
1
+ import { ReadyToSendEmail } from './ready-to-send-email.js';
2
2
  import { SendRawEmailCommandOutput, SendRawEmailResponse, SESClient } from '@aws-sdk/client-ses';
3
- import { MailerConfig } from './mailer-config';
4
- import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email';
5
- import { MailerLike } from './mailer-like';
6
- /**
7
- * Generic Mail Sender for AWS.
8
- *
9
- * Params:
10
- * ses: AWS SES handler, properly configured
11
- * defaultSendingAddress:
12
- */
3
+ import { MailerConfig } from './mailer-config.js';
4
+ import { ResolvedReadyToSendEmail } from './resolved-ready-to-send-email.js';
5
+ import { MailerLike } from './mailer-like.js';
13
6
  export declare class Mailer implements MailerLike {
14
7
  private ses;
15
8
  private config;
@@ -1,11 +1,14 @@
1
- import { Logger } from '@bitblit/ratchet-common';
1
+ import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
2
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
3
+ import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
4
+ import { Base64Ratchet } from '@bitblit/ratchet-common/lib/lang/base64-ratchet.js';
5
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
2
6
  import { SendRawEmailCommand } from '@aws-sdk/client-ses';
3
- import { StringRatchet } from '@bitblit/ratchet-common';
4
- import { ErrorRatchet } from '@bitblit/ratchet-common';
5
7
  import { DateTime } from 'luxon';
6
- import { Base64Ratchet } from '@bitblit/ratchet-common';
7
- import { RequireRatchet } from '@bitblit/ratchet-common';
8
8
  export class Mailer {
9
+ ses;
10
+ config;
11
+ static EMAIL = new RegExp('.+@.+\\.[a-z]+');
9
12
  constructor(ses, config = {}) {
10
13
  this.ses = ses;
11
14
  this.config = config;
@@ -201,4 +204,3 @@ export class Mailer {
201
204
  return email !== null && Mailer.EMAIL.test(email);
202
205
  }
203
206
  }
204
- Mailer.EMAIL = new RegExp('.+@.+\\.[a-z]+');
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,104 @@
1
+ import { SendRawEmailCommand, SESClient } from '@aws-sdk/client-ses';
2
+ import { Mailer } from './mailer.js';
3
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
4
+ import { Base64Ratchet } from '@bitblit/ratchet-common/lib/lang/base64-ratchet.js';
5
+ import { mockClient } from 'aws-sdk-client-mock';
6
+ let mockSES;
7
+ const smallImageBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
8
+ describe('#mailer', function () {
9
+ mockSES = mockClient(SESClient);
10
+ beforeEach(() => {
11
+ mockSES.reset();
12
+ });
13
+ it('should send email', async () => {
14
+ const config = {
15
+ defaultSendingAddress: 'test1@test.com',
16
+ autoBccAddresses: [],
17
+ archive: null,
18
+ archivePrefix: null,
19
+ };
20
+ const svc = new Mailer(mockSES, config);
21
+ const attach1 = {
22
+ filename: 'test.txt',
23
+ contentType: 'text/plain',
24
+ base64Data: Base64Ratchet.generateBase64VersionOfString('This is a test2'),
25
+ };
26
+ const attach2 = {
27
+ filename: 'a2.png',
28
+ contentType: 'image/png',
29
+ base64Data: smallImageBase64,
30
+ };
31
+ const rts = {
32
+ txtMessage: 'test txt',
33
+ htmlMessage: '<h1>Test html</h1><p>Test paragraph</p>',
34
+ subject: 'Test subject',
35
+ fromAddress: 'test@test.com',
36
+ destinationAddresses: ['testout@test.com'],
37
+ attachments: [attach1, attach2],
38
+ };
39
+ mockSES.on(SendRawEmailCommand).resolves({});
40
+ const result = await svc.sendEmail(rts);
41
+ expect(result).toBeTruthy();
42
+ });
43
+ it('should allow for unicode in email subject', async () => {
44
+ const config = {
45
+ defaultSendingAddress: 'jflint@adomni.com',
46
+ autoBccAddresses: [],
47
+ archive: null,
48
+ archivePrefix: null,
49
+ };
50
+ const svc = new Mailer(mockSES, config);
51
+ const rts = {
52
+ txtMessage: 'test txt',
53
+ htmlMessage: '<h1>Test html</h1><p>Test paragraph</p>',
54
+ subject: "Rappel: Votre panneau d'affichage Shout est diffusé aujourd'hui!",
55
+ fromAddress: 'jflint@adomni.com',
56
+ destinationAddresses: ['jflint@adomni.com'],
57
+ };
58
+ mockSES.on(SendRawEmailCommand).resolves({});
59
+ const result = await svc.sendEmail(rts);
60
+ expect(result).toBeTruthy();
61
+ });
62
+ it('should filter outbound', async () => {
63
+ const config = {
64
+ allowedDestinationEmails: [/.*test\.com/, /.*.test2\.com/],
65
+ };
66
+ const svc = new Mailer({}, config);
67
+ const out1 = ['a@test.com', 'b@fail.com'];
68
+ const res1 = svc.filterEmailsToValid(out1);
69
+ expect(res1).toBeTruthy();
70
+ expect(res1.length).toEqual(1);
71
+ const out2 = ['a@fail.com', 'b@fail.com'];
72
+ const res2 = svc.filterEmailsToValid(out2);
73
+ expect(res2).toBeTruthy();
74
+ expect(res2.length).toEqual(0);
75
+ });
76
+ it('should fix a huge text/html body', async () => {
77
+ const config = {
78
+ defaultSendingAddress: 'test@test.com',
79
+ autoBccAddresses: [],
80
+ archive: null,
81
+ archivePrefix: null,
82
+ maxMessageBodySizeInBytes: 500,
83
+ maxAttachmentSizeInBase64Bytes: 1000,
84
+ };
85
+ const svc = new Mailer(mockSES, config);
86
+ const bigBody = StringRatchet.createRandomHexString(300);
87
+ const bigAttach = {
88
+ filename: 'test.txt',
89
+ contentType: 'text/plain',
90
+ base64Data: Base64Ratchet.generateBase64VersionOfString(StringRatchet.createRandomHexString(2000)),
91
+ };
92
+ const rts = {
93
+ txtMessage: bigBody,
94
+ htmlMessage: bigBody,
95
+ subject: 'Test big message',
96
+ fromAddress: 'test@test.com',
97
+ destinationAddresses: ['test@test.com'],
98
+ attachments: [bigAttach],
99
+ };
100
+ mockSES.on(SendRawEmailCommand).resolves({});
101
+ const result = await svc.sendEmail(rts);
102
+ expect(result).toBeTruthy();
103
+ });
104
+ });
@@ -1,7 +1,3 @@
1
- /**
2
- * tbd
3
- * @interface RatchetTemplateRenderer
4
- */
5
1
  export interface RatchetTemplateRenderer {
6
2
  renderTemplate(templateName: string, context: any, layoutName?: string, partialNames?: string[]): Promise<string>;
7
3
  renderTemplateDirect(templateValue: string, context: any, layoutName?: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import { EmailAttachment } from './email-attachment.js';
2
+ export interface ReadyToSendEmail {
3
+ destinationAddresses?: Array<string>;
4
+ bccAddresses?: Array<string>;
5
+ attachments?: Array<EmailAttachment>;
6
+ fromAddress?: string;
7
+ txtMessage?: string;
8
+ htmlMessage?: string;
9
+ subject?: string;
10
+ fromName?: string;
11
+ doNotAutoBcc?: boolean;
12
+ doNotArchive?: boolean;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,4 @@
1
- import { RatchetTemplateRenderer } from './ratchet-template-renderer';
2
- /**
3
- */
1
+ import { RatchetTemplateRenderer } from './ratchet-template-renderer.js';
4
2
  export declare class RemoteHandlebarsTemplateRenderer implements RatchetTemplateRenderer {
5
3
  private prefix;
6
4
  private suffix;
@@ -1,9 +1,13 @@
1
1
  import handlebars from 'handlebars';
2
2
  import fetch from 'cross-fetch';
3
- import { StringRatchet } from '@bitblit/ratchet-common';
4
- import { Logger } from '@bitblit/ratchet-common';
3
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
4
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
5
5
  import layouts from 'handlebars-layouts';
6
6
  export class RemoteHandlebarsTemplateRenderer {
7
+ prefix;
8
+ suffix;
9
+ maxCacheTemplates;
10
+ cache;
7
11
  constructor(prefix = '', suffix = '', maxCacheTemplates = 10) {
8
12
  this.prefix = prefix;
9
13
  this.suffix = suffix;
@@ -0,0 +1,5 @@
1
+ import { ReadyToSendEmail } from './ready-to-send-email.js';
2
+ export interface ResolvedReadyToSendEmail extends ReadyToSendEmail {
3
+ srcDestinationAddresses?: string[];
4
+ srcBccAddresses?: string[];
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,9 @@
1
- import { Logger } from '@bitblit/ratchet-common';
1
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
2
+ import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
2
3
  import { PublishCommand, SNSClient } from '@aws-sdk/client-sns';
3
- import { RequireRatchet } from '@bitblit/ratchet-common';
4
4
  export class SnsRatchet {
5
+ sns;
6
+ topicArn;
5
7
  constructor(sns = new SNSClient({ region: 'us-east-1' }), topicArn) {
6
8
  this.sns = sns;
7
9
  this.topicArn = topicArn;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { PublishCommand, SNSClient } from '@aws-sdk/client-sns';
2
+ import { SnsRatchet } from './sns-ratchet.js';
3
+ import { mockClient } from 'aws-sdk-client-mock';
4
+ let mockSNS;
5
+ describe('#SNSRatchet', function () {
6
+ mockSNS = mockClient(SNSClient);
7
+ beforeEach(() => {
8
+ mockSNS.reset();
9
+ });
10
+ it('should send a message', async () => {
11
+ mockSNS.on(PublishCommand).resolves({});
12
+ const topicArn = 'TOPIC-ARN-HERE';
13
+ const ratchet = new SnsRatchet(mockSNS, topicArn);
14
+ const out = await ratchet.sendMessage('test \n\n' + new Date() + '\n\n---\n\nTest CR');
15
+ expect(out).toBeTruthy();
16
+ });
17
+ });
@@ -1,5 +1,5 @@
1
- import { DynamoRatchet } from '../dynamodb/dynamo-ratchet';
2
- import { SyncLockProvider } from './sync-lock-provider';
1
+ import { DynamoRatchet } from '../dynamodb/dynamo-ratchet.js';
2
+ import { SyncLockProvider } from './sync-lock-provider.js';
3
3
  export declare class DynamoDbSyncLock implements SyncLockProvider {
4
4
  private ratchet;
5
5
  private tableName;
@@ -1,6 +1,10 @@
1
- import { Logger, RequireRatchet, StringRatchet } from '@bitblit/ratchet-common';
1
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
2
+ import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
3
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
2
4
  import { PutItemCommand } from '@aws-sdk/client-dynamodb';
3
5
  export class DynamoDbSyncLock {
6
+ ratchet;
7
+ tableName;
4
8
  constructor(ratchet, tableName) {
5
9
  this.ratchet = ratchet;
6
10
  this.tableName = tableName;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import { DynamoDbSyncLock } from './dynamo-db-sync-lock.js';
2
+ import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
3
+ import { JestRatchet } from '@bitblit/ratchet-jest/lib/jest/jest-ratchet.js';
4
+ import { jest } from '@jest/globals';
5
+ let mockDR;
6
+ describe('#syncLockService', () => {
7
+ beforeEach(() => {
8
+ mockDR = JestRatchet.mock(jest.fn);
9
+ });
10
+ xit('should test sync locks', async () => {
11
+ const svc = new DynamoDbSyncLock(mockDR, 'test-table');
12
+ const lockTestValue = 'SYNC_LOCK_TEST';
13
+ const aq1 = await svc.acquireLock(lockTestValue);
14
+ expect(aq1).toBe(true);
15
+ const aq2 = await svc.acquireLock(lockTestValue);
16
+ expect(aq2).toBe(false);
17
+ await svc.releaseLock(lockTestValue);
18
+ const aq3 = await svc.acquireLock(lockTestValue);
19
+ expect(aq3).toBe(true);
20
+ await svc.releaseLock(lockTestValue);
21
+ });
22
+ it('should clear expired sync locks', async () => {
23
+ mockDR.fullyExecuteScan.mockResolvedValue([{ lockingKey: 'aa' }, { lockingKey: 'ab' }]);
24
+ mockDR.deleteAllInBatches.mockResolvedValue(2);
25
+ const svc = new DynamoDbSyncLock(mockDR, 'test-table');
26
+ const res = await svc.clearExpiredSyncLocks();
27
+ Logger.info('Got : %s', res);
28
+ expect(res).toEqual(2);
29
+ });
30
+ });
@@ -1,7 +1,4 @@
1
- import { SyncLockProvider } from './sync-lock-provider';
2
- /**
3
- * Simple in-memory implementation of the SyncLockProvider interface
4
- */
1
+ import { SyncLockProvider } from './sync-lock-provider.js';
5
2
  export declare class MemorySyncLock implements SyncLockProvider {
6
3
  private _locks;
7
4
  constructor();
@@ -1,8 +1,7 @@
1
- import { StringRatchet } from '@bitblit/ratchet-common';
1
+ import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
2
2
  export class MemorySyncLock {
3
- constructor() {
4
- this._locks = new Map();
5
- }
3
+ _locks = new Map();
4
+ constructor() { }
6
5
  async acquireLock(lockKey, expirationSeconds = 30) {
7
6
  let rval = false;
8
7
  if (StringRatchet.trimToNull(lockKey)) {
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@bitblit/ratchet-aws",
3
- "version": "4.0.99-alpha",
3
+ "version": "4.0.103-alpha",
4
4
  "description": "Common tools for use with AWS browser and node",
5
5
  "sideEffects": false,
6
- "main": "./dist/cjs/index.js",
7
- "module": "./dist/esm/index.js",
8
- "types": "./dist/types/index.d.ts",
6
+ "type": "module",
7
+ "module": "index.js",
9
8
  "files": [
10
- "dist/*"
9
+ "lib/*",
10
+ "bin/*"
11
11
  ],
12
12
  "contributors": [
13
13
  "Christopher Weiss <bitblit@gmail.com>",
@@ -30,16 +30,15 @@
30
30
  "config": {},
31
31
  "scripts": {
32
32
  "watch": "tsc-watch",
33
- "clean": "shx rm -Rf dist",
34
- "test": "jest",
33
+ "clean": "shx rm -Rf lib",
34
+ "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
35
35
  "docs": "typedoc",
36
36
  "lint": "eslint src/**/*.ts",
37
37
  "lint-fix": "eslint --fix src/**/*.ts",
38
- "generate-barrels": "barrelsby -q --delete -d src -e .*\\.spec\\.ts",
39
- "build": "yarn run generate-barrels && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
40
- "build:cjs": "tsc -p tsconfig.cjs.json",
41
- "build:es": "tsc -p tsconfig.es.json",
42
- "build:types": "tsc -p tsconfig.types.json"
38
+ "__generate-barrels": "barrelsby -q --delete -d src -e .*\\.spec\\.ts",
39
+ "__build": "yarn run generate-barrels && tsc",
40
+ "build": "tsc",
41
+ "force-build": "tsc --build --force"
43
42
  },
44
43
  "repository": {
45
44
  "type": "git",