@remotion/lambda-client 4.0.313 → 4.0.315

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 (93) hide show
  1. package/.turbo/turbo-formatting.log +7 -0
  2. package/.turbo/turbo-make.log +2 -2
  3. package/dist/aws-clients.d.ts +6 -5
  4. package/dist/aws-clients.js +10 -5
  5. package/dist/aws-provider.d.ts +2 -0
  6. package/dist/bucket-exists.js +2 -1
  7. package/dist/call-lambda-async.js +1 -1
  8. package/dist/call-lambda-streaming.js +1 -1
  9. package/dist/call-lambda-sync.js +1 -1
  10. package/dist/clean-items.d.ts +2 -1
  11. package/dist/clean-items.js +2 -1
  12. package/dist/create-bucket.js +25 -5
  13. package/dist/delete-file.js +7 -2
  14. package/dist/delete-function.d.ts +4 -1
  15. package/dist/delete-function.js +2 -2
  16. package/dist/delete-render.d.ts +2 -0
  17. package/dist/delete-render.js +7 -1
  18. package/dist/esm/index.mjs +232 -106
  19. package/dist/get-account-id.js +1 -1
  20. package/dist/get-aws-client.d.ts +3 -1
  21. package/dist/get-aws-client.js +2 -1
  22. package/dist/get-buckets.js +3 -1
  23. package/dist/get-compositions-on-lambda.d.ts +3 -1
  24. package/dist/get-compositions-on-lambda.js +3 -1
  25. package/dist/get-function-version.d.ts +3 -1
  26. package/dist/get-function-version.js +4 -1
  27. package/dist/get-functions.d.ts +2 -0
  28. package/dist/get-functions.js +5 -2
  29. package/dist/get-render-progress.d.ts +2 -0
  30. package/dist/get-render-progress.js +2 -0
  31. package/dist/get-s3-client.d.ts +3 -1
  32. package/dist/get-s3-client.js +2 -1
  33. package/dist/get-service-client.d.ts +3 -1
  34. package/dist/get-service-client.js +13 -5
  35. package/dist/get-sites.d.ts +4 -2
  36. package/dist/get-sites.js +6 -2
  37. package/dist/head-file.js +2 -1
  38. package/dist/index.d.ts +14 -10
  39. package/dist/is-flaky-error.js +2 -1
  40. package/dist/lifecycle-rules.d.ts +3 -1
  41. package/dist/lifecycle-rules.js +17 -5
  42. package/dist/list-objects.js +4 -1
  43. package/dist/make-lambda-payload.d.ts +4 -2
  44. package/dist/make-lambda-payload.js +4 -2
  45. package/dist/presign-url.d.ts +5 -2
  46. package/dist/presign-url.js +4 -2
  47. package/dist/read-file.d.ts +3 -1
  48. package/dist/read-file.js +2 -1
  49. package/dist/render-media-on-lambda.d.ts +2 -0
  50. package/dist/render-media-on-lambda.js +3 -1
  51. package/dist/render-still-on-lambda.d.ts +5 -1
  52. package/dist/render-still-on-lambda.js +3 -1
  53. package/dist/test/request-handler.test.d.ts +1 -0
  54. package/dist/test/request-handler.test.js +36 -0
  55. package/dist/types.d.ts +4 -0
  56. package/dist/types.js +2 -0
  57. package/dist/write-file.js +2 -1
  58. package/package.json +3 -3
  59. package/src/aws-clients.ts +18 -3
  60. package/src/aws-provider.ts +2 -0
  61. package/src/bucket-exists.ts +8 -1
  62. package/src/call-lambda-async.ts +5 -1
  63. package/src/call-lambda-streaming.ts +5 -1
  64. package/src/call-lambda-sync.ts +5 -1
  65. package/src/clean-items.ts +3 -0
  66. package/src/create-bucket.ts +25 -5
  67. package/src/delete-file.ts +9 -1
  68. package/src/delete-function.ts +6 -2
  69. package/src/delete-render.ts +8 -1
  70. package/src/get-account-id.ts +1 -1
  71. package/src/get-aws-client.ts +4 -0
  72. package/src/get-buckets.ts +3 -0
  73. package/src/get-compositions-on-lambda.ts +5 -0
  74. package/src/get-function-version.ts +6 -0
  75. package/src/get-functions.ts +12 -1
  76. package/src/get-render-progress.ts +4 -0
  77. package/src/get-s3-client.ts +4 -0
  78. package/src/get-service-client.ts +17 -3
  79. package/src/get-sites.ts +8 -0
  80. package/src/head-file.ts +2 -0
  81. package/src/index.ts +1 -0
  82. package/src/is-flaky-error.ts +4 -1
  83. package/src/lifecycle-rules.ts +21 -6
  84. package/src/list-objects.ts +4 -0
  85. package/src/make-lambda-payload.ts +6 -0
  86. package/src/presign-url.ts +13 -2
  87. package/src/read-file.ts +4 -0
  88. package/src/render-media-on-lambda.ts +4 -0
  89. package/src/render-still-on-lambda.ts +7 -1
  90. package/src/test/request-handler.test.ts +42 -0
  91. package/src/types.ts +7 -0
  92. package/src/write-file.ts +2 -0
  93. package/tsconfig.tsbuildinfo +1 -0
@@ -4,6 +4,7 @@ import {validateBucketName} from '@remotion/serverless-client';
4
4
  import {REMOTION_BUCKET_PREFIX} from './constants';
5
5
  import {getS3Client} from './get-s3-client';
6
6
  import type {AwsRegion} from './regions';
7
+ import type {RequestHandler} from './types';
7
8
  import {validatePresignExpiration} from './validate-presign-expiration';
8
9
 
9
10
  type MandatoryParameters = {
@@ -19,9 +20,15 @@ type OptionalParameters<CheckIfObjectExists extends boolean> = {
19
20
  };
20
21
 
21
22
  export type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> =
22
- MandatoryParameters & Partial<OptionalParameters<CheckIfObjectExists>>;
23
+ MandatoryParameters &
24
+ Partial<OptionalParameters<CheckIfObjectExists>> & {
25
+ requestHandler?: RequestHandler;
26
+ };
23
27
  type PresignUrlInputInternal<CheckIfObjectExists extends boolean> =
24
- MandatoryParameters & OptionalParameters<CheckIfObjectExists>;
28
+ MandatoryParameters &
29
+ OptionalParameters<CheckIfObjectExists> & {
30
+ requestHandler?: RequestHandler;
31
+ };
25
32
 
26
33
  const internalPresignUrl = async <CheckIfObjectExists extends boolean = false>({
27
34
  region,
@@ -30,6 +37,7 @@ const internalPresignUrl = async <CheckIfObjectExists extends boolean = false>({
30
37
  checkIfObjectExists,
31
38
  expiresInSeconds,
32
39
  forcePathStyle,
40
+ requestHandler,
33
41
  }: PresignUrlInputInternal<CheckIfObjectExists>): Promise<
34
42
  CheckIfObjectExists extends true ? string | null : string
35
43
  > => {
@@ -44,6 +52,7 @@ const internalPresignUrl = async <CheckIfObjectExists extends boolean = false>({
44
52
  region,
45
53
  customCredentials: null,
46
54
  forcePathStyle,
55
+ requestHandler: requestHandler ?? null,
47
56
  });
48
57
 
49
58
  if (checkIfObjectExists === true) {
@@ -96,6 +105,7 @@ export const presignUrl = <CheckIfObjectExists extends boolean = false>({
96
105
  checkIfObjectExists,
97
106
  expiresInSeconds,
98
107
  forcePathStyle,
108
+ requestHandler,
99
109
  }: PresignUrlInput<CheckIfObjectExists>): Promise<
100
110
  CheckIfObjectExists extends true ? string | null : string
101
111
  > => {
@@ -106,5 +116,6 @@ export const presignUrl = <CheckIfObjectExists extends boolean = false>({
106
116
  checkIfObjectExists: checkIfObjectExists ?? false,
107
117
  expiresInSeconds,
108
118
  forcePathStyle: forcePathStyle ?? false,
119
+ requestHandler,
109
120
  });
110
121
  };
package/src/read-file.ts CHANGED
@@ -2,6 +2,7 @@ import {GetObjectCommand} from '@aws-sdk/client-s3';
2
2
  import type {Readable} from 'stream';
3
3
  import {getS3Client} from './get-s3-client';
4
4
  import type {AwsRegion} from './regions';
5
+ import type {RequestHandler} from './types';
5
6
 
6
7
  export const lambdaReadFileImplementation = async ({
7
8
  bucketName,
@@ -9,17 +10,20 @@ export const lambdaReadFileImplementation = async ({
9
10
  region,
10
11
  expectedBucketOwner,
11
12
  forcePathStyle,
13
+ requestHandler,
12
14
  }: {
13
15
  bucketName: string;
14
16
  key: string;
15
17
  region: AwsRegion;
16
18
  expectedBucketOwner: string | null;
17
19
  forcePathStyle: boolean;
20
+ requestHandler: RequestHandler | null;
18
21
  }): Promise<Readable> => {
19
22
  const {Body} = await getS3Client({
20
23
  region,
21
24
  customCredentials: null,
22
25
  forcePathStyle,
26
+ requestHandler,
23
27
  }).send(
24
28
  new GetObjectCommand({
25
29
  Bucket: bucketName,
@@ -29,6 +29,7 @@ import {
29
29
  import type {InnerRenderMediaOnLambdaInput} from './make-lambda-payload';
30
30
  import {makeLambdaRenderMediaPayload} from './make-lambda-payload';
31
31
  import type {AwsRegion} from './regions';
32
+ import type {RequestHandler} from './types';
32
33
 
33
34
  export type RenderMediaOnLambdaInput = {
34
35
  region: AwsRegion;
@@ -71,6 +72,7 @@ export type RenderMediaOnLambdaInput = {
71
72
  forcePathStyle?: boolean;
72
73
  metadata?: Record<string, string> | null;
73
74
  storageClass?: StorageClass | null;
75
+ requestHandler?: RequestHandler;
74
76
  } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
75
77
 
76
78
  export type RenderMediaOnLambdaOutput = {
@@ -95,6 +97,7 @@ export const internalRenderMediaOnLambdaRaw = async (
95
97
  payload: await makeLambdaRenderMediaPayload(input),
96
98
  region,
97
99
  timeoutInTest: 120000,
100
+ requestHandler: input.requestHandler,
98
101
  });
99
102
 
100
103
  return {
@@ -193,6 +196,7 @@ export const renderMediaOnLambdaOptionalToRequired = (
193
196
  metadata: options.metadata ?? null,
194
197
  apiKey: options.apiKey ?? null,
195
198
  storageClass: options.storageClass ?? null,
199
+ requestHandler: options.requestHandler ?? null,
196
200
  };
197
201
  };
198
202
 
@@ -21,6 +21,7 @@ import {DEFAULT_MAX_RETRIES} from './constants';
21
21
  import {getCloudwatchMethodUrl, getLambdaInsightsUrl} from './get-aws-urls';
22
22
  import {makeLambdaRenderStillPayload} from './make-lambda-payload';
23
23
  import type {AwsRegion} from './regions';
24
+ import type {RequestHandler} from './types';
24
25
 
25
26
  type MandatoryParameters = {
26
27
  region: AwsRegion;
@@ -50,13 +51,16 @@ type OptionalParameters = {
50
51
  indent: boolean;
51
52
  forcePathStyle: boolean;
52
53
  storageClass: StorageClass | null;
54
+ requestHandler: RequestHandler | null | undefined;
53
55
  } & ToOptions<typeof BrowserSafeApis.optionsMap.renderStillOnLambda>;
54
56
 
55
57
  export type RenderStillOnLambdaNonNullInput = MandatoryParameters &
56
58
  OptionalParameters;
57
59
 
58
60
  export type RenderStillOnLambdaInput = MandatoryParameters &
59
- Partial<OptionalParameters>;
61
+ Partial<OptionalParameters> & {
62
+ requestHandler?: RequestHandler;
63
+ };
60
64
 
61
65
  export type RenderStillOnLambdaOutput = {
62
66
  estimatedPrice: CostsInfo;
@@ -112,6 +116,7 @@ const innerRenderStillOnLambda = async (
112
116
  },
113
117
  timeoutInTest: 120000,
114
118
  retriesRemaining: input.maxRetries,
119
+ requestHandler: input.requestHandler,
115
120
  })
116
121
  .then(() => {
117
122
  reject(new Error('Expected response to be streamed'));
@@ -198,5 +203,6 @@ export const renderStillOnLambda = (
198
203
  apiKey: input.apiKey ?? null,
199
204
  offthreadVideoThreads: input.offthreadVideoThreads ?? null,
200
205
  storageClass: input.storageClass ?? null,
206
+ requestHandler: input.requestHandler ?? null,
201
207
  });
202
208
  };
@@ -0,0 +1,42 @@
1
+ import {expect, test} from 'bun:test';
2
+ import type {GetAwsClientInput} from '../get-aws-client';
3
+ import type {GetFunctionsInput} from '../get-functions';
4
+ import type {RequestHandler} from '../types';
5
+
6
+ test('RequestHandler type should be properly exported and defined', () => {
7
+ // Just verify the type can be imported
8
+ const requestHandler: RequestHandler = {
9
+ httpsAgent: {
10
+ maxSockets: 100,
11
+ },
12
+ };
13
+
14
+ expect(requestHandler).toBeDefined();
15
+ expect(typeof requestHandler).toBe('object');
16
+ });
17
+
18
+ test('API input types should accept requestHandler option', () => {
19
+ // Test that the type checking works for various API inputs
20
+ const getAwsClientInput: GetAwsClientInput<'lambda'> = {
21
+ region: 'us-east-1',
22
+ service: 'lambda',
23
+ requestHandler: {
24
+ httpsAgent: {
25
+ maxSockets: 50,
26
+ },
27
+ },
28
+ };
29
+
30
+ const getFunctionsInput: GetFunctionsInput = {
31
+ region: 'us-east-1',
32
+ compatibleOnly: false,
33
+ requestHandler: {
34
+ httpsAgent: {
35
+ maxSockets: 25,
36
+ },
37
+ },
38
+ };
39
+
40
+ expect(getAwsClientInput.requestHandler).toBeDefined();
41
+ expect(getFunctionsInput.requestHandler).toBeDefined();
42
+ });
package/src/types.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type {LambdaClient} from '@aws-sdk/client-lambda';
2
+
3
+ // Extract RequestHandler type from AWS SDK LambdaClient constructor
4
+ type LambdaClientConfig = NonNullable<
5
+ ConstructorParameters<typeof LambdaClient>[0]
6
+ >;
7
+ export type RequestHandler = LambdaClientConfig['requestHandler'];
package/src/write-file.ts CHANGED
@@ -25,11 +25,13 @@ const tryLambdaWriteFile = async ({
25
25
  customCredentials,
26
26
  forcePathStyle,
27
27
  storageClass,
28
+ requestHandler,
28
29
  }: WriteFileInput<AwsProvider>): Promise<void> => {
29
30
  const client = getS3Client({
30
31
  region,
31
32
  customCredentials: customCredentials as CustomCredentials<AwsProvider>,
32
33
  forcePathStyle,
34
+ requestHandler,
33
35
  });
34
36
 
35
37
  const params: PutObjectCommandInput = {