@remotion/lambda 4.0.143 → 4.0.144
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 +4 -0
- package/dist/api/iam-validation/suggested-policy.d.ts +5 -3
- package/dist/api/iam-validation/suggested-policy.js +5 -3
- package/dist/api/speculate-function-name.js +2 -0
- package/dist/cli/helpers/find-function-name.js +29 -33
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/functions/still.d.ts +1 -0
- package/dist/functions/still.js +1 -0
- package/dist/shared/content-disposition-header.d.ts +3 -0
- package/dist/shared/content-disposition-header.js +32 -1
- package/dist/shared/is-flaky-error.js +4 -0
- package/package.json +9 -10
- package/remotionlambda-arm64.zip +0 -0
- package/dist/shared/serialize-props.d.ts +0 -14
- package/dist/shared/serialize-props.js +0 -36
package/LICENSE.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Remotion License
|
|
2
2
|
|
|
3
|
+
In Remotion 5.0, the license will slightly change. [View the changes here](https://github.com/remotion-dev/remotion/pull/3750).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
3
7
|
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
4
8
|
|
|
5
9
|
- [Free license](#free-license)
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for
|
|
3
|
-
* @
|
|
2
|
+
* @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
|
|
3
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
|
|
4
|
+
* @returns {string} A JSON string representation of the user policy.
|
|
4
5
|
*/
|
|
5
6
|
export declare const getUserPolicy: () => string;
|
|
6
7
|
export declare const ROLE_NAME = "remotion-lambda-role";
|
|
7
8
|
/**
|
|
8
9
|
* @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
|
|
9
|
-
* @
|
|
10
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
|
|
11
|
+
* @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
|
|
10
12
|
*/
|
|
11
13
|
export declare const getRolePolicy: () => string;
|
|
@@ -30,15 +30,17 @@ const suggestedRolePolicy = {
|
|
|
30
30
|
],
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for
|
|
34
|
-
* @
|
|
33
|
+
* @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for executing CLI commands or calling Node.JS functions.
|
|
34
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/getuserpolicy)
|
|
35
|
+
* @returns {string} A JSON string representation of the user policy.
|
|
35
36
|
*/
|
|
36
37
|
const getUserPolicy = () => JSON.stringify(suggestedPolicy, null, 2);
|
|
37
38
|
exports.getUserPolicy = getUserPolicy;
|
|
38
39
|
exports.ROLE_NAME = 'remotion-lambda-role';
|
|
39
40
|
/**
|
|
40
41
|
* @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.
|
|
41
|
-
* @
|
|
42
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/getrolepolicy)
|
|
43
|
+
* @returns {object} The policy object which includes the version and statements specific to AWS permissions for the lambda function
|
|
42
44
|
*/
|
|
43
45
|
const getRolePolicy = () => JSON.stringify(suggestedRolePolicy, null, 2);
|
|
44
46
|
exports.getRolePolicy = getRolePolicy;
|
|
@@ -12,6 +12,8 @@ const lambda_version_string_1 = require("../shared/lambda-version-string");
|
|
|
12
12
|
* @returns {string} The speculated lambda function name
|
|
13
13
|
*/
|
|
14
14
|
const speculateFunctionName = ({ memorySizeInMb, diskSizeInMb, timeoutInSeconds, }) => {
|
|
15
|
+
// find-function-name.ts uses this for templating
|
|
16
|
+
// consider this before adding any validation here
|
|
15
17
|
return [
|
|
16
18
|
`${defaults_1.RENDER_FN_PREFIX}${lambda_version_string_1.LAMBDA_VERSION_STRING}`,
|
|
17
19
|
`mem${memorySizeInMb}mb`,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.findFunctionName = void 0;
|
|
4
4
|
const version_1 = require("remotion/version");
|
|
5
5
|
const get_functions_1 = require("../../api/get-functions");
|
|
6
|
+
const client_1 = require("../../client");
|
|
6
7
|
const constants_1 = require("../../shared/constants");
|
|
7
8
|
const args_1 = require("../args");
|
|
8
9
|
const functions_1 = require("../commands/functions");
|
|
@@ -17,11 +18,27 @@ const findFunctionName = async (logLevel) => {
|
|
|
17
18
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
18
19
|
compatibleOnly: false,
|
|
19
20
|
});
|
|
20
|
-
|
|
21
|
+
const lambdasWithMatchingVersion = remotionLambdas.filter((l) => l.version === version_1.VERSION);
|
|
21
22
|
const logOptions = {
|
|
22
23
|
indent: false,
|
|
23
24
|
logLevel,
|
|
24
25
|
};
|
|
26
|
+
const cliFlag = args_1.parsedLambdaCli['function-name'];
|
|
27
|
+
if (cliFlag) {
|
|
28
|
+
const compatibleFunctionExists = lambdasWithMatchingVersion.find((l) => l.functionName === cliFlag);
|
|
29
|
+
if (!compatibleFunctionExists) {
|
|
30
|
+
log_1.Log.warn({ indent: false, logLevel }, `Function "${cliFlag}" does not match naming convention ${(0, client_1.speculateFunctionName)({ diskSizeInMb: '[disk]', memorySizeInMb: '[memory]', timeoutInSeconds: '[timeout]' })}.`);
|
|
31
|
+
log_1.Log.warn({ indent: false, logLevel }, 'Remotion relies on the naming to determine function information. This is an unsupported workflow.');
|
|
32
|
+
if (lambdasWithMatchingVersion.length > 0) {
|
|
33
|
+
log_1.Log.info(logOptions, 'The following functions were found:');
|
|
34
|
+
for (const l of lambdasWithMatchingVersion) {
|
|
35
|
+
log_1.Log.info(logOptions, `- ${l.functionName} (v${l.version})`);
|
|
36
|
+
}
|
|
37
|
+
log_1.Log.info(logOptions, 'Prefer using one of those functions by passing their name to `--function-name` or removing it entirely.');
|
|
38
|
+
}
|
|
39
|
+
return cliFlag;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
25
42
|
if (lambdasWithMatchingVersion.length === 0) {
|
|
26
43
|
log_1.Log.error({ indent: false, logLevel }, `No Lambda functions with version ${version_1.VERSION} found in your account.`);
|
|
27
44
|
if (remotionLambdas.length > 0) {
|
|
@@ -33,39 +50,18 @@ const findFunctionName = async (logLevel) => {
|
|
|
33
50
|
(0, quit_1.quit)(1);
|
|
34
51
|
}
|
|
35
52
|
if (lambdasWithMatchingVersion.length > 1) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
log_1.Log.info(logOptions, 'The following functions were found:');
|
|
48
|
-
for (const l of prevFunctions) {
|
|
49
|
-
log_1.Log.info(logOptions, `- ${l.functionName} (v${l.version})`);
|
|
50
|
-
}
|
|
51
|
-
log_1.Log.info(logOptions, 'Remove the `--function-name` parameter use one of them.');
|
|
52
|
-
(0, quit_1.quit)(1);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
log_1.Log.error({ indent: false, logLevel }, 'More than 1 lambda function found in your account. Unsure which one to use.');
|
|
57
|
-
log_1.Log.info(logOptions);
|
|
58
|
-
log_1.Log.info(logOptions, 'Possible solutions:');
|
|
59
|
-
log_1.Log.info(logOptions, '- Define using `--function-name` which function you want to use.');
|
|
60
|
-
log_1.Log.info(logOptions, `- Delete extraneous lambda functions in your AWS console or using:`);
|
|
61
|
-
log_1.Log.info(logOptions, ` npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${rm_1.FUNCTIONS_RM_SUBCOMMAND} $(npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${ls_1.FUNCTIONS_LS_SUBCOMMAND} -q) -y`);
|
|
62
|
-
log_1.Log.info(logOptions);
|
|
63
|
-
log_1.Log.info(logOptions, `The following functions were found (only showing v${version_1.VERSION}):`);
|
|
64
|
-
for (const l of lambdasWithMatchingVersion) {
|
|
65
|
-
log_1.Log.info(logOptions, `- ${l.functionName}`);
|
|
66
|
-
}
|
|
67
|
-
(0, quit_1.quit)(1);
|
|
53
|
+
log_1.Log.error({ indent: false, logLevel }, 'More than 1 lambda function found in your account. Unsure which one to use.');
|
|
54
|
+
log_1.Log.info(logOptions);
|
|
55
|
+
log_1.Log.info(logOptions, 'Possible solutions:');
|
|
56
|
+
log_1.Log.info(logOptions, '- Define using `--function-name` which function you want to use.');
|
|
57
|
+
log_1.Log.info(logOptions, `- Delete extraneous lambda functions in your AWS console or using:`);
|
|
58
|
+
log_1.Log.info(logOptions, ` npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${rm_1.FUNCTIONS_RM_SUBCOMMAND} $(npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${ls_1.FUNCTIONS_LS_SUBCOMMAND} -q) -y`);
|
|
59
|
+
log_1.Log.info(logOptions);
|
|
60
|
+
log_1.Log.info(logOptions, `The following functions were found (only showing v${version_1.VERSION}):`);
|
|
61
|
+
for (const l of lambdasWithMatchingVersion) {
|
|
62
|
+
log_1.Log.info(logOptions, `- ${l.functionName}`);
|
|
68
63
|
}
|
|
64
|
+
(0, quit_1.quit)(1);
|
|
69
65
|
}
|
|
70
66
|
const { functionName } = lambdasWithMatchingVersion[0];
|
|
71
67
|
return functionName;
|
package/dist/functions/still.js
CHANGED
|
@@ -209,6 +209,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
|
|
|
209
209
|
type: 'success',
|
|
210
210
|
output: url,
|
|
211
211
|
size,
|
|
212
|
+
sizeInBytes: size,
|
|
212
213
|
bucketName,
|
|
213
214
|
estimatedPrice: (0, format_costs_info_1.formatCostsInfo)(estimatedPrice),
|
|
214
215
|
renderId,
|
|
@@ -4,6 +4,33 @@
|
|
|
4
4
|
// visit the link
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getContentDispositionHeader = void 0;
|
|
7
|
+
const problematicCharacters = {
|
|
8
|
+
'%3A': ':',
|
|
9
|
+
'%2F': '/',
|
|
10
|
+
'%3F': '?',
|
|
11
|
+
'%23': '#',
|
|
12
|
+
'%5B': '[',
|
|
13
|
+
'%5D': ']',
|
|
14
|
+
'%40': '@',
|
|
15
|
+
'%21': '!',
|
|
16
|
+
'%24': '$',
|
|
17
|
+
'%26': '&',
|
|
18
|
+
'%27': "'",
|
|
19
|
+
'%28': '(',
|
|
20
|
+
'%29': ')',
|
|
21
|
+
'%2A': '*',
|
|
22
|
+
'%2B': '+',
|
|
23
|
+
'%2C': ',',
|
|
24
|
+
'%3B': ';',
|
|
25
|
+
};
|
|
26
|
+
const includesHexOfUnsafeChar = (path) => {
|
|
27
|
+
for (const key of Object.keys(problematicCharacters)) {
|
|
28
|
+
if (path.includes(key)) {
|
|
29
|
+
return { containsHex: true };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { containsHex: false };
|
|
33
|
+
};
|
|
7
34
|
const getContentDispositionHeader = (behavior) => {
|
|
8
35
|
if (behavior === null) {
|
|
9
36
|
return undefined;
|
|
@@ -14,6 +41,10 @@ const getContentDispositionHeader = (behavior) => {
|
|
|
14
41
|
if (behavior.fileName === null) {
|
|
15
42
|
return `attachment`;
|
|
16
43
|
}
|
|
17
|
-
|
|
44
|
+
const { containsHex } = includesHexOfUnsafeChar(behavior.fileName);
|
|
45
|
+
if (containsHex) {
|
|
46
|
+
return `attachment; filename="${behavior.fileName}"`;
|
|
47
|
+
}
|
|
48
|
+
return `attachment; filename="${encodeURIComponent(behavior.fileName)}"`;
|
|
18
49
|
};
|
|
19
50
|
exports.getContentDispositionHeader = getContentDispositionHeader;
|
|
@@ -55,6 +55,10 @@ const isFlakyError = (err) => {
|
|
|
55
55
|
message.includes('socket hang up')) {
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
|
+
if ((message === null || message === void 0 ? void 0 : message.includes('Target closed')) ||
|
|
59
|
+
(message === null || message === void 0 ? void 0 : message.includes('Session closed'))) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
58
62
|
return false;
|
|
59
63
|
};
|
|
60
64
|
exports.isFlakyError = isFlakyError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.144",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
28
|
"zod": "3.22.3",
|
|
29
|
-
"@remotion/
|
|
30
|
-
"@remotion/
|
|
31
|
-
"@remotion/renderer": "4.0.
|
|
32
|
-
"remotion": "4.0.
|
|
29
|
+
"@remotion/cli": "4.0.144",
|
|
30
|
+
"@remotion/bundler": "4.0.144",
|
|
31
|
+
"@remotion/renderer": "4.0.144",
|
|
32
|
+
"remotion": "4.0.144"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.281",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"ts-node": "10.9.2",
|
|
46
46
|
"vitest": "0.31.1",
|
|
47
47
|
"zip-lib": "^0.7.2",
|
|
48
|
-
"@remotion/bundler": "4.0.
|
|
49
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
48
|
+
"@remotion/bundler": "4.0.144",
|
|
49
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.144"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@remotion/bundler": "4.0.
|
|
52
|
+
"@remotion/bundler": "4.0.144"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"test": "vitest src/test/unit --run",
|
|
87
87
|
"watch": "tsc -w",
|
|
88
88
|
"build": "tsc -d && pnpm run buildlambda",
|
|
89
|
-
"buildlambda": "ts-node src/admin/bundle-lambda.ts"
|
|
90
|
-
"start": "ts-node src/run.ts"
|
|
89
|
+
"buildlambda": "ts-node src/admin/bundle-lambda.ts"
|
|
91
90
|
}
|
|
92
91
|
}
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
type SerializedJSONWithCustomFields = {
|
|
2
|
-
serializedString: string;
|
|
3
|
-
customDateUsed: boolean;
|
|
4
|
-
customFileUsed: boolean;
|
|
5
|
-
mapUsed: boolean;
|
|
6
|
-
setUsed: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const FILE_TOKEN = "remotion-file:";
|
|
9
|
-
export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
|
|
10
|
-
data: Record<string, unknown>;
|
|
11
|
-
indent: number | undefined;
|
|
12
|
-
staticBase: string | null;
|
|
13
|
-
}) => SerializedJSONWithCustomFields;
|
|
14
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Must keep this file in sync with the one in packages/core/src/input-props-serialization.ts!
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
|
|
5
|
-
const DATE_TOKEN = 'remotion-date:';
|
|
6
|
-
exports.FILE_TOKEN = 'remotion-file:';
|
|
7
|
-
const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
|
|
8
|
-
let customDateUsed = false;
|
|
9
|
-
let customFileUsed = false;
|
|
10
|
-
let mapUsed = false;
|
|
11
|
-
let setUsed = false;
|
|
12
|
-
const serializedString = JSON.stringify(data, function (key, value) {
|
|
13
|
-
const item = this[key];
|
|
14
|
-
if (item instanceof Date) {
|
|
15
|
-
customDateUsed = true;
|
|
16
|
-
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
17
|
-
}
|
|
18
|
-
if (item instanceof Map) {
|
|
19
|
-
mapUsed = true;
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
if (item instanceof Set) {
|
|
23
|
-
setUsed = true;
|
|
24
|
-
return value;
|
|
25
|
-
}
|
|
26
|
-
if (typeof item === 'string' &&
|
|
27
|
-
staticBase !== null &&
|
|
28
|
-
item.startsWith(staticBase)) {
|
|
29
|
-
customFileUsed = true;
|
|
30
|
-
return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
|
|
31
|
-
}
|
|
32
|
-
return value;
|
|
33
|
-
}, indent);
|
|
34
|
-
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
35
|
-
};
|
|
36
|
-
exports.serializeJSONWithDate = serializeJSONWithDate;
|