@remotion/lambda 3.2.35-crf.3 → 3.2.36

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.
package/LICENSE.md CHANGED
@@ -7,7 +7,7 @@ Depending on the type of your legal entity, you are granted permission to use Re
7
7
 
8
8
  ## Free license
9
9
 
10
- Copyright © 2022 [Jonny Burger](https://jonny.io)
10
+ Copyright © 2022 [Remotion](https://www.remotion.dev/)
11
11
 
12
12
  ### Eligibility
13
13
 
@@ -6,6 +6,7 @@ const call_lambda_1 = require("../shared/call-lambda");
6
6
  const constants_1 = require("../shared/constants");
7
7
  const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
8
  const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url");
9
+ const serialize_input_props_1 = require("../shared/serialize-input-props");
9
10
  const validate_download_behavior_1 = require("../shared/validate-download-behavior");
10
11
  const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
11
12
  const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
@@ -39,6 +40,11 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
39
40
  });
40
41
  (0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
41
42
  const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
43
+ const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
44
+ inputProps,
45
+ region,
46
+ type: 'video-or-audio',
47
+ });
42
48
  try {
43
49
  const res = await (0, call_lambda_1.callLambda)({
44
50
  functionName,
@@ -47,7 +53,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
47
53
  framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
48
54
  composition,
49
55
  serveUrl: realServeUrl,
50
- inputProps: inputProps !== null && inputProps !== void 0 ? inputProps : {},
56
+ inputProps: serializedInputProps,
51
57
  codec: actualCodec,
52
58
  imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg',
53
59
  crf,
@@ -6,6 +6,7 @@ const call_lambda_1 = require("../shared/call-lambda");
6
6
  const constants_1 = require("../shared/constants");
7
7
  const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
8
  const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url");
9
+ const serialize_input_props_1 = require("../shared/serialize-input-props");
9
10
  /**
10
11
  * @description Renders a still frame on Lambda
11
12
  * @link https://remotion.dev/docs/lambda/renderstillonlambda
@@ -25,6 +26,11 @@ const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url
25
26
  const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
26
27
  var _a;
27
28
  const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
29
+ const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
30
+ inputProps,
31
+ region,
32
+ type: 'still',
33
+ });
28
34
  try {
29
35
  const res = await (0, call_lambda_1.callLambda)({
30
36
  functionName,
@@ -32,7 +38,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
32
38
  payload: {
33
39
  composition,
34
40
  serveUrl: realServeUrl,
35
- inputProps,
41
+ inputProps: serializedInputProps,
36
42
  imageFormat,
37
43
  envVariables,
38
44
  quality,
@@ -7,10 +7,12 @@ const download_media_1 = require("../../../api/download-media");
7
7
  const get_render_progress_1 = require("../../../api/get-render-progress");
8
8
  const render_media_on_lambda_1 = require("../../../api/render-media-on-lambda");
9
9
  const constants_1 = require("../../../shared/constants");
10
+ const convert_to_serve_url_1 = require("../../../shared/convert-to-serve-url");
10
11
  const sleep_1 = require("../../../shared/sleep");
11
12
  const validate_frames_per_lambda_1 = require("../../../shared/validate-frames-per-lambda");
12
13
  const validate_privacy_1 = require("../../../shared/validate-privacy");
13
14
  const validate_retries_1 = require("../../../shared/validate-retries");
15
+ const validate_serveurl_1 = require("../../../shared/validate-serveurl");
14
16
  const args_1 = require("../../args");
15
17
  const get_aws_region_1 = require("../../get-aws-region");
16
18
  const find_function_name_1 = require("../../helpers/find-function-name");
@@ -28,13 +30,15 @@ const renderCommand = async (args) => {
28
30
  log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.RENDER_COMMAND} <serve-url> <composition-id> [output-location]`);
29
31
  (0, quit_1.quit)(1);
30
32
  }
31
- const composition = args[1];
33
+ const region = (0, get_aws_region_1.getAwsRegion)();
34
+ let composition = args[1];
32
35
  if (!composition) {
33
- log_1.Log.error('No composition ID passed.');
34
- log_1.Log.info('Pass an additional argument specifying the composition ID.');
35
- log_1.Log.info();
36
- log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.RENDER_COMMAND} <serve-url> <composition-id> [output-location]`);
37
- (0, quit_1.quit)(1);
36
+ log_1.Log.info('No compositions passed. Fetching compositions...');
37
+ (0, validate_serveurl_1.validateServeUrl)(serveUrl);
38
+ const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
39
+ const comps = await (0, renderer_1.getCompositions)(realServeUrl);
40
+ const { compositionId } = await cli_1.CliInternals.selectComposition(comps);
41
+ composition = compositionId;
38
42
  }
39
43
  const outName = args_1.parsedLambdaCli['out-name'];
40
44
  const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
@@ -48,7 +52,6 @@ const renderCommand = async (args) => {
48
52
  codec,
49
53
  });
50
54
  const functionName = await (0, find_function_name_1.findFunctionName)();
51
- const region = (0, get_aws_region_1.getAwsRegion)();
52
55
  const maxRetries = (_b = args_1.parsedLambdaCli['max-retries']) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_RETRIES;
53
56
  (0, validate_retries_1.validateMaxRetries)(maxRetries);
54
57
  const privacy = (_c = args_1.parsedLambdaCli.privacy) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_OUTPUT_PRIVACY;
@@ -6,8 +6,10 @@ const renderer_1 = require("@remotion/renderer");
6
6
  const download_media_1 = require("../../api/download-media");
7
7
  const render_still_on_lambda_1 = require("../../api/render-still-on-lambda");
8
8
  const constants_1 = require("../../shared/constants");
9
+ const convert_to_serve_url_1 = require("../../shared/convert-to-serve-url");
9
10
  const validate_privacy_1 = require("../../shared/validate-privacy");
10
11
  const validate_retries_1 = require("../../shared/validate-retries");
12
+ const validate_serveurl_1 = require("../../shared/validate-serveurl");
11
13
  const args_1 = require("../args");
12
14
  const get_aws_region_1 = require("../get-aws-region");
13
15
  const find_function_name_1 = require("../helpers/find-function-name");
@@ -24,13 +26,17 @@ const stillCommand = async (args) => {
24
26
  log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.STILL_COMMAND} <serve-url> <composition-id> [output-location]`);
25
27
  (0, quit_1.quit)(1);
26
28
  }
27
- const composition = args[1];
29
+ const region = (0, get_aws_region_1.getAwsRegion)();
30
+ let composition = args[1];
28
31
  if (!composition) {
29
- log_1.Log.error('No composition ID passed.');
30
- log_1.Log.info('Pass an additional argument specifying the composition ID.');
31
- log_1.Log.info();
32
- log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.STILL_COMMAND} <serve-url> <composition-id> [output-location]`);
33
- (0, quit_1.quit)(1);
32
+ if (!composition) {
33
+ log_1.Log.info('No compositions passed. Fetching compositions...');
34
+ (0, validate_serveurl_1.validateServeUrl)(serveUrl);
35
+ const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
36
+ const comps = await (0, renderer_1.getCompositions)(realServeUrl);
37
+ const { compositionId } = await cli_1.CliInternals.selectComposition(comps);
38
+ composition = compositionId;
39
+ }
34
40
  }
35
41
  const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
36
42
  const outName = args_1.parsedLambdaCli['out-name'];
@@ -60,7 +66,7 @@ const stillCommand = async (args) => {
60
66
  imageFormat,
61
67
  composition,
62
68
  privacy,
63
- region: (0, get_aws_region_1.getAwsRegion)(),
69
+ region,
64
70
  maxRetries,
65
71
  envVariables,
66
72
  frame: stillFrame,
@@ -78,7 +84,7 @@ const stillCommand = async (args) => {
78
84
  const { outputPath, sizeInBytes } = await (0, download_media_1.downloadMedia)({
79
85
  bucketName: res.bucketName,
80
86
  outPath: downloadName,
81
- region: (0, get_aws_region_1.getAwsRegion)(),
87
+ region,
82
88
  renderId: res.renderId,
83
89
  });
84
90
  log_1.Log.info('Done!', outputPath, cli_1.CliInternals.formatBytes(sizeInBytes));
@@ -10,7 +10,9 @@ const fs_1 = __importDefault(require("fs"));
10
10
  const remotion_1 = require("remotion");
11
11
  const version_1 = require("remotion/version");
12
12
  const aws_clients_1 = require("../shared/aws-clients");
13
+ const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
13
14
  const constants_1 = require("../shared/constants");
15
+ const deserialize_input_props_1 = require("../shared/deserialize-input-props");
14
16
  const docs_url_1 = require("../shared/docs-url");
15
17
  const invoke_webhook_1 = require("../shared/invoke-webhook");
16
18
  const make_s3_url_1 = require("../shared/make-s3-url");
@@ -123,11 +125,17 @@ const innerLaunchHandler = async (params, options) => {
123
125
  }),
124
126
  ]);
125
127
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
128
+ const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
129
+ bucketName: params.bucketName,
130
+ expectedBucketOwner: options.expectedBucketOwner,
131
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
132
+ serialized: params.inputProps,
133
+ });
126
134
  const comp = await (0, validate_composition_1.validateComposition)({
127
135
  serveUrl: params.serveUrl,
128
136
  composition: params.composition,
129
137
  browserInstance,
130
- inputProps: params.inputProps,
138
+ inputProps: await inputPropsPromise,
131
139
  envVariables: params.envVariables,
132
140
  ffmpegExecutable: null,
133
141
  ffprobeExecutable: null,
@@ -453,6 +461,11 @@ const innerLaunchHandler = async (params, options) => {
453
461
  contents,
454
462
  jobs,
455
463
  });
464
+ const cleanupSerializedInputPropsProm = (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
465
+ bucketName: params.bucketName,
466
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
467
+ serialized: params.inputProps,
468
+ });
456
469
  const outputUrl = (0, get_output_url_from_metadata_1.getOutputUrlFromMetadata)(renderMetadata, params.bucketName, customCredentials);
457
470
  const postRenderData = (0, create_post_render_data_1.createPostRenderData)({
458
471
  expectedBucketOwner: options.expectedBucketOwner,
@@ -463,7 +476,7 @@ const innerLaunchHandler = async (params, options) => {
463
476
  contents,
464
477
  errorExplanations: await errorExplanationsProm,
465
478
  timeToEncode: encodingStop - encodingStart,
466
- timeToDelete: await deletProm,
479
+ timeToDelete: (await Promise.all([deletProm, cleanupSerializedInputPropsProm])).reduce((a, b) => a + b, 0),
467
480
  outputFile: {
468
481
  lastModified: Date.now(),
469
482
  size: outputSize.size,
@@ -10,6 +10,7 @@ const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const aws_clients_1 = require("../shared/aws-clients");
12
12
  const constants_1 = require("../shared/constants");
13
+ const deserialize_input_props_1 = require("../shared/deserialize-input-props");
13
14
  const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
14
15
  const get_browser_instance_1 = require("./helpers/get-browser-instance");
15
16
  const get_current_region_1 = require("./helpers/get-current-region");
@@ -22,6 +23,12 @@ const renderHandler = async (params, options, logs) => {
22
23
  if (params.type !== constants_1.LambdaRoutines.renderer) {
23
24
  throw new Error('Params must be renderer');
24
25
  }
26
+ const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
27
+ bucketName: params.bucketName,
28
+ expectedBucketOwner: options.expectedBucketOwner,
29
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
30
+ serialized: params.inputProps,
31
+ });
25
32
  const browserInstance = await (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'), (_a = params.chromiumOptions) !== null && _a !== void 0 ? _a : {});
26
33
  const outputPath = renderer_1.RenderInternals.tmpDir('remotion-render-');
27
34
  if (typeof params.chunk !== 'number') {
@@ -42,6 +49,7 @@ const renderHandler = async (params, options, logs) => {
42
49
  const chunkCodec = params.codec === 'gif' ? 'h264-mkv' : params.codec;
43
50
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
44
51
  const downloads = {};
52
+ const inputProps = await inputPropsPromise;
45
53
  await new Promise((resolve, reject) => {
46
54
  var _a;
47
55
  (0, renderer_1.renderMedia)({
@@ -53,7 +61,7 @@ const renderHandler = async (params, options, logs) => {
53
61
  width: params.width,
54
62
  },
55
63
  imageFormat: params.imageFormat,
56
- inputProps: params.inputProps,
64
+ inputProps,
57
65
  frameRange: params.frameRange,
58
66
  onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
59
67
  if (renderedFrames % 10 === 0 &&
@@ -12,7 +12,9 @@ const version_1 = require("remotion/version");
12
12
  const estimate_price_1 = require("../api/estimate-price");
13
13
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
14
14
  const aws_clients_1 = require("../shared/aws-clients");
15
+ const cleanup_serialized_input_props_1 = require("../shared/cleanup-serialized-input-props");
15
16
  const constants_1 = require("../shared/constants");
17
+ const deserialize_input_props_1 = require("../shared/deserialize-input-props");
16
18
  const make_s3_url_1 = require("../shared/make-s3-url");
17
19
  const random_hash_1 = require("../shared/random-hash");
18
20
  const validate_download_behavior_1 = require("../shared/validate-download-behavior");
@@ -48,6 +50,12 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
48
50
  }),
49
51
  (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
50
52
  ]);
53
+ const inputPropsPromise = (0, deserialize_input_props_1.deserializeInputProps)({
54
+ bucketName,
55
+ expectedBucketOwner: options.expectedBucketOwner,
56
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
57
+ serialized: lambdaParams.inputProps,
58
+ });
51
59
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
52
60
  const outputPath = path_1.default.join(outputDir, 'output');
53
61
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
@@ -95,6 +103,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
95
103
  downloadBehavior: null,
96
104
  customCredentials: null,
97
105
  });
106
+ const inputProps = await inputPropsPromise;
98
107
  await (0, renderer_1.renderStill)({
99
108
  composition,
100
109
  output: outputPath,
@@ -106,7 +115,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
106
115
  durationInFrames: composition.durationInFrames,
107
116
  }),
108
117
  imageFormat: lambdaParams.imageFormat,
109
- inputProps: lambdaParams.inputProps,
118
+ inputProps,
110
119
  overwrite: false,
111
120
  puppeteerInstance: browserInstance,
112
121
  quality: lambdaParams.quality,
@@ -127,7 +136,14 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
127
136
  downloadBehavior: lambdaParams.downloadBehavior,
128
137
  customCredentials,
129
138
  });
130
- await fs_1.default.promises.rm(outputPath, { recursive: true });
139
+ await Promise.all([
140
+ fs_1.default.promises.rm(outputPath, { recursive: true }),
141
+ (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
142
+ bucketName,
143
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
144
+ serialized: lambdaParams.inputProps,
145
+ }),
146
+ ]);
131
147
  const estimatedPrice = (0, estimate_price_1.estimatePrice)({
132
148
  durationInMiliseconds: Date.now() - start + 100,
133
149
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
@@ -0,0 +1,7 @@
1
+ import type { AwsRegion } from '../client';
2
+ import type { SerializedInputProps } from './constants';
3
+ export declare const cleanupSerializedInputProps: ({ serialized, region, bucketName, }: {
4
+ serialized: SerializedInputProps;
5
+ region: AwsRegion;
6
+ bucketName: string;
7
+ }) => Promise<void>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanupSerializedInputProps = void 0;
4
+ const io_1 = require("../functions/helpers/io");
5
+ const constants_1 = require("./constants");
6
+ const cleanupSerializedInputProps = async ({ serialized, region, bucketName, }) => {
7
+ if (serialized.type === 'payload') {
8
+ return undefined;
9
+ }
10
+ await (0, io_1.lambdaDeleteFile)({
11
+ bucketName,
12
+ key: (0, constants_1.inputPropsKey)(serialized.hash),
13
+ region,
14
+ customCredentials: null,
15
+ });
16
+ };
17
+ exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
@@ -0,0 +1,7 @@
1
+ import type { AwsRegion } from '../client';
2
+ import type { SerializedInputProps } from './constants';
3
+ export declare const cleanupSerializedInputProps: ({ serialized, region, bucketName, }: {
4
+ serialized: SerializedInputProps;
5
+ region: AwsRegion;
6
+ bucketName: string;
7
+ }) => Promise<number>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanupSerializedInputProps = void 0;
4
+ const io_1 = require("../functions/helpers/io");
5
+ const constants_1 = require("./constants");
6
+ const cleanupSerializedInputProps = async ({ serialized, region, bucketName, }) => {
7
+ if (serialized.type === 'payload') {
8
+ return 0;
9
+ }
10
+ const time = Date.now();
11
+ await (0, io_1.lambdaDeleteFile)({
12
+ bucketName,
13
+ key: (0, constants_1.inputPropsKey)(serialized.hash),
14
+ region,
15
+ customCredentials: null,
16
+ });
17
+ return Date.now() - time;
18
+ };
19
+ exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
@@ -0,0 +1 @@
1
+ declare const hi: (query: string) => Promise<void>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ const hi = async (query) => {
3
+ await fetch('https://plsduol1ca-dsn.algolianet.com/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20JavaScript%20(4.14.2)%3B%20Browser%20(lite)%3B%20docsearch%20(3.2.1)%3B%20docsearch-react%20(3.2.1)%3B%20docusaurus%20(2.1.0)&x-algolia-api-key=3e42dbd4f895fe93ff5cf40d860c4a85&x-algolia-application-id=PLSDUOL1CA', {
4
+ headers: {
5
+ 'content-type': 'application/x-www-form-urlencoded',
6
+ },
7
+ body: JSON.stringify({
8
+ requests: [
9
+ {
10
+ query,
11
+ indexName: 'remotion',
12
+ params: 'attributesToRetrieve=%5B%22hierarchy.lvl0%22%2C%22hierarchy.lvl1%22%2C%22hierarchy.lvl2%22%2C%22hierarchy.lvl3%22%2C%22hierarchy.lvl4%22%2C%22hierarchy.lvl5%22%2C%22hierarchy.lvl6%22%2C%22content%22%2C%22type%22%2C%22url%22%5D&attributesToSnippet=%5B%22hierarchy.lvl1%3A10%22%2C%22hierarchy.lvl2%3A10%22%2C%22hierarchy.lvl3%3A10%22%2C%22hierarchy.lvl4%3A10%22%2C%22hierarchy.lvl5%3A10%22%2C%22hierarchy.lvl6%3A10%22%2C%22content%3A10%22%5D&snippetEllipsisText=%E2%80%A6&highlightPreTag=%3Cmark%3E&highlightPostTag=%3C%2Fmark%3E&hitsPerPage=20&facetFilters=%5B%5D',
13
+ },
14
+ ],
15
+ }),
16
+ method: 'POST',
17
+ }).then((res) => res.json());
18
+ };
@@ -81,6 +81,7 @@ export declare const outName: (renderId: string, extension: string) => string;
81
81
  export declare const outStillName: (renderId: string, imageFormat: ImageFormat) => string;
82
82
  export declare const customOutName: (renderId: string, bucketName: string, name: OutNameInput) => OutNameOutput;
83
83
  export declare const postRenderDataKey: (renderId: string) => string;
84
+ export declare const inputPropsKey: (hash: string) => string;
84
85
  export declare const RENDERER_PATH_TOKEN = "remotion-bucket";
85
86
  export declare const CONCAT_FOLDER_TOKEN = "remotion-concat";
86
87
  export declare const REMOTION_CONCATED_TOKEN = "remotion-concated-token";
@@ -97,6 +98,13 @@ declare type WebhookOption = null | {
97
98
  url: string;
98
99
  secret: string | null;
99
100
  };
101
+ export declare type SerializedInputProps = {
102
+ type: 'bucket-url';
103
+ hash: string;
104
+ } | {
105
+ type: 'payload';
106
+ payload: unknown;
107
+ };
100
108
  export declare type LambdaPayloads = {
101
109
  info: {
102
110
  type: LambdaRoutines.info;
@@ -106,7 +114,7 @@ export declare type LambdaPayloads = {
106
114
  serveUrl: string;
107
115
  composition: string;
108
116
  framesPerLambda: number | null;
109
- inputProps: unknown;
117
+ inputProps: SerializedInputProps;
110
118
  codec: LambdaCodec;
111
119
  imageFormat: ImageFormat;
112
120
  crf: number | undefined;
@@ -139,7 +147,7 @@ export declare type LambdaPayloads = {
139
147
  composition: string;
140
148
  framesPerLambda: number | null;
141
149
  bucketName: string;
142
- inputProps: unknown;
150
+ inputProps: SerializedInputProps;
143
151
  renderId: string;
144
152
  imageFormat: ImageFormat;
145
153
  codec: LambdaCodec;
@@ -186,7 +194,7 @@ export declare type LambdaPayloads = {
186
194
  width: number;
187
195
  durationInFrames: number;
188
196
  retriesLeft: number;
189
- inputProps: unknown;
197
+ inputProps: SerializedInputProps;
190
198
  renderId: string;
191
199
  imageFormat: ImageFormat;
192
200
  codec: Exclude<Codec, 'h264'>;
@@ -210,7 +218,7 @@ export declare type LambdaPayloads = {
210
218
  type: LambdaRoutines.still;
211
219
  serveUrl: string;
212
220
  composition: string;
213
- inputProps: unknown;
221
+ inputProps: SerializedInputProps;
214
222
  imageFormat: ImageFormat;
215
223
  envVariables: Record<string, string> | undefined;
216
224
  attempt: number;
@@ -246,7 +254,7 @@ export declare type RenderMetadata = {
246
254
  usesOptimizationProfile: boolean;
247
255
  type: 'still' | 'video';
248
256
  imageFormat: ImageFormat;
249
- inputProps: unknown;
257
+ inputProps: SerializedInputProps;
250
258
  framesPerLambda: number;
251
259
  memorySizeInMb: number;
252
260
  lambdaVersion: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.optimizationProfile = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
3
+ exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.inputPropsKey = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.optimizationProfile = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
4
4
  exports.MIN_MEMORY = 512;
5
5
  exports.MAX_MEMORY = 10240;
6
6
  exports.DEFAULT_MEMORY_SIZE = 2048;
@@ -79,6 +79,10 @@ const postRenderDataKey = (renderId) => {
79
79
  return `${(0, exports.rendersPrefix)(renderId)}/post-render-metadata.json`;
80
80
  };
81
81
  exports.postRenderDataKey = postRenderDataKey;
82
+ const inputPropsKey = (hash) => {
83
+ return `input-props/${hash}.json`;
84
+ };
85
+ exports.inputPropsKey = inputPropsKey;
82
86
  exports.RENDERER_PATH_TOKEN = 'remotion-bucket';
83
87
  exports.CONCAT_FOLDER_TOKEN = 'remotion-concat';
84
88
  exports.REMOTION_CONCATED_TOKEN = 'remotion-concated-token';
@@ -0,0 +1,8 @@
1
+ import type { AwsRegion } from '../client';
2
+ import type { SerializedInputProps } from './constants';
3
+ export declare const deserializeInputProps: ({ serialized, region, bucketName, expectedBucketOwner, }: {
4
+ serialized: SerializedInputProps;
5
+ region: AwsRegion;
6
+ bucketName: string;
7
+ expectedBucketOwner: string;
8
+ }) => Promise<unknown>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeInputProps = void 0;
4
+ const io_1 = require("../functions/helpers/io");
5
+ const constants_1 = require("./constants");
6
+ const stream_to_string_1 = require("./stream-to-string");
7
+ const deserializeInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, }) => {
8
+ if (serialized.type === 'payload') {
9
+ return {
10
+ inputProps: serialized.payload,
11
+ };
12
+ }
13
+ try {
14
+ const response = await (0, io_1.lambdaReadFile)({
15
+ bucketName,
16
+ expectedBucketOwner,
17
+ key: (0, constants_1.inputPropsKey)(serialized.hash),
18
+ region,
19
+ });
20
+ const body = await (0, stream_to_string_1.streamToString)(response);
21
+ const payload = JSON.parse(body);
22
+ return payload;
23
+ }
24
+ catch (err) {
25
+ throw new Error('Failed to parse input props that were');
26
+ }
27
+ };
28
+ exports.deserializeInputProps = deserializeInputProps;
@@ -0,0 +1 @@
1
+ declare const hi: (query: string) => Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ const hi = async (query) => {
3
+ await fetch('https://plsduol1ca-dsn.algolianet.com/1/indexes/*/queries?x-algolia-agent=' +
4
+ encodeURIComponent('Remotion Preview DocSearch') +
5
+ '&x-algolia-api-key=3e42dbd4f895fe93ff5cf40d860c4a85&x-algolia-application-id=PLSDUOL1CA', {
6
+ headers: {
7
+ 'content-type': 'application/x-www-form-urlencoded',
8
+ },
9
+ body: JSON.stringify({
10
+ requests: [
11
+ {
12
+ query,
13
+ indexName: 'remotion',
14
+ params: encodeURIComponent('attributesToRetrieve=["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"]&attributesToSnippet=["hierarchy.lvl1:10","hierarchy.lvl2:10","hierarchy.lvl3:10","hierarchy.lvl4:10","hierarchy.lvl5:10","hierarchy.lvl6:10","content:10"]&snippetEllipsisText=…&highlightPreTag=<mark>&highlightPostTag=</mark>&hitsPerPage=20&facetFilters=[]'),
15
+ },
16
+ ],
17
+ }),
18
+ method: 'POST',
19
+ }).then((res) => res.json());
20
+ };
21
+ hi();
@@ -0,0 +1,7 @@
1
+ import type { AwsRegion } from '../client';
2
+ import type { SerializedInputProps } from './constants';
3
+ export declare const serializeInputProps: ({ inputProps, region, type, }: {
4
+ inputProps: unknown;
5
+ region: AwsRegion;
6
+ type: 'still' | 'video-or-audio';
7
+ }) => Promise<SerializedInputProps>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeInputProps = void 0;
4
+ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
5
+ const io_1 = require("../functions/helpers/io");
6
+ const constants_1 = require("./constants");
7
+ const random_hash_1 = require("./random-hash");
8
+ const serializeInputProps = async ({ inputProps, region, type, }) => {
9
+ try {
10
+ const payload = JSON.stringify(inputProps);
11
+ const hash = (0, random_hash_1.randomHash)();
12
+ const MAX_INLINE_PAYLOAD_SIZE = type === 'still' ? 5000000 : 200000;
13
+ if (payload.length > MAX_INLINE_PAYLOAD_SIZE) {
14
+ console.warn(`Warning: inputProps are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(payload.length / 1024)}KB) in size. Uploading them to S3 to circumvent AWS Lambda payload size.`);
15
+ const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
16
+ region,
17
+ });
18
+ await (0, io_1.lambdaWriteFile)({
19
+ body: payload,
20
+ bucketName,
21
+ region,
22
+ customCredentials: null,
23
+ downloadBehavior: null,
24
+ expectedBucketOwner: null,
25
+ key: (0, constants_1.inputPropsKey)(hash),
26
+ privacy: 'public',
27
+ });
28
+ return {
29
+ type: 'bucket-url',
30
+ hash,
31
+ };
32
+ }
33
+ return {
34
+ type: 'payload',
35
+ payload,
36
+ };
37
+ }
38
+ catch (err) {
39
+ throw new Error('Error serializing inputProps. Check it has no circular references or reduce the size if the object is big.');
40
+ }
41
+ };
42
+ exports.serializeInputProps = serializeInputProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.2.35-crf.3+08916235b",
3
+ "version": "3.2.36",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -31,12 +31,12 @@
31
31
  "@aws-sdk/client-service-quotas": "3.190.0",
32
32
  "@aws-sdk/lib-storage": "3.190.0",
33
33
  "@aws-sdk/s3-request-presigner": "3.190.0",
34
- "@remotion/bundler": "3.2.35-crf.3+08916235b",
35
- "@remotion/cli": "3.2.35-crf.3+08916235b",
36
- "@remotion/renderer": "3.2.35-crf.3+08916235b",
34
+ "@remotion/bundler": "3.2.36",
35
+ "@remotion/cli": "3.2.36",
36
+ "@remotion/renderer": "3.2.36",
37
37
  "aws-policies": "^1.0.1",
38
38
  "mime-types": "2.1.34",
39
- "remotion": "3.2.35-crf.3+08916235b"
39
+ "remotion": "3.2.36"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=16.8.0",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "08916235b80e2f2bee603e2ba0ea8827b436cf8c"
62
+ "gitHead": "69d6e23f17b14509aee4d327b3481fd4e15df4a4"
63
63
  }
Binary file