@remotion/serverless 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/.eslintrc +3 -0
- package/LICENSE.md +49 -0
- package/README.md +18 -0
- package/dist/await.d.ts +1 -0
- package/dist/await.js +2 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.js +40 -0
- package/dist/compositions.d.ts +11 -0
- package/dist/compositions.js +79 -0
- package/dist/compress-props.d.ts +23 -0
- package/dist/compress-props.js +90 -0
- package/dist/constants.d.ts +266 -0
- package/dist/constants.js +58 -0
- package/dist/error-category.d.ts +3 -0
- package/dist/error-category.js +16 -0
- package/dist/expected-out-name.d.ts +5 -0
- package/dist/expected-out-name.js +52 -0
- package/dist/get-browser-instance.d.ts +16 -0
- package/dist/get-browser-instance.js +104 -0
- package/dist/get-custom-out-name.d.ts +7 -0
- package/dist/get-custom-out-name.js +32 -0
- package/dist/get-files-in-folder.d.ts +5 -0
- package/dist/get-files-in-folder.js +2 -0
- package/dist/get-or-create-bucket.d.ts +20 -0
- package/dist/get-or-create-bucket.js +37 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +32 -0
- package/dist/info.d.ts +6 -0
- package/dist/info.js +16 -0
- package/dist/input-props-keys.d.ts +2 -0
- package/dist/input-props-keys.js +11 -0
- package/dist/make-bucket-name.d.ts +3 -0
- package/dist/make-bucket-name.js +8 -0
- package/dist/provider-implementation.d.ts +105 -0
- package/dist/provider-implementation.js +2 -0
- package/dist/random-hash.d.ts +3 -0
- package/dist/random-hash.js +14 -0
- package/dist/region.d.ts +3 -0
- package/dist/region.js +45 -0
- package/dist/render-metadata.d.ts +37 -0
- package/dist/render-metadata.js +2 -0
- package/dist/serialize-artifact.d.ts +9 -0
- package/dist/serialize-artifact.js +37 -0
- package/dist/still.d.ts +28 -0
- package/dist/still.js +2 -0
- package/dist/stream-to-string.d.ts +4 -0
- package/dist/stream-to-string.js +15 -0
- package/dist/streaming/response-stream.d.ts +20 -0
- package/dist/streaming/response-stream.js +64 -0
- package/dist/streaming/stream-writer.d.ts +6 -0
- package/dist/streaming/stream-writer.js +35 -0
- package/dist/streaming/streaming.d.ts +102 -0
- package/dist/streaming/streaming.js +61 -0
- package/dist/truthy.d.ts +3 -0
- package/dist/truthy.js +7 -0
- package/dist/validate-bucket-name.d.ts +3 -0
- package/dist/validate-bucket-name.js +17 -0
- package/dist/validate-composition.d.ts +25 -0
- package/dist/validate-composition.js +31 -0
- package/dist/validate-outname.d.ts +8 -0
- package/dist/validate-outname.js +37 -0
- package/dist/validate-webhook.d.ts +3 -0
- package/dist/validate-webhook.js +16 -0
- package/dist/write-lambda-error.d.ts +27 -0
- package/dist/write-lambda-error.js +19 -0
- package/package.json +41 -0
- package/tsconfig.tsbuildinfo +1 -0
package/.eslintrc
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Remotion License
|
|
2
|
+
|
|
3
|
+
In Remotion 5.0, the license will slightly change. [View the changes here](https://github.com/remotion-dev/remotion/pull/3750).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
8
|
+
|
|
9
|
+
- [Free license](#free-license)
|
|
10
|
+
- [Company license](#company-license)
|
|
11
|
+
|
|
12
|
+
## Free license
|
|
13
|
+
|
|
14
|
+
Copyright © 2024 [Remotion](https://www.remotion.dev)
|
|
15
|
+
|
|
16
|
+
### Eligibility
|
|
17
|
+
|
|
18
|
+
You are eligible to use Remotion for free if you are:
|
|
19
|
+
|
|
20
|
+
- an individual
|
|
21
|
+
- a for-profit organization with up to 3 employees
|
|
22
|
+
- a non-profit or not-for-profit organization
|
|
23
|
+
- evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
|
|
24
|
+
|
|
25
|
+
### Allowed use cases
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
|
|
28
|
+
|
|
29
|
+
### Disallowed use cases
|
|
30
|
+
|
|
31
|
+
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
|
|
32
|
+
|
|
33
|
+
### Warranty notice
|
|
34
|
+
|
|
35
|
+
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
36
|
+
|
|
37
|
+
### Support
|
|
38
|
+
|
|
39
|
+
Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
|
|
40
|
+
|
|
41
|
+
## Company license
|
|
42
|
+
|
|
43
|
+
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](https://www.remotion.dev/docs/support)).
|
|
44
|
+
|
|
45
|
+
Visit [remotion.pro](https://www.remotion.pro/license) for pricing and to buy a license.
|
|
46
|
+
|
|
47
|
+
### FAQs
|
|
48
|
+
|
|
49
|
+
Are you not sure whether you need a company license because of an edge case? Here are some [frequently asked questions](https://www.remotion.pro/faq).
|
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @remotion/serverless
|
|
2
|
+
|
|
3
|
+
A runtime for distributed rendering
|
|
4
|
+
|
|
5
|
+
[](https://npmcharts.com/compare/@remotion/serverless?minimal=true)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @remotion/serverless --save-exact
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.
|
|
14
|
+
Remove the `^` character from the version number to use the exact version.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
This is an internal package and has no documentation.
|
package/dist/await.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Await<T> = T extends PromiseLike<infer U> ? U : T;
|
package/dist/await.js
ADDED
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Await } from './await';
|
|
2
|
+
export { compressInputProps, decompressInputProps, getNeedsToUpload, serializeOrThrow, } from './compress-props';
|
|
3
|
+
export { REMOTION_BUCKET_PREFIX, ServerlessCodec, ServerlessPayload, ServerlessPayloads, ServerlessRoutines, ServerlessStartPayload, ServerlessStatusPayload, artifactName, customOutName, expiryDays, outName, outStillName, overallProgressKey, rendersPrefix, serverlessCodecs, type CustomCredentials, type CustomCredentialsWithoutSensitiveData, type DeleteAfter, type DownloadBehavior, type OutNameInput, type OutNameInputWithoutCredentials, type OutNameOutput, type Privacy, type SerializedInputProps, type WebhookOption, } from './constants';
|
|
4
|
+
export { GetOrCreateBucketInput, GetOrCreateBucketOutput, internalGetOrCreateBucket, } from './get-or-create-bucket';
|
|
5
|
+
export { getExpectedOutName } from './expected-out-name';
|
|
6
|
+
export { FileNameAndSize, GetFolderFiles } from './get-files-in-folder';
|
|
7
|
+
export { inputPropsKey, resolvedPropsKey } from './input-props-keys';
|
|
8
|
+
export { makeBucketName } from './make-bucket-name';
|
|
9
|
+
export { RenderMetadata } from './render-metadata';
|
|
10
|
+
export { streamToString } from './stream-to-string';
|
|
11
|
+
export { MessageTypeId, formatMap, makeStreamPayload, messageTypeIdToMessageType, } from './streaming/streaming';
|
|
12
|
+
export { truthy } from './truthy';
|
|
13
|
+
export { validateBucketName } from './validate-bucket-name';
|
|
14
|
+
export { validateWebhook } from './validate-webhook';
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateWebhook = exports.validateBucketName = exports.truthy = exports.messageTypeIdToMessageType = exports.makeStreamPayload = exports.formatMap = exports.streamToString = exports.makeBucketName = exports.resolvedPropsKey = exports.inputPropsKey = exports.getExpectedOutName = exports.internalGetOrCreateBucket = exports.serverlessCodecs = exports.rendersPrefix = exports.overallProgressKey = exports.outStillName = exports.outName = exports.expiryDays = exports.customOutName = exports.artifactName = exports.ServerlessRoutines = exports.REMOTION_BUCKET_PREFIX = exports.serializeOrThrow = exports.getNeedsToUpload = exports.decompressInputProps = exports.compressInputProps = void 0;
|
|
4
|
+
var compress_props_1 = require("./compress-props");
|
|
5
|
+
Object.defineProperty(exports, "compressInputProps", { enumerable: true, get: function () { return compress_props_1.compressInputProps; } });
|
|
6
|
+
Object.defineProperty(exports, "decompressInputProps", { enumerable: true, get: function () { return compress_props_1.decompressInputProps; } });
|
|
7
|
+
Object.defineProperty(exports, "getNeedsToUpload", { enumerable: true, get: function () { return compress_props_1.getNeedsToUpload; } });
|
|
8
|
+
Object.defineProperty(exports, "serializeOrThrow", { enumerable: true, get: function () { return compress_props_1.serializeOrThrow; } });
|
|
9
|
+
var constants_1 = require("./constants");
|
|
10
|
+
Object.defineProperty(exports, "REMOTION_BUCKET_PREFIX", { enumerable: true, get: function () { return constants_1.REMOTION_BUCKET_PREFIX; } });
|
|
11
|
+
Object.defineProperty(exports, "ServerlessRoutines", { enumerable: true, get: function () { return constants_1.ServerlessRoutines; } });
|
|
12
|
+
Object.defineProperty(exports, "artifactName", { enumerable: true, get: function () { return constants_1.artifactName; } });
|
|
13
|
+
Object.defineProperty(exports, "customOutName", { enumerable: true, get: function () { return constants_1.customOutName; } });
|
|
14
|
+
Object.defineProperty(exports, "expiryDays", { enumerable: true, get: function () { return constants_1.expiryDays; } });
|
|
15
|
+
Object.defineProperty(exports, "outName", { enumerable: true, get: function () { return constants_1.outName; } });
|
|
16
|
+
Object.defineProperty(exports, "outStillName", { enumerable: true, get: function () { return constants_1.outStillName; } });
|
|
17
|
+
Object.defineProperty(exports, "overallProgressKey", { enumerable: true, get: function () { return constants_1.overallProgressKey; } });
|
|
18
|
+
Object.defineProperty(exports, "rendersPrefix", { enumerable: true, get: function () { return constants_1.rendersPrefix; } });
|
|
19
|
+
Object.defineProperty(exports, "serverlessCodecs", { enumerable: true, get: function () { return constants_1.serverlessCodecs; } });
|
|
20
|
+
var get_or_create_bucket_1 = require("./get-or-create-bucket");
|
|
21
|
+
Object.defineProperty(exports, "internalGetOrCreateBucket", { enumerable: true, get: function () { return get_or_create_bucket_1.internalGetOrCreateBucket; } });
|
|
22
|
+
var expected_out_name_1 = require("./expected-out-name");
|
|
23
|
+
Object.defineProperty(exports, "getExpectedOutName", { enumerable: true, get: function () { return expected_out_name_1.getExpectedOutName; } });
|
|
24
|
+
var input_props_keys_1 = require("./input-props-keys");
|
|
25
|
+
Object.defineProperty(exports, "inputPropsKey", { enumerable: true, get: function () { return input_props_keys_1.inputPropsKey; } });
|
|
26
|
+
Object.defineProperty(exports, "resolvedPropsKey", { enumerable: true, get: function () { return input_props_keys_1.resolvedPropsKey; } });
|
|
27
|
+
var make_bucket_name_1 = require("./make-bucket-name");
|
|
28
|
+
Object.defineProperty(exports, "makeBucketName", { enumerable: true, get: function () { return make_bucket_name_1.makeBucketName; } });
|
|
29
|
+
var stream_to_string_1 = require("./stream-to-string");
|
|
30
|
+
Object.defineProperty(exports, "streamToString", { enumerable: true, get: function () { return stream_to_string_1.streamToString; } });
|
|
31
|
+
var streaming_1 = require("./streaming/streaming");
|
|
32
|
+
Object.defineProperty(exports, "formatMap", { enumerable: true, get: function () { return streaming_1.formatMap; } });
|
|
33
|
+
Object.defineProperty(exports, "makeStreamPayload", { enumerable: true, get: function () { return streaming_1.makeStreamPayload; } });
|
|
34
|
+
Object.defineProperty(exports, "messageTypeIdToMessageType", { enumerable: true, get: function () { return streaming_1.messageTypeIdToMessageType; } });
|
|
35
|
+
var truthy_1 = require("./truthy");
|
|
36
|
+
Object.defineProperty(exports, "truthy", { enumerable: true, get: function () { return truthy_1.truthy; } });
|
|
37
|
+
var validate_bucket_name_1 = require("./validate-bucket-name");
|
|
38
|
+
Object.defineProperty(exports, "validateBucketName", { enumerable: true, get: function () { return validate_bucket_name_1.validateBucketName; } });
|
|
39
|
+
var validate_webhook_1 = require("./validate-webhook");
|
|
40
|
+
Object.defineProperty(exports, "validateWebhook", { enumerable: true, get: function () { return validate_webhook_1.validateWebhook; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ServerlessPayload } from './constants';
|
|
2
|
+
import type { ProviderSpecifics } from './provider-implementation';
|
|
3
|
+
import type { CloudProvider } from './still';
|
|
4
|
+
type Options = {
|
|
5
|
+
expectedBucketOwner: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const compositionsHandler: <Provider extends CloudProvider<string, Record<string, unknown>>>(lambdaParams: ServerlessPayload<Provider>, options: Options, providerSpecifics: ProviderSpecifics<Provider>) => Promise<{
|
|
8
|
+
compositions: import("remotion").VideoConfig[];
|
|
9
|
+
type: "success";
|
|
10
|
+
}>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compositionsHandler = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const version_1 = require("remotion/version");
|
|
6
|
+
const compress_props_1 = require("./compress-props");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const get_browser_instance_1 = require("./get-browser-instance");
|
|
9
|
+
const get_or_create_bucket_1 = require("./get-or-create-bucket");
|
|
10
|
+
const compositionsHandler = async (lambdaParams, options, providerSpecifics) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (lambdaParams.type !== constants_1.ServerlessRoutines.compositions) {
|
|
13
|
+
throw new TypeError('Expected info compositions');
|
|
14
|
+
}
|
|
15
|
+
if (lambdaParams.version !== version_1.VERSION) {
|
|
16
|
+
if (!lambdaParams.version) {
|
|
17
|
+
throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
18
|
+
}
|
|
19
|
+
throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const region = providerSpecifics.getCurrentRegionInFunction();
|
|
23
|
+
const browserInstancePromise = (0, get_browser_instance_1.getBrowserInstance)({
|
|
24
|
+
logLevel: lambdaParams.logLevel,
|
|
25
|
+
indent: false,
|
|
26
|
+
chromiumOptions: lambdaParams.chromiumOptions,
|
|
27
|
+
providerSpecifics,
|
|
28
|
+
});
|
|
29
|
+
const bucketNamePromise = lambdaParams.bucketName
|
|
30
|
+
? Promise.resolve(lambdaParams.bucketName)
|
|
31
|
+
: (0, get_or_create_bucket_1.internalGetOrCreateBucket)({
|
|
32
|
+
region,
|
|
33
|
+
enableFolderExpiry: null,
|
|
34
|
+
customCredentials: null,
|
|
35
|
+
providerSpecifics,
|
|
36
|
+
}).then((b) => b.bucketName);
|
|
37
|
+
const bucketName = await bucketNamePromise;
|
|
38
|
+
const serializedInputPropsWithCustomSchema = await (0, compress_props_1.decompressInputProps)({
|
|
39
|
+
bucketName: await bucketNamePromise,
|
|
40
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
41
|
+
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
42
|
+
serialized: lambdaParams.inputProps,
|
|
43
|
+
propsType: 'input-props',
|
|
44
|
+
providerSpecifics,
|
|
45
|
+
});
|
|
46
|
+
const realServeUrl = providerSpecifics.convertToServeUrl({
|
|
47
|
+
urlOrId: lambdaParams.serveUrl,
|
|
48
|
+
region,
|
|
49
|
+
bucketName,
|
|
50
|
+
});
|
|
51
|
+
const compositions = await renderer_1.RenderInternals.internalGetCompositions({
|
|
52
|
+
serveUrlOrWebpackUrl: realServeUrl,
|
|
53
|
+
puppeteerInstance: (await browserInstancePromise).instance,
|
|
54
|
+
serializedInputPropsWithCustomSchema,
|
|
55
|
+
envVariables: (_a = lambdaParams.envVariables) !== null && _a !== void 0 ? _a : {},
|
|
56
|
+
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
|
|
57
|
+
chromiumOptions: lambdaParams.chromiumOptions,
|
|
58
|
+
port: null,
|
|
59
|
+
server: undefined,
|
|
60
|
+
logLevel: lambdaParams.logLevel,
|
|
61
|
+
indent: false,
|
|
62
|
+
browserExecutable: null,
|
|
63
|
+
onBrowserLog: null,
|
|
64
|
+
offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
|
|
65
|
+
binariesDirectory: null,
|
|
66
|
+
onBrowserDownload: () => {
|
|
67
|
+
throw new Error('Should not download a browser in Lambda');
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return Promise.resolve({
|
|
71
|
+
compositions,
|
|
72
|
+
type: 'success',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
(0, get_browser_instance_1.forgetBrowserEventLoop)(lambdaParams.logLevel);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.compositionsHandler = compositionsHandler;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SerializedInputProps } from './constants';
|
|
2
|
+
import type { ProviderSpecifics } from './provider-implementation';
|
|
3
|
+
import type { CloudProvider } from './still';
|
|
4
|
+
type PropsType = 'input-props' | 'resolved-props';
|
|
5
|
+
export declare const serializeOrThrow: (inputProps: Record<string, unknown>, propsType: PropsType) => string;
|
|
6
|
+
export declare const getNeedsToUpload: (type: 'still' | 'video-or-audio', sizes: number[]) => boolean;
|
|
7
|
+
export declare const compressInputProps: <Provider extends CloudProvider<string, Record<string, unknown>>>({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }: {
|
|
8
|
+
stringifiedInputProps: string;
|
|
9
|
+
region: Provider["region"];
|
|
10
|
+
userSpecifiedBucketName: string | null;
|
|
11
|
+
propsType: PropsType;
|
|
12
|
+
needsToUpload: boolean;
|
|
13
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
14
|
+
}) => Promise<SerializedInputProps>;
|
|
15
|
+
export declare const decompressInputProps: <Provider extends CloudProvider<string, Record<string, unknown>>>({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }: {
|
|
16
|
+
serialized: SerializedInputProps;
|
|
17
|
+
region: Provider["region"];
|
|
18
|
+
bucketName: string;
|
|
19
|
+
expectedBucketOwner: string;
|
|
20
|
+
propsType: PropsType;
|
|
21
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
22
|
+
}) => Promise<string>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decompressInputProps = exports.compressInputProps = exports.getNeedsToUpload = exports.serializeOrThrow = void 0;
|
|
4
|
+
const no_react_1 = require("remotion/no-react");
|
|
5
|
+
const get_or_create_bucket_1 = require("./get-or-create-bucket");
|
|
6
|
+
const input_props_keys_1 = require("./input-props-keys");
|
|
7
|
+
const stream_to_string_1 = require("./stream-to-string");
|
|
8
|
+
const validate_webhook_1 = require("./validate-webhook");
|
|
9
|
+
const makeKey = (type, hash) => {
|
|
10
|
+
if (type === 'input-props') {
|
|
11
|
+
return (0, input_props_keys_1.inputPropsKey)(hash);
|
|
12
|
+
}
|
|
13
|
+
return (0, input_props_keys_1.resolvedPropsKey)(hash);
|
|
14
|
+
};
|
|
15
|
+
const serializeOrThrow = (inputProps, propsType) => {
|
|
16
|
+
try {
|
|
17
|
+
const payload = no_react_1.NoReactInternals.serializeJSONWithDate({
|
|
18
|
+
indent: undefined,
|
|
19
|
+
staticBase: null,
|
|
20
|
+
data: inputProps,
|
|
21
|
+
});
|
|
22
|
+
return payload.serializedString;
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
throw new Error(`Error serializing ${propsType}. Check it has no circular references or reduce the size if the object is big.`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.serializeOrThrow = serializeOrThrow;
|
|
29
|
+
const getNeedsToUpload = (type, sizes) => {
|
|
30
|
+
const MARGIN = 5000 + validate_webhook_1.MAX_WEBHOOK_CUSTOM_DATA_SIZE;
|
|
31
|
+
const MAX_INLINE_PAYLOAD_SIZE = (type === 'still' ? 5000000 : 200000) - MARGIN;
|
|
32
|
+
const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
|
|
33
|
+
if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
|
|
34
|
+
console.warn(`Warning: The props are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(sizesAlreadyUsed / 1024)}KB) in size. Uploading them to S3 to circumvent AWS Lambda payload size, which may lead to slowdown.`);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
exports.getNeedsToUpload = getNeedsToUpload;
|
|
40
|
+
const compressInputProps = async ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }) => {
|
|
41
|
+
const hash = providerSpecifics.randomHash();
|
|
42
|
+
if (needsToUpload) {
|
|
43
|
+
const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, get_or_create_bucket_1.internalGetOrCreateBucket)({
|
|
44
|
+
region,
|
|
45
|
+
enableFolderExpiry: null,
|
|
46
|
+
customCredentials: null,
|
|
47
|
+
providerSpecifics,
|
|
48
|
+
})).bucketName;
|
|
49
|
+
await providerSpecifics.writeFile({
|
|
50
|
+
body: stringifiedInputProps,
|
|
51
|
+
bucketName,
|
|
52
|
+
region,
|
|
53
|
+
customCredentials: null,
|
|
54
|
+
downloadBehavior: null,
|
|
55
|
+
expectedBucketOwner: null,
|
|
56
|
+
key: makeKey(propsType, hash),
|
|
57
|
+
privacy: 'private',
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
type: 'bucket-url',
|
|
61
|
+
hash,
|
|
62
|
+
bucketName,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
type: 'payload',
|
|
67
|
+
payload: stringifiedInputProps,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.compressInputProps = compressInputProps;
|
|
71
|
+
const decompressInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }) => {
|
|
72
|
+
if (serialized.type === 'payload') {
|
|
73
|
+
return serialized.payload;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const response = await providerSpecifics.readFile({
|
|
77
|
+
bucketName,
|
|
78
|
+
expectedBucketOwner,
|
|
79
|
+
key: makeKey(propsType, serialized.hash),
|
|
80
|
+
region,
|
|
81
|
+
});
|
|
82
|
+
const body = await (0, stream_to_string_1.streamToString)(response);
|
|
83
|
+
const payload = body;
|
|
84
|
+
return payload;
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
exports.decompressInputProps = decompressInputProps;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import type { AudioCodec, ChromiumOptions, ColorSpace, FrameRange, LogLevel, PixelFormat, ProResProfile, StillImageFormat, ToOptions, VideoImageFormat, X264Preset } from '@remotion/renderer';
|
|
2
|
+
import type { BrowserSafeApis } from '@remotion/renderer/client';
|
|
3
|
+
import type { CloudProvider } from './still';
|
|
4
|
+
export declare const expiryDays: {
|
|
5
|
+
readonly '1-day': 1;
|
|
6
|
+
readonly '3-days': 3;
|
|
7
|
+
readonly '7-days': 7;
|
|
8
|
+
readonly '30-days': 30;
|
|
9
|
+
};
|
|
10
|
+
export type DeleteAfter = keyof typeof expiryDays;
|
|
11
|
+
export declare enum ServerlessRoutines {
|
|
12
|
+
info = "info",
|
|
13
|
+
start = "start",
|
|
14
|
+
launch = "launch",
|
|
15
|
+
status = "status",
|
|
16
|
+
renderer = "renderer",
|
|
17
|
+
still = "still",
|
|
18
|
+
compositions = "compositions"
|
|
19
|
+
}
|
|
20
|
+
export type CustomCredentialsWithoutSensitiveData = {
|
|
21
|
+
endpoint: string;
|
|
22
|
+
};
|
|
23
|
+
export type CustomCredentials<Provider extends CloudProvider> = CustomCredentialsWithoutSensitiveData & {
|
|
24
|
+
accessKeyId: string | null;
|
|
25
|
+
secretAccessKey: string | null;
|
|
26
|
+
region?: Provider['region'];
|
|
27
|
+
};
|
|
28
|
+
export type OutNameInput<Provider extends CloudProvider> = string | {
|
|
29
|
+
bucketName: string;
|
|
30
|
+
key: string;
|
|
31
|
+
s3OutputProvider?: CustomCredentials<Provider>;
|
|
32
|
+
};
|
|
33
|
+
export type SerializedInputProps = {
|
|
34
|
+
type: 'bucket-url';
|
|
35
|
+
hash: string;
|
|
36
|
+
bucketName: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'payload';
|
|
39
|
+
payload: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const serverlessCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "gif", "prores"];
|
|
42
|
+
export type ServerlessCodec = (typeof serverlessCodecs)[number];
|
|
43
|
+
export type Privacy = 'public' | 'private' | 'no-acl';
|
|
44
|
+
export type DownloadBehavior = {
|
|
45
|
+
type: 'play-in-browser';
|
|
46
|
+
} | {
|
|
47
|
+
type: 'download';
|
|
48
|
+
fileName: string | null;
|
|
49
|
+
};
|
|
50
|
+
type Prettify<T> = {
|
|
51
|
+
[K in keyof T]: T[K];
|
|
52
|
+
} & {};
|
|
53
|
+
export type WebhookOption = Prettify<null | ({
|
|
54
|
+
url: string;
|
|
55
|
+
secret: string | null;
|
|
56
|
+
} & Partial<ToOptions<{
|
|
57
|
+
customData: typeof BrowserSafeApis.options.webhookCustomDataOption;
|
|
58
|
+
}>>)>;
|
|
59
|
+
export type ServerlessStatusPayload<Provider extends CloudProvider> = {
|
|
60
|
+
type: ServerlessRoutines.status;
|
|
61
|
+
bucketName: string;
|
|
62
|
+
renderId: string;
|
|
63
|
+
version: string;
|
|
64
|
+
logLevel: LogLevel;
|
|
65
|
+
s3OutputProvider?: CustomCredentials<Provider>;
|
|
66
|
+
};
|
|
67
|
+
export type ServerlessStartPayload<Provider extends CloudProvider> = {
|
|
68
|
+
rendererFunctionName: string | null;
|
|
69
|
+
type: ServerlessRoutines.start;
|
|
70
|
+
serveUrl: string;
|
|
71
|
+
composition: string;
|
|
72
|
+
framesPerLambda: number | null;
|
|
73
|
+
inputProps: SerializedInputProps;
|
|
74
|
+
codec: ServerlessCodec;
|
|
75
|
+
audioCodec: AudioCodec | null;
|
|
76
|
+
imageFormat: VideoImageFormat;
|
|
77
|
+
crf: number | undefined;
|
|
78
|
+
envVariables: Record<string, string> | undefined;
|
|
79
|
+
pixelFormat: PixelFormat | undefined;
|
|
80
|
+
proResProfile: ProResProfile | undefined;
|
|
81
|
+
x264Preset: X264Preset | null;
|
|
82
|
+
jpegQuality: number | undefined;
|
|
83
|
+
maxRetries: number;
|
|
84
|
+
privacy: Privacy;
|
|
85
|
+
logLevel: LogLevel;
|
|
86
|
+
frameRange: FrameRange | null;
|
|
87
|
+
outName: OutNameInput<Provider> | null;
|
|
88
|
+
timeoutInMilliseconds: number;
|
|
89
|
+
chromiumOptions: ChromiumOptions;
|
|
90
|
+
scale: number;
|
|
91
|
+
everyNthFrame: number;
|
|
92
|
+
numberOfGifLoops: number | null;
|
|
93
|
+
concurrencyPerLambda: number;
|
|
94
|
+
downloadBehavior: DownloadBehavior;
|
|
95
|
+
muted: boolean;
|
|
96
|
+
version: string;
|
|
97
|
+
overwrite: boolean;
|
|
98
|
+
audioBitrate: string | null;
|
|
99
|
+
videoBitrate: string | null;
|
|
100
|
+
encodingMaxRate: string | null;
|
|
101
|
+
encodingBufferSize: string | null;
|
|
102
|
+
webhook: WebhookOption;
|
|
103
|
+
forceHeight: number | null;
|
|
104
|
+
forceWidth: number | null;
|
|
105
|
+
bucketName: string | null;
|
|
106
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
107
|
+
deleteAfter: DeleteAfter | null;
|
|
108
|
+
colorSpace: ColorSpace | null;
|
|
109
|
+
preferLossless: boolean;
|
|
110
|
+
};
|
|
111
|
+
export type ServerlessPayloads<Provider extends CloudProvider> = {
|
|
112
|
+
info: {
|
|
113
|
+
type: ServerlessRoutines.info;
|
|
114
|
+
logLevel: LogLevel;
|
|
115
|
+
};
|
|
116
|
+
start: ServerlessStartPayload<Provider>;
|
|
117
|
+
launch: {
|
|
118
|
+
rendererFunctionName: string | null;
|
|
119
|
+
type: ServerlessRoutines.launch;
|
|
120
|
+
serveUrl: string;
|
|
121
|
+
composition: string;
|
|
122
|
+
framesPerLambda: number | null;
|
|
123
|
+
bucketName: string;
|
|
124
|
+
inputProps: SerializedInputProps;
|
|
125
|
+
renderId: string;
|
|
126
|
+
imageFormat: VideoImageFormat;
|
|
127
|
+
codec: ServerlessCodec;
|
|
128
|
+
audioCodec: AudioCodec | null;
|
|
129
|
+
crf: number | undefined;
|
|
130
|
+
envVariables: Record<string, string> | undefined;
|
|
131
|
+
pixelFormat: PixelFormat | undefined;
|
|
132
|
+
proResProfile: ProResProfile | undefined;
|
|
133
|
+
x264Preset: X264Preset | null;
|
|
134
|
+
jpegQuality: number | undefined;
|
|
135
|
+
maxRetries: number;
|
|
136
|
+
privacy: Privacy;
|
|
137
|
+
logLevel: LogLevel;
|
|
138
|
+
frameRange: FrameRange | null;
|
|
139
|
+
outName: OutNameInput<Provider> | null;
|
|
140
|
+
timeoutInMilliseconds: number;
|
|
141
|
+
chromiumOptions: ChromiumOptions;
|
|
142
|
+
scale: number;
|
|
143
|
+
everyNthFrame: number;
|
|
144
|
+
numberOfGifLoops: number | null;
|
|
145
|
+
concurrencyPerLambda: number;
|
|
146
|
+
downloadBehavior: DownloadBehavior;
|
|
147
|
+
muted: boolean;
|
|
148
|
+
overwrite: boolean;
|
|
149
|
+
audioBitrate: string | null;
|
|
150
|
+
videoBitrate: string | null;
|
|
151
|
+
encodingMaxRate: string | null;
|
|
152
|
+
encodingBufferSize: string | null;
|
|
153
|
+
webhook: WebhookOption;
|
|
154
|
+
forceHeight: number | null;
|
|
155
|
+
forceWidth: number | null;
|
|
156
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
157
|
+
deleteAfter: DeleteAfter | null;
|
|
158
|
+
colorSpace: ColorSpace | null;
|
|
159
|
+
preferLossless: boolean;
|
|
160
|
+
};
|
|
161
|
+
status: ServerlessStatusPayload<Provider>;
|
|
162
|
+
renderer: {
|
|
163
|
+
concurrencyPerLambda: number;
|
|
164
|
+
type: ServerlessRoutines.renderer;
|
|
165
|
+
serveUrl: string;
|
|
166
|
+
frameRange: [number, number];
|
|
167
|
+
chunk: number;
|
|
168
|
+
bucketName: string;
|
|
169
|
+
composition: string;
|
|
170
|
+
fps: number;
|
|
171
|
+
height: number;
|
|
172
|
+
width: number;
|
|
173
|
+
durationInFrames: number;
|
|
174
|
+
retriesLeft: number;
|
|
175
|
+
inputProps: SerializedInputProps;
|
|
176
|
+
renderId: string;
|
|
177
|
+
imageFormat: VideoImageFormat;
|
|
178
|
+
codec: ServerlessCodec;
|
|
179
|
+
crf: number | undefined;
|
|
180
|
+
proResProfile: ProResProfile | undefined;
|
|
181
|
+
x264Preset: X264Preset | null;
|
|
182
|
+
pixelFormat: PixelFormat | undefined;
|
|
183
|
+
jpegQuality: number | undefined;
|
|
184
|
+
envVariables: Record<string, string> | undefined;
|
|
185
|
+
privacy: Privacy;
|
|
186
|
+
attempt: number;
|
|
187
|
+
logLevel: LogLevel;
|
|
188
|
+
timeoutInMilliseconds: number;
|
|
189
|
+
chromiumOptions: ChromiumOptions;
|
|
190
|
+
resolvedProps: SerializedInputProps;
|
|
191
|
+
scale: number;
|
|
192
|
+
everyNthFrame: number;
|
|
193
|
+
muted: boolean;
|
|
194
|
+
audioBitrate: string | null;
|
|
195
|
+
videoBitrate: string | null;
|
|
196
|
+
encodingBufferSize: string | null;
|
|
197
|
+
encodingMaxRate: string | null;
|
|
198
|
+
launchFunctionConfig: {
|
|
199
|
+
version: string;
|
|
200
|
+
};
|
|
201
|
+
preferLossless: boolean;
|
|
202
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
203
|
+
deleteAfter: DeleteAfter | null;
|
|
204
|
+
colorSpace: ColorSpace | null;
|
|
205
|
+
compositionStart: number;
|
|
206
|
+
framesPerLambda: number;
|
|
207
|
+
progressEveryNthFrame: number;
|
|
208
|
+
};
|
|
209
|
+
still: {
|
|
210
|
+
type: ServerlessRoutines.still;
|
|
211
|
+
serveUrl: string;
|
|
212
|
+
composition: string;
|
|
213
|
+
inputProps: SerializedInputProps;
|
|
214
|
+
imageFormat: StillImageFormat;
|
|
215
|
+
envVariables: Record<string, string>;
|
|
216
|
+
attempt: number;
|
|
217
|
+
jpegQuality: number | undefined;
|
|
218
|
+
maxRetries: number;
|
|
219
|
+
frame: number;
|
|
220
|
+
privacy: Privacy;
|
|
221
|
+
logLevel: LogLevel;
|
|
222
|
+
outName: OutNameInput<Provider> | null;
|
|
223
|
+
timeoutInMilliseconds: number;
|
|
224
|
+
chromiumOptions: ChromiumOptions;
|
|
225
|
+
scale: number;
|
|
226
|
+
downloadBehavior: DownloadBehavior;
|
|
227
|
+
version: string;
|
|
228
|
+
forceHeight: number | null;
|
|
229
|
+
forceWidth: number | null;
|
|
230
|
+
bucketName: string | null;
|
|
231
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
232
|
+
deleteAfter: DeleteAfter | null;
|
|
233
|
+
streamed: boolean;
|
|
234
|
+
};
|
|
235
|
+
compositions: {
|
|
236
|
+
type: ServerlessRoutines.compositions;
|
|
237
|
+
version: string;
|
|
238
|
+
chromiumOptions: ChromiumOptions;
|
|
239
|
+
logLevel: LogLevel;
|
|
240
|
+
inputProps: SerializedInputProps;
|
|
241
|
+
envVariables: Record<string, string> | undefined;
|
|
242
|
+
timeoutInMilliseconds: number;
|
|
243
|
+
serveUrl: string;
|
|
244
|
+
bucketName: string | null;
|
|
245
|
+
offthreadVideoCacheSizeInBytes: number | null;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
export type ServerlessPayload<Provider extends CloudProvider> = ServerlessPayloads<Provider>[ServerlessRoutines];
|
|
249
|
+
export declare const REMOTION_BUCKET_PREFIX = "remotionlambda-";
|
|
250
|
+
export type OutNameOutput<Provider extends CloudProvider> = {
|
|
251
|
+
renderBucketName: string;
|
|
252
|
+
key: string;
|
|
253
|
+
customCredentials: CustomCredentials<Provider> | null;
|
|
254
|
+
};
|
|
255
|
+
export type OutNameInputWithoutCredentials = string | {
|
|
256
|
+
bucketName: string;
|
|
257
|
+
key: string;
|
|
258
|
+
s3OutputProvider?: CustomCredentialsWithoutSensitiveData;
|
|
259
|
+
};
|
|
260
|
+
export declare const rendersPrefix: (renderId: string) => string;
|
|
261
|
+
export declare const outStillName: (renderId: string, imageFormat: StillImageFormat) => string;
|
|
262
|
+
export declare const outName: (renderId: string, extension: string) => string;
|
|
263
|
+
export declare const customOutName: <Provider extends CloudProvider<string, Record<string, unknown>>>(renderId: string, bucketName: string, name: OutNameInput<Provider>) => OutNameOutput<Provider>;
|
|
264
|
+
export declare const overallProgressKey: (renderId: string) => string;
|
|
265
|
+
export declare const artifactName: (renderId: string, name: string) => string;
|
|
266
|
+
export {};
|