@remotion/lambda 4.0.187 → 4.0.188
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/__mocks__/clean-items.d.ts +2 -0
- package/dist/api/__mocks__/clean-items.js +24 -0
- package/dist/api/__mocks__/create-function.d.ts +2 -0
- package/dist/api/__mocks__/create-function.js +21 -0
- package/dist/api/__mocks__/delete-function.d.ts +2 -0
- package/dist/api/__mocks__/delete-function.js +9 -0
- package/dist/api/__mocks__/get-functions.d.ts +2 -0
- package/dist/api/__mocks__/get-functions.js +9 -0
- package/dist/api/__mocks__/upload-dir.d.ts +3 -0
- package/dist/api/__mocks__/upload-dir.js +47 -0
- package/dist/api/bucket-exists.d.ts +3 -6
- package/dist/api/bucket-exists.js +5 -5
- package/dist/api/clean-items.d.ts +4 -3
- package/dist/api/clean-items.js +7 -7
- package/dist/api/create-bucket.d.ts +3 -5
- package/dist/api/create-bucket.js +6 -6
- package/dist/api/create-function.d.ts +1 -1
- package/dist/api/delete-function.d.ts +1 -1
- package/dist/api/delete-render.d.ts +10 -3
- package/dist/api/delete-render.js +27 -19
- package/dist/api/delete-site.d.ts +7 -2
- package/dist/api/delete-site.js +23 -15
- package/dist/api/deploy-function.d.ts +1 -1
- package/dist/api/deploy-function.js +2 -2
- package/dist/api/deploy-site.d.ts +9 -5
- package/dist/api/deploy-site.js +11 -12
- package/dist/api/download-media.d.ts +8 -3
- package/dist/api/download-media.js +24 -15
- package/dist/api/estimate-price.d.ts +1 -1
- package/dist/api/get-aws-client.d.ts +4 -2
- package/dist/api/get-aws-client.js +2 -2
- package/dist/api/get-buckets.d.ts +4 -4
- package/dist/api/get-buckets.js +12 -14
- package/dist/api/get-compositions-on-lambda.js +7 -6
- package/dist/api/get-function-info.d.ts +1 -1
- package/dist/api/get-functions.d.ts +1 -1
- package/dist/api/get-or-create-bucket.d.ts +3 -19
- package/dist/api/get-or-create-bucket.js +5 -39
- package/dist/api/get-regions.d.ts +1 -1
- package/dist/api/get-regions.js +1 -2
- package/dist/api/get-render-progress.d.ts +4 -3
- package/dist/api/get-render-progress.js +2 -2
- package/dist/api/get-sites.d.ts +6 -1
- package/dist/api/get-sites.js +21 -14
- package/dist/api/iam-validation/role-permissions.js +2 -1
- package/dist/api/iam-validation/simulate-rule.d.ts +1 -1
- package/dist/api/iam-validation/simulate.d.ts +1 -1
- package/dist/api/iam-validation/user-permissions.js +2 -1
- package/dist/api/make-lambda-payload.d.ts +8 -9
- package/dist/api/make-lambda-payload.js +15 -13
- package/dist/api/mock-functions.d.ts +1 -1
- package/dist/api/presign-url.d.ts +1 -1
- package/dist/api/presign-url.js +4 -4
- package/dist/api/render-media-on-lambda.d.ts +5 -6
- package/dist/api/render-media-on-lambda.js +5 -5
- package/dist/api/render-still-on-lambda.d.ts +8 -6
- package/dist/api/render-still-on-lambda.js +6 -5
- package/dist/api/upload-dir.d.ts +2 -2
- package/dist/api/upload-dir.js +2 -2
- package/dist/cli/args.d.ts +2 -3
- package/dist/cli/commands/render/progress.d.ts +2 -2
- package/dist/cli/commands/render/progress.js +6 -5
- package/dist/cli/commands/render/render.d.ts +3 -1
- package/dist/cli/commands/render/render.js +3 -2
- package/dist/cli/commands/sites/create.d.ts +3 -1
- package/dist/cli/commands/sites/create.js +6 -5
- package/dist/cli/commands/sites/index.d.ts +3 -1
- package/dist/cli/commands/sites/index.js +4 -4
- package/dist/cli/commands/sites/rm.d.ts +3 -1
- package/dist/cli/commands/sites/rm.js +4 -3
- package/dist/cli/commands/sites/rmall.d.ts +3 -1
- package/dist/cli/commands/sites/rmall.js +4 -3
- package/dist/cli/commands/still.d.ts +3 -1
- package/dist/cli/commands/still.js +3 -2
- package/dist/cli/get-aws-region.d.ts +1 -1
- package/dist/cli/helpers/__mocks__/quit.d.ts +1 -0
- package/dist/cli/helpers/__mocks__/quit.js +7 -0
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.js +8 -7
- package/dist/client.d.ts +4 -5
- package/dist/functions/aws-implementation.d.ts +11 -0
- package/dist/functions/aws-implementation.js +49 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/compositions.d.ts +3 -2
- package/dist/functions/compositions.js +18 -15
- package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +3 -0
- package/dist/functions/helpers/__mocks__/get-browser-instance.js +12 -0
- package/dist/functions/helpers/__mocks__/leak-detection.d.ts +4 -0
- package/dist/functions/helpers/__mocks__/leak-detection.js +9 -0
- package/dist/functions/helpers/__mocks__/timer.d.ts +2 -0
- package/dist/functions/helpers/__mocks__/timer.js +10 -0
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +5 -3
- package/dist/functions/helpers/calculate-price-from-bucket.js +2 -3
- package/dist/functions/helpers/cleanup-props.d.ts +4 -2
- package/dist/functions/helpers/cleanup-props.js +5 -4
- package/dist/functions/helpers/concat-videos.d.ts +2 -2
- package/dist/functions/helpers/create-post-render-data.d.ts +8 -8
- package/dist/functions/helpers/create-post-render-data.js +1 -1
- package/dist/functions/helpers/expected-out-name.d.ts +4 -4
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +8 -7
- package/dist/functions/helpers/find-output-file-in-bucket.js +5 -6
- package/dist/functions/helpers/get-browser-instance.d.ts +3 -2
- package/dist/functions/helpers/get-browser-instance.js +3 -4
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-current-region.js +3 -3
- package/dist/functions/helpers/get-custom-out-name.d.ts +5 -5
- package/dist/functions/helpers/get-folder-files.d.ts +2 -0
- package/dist/functions/helpers/get-folder-files.js +38 -0
- package/dist/functions/helpers/get-output-url-from-metadata.d.ts +4 -3
- package/dist/functions/helpers/get-output-url-from-metadata.js +4 -5
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +5 -4
- package/dist/functions/helpers/get-overall-progress-s3.js +5 -7
- package/dist/functions/helpers/get-progress.d.ts +8 -7
- package/dist/functions/helpers/get-progress.js +7 -5
- package/dist/functions/helpers/inspect-errors.d.ts +1 -1
- package/dist/functions/helpers/inspect-errors.js +4 -4
- package/dist/functions/helpers/io.d.ts +3 -36
- package/dist/functions/helpers/io.js +3 -104
- package/dist/functions/helpers/lifecycle.d.ts +3 -9
- package/dist/functions/helpers/lifecycle.js +6 -16
- package/dist/functions/helpers/make-aws-artifact.d.ts +3 -0
- package/dist/functions/helpers/make-aws-artifact.js +12 -0
- package/dist/functions/helpers/make-timeout-error.d.ts +5 -4
- package/dist/functions/helpers/make-timeout-error.js +2 -1
- package/dist/functions/helpers/make-timeout-message.d.ts +5 -3
- package/dist/functions/helpers/make-timeout-message.js +8 -9
- package/dist/functions/helpers/merge-chunks.d.ts +10 -10
- package/dist/functions/helpers/merge-chunks.js +7 -8
- package/dist/functions/helpers/overall-render-progress.d.ts +18 -23
- package/dist/functions/helpers/overall-render-progress.js +5 -5
- package/dist/functions/helpers/print-cloudwatch-helper.d.ts +2 -2
- package/dist/functions/helpers/print-logging-helper.d.ts +4 -0
- package/dist/functions/helpers/print-logging-helper.js +12 -0
- package/dist/functions/helpers/read-with-progress.d.ts +4 -3
- package/dist/functions/helpers/read-with-progress.js +2 -2
- package/dist/functions/helpers/render-has-audio-video.d.ts +3 -2
- package/dist/functions/helpers/stream-renderer.d.ts +7 -4
- package/dist/functions/helpers/stream-renderer.js +11 -10
- package/dist/functions/helpers/streamify-response.d.ts +0 -20
- package/dist/functions/helpers/streamify-response.js +1 -62
- package/dist/functions/helpers/validate-composition.d.ts +5 -3
- package/dist/functions/helpers/validate-composition.js +2 -3
- package/dist/functions/index.d.ts +5 -3
- package/dist/functions/index.js +98 -72
- package/dist/functions/info.d.ts +1 -1
- package/dist/functions/info.js +2 -2
- package/dist/functions/launch.d.ts +3 -2
- package/dist/functions/launch.js +54 -41
- package/dist/functions/progress.d.ts +6 -3
- package/dist/functions/progress.js +5 -4
- package/dist/functions/provider-implementation.d.ts +0 -0
- package/dist/functions/provider-implementation.js +1 -0
- package/dist/functions/renderer.d.ts +9 -3
- package/dist/functions/renderer.js +30 -22
- package/dist/functions/start.d.ts +3 -2
- package/dist/functions/start.js +13 -16
- package/dist/functions/still.d.ts +8 -18
- package/dist/functions/still.js +47 -46
- package/dist/index.d.ts +4 -6
- package/dist/internals.d.ts +16 -14
- package/dist/io/delete-file.d.ts +3 -0
- package/dist/io/delete-file.js +12 -0
- package/dist/io/head-file.d.ts +3 -0
- package/dist/io/head-file.js +13 -0
- package/dist/io/list-objects.d.ts +3 -0
- package/dist/io/list-objects.js +58 -0
- package/dist/io/read-file.d.ts +9 -0
- package/dist/io/read-file.js +14 -0
- package/dist/io/write-file.d.ts +5 -0
- package/dist/io/write-file.js +51 -0
- package/dist/pricing/aws-regions.d.ts +0 -3
- package/dist/pricing/aws-regions.js +0 -44
- package/dist/pricing/price-per-1-s.d.ts +1 -1
- package/dist/regions.d.ts +3 -2
- package/dist/regions.js +43 -3
- package/dist/shared/__mocks__/aws-clients.d.ts +2 -0
- package/dist/shared/__mocks__/aws-clients.js +62 -0
- package/dist/shared/__mocks__/bundle-site.d.ts +2 -0
- package/dist/shared/__mocks__/bundle-site.js +32 -0
- package/dist/shared/__mocks__/check-credentials.d.ts +1 -0
- package/dist/shared/__mocks__/check-credentials.js +5 -0
- package/dist/shared/__mocks__/get-account-id.d.ts +2 -0
- package/dist/shared/__mocks__/get-account-id.js +11 -0
- package/dist/shared/__mocks__/read-dir.d.ts +2 -0
- package/dist/shared/__mocks__/read-dir.js +13 -0
- package/dist/shared/aws-clients.d.ts +6 -29
- package/dist/shared/aws-clients.js +7 -177
- package/dist/shared/call-lambda.d.ts +8 -9
- package/dist/shared/call-lambda.js +16 -3
- package/dist/shared/check-credentials.js +2 -2
- package/dist/shared/cleanup-serialized-input-props.d.ts +8 -6
- package/dist/shared/cleanup-serialized-input-props.js +7 -8
- package/dist/shared/compress-props.d.ts +8 -6
- package/dist/shared/compress-props.js +11 -14
- package/dist/shared/constants.d.ts +10 -288
- package/dist/shared/constants.js +1 -46
- package/dist/shared/content-disposition-header.d.ts +1 -6
- package/dist/shared/content-disposition-header.js +2 -2
- package/dist/shared/convert-to-serve-url.d.ts +2 -2
- package/dist/shared/convert-to-serve-url.js +3 -3
- package/dist/shared/get-account-id.d.ts +1 -1
- package/dist/shared/get-aws-urls.d.ts +2 -2
- package/dist/shared/get-credentials.d.ts +9 -0
- package/dist/shared/get-credentials.js +53 -0
- package/dist/shared/get-function-version.d.ts +1 -1
- package/dist/shared/get-function-version.js +2 -1
- package/dist/shared/get-s3-client.d.ts +5 -0
- package/dist/shared/get-s3-client.js +13 -0
- package/dist/shared/get-service-client.d.ts +22 -0
- package/dist/shared/get-service-client.js +117 -0
- package/dist/shared/hosted-layers.d.ts +1 -1
- package/dist/shared/invoke-webhook.d.ts +1 -1
- package/dist/shared/lambda-insights-extensions.d.ts +1 -1
- package/dist/shared/lifecycle-rules.d.ts +4 -3
- package/dist/shared/lifecycle-rules.js +3 -3
- package/dist/shared/make-s3-url.d.ts +1 -1
- package/dist/shared/random-hash.d.ts +1 -3
- package/dist/shared/random-hash.js +3 -4
- package/dist/shared/return-values.d.ts +10 -11
- package/dist/shared/validate-aws-region.d.ts +1 -1
- package/dist/shared/validate-aws-region.js +3 -3
- package/dist/shared/validate-bucketname.d.ts +0 -4
- package/dist/shared/validate-bucketname.js +3 -23
- package/dist/shared/validate-lambda-codec.d.ts +2 -4
- package/dist/shared/validate-lambda-codec.js +3 -13
- package/dist/shared/validate-outname.js +2 -2
- package/dist/shared/validate-privacy.d.ts +1 -1
- package/dist/shared/validate-webhook.d.ts +1 -1
- package/package.json +11 -9
- package/remotionlambda-arm64.zip +0 -0
package/dist/functions/index.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler = exports.routine = void 0;
|
|
3
|
+
exports.handler = exports.routine = exports.innerRoutine = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const serverless_1 = require("@remotion/serverless");
|
|
6
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
7
|
const constants_1 = require("../shared/constants");
|
|
6
|
-
const
|
|
8
|
+
const aws_implementation_1 = require("./aws-implementation");
|
|
7
9
|
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
8
10
|
const is_warm_1 = require("./helpers/is-warm");
|
|
9
11
|
const leak_detection_1 = require("./helpers/leak-detection");
|
|
10
12
|
const lifecycle_1 = require("./helpers/lifecycle");
|
|
11
|
-
const
|
|
13
|
+
const print_logging_helper_1 = require("./helpers/print-logging-helper");
|
|
12
14
|
const streamify_response_1 = require("./helpers/streamify-response");
|
|
13
|
-
const info_1 = require("./info");
|
|
14
15
|
const launch_1 = require("./launch");
|
|
15
16
|
const progress_1 = require("./progress");
|
|
16
17
|
const renderer_2 = require("./renderer");
|
|
17
18
|
const start_1 = require("./start");
|
|
18
19
|
const still_1 = require("./still");
|
|
19
|
-
const
|
|
20
|
-
const streaming_1 = require("./streaming/streaming");
|
|
21
|
-
const innerHandler = async ({ params, responseWriter, context, }) => {
|
|
20
|
+
const innerHandler = async ({ params, responseWriter, context, providerSpecifics, }) => {
|
|
22
21
|
(0, leak_detection_1.setCurrentRequestId)(context.awsRequestId);
|
|
23
22
|
process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA = 'true';
|
|
24
23
|
const timeoutInMilliseconds = context.getRemainingTimeInMillis();
|
|
@@ -31,18 +30,20 @@ const innerHandler = async ({ params, responseWriter, context, }) => {
|
|
|
31
30
|
const isWarm = (0, is_warm_1.getWarm)();
|
|
32
31
|
(0, is_warm_1.setWarm)();
|
|
33
32
|
const currentUserId = context.invokedFunctionArn.split(':')[4];
|
|
34
|
-
if (params.type ===
|
|
33
|
+
if (params.type === client_1.ServerlessRoutines.still) {
|
|
35
34
|
(0, lifecycle_1.validateDeleteAfter)(params.deleteAfter);
|
|
36
|
-
const renderId = (0, lifecycle_1.generateRandomHashWithLifeCycleRule)(params.deleteAfter);
|
|
37
|
-
(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
const renderId = (0, lifecycle_1.generateRandomHashWithLifeCycleRule)(params.deleteAfter, providerSpecifics);
|
|
36
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
37
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.still, {
|
|
38
|
+
renderId,
|
|
39
|
+
inputProps: JSON.stringify(params.inputProps),
|
|
40
|
+
isWarm,
|
|
41
|
+
}, params.logLevel);
|
|
42
|
+
}
|
|
42
43
|
try {
|
|
43
44
|
await new Promise((resolve, reject) => {
|
|
44
45
|
const onStream = (payload) => {
|
|
45
|
-
const message = (0,
|
|
46
|
+
const message = (0, client_1.makeStreamPayload)({
|
|
46
47
|
message: payload,
|
|
47
48
|
});
|
|
48
49
|
return new Promise((innerResolve, innerReject) => {
|
|
@@ -69,6 +70,7 @@ const innerHandler = async ({ params, responseWriter, context, }) => {
|
|
|
69
70
|
renderId,
|
|
70
71
|
onStream,
|
|
71
72
|
timeoutInMilliseconds,
|
|
73
|
+
providerSpecifics,
|
|
72
74
|
})
|
|
73
75
|
.then((r) => {
|
|
74
76
|
resolve(r);
|
|
@@ -84,75 +86,90 @@ const innerHandler = async ({ params, responseWriter, context, }) => {
|
|
|
84
86
|
}
|
|
85
87
|
return;
|
|
86
88
|
}
|
|
87
|
-
if (params.type ===
|
|
88
|
-
(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if (params.type === client_1.ServerlessRoutines.start) {
|
|
90
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
91
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.start, {
|
|
92
|
+
inputProps: JSON.stringify(params.inputProps),
|
|
93
|
+
isWarm,
|
|
94
|
+
}, params.logLevel);
|
|
95
|
+
}
|
|
92
96
|
const response = await (0, start_1.startHandler)(params, {
|
|
93
97
|
expectedBucketOwner: currentUserId,
|
|
94
98
|
timeoutInMilliseconds,
|
|
95
|
-
});
|
|
99
|
+
}, providerSpecifics);
|
|
96
100
|
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
97
101
|
await responseWriter.end();
|
|
98
102
|
return;
|
|
99
103
|
}
|
|
100
|
-
if (params.type ===
|
|
101
|
-
(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
if (params.type === client_1.ServerlessRoutines.launch) {
|
|
105
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
106
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.launch, {
|
|
107
|
+
renderId: params.renderId,
|
|
108
|
+
inputProps: JSON.stringify(params.inputProps),
|
|
109
|
+
isWarm,
|
|
110
|
+
}, params.logLevel);
|
|
111
|
+
}
|
|
106
112
|
const response = await (0, launch_1.launchHandler)(params, {
|
|
107
113
|
expectedBucketOwner: currentUserId,
|
|
108
114
|
getRemainingTimeInMillis: context.getRemainingTimeInMillis,
|
|
109
|
-
});
|
|
115
|
+
}, providerSpecifics);
|
|
110
116
|
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
111
117
|
await responseWriter.end();
|
|
112
118
|
return;
|
|
113
119
|
}
|
|
114
|
-
if (params.type ===
|
|
115
|
-
(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
if (params.type === client_1.ServerlessRoutines.status) {
|
|
121
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
122
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.status, {
|
|
123
|
+
renderId: params.renderId,
|
|
124
|
+
isWarm,
|
|
125
|
+
}, params.logLevel);
|
|
126
|
+
}
|
|
119
127
|
const response = await (0, progress_1.progressHandler)(params, {
|
|
120
128
|
expectedBucketOwner: currentUserId,
|
|
121
129
|
timeoutInMilliseconds,
|
|
122
130
|
retriesRemaining: 2,
|
|
131
|
+
providerSpecifics,
|
|
123
132
|
});
|
|
124
133
|
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
125
134
|
await responseWriter.end();
|
|
126
135
|
return;
|
|
127
136
|
}
|
|
128
|
-
if (params.type ===
|
|
129
|
-
(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}, params.logLevel);
|
|
136
|
-
await new Promise((resolve, reject) => {
|
|
137
|
-
(0, renderer_2.rendererHandler)(params, {
|
|
138
|
-
expectedBucketOwner: currentUserId,
|
|
137
|
+
if (params.type === client_1.ServerlessRoutines.renderer) {
|
|
138
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
139
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.renderer, {
|
|
140
|
+
renderId: params.renderId,
|
|
141
|
+
chunk: String(params.chunk),
|
|
142
|
+
dumpLogs: String(renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')),
|
|
143
|
+
resolvedProps: JSON.stringify(params.resolvedProps),
|
|
139
144
|
isWarm,
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
innerReject(err);
|
|
145
|
+
}, params.logLevel);
|
|
146
|
+
}
|
|
147
|
+
await new Promise((resolve, reject) => {
|
|
148
|
+
(0, renderer_2.rendererHandler)({
|
|
149
|
+
params,
|
|
150
|
+
options: {
|
|
151
|
+
expectedBucketOwner: currentUserId,
|
|
152
|
+
isWarm,
|
|
153
|
+
},
|
|
154
|
+
onStream: (payload) => {
|
|
155
|
+
const message = (0, client_1.makeStreamPayload)({
|
|
156
|
+
message: payload,
|
|
153
157
|
});
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
const writeProm = responseWriter.write(message);
|
|
159
|
+
return new Promise((innerResolve, innerReject) => {
|
|
160
|
+
writeProm
|
|
161
|
+
.then(() => {
|
|
162
|
+
innerResolve();
|
|
163
|
+
})
|
|
164
|
+
.catch((err) => {
|
|
165
|
+
reject(err);
|
|
166
|
+
innerReject(err);
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
requestContext: context,
|
|
171
|
+
providerSpecifics,
|
|
172
|
+
})
|
|
156
173
|
.then((res) => {
|
|
157
174
|
resolve(res);
|
|
158
175
|
})
|
|
@@ -163,35 +180,40 @@ const innerHandler = async ({ params, responseWriter, context, }) => {
|
|
|
163
180
|
await responseWriter.end();
|
|
164
181
|
return;
|
|
165
182
|
}
|
|
166
|
-
if (params.type ===
|
|
167
|
-
(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
183
|
+
if (params.type === client_1.ServerlessRoutines.info) {
|
|
184
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
185
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.info, {
|
|
186
|
+
isWarm,
|
|
187
|
+
}, params.logLevel);
|
|
188
|
+
}
|
|
189
|
+
const response = await (0, serverless_1.infoHandler)(params);
|
|
171
190
|
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
172
191
|
await responseWriter.end();
|
|
173
192
|
return;
|
|
174
193
|
}
|
|
175
|
-
if (params.type ===
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
194
|
+
if (params.type === client_1.ServerlessRoutines.compositions) {
|
|
195
|
+
if (providerSpecifics.printLoggingHelper) {
|
|
196
|
+
(0, print_logging_helper_1.printLoggingGrepHelper)(client_1.ServerlessRoutines.compositions, {
|
|
197
|
+
isWarm,
|
|
198
|
+
}, params.logLevel);
|
|
199
|
+
}
|
|
200
|
+
const response = await (0, serverless_1.compositionsHandler)(params, {
|
|
180
201
|
expectedBucketOwner: currentUserId,
|
|
181
|
-
});
|
|
202
|
+
}, providerSpecifics);
|
|
182
203
|
await responseWriter.write(Buffer.from(JSON.stringify(response)));
|
|
183
204
|
await responseWriter.end();
|
|
184
205
|
return;
|
|
185
206
|
}
|
|
186
207
|
throw new Error(constants_1.COMMAND_NOT_FOUND);
|
|
187
208
|
};
|
|
188
|
-
const
|
|
189
|
-
const responseWriter = (0,
|
|
209
|
+
const innerRoutine = async (params, responseStream, context, providerSpecifics) => {
|
|
210
|
+
const responseWriter = (0, serverless_1.streamWriter)(responseStream);
|
|
190
211
|
try {
|
|
191
212
|
await innerHandler({
|
|
192
213
|
params,
|
|
193
214
|
responseWriter,
|
|
194
215
|
context,
|
|
216
|
+
providerSpecifics,
|
|
195
217
|
});
|
|
196
218
|
}
|
|
197
219
|
catch (err) {
|
|
@@ -204,5 +226,9 @@ const routine = async (params, responseStream, context) => {
|
|
|
204
226
|
await responseWriter.end();
|
|
205
227
|
}
|
|
206
228
|
};
|
|
229
|
+
exports.innerRoutine = innerRoutine;
|
|
230
|
+
const routine = (params, responseStream, context) => {
|
|
231
|
+
return (0, exports.innerRoutine)(params, responseStream, context, aws_implementation_1.awsImplementation);
|
|
232
|
+
};
|
|
207
233
|
exports.routine = routine;
|
|
208
234
|
exports.handler = (0, streamify_response_1.streamifyResponse)(exports.routine);
|
package/dist/functions/info.d.ts
CHANGED
package/dist/functions/info.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.infoHandler = void 0;
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
4
5
|
const version_1 = require("remotion/version");
|
|
5
|
-
const constants_1 = require("../shared/constants");
|
|
6
6
|
const infoHandler = (lambdaParams) => {
|
|
7
|
-
if (lambdaParams.type !==
|
|
7
|
+
if (lambdaParams.type !== client_1.LambdaRoutines.info) {
|
|
8
8
|
throw new TypeError('Expected info type');
|
|
9
9
|
}
|
|
10
10
|
const returnValue = {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
2
3
|
type Options = {
|
|
3
4
|
expectedBucketOwner: string;
|
|
4
5
|
getRemainingTimeInMillis: () => number;
|
|
5
6
|
};
|
|
6
|
-
export declare const launchHandler: (params:
|
|
7
|
+
export declare const launchHandler: <Provider extends CloudProvider<string, Record<string, unknown>>>(params: ServerlessPayload<Provider>, options: Options, providerSpecifics: ProviderSpecifics<Provider>) => Promise<{
|
|
7
8
|
type: 'success';
|
|
8
9
|
}>;
|
|
9
10
|
export {};
|
package/dist/functions/launch.js
CHANGED
|
@@ -2,44 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.launchHandler = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const serverless_1 = require("@remotion/serverless");
|
|
6
|
+
const client_1 = require("@remotion/serverless/client");
|
|
5
7
|
const fs_1 = require("fs");
|
|
6
8
|
const path_1 = require("path");
|
|
7
9
|
const version_1 = require("remotion/version");
|
|
8
|
-
const compress_props_1 = require("../shared/compress-props");
|
|
9
10
|
const constants_1 = require("../shared/constants");
|
|
10
11
|
const docs_url_1 = require("../shared/docs-url");
|
|
11
12
|
const invoke_webhook_1 = require("../shared/invoke-webhook");
|
|
12
13
|
const validate_1 = require("../shared/validate");
|
|
13
14
|
const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
|
|
14
|
-
const validate_outname_1 = require("../shared/validate-outname");
|
|
15
15
|
const validate_privacy_1 = require("../shared/validate-privacy");
|
|
16
16
|
const plan_frame_ranges_1 = require("./chunk-optimization/plan-frame-ranges");
|
|
17
17
|
const best_frames_per_lambda_param_1 = require("./helpers/best-frames-per-lambda-param");
|
|
18
18
|
const cleanup_props_1 = require("./helpers/cleanup-props");
|
|
19
|
-
const expected_out_name_1 = require("./helpers/expected-out-name");
|
|
20
19
|
const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-bucket");
|
|
21
|
-
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
22
|
-
const get_current_region_1 = require("./helpers/get-current-region");
|
|
23
|
-
const io_1 = require("./helpers/io");
|
|
24
20
|
const merge_chunks_1 = require("./helpers/merge-chunks");
|
|
25
21
|
const overall_render_progress_1 = require("./helpers/overall-render-progress");
|
|
26
22
|
const stream_renderer_1 = require("./helpers/stream-renderer");
|
|
27
23
|
const timer_1 = require("./helpers/timer");
|
|
28
|
-
const
|
|
29
|
-
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
30
|
-
const innerLaunchHandler = async ({ functionName, params, options, overallProgress, registerCleanupTask, }) => {
|
|
24
|
+
const innerLaunchHandler = async ({ functionName, params, options, overallProgress, registerCleanupTask, providerSpecifics, }) => {
|
|
31
25
|
var _a, _b, _c, _d, _e;
|
|
32
|
-
if (params.type !==
|
|
26
|
+
if (params.type !== client_1.ServerlessRoutines.launch) {
|
|
33
27
|
throw new Error('Expected launch type');
|
|
34
28
|
}
|
|
35
29
|
const startedDate = Date.now();
|
|
36
|
-
const browserInstance = (0,
|
|
37
|
-
|
|
30
|
+
const browserInstance = (0, serverless_1.getBrowserInstance)({
|
|
31
|
+
logLevel: params.logLevel,
|
|
32
|
+
indent: false,
|
|
33
|
+
chromiumOptions: params.chromiumOptions,
|
|
34
|
+
providerSpecifics,
|
|
35
|
+
});
|
|
36
|
+
const inputPropsPromise = (0, client_1.decompressInputProps)({
|
|
38
37
|
bucketName: params.bucketName,
|
|
39
38
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
40
|
-
region:
|
|
39
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
41
40
|
serialized: params.inputProps,
|
|
42
41
|
propsType: 'input-props',
|
|
42
|
+
providerSpecifics,
|
|
43
43
|
});
|
|
44
44
|
const logOptions = {
|
|
45
45
|
indent: false,
|
|
@@ -50,7 +50,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
50
50
|
const { instance } = await browserInstance;
|
|
51
51
|
renderer_1.RenderInternals.Log.info(logOptions, 'Validating composition, input props:', serializedInputPropsWithCustomSchema);
|
|
52
52
|
const startTime = Date.now();
|
|
53
|
-
const comp = await (0,
|
|
53
|
+
const comp = await (0, serverless_1.validateComposition)({
|
|
54
54
|
serveUrl: params.serveUrl,
|
|
55
55
|
composition: params.composition,
|
|
56
56
|
browserInstance: instance,
|
|
@@ -70,6 +70,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
70
70
|
onServeUrlVisited: () => {
|
|
71
71
|
overallProgress.setServeUrlOpened(Date.now());
|
|
72
72
|
},
|
|
73
|
+
providerSpecifics,
|
|
73
74
|
});
|
|
74
75
|
overallProgress.setCompositionValidated(Date.now());
|
|
75
76
|
renderer_1.RenderInternals.Log.info(logOptions, 'Composition validated, resolved props', comp.props);
|
|
@@ -94,7 +95,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
94
95
|
framesPerLambda,
|
|
95
96
|
durationInFrames: frameCount.length,
|
|
96
97
|
});
|
|
97
|
-
(0,
|
|
98
|
+
(0, serverless_1.validateOutname)({
|
|
98
99
|
outName: params.outName,
|
|
99
100
|
codec: params.codec,
|
|
100
101
|
audioCodecSetting: params.audioCodec,
|
|
@@ -112,24 +113,26 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
112
113
|
}
|
|
113
114
|
overallProgress.setExpectedChunks(chunks.length);
|
|
114
115
|
const sortedChunks = chunks.slice().sort((a, b) => a[0] - b[0]);
|
|
115
|
-
const serializedResolved = (0,
|
|
116
|
-
const needsToUpload = (0,
|
|
116
|
+
const serializedResolved = (0, client_1.serializeOrThrow)(comp.props, 'resolved-props');
|
|
117
|
+
const needsToUpload = (0, client_1.getNeedsToUpload)('video-or-audio', [
|
|
117
118
|
serializedResolved.length,
|
|
118
119
|
params.inputProps.type === 'bucket-url'
|
|
119
120
|
? params.inputProps.hash.length
|
|
120
121
|
: params.inputProps.payload.length,
|
|
121
122
|
]);
|
|
122
|
-
const serializedResolvedProps = await (0,
|
|
123
|
+
const serializedResolvedProps = await (0, client_1.compressInputProps)({
|
|
123
124
|
propsType: 'resolved-props',
|
|
124
|
-
region:
|
|
125
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
125
126
|
stringifiedInputProps: serializedResolved,
|
|
126
127
|
userSpecifiedBucketName: params.bucketName,
|
|
127
128
|
needsToUpload,
|
|
129
|
+
providerSpecifics,
|
|
128
130
|
});
|
|
129
131
|
registerCleanupTask(() => {
|
|
130
132
|
return (0, cleanup_props_1.cleanupProps)({
|
|
131
133
|
serializedResolvedProps,
|
|
132
134
|
inputProps: params.inputProps,
|
|
135
|
+
providerSpecifics,
|
|
133
136
|
});
|
|
134
137
|
});
|
|
135
138
|
const fps = comp.fps / params.everyNthFrame;
|
|
@@ -139,7 +142,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
139
142
|
const lambdaPayloads = chunks.map((chunkPayload) => {
|
|
140
143
|
var _a;
|
|
141
144
|
const payload = {
|
|
142
|
-
type:
|
|
145
|
+
type: client_1.ServerlessRoutines.renderer,
|
|
143
146
|
frameRange: chunkPayload,
|
|
144
147
|
serveUrl: params.serveUrl,
|
|
145
148
|
chunk: sortedChunks.indexOf(chunkPayload),
|
|
@@ -207,7 +210,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
207
210
|
lambdaVersion: version_1.VERSION,
|
|
208
211
|
framesPerLambda,
|
|
209
212
|
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
210
|
-
region:
|
|
213
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
211
214
|
renderId: params.renderId,
|
|
212
215
|
outName: (_c = params.outName) !== null && _c !== void 0 ? _c : undefined,
|
|
213
216
|
privacy: params.privacy,
|
|
@@ -220,7 +223,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
220
223
|
audioBitrate: params.audioBitrate,
|
|
221
224
|
muted: params.muted,
|
|
222
225
|
};
|
|
223
|
-
const { key, renderBucketName, customCredentials } = (0,
|
|
226
|
+
const { key, renderBucketName, customCredentials } = (0, client_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
224
227
|
? null
|
|
225
228
|
: (_e = (_d = params.outName) === null || _d === void 0 ? void 0 : _d.s3OutputProvider) !== null && _e !== void 0 ? _e : null);
|
|
226
229
|
if (!params.overwrite) {
|
|
@@ -229,10 +232,12 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
229
232
|
bucketName: params.bucketName,
|
|
230
233
|
customCredentials,
|
|
231
234
|
renderMetadata,
|
|
232
|
-
region:
|
|
235
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
236
|
+
currentRegion: providerSpecifics.getCurrentRegionInFunction(),
|
|
237
|
+
providerSpecifics,
|
|
233
238
|
});
|
|
234
239
|
if (output) {
|
|
235
|
-
throw new TypeError(`Output file "${key}" in bucket "${renderBucketName}" in region "${
|
|
240
|
+
throw new TypeError(`Output file "${key}" in bucket "${renderBucketName}" in region "${providerSpecifics.getCurrentRegionInFunction()}" already exists. Delete it before re-rendering, or set the 'overwrite' option in renderMediaOnLambda() to overwrite it."`);
|
|
236
241
|
}
|
|
237
242
|
findOutputFile.end();
|
|
238
243
|
}
|
|
@@ -251,13 +256,14 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
251
256
|
.find((a) => a.filename === artifact.filename)) {
|
|
252
257
|
return { alreadyExisted: true };
|
|
253
258
|
}
|
|
254
|
-
const region =
|
|
255
|
-
const
|
|
259
|
+
const region = providerSpecifics.getCurrentRegionInFunction();
|
|
260
|
+
const storageKey = (0, client_1.artifactName)(renderMetadata.renderId, artifact.filename);
|
|
256
261
|
const start = Date.now();
|
|
257
262
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'Writing artifact ' + artifact.filename + ' to S3');
|
|
258
|
-
|
|
263
|
+
providerSpecifics
|
|
264
|
+
.writeFile({
|
|
259
265
|
bucketName: renderBucketName,
|
|
260
|
-
key:
|
|
266
|
+
key: storageKey,
|
|
261
267
|
body: artifact.content,
|
|
262
268
|
region,
|
|
263
269
|
privacy: params.privacy,
|
|
@@ -267,12 +273,12 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
267
273
|
})
|
|
268
274
|
.then(() => {
|
|
269
275
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, `Wrote artifact to S3 in ${Date.now() - start}ms`);
|
|
270
|
-
overallProgress.addReceivedArtifact({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
});
|
|
276
|
+
overallProgress.addReceivedArtifact(providerSpecifics.makeArtifactWithDetails({
|
|
277
|
+
region,
|
|
278
|
+
renderBucketName,
|
|
279
|
+
storageKey,
|
|
280
|
+
artifact,
|
|
281
|
+
}));
|
|
276
282
|
})
|
|
277
283
|
.catch((err) => {
|
|
278
284
|
overallProgress.addErrorWithoutUpload({
|
|
@@ -302,6 +308,7 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
302
308
|
payload,
|
|
303
309
|
logLevel: params.logLevel,
|
|
304
310
|
onArtifact,
|
|
311
|
+
providerSpecifics,
|
|
305
312
|
});
|
|
306
313
|
}));
|
|
307
314
|
const postRenderData = await (0, merge_chunks_1.mergeChunksAndFinishRender)({
|
|
@@ -332,12 +339,13 @@ const innerLaunchHandler = async ({ functionName, params, options, overallProgre
|
|
|
332
339
|
files: files.sort(),
|
|
333
340
|
overallProgress,
|
|
334
341
|
startTime,
|
|
342
|
+
providerSpecifics,
|
|
335
343
|
});
|
|
336
344
|
return postRenderData;
|
|
337
345
|
};
|
|
338
|
-
const launchHandler = async (params, options) => {
|
|
346
|
+
const launchHandler = async (params, options, providerSpecifics) => {
|
|
339
347
|
var _a, _b, _c;
|
|
340
|
-
if (params.type !==
|
|
348
|
+
if (params.type !== client_1.ServerlessRoutines.launch) {
|
|
341
349
|
throw new Error('Expected launch type');
|
|
342
350
|
}
|
|
343
351
|
const functionName = (_a = params.rendererFunctionName) !== null && _a !== void 0 ? _a : process.env.AWS_LAMBDA_FUNCTION_NAME;
|
|
@@ -363,8 +371,11 @@ const launchHandler = async (params, options) => {
|
|
|
363
371
|
const onTimeout = async () => {
|
|
364
372
|
var _a;
|
|
365
373
|
renderer_1.RenderInternals.Log.error({ indent: false, logLevel: params.logLevel }, 'Function is about to time out. Can not finish render.');
|
|
366
|
-
// @ts-expect-error
|
|
367
|
-
globalThis._dumpUnreleasedBuffers
|
|
374
|
+
// @ts-expect-error - We are adding a listener to a global variable
|
|
375
|
+
if (globalThis._dumpUnreleasedBuffers) {
|
|
376
|
+
// @ts-expect-error - We are adding a listener to a global variable
|
|
377
|
+
globalThis._dumpUnreleasedBuffers.emit('dump-unreleased-buffers');
|
|
378
|
+
}
|
|
368
379
|
runCleanupTasks();
|
|
369
380
|
if (!params.webhook) {
|
|
370
381
|
renderer_1.RenderInternals.Log.verbose({
|
|
@@ -428,9 +439,10 @@ const launchHandler = async (params, options) => {
|
|
|
428
439
|
renderId: params.renderId,
|
|
429
440
|
bucketName: params.bucketName,
|
|
430
441
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
431
|
-
region:
|
|
442
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
432
443
|
timeoutTimestamp: options.getRemainingTimeInMillis() + Date.now(),
|
|
433
444
|
logLevel: params.logLevel,
|
|
445
|
+
providerSpecifics,
|
|
434
446
|
});
|
|
435
447
|
try {
|
|
436
448
|
const postRenderData = await innerLaunchHandler({
|
|
@@ -439,6 +451,7 @@ const launchHandler = async (params, options) => {
|
|
|
439
451
|
options,
|
|
440
452
|
overallProgress,
|
|
441
453
|
registerCleanupTask,
|
|
454
|
+
providerSpecifics,
|
|
442
455
|
});
|
|
443
456
|
clearTimeout(webhookDueToTimeout);
|
|
444
457
|
if (!params.webhook || webhookInvoked) {
|
|
@@ -504,7 +517,7 @@ const launchHandler = async (params, options) => {
|
|
|
504
517
|
stack: err.stack,
|
|
505
518
|
type: 'stitcher',
|
|
506
519
|
isFatal: true,
|
|
507
|
-
tmpDir: (0,
|
|
520
|
+
tmpDir: (0, serverless_1.getTmpDirStateIfENoSp)(err.stack, providerSpecifics),
|
|
508
521
|
attempt: 1,
|
|
509
522
|
totalAttempts: 1,
|
|
510
523
|
willRetry: false,
|
|
@@ -560,7 +573,7 @@ const launchHandler = async (params, options) => {
|
|
|
560
573
|
throw err;
|
|
561
574
|
}
|
|
562
575
|
finally {
|
|
563
|
-
(0,
|
|
576
|
+
(0, serverless_1.forgetBrowserEventLoop)(params.logLevel);
|
|
564
577
|
}
|
|
565
578
|
};
|
|
566
579
|
exports.launchHandler = launchHandler;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type
|
|
1
|
+
import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
3
|
+
import type { GenericRenderProgress } from '../shared/constants';
|
|
4
|
+
type Options<Provider extends CloudProvider> = {
|
|
3
5
|
expectedBucketOwner: string;
|
|
4
6
|
timeoutInMilliseconds: number;
|
|
5
7
|
retriesRemaining: number;
|
|
8
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
6
9
|
};
|
|
7
|
-
export declare const progressHandler: (lambdaParams:
|
|
10
|
+
export declare const progressHandler: <Provider extends CloudProvider<string, Record<string, unknown>>>(lambdaParams: ServerlessPayload<Provider>, options: Options<Provider>) => Promise<GenericRenderProgress<Provider>>;
|
|
8
11
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.progressHandler = void 0;
|
|
4
|
+
const client_1 = require("@remotion/serverless/client");
|
|
4
5
|
const version_1 = require("remotion/version");
|
|
5
|
-
const constants_1 = require("../shared/constants");
|
|
6
|
-
const get_current_region_1 = require("./helpers/get-current-region");
|
|
7
6
|
const get_progress_1 = require("./helpers/get-progress");
|
|
8
7
|
const progressHandler = async (lambdaParams, options) => {
|
|
9
8
|
var _a;
|
|
10
|
-
if (lambdaParams.type !==
|
|
9
|
+
if (lambdaParams.type !== client_1.ServerlessRoutines.status) {
|
|
11
10
|
throw new TypeError('Expected status type');
|
|
12
11
|
}
|
|
13
12
|
if (lambdaParams.version !== version_1.VERSION) {
|
|
@@ -21,10 +20,11 @@ const progressHandler = async (lambdaParams, options) => {
|
|
|
21
20
|
bucketName: lambdaParams.bucketName,
|
|
22
21
|
renderId: lambdaParams.renderId,
|
|
23
22
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
24
|
-
region:
|
|
23
|
+
region: options.providerSpecifics.getCurrentRegionInFunction(),
|
|
25
24
|
memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
|
|
26
25
|
timeoutInMilliseconds: options.timeoutInMilliseconds,
|
|
27
26
|
customCredentials: (_a = lambdaParams.s3OutputProvider) !== null && _a !== void 0 ? _a : null,
|
|
27
|
+
providerSpecifics: options.providerSpecifics,
|
|
28
28
|
});
|
|
29
29
|
return progress;
|
|
30
30
|
}
|
|
@@ -40,6 +40,7 @@ const progressHandler = async (lambdaParams, options) => {
|
|
|
40
40
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
41
41
|
timeoutInMilliseconds: options.timeoutInMilliseconds,
|
|
42
42
|
retriesRemaining: options.retriesRemaining - 1,
|
|
43
|
+
providerSpecifics: options.providerSpecifics,
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
throw err;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CloudProvider, OnStream, ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
+
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
2
3
|
import type { RequestContext } from './helpers/request-context';
|
|
3
|
-
import type { OnStream } from './streaming/streaming';
|
|
4
4
|
type Options = {
|
|
5
5
|
expectedBucketOwner: string;
|
|
6
6
|
isWarm: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare const rendererHandler: (
|
|
8
|
+
export declare const rendererHandler: <Provider extends CloudProvider<string, Record<string, unknown>>>({ onStream, options, params, providerSpecifics, requestContext, }: {
|
|
9
|
+
params: ServerlessPayload<Provider>;
|
|
10
|
+
options: Options;
|
|
11
|
+
onStream: OnStream<Provider>;
|
|
12
|
+
requestContext: RequestContext;
|
|
13
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
14
|
+
}) => Promise<{
|
|
9
15
|
type: 'success';
|
|
10
16
|
}>;
|
|
11
17
|
export {};
|