@remotion/lambda 3.1.7 → 3.1.8
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/api/render-still-on-lambda.d.ts +2 -2
- package/dist/api/upload-dir.js +5 -1
- package/dist/cli/helpers/format-bytes.d.ts +6 -0
- package/dist/cli/helpers/format-bytes.js +103 -0
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +2 -2
- package/dist/functions/helpers/io.js +5 -1
- package/dist/functions/helpers/min-max.d.ts +1 -1
- package/dist/functions/helpers/min-max.js +1 -1
- package/dist/shared/chunk.d.ts +1 -0
- package/dist/shared/chunk.js +11 -0
- package/dist/shared/constants.d.ts +2 -2
- package/dist/shared/constants.js +1 -1
- package/dist/shared/truthy.d.ts +0 -0
- package/dist/shared/truthy.js +0 -0
- package/dist/shared/validate-privacy.js +2 -2
- package/package.json +6 -6
- package/remotionlambda.zip +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChromiumOptions, LogLevel, StillImageFormat } from '@remotion/renderer';
|
|
2
2
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
3
|
-
import type { CostsInfo, OutNameInput } from '../shared/constants';
|
|
3
|
+
import type { CostsInfo, OutNameInput, Privacy } from '../shared/constants';
|
|
4
4
|
import type { DownloadBehavior } from '../shared/content-disposition-header';
|
|
5
5
|
export declare type RenderStillOnLambdaInput = {
|
|
6
6
|
region: AwsRegion;
|
|
@@ -9,7 +9,7 @@ export declare type RenderStillOnLambdaInput = {
|
|
|
9
9
|
composition: string;
|
|
10
10
|
inputProps: unknown;
|
|
11
11
|
imageFormat: StillImageFormat;
|
|
12
|
-
privacy:
|
|
12
|
+
privacy: Privacy;
|
|
13
13
|
maxRetries?: number;
|
|
14
14
|
envVariables?: Record<string, string>;
|
|
15
15
|
quality?: number;
|
package/dist/api/upload-dir.js
CHANGED
|
@@ -42,7 +42,11 @@ const uploadDir = async ({ bucket, region, dir, onProgress, folder, privacy, })
|
|
|
42
42
|
const Key = (0, make_s3_key_1.makeS3Key)(folder, dir, filePath.name);
|
|
43
43
|
const Body = (0, fs_1.createReadStream)(filePath.name);
|
|
44
44
|
const ContentType = mime_types_1.default.lookup(Key) || 'application/octet-stream';
|
|
45
|
-
const ACL = privacy === '
|
|
45
|
+
const ACL = privacy === 'no-acl'
|
|
46
|
+
? undefined
|
|
47
|
+
: privacy === 'private'
|
|
48
|
+
? 'private'
|
|
49
|
+
: 'public-read';
|
|
46
50
|
if (filePath.size > 5 * 1024 * 1024) {
|
|
47
51
|
const paralellUploads3 = new lib_storage_1.Upload({
|
|
48
52
|
client,
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatBytes = void 0;
|
|
4
|
+
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
5
|
+
const BIBYTE_UNITS = [
|
|
6
|
+
'B',
|
|
7
|
+
'kiB',
|
|
8
|
+
'MiB',
|
|
9
|
+
'GiB',
|
|
10
|
+
'TiB',
|
|
11
|
+
'PiB',
|
|
12
|
+
'EiB',
|
|
13
|
+
'ZiB',
|
|
14
|
+
'YiB',
|
|
15
|
+
];
|
|
16
|
+
const BIT_UNITS = [
|
|
17
|
+
'b',
|
|
18
|
+
'kbit',
|
|
19
|
+
'Mbit',
|
|
20
|
+
'Gbit',
|
|
21
|
+
'Tbit',
|
|
22
|
+
'Pbit',
|
|
23
|
+
'Ebit',
|
|
24
|
+
'Zbit',
|
|
25
|
+
'Ybit',
|
|
26
|
+
];
|
|
27
|
+
const BIBIT_UNITS = [
|
|
28
|
+
'b',
|
|
29
|
+
'kibit',
|
|
30
|
+
'Mibit',
|
|
31
|
+
'Gibit',
|
|
32
|
+
'Tibit',
|
|
33
|
+
'Pibit',
|
|
34
|
+
'Eibit',
|
|
35
|
+
'Zibit',
|
|
36
|
+
'Yibit',
|
|
37
|
+
];
|
|
38
|
+
/*
|
|
39
|
+
Formats the given number using `Number#toLocaleString`.
|
|
40
|
+
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
41
|
+
- If locale is true, the system default locale is used for translation.
|
|
42
|
+
- If no value for locale is specified, the number is returned unmodified.
|
|
43
|
+
*/
|
|
44
|
+
const toLocaleString = (number, locale, options) => {
|
|
45
|
+
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
46
|
+
return number.toLocaleString(locale, options);
|
|
47
|
+
}
|
|
48
|
+
if (locale === true || options !== undefined) {
|
|
49
|
+
return number.toLocaleString(undefined, options);
|
|
50
|
+
}
|
|
51
|
+
return String(number);
|
|
52
|
+
};
|
|
53
|
+
const formatBytes = (number, options = {
|
|
54
|
+
locale: 'en-US',
|
|
55
|
+
signed: false,
|
|
56
|
+
maximumFractionDigits: 1,
|
|
57
|
+
}) => {
|
|
58
|
+
if (!Number.isFinite(number)) {
|
|
59
|
+
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
60
|
+
}
|
|
61
|
+
options = { bits: false, binary: false, ...options };
|
|
62
|
+
const UNITS = options.bits
|
|
63
|
+
? options.binary
|
|
64
|
+
? BIBIT_UNITS
|
|
65
|
+
: BIT_UNITS
|
|
66
|
+
: options.binary
|
|
67
|
+
? BIBYTE_UNITS
|
|
68
|
+
: BYTE_UNITS;
|
|
69
|
+
if (options.signed && number === 0) {
|
|
70
|
+
return `0 $ {
|
|
71
|
+
UNITS[0]
|
|
72
|
+
}`;
|
|
73
|
+
}
|
|
74
|
+
const isNegative = number < 0;
|
|
75
|
+
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
76
|
+
if (isNegative) {
|
|
77
|
+
number = -number;
|
|
78
|
+
}
|
|
79
|
+
let localeOptions;
|
|
80
|
+
if (options.minimumFractionDigits !== undefined) {
|
|
81
|
+
localeOptions = {
|
|
82
|
+
minimumFractionDigits: options.minimumFractionDigits,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (options.maximumFractionDigits !== undefined) {
|
|
86
|
+
localeOptions = {
|
|
87
|
+
maximumFractionDigits: options.maximumFractionDigits,
|
|
88
|
+
...localeOptions,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (number < 1) {
|
|
92
|
+
const numString = toLocaleString(number, options.locale, localeOptions);
|
|
93
|
+
return prefix + numString + ' ' + UNITS[0];
|
|
94
|
+
}
|
|
95
|
+
const exponent = Math.min(Math.floor(options.binary
|
|
96
|
+
? Math.log(number) / Math.log(1024)
|
|
97
|
+
: Math.log10(number) / 3), UNITS.length - 1);
|
|
98
|
+
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
99
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
100
|
+
const unit = UNITS[exponent];
|
|
101
|
+
return prefix + numberString + ' ' + unit;
|
|
102
|
+
};
|
|
103
|
+
exports.formatBytes = formatBytes;
|
|
@@ -4,11 +4,11 @@ exports.getLambdasInvokedStats = void 0;
|
|
|
4
4
|
const constants_1 = require("../../shared/constants");
|
|
5
5
|
const min_max_1 = require("./min-max");
|
|
6
6
|
const getLambdasInvokedStats = (contents, renderId, startDate) => {
|
|
7
|
+
var _a;
|
|
7
8
|
const lambdasInvoked = contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaInitializedPrefix)(renderId)); });
|
|
8
9
|
const timeToInvokeLambdas = startDate === null
|
|
9
10
|
? null
|
|
10
|
-
: (0, min_max_1.max)(lambdasInvoked.map((l) => { var _a; return (_a = l.LastModified) === null || _a === void 0 ? void 0 : _a.getTime(); })) -
|
|
11
|
-
startDate;
|
|
11
|
+
: ((_a = (0, min_max_1.max)(lambdasInvoked.map((l) => { var _a; return (_a = l.LastModified) === null || _a === void 0 ? void 0 : _a.getTime(); }))) !== null && _a !== void 0 ? _a : 0) - startDate;
|
|
12
12
|
return {
|
|
13
13
|
timeToInvokeLambdas,
|
|
14
14
|
lambdasInvoked: lambdasInvoked.length,
|
|
@@ -52,7 +52,11 @@ const lambdaWriteFile = async ({ bucketName, key, body, region, privacy, expecte
|
|
|
52
52
|
Bucket: bucketName,
|
|
53
53
|
Key: key,
|
|
54
54
|
Body: body,
|
|
55
|
-
ACL: privacy === '
|
|
55
|
+
ACL: privacy === 'no-acl'
|
|
56
|
+
? undefined
|
|
57
|
+
: privacy === 'private'
|
|
58
|
+
? 'private'
|
|
59
|
+
: 'public-read',
|
|
56
60
|
ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
|
|
57
61
|
ContentType: mime_types_1.default.lookup(key) || 'application/octet-stream',
|
|
58
62
|
ContentDisposition: (0, content_disposition_header_1.getContentDispositionHeader)(downloadBehavior),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const min: (arr: number[]) => number;
|
|
2
|
-
export declare const max: (arr: number[]) => number;
|
|
2
|
+
export declare const max: (arr: number[]) => number | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chunk: <T>(input: T[], size: number) => T[][];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chunk = void 0;
|
|
4
|
+
const chunk = (input, size) => {
|
|
5
|
+
return input.reduce((arr, item, idx) => {
|
|
6
|
+
return idx % size === 0
|
|
7
|
+
? [...arr, [item]]
|
|
8
|
+
: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
|
|
9
|
+
}, []);
|
|
10
|
+
};
|
|
11
|
+
exports.chunk = chunk;
|
|
@@ -224,7 +224,7 @@ export declare type RenderMetadata = {
|
|
|
224
224
|
renderId: string;
|
|
225
225
|
outName: OutNameInput | undefined;
|
|
226
226
|
};
|
|
227
|
-
export declare type LambdaVersions = '2022-07-27' | '2022-07-25' | '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';
|
|
227
|
+
export declare type LambdaVersions = '2022-07-28' | '2022-07-27' | '2022-07-25' | '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';
|
|
228
228
|
export declare const CURRENT_VERSION: LambdaVersions;
|
|
229
229
|
export declare type PostRenderData = {
|
|
230
230
|
cost: {
|
|
@@ -284,6 +284,6 @@ export declare type RenderProgress = {
|
|
|
284
284
|
retriesInfo: ChunkRetry[];
|
|
285
285
|
mostExpensiveFrameRanges: ExpensiveChunk[] | null;
|
|
286
286
|
};
|
|
287
|
-
export declare type Privacy = 'public' | 'private';
|
|
287
|
+
export declare type Privacy = 'public' | 'private' | 'no-acl';
|
|
288
288
|
export declare const LAMBDA_CONCURRENCY_LIMIT_QUOTA = "L-B99A9384";
|
|
289
289
|
export declare const LAMBDA_BURST_LIMIT_QUOTA = "L-548AE339";
|
package/dist/shared/constants.js
CHANGED
|
@@ -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-
|
|
87
|
+
exports.CURRENT_VERSION = '2022-07-28';
|
|
88
88
|
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
|
|
89
89
|
exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
|
package/dist/shared/truthy.d.ts
CHANGED
|
File without changes
|
package/dist/shared/truthy.js
CHANGED
|
File without changes
|
|
@@ -5,8 +5,8 @@ function validatePrivacy(privacy) {
|
|
|
5
5
|
if (typeof privacy !== 'string') {
|
|
6
6
|
throw new TypeError('Privacy must be a string');
|
|
7
7
|
}
|
|
8
|
-
if (privacy !== 'private' && privacy !== 'public') {
|
|
9
|
-
throw new TypeError('Privacy must be either "private"
|
|
8
|
+
if (privacy !== 'private' && privacy !== 'public' && privacy !== 'no-acl') {
|
|
9
|
+
throw new TypeError('Privacy must be either "private", "public-read" or "no-acl"');
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
exports.validatePrivacy = validatePrivacy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"@aws-sdk/client-service-quotas": "3.58.0",
|
|
33
33
|
"@aws-sdk/lib-storage": "3.58.0",
|
|
34
34
|
"@aws-sdk/s3-request-presigner": "3.58.0",
|
|
35
|
-
"@remotion/bundler": "3.1.
|
|
36
|
-
"@remotion/cli": "3.1.
|
|
37
|
-
"@remotion/renderer": "3.1.
|
|
35
|
+
"@remotion/bundler": "3.1.8",
|
|
36
|
+
"@remotion/cli": "3.1.8",
|
|
37
|
+
"@remotion/renderer": "3.1.8",
|
|
38
38
|
"aws-policies": "^1.0.1",
|
|
39
39
|
"mime-types": "2.1.34",
|
|
40
|
-
"remotion": "3.1.
|
|
40
|
+
"remotion": "3.1.8"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.8.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "57f34a02b0f830053f92af426a6b70b6824f887e"
|
|
66
66
|
}
|
package/remotionlambda.zip
CHANGED
|
Binary file
|