@remotion/lambda 4.0.0-umungobongo.4 → 4.0.0-webhook.25
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/dist/admin/make-layer-public.js +5 -5
- package/dist/api/bucket-exists.js +1 -1
- package/dist/api/clean-items.js +1 -1
- package/dist/api/create-bucket.js +1 -1
- package/dist/api/delete-render.d.ts +19 -0
- package/dist/api/delete-render.js +66 -0
- package/dist/api/delete-site.js +0 -5
- package/dist/api/deploy-function.js +4 -2
- package/dist/api/deploy-site.d.ts +2 -0
- package/dist/api/deploy-site.js +2 -0
- package/dist/api/download-media.d.ts +13 -0
- package/dist/api/download-media.js +15 -3
- package/dist/api/enable-s3-website.js +1 -1
- package/dist/api/get-aws-client.d.ts +4 -2
- package/dist/api/get-aws-client.js +7 -2
- package/dist/api/get-buckets.js +2 -2
- package/dist/api/get-function-info.d.ts +1 -2
- package/dist/api/get-functions.js +2 -1
- package/dist/api/get-render-progress.d.ts +4 -1
- package/dist/api/get-render-progress.js +5 -1
- package/dist/api/mock-functions.d.ts +4 -5
- package/dist/api/presign-url.js +6 -1
- package/dist/api/render-media-on-lambda.d.ts +18 -10
- package/dist/api/render-media-on-lambda.js +65 -40
- package/dist/api/render-still-on-lambda.d.ts +1 -0
- package/dist/api/render-still-on-lambda.js +48 -30
- package/dist/api/upload-dir.js +1 -1
- package/dist/api/validate-webhook-signature.d.ts +13 -0
- package/dist/api/validate-webhook-signature.js +32 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/commands/functions/deploy.js +2 -1
- package/dist/cli/commands/render/render.js +24 -15
- package/dist/cli/commands/still.js +20 -16
- package/dist/cli/get-aws-region.js +2 -1
- package/dist/cli/helpers/determine-image-format.d.ts +10 -0
- package/dist/cli/helpers/determine-image-format.js +47 -0
- package/dist/cli/helpers/find-function-name.js +3 -2
- package/dist/cli/helpers/webhook-types.d.ts +6 -0
- package/dist/cli/helpers/webhook-types.js +2 -0
- package/dist/cli/index.js +1 -1
- package/dist/client.d.ts +4 -2
- package/dist/client.js +3 -1
- package/dist/functions/chunk-optimization/can-use-optimization.js +2 -2
- package/dist/functions/chunk-optimization/s3-optimization-file.js +1 -0
- package/dist/functions/chunk-optimization/types.d.ts +1 -2
- package/dist/functions/helpers/check-if-render-exists.d.ts +3 -0
- package/dist/functions/helpers/check-if-render-exists.js +14 -0
- package/dist/functions/helpers/expected-out-name.d.ts +4 -2
- package/dist/functions/helpers/expected-out-name.js +26 -5
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +3 -1
- package/dist/functions/helpers/find-output-file-in-bucket.js +17 -13
- package/dist/functions/helpers/get-custom-out-name.d.ts +6 -0
- package/dist/functions/helpers/get-custom-out-name.js +31 -0
- package/dist/functions/helpers/get-files-to-delete.js +1 -1
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -1
- package/dist/functions/helpers/get-output-url-from-metadata.d.ts +2 -1
- package/dist/functions/helpers/get-output-url-from-metadata.js +2 -2
- package/dist/functions/helpers/get-progress.d.ts +4 -2
- package/dist/functions/helpers/get-progress.js +13 -6
- package/dist/functions/helpers/get-retry-stats.js +1 -1
- package/dist/functions/helpers/io.d.ts +17 -1
- package/dist/functions/helpers/io.js +21 -6
- package/dist/functions/helpers/read-with-progress.d.ts +3 -1
- package/dist/functions/helpers/read-with-progress.js +2 -2
- package/dist/functions/helpers/write-lambda-error.d.ts +1 -1
- package/dist/functions/helpers/write-lambda-error.js +1 -0
- package/dist/functions/helpers/write-post-render-data.js +1 -0
- package/dist/functions/index.js +4 -4
- package/dist/functions/info.d.ts +2 -2
- package/dist/functions/info.js +2 -1
- package/dist/functions/launch.js +206 -13
- package/dist/functions/progress.d.ts +1 -1
- package/dist/functions/progress.js +10 -1
- package/dist/functions/renderer.js +104 -74
- package/dist/functions/start.d.ts +5 -1
- package/dist/functions/start.js +23 -1
- package/dist/functions/still.js +17 -4
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -1
- package/dist/shared/aws-clients.d.ts +13 -2
- package/dist/shared/aws-clients.js +56 -26
- package/dist/shared/bundle-site.d.ts +2 -1
- package/dist/shared/constants.d.ts +31 -6
- package/dist/shared/constants.js +14 -7
- package/dist/shared/get-cloudwatch-stream-url.d.ts +8 -0
- package/dist/shared/get-cloudwatch-stream-url.js +7 -0
- package/dist/shared/get-function-version.d.ts +1 -2
- package/dist/shared/hosted-layers.js +60 -60
- package/dist/shared/invoke-webhook.d.ts +59 -0
- package/dist/shared/invoke-webhook.js +102 -0
- package/dist/shared/is-in-lambda.js +5 -1
- package/dist/shared/lambda-version-string.d.ts +1 -0
- package/dist/shared/lambda-version-string.js +7 -0
- package/dist/shared/validate-frames-per-lambda.d.ts +4 -1
- package/dist/shared/validate-frames-per-lambda.js +4 -3
- package/dist/shared/validate-outname.d.ts +3 -2
- package/dist/shared/validate-outname.js +5 -1
- package/package.json +9 -9
- package/remotionlambda.zip +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderVideoOnLambda = exports.renderMediaOnLambda = void 0;
|
|
4
|
+
const version_1 = require("remotion/version");
|
|
4
5
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
5
6
|
const constants_1 = require("../shared/constants");
|
|
6
7
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
8
|
+
const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url");
|
|
7
9
|
const validate_download_behavior_1 = require("../shared/validate-download-behavior");
|
|
8
10
|
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
9
11
|
const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
|
|
@@ -15,57 +17,80 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
|
15
17
|
* @param params.serveUrl The URL of the deployed project
|
|
16
18
|
* @param params.composition The ID of the composition which should be rendered.
|
|
17
19
|
* @param params.inputProps The input props that should be passed to the composition.
|
|
18
|
-
* @param params.codec The
|
|
19
|
-
* @param params.imageFormat In which image format the frames should be rendered.
|
|
20
|
+
* @param params.codec The media codec which should be used for encoding.
|
|
21
|
+
* @param params.imageFormat In which image format the frames should be rendered. Default "jpeg"
|
|
20
22
|
* @param params.crf The constant rate factor to be used during encoding.
|
|
21
23
|
* @param params.envVariables Object containing environment variables to be inserted into the video environment
|
|
22
24
|
* @param params.proResProfile The ProRes profile if rendering a ProRes video
|
|
23
25
|
* @param params.quality JPEG quality if JPEG was selected as the image format.
|
|
24
|
-
* @param params.region The AWS region in which the
|
|
25
|
-
* @param params.maxRetries How often rendering a chunk may fail before the
|
|
26
|
+
* @param params.region The AWS region in which the media should be rendered.
|
|
27
|
+
* @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"
|
|
26
28
|
* @param params.logLevel Level of logging that Lambda function should perform. Default "info".
|
|
29
|
+
* @param params.webhook Webhook URL to be called upon completion or timeout of the rendering process.
|
|
27
30
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
28
31
|
*/
|
|
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, downloadBehavior, }) => {
|
|
32
|
+
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, muted, overwrite, webhook, }) => {
|
|
33
|
+
var _a;
|
|
30
34
|
const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
|
|
31
35
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
32
|
-
(0, validate_frames_per_lambda_1.validateFramesPerLambda)(
|
|
36
|
+
(0, validate_frames_per_lambda_1.validateFramesPerLambda)({
|
|
37
|
+
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
38
|
+
durationInFrames: 1,
|
|
39
|
+
});
|
|
33
40
|
(0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
|
|
34
41
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
42
|
+
try {
|
|
43
|
+
const res = await (0, call_lambda_1.callLambda)({
|
|
44
|
+
functionName,
|
|
45
|
+
type: constants_1.LambdaRoutines.start,
|
|
46
|
+
payload: {
|
|
47
|
+
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
48
|
+
composition,
|
|
49
|
+
serveUrl: realServeUrl,
|
|
50
|
+
inputProps: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
51
|
+
codec: actualCodec,
|
|
52
|
+
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg',
|
|
53
|
+
crf,
|
|
54
|
+
envVariables,
|
|
55
|
+
pixelFormat,
|
|
56
|
+
proResProfile,
|
|
57
|
+
quality,
|
|
58
|
+
maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : 1,
|
|
59
|
+
privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
|
|
60
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
61
|
+
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
62
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
63
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
64
|
+
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
65
|
+
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
66
|
+
everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
|
|
67
|
+
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : 0,
|
|
68
|
+
concurrencyPerLambda: concurrencyPerLambda !== null && concurrencyPerLambda !== void 0 ? concurrencyPerLambda : 1,
|
|
69
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
70
|
+
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
71
|
+
version: version_1.VERSION,
|
|
72
|
+
overwrite: overwrite !== null && overwrite !== void 0 ? overwrite : false,
|
|
73
|
+
webhook: webhook !== null && webhook !== void 0 ? webhook : null,
|
|
74
|
+
},
|
|
75
|
+
region,
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
renderId: res.renderId,
|
|
79
|
+
bucketName: res.bucketName,
|
|
80
|
+
cloudWatchLogs: (0, get_cloudwatch_stream_url_1.getCloudwatchStreamUrl)({
|
|
81
|
+
functionName,
|
|
82
|
+
method: constants_1.LambdaRoutines.renderer,
|
|
83
|
+
region,
|
|
84
|
+
renderId: res.renderId,
|
|
85
|
+
}),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
|
|
90
|
+
throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
|
|
91
|
+
}
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
69
94
|
};
|
|
70
95
|
exports.renderMediaOnLambda = renderMediaOnLambda;
|
|
71
96
|
/**
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderStillOnLambda = void 0;
|
|
4
|
+
const version_1 = require("remotion/version");
|
|
4
5
|
const call_lambda_1 = require("../shared/call-lambda");
|
|
5
6
|
const constants_1 = require("../shared/constants");
|
|
6
7
|
const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
8
|
+
const get_cloudwatch_stream_url_1 = require("../shared/get-cloudwatch-stream-url");
|
|
7
9
|
/**
|
|
8
10
|
* @description Renders a still frame on Lambda
|
|
9
11
|
* @link https://remotion.dev/docs/lambda/renderstillonlambda
|
|
@@ -21,36 +23,52 @@ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
|
21
23
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
22
24
|
*/
|
|
23
25
|
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
|
|
26
|
+
var _a;
|
|
24
27
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
28
|
+
try {
|
|
29
|
+
const res = await (0, call_lambda_1.callLambda)({
|
|
30
|
+
functionName,
|
|
31
|
+
type: constants_1.LambdaRoutines.still,
|
|
32
|
+
payload: {
|
|
33
|
+
composition,
|
|
34
|
+
serveUrl: realServeUrl,
|
|
35
|
+
inputProps,
|
|
36
|
+
imageFormat,
|
|
37
|
+
envVariables,
|
|
38
|
+
quality,
|
|
39
|
+
maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : constants_1.DEFAULT_MAX_RETRIES,
|
|
40
|
+
frame: frame !== null && frame !== void 0 ? frame : 0,
|
|
41
|
+
privacy,
|
|
42
|
+
attempt: 1,
|
|
43
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
44
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
45
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
46
|
+
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
47
|
+
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
48
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
49
|
+
version: version_1.VERSION,
|
|
50
|
+
},
|
|
51
|
+
region,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
estimatedPrice: res.estimatedPrice,
|
|
55
|
+
url: res.output,
|
|
56
|
+
sizeInBytes: res.size,
|
|
57
|
+
bucketName: res.bucketName,
|
|
58
|
+
renderId: res.renderId,
|
|
59
|
+
cloudWatchLogs: (0, get_cloudwatch_stream_url_1.getCloudwatchStreamUrl)({
|
|
60
|
+
functionName,
|
|
61
|
+
method: constants_1.LambdaRoutines.still,
|
|
62
|
+
region,
|
|
63
|
+
renderId: res.renderId,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
|
|
69
|
+
throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
|
|
70
|
+
}
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
55
73
|
};
|
|
56
74
|
exports.renderStillOnLambda = renderStillOnLambda;
|
package/dist/api/upload-dir.js
CHANGED
|
@@ -37,7 +37,7 @@ const uploadDir = async ({ bucket, region, dir, onProgress, folder, privacy, })
|
|
|
37
37
|
for (const file of files) {
|
|
38
38
|
progresses[file.name] = 0;
|
|
39
39
|
}
|
|
40
|
-
const client = (0, aws_clients_1.getS3Client)(region);
|
|
40
|
+
const client = (0, aws_clients_1.getS3Client)(region, null);
|
|
41
41
|
const uploads = files.map(async (filePath) => {
|
|
42
42
|
const Key = (0, make_s3_key_1.makeS3Key)(folder, dir, filePath.name);
|
|
43
43
|
const Body = (0, fs_1.createReadStream)(filePath.name);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Throws if the signature of the finish webhook is missing or inauthentic
|
|
3
|
+
* @link https://remotion.dev/docs/lambda/validate-webhook-signature
|
|
4
|
+
* @param params.secret The secret used for signing the webhook
|
|
5
|
+
* @param params.body The body that was received by the endpoint
|
|
6
|
+
* @param params.signatureHeader The `X-Remotion-Signature` header
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
9
|
+
export declare const validateWebhookSignature: ({ secret, body, signatureHeader, }: {
|
|
10
|
+
secret: string;
|
|
11
|
+
body: string;
|
|
12
|
+
signatureHeader: string;
|
|
13
|
+
}) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateWebhookSignature = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @description Throws if the signature of the finish webhook is missing or inauthentic
|
|
6
|
+
* @link https://remotion.dev/docs/lambda/validate-webhook-signature
|
|
7
|
+
* @param params.secret The secret used for signing the webhook
|
|
8
|
+
* @param params.body The body that was received by the endpoint
|
|
9
|
+
* @param params.signatureHeader The `X-Remotion-Signature` header
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
const validateWebhookSignature = ({ secret, body, signatureHeader, }) => {
|
|
13
|
+
if (!secret) {
|
|
14
|
+
throw new TypeError("No 'secret' was provided to validateWebhookSignature().");
|
|
15
|
+
}
|
|
16
|
+
if (!body) {
|
|
17
|
+
throw new TypeError("No 'body' was provided to validateWebhookSignature().");
|
|
18
|
+
}
|
|
19
|
+
if (typeof require === 'undefined') {
|
|
20
|
+
throw new Error('validateWebhookSignature can only be called from Node.JS');
|
|
21
|
+
}
|
|
22
|
+
const Crypto = require('crypto');
|
|
23
|
+
const hmac = Crypto.createHmac('sha512', secret);
|
|
24
|
+
const signature = `sha512=${hmac.update(JSON.stringify(body)).digest('hex')}`;
|
|
25
|
+
if (!signatureHeader || signatureHeader === 'NO_SECRET_PROVIDED') {
|
|
26
|
+
throw new Error('No webhook signature was provided');
|
|
27
|
+
}
|
|
28
|
+
if (signatureHeader !== signature) {
|
|
29
|
+
throw new Error('Signatures do not match');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.validateWebhookSignature = validateWebhookSignature;
|
package/dist/cli/args.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ declare type LambdaCommandLineOptions = {
|
|
|
24
24
|
['architecture']: LambdaArchitecture;
|
|
25
25
|
['custom-role-arn']: string | undefined;
|
|
26
26
|
privacy: Privacy;
|
|
27
|
+
webhook: string | undefined;
|
|
28
|
+
['webhook-secret']: string | undefined;
|
|
27
29
|
};
|
|
28
30
|
export declare const parsedLambdaCli: LambdaCommandLineOptions & minimist.ParsedArgs;
|
|
29
31
|
export declare const forceFlagProvided: boolean;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.functionsDeploySubcommand = exports.FUNCTIONS_DEPLOY_SUBCOMMAND = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const log_1 = require("@remotion/cli/dist/log");
|
|
6
|
+
const version_1 = require("remotion/version");
|
|
6
7
|
const deploy_function_1 = require("../../../api/deploy-function");
|
|
7
8
|
const constants_1 = require("../../../shared/constants");
|
|
8
9
|
const validate_architecture_1 = require("../../../shared/validate-architecture");
|
|
@@ -34,7 +35,7 @@ Region = ${region}
|
|
|
34
35
|
Memory = ${memorySizeInMb}MB
|
|
35
36
|
Disk size = ${diskSizeInMb}MB
|
|
36
37
|
Timeout = ${timeoutInSeconds}sec
|
|
37
|
-
Version = ${
|
|
38
|
+
Version = ${version_1.VERSION}
|
|
38
39
|
Architecture = ${architecture}
|
|
39
40
|
CloudWatch Logging Enabled = ${createCloudWatchLogGroup}
|
|
40
41
|
CloudWatch Retention Period = ${cloudWatchLogRetentionPeriodInDays} days
|
|
@@ -14,13 +14,12 @@ const validate_retries_1 = require("../../../shared/validate-retries");
|
|
|
14
14
|
const args_1 = require("../../args");
|
|
15
15
|
const get_aws_region_1 = require("../../get-aws-region");
|
|
16
16
|
const find_function_name_1 = require("../../helpers/find-function-name");
|
|
17
|
-
const get_cloudwatch_stream_url_1 = require("../../helpers/get-cloudwatch-stream-url");
|
|
18
17
|
const quit_1 = require("../../helpers/quit");
|
|
19
18
|
const log_1 = require("../../log");
|
|
20
19
|
const progress_1 = require("./progress");
|
|
21
20
|
exports.RENDER_COMMAND = 'render';
|
|
22
21
|
const renderCommand = async (args) => {
|
|
23
|
-
var _a, _b, _c, _d;
|
|
22
|
+
var _a, _b, _c, _d, _e;
|
|
24
23
|
const serveUrl = args[0];
|
|
25
24
|
if (!serveUrl) {
|
|
26
25
|
log_1.Log.error('No serve URL passed.');
|
|
@@ -37,10 +36,16 @@ const renderCommand = async (args) => {
|
|
|
37
36
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.RENDER_COMMAND} <serve-url> <composition-id> [output-location]`);
|
|
38
37
|
(0, quit_1.quit)(1);
|
|
39
38
|
}
|
|
40
|
-
const outName =
|
|
41
|
-
const
|
|
39
|
+
const outName = args_1.parsedLambdaCli['out-name'];
|
|
40
|
+
const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
|
|
41
|
+
const { codec, reason } = cli_1.CliInternals.getFinalCodec({
|
|
42
|
+
downloadName,
|
|
43
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
44
|
+
});
|
|
45
|
+
const { chromiumOptions, crf, envVariables, frameRange, imageFormat, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, } = await cli_1.CliInternals.getCliOptions({
|
|
42
46
|
type: 'series',
|
|
43
47
|
isLambda: true,
|
|
48
|
+
codec,
|
|
44
49
|
});
|
|
45
50
|
const functionName = await (0, find_function_name_1.findFunctionName)();
|
|
46
51
|
const region = (0, get_aws_region_1.getAwsRegion)();
|
|
@@ -49,7 +54,7 @@ const renderCommand = async (args) => {
|
|
|
49
54
|
const privacy = (_c = args_1.parsedLambdaCli.privacy) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_OUTPUT_PRIVACY;
|
|
50
55
|
(0, validate_privacy_1.validatePrivacy)(privacy);
|
|
51
56
|
const framesPerLambda = (_d = args_1.parsedLambdaCli['frames-per-lambda']) !== null && _d !== void 0 ? _d : undefined;
|
|
52
|
-
(0, validate_frames_per_lambda_1.validateFramesPerLambda)(framesPerLambda);
|
|
57
|
+
(0, validate_frames_per_lambda_1.validateFramesPerLambda)({ framesPerLambda, durationInFrames: 1 });
|
|
53
58
|
const res = await (0, render_media_on_lambda_1.renderMediaOnLambda)({
|
|
54
59
|
functionName,
|
|
55
60
|
serveUrl,
|
|
@@ -75,16 +80,20 @@ const renderCommand = async (args) => {
|
|
|
75
80
|
numberOfGifLoops,
|
|
76
81
|
everyNthFrame,
|
|
77
82
|
concurrencyPerLambda: args_1.parsedLambdaCli['concurrency-per-lambda'],
|
|
83
|
+
muted,
|
|
84
|
+
overwrite,
|
|
85
|
+
webhook: args_1.parsedLambdaCli.webhook
|
|
86
|
+
? {
|
|
87
|
+
url: args_1.parsedLambdaCli.webhook,
|
|
88
|
+
secret: (_e = args_1.parsedLambdaCli['webhook-secret']) !== null && _e !== void 0 ? _e : null,
|
|
89
|
+
}
|
|
90
|
+
: undefined,
|
|
78
91
|
});
|
|
79
|
-
const totalSteps =
|
|
92
|
+
const totalSteps = downloadName ? 5 : 4;
|
|
80
93
|
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput(cli_1.CliInternals.quietFlagProvided());
|
|
81
|
-
log_1.Log.info(cli_1.CliInternals.chalk.gray(`
|
|
82
|
-
log_1.Log.
|
|
83
|
-
|
|
84
|
-
region,
|
|
85
|
-
renderId: res.renderId,
|
|
86
|
-
method: constants_1.LambdaRoutines.renderer,
|
|
87
|
-
})}`);
|
|
94
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`bucket = ${res.bucketName}, function = ${functionName}`));
|
|
95
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`renderId = ${res.renderId}, codec = ${codec} (${reason})`));
|
|
96
|
+
log_1.Log.verbose(`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`);
|
|
88
97
|
const status = await (0, get_render_progress_1.getRenderProgress)({
|
|
89
98
|
functionName,
|
|
90
99
|
bucketName: res.bucketName,
|
|
@@ -121,11 +130,11 @@ const renderCommand = async (args) => {
|
|
|
121
130
|
downloadInfo: null,
|
|
122
131
|
retriesInfo: newStatus.retriesInfo,
|
|
123
132
|
}));
|
|
124
|
-
if (
|
|
133
|
+
if (downloadName) {
|
|
125
134
|
const downloadStart = Date.now();
|
|
126
135
|
const { outputPath, sizeInBytes } = await (0, download_media_1.downloadMedia)({
|
|
127
136
|
bucketName: res.bucketName,
|
|
128
|
-
outPath:
|
|
137
|
+
outPath: downloadName,
|
|
129
138
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
130
139
|
renderId: res.renderId,
|
|
131
140
|
onProgress: ({ downloaded, totalSize }) => {
|
|
@@ -11,12 +11,11 @@ const validate_retries_1 = require("../../shared/validate-retries");
|
|
|
11
11
|
const args_1 = require("../args");
|
|
12
12
|
const get_aws_region_1 = require("../get-aws-region");
|
|
13
13
|
const find_function_name_1 = require("../helpers/find-function-name");
|
|
14
|
-
const get_cloudwatch_stream_url_1 = require("../helpers/get-cloudwatch-stream-url");
|
|
15
14
|
const quit_1 = require("../helpers/quit");
|
|
16
15
|
const log_1 = require("../log");
|
|
17
16
|
exports.STILL_COMMAND = 'still';
|
|
18
17
|
const stillCommand = async (args) => {
|
|
19
|
-
var _a, _b, _c, _d;
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20
19
|
const serveUrl = args[0];
|
|
21
20
|
if (!serveUrl) {
|
|
22
21
|
log_1.Log.error('No serve URL passed.');
|
|
@@ -33,22 +32,32 @@ const stillCommand = async (args) => {
|
|
|
33
32
|
log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.STILL_COMMAND} <serve-url> <composition-id> [output-location]`);
|
|
34
33
|
(0, quit_1.quit)(1);
|
|
35
34
|
}
|
|
36
|
-
const
|
|
37
|
-
const
|
|
35
|
+
const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
|
|
36
|
+
const outName = args_1.parsedLambdaCli['out-name'];
|
|
37
|
+
const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, quality, stillFrame, scale, } = await cli_1.CliInternals.getCliOptions({
|
|
38
38
|
type: 'still',
|
|
39
39
|
isLambda: true,
|
|
40
|
+
codec: 'h264',
|
|
40
41
|
});
|
|
41
42
|
const functionName = await (0, find_function_name_1.findFunctionName)();
|
|
42
43
|
const maxRetries = (_b = args_1.parsedLambdaCli['max-retries']) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_RETRIES;
|
|
43
44
|
(0, validate_retries_1.validateMaxRetries)(maxRetries);
|
|
44
45
|
const privacy = (_c = args_1.parsedLambdaCli.privacy) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_OUTPUT_PRIVACY;
|
|
45
46
|
(0, validate_privacy_1.validatePrivacy)(privacy);
|
|
47
|
+
const { format: imageFormat, source: imageFormatReason } = cli_1.CliInternals.determineFinalImageFormat({
|
|
48
|
+
downloadName,
|
|
49
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
50
|
+
configImageFormat: (_d = cli_1.ConfigInternals.getUserPreferredImageFormat()) !== null && _d !== void 0 ? _d : null,
|
|
51
|
+
cliFlag: (_e = cli_1.CliInternals.parsedCli['image-format']) !== null && _e !== void 0 ? _e : null,
|
|
52
|
+
isLambda: true,
|
|
53
|
+
});
|
|
46
54
|
try {
|
|
55
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`functionName = ${functionName}, imageFormat = ${imageFormat} (${imageFormatReason})`));
|
|
47
56
|
const res = await (0, render_still_on_lambda_1.renderStillOnLambda)({
|
|
48
57
|
functionName,
|
|
49
58
|
serveUrl,
|
|
50
59
|
inputProps,
|
|
51
|
-
imageFormat
|
|
60
|
+
imageFormat,
|
|
52
61
|
composition,
|
|
53
62
|
privacy,
|
|
54
63
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
@@ -57,23 +66,18 @@ const stillCommand = async (args) => {
|
|
|
57
66
|
frame: stillFrame,
|
|
58
67
|
quality,
|
|
59
68
|
logLevel,
|
|
60
|
-
outName
|
|
69
|
+
outName,
|
|
61
70
|
chromiumOptions,
|
|
62
71
|
timeoutInMilliseconds: puppeteerTimeout,
|
|
63
72
|
scale,
|
|
64
73
|
});
|
|
65
|
-
log_1.Log.
|
|
66
|
-
log_1.Log.verbose(`CloudWatch logs (if enabled): ${
|
|
67
|
-
|
|
68
|
-
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
69
|
-
renderId: res.renderId,
|
|
70
|
-
method: constants_1.LambdaRoutines.still,
|
|
71
|
-
})}`);
|
|
72
|
-
if (outName) {
|
|
74
|
+
log_1.Log.info(cli_1.CliInternals.chalk.gray(`Bucket = ${res.bucketName}, renderId = ${res.renderId}`));
|
|
75
|
+
log_1.Log.verbose(`CloudWatch logs (if enabled): ${res.cloudWatchLogs}`);
|
|
76
|
+
if (downloadName) {
|
|
73
77
|
log_1.Log.info('Finished rendering. Downloading...');
|
|
74
78
|
const { outputPath, sizeInBytes } = await (0, download_media_1.downloadMedia)({
|
|
75
79
|
bucketName: res.bucketName,
|
|
76
|
-
outPath:
|
|
80
|
+
outPath: downloadName,
|
|
77
81
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
78
82
|
renderId: res.renderId,
|
|
79
83
|
});
|
|
@@ -86,7 +90,7 @@ const stillCommand = async (args) => {
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
catch (err) {
|
|
89
|
-
const frames = renderer_1.RenderInternals.parseStack(((
|
|
93
|
+
const frames = renderer_1.RenderInternals.parseStack(((_f = err.stack) !== null && _f !== void 0 ? _f : '').split('\n'));
|
|
90
94
|
const errorWithStackFrame = new renderer_1.RenderInternals.SymbolicateableError({
|
|
91
95
|
message: err.message,
|
|
92
96
|
frame: null,
|
|
@@ -6,6 +6,7 @@ const is_in_lambda_1 = require("../shared/is-in-lambda");
|
|
|
6
6
|
const validate_aws_region_1 = require("../shared/validate-aws-region");
|
|
7
7
|
const args_1 = require("./args");
|
|
8
8
|
const getAwsRegion = () => {
|
|
9
|
+
var _a;
|
|
9
10
|
if ((0, is_in_lambda_1.isInsideLambda)()) {
|
|
10
11
|
throw new Error('Should not call getAwsRegion() if in lambda');
|
|
11
12
|
}
|
|
@@ -13,7 +14,7 @@ const getAwsRegion = () => {
|
|
|
13
14
|
(0, validate_aws_region_1.validateAwsRegion)(args_1.parsedLambdaCli.region);
|
|
14
15
|
return args_1.parsedLambdaCli.region;
|
|
15
16
|
}
|
|
16
|
-
const envVariable = process.env.AWS_REGION;
|
|
17
|
+
const envVariable = (_a = process.env.REMOTION_AWS_REGION) !== null && _a !== void 0 ? _a : process.env.AWS_REGION;
|
|
17
18
|
if (envVariable) {
|
|
18
19
|
(0, validate_aws_region_1.validateAwsRegion)(envVariable);
|
|
19
20
|
return envVariable;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ImageFormat, StillImageFormat } from '@remotion/renderer';
|
|
2
|
+
export declare const getImageFormat: ({ downloadName, outName, configImageFormat, cliFlag, }: {
|
|
3
|
+
downloadName: string | null;
|
|
4
|
+
outName: string | null;
|
|
5
|
+
configImageFormat: ImageFormat | null;
|
|
6
|
+
cliFlag: ImageFormat | null;
|
|
7
|
+
}) => {
|
|
8
|
+
format: StillImageFormat;
|
|
9
|
+
source: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getImageFormat = void 0;
|
|
4
|
+
const deriveExtensionFromFilename = (filename) => {
|
|
5
|
+
if (filename === null || filename === void 0 ? void 0 : filename.endsWith('.png')) {
|
|
6
|
+
return 'png';
|
|
7
|
+
}
|
|
8
|
+
if (filename === null || filename === void 0 ? void 0 : filename.endsWith('.jpg')) {
|
|
9
|
+
return 'jpeg';
|
|
10
|
+
}
|
|
11
|
+
if (filename === null || filename === void 0 ? void 0 : filename.endsWith('.jpeg')) {
|
|
12
|
+
return 'jpeg';
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
16
|
+
const getImageFormat = ({ downloadName, outName, configImageFormat, cliFlag, }) => {
|
|
17
|
+
const outNameExtension = deriveExtensionFromFilename(outName);
|
|
18
|
+
const downloadNameExtension = deriveExtensionFromFilename(downloadName);
|
|
19
|
+
if (outNameExtension &&
|
|
20
|
+
downloadNameExtension &&
|
|
21
|
+
outNameExtension !== downloadNameExtension) {
|
|
22
|
+
throw new TypeError(`Image format mismatch: ${outName} was given as the S3 output name and ${downloadName} was given as the download name, but the extensions don't match.`);
|
|
23
|
+
}
|
|
24
|
+
if (downloadNameExtension) {
|
|
25
|
+
if (cliFlag && downloadNameExtension !== cliFlag) {
|
|
26
|
+
throw new TypeError(`Image format mismatch: ${downloadName} was given as the download name, but --image-format=${cliFlag} was passed. The image formats must match.`);
|
|
27
|
+
}
|
|
28
|
+
return { format: downloadNameExtension, source: 'Download name extension' };
|
|
29
|
+
}
|
|
30
|
+
if (outNameExtension) {
|
|
31
|
+
if (cliFlag && outNameExtension !== cliFlag) {
|
|
32
|
+
throw new TypeError(`Image format mismatch: ${outName} was given as the S3 out name, but --image-format=${cliFlag} was passed. The image formats must match.`);
|
|
33
|
+
}
|
|
34
|
+
return { format: outNameExtension, source: 'Out name extension' };
|
|
35
|
+
}
|
|
36
|
+
if (cliFlag === 'none') {
|
|
37
|
+
throw new TypeError('The --image-format flag must not be "none" for stills.');
|
|
38
|
+
}
|
|
39
|
+
if (cliFlag !== null) {
|
|
40
|
+
return { format: cliFlag, source: '--image-format flag' };
|
|
41
|
+
}
|
|
42
|
+
if (configImageFormat !== null && configImageFormat !== 'none') {
|
|
43
|
+
return { format: configImageFormat, source: 'Config file' };
|
|
44
|
+
}
|
|
45
|
+
return { format: 'png', source: 'Default' };
|
|
46
|
+
};
|
|
47
|
+
exports.getImageFormat = getImageFormat;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findFunctionName = void 0;
|
|
4
|
+
const version_1 = require("remotion/version");
|
|
4
5
|
const get_functions_1 = require("../../api/get-functions");
|
|
5
6
|
const constants_1 = require("../../shared/constants");
|
|
6
7
|
const functions_1 = require("../commands/functions");
|
|
@@ -15,9 +16,9 @@ const findFunctionName = async () => {
|
|
|
15
16
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
16
17
|
compatibleOnly: false,
|
|
17
18
|
});
|
|
18
|
-
const lambdasWithMatchingVersion = remotionLambdas.filter((l) => l.version ===
|
|
19
|
+
const lambdasWithMatchingVersion = remotionLambdas.filter((l) => l.version === version_1.VERSION);
|
|
19
20
|
if (lambdasWithMatchingVersion.length === 0) {
|
|
20
|
-
log_1.Log.error(`No lambda functions with version ${
|
|
21
|
+
log_1.Log.error(`No lambda functions with version ${version_1.VERSION} found in your account.`);
|
|
21
22
|
if (remotionLambdas.length > 0) {
|
|
22
23
|
log_1.Log.error('Other functions were found, but are not compatible with this version of the CLI.');
|
|
23
24
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -133,7 +133,7 @@ AWS returned an "TooManyRequestsException" error message which could mean you re
|
|
|
133
133
|
};
|
|
134
134
|
exports.executeCommand = executeCommand;
|
|
135
135
|
const cli = async () => {
|
|
136
|
-
await cli_1.CliInternals.
|
|
136
|
+
await cli_1.CliInternals.initializeCli(cli_1.CliInternals.findRemotionRoot());
|
|
137
137
|
await (0, exports.executeCommand)(args_1.parsedLambdaCli._);
|
|
138
138
|
};
|
|
139
139
|
exports.cli = cli;
|
package/dist/client.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { getFunctions } from './api/get-functions';
|
|
|
2
2
|
import { getRenderProgress } from './api/get-render-progress';
|
|
3
3
|
import { renderMediaOnLambda, renderVideoOnLambda } from './api/render-media-on-lambda';
|
|
4
4
|
import { renderStillOnLambda } from './api/render-still-on-lambda';
|
|
5
|
+
import { validateWebhookSignature } from './api/validate-webhook-signature';
|
|
5
6
|
import type { AwsRegion } from './pricing/aws-regions';
|
|
6
7
|
import type { RenderProgress } from './shared/constants';
|
|
7
|
-
|
|
8
|
-
export
|
|
8
|
+
import type { WebhookPayload } from './shared/invoke-webhook';
|
|
9
|
+
export { renderVideoOnLambda, renderMediaOnLambda, renderStillOnLambda, getRenderProgress, getFunctions, validateWebhookSignature, };
|
|
10
|
+
export type { AwsRegion, RenderProgress, WebhookPayload };
|