@remotion/lambda 4.0.259 → 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.
Files changed (221) hide show
  1. package/build.ts +1 -1
  2. package/dist/admin/make-layer-public.js +3 -3
  3. package/dist/api/create-function.d.ts +1 -2
  4. package/dist/api/create-function.js +8 -8
  5. package/dist/api/delete-site.d.ts +2 -2
  6. package/dist/api/delete-site.js +3 -4
  7. package/dist/api/deploy-function.d.ts +2 -2
  8. package/dist/api/deploy-function.js +9 -13
  9. package/dist/api/deploy-site.d.ts +2 -2
  10. package/dist/api/deploy-site.js +19 -13
  11. package/dist/api/download-media.d.ts +3 -3
  12. package/dist/api/download-media.js +11 -5
  13. package/dist/api/get-function-info.d.ts +1 -1
  14. package/dist/api/get-function-info.js +6 -8
  15. package/dist/api/get-or-create-bucket.d.ts +3 -3
  16. package/dist/api/get-or-create-bucket.js +4 -4
  17. package/dist/api/get-regions.d.ts +1 -1
  18. package/dist/api/get-regions.js +1 -1
  19. package/dist/api/iam-validation/role-permissions.js +6 -7
  20. package/dist/api/iam-validation/simulate-rule.d.ts +1 -1
  21. package/dist/api/iam-validation/simulate-rule.js +2 -2
  22. package/dist/api/iam-validation/simulate.d.ts +1 -1
  23. package/dist/api/iam-validation/simulate.js +2 -2
  24. package/dist/api/iam-validation/user-permissions.js +4 -5
  25. package/dist/api/upload-dir.d.ts +2 -3
  26. package/dist/api/upload-dir.js +7 -4
  27. package/dist/cli/args.d.ts +2 -4
  28. package/dist/cli/commands/compositions/index.d.ts +1 -1
  29. package/dist/cli/commands/compositions/index.js +5 -6
  30. package/dist/cli/commands/functions/deploy.d.ts +1 -1
  31. package/dist/cli/commands/functions/deploy.js +8 -9
  32. package/dist/cli/commands/functions/index.d.ts +1 -1
  33. package/dist/cli/commands/functions/index.js +6 -6
  34. package/dist/cli/commands/functions/ls.d.ts +1 -1
  35. package/dist/cli/commands/functions/rm.js +4 -4
  36. package/dist/cli/commands/functions/rmall.d.ts +1 -1
  37. package/dist/cli/commands/functions/rmall.js +2 -2
  38. package/dist/cli/commands/policies/policies.js +5 -5
  39. package/dist/cli/commands/quotas/increase.js +5 -5
  40. package/dist/cli/commands/quotas/list.js +4 -4
  41. package/dist/cli/commands/render/progress.js +4 -4
  42. package/dist/cli/commands/render/render.d.ts +1 -1
  43. package/dist/cli/commands/render/render.js +13 -16
  44. package/dist/cli/commands/sites/create.d.ts +1 -1
  45. package/dist/cli/commands/sites/create.js +9 -5
  46. package/dist/cli/commands/sites/index.d.ts +1 -1
  47. package/dist/cli/commands/sites/index.js +6 -6
  48. package/dist/cli/commands/sites/ls.js +2 -2
  49. package/dist/cli/commands/sites/rm.d.ts +1 -1
  50. package/dist/cli/commands/sites/rm.js +4 -4
  51. package/dist/cli/commands/sites/rmall.d.ts +1 -1
  52. package/dist/cli/commands/sites/rmall.js +4 -4
  53. package/dist/cli/commands/still.d.ts +1 -1
  54. package/dist/cli/commands/still.js +10 -12
  55. package/dist/cli/get-aws-region.d.ts +1 -1
  56. package/dist/cli/get-aws-region.js +6 -7
  57. package/dist/cli/help.js +10 -10
  58. package/dist/cli/helpers/find-function-name.d.ts +1 -1
  59. package/dist/cli/helpers/find-function-name.js +5 -5
  60. package/dist/cli/index.d.ts +2 -2
  61. package/dist/cli/index.js +15 -17
  62. package/dist/cli/log.d.ts +5 -5
  63. package/dist/client.d.ts +1 -19
  64. package/dist/client.js +15 -30
  65. package/dist/defaults.d.ts +1 -1
  66. package/dist/defaults.js +1 -1
  67. package/dist/functions/aws-server-implementation.d.ts +2 -1
  68. package/dist/functions/aws-server-implementation.js +11 -2
  69. package/dist/functions/full-client-implementation.d.ts +1 -1
  70. package/dist/functions/full-client-implementation.js +0 -2
  71. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  72. package/dist/functions/helpers/get-folder-files.d.ts +1 -1
  73. package/dist/functions/helpers/make-aws-artifact.d.ts +1 -1
  74. package/dist/functions/helpers/read-with-progress.d.ts +2 -3
  75. package/dist/functions/helpers/read-with-progress.js +6 -2
  76. package/dist/functions/index.d.ts +2 -3
  77. package/dist/functions/index.js +2 -4
  78. package/dist/index.d.ts +13 -32
  79. package/dist/index.js +24 -35
  80. package/dist/internals.d.ts +8 -12
  81. package/dist/internals.js +0 -4
  82. package/dist/shared/get-layers.d.ts +1 -4
  83. package/dist/shared/get-layers.js +3 -3
  84. package/dist/shared/get-s3-operations.d.ts +1 -1
  85. package/dist/shared/hosted-layers.d.ts +1 -1
  86. package/dist/shared/lambda-insights-extensions.d.ts +1 -1
  87. package/dist/shared/validate-timeout.js +3 -3
  88. package/package.json +22 -30
  89. package/remotionlambda-arm64.zip +0 -0
  90. package/dist/api/app-router-webhook.d.ts +0 -10
  91. package/dist/api/app-router-webhook.js +0 -43
  92. package/dist/api/bucket-exists.d.ts +0 -3
  93. package/dist/api/bucket-exists.js +0 -26
  94. package/dist/api/clean-items.d.ts +0 -16
  95. package/dist/api/clean-items.js +0 -25
  96. package/dist/api/create-bucket.d.ts +0 -3
  97. package/dist/api/create-bucket.js +0 -45
  98. package/dist/api/delete-function.d.ts +0 -4
  99. package/dist/api/delete-function.js +0 -15
  100. package/dist/api/delete-render.d.ts +0 -20
  101. package/dist/api/delete-render.js +0 -78
  102. package/dist/api/estimate-price.d.ts +0 -17
  103. package/dist/api/estimate-price.js +0 -45
  104. package/dist/api/express-webhook.d.ts +0 -3
  105. package/dist/api/express-webhook.js +0 -46
  106. package/dist/api/get-aws-client.d.ts +0 -30
  107. package/dist/api/get-aws-client.js +0 -56
  108. package/dist/api/get-buckets.d.ts +0 -9
  109. package/dist/api/get-buckets.js +0 -62
  110. package/dist/api/get-compositions-on-lambda.d.ts +0 -20
  111. package/dist/api/get-compositions-on-lambda.js +0 -60
  112. package/dist/api/get-functions.d.ts +0 -9
  113. package/dist/api/get-functions.js +0 -77
  114. package/dist/api/get-render-progress.d.ts +0 -16
  115. package/dist/api/get-render-progress.js +0 -45
  116. package/dist/api/get-sites.d.ts +0 -29
  117. package/dist/api/get-sites.js +0 -79
  118. package/dist/api/make-lambda-payload.d.ts +0 -57
  119. package/dist/api/make-lambda-payload.js +0 -150
  120. package/dist/api/pages-router-webhook.d.ts +0 -5
  121. package/dist/api/pages-router-webhook.js +0 -48
  122. package/dist/api/presign-url.d.ts +0 -14
  123. package/dist/api/presign-url.js +0 -59
  124. package/dist/api/render-media-on-lambda.d.ts +0 -63
  125. package/dist/api/render-media-on-lambda.js +0 -128
  126. package/dist/api/render-still-on-lambda.d.ts +0 -56
  127. package/dist/api/render-still-on-lambda.js +0 -118
  128. package/dist/api/speculate-function-name.d.ts +0 -6
  129. package/dist/api/speculate-function-name.js +0 -20
  130. package/dist/api/validate-webhook-signature.d.ts +0 -5
  131. package/dist/api/validate-webhook-signature.js +0 -28
  132. package/dist/cli/is-cli.d.ts +0 -2
  133. package/dist/cli/is-cli.js +0 -10
  134. package/dist/functions/aws-implementation.d.ts +0 -23
  135. package/dist/functions/aws-implementation.js +0 -97
  136. package/dist/functions/helpers/apply-lifecyle.d.ts +0 -8
  137. package/dist/functions/helpers/apply-lifecyle.js +0 -18
  138. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +0 -3
  139. package/dist/functions/helpers/get-output-url-from-metadata.js +0 -12
  140. package/dist/functions/helpers/lifecycle.d.ts +0 -8
  141. package/dist/functions/helpers/lifecycle.js +0 -24
  142. package/dist/functions/helpers/parse-function-name.d.ts +0 -8
  143. package/dist/functions/helpers/parse-function-name.js +0 -17
  144. package/dist/functions/http-client.d.ts +0 -2
  145. package/dist/functions/http-client.js +0 -18
  146. package/dist/io/delete-file.d.ts +0 -3
  147. package/dist/io/delete-file.js +0 -12
  148. package/dist/io/head-file.d.ts +0 -3
  149. package/dist/io/head-file.js +0 -17
  150. package/dist/io/list-objects.d.ts +0 -3
  151. package/dist/io/list-objects.js +0 -67
  152. package/dist/io/read-file.d.ts +0 -9
  153. package/dist/io/read-file.js +0 -18
  154. package/dist/io/write-file.d.ts +0 -5
  155. package/dist/io/write-file.js +0 -55
  156. package/dist/pricing/price-per-1-s.d.ts +0 -37
  157. package/dist/pricing/price-per-1-s.js +0 -822
  158. package/dist/regions.d.ts +0 -3
  159. package/dist/regions.js +0 -48
  160. package/dist/shared/aws-clients.d.ts +0 -11
  161. package/dist/shared/aws-clients.js +0 -51
  162. package/dist/shared/call-lambda-async.d.ts +0 -3
  163. package/dist/shared/call-lambda-async.js +0 -20
  164. package/dist/shared/call-lambda-streaming.d.ts +0 -7
  165. package/dist/shared/call-lambda-streaming.js +0 -126
  166. package/dist/shared/call-lambda-sync.d.ts +0 -3
  167. package/dist/shared/call-lambda-sync.js +0 -30
  168. package/dist/shared/check-credentials.d.ts +0 -1
  169. package/dist/shared/check-credentials.js +0 -39
  170. package/dist/shared/constants.d.ts +0 -26
  171. package/dist/shared/constants.js +0 -29
  172. package/dist/shared/content-disposition-header.d.ts +0 -2
  173. package/dist/shared/content-disposition-header.js +0 -50
  174. package/dist/shared/convert-to-serve-url.d.ts +0 -6
  175. package/dist/shared/convert-to-serve-url.js +0 -14
  176. package/dist/shared/encode-aws-url-params.d.ts +0 -1
  177. package/dist/shared/encode-aws-url-params.js +0 -7
  178. package/dist/shared/get-account-id.d.ts +0 -3
  179. package/dist/shared/get-account-id.js +0 -15
  180. package/dist/shared/get-aws-urls.d.ts +0 -26
  181. package/dist/shared/get-aws-urls.js +0 -31
  182. package/dist/shared/get-credentials.d.ts +0 -9
  183. package/dist/shared/get-credentials.js +0 -55
  184. package/dist/shared/get-env-variable.d.ts +0 -1
  185. package/dist/shared/get-env-variable.js +0 -15
  186. package/dist/shared/get-function-version.d.ts +0 -7
  187. package/dist/shared/get-function-version.js +0 -32
  188. package/dist/shared/get-s3-client.d.ts +0 -9
  189. package/dist/shared/get-s3-client.js +0 -14
  190. package/dist/shared/get-service-client.d.ts +0 -23
  191. package/dist/shared/get-service-client.js +0 -121
  192. package/dist/shared/is-flaky-error.d.ts +0 -1
  193. package/dist/shared/is-flaky-error.js +0 -77
  194. package/dist/shared/is-in-lambda.d.ts +0 -1
  195. package/dist/shared/is-in-lambda.js +0 -9
  196. package/dist/shared/is-likely-to-have-aws-profile.d.ts +0 -1
  197. package/dist/shared/is-likely-to-have-aws-profile.js +0 -50
  198. package/dist/shared/lambda-version-string.d.ts +0 -1
  199. package/dist/shared/lambda-version-string.js +0 -7
  200. package/dist/shared/lifecycle-rules.d.ts +0 -10
  201. package/dist/shared/lifecycle-rules.js +0 -61
  202. package/dist/shared/make-s3-url.d.ts +0 -6
  203. package/dist/shared/make-s3-url.js +0 -7
  204. package/dist/shared/p-limit.d.ts +0 -1
  205. package/dist/shared/p-limit.js +0 -57
  206. package/dist/shared/random-hash.d.ts +0 -1
  207. package/dist/shared/random-hash.js +0 -13
  208. package/dist/shared/validate-aws-region.d.ts +0 -2
  209. package/dist/shared/validate-aws-region.js +0 -9
  210. package/dist/shared/validate-bucketname.d.ts +0 -4
  211. package/dist/shared/validate-bucketname.js +0 -15
  212. package/dist/shared/validate-disk-size-in-mb.d.ts +0 -1
  213. package/dist/shared/validate-disk-size-in-mb.js +0 -23
  214. package/dist/shared/validate-lambda-codec.d.ts +0 -2
  215. package/dist/shared/validate-lambda-codec.js +0 -21
  216. package/dist/shared/validate-memory-size.d.ts +0 -1
  217. package/dist/shared/validate-memory-size.js +0 -22
  218. package/dist/shared/validate-presign-expiration.d.ts +0 -1
  219. package/dist/shared/validate-presign-expiration.js +0 -29
  220. package/dist/shared/validate-serveurl.d.ts +0 -1
  221. package/dist/shared/validate-serveurl.js +0 -9
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createBucket = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const get_s3_client_1 = require("../shared/get-s3-client");
6
- const createBucket = async ({ region, bucketName, forcePathStyle }) => {
7
- await (0, get_s3_client_1.getS3Client)({ region, customCredentials: null, forcePathStyle }).send(new client_s3_1.CreateBucketCommand({
8
- Bucket: bucketName,
9
- }));
10
- try {
11
- await (0, get_s3_client_1.getS3Client)({ region, customCredentials: null, forcePathStyle }).send(new client_s3_1.DeleteBucketOwnershipControlsCommand({
12
- Bucket: bucketName,
13
- }));
14
- }
15
- catch (err) {
16
- if (err.message.includes('Access Denied')) {
17
- throw new Error('Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
18
- }
19
- throw err;
20
- }
21
- try {
22
- await (0, get_s3_client_1.getS3Client)({ region, customCredentials: null, forcePathStyle }).send(new client_s3_1.DeletePublicAccessBlockCommand({
23
- Bucket: bucketName,
24
- }));
25
- }
26
- catch (err) {
27
- if (err.message.includes('Access Denied')) {
28
- throw new Error('PARTIAL SUCCESS: The s3:PutBucketOwnershipControls was found, but the s3:PutBucketPublicAccessBlock permission is not given. Since April 2023, more AWS permissions are required to create an S3 bucket. You need to update your user policy to continue. You need to update your user policy to continue. See https://remotion.dev/docs/lambda/s3-public-access for instructions on how to resolve this issue.');
29
- }
30
- throw err;
31
- }
32
- try {
33
- await (0, get_s3_client_1.getS3Client)({ region, customCredentials: null, forcePathStyle }).send(new client_s3_1.PutBucketAclCommand({
34
- Bucket: bucketName,
35
- ACL: 'public-read',
36
- }));
37
- }
38
- catch (err) {
39
- if (err.message.includes('The bucket does not allow ACLs')) {
40
- throw new Error(`Could not add an ACL to the bucket. This might have happened because the bucket was already successfully created before but then failed to configure correctly. We recommend to delete the bucket (${bucketName}) if it is empty and start over to fix the problem.`);
41
- }
42
- throw err;
43
- }
44
- };
45
- exports.createBucket = createBucket;
@@ -1,4 +0,0 @@
1
- import type { DeleteFunction, DeleteFunctionInput as GenericDeleteFunctionInput } from '@remotion/serverless';
2
- import type { AwsProvider } from '../functions/aws-implementation';
3
- export type DeleteFunctionInput = GenericDeleteFunctionInput<AwsProvider>;
4
- export declare const deleteFunction: DeleteFunction<AwsProvider>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteFunction = void 0;
4
- const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const aws_clients_1 = require("../shared/aws-clients");
6
- /*
7
- * @description Deletes a deployed Lambda function based on its name.
8
- * @see [Documentation](https://remotion.dev/docs/lambda/deletefunction)
9
- */
10
- const deleteFunction = async ({ region, functionName, }) => {
11
- await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.DeleteFunctionCommand({
12
- FunctionName: functionName,
13
- }));
14
- };
15
- exports.deleteFunction = deleteFunction;
@@ -1,20 +0,0 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless';
2
- import { type CustomCredentials } from '@remotion/serverless/client';
3
- import type { AwsProvider } from '../functions/aws-implementation';
4
- import type { AwsRegion } from '../regions';
5
- export type DeleteRenderInput = {
6
- region: AwsRegion;
7
- bucketName: string;
8
- renderId: string;
9
- customCredentials?: CustomCredentials<AwsProvider>;
10
- forcePathStyle?: boolean;
11
- };
12
- export declare const internalDeleteRender: (input: DeleteRenderInput & {
13
- providerSpecifics: ProviderSpecifics<AwsProvider>;
14
- forcePathStyle: boolean;
15
- }) => Promise<{
16
- freedBytes: number;
17
- }>;
18
- export declare const deleteRender: (input: DeleteRenderInput) => Promise<{
19
- freedBytes: number;
20
- }>;
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteRender = exports.internalDeleteRender = void 0;
4
- const client_1 = require("@remotion/serverless/client");
5
- const aws_implementation_1 = require("../functions/aws-implementation");
6
- const clean_items_1 = require("./clean-items");
7
- const internalDeleteRender = async (input) => {
8
- var _a;
9
- const expectedBucketOwner = await input.providerSpecifics.getAccountId({
10
- region: input.region,
11
- });
12
- const progress = await (0, client_1.getOverallProgressFromStorage)({
13
- bucketName: input.bucketName,
14
- expectedBucketOwner,
15
- region: input.region,
16
- renderId: input.renderId,
17
- providerSpecifics: input.providerSpecifics,
18
- forcePathStyle: input.forcePathStyle,
19
- });
20
- // Render did not start yet
21
- if (progress.renderMetadata === null) {
22
- return { freedBytes: 0 };
23
- }
24
- const { key, renderBucketName, customCredentials } = (0, client_1.getExpectedOutName)(progress.renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
25
- await input.providerSpecifics.deleteFile({
26
- bucketName: renderBucketName,
27
- customCredentials,
28
- key,
29
- region: input.region,
30
- forcePathStyle: input.forcePathStyle,
31
- });
32
- let files = await input.providerSpecifics.listObjects({
33
- bucketName: input.bucketName,
34
- prefix: (0, client_1.rendersPrefix)(input.renderId),
35
- region: input.region,
36
- expectedBucketOwner,
37
- forcePathStyle: input.forcePathStyle,
38
- });
39
- let totalSize = 0;
40
- while (files.length > 0) {
41
- totalSize += files.reduce((a, b) => {
42
- var _a;
43
- return a + ((_a = b.Size) !== null && _a !== void 0 ? _a : 0);
44
- }, 0);
45
- await (0, clean_items_1.cleanItems)({
46
- list: files.map((f) => f.Key),
47
- bucket: input.bucketName,
48
- onAfterItemDeleted: () => undefined,
49
- onBeforeItemDeleted: () => undefined,
50
- region: input.region,
51
- providerSpecifics: input.providerSpecifics,
52
- forcePathStyle: input.forcePathStyle,
53
- });
54
- files = await input.providerSpecifics.listObjects({
55
- bucketName: input.bucketName,
56
- prefix: (0, client_1.rendersPrefix)(input.renderId),
57
- region: input.region,
58
- expectedBucketOwner,
59
- forcePathStyle: input.forcePathStyle,
60
- });
61
- }
62
- return {
63
- freedBytes: totalSize,
64
- };
65
- };
66
- exports.internalDeleteRender = internalDeleteRender;
67
- /*
68
- * @description Deletes a rendered video, audio or still and its associated metadata.
69
- * @see [Documentation](https://remotion.dev/docs/lambda/deleterender)
70
- */
71
- const deleteRender = (input) => {
72
- return (0, exports.internalDeleteRender)({
73
- ...input,
74
- providerSpecifics: aws_implementation_1.awsImplementation,
75
- forcePathStyle: false,
76
- });
77
- };
78
- exports.deleteRender = deleteRender;
@@ -1,17 +0,0 @@
1
- import type { AwsRegion } from '../regions';
2
- type Miliseconds = {
3
- /**
4
- * @deprecated Typo in property name. Use `durationInMilliseconds` instead.
5
- */
6
- durationInMiliseconds: number;
7
- } | {
8
- durationInMilliseconds: number;
9
- };
10
- export type EstimatePriceInput = {
11
- region: AwsRegion;
12
- memorySizeInMb: number;
13
- diskSizeInMb: number;
14
- lambdasInvoked: number;
15
- } & Miliseconds;
16
- export declare const estimatePrice: ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }: EstimatePriceInput) => number;
17
- export {};
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.estimatePrice = void 0;
4
- const defaults_1 = require("../defaults");
5
- const price_per_1_s_1 = require("../pricing/price-per-1-s");
6
- const validate_aws_region_1 = require("../shared/validate-aws-region");
7
- const validate_disk_size_in_mb_1 = require("../shared/validate-disk-size-in-mb");
8
- const validate_memory_size_1 = require("../shared/validate-memory-size");
9
- /*
10
- * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
11
- * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
12
- */
13
- const estimatePrice = ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }) => {
14
- (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
15
- (0, validate_aws_region_1.validateAwsRegion)(region);
16
- (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
17
- const durationInMilliseconds = 'durationInMiliseconds' in other
18
- ? other.durationInMiliseconds
19
- : other.durationInMilliseconds;
20
- if (typeof durationInMilliseconds !== 'number') {
21
- throw new TypeError(`Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}`);
22
- }
23
- if (Number.isNaN(durationInMilliseconds)) {
24
- throw new TypeError(`Parameter 'durationInMilliseconds' must not be NaN but it is.`);
25
- }
26
- if (!Number.isFinite(durationInMilliseconds)) {
27
- throw new TypeError(`Parameter 'durationInMilliseconds' must be finite but it is ${durationInMilliseconds}`);
28
- }
29
- if (durationInMilliseconds < 0) {
30
- throw new TypeError(`Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}.`);
31
- }
32
- const durationPrice = price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
33
- // In GB-second
34
- const timeCostDollars = Number(durationPrice) *
35
- ((memorySizeInMb * durationInMilliseconds) / 1000 / 1024);
36
- const diskSizePrice = price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
37
- const chargedDiskSize = Math.max(0, diskSizeInMb - defaults_1.MIN_EPHEMERAL_STORAGE_IN_MB);
38
- // In GB-second
39
- const diskSizeDollars = chargedDiskSize *
40
- Number(diskSizePrice) *
41
- (durationInMilliseconds / 1000 / 1024);
42
- const invocationCost = Number(price_per_1_s_1.pricing[region]['Lambda Requests'].price) * lambdasInvoked;
43
- return Number((timeCostDollars + diskSizeDollars + invocationCost).toFixed(5));
44
- };
45
- exports.estimatePrice = estimatePrice;
@@ -1,3 +0,0 @@
1
- import type { Request, Response } from 'express';
2
- import type { NextWebhookArgs } from './app-router-webhook';
3
- export declare const expressWebhook: (options: NextWebhookArgs) => (req: Request, res: Response) => void;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expressWebhook = void 0;
4
- const pages_router_webhook_1 = require("./pages-router-webhook");
5
- const validate_webhook_signature_1 = require("./validate-webhook-signature");
6
- const expressWebhook = (options) => {
7
- const { testing, extraHeaders, secret, onSuccess, onTimeout, onError } = options;
8
- return (req, res) => {
9
- // add headers to enable testing
10
- if (testing) {
11
- const testingheaders = {
12
- 'Access-Control-Allow-Origin': 'https://www.remotion.dev',
13
- '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',
14
- 'Access-Control-Allow-Methods': 'OPTIONS,POST',
15
- };
16
- (0, pages_router_webhook_1.addHeaders)(res, testingheaders);
17
- }
18
- // add extra headers
19
- (0, pages_router_webhook_1.addHeaders)(res, extraHeaders || {});
20
- // dont go forward if just testing
21
- if (req.method === 'OPTIONS') {
22
- res.status(200).end();
23
- return;
24
- }
25
- // validate the webhook signature
26
- (0, validate_webhook_signature_1.validateWebhookSignature)({
27
- signatureHeader: req.header('X-Remotion-Signature'),
28
- body: req.body,
29
- secret,
30
- });
31
- // custom logic
32
- const payload = req.body;
33
- if (payload.type === 'success' && onSuccess) {
34
- onSuccess(payload);
35
- }
36
- else if (payload.type === 'error' && onError) {
37
- onError(payload);
38
- }
39
- else if (payload.type === 'timeout' && onTimeout) {
40
- onTimeout(payload);
41
- }
42
- // send response
43
- res.status(200).json({ success: true });
44
- };
45
- };
46
- exports.expressWebhook = expressWebhook;
@@ -1,30 +0,0 @@
1
- import * as CloudWatchSDK from '@aws-sdk/client-cloudwatch-logs';
2
- import * as IamSdk from '@aws-sdk/client-iam';
3
- import * as LambdaSDK from '@aws-sdk/client-lambda';
4
- import * as S3SDK from '@aws-sdk/client-s3';
5
- import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
6
- import * as StsSdk from '@aws-sdk/client-sts';
7
- import type { CustomCredentials } from '@remotion/serverless/client';
8
- import type { AwsProvider } from '../functions/aws-implementation';
9
- import type { AwsRegion } from '../regions';
10
- import { type ServiceMapping } from '../shared/get-service-client';
11
- export type GetAwsClientInput<T extends keyof ServiceMapping> = {
12
- region: AwsRegion;
13
- service: T;
14
- customCredentials?: CustomCredentials<AwsProvider> | null;
15
- forcePathStyle?: boolean;
16
- };
17
- type SdkMapping = {
18
- s3: typeof S3SDK;
19
- cloudwatch: typeof CloudWatchSDK;
20
- iam: typeof IamSdk;
21
- lambda: typeof LambdaSDK;
22
- servicequotas: typeof ServiceQuotasSDK;
23
- sts: typeof StsSdk;
24
- };
25
- export type GetAwsClientOutput<T extends keyof ServiceMapping> = {
26
- client: ServiceMapping[T];
27
- sdk: SdkMapping[T];
28
- };
29
- export declare const getAwsClient: <T extends keyof ServiceMapping>({ region, service, customCredentials, forcePathStyle, }: GetAwsClientInput<T>) => GetAwsClientOutput<T>;
30
- export {};
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getAwsClient = void 0;
27
- const CloudWatchSDK = __importStar(require("@aws-sdk/client-cloudwatch-logs"));
28
- const IamSdk = __importStar(require("@aws-sdk/client-iam"));
29
- const LambdaSDK = __importStar(require("@aws-sdk/client-lambda"));
30
- const S3SDK = __importStar(require("@aws-sdk/client-s3"));
31
- const ServiceQuotasSDK = __importStar(require("@aws-sdk/client-service-quotas"));
32
- const StsSdk = __importStar(require("@aws-sdk/client-sts"));
33
- const get_service_client_1 = require("../shared/get-service-client");
34
- /*
35
- * @description Exposes full access to the AWS SDK used by Remotion, allowing interaction with AWS infrastructure beyond provided functionalities.
36
- * @see [Documentation](https://remotion.dev/docs/lambda/getawsclient)
37
- */
38
- const getAwsClient = ({ region, service, customCredentials, forcePathStyle, }) => {
39
- return {
40
- client: (0, get_service_client_1.getServiceClient)({
41
- region,
42
- service,
43
- customCredentials: customCredentials !== null && customCredentials !== void 0 ? customCredentials : null,
44
- forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
45
- }),
46
- sdk: {
47
- lambda: LambdaSDK,
48
- cloudwatch: CloudWatchSDK,
49
- iam: IamSdk,
50
- s3: S3SDK,
51
- servicequotas: ServiceQuotasSDK,
52
- sts: StsSdk,
53
- }[service],
54
- };
55
- };
56
- exports.getAwsClient = getAwsClient;
@@ -1,9 +0,0 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless';
2
- import type { AwsProvider } from '../functions/aws-implementation';
3
- import type { AwsRegion } from '../regions';
4
- export type BucketWithLocation = {
5
- name: string;
6
- creationDate: number;
7
- region: AwsRegion;
8
- };
9
- export declare const getRemotionBuckets: ProviderSpecifics<AwsProvider>['getBuckets'];
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRemotionBuckets = void 0;
4
- const client_s3_1 = require("@aws-sdk/client-s3");
5
- const client_1 = require("@remotion/serverless/client");
6
- const get_s3_client_1 = require("../shared/get-s3-client");
7
- const validate_bucketname_1 = require("../shared/validate-bucketname");
8
- const getRemotionBuckets = async ({ region, forceBucketName, forcePathStyle, }) => {
9
- const { Buckets } = await (0, get_s3_client_1.getS3Client)({
10
- region,
11
- customCredentials: null,
12
- forcePathStyle,
13
- }).send(new client_s3_1.ListBucketsCommand({}));
14
- if (!Buckets) {
15
- return [];
16
- }
17
- const remotionBuckets = Buckets.filter((b) => {
18
- var _a;
19
- if (forceBucketName) {
20
- return b.Name === forceBucketName;
21
- }
22
- return (_a = b.Name) === null || _a === void 0 ? void 0 : _a.startsWith(client_1.REMOTION_BUCKET_PREFIX);
23
- });
24
- const locations = await Promise.all(remotionBuckets.map(async (bucket) => {
25
- var _a, _b;
26
- const { region: parsedRegion } = (0, validate_bucketname_1.parseBucketName)(bucket.Name);
27
- if (parsedRegion) {
28
- return parsedRegion;
29
- }
30
- try {
31
- const result = await (0, get_s3_client_1.getS3Client)({
32
- region,
33
- customCredentials: null,
34
- forcePathStyle,
35
- }).send(new client_s3_1.GetBucketLocationCommand({
36
- Bucket: bucket.Name,
37
- }));
38
- // AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
39
- return (_a = result.LocationConstraint) !== null && _a !== void 0 ? _a : 'us-east-1';
40
- }
41
- catch (err) {
42
- // Sometimes the API returns a bucket even if it was deleted before
43
- if ((_b = err.stack) === null || _b === void 0 ? void 0 : _b.includes('NoSuchBucket')) {
44
- return null;
45
- }
46
- throw err;
47
- }
48
- }));
49
- const bucketsWithLocation = remotionBuckets
50
- .map((bucket, i) => {
51
- return {
52
- creationDate: bucket.CreationDate.getTime(),
53
- name: bucket.Name,
54
- region: locations[i],
55
- };
56
- })
57
- .filter((b) => b.region);
58
- return bucketsWithLocation.filter((bucket) => {
59
- return bucket.region === region;
60
- });
61
- };
62
- exports.getRemotionBuckets = getRemotionBuckets;
@@ -1,20 +0,0 @@
1
- import type { ChromiumOptions, ToOptions } from '@remotion/renderer';
2
- import type { BrowserSafeApis } from '@remotion/renderer/client';
3
- import type { VideoConfig } from 'remotion/no-react';
4
- import type { AwsRegion } from '../regions';
5
- export type GetCompositionsOnLambdaInput = {
6
- chromiumOptions?: ChromiumOptions;
7
- region: AwsRegion;
8
- inputProps: Record<string, unknown>;
9
- functionName: string;
10
- serveUrl: string;
11
- envVariables?: Record<string, string>;
12
- forceBucketName?: string;
13
- /**
14
- * @deprecated in favor of `logLevel`: true
15
- */
16
- dumpBrowserLogs?: boolean;
17
- forcePathStyle?: boolean;
18
- } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.getCompositionsOnLambda>>;
19
- export type GetCompositionsOnLambdaOutput = VideoConfig[];
20
- export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, forcePathStyle, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCompositionsOnLambda = void 0;
4
- const client_1 = require("@remotion/serverless/client");
5
- const version_1 = require("remotion/version");
6
- const aws_implementation_1 = require("../functions/aws-implementation");
7
- /*
8
- * @description Gets the compositions inside a Lambda function.
9
- * @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
10
- */
11
- const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, forcePathStyle, }) => {
12
- var _a;
13
- const stringifiedInputProps = (0, client_1.serializeOrThrow)(inputProps, 'input-props');
14
- const serializedInputProps = await (0, client_1.compressInputProps)({
15
- stringifiedInputProps,
16
- region,
17
- userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
18
- propsType: 'input-props',
19
- needsToUpload: (0, client_1.getNeedsToUpload)({
20
- type: 'video-or-audio',
21
- sizes: [
22
- stringifiedInputProps.length,
23
- JSON.stringify(envVariables).length,
24
- ],
25
- providerSpecifics: aws_implementation_1.awsImplementation,
26
- }),
27
- providerSpecifics: aws_implementation_1.awsImplementation,
28
- forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
29
- skipPutAcl: false,
30
- });
31
- try {
32
- const res = await aws_implementation_1.awsImplementation.callFunctionSync({
33
- functionName,
34
- type: client_1.ServerlessRoutines.compositions,
35
- payload: {
36
- type: client_1.ServerlessRoutines.compositions,
37
- chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
38
- serveUrl,
39
- envVariables,
40
- inputProps: serializedInputProps,
41
- logLevel: dumpBrowserLogs ? 'verbose' : (logLevel !== null && logLevel !== void 0 ? logLevel : 'info'),
42
- timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
43
- version: version_1.VERSION,
44
- bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
45
- offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
46
- forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
47
- },
48
- region,
49
- timeoutInTest: 120000,
50
- });
51
- return res.compositions;
52
- }
53
- catch (err) {
54
- if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
55
- 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');
56
- }
57
- throw err;
58
- }
59
- };
60
- exports.getCompositionsOnLambda = getCompositionsOnLambda;
@@ -1,9 +0,0 @@
1
- import type { LogLevel } from '@remotion/renderer';
2
- import type { FunctionInfo } from '@remotion/serverless';
3
- import type { AwsRegion } from '../regions';
4
- export type GetFunctionsInput = {
5
- region: AwsRegion;
6
- compatibleOnly: boolean;
7
- logLevel?: LogLevel;
8
- };
9
- export declare const getFunctions: (params: GetFunctionsInput) => Promise<FunctionInfo[]>;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFunctions = void 0;
4
- const client_lambda_1 = require("@aws-sdk/client-lambda");
5
- const version_1 = require("remotion/version");
6
- const aws_clients_1 = require("../shared/aws-clients");
7
- const constants_1 = require("../shared/constants");
8
- const get_function_version_1 = require("../shared/get-function-version");
9
- const getAllFunctions = async ({ existing, nextMarker, region, }) => {
10
- const allLambdas = [...existing];
11
- const lambdas = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.ListFunctionsCommand({
12
- Marker: nextMarker !== null && nextMarker !== void 0 ? nextMarker : undefined,
13
- }));
14
- if (!lambdas.Functions) {
15
- return allLambdas;
16
- }
17
- for (const lambda of lambdas.Functions) {
18
- allLambdas.push(lambda);
19
- }
20
- if (lambdas.NextMarker) {
21
- return getAllFunctions({
22
- existing: allLambdas,
23
- nextMarker: lambdas.NextMarker,
24
- region,
25
- });
26
- }
27
- return allLambdas;
28
- };
29
- /*
30
- * @description Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
31
- * @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
32
- */
33
- const getFunctions = async (params) => {
34
- const lambdas = await getAllFunctions({
35
- existing: [],
36
- nextMarker: null,
37
- region: params.region,
38
- });
39
- const remotionLambdas = lambdas.filter((f) => {
40
- var _a;
41
- return (_a = f.FunctionName) === null || _a === void 0 ? void 0 : _a.startsWith(constants_1.RENDER_FN_PREFIX);
42
- });
43
- const configs = await Promise.all(remotionLambdas.map(async (fn) => {
44
- var _a;
45
- try {
46
- const version = await (0, get_function_version_1.getFunctionVersion)({
47
- functionName: fn.FunctionName,
48
- region: params.region,
49
- logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
50
- });
51
- return version;
52
- }
53
- catch (_b) {
54
- return null;
55
- }
56
- }));
57
- const list = remotionLambdas.map((lambda, i) => {
58
- var _a, _b;
59
- return {
60
- functionName: lambda.FunctionName,
61
- version: configs[i],
62
- memorySizeInMb: lambda.MemorySize,
63
- timeoutInSeconds: lambda.Timeout,
64
- diskSizeInMb: (_b = (_a = lambda.EphemeralStorage) === null || _a === void 0 ? void 0 : _a.Size) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB,
65
- };
66
- });
67
- if (!params.compatibleOnly) {
68
- return list;
69
- }
70
- return list.filter((l) => {
71
- if (!params.compatibleOnly) {
72
- return true;
73
- }
74
- return l.version === version_1.VERSION;
75
- });
76
- };
77
- exports.getFunctions = getFunctions;
@@ -1,16 +0,0 @@
1
- import type { LogLevel } from '@remotion/renderer';
2
- import type { CustomCredentials } from '@remotion/serverless/client';
3
- import { type AwsProvider } from '../functions/aws-implementation';
4
- import type { AwsRegion } from '../regions';
5
- import type { RenderProgress } from '../shared/constants';
6
- export type GetRenderProgressInput = {
7
- functionName: string;
8
- bucketName: string;
9
- renderId: string;
10
- region: AwsRegion;
11
- logLevel?: LogLevel;
12
- s3OutputProvider?: CustomCredentials<AwsProvider>;
13
- forcePathStyle?: boolean;
14
- skipLambdaInvocation?: boolean;
15
- };
16
- export declare const getRenderProgress: (input: GetRenderProgressInput) => Promise<RenderProgress>;