@remotion/lambda 4.0.0-alpha.217 → 4.0.0-alpha10

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 (86) hide show
  1. package/dist/admin/bundle-lambda.js +12 -12
  2. package/dist/admin/generate-etag-list.js +4 -4
  3. package/dist/admin/make-layer-public.js +4 -5
  4. package/dist/api/create-bucket.js +34 -1
  5. package/dist/api/create-function.js +4 -4
  6. package/dist/api/delete-function.d.ts +2 -2
  7. package/dist/api/delete-function.js +2 -2
  8. package/dist/api/delete-site.d.ts +4 -4
  9. package/dist/api/delete-site.js +4 -4
  10. package/dist/api/deploy-function.d.ts +8 -7
  11. package/dist/api/deploy-function.js +26 -25
  12. package/dist/api/deploy-site.d.ts +2 -1
  13. package/dist/api/deploy-site.js +7 -4
  14. package/dist/api/download-media.d.ts +1 -1
  15. package/dist/api/download-media.js +3 -3
  16. package/dist/api/get-compositions-on-lambda.d.ts +1 -1
  17. package/dist/api/get-functions.d.ts +3 -3
  18. package/dist/api/get-functions.js +7 -7
  19. package/dist/api/get-or-create-bucket.d.ts +2 -2
  20. package/dist/api/get-or-create-bucket.js +6 -6
  21. package/dist/api/get-render-progress.d.ts +1 -1
  22. package/dist/api/get-render-progress.js +5 -10
  23. package/dist/api/get-sites.d.ts +0 -1
  24. package/dist/api/iam-validation/user-permissions.js +2 -0
  25. package/dist/api/make-lambda-payload.d.ts +5 -0
  26. package/dist/api/make-lambda-payload.js +77 -0
  27. package/dist/api/render-media-on-lambda.d.ts +3 -3
  28. package/dist/api/render-media-on-lambda.js +4 -60
  29. package/dist/api/render-still-on-lambda.d.ts +1 -1
  30. package/dist/api/speculate-function-name.d.ts +3 -3
  31. package/dist/api/speculate-function-name.js +3 -3
  32. package/dist/api/upload-dir.js +7 -7
  33. package/dist/cli/commands/functions/deploy.js +6 -3
  34. package/dist/cli/commands/functions/ls.js +8 -3
  35. package/dist/cli/commands/functions/rm.js +12 -5
  36. package/dist/cli/commands/functions/rmall.js +12 -6
  37. package/dist/cli/commands/quotas/increase.js +2 -2
  38. package/dist/cli/commands/render/render.js +32 -14
  39. package/dist/cli/commands/sites/create.js +5 -1
  40. package/dist/cli/commands/sites/index.js +3 -0
  41. package/dist/cli/commands/still.js +24 -9
  42. package/dist/cli/help.js +4 -0
  43. package/dist/cli/index.js +3 -3
  44. package/dist/cli/log.d.ts +2 -0
  45. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
  46. package/dist/functions/helpers/clean-tmpdir.js +7 -7
  47. package/dist/functions/helpers/concat-videos.js +7 -7
  48. package/dist/functions/helpers/get-browser-instance.js +1 -0
  49. package/dist/functions/helpers/get-chromium-executable-path.js +7 -6
  50. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  51. package/dist/functions/helpers/get-files-in-folder.js +5 -5
  52. package/dist/functions/helpers/io.d.ts +8 -2
  53. package/dist/functions/helpers/io.js +22 -2
  54. package/dist/functions/helpers/streamify-response.d.ts +16 -0
  55. package/dist/functions/helpers/streamify-response.js +67 -0
  56. package/dist/functions/helpers/validate-composition.d.ts +4 -3
  57. package/dist/functions/helpers/validate-composition.js +9 -12
  58. package/dist/functions/index.d.ts +1 -18
  59. package/dist/functions/index.js +31 -10
  60. package/dist/functions/launch.js +12 -13
  61. package/dist/functions/renderer.js +6 -6
  62. package/dist/functions/still.js +8 -7
  63. package/dist/index.d.ts +1 -1
  64. package/dist/internals.d.ts +2 -0
  65. package/dist/internals.js +3 -0
  66. package/dist/shared/aws-clients.js +2 -2
  67. package/dist/shared/call-lambda.js +27 -2
  68. package/dist/shared/constants.d.ts +47 -45
  69. package/dist/shared/deserialize-input-props.d.ts +1 -1
  70. package/dist/shared/function-zip-path.js +2 -2
  71. package/dist/shared/get-etag.js +4 -4
  72. package/dist/shared/hosted-layers.js +35 -119
  73. package/dist/shared/invoke-webhook.d.ts +3 -1
  74. package/dist/shared/invoke-webhook.js +4 -4
  75. package/dist/shared/make-s3-key.js +2 -2
  76. package/dist/shared/make-s3-url.js +2 -2
  77. package/dist/shared/read-dir.js +2 -2
  78. package/dist/shared/return-values.d.ts +5 -0
  79. package/dist/shared/serialize-input-props.d.ts +1 -1
  80. package/dist/shared/serialize-input-props.js +1 -1
  81. package/dist/shared/validate-privacy.d.ts +1 -1
  82. package/dist/shared/validate-privacy.js +5 -2
  83. package/package.json +89 -90
  84. package/remotionlambda-arm64.zip +0 -0
  85. package/remotionlambda-x64.zip +0 -0
  86. package/remotionlambda.zip +0 -0
@@ -4,21 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const bundler_1 = require("@remotion/bundler");
7
- const compositor_linux_arm64_musl_1 = require("@remotion/compositor-linux-arm64-musl");
8
- const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
7
+ const compositor_linux_arm64_gnu_1 = require("@remotion/compositor-linux-arm64-gnu");
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_path_1 = __importDefault(require("node:path"));
10
10
  const quit_1 = require("../cli/helpers/quit");
11
11
  const function_zip_path_1 = require("../shared/function-zip-path");
12
12
  const zl = require("zip-lib");
13
13
  const bundleLambda = async () => {
14
- const outdir = path_1.default.join(__dirname, '..', `build-render`);
15
- fs_1.default.mkdirSync(outdir, {
14
+ const outdir = node_path_1.default.join(__dirname, '..', `build-render`);
15
+ node_fs_1.default.mkdirSync(outdir, {
16
16
  recursive: true,
17
17
  });
18
- const outfile = path_1.default.join(outdir, 'index.js');
19
- fs_1.default.rmSync(outdir, { recursive: true });
20
- fs_1.default.mkdirSync(outdir, { recursive: true });
21
- const template = require.resolve(path_1.default.join(__dirname, '..', 'functions', 'index'));
18
+ const outfile = node_path_1.default.join(outdir, 'index.js');
19
+ node_fs_1.default.rmSync(outdir, { recursive: true });
20
+ node_fs_1.default.mkdirSync(outdir, { recursive: true });
21
+ const template = require.resolve(node_path_1.default.join(__dirname, '..', 'functions', 'index'));
22
22
  await bundler_1.BundlerInternals.esbuild.build({
23
23
  platform: 'node',
24
24
  target: 'node16',
@@ -36,10 +36,10 @@ const bundleLambda = async () => {
36
36
  ],
37
37
  });
38
38
  const compositorFile = `${outdir}/compositor`;
39
- fs_1.default.copyFileSync(compositor_linux_arm64_musl_1.binaryPath, compositorFile);
39
+ node_fs_1.default.copyFileSync(compositor_linux_arm64_gnu_1.binaryPath, compositorFile);
40
+ node_fs_1.default.cpSync(compositor_linux_arm64_gnu_1.ffmpegCwd, `${outdir}/ffmpeg`, { recursive: true });
40
41
  await zl.archiveFolder(outdir, function_zip_path_1.FUNCTION_ZIP_ARM64);
41
- fs_1.default.unlinkSync(compositorFile);
42
- fs_1.default.unlinkSync(outfile);
42
+ node_fs_1.default.rmSync(outdir, { recursive: true });
43
43
  };
44
44
  bundleLambda()
45
45
  .then(() => {
@@ -3,12 +3,12 @@ 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
- const crypto_1 = __importDefault(require("crypto"));
7
- const fs_1 = require("fs");
8
- const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
6
+ const node_crypto_1 = __importDefault(require("node:crypto"));
7
+ const node_fs_1 = require("node:fs");
8
+ const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
9
9
  const chunks = [];
10
10
  for (let i = 0; i < 2000; i++) {
11
11
  const etag = `"${md5(String(i))}"`;
12
12
  chunks.push(etag);
13
13
  }
14
- (0, fs_1.writeFileSync)('etags.json', JSON.stringify(chunks));
14
+ (0, node_fs_1.writeFileSync)('etags.json', JSON.stringify(chunks));
@@ -30,22 +30,21 @@ const layerInfo = {
30
30
  'sa-east-1': [],
31
31
  'us-west-1': [],
32
32
  };
33
- const architecture = 'arm64';
34
33
  const makeLayerPublic = async () => {
35
34
  const layers = ['fonts', 'ffmpeg', 'chromium'];
36
35
  for (const region of (0, get_regions_1.getRegions)()) {
37
36
  for (const layer of layers) {
38
- const layerName = `remotion-binaries-${layer}-${architecture}`;
37
+ const layerName = `remotion-binaries-${layer}-arm64`;
39
38
  const { Version, LayerArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PublishLayerVersionCommand({
40
39
  Content: {
41
40
  S3Bucket: 'remotionlambda-binaries-' + region,
42
- S3Key: `remotion-layer-${layer}-v9-${architecture}.zip`,
41
+ S3Key: `remotion-layer-${layer}-v10-arm64.zip`,
43
42
  },
44
43
  LayerName: layerName,
45
44
  LicenseInfo: layer === 'chromium'
46
- ? 'Chromium 104, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
45
+ ? 'Chromium 114, compiled from source. Read Chromium License: https://chromium.googlesource.com/chromium/src/+/refs/heads/main/LICENSE'
47
46
  : layer === 'ffmpeg'
48
- ? 'Compiled from FFMPEG source. Read FFMPEG license: https://ffmpeg.org/legal.html'
47
+ ? 'FFmpeg 6.0, compiled from source. Read FFMPEG license: https://ffmpeg.org/legal.html'
49
48
  : 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',
50
49
  CompatibleRuntimes: runtimes,
51
50
  Description: version_1.VERSION,
@@ -6,7 +6,40 @@ const aws_clients_1 = require("../shared/aws-clients");
6
6
  const createBucket = async ({ region, bucketName, }) => {
7
7
  await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.CreateBucketCommand({
8
8
  Bucket: bucketName,
9
- ACL: 'public-read',
10
9
  }));
10
+ try {
11
+ await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.DeleteBucketOwnershipControlsCommand({
12
+ Bucket: bucketName,
13
+ }));
14
+ }
15
+ catch (err) {
16
+ if (err.message.includes('Access Denied')) {
17
+ throw new Error('Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
18
+ }
19
+ throw err;
20
+ }
21
+ try {
22
+ await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.DeletePublicAccessBlockCommand({
23
+ Bucket: bucketName,
24
+ }));
25
+ }
26
+ catch (err) {
27
+ if (err.message.includes('Access Denied')) {
28
+ throw new Error('PARTIAL SUCCESS: The s3:PutBucketOwnershipControls was found, but the s3:PutBucketPublicAccessBlock permission is not given. Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
29
+ }
30
+ throw err;
31
+ }
32
+ try {
33
+ await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.PutBucketAclCommand({
34
+ Bucket: bucketName,
35
+ ACL: 'public-read',
36
+ }));
37
+ }
38
+ catch (err) {
39
+ if (err.message.includes('The bucket does not allow ACLs')) {
40
+ throw new Error(`Could not add an ACL to the bucket. This might have happened because the bucket was already successfully created before but then failed to configure correctly. We recommend to delete the bucket (${bucketName}) if it is empty and start over to fix the problem.`);
41
+ }
42
+ throw err;
43
+ }
11
44
  };
12
45
  exports.createBucket = createBucket;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFunction = void 0;
4
4
  const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
5
5
  const client_lambda_1 = require("@aws-sdk/client-lambda");
6
- const fs_1 = require("fs");
6
+ const node_fs_1 = require("node:fs");
7
7
  const defaults_1 = require("../defaults");
8
8
  const aws_clients_1 = require("../shared/aws-clients");
9
9
  const hosted_layers_1 = require("../shared/hosted-layers");
@@ -33,7 +33,7 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
33
33
  const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
34
34
  const { FunctionName } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
35
35
  Code: {
36
- ZipFile: (0, fs_1.readFileSync)(zipFile),
36
+ ZipFile: (0, node_fs_1.readFileSync)(zipFile),
37
37
  },
38
38
  FunctionName: functionName,
39
39
  Handler: 'index.handler',
@@ -66,11 +66,11 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
66
66
  await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutRuntimeManagementConfigCommand({
67
67
  FunctionName,
68
68
  UpdateRuntimeOn: 'Manual',
69
- RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:69000d3430a08938bcab71617dffcb8ea551a2cbc36c59f38c52a1ea087e461b`,
69
+ RuntimeVersionArn: `arn:aws:lambda:${region}::runtime:b97ad873eb5228db2e7d5727cd116734cc24c92ff1381739c4400c095404a2d3`,
70
70
  }));
71
71
  }
72
72
  catch (err) {
73
- console.warn('⚠️ Could not lock the runtime version. We recommend to update your policies to prevent your functions from breaking soon: https://remotion.dev/docs/lambda/feb-2023-incident');
73
+ console.warn('⚠️ Could not lock the runtime version. We recommend to update your policies to prevent your functions from breaking in the future in case the AWS runtime changes. See https://remotion.dev/docs/lambda/feb-2023-incident for an example on how to update your policy.');
74
74
  }
75
75
  return { FunctionName: FunctionName };
76
76
  };
@@ -6,8 +6,8 @@ export declare type DeleteFunctionInput = {
6
6
  /**
7
7
  * @description Deletes a function from AWS Lambda.
8
8
  * @see [Documentation](https://remotion.dev/docs/lambda/deletefunction)
9
- * @param options.region The region the function was deployed to.
10
- * @param options.functionName The name of the function.
9
+ * @param params.region The region the function was deployed to.
10
+ * @param params.functionName The name of the function.
11
11
  * @returns {Promise<void>} Nothing. Throws if the function failed to delete.
12
12
  */
13
13
  export declare const deleteFunction: ({ region, functionName, }: DeleteFunctionInput) => Promise<void>;
@@ -6,8 +6,8 @@ const aws_clients_1 = require("../shared/aws-clients");
6
6
  /**
7
7
  * @description Deletes a function from AWS Lambda.
8
8
  * @see [Documentation](https://remotion.dev/docs/lambda/deletefunction)
9
- * @param options.region The region the function was deployed to.
10
- * @param options.functionName The name of the function.
9
+ * @param params.region The region the function was deployed to.
10
+ * @param params.functionName The name of the function.
11
11
  * @returns {Promise<void>} Nothing. Throws if the function failed to delete.
12
12
  */
13
13
  const deleteFunction = async ({ region, functionName, }) => {
@@ -15,10 +15,10 @@ export declare type DeleteSiteOutput = {
15
15
  *
16
16
  * @description Deletes a deployed site from your S3 bucket. The opposite of deploySite().
17
17
  * @see [Documentation](https://remotion.dev/docs/lambda/deletesite)
18
- * @param options.bucketName The S3 bucket name where the site resides in.
19
- * @param options.siteName The ID of the site that you want to delete.
20
- * @param {AwsRegion} options.region The region in where the S3 bucket resides in.
21
- * @param options.onAfterItemDeleted Function that gets called after each file that gets deleted, useful for showing progress.
18
+ * @param params.bucketName The S3 bucket name where the site resides in.
19
+ * @param params.siteName The ID of the site that you want to delete.
20
+ * @param {AwsRegion} params.region The region in where the S3 bucket resides in.
21
+ * @param params.onAfterItemDeleted Function that gets called after each file that gets deleted, useful for showing progress.
22
22
  * @returns {Promise<DeleteSiteOutput>} Object containing info about how much space was freed.
23
23
  */
24
24
  export declare const deleteSite: ({ bucketName, siteName, region, onAfterItemDeleted, }: DeleteSiteInput) => Promise<DeleteSiteOutput>;
@@ -9,10 +9,10 @@ const clean_items_1 = require("./clean-items");
9
9
  *
10
10
  * @description Deletes a deployed site from your S3 bucket. The opposite of deploySite().
11
11
  * @see [Documentation](https://remotion.dev/docs/lambda/deletesite)
12
- * @param options.bucketName The S3 bucket name where the site resides in.
13
- * @param options.siteName The ID of the site that you want to delete.
14
- * @param {AwsRegion} options.region The region in where the S3 bucket resides in.
15
- * @param options.onAfterItemDeleted Function that gets called after each file that gets deleted, useful for showing progress.
12
+ * @param params.bucketName The S3 bucket name where the site resides in.
13
+ * @param params.siteName The ID of the site that you want to delete.
14
+ * @param {AwsRegion} params.region The region in where the S3 bucket resides in.
15
+ * @param params.onAfterItemDeleted Function that gets called after each file that gets deleted, useful for showing progress.
16
16
  * @returns {Promise<DeleteSiteOutput>} Object containing info about how much space was freed.
17
17
  */
18
18
  const deleteSite = async ({ bucketName, siteName, region, onAfterItemDeleted, }) => {
@@ -15,12 +15,13 @@ export declare type DeployFunctionOutput = {
15
15
  /**
16
16
  * @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
17
17
  * @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
18
- * @param options.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
19
- * @param options.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
20
- * @param options.region The region you want to deploy your function to.
21
- * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
22
- * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
23
- * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
18
+ * @param params.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
19
+ * @param params.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
20
+ * @param params.region The region you want to deploy your function to.
21
+ * @param params.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
22
+ * @param params.memorySizeInMb How much memory should be allocated to the Lambda function.
23
+ * @param params.architecture The architecture Lambda should run on. One of x86_64 and x64
24
+ * @param params.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
24
25
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
25
26
  */
26
- export declare const deployFunction: (options: DeployFunctionInput) => Promise<DeployFunctionOutput>;
27
+ export declare const deployFunction: (params: DeployFunctionInput) => Promise<DeployFunctionOutput>;
@@ -17,50 +17,51 @@ const create_function_1 = require("./create-function");
17
17
  /**
18
18
  * @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
19
19
  * @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
20
- * @param options.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
21
- * @param options.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
22
- * @param options.region The region you want to deploy your function to.
23
- * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
24
- * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
25
- * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
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.
26
27
  * @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
27
28
  */
28
- const deployFunction = async (options) => {
29
+ const deployFunction = async (params) => {
29
30
  var _a, _b;
30
- const diskSizeInMb = (_a = options.diskSizeInMb) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB;
31
- (0, validate_memory_size_1.validateMemorySize)(options.memorySizeInMb);
32
- (0, validate_timeout_1.validateTimeout)(options.timeoutInSeconds);
33
- (0, validate_aws_region_1.validateAwsRegion)(options.region);
34
- (0, validate_retention_period_1.validateCloudWatchRetentionPeriod)(options.cloudWatchLogRetentionPeriodInDays);
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);
35
36
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
36
- (0, validate_custom_role_arn_1.validateCustomRoleArn)(options.customRoleArn);
37
+ (0, validate_custom_role_arn_1.validateCustomRoleArn)(params.customRoleArn);
37
38
  const fnNameRender = [
38
39
  `${constants_1.RENDER_FN_PREFIX}${lambda_version_string_1.LAMBDA_VERSION_STRING}`,
39
- `mem${options.memorySizeInMb}mb`,
40
+ `mem${params.memorySizeInMb}mb`,
40
41
  `disk${diskSizeInMb}mb`,
41
- `${options.timeoutInSeconds}sec`,
42
+ `${params.timeoutInSeconds}sec`,
42
43
  ].join('-');
43
- 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 });
44
45
  const fns = await (0, get_functions_1.getFunctions)({
45
46
  compatibleOnly: true,
46
- region: options.region,
47
+ region: params.region,
47
48
  });
48
49
  const alreadyDeployed = fns.find((f) => f.version === version_1.VERSION &&
49
- f.memorySizeInMb === options.memorySizeInMb &&
50
- f.timeoutInSeconds === options.timeoutInSeconds &&
50
+ f.memorySizeInMb === params.memorySizeInMb &&
51
+ f.timeoutInSeconds === params.timeoutInSeconds &&
51
52
  f.diskSizeInMb === diskSizeInMb);
52
53
  const created = await (0, create_function_1.createFunction)({
53
- createCloudWatchLogGroup: options.createCloudWatchLogGroup,
54
- region: options.region,
54
+ createCloudWatchLogGroup: params.createCloudWatchLogGroup,
55
+ region: params.region,
55
56
  zipFile: function_zip_path_1.FUNCTION_ZIP_ARM64,
56
57
  functionName: fnNameRender,
57
58
  accountId,
58
- memorySizeInMb: options.memorySizeInMb,
59
- timeoutInSeconds: options.timeoutInSeconds,
60
- 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,
61
62
  alreadyCreated: Boolean(alreadyDeployed),
62
63
  ephemerealStorageInMb: diskSizeInMb,
63
- customRoleArn: options.customRoleArn,
64
+ customRoleArn: params.customRoleArn,
64
65
  });
65
66
  if (!created.FunctionName) {
66
67
  throw new Error('Lambda was created but has no name');
@@ -16,6 +16,7 @@ export declare type DeploySiteInput = {
16
16
  rootDir?: string;
17
17
  bypassBucketNameValidation?: boolean;
18
18
  };
19
+ privacy?: 'public' | 'no-acl';
19
20
  };
20
21
  export declare type DeploySiteOutput = Promise<{
21
22
  serveUrl: string;
@@ -35,4 +36,4 @@ export declare type DeploySiteOutput = Promise<{
35
36
  * @param {string} params.siteName The name of the folder in which the project gets deployed to.
36
37
  * @param {object} params.options Further options, see documentation page for this function.
37
38
  */
38
- 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;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.deploySite = void 0;
7
- const fs_1 = __importDefault(require("fs"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const io_1 = require("../functions/helpers/io");
9
9
  const bundle_site_1 = require("../shared/bundle-site");
10
10
  const constants_1 = require("../shared/constants");
@@ -14,6 +14,7 @@ const make_s3_url_1 = require("../shared/make-s3-url");
14
14
  const random_hash_1 = require("../shared/random-hash");
15
15
  const validate_aws_region_1 = require("../shared/validate-aws-region");
16
16
  const validate_bucketname_1 = require("../shared/validate-bucketname");
17
+ const validate_privacy_1 = require("../shared/validate-privacy");
17
18
  const validate_site_name_1 = require("../shared/validate-site-name");
18
19
  const bucket_exists_1 = require("./bucket-exists");
19
20
  const upload_dir_1 = require("./upload-dir");
@@ -26,7 +27,7 @@ const upload_dir_1 = require("./upload-dir");
26
27
  * @param {string} params.siteName The name of the folder in which the project gets deployed to.
27
28
  * @param {object} params.options Further options, see documentation page for this function.
28
29
  */
29
- const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }) => {
30
+ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, privacy: passedPrivacy, }) => {
30
31
  var _a, _b, _c, _d;
31
32
  (0, validate_aws_region_1.validateAwsRegion)(region);
32
33
  (0, validate_bucketname_1.validateBucketName)(bucketName, {
@@ -34,6 +35,8 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
34
35
  });
35
36
  const siteId = siteName !== null && siteName !== void 0 ? siteName : (0, random_hash_1.randomHash)();
36
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);
37
40
  const accountId = await (0, get_account_id_1.getAccountId)({ region });
38
41
  const bucketExists = await (0, bucket_exists_1.bucketExistsInRegion)({
39
42
  bucketName,
@@ -74,7 +77,7 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
74
77
  localDir: bundled,
75
78
  onProgress: (_d = options === null || options === void 0 ? void 0 : options.onUploadProgress) !== null && _d !== void 0 ? _d : (() => undefined),
76
79
  keyPrefix: subFolder,
77
- privacy: 'public',
80
+ privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
78
81
  toUpload,
79
82
  }),
80
83
  Promise.all(toDelete.map((d) => {
@@ -87,7 +90,7 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
87
90
  })),
88
91
  ]);
89
92
  if (!process.env.VITEST) {
90
- fs_1.default.rmSync(bundled, {
93
+ node_fs_1.default.rmSync(bundled, {
91
94
  recursive: true,
92
95
  });
93
96
  }
@@ -14,7 +14,7 @@ export declare type DownloadMediaOutput = {
14
14
  sizeInBytes: number;
15
15
  };
16
16
  /**
17
- * @description Triggers a render on a lambda given a composition and a lambda function.
17
+ * @description Downloads a rendered video, audio or still to the disk of the machine this API is called from.
18
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.
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
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.
14
+ * @description Downloads a rendered video, audio or still to the disk of the machine this API is called from.
15
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.
@@ -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)({
@@ -4,7 +4,7 @@ import type { AwsRegion } from '../client';
4
4
  export declare type GetCompositionsOnLambdaInput = {
5
5
  chromiumOptions?: ChromiumOptions;
6
6
  region: AwsRegion;
7
- inputProps: unknown;
7
+ inputProps: Record<string, unknown>;
8
8
  functionName: string;
9
9
  serveUrl: string;
10
10
  envVariables?: Record<string, string>;
@@ -7,8 +7,8 @@ export declare type GetFunctionsInput = {
7
7
  /**
8
8
  * @description Lists Remotion Lambda render functions deployed to AWS Lambda.
9
9
  * @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
10
- * @param options.region The region of which the functions should be listed.
11
- * @param options.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
10
+ * @param params.region The region of which the functions should be listed.
11
+ * @param params.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
12
12
  * @returns {Promise<FunctionInfo[]>} An array with the objects containing information about the deployed functions.
13
13
  */
14
- export declare const getFunctions: (options: GetFunctionsInput) => Promise<FunctionInfo[]>;
14
+ export declare const getFunctions: (params: GetFunctionsInput) => Promise<FunctionInfo[]>;
@@ -29,15 +29,15 @@ const getAllFunctions = async ({ existing, nextMarker, region, }) => {
29
29
  /**
30
30
  * @description Lists Remotion Lambda render functions deployed to AWS Lambda.
31
31
  * @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
32
- * @param options.region The region of which the functions should be listed.
33
- * @param options.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
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
34
  * @returns {Promise<FunctionInfo[]>} An array with the objects containing information about the deployed functions.
35
35
  */
36
- const getFunctions = async (options) => {
36
+ const getFunctions = async (params) => {
37
37
  const lambdas = await getAllFunctions({
38
38
  existing: [],
39
39
  nextMarker: null,
40
- region: options.region,
40
+ region: params.region,
41
41
  });
42
42
  const remotionLambdas = lambdas.filter((f) => {
43
43
  var _a;
@@ -47,7 +47,7 @@ const getFunctions = async (options) => {
47
47
  try {
48
48
  const version = await (0, get_function_version_1.getFunctionVersion)({
49
49
  functionName: fn.FunctionName,
50
- region: options.region,
50
+ region: params.region,
51
51
  });
52
52
  return version;
53
53
  }
@@ -65,11 +65,11 @@ const getFunctions = async (options) => {
65
65
  diskSizeInMb: (_b = (_a = lambda.EphemeralStorage) === null || _a === void 0 ? void 0 : _a.Size) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB,
66
66
  };
67
67
  });
68
- if (!options.compatibleOnly) {
68
+ if (!params.compatibleOnly) {
69
69
  return list;
70
70
  }
71
71
  return list.filter((l) => {
72
- if (!options.compatibleOnly) {
72
+ if (!params.compatibleOnly) {
73
73
  return true;
74
74
  }
75
75
  return l.version === version_1.VERSION;
@@ -9,7 +9,7 @@ export declare type GetOrCreateBucketOutput = {
9
9
  /**
10
10
  * @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
11
11
  * @see [Documentation](https://remotion.dev/docs/lambda/getorcreatebucket)
12
- * @param options.region The region in which you want your S3 bucket to reside in.
12
+ * @param params.region The region in which you want your S3 bucket to reside in.
13
13
  * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
14
14
  */
15
- export declare const getOrCreateBucket: (options: GetOrCreateBucketInput) => Promise<GetOrCreateBucketOutput>;
15
+ export declare const getOrCreateBucket: (params: GetOrCreateBucketInput) => Promise<GetOrCreateBucketOutput>;
@@ -8,21 +8,21 @@ const get_buckets_1 = require("./get-buckets");
8
8
  /**
9
9
  * @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
10
10
  * @see [Documentation](https://remotion.dev/docs/lambda/getorcreatebucket)
11
- * @param options.region The region in which you want your S3 bucket to reside in.
11
+ * @param params.region The region in which you want your S3 bucket to reside in.
12
12
  * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
13
13
  */
14
- const getOrCreateBucket = async (options) => {
15
- const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(options.region);
14
+ const getOrCreateBucket = async (params) => {
15
+ const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(params.region);
16
16
  if (remotionBuckets.length > 1) {
17
- throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${options.region}) starting with "${constants_1.REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
17
+ throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${params.region}) starting with "${constants_1.REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
18
18
  }
19
19
  if (remotionBuckets.length === 1) {
20
20
  return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
21
21
  }
22
- const bucketName = (0, validate_bucketname_1.makeBucketName)(options.region);
22
+ const bucketName = (0, validate_bucketname_1.makeBucketName)(params.region);
23
23
  await (0, create_bucket_1.createBucket)({
24
24
  bucketName,
25
- region: options.region,
25
+ region: params.region,
26
26
  });
27
27
  return { bucketName, alreadyExisted: false };
28
28
  };
@@ -18,4 +18,4 @@ export declare type GetRenderInput = {
18
18
  * @param {CustomCredentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
19
19
  * @returns {Promise<RenderProgress>} See documentation for this function to see all properties on the return object.
20
20
  */
21
- export declare const getRenderProgress: ({ functionName, bucketName, renderId, region, s3OutputProvider, }: GetRenderInput) => Promise<RenderProgress>;
21
+ export declare const getRenderProgress: (input: GetRenderInput) => Promise<RenderProgress>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRenderProgress = void 0;
4
- const version_1 = require("remotion/version");
5
4
  const call_lambda_1 = require("../shared/call-lambda");
6
5
  const constants_1 = require("../shared/constants");
6
+ const make_lambda_payload_1 = require("./make-lambda-payload");
7
7
  /**
8
8
  * @description Gets the current status of a render originally triggered via renderMediaOnLambda().
9
9
  * @see [Documentation](https://remotion.dev/docs/lambda/getrenderprogress)
@@ -14,17 +14,12 @@ const constants_1 = require("../shared/constants");
14
14
  * @param {CustomCredentials} params.s3OutputProvider? Endpoint and credentials if the output file is stored outside of AWS.
15
15
  * @returns {Promise<RenderProgress>} See documentation for this function to see all properties on the return object.
16
16
  */
17
- const getRenderProgress = async ({ functionName, bucketName, renderId, region, s3OutputProvider, }) => {
17
+ const getRenderProgress = async (input) => {
18
18
  const result = await (0, call_lambda_1.callLambda)({
19
- functionName,
19
+ functionName: input.functionName,
20
20
  type: constants_1.LambdaRoutines.status,
21
- payload: {
22
- bucketName,
23
- renderId,
24
- version: version_1.VERSION,
25
- s3OutputProvider,
26
- },
27
- region,
21
+ payload: (0, make_lambda_payload_1.getRenderProgressPayload)(input),
22
+ region: input.region,
28
23
  });
29
24
  return result;
30
25
  };
@@ -9,7 +9,6 @@ declare type Site = {
9
9
  };
10
10
  export declare type GetSitesInput = {
11
11
  region: AwsRegion;
12
- bucketName?: string;
13
12
  };
14
13
  export declare type GetSitesOutput = {
15
14
  sites: Site[];
@@ -37,6 +37,8 @@ exports.requiredPermissions = [
37
37
  aws_policies_1.s3.GetBucketLocation,
38
38
  aws_policies_1.s3.PutBucketAcl,
39
39
  aws_policies_1.s3.DeleteBucket,
40
+ aws_policies_1.s3.PutBucketOwnershipControls,
41
+ aws_policies_1.s3.PutBucketPublicAccessBlock,
40
42
  ],
41
43
  resource: [`arn:aws:s3:::${constants_1.REMOTION_BUCKET_PREFIX}*`],
42
44
  },
@@ -0,0 +1,5 @@
1
+ import type { LambdaStartPayload, LambdaStatusPayload } from '../defaults';
2
+ import type { GetRenderInput } from './get-render-progress';
3
+ import type { RenderMediaOnLambdaInput } from './render-media-on-lambda';
4
+ export declare const makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: RenderMediaOnLambdaInput) => Promise<LambdaStartPayload>;
5
+ export declare const getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }: GetRenderInput) => LambdaStatusPayload;