@remotion/lambda-client 4.0.398 → 4.0.400

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 (143) hide show
  1. package/dist/cjs/index.d.ts +2 -2
  2. package/dist/cjs/index.js +7 -1
  3. package/dist/cjs/make-lambda-payload.d.ts +2 -2
  4. package/dist/esm/index.mjs +7 -1
  5. package/package.json +3 -3
  6. package/dist/app-router-webhook.d.ts +0 -10
  7. package/dist/app-router-webhook.js +0 -43
  8. package/dist/apply-lifecycle.d.ts +0 -8
  9. package/dist/apply-lifecycle.js +0 -18
  10. package/dist/aws-clients.d.ts +0 -12
  11. package/dist/aws-clients.js +0 -56
  12. package/dist/aws-provider.d.ts +0 -27
  13. package/dist/aws-provider.js +0 -94
  14. package/dist/bucket-exists.d.ts +0 -3
  15. package/dist/bucket-exists.js +0 -27
  16. package/dist/call-lambda-async.d.ts +0 -2
  17. package/dist/call-lambda-async.js +0 -20
  18. package/dist/call-lambda-streaming.d.ts +0 -6
  19. package/dist/call-lambda-streaming.js +0 -126
  20. package/dist/call-lambda-sync.d.ts +0 -2
  21. package/dist/call-lambda-sync.js +0 -30
  22. package/dist/check-credentials.d.ts +0 -1
  23. package/dist/check-credentials.js +0 -39
  24. package/dist/clean-items.d.ts +0 -17
  25. package/dist/clean-items.js +0 -26
  26. package/dist/constants.d.ts +0 -25
  27. package/dist/constants.js +0 -26
  28. package/dist/content-disposition-header.d.ts +0 -2
  29. package/dist/content-disposition-header.js +0 -50
  30. package/dist/convert-to-serve-url.d.ts +0 -6
  31. package/dist/convert-to-serve-url.js +0 -14
  32. package/dist/create-bucket.d.ts +0 -3
  33. package/dist/create-bucket.js +0 -65
  34. package/dist/delete-file.d.ts +0 -3
  35. package/dist/delete-file.js +0 -17
  36. package/dist/delete-function.d.ts +0 -7
  37. package/dist/delete-function.js +0 -15
  38. package/dist/delete-render.d.ts +0 -22
  39. package/dist/delete-render.js +0 -90
  40. package/dist/encode-aws-url-params.d.ts +0 -1
  41. package/dist/encode-aws-url-params.js +0 -7
  42. package/dist/estimate-price.d.ts +0 -17
  43. package/dist/estimate-price.js +0 -45
  44. package/dist/express-webhook.d.ts +0 -3
  45. package/dist/express-webhook.js +0 -46
  46. package/dist/get-account-id.d.ts +0 -3
  47. package/dist/get-account-id.js +0 -15
  48. package/dist/get-aws-client.d.ts +0 -32
  49. package/dist/get-aws-client.js +0 -67
  50. package/dist/get-aws-urls.d.ts +0 -25
  51. package/dist/get-aws-urls.js +0 -31
  52. package/dist/get-buckets.d.ts +0 -9
  53. package/dist/get-buckets.js +0 -64
  54. package/dist/get-compositions-on-lambda.d.ts +0 -20
  55. package/dist/get-compositions-on-lambda.js +0 -62
  56. package/dist/get-credentials.d.ts +0 -9
  57. package/dist/get-credentials.js +0 -55
  58. package/dist/get-env-variable.d.ts +0 -1
  59. package/dist/get-env-variable.js +0 -15
  60. package/dist/get-function-name.d.ts +0 -8
  61. package/dist/get-function-name.js +0 -17
  62. package/dist/get-function-version.d.ts +0 -9
  63. package/dist/get-function-version.js +0 -35
  64. package/dist/get-functions.d.ts +0 -10
  65. package/dist/get-functions.js +0 -80
  66. package/dist/get-output-url-from-metadata.d.ts +0 -3
  67. package/dist/get-output-url-from-metadata.js +0 -18
  68. package/dist/get-render-progress.d.ts +0 -17
  69. package/dist/get-render-progress.js +0 -47
  70. package/dist/get-s3-client.d.ts +0 -11
  71. package/dist/get-s3-client.js +0 -15
  72. package/dist/get-service-client.d.ts +0 -25
  73. package/dist/get-service-client.js +0 -131
  74. package/dist/get-sites.d.ts +0 -31
  75. package/dist/get-sites.js +0 -83
  76. package/dist/head-file.d.ts +0 -3
  77. package/dist/head-file.js +0 -18
  78. package/dist/index.d.ts +0 -129
  79. package/dist/index.js +0 -108
  80. package/dist/is-cli.d.ts +0 -2
  81. package/dist/is-cli.js +0 -10
  82. package/dist/is-flaky-error.d.ts +0 -1
  83. package/dist/is-flaky-error.js +0 -78
  84. package/dist/is-in-lambda.d.ts +0 -1
  85. package/dist/is-in-lambda.js +0 -9
  86. package/dist/is-likely-to-have-aws-profile.d.ts +0 -1
  87. package/dist/is-likely-to-have-aws-profile.js +0 -50
  88. package/dist/lambda-version-string.d.ts +0 -1
  89. package/dist/lambda-version-string.js +0 -7
  90. package/dist/lifecycle-rules.d.ts +0 -12
  91. package/dist/lifecycle-rules.js +0 -73
  92. package/dist/lifecycle.d.ts +0 -7
  93. package/dist/lifecycle.js +0 -24
  94. package/dist/list-objects.d.ts +0 -3
  95. package/dist/list-objects.js +0 -70
  96. package/dist/make-lambda-payload.d.ts +0 -59
  97. package/dist/make-lambda-payload.js +0 -150
  98. package/dist/make-s3-url.d.ts +0 -6
  99. package/dist/make-s3-url.js +0 -7
  100. package/dist/p-limit.d.ts +0 -1
  101. package/dist/p-limit.js +0 -57
  102. package/dist/pages-router-webhook.d.ts +0 -5
  103. package/dist/pages-router-webhook.js +0 -48
  104. package/dist/parse-function-name.d.ts +0 -8
  105. package/dist/parse-function-name.js +0 -17
  106. package/dist/presign-url.d.ts +0 -17
  107. package/dist/presign-url.js +0 -66
  108. package/dist/price-per-1s.d.ts +0 -37
  109. package/dist/price-per-1s.js +0 -822
  110. package/dist/random-hash.d.ts +0 -1
  111. package/dist/random-hash.js +0 -13
  112. package/dist/read-file.d.ts +0 -11
  113. package/dist/read-file.js +0 -19
  114. package/dist/regions.d.ts +0 -3
  115. package/dist/regions.js +0 -48
  116. package/dist/render-media-on-lambda.d.ts +0 -66
  117. package/dist/render-media-on-lambda.js +0 -133
  118. package/dist/render-still-on-lambda.d.ts +0 -61
  119. package/dist/render-still-on-lambda.js +0 -121
  120. package/dist/runtime-preference.d.ts +0 -2
  121. package/dist/runtime-preference.js +0 -8
  122. package/dist/speculate-function-name.d.ts +0 -7
  123. package/dist/speculate-function-name.js +0 -39
  124. package/dist/types.d.ts +0 -4
  125. package/dist/types.js +0 -2
  126. package/dist/validate-aws-region.d.ts +0 -2
  127. package/dist/validate-aws-region.js +0 -9
  128. package/dist/validate-bucketname.d.ts +0 -4
  129. package/dist/validate-bucketname.js +0 -15
  130. package/dist/validate-disk-size-in-mb.d.ts +0 -1
  131. package/dist/validate-disk-size-in-mb.js +0 -23
  132. package/dist/validate-lambda-codec.d.ts +0 -2
  133. package/dist/validate-lambda-codec.js +0 -21
  134. package/dist/validate-memory-size.d.ts +0 -1
  135. package/dist/validate-memory-size.js +0 -22
  136. package/dist/validate-presign-expiration.d.ts +0 -1
  137. package/dist/validate-presign-expiration.js +0 -29
  138. package/dist/validate-serveurl.d.ts +0 -1
  139. package/dist/validate-serveurl.js +0 -9
  140. package/dist/validate-webhook-signature.d.ts +0 -5
  141. package/dist/validate-webhook-signature.js +0 -28
  142. package/dist/write-file.d.ts +0 -5
  143. package/dist/write-file.js +0 -83
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFlakyError = void 0;
4
- const isFlakyError = (err) => {
5
- var _a;
6
- const message = (_a = err.stack) !== null && _a !== void 0 ? _a : '';
7
- // storage.googleapis.com sometimes returns 500s, and Video does not have retry on its own
8
- if ((message.includes('Format error') || message.includes('audio metadata')) &&
9
- message.includes('storage.googleapis.com')) {
10
- return true;
11
- }
12
- if (message.includes('FATAL:zygote_communication_linux.cc')) {
13
- return true;
14
- }
15
- if (message.includes('error while loading shared libraries: libnss3.so')) {
16
- return true;
17
- }
18
- if (message.includes('but the server sent no data')) {
19
- return true;
20
- }
21
- if (message.includes('Compositor panicked')) {
22
- return true;
23
- }
24
- // S3 in rare occasions
25
- if (message.includes('We encountered an internal error.')) {
26
- return true;
27
- }
28
- if (message.includes('Compositor exited') && !message.includes('SIGSEGV')) {
29
- return true;
30
- }
31
- if (message.includes('Timed out') &&
32
- message.includes('while setting up the headless browser')) {
33
- return true;
34
- }
35
- // https://github.com/remotion-dev/remotion/issues/2742
36
- if (message.includes('while trying to connect to the browser')) {
37
- return true;
38
- }
39
- // https://discord.com/channels/809501355504959528/1131234931863998665/1131998442219118622
40
- if (message.includes('RequestTimeout: Your socket connection to the server')) {
41
- return true;
42
- }
43
- if (message.includes('waiting for the page to render the React component')) {
44
- return true;
45
- }
46
- // In puppeteer-evaluate.ts
47
- if (message.includes('Timed out evaluating page function')) {
48
- return true;
49
- }
50
- if (message.includes('Timeout exceeded rendering the component')) {
51
- return true;
52
- }
53
- // CDN slowness
54
- if (message.includes('Loading root component')) {
55
- return true;
56
- }
57
- // Internet flakiness
58
- if (message.includes('getaddrinfo') ||
59
- message.includes('ECONNRESET') ||
60
- message.includes('ERR_CONNECTION_TIMED_OUT') ||
61
- message.includes('ERR_NETWORK_CHANGED') ||
62
- message.includes('A network error occurred') ||
63
- message.includes('socket hang up')) {
64
- return true;
65
- }
66
- if (message.includes('Target closed') || message.includes('Session closed')) {
67
- return true;
68
- }
69
- if (message.includes('SIGKILL')) {
70
- return true;
71
- }
72
- // ServiceException: We currently do not have sufficient capacity in the region you requested. Our system will be working on provisioning additional capacity. You can avoid getting this error by temporarily reducing your request rate.
73
- if (message.includes('ServiceException: We currently do not have sufficient capacity in the region you requested')) {
74
- return true;
75
- }
76
- return false;
77
- };
78
- exports.isFlakyError = isFlakyError;
@@ -1 +0,0 @@
1
- export declare const isInsideLambda: () => boolean;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isInsideLambda = void 0;
4
- const isInsideLambda = () => {
5
- var _a;
6
- return Boolean(typeof process !== 'undefined' &&
7
- ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.__RESERVED_IS_INSIDE_REMOTION_LAMBDA));
8
- };
9
- exports.isInsideLambda = isInsideLambda;
@@ -1 +0,0 @@
1
- export declare const isLikelyToHaveAwsProfile: () => boolean;
@@ -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) => void;