@remotion/lambda 4.0.30 → 4.0.31
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/cli/helpers/validate.d.ts +4 -0
- package/dist/cli/helpers/validate.js +8 -0
- package/dist/functions/helpers/apply-lifecyle.d.ts +8 -0
- package/dist/functions/helpers/apply-lifecyle.js +18 -0
- package/dist/functions/helpers/lifecycle.d.ts +19 -0
- package/dist/functions/helpers/lifecycle.js +42 -0
- package/dist/shared/lifecycle-rules.d.ts +8 -0
- package/dist/shared/lifecycle-rules.js +51 -0
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = void 0;
|
|
4
|
+
/* eslint-disable prefer-destructuring */
|
|
5
|
+
const remotion_1 = require("remotion");
|
|
6
|
+
exports.validateFps = remotion_1.Internals.validateFps;
|
|
7
|
+
exports.validateDimension = remotion_1.Internals.validateDimension;
|
|
8
|
+
exports.validateDurationInFrames = remotion_1.Internals.validateDurationInFrames;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DeleteBucketLifecycleCommandInput, LifecycleRule, PutBucketLifecycleConfigurationCommandInput } from '@aws-sdk/client-s3';
|
|
2
|
+
export declare const deleteLifeCycleInput: ({ bucketName, }: {
|
|
3
|
+
bucketName: string;
|
|
4
|
+
}) => DeleteBucketLifecycleCommandInput;
|
|
5
|
+
export declare const createLifeCycleInput: ({ bucketName, lcRules, }: {
|
|
6
|
+
bucketName: string;
|
|
7
|
+
lcRules: LifecycleRule[];
|
|
8
|
+
}) => PutBucketLifecycleConfigurationCommandInput;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLifeCycleInput = exports.deleteLifeCycleInput = void 0;
|
|
4
|
+
const deleteLifeCycleInput = ({ bucketName, }) => {
|
|
5
|
+
return {
|
|
6
|
+
Bucket: bucketName,
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
exports.deleteLifeCycleInput = deleteLifeCycleInput;
|
|
10
|
+
const createLifeCycleInput = ({ bucketName, lcRules, }) => {
|
|
11
|
+
return {
|
|
12
|
+
Bucket: bucketName,
|
|
13
|
+
LifecycleConfiguration: {
|
|
14
|
+
Rules: lcRules,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.createLifeCycleInput = createLifeCycleInput;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LifecycleRule } from '@aws-sdk/client-s3';
|
|
2
|
+
declare const expiryDays: {
|
|
3
|
+
readonly '1-day': 1;
|
|
4
|
+
readonly '3-days': 3;
|
|
5
|
+
readonly '7-days': 7;
|
|
6
|
+
readonly '30-days': 30;
|
|
7
|
+
};
|
|
8
|
+
export type RenderExpiryDays = keyof typeof expiryDays;
|
|
9
|
+
export declare const renderEnumToStr: (v: RenderExpiryDays) => string;
|
|
10
|
+
export declare const strToRenderEnum: ({ value }: {
|
|
11
|
+
value?: string | undefined;
|
|
12
|
+
}) => "1-day" | "3-days" | "7-days" | "30-days" | null;
|
|
13
|
+
export declare const getEnabledLifeCycleRule: ({ key, value, }: {
|
|
14
|
+
key: string;
|
|
15
|
+
value: number;
|
|
16
|
+
}) => LifecycleRule;
|
|
17
|
+
export declare const getLifeCycleRules: () => LifecycleRule[];
|
|
18
|
+
export declare const generateRandomHashWithLifeCycleRule: (renderFolderExpiry: RenderExpiryDays | null) => string;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateRandomHashWithLifeCycleRule = exports.getLifeCycleRules = exports.getEnabledLifeCycleRule = exports.strToRenderEnum = exports.renderEnumToStr = void 0;
|
|
4
|
+
const random_hash_1 = require("../../shared/random-hash");
|
|
5
|
+
const truthy_1 = require("../../shared/truthy");
|
|
6
|
+
const expiryDays = {
|
|
7
|
+
'1-day': 1,
|
|
8
|
+
'3-days': 3,
|
|
9
|
+
'7-days': 7,
|
|
10
|
+
'30-days': 30,
|
|
11
|
+
};
|
|
12
|
+
const renderEnumToStr = (v) => {
|
|
13
|
+
return v;
|
|
14
|
+
};
|
|
15
|
+
exports.renderEnumToStr = renderEnumToStr;
|
|
16
|
+
const strToRenderEnum = ({ value }) => {
|
|
17
|
+
return value ? value : null;
|
|
18
|
+
};
|
|
19
|
+
exports.strToRenderEnum = strToRenderEnum;
|
|
20
|
+
const getEnabledLifeCycleRule = ({ key, value, }) => {
|
|
21
|
+
return {
|
|
22
|
+
Expiration: {
|
|
23
|
+
Days: value,
|
|
24
|
+
},
|
|
25
|
+
Filter: {
|
|
26
|
+
Prefix: `renders/${key}`,
|
|
27
|
+
},
|
|
28
|
+
ID: `delete-after-${key}`,
|
|
29
|
+
Status: 'Enabled',
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.getEnabledLifeCycleRule = getEnabledLifeCycleRule;
|
|
33
|
+
const getLifeCycleRules = () => {
|
|
34
|
+
return Object.entries(expiryDays).map(([key, value]) => (0, exports.getEnabledLifeCycleRule)({ key, value }));
|
|
35
|
+
};
|
|
36
|
+
exports.getLifeCycleRules = getLifeCycleRules;
|
|
37
|
+
const generateRandomHashWithLifeCycleRule = (renderFolderExpiry) => {
|
|
38
|
+
return [renderFolderExpiry, (0, random_hash_1.randomHash)({ randomInTests: true })]
|
|
39
|
+
.filter(truthy_1.truthy)
|
|
40
|
+
.join('-');
|
|
41
|
+
};
|
|
42
|
+
exports.generateRandomHashWithLifeCycleRule = generateRandomHashWithLifeCycleRule;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AwsRegion } from '../client';
|
|
2
|
+
import type { CustomCredentials } from './aws-clients';
|
|
3
|
+
export declare const applyLifeCyleOperation: ({ enableFolderExpiry, bucketName, region, customCredentials, }: {
|
|
4
|
+
enableFolderExpiry: boolean | null;
|
|
5
|
+
bucketName: string;
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
customCredentials: CustomCredentials | null;
|
|
8
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyLifeCyleOperation = void 0;
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const apply_lifecyle_1 = require("../functions/helpers/apply-lifecyle");
|
|
6
|
+
const lifecycle_1 = require("../functions/helpers/lifecycle");
|
|
7
|
+
const aws_clients_1 = require("./aws-clients");
|
|
8
|
+
const createLCRules = async ({ bucketName, region, customCredentials, }) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const lcRules = (0, lifecycle_1.getLifeCycleRules)();
|
|
11
|
+
// create the lifecyle rules
|
|
12
|
+
const createCommandInput = (0, apply_lifecyle_1.createLifeCycleInput)({
|
|
13
|
+
bucketName,
|
|
14
|
+
lcRules,
|
|
15
|
+
});
|
|
16
|
+
const createCommand = new client_s3_1.PutBucketLifecycleConfigurationCommand(createCommandInput);
|
|
17
|
+
try {
|
|
18
|
+
await (0, aws_clients_1.getS3Client)(region, customCredentials).send(createCommand);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('AccessDenied')) {
|
|
22
|
+
throw new Error(`You don't have the required permissions to create lifecycle rules on the bucket "${bucketName}", but the "enableFolderExpiry" was set to true. Ensure that your user has the "s3:PutLifecycleConfiguration" permission.`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const deleteLCRules = async ({ bucketName, region, customCredentials, }) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const deleteCommandInput = (0, apply_lifecyle_1.deleteLifeCycleInput)({
|
|
29
|
+
bucketName,
|
|
30
|
+
});
|
|
31
|
+
try {
|
|
32
|
+
await (0, aws_clients_1.getS3Client)(region, customCredentials).send(new client_s3_1.DeleteBucketLifecycleCommand(deleteCommandInput));
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('AccessDenied')) {
|
|
36
|
+
throw new Error(`You don't have the required permissions to delete lifecycle rules on the bucket "${bucketName}", but the "enableFolderExpiry" option was set to "false". Ensure that your user has the "s3:PutLifecycleConfiguration" permission. Set "enableFolderExpiry" to "null" to not overwrite any existing lifecycle rules.`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const applyLifeCyleOperation = async ({ enableFolderExpiry, bucketName, region, customCredentials, }) => {
|
|
41
|
+
if (enableFolderExpiry === null) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (enableFolderExpiry === true) {
|
|
45
|
+
await createLCRules({ bucketName, region, customCredentials });
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
await deleteLCRules({ bucketName, region, customCredentials });
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.applyLifeCyleOperation = applyLifeCyleOperation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.31",
|
|
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.21.4",
|
|
29
|
-
"@remotion/bundler": "4.0.
|
|
30
|
-
"@remotion/cli": "4.0.
|
|
31
|
-
"@remotion/renderer": "4.0.
|
|
32
|
-
"remotion": "4.0.
|
|
29
|
+
"@remotion/bundler": "4.0.31",
|
|
30
|
+
"@remotion/cli": "4.0.31",
|
|
31
|
+
"@remotion/renderer": "4.0.31",
|
|
32
|
+
"remotion": "4.0.31"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.266",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"ts-node": "^10.8.0",
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
|
-
"@remotion/bundler": "4.0.
|
|
47
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
46
|
+
"@remotion/bundler": "4.0.31",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.31"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.31"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|