@remotion/lambda-client 4.0.369 → 4.0.371

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.
Files changed (141) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.mjs +1 -1
  3. package/package.json +3 -3
  4. package/dist/app-router-webhook.d.ts +0 -10
  5. package/dist/app-router-webhook.js +0 -51
  6. package/dist/apply-lifecycle.d.ts +0 -8
  7. package/dist/apply-lifecycle.js +0 -18
  8. package/dist/aws-clients.d.ts +0 -12
  9. package/dist/aws-clients.js +0 -56
  10. package/dist/aws-provider.d.ts +0 -27
  11. package/dist/aws-provider.js +0 -94
  12. package/dist/bucket-exists.d.ts +0 -3
  13. package/dist/bucket-exists.js +0 -27
  14. package/dist/call-lambda-async.d.ts +0 -2
  15. package/dist/call-lambda-async.js +0 -20
  16. package/dist/call-lambda-streaming.d.ts +0 -6
  17. package/dist/call-lambda-streaming.js +0 -126
  18. package/dist/call-lambda-sync.d.ts +0 -2
  19. package/dist/call-lambda-sync.js +0 -30
  20. package/dist/check-credentials.d.ts +0 -1
  21. package/dist/check-credentials.js +0 -39
  22. package/dist/clean-items.d.ts +0 -17
  23. package/dist/clean-items.js +0 -26
  24. package/dist/constants.d.ts +0 -25
  25. package/dist/constants.js +0 -26
  26. package/dist/content-disposition-header.d.ts +0 -2
  27. package/dist/content-disposition-header.js +0 -50
  28. package/dist/convert-to-serve-url.d.ts +0 -6
  29. package/dist/convert-to-serve-url.js +0 -14
  30. package/dist/create-bucket.d.ts +0 -3
  31. package/dist/create-bucket.js +0 -65
  32. package/dist/delete-file.d.ts +0 -3
  33. package/dist/delete-file.js +0 -17
  34. package/dist/delete-function.d.ts +0 -7
  35. package/dist/delete-function.js +0 -15
  36. package/dist/delete-render.d.ts +0 -22
  37. package/dist/delete-render.js +0 -90
  38. package/dist/encode-aws-url-params.d.ts +0 -1
  39. package/dist/encode-aws-url-params.js +0 -7
  40. package/dist/estimate-price.d.ts +0 -17
  41. package/dist/estimate-price.js +0 -45
  42. package/dist/express-webhook.d.ts +0 -3
  43. package/dist/express-webhook.js +0 -54
  44. package/dist/get-account-id.d.ts +0 -3
  45. package/dist/get-account-id.js +0 -15
  46. package/dist/get-aws-client.d.ts +0 -32
  47. package/dist/get-aws-client.js +0 -67
  48. package/dist/get-aws-urls.d.ts +0 -25
  49. package/dist/get-aws-urls.js +0 -31
  50. package/dist/get-buckets.d.ts +0 -9
  51. package/dist/get-buckets.js +0 -64
  52. package/dist/get-compositions-on-lambda.d.ts +0 -20
  53. package/dist/get-compositions-on-lambda.js +0 -62
  54. package/dist/get-credentials.d.ts +0 -9
  55. package/dist/get-credentials.js +0 -55
  56. package/dist/get-env-variable.d.ts +0 -1
  57. package/dist/get-env-variable.js +0 -15
  58. package/dist/get-function-name.d.ts +0 -8
  59. package/dist/get-function-name.js +0 -17
  60. package/dist/get-function-version.d.ts +0 -9
  61. package/dist/get-function-version.js +0 -35
  62. package/dist/get-functions.d.ts +0 -10
  63. package/dist/get-functions.js +0 -80
  64. package/dist/get-output-url-from-metadata.d.ts +0 -3
  65. package/dist/get-output-url-from-metadata.js +0 -18
  66. package/dist/get-render-progress.d.ts +0 -17
  67. package/dist/get-render-progress.js +0 -47
  68. package/dist/get-s3-client.d.ts +0 -11
  69. package/dist/get-s3-client.js +0 -15
  70. package/dist/get-service-client.d.ts +0 -25
  71. package/dist/get-service-client.js +0 -131
  72. package/dist/get-sites.d.ts +0 -31
  73. package/dist/get-sites.js +0 -83
  74. package/dist/head-file.d.ts +0 -3
  75. package/dist/head-file.js +0 -18
  76. package/dist/index.d.ts +0 -129
  77. package/dist/index.js +0 -108
  78. package/dist/is-cli.d.ts +0 -2
  79. package/dist/is-cli.js +0 -10
  80. package/dist/is-flaky-error.d.ts +0 -1
  81. package/dist/is-flaky-error.js +0 -78
  82. package/dist/is-in-lambda.d.ts +0 -1
  83. package/dist/is-in-lambda.js +0 -9
  84. package/dist/is-likely-to-have-aws-profile.d.ts +0 -1
  85. package/dist/is-likely-to-have-aws-profile.js +0 -50
  86. package/dist/lambda-version-string.d.ts +0 -1
  87. package/dist/lambda-version-string.js +0 -7
  88. package/dist/lifecycle-rules.d.ts +0 -12
  89. package/dist/lifecycle-rules.js +0 -73
  90. package/dist/lifecycle.d.ts +0 -7
  91. package/dist/lifecycle.js +0 -24
  92. package/dist/list-objects.d.ts +0 -3
  93. package/dist/list-objects.js +0 -70
  94. package/dist/make-lambda-payload.d.ts +0 -59
  95. package/dist/make-lambda-payload.js +0 -150
  96. package/dist/make-s3-url.d.ts +0 -6
  97. package/dist/make-s3-url.js +0 -7
  98. package/dist/p-limit.d.ts +0 -1
  99. package/dist/p-limit.js +0 -57
  100. package/dist/pages-router-webhook.d.ts +0 -5
  101. package/dist/pages-router-webhook.js +0 -56
  102. package/dist/parse-function-name.d.ts +0 -8
  103. package/dist/parse-function-name.js +0 -17
  104. package/dist/presign-url.d.ts +0 -17
  105. package/dist/presign-url.js +0 -66
  106. package/dist/price-per-1s.d.ts +0 -37
  107. package/dist/price-per-1s.js +0 -822
  108. package/dist/random-hash.d.ts +0 -1
  109. package/dist/random-hash.js +0 -13
  110. package/dist/read-file.d.ts +0 -11
  111. package/dist/read-file.js +0 -19
  112. package/dist/regions.d.ts +0 -3
  113. package/dist/regions.js +0 -48
  114. package/dist/render-media-on-lambda.d.ts +0 -66
  115. package/dist/render-media-on-lambda.js +0 -133
  116. package/dist/render-still-on-lambda.d.ts +0 -61
  117. package/dist/render-still-on-lambda.js +0 -121
  118. package/dist/runtime-preference.d.ts +0 -2
  119. package/dist/runtime-preference.js +0 -8
  120. package/dist/speculate-function-name.d.ts +0 -7
  121. package/dist/speculate-function-name.js +0 -39
  122. package/dist/types.d.ts +0 -4
  123. package/dist/types.js +0 -2
  124. package/dist/validate-aws-region.d.ts +0 -2
  125. package/dist/validate-aws-region.js +0 -9
  126. package/dist/validate-bucketname.d.ts +0 -4
  127. package/dist/validate-bucketname.js +0 -15
  128. package/dist/validate-disk-size-in-mb.d.ts +0 -1
  129. package/dist/validate-disk-size-in-mb.js +0 -23
  130. package/dist/validate-lambda-codec.d.ts +0 -2
  131. package/dist/validate-lambda-codec.js +0 -21
  132. package/dist/validate-memory-size.d.ts +0 -1
  133. package/dist/validate-memory-size.js +0 -22
  134. package/dist/validate-presign-expiration.d.ts +0 -1
  135. package/dist/validate-presign-expiration.js +0 -29
  136. package/dist/validate-serveurl.d.ts +0 -1
  137. package/dist/validate-serveurl.js +0 -9
  138. package/dist/validate-webhook-signature.d.ts +0 -5
  139. package/dist/validate-webhook-signature.js +0 -28
  140. package/dist/write-file.d.ts +0 -5
  141. package/dist/write-file.js +0 -83
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLikelyToHaveAwsProfile = void 0;
4
- const fs_1 = require("fs");
5
- const os_1 = require("os");
6
- const path_1 = require("path");
7
- const get_env_variable_1 = require("./get-env-variable");
8
- const homeDirCache = {};
9
- const getHomeDirCacheKey = () => {
10
- // geteuid is only available on POSIX platforms (i.e. not Windows or Android).
11
- if (process && process.geteuid) {
12
- return `${process.geteuid()}`;
13
- }
14
- return 'DEFAULT';
15
- };
16
- const getHomeDir = () => {
17
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${path_1.sep}` } = process.env;
18
- if (HOME)
19
- return HOME;
20
- if (USERPROFILE)
21
- return USERPROFILE;
22
- if (HOMEPATH)
23
- return `${HOMEDRIVE}${HOMEPATH}`;
24
- const homeDirCacheKey = getHomeDirCacheKey();
25
- if (!homeDirCache[homeDirCacheKey])
26
- homeDirCache[homeDirCacheKey] = (0, os_1.homedir)();
27
- return homeDirCache[homeDirCacheKey];
28
- };
29
- const ENV_CREDENTIALS_PATH = 'AWS_SHARED_CREDENTIALS_FILE';
30
- // Logic is inline to https://github.com/smithy-lang/smithy-typescript/blob/main/packages/shared-ini-file-loader/src/getCredentialsFilepath.ts#L7
31
- const pathOfCredentialsFile = () => {
32
- return ((0, get_env_variable_1.getEnvVariable)(ENV_CREDENTIALS_PATH) ||
33
- (0, path_1.join)(getHomeDir(), '.aws', 'credentials'));
34
- };
35
- const isLikelyToHaveAwsProfile = () => {
36
- // Supabase uses Deno and does not support readFile
37
- // https://github.com/remotion-dev/remotion/issues/4844
38
- if (typeof Deno !== 'undefined') {
39
- return false;
40
- }
41
- const credentialsFile = pathOfCredentialsFile();
42
- try {
43
- const content = (0, fs_1.readFileSync)(credentialsFile, 'utf-8');
44
- return content.includes('[default]');
45
- }
46
- catch (_a) {
47
- return false;
48
- }
49
- };
50
- exports.isLikelyToHaveAwsProfile = isLikelyToHaveAwsProfile;
@@ -1 +0,0 @@
1
- export declare const LAMBDA_VERSION_STRING: string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LAMBDA_VERSION_STRING = void 0;
4
- const serverless_client_1 = require("@remotion/serverless-client");
5
- exports.LAMBDA_VERSION_STRING = serverless_client_1.VERSION.replace(/\./g, '-')
6
- .replace(/\+/g, '-')
7
- .substring(0, 10);
@@ -1,12 +0,0 @@
1
- import type { CustomCredentials } from '@remotion/serverless-client';
2
- import type { AwsProvider } from './aws-provider';
3
- import type { AwsRegion } from './regions';
4
- import type { RequestHandler } from './types';
5
- export declare const applyLifeCyleOperation: ({ enableFolderExpiry, bucketName, region, customCredentials, forcePathStyle, requestHandler, }: {
6
- enableFolderExpiry: boolean | null;
7
- bucketName: string;
8
- region: AwsRegion;
9
- customCredentials: CustomCredentials<AwsProvider> | null;
10
- forcePathStyle: boolean;
11
- requestHandler: RequestHandler | null;
12
- }) => Promise<void>;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyLifeCyleOperation = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const apply_lifecycle_1 = require("./apply-lifecycle");
6
- const get_s3_client_1 = require("./get-s3-client");
7
- const lifecycle_1 = require("./lifecycle");
8
- const createLCRules = async ({ bucketName, region, customCredentials, forcePathStyle, requestHandler, }) => {
9
- var _a;
10
- const lcRules = (0, lifecycle_1.getLifeCycleRules)();
11
- // create the lifecyle rules
12
- const createCommandInput = (0, apply_lifecycle_1.createLifeCycleInput)({
13
- bucketName,
14
- lcRules,
15
- });
16
- const createCommand = new client_s3_1.PutBucketLifecycleConfigurationCommand(createCommandInput);
17
- try {
18
- await (0, get_s3_client_1.getS3Client)({
19
- region,
20
- customCredentials,
21
- forcePathStyle,
22
- requestHandler,
23
- }).send(createCommand);
24
- }
25
- catch (err) {
26
- if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('AccessDenied')) {
27
- throw new Error(`You don't have the required permissions to create lifecycle rules on the bucket "${bucketName}", but the "enableFolderExpiry" was set to true. Ensure that your user has the "s3:PutLifecycleConfiguration" permission.`);
28
- }
29
- }
30
- };
31
- const deleteLCRules = async ({ bucketName, region, customCredentials, forcePathStyle, requestHandler, }) => {
32
- var _a;
33
- const deleteCommandInput = (0, apply_lifecycle_1.deleteLifeCycleInput)({
34
- bucketName,
35
- });
36
- try {
37
- await (0, get_s3_client_1.getS3Client)({
38
- region,
39
- customCredentials,
40
- forcePathStyle,
41
- requestHandler,
42
- }).send(new client_s3_1.DeleteBucketLifecycleCommand(deleteCommandInput));
43
- }
44
- catch (err) {
45
- if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('AccessDenied')) {
46
- throw new Error(`You don't have the required permissions to delete lifecycle rules on the bucket "${bucketName}", but the "enableFolderExpiry" option was set to "false". Ensure that your user has the "s3:PutLifecycleConfiguration" permission. Set "enableFolderExpiry" to "null" to not overwrite any existing lifecycle rules.`);
47
- }
48
- }
49
- };
50
- const applyLifeCyleOperation = async ({ enableFolderExpiry, bucketName, region, customCredentials, forcePathStyle, requestHandler, }) => {
51
- if (enableFolderExpiry === null) {
52
- return;
53
- }
54
- if (enableFolderExpiry === true) {
55
- await createLCRules({
56
- bucketName,
57
- region,
58
- customCredentials,
59
- forcePathStyle,
60
- requestHandler,
61
- });
62
- }
63
- else {
64
- await deleteLCRules({
65
- bucketName,
66
- region,
67
- customCredentials,
68
- forcePathStyle,
69
- requestHandler,
70
- });
71
- }
72
- };
73
- exports.applyLifeCyleOperation = applyLifeCyleOperation;
@@ -1,7 +0,0 @@
1
- import type { LifecycleRule } from '@aws-sdk/client-s3';
2
- import type { CloudProvider, DeleteAfter, ProviderSpecifics } from '@remotion/serverless-client';
3
- export declare const getLifeCycleRules: () => LifecycleRule[];
4
- export declare const generateRandomHashWithLifeCycleRule: <Provider extends CloudProvider>({ deleteAfter, randomHashFn, }: {
5
- deleteAfter: DeleteAfter | null;
6
- randomHashFn: ProviderSpecifics<Provider>["randomHash"];
7
- }) => string;
package/dist/lifecycle.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateRandomHashWithLifeCycleRule = exports.getLifeCycleRules = void 0;
4
- const serverless_client_1 = require("@remotion/serverless-client");
5
- const getEnabledLifeCycleRule = ({ key, value, }) => {
6
- return {
7
- Expiration: {
8
- Days: value,
9
- },
10
- Filter: {
11
- Prefix: `renders/${key}`,
12
- },
13
- ID: `delete-after-${key}`,
14
- Status: 'Enabled',
15
- };
16
- };
17
- const getLifeCycleRules = () => {
18
- return Object.entries(serverless_client_1.expiryDays).map(([key, value]) => getEnabledLifeCycleRule({ key, value }));
19
- };
20
- exports.getLifeCycleRules = getLifeCycleRules;
21
- const generateRandomHashWithLifeCycleRule = ({ deleteAfter, randomHashFn, }) => {
22
- return [deleteAfter, randomHashFn()].filter(serverless_client_1.truthy).join('-');
23
- };
24
- exports.generateRandomHashWithLifeCycleRule = generateRandomHashWithLifeCycleRule;
@@ -1,3 +0,0 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless-client';
2
- import type { AwsProvider } from './aws-provider';
3
- export declare const lambdaLsImplementation: ProviderSpecifics<AwsProvider>['listObjects'];
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lambdaLsImplementation = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const get_s3_client_1 = require("./get-s3-client");
6
- const lambdaLsImplementation = async ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, forcePathStyle, requestHandler, }) => {
7
- var _a, _b, _c, _d;
8
- try {
9
- const list = await (0, get_s3_client_1.getS3Client)({
10
- region,
11
- customCredentials: null,
12
- forcePathStyle,
13
- requestHandler,
14
- }).send(new client_s3_1.ListObjectsV2Command({
15
- Bucket: bucketName,
16
- Prefix: prefix,
17
- ExpectedBucketOwner: expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined,
18
- ContinuationToken: continuationToken,
19
- }));
20
- if (list.NextContinuationToken) {
21
- return [
22
- ...((_a = list.Contents) !== null && _a !== void 0 ? _a : []).map((o) => {
23
- return {
24
- Key: o.Key,
25
- LastModified: o.LastModified,
26
- ETag: o.ETag,
27
- Size: o.Size,
28
- };
29
- }),
30
- ...(await (0, exports.lambdaLsImplementation)({
31
- bucketName,
32
- prefix,
33
- expectedBucketOwner,
34
- region,
35
- continuationToken: list.NextContinuationToken,
36
- forcePathStyle,
37
- requestHandler,
38
- })),
39
- ];
40
- }
41
- return ((_c = (_b = (list.Contents || [])) === null || _b === void 0 ? void 0 : _b.map((o) => {
42
- return {
43
- Key: o.Key,
44
- LastModified: o.LastModified,
45
- ETag: o.ETag,
46
- Size: o.Size,
47
- };
48
- })) !== null && _c !== void 0 ? _c : []);
49
- }
50
- catch (err) {
51
- if (!expectedBucketOwner) {
52
- throw err;
53
- }
54
- // Prevent from accessing a foreign bucket, retry without ExpectedBucketOwner and see if it works. If it works then it's an owner mismatch.
55
- if ((_d = err.stack) === null || _d === void 0 ? void 0 : _d.includes('AccessDenied')) {
56
- await (0, get_s3_client_1.getS3Client)({
57
- region,
58
- customCredentials: null,
59
- forcePathStyle,
60
- requestHandler,
61
- }).send(new client_s3_1.ListObjectsV2Command({
62
- Bucket: bucketName,
63
- Prefix: prefix,
64
- }));
65
- throw new Error(`Bucket owner mismatch: Expected the bucket ${bucketName} to be owned by you (AWS Account ID: ${expectedBucketOwner}) but it's not the case. Did you accidentially specify the wrong bucket?`);
66
- }
67
- throw err;
68
- }
69
- };
70
- exports.lambdaLsImplementation = lambdaLsImplementation;
@@ -1,59 +0,0 @@
1
- import type { AudioCodec, BrowserSafeApis, ChromiumOptions, ColorSpace, DeleteAfter, DownloadBehavior, FrameRange, LogLevel, OutNameInput, PixelFormat, Privacy, ProResProfile, ServerlessCodec, ServerlessPayloads, ServerlessStartPayload, ServerlessStatusPayload, ToOptions, VideoImageFormat, WebhookOption, X264Preset } from '@remotion/serverless-client';
2
- import { ServerlessRoutines } from '@remotion/serverless-client';
3
- import type { AwsProvider } from './aws-provider';
4
- import type { StorageClass } from '@aws-sdk/client-s3';
5
- import type { GetRenderProgressInput } from './get-render-progress';
6
- import type { AwsRegion } from './regions';
7
- import type { RenderStillOnLambdaNonNullInput } from './render-still-on-lambda';
8
- import type { RequestHandler } from './types';
9
- export type InnerRenderMediaOnLambdaInput = {
10
- region: AwsRegion;
11
- functionName: string;
12
- serveUrl: string;
13
- composition: string;
14
- inputProps: Record<string, unknown>;
15
- codec: ServerlessCodec;
16
- imageFormat: VideoImageFormat;
17
- crf: number | undefined;
18
- envVariables: Record<string, string>;
19
- pixelFormat: PixelFormat | undefined;
20
- proResProfile: ProResProfile | undefined;
21
- x264Preset: X264Preset | null;
22
- privacy: Privacy;
23
- jpegQuality: number;
24
- maxRetries: number;
25
- framesPerLambda: number | null;
26
- concurrency: number | null;
27
- logLevel: LogLevel;
28
- frameRange: FrameRange | null;
29
- outName: OutNameInput<AwsProvider> | null;
30
- timeoutInMilliseconds: number;
31
- chromiumOptions: ChromiumOptions;
32
- scale: number;
33
- everyNthFrame: number;
34
- numberOfGifLoops: number | null;
35
- concurrencyPerLambda: number;
36
- downloadBehavior: DownloadBehavior;
37
- muted: boolean;
38
- overwrite: boolean;
39
- audioBitrate: string | null;
40
- videoBitrate: string | null;
41
- encodingMaxRate: string | null;
42
- encodingBufferSize: string | null;
43
- webhook: WebhookOption | null;
44
- forceWidth: number | null;
45
- forceHeight: number | null;
46
- rendererFunctionName: string | null;
47
- forceBucketName: string | null;
48
- audioCodec: AudioCodec | null;
49
- colorSpace: ColorSpace | null;
50
- deleteAfter: DeleteAfter | null;
51
- indent: boolean;
52
- forcePathStyle: boolean;
53
- metadata: Record<string, string> | null;
54
- storageClass: StorageClass | null;
55
- requestHandler: RequestHandler | null;
56
- } & ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>;
57
- export declare const makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, concurrency, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, mediaCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, forcePathStyle, metadata, apiKey, offthreadVideoThreads, storageClass, requestHandler, }: InnerRenderMediaOnLambdaInput) => Promise<ServerlessStartPayload<AwsProvider>>;
58
- export declare const getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, logLevel, forcePathStyle, }: GetRenderProgressInput) => ServerlessStatusPayload<AwsProvider>;
59
- export declare const makeLambdaRenderStillPayload: ({ serveUrl, inputProps, imageFormat, envVariables, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, forcePathStyle, apiKey, storageClass, requestHandler, offthreadVideoThreads, mediaCacheSizeInBytes, }: RenderStillOnLambdaNonNullInput) => Promise<ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]>;
@@ -1,150 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeLambdaRenderStillPayload = exports.getRenderProgressPayload = exports.makeLambdaRenderMediaPayload = void 0;
4
- const serverless_client_1 = require("@remotion/serverless-client");
5
- const aws_provider_1 = require("./aws-provider");
6
- const serverless_client_2 = require("@remotion/serverless-client");
7
- const validate_lambda_codec_1 = require("./validate-lambda-codec");
8
- const validate_serveurl_1 = require("./validate-serveurl");
9
- const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange, framesPerLambda, concurrency, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, encodingMaxRate, encodingBufferSize, downloadBehavior, muted, overwrite, jpegQuality, offthreadVideoCacheSizeInBytes, mediaCacheSizeInBytes, deleteAfter, colorSpace, preferLossless, forcePathStyle, metadata, apiKey, offthreadVideoThreads, storageClass, requestHandler, }) => {
10
- const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
11
- (0, validate_serveurl_1.validateServeUrl)(serveUrl);
12
- (0, serverless_client_1.validateDownloadBehavior)(downloadBehavior);
13
- (0, serverless_client_2.validateWebhook)(webhook);
14
- const stringifiedInputProps = (0, serverless_client_1.serializeOrThrow)(inputProps !== null && inputProps !== void 0 ? inputProps : {}, 'input-props');
15
- const serialized = await (0, serverless_client_1.compressInputProps)({
16
- stringifiedInputProps,
17
- region,
18
- needsToUpload: (0, serverless_client_1.getNeedsToUpload)({
19
- type: 'video-or-audio',
20
- sizes: [
21
- stringifiedInputProps.length,
22
- JSON.stringify(envVariables).length,
23
- ],
24
- providerSpecifics: aws_provider_1.awsImplementation,
25
- }),
26
- userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
27
- propsType: 'input-props',
28
- providerSpecifics: aws_provider_1.awsImplementation,
29
- forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
30
- skipPutAcl: privacy === 'no-acl',
31
- requestHandler: requestHandler !== null && requestHandler !== void 0 ? requestHandler : null,
32
- });
33
- return {
34
- rendererFunctionName,
35
- framesPerLambda,
36
- concurrency,
37
- composition,
38
- serveUrl,
39
- inputProps: serialized,
40
- codec: actualCodec,
41
- imageFormat,
42
- crf: crf !== null && crf !== void 0 ? crf : null,
43
- envVariables,
44
- pixelFormat: pixelFormat !== null && pixelFormat !== void 0 ? pixelFormat : null,
45
- proResProfile: proResProfile !== null && proResProfile !== void 0 ? proResProfile : null,
46
- x264Preset,
47
- jpegQuality,
48
- maxRetries,
49
- privacy,
50
- logLevel,
51
- frameRange,
52
- outName,
53
- timeoutInMilliseconds,
54
- chromiumOptions,
55
- scale,
56
- everyNthFrame,
57
- numberOfGifLoops,
58
- concurrencyPerLambda,
59
- downloadBehavior,
60
- muted,
61
- version: serverless_client_1.VERSION,
62
- overwrite: overwrite !== null && overwrite !== void 0 ? overwrite : serverless_client_1.ENABLE_V5_BREAKING_CHANGES,
63
- audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
64
- videoBitrate: videoBitrate !== null && videoBitrate !== void 0 ? videoBitrate : null,
65
- encodingBufferSize: encodingBufferSize !== null && encodingBufferSize !== void 0 ? encodingBufferSize : null,
66
- encodingMaxRate: encodingMaxRate !== null && encodingMaxRate !== void 0 ? encodingMaxRate : null,
67
- webhook: webhook !== null && webhook !== void 0 ? webhook : null,
68
- forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
69
- forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
70
- bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
71
- audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
72
- type: serverless_client_1.ServerlessRoutines.start,
73
- offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
74
- deleteAfter: deleteAfter !== null && deleteAfter !== void 0 ? deleteAfter : null,
75
- colorSpace: colorSpace !== null && colorSpace !== void 0 ? colorSpace : null,
76
- preferLossless: preferLossless !== null && preferLossless !== void 0 ? preferLossless : false,
77
- forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
78
- metadata: metadata !== null && metadata !== void 0 ? metadata : null,
79
- apiKey: apiKey !== null && apiKey !== void 0 ? apiKey : null,
80
- offthreadVideoThreads: offthreadVideoThreads !== null && offthreadVideoThreads !== void 0 ? offthreadVideoThreads : null,
81
- mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
82
- storageClass: storageClass !== null && storageClass !== void 0 ? storageClass : null,
83
- };
84
- };
85
- exports.makeLambdaRenderMediaPayload = makeLambdaRenderMediaPayload;
86
- const getRenderProgressPayload = ({ bucketName, renderId, s3OutputProvider, logLevel, forcePathStyle, }) => {
87
- return {
88
- type: serverless_client_1.ServerlessRoutines.status,
89
- bucketName,
90
- renderId,
91
- version: serverless_client_1.VERSION,
92
- s3OutputProvider: s3OutputProvider !== null && s3OutputProvider !== void 0 ? s3OutputProvider : null,
93
- logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
94
- forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
95
- };
96
- };
97
- exports.getRenderProgressPayload = getRenderProgressPayload;
98
- const makeLambdaRenderStillPayload = async ({ serveUrl, inputProps, imageFormat, envVariables, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, offthreadVideoCacheSizeInBytes, deleteAfter, forcePathStyle, apiKey, storageClass, requestHandler, offthreadVideoThreads, mediaCacheSizeInBytes, }) => {
99
- const stringifiedInputProps = (0, serverless_client_1.serializeOrThrow)(inputProps, 'input-props');
100
- const serializedInputProps = await (0, serverless_client_1.compressInputProps)({
101
- stringifiedInputProps,
102
- region,
103
- needsToUpload: (0, serverless_client_1.getNeedsToUpload)({
104
- type: 'still',
105
- sizes: [
106
- stringifiedInputProps.length,
107
- JSON.stringify(envVariables).length,
108
- ],
109
- providerSpecifics: aws_provider_1.awsImplementation,
110
- }),
111
- userSpecifiedBucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
112
- propsType: 'input-props',
113
- providerSpecifics: aws_provider_1.awsImplementation,
114
- forcePathStyle,
115
- skipPutAcl: privacy === 'no-acl',
116
- requestHandler,
117
- });
118
- return {
119
- composition,
120
- serveUrl,
121
- inputProps: serializedInputProps,
122
- imageFormat,
123
- envVariables,
124
- jpegQuality,
125
- maxRetries,
126
- frame,
127
- privacy,
128
- attempt: 1,
129
- logLevel,
130
- outName,
131
- timeoutInMilliseconds,
132
- chromiumOptions,
133
- scale,
134
- downloadBehavior,
135
- version: serverless_client_1.VERSION,
136
- forceHeight,
137
- forceWidth,
138
- bucketName: forceBucketName,
139
- offthreadVideoCacheSizeInBytes,
140
- deleteAfter,
141
- type: serverless_client_1.ServerlessRoutines.still,
142
- streamed: true,
143
- forcePathStyle,
144
- apiKey: apiKey !== null && apiKey !== void 0 ? apiKey : null,
145
- offthreadVideoThreads: offthreadVideoThreads !== null && offthreadVideoThreads !== void 0 ? offthreadVideoThreads : null,
146
- mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
147
- storageClass: storageClass !== null && storageClass !== void 0 ? storageClass : null,
148
- };
149
- };
150
- exports.makeLambdaRenderStillPayload = makeLambdaRenderStillPayload;
@@ -1,6 +0,0 @@
1
- import type { AwsRegion } from './regions';
2
- export declare const makeS3ServeUrl: ({ bucketName, subFolder, region, }: {
3
- bucketName: string;
4
- subFolder: string;
5
- region: AwsRegion;
6
- }) => string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeS3ServeUrl = void 0;
4
- const makeS3ServeUrl = ({ bucketName, subFolder, region, }) => {
5
- return `https://${bucketName}.s3.${region}.amazonaws.com/${subFolder}/index.html`;
6
- };
7
- exports.makeS3ServeUrl = makeS3ServeUrl;
package/dist/p-limit.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const pLimit: (concurrency: number) => <Arguments extends unknown[], ReturnType>(fn: (..._arguments: Arguments) => PromiseLike<ReturnType> | ReturnType, ...args: Arguments) => Promise<ReturnType>;
package/dist/p-limit.js DELETED
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pLimit = void 0;
4
- const pLimit = (concurrency) => {
5
- const queue = [];
6
- let activeCount = 0;
7
- const next = () => {
8
- var _a;
9
- activeCount--;
10
- if (queue.length > 0) {
11
- (_a = queue.shift()) === null || _a === void 0 ? void 0 : _a();
12
- }
13
- };
14
- const run = async (fn, resolve, ...args) => {
15
- activeCount++;
16
- // eslint-disable-next-line require-await
17
- const result = (async () => fn(...args))();
18
- resolve(result);
19
- try {
20
- await result;
21
- }
22
- catch (_a) { }
23
- next();
24
- };
25
- const enqueue = (fn, resolve, ...args) => {
26
- queue.push(() => run(fn, resolve, ...args));
27
- (async () => {
28
- var _a;
29
- // This function needs to wait until the next microtask before comparing
30
- // `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
31
- // when the run function is dequeued and called. The comparison in the if-statement
32
- // needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
33
- await Promise.resolve();
34
- if (activeCount < concurrency && queue.length > 0) {
35
- (_a = queue.shift()) === null || _a === void 0 ? void 0 : _a();
36
- }
37
- })();
38
- };
39
- const generator = (fn, ...args) => new Promise((resolve) => {
40
- enqueue(fn, resolve, ...args);
41
- });
42
- Object.defineProperties(generator, {
43
- activeCount: {
44
- get: () => activeCount,
45
- },
46
- pendingCount: {
47
- get: () => queue.length,
48
- },
49
- clearQueue: {
50
- value: () => {
51
- queue.length = 0;
52
- },
53
- },
54
- });
55
- return generator;
56
- };
57
- exports.pLimit = pLimit;
@@ -1,5 +0,0 @@
1
- import type { Response } from 'express';
2
- import type { NextApiRequest, NextApiResponse } from 'next';
3
- import type { NextWebhookArgs } from './app-router-webhook';
4
- export declare const addHeaders: (res: NextApiResponse | Response, headers: Record<string, string>) => void;
5
- export declare const pagesRouterWebhook: (options: NextWebhookArgs) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pagesRouterWebhook = exports.addHeaders = void 0;
4
- const validate_webhook_signature_1 = require("./validate-webhook-signature");
5
- const addHeaders = (res, headers) => {
6
- Object.entries(headers).forEach(([key, value]) => {
7
- res.setHeader(key, value);
8
- });
9
- };
10
- exports.addHeaders = addHeaders;
11
- const pagesRouterWebhook = (options) => {
12
- const { testing, extraHeaders, secret, onSuccess, onTimeout, onError } = options;
13
- return async function (req, res) {
14
- (0, exports.addHeaders)(res, extraHeaders || {});
15
- if (testing) {
16
- const testingheaders = {
17
- 'Access-Control-Allow-Origin': 'https://www.remotion.dev',
18
- 'Access-Control-Allow-Headers': 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, X-Remotion-Status, X-Remotion-Signature, X-Remotion-Mode',
19
- 'Access-Control-Allow-Methods': 'OPTIONS,POST',
20
- };
21
- (0, exports.addHeaders)(res, testingheaders);
22
- }
23
- if (req.method === 'OPTIONS') {
24
- res.status(200).end();
25
- return;
26
- }
27
- try {
28
- (0, validate_webhook_signature_1.validateWebhookSignature)({
29
- secret,
30
- body: req.body,
31
- signatureHeader: req.headers['x-remotion-signature'],
32
- });
33
- // If code reaches this path, the webhook is authentic.
34
- const payload = req.body;
35
- if (payload.type === 'success' && onSuccess) {
36
- await onSuccess(payload);
37
- }
38
- else if (payload.type === 'timeout' && onTimeout) {
39
- await onTimeout(payload);
40
- }
41
- else if (payload.type === 'error' && onError) {
42
- await onError(payload);
43
- }
44
- res.status(200).json({
45
- success: true,
46
- });
47
- }
48
- catch (err) {
49
- res.status(500).json({
50
- success: false,
51
- error: err instanceof Error ? err.message : String(err),
52
- });
53
- }
54
- };
55
- };
56
- exports.pagesRouterWebhook = pagesRouterWebhook;
@@ -1,8 +0,0 @@
1
- type ReturnType = {
2
- version: string;
3
- memorySizeInMb: number;
4
- diskSizeInMb: number;
5
- timeoutInSeconds: number;
6
- };
7
- export declare const parseFunctionName: (functionName: string) => ReturnType | null;
8
- export {};
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFunctionName = void 0;
4
- const constants_1 = require("./constants");
5
- const parseFunctionName = (functionName) => {
6
- const match = functionName.match(new RegExp(constants_1.RENDER_FN_PREFIX + '(.*)-mem(\\d+)mb-disk(\\d+)mb-(\\d+)sec$'));
7
- if (!match) {
8
- return null;
9
- }
10
- return {
11
- version: match[1],
12
- memorySizeInMb: parseInt(match[2], 10),
13
- diskSizeInMb: parseInt(match[3], 10),
14
- timeoutInSeconds: parseInt(match[4], 10),
15
- };
16
- };
17
- exports.parseFunctionName = parseFunctionName;
@@ -1,17 +0,0 @@
1
- import type { AwsRegion } from './regions';
2
- import type { RequestHandler } from './types';
3
- type MandatoryParameters = {
4
- region: AwsRegion;
5
- bucketName: string;
6
- objectKey: string;
7
- expiresInSeconds: number;
8
- };
9
- type OptionalParameters<CheckIfObjectExists extends boolean> = {
10
- checkIfObjectExists: CheckIfObjectExists;
11
- forcePathStyle: boolean;
12
- };
13
- export type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> = MandatoryParameters & Partial<OptionalParameters<CheckIfObjectExists>> & {
14
- requestHandler?: RequestHandler;
15
- };
16
- export declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, forcePathStyle, requestHandler, }: PresignUrlInput<CheckIfObjectExists>) => Promise<CheckIfObjectExists extends true ? string | null : string>;
17
- export {};