@remotion/lambda 4.0.0-webhook.27 → 4.1.0-alpha3

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 (409) hide show
  1. package/LICENSE.md +8 -8
  2. package/dist/admin/bundle-lambda.d.ts +0 -0
  3. package/dist/admin/bundle-lambda.js +24 -13
  4. package/dist/admin/generate-etag-list.d.ts +1 -0
  5. package/dist/admin/generate-etag-list.js +14 -0
  6. package/dist/admin/make-layer-public.d.ts +0 -0
  7. package/dist/admin/make-layer-public.js +59 -65
  8. package/dist/api/bucket-exists.d.ts +0 -0
  9. package/dist/api/bucket-exists.js +0 -0
  10. package/dist/api/clean-items.d.ts +0 -0
  11. package/dist/api/clean-items.js +1 -1
  12. package/dist/api/create-bucket.d.ts +0 -0
  13. package/dist/api/create-bucket.js +34 -1
  14. package/dist/api/create-function.d.ts +1 -3
  15. package/dist/api/create-function.js +27 -6
  16. package/dist/api/delete-function.d.ts +4 -4
  17. package/dist/api/delete-function.js +3 -3
  18. package/dist/api/delete-render.d.ts +2 -2
  19. package/dist/api/delete-render.js +1 -1
  20. package/dist/api/delete-site.d.ts +7 -7
  21. package/dist/api/delete-site.js +9 -7
  22. package/dist/api/deploy-function.d.ts +11 -13
  23. package/dist/api/deploy-function.js +28 -31
  24. package/dist/api/deploy-site.d.ts +13 -5
  25. package/dist/api/deploy-site.js +61 -25
  26. package/dist/api/download-media.d.ts +4 -8
  27. package/dist/api/download-media.js +5 -9
  28. package/dist/api/estimate-price.d.ts +3 -5
  29. package/dist/api/estimate-price.js +4 -10
  30. package/dist/api/get-aws-client.d.ts +6 -4
  31. package/dist/api/get-aws-client.js +3 -1
  32. package/dist/api/get-buckets.d.ts +2 -2
  33. package/dist/api/get-buckets.js +35 -12
  34. package/dist/api/get-compositions-on-lambda.d.ts +33 -0
  35. package/dist/api/get-compositions-on-lambda.js +57 -0
  36. package/dist/api/get-function-info.d.ts +3 -3
  37. package/dist/api/get-function-info.js +1 -1
  38. package/dist/api/get-functions.d.ts +5 -7
  39. package/dist/api/get-functions.js +8 -10
  40. package/dist/api/get-or-create-bucket.d.ts +6 -6
  41. package/dist/api/get-or-create-bucket.js +10 -18
  42. package/dist/api/get-regions.d.ts +6 -2
  43. package/dist/api/get-regions.js +6 -3
  44. package/dist/api/get-render-progress.d.ts +3 -3
  45. package/dist/api/get-render-progress.js +6 -11
  46. package/dist/api/get-sites.d.ts +6 -6
  47. package/dist/api/get-sites.js +5 -4
  48. package/dist/api/iam-validation/role-permissions.d.ts +0 -0
  49. package/dist/api/iam-validation/role-permissions.js +0 -0
  50. package/dist/api/iam-validation/simulate-rule.d.ts +2 -2
  51. package/dist/api/iam-validation/simulate-rule.js +0 -22
  52. package/dist/api/iam-validation/simulate.d.ts +3 -3
  53. package/dist/api/iam-validation/simulate.js +27 -6
  54. package/dist/api/iam-validation/suggested-policy.d.ts +0 -0
  55. package/dist/api/iam-validation/suggested-policy.js +0 -0
  56. package/dist/api/iam-validation/user-permissions.d.ts +1 -1
  57. package/dist/api/iam-validation/user-permissions.js +3 -8
  58. package/dist/api/make-lambda-payload.d.ts +5 -0
  59. package/dist/api/make-lambda-payload.js +79 -0
  60. package/dist/api/mock-functions.d.ts +0 -0
  61. package/dist/api/mock-functions.js +0 -0
  62. package/dist/api/presign-url.d.ts +4 -5
  63. package/dist/api/presign-url.js +3 -3
  64. package/dist/api/render-media-on-lambda.d.ts +27 -11
  65. package/dist/api/render-media-on-lambda.js +15 -49
  66. package/dist/api/render-still-on-lambda.d.ts +17 -6
  67. package/dist/api/render-still-on-lambda.js +25 -10
  68. package/dist/api/speculate-function-name.d.ts +14 -0
  69. package/dist/api/speculate-function-name.js +22 -0
  70. package/dist/api/upload-dir.d.ts +6 -5
  71. package/dist/api/upload-dir.js +54 -51
  72. package/dist/api/validate-webhook-signature.d.ts +2 -2
  73. package/dist/api/validate-webhook-signature.js +1 -1
  74. package/dist/cli/args.d.ts +7 -5
  75. package/dist/cli/args.js +1 -5
  76. package/dist/cli/commands/compositions/index.d.ts +2 -0
  77. package/dist/cli/commands/compositions/index.js +44 -0
  78. package/dist/cli/commands/functions/deploy.d.ts +0 -0
  79. package/dist/cli/commands/functions/deploy.js +15 -15
  80. package/dist/cli/commands/functions/index.d.ts +0 -0
  81. package/dist/cli/commands/functions/index.js +16 -17
  82. package/dist/cli/commands/functions/ls.d.ts +0 -0
  83. package/dist/cli/commands/functions/ls.js +17 -10
  84. package/dist/cli/commands/functions/rm.d.ts +0 -0
  85. package/dist/cli/commands/functions/rm.js +20 -7
  86. package/dist/cli/commands/functions/rmall.d.ts +0 -0
  87. package/dist/cli/commands/functions/rmall.js +20 -8
  88. package/dist/cli/commands/policies/policies.d.ts +0 -0
  89. package/dist/cli/commands/policies/policies.js +0 -0
  90. package/dist/cli/commands/policies/role.d.ts +0 -0
  91. package/dist/cli/commands/policies/role.js +0 -0
  92. package/dist/cli/commands/policies/user.d.ts +0 -0
  93. package/dist/cli/commands/policies/user.js +0 -0
  94. package/dist/cli/commands/policies/validate.d.ts +0 -0
  95. package/dist/cli/commands/policies/validate.js +0 -0
  96. package/dist/cli/commands/quotas/increase.d.ts +0 -0
  97. package/dist/cli/commands/quotas/increase.js +30 -10
  98. package/dist/cli/commands/quotas/index.d.ts +0 -0
  99. package/dist/cli/commands/quotas/index.js +8 -9
  100. package/dist/cli/commands/quotas/list.d.ts +0 -0
  101. package/dist/cli/commands/quotas/list.js +0 -0
  102. package/dist/cli/commands/regions.d.ts +0 -0
  103. package/dist/cli/commands/regions.js +6 -2
  104. package/dist/cli/commands/render/progress.d.ts +11 -7
  105. package/dist/cli/commands/render/progress.js +55 -45
  106. package/dist/cli/commands/render/render.d.ts +1 -1
  107. package/dist/cli/commands/render/render.js +99 -27
  108. package/dist/cli/commands/sites/create.d.ts +1 -1
  109. package/dist/cli/commands/sites/create.js +37 -33
  110. package/dist/cli/commands/sites/index.d.ts +1 -1
  111. package/dist/cli/commands/sites/index.js +18 -16
  112. package/dist/cli/commands/sites/ls.d.ts +0 -0
  113. package/dist/cli/commands/sites/ls.js +9 -10
  114. package/dist/cli/commands/sites/rm.d.ts +0 -0
  115. package/dist/cli/commands/sites/rm.js +7 -16
  116. package/dist/cli/commands/sites/rmall.d.ts +0 -0
  117. package/dist/cli/commands/sites/rmall.js +5 -16
  118. package/dist/cli/commands/still.d.ts +1 -1
  119. package/dist/cli/commands/still.js +49 -20
  120. package/dist/cli/get-aws-region.d.ts +0 -0
  121. package/dist/cli/get-aws-region.js +0 -0
  122. package/dist/cli/help.d.ts +0 -0
  123. package/dist/cli/help.js +4 -0
  124. package/dist/cli/helpers/confirm.d.ts +0 -0
  125. package/dist/cli/helpers/confirm.js +0 -0
  126. package/dist/cli/helpers/date-string.d.ts +0 -0
  127. package/dist/cli/helpers/date-string.js +0 -0
  128. package/dist/cli/helpers/find-function-name.d.ts +0 -0
  129. package/dist/cli/helpers/find-function-name.js +35 -6
  130. package/dist/cli/helpers/progress-bar.d.ts +12 -7
  131. package/dist/cli/helpers/progress-bar.js +20 -11
  132. package/dist/cli/helpers/quit.d.ts +0 -0
  133. package/dist/cli/helpers/quit.js +0 -0
  134. package/dist/cli/helpers/yes-or-no.d.ts +0 -0
  135. package/dist/cli/helpers/yes-or-no.js +0 -0
  136. package/dist/cli/index.d.ts +1 -1
  137. package/dist/cli/index.js +23 -12
  138. package/dist/cli/is-cli.d.ts +0 -0
  139. package/dist/cli/is-cli.js +0 -0
  140. package/dist/cli/log.d.ts +14 -0
  141. package/dist/cli/log.js +0 -0
  142. package/dist/client.d.ts +8 -2
  143. package/dist/client.js +9 -1
  144. package/dist/defaults.d.ts +0 -0
  145. package/dist/defaults.js +0 -0
  146. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -5
  147. package/dist/functions/chunk-optimization/plan-frame-ranges.js +2 -15
  148. package/dist/functions/chunk-optimization/types.d.ts +2 -13
  149. package/dist/functions/chunk-optimization/types.js +0 -0
  150. package/dist/functions/compositions.d.ts +8 -0
  151. package/dist/functions/compositions.js +59 -0
  152. package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +0 -0
  153. package/dist/functions/helpers/best-frames-per-lambda-param.js +0 -0
  154. package/dist/functions/helpers/calculate-chunk-times.d.ts +0 -0
  155. package/dist/functions/helpers/calculate-chunk-times.js +0 -0
  156. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +1 -3
  157. package/dist/functions/helpers/calculate-price-from-bucket.js +1 -2
  158. package/dist/functions/helpers/check-if-render-exists.d.ts +0 -0
  159. package/dist/functions/helpers/check-if-render-exists.js +0 -0
  160. package/dist/functions/helpers/clean-tmpdir.d.ts +0 -0
  161. package/dist/functions/helpers/clean-tmpdir.js +8 -8
  162. package/dist/functions/helpers/concat-videos.d.ts +13 -5
  163. package/dist/functions/helpers/concat-videos.js +38 -39
  164. package/dist/functions/helpers/create-post-render-data.d.ts +0 -0
  165. package/dist/functions/helpers/create-post-render-data.js +1 -15
  166. package/dist/functions/helpers/delete-chunks.d.ts +0 -0
  167. package/dist/functions/helpers/delete-chunks.js +0 -0
  168. package/dist/functions/helpers/expected-out-name.d.ts +0 -0
  169. package/dist/functions/helpers/expected-out-name.js +2 -2
  170. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +1 -1
  171. package/dist/functions/helpers/find-output-file-in-bucket.js +0 -0
  172. package/dist/functions/helpers/format-costs-info.d.ts +0 -0
  173. package/dist/functions/helpers/format-costs-info.js +0 -0
  174. package/dist/functions/helpers/get-browser-instance.d.ts +2 -3
  175. package/dist/functions/helpers/get-browser-instance.js +9 -5
  176. package/dist/functions/helpers/get-chromium-executable-path.d.ts +1 -1
  177. package/dist/functions/helpers/get-chromium-executable-path.js +8 -6
  178. package/dist/functions/helpers/get-cleanup-progress.d.ts +0 -0
  179. package/dist/functions/helpers/get-cleanup-progress.js +0 -0
  180. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  181. package/dist/functions/helpers/get-current-region.js +0 -0
  182. package/dist/functions/helpers/get-custom-out-name.d.ts +0 -0
  183. package/dist/functions/helpers/get-custom-out-name.js +1 -1
  184. package/dist/functions/helpers/get-encoding-metadata.d.ts +5 -8
  185. package/dist/functions/helpers/get-encoding-metadata.js +7 -17
  186. package/dist/functions/helpers/get-files-in-folder.d.ts +1 -1
  187. package/dist/functions/helpers/get-files-in-folder.js +5 -5
  188. package/dist/functions/helpers/get-files-to-delete.d.ts +1 -1
  189. package/dist/functions/helpers/get-files-to-delete.js +0 -0
  190. package/dist/functions/helpers/get-final-encoding-status.d.ts +2 -4
  191. package/dist/functions/helpers/get-final-encoding-status.js +1 -4
  192. package/dist/functions/helpers/get-folder-size.d.ts +0 -0
  193. package/dist/functions/helpers/get-folder-size.js +0 -0
  194. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +2 -6
  195. package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -9
  196. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +0 -0
  197. package/dist/functions/helpers/get-output-url-from-metadata.js +0 -0
  198. package/dist/functions/helpers/get-overall-progress.d.ts +2 -1
  199. package/dist/functions/helpers/get-overall-progress.js +7 -5
  200. package/dist/functions/helpers/get-post-render-data.d.ts +0 -0
  201. package/dist/functions/helpers/get-post-render-data.js +0 -0
  202. package/dist/functions/helpers/get-progress.d.ts +0 -0
  203. package/dist/functions/helpers/get-progress.js +43 -42
  204. package/dist/functions/helpers/get-render-metadata.d.ts +0 -0
  205. package/dist/functions/helpers/get-render-metadata.js +0 -0
  206. package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
  207. package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
  208. package/dist/functions/helpers/get-retry-stats.d.ts +1 -1
  209. package/dist/functions/helpers/get-retry-stats.js +0 -0
  210. package/dist/functions/helpers/get-time-to-finish.d.ts +0 -0
  211. package/dist/functions/helpers/get-time-to-finish.js +0 -0
  212. package/dist/functions/helpers/inspect-errors.d.ts +0 -0
  213. package/dist/functions/helpers/inspect-errors.js +0 -0
  214. package/dist/functions/helpers/io.d.ts +10 -4
  215. package/dist/functions/helpers/io.js +25 -3
  216. package/dist/functions/helpers/is-enosp-err.d.ts +0 -0
  217. package/dist/functions/helpers/is-enosp-err.js +1 -1
  218. package/dist/functions/helpers/is-warm.d.ts +0 -0
  219. package/dist/functions/helpers/is-warm.js +0 -0
  220. package/dist/functions/helpers/make-timeout-error.d.ts +8 -0
  221. package/dist/functions/helpers/make-timeout-error.js +35 -0
  222. package/dist/functions/helpers/make-timeout-message.d.ts +6 -0
  223. package/dist/functions/helpers/make-timeout-message.js +31 -0
  224. package/dist/functions/helpers/min-max.d.ts +0 -0
  225. package/dist/functions/helpers/min-max.js +0 -0
  226. package/dist/functions/helpers/print-cloudwatch-helper.d.ts +0 -0
  227. package/dist/functions/helpers/print-cloudwatch-helper.js +0 -0
  228. package/dist/functions/helpers/print-concurrency-curve.d.ts +0 -0
  229. package/dist/functions/helpers/print-concurrency-curve.js +0 -0
  230. package/dist/functions/helpers/read-with-progress.d.ts +1 -1
  231. package/dist/functions/helpers/read-with-progress.js +1 -1
  232. package/dist/functions/helpers/streamify-response.d.ts +16 -0
  233. package/dist/functions/helpers/streamify-response.js +67 -0
  234. package/dist/functions/helpers/timer.d.ts +0 -0
  235. package/dist/functions/helpers/timer.js +0 -0
  236. package/dist/functions/helpers/validate-composition.d.ts +10 -9
  237. package/dist/functions/helpers/validate-composition.js +16 -13
  238. package/dist/functions/helpers/write-lambda-error.d.ts +2 -2
  239. package/dist/functions/helpers/write-lambda-error.js +0 -0
  240. package/dist/functions/helpers/write-post-render-data.d.ts +0 -0
  241. package/dist/functions/helpers/write-post-render-data.js +0 -0
  242. package/dist/functions/index.d.ts +1 -7
  243. package/dist/functions/index.js +43 -10
  244. package/dist/functions/info.d.ts +0 -0
  245. package/dist/functions/info.js +0 -0
  246. package/dist/functions/launch.d.ts +2 -1
  247. package/dist/functions/launch.js +151 -134
  248. package/dist/functions/progress.d.ts +1 -1
  249. package/dist/functions/progress.js +2 -2
  250. package/dist/functions/renderer.d.ts +1 -1
  251. package/dist/functions/renderer.js +73 -44
  252. package/dist/functions/start.d.ts +1 -1
  253. package/dist/functions/start.js +21 -8
  254. package/dist/functions/still.d.ts +1 -1
  255. package/dist/functions/still.js +78 -37
  256. package/dist/index.d.ts +24 -8
  257. package/dist/index.js +23 -6
  258. package/dist/internals.d.ts +3 -1
  259. package/dist/internals.js +3 -0
  260. package/dist/pricing/aws-regions.d.ts +3 -2
  261. package/dist/pricing/aws-regions.js +31 -1
  262. package/dist/pricing/price-per-1-s.d.ts +0 -0
  263. package/dist/pricing/price-per-1-s.js +413 -39
  264. package/dist/regions.d.ts +0 -0
  265. package/dist/regions.js +0 -0
  266. package/dist/shared/await.d.ts +1 -1
  267. package/dist/shared/await.js +0 -0
  268. package/dist/shared/aws-clients.d.ts +6 -3
  269. package/dist/shared/aws-clients.js +75 -13
  270. package/dist/shared/bundle-site.d.ts +0 -0
  271. package/dist/shared/bundle-site.js +0 -0
  272. package/dist/shared/call-lambda.d.ts +0 -0
  273. package/dist/shared/call-lambda.js +27 -2
  274. package/dist/shared/check-credentials.d.ts +0 -0
  275. package/dist/shared/check-credentials.js +3 -0
  276. package/dist/shared/chunk-progress.d.ts +9 -0
  277. package/dist/shared/chunk-progress.js +2034 -0
  278. package/dist/shared/cleanup-serialized-input-props.d.ts +7 -0
  279. package/dist/shared/cleanup-serialized-input-props.js +19 -0
  280. package/dist/shared/constants.d.ts +135 -89
  281. package/dist/shared/constants.js +7 -4
  282. package/dist/shared/content-disposition-header.d.ts +1 -1
  283. package/dist/shared/content-disposition-header.js +0 -0
  284. package/dist/shared/convert-to-serve-url.d.ts +5 -1
  285. package/dist/shared/convert-to-serve-url.js +1 -5
  286. package/dist/shared/deserialize-input-props.d.ts +8 -0
  287. package/dist/shared/deserialize-input-props.js +26 -0
  288. package/dist/shared/docs-url.d.ts +0 -0
  289. package/dist/shared/docs-url.js +0 -0
  290. package/dist/shared/function-zip-path.d.ts +1 -1
  291. package/dist/shared/function-zip-path.js +3 -3
  292. package/dist/shared/get-account-id.d.ts +0 -0
  293. package/dist/shared/get-account-id.js +4 -6
  294. package/dist/shared/{get-cloudwatch-stream-url.d.ts → get-aws-urls.d.ts} +7 -1
  295. package/dist/shared/get-aws-urls.js +12 -0
  296. package/dist/shared/get-etag.d.ts +1 -0
  297. package/dist/shared/get-etag.js +24 -0
  298. package/dist/shared/get-function-version.d.ts +0 -0
  299. package/dist/shared/get-function-version.js +0 -0
  300. package/dist/shared/get-most-expensive-chunks.d.ts +2 -2
  301. package/dist/shared/get-most-expensive-chunks.js +3 -2
  302. package/dist/shared/get-s3-operations.d.ts +10 -0
  303. package/dist/shared/get-s3-operations.js +36 -0
  304. package/dist/shared/hosted-layers.d.ts +5 -8
  305. package/dist/shared/hosted-layers.js +210 -284
  306. package/dist/shared/invoke-webhook.d.ts +5 -18
  307. package/dist/shared/invoke-webhook.js +4 -19
  308. package/dist/shared/is-in-lambda.d.ts +0 -0
  309. package/dist/shared/is-in-lambda.js +0 -0
  310. package/dist/shared/lambda-version-string.d.ts +0 -0
  311. package/dist/shared/lambda-version-string.js +0 -0
  312. package/dist/shared/make-s3-key.d.ts +0 -0
  313. package/dist/shared/make-s3-key.js +2 -2
  314. package/dist/shared/make-s3-url.d.ts +0 -0
  315. package/dist/shared/make-s3-url.js +2 -2
  316. package/dist/shared/p-limit.d.ts +0 -0
  317. package/dist/shared/p-limit.js +0 -0
  318. package/dist/shared/parse-chunk-key.d.ts +4 -0
  319. package/dist/shared/parse-chunk-key.js +14 -0
  320. package/dist/shared/parse-lambda-initialized-key.d.ts +0 -0
  321. package/dist/shared/parse-lambda-initialized-key.js +0 -0
  322. package/dist/shared/parse-lambda-timings-key.d.ts +1 -1
  323. package/dist/shared/parse-lambda-timings-key.js +0 -0
  324. package/dist/shared/random-hash.d.ts +0 -0
  325. package/dist/shared/random-hash.js +0 -0
  326. package/dist/shared/read-dir.d.ts +9 -0
  327. package/dist/shared/read-dir.js +57 -0
  328. package/dist/shared/return-values.d.ts +7 -0
  329. package/dist/shared/return-values.js +0 -0
  330. package/dist/shared/serialize-input-props.d.ts +8 -0
  331. package/dist/shared/serialize-input-props.js +42 -0
  332. package/dist/shared/sleep.d.ts +0 -0
  333. package/dist/shared/sleep.js +0 -0
  334. package/dist/shared/stream-to-string.d.ts +0 -0
  335. package/dist/shared/stream-to-string.js +0 -0
  336. package/dist/shared/truthy.d.ts +1 -1
  337. package/dist/shared/truthy.js +0 -0
  338. package/dist/shared/validate-aws-region.d.ts +0 -0
  339. package/dist/shared/validate-aws-region.js +0 -0
  340. package/dist/shared/validate-bucketname.d.ts +5 -0
  341. package/dist/shared/validate-bucketname.js +19 -1
  342. package/dist/shared/validate-custom-role-arn.d.ts +0 -0
  343. package/dist/shared/validate-custom-role-arn.js +0 -0
  344. package/dist/shared/validate-disk-size-in-mb.d.ts +0 -0
  345. package/dist/shared/validate-disk-size-in-mb.js +0 -0
  346. package/dist/shared/validate-download-behavior.d.ts +0 -0
  347. package/dist/shared/validate-download-behavior.js +0 -0
  348. package/dist/shared/validate-frames-per-lambda.d.ts +0 -0
  349. package/dist/shared/validate-frames-per-lambda.js +0 -0
  350. package/dist/shared/validate-lambda-codec.d.ts +2 -2
  351. package/dist/shared/validate-lambda-codec.js +1 -1
  352. package/dist/shared/validate-memory-size.d.ts +0 -0
  353. package/dist/shared/validate-memory-size.js +0 -0
  354. package/dist/shared/validate-outname.d.ts +2 -2
  355. package/dist/shared/validate-outname.js +16 -10
  356. package/dist/shared/validate-presign-expiration.d.ts +0 -0
  357. package/dist/shared/validate-presign-expiration.js +0 -0
  358. package/dist/shared/validate-privacy.d.ts +1 -1
  359. package/dist/shared/validate-privacy.js +5 -2
  360. package/dist/shared/validate-retention-period.d.ts +0 -0
  361. package/dist/shared/validate-retention-period.js +0 -0
  362. package/dist/shared/validate-retries.d.ts +0 -0
  363. package/dist/shared/validate-retries.js +0 -0
  364. package/dist/shared/validate-serveurl.d.ts +0 -0
  365. package/dist/shared/validate-serveurl.js +0 -0
  366. package/dist/shared/validate-site-name.d.ts +0 -0
  367. package/dist/shared/validate-site-name.js +0 -0
  368. package/dist/shared/validate-timeout.d.ts +0 -0
  369. package/dist/shared/validate-timeout.js +0 -0
  370. package/package.json +89 -65
  371. package/remotionlambda-arm64.zip +0 -0
  372. package/.prettierrc.js +0 -14
  373. package/client.d.ts +0 -1
  374. package/client.js +0 -1
  375. package/dist/api/enable-s3-website.d.ts +0 -5
  376. package/dist/api/enable-s3-website.js +0 -16
  377. package/dist/cli/helpers/determine-image-format.d.ts +0 -10
  378. package/dist/cli/helpers/determine-image-format.js +0 -47
  379. package/dist/cli/helpers/get-cloudwatch-stream-url.d.ts +0 -8
  380. package/dist/cli/helpers/get-cloudwatch-stream-url.js +0 -7
  381. package/dist/cli/helpers/webhook-types.d.ts +0 -6
  382. package/dist/cli/helpers/webhook-types.js +0 -2
  383. package/dist/functions/chunk-optimization/can-use-optimization.d.ts +0 -6
  384. package/dist/functions/chunk-optimization/can-use-optimization.js +0 -23
  385. package/dist/functions/chunk-optimization/collect-data.d.ts +0 -9
  386. package/dist/functions/chunk-optimization/collect-data.js +0 -27
  387. package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.d.ts +0 -3
  388. package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.js +0 -11
  389. package/dist/functions/chunk-optimization/get-profile-duration.d.ts +0 -3
  390. package/dist/functions/chunk-optimization/get-profile-duration.js +0 -18
  391. package/dist/functions/chunk-optimization/is-valid-profile.d.ts +0 -2
  392. package/dist/functions/chunk-optimization/is-valid-profile.js +0 -12
  393. package/dist/functions/chunk-optimization/optimize-invocation-order.d.ts +0 -2
  394. package/dist/functions/chunk-optimization/optimize-invocation-order.js +0 -19
  395. package/dist/functions/chunk-optimization/optimize-profile.d.ts +0 -9
  396. package/dist/functions/chunk-optimization/optimize-profile.js +0 -74
  397. package/dist/functions/chunk-optimization/s3-optimization-file.d.ts +0 -17
  398. package/dist/functions/chunk-optimization/s3-optimization-file.js +0 -47
  399. package/dist/functions/chunk-optimization/simulate-frame-ranges.d.ts +0 -7
  400. package/dist/functions/chunk-optimization/simulate-frame-ranges.js +0 -47
  401. package/dist/functions/chunk-optimization/sort-by-duration.d.ts +0 -2
  402. package/dist/functions/chunk-optimization/sort-by-duration.js +0 -25
  403. package/dist/functions/helpers/get-current-architecture.d.ts +0 -2
  404. package/dist/functions/helpers/get-current-architecture.js +0 -11
  405. package/dist/shared/get-cloudwatch-stream-url.js +0 -7
  406. package/dist/shared/validate-architecture.d.ts +0 -4
  407. package/dist/shared/validate-architecture.js +0 -14
  408. package/remotionlambda.zip +0 -0
  409. package/tsconfig.json +0 -16
@@ -7,7 +7,6 @@ const constants_1 = require("../shared/constants");
7
7
  const function_zip_path_1 = require("../shared/function-zip-path");
8
8
  const get_account_id_1 = require("../shared/get-account-id");
9
9
  const lambda_version_string_1 = require("../shared/lambda-version-string");
10
- const validate_architecture_1 = require("../shared/validate-architecture");
11
10
  const validate_aws_region_1 = require("../shared/validate-aws-region");
12
11
  const validate_custom_role_arn_1 = require("../shared/validate-custom-role-arn");
13
12
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
@@ -17,54 +16,52 @@ const validate_timeout_1 = require("../shared/validate-timeout");
17
16
  const create_function_1 = require("./create-function");
18
17
  /**
19
18
  * @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
20
- * @link https://remotion.dev/docs/lambda/deployfunction
21
- * @param options.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
22
- * @param options.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
23
- * @param options.region The region you want to deploy your function to.
24
- * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
25
- * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
26
- * @param options.architecture The architecture Lambda should run on. One of x86_64 and x64
27
- * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
19
+ * @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
20
+ * @param params.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
21
+ * @param params.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
22
+ * @param params.region The region you want to deploy your function to.
23
+ * @param params.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
24
+ * @param params.memorySizeInMb How much memory should be allocated to the Lambda function.
25
+ * @param params.architecture The architecture Lambda should run on. One of x86_64 and x64
26
+ * @param params.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
28
27
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
29
28
  */
30
- const deployFunction = async (options) => {
29
+ const deployFunction = async (params) => {
31
30
  var _a, _b;
32
- const diskSizeInMb = (_a = options.diskSizeInMb) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB;
33
- (0, validate_memory_size_1.validateMemorySize)(options.memorySizeInMb);
34
- (0, validate_timeout_1.validateTimeout)(options.timeoutInSeconds);
35
- (0, validate_aws_region_1.validateAwsRegion)(options.region);
36
- (0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(options.cloudWatchLogRetentionPeriodInDays);
37
- (0, validate_architecture_1.validateArchitecture)(options.architecture);
31
+ const diskSizeInMb = (_a = params.diskSizeInMb) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB;
32
+ (0, validate_memory_size_1.validateMemorySize)(params.memorySizeInMb);
33
+ (0, validate_timeout_1.validateTimeout)(params.timeoutInSeconds);
34
+ (0, validate_aws_region_1.validateAwsRegion)(params.region);
35
+ (0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(params.cloudWatchLogRetentionPeriodInDays);
38
36
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
39
- (0, validate_custom_role_arn_1.validateCustomRoleArn)(options.customRoleArn);
37
+ (0, validate_custom_role_arn_1.validateCustomRoleArn)(params.customRoleArn);
40
38
  const fnNameRender = [
41
39
  `${constants_1.RENDER_FN_PREFIX}${lambda_version_string_1.LAMBDA_VERSION_STRING}`,
42
- `mem${options.memorySizeInMb}mb`,
40
+ `mem${params.memorySizeInMb}mb`,
43
41
  `disk${diskSizeInMb}mb`,
44
- `${options.timeoutInSeconds}sec`,
42
+ `${params.timeoutInSeconds}sec`,
45
43
  ].join('-');
46
- const accountId = await (0, get_account_id_1.getAccountId)({ region: options.region });
44
+ const accountId = await (0, get_account_id_1.getAccountId)({ region: params.region });
47
45
  const fns = await (0, get_functions_1.getFunctions)({
48
46
  compatibleOnly: true,
49
- region: options.region,
47
+ region: params.region,
50
48
  });
51
49
  const alreadyDeployed = fns.find((f) => f.version === version_1.VERSION &&
52
- f.memorySizeInMb === options.memorySizeInMb &&
53
- f.timeoutInSeconds === options.timeoutInSeconds &&
50
+ f.memorySizeInMb === params.memorySizeInMb &&
51
+ f.timeoutInSeconds === params.timeoutInSeconds &&
54
52
  f.diskSizeInMb === diskSizeInMb);
55
53
  const created = await (0, create_function_1.createFunction)({
56
- createCloudWatchLogGroup: options.createCloudWatchLogGroup,
57
- region: options.region,
58
- zipFile: function_zip_path_1.FUNCTION_ZIP,
54
+ createCloudWatchLogGroup: params.createCloudWatchLogGroup,
55
+ region: params.region,
56
+ zipFile: function_zip_path_1.FUNCTION_ZIP_ARM64,
59
57
  functionName: fnNameRender,
60
58
  accountId,
61
- memorySizeInMb: options.memorySizeInMb,
62
- timeoutInSeconds: options.timeoutInSeconds,
63
- retentionInDays: (_b = options.cloudWatchLogRetentionPeriodInDays) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
59
+ memorySizeInMb: params.memorySizeInMb,
60
+ timeoutInSeconds: params.timeoutInSeconds,
61
+ retentionInDays: (_b = params.cloudWatchLogRetentionPeriodInDays) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
64
62
  alreadyCreated: Boolean(alreadyDeployed),
65
- architecture: options.architecture,
66
63
  ephemerealStorageInMb: diskSizeInMb,
67
- customRoleArn: options.customRoleArn,
64
+ customRoleArn: params.customRoleArn,
68
65
  });
69
66
  if (!created.FunctionName) {
70
67
  throw new Error('Lambda was created but has no name');
@@ -1,7 +1,7 @@
1
- import type { WebpackOverrideFn } from 'remotion';
1
+ import type { WebpackOverrideFn } from '@remotion/bundler';
2
2
  import type { AwsRegion } from '../pricing/aws-regions';
3
3
  import type { UploadDirProgress } from './upload-dir';
4
- export declare type DeploySiteInput = {
4
+ export type DeploySiteInput = {
5
5
  entryPoint: string;
6
6
  bucketName: string;
7
7
  region: AwsRegion;
@@ -10,22 +10,30 @@ export declare type DeploySiteInput = {
10
10
  onBundleProgress?: (progress: number) => void;
11
11
  onUploadProgress?: (upload: UploadDirProgress) => void;
12
12
  webpackOverride?: WebpackOverrideFn;
13
+ ignoreRegisterRootWarning?: boolean;
13
14
  enableCaching?: boolean;
14
15
  publicDir?: string | null;
15
16
  rootDir?: string;
17
+ bypassBucketNameValidation?: boolean;
16
18
  };
19
+ privacy?: 'public' | 'no-acl';
17
20
  };
18
- export declare type DeploySiteOutput = Promise<{
21
+ export type DeploySiteOutput = Promise<{
19
22
  serveUrl: string;
20
23
  siteName: string;
24
+ stats: {
25
+ uploadedFiles: number;
26
+ deletedFiles: number;
27
+ untouchedFiles: number;
28
+ };
21
29
  }>;
22
30
  /**
23
31
  * @description Deploys a Remotion project to an S3 bucket to prepare it for rendering on AWS Lambda.
24
- * @link https://remotion.dev/docs/lambda/deploysite
32
+ * @see [Documentation](https://remotion.dev/docs/lambda/deploysite)
25
33
  * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
26
34
  * @param {string} params.entryPoint An absolute path to the entry file of your Remotion project.
27
35
  * @param {string} params.bucketName The name of the bucket to deploy your project into.
28
36
  * @param {string} params.siteName The name of the folder in which the project gets deployed to.
29
37
  * @param {object} params.options Further options, see documentation page for this function.
30
38
  */
31
- export declare const deploySite: ({ bucketName, entryPoint, siteName, options, region, }: DeploySiteInput) => DeploySiteOutput;
39
+ export declare const deploySite: ({ bucketName, entryPoint, siteName, options, region, privacy: passedPrivacy, }: DeploySiteInput) => DeploySiteOutput;
@@ -1,72 +1,108 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.deploySite = void 0;
4
- const delete_site_1 = require("../api/delete-site");
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const io_1 = require("../functions/helpers/io");
5
9
  const bundle_site_1 = require("../shared/bundle-site");
6
10
  const constants_1 = require("../shared/constants");
7
11
  const get_account_id_1 = require("../shared/get-account-id");
12
+ const get_s3_operations_1 = require("../shared/get-s3-operations");
8
13
  const make_s3_url_1 = require("../shared/make-s3-url");
9
14
  const random_hash_1 = require("../shared/random-hash");
10
15
  const validate_aws_region_1 = require("../shared/validate-aws-region");
11
16
  const validate_bucketname_1 = require("../shared/validate-bucketname");
17
+ const validate_privacy_1 = require("../shared/validate-privacy");
12
18
  const validate_site_name_1 = require("../shared/validate-site-name");
13
19
  const bucket_exists_1 = require("./bucket-exists");
14
- const enable_s3_website_1 = require("./enable-s3-website");
15
20
  const upload_dir_1 = require("./upload-dir");
16
21
  /**
17
22
  * @description Deploys a Remotion project to an S3 bucket to prepare it for rendering on AWS Lambda.
18
- * @link https://remotion.dev/docs/lambda/deploysite
23
+ * @see [Documentation](https://remotion.dev/docs/lambda/deploysite)
19
24
  * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
20
25
  * @param {string} params.entryPoint An absolute path to the entry file of your Remotion project.
21
26
  * @param {string} params.bucketName The name of the bucket to deploy your project into.
22
27
  * @param {string} params.siteName The name of the folder in which the project gets deployed to.
23
28
  * @param {object} params.options Further options, see documentation page for this function.
24
29
  */
25
- const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }) => {
30
+ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, privacy: passedPrivacy, }) => {
26
31
  var _a, _b, _c, _d;
27
32
  (0, validate_aws_region_1.validateAwsRegion)(region);
28
- (0, validate_bucketname_1.validateBucketName)(bucketName, { mustStartWithRemotion: true });
33
+ (0, validate_bucketname_1.validateBucketName)(bucketName, {
34
+ mustStartWithRemotion: !(options === null || options === void 0 ? void 0 : options.bypassBucketNameValidation),
35
+ });
29
36
  const siteId = siteName !== null && siteName !== void 0 ? siteName : (0, random_hash_1.randomHash)();
30
37
  (0, validate_site_name_1.validateSiteName)(siteId);
38
+ const privacy = passedPrivacy !== null && passedPrivacy !== void 0 ? passedPrivacy : 'public';
39
+ (0, validate_privacy_1.validatePrivacy)(privacy, false);
40
+ const accountId = await (0, get_account_id_1.getAccountId)({ region });
31
41
  const bucketExists = await (0, bucket_exists_1.bucketExistsInRegion)({
32
42
  bucketName,
33
43
  region,
34
- expectedBucketOwner: await (0, get_account_id_1.getAccountId)({ region }),
44
+ expectedBucketOwner: accountId,
35
45
  });
36
46
  if (!bucketExists) {
37
47
  throw new Error(`No bucket with the name ${bucketName} exists`);
38
48
  }
39
49
  const subFolder = (0, constants_1.getSitesKey)(siteId);
40
- await (0, delete_site_1.deleteSite)({
41
- bucketName,
42
- onAfterItemDeleted: () => undefined,
43
- region,
44
- siteName: siteId,
45
- });
46
- const bundled = await (0, bundle_site_1.bundleSite)(entryPoint, (_a = options === null || options === void 0 ? void 0 : options.onBundleProgress) !== null && _a !== void 0 ? _a : (() => undefined), {
47
- publicPath: `/${subFolder}/`,
48
- webpackOverride: (_b = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _b !== void 0 ? _b : ((f) => f),
49
- enableCaching: (_c = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _c !== void 0 ? _c : true,
50
- publicDir: options === null || options === void 0 ? void 0 : options.publicDir,
51
- rootDir: options === null || options === void 0 ? void 0 : options.rootDir,
50
+ const [files, bundled] = await Promise.all([
51
+ (0, io_1.lambdaLs)({
52
+ bucketName,
53
+ expectedBucketOwner: accountId,
54
+ region,
55
+ // The `/` is important to not accidentially delete sites with the same name but containing a suffix.
56
+ prefix: `${subFolder}/`,
57
+ }),
58
+ (0, bundle_site_1.bundleSite)({
59
+ publicPath: `/${subFolder}/`,
60
+ webpackOverride: (_a = options === null || options === void 0 ? void 0 : options.webpackOverride) !== null && _a !== void 0 ? _a : ((f) => f),
61
+ enableCaching: (_b = options === null || options === void 0 ? void 0 : options.enableCaching) !== null && _b !== void 0 ? _b : true,
62
+ publicDir: options === null || options === void 0 ? void 0 : options.publicDir,
63
+ rootDir: options === null || options === void 0 ? void 0 : options.rootDir,
64
+ ignoreRegisterRootWarning: options === null || options === void 0 ? void 0 : options.ignoreRegisterRootWarning,
65
+ onProgress: (_c = options === null || options === void 0 ? void 0 : options.onBundleProgress) !== null && _c !== void 0 ? _c : (() => undefined),
66
+ entryPoint,
67
+ }),
68
+ ]);
69
+ const { toDelete, toUpload, existingCount } = await (0, get_s3_operations_1.getS3DiffOperations)({
70
+ objects: files,
71
+ bundle: bundled,
72
+ prefix: subFolder,
52
73
  });
53
74
  await Promise.all([
54
75
  (0, upload_dir_1.uploadDir)({
55
76
  bucket: bucketName,
56
77
  region,
57
- dir: bundled,
78
+ localDir: bundled,
58
79
  onProgress: (_d = options === null || options === void 0 ? void 0 : options.onUploadProgress) !== null && _d !== void 0 ? _d : (() => undefined),
59
- folder: subFolder,
60
- privacy: 'public',
61
- }),
62
- (0, enable_s3_website_1.enableS3Website)({
63
- region,
64
- bucketName,
80
+ keyPrefix: subFolder,
81
+ privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
82
+ toUpload,
65
83
  }),
84
+ Promise.all(toDelete.map((d) => {
85
+ return (0, io_1.lambdaDeleteFile)({
86
+ bucketName,
87
+ customCredentials: null,
88
+ key: d.Key,
89
+ region,
90
+ });
91
+ })),
66
92
  ]);
93
+ if (!process.env.VITEST) {
94
+ node_fs_1.default.rmSync(bundled, {
95
+ recursive: true,
96
+ });
97
+ }
67
98
  return {
68
99
  serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({ bucketName, subFolder, region }),
69
100
  siteName: siteId,
101
+ stats: {
102
+ uploadedFiles: toUpload.length,
103
+ deletedFiles: toDelete.length,
104
+ untouchedFiles: existingCount,
105
+ },
70
106
  };
71
107
  };
72
108
  exports.deploySite = deploySite;
@@ -1,7 +1,7 @@
1
1
  import type { LambdaReadFileProgress } from '../functions/helpers/read-with-progress';
2
2
  import type { AwsRegion } from '../pricing/aws-regions';
3
3
  import type { CustomCredentials } from '../shared/aws-clients';
4
- export declare type DownloadMediaInput = {
4
+ export type DownloadMediaInput = {
5
5
  region: AwsRegion;
6
6
  bucketName: string;
7
7
  renderId: string;
@@ -9,13 +9,13 @@ export declare type DownloadMediaInput = {
9
9
  onProgress?: LambdaReadFileProgress;
10
10
  customCredentials?: CustomCredentials;
11
11
  };
12
- export declare type DownloadMediaOutput = {
12
+ export type DownloadMediaOutput = {
13
13
  outputPath: string;
14
14
  sizeInBytes: number;
15
15
  };
16
16
  /**
17
- * @description Triggers a render on a lambda given a composition and a lambda function.
18
- * @link https://remotion.dev/docs/lambda/downloadmedia
17
+ * @description Downloads a rendered video, audio or still to the disk of the machine this API is called from.
18
+ * @see [Documentation](https://remotion.dev/docs/lambda/downloadmedia)
19
19
  * @param params.region The AWS region in which the media resides.
20
20
  * @param params.bucketName The `bucketName` that was specified during the render.
21
21
  * @param params.renderId The `renderId` that was obtained after triggering the render.
@@ -25,7 +25,3 @@ export declare type DownloadMediaOutput = {
25
25
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
26
26
  */
27
27
  export declare const downloadMedia: (input: DownloadMediaInput) => Promise<DownloadMediaOutput>;
28
- /**
29
- * @deprecated Renamed to downloadMedia()
30
- */
31
- export declare const downloadVideo: (input: DownloadMediaInput) => Promise<DownloadMediaOutput>;
@@ -3,16 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadVideo = exports.downloadMedia = void 0;
6
+ exports.downloadMedia = void 0;
7
7
  const renderer_1 = require("@remotion/renderer");
8
- const path_1 = __importDefault(require("path"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const expected_out_name_1 = require("../functions/helpers/expected-out-name");
10
10
  const get_render_metadata_1 = require("../functions/helpers/get-render-metadata");
11
11
  const read_with_progress_1 = require("../functions/helpers/read-with-progress");
12
12
  const get_account_id_1 = require("../shared/get-account-id");
13
13
  /**
14
- * @description Triggers a render on a lambda given a composition and a lambda function.
15
- * @link https://remotion.dev/docs/lambda/downloadmedia
14
+ * @description Downloads a rendered video, audio or still to the disk of the machine this API is called from.
15
+ * @see [Documentation](https://remotion.dev/docs/lambda/downloadmedia)
16
16
  * @param params.region The AWS region in which the media resides.
17
17
  * @param params.bucketName The `bucketName` that was specified during the render.
18
18
  * @param params.renderId The `renderId` that was obtained after triggering the render.
@@ -32,7 +32,7 @@ const downloadMedia = async (input) => {
32
32
  region: input.region,
33
33
  renderId: input.renderId,
34
34
  });
35
- const outputPath = path_1.default.resolve(process.cwd(), input.outPath);
35
+ const outputPath = node_path_1.default.resolve(process.cwd(), input.outPath);
36
36
  renderer_1.RenderInternals.ensureOutputDirectory(outputPath);
37
37
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
38
38
  const { sizeInBytes } = await (0, read_with_progress_1.lambdaDownloadFileWithProgress)({
@@ -50,7 +50,3 @@ const downloadMedia = async (input) => {
50
50
  };
51
51
  };
52
52
  exports.downloadMedia = downloadMedia;
53
- /**
54
- * @deprecated Renamed to downloadMedia()
55
- */
56
- exports.downloadVideo = exports.downloadMedia;
@@ -1,17 +1,15 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- import type { LambdaArchitecture } from '../shared/validate-architecture';
3
- export declare type EstimatePriceInput = {
2
+ export type EstimatePriceInput = {
4
3
  region: AwsRegion;
5
4
  durationInMiliseconds: number;
6
5
  memorySizeInMb: number;
7
6
  diskSizeInMb: number;
8
- architecture: LambdaArchitecture;
9
7
  lambdasInvoked: number;
10
8
  };
11
9
  /**
12
10
  *
13
11
  * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
14
- * @link https://remotion.dev/docs/lambda/estimateprice
12
+ * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
15
13
  * @returns {number} Price in USD
16
14
  */
17
- export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, architecture, lambdasInvoked, }: EstimatePriceInput) => number;
15
+ export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }: EstimatePriceInput) => number;
@@ -3,20 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.estimatePrice = void 0;
4
4
  const defaults_1 = require("../defaults");
5
5
  const price_per_1_s_1 = require("../pricing/price-per-1-s");
6
- const validate_architecture_1 = require("../shared/validate-architecture");
7
6
  const validate_aws_region_1 = require("../shared/validate-aws-region");
8
7
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
9
8
  const validate_memory_size_1 = require("../shared/validate-memory-size");
10
9
  /**
11
10
  *
12
11
  * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
13
- * @link https://remotion.dev/docs/lambda/estimateprice
12
+ * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
14
13
  * @returns {number} Price in USD
15
14
  */
16
- const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, architecture, lambdasInvoked, }) => {
15
+ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }) => {
17
16
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
18
17
  (0, validate_aws_region_1.validateAwsRegion)(region);
19
- (0, validate_architecture_1.validateArchitecture)(architecture);
20
18
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
21
19
  if (typeof durationInMiliseconds !== 'number') {
22
20
  throw new TypeError(`Parameter 'durationInMiliseconds' must be a number but got ${typeof durationInMiliseconds}`);
@@ -30,15 +28,11 @@ const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSize
30
28
  if (durationInMiliseconds < 0) {
31
29
  throw new TypeError(`Parameter 'durationInMiliseconds' must be over 0 but it is ${durationInMiliseconds}.`);
32
30
  }
33
- const durationPrice = architecture === 'x86_64'
34
- ? price_per_1_s_1.pricing[region]['Lambda Duration'].price
35
- : price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
31
+ const durationPrice = price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
36
32
  // In GB-second
37
33
  const timeCostDollars = Number(durationPrice) *
38
34
  ((memorySizeInMb * durationInMiliseconds) / 1000 / 1024);
39
- const diskSizePrice = architecture === 'x86_64'
40
- ? price_per_1_s_1.pricing[region]['Lambda Storage-Duration'].price
41
- : price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
35
+ const diskSizePrice = price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
42
36
  const chargedDiskSize = Math.max(0, diskSizeInMb - defaults_1.MIN_EPHEMERAL_STORAGE_IN_MB);
43
37
  // In GB-second
44
38
  const diskSizeDollars = chargedDiskSize *
@@ -3,27 +3,29 @@ import * as IamSdk from '@aws-sdk/client-iam';
3
3
  import * as LambdaSDK from '@aws-sdk/client-lambda';
4
4
  import * as S3SDK from '@aws-sdk/client-s3';
5
5
  import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
6
+ import * as StsSdk from '@aws-sdk/client-sts';
6
7
  import type { AwsRegion } from '../client';
7
8
  import type { CustomCredentials, ServiceMapping } from '../shared/aws-clients';
8
- export declare type GetAwsClientInput<T extends keyof ServiceMapping> = {
9
+ export type GetAwsClientInput<T extends keyof ServiceMapping> = {
9
10
  region: AwsRegion;
10
11
  service: T;
11
12
  customCredentials?: CustomCredentials | null;
12
13
  };
13
- declare type SdkMapping = {
14
+ type SdkMapping = {
14
15
  s3: typeof S3SDK;
15
16
  cloudwatch: typeof CloudWatchSDK;
16
17
  iam: typeof IamSdk;
17
18
  lambda: typeof LambdaSDK;
18
19
  servicequotas: typeof ServiceQuotasSDK;
20
+ sts: typeof StsSdk;
19
21
  };
20
- export declare type GetAwsClientOutput<T extends keyof ServiceMapping> = {
22
+ export type GetAwsClientOutput<T extends keyof ServiceMapping> = {
21
23
  client: ServiceMapping[T];
22
24
  sdk: SdkMapping[T];
23
25
  };
24
26
  /**
25
27
  * @description Gets the full AWS SDK and an instantiated client for an AWS service
26
- * @link https://remotion.dev/docs/lambda/getawsclient
28
+ * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
27
29
  * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
28
30
  * @param {string} params.service One of `iam`, `s3`, `cloudwatch`, `iam` or `servicequotas`
29
31
  * @param {CustomCredentials} params.customCredentials Pass endpoint and credentials if you want to connect to a different cloud for S3
@@ -29,10 +29,11 @@ const IamSdk = __importStar(require("@aws-sdk/client-iam"));
29
29
  const LambdaSDK = __importStar(require("@aws-sdk/client-lambda"));
30
30
  const S3SDK = __importStar(require("@aws-sdk/client-s3"));
31
31
  const ServiceQuotasSDK = __importStar(require("@aws-sdk/client-service-quotas"));
32
+ const StsSdk = __importStar(require("@aws-sdk/client-sts"));
32
33
  const aws_clients_1 = require("../shared/aws-clients");
33
34
  /**
34
35
  * @description Gets the full AWS SDK and an instantiated client for an AWS service
35
- * @link https://remotion.dev/docs/lambda/getawsclient
36
+ * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
36
37
  * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
37
38
  * @param {string} params.service One of `iam`, `s3`, `cloudwatch`, `iam` or `servicequotas`
38
39
  * @param {CustomCredentials} params.customCredentials Pass endpoint and credentials if you want to connect to a different cloud for S3
@@ -51,6 +52,7 @@ const getAwsClient = ({ region, service, customCredentials, }) => {
51
52
  iam: IamSdk,
52
53
  s3: S3SDK,
53
54
  servicequotas: ServiceQuotasSDK,
55
+ sts: StsSdk,
54
56
  }[service],
55
57
  };
56
58
  };
@@ -1,9 +1,9 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare type BucketWithLocation = {
2
+ export type BucketWithLocation = {
3
3
  name: string;
4
4
  creationDate: number;
5
5
  region: AwsRegion;
6
6
  };
7
- export declare const getRemotionS3Buckets: (region: AwsRegion) => Promise<{
7
+ export declare const getRemotionS3Buckets: (region: AwsRegion, forceBucketName?: string) => Promise<{
8
8
  remotionBuckets: BucketWithLocation[];
9
9
  }>;
@@ -2,28 +2,51 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRemotionS3Buckets = void 0;
4
4
  const client_s3_1 = require("@aws-sdk/client-s3");
5
+ const defaults_1 = require("../defaults");
5
6
  const aws_clients_1 = require("../shared/aws-clients");
6
- const constants_1 = require("../shared/constants");
7
- const getRemotionS3Buckets = async (region) => {
7
+ const validate_bucketname_1 = require("../shared/validate-bucketname");
8
+ const getRemotionS3Buckets = async (region, forceBucketName) => {
8
9
  const { Buckets } = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.ListBucketsCommand({}));
9
10
  if (!Buckets) {
10
11
  return { remotionBuckets: [] };
11
12
  }
12
- const remotionBuckets = Buckets.filter((b) => { var _a; return (_a = b.Name) === null || _a === void 0 ? void 0 : _a.startsWith(constants_1.REMOTION_BUCKET_PREFIX); });
13
- const locations = await Promise.all(remotionBuckets.map((bucket) => {
14
- return (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.GetBucketLocationCommand({
15
- Bucket: bucket.Name,
16
- }));
17
- }));
18
- const bucketsWithLocation = remotionBuckets.map((bucket, i) => {
13
+ const remotionBuckets = Buckets.filter((b) => {
19
14
  var _a;
15
+ if (forceBucketName) {
16
+ return b.Name === forceBucketName;
17
+ }
18
+ return (_a = b.Name) === null || _a === void 0 ? void 0 : _a.startsWith(defaults_1.REMOTION_BUCKET_PREFIX);
19
+ });
20
+ const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
21
+ var _a, _b;
22
+ const { region: parsedRegion } = (0, validate_bucketname_1.parseBucketName)(bucket.Name);
23
+ if (parsedRegion) {
24
+ return parsedRegion;
25
+ }
26
+ try {
27
+ const result = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.GetBucketLocationCommand({
28
+ Bucket: bucket.Name,
29
+ }));
30
+ // AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
31
+ return (_a = result.LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1';
32
+ }
33
+ catch (err) {
34
+ // Sometimes the API returns a bucket even if it was deleted before
35
+ if ((_b = err.stack) === null || _b === void 0 ? void 0 : _b.includes('NoSuchBucket')) {
36
+ return null;
37
+ }
38
+ throw err;
39
+ }
40
+ }));
41
+ const bucketsWithLocation = remotionBuckets
42
+ .map((bucket, i) => {
20
43
  return {
21
44
  creationDate: bucket.CreationDate.getTime(),
22
45
  name: bucket.Name,
23
- // AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
24
- region: ((_a = locations[i].LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1'),
46
+ region: locations[i],
25
47
  };
26
- });
48
+ })
49
+ .filter((b) => b.region);
27
50
  return {
28
51
  remotionBuckets: bucketsWithLocation.filter((bucket) => {
29
52
  return bucket.region === region;
@@ -0,0 +1,33 @@
1
+ import type { ChromiumOptions, LogLevel } from '@remotion/renderer';
2
+ import type { AnyCompMetadata } from 'remotion';
3
+ import type { AwsRegion } from '../client';
4
+ export type GetCompositionsOnLambdaInput = {
5
+ chromiumOptions?: ChromiumOptions;
6
+ region: AwsRegion;
7
+ inputProps: Record<string, unknown>;
8
+ functionName: string;
9
+ serveUrl: string;
10
+ envVariables?: Record<string, string>;
11
+ logLevel?: LogLevel;
12
+ timeoutInMilliseconds?: number;
13
+ forceBucketName?: string;
14
+ /**
15
+ * @deprecated in favor of `logLevel`: true
16
+ */
17
+ dumpBrowserLogs?: boolean;
18
+ };
19
+ export type GetCompositionsOnLambdaOutput = AnyCompMetadata[];
20
+ /**
21
+ * @description Returns the compositions from a serveUrl
22
+ * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
23
+ * @param params.functionName The name of the Lambda function that should be used
24
+ * @param params.serveUrl The URL of the deployed project
25
+ * @param params.inputProps The input props that should be passed while the compositions are evaluated.
26
+ * @param params.envVariables Object containing environment variables to be inserted into the video environment
27
+ * @param params.region The AWS region in which the video should be rendered.
28
+ * @param params.logLevel The log level of the Lambda function
29
+ * @param params.timeoutInMilliseconds The timeout of the Lambda function
30
+ * @param params.chromiumOptions The options to pass to Chromium
31
+ * @returns The compositions
32
+ */
33
+ export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompositionsOnLambda = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const version_1 = require("remotion/version");
6
+ const defaults_1 = require("../defaults");
7
+ const call_lambda_1 = require("../shared/call-lambda");
8
+ const serialize_input_props_1 = require("../shared/serialize-input-props");
9
+ /**
10
+ * @description Returns the compositions from a serveUrl
11
+ * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
12
+ * @param params.functionName The name of the Lambda function that should be used
13
+ * @param params.serveUrl The URL of the deployed project
14
+ * @param params.inputProps The input props that should be passed while the compositions are evaluated.
15
+ * @param params.envVariables Object containing environment variables to be inserted into the video environment
16
+ * @param params.region The AWS region in which the video should be rendered.
17
+ * @param params.logLevel The log level of the Lambda function
18
+ * @param params.timeoutInMilliseconds The timeout of the Lambda function
19
+ * @param params.chromiumOptions The options to pass to Chromium
20
+ * @returns The compositions
21
+ */
22
+ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, }) => {
23
+ var _a;
24
+ const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
25
+ inputProps,
26
+ region,
27
+ type: 'still',
28
+ userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
29
+ });
30
+ try {
31
+ const res = await (0, call_lambda_1.callLambda)({
32
+ functionName,
33
+ type: defaults_1.LambdaRoutines.compositions,
34
+ payload: {
35
+ chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
36
+ serveUrl,
37
+ envVariables,
38
+ inputProps: serializedInputProps,
39
+ logLevel: dumpBrowserLogs
40
+ ? 'verbose'
41
+ : logLevel !== null && logLevel !== void 0 ? logLevel : renderer_1.RenderInternals.getLogLevel(),
42
+ timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
43
+ version: version_1.VERSION,
44
+ bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
45
+ },
46
+ region,
47
+ });
48
+ return res.compositions;
49
+ }
50
+ catch (err) {
51
+ if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
52
+ throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
53
+ }
54
+ throw err;
55
+ }
56
+ };
57
+ exports.getCompositionsOnLambda = getCompositionsOnLambda;