@remotion/lambda-client 4.0.363 → 4.0.365

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 (168) hide show
  1. package/dist/cjs/app-router-webhook.d.ts +10 -0
  2. package/dist/cjs/apply-lifecycle.d.ts +8 -0
  3. package/dist/cjs/aws-clients.d.ts +12 -0
  4. package/dist/cjs/aws-provider.d.ts +27 -0
  5. package/dist/cjs/bucket-exists.d.ts +3 -0
  6. package/dist/cjs/call-lambda-async.d.ts +2 -0
  7. package/dist/cjs/call-lambda-streaming.d.ts +6 -0
  8. package/dist/cjs/call-lambda-sync.d.ts +2 -0
  9. package/dist/cjs/check-credentials.d.ts +1 -0
  10. package/dist/cjs/clean-items.d.ts +17 -0
  11. package/dist/cjs/constants.d.ts +25 -0
  12. package/dist/cjs/constants.js +75 -0
  13. package/dist/cjs/content-disposition-header.d.ts +2 -0
  14. package/dist/cjs/convert-to-serve-url.d.ts +6 -0
  15. package/dist/cjs/create-bucket.d.ts +3 -0
  16. package/dist/cjs/delete-file.d.ts +3 -0
  17. package/dist/cjs/delete-function.d.ts +7 -0
  18. package/dist/cjs/delete-render.d.ts +22 -0
  19. package/dist/cjs/encode-aws-url-params.d.ts +1 -0
  20. package/dist/cjs/estimate-price.d.ts +17 -0
  21. package/dist/cjs/express-webhook.d.ts +3 -0
  22. package/dist/cjs/get-account-id.d.ts +3 -0
  23. package/dist/cjs/get-aws-client.d.ts +32 -0
  24. package/dist/cjs/get-aws-urls.d.ts +25 -0
  25. package/dist/cjs/get-buckets.d.ts +9 -0
  26. package/dist/cjs/get-compositions-on-lambda.d.ts +20 -0
  27. package/dist/cjs/get-credentials.d.ts +9 -0
  28. package/dist/cjs/get-env-variable.d.ts +1 -0
  29. package/dist/cjs/get-function-name.d.ts +8 -0
  30. package/dist/cjs/get-function-version.d.ts +9 -0
  31. package/dist/cjs/get-functions.d.ts +10 -0
  32. package/dist/cjs/get-output-url-from-metadata.d.ts +3 -0
  33. package/dist/cjs/get-render-progress.d.ts +17 -0
  34. package/dist/cjs/get-s3-client.d.ts +11 -0
  35. package/dist/cjs/get-service-client.d.ts +25 -0
  36. package/dist/cjs/get-sites.d.ts +31 -0
  37. package/dist/cjs/head-file.d.ts +3 -0
  38. package/dist/cjs/index.d.ts +129 -0
  39. package/dist/cjs/index.js +72692 -0
  40. package/dist/cjs/is-cli.d.ts +2 -0
  41. package/dist/cjs/is-flaky-error.d.ts +1 -0
  42. package/dist/cjs/is-in-lambda.d.ts +1 -0
  43. package/dist/cjs/is-likely-to-have-aws-profile.d.ts +1 -0
  44. package/dist/cjs/lambda-version-string.d.ts +1 -0
  45. package/dist/cjs/lifecycle-rules.d.ts +12 -0
  46. package/dist/cjs/lifecycle.d.ts +7 -0
  47. package/dist/cjs/list-objects.d.ts +3 -0
  48. package/dist/cjs/make-lambda-payload.d.ts +59 -0
  49. package/dist/cjs/make-s3-url.d.ts +6 -0
  50. package/dist/cjs/p-limit.d.ts +1 -0
  51. package/dist/cjs/pages-router-webhook.d.ts +5 -0
  52. package/dist/cjs/parse-function-name.d.ts +8 -0
  53. package/dist/cjs/presign-url.d.ts +17 -0
  54. package/dist/cjs/price-per-1s.d.ts +37 -0
  55. package/dist/cjs/random-hash.d.ts +1 -0
  56. package/dist/cjs/read-file.d.ts +11 -0
  57. package/dist/cjs/regions.d.ts +3 -0
  58. package/dist/cjs/regions.js +80 -0
  59. package/dist/cjs/render-media-on-lambda.d.ts +66 -0
  60. package/dist/cjs/render-still-on-lambda.d.ts +61 -0
  61. package/dist/cjs/runtime-preference.d.ts +2 -0
  62. package/dist/cjs/speculate-function-name.d.ts +7 -0
  63. package/dist/cjs/types.d.ts +4 -0
  64. package/dist/cjs/validate-aws-region.d.ts +2 -0
  65. package/dist/cjs/validate-bucketname.d.ts +4 -0
  66. package/dist/cjs/validate-disk-size-in-mb.d.ts +1 -0
  67. package/dist/cjs/validate-lambda-codec.d.ts +2 -0
  68. package/dist/cjs/validate-memory-size.d.ts +1 -0
  69. package/dist/cjs/validate-presign-expiration.d.ts +1 -0
  70. package/dist/cjs/validate-serveurl.d.ts +1 -0
  71. package/dist/cjs/validate-webhook-signature.d.ts +5 -0
  72. package/dist/cjs/write-file.d.ts +5 -0
  73. package/dist/esm/index.mjs +64284 -13659
  74. package/package.json +15 -16
  75. package/.turbo/turbo-formatting.log +0 -4
  76. package/.turbo/turbo-lint.log +0 -25
  77. package/.turbo/turbo-make.log +0 -3
  78. package/bundle.ts +0 -24
  79. package/dist/test/concurrency-payload.test.d.ts +0 -1
  80. package/dist/test/concurrency-payload.test.js +0 -119
  81. package/dist/test/encode-aws-url.test.d.ts +0 -1
  82. package/dist/test/encode-aws-url.test.js +0 -8
  83. package/dist/test/price-calculation.test.d.ts +0 -1
  84. package/dist/test/price-calculation.test.js +0 -62
  85. package/dist/test/pricing.test.d.ts +0 -1
  86. package/dist/test/pricing.test.js +0 -27
  87. package/dist/test/request-handler.test.d.ts +0 -1
  88. package/dist/test/request-handler.test.js +0 -36
  89. package/dist/test/validate-disk-size-in-mb.test.d.ts +0 -1
  90. package/dist/test/validate-disk-size-in-mb.test.js +0 -14
  91. package/eslint.config.mjs +0 -5
  92. package/src/app-router-webhook.ts +0 -73
  93. package/src/apply-lifecycle.ts +0 -30
  94. package/src/aws-clients.ts +0 -75
  95. package/src/aws-provider.ts +0 -139
  96. package/src/bucket-exists.ts +0 -35
  97. package/src/call-lambda-async.ts +0 -43
  98. package/src/call-lambda-streaming.ts +0 -226
  99. package/src/call-lambda-sync.ts +0 -59
  100. package/src/check-credentials.ts +0 -51
  101. package/src/clean-items.ts +0 -50
  102. package/src/constants.ts +0 -38
  103. package/src/content-disposition-header.ts +0 -64
  104. package/src/convert-to-serve-url.ts +0 -24
  105. package/src/create-bucket.ts +0 -87
  106. package/src/delete-file.ts +0 -38
  107. package/src/delete-function.ts +0 -28
  108. package/src/delete-render.ts +0 -114
  109. package/src/encode-aws-url-params.ts +0 -3
  110. package/src/estimate-price.ts +0 -95
  111. package/src/express-webhook.ts +0 -57
  112. package/src/get-account-id.ts +0 -22
  113. package/src/get-aws-client.ts +0 -63
  114. package/src/get-aws-urls.ts +0 -85
  115. package/src/get-buckets.ts +0 -84
  116. package/src/get-compositions-on-lambda.ts +0 -111
  117. package/src/get-credentials.ts +0 -81
  118. package/src/get-env-variable.ts +0 -15
  119. package/src/get-function-name.ts +0 -24
  120. package/src/get-function-version.ts +0 -49
  121. package/src/get-functions.ts +0 -114
  122. package/src/get-output-url-from-metadata.ts +0 -23
  123. package/src/get-render-progress.ts +0 -66
  124. package/src/get-s3-client.ts +0 -26
  125. package/src/get-service-client.ts +0 -195
  126. package/src/get-sites.ts +0 -136
  127. package/src/head-file.ts +0 -30
  128. package/src/index.ts +0 -152
  129. package/src/is-cli.ts +0 -7
  130. package/src/is-flaky-error.ts +0 -104
  131. package/src/is-in-lambda.ts +0 -5
  132. package/src/is-likely-to-have-aws-profile.ts +0 -55
  133. package/src/lambda-version-string.ts +0 -5
  134. package/src/lifecycle-rules.ts +0 -119
  135. package/src/lifecycle.ts +0 -44
  136. package/src/list-objects.ts +0 -87
  137. package/src/make-lambda-payload.ts +0 -328
  138. package/src/make-s3-url.ts +0 -13
  139. package/src/p-limit.ts +0 -75
  140. package/src/pages-router-webhook.ts +0 -68
  141. package/src/parse-function-name.ts +0 -24
  142. package/src/presign-url.ts +0 -121
  143. package/src/price-per-1s.ts +0 -863
  144. package/src/random-hash.ts +0 -10
  145. package/src/read-file.ts +0 -35
  146. package/src/regions.ts +0 -48
  147. package/src/render-media-on-lambda.ts +0 -227
  148. package/src/render-still-on-lambda.ts +0 -209
  149. package/src/runtime-preference.ts +0 -7
  150. package/src/speculate-function-name.ts +0 -60
  151. package/src/test/concurrency-payload.test.ts +0 -121
  152. package/src/test/encode-aws-url.test.ts +0 -7
  153. package/src/test/price-calculation.test.ts +0 -62
  154. package/src/test/pricing.test.ts +0 -32
  155. package/src/test/request-handler.test.ts +0 -42
  156. package/src/test/validate-disk-size-in-mb.test.ts +0 -15
  157. package/src/types.ts +0 -7
  158. package/src/validate-aws-region.ts +0 -14
  159. package/src/validate-bucketname.ts +0 -24
  160. package/src/validate-disk-size-in-mb.ts +0 -37
  161. package/src/validate-lambda-codec.ts +0 -28
  162. package/src/validate-memory-size.ts +0 -31
  163. package/src/validate-presign-expiration.ts +0 -46
  164. package/src/validate-serveurl.ts +0 -9
  165. package/src/validate-webhook-signature.ts +0 -42
  166. package/src/write-file.ts +0 -108
  167. package/tsconfig.json +0 -9
  168. package/tsconfig.tsbuildinfo +0 -1
@@ -1,68 +0,0 @@
1
- import type {WebhookPayload} from '@remotion/serverless-client';
2
- import type {Response} from 'express';
3
- import type {NextApiRequest, NextApiResponse} from 'next';
4
- import type {NextWebhookArgs} from './app-router-webhook';
5
- import {validateWebhookSignature} from './validate-webhook-signature';
6
-
7
- export const addHeaders = (
8
- res: NextApiResponse | Response,
9
- headers: Record<string, string>,
10
- ) => {
11
- Object.entries(headers).forEach(([key, value]) => {
12
- res.setHeader(key, value);
13
- });
14
- };
15
-
16
- export const pagesRouterWebhook = (options: NextWebhookArgs) => {
17
- const {testing, extraHeaders, secret, onSuccess, onTimeout, onError} =
18
- options;
19
- return async function (
20
- req: NextApiRequest,
21
- res: NextApiResponse,
22
- ): Promise<void> {
23
- addHeaders(res, extraHeaders || {});
24
-
25
- if (testing) {
26
- const testingheaders = {
27
- 'Access-Control-Allow-Origin': 'https://www.remotion.dev',
28
- 'Access-Control-Allow-Headers':
29
- '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',
30
- 'Access-Control-Allow-Methods': 'OPTIONS,POST',
31
- };
32
-
33
- addHeaders(res, testingheaders);
34
- }
35
-
36
- if (req.method === 'OPTIONS') {
37
- res.status(200).end();
38
- return;
39
- }
40
-
41
- try {
42
- validateWebhookSignature({
43
- secret,
44
- body: req.body,
45
- signatureHeader: req.headers['x-remotion-signature'] as string,
46
- });
47
-
48
- // If code reaches this path, the webhook is authentic.
49
- const payload = req.body as WebhookPayload;
50
- if (payload.type === 'success' && onSuccess) {
51
- await onSuccess(payload);
52
- } else if (payload.type === 'timeout' && onTimeout) {
53
- await onTimeout(payload);
54
- } else if (payload.type === 'error' && onError) {
55
- await onError(payload);
56
- }
57
-
58
- res.status(200).json({
59
- success: true,
60
- });
61
- } catch (err) {
62
- res.status(500).json({
63
- success: false,
64
- error: err instanceof Error ? err.message : String(err),
65
- });
66
- }
67
- };
68
- };
@@ -1,24 +0,0 @@
1
- import {RENDER_FN_PREFIX} from './constants';
2
-
3
- type ReturnType = {
4
- version: string;
5
- memorySizeInMb: number;
6
- diskSizeInMb: number;
7
- timeoutInSeconds: number;
8
- };
9
-
10
- export const parseFunctionName = (functionName: string): ReturnType | null => {
11
- const match = functionName.match(
12
- new RegExp(RENDER_FN_PREFIX + '(.*)-mem(\\d+)mb-disk(\\d+)mb-(\\d+)sec$'),
13
- );
14
- if (!match) {
15
- return null;
16
- }
17
-
18
- return {
19
- version: match[1],
20
- memorySizeInMb: parseInt(match[2], 10),
21
- diskSizeInMb: parseInt(match[3], 10),
22
- timeoutInSeconds: parseInt(match[4], 10),
23
- };
24
- };
@@ -1,121 +0,0 @@
1
- import {GetObjectCommand, HeadObjectCommand} from '@aws-sdk/client-s3';
2
- import {getSignedUrl} from '@aws-sdk/s3-request-presigner';
3
- import {validateBucketName} from '@remotion/serverless-client';
4
- import {REMOTION_BUCKET_PREFIX} from './constants';
5
- import {getS3Client} from './get-s3-client';
6
- import type {AwsRegion} from './regions';
7
- import type {RequestHandler} from './types';
8
- import {validatePresignExpiration} from './validate-presign-expiration';
9
-
10
- type MandatoryParameters = {
11
- region: AwsRegion;
12
- bucketName: string;
13
- objectKey: string;
14
- expiresInSeconds: number;
15
- };
16
-
17
- type OptionalParameters<CheckIfObjectExists extends boolean> = {
18
- checkIfObjectExists: CheckIfObjectExists;
19
- forcePathStyle: boolean;
20
- };
21
-
22
- export type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> =
23
- MandatoryParameters &
24
- Partial<OptionalParameters<CheckIfObjectExists>> & {
25
- requestHandler?: RequestHandler;
26
- };
27
- type PresignUrlInputInternal<CheckIfObjectExists extends boolean> =
28
- MandatoryParameters &
29
- OptionalParameters<CheckIfObjectExists> & {
30
- requestHandler?: RequestHandler;
31
- };
32
-
33
- const internalPresignUrl = async <CheckIfObjectExists extends boolean = false>({
34
- region,
35
- bucketName,
36
- objectKey,
37
- checkIfObjectExists,
38
- expiresInSeconds,
39
- forcePathStyle,
40
- requestHandler,
41
- }: PresignUrlInputInternal<CheckIfObjectExists>): Promise<
42
- CheckIfObjectExists extends true ? string | null : string
43
- > => {
44
- validateBucketName({
45
- bucketName,
46
- bucketNamePrefix: REMOTION_BUCKET_PREFIX,
47
- options: {mustStartWithRemotion: false},
48
- });
49
- validatePresignExpiration(expiresInSeconds);
50
-
51
- const s3Client = getS3Client({
52
- region,
53
- customCredentials: null,
54
- forcePathStyle,
55
- requestHandler: requestHandler ?? null,
56
- });
57
-
58
- if (checkIfObjectExists === true) {
59
- try {
60
- await s3Client.send(
61
- new HeadObjectCommand({
62
- Bucket: bucketName,
63
- Key: objectKey,
64
- }),
65
- );
66
- } catch (err) {
67
- if ((err as {name: string}).name === 'NotFound') {
68
- return null as unknown as string;
69
- }
70
-
71
- if (
72
- (err as Error).message === 'UnknownError' ||
73
- (err as {$metadata: {httpStatusCode: number}}).$metadata
74
- .httpStatusCode === 403
75
- ) {
76
- throw new Error(
77
- `Unable to access item "${objectKey}" from bucket "${bucketName}". You must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`,
78
- );
79
- }
80
-
81
- throw err;
82
- }
83
- }
84
-
85
- const objCommand = new GetObjectCommand({
86
- Bucket: bucketName,
87
- Key: objectKey,
88
- });
89
-
90
- const publicUrl = await getSignedUrl(s3Client, objCommand, {
91
- expiresIn: expiresInSeconds,
92
- });
93
-
94
- return publicUrl;
95
- };
96
-
97
- /*
98
- * @description Takes a private S3 object and turns it into a public URL by signing it with your AWS credentials.
99
- * @see [Documentation](https://remotion.dev/docs/lambda/presignurl)
100
- */
101
- export const presignUrl = <CheckIfObjectExists extends boolean = false>({
102
- region,
103
- bucketName,
104
- objectKey,
105
- checkIfObjectExists,
106
- expiresInSeconds,
107
- forcePathStyle,
108
- requestHandler,
109
- }: PresignUrlInput<CheckIfObjectExists>): Promise<
110
- CheckIfObjectExists extends true ? string | null : string
111
- > => {
112
- return internalPresignUrl({
113
- region,
114
- bucketName,
115
- objectKey,
116
- checkIfObjectExists: checkIfObjectExists ?? false,
117
- expiresInSeconds,
118
- forcePathStyle: forcePathStyle ?? false,
119
- requestHandler,
120
- });
121
- };