@takumi-stack/core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/common/coordinator.d.ts +28 -0
  2. package/common/coordinator.d.ts.map +1 -0
  3. package/common/coordinator.js +94 -0
  4. package/common/coordinator.js.map +1 -0
  5. package/common/index.d.ts +6 -0
  6. package/common/index.d.ts.map +1 -0
  7. package/common/index.js +22 -0
  8. package/common/index.js.map +1 -0
  9. package/common/modifier.d.ts +5 -0
  10. package/common/modifier.d.ts.map +1 -0
  11. package/common/modifier.js +12 -0
  12. package/common/modifier.js.map +1 -0
  13. package/common/naming/get-deploy-config.d.ts +9 -0
  14. package/common/naming/get-deploy-config.d.ts.map +1 -0
  15. package/common/naming/get-deploy-config.js +8 -0
  16. package/common/naming/get-deploy-config.js.map +1 -0
  17. package/common/naming/get-domain.d.ts +9 -0
  18. package/common/naming/get-domain.d.ts.map +1 -0
  19. package/common/naming/get-domain.js +13 -0
  20. package/common/naming/get-domain.js.map +1 -0
  21. package/common/naming/get-function-entry.d.ts +4 -0
  22. package/common/naming/get-function-entry.d.ts.map +1 -0
  23. package/common/naming/get-function-entry.js +14 -0
  24. package/common/naming/get-function-entry.js.map +1 -0
  25. package/common/naming/get-logical-name.d.ts +2 -0
  26. package/common/naming/get-logical-name.d.ts.map +1 -0
  27. package/common/naming/get-logical-name.js +8 -0
  28. package/common/naming/get-logical-name.js.map +1 -0
  29. package/common/naming/get-resource-name.d.ts +47 -0
  30. package/common/naming/get-resource-name.d.ts.map +1 -0
  31. package/common/naming/get-resource-name.js +38 -0
  32. package/common/naming/get-resource-name.js.map +1 -0
  33. package/common/naming/get-service-name.d.ts +10 -0
  34. package/common/naming/get-service-name.d.ts.map +1 -0
  35. package/common/naming/get-service-name.js +10 -0
  36. package/common/naming/get-service-name.js.map +1 -0
  37. package/common/naming/index.d.ts +8 -0
  38. package/common/naming/index.d.ts.map +1 -0
  39. package/common/naming/index.js +24 -0
  40. package/common/naming/index.js.map +1 -0
  41. package/common/naming/string-parser.d.ts +4 -0
  42. package/common/naming/string-parser.d.ts.map +1 -0
  43. package/common/naming/string-parser.js +22 -0
  44. package/common/naming/string-parser.js.map +1 -0
  45. package/common/service.d.ts +29 -0
  46. package/common/service.d.ts.map +1 -0
  47. package/common/service.js +28 -0
  48. package/common/service.js.map +1 -0
  49. package/common/synth/account-mapping.d.ts +2 -0
  50. package/common/synth/account-mapping.d.ts.map +1 -0
  51. package/common/synth/account-mapping.js +18 -0
  52. package/common/synth/account-mapping.js.map +1 -0
  53. package/common/synth/assume-role.d.ts +18 -0
  54. package/common/synth/assume-role.d.ts.map +1 -0
  55. package/common/synth/assume-role.js +25 -0
  56. package/common/synth/assume-role.js.map +1 -0
  57. package/common/synth/get-global-props.d.ts +16 -0
  58. package/common/synth/get-global-props.d.ts.map +1 -0
  59. package/common/synth/get-global-props.js +34 -0
  60. package/common/synth/get-global-props.js.map +1 -0
  61. package/common/synth/get-service-props.d.ts +11 -0
  62. package/common/synth/get-service-props.d.ts.map +1 -0
  63. package/common/synth/get-service-props.js +12 -0
  64. package/common/synth/get-service-props.js.map +1 -0
  65. package/common/synth/index.d.ts +8 -0
  66. package/common/synth/index.d.ts.map +1 -0
  67. package/common/synth/index.js +24 -0
  68. package/common/synth/index.js.map +1 -0
  69. package/common/synth/pre-script.d.ts +32 -0
  70. package/common/synth/pre-script.d.ts.map +1 -0
  71. package/common/synth/pre-script.js +74 -0
  72. package/common/synth/pre-script.js.map +1 -0
  73. package/common/synth/props-types.d.ts +60 -0
  74. package/common/synth/props-types.d.ts.map +1 -0
  75. package/common/synth/props-types.js +3 -0
  76. package/common/synth/props-types.js.map +1 -0
  77. package/common/synth/synth-error.d.ts +8 -0
  78. package/common/synth/synth-error.d.ts.map +1 -0
  79. package/common/synth/synth-error.js +17 -0
  80. package/common/synth/synth-error.js.map +1 -0
  81. package/index.d.ts +4 -0
  82. package/index.d.ts.map +1 -0
  83. package/index.js +20 -0
  84. package/index.js.map +1 -0
  85. package/package.json +43 -0
  86. package/prefab/analytics/events/handlers/ingestion-transform/handler.d.ts +4 -0
  87. package/prefab/analytics/events/handlers/ingestion-transform/handler.d.ts.map +1 -0
  88. package/prefab/analytics/events/handlers/ingestion-transform/handler.js +34 -0
  89. package/prefab/analytics/events/handlers/ingestion-transform/handler.js.map +1 -0
  90. package/prefab/analytics/events/index.d.ts +31 -0
  91. package/prefab/analytics/events/index.d.ts.map +1 -0
  92. package/prefab/analytics/events/index.js +163 -0
  93. package/prefab/analytics/events/index.js.map +1 -0
  94. package/prefab/analytics/index.d.ts +2 -0
  95. package/prefab/analytics/index.d.ts.map +1 -0
  96. package/prefab/analytics/index.js +18 -0
  97. package/prefab/analytics/index.js.map +1 -0
  98. package/prefab/auth/cognito-pool/index.d.ts +65 -0
  99. package/prefab/auth/cognito-pool/index.d.ts.map +1 -0
  100. package/prefab/auth/cognito-pool/index.js +240 -0
  101. package/prefab/auth/cognito-pool/index.js.map +1 -0
  102. package/prefab/auth/index.d.ts +2 -0
  103. package/prefab/auth/index.d.ts.map +1 -0
  104. package/prefab/auth/index.js +18 -0
  105. package/prefab/auth/index.js.map +1 -0
  106. package/prefab/cdn/cdn-api/index.d.ts +38 -0
  107. package/prefab/cdn/cdn-api/index.d.ts.map +1 -0
  108. package/prefab/cdn/cdn-api/index.js +153 -0
  109. package/prefab/cdn/cdn-api/index.js.map +1 -0
  110. package/prefab/cdn/cdn-asset/index.d.ts +27 -0
  111. package/prefab/cdn/cdn-asset/index.d.ts.map +1 -0
  112. package/prefab/cdn/cdn-asset/index.js +96 -0
  113. package/prefab/cdn/cdn-asset/index.js.map +1 -0
  114. package/prefab/cdn/cdn-spa/index.d.ts +27 -0
  115. package/prefab/cdn/cdn-spa/index.d.ts.map +1 -0
  116. package/prefab/cdn/cdn-spa/index.js +138 -0
  117. package/prefab/cdn/cdn-spa/index.js.map +1 -0
  118. package/prefab/cdn/cdn-ssr/index.d.ts +36 -0
  119. package/prefab/cdn/cdn-ssr/index.d.ts.map +1 -0
  120. package/prefab/cdn/cdn-ssr/index.js +271 -0
  121. package/prefab/cdn/cdn-ssr/index.js.map +1 -0
  122. package/prefab/cdn/index.d.ts +5 -0
  123. package/prefab/cdn/index.d.ts.map +1 -0
  124. package/prefab/cdn/index.js +21 -0
  125. package/prefab/cdn/index.js.map +1 -0
  126. package/prefab/compute/fargate/cluster.d.ts +16 -0
  127. package/prefab/compute/fargate/cluster.d.ts.map +1 -0
  128. package/prefab/compute/fargate/cluster.js +42 -0
  129. package/prefab/compute/fargate/cluster.js.map +1 -0
  130. package/prefab/compute/fargate/index.d.ts +3 -0
  131. package/prefab/compute/fargate/index.d.ts.map +1 -0
  132. package/prefab/compute/fargate/index.js +19 -0
  133. package/prefab/compute/fargate/index.js.map +1 -0
  134. package/prefab/compute/fargate/service.d.ts +49 -0
  135. package/prefab/compute/fargate/service.d.ts.map +1 -0
  136. package/prefab/compute/fargate/service.js +109 -0
  137. package/prefab/compute/fargate/service.js.map +1 -0
  138. package/prefab/compute/function/api-function/api-aggregate.d.ts +32 -0
  139. package/prefab/compute/function/api-function/api-aggregate.d.ts.map +1 -0
  140. package/prefab/compute/function/api-function/api-aggregate.js +54 -0
  141. package/prefab/compute/function/api-function/api-aggregate.js.map +1 -0
  142. package/prefab/compute/function/api-function/api-function.d.ts +22 -0
  143. package/prefab/compute/function/api-function/api-function.d.ts.map +1 -0
  144. package/prefab/compute/function/api-function/api-function.js +45 -0
  145. package/prefab/compute/function/api-function/api-function.js.map +1 -0
  146. package/prefab/compute/function/api-function/index.d.ts +3 -0
  147. package/prefab/compute/function/api-function/index.d.ts.map +1 -0
  148. package/prefab/compute/function/api-function/index.js +19 -0
  149. package/prefab/compute/function/api-function/index.js.map +1 -0
  150. package/prefab/compute/function/base-function/index.d.ts +33 -0
  151. package/prefab/compute/function/base-function/index.d.ts.map +1 -0
  152. package/prefab/compute/function/base-function/index.js +70 -0
  153. package/prefab/compute/function/base-function/index.js.map +1 -0
  154. package/prefab/compute/function/cognito-function/cognito-aggregate.d.ts +18 -0
  155. package/prefab/compute/function/cognito-function/cognito-aggregate.d.ts.map +1 -0
  156. package/prefab/compute/function/cognito-function/cognito-aggregate.js +22 -0
  157. package/prefab/compute/function/cognito-function/cognito-aggregate.js.map +1 -0
  158. package/prefab/compute/function/cognito-function/cognito-function.d.ts +19 -0
  159. package/prefab/compute/function/cognito-function/cognito-function.d.ts.map +1 -0
  160. package/prefab/compute/function/cognito-function/cognito-function.js +24 -0
  161. package/prefab/compute/function/cognito-function/cognito-function.js.map +1 -0
  162. package/prefab/compute/function/cognito-function/index.d.ts +3 -0
  163. package/prefab/compute/function/cognito-function/index.d.ts.map +1 -0
  164. package/prefab/compute/function/cognito-function/index.js +19 -0
  165. package/prefab/compute/function/cognito-function/index.js.map +1 -0
  166. package/prefab/compute/function/cron-function/cron-aggregate.d.ts +17 -0
  167. package/prefab/compute/function/cron-function/cron-aggregate.d.ts.map +1 -0
  168. package/prefab/compute/function/cron-function/cron-aggregate.js +22 -0
  169. package/prefab/compute/function/cron-function/cron-aggregate.js.map +1 -0
  170. package/prefab/compute/function/cron-function/cron-function.d.ts +17 -0
  171. package/prefab/compute/function/cron-function/cron-function.d.ts.map +1 -0
  172. package/prefab/compute/function/cron-function/cron-function.js +24 -0
  173. package/prefab/compute/function/cron-function/cron-function.js.map +1 -0
  174. package/prefab/compute/function/cron-function/index.d.ts +3 -0
  175. package/prefab/compute/function/cron-function/index.d.ts.map +1 -0
  176. package/prefab/compute/function/cron-function/index.js +19 -0
  177. package/prefab/compute/function/cron-function/index.js.map +1 -0
  178. package/prefab/compute/function/event-function/event-aggregate.d.ts +20 -0
  179. package/prefab/compute/function/event-function/event-aggregate.d.ts.map +1 -0
  180. package/prefab/compute/function/event-function/event-aggregate.js +25 -0
  181. package/prefab/compute/function/event-function/event-aggregate.js.map +1 -0
  182. package/prefab/compute/function/event-function/event-function.d.ts +14 -0
  183. package/prefab/compute/function/event-function/event-function.d.ts.map +1 -0
  184. package/prefab/compute/function/event-function/event-function.js +33 -0
  185. package/prefab/compute/function/event-function/event-function.js.map +1 -0
  186. package/prefab/compute/function/event-function/index.d.ts +3 -0
  187. package/prefab/compute/function/event-function/index.d.ts.map +1 -0
  188. package/prefab/compute/function/event-function/index.js +19 -0
  189. package/prefab/compute/function/event-function/index.js.map +1 -0
  190. package/prefab/compute/function/index.d.ts +8 -0
  191. package/prefab/compute/function/index.d.ts.map +1 -0
  192. package/prefab/compute/function/index.js +24 -0
  193. package/prefab/compute/function/index.js.map +1 -0
  194. package/prefab/compute/function/queue-function/index.d.ts +25 -0
  195. package/prefab/compute/function/queue-function/index.d.ts.map +1 -0
  196. package/prefab/compute/function/queue-function/index.js +46 -0
  197. package/prefab/compute/function/queue-function/index.js.map +1 -0
  198. package/prefab/compute/function/topic-function/index.d.ts +23 -0
  199. package/prefab/compute/function/topic-function/index.d.ts.map +1 -0
  200. package/prefab/compute/function/topic-function/index.js +23 -0
  201. package/prefab/compute/function/topic-function/index.js.map +1 -0
  202. package/prefab/compute/index.d.ts +3 -0
  203. package/prefab/compute/index.d.ts.map +1 -0
  204. package/prefab/compute/index.js +19 -0
  205. package/prefab/compute/index.js.map +1 -0
  206. package/prefab/database/dynamo/index.d.ts +14 -0
  207. package/prefab/database/dynamo/index.d.ts.map +1 -0
  208. package/prefab/database/dynamo/index.js +106 -0
  209. package/prefab/database/dynamo/index.js.map +1 -0
  210. package/prefab/database/index.d.ts +4 -0
  211. package/prefab/database/index.d.ts.map +1 -0
  212. package/prefab/database/index.js +20 -0
  213. package/prefab/database/index.js.map +1 -0
  214. package/prefab/database/rds/handlers/start-cluster/handler.d.ts +2 -0
  215. package/prefab/database/rds/handlers/start-cluster/handler.d.ts.map +1 -0
  216. package/prefab/database/rds/handlers/start-cluster/handler.js +10 -0
  217. package/prefab/database/rds/handlers/start-cluster/handler.js.map +1 -0
  218. package/prefab/database/rds/handlers/stop-cluster/handler.d.ts +2 -0
  219. package/prefab/database/rds/handlers/stop-cluster/handler.d.ts.map +1 -0
  220. package/prefab/database/rds/handlers/stop-cluster/handler.js +10 -0
  221. package/prefab/database/rds/handlers/stop-cluster/handler.js.map +1 -0
  222. package/prefab/database/rds/index.d.ts +54 -0
  223. package/prefab/database/rds/index.d.ts.map +1 -0
  224. package/prefab/database/rds/index.js +223 -0
  225. package/prefab/database/rds/index.js.map +1 -0
  226. package/prefab/database/timestream/index.d.ts +3 -0
  227. package/prefab/database/timestream/index.d.ts.map +1 -0
  228. package/prefab/database/timestream/index.js +19 -0
  229. package/prefab/database/timestream/index.js.map +1 -0
  230. package/prefab/database/timestream/timestream-database.d.ts +13 -0
  231. package/prefab/database/timestream/timestream-database.d.ts.map +1 -0
  232. package/prefab/database/timestream/timestream-database.js +21 -0
  233. package/prefab/database/timestream/timestream-database.js.map +1 -0
  234. package/prefab/database/timestream/timestream-table.d.ts +23 -0
  235. package/prefab/database/timestream/timestream-table.d.ts.map +1 -0
  236. package/prefab/database/timestream/timestream-table.js +62 -0
  237. package/prefab/database/timestream/timestream-table.js.map +1 -0
  238. package/prefab/gateway/alb-public/index.d.ts +44 -0
  239. package/prefab/gateway/alb-public/index.d.ts.map +1 -0
  240. package/prefab/gateway/alb-public/index.js +116 -0
  241. package/prefab/gateway/alb-public/index.js.map +1 -0
  242. package/prefab/gateway/api-gateway/api-http.d.ts +27 -0
  243. package/prefab/gateway/api-gateway/api-http.d.ts.map +1 -0
  244. package/prefab/gateway/api-gateway/api-http.js +48 -0
  245. package/prefab/gateway/api-gateway/api-http.js.map +1 -0
  246. package/prefab/gateway/api-gateway/api-rest.d.ts +26 -0
  247. package/prefab/gateway/api-gateway/api-rest.d.ts.map +1 -0
  248. package/prefab/gateway/api-gateway/api-rest.js +90 -0
  249. package/prefab/gateway/api-gateway/api-rest.js.map +1 -0
  250. package/prefab/gateway/api-gateway/index.d.ts +3 -0
  251. package/prefab/gateway/api-gateway/index.d.ts.map +1 -0
  252. package/prefab/gateway/api-gateway/index.js +19 -0
  253. package/prefab/gateway/api-gateway/index.js.map +1 -0
  254. package/prefab/gateway/app-sync/index.d.ts +36 -0
  255. package/prefab/gateway/app-sync/index.d.ts.map +1 -0
  256. package/prefab/gateway/app-sync/index.js +114 -0
  257. package/prefab/gateway/app-sync/index.js.map +1 -0
  258. package/prefab/gateway/app-sync/resolver-aggregate.d.ts +33 -0
  259. package/prefab/gateway/app-sync/resolver-aggregate.d.ts.map +1 -0
  260. package/prefab/gateway/app-sync/resolver-aggregate.js +125 -0
  261. package/prefab/gateway/app-sync/resolver-aggregate.js.map +1 -0
  262. package/prefab/gateway/app-sync/types.d.ts +29 -0
  263. package/prefab/gateway/app-sync/types.d.ts.map +1 -0
  264. package/prefab/gateway/app-sync/types.js +3 -0
  265. package/prefab/gateway/app-sync/types.js.map +1 -0
  266. package/prefab/gateway/index.d.ts +4 -0
  267. package/prefab/gateway/index.d.ts.map +1 -0
  268. package/prefab/gateway/index.js +20 -0
  269. package/prefab/gateway/index.js.map +1 -0
  270. package/prefab/index.d.ts +11 -0
  271. package/prefab/index.d.ts.map +1 -0
  272. package/prefab/index.js +27 -0
  273. package/prefab/index.js.map +1 -0
  274. package/prefab/integration/event-bus/index.d.ts +20 -0
  275. package/prefab/integration/event-bus/index.d.ts.map +1 -0
  276. package/prefab/integration/event-bus/index.js +46 -0
  277. package/prefab/integration/event-bus/index.js.map +1 -0
  278. package/prefab/integration/index.d.ts +4 -0
  279. package/prefab/integration/index.d.ts.map +1 -0
  280. package/prefab/integration/index.js +20 -0
  281. package/prefab/integration/index.js.map +1 -0
  282. package/prefab/integration/queue/index.d.ts +29 -0
  283. package/prefab/integration/queue/index.d.ts.map +1 -0
  284. package/prefab/integration/queue/index.js +70 -0
  285. package/prefab/integration/queue/index.js.map +1 -0
  286. package/prefab/integration/topic/index.d.ts +21 -0
  287. package/prefab/integration/topic/index.d.ts.map +1 -0
  288. package/prefab/integration/topic/index.js +48 -0
  289. package/prefab/integration/topic/index.js.map +1 -0
  290. package/prefab/networking/dns-domain-ref/index.d.ts +16 -0
  291. package/prefab/networking/dns-domain-ref/index.d.ts.map +1 -0
  292. package/prefab/networking/dns-domain-ref/index.js +28 -0
  293. package/prefab/networking/dns-domain-ref/index.js.map +1 -0
  294. package/prefab/networking/dns-subdomain-certificate/index.d.ts +13 -0
  295. package/prefab/networking/dns-subdomain-certificate/index.d.ts.map +1 -0
  296. package/prefab/networking/dns-subdomain-certificate/index.js +28 -0
  297. package/prefab/networking/dns-subdomain-certificate/index.js.map +1 -0
  298. package/prefab/networking/dns-subdomain-hosted-zone/index.d.ts +12 -0
  299. package/prefab/networking/dns-subdomain-hosted-zone/index.d.ts.map +1 -0
  300. package/prefab/networking/dns-subdomain-hosted-zone/index.js +27 -0
  301. package/prefab/networking/dns-subdomain-hosted-zone/index.js.map +1 -0
  302. package/prefab/networking/index.d.ts +6 -0
  303. package/prefab/networking/index.d.ts.map +1 -0
  304. package/prefab/networking/index.js +22 -0
  305. package/prefab/networking/index.js.map +1 -0
  306. package/prefab/networking/vpc/index.d.ts +20 -0
  307. package/prefab/networking/vpc/index.d.ts.map +1 -0
  308. package/prefab/networking/vpc/index.js +28 -0
  309. package/prefab/networking/vpc/index.js.map +1 -0
  310. package/prefab/networking/waf/index.d.ts +14 -0
  311. package/prefab/networking/waf/index.d.ts.map +1 -0
  312. package/prefab/networking/waf/index.js +45 -0
  313. package/prefab/networking/waf/index.js.map +1 -0
  314. package/prefab/storage/bucket/asset-bucket.d.ts +12 -0
  315. package/prefab/storage/bucket/asset-bucket.d.ts.map +1 -0
  316. package/prefab/storage/bucket/asset-bucket.js +19 -0
  317. package/prefab/storage/bucket/asset-bucket.js.map +1 -0
  318. package/prefab/storage/bucket/index.d.ts +3 -0
  319. package/prefab/storage/bucket/index.d.ts.map +1 -0
  320. package/prefab/storage/bucket/index.js +19 -0
  321. package/prefab/storage/bucket/index.js.map +1 -0
  322. package/prefab/storage/bucket/private-bucket.d.ts +26 -0
  323. package/prefab/storage/bucket/private-bucket.d.ts.map +1 -0
  324. package/prefab/storage/bucket/private-bucket.js +82 -0
  325. package/prefab/storage/bucket/private-bucket.js.map +1 -0
  326. package/prefab/storage/index.d.ts +2 -0
  327. package/prefab/storage/index.d.ts.map +1 -0
  328. package/prefab/storage/index.js +18 -0
  329. package/prefab/storage/index.js.map +1 -0
  330. package/prefab/utils/config/frontend-env-builder.d.ts +14 -0
  331. package/prefab/utils/config/frontend-env-builder.d.ts.map +1 -0
  332. package/prefab/utils/config/frontend-env-builder.js +25 -0
  333. package/prefab/utils/config/frontend-env-builder.js.map +1 -0
  334. package/prefab/utils/config/index.d.ts +4 -0
  335. package/prefab/utils/config/index.d.ts.map +1 -0
  336. package/prefab/utils/config/index.js +20 -0
  337. package/prefab/utils/config/index.js.map +1 -0
  338. package/prefab/utils/config/parameter-secret.d.ts +21 -0
  339. package/prefab/utils/config/parameter-secret.d.ts.map +1 -0
  340. package/prefab/utils/config/parameter-secret.js +42 -0
  341. package/prefab/utils/config/parameter-secret.js.map +1 -0
  342. package/prefab/utils/config/runtime-secret.d.ts +20 -0
  343. package/prefab/utils/config/runtime-secret.d.ts.map +1 -0
  344. package/prefab/utils/config/runtime-secret.js +37 -0
  345. package/prefab/utils/config/runtime-secret.js.map +1 -0
  346. package/prefab/utils/deploy-pipeline/catalog/integrations/index.d.ts +2 -0
  347. package/prefab/utils/deploy-pipeline/catalog/integrations/index.d.ts.map +1 -0
  348. package/prefab/utils/deploy-pipeline/catalog/integrations/index.js +28 -0
  349. package/prefab/utils/deploy-pipeline/catalog/integrations/index.js.map +1 -0
  350. package/prefab/utils/deploy-pipeline/catalog/integrations/slack.d.ts +28 -0
  351. package/prefab/utils/deploy-pipeline/catalog/integrations/slack.d.ts.map +1 -0
  352. package/prefab/utils/deploy-pipeline/catalog/integrations/slack.js +8 -0
  353. package/prefab/utils/deploy-pipeline/catalog/integrations/slack.js.map +1 -0
  354. package/prefab/utils/deploy-pipeline/entities/index.d.ts +29 -0
  355. package/prefab/utils/deploy-pipeline/entities/index.d.ts.map +1 -0
  356. package/prefab/utils/deploy-pipeline/entities/index.js +3 -0
  357. package/prefab/utils/deploy-pipeline/entities/index.js.map +1 -0
  358. package/prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.d.ts +3 -0
  359. package/prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.d.ts.map +1 -0
  360. package/prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.js +28 -0
  361. package/prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.js.map +1 -0
  362. package/prefab/utils/deploy-pipeline/index.d.ts +15 -0
  363. package/prefab/utils/deploy-pipeline/index.d.ts.map +1 -0
  364. package/prefab/utils/deploy-pipeline/index.js +173 -0
  365. package/prefab/utils/deploy-pipeline/index.js.map +1 -0
  366. package/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.d.ts +6 -0
  367. package/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.d.ts.map +1 -0
  368. package/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.js +26 -0
  369. package/prefab/utils/deploy-pipeline/platform/get-pipeline-detail.js.map +1 -0
  370. package/prefab/utils/deploy-pipeline/platform/get-slack-payload.d.ts +4 -0
  371. package/prefab/utils/deploy-pipeline/platform/get-slack-payload.d.ts.map +1 -0
  372. package/prefab/utils/deploy-pipeline/platform/get-slack-payload.js +39 -0
  373. package/prefab/utils/deploy-pipeline/platform/get-slack-payload.js.map +1 -0
  374. package/prefab/utils/deploy-pipeline/platform/send-to-slack.d.ts +3 -0
  375. package/prefab/utils/deploy-pipeline/platform/send-to-slack.d.ts.map +1 -0
  376. package/prefab/utils/deploy-pipeline/platform/send-to-slack.js +14 -0
  377. package/prefab/utils/deploy-pipeline/platform/send-to-slack.js.map +1 -0
  378. package/prefab/utils/duration.d.ts +2 -0
  379. package/prefab/utils/duration.d.ts.map +1 -0
  380. package/prefab/utils/duration.js +6 -0
  381. package/prefab/utils/duration.js.map +1 -0
  382. package/prefab/utils/index.d.ts +5 -0
  383. package/prefab/utils/index.d.ts.map +1 -0
  384. package/prefab/utils/index.js +21 -0
  385. package/prefab/utils/index.js.map +1 -0
  386. package/prefab/utils/ses/index.d.ts +22 -0
  387. package/prefab/utils/ses/index.d.ts.map +1 -0
  388. package/prefab/utils/ses/index.js +124 -0
  389. package/prefab/utils/ses/index.js.map +1 -0
  390. package/script/config-command/bootstrap.d.ts +4 -0
  391. package/script/config-command/bootstrap.d.ts.map +1 -0
  392. package/script/config-command/bootstrap.js +66 -0
  393. package/script/config-command/bootstrap.js.map +1 -0
  394. package/script/config-command/deploy-spa.d.ts +4 -0
  395. package/script/config-command/deploy-spa.d.ts.map +1 -0
  396. package/script/config-command/deploy-spa.js +84 -0
  397. package/script/config-command/deploy-spa.js.map +1 -0
  398. package/script/config-command/deploy.d.ts +4 -0
  399. package/script/config-command/deploy.d.ts.map +1 -0
  400. package/script/config-command/deploy.js +26 -0
  401. package/script/config-command/deploy.js.map +1 -0
  402. package/script/config-command/destroy.d.ts +4 -0
  403. package/script/config-command/destroy.d.ts.map +1 -0
  404. package/script/config-command/destroy.js +26 -0
  405. package/script/config-command/destroy.js.map +1 -0
  406. package/script/config-command/env-ssr.d.ts +4 -0
  407. package/script/config-command/env-ssr.d.ts.map +1 -0
  408. package/script/config-command/env-ssr.js +51 -0
  409. package/script/config-command/env-ssr.js.map +1 -0
  410. package/script/config-command/invalidation-ssr.d.ts +4 -0
  411. package/script/config-command/invalidation-ssr.d.ts.map +1 -0
  412. package/script/config-command/invalidation-ssr.js +55 -0
  413. package/script/config-command/invalidation-ssr.js.map +1 -0
  414. package/script/config-command/rds-migration.d.ts +7 -0
  415. package/script/config-command/rds-migration.d.ts.map +1 -0
  416. package/script/config-command/rds-migration.js +125 -0
  417. package/script/config-command/rds-migration.js.map +1 -0
  418. package/script/config-command/rds-sync.d.ts +4 -0
  419. package/script/config-command/rds-sync.d.ts.map +1 -0
  420. package/script/config-command/rds-sync.js +66 -0
  421. package/script/config-command/rds-sync.js.map +1 -0
  422. package/script/config-command/ssm-connect.d.ts +4 -0
  423. package/script/config-command/ssm-connect.d.ts.map +1 -0
  424. package/script/config-command/ssm-connect.js +86 -0
  425. package/script/config-command/ssm-connect.js.map +1 -0
  426. package/script/config-command/start-spa.d.ts +4 -0
  427. package/script/config-command/start-spa.d.ts.map +1 -0
  428. package/script/config-command/start-spa.js +55 -0
  429. package/script/config-command/start-spa.js.map +1 -0
  430. package/script/config-command/start-ssr.d.ts +4 -0
  431. package/script/config-command/start-ssr.d.ts.map +1 -0
  432. package/script/config-command/start-ssr.js +55 -0
  433. package/script/config-command/start-ssr.js.map +1 -0
  434. package/script/config-command/synth.d.ts +4 -0
  435. package/script/config-command/synth.d.ts.map +1 -0
  436. package/script/config-command/synth.js +26 -0
  437. package/script/config-command/synth.js.map +1 -0
  438. package/script/index.d.ts +25 -0
  439. package/script/index.d.ts.map +1 -0
  440. package/script/index.js +70 -0
  441. package/script/index.js.map +1 -0
  442. package/script/output-command/create-user.d.ts +9 -0
  443. package/script/output-command/create-user.d.ts.map +1 -0
  444. package/script/output-command/create-user.js +61 -0
  445. package/script/output-command/create-user.js.map +1 -0
  446. package/script/output-command/gen-postman-env.d.ts +28 -0
  447. package/script/output-command/gen-postman-env.d.ts.map +1 -0
  448. package/script/output-command/gen-postman-env.js +56 -0
  449. package/script/output-command/gen-postman-env.js.map +1 -0
  450. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,29 @@
1
+ export type PipelineNotification = {
2
+ detail: {
3
+ 'execution-id': string;
4
+ pipeline: string;
5
+ state: 'FAILED';
6
+ };
7
+ additionalAttributes: {
8
+ failedActionCount: number;
9
+ failedActions: {
10
+ action: string;
11
+ additionalInformation: string;
12
+ }[];
13
+ failedStage: string;
14
+ };
15
+ };
16
+ export type SlackNotificationConfig = {
17
+ channel: string;
18
+ token: string;
19
+ };
20
+ export type SlackNotificationPayload = {
21
+ fallback: string;
22
+ color: string;
23
+ fields: {
24
+ title: string;
25
+ short: boolean;
26
+ value: string;
27
+ }[];
28
+ };
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/entities/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE;QACN,cAAc,EAAE,MAAM,CAAC;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,QAAQ,CAAC;KACjB,CAAC;IACF,oBAAoB,EAAE;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,qBAAqB,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACnE,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5D,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/entities/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { SNSHandler } from 'aws-lambda';
2
+ export declare const handler: SNSHandler;
3
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../../../prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAOxC,eAAO,MAAM,OAAO,EAAE,UAuBrB,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handler = void 0;
4
+ const sdk_1 = require("@takumi-stack/sdk");
5
+ const get_pipeline_detail_1 = require("../../platform/get-pipeline-detail");
6
+ const get_slack_payload_1 = require("../../platform/get-slack-payload");
7
+ const send_to_slack_1 = require("../../platform/send-to-slack");
8
+ const handler = async (event) => {
9
+ await Promise.all(event.Records.map(async (v) => {
10
+ const response = JSON.parse(v.Sns.Message);
11
+ const pipelineName = response.detail.pipeline;
12
+ const { commitId, commitMessage } = await (0, get_pipeline_detail_1.getPipelineDetail)(pipelineName, response.detail['execution-id']);
13
+ const slackPayload = (0, get_slack_payload_1.getSlackPayload)(pipelineName, response.detail.state, commitId, commitMessage);
14
+ if (process.env.SLACK_EXTRA_CONFIG_NAME) {
15
+ const slackConfig = await (0, sdk_1.getParameter)(process.env.SLACK_EXTRA_CONFIG_NAME);
16
+ await Promise.all(slackConfig.map((sc) => (0, send_to_slack_1.sendToSlack)(slackPayload, sc)));
17
+ }
18
+ else {
19
+ const defaultSlackConfig = {
20
+ channel: process.env.DEFAULT_SLACK_CHANNEL,
21
+ token: await (0, sdk_1.getParameter)(process.env.DEFAULT_SLACK_TOKEN_PARAMETER, true),
22
+ };
23
+ await (0, send_to_slack_1.sendToSlack)(slackPayload, defaultSlackConfig);
24
+ }
25
+ }));
26
+ };
27
+ exports.handler = handler;
28
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../../../prefab/utils/deploy-pipeline/handlers/send-to-slack/handler.ts"],"names":[],"mappings":";;;AAAA,2CAAiD;AAIjD,4EAAuE;AACvE,wEAAmE;AACnE,gEAA2D;AAEpD,MAAM,OAAO,GAA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+1,15 @@
1
+ import * as awsCodebuild from 'aws-cdk-lib/aws-codebuild';
2
+ import { Construct } from 'constructs';
3
+
4
+ import { ServiceStack } from '../../../common';
5
+
6
+ export type DeployPipelineProps = {
7
+ preDeployCommands?: string[];
8
+ postDeployCommands?: string[];
9
+ codeBuildProjectParams?: Partial<awsCodebuild.ProjectProps>;
10
+ useExtraSlackNotification?: boolean;
11
+ };
12
+ export declare class DeployPipelinePrefab extends Construct {
13
+ constructor(service: ServiceStack, params: DeployPipelineProps);
14
+ }
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../prefab/utils/deploy-pipeline/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAC;AAS1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAiC,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKrE,MAAM,MAAM,mBAAmB,GAAG;IAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,sBAAsB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAC5D,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,SAAS;gBACrC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,mBAAmB;CAuI/D"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.DeployPipelinePrefab = void 0;
27
+ const awsCodebuild = __importStar(require("aws-cdk-lib/aws-codebuild"));
28
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
29
+ const aws_codepipeline_1 = require("aws-cdk-lib/aws-codepipeline");
30
+ const aws_codepipeline_actions_1 = require("aws-cdk-lib/aws-codepipeline-actions");
31
+ const aws_codestarnotifications_1 = require("aws-cdk-lib/aws-codestarnotifications");
32
+ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
33
+ const aws_s3_1 = require("aws-cdk-lib/aws-s3");
34
+ const aws_ssm_1 = require("aws-cdk-lib/aws-ssm");
35
+ const constructs_1 = require("constructs");
36
+ const common_1 = require("../../../common");
37
+ const topic_function_1 = require("../../compute/function/topic-function");
38
+ const parameter_secret_1 = require("../config/parameter-secret");
39
+ class DeployPipelinePrefab extends constructs_1.Construct {
40
+ constructor(service, params) {
41
+ super(service, (0, common_1.getLogicalName)(DeployPipelinePrefab.name));
42
+ const overriddenService = Object.assign({ props: { ...service.props } }, service);
43
+ overriddenService.props.isSingleProjectAccount = false;
44
+ if (overriddenService.props.ephemeralEnvName)
45
+ return;
46
+ const repositoryOwner = aws_ssm_1.StringParameter.valueFromLookup(this, 'pipeline-default-repository-owner');
47
+ const repositoryConnection = aws_ssm_1.StringParameter.valueFromLookup(this, 'pipeline-default-repository-connection');
48
+ const sourceCodeArtifact = new aws_codepipeline_1.Artifact('sourceCode');
49
+ const sourceCodeAction = new aws_codepipeline_actions_1.CodeStarConnectionsSourceAction({
50
+ actionName: 'FetchRepo',
51
+ branch: overriddenService.props.deployBranch,
52
+ repo: overriddenService.props.repositoryName,
53
+ output: sourceCodeArtifact,
54
+ owner: repositoryOwner,
55
+ connectionArn: repositoryConnection,
56
+ });
57
+ const deploymentRole = new aws_iam_1.Role(this, 'DeployRole', { assumedBy: new aws_iam_1.ServicePrincipal('codebuild.amazonaws.com') });
58
+ const policy = aws_iam_1.ManagedPolicy.fromAwsManagedPolicyName('AdministratorAccess');
59
+ deploymentRole.addManagedPolicy(policy);
60
+ const workerCommands = aws_ssm_1.StringParameter.valueFromLookup(this, 'pipeline-deploy-worker-role') !== 'null'
61
+ ? [
62
+ 'output=$(aws sts assume-role --role-arn "$DEPLOY_WORKER_ROLE" --role-session-name "CDK" --query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" --output text)',
63
+ "var1=$(echo \"$output\" | awk -F'\t' '{print $1}')",
64
+ "var2=$(echo \"$output\" | awk -F'\t' '{print $2}')",
65
+ "var3=$(echo \"$output\" | awk -F'\t' '{print $3}')",
66
+ 'export AWS_ACCESS_KEY_ID=$var1',
67
+ 'export AWS_SECRET_ACCESS_KEY=$var2',
68
+ 'export AWS_SESSION_TOKEN=$var3',
69
+ ]
70
+ : [];
71
+ const codebuildProject = new awsCodebuild.Project(this, 'CodebuildProject', {
72
+ projectName: `${overriddenService.props.projectName}-${overriddenService.props.envName}`,
73
+ role: deploymentRole,
74
+ environment: {
75
+ computeType: awsCodebuild.ComputeType.LARGE,
76
+ buildImage: awsCodebuild.LinuxBuildImage.STANDARD_7_0,
77
+ },
78
+ buildSpec: awsCodebuild.BuildSpec.fromObject({
79
+ version: '0.2',
80
+ phases: {
81
+ install: {
82
+ 'runtime-versions': { nodejs: 18 },
83
+ },
84
+ pre_build: {
85
+ commands: [
86
+ ...workerCommands,
87
+ 'npm install --global yarn',
88
+ 'npm set //npm.pkg.github.com/:_authToken $GITHUB_TOKEN',
89
+ 'yarn --prod',
90
+ ...(params.preDeployCommands || []),
91
+ ],
92
+ },
93
+ build: {
94
+ commands: [`yarn deploy ${overriddenService.props.envName}`],
95
+ },
96
+ post_build: {
97
+ commands: params.postDeployCommands || [],
98
+ },
99
+ },
100
+ }),
101
+ ...params.codeBuildProjectParams,
102
+ // I put this at the end because we need to prevent to override the environment variables
103
+ environmentVariables: {
104
+ GITHUB_TOKEN: {
105
+ type: awsCodebuild.BuildEnvironmentVariableType.PARAMETER_STORE,
106
+ value: 'pipeline-default-repository-token',
107
+ },
108
+ DEPLOY_WORKER_ROLE: {
109
+ type: awsCodebuild.BuildEnvironmentVariableType.PARAMETER_STORE,
110
+ value: 'pipeline-deploy-worker-role',
111
+ },
112
+ ...params.codeBuildProjectParams?.environmentVariables,
113
+ },
114
+ });
115
+ const deployAction = new aws_codepipeline_actions_1.CodeBuildAction({
116
+ actionName: 'Deploy',
117
+ input: sourceCodeArtifact,
118
+ project: codebuildProject,
119
+ });
120
+ const pipeline = new aws_codepipeline_1.Pipeline(this, 'Pipeline', {
121
+ crossAccountKeys: false,
122
+ pipelineName: `${overriddenService.props.projectName}-${overriddenService.props.envName}`,
123
+ artifactBucket: new aws_s3_1.Bucket(this, 'bucket', {
124
+ bucketName: (0, common_1.getBucketName)('bucket', overriddenService.props),
125
+ autoDeleteObjects: true,
126
+ removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY,
127
+ }),
128
+ stages: [
129
+ { stageName: 'Source', actions: [sourceCodeAction] },
130
+ { stageName: 'Deploy', actions: [deployAction] },
131
+ ],
132
+ });
133
+ if (overriddenService.props.pipelineNotificationSlackChannel) {
134
+ const extraSlackNotification = 'extra-slack-notification';
135
+ const defaultSlackToken = new parameter_secret_1.ParameterSecret(service, { existingName: 'pipeline-default-slack-token' });
136
+ const modifiers = [getPipelineExecution(), defaultSlackToken.useModReader('DEFAULT_SLACK_TOKEN_PARAMETER')];
137
+ if (params.useExtraSlackNotification) {
138
+ const extraSlackNotificationParam = new parameter_secret_1.ParameterSecret(service, { name: extraSlackNotification });
139
+ modifiers.push(extraSlackNotificationParam.useModReader('SLACK_EXTRA_CONFIG_NAME'));
140
+ }
141
+ const topicFunction = new topic_function_1.TopicFunction(service, {
142
+ customTopicParams: { name: 'notifications' },
143
+ name: 'send-to-slack',
144
+ baseFunctionFolder: __dirname,
145
+ modifiers,
146
+ ...(overriddenService.props.isDemoProject ? {} : { compiled: true }),
147
+ environment: {
148
+ REPOSITORY_OWNER: repositoryOwner,
149
+ REPOSITORY_NAME: overriddenService.props.repositoryName,
150
+ DEFAULT_SLACK_CHANNEL: overriddenService.props.pipelineNotificationSlackChannel,
151
+ },
152
+ });
153
+ new aws_codestarnotifications_1.NotificationRule(this, 'Notification', {
154
+ notificationRuleName: `${overriddenService.props.projectName}-${overriddenService.props.envName}`,
155
+ detailType: aws_codestarnotifications_1.DetailType.FULL,
156
+ source: pipeline,
157
+ targets: [topicFunction.customTopic.topic],
158
+ events: ['codepipeline-pipeline-pipeline-execution-failed', 'codepipeline-pipeline-pipeline-execution-succeeded'],
159
+ });
160
+ }
161
+ }
162
+ }
163
+ exports.DeployPipelinePrefab = DeployPipelinePrefab;
164
+ // }
165
+ const getPipelineExecution = () => {
166
+ return (lambda) => {
167
+ lambda.role?.addToPrincipalPolicy(new aws_iam_1.PolicyStatement({
168
+ actions: ['codepipeline:GetPipelineExecution'],
169
+ resources: ['*'],
170
+ }));
171
+ };
172
+ };
173
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../prefab/utils/deploy-pipeline/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wEAA0D;AAC1D,6CAA4C;AAC5C,mEAAkE;AAClE,mFAAwG;AACxG,qFAAqF;AACrF,iDAA6G;AAE7G,+CAA4C;AA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MAAM,oBAAoB,GAAG,GAAuC,EAAE;IACpE,OAAO,CAAC,MAAsB,EAAQ,EAAE;QACtC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAC/B,IAAI,yBAAe,CAAC;YAClB,OAAO,EAAE,CAAC,mCAAmC,CAAC;YAC9C,SAAS,EAAE,CAAC,GAAG,CAAC;SACjB,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type PipelineDetail = {
2
+ commitId: string;
3
+ commitMessage: string;
4
+ };
5
+ export declare const getPipelineDetail: (pipelineName: string, executionId: string) => Promise<PipelineDetail>;
6
+ //# sourceMappingURL=get-pipeline-detail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-pipeline-detail.d.ts","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/platform/get-pipeline-detail.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,iBAAwB,MAAM,eAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAqBzG,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPipelineDetail = void 0;
4
+ const client_codepipeline_1 = require("@aws-sdk/client-codepipeline");
5
+ const codepipeline = new client_codepipeline_1.CodePipelineClient({});
6
+ const getPipelineDetail = async (pipelineName, executionId) => {
7
+ const { pipelineExecution } = await codepipeline.send(new client_codepipeline_1.GetPipelineExecutionCommand({
8
+ pipelineName: pipelineName,
9
+ pipelineExecutionId: executionId,
10
+ }));
11
+ if (!pipelineExecution)
12
+ throw new Error('Missing pipelineExecution');
13
+ const detail = pipelineExecution.artifactRevisions
14
+ ?.filter((a) => a.name === 'sourceCode')
15
+ .map((a) => {
16
+ return {
17
+ commitId: a.revisionId || '',
18
+ commitMessage: JSON.parse(a.revisionSummary || '{}')['CommitMessage'],
19
+ };
20
+ });
21
+ if (!detail || !detail[0])
22
+ throw new Error('Missing artifactRevision');
23
+ return detail[0];
24
+ };
25
+ exports.getPipelineDetail = getPipelineDetail;
26
+ //# sourceMappingURL=get-pipeline-detail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-pipeline-detail.js","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/platform/get-pipeline-detail.ts"],"names":[],"mappings":";;;AAAA,sEAA+F;AAE/F,MAAM,YAAY,GAAG,IAAI,wCAAkB,CAAC,EAAE,CAAC,CAAC;AAOzC,MAAM,iBAAiB,GAAG,KAAK,EAAE,YAAoB,EAAE,WAAmB,EAA2B,EAAE;IAC5G,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CACnD,IAAI,iDAA2B,CAAC;QAC9B,YAAY,EAAE,YAAY;QAC1B,mBAAmB,EAAE,WAAW;KACjC,CAAC,CACH,CAAC;IAEF,IAAI,CAAC,iBAAiB;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAErE,MAAM,MAAM,GAAG,iBAAiB,CAAC,iBAAiB;QAChD,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC;SACvC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,OAAO;YACL,QAAQ,EAAE,CAAC,CAAC,UAAU,IAAI,EAAE;YAC5B,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,eAAe,CAAC;SACtE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC;AArBW,QAAA,iBAAiB,qBAqB5B"}
@@ -0,0 +1,4 @@
1
+ import { SlackNotificationPayload } from '../entities';
2
+
3
+ export declare const getSlackPayload: (pipelineName: string, state: string, commitId: string, commitMessage: string) => SlackNotificationPayload;
4
+ //# sourceMappingURL=get-slack-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-slack-payload.d.ts","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/platform/get-slack-payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,eAAe,iBAAkB,MAAM,SAAS,MAAM,YAAY,MAAM,iBAAiB,MAAM,KAAG,wBAmC9G,CAAC"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSlackPayload = void 0;
4
+ const getSlackPayload = (pipelineName, state, commitId, commitMessage) => {
5
+ const commitUrl = `https://github.com/${process.env.REPOSITORY_OWNER}/${process.env.REPOSITORY_NAME}/commit/${commitId}`;
6
+ const url = `https://us-east-1.console.aws.amazon.com/codesuite/codepipeline/pipelines/${pipelineName}/view?region=us-east-1`;
7
+ const fallback = ':robot_face: *[Deploy Pipeline]* :robot_face:\n';
8
+ const color = state === 'FAILED' ? '#D00000' : '#00d02d';
9
+ const fieldState = state === 'FAILED'
10
+ ? [
11
+ {
12
+ title: 'Status: [Pipeline Failed]',
13
+ short: false,
14
+ value: `_For more details <${url}|Go to AWS Console>_ `,
15
+ },
16
+ ]
17
+ : [
18
+ {
19
+ title: 'Status: [Pipeline Finished]',
20
+ short: false,
21
+ value: `Deployed at: ${new Date().toDateString()}`,
22
+ },
23
+ ];
24
+ return {
25
+ color,
26
+ fallback,
27
+ fields: [
28
+ { title: 'Pipeline', short: false, value: pipelineName },
29
+ {
30
+ title: 'Commit',
31
+ short: false,
32
+ value: `${commitMessage} \n\n _For more details <${commitUrl}|Go to GitHub>_`,
33
+ },
34
+ ...fieldState,
35
+ ],
36
+ };
37
+ };
38
+ exports.getSlackPayload = getSlackPayload;
39
+ //# sourceMappingURL=get-slack-payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-slack-payload.js","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/platform/get-slack-payload.ts"],"names":[],"mappings":";;;AAEO,MAAM,eAAe,GAAG,CAAC,YAAoB,EAAE,KAAa,EAAE,QAAgB,EAAE,aAAqB,EAA4B,EAAE;IACxI,MAAM,SAAS,GAAG,sBAAsB,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,WAAW,QAAQ,EAAE,CAAC;IACzH,MAAM,GAAG,GAAG,6EAA6E,YAAY,wBAAwB,CAAC;IAC9H,MAAM,QAAQ,GAAG,iDAAiD,CAAC;IACnE,MAAM,KAAK,GAAG,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACzD,MAAM,UAAU,GACd,KAAK,KAAK,QAAQ;QAChB,CAAC,CAAC;YACE;gBACE,KAAK,EAAE,2BAA2B;gBAClC,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sBAAsB,GAAG,uBAAuB;aACxD;SACF;QACH,CAAC,CAAC;YACE;gBACE,KAAK,EAAE,6BAA6B;gBACpC,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,gBAAgB,IAAI,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;aACnD;SACF,CAAC;IAER,OAAO;QACL,KAAK;QACL,QAAQ;QACR,MAAM,EAAE;YACN,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE;YACxD;gBACE,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,GAAG,aAAa,4BAA4B,SAAS,iBAAiB;aAC9E;YACD,GAAG,UAAU;SACd;KACF,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,eAAe,mBAmC1B"}
@@ -0,0 +1,3 @@
1
+ import { SlackNotificationPayload, SlackNotificationConfig } from '../entities';
2
+ export declare const sendToSlack: (slackNotificationPayload: SlackNotificationPayload, slackNotificationConfig: SlackNotificationConfig) => Promise<void>;
3
+ //# sourceMappingURL=send-to-slack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-to-slack.d.ts","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/platform/send-to-slack.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEhF,eAAO,MAAM,WAAW,6BAAoC,wBAAwB,2BAA2B,uBAAuB,kBAUrI,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendToSlack = void 0;
4
+ const sdk_1 = require("@takumi-stack/sdk");
5
+ const integrations_1 = require("../catalog/integrations");
6
+ const sendToSlack = async (slackNotificationPayload, slackNotificationConfig) => {
7
+ const { fallback, color, fields } = slackNotificationPayload;
8
+ await (0, sdk_1.apiCall)(integrations_1.Slack.config, {
9
+ pathParams: { token: slackNotificationConfig.token },
10
+ body: { attachments: [{ pretext: fallback, fallback, color, fields }], channel: slackNotificationConfig.channel },
11
+ }, { tracingMeta: {}, ignoreResponse: true });
12
+ };
13
+ exports.sendToSlack = sendToSlack;
14
+ //# sourceMappingURL=send-to-slack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-to-slack.js","sourceRoot":"","sources":["../../../../../prefab/utils/deploy-pipeline/platform/send-to-slack.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,0DAAgD;AAGzC,MAAM,WAAW,GAAG,KAAK,EAAE,wBAAkD,EAAE,uBAAgD,EAAE,EAAE;IACxI,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,wBAAwB,CAAC;IAC7D,MAAM,IAAA,aAAO,EACX,oBAAK,CAAC,MAAM,EACZ;QACE,UAAU,EAAE,EAAE,KAAK,EAAE,uBAAuB,CAAC,KAAK,EAAE;QACpD,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,uBAAuB,CAAC,OAAO,EAAE;KAClH,EACD,EAAE,WAAW,EAAE,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAC1C,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,WAAW,eAUtB"}
@@ -0,0 +1,2 @@
1
+ export { Duration } from 'aws-cdk-lib/core';
2
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../prefab/utils/duration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Duration = void 0;
4
+ var core_1 = require("aws-cdk-lib/core");
5
+ Object.defineProperty(exports, "Duration", { enumerable: true, get: function () { return core_1.Duration; } });
6
+ //# sourceMappingURL=duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../prefab/utils/duration.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAAnC,gGAAA,QAAQ,OAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './config';
2
+ export * from './deploy-pipeline';
3
+ export * from './ses';
4
+ export * from './duration';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../prefab/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./config"), exports);
18
+ __exportStar(require("./deploy-pipeline"), exports);
19
+ __exportStar(require("./ses"), exports);
20
+ __exportStar(require("./duration"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../prefab/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,oDAAkC;AAClC,wCAAsB;AACtB,6CAA2B"}
@@ -0,0 +1,22 @@
1
+ import { UserPoolSESOptions } from '../../../node_modules/aws-cdk-lib/aws-cognito/lib';
2
+ import { NodejsFunction } from '../../../node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function';
3
+ import { AwsCustomResourcePolicy } from 'aws-cdk-lib/custom-resources';
4
+ import { Construct } from 'constructs';
5
+
6
+ import { BaseGlobalProps, ServiceStack } from '../../../common';
7
+
8
+ export declare class SesDomain extends Construct {
9
+ constructor(service: ServiceStack);
10
+ private verifyDomainIdentity;
11
+ private verifyDomainDkim;
12
+ private getHostedZone;
13
+ private addDkimRecords;
14
+ useMod(mods: (() => any)[]): (lambda: NodejsFunction) => void;
15
+ static modifier: {
16
+ emailSender: () => (lambda: NodejsFunction) => void;
17
+ smsSender: () => (lambda: NodejsFunction) => void;
18
+ };
19
+ static getCognitoRef(props: BaseGlobalProps): UserPoolSESOptions;
20
+ }
21
+ export declare function generateSesPolicyForCustomResource(...methods: string[]): AwsCustomResourcePolicy;
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../prefab/utils/ses/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,kEAAkE,CAAC;AAGlG,OAAO,EAAqB,uBAAuB,EAAsB,MAAM,8BAA8B,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,eAAe,EAA6B,YAAY,EAAE,MAAM,QAAQ,CAAC;AAElF,qBAAa,SAAU,SAAQ,SAAS;gBAC1B,OAAO,EAAE,YAAY;IAcjC,OAAO,CAAC,oBAAoB;IA8B5B,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,cAAc;IAaf,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI;IAMpE,OAAc,QAAQ;2BACH,CAAC,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;yBAKpC,CAAC,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;MAKjD;WAEY,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,kBAAkB;CAQxE;AAED,wBAAgB,kCAAkC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,uBAAuB,CAQhG"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SesDomain = void 0;
4
+ exports.generateSesPolicyForCustomResource = generateSesPolicyForCustomResource;
5
+ const aws_iam_1 = require("aws-cdk-lib/aws-iam");
6
+ const aws_route53_1 = require("aws-cdk-lib/aws-route53");
7
+ const custom_resources_1 = require("aws-cdk-lib/custom-resources");
8
+ const constructs_1 = require("constructs");
9
+ const common_1 = require("../../../common");
10
+ class SesDomain extends constructs_1.Construct {
11
+ constructor(service) {
12
+ super(service, (0, common_1.getLogicalName)(SesDomain.name));
13
+ const domain = (0, common_1.getDomain)('', service.props);
14
+ const zone = this.getHostedZone(domain);
15
+ const verifyDomainIdentity = this.verifyDomainIdentity(domain);
16
+ const verifyDomainDkim = this.verifyDomainDkim(domain);
17
+ verifyDomainDkim.node.addDependency(verifyDomainIdentity);
18
+ this.addDkimRecords(verifyDomainDkim, zone, domain);
19
+ }
20
+ verifyDomainIdentity(domainName) {
21
+ return new custom_resources_1.AwsCustomResource(this, 'VerifyDomainIdentity', {
22
+ installLatestAwsSdk: true,
23
+ onCreate: {
24
+ service: 'SES',
25
+ action: 'verifyDomainIdentity',
26
+ parameters: {
27
+ Domain: domainName,
28
+ },
29
+ physicalResourceId: custom_resources_1.PhysicalResourceId.fromResponse('VerificationToken'),
30
+ },
31
+ onUpdate: {
32
+ service: 'SES',
33
+ action: 'verifyDomainIdentity',
34
+ parameters: {
35
+ Domain: domainName,
36
+ },
37
+ physicalResourceId: custom_resources_1.PhysicalResourceId.fromResponse('VerificationToken'),
38
+ },
39
+ onDelete: {
40
+ service: 'SES',
41
+ action: 'deleteIdentity',
42
+ parameters: {
43
+ Identity: domainName,
44
+ },
45
+ },
46
+ policy: generateSesPolicyForCustomResource('VerifyDomainIdentity', 'DeleteIdentity'),
47
+ });
48
+ }
49
+ verifyDomainDkim(domainName) {
50
+ return new custom_resources_1.AwsCustomResource(this, 'VerifyDomainDkim', {
51
+ installLatestAwsSdk: true,
52
+ onCreate: {
53
+ service: 'SES',
54
+ action: 'verifyDomainDkim',
55
+ parameters: {
56
+ Domain: domainName,
57
+ },
58
+ physicalResourceId: custom_resources_1.PhysicalResourceId.of(`${domainName}-verify-domain-dkim`),
59
+ },
60
+ onUpdate: {
61
+ service: 'SES',
62
+ action: 'verifyDomainDkim',
63
+ parameters: {
64
+ Domain: domainName,
65
+ },
66
+ physicalResourceId: custom_resources_1.PhysicalResourceId.of(`${domainName}-verify-domain-dkim`),
67
+ },
68
+ policy: generateSesPolicyForCustomResource('VerifyDomainDkim'),
69
+ });
70
+ }
71
+ getHostedZone(domainName) {
72
+ return aws_route53_1.HostedZone.fromLookup(this, 'Zone', {
73
+ domainName: domainName,
74
+ });
75
+ }
76
+ addDkimRecords(verifyDomainDkim, zone, domainName) {
77
+ [0, 1, 2].forEach((val) => {
78
+ const dkimToken = verifyDomainDkim.getResponseField(`DkimTokens.${val}`);
79
+ const cnameRecord = new aws_route53_1.CnameRecord(this, 'SesDkimVerificationRecord' + val, {
80
+ zone,
81
+ recordName: `${dkimToken}._domainkey.${domainName}`,
82
+ domainName: `${dkimToken}.dkim.amazonses.com`,
83
+ });
84
+ cnameRecord.node.addDependency(verifyDomainDkim);
85
+ });
86
+ }
87
+ // Custom Methods
88
+ useMod(mods) {
89
+ return (lambda) => {
90
+ mods.map((fn) => fn()(lambda));
91
+ };
92
+ }
93
+ static modifier = {
94
+ emailSender: () => {
95
+ return (lambda) => {
96
+ lambda.addToRolePolicy(new aws_iam_1.PolicyStatement({ effect: aws_iam_1.Effect.ALLOW, actions: ['ses:SendRawEmail'], resources: ['*'] }));
97
+ };
98
+ },
99
+ smsSender: () => {
100
+ return (lambda) => {
101
+ lambda.addToRolePolicy(new aws_iam_1.PolicyStatement({ effect: aws_iam_1.Effect.ALLOW, actions: ['sns:Publish'], resources: ['*'] }));
102
+ };
103
+ },
104
+ };
105
+ static getCognitoRef(props) {
106
+ return {
107
+ // emailSendingAccount: 'DEVELOPER',
108
+ fromEmail: props.emailSender,
109
+ sesVerifiedDomain: (0, common_1.getDomain)('', props),
110
+ // sourceArn: `arn:aws:ses:${props.regionName}:${props.deployTarget['services'].account}:identity/${getDomain('', props)}`,
111
+ };
112
+ }
113
+ }
114
+ exports.SesDomain = SesDomain;
115
+ function generateSesPolicyForCustomResource(...methods) {
116
+ return custom_resources_1.AwsCustomResourcePolicy.fromStatements([
117
+ new aws_iam_1.PolicyStatement({
118
+ actions: methods.map((method) => 'ses:' + method),
119
+ effect: aws_iam_1.Effect.ALLOW,
120
+ resources: ['*'],
121
+ }),
122
+ ]);
123
+ }
124
+ //# sourceMappingURL=index.js.map