@remotion/lambda 4.0.244 → 4.0.246

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 (258) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/admin/make-layer-public.js +10 -11
  3. package/dist/api/app-router-webhook.d.ts +10 -0
  4. package/dist/api/app-router-webhook.js +43 -0
  5. package/dist/api/create-function.d.ts +1 -2
  6. package/dist/api/create-function.js +10 -10
  7. package/dist/api/delete-function.d.ts +4 -13
  8. package/dist/api/delete-function.js +2 -5
  9. package/dist/api/delete-render.d.ts +0 -8
  10. package/dist/api/delete-render.js +4 -10
  11. package/dist/api/delete-site.d.ts +0 -10
  12. package/dist/api/delete-site.js +4 -11
  13. package/dist/api/deploy-function.d.ts +8 -15
  14. package/dist/api/deploy-function.js +21 -27
  15. package/dist/api/deploy-site.d.ts +2 -11
  16. package/dist/api/deploy-site.js +14 -22
  17. package/dist/api/download-media.d.ts +0 -11
  18. package/dist/api/download-media.js +3 -12
  19. package/dist/api/estimate-price.d.ts +0 -6
  20. package/dist/api/estimate-price.js +1 -3
  21. package/dist/api/get-aws-client.d.ts +1 -9
  22. package/dist/api/get-aws-client.js +2 -6
  23. package/dist/api/get-compositions-on-lambda.d.ts +1 -14
  24. package/dist/api/get-compositions-on-lambda.js +12 -17
  25. package/dist/api/get-function-info.d.ts +1 -14
  26. package/dist/api/get-function-info.js +2 -5
  27. package/dist/api/get-functions.d.ts +1 -8
  28. package/dist/api/get-functions.js +2 -5
  29. package/dist/api/get-or-create-bucket.d.ts +0 -6
  30. package/dist/api/get-or-create-bucket.js +3 -5
  31. package/dist/api/get-regions.d.ts +0 -5
  32. package/dist/api/get-regions.js +3 -4
  33. package/dist/api/get-render-progress.d.ts +0 -10
  34. package/dist/api/get-render-progress.js +3 -11
  35. package/dist/api/get-sites.d.ts +0 -6
  36. package/dist/api/get-sites.js +4 -7
  37. package/dist/api/iam-validation/simulate.d.ts +0 -7
  38. package/dist/api/iam-validation/simulate.js +2 -5
  39. package/dist/api/iam-validation/suggested-policy.d.ts +0 -10
  40. package/dist/api/iam-validation/suggested-policy.js +2 -4
  41. package/dist/api/make-lambda-payload.d.ts +2 -1
  42. package/dist/api/make-lambda-payload.js +19 -13
  43. package/dist/api/pages-router-webhook.d.ts +3 -0
  44. package/dist/api/pages-router-webhook.js +47 -0
  45. package/dist/api/presign-url.d.ts +0 -10
  46. package/dist/api/presign-url.js +2 -8
  47. package/dist/api/render-media-on-lambda.d.ts +1 -20
  48. package/dist/api/render-media-on-lambda.js +4 -19
  49. package/dist/api/render-still-on-lambda.d.ts +2 -19
  50. package/dist/api/render-still-on-lambda.js +6 -17
  51. package/dist/api/speculate-function-name.d.ts +0 -8
  52. package/dist/api/speculate-function-name.js +3 -7
  53. package/dist/api/upload-dir.d.ts +1 -7
  54. package/dist/api/upload-dir.js +1 -5
  55. package/dist/api/validate-webhook-signature.d.ts +0 -8
  56. package/dist/api/validate-webhook-signature.js +3 -7
  57. package/dist/cli/args.d.ts +2 -1
  58. package/dist/cli/commands/compositions/index.d.ts +7 -1
  59. package/dist/cli/commands/compositions/index.js +2 -2
  60. package/dist/cli/commands/functions/deploy.d.ts +7 -1
  61. package/dist/cli/commands/functions/deploy.js +7 -2
  62. package/dist/cli/commands/functions/index.d.ts +8 -1
  63. package/dist/cli/commands/functions/index.js +8 -4
  64. package/dist/cli/commands/functions/ls.d.ts +6 -1
  65. package/dist/cli/commands/functions/ls.js +2 -3
  66. package/dist/cli/commands/functions/rmall.d.ts +6 -1
  67. package/dist/cli/commands/functions/rmall.js +2 -3
  68. package/dist/cli/commands/render/render.d.ts +6 -1
  69. package/dist/cli/commands/render/render.js +9 -7
  70. package/dist/cli/commands/sites/create.js +2 -0
  71. package/dist/cli/commands/sites/index.d.ts +1 -1
  72. package/dist/cli/commands/sites/index.js +4 -4
  73. package/dist/cli/commands/still.d.ts +2 -2
  74. package/dist/cli/commands/still.js +5 -5
  75. package/dist/cli/get-aws-region.js +0 -4
  76. package/dist/cli/helpers/find-function-name.d.ts +6 -1
  77. package/dist/cli/helpers/find-function-name.js +4 -5
  78. package/dist/cli/index.d.ts +2 -2
  79. package/dist/cli/index.js +36 -16
  80. package/dist/client.d.ts +17 -22
  81. package/dist/client.js +17 -13
  82. package/dist/functions/aws-implementation.d.ts +13 -1
  83. package/dist/functions/aws-implementation.js +46 -0
  84. package/dist/functions/aws-server-implementation.d.ts +2 -0
  85. package/dist/functions/aws-server-implementation.js +25 -0
  86. package/dist/functions/full-client-implementation.d.ts +3 -0
  87. package/dist/functions/full-client-implementation.js +16 -0
  88. package/dist/functions/helpers/clean-tmpdir.js +1 -3
  89. package/dist/functions/helpers/get-current-region.js +0 -4
  90. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +3 -7
  91. package/dist/functions/helpers/get-output-url-from-metadata.js +1 -1
  92. package/dist/functions/helpers/lifecycle.d.ts +4 -2
  93. package/dist/functions/helpers/lifecycle.js +3 -18
  94. package/dist/functions/helpers/timer.d.ts +2 -4
  95. package/dist/functions/http-client.d.ts +7 -0
  96. package/dist/functions/http-client.js +22 -0
  97. package/dist/functions/index.d.ts +1 -8
  98. package/dist/functions/index.js +12 -235
  99. package/dist/index.d.ts +6 -6
  100. package/dist/index.js +27 -6
  101. package/dist/internals.d.ts +6 -5
  102. package/dist/pricing/price-per-1-s.js +102 -0
  103. package/dist/regions.d.ts +1 -1
  104. package/dist/regions.js +3 -0
  105. package/dist/shared/call-lambda-async.d.ts +3 -0
  106. package/dist/shared/call-lambda-async.js +20 -0
  107. package/dist/shared/call-lambda-streaming.d.ts +7 -0
  108. package/dist/shared/{call-lambda.js → call-lambda-streaming.js} +36 -61
  109. package/dist/shared/call-lambda-sync.d.ts +3 -0
  110. package/dist/shared/call-lambda-sync.js +30 -0
  111. package/dist/shared/check-credentials.js +2 -3
  112. package/dist/shared/constants.d.ts +2 -91
  113. package/dist/shared/constants.js +1 -8
  114. package/dist/shared/convert-to-serve-url.js +2 -2
  115. package/dist/shared/get-account-id.d.ts +3 -4
  116. package/dist/shared/get-account-id.js +3 -3
  117. package/dist/shared/get-aws-urls.d.ts +4 -8
  118. package/dist/shared/get-aws-urls.js +1 -1
  119. package/dist/shared/get-function-version.js +4 -4
  120. package/dist/shared/get-layers.d.ts +1 -2
  121. package/dist/shared/get-layers.js +2 -4
  122. package/dist/shared/get-s3-operations.d.ts +4 -1
  123. package/dist/shared/get-s3-operations.js +2 -3
  124. package/dist/shared/get-service-client.js +2 -2
  125. package/dist/shared/hosted-layers.d.ts +0 -1
  126. package/dist/shared/hosted-layers.js +139 -537
  127. package/dist/shared/lambda-insights-extensions.d.ts +1 -1
  128. package/dist/shared/lambda-insights-extensions.js +3 -0
  129. package/dist/shared/read-dir.d.ts +2 -10
  130. package/dist/shared/read-dir.js +5 -4
  131. package/dist/shared/validate-aws-region.js +1 -1
  132. package/dist/shared/validate-bucketname.d.ts +1 -1
  133. package/package.json +15 -15
  134. package/remotionlambda-arm64.zip +0 -0
  135. package/dist/api/__mocks__/clean-items.d.ts +0 -2
  136. package/dist/api/__mocks__/clean-items.js +0 -24
  137. package/dist/api/__mocks__/create-function.d.ts +0 -2
  138. package/dist/api/__mocks__/create-function.js +0 -21
  139. package/dist/api/__mocks__/delete-function.d.ts +0 -2
  140. package/dist/api/__mocks__/delete-function.js +0 -9
  141. package/dist/api/__mocks__/get-functions.d.ts +0 -2
  142. package/dist/api/__mocks__/get-functions.js +0 -9
  143. package/dist/api/__mocks__/upload-dir.d.ts +0 -3
  144. package/dist/api/__mocks__/upload-dir.js +0 -47
  145. package/dist/api/mock-functions.d.ts +0 -18
  146. package/dist/api/mock-functions.js +0 -36
  147. package/dist/cli/helpers/__mocks__/quit.d.ts +0 -1
  148. package/dist/cli/helpers/__mocks__/quit.js +0 -7
  149. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +0 -7
  150. package/dist/functions/chunk-optimization/plan-frame-ranges.js +0 -17
  151. package/dist/functions/chunk-optimization/types.d.ts +0 -8
  152. package/dist/functions/chunk-optimization/types.js +0 -2
  153. package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +0 -3
  154. package/dist/functions/helpers/__mocks__/get-browser-instance.js +0 -12
  155. package/dist/functions/helpers/__mocks__/leak-detection.d.ts +0 -4
  156. package/dist/functions/helpers/__mocks__/leak-detection.js +0 -9
  157. package/dist/functions/helpers/__mocks__/timer.d.ts +0 -2
  158. package/dist/functions/helpers/__mocks__/timer.js +0 -10
  159. package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +0 -1
  160. package/dist/functions/helpers/best-frames-per-lambda-param.js +0 -17
  161. package/dist/functions/helpers/calculate-chunk-times.d.ts +0 -5
  162. package/dist/functions/helpers/calculate-chunk-times.js +0 -29
  163. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +0 -15
  164. package/dist/functions/helpers/calculate-price-from-bucket.js +0 -30
  165. package/dist/functions/helpers/can-concat-seamlessly.d.ts +0 -3
  166. package/dist/functions/helpers/can-concat-seamlessly.js +0 -17
  167. package/dist/functions/helpers/cleanup-props.d.ts +0 -8
  168. package/dist/functions/helpers/cleanup-props.js +0 -23
  169. package/dist/functions/helpers/concat-videos.d.ts +0 -23
  170. package/dist/functions/helpers/concat-videos.js +0 -54
  171. package/dist/functions/helpers/create-post-render-data.d.ts +0 -17
  172. package/dist/functions/helpers/create-post-render-data.js +0 -67
  173. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +0 -14
  174. package/dist/functions/helpers/find-output-file-in-bucket.js +0 -38
  175. package/dist/functions/helpers/format-costs-info.d.ts +0 -2
  176. package/dist/functions/helpers/format-costs-info.js +0 -23
  177. package/dist/functions/helpers/get-overall-progress-s3.d.ts +0 -10
  178. package/dist/functions/helpers/get-overall-progress-s3.js +0 -24
  179. package/dist/functions/helpers/get-overall-progress.d.ts +0 -9
  180. package/dist/functions/helpers/get-overall-progress.js +0 -23
  181. package/dist/functions/helpers/get-progress.d.ts +0 -15
  182. package/dist/functions/helpers/get-progress.js +0 -254
  183. package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
  184. package/dist/functions/helpers/get-retry-stats.js +0 -2
  185. package/dist/functions/helpers/inspect-errors.d.ts +0 -4
  186. package/dist/functions/helpers/inspect-errors.js +0 -39
  187. package/dist/functions/helpers/is-warm.d.ts +0 -2
  188. package/dist/functions/helpers/is-warm.js +0 -10
  189. package/dist/functions/helpers/leak-detection.d.ts +0 -4
  190. package/dist/functions/helpers/leak-detection.js +0 -40
  191. package/dist/functions/helpers/make-timeout-error.d.ts +0 -10
  192. package/dist/functions/helpers/make-timeout-error.js +0 -31
  193. package/dist/functions/helpers/make-timeout-message.d.ts +0 -10
  194. package/dist/functions/helpers/make-timeout-message.js +0 -75
  195. package/dist/functions/helpers/merge-chunks.d.ts +0 -36
  196. package/dist/functions/helpers/merge-chunks.js +0 -84
  197. package/dist/functions/helpers/min-max.d.ts +0 -2
  198. package/dist/functions/helpers/min-max.js +0 -33
  199. package/dist/functions/helpers/on-downloads-logger.d.ts +0 -2
  200. package/dist/functions/helpers/on-downloads-logger.js +0 -29
  201. package/dist/functions/helpers/overall-render-progress.d.ts +0 -59
  202. package/dist/functions/helpers/overall-render-progress.js +0 -180
  203. package/dist/functions/helpers/print-concurrency-curve.d.ts +0 -1
  204. package/dist/functions/helpers/print-concurrency-curve.js +0 -8
  205. package/dist/functions/helpers/print-logging-helper.d.ts +0 -4
  206. package/dist/functions/helpers/print-logging-helper.js +0 -12
  207. package/dist/functions/helpers/render-has-audio-video.d.ts +0 -6
  208. package/dist/functions/helpers/render-has-audio-video.js +0 -21
  209. package/dist/functions/helpers/request-context.d.ts +0 -5
  210. package/dist/functions/helpers/request-context.js +0 -2
  211. package/dist/functions/helpers/stream-renderer.d.ts +0 -17
  212. package/dist/functions/helpers/stream-renderer.js +0 -148
  213. package/dist/functions/launch.d.ts +0 -10
  214. package/dist/functions/launch.js +0 -596
  215. package/dist/functions/progress.d.ts +0 -11
  216. package/dist/functions/progress.js +0 -51
  217. package/dist/functions/renderer.d.ts +0 -17
  218. package/dist/functions/renderer.js +0 -341
  219. package/dist/functions/start.d.ts +0 -13
  220. package/dist/functions/start.js +0 -113
  221. package/dist/functions/still.d.ts +0 -19
  222. package/dist/functions/still.js +0 -330
  223. package/dist/shared/__mocks__/aws-clients.d.ts +0 -2
  224. package/dist/shared/__mocks__/aws-clients.js +0 -62
  225. package/dist/shared/__mocks__/bundle-site.d.ts +0 -2
  226. package/dist/shared/__mocks__/bundle-site.js +0 -32
  227. package/dist/shared/__mocks__/check-credentials.d.ts +0 -1
  228. package/dist/shared/__mocks__/check-credentials.js +0 -5
  229. package/dist/shared/__mocks__/get-account-id.d.ts +0 -2
  230. package/dist/shared/__mocks__/get-account-id.js +0 -11
  231. package/dist/shared/__mocks__/read-dir.d.ts +0 -2
  232. package/dist/shared/__mocks__/read-dir.js +0 -13
  233. package/dist/shared/call-lambda.d.ts +0 -16
  234. package/dist/shared/cleanup-serialized-input-props.d.ts +0 -14
  235. package/dist/shared/cleanup-serialized-input-props.js +0 -34
  236. package/dist/shared/docs-url.d.ts +0 -1
  237. package/dist/shared/docs-url.js +0 -4
  238. package/dist/shared/get-most-expensive-chunks.d.ts +0 -8
  239. package/dist/shared/get-most-expensive-chunks.js +0 -28
  240. package/dist/shared/invoke-webhook.d.ts +0 -48
  241. package/dist/shared/invoke-webhook.js +0 -140
  242. package/dist/shared/parse-lambda-timings-key.d.ts +0 -5
  243. package/dist/shared/parse-lambda-timings-key.js +0 -2
  244. package/dist/shared/return-values.d.ts +0 -16
  245. package/dist/shared/return-values.js +0 -2
  246. package/dist/shared/stackback.d.ts +0 -6
  247. package/dist/shared/stackback.js +0 -59
  248. package/dist/shared/validate-download-behavior.d.ts +0 -1
  249. package/dist/shared/validate-download-behavior.js +0 -21
  250. package/dist/shared/validate-frames-per-lambda.d.ts +0 -4
  251. package/dist/shared/validate-frames-per-lambda.js +0 -29
  252. package/dist/shared/validate-privacy.d.ts +0 -2
  253. package/dist/shared/validate-privacy.js +0 -14
  254. package/dist/shared/validate.d.ts +0 -4
  255. package/dist/shared/validate.js +0 -8
  256. package/dist/shared/why-is-node-running.d.ts +0 -15
  257. package/dist/shared/why-is-node-running.js +0 -88
  258. package/vitest.config.mts +0 -11
@@ -8,15 +8,13 @@ const renderer_1 = require("@remotion/renderer");
8
8
  const client_1 = require("@remotion/serverless/client");
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
10
  const aws_implementation_1 = require("../functions/aws-implementation");
11
- const get_overall_progress_s3_1 = require("../functions/helpers/get-overall-progress-s3");
12
11
  const read_with_progress_1 = require("../functions/helpers/read-with-progress");
13
- const get_account_id_1 = require("../shared/get-account-id");
14
12
  const internalDownloadMedia = async (input) => {
15
13
  var _a, _b, _c, _d;
16
- const expectedBucketOwner = await (0, get_account_id_1.getAccountId)({
14
+ const expectedBucketOwner = await input.providerSpecifics.getAccountId({
17
15
  region: input.region,
18
16
  });
19
- const overallProgress = await (0, get_overall_progress_s3_1.getOverallProgressS3)({
17
+ const overallProgress = await (0, client_1.getOverallProgressFromStorage)({
20
18
  bucketName: input.bucketName,
21
19
  expectedBucketOwner,
22
20
  region: input.region,
@@ -47,16 +45,9 @@ const internalDownloadMedia = async (input) => {
47
45
  };
48
46
  };
49
47
  exports.internalDownloadMedia = internalDownloadMedia;
50
- /**
48
+ /*
51
49
  * @description Downloads a rendered video, audio or still to the disk of the machine this API is called from.
52
50
  * @see [Documentation](https://remotion.dev/docs/lambda/downloadmedia)
53
- * @param params.region The AWS region in which the media resides.
54
- * @param params.bucketName The `bucketName` that was specified during the render.
55
- * @param params.renderId The `renderId` that was obtained after triggering the render.
56
- * @param params.outPath Where to save the media.
57
- * @param params.onProgress Progress callback function - see docs for details.
58
- * @param params.customCredentials If the file was saved to a foreign cloud, pass credentials for reading from it.
59
- * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
60
51
  */
61
52
  const downloadMedia = (input) => {
62
53
  return (0, exports.internalDownloadMedia)({
@@ -13,11 +13,5 @@ export type EstimatePriceInput = {
13
13
  diskSizeInMb: number;
14
14
  lambdasInvoked: number;
15
15
  } & Miliseconds;
16
- /**
17
- *
18
- * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
19
- * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
20
- * @returns {number} Price in USD
21
- */
22
16
  export declare const estimatePrice: ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }: EstimatePriceInput) => number;
23
17
  export {};
@@ -6,11 +6,9 @@ const price_per_1_s_1 = require("../pricing/price-per-1-s");
6
6
  const validate_aws_region_1 = require("../shared/validate-aws-region");
7
7
  const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
8
8
  const validate_memory_size_1 = require("../shared/validate-memory-size");
9
- /**
10
- *
9
+ /*
11
10
  * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
12
11
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
13
- * @returns {number} Price in USD
14
12
  */
15
13
  const estimatePrice = ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }) => {
16
14
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
@@ -5,8 +5,8 @@ import * as S3SDK from '@aws-sdk/client-s3';
5
5
  import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
6
6
  import * as StsSdk from '@aws-sdk/client-sts';
7
7
  import type { CustomCredentials } from '@remotion/serverless/client';
8
- import type { AwsRegion } from '../client';
9
8
  import type { AwsProvider } from '../functions/aws-implementation';
9
+ import type { AwsRegion } from '../regions';
10
10
  import { type ServiceMapping } from '../shared/get-service-client';
11
11
  export type GetAwsClientInput<T extends keyof ServiceMapping> = {
12
12
  region: AwsRegion;
@@ -26,13 +26,5 @@ export type GetAwsClientOutput<T extends keyof ServiceMapping> = {
26
26
  client: ServiceMapping[T];
27
27
  sdk: SdkMapping[T];
28
28
  };
29
- /**
30
- * @description Gets the full AWS SDK and an instantiated client for an AWS service
31
- * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
32
- * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
33
- * @param {string} params.service One of `iam`, `s3`, `cloudwatch`, `iam` or `servicequotas`
34
- * @param {CustomCredentials} params.customCredentials Pass endpoint and credentials if you want to connect to a different cloud for S3
35
- * @returns {GetAwsClientOutput<T>} Returns `client` and `sdk` of a AWS service
36
- */
37
29
  export declare const getAwsClient: <T extends keyof ServiceMapping>({ region, service, customCredentials, forcePathStyle, }: GetAwsClientInput<T>) => GetAwsClientOutput<T>;
38
30
  export {};
@@ -31,13 +31,9 @@ const S3SDK = __importStar(require("@aws-sdk/client-s3"));
31
31
  const ServiceQuotasSDK = __importStar(require("@aws-sdk/client-service-quotas"));
32
32
  const StsSdk = __importStar(require("@aws-sdk/client-sts"));
33
33
  const get_service_client_1 = require("../shared/get-service-client");
34
- /**
35
- * @description Gets the full AWS SDK and an instantiated client for an AWS service
34
+ /*
35
+ * @description Exposes full access to the AWS SDK used by Remotion, allowing interaction with AWS infrastructure beyond provided functionalities.
36
36
  * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
37
- * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
38
- * @param {string} params.service One of `iam`, `s3`, `cloudwatch`, `iam` or `servicequotas`
39
- * @param {CustomCredentials} params.customCredentials Pass endpoint and credentials if you want to connect to a different cloud for S3
40
- * @returns {GetAwsClientOutput<T>} Returns `client` and `sdk` of a AWS service
41
37
  */
42
38
  const getAwsClient = ({ region, service, customCredentials, forcePathStyle, }) => {
43
39
  return {
@@ -1,7 +1,7 @@
1
1
  import type { ChromiumOptions, ToOptions } from '@remotion/renderer';
2
2
  import type { BrowserSafeApis } from '@remotion/renderer/client';
3
3
  import type { VideoConfig } from 'remotion/no-react';
4
- import type { AwsRegion } from '../client';
4
+ import type { AwsRegion } from '../regions';
5
5
  export type GetCompositionsOnLambdaInput = {
6
6
  chromiumOptions?: ChromiumOptions;
7
7
  region: AwsRegion;
@@ -17,17 +17,4 @@ export type GetCompositionsOnLambdaInput = {
17
17
  forcePathStyle?: boolean;
18
18
  } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.getCompositionsOnLambda>>;
19
19
  export type GetCompositionsOnLambdaOutput = VideoConfig[];
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
20
  export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, forcePathStyle, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -4,19 +4,9 @@ exports.getCompositionsOnLambda = void 0;
4
4
  const client_1 = require("@remotion/serverless/client");
5
5
  const version_1 = require("remotion/version");
6
6
  const aws_implementation_1 = require("../functions/aws-implementation");
7
- const call_lambda_1 = require("../shared/call-lambda");
8
- /**
9
- * @description Returns the compositions from a serveUrl
7
+ /*
8
+ * @description Gets the compositions inside a Lambda function.
10
9
  * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
11
- * @param params.functionName The name of the Lambda function that should be used
12
- * @param params.serveUrl The URL of the deployed project
13
- * @param params.inputProps The input props that should be passed while the compositions are evaluated.
14
- * @param params.envVariables Object containing environment variables to be inserted into the video environment
15
- * @param params.region The AWS region in which the video should be rendered.
16
- * @param params.logLevel The log level of the Lambda function
17
- * @param params.timeoutInMilliseconds The timeout of the Lambda function
18
- * @param params.chromiumOptions The options to pass to Chromium
19
- * @returns The compositions
20
10
  */
21
11
  const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, forcePathStyle, }) => {
22
12
  var _a;
@@ -26,19 +16,24 @@ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inpu
26
16
  region,
27
17
  userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
28
18
  propsType: 'input-props',
29
- needsToUpload: (0, client_1.getNeedsToUpload)('video-or-audio', [
30
- stringifiedInputProps.length,
31
- JSON.stringify(envVariables).length,
32
- ]),
19
+ needsToUpload: (0, client_1.getNeedsToUpload)({
20
+ type: 'video-or-audio',
21
+ sizes: [
22
+ stringifiedInputProps.length,
23
+ JSON.stringify(envVariables).length,
24
+ ],
25
+ providerSpecifics: aws_implementation_1.awsImplementation,
26
+ }),
33
27
  providerSpecifics: aws_implementation_1.awsImplementation,
34
28
  forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
35
29
  skipPutAcl: false,
36
30
  });
37
31
  try {
38
- const res = await (0, call_lambda_1.callLambda)({
32
+ const res = await aws_implementation_1.awsImplementation.callFunctionSync({
39
33
  functionName,
40
34
  type: client_1.ServerlessRoutines.compositions,
41
35
  payload: {
36
+ type: client_1.ServerlessRoutines.compositions,
42
37
  chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
43
38
  serveUrl,
44
39
  envVariables,
@@ -1,22 +1,9 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
+ import type { FunctionInfo } from '@remotion/serverless';
2
3
  import type { AwsRegion } from '../regions';
3
- export type FunctionInfo = {
4
- functionName: string;
5
- timeoutInSeconds: number;
6
- memorySizeInMb: number;
7
- version: string | null;
8
- diskSizeInMb: number;
9
- };
10
4
  export type GetFunctionInfoInput = {
11
5
  region: AwsRegion;
12
6
  functionName: string;
13
7
  logLevel?: LogLevel;
14
8
  };
15
- /**
16
- * @description Given a region and function name, returns information about the function such as version, memory size and timeout.
17
- * @see [Documentation](https://remotion.dev/docs/lambda/getfunctioninfo)
18
- * @param {AwsRegion} options.region The region in which the function resides in.
19
- * @param {string} options.functionName The name of the function
20
- * @return {Promise<FunctionInfo>} Promise resolving to information about the function.
21
- */
22
9
  export declare const getFunctionInfo: ({ region, functionName, logLevel, }: GetFunctionInfoInput) => Promise<FunctionInfo>;
@@ -6,12 +6,9 @@ const aws_clients_1 = require("../shared/aws-clients");
6
6
  const constants_1 = require("../shared/constants");
7
7
  const get_function_version_1 = require("../shared/get-function-version");
8
8
  const validate_aws_region_1 = require("../shared/validate-aws-region");
9
- /**
10
- * @description Given a region and function name, returns information about the function such as version, memory size and timeout.
9
+ /*
10
+ * @description Gets information about a function given its name and region.
11
11
  * @see [Documentation](https://remotion.dev/docs/lambda/getfunctioninfo)
12
- * @param {AwsRegion} options.region The region in which the function resides in.
13
- * @param {string} options.functionName The name of the function
14
- * @return {Promise<FunctionInfo>} Promise resolving to information about the function.
15
12
  */
16
13
  const getFunctionInfo = async ({ region, functionName, logLevel, }) => {
17
14
  var _a, _b, _c, _d, _e;
@@ -1,16 +1,9 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
+ import type { FunctionInfo } from '@remotion/serverless';
2
3
  import type { AwsRegion } from '../regions';
3
- import type { FunctionInfo } from './get-function-info';
4
4
  export type GetFunctionsInput = {
5
5
  region: AwsRegion;
6
6
  compatibleOnly: boolean;
7
7
  logLevel?: LogLevel;
8
8
  };
9
- /**
10
- * @description Lists Remotion Lambda render functions deployed to AWS Lambda.
11
- * @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
12
- * @param params.region The region of which the functions should be listed.
13
- * @param params.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
14
- * @returns {Promise<FunctionInfo[]>} An array with the objects containing information about the deployed functions.
15
- */
16
9
  export declare const getFunctions: (params: GetFunctionsInput) => Promise<FunctionInfo[]>;
@@ -26,12 +26,9 @@ const getAllFunctions = async ({ existing, nextMarker, region, }) => {
26
26
  }
27
27
  return allLambdas;
28
28
  };
29
- /**
30
- * @description Lists Remotion Lambda render functions deployed to AWS Lambda.
29
+ /*
30
+ * @description Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
31
31
  * @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
32
- * @param params.region The region of which the functions should be listed.
33
- * @param params.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
34
- * @returns {Promise<FunctionInfo[]>} An array with the objects containing information about the deployed functions.
35
32
  */
36
33
  const getFunctions = async (params) => {
37
34
  const lambdas = await getAllFunctions({
@@ -1,9 +1,3 @@
1
1
  import type { GetOrCreateBucketInput } from '@remotion/serverless/client';
2
2
  import type { AwsProvider } from '../functions/aws-implementation';
3
- /**
4
- * @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
5
- * @see [Documentation](https://remotion.dev/docs/lambda/getorcreatebucket)
6
- * @param params.region The region in which you want your S3 bucket to reside in.
7
- * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
8
- */
9
3
  export declare const getOrCreateBucket: (options: GetOrCreateBucketInput<AwsProvider>) => Promise<import("@remotion/serverless/client").GetOrCreateBucketOutput>;
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOrCreateBucket = void 0;
4
4
  const client_1 = require("@remotion/serverless/client");
5
5
  const aws_implementation_1 = require("../functions/aws-implementation");
6
- /**
7
- * @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
8
- * @see [Documentation](https://remotion.dev/docs/lambda/getorcreatebucket)
9
- * @param params.region The region in which you want your S3 bucket to reside in.
10
- * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
6
+ /*
7
+ * @description Creates a Cloud Storage bucket for Remotion Cloud Run in your GCP project. If one already exists, it will get returned instead.
8
+ * @see [Documentation](https://remotion.dev/docs/cloudrun/getorcreatebucket)
11
9
  */
12
10
  const getOrCreateBucket = (options) => {
13
11
  var _a, _b;
@@ -2,10 +2,5 @@ import type { AwsRegion } from '../regions';
2
2
  type Options = {
3
3
  enabledByDefaultOnly?: boolean;
4
4
  };
5
- /**
6
- * @description Gets an array of all supported AWS regions of this release of Remotion Lambda.
7
- * @see [Documentation](https://remotion.dev/docs/lambda/getregions)
8
- * @returns {AwsRegion[]} A list of AWS regions.
9
- */
10
5
  export declare const getRegions: (options?: Options) => readonly AwsRegion[];
11
6
  export {};
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRegions = void 0;
4
4
  const regions_1 = require("../regions");
5
- /**
6
- * @description Gets an array of all supported AWS regions of this release of Remotion Lambda.
7
- * @see [Documentation](https://remotion.dev/docs/lambda/getregions)
8
- * @returns {AwsRegion[]} A list of AWS regions.
5
+ /*
6
+ * @description Gets an array of all supported GCP regions of this release of Remotion Cloud Run.
7
+ * @see [Documentation](https://remotion.dev/docs/cloudrun/getregions)
9
8
  */
10
9
  const getRegions = (options) => {
11
10
  var _a;
@@ -13,14 +13,4 @@ export type GetRenderProgressInput = {
13
13
  forcePathStyle?: boolean;
14
14
  skipLambdaInvocation?: boolean;
15
15
  };
16
- /**
17
- * @description Gets the current status of a render originally triggered via renderMediaOnLambda().
18
- * @see [Documentation](https://remotion.dev/docs/lambda/getrenderprogress)
19
- * @param {string} params.functionName The name of the function used to trigger the render.
20
- * @param {string} params.bucketName The name of the bucket that was used in the render.
21
- * @param {string} params.renderId The ID of the render that was returned by `renderMediaOnLambda()`.
22
- * @param {AwsRegion} params.region The region in which the render was triggered.
23
- * @param {CustomCredentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
24
- * @returns {Promise<RenderProgress>} See documentation for this function to see all properties on the return object.
25
- */
26
16
  export declare const getRenderProgress: (input: GetRenderProgressInput) => Promise<RenderProgress>;
@@ -3,19 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRenderProgress = void 0;
4
4
  const client_1 = require("@remotion/serverless/client");
5
5
  const aws_implementation_1 = require("../functions/aws-implementation");
6
- const get_progress_1 = require("../functions/helpers/get-progress");
7
6
  const parse_function_name_1 = require("../functions/helpers/parse-function-name");
8
- const call_lambda_1 = require("../shared/call-lambda");
9
7
  const make_lambda_payload_1 = require("./make-lambda-payload");
10
- /**
8
+ /*
11
9
  * @description Gets the current status of a render originally triggered via renderMediaOnLambda().
12
10
  * @see [Documentation](https://remotion.dev/docs/lambda/getrenderprogress)
13
- * @param {string} params.functionName The name of the function used to trigger the render.
14
- * @param {string} params.bucketName The name of the bucket that was used in the render.
15
- * @param {string} params.renderId The ID of the render that was returned by `renderMediaOnLambda()`.
16
- * @param {AwsRegion} params.region The region in which the render was triggered.
17
- * @param {CustomCredentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
18
- * @returns {Promise<RenderProgress>} See documentation for this function to see all properties on the return object.
19
11
  */
20
12
  const getRenderProgress = async (input) => {
21
13
  var _a, _b;
@@ -28,7 +20,7 @@ const getRenderProgress = async (input) => {
28
20
  'You must call getRenderProgress with `skipLambdaInvocation` set to false.',
29
21
  ].join('\n'));
30
22
  }
31
- return (0, get_progress_1.getProgress)({
23
+ return (0, client_1.getProgress)({
32
24
  bucketName: input.bucketName,
33
25
  renderId: input.renderId,
34
26
  region: input.region,
@@ -41,7 +33,7 @@ const getRenderProgress = async (input) => {
41
33
  functionName: input.functionName,
42
34
  });
43
35
  }
44
- const result = await (0, call_lambda_1.callLambda)({
36
+ const result = await aws_implementation_1.awsImplementation.callFunctionSync({
45
37
  functionName: input.functionName,
46
38
  type: client_1.ServerlessRoutines.status,
47
39
  payload: (0, make_lambda_payload_1.getRenderProgressPayload)(input),
@@ -25,11 +25,5 @@ export type GetSitesOutput = {
25
25
  export declare const internalGetSites: ({ region, forceBucketName, providerSpecifics, forcePathStyle, }: GetSitesInternalInput & {
26
26
  providerSpecifics: ProviderSpecifics<AwsProvider>;
27
27
  }) => Promise<GetSitesOutput>;
28
- /**
29
- * @description Gets all the deployed sites for a certain AWS region.
30
- * @see [Documentation](https://remotion.dev/docs/lambda/getsites)
31
- * @param {AwsRegion} params.region The AWS region that you want to query for.
32
- * @returns {Promise<GetSitesOutput>} A Promise containing an object with `sites` and `bucket` keys. Consult documentation for details.
33
- */
34
28
  export declare const getSites: ({ region, forceBucketName, forcePathStyle, }: GetSitesInput) => Promise<GetSitesOutput>;
35
29
  export {};
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSites = exports.internalGetSites = void 0;
4
4
  const aws_implementation_1 = require("../functions/aws-implementation");
5
5
  const constants_1 = require("../shared/constants");
6
- const get_account_id_1 = require("../shared/get-account-id");
7
6
  const make_s3_url_1 = require("../shared/make-s3-url");
8
7
  const internalGetSites = async ({ region, forceBucketName, providerSpecifics, forcePathStyle, }) => {
9
8
  var _a;
@@ -18,7 +17,7 @@ const internalGetSites = async ({ region, forceBucketName, providerSpecifics, fo
18
17
  forceBucketName: null,
19
18
  forcePathStyle,
20
19
  });
21
- const accountId = await (0, get_account_id_1.getAccountId)({ region });
20
+ const accountId = await providerSpecifics.getAccountId({ region });
22
21
  const sites = {};
23
22
  for (const bucket of remotionBuckets) {
24
23
  const ls = await providerSpecifics.listObjects({
@@ -65,11 +64,9 @@ const internalGetSites = async ({ region, forceBucketName, providerSpecifics, fo
65
64
  return { sites: sitesArray, buckets: remotionBuckets };
66
65
  };
67
66
  exports.internalGetSites = internalGetSites;
68
- /**
69
- * @description Gets all the deployed sites for a certain AWS region.
70
- * @see [Documentation](https://remotion.dev/docs/lambda/getsites)
71
- * @param {AwsRegion} params.region The AWS region that you want to query for.
72
- * @returns {Promise<GetSitesOutput>} A Promise containing an object with `sites` and `bucket` keys. Consult documentation for details.
67
+ /*
68
+ * @description Gets an array of Remotion projects in Cloud Storage, in your GCP project.
69
+ * @see [Documentation](https://remotion.dev/docs/cloudrun/getsites)
73
70
  */
74
71
  const getSites = ({ region, forceBucketName, forcePathStyle, }) => {
75
72
  return (0, exports.internalGetSites)({
@@ -8,11 +8,4 @@ export type SimulatePermissionsInput = {
8
8
  export type SimulatePermissionsOutput = {
9
9
  results: SimulationResult[];
10
10
  };
11
- /**
12
- * @description Simulates calls using the AWS Simulator to validate the correct permissions.
13
- * @see [Documentation](http://remotion.dev/docs/lambda/simulatepermissions)
14
- * @param {AwsRegion} options.region The region which you would like to validate
15
- * @param {(result: SimulationResult) => void} options.onSimulation The region which you would like to validate
16
- * @returns {Promise<SimulatePermissionsOutput>} See documentation for detailed response structure.
17
- */
18
11
  export declare const simulatePermissions: (options: SimulatePermissionsInput) => Promise<SimulatePermissionsOutput>;
@@ -17,12 +17,9 @@ const logPermissionOutput = (output) => {
17
17
  return [getEmojiForStatus(output.decision), output.name].join(' ');
18
18
  };
19
19
  exports.logPermissionOutput = logPermissionOutput;
20
- /**
20
+ /*
21
21
  * @description Simulates calls using the AWS Simulator to validate the correct permissions.
22
- * @see [Documentation](http://remotion.dev/docs/lambda/simulatepermissions)
23
- * @param {AwsRegion} options.region The region which you would like to validate
24
- * @param {(result: SimulationResult) => void} options.onSimulation The region which you would like to validate
25
- * @returns {Promise<SimulatePermissionsOutput>} See documentation for detailed response structure.
22
+ * @see [Documentation](https://remotion.dev/docs/lambda/simulatepermissions)
26
23
  */
27
24
  const simulatePermissions = async (options) => {
28
25
  var _a;
@@ -1,13 +1,3 @@
1
- /**
2
- * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
3
- * @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
4
- * @returns {string} A JSON string representation of the user policy.
5
- */
6
1
  export declare const getUserPolicy: () => string;
7
2
  export declare const ROLE_NAME = "remotion-lambda-role";
8
- /**
9
- * @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
10
- * @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
11
- * @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
12
- */
13
3
  export declare const getRolePolicy: () => string;
@@ -29,18 +29,16 @@ const suggestedRolePolicy = {
29
29
  }),
30
30
  ],
31
31
  };
32
- /**
32
+ /*
33
33
  * @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
34
34
  * @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
35
- * @returns {string} A JSON string representation of the user policy.
36
35
  */
37
36
  const getUserPolicy = () => JSON.stringify(suggestedPolicy, null, 2);
38
37
  exports.getUserPolicy = getUserPolicy;
39
38
  exports.ROLE_NAME = 'remotion-lambda-role';
40
- /**
39
+ /*
41
40
  * @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
42
41
  * @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
43
- * @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
44
42
  */
45
43
  const getRolePolicy = () => JSON.stringify(suggestedRolePolicy, null, 2);
46
44
  exports.getRolePolicy = getRolePolicy;
@@ -2,8 +2,9 @@ import type { AudioCodec, ChromiumOptions, ColorSpace, FrameRange, LogLevel, Pix
2
2
  import type { BrowserSafeApis } from '@remotion/renderer/client';
3
3
  import type { DownloadBehavior, OutNameInput, Privacy, ServerlessCodec, ServerlessPayloads, ServerlessStartPayload, ServerlessStatusPayload, WebhookOption } from '@remotion/serverless/client';
4
4
  import { ServerlessRoutines } from '@remotion/serverless/client';
5
- import type { AwsRegion, DeleteAfter } from '../client';
5
+ import type { DeleteAfter } from '../client';
6
6
  import type { AwsProvider } from '../functions/aws-implementation';
7
+ import type { AwsRegion } from '../regions';
7
8
  import type { GetRenderProgressInput } from './get-render-progress';
8
9
  import type { RenderStillOnLambdaNonNullInput } from './render-still-on-lambda';
9
10
  export type InnerRenderMediaOnLambdaInput = {
@@ -6,27 +6,29 @@ const version_1 = require("remotion/version");
6
6
  const aws_implementation_1 = require("../functions/aws-implementation");
7
7
  const client_2 = require("@remotion/serverless/client");
8
8
  const no_react_1 = require("remotion/no-react");
9
- const validate_download_behavior_1 = require("../shared/validate-download-behavior");
10
- const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
11
9
  const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
12
10
  const validate_serveurl_1 = require("../shared/validate-serveurl");
13
11
  const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, forcePathStyle, metadata, }) => {
14
12
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
15
13
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
16
- (0, validate_frames_per_lambda_1.validateFramesPerLambda)({
17
- framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
14
+ (0, client_1.validateFramesPerFunction)({
15
+ framesPerFunction: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
18
16
  durationInFrames: 1,
19
17
  });
20
- (0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
18
+ (0, client_1.validateDownloadBehavior)(downloadBehavior);
21
19
  (0, client_2.validateWebhook)(webhook);
22
20
  const stringifiedInputProps = (0, client_1.serializeOrThrow)(inputProps !== null && inputProps !== void 0 ? inputProps : {}, 'input-props');
23
21
  const serialized = await (0, client_1.compressInputProps)({
24
22
  stringifiedInputProps,
25
23
  region,
26
- needsToUpload: (0, client_1.getNeedsToUpload)('video-or-audio', [
27
- stringifiedInputProps.length,
28
- JSON.stringify(envVariables).length,
29
- ]),
24
+ needsToUpload: (0, client_1.getNeedsToUpload)({
25
+ type: 'video-or-audio',
26
+ sizes: [
27
+ stringifiedInputProps.length,
28
+ JSON.stringify(envVariables).length,
29
+ ],
30
+ providerSpecifics: aws_implementation_1.awsImplementation,
31
+ }),
30
32
  userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
31
33
  propsType: 'input-props',
32
34
  providerSpecifics: aws_implementation_1.awsImplementation,
@@ -101,10 +103,14 @@ const makeLambdaRenderStillPayload = async ({ serveUrl, inputProps, imageFormat,
101
103
  const serializedInputProps = await (0, client_1.compressInputProps)({
102
104
  stringifiedInputProps,
103
105
  region,
104
- needsToUpload: (0, client_1.getNeedsToUpload)('still', [
105
- stringifiedInputProps.length,
106
- JSON.stringify(envVariables).length,
107
- ]),
106
+ needsToUpload: (0, client_1.getNeedsToUpload)({
107
+ type: 'still',
108
+ sizes: [
109
+ stringifiedInputProps.length,
110
+ JSON.stringify(envVariables).length,
111
+ ],
112
+ providerSpecifics: aws_implementation_1.awsImplementation,
113
+ }),
108
114
  userSpecifiedBucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
109
115
  propsType: 'input-props',
110
116
  providerSpecifics: aws_implementation_1.awsImplementation,
@@ -0,0 +1,3 @@
1
+ import type { NextApiRequest, NextApiResponse } from 'next';
2
+ import type { NextWebhookArgs } from './app-router-webhook';
3
+ export declare const pagesRouterWebhook: (options: NextWebhookArgs) => (req: NextApiRequest, res: NextApiResponse) => void;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pagesRouterWebhook = void 0;
4
+ const validate_webhook_signature_1 = require("./validate-webhook-signature");
5
+ const addHeaders = (res, headers) => {
6
+ Object.entries(headers).forEach(([key, value]) => {
7
+ res.setHeader(key, value);
8
+ });
9
+ };
10
+ const pagesRouterWebhook = (options) => {
11
+ const { testing, extraHeaders, secret, onSuccess, onTimeout, onError } = options;
12
+ return function (req, res) {
13
+ addHeaders(res, extraHeaders || {});
14
+ if (testing) {
15
+ const testingheaders = {
16
+ 'Access-Control-Allow-Origin': 'https://www.remotion.dev',
17
+ 'Access-Control-Allow-Headers': 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Remotion-Status, X-Remotion-Signature, X-Remotion-Mode',
18
+ 'Access-Control-Allow-Methods': 'OPTIONS,POST',
19
+ };
20
+ addHeaders(res, testingheaders);
21
+ }
22
+ if (req.method === 'OPTIONS') {
23
+ res.status(200).end();
24
+ return;
25
+ }
26
+ (0, validate_webhook_signature_1.validateWebhookSignature)({
27
+ secret,
28
+ body: req.body,
29
+ signatureHeader: req.headers['x-remotion-signature'],
30
+ });
31
+ // If code reaches this path, the webhook is authentic.
32
+ const payload = req.body;
33
+ if (payload.type === 'success' && onSuccess) {
34
+ onSuccess(payload);
35
+ }
36
+ else if (payload.type === 'timeout' && onTimeout) {
37
+ onTimeout(payload);
38
+ }
39
+ else if (payload.type === 'error' && onError) {
40
+ onError(payload);
41
+ }
42
+ res.status(200).json({
43
+ success: true,
44
+ });
45
+ };
46
+ };
47
+ exports.pagesRouterWebhook = pagesRouterWebhook;
@@ -10,15 +10,5 @@ type OptionalParameters<CheckIfObjectExists extends boolean> = {
10
10
  forcePathStyle: boolean;
11
11
  };
12
12
  export type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> = MandatoryParameters & Partial<OptionalParameters<CheckIfObjectExists>>;
13
- /**
14
- * @description Returns a public url of an object stored in Remotion's S3 bucket.
15
- * @see [Documentation](https://remotion.dev/docs/lambda/presignurl)
16
- * @param {AwsRegion} params.region The region in which the S3 bucket resides in.
17
- * @param {string} params.bucketName The name of the bucket to fetch the object from.
18
- * @param {string} params.objectKey Key of the S3 object to get.
19
- * @param {string} params.expiresIn The number of seconds before the presigned URL expires. Default 120.
20
- * @param {boolean} params.checkIfObjectExists Whether the function should check if the object exists in the bucket before generating the presigned url.
21
- * @returns {Promise<string | null>} The public url of an object or `null` if `checkIfObjectExists=true` & object does not exist.
22
- */
23
13
  export declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, }: PresignUrlInput<CheckIfObjectExists>) => Promise<CheckIfObjectExists extends true ? string | null : string>;
24
14
  export {};