@remotion/lambda 4.0.163 → 4.0.165
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/delete-render.js +7 -3
- package/dist/api/deploy-function.d.ts +0 -1
- package/dist/api/deploy-function.js +3 -3
- package/dist/api/deploy-site.d.ts +3 -3
- package/dist/api/download-media.js +6 -3
- package/dist/api/get-compositions-on-lambda.js +0 -2
- package/dist/api/get-render-progress.js +0 -2
- package/dist/api/make-lambda-payload.js +2 -1
- package/dist/api/render-media-on-lambda.js +0 -2
- package/dist/api/render-still-on-lambda.js +37 -25
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/commands/functions/ls.js +3 -1
- package/dist/cli/commands/render/progress.d.ts +3 -28
- package/dist/cli/commands/render/progress.js +89 -90
- package/dist/cli/commands/render/render.js +7 -40
- package/dist/cli/commands/sites/create.js +2 -2
- package/dist/functions/chunk-optimization/types.d.ts +0 -3
- package/dist/functions/helpers/calculate-chunk-times.d.ts +3 -4
- package/dist/functions/helpers/calculate-chunk-times.js +4 -8
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +3 -5
- package/dist/functions/helpers/calculate-price-from-bucket.js +5 -18
- package/dist/functions/helpers/clean-tmpdir.d.ts +0 -2
- package/dist/functions/helpers/clean-tmpdir.js +1 -7
- package/dist/functions/helpers/concat-videos.d.ts +1 -13
- package/dist/functions/helpers/concat-videos.js +7 -131
- package/dist/functions/helpers/create-post-render-data.d.ts +6 -6
- package/dist/functions/helpers/create-post-render-data.js +17 -37
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +1 -3
- package/dist/functions/helpers/find-output-file-in-bucket.js +1 -4
- package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-progress-step-size.js +0 -3
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -6
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +0 -13
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +8 -0
- package/dist/functions/helpers/get-overall-progress-s3.js +25 -0
- package/dist/functions/helpers/get-overall-progress.d.ts +1 -2
- package/dist/functions/helpers/get-overall-progress.js +2 -4
- package/dist/functions/helpers/get-progress.js +78 -154
- package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
- package/dist/functions/helpers/get-retry-stats.js +0 -18
- package/dist/functions/helpers/inspect-errors.d.ts +4 -10
- package/dist/functions/helpers/inspect-errors.js +5 -27
- package/dist/functions/helpers/io.d.ts +0 -1
- package/dist/functions/helpers/io.js +2 -3
- package/dist/functions/helpers/lifecycle.d.ts +0 -4
- package/dist/functions/helpers/lifecycle.js +2 -3
- package/dist/functions/helpers/make-timeout-error.d.ts +0 -2
- package/dist/functions/helpers/merge-chunks.d.ts +5 -7
- package/dist/functions/helpers/merge-chunks.js +16 -149
- package/dist/functions/helpers/min-max.d.ts +1 -1
- package/dist/functions/helpers/min-max.js +1 -1
- package/dist/functions/helpers/overall-render-progress.d.ts +49 -0
- package/dist/functions/helpers/overall-render-progress.js +164 -0
- package/dist/functions/helpers/stream-renderer.d.ts +11 -0
- package/dist/functions/helpers/stream-renderer.js +127 -0
- package/dist/functions/helpers/streamify-response.d.ts +0 -3
- package/dist/functions/helpers/streamify-response.js +2 -14
- package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
- package/dist/functions/helpers/write-lambda-error.d.ts +3 -6
- package/dist/functions/helpers/write-lambda-error.js +1 -21
- package/dist/functions/index.d.ts +5 -0
- package/dist/functions/index.js +70 -51
- package/dist/functions/launch.js +103 -200
- package/dist/functions/renderer.d.ts +2 -2
- package/dist/functions/renderer.js +70 -123
- package/dist/functions/start.d.ts +1 -0
- package/dist/functions/start.js +3 -2
- package/dist/functions/still.d.ts +7 -2
- package/dist/functions/still.js +17 -34
- package/dist/functions/streaming/stream-writer.d.ts +6 -0
- package/dist/functions/streaming/stream-writer.js +35 -0
- package/dist/functions/streaming/streaming.d.ts +92 -0
- package/dist/functions/streaming/streaming.js +58 -0
- package/dist/internals.d.ts +7 -6
- package/dist/shared/aws-clients.js +8 -0
- package/dist/shared/call-lambda.d.ts +5 -4
- package/dist/shared/call-lambda.js +53 -44
- package/dist/shared/constants.d.ts +15 -49
- package/dist/shared/constants.js +3 -32
- package/dist/shared/content-disposition-header.d.ts +0 -3
- package/dist/shared/get-function-version.js +0 -2
- package/dist/shared/is-flaky-error.js +4 -0
- package/dist/shared/parse-lambda-timings-key.d.ts +0 -2
- package/dist/shared/parse-lambda-timings-key.js +0 -14
- package/dist/shared/return-values.d.ts +0 -7
- package/package.json +18 -18
- package/remotionlambda-arm64.zip +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const constants_1 = require("../../shared/constants");
|
|
5
|
-
const get_current_region_1 = require("./get-current-region");
|
|
3
|
+
exports.getTmpDirStateIfENoSp = void 0;
|
|
6
4
|
const get_files_in_folder_1 = require("./get-files-in-folder");
|
|
7
|
-
const io_1 = require("./io");
|
|
8
5
|
const is_enosp_err_1 = require("./is-enosp-err");
|
|
9
6
|
const getTmpDirStateIfENoSp = (err) => {
|
|
10
7
|
if (!(0, is_enosp_err_1.errorIsOutOfSpaceError)(err)) {
|
|
@@ -21,20 +18,3 @@ const getTmpDirStateIfENoSp = (err) => {
|
|
|
21
18
|
};
|
|
22
19
|
};
|
|
23
20
|
exports.getTmpDirStateIfENoSp = getTmpDirStateIfENoSp;
|
|
24
|
-
const writeLambdaError = async ({ bucketName, renderId, errorInfo, expectedBucketOwner, }) => {
|
|
25
|
-
await (0, io_1.lambdaWriteFile)({
|
|
26
|
-
bucketName,
|
|
27
|
-
key: `${(0, constants_1.getErrorFileName)({
|
|
28
|
-
renderId,
|
|
29
|
-
chunk: errorInfo.chunk,
|
|
30
|
-
attempt: errorInfo.attempt,
|
|
31
|
-
})}.txt`,
|
|
32
|
-
body: JSON.stringify(errorInfo),
|
|
33
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
34
|
-
privacy: 'private',
|
|
35
|
-
expectedBucketOwner,
|
|
36
|
-
downloadBehavior: null,
|
|
37
|
-
customCredentials: null,
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
exports.writeLambdaError = writeLambdaError;
|
package/dist/functions/index.js
CHANGED
|
@@ -10,15 +10,15 @@ const leak_detection_1 = require("./helpers/leak-detection");
|
|
|
10
10
|
const lifecycle_1 = require("./helpers/lifecycle");
|
|
11
11
|
const print_cloudwatch_helper_1 = require("./helpers/print-cloudwatch-helper");
|
|
12
12
|
const streamify_response_1 = require("./helpers/streamify-response");
|
|
13
|
-
const streaming_payloads_1 = require("./helpers/streaming-payloads");
|
|
14
13
|
const info_1 = require("./info");
|
|
15
14
|
const launch_1 = require("./launch");
|
|
16
|
-
const merge_1 = require("./merge");
|
|
17
15
|
const progress_1 = require("./progress");
|
|
18
16
|
const renderer_2 = require("./renderer");
|
|
19
17
|
const start_1 = require("./start");
|
|
20
18
|
const still_1 = require("./still");
|
|
21
|
-
const
|
|
19
|
+
const stream_writer_1 = require("./streaming/stream-writer");
|
|
20
|
+
const streaming_1 = require("./streaming/streaming");
|
|
21
|
+
const innerHandler = async ({ params, responseWriter, context, }) => {
|
|
22
22
|
(0, leak_detection_1.setCurrentRequestId)(context.awsRequestId);
|
|
23
23
|
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
|
|
24
24
|
const timeoutInMilliseconds = context.getRemainingTimeInMillis();
|
|
@@ -39,19 +39,36 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
39
39
|
inputProps: JSON.stringify(params.inputProps),
|
|
40
40
|
isWarm,
|
|
41
41
|
}, params.logLevel);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
await new Promise((resolve, reject) => {
|
|
43
|
+
const onStream = (payload) => {
|
|
44
|
+
const message = (0, streaming_1.makeStreamPayload)({
|
|
45
|
+
message: payload,
|
|
46
|
+
});
|
|
47
|
+
responseWriter.write(message).catch((err) => {
|
|
48
|
+
reject(err);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
if (params.streamed) {
|
|
52
|
+
onStream({
|
|
53
|
+
type: 'render-id-determined',
|
|
54
|
+
payload: { renderId },
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
(0, still_1.stillHandler)({
|
|
58
|
+
expectedBucketOwner: currentUserId,
|
|
59
|
+
params,
|
|
60
|
+
renderId,
|
|
61
|
+
onStream,
|
|
62
|
+
timeoutInMilliseconds,
|
|
63
|
+
})
|
|
64
|
+
.then((r) => {
|
|
65
|
+
resolve(r);
|
|
66
|
+
})
|
|
67
|
+
.catch((err) => {
|
|
68
|
+
reject(err);
|
|
69
|
+
});
|
|
54
70
|
});
|
|
71
|
+
await responseWriter.end();
|
|
55
72
|
return;
|
|
56
73
|
}
|
|
57
74
|
if (params.type === constants_1.LambdaRoutines.start) {
|
|
@@ -61,10 +78,10 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
61
78
|
}, params.logLevel);
|
|
62
79
|
const response = await (0, start_1.startHandler)(params, {
|
|
63
80
|
expectedBucketOwner: currentUserId,
|
|
81
|
+
timeoutInMilliseconds,
|
|
64
82
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
83
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
84
|
+
await responseWriter.end();
|
|
68
85
|
return;
|
|
69
86
|
}
|
|
70
87
|
if (params.type === constants_1.LambdaRoutines.launch) {
|
|
@@ -77,9 +94,8 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
77
94
|
expectedBucketOwner: currentUserId,
|
|
78
95
|
getRemainingTimeInMillis: context.getRemainingTimeInMillis,
|
|
79
96
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
97
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
98
|
+
await responseWriter.end();
|
|
83
99
|
return;
|
|
84
100
|
}
|
|
85
101
|
if (params.type === constants_1.LambdaRoutines.status) {
|
|
@@ -92,9 +108,8 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
92
108
|
timeoutInMilliseconds,
|
|
93
109
|
retriesRemaining: 2,
|
|
94
110
|
});
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
111
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
112
|
+
await responseWriter.end();
|
|
98
113
|
return;
|
|
99
114
|
}
|
|
100
115
|
if (params.type === constants_1.LambdaRoutines.renderer) {
|
|
@@ -105,13 +120,26 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
105
120
|
resolvedProps: JSON.stringify(params.resolvedProps),
|
|
106
121
|
isWarm,
|
|
107
122
|
}, params.logLevel);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
123
|
+
await new Promise((resolve, reject) => {
|
|
124
|
+
(0, renderer_2.rendererHandler)(params, {
|
|
125
|
+
expectedBucketOwner: currentUserId,
|
|
126
|
+
isWarm,
|
|
127
|
+
}, (payload) => {
|
|
128
|
+
const message = (0, streaming_1.makeStreamPayload)({
|
|
129
|
+
message: payload,
|
|
130
|
+
});
|
|
131
|
+
responseWriter.write(message).catch((err) => {
|
|
132
|
+
reject(err);
|
|
133
|
+
});
|
|
134
|
+
}, context)
|
|
135
|
+
.then((res) => {
|
|
136
|
+
resolve(res);
|
|
137
|
+
})
|
|
138
|
+
.catch((err) => {
|
|
139
|
+
reject(err);
|
|
140
|
+
});
|
|
114
141
|
});
|
|
142
|
+
await responseWriter.end();
|
|
115
143
|
return;
|
|
116
144
|
}
|
|
117
145
|
if (params.type === constants_1.LambdaRoutines.info) {
|
|
@@ -119,23 +147,10 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
119
147
|
isWarm,
|
|
120
148
|
}, params.logLevel);
|
|
121
149
|
const response = await (0, info_1.infoHandler)(params);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
150
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
151
|
+
await responseWriter.end();
|
|
125
152
|
return;
|
|
126
153
|
}
|
|
127
|
-
if (params.type === constants_1.LambdaRoutines.merge) {
|
|
128
|
-
(0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.merge, {
|
|
129
|
-
renderId: params.renderId,
|
|
130
|
-
isWarm,
|
|
131
|
-
}, params.logLevel);
|
|
132
|
-
const response = await (0, merge_1.mergeHandler)(params, {
|
|
133
|
-
expectedBucketOwner: currentUserId,
|
|
134
|
-
});
|
|
135
|
-
responseStream.write(JSON.stringify(response), () => {
|
|
136
|
-
responseStream.end();
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
154
|
if (params.type === constants_1.LambdaRoutines.compositions) {
|
|
140
155
|
(0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.compositions, {
|
|
141
156
|
isWarm,
|
|
@@ -143,16 +158,20 @@ const innerHandler = async (params, responseStream, context) => {
|
|
|
143
158
|
const response = await (0, compositions_1.compositionsHandler)(params, {
|
|
144
159
|
expectedBucketOwner: currentUserId,
|
|
145
160
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
161
|
+
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
162
|
+
await responseWriter.end();
|
|
149
163
|
return;
|
|
150
164
|
}
|
|
151
165
|
throw new Error(constants_1.COMMAND_NOT_FOUND);
|
|
152
166
|
};
|
|
153
167
|
const routine = async (params, responseStream, context) => {
|
|
168
|
+
const responseWriter = (0, stream_writer_1.streamWriter)(responseStream);
|
|
154
169
|
try {
|
|
155
|
-
await innerHandler(
|
|
170
|
+
await innerHandler({
|
|
171
|
+
params,
|
|
172
|
+
responseWriter,
|
|
173
|
+
context,
|
|
174
|
+
});
|
|
156
175
|
}
|
|
157
176
|
catch (err) {
|
|
158
177
|
const res = {
|
|
@@ -160,8 +179,8 @@ const routine = async (params, responseStream, context) => {
|
|
|
160
179
|
message: err.message,
|
|
161
180
|
stack: err.stack,
|
|
162
181
|
};
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
await responseWriter.write(Buffer.from(JSON.stringify(res)));
|
|
183
|
+
await responseWriter.end();
|
|
165
184
|
}
|
|
166
185
|
};
|
|
167
186
|
exports.handler = (0, streamify_response_1.streamifyResponse)(routine);
|