@remotion/lambda 3.1.2 → 3.1.5

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 (29) hide show
  1. package/dist/api/presign-url.d.ts +2 -1
  2. package/dist/api/render-media-on-lambda.d.ts +4 -2
  3. package/dist/api/render-media-on-lambda.js +4 -1
  4. package/dist/api/render-still-on-lambda.d.ts +3 -1
  5. package/dist/api/render-still-on-lambda.js +2 -1
  6. package/dist/cli/commands/render/progress.d.ts +1 -1
  7. package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.d.ts +4 -1
  8. package/dist/functions/chunk-optimization/optimize-profile.d.ts +8 -2
  9. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  10. package/dist/functions/chunk-optimization/s3-optimization-file.js +1 -0
  11. package/dist/functions/chunk-optimization/simulate-frame-ranges.d.ts +4 -1
  12. package/dist/functions/helpers/io.d.ts +3 -1
  13. package/dist/functions/helpers/io.js +3 -1
  14. package/dist/functions/helpers/write-lambda-error.js +1 -0
  15. package/dist/functions/helpers/write-post-render-data.js +1 -0
  16. package/dist/functions/launch.js +4 -0
  17. package/dist/functions/renderer.js +5 -2
  18. package/dist/functions/start.js +1 -0
  19. package/dist/functions/still.js +4 -0
  20. package/dist/shared/constants.d.ts +5 -1
  21. package/dist/shared/constants.js +1 -1
  22. package/dist/shared/content-disposition-header.d.ts +7 -0
  23. package/dist/shared/content-disposition-header.js +19 -0
  24. package/dist/shared/validate-download-behavior.d.ts +1 -0
  25. package/dist/shared/validate-download-behavior.js +21 -0
  26. package/dist/shared/validate-presign-expiration.d.ts +0 -2
  27. package/dist/shared/validate-presign-expiration.js +7 -7
  28. package/package.json +6 -6
  29. package/remotionlambda.zip +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- export declare type PresignURLInput = {
2
+ declare type PresignURLInput = {
3
3
  region: AwsRegion;
4
4
  bucketName: string;
5
5
  objectKey: string;
@@ -17,3 +17,4 @@ export declare type PresignURLInput = {
17
17
  * @returns {Promise<string | null>} The public url of an object or `null` if `checkIfObjectExists=true` & object does not exist.
18
18
  */
19
19
  export declare const presignUrl: ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }: PresignURLInput) => Promise<string | null>;
20
+ export {};
@@ -2,6 +2,7 @@ import type { ChromiumOptions } from '@remotion/renderer';
2
2
  import type { FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from 'remotion';
3
3
  import type { AwsRegion } from '../pricing/aws-regions';
4
4
  import type { OutNameInput, Privacy } from '../shared/constants';
5
+ import type { DownloadBehavior } from '../shared/content-disposition-header';
5
6
  import type { LambdaCodec } from '../shared/validate-lambda-codec';
6
7
  export declare type RenderMediaOnLambdaInput = {
7
8
  region: AwsRegion;
@@ -28,6 +29,7 @@ export declare type RenderMediaOnLambdaInput = {
28
29
  everyNthFrame?: number;
29
30
  numberOfGifLoops?: number | null;
30
31
  concurrencyPerLambda?: number;
32
+ downloadBehavior?: DownloadBehavior | null;
31
33
  };
32
34
  export declare type RenderMediaOnLambdaOutput = {
33
35
  renderId: string;
@@ -51,8 +53,8 @@ export declare type RenderMediaOnLambdaOutput = {
51
53
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
52
54
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
53
55
  */
54
- export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
56
+ export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
55
57
  /**
56
58
  * @deprecated Renamed to renderMediaOnLambda()
57
59
  */
58
- export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
60
+ export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
@@ -5,6 +5,7 @@ const remotion_1 = require("remotion");
5
5
  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
+ const validate_download_behavior_1 = require("../shared/validate-download-behavior");
8
9
  const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
9
10
  const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
10
11
  const validate_serveurl_1 = require("../shared/validate-serveurl");
@@ -26,10 +27,11 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
26
27
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
27
28
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
28
29
  */
29
- const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, }) => {
30
+ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, }) => {
30
31
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
31
32
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
32
33
  (0, validate_frames_per_lambda_1.validateFramesPerLambda)(framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null);
34
+ (0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
33
35
  const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
34
36
  const res = await (0, call_lambda_1.callLambda)({
35
37
  functionName,
@@ -57,6 +59,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
57
59
  everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
58
60
  numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : 0,
59
61
  concurrencyPerLambda: concurrencyPerLambda !== null && concurrencyPerLambda !== void 0 ? concurrencyPerLambda : 1,
62
+ downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
60
63
  },
61
64
  region,
62
65
  });
@@ -2,6 +2,7 @@ import type { ChromiumOptions } from '@remotion/renderer';
2
2
  import type { LogLevel, StillImageFormat } from 'remotion';
3
3
  import type { AwsRegion } from '../pricing/aws-regions';
4
4
  import type { CostsInfo, OutNameInput } from '../shared/constants';
5
+ import type { DownloadBehavior } from '../shared/content-disposition-header';
5
6
  export declare type RenderStillOnLambdaInput = {
6
7
  region: AwsRegion;
7
8
  functionName: string;
@@ -19,6 +20,7 @@ export declare type RenderStillOnLambdaInput = {
19
20
  timeoutInMilliseconds?: number;
20
21
  chromiumOptions?: ChromiumOptions;
21
22
  scale?: number;
23
+ downloadBehavior?: DownloadBehavior;
22
24
  };
23
25
  export declare type RenderStillOnLambdaOutput = {
24
26
  estimatedPrice: CostsInfo;
@@ -43,4 +45,4 @@ export declare type RenderStillOnLambdaOutput = {
43
45
  * @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
44
46
  * @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
45
47
  */
46
- export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
48
+ export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
@@ -21,7 +21,7 @@ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
21
21
  * @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
22
22
  * @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
23
23
  */
24
- const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, }) => {
24
+ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
25
25
  const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
26
26
  const res = await (0, call_lambda_1.callLambda)({
27
27
  functionName,
@@ -42,6 +42,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
42
42
  timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : remotion_1.Internals.DEFAULT_PUPPETEER_TIMEOUT,
43
43
  chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
44
44
  scale: scale !== null && scale !== void 0 ? scale : 1,
45
+ downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
45
46
  },
46
47
  region,
47
48
  });
@@ -10,7 +10,7 @@ declare type ChunkProgress = {
10
10
  chunksInvoked: number;
11
11
  doneIn: number | null;
12
12
  };
13
- export declare type MultiRenderProgress = {
13
+ declare type MultiRenderProgress = {
14
14
  lambdaInvokeProgress: LambdaInvokeProgress;
15
15
  chunkProgress: ChunkProgress;
16
16
  encodingProgress: EncodingProgress;
@@ -1,3 +1,6 @@
1
1
  import type { TimingProfile } from './types';
2
- export declare const getFrameRangesFromProfile: (profile: TimingProfile) => [number, number][];
2
+ export declare const getFrameRangesFromProfile: (profile: TimingProfile) => [
3
+ number,
4
+ number
5
+ ][];
3
6
  export declare const sortProfileByFrameRanges: (profile: TimingProfile) => import("./types").ChunkTimingData[];
@@ -1,9 +1,15 @@
1
1
  import type { TimingProfile } from './types';
2
2
  export declare const assignFrameToOther: ({ frameRanges, fromChunk, toChunk, framesToShift, }: {
3
- frameRanges: [number, number][];
3
+ frameRanges: [
4
+ number,
5
+ number
6
+ ][];
4
7
  fromChunk: number;
5
8
  toChunk: number;
6
9
  framesToShift: number;
7
- }) => [number, number][];
10
+ }) => [
11
+ number,
12
+ number
13
+ ][];
8
14
  export declare const optimizeProfile: (_profile: TimingProfile) => TimingProfile;
9
15
  export declare const optimizeProfileRecursively: (profile: TimingProfile, amount: number) => TimingProfile;
@@ -6,6 +6,9 @@ export declare const planFrameRanges: ({ framesPerLambda, optimization, shouldUs
6
6
  frameRange: [number, number];
7
7
  everyNthFrame: number;
8
8
  }) => {
9
- chunks: [number, number][];
9
+ chunks: [
10
+ number,
11
+ number
12
+ ][];
10
13
  didUseOptimization: boolean;
11
14
  };
@@ -12,6 +12,7 @@ const writeOptimization = async ({ bucketName, optimization, compositionId, site
12
12
  region,
13
13
  privacy: 'private',
14
14
  expectedBucketOwner,
15
+ downloadBehavior: null,
15
16
  });
16
17
  };
17
18
  exports.writeOptimization = writeOptimization;
@@ -3,5 +3,8 @@ export declare const getTimingForFrame: (profile: TimingProfile, frame: number)
3
3
  export declare const getSimulatedTimingForFrameRange: (profile: TimingProfile, frameRange: [number, number]) => ChunkTimingData['timings'];
4
4
  export declare const simulateFrameRanges: ({ profile, newFrameRanges, }: {
5
5
  profile: TimingProfile;
6
- newFrameRanges: [number, number][];
6
+ newFrameRanges: [
7
+ number,
8
+ number
9
+ ][];
7
10
  }) => TimingProfile;
@@ -3,6 +3,7 @@ import type { ReadStream } from 'fs';
3
3
  import type { Readable } from 'stream';
4
4
  import type { AwsRegion } from '../../pricing/aws-regions';
5
5
  import type { Privacy } from '../../shared/constants';
6
+ import type { DownloadBehavior } from '../../shared/content-disposition-header';
6
7
  export declare type LambdaLSInput = {
7
8
  bucketName: string;
8
9
  prefix: string;
@@ -12,13 +13,14 @@ export declare type LambdaLSInput = {
12
13
  };
13
14
  export declare type LambdaLsReturnType = Promise<_Object[]>;
14
15
  export declare const lambdaLs: ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }: LambdaLSInput) => LambdaLsReturnType;
15
- export declare const lambdaWriteFile: ({ bucketName, key, body, region, privacy, expectedBucketOwner, }: {
16
+ export declare const lambdaWriteFile: ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, }: {
16
17
  bucketName: string;
17
18
  key: string;
18
19
  body: ReadStream | string;
19
20
  region: AwsRegion;
20
21
  privacy: Privacy;
21
22
  expectedBucketOwner: string | null;
23
+ downloadBehavior: DownloadBehavior | null;
22
24
  }) => Promise<void>;
23
25
  export declare const lambdaReadFile: ({ bucketName, key, region, expectedBucketOwner, }: {
24
26
  bucketName: string;
@@ -7,6 +7,7 @@ exports.lambdaReadFile = exports.lambdaWriteFile = exports.lambdaLs = void 0;
7
7
  const client_s3_1 = require("@aws-sdk/client-s3");
8
8
  const mime_types_1 = __importDefault(require("mime-types"));
9
9
  const aws_clients_1 = require("../../shared/aws-clients");
10
+ const content_disposition_header_1 = require("../../shared/content-disposition-header");
10
11
  const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }) => {
11
12
  var _a, _b, _c;
12
13
  try {
@@ -46,7 +47,7 @@ const lambdaLs = async ({ bucketName, prefix, region, expectedBucketOwner, conti
46
47
  }
47
48
  };
48
49
  exports.lambdaLs = lambdaLs;
49
- const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, }) => {
50
+ const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, }) => {
50
51
  await (0, aws_clients_1.getS3Client)(region).send(new client_s3_1.PutObjectCommand({
51
52
  Bucket: bucketName,
52
53
  Key: key,
@@ -54,6 +55,7 @@ const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expecte
54
55
  ACL: privacy === 'private' ? 'private' : 'public-read',
55
56
  ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
56
57
  ContentType: mime_types_1.default.lookup(key) || 'application/octet-stream',
58
+ ContentDisposition: (0, content_disposition_header_1.getContentDispositionHeader)(downloadBehavior),
57
59
  }));
58
60
  };
59
61
  exports.lambdaWriteFile = lambdaWriteFile;
@@ -33,6 +33,7 @@ const writeLambdaError = async ({ bucketName, renderId, errorInfo, expectedBucke
33
33
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
34
34
  privacy: 'private',
35
35
  expectedBucketOwner,
36
+ downloadBehavior: null,
36
37
  });
37
38
  };
38
39
  exports.writeLambdaError = writeLambdaError;
@@ -11,6 +11,7 @@ const writePostRenderData = async ({ bucketName, renderId, postRenderData, expec
11
11
  body: JSON.stringify(postRenderData),
12
12
  expectedBucketOwner,
13
13
  region,
14
+ downloadBehavior: null,
14
15
  });
15
16
  };
16
17
  exports.writePostRenderData = writePostRenderData;
@@ -161,6 +161,7 @@ const innerLaunchHandler = async (params, options) => {
161
161
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
162
162
  privacy: 'private',
163
163
  expectedBucketOwner: options.expectedBucketOwner,
164
+ downloadBehavior: null,
164
165
  });
165
166
  await Promise.all(lambdaPayloads.map(async (payload, index) => {
166
167
  const callingLambdaTimer = (0, timer_1.timer)('Calling chunk ' + index);
@@ -198,6 +199,7 @@ const innerLaunchHandler = async (params, options) => {
198
199
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
199
200
  privacy: 'private',
200
201
  expectedBucketOwner: options.expectedBucketOwner,
202
+ downloadBehavior: null,
201
203
  }).catch((err) => {
202
204
  (0, write_lambda_error_1.writeLambdaError)({
203
205
  bucketName: params.bucketName,
@@ -244,6 +246,7 @@ const innerLaunchHandler = async (params, options) => {
244
246
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
245
247
  privacy: params.privacy,
246
248
  expectedBucketOwner: options.expectedBucketOwner,
249
+ downloadBehavior: params.downloadBehavior,
247
250
  });
248
251
  let chunkProm = Promise.resolve();
249
252
  // TODO: Enable in a later release
@@ -299,6 +302,7 @@ const innerLaunchHandler = async (params, options) => {
299
302
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
300
303
  privacy: 'private',
301
304
  expectedBucketOwner: options.expectedBucketOwner,
305
+ downloadBehavior: null,
302
306
  });
303
307
  const errorExplanationsProm = (0, inspect_errors_1.inspectErrors)({
304
308
  contents,
@@ -84,6 +84,7 @@ const renderHandler = async (params, options, logs) => {
84
84
  }),
85
85
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
86
86
  expectedBucketOwner: options.expectedBucketOwner,
87
+ downloadBehavior: null,
87
88
  });
88
89
  },
89
90
  puppeteerInstance: browserInstance,
@@ -128,6 +129,7 @@ const renderHandler = async (params, options, logs) => {
128
129
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
129
130
  privacy: params.privacy,
130
131
  expectedBucketOwner: options.expectedBucketOwner,
132
+ downloadBehavior: null,
131
133
  });
132
134
  await Promise.all([
133
135
  fs_1.default.promises.rm(outputLocation, { recursive: true }),
@@ -135,15 +137,16 @@ const renderHandler = async (params, options, logs) => {
135
137
  (0, io_1.lambdaWriteFile)({
136
138
  bucketName: params.bucketName,
137
139
  body: JSON.stringify(condensedTimingData, null, 2),
138
- key: `${(0, constants_1.lambdaTimingsKey)({
140
+ key: (0, constants_1.lambdaTimingsKey)({
139
141
  renderId: params.renderId,
140
142
  chunk: params.chunk,
141
143
  rendered: endRendered,
142
144
  start,
143
- })}`,
145
+ }),
144
146
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
145
147
  privacy: 'private',
146
148
  expectedBucketOwner: options.expectedBucketOwner,
149
+ downloadBehavior: null,
147
150
  }),
148
151
  ]);
149
152
  };
@@ -43,6 +43,7 @@ const startHandler = async (params) => {
43
43
  numberOfGifLoops: params.numberOfGifLoops,
44
44
  everyNthFrame: params.everyNthFrame,
45
45
  concurrencyPerLambda: params.concurrencyPerLambda,
46
+ downloadBehavior: params.downloadBehavior,
46
47
  };
47
48
  await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
48
49
  FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
@@ -15,6 +15,7 @@ const aws_clients_1 = require("../shared/aws-clients");
15
15
  const constants_1 = require("../shared/constants");
16
16
  const make_s3_url_1 = require("../shared/make-s3-url");
17
17
  const random_hash_1 = require("../shared/random-hash");
18
+ const validate_download_behavior_1 = require("../shared/validate-download-behavior");
18
19
  const validate_outname_1 = require("../shared/validate-outname");
19
20
  const validate_privacy_1 = require("../shared/validate-privacy");
20
21
  const expected_out_name_1 = require("./helpers/expected-out-name");
@@ -31,6 +32,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
31
32
  if (lambdaParams.type !== constants_1.LambdaRoutines.still) {
32
33
  throw new TypeError('Expected still type');
33
34
  }
35
+ (0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
34
36
  (0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
35
37
  (0, validate_outname_1.validateOutname)(lambdaParams.outName);
36
38
  const start = Date.now();
@@ -81,6 +83,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
81
83
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
82
84
  privacy: 'private',
83
85
  expectedBucketOwner: options.expectedBucketOwner,
86
+ downloadBehavior: null,
84
87
  });
85
88
  await (0, renderer_1.renderStill)({
86
89
  composition,
@@ -107,6 +110,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
107
110
  body: fs_1.default.createReadStream(outputPath),
108
111
  expectedBucketOwner: options.expectedBucketOwner,
109
112
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
113
+ downloadBehavior: lambdaParams.downloadBehavior,
110
114
  });
111
115
  await fs_1.default.promises.rm(outputPath, { recursive: true });
112
116
  const estimatedPrice = (0, estimate_price_1.estimatePrice)({
@@ -3,6 +3,7 @@ import type { Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfi
3
3
  import type { ChunkRetry } from '../functions/helpers/get-retry-stats';
4
4
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
5
5
  import type { AwsRegion } from '../pricing/aws-regions';
6
+ import type { DownloadBehavior } from './content-disposition-header';
6
7
  import type { ExpensiveChunk } from './get-most-expensive-chunks';
7
8
  import type { LambdaArchitecture } from './validate-architecture';
8
9
  import type { LambdaCodec } from './validate-lambda-codec';
@@ -111,6 +112,7 @@ export declare type LambdaPayloads = {
111
112
  everyNthFrame: number;
112
113
  numberOfGifLoops: number | null;
113
114
  concurrencyPerLambda: number;
115
+ downloadBehavior: DownloadBehavior;
114
116
  };
115
117
  launch: {
116
118
  type: LambdaRoutines.launch;
@@ -138,6 +140,7 @@ export declare type LambdaPayloads = {
138
140
  everyNthFrame: number;
139
141
  numberOfGifLoops: number | null;
140
142
  concurrencyPerLambda: number;
143
+ downloadBehavior: DownloadBehavior;
141
144
  };
142
145
  status: {
143
146
  type: LambdaRoutines.status;
@@ -191,6 +194,7 @@ export declare type LambdaPayloads = {
191
194
  timeoutInMilliseconds: number;
192
195
  chromiumOptions: ChromiumOptions;
193
196
  scale: number;
197
+ downloadBehavior: DownloadBehavior | null;
194
198
  };
195
199
  };
196
200
  export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
@@ -220,7 +224,7 @@ export declare type RenderMetadata = {
220
224
  renderId: string;
221
225
  outName: OutNameInput | undefined;
222
226
  };
223
- export declare type LambdaVersions = '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
227
+ export declare type LambdaVersions = '2022-07-23' | '2022-07-20' | '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
224
228
  export declare const CURRENT_VERSION: LambdaVersions;
225
229
  export declare type PostRenderData = {
226
230
  cost: {
@@ -84,6 +84,6 @@ var LambdaRoutines;
84
84
  LambdaRoutines["renderer"] = "renderer";
85
85
  LambdaRoutines["still"] = "still";
86
86
  })(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
87
- exports.CURRENT_VERSION = '2022-07-18';
87
+ exports.CURRENT_VERSION = '2022-07-23';
88
88
  exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
89
89
  exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
@@ -0,0 +1,7 @@
1
+ export declare type DownloadBehavior = {
2
+ type: 'play-in-browser';
3
+ } | {
4
+ type: 'download';
5
+ fileName: string | null;
6
+ };
7
+ export declare const getContentDispositionHeader: (behavior: DownloadBehavior | null) => string | undefined;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ // By setting the Content-Disposition header in an S3 object,
3
+ // you can control if the user downloads the item if you
4
+ // visit the link
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getContentDispositionHeader = void 0;
7
+ const getContentDispositionHeader = (behavior) => {
8
+ if (behavior === null) {
9
+ return undefined;
10
+ }
11
+ if (behavior.type === 'play-in-browser') {
12
+ return undefined;
13
+ }
14
+ if (behavior.fileName === null) {
15
+ return `attachment`;
16
+ }
17
+ return `attachment; filename="${behavior.fileName}"`;
18
+ };
19
+ exports.getContentDispositionHeader = getContentDispositionHeader;
@@ -0,0 +1 @@
1
+ export declare const validateDownloadBehavior: (downloadBehavior: unknown) => null | undefined;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateDownloadBehavior = void 0;
4
+ const validateDownloadBehavior = (downloadBehavior) => {
5
+ if (downloadBehavior === null || downloadBehavior === undefined) {
6
+ return null;
7
+ }
8
+ if (typeof downloadBehavior !== 'object') {
9
+ throw new Error('downloadBehavior must be null or an object');
10
+ }
11
+ const behavior = downloadBehavior;
12
+ if (behavior.type !== 'download' && behavior.type !== 'play-in-browser') {
13
+ throw new Error('Download behavior must be either "download" or "play-in-browser"');
14
+ }
15
+ if (behavior.type === 'download') {
16
+ if (typeof behavior.fileName !== 'string' && behavior.fileName !== null) {
17
+ throw new Error('If "downloadBehavior.type" is "download", then fileName must be "null" or a string');
18
+ }
19
+ }
20
+ };
21
+ exports.validateDownloadBehavior = validateDownloadBehavior;
@@ -1,3 +1 @@
1
- export declare const MAX_PRESIGN_EXPIRATION = 604800;
2
- export declare const MIN_PRESIGN_EXPIRATION = 1;
3
1
  export declare const validatePresignExpiration: (presignExpiration: unknown) => void;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validatePresignExpiration = exports.MIN_PRESIGN_EXPIRATION = exports.MAX_PRESIGN_EXPIRATION = void 0;
4
- exports.MAX_PRESIGN_EXPIRATION = 604800;
5
- exports.MIN_PRESIGN_EXPIRATION = 1;
3
+ exports.validatePresignExpiration = void 0;
4
+ const MAX_PRESIGN_EXPIRATION = 604800;
5
+ const MIN_PRESIGN_EXPIRATION = 1;
6
6
  const validatePresignExpiration = (presignExpiration) => {
7
7
  if (typeof presignExpiration === 'undefined' || presignExpiration === null) {
8
8
  return;
@@ -19,11 +19,11 @@ const validatePresignExpiration = (presignExpiration) => {
19
19
  if (presignExpiration % 1 !== 0) {
20
20
  throw new TypeError(`'expiresIn' should be an integer but is ${JSON.stringify(presignExpiration)}`);
21
21
  }
22
- if (presignExpiration > exports.MAX_PRESIGN_EXPIRATION) {
23
- throw new TypeError(`The 'expiresIn' parameter must be less or equal than ${exports.MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`);
22
+ if (presignExpiration > MAX_PRESIGN_EXPIRATION) {
23
+ throw new TypeError(`The 'expiresIn' parameter must be less or equal than ${MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`);
24
24
  }
25
- if (presignExpiration < exports.MIN_PRESIGN_EXPIRATION) {
26
- throw new TypeError(`The 'expiresIn' parameter must be greater or equal than ${exports.MIN_PRESIGN_EXPIRATION}`);
25
+ if (presignExpiration < MIN_PRESIGN_EXPIRATION) {
26
+ throw new TypeError(`The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}`);
27
27
  }
28
28
  };
29
29
  exports.validatePresignExpiration = validatePresignExpiration;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.1.2",
3
+ "version": "3.1.5",
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.58.0",
32
32
  "@aws-sdk/lib-storage": "3.58.0",
33
33
  "@aws-sdk/s3-request-presigner": "3.58.0",
34
- "@remotion/bundler": "3.1.2",
35
- "@remotion/cli": "3.1.2",
36
- "@remotion/renderer": "3.1.2",
34
+ "@remotion/bundler": "3.1.5",
35
+ "@remotion/cli": "3.1.5",
36
+ "@remotion/renderer": "3.1.5",
37
37
  "aws-policies": "^1.0.1",
38
38
  "mime-types": "2.1.34",
39
- "remotion": "3.1.2"
39
+ "remotion": "3.1.5"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=16.8.0",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "7ac5f5675a7390cc776265c667d382149dee9814"
64
+ "gitHead": "965ca68bd4efce9ca5e27fe30c4a31aec594575c"
65
65
  }
Binary file