@remotion/lambda-client 4.0.261
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/.turbo/turbo-make.log +6 -0
- package/LICENSE.md +49 -0
- package/README.md +5 -0
- package/bundle.ts +20 -0
- package/dist/app-router-webhook.d.ts +10 -0
- package/dist/app-router-webhook.js +43 -0
- package/dist/apply-lifecycle.d.ts +8 -0
- package/dist/apply-lifecycle.js +18 -0
- package/dist/aws-clients.d.ts +11 -0
- package/dist/aws-clients.js +51 -0
- package/dist/aws-provider.d.ts +23 -0
- package/dist/aws-provider.js +94 -0
- package/dist/bucket-exists.d.ts +3 -0
- package/dist/bucket-exists.js +26 -0
- package/dist/call-lambda-async.d.ts +2 -0
- package/dist/call-lambda-async.js +20 -0
- package/dist/call-lambda-streaming.d.ts +6 -0
- package/dist/call-lambda-streaming.js +125 -0
- package/dist/call-lambda-sync.d.ts +2 -0
- package/dist/call-lambda-sync.js +30 -0
- package/dist/check-credentials.d.ts +1 -0
- package/dist/check-credentials.js +39 -0
- package/dist/clean-items.d.ts +16 -0
- package/dist/clean-items.js +25 -0
- package/dist/constants.d.ts +25 -0
- package/dist/constants.js +26 -0
- package/dist/content-disposition-header.d.ts +2 -0
- package/dist/content-disposition-header.js +50 -0
- package/dist/convert-to-serve-url.d.ts +6 -0
- package/dist/convert-to-serve-url.js +14 -0
- package/dist/create-bucket.d.ts +3 -0
- package/dist/create-bucket.js +45 -0
- package/dist/delete-file.d.ts +3 -0
- package/dist/delete-file.js +12 -0
- package/dist/delete-function.d.ts +4 -0
- package/dist/delete-function.js +15 -0
- package/dist/delete-render.d.ts +20 -0
- package/dist/delete-render.js +84 -0
- package/dist/encode-aws-url-params.d.ts +1 -0
- package/dist/encode-aws-url-params.js +7 -0
- package/dist/esm/constants.mjs +45 -0
- package/dist/esm/index.mjs +6516 -0
- package/dist/esm/regions.mjs +50 -0
- package/dist/estimate-price.d.ts +17 -0
- package/dist/estimate-price.js +45 -0
- package/dist/express-webhook.d.ts +3 -0
- package/dist/express-webhook.js +46 -0
- package/dist/get-account-id.d.ts +3 -0
- package/dist/get-account-id.js +15 -0
- package/dist/get-aws-client.d.ts +30 -0
- package/dist/get-aws-client.js +56 -0
- package/dist/get-aws-urls.d.ts +25 -0
- package/dist/get-aws-urls.js +31 -0
- package/dist/get-buckets.d.ts +9 -0
- package/dist/get-buckets.js +62 -0
- package/dist/get-compositions-on-lambda.d.ts +18 -0
- package/dist/get-compositions-on-lambda.js +59 -0
- package/dist/get-credentials.d.ts +9 -0
- package/dist/get-credentials.js +55 -0
- package/dist/get-env-variable.d.ts +1 -0
- package/dist/get-env-variable.js +15 -0
- package/dist/get-function-name.d.ts +8 -0
- package/dist/get-function-name.js +17 -0
- package/dist/get-function-version.d.ts +7 -0
- package/dist/get-function-version.js +32 -0
- package/dist/get-functions.d.ts +8 -0
- package/dist/get-functions.js +77 -0
- package/dist/get-output-url-from-metadata.d.ts +3 -0
- package/dist/get-output-url-from-metadata.js +18 -0
- package/dist/get-render-progress.d.ts +15 -0
- package/dist/get-render-progress.js +45 -0
- package/dist/get-s3-client.d.ts +9 -0
- package/dist/get-s3-client.js +14 -0
- package/dist/get-service-client.d.ts +23 -0
- package/dist/get-service-client.js +120 -0
- package/dist/get-sites.d.ts +29 -0
- package/dist/get-sites.js +79 -0
- package/dist/head-file.d.ts +3 -0
- package/dist/head-file.js +17 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +104 -0
- package/dist/is-cli.d.ts +2 -0
- package/dist/is-cli.js +10 -0
- package/dist/is-flaky-error.d.ts +1 -0
- package/dist/is-flaky-error.js +77 -0
- package/dist/is-in-lambda.d.ts +1 -0
- package/dist/is-in-lambda.js +9 -0
- package/dist/is-likely-to-have-aws-profile.d.ts +1 -0
- package/dist/is-likely-to-have-aws-profile.js +50 -0
- package/dist/lambda-version-string.d.ts +1 -0
- package/dist/lambda-version-string.js +7 -0
- package/dist/lifecycle-rules.d.ts +10 -0
- package/dist/lifecycle-rules.js +61 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.js +24 -0
- package/dist/list-objects.d.ts +3 -0
- package/dist/list-objects.js +67 -0
- package/dist/make-lambda-payload.d.ts +54 -0
- package/dist/make-lambda-payload.js +148 -0
- package/dist/make-s3-url.d.ts +6 -0
- package/dist/make-s3-url.js +7 -0
- package/dist/p-limit.d.ts +1 -0
- package/dist/p-limit.js +57 -0
- package/dist/pages-router-webhook.d.ts +5 -0
- package/dist/pages-router-webhook.js +48 -0
- package/dist/parse-function-name.d.ts +8 -0
- package/dist/parse-function-name.js +17 -0
- package/dist/presign-url.d.ts +14 -0
- package/dist/presign-url.js +64 -0
- package/dist/price-per-1s.d.ts +37 -0
- package/dist/price-per-1s.js +822 -0
- package/dist/random-hash.d.ts +1 -0
- package/dist/random-hash.js +13 -0
- package/dist/read-file.d.ts +9 -0
- package/dist/read-file.js +18 -0
- package/dist/regions.d.ts +3 -0
- package/dist/regions.js +48 -0
- package/dist/render-media-on-lambda.d.ts +61 -0
- package/dist/render-media-on-lambda.js +127 -0
- package/dist/render-still-on-lambda.d.ts +53 -0
- package/dist/render-still-on-lambda.js +118 -0
- package/dist/runtime-preference.d.ts +2 -0
- package/dist/runtime-preference.js +8 -0
- package/dist/speculate-function-name.d.ts +6 -0
- package/dist/speculate-function-name.js +20 -0
- package/dist/test/encode-aws-url.test.d.ts +1 -0
- package/dist/test/encode-aws-url.test.js +8 -0
- package/dist/test/price-calculation.test.d.ts +1 -0
- package/dist/test/price-calculation.test.js +61 -0
- package/dist/test/pricing.test.d.ts +1 -0
- package/dist/test/pricing.test.js +27 -0
- package/dist/test/validate-disk-size-in-mb.test.d.ts +1 -0
- package/dist/test/validate-disk-size-in-mb.test.js +14 -0
- package/dist/validate-aws-region.d.ts +2 -0
- package/dist/validate-aws-region.js +9 -0
- package/dist/validate-bucketname.d.ts +4 -0
- package/dist/validate-bucketname.js +15 -0
- package/dist/validate-disk-size-in-mb.d.ts +1 -0
- package/dist/validate-disk-size-in-mb.js +23 -0
- package/dist/validate-lambda-codec.d.ts +2 -0
- package/dist/validate-lambda-codec.js +21 -0
- package/dist/validate-memory-size.d.ts +1 -0
- package/dist/validate-memory-size.js +22 -0
- package/dist/validate-presign-expiration.d.ts +1 -0
- package/dist/validate-presign-expiration.js +29 -0
- package/dist/validate-serveurl.d.ts +1 -0
- package/dist/validate-serveurl.js +9 -0
- package/dist/validate-webhook-signature.d.ts +5 -0
- package/dist/validate-webhook-signature.js +28 -0
- package/dist/write-file.d.ts +5 -0
- package/dist/write-file.js +56 -0
- package/eslint.config.mjs +5 -0
- package/package.json +71 -0
- package/src/app-router-webhook.ts +64 -0
- package/src/apply-lifecycle.ts +30 -0
- package/src/aws-clients.ts +60 -0
- package/src/aws-provider.ts +135 -0
- package/src/bucket-exists.ts +28 -0
- package/src/call-lambda-async.ts +39 -0
- package/src/call-lambda-streaming.ts +219 -0
- package/src/call-lambda-sync.ts +55 -0
- package/src/check-credentials.ts +51 -0
- package/src/clean-items.ts +47 -0
- package/src/constants.ts +38 -0
- package/src/content-disposition-header.ts +64 -0
- package/src/convert-to-serve-url.ts +24 -0
- package/src/create-bucket.ts +67 -0
- package/src/delete-file.ts +30 -0
- package/src/delete-function.ts +24 -0
- package/src/delete-render.ts +107 -0
- package/src/encode-aws-url-params.ts +3 -0
- package/src/estimate-price.ts +95 -0
- package/src/express-webhook.ts +50 -0
- package/src/get-account-id.ts +22 -0
- package/src/get-aws-client.ts +59 -0
- package/src/get-aws-urls.ts +85 -0
- package/src/get-buckets.ts +81 -0
- package/src/get-compositions-on-lambda.ts +104 -0
- package/src/get-credentials.ts +81 -0
- package/src/get-env-variable.ts +15 -0
- package/src/get-function-name.ts +24 -0
- package/src/get-function-version.ts +43 -0
- package/src/get-functions.ts +103 -0
- package/src/get-output-url-from-metadata.ts +23 -0
- package/src/get-render-progress.ts +62 -0
- package/src/get-s3-client.ts +22 -0
- package/src/get-service-client.ts +178 -0
- package/src/get-sites.ts +128 -0
- package/src/head-file.ts +28 -0
- package/src/index.ts +147 -0
- package/src/is-cli.ts +7 -0
- package/src/is-flaky-error.ts +101 -0
- package/src/is-in-lambda.ts +5 -0
- package/src/is-likely-to-have-aws-profile.ts +55 -0
- package/src/lambda-version-string.ts +5 -0
- package/src/lifecycle-rules.ts +104 -0
- package/src/lifecycle.ts +44 -0
- package/src/list-objects.ts +83 -0
- package/src/make-lambda-payload.ts +317 -0
- package/src/make-s3-url.ts +13 -0
- package/src/p-limit.ts +75 -0
- package/src/pages-router-webhook.ts +58 -0
- package/src/parse-function-name.ts +24 -0
- package/src/presign-url.ts +110 -0
- package/src/price-per-1s.ts +863 -0
- package/src/random-hash.ts +10 -0
- package/src/read-file.ts +31 -0
- package/src/regions.ts +48 -0
- package/src/render-media-on-lambda.ts +216 -0
- package/src/render-still-on-lambda.ts +195 -0
- package/src/runtime-preference.ts +7 -0
- package/src/speculate-function-name.ts +27 -0
- package/src/test/encode-aws-url.test.ts +7 -0
- package/src/test/price-calculation.test.ts +61 -0
- package/src/test/pricing.test.ts +32 -0
- package/src/test/validate-disk-size-in-mb.test.ts +15 -0
- package/src/validate-aws-region.ts +14 -0
- package/src/validate-bucketname.ts +24 -0
- package/src/validate-disk-size-in-mb.ts +37 -0
- package/src/validate-lambda-codec.ts +28 -0
- package/src/validate-memory-size.ts +31 -0
- package/src/validate-presign-expiration.ts +46 -0
- package/src/validate-serveurl.ts +9 -0
- package/src/validate-webhook-signature.ts +42 -0
- package/src/write-file.ts +74 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const randomHashImplementation: () => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randomHashImplementation = void 0;
|
|
4
|
+
const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
|
5
|
+
const randomHashImplementation = () => {
|
|
6
|
+
return new Array(10)
|
|
7
|
+
.fill(1)
|
|
8
|
+
.map(() => {
|
|
9
|
+
return alphabet[Math.floor(Math.random() * alphabet.length)];
|
|
10
|
+
})
|
|
11
|
+
.join('');
|
|
12
|
+
};
|
|
13
|
+
exports.randomHashImplementation = randomHashImplementation;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Readable } from 'stream';
|
|
2
|
+
import type { AwsRegion } from './regions';
|
|
3
|
+
export declare const lambdaReadFileImplementation: ({ bucketName, key, region, expectedBucketOwner, forcePathStyle, }: {
|
|
4
|
+
bucketName: string;
|
|
5
|
+
key: string;
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
expectedBucketOwner: string | null;
|
|
8
|
+
forcePathStyle: boolean;
|
|
9
|
+
}) => Promise<Readable>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lambdaReadFileImplementation = void 0;
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const get_s3_client_1 = require("./get-s3-client");
|
|
6
|
+
const lambdaReadFileImplementation = async ({ bucketName, key, region, expectedBucketOwner, forcePathStyle, }) => {
|
|
7
|
+
const { Body } = await (0, get_s3_client_1.getS3Client)({
|
|
8
|
+
region,
|
|
9
|
+
customCredentials: null,
|
|
10
|
+
forcePathStyle,
|
|
11
|
+
}).send(new client_s3_1.GetObjectCommand({
|
|
12
|
+
Bucket: bucketName,
|
|
13
|
+
Key: key,
|
|
14
|
+
ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
|
|
15
|
+
}));
|
|
16
|
+
return Body;
|
|
17
|
+
};
|
|
18
|
+
exports.lambdaReadFileImplementation = lambdaReadFileImplementation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const DEFAULT_AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "sa-east-1"];
|
|
2
|
+
export declare const AWS_REGIONS: readonly ["eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-south-1", "ap-east-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-southeast-4", "ap-southeast-5", "ca-central-1", "me-south-1", "sa-east-1"];
|
|
3
|
+
export type AwsRegion = (typeof AWS_REGIONS)[number];
|
package/dist/regions.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AWS_REGIONS = exports.DEFAULT_AWS_REGIONS = void 0;
|
|
4
|
+
exports.DEFAULT_AWS_REGIONS = [
|
|
5
|
+
'eu-central-1',
|
|
6
|
+
'eu-west-1',
|
|
7
|
+
'eu-west-2',
|
|
8
|
+
'eu-west-3',
|
|
9
|
+
'eu-north-1',
|
|
10
|
+
'us-east-1', // N. Virginia
|
|
11
|
+
'us-east-2', // Ohio;
|
|
12
|
+
'us-west-1',
|
|
13
|
+
'us-west-2', // Oregon
|
|
14
|
+
'ap-south-1',
|
|
15
|
+
'ap-southeast-1',
|
|
16
|
+
'ap-southeast-2',
|
|
17
|
+
'ap-northeast-1',
|
|
18
|
+
'ap-northeast-2',
|
|
19
|
+
'ap-northeast-3',
|
|
20
|
+
'ca-central-1',
|
|
21
|
+
'sa-east-1',
|
|
22
|
+
];
|
|
23
|
+
exports.AWS_REGIONS = [
|
|
24
|
+
'eu-central-1',
|
|
25
|
+
'eu-central-2',
|
|
26
|
+
'eu-west-1',
|
|
27
|
+
'eu-west-2',
|
|
28
|
+
'eu-west-3',
|
|
29
|
+
'eu-south-1',
|
|
30
|
+
'eu-north-1',
|
|
31
|
+
'us-east-1', // N. Virginia
|
|
32
|
+
'us-east-2', // Ohio;
|
|
33
|
+
'us-west-1',
|
|
34
|
+
'us-west-2', // Oregon
|
|
35
|
+
'af-south-1',
|
|
36
|
+
'ap-south-1',
|
|
37
|
+
'ap-east-1',
|
|
38
|
+
'ap-southeast-1',
|
|
39
|
+
'ap-southeast-2',
|
|
40
|
+
'ap-northeast-1',
|
|
41
|
+
'ap-northeast-2',
|
|
42
|
+
'ap-northeast-3',
|
|
43
|
+
'ap-southeast-4',
|
|
44
|
+
'ap-southeast-5',
|
|
45
|
+
'ca-central-1',
|
|
46
|
+
'me-south-1',
|
|
47
|
+
'sa-east-1',
|
|
48
|
+
];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AudioCodec, BrowserSafeApis, ChromiumOptions, DownloadBehavior, FrameRange, OutNameInput, PixelFormat, Privacy, ProResProfile, ServerlessCodec, ToOptions, VideoImageFormat, WebhookOption } from '@remotion/serverless-client';
|
|
2
|
+
import { type AwsProvider } from './aws-provider';
|
|
3
|
+
import type { InnerRenderMediaOnLambdaInput } from './make-lambda-payload';
|
|
4
|
+
import type { AwsRegion } from './regions';
|
|
5
|
+
export type RenderMediaOnLambdaInput = {
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
functionName: string;
|
|
8
|
+
serveUrl: string;
|
|
9
|
+
composition: string;
|
|
10
|
+
inputProps?: Record<string, unknown>;
|
|
11
|
+
codec: ServerlessCodec;
|
|
12
|
+
imageFormat?: VideoImageFormat;
|
|
13
|
+
crf?: number | undefined;
|
|
14
|
+
envVariables?: Record<string, string>;
|
|
15
|
+
pixelFormat?: PixelFormat;
|
|
16
|
+
proResProfile?: ProResProfile;
|
|
17
|
+
privacy?: Privacy;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Renamed to `jpegQuality`
|
|
20
|
+
*/
|
|
21
|
+
quality?: never;
|
|
22
|
+
jpegQuality?: number;
|
|
23
|
+
maxRetries?: number;
|
|
24
|
+
framesPerLambda?: number;
|
|
25
|
+
frameRange?: FrameRange;
|
|
26
|
+
outName?: OutNameInput<AwsProvider>;
|
|
27
|
+
chromiumOptions?: Omit<ChromiumOptions, 'enableMultiProcessOnLinux'>;
|
|
28
|
+
scale?: number;
|
|
29
|
+
everyNthFrame?: number;
|
|
30
|
+
concurrencyPerLambda?: number;
|
|
31
|
+
downloadBehavior?: DownloadBehavior | null;
|
|
32
|
+
overwrite?: boolean;
|
|
33
|
+
webhook?: WebhookOption | null;
|
|
34
|
+
forceWidth?: number | null;
|
|
35
|
+
forceHeight?: number | null;
|
|
36
|
+
rendererFunctionName?: string | null;
|
|
37
|
+
forceBucketName?: string;
|
|
38
|
+
audioCodec?: AudioCodec | null;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated in favor of `logLevel`: true
|
|
41
|
+
*/
|
|
42
|
+
dumpBrowserLogs?: boolean;
|
|
43
|
+
forcePathStyle?: boolean;
|
|
44
|
+
metadata?: Record<string, string> | null;
|
|
45
|
+
} & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
|
|
46
|
+
export type RenderMediaOnLambdaOutput = {
|
|
47
|
+
renderId: string;
|
|
48
|
+
bucketName: string;
|
|
49
|
+
cloudWatchLogs: string;
|
|
50
|
+
cloudWatchMainLogs: string;
|
|
51
|
+
lambdaInsightsLogs: string;
|
|
52
|
+
folderInS3Console: string;
|
|
53
|
+
progressJsonInConsole: string;
|
|
54
|
+
};
|
|
55
|
+
export declare const internalRenderMediaOnLambdaRaw: (input: InnerRenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
56
|
+
export declare const renderMediaOnLambdaOptionalToRequired: (options: RenderMediaOnLambdaInput) => InnerRenderMediaOnLambdaInput;
|
|
57
|
+
export declare const renderMediaOnLambda: (options: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Renamed to renderMediaOnLambda()
|
|
60
|
+
*/
|
|
61
|
+
export declare const renderVideoOnLambda: (options: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderVideoOnLambda = exports.renderMediaOnLambda = exports.renderMediaOnLambdaOptionalToRequired = exports.internalRenderMediaOnLambdaRaw = void 0;
|
|
4
|
+
const serverless_client_1 = require("@remotion/serverless-client");
|
|
5
|
+
const aws_provider_1 = require("./aws-provider");
|
|
6
|
+
const get_aws_urls_1 = require("./get-aws-urls");
|
|
7
|
+
const make_lambda_payload_1 = require("./make-lambda-payload");
|
|
8
|
+
const internalRenderMediaOnLambdaRaw = async (input) => {
|
|
9
|
+
var _a;
|
|
10
|
+
const { functionName, region, rendererFunctionName } = input;
|
|
11
|
+
try {
|
|
12
|
+
const res = await aws_provider_1.awsImplementation.callFunctionSync({
|
|
13
|
+
functionName,
|
|
14
|
+
type: serverless_client_1.ServerlessRoutines.start,
|
|
15
|
+
payload: await (0, make_lambda_payload_1.makeLambdaRenderMediaPayload)(input),
|
|
16
|
+
region,
|
|
17
|
+
timeoutInTest: 120000,
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
renderId: res.renderId,
|
|
21
|
+
bucketName: res.bucketName,
|
|
22
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchRendererUrl)({
|
|
23
|
+
functionName,
|
|
24
|
+
region,
|
|
25
|
+
renderId: res.renderId,
|
|
26
|
+
rendererFunctionName: rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : null,
|
|
27
|
+
chunk: null,
|
|
28
|
+
}),
|
|
29
|
+
cloudWatchMainLogs: (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
30
|
+
renderId: res.renderId,
|
|
31
|
+
functionName,
|
|
32
|
+
method: serverless_client_1.ServerlessRoutines.launch,
|
|
33
|
+
region,
|
|
34
|
+
rendererFunctionName: rendererFunctionName !== null && rendererFunctionName !== void 0 ? rendererFunctionName : null,
|
|
35
|
+
}),
|
|
36
|
+
folderInS3Console: (0, get_aws_urls_1.getS3RenderUrl)({
|
|
37
|
+
bucketName: res.bucketName,
|
|
38
|
+
renderId: res.renderId,
|
|
39
|
+
region,
|
|
40
|
+
}),
|
|
41
|
+
lambdaInsightsLogs: (0, get_aws_urls_1.getLambdaInsightsUrl)({
|
|
42
|
+
functionName,
|
|
43
|
+
region,
|
|
44
|
+
}),
|
|
45
|
+
progressJsonInConsole: (0, get_aws_urls_1.getProgressJsonUrl)({
|
|
46
|
+
bucketName: res.bucketName,
|
|
47
|
+
renderId: res.renderId,
|
|
48
|
+
region,
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
|
|
54
|
+
throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports.internalRenderMediaOnLambdaRaw = internalRenderMediaOnLambdaRaw;
|
|
60
|
+
const renderMediaOnLambdaOptionalToRequired = (options) => {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
|
|
62
|
+
return {
|
|
63
|
+
audioBitrate: (_a = options.audioBitrate) !== null && _a !== void 0 ? _a : null,
|
|
64
|
+
audioCodec: (_b = options.audioCodec) !== null && _b !== void 0 ? _b : null,
|
|
65
|
+
chromiumOptions: (_c = options.chromiumOptions) !== null && _c !== void 0 ? _c : {},
|
|
66
|
+
codec: options.codec,
|
|
67
|
+
colorSpace: (_d = options.colorSpace) !== null && _d !== void 0 ? _d : null,
|
|
68
|
+
composition: options.composition,
|
|
69
|
+
concurrencyPerLambda: (_e = options.concurrencyPerLambda) !== null && _e !== void 0 ? _e : 1,
|
|
70
|
+
crf: options.crf,
|
|
71
|
+
downloadBehavior: (_f = options.downloadBehavior) !== null && _f !== void 0 ? _f : { type: 'play-in-browser' },
|
|
72
|
+
envVariables: (_g = options.envVariables) !== null && _g !== void 0 ? _g : {},
|
|
73
|
+
everyNthFrame: (_h = options.everyNthFrame) !== null && _h !== void 0 ? _h : 1,
|
|
74
|
+
forceBucketName: (_j = options.forceBucketName) !== null && _j !== void 0 ? _j : null,
|
|
75
|
+
forceHeight: (_k = options.forceHeight) !== null && _k !== void 0 ? _k : null,
|
|
76
|
+
forceWidth: (_l = options.forceWidth) !== null && _l !== void 0 ? _l : null,
|
|
77
|
+
frameRange: (_m = options.frameRange) !== null && _m !== void 0 ? _m : null,
|
|
78
|
+
framesPerLambda: (_o = options.framesPerLambda) !== null && _o !== void 0 ? _o : null,
|
|
79
|
+
functionName: options.functionName,
|
|
80
|
+
imageFormat: (_p = options.imageFormat) !== null && _p !== void 0 ? _p : 'jpeg',
|
|
81
|
+
inputProps: (_q = options.inputProps) !== null && _q !== void 0 ? _q : {},
|
|
82
|
+
jpegQuality: (_r = options.jpegQuality) !== null && _r !== void 0 ? _r : 80,
|
|
83
|
+
logLevel: (_s = options.logLevel) !== null && _s !== void 0 ? _s : 'info',
|
|
84
|
+
maxRetries: (_t = options.maxRetries) !== null && _t !== void 0 ? _t : 1,
|
|
85
|
+
muted: (_u = options.muted) !== null && _u !== void 0 ? _u : false,
|
|
86
|
+
numberOfGifLoops: (_v = options.numberOfGifLoops) !== null && _v !== void 0 ? _v : null,
|
|
87
|
+
offthreadVideoCacheSizeInBytes: (_w = options.offthreadVideoCacheSizeInBytes) !== null && _w !== void 0 ? _w : null,
|
|
88
|
+
outName: (_x = options.outName) !== null && _x !== void 0 ? _x : null,
|
|
89
|
+
overwrite: (_y = options.overwrite) !== null && _y !== void 0 ? _y : false,
|
|
90
|
+
pixelFormat: (_z = options.pixelFormat) !== null && _z !== void 0 ? _z : undefined,
|
|
91
|
+
privacy: (_0 = options.privacy) !== null && _0 !== void 0 ? _0 : 'public',
|
|
92
|
+
proResProfile: (_1 = options.proResProfile) !== null && _1 !== void 0 ? _1 : undefined,
|
|
93
|
+
region: options.region,
|
|
94
|
+
rendererFunctionName: (_2 = options.rendererFunctionName) !== null && _2 !== void 0 ? _2 : null,
|
|
95
|
+
scale: (_3 = options.scale) !== null && _3 !== void 0 ? _3 : 1,
|
|
96
|
+
serveUrl: options.serveUrl,
|
|
97
|
+
timeoutInMilliseconds: (_4 = options.timeoutInMilliseconds) !== null && _4 !== void 0 ? _4 : 30000,
|
|
98
|
+
videoBitrate: (_5 = options.videoBitrate) !== null && _5 !== void 0 ? _5 : null,
|
|
99
|
+
encodingMaxRate: (_6 = options.encodingMaxRate) !== null && _6 !== void 0 ? _6 : null,
|
|
100
|
+
encodingBufferSize: (_7 = options.encodingBufferSize) !== null && _7 !== void 0 ? _7 : null,
|
|
101
|
+
webhook: (_8 = options.webhook) !== null && _8 !== void 0 ? _8 : null,
|
|
102
|
+
x264Preset: (_9 = options.x264Preset) !== null && _9 !== void 0 ? _9 : null,
|
|
103
|
+
deleteAfter: (_10 = options.deleteAfter) !== null && _10 !== void 0 ? _10 : null,
|
|
104
|
+
preferLossless: (_11 = options.preferLossless) !== null && _11 !== void 0 ? _11 : false,
|
|
105
|
+
forcePathStyle: (_12 = options.forcePathStyle) !== null && _12 !== void 0 ? _12 : false,
|
|
106
|
+
indent: false,
|
|
107
|
+
metadata: (_13 = options.metadata) !== null && _13 !== void 0 ? _13 : null,
|
|
108
|
+
apiKey: (_14 = options.apiKey) !== null && _14 !== void 0 ? _14 : null,
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
exports.renderMediaOnLambdaOptionalToRequired = renderMediaOnLambdaOptionalToRequired;
|
|
112
|
+
const wrapped = (0, serverless_client_1.wrapWithErrorHandling)(exports.internalRenderMediaOnLambdaRaw);
|
|
113
|
+
/*
|
|
114
|
+
* @description Kicks off a render process on Remotion Lambda. The progress can be tracked using getRenderProgress().
|
|
115
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/rendermediaonlambda)
|
|
116
|
+
*/
|
|
117
|
+
const renderMediaOnLambda = (options) => {
|
|
118
|
+
if (options.quality) {
|
|
119
|
+
throw new Error('quality has been renamed to jpegQuality. Please rename the option.');
|
|
120
|
+
}
|
|
121
|
+
return wrapped((0, exports.renderMediaOnLambdaOptionalToRequired)(options));
|
|
122
|
+
};
|
|
123
|
+
exports.renderMediaOnLambda = renderMediaOnLambda;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Renamed to renderMediaOnLambda()
|
|
126
|
+
*/
|
|
127
|
+
exports.renderVideoOnLambda = exports.renderMediaOnLambda;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BrowserSafeApis, ChromiumOptions, DownloadBehavior, StillImageFormat, ToOptions } from '@remotion/serverless-client';
|
|
2
|
+
import type { CostsInfo, OutNameInput, Privacy, ReceivedArtifact } from '@remotion/serverless-client';
|
|
3
|
+
import { type AwsProvider } from './aws-provider';
|
|
4
|
+
import type { AwsRegion } from './regions';
|
|
5
|
+
type MandatoryParameters = {
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
functionName: string;
|
|
8
|
+
serveUrl: string;
|
|
9
|
+
composition: string;
|
|
10
|
+
inputProps: Record<string, unknown>;
|
|
11
|
+
imageFormat: StillImageFormat;
|
|
12
|
+
privacy: Privacy;
|
|
13
|
+
};
|
|
14
|
+
type OptionalParameters = {
|
|
15
|
+
maxRetries: number;
|
|
16
|
+
envVariables: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Renamed to `jpegQuality`
|
|
19
|
+
*/
|
|
20
|
+
quality?: never;
|
|
21
|
+
frame: number;
|
|
22
|
+
outName: OutNameInput<AwsProvider> | null;
|
|
23
|
+
chromiumOptions: ChromiumOptions;
|
|
24
|
+
downloadBehavior: DownloadBehavior;
|
|
25
|
+
forceWidth: number | null;
|
|
26
|
+
forceHeight: number | null;
|
|
27
|
+
forceBucketName: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Renamed to `logLevel`
|
|
30
|
+
*/
|
|
31
|
+
dumpBrowserLogs: boolean;
|
|
32
|
+
onInit: (data: {
|
|
33
|
+
renderId: string;
|
|
34
|
+
cloudWatchLogs: string;
|
|
35
|
+
lambdaInsightsUrl: string;
|
|
36
|
+
}) => void;
|
|
37
|
+
indent: boolean;
|
|
38
|
+
forcePathStyle: boolean;
|
|
39
|
+
} & ToOptions<typeof BrowserSafeApis.optionsMap.renderStillOnLambda>;
|
|
40
|
+
export type RenderStillOnLambdaNonNullInput = MandatoryParameters & OptionalParameters;
|
|
41
|
+
export type RenderStillOnLambdaInput = MandatoryParameters & Partial<OptionalParameters>;
|
|
42
|
+
export type RenderStillOnLambdaOutput = {
|
|
43
|
+
estimatedPrice: CostsInfo;
|
|
44
|
+
url: string;
|
|
45
|
+
outKey: string;
|
|
46
|
+
sizeInBytes: number;
|
|
47
|
+
bucketName: string;
|
|
48
|
+
renderId: string;
|
|
49
|
+
cloudWatchLogs: string;
|
|
50
|
+
artifacts: ReceivedArtifact<AwsProvider>[];
|
|
51
|
+
};
|
|
52
|
+
export declare const renderStillOnLambda: (input: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStillOnLambda = void 0;
|
|
4
|
+
const serverless_client_1 = require("@remotion/serverless-client");
|
|
5
|
+
const serverless_client_2 = require("@remotion/serverless-client");
|
|
6
|
+
const aws_provider_1 = require("./aws-provider");
|
|
7
|
+
const constants_1 = require("./constants");
|
|
8
|
+
const get_aws_urls_1 = require("./get-aws-urls");
|
|
9
|
+
const make_lambda_payload_1 = require("./make-lambda-payload");
|
|
10
|
+
const internalRenderStillOnLambda = async (input) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const { functionName, region, onInit } = input;
|
|
13
|
+
try {
|
|
14
|
+
const payload = await (0, make_lambda_payload_1.makeLambdaRenderStillPayload)(input);
|
|
15
|
+
const res = await new Promise((resolve, reject) => {
|
|
16
|
+
aws_provider_1.awsImplementation
|
|
17
|
+
.callFunctionStreaming({
|
|
18
|
+
functionName,
|
|
19
|
+
type: serverless_client_1.ServerlessRoutines.still,
|
|
20
|
+
payload,
|
|
21
|
+
region,
|
|
22
|
+
receivedStreamingPayload: ({ message }) => {
|
|
23
|
+
if (message.type === 'render-id-determined') {
|
|
24
|
+
onInit === null || onInit === void 0 ? void 0 : onInit({
|
|
25
|
+
renderId: message.payload.renderId,
|
|
26
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
27
|
+
functionName,
|
|
28
|
+
method: serverless_client_1.ServerlessRoutines.still,
|
|
29
|
+
region,
|
|
30
|
+
rendererFunctionName: null,
|
|
31
|
+
renderId: message.payload.renderId,
|
|
32
|
+
}),
|
|
33
|
+
lambdaInsightsUrl: (0, get_aws_urls_1.getLambdaInsightsUrl)({
|
|
34
|
+
functionName,
|
|
35
|
+
region,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (message.type === 'error-occurred') {
|
|
40
|
+
reject(new Error(message.payload.error));
|
|
41
|
+
}
|
|
42
|
+
if (message.type === 'still-rendered') {
|
|
43
|
+
resolve(message.payload);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
timeoutInTest: 120000,
|
|
47
|
+
retriesRemaining: input.maxRetries,
|
|
48
|
+
})
|
|
49
|
+
.then(() => {
|
|
50
|
+
reject(new Error('Expected response to be streamed'));
|
|
51
|
+
})
|
|
52
|
+
.catch((err) => {
|
|
53
|
+
reject(err);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
estimatedPrice: res.estimatedPrice,
|
|
58
|
+
url: res.output,
|
|
59
|
+
outKey: res.outKey,
|
|
60
|
+
sizeInBytes: res.size,
|
|
61
|
+
bucketName: res.bucketName,
|
|
62
|
+
renderId: res.renderId,
|
|
63
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
64
|
+
functionName,
|
|
65
|
+
method: serverless_client_1.ServerlessRoutines.still,
|
|
66
|
+
region,
|
|
67
|
+
renderId: res.renderId,
|
|
68
|
+
rendererFunctionName: null,
|
|
69
|
+
}),
|
|
70
|
+
artifacts: res.receivedArtifacts,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
|
|
75
|
+
throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
|
|
76
|
+
}
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const errorHandled = (0, serverless_client_2.wrapWithErrorHandling)(internalRenderStillOnLambda);
|
|
81
|
+
/*
|
|
82
|
+
* @description Renders a still image inside a lambda function and writes it to the specified output location.
|
|
83
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/renderstillonlambda)
|
|
84
|
+
*/
|
|
85
|
+
const renderStillOnLambda = (input) => {
|
|
86
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
87
|
+
return errorHandled({
|
|
88
|
+
chromiumOptions: (_a = input.chromiumOptions) !== null && _a !== void 0 ? _a : {},
|
|
89
|
+
composition: input.composition,
|
|
90
|
+
deleteAfter: (_b = input.deleteAfter) !== null && _b !== void 0 ? _b : null,
|
|
91
|
+
downloadBehavior: (_c = input.downloadBehavior) !== null && _c !== void 0 ? _c : { type: 'play-in-browser' },
|
|
92
|
+
envVariables: (_d = input.envVariables) !== null && _d !== void 0 ? _d : {},
|
|
93
|
+
forceBucketName: (_e = input.forceBucketName) !== null && _e !== void 0 ? _e : null,
|
|
94
|
+
forceHeight: (_f = input.forceHeight) !== null && _f !== void 0 ? _f : null,
|
|
95
|
+
forceWidth: (_g = input.forceWidth) !== null && _g !== void 0 ? _g : null,
|
|
96
|
+
frame: (_h = input.frame) !== null && _h !== void 0 ? _h : 0,
|
|
97
|
+
functionName: input.functionName,
|
|
98
|
+
imageFormat: input.imageFormat,
|
|
99
|
+
indent: false,
|
|
100
|
+
inputProps: input.inputProps,
|
|
101
|
+
maxRetries: (_j = input.maxRetries) !== null && _j !== void 0 ? _j : constants_1.DEFAULT_MAX_RETRIES,
|
|
102
|
+
onInit: (_k = input.onInit) !== null && _k !== void 0 ? _k : (() => undefined),
|
|
103
|
+
outName: (_l = input.outName) !== null && _l !== void 0 ? _l : null,
|
|
104
|
+
privacy: input.privacy,
|
|
105
|
+
quality: undefined,
|
|
106
|
+
region: input.region,
|
|
107
|
+
serveUrl: input.serveUrl,
|
|
108
|
+
jpegQuality: (_m = input.jpegQuality) !== null && _m !== void 0 ? _m : 80,
|
|
109
|
+
logLevel: input.dumpBrowserLogs ? 'verbose' : ((_o = input.logLevel) !== null && _o !== void 0 ? _o : 'info'),
|
|
110
|
+
offthreadVideoCacheSizeInBytes: (_p = input.offthreadVideoCacheSizeInBytes) !== null && _p !== void 0 ? _p : null,
|
|
111
|
+
scale: (_q = input.scale) !== null && _q !== void 0 ? _q : 1,
|
|
112
|
+
timeoutInMilliseconds: (_r = input.timeoutInMilliseconds) !== null && _r !== void 0 ? _r : 30000,
|
|
113
|
+
dumpBrowserLogs: false,
|
|
114
|
+
forcePathStyle: (_s = input.forcePathStyle) !== null && _s !== void 0 ? _s : false,
|
|
115
|
+
apiKey: (_t = input.apiKey) !== null && _t !== void 0 ? _t : null,
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
exports.renderStillOnLambda = renderStillOnLambda;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type SpeculateFunctionNameInput = {
|
|
2
|
+
memorySizeInMb: string | number;
|
|
3
|
+
diskSizeInMb: string | number;
|
|
4
|
+
timeoutInSeconds: string | number;
|
|
5
|
+
};
|
|
6
|
+
export declare const speculateFunctionName: ({ memorySizeInMb, diskSizeInMb, timeoutInSeconds, }: SpeculateFunctionNameInput) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.speculateFunctionName = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const lambda_version_string_1 = require("./lambda-version-string");
|
|
6
|
+
/*
|
|
7
|
+
* @description Speculate the name of the Lambda function that will be created by `deployFunction()` or its CLI equivalent, based on the function configuration.
|
|
8
|
+
* @see [Documentation](https://remotion.dev/docs/lambda/speculatefunctionname)
|
|
9
|
+
*/
|
|
10
|
+
const speculateFunctionName = ({ memorySizeInMb, diskSizeInMb, timeoutInSeconds, }) => {
|
|
11
|
+
// find-function-name.ts uses this for templating
|
|
12
|
+
// consider this before adding any validation here
|
|
13
|
+
return [
|
|
14
|
+
`${constants_1.RENDER_FN_PREFIX}${lambda_version_string_1.LAMBDA_VERSION_STRING}`,
|
|
15
|
+
`mem${memorySizeInMb}mb`,
|
|
16
|
+
`disk${diskSizeInMb}mb`,
|
|
17
|
+
`${timeoutInSeconds}sec`,
|
|
18
|
+
].join('-');
|
|
19
|
+
};
|
|
20
|
+
exports.speculateFunctionName = speculateFunctionName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const encode_aws_url_params_1 = require("../encode-aws-url-params");
|
|
5
|
+
(0, bun_test_1.test)('Encode AWS URL test', () => {
|
|
6
|
+
const params = (0, encode_aws_url_params_1.encodeAwsUrlParams)('"method=test"');
|
|
7
|
+
(0, bun_test_1.expect)(params).toBe('$2522method$253Dtest$2522');
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const serverless_client_1 = require("@remotion/serverless-client");
|
|
4
|
+
const bun_test_1 = require("bun:test");
|
|
5
|
+
const aws_provider_1 = require("../aws-provider");
|
|
6
|
+
(0, bun_test_1.test)('Should not throw while calculating prices when time shifts occur', () => {
|
|
7
|
+
const aDate = Date.now();
|
|
8
|
+
process.env.AWS_REGION = 'us-east-1';
|
|
9
|
+
const price = (0, serverless_client_1.estimatePriceFromMetadata)({
|
|
10
|
+
memorySizeInMb: 1024,
|
|
11
|
+
renderMetadata: {
|
|
12
|
+
audioBitrate: null,
|
|
13
|
+
codec: 'h264',
|
|
14
|
+
compositionId: 'react-svg',
|
|
15
|
+
estimatedRenderLambdaInvokations: 10,
|
|
16
|
+
estimatedTotalLambdaInvokations: 10,
|
|
17
|
+
framesPerLambda: 10,
|
|
18
|
+
imageFormat: 'jpeg',
|
|
19
|
+
inputProps: {
|
|
20
|
+
type: 'payload',
|
|
21
|
+
payload: '{}',
|
|
22
|
+
},
|
|
23
|
+
lambdaVersion: '2021-11-29',
|
|
24
|
+
memorySizeInMb: 1024,
|
|
25
|
+
region: 'eu-central-1',
|
|
26
|
+
renderId: '123',
|
|
27
|
+
deleteAfter: null,
|
|
28
|
+
siteId: 'my-site',
|
|
29
|
+
startedDate: aDate + 1000,
|
|
30
|
+
totalChunks: 20,
|
|
31
|
+
type: 'video',
|
|
32
|
+
outName: 'out.mp4',
|
|
33
|
+
privacy: 'public',
|
|
34
|
+
everyNthFrame: 1,
|
|
35
|
+
frameRange: [0, 99],
|
|
36
|
+
audioCodec: null,
|
|
37
|
+
downloadBehavior: { type: 'play-in-browser' },
|
|
38
|
+
numberOfGifLoops: null,
|
|
39
|
+
muted: false,
|
|
40
|
+
metadata: { Author: 'Lunar' },
|
|
41
|
+
functionName: 'remotion-render-la8ffw',
|
|
42
|
+
rendererFunctionName: 'remotion-render-la8ffw',
|
|
43
|
+
dimensions: {
|
|
44
|
+
height: 1080,
|
|
45
|
+
width: 1920,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
diskSizeInMb: 512,
|
|
49
|
+
functionsInvoked: 1,
|
|
50
|
+
timings: [
|
|
51
|
+
{
|
|
52
|
+
chunk: 1,
|
|
53
|
+
rendered: aDate - 2000,
|
|
54
|
+
start: aDate,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
region: 'eu-central-1',
|
|
58
|
+
providerSpecifics: aws_provider_1.awsImplementation,
|
|
59
|
+
});
|
|
60
|
+
(0, bun_test_1.expect)(price === null || price === void 0 ? void 0 : price.accruedSoFar).toBeGreaterThanOrEqual(0);
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const estimate_price_1 = require("../estimate-price");
|
|
5
|
+
(0, bun_test_1.test)('Should calculate costs accurately', () => {
|
|
6
|
+
(0, bun_test_1.expect)((0, estimate_price_1.estimatePrice)({
|
|
7
|
+
region: 'us-east-1',
|
|
8
|
+
durationInMiliseconds: 20000000,
|
|
9
|
+
memorySizeInMb: 2048,
|
|
10
|
+
diskSizeInMb: 512,
|
|
11
|
+
lambdasInvoked: 1,
|
|
12
|
+
})).toEqual(0.53334);
|
|
13
|
+
(0, bun_test_1.expect)((0, estimate_price_1.estimatePrice)({
|
|
14
|
+
region: 'us-east-1',
|
|
15
|
+
durationInMilliseconds: 20000000,
|
|
16
|
+
memorySizeInMb: 2048,
|
|
17
|
+
diskSizeInMb: 10240,
|
|
18
|
+
lambdasInvoked: 1,
|
|
19
|
+
})).toEqual(0.53921);
|
|
20
|
+
(0, bun_test_1.expect)((0, estimate_price_1.estimatePrice)({
|
|
21
|
+
region: 'us-east-1',
|
|
22
|
+
durationInMiliseconds: 20000000,
|
|
23
|
+
memorySizeInMb: 2048,
|
|
24
|
+
diskSizeInMb: 10240,
|
|
25
|
+
lambdasInvoked: 1,
|
|
26
|
+
})).toEqual(0.53921);
|
|
27
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const validate_disk_size_in_mb_1 = require("../validate-disk-size-in-mb");
|
|
5
|
+
(0, bun_test_1.test)('Disk size tests', () => {
|
|
6
|
+
(0, bun_test_1.expect)(() => (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(512)).not.toThrow();
|
|
7
|
+
(0, bun_test_1.expect)(() => (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(10240)).not.toThrow();
|
|
8
|
+
(0, bun_test_1.expect)(() => {
|
|
9
|
+
(0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(0);
|
|
10
|
+
}).toThrow(/parameter 'diskSizeInMb' must be between 512 and 10240, but got 0/);
|
|
11
|
+
(0, bun_test_1.expect)(() => {
|
|
12
|
+
(0, validate_disk_size_in_mb_1.validateDiskSizeInMb)({});
|
|
13
|
+
}).toThrow(/parameter 'diskSizeInMb' must be a number, got a object/);
|
|
14
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAwsRegion = validateAwsRegion;
|
|
4
|
+
const regions_1 = require("./regions");
|
|
5
|
+
function validateAwsRegion(region) {
|
|
6
|
+
if (!regions_1.AWS_REGIONS.includes(region)) {
|
|
7
|
+
throw new TypeError(`${region} is not a supported AWS region. Must be one of: ${regions_1.AWS_REGIONS.join(', ')}`);
|
|
8
|
+
}
|
|
9
|
+
}
|