@remotion/lambda 3.3.12 → 3.3.14
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/get-buckets.js +26 -9
- package/dist/api/get-compositions-on-lambda.d.ts +2 -2
- package/dist/api/get-or-create-bucket.js +2 -2
- package/dist/api/render-media-on-lambda.d.ts +2 -2
- package/dist/api/render-still-on-lambda.d.ts +2 -2
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/shared/validate-bucketname.d.ts +5 -0
- package/dist/shared/validate-bucketname.js +19 -1
- package/package.json +6 -6
- package/remotionlambda.zip +0 -0
package/dist/api/get-buckets.js
CHANGED
|
@@ -4,26 +4,43 @@ exports.getRemotionS3Buckets = void 0;
|
|
|
4
4
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
5
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
6
6
|
const constants_1 = require("../shared/constants");
|
|
7
|
+
const validate_bucketname_1 = require("../shared/validate-bucketname");
|
|
7
8
|
const getRemotionS3Buckets = async (region) => {
|
|
8
9
|
const { Buckets } = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.ListBucketsCommand({}));
|
|
9
10
|
if (!Buckets) {
|
|
10
11
|
return { remotionBuckets: [] };
|
|
11
12
|
}
|
|
12
13
|
const remotionBuckets = Buckets.filter((b) => { var _a; return (_a = b.Name) === null || _a === void 0 ? void 0 : _a.startsWith(constants_1.REMOTION_BUCKET_PREFIX); });
|
|
13
|
-
const locations = await Promise.all(remotionBuckets.map((bucket) => {
|
|
14
|
-
return (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.GetBucketLocationCommand({
|
|
15
|
-
Bucket: bucket.Name,
|
|
16
|
-
}));
|
|
17
|
-
}));
|
|
18
|
-
const bucketsWithLocation = remotionBuckets.map((bucket, i) => {
|
|
14
|
+
const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
|
|
19
15
|
var _a;
|
|
16
|
+
const { region: parsedRegion } = (0, validate_bucketname_1.parseBucketName)(bucket.Name);
|
|
17
|
+
if (parsedRegion) {
|
|
18
|
+
return parsedRegion;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const result = await (0, aws_clients_1.getS3Client)(region, null).send(new client_s3_1.GetBucketLocationCommand({
|
|
22
|
+
Bucket: bucket.Name,
|
|
23
|
+
}));
|
|
24
|
+
// AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
|
|
25
|
+
return (_a = result.LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1';
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
// Sometimes the API returns a bucket even if it was deleted before
|
|
29
|
+
if (err.message.includes('NoSuchBucket')) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
const bucketsWithLocation = remotionBuckets
|
|
36
|
+
.map((bucket, i) => {
|
|
20
37
|
return {
|
|
21
38
|
creationDate: bucket.CreationDate.getTime(),
|
|
22
39
|
name: bucket.Name,
|
|
23
|
-
|
|
24
|
-
region: ((_a = locations[i].LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1'),
|
|
40
|
+
region: locations[i],
|
|
25
41
|
};
|
|
26
|
-
})
|
|
42
|
+
})
|
|
43
|
+
.filter((b) => b.region);
|
|
27
44
|
return {
|
|
28
45
|
remotionBuckets: bucketsWithLocation.filter((bucket) => {
|
|
29
46
|
return bucket.region === region;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { LogLevel } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChromiumOptions } from '@remotion/renderer/src/open-browser';
|
|
3
3
|
import type { TCompMetadata } from 'remotion';
|
|
4
4
|
import type { AwsRegion } from '../client';
|
|
5
5
|
export declare type GetCompositionsOnLambdaInput = {
|
|
6
|
-
chromiumOptions?:
|
|
6
|
+
chromiumOptions?: ChromiumOptions;
|
|
7
7
|
region: AwsRegion;
|
|
8
8
|
inputProps: unknown;
|
|
9
9
|
functionName: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getOrCreateBucket = void 0;
|
|
4
4
|
const constants_1 = require("../shared/constants");
|
|
5
|
-
const
|
|
5
|
+
const validate_bucketname_1 = require("../shared/validate-bucketname");
|
|
6
6
|
const create_bucket_1 = require("./create-bucket");
|
|
7
7
|
const get_buckets_1 = require("./get-buckets");
|
|
8
8
|
/**
|
|
@@ -21,7 +21,7 @@ const getOrCreateBucket = async (options) => {
|
|
|
21
21
|
(_a = options.onBucketEnsured) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
22
22
|
return { bucketName: remotionBuckets[0].name };
|
|
23
23
|
}
|
|
24
|
-
const bucketName =
|
|
24
|
+
const bucketName = (0, validate_bucketname_1.makeBucketName)(options.region);
|
|
25
25
|
await (0, create_bucket_1.createBucket)({
|
|
26
26
|
bucketName,
|
|
27
27
|
region: options.region,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChromiumOptions } from '@remotion/renderer/src/open-browser';
|
|
3
3
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
4
4
|
import type { OutNameInput, Privacy } from '../shared/constants';
|
|
5
5
|
import type { DownloadBehavior } from '../shared/content-disposition-header';
|
|
@@ -24,7 +24,7 @@ export declare type RenderMediaOnLambdaInput = {
|
|
|
24
24
|
frameRange?: FrameRange;
|
|
25
25
|
outName?: OutNameInput;
|
|
26
26
|
timeoutInMilliseconds?: number;
|
|
27
|
-
chromiumOptions?:
|
|
27
|
+
chromiumOptions?: ChromiumOptions;
|
|
28
28
|
scale?: number;
|
|
29
29
|
everyNthFrame?: number;
|
|
30
30
|
numberOfGifLoops?: number | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LogLevel, StillImageFormat } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ChromiumOptions } from '@remotion/renderer/src/open-browser';
|
|
3
3
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
4
4
|
import type { CostsInfo, OutNameInput, Privacy } from '../shared/constants';
|
|
5
5
|
import type { DownloadBehavior } from '../shared/content-disposition-header';
|
|
@@ -18,7 +18,7 @@ export declare type RenderStillOnLambdaInput = {
|
|
|
18
18
|
logLevel?: LogLevel;
|
|
19
19
|
outName?: OutNameInput;
|
|
20
20
|
timeoutInMilliseconds?: number;
|
|
21
|
-
chromiumOptions?:
|
|
21
|
+
chromiumOptions?: ChromiumOptions;
|
|
22
22
|
scale?: number;
|
|
23
23
|
downloadBehavior?: DownloadBehavior;
|
|
24
24
|
forceWidth?: number | null;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
1
2
|
export declare const validateBucketName: (bucketName: unknown, options: {
|
|
2
3
|
mustStartWithRemotion: boolean;
|
|
3
4
|
}) => void;
|
|
5
|
+
export declare const parseBucketName: (name: string) => {
|
|
6
|
+
region: AwsRegion | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const makeBucketName: (region: AwsRegion) => string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateBucketName = void 0;
|
|
3
|
+
exports.makeBucketName = exports.parseBucketName = exports.validateBucketName = void 0;
|
|
4
|
+
const regions_1 = require("../regions");
|
|
4
5
|
const constants_1 = require("./constants");
|
|
6
|
+
const random_hash_1 = require("./random-hash");
|
|
5
7
|
const validateBucketName = (bucketName, options) => {
|
|
6
8
|
if (typeof bucketName !== 'string') {
|
|
7
9
|
throw new TypeError(`'bucketName' must be a string, but is ${JSON.stringify(bucketName)}`);
|
|
@@ -15,3 +17,19 @@ const validateBucketName = (bucketName, options) => {
|
|
|
15
17
|
}
|
|
16
18
|
};
|
|
17
19
|
exports.validateBucketName = validateBucketName;
|
|
20
|
+
const parseBucketName = (name) => {
|
|
21
|
+
const parsed = name.match(new RegExp(`^${constants_1.REMOTION_BUCKET_PREFIX}(.*)-([a-z0-9A-Z]+)$`));
|
|
22
|
+
const region = parsed === null || parsed === void 0 ? void 0 : parsed[1];
|
|
23
|
+
if (!region) {
|
|
24
|
+
return { region: null };
|
|
25
|
+
}
|
|
26
|
+
const realRegionFound = regions_1.AWS_REGIONS.find((r) => r.replace(/-/g, '') === region);
|
|
27
|
+
return { region: realRegionFound !== null && realRegionFound !== void 0 ? realRegionFound : null };
|
|
28
|
+
};
|
|
29
|
+
exports.parseBucketName = parseBucketName;
|
|
30
|
+
const makeBucketName = (region) => {
|
|
31
|
+
return `${constants_1.REMOTION_BUCKET_PREFIX}${region.replace(/-/g, '')}-${(0, random_hash_1.randomHash)({
|
|
32
|
+
randomInTests: false,
|
|
33
|
+
})}`;
|
|
34
|
+
};
|
|
35
|
+
exports.makeBucketName = makeBucketName;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.14",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"@aws-sdk/credential-providers": "3.215.0",
|
|
34
34
|
"@aws-sdk/lib-storage": "3.215.0",
|
|
35
35
|
"@aws-sdk/s3-request-presigner": "3.215.0",
|
|
36
|
-
"@remotion/bundler": "3.3.
|
|
37
|
-
"@remotion/cli": "3.3.
|
|
38
|
-
"@remotion/renderer": "3.3.
|
|
36
|
+
"@remotion/bundler": "3.3.14",
|
|
37
|
+
"@remotion/cli": "3.3.14",
|
|
38
|
+
"@remotion/renderer": "3.3.14",
|
|
39
39
|
"aws-policies": "^1.0.1",
|
|
40
40
|
"mime-types": "2.1.34",
|
|
41
|
-
"remotion": "3.3.
|
|
41
|
+
"remotion": "3.3.14"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=16.8.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "85189b3037c37ec1a63dfc1f10a22981b3a56382"
|
|
65
65
|
}
|
package/remotionlambda.zip
CHANGED
|
Binary file
|