@remotion/lambda 4.0.50 → 4.0.51
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/create-function.js +20 -1
- package/dist/api/iam-validation/user-permissions.js +1 -0
- package/dist/cli/commands/sites/create.js +1 -0
- package/dist/cli/log.d.ts +4 -4
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/shared/invoke-webhook.d.ts +2 -0
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
- package/dist/cli/helpers/validate.d.ts +0 -4
- package/dist/cli/helpers/validate.js +0 -8
- package/dist/functions/streaming/streaming.d.ts +0 -12
- package/dist/functions/streaming/streaming.js +0 -100
|
@@ -4,6 +4,7 @@ exports.createFunction = void 0;
|
|
|
4
4
|
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
5
5
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
|
+
const version_1 = require("remotion/version");
|
|
7
8
|
const defaults_1 = require("../defaults");
|
|
8
9
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
9
10
|
const hosted_layers_1 = require("../shared/hosted-layers");
|
|
@@ -31,7 +32,7 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
31
32
|
return { FunctionName: functionName };
|
|
32
33
|
}
|
|
33
34
|
const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
|
|
34
|
-
const { FunctionName } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
|
|
35
|
+
const { FunctionName, FunctionArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
|
|
35
36
|
Code: {
|
|
36
37
|
ZipFile: (0, node_fs_1.readFileSync)(zipFile),
|
|
37
38
|
},
|
|
@@ -48,6 +49,24 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
48
49
|
Size: ephemerealStorageInMb,
|
|
49
50
|
},
|
|
50
51
|
}));
|
|
52
|
+
try {
|
|
53
|
+
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.TagResourceCommand({
|
|
54
|
+
Resource: FunctionArn,
|
|
55
|
+
Tags: {
|
|
56
|
+
'remotion-lambda': 'true',
|
|
57
|
+
'remotion-version': version_1.VERSION,
|
|
58
|
+
'remotion-memory-in-mb': String(memorySizeInMb),
|
|
59
|
+
'remotion-timeout-in-seconds': String(timeoutInSeconds),
|
|
60
|
+
'remotion-ephemereal-storage-in-mb': String(ephemerealStorageInMb),
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
// Previous Lambda versions had no permission to tag the function
|
|
66
|
+
if (!err.name.includes('AccessDenied')) {
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
51
70
|
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutFunctionEventInvokeConfigCommand({
|
|
52
71
|
MaximumRetryAttempts: 0,
|
|
53
72
|
FunctionName,
|
|
@@ -62,6 +62,7 @@ exports.requiredPermissions = [
|
|
|
62
62
|
aws_policies_1.lambda.DeleteFunction,
|
|
63
63
|
aws_policies_1.lambda.PutFunctionEventInvokeConfig,
|
|
64
64
|
'lambda:PutRuntimeManagementConfig',
|
|
65
|
+
aws_policies_1.lambda.TagResource,
|
|
65
66
|
],
|
|
66
67
|
resource: [`arn:aws:lambda:*:*:function:${constants_1.RENDER_FN_PREFIX}*`],
|
|
67
68
|
},
|
package/dist/cli/log.d.ts
CHANGED
|
@@ -2,24 +2,24 @@ export declare const Log: {
|
|
|
2
2
|
verbose: (message?: any, ...optionalParams: any[]) => void;
|
|
3
3
|
verboseAdvanced: (options: {
|
|
4
4
|
indent: boolean;
|
|
5
|
-
logLevel: "
|
|
5
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
6
6
|
} & {
|
|
7
7
|
tag?: string | undefined;
|
|
8
8
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
9
9
|
info: (message?: any, ...optionalParams: any[]) => void;
|
|
10
10
|
infoAdvanced: (options: {
|
|
11
11
|
indent: boolean;
|
|
12
|
-
logLevel: "
|
|
12
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
13
13
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
14
14
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
15
15
|
warnAdvanced: (options: {
|
|
16
16
|
indent: boolean;
|
|
17
|
-
logLevel: "
|
|
17
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
18
18
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
19
19
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
20
20
|
errorAdvanced: (options: {
|
|
21
21
|
indent: boolean;
|
|
22
|
-
logLevel: "
|
|
22
|
+
logLevel: "error" | "verbose" | "info" | "warn";
|
|
23
23
|
} & {
|
|
24
24
|
tag?: string | undefined;
|
|
25
25
|
}, message?: any, ...optionalParams: any[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-
|
|
1
|
+
export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "sa-east-1" | "eu-south-1" | "af-south-1" | "ap-east-1" | "me-south-1";
|
|
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
|
|
|
4
4
|
type: z.ZodLiteral<"render-id-determined">;
|
|
5
5
|
renderId: z.ZodString;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
type: "render-id-determined";
|
|
8
7
|
renderId: string;
|
|
9
|
-
}, {
|
|
10
8
|
type: "render-id-determined";
|
|
9
|
+
}, {
|
|
11
10
|
renderId: string;
|
|
11
|
+
type: "render-id-determined";
|
|
12
12
|
}>]>;
|
|
13
13
|
export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
|
|
14
14
|
export declare const isStreamingPayload: (str: string) => false | {
|
|
15
|
-
type: "render-id-determined";
|
|
16
15
|
renderId: string;
|
|
16
|
+
type: "render-id-determined";
|
|
17
17
|
};
|
|
18
18
|
export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
|
|
19
19
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.51",
|
|
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/bundler": "4.0.
|
|
30
|
-
"remotion": "4.0.
|
|
31
|
-
"
|
|
32
|
-
"@remotion/
|
|
29
|
+
"@remotion/bundler": "4.0.51",
|
|
30
|
+
"@remotion/renderer": "4.0.51",
|
|
31
|
+
"remotion": "4.0.51",
|
|
32
|
+
"@remotion/cli": "4.0.51"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.276",
|
|
@@ -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.51",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.51"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.51"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
type OnMessage = (type: 'error' | 'success', nonce: string, data: Buffer) => void;
|
|
3
|
-
export declare const makeStreaming: (onMessage: OnMessage) => {
|
|
4
|
-
addData: (data: Buffer) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const makePayloadMessage: (nonce: number, data: Buffer, status: 0 | 1) => Buffer;
|
|
7
|
-
export type StreamingPayload = {
|
|
8
|
-
type: 'frames-rendered';
|
|
9
|
-
frames: number;
|
|
10
|
-
};
|
|
11
|
-
export type OnStream = (payload: StreamingPayload) => void;
|
|
12
|
-
export {};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makePayloadMessage = exports.makeStreaming = void 0;
|
|
4
|
-
const makeStreaming = (onMessage) => {
|
|
5
|
-
let outputBuffer = Buffer.from('');
|
|
6
|
-
const separator = Buffer.from('remotion_buffer:');
|
|
7
|
-
let unprocessedBuffers = [];
|
|
8
|
-
let missingData = null;
|
|
9
|
-
const processInput = () => {
|
|
10
|
-
let separatorIndex = outputBuffer.indexOf(separator);
|
|
11
|
-
if (separatorIndex === -1) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
separatorIndex += separator.length;
|
|
15
|
-
let nonceString = '';
|
|
16
|
-
let lengthString = '';
|
|
17
|
-
let statusString = '';
|
|
18
|
-
// Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
|
|
19
|
-
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
20
|
-
// we'll extract the data and pass it to the callback.
|
|
21
|
-
// eslint-disable-next-line no-constant-condition
|
|
22
|
-
while (true) {
|
|
23
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
24
|
-
// 0x3a is the character ":"
|
|
25
|
-
if (nextDigit === 0x3a) {
|
|
26
|
-
separatorIndex++;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
separatorIndex++;
|
|
30
|
-
nonceString += String.fromCharCode(nextDigit);
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line no-constant-condition
|
|
33
|
-
while (true) {
|
|
34
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
35
|
-
if (nextDigit === 0x3a) {
|
|
36
|
-
separatorIndex++;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
separatorIndex++;
|
|
40
|
-
lengthString += String.fromCharCode(nextDigit);
|
|
41
|
-
}
|
|
42
|
-
// eslint-disable-next-line no-constant-condition
|
|
43
|
-
while (true) {
|
|
44
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
45
|
-
if (nextDigit === 0x3a) {
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
separatorIndex++;
|
|
49
|
-
statusString += String.fromCharCode(nextDigit);
|
|
50
|
-
}
|
|
51
|
-
const length = Number(lengthString);
|
|
52
|
-
const status = Number(statusString);
|
|
53
|
-
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
54
|
-
if (dataLength < length) {
|
|
55
|
-
missingData = {
|
|
56
|
-
dataMissing: length - dataLength,
|
|
57
|
-
};
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
61
|
-
onMessage(status === 1 ? 'error' : 'success', nonceString, data);
|
|
62
|
-
missingData = null;
|
|
63
|
-
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
64
|
-
processInput();
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
addData: (data) => {
|
|
68
|
-
unprocessedBuffers.push(data);
|
|
69
|
-
const separatorIndex = data.indexOf(separator);
|
|
70
|
-
if (separatorIndex === -1) {
|
|
71
|
-
if (missingData) {
|
|
72
|
-
missingData.dataMissing -= data.length;
|
|
73
|
-
}
|
|
74
|
-
if (!missingData || missingData.dataMissing > 0) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
unprocessedBuffers.unshift(outputBuffer);
|
|
79
|
-
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
80
|
-
unprocessedBuffers = [];
|
|
81
|
-
console.log('the unprocessed input is now', new TextDecoder('utf-8').decode(outputBuffer));
|
|
82
|
-
processInput();
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
exports.makeStreaming = makeStreaming;
|
|
87
|
-
const makePayloadMessage = (nonce, data, status) => {
|
|
88
|
-
const concat = Buffer.concat([
|
|
89
|
-
Buffer.from('remotion_buffer:'),
|
|
90
|
-
Buffer.from(nonce.toString()),
|
|
91
|
-
Buffer.from(':'),
|
|
92
|
-
Buffer.from(data.length.toString()),
|
|
93
|
-
Buffer.from(':'),
|
|
94
|
-
Buffer.from(String(status)),
|
|
95
|
-
Buffer.from(':'),
|
|
96
|
-
data,
|
|
97
|
-
]);
|
|
98
|
-
return concat;
|
|
99
|
-
};
|
|
100
|
-
exports.makePayloadMessage = makePayloadMessage;
|