@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.
- package/dist/cjs/app-router-webhook.d.ts +10 -0
- package/dist/cjs/apply-lifecycle.d.ts +8 -0
- package/dist/cjs/aws-clients.d.ts +12 -0
- package/dist/cjs/aws-provider.d.ts +27 -0
- package/dist/cjs/bucket-exists.d.ts +3 -0
- package/dist/cjs/call-lambda-async.d.ts +2 -0
- package/dist/cjs/call-lambda-streaming.d.ts +6 -0
- package/dist/cjs/call-lambda-sync.d.ts +2 -0
- package/dist/cjs/check-credentials.d.ts +1 -0
- package/dist/cjs/clean-items.d.ts +17 -0
- package/dist/cjs/constants.d.ts +25 -0
- package/dist/cjs/constants.js +75 -0
- package/dist/cjs/content-disposition-header.d.ts +2 -0
- package/dist/cjs/convert-to-serve-url.d.ts +6 -0
- package/dist/cjs/create-bucket.d.ts +3 -0
- package/dist/cjs/delete-file.d.ts +3 -0
- package/dist/cjs/delete-function.d.ts +7 -0
- package/dist/cjs/delete-render.d.ts +22 -0
- package/dist/cjs/encode-aws-url-params.d.ts +1 -0
- package/dist/cjs/estimate-price.d.ts +17 -0
- package/dist/cjs/express-webhook.d.ts +3 -0
- package/dist/cjs/get-account-id.d.ts +3 -0
- package/dist/cjs/get-aws-client.d.ts +32 -0
- package/dist/cjs/get-aws-urls.d.ts +25 -0
- package/dist/cjs/get-buckets.d.ts +9 -0
- package/dist/cjs/get-compositions-on-lambda.d.ts +20 -0
- package/dist/cjs/get-credentials.d.ts +9 -0
- package/dist/cjs/get-env-variable.d.ts +1 -0
- package/dist/cjs/get-function-name.d.ts +8 -0
- package/dist/cjs/get-function-version.d.ts +9 -0
- package/dist/cjs/get-functions.d.ts +10 -0
- package/dist/cjs/get-output-url-from-metadata.d.ts +3 -0
- package/dist/cjs/get-render-progress.d.ts +17 -0
- package/dist/cjs/get-s3-client.d.ts +11 -0
- package/dist/cjs/get-service-client.d.ts +25 -0
- package/dist/cjs/get-sites.d.ts +31 -0
- package/dist/cjs/head-file.d.ts +3 -0
- package/dist/cjs/index.d.ts +129 -0
- package/dist/cjs/index.js +72692 -0
- package/dist/cjs/is-cli.d.ts +2 -0
- package/dist/cjs/is-flaky-error.d.ts +1 -0
- package/dist/cjs/is-in-lambda.d.ts +1 -0
- package/dist/cjs/is-likely-to-have-aws-profile.d.ts +1 -0
- package/dist/cjs/lambda-version-string.d.ts +1 -0
- package/dist/cjs/lifecycle-rules.d.ts +12 -0
- package/dist/cjs/lifecycle.d.ts +7 -0
- package/dist/cjs/list-objects.d.ts +3 -0
- package/dist/cjs/make-lambda-payload.d.ts +59 -0
- package/dist/cjs/make-s3-url.d.ts +6 -0
- package/dist/cjs/p-limit.d.ts +1 -0
- package/dist/cjs/pages-router-webhook.d.ts +5 -0
- package/dist/cjs/parse-function-name.d.ts +8 -0
- package/dist/cjs/presign-url.d.ts +17 -0
- package/dist/cjs/price-per-1s.d.ts +37 -0
- package/dist/cjs/random-hash.d.ts +1 -0
- package/dist/cjs/read-file.d.ts +11 -0
- package/dist/cjs/regions.d.ts +3 -0
- package/dist/cjs/regions.js +80 -0
- package/dist/cjs/render-media-on-lambda.d.ts +66 -0
- package/dist/cjs/render-still-on-lambda.d.ts +61 -0
- package/dist/cjs/runtime-preference.d.ts +2 -0
- package/dist/cjs/speculate-function-name.d.ts +7 -0
- package/dist/cjs/types.d.ts +4 -0
- package/dist/cjs/validate-aws-region.d.ts +2 -0
- package/dist/cjs/validate-bucketname.d.ts +4 -0
- package/dist/cjs/validate-disk-size-in-mb.d.ts +1 -0
- package/dist/cjs/validate-lambda-codec.d.ts +2 -0
- package/dist/cjs/validate-memory-size.d.ts +1 -0
- package/dist/cjs/validate-presign-expiration.d.ts +1 -0
- package/dist/cjs/validate-serveurl.d.ts +1 -0
- package/dist/cjs/validate-webhook-signature.d.ts +5 -0
- package/dist/cjs/write-file.d.ts +5 -0
- package/dist/esm/index.mjs +64284 -13659
- package/package.json +15 -16
- package/.turbo/turbo-formatting.log +0 -4
- package/.turbo/turbo-lint.log +0 -25
- package/.turbo/turbo-make.log +0 -3
- package/bundle.ts +0 -24
- package/dist/test/concurrency-payload.test.d.ts +0 -1
- package/dist/test/concurrency-payload.test.js +0 -119
- package/dist/test/encode-aws-url.test.d.ts +0 -1
- package/dist/test/encode-aws-url.test.js +0 -8
- package/dist/test/price-calculation.test.d.ts +0 -1
- package/dist/test/price-calculation.test.js +0 -62
- package/dist/test/pricing.test.d.ts +0 -1
- package/dist/test/pricing.test.js +0 -27
- package/dist/test/request-handler.test.d.ts +0 -1
- package/dist/test/request-handler.test.js +0 -36
- package/dist/test/validate-disk-size-in-mb.test.d.ts +0 -1
- package/dist/test/validate-disk-size-in-mb.test.js +0 -14
- package/eslint.config.mjs +0 -5
- package/src/app-router-webhook.ts +0 -73
- package/src/apply-lifecycle.ts +0 -30
- package/src/aws-clients.ts +0 -75
- package/src/aws-provider.ts +0 -139
- package/src/bucket-exists.ts +0 -35
- package/src/call-lambda-async.ts +0 -43
- package/src/call-lambda-streaming.ts +0 -226
- package/src/call-lambda-sync.ts +0 -59
- package/src/check-credentials.ts +0 -51
- package/src/clean-items.ts +0 -50
- package/src/constants.ts +0 -38
- package/src/content-disposition-header.ts +0 -64
- package/src/convert-to-serve-url.ts +0 -24
- package/src/create-bucket.ts +0 -87
- package/src/delete-file.ts +0 -38
- package/src/delete-function.ts +0 -28
- package/src/delete-render.ts +0 -114
- package/src/encode-aws-url-params.ts +0 -3
- package/src/estimate-price.ts +0 -95
- package/src/express-webhook.ts +0 -57
- package/src/get-account-id.ts +0 -22
- package/src/get-aws-client.ts +0 -63
- package/src/get-aws-urls.ts +0 -85
- package/src/get-buckets.ts +0 -84
- package/src/get-compositions-on-lambda.ts +0 -111
- package/src/get-credentials.ts +0 -81
- package/src/get-env-variable.ts +0 -15
- package/src/get-function-name.ts +0 -24
- package/src/get-function-version.ts +0 -49
- package/src/get-functions.ts +0 -114
- package/src/get-output-url-from-metadata.ts +0 -23
- package/src/get-render-progress.ts +0 -66
- package/src/get-s3-client.ts +0 -26
- package/src/get-service-client.ts +0 -195
- package/src/get-sites.ts +0 -136
- package/src/head-file.ts +0 -30
- package/src/index.ts +0 -152
- package/src/is-cli.ts +0 -7
- package/src/is-flaky-error.ts +0 -104
- package/src/is-in-lambda.ts +0 -5
- package/src/is-likely-to-have-aws-profile.ts +0 -55
- package/src/lambda-version-string.ts +0 -5
- package/src/lifecycle-rules.ts +0 -119
- package/src/lifecycle.ts +0 -44
- package/src/list-objects.ts +0 -87
- package/src/make-lambda-payload.ts +0 -328
- package/src/make-s3-url.ts +0 -13
- package/src/p-limit.ts +0 -75
- package/src/pages-router-webhook.ts +0 -68
- package/src/parse-function-name.ts +0 -24
- package/src/presign-url.ts +0 -121
- package/src/price-per-1s.ts +0 -863
- package/src/random-hash.ts +0 -10
- package/src/read-file.ts +0 -35
- package/src/regions.ts +0 -48
- package/src/render-media-on-lambda.ts +0 -227
- package/src/render-still-on-lambda.ts +0 -209
- package/src/runtime-preference.ts +0 -7
- package/src/speculate-function-name.ts +0 -60
- package/src/test/concurrency-payload.test.ts +0 -121
- package/src/test/encode-aws-url.test.ts +0 -7
- package/src/test/price-calculation.test.ts +0 -62
- package/src/test/pricing.test.ts +0 -32
- package/src/test/request-handler.test.ts +0 -42
- package/src/test/validate-disk-size-in-mb.test.ts +0 -15
- package/src/types.ts +0 -7
- package/src/validate-aws-region.ts +0 -14
- package/src/validate-bucketname.ts +0 -24
- package/src/validate-disk-size-in-mb.ts +0 -37
- package/src/validate-lambda-codec.ts +0 -28
- package/src/validate-memory-size.ts +0 -31
- package/src/validate-presign-expiration.ts +0 -46
- package/src/validate-serveurl.ts +0 -9
- package/src/validate-webhook-signature.ts +0 -42
- package/src/write-file.ts +0 -108
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
package/src/get-buckets.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {GetBucketLocationCommand, ListBucketsCommand} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {ProviderSpecifics} from '@remotion/serverless-client';
|
|
3
|
-
import type {AwsProvider} from './aws-provider';
|
|
4
|
-
import {REMOTION_BUCKET_PREFIX} from './constants';
|
|
5
|
-
import {getS3Client} from './get-s3-client';
|
|
6
|
-
import type {AwsRegion} from './regions';
|
|
7
|
-
import {parseBucketName} from './validate-bucketname';
|
|
8
|
-
|
|
9
|
-
export type BucketWithLocation = {
|
|
10
|
-
name: string;
|
|
11
|
-
creationDate: number;
|
|
12
|
-
region: AwsRegion;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const getRemotionBuckets: ProviderSpecifics<AwsProvider>['getBuckets'] =
|
|
16
|
-
async ({
|
|
17
|
-
region,
|
|
18
|
-
forceBucketName,
|
|
19
|
-
forcePathStyle,
|
|
20
|
-
requestHandler,
|
|
21
|
-
}): Promise<BucketWithLocation[]> => {
|
|
22
|
-
const {Buckets} = await getS3Client({
|
|
23
|
-
region,
|
|
24
|
-
customCredentials: null,
|
|
25
|
-
forcePathStyle,
|
|
26
|
-
requestHandler,
|
|
27
|
-
}).send(new ListBucketsCommand({}));
|
|
28
|
-
if (!Buckets) {
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const remotionBuckets = Buckets.filter((b) => {
|
|
33
|
-
if (forceBucketName) {
|
|
34
|
-
return b.Name === forceBucketName;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return b.Name?.startsWith(REMOTION_BUCKET_PREFIX);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const locations = await Promise.all(
|
|
41
|
-
remotionBuckets.map(async (bucket) => {
|
|
42
|
-
const {region: parsedRegion} = parseBucketName(bucket.Name as string);
|
|
43
|
-
if (parsedRegion) {
|
|
44
|
-
return parsedRegion;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const result = await getS3Client({
|
|
49
|
-
region,
|
|
50
|
-
customCredentials: null,
|
|
51
|
-
forcePathStyle,
|
|
52
|
-
requestHandler,
|
|
53
|
-
}).send(
|
|
54
|
-
new GetBucketLocationCommand({
|
|
55
|
-
Bucket: bucket.Name as string,
|
|
56
|
-
}),
|
|
57
|
-
);
|
|
58
|
-
// AWS docs: Buckets in Region us-east-1 have a LocationConstraint of null!!
|
|
59
|
-
return result.LocationConstraint ?? ('us-east-1' as AwsRegion);
|
|
60
|
-
} catch (err) {
|
|
61
|
-
// Sometimes the API returns a bucket even if it was deleted before
|
|
62
|
-
if ((err as Error).stack?.includes('NoSuchBucket')) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
throw err;
|
|
67
|
-
}
|
|
68
|
-
}),
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const bucketsWithLocation = remotionBuckets
|
|
72
|
-
.map((bucket, i): BucketWithLocation => {
|
|
73
|
-
return {
|
|
74
|
-
creationDate: (bucket.CreationDate as Date).getTime(),
|
|
75
|
-
name: bucket.Name as string,
|
|
76
|
-
region: locations[i] as AwsRegion,
|
|
77
|
-
};
|
|
78
|
-
})
|
|
79
|
-
.filter((b) => b.region);
|
|
80
|
-
|
|
81
|
-
return bucketsWithLocation.filter((bucket) => {
|
|
82
|
-
return bucket.region === region;
|
|
83
|
-
});
|
|
84
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
BrowserSafeApis,
|
|
3
|
-
ChromiumOptions,
|
|
4
|
-
ToOptions,
|
|
5
|
-
VideoConfig,
|
|
6
|
-
} from '@remotion/serverless-client';
|
|
7
|
-
import {
|
|
8
|
-
ServerlessRoutines,
|
|
9
|
-
VERSION,
|
|
10
|
-
compressInputProps,
|
|
11
|
-
getNeedsToUpload,
|
|
12
|
-
serializeOrThrow,
|
|
13
|
-
} from '@remotion/serverless-client';
|
|
14
|
-
import {awsImplementation} from './aws-provider';
|
|
15
|
-
import type {AwsRegion} from './regions';
|
|
16
|
-
import type {RequestHandler} from './types';
|
|
17
|
-
|
|
18
|
-
export type GetCompositionsOnLambdaInput = {
|
|
19
|
-
chromiumOptions?: ChromiumOptions;
|
|
20
|
-
region: AwsRegion;
|
|
21
|
-
inputProps: Record<string, unknown>;
|
|
22
|
-
functionName: string;
|
|
23
|
-
serveUrl: string;
|
|
24
|
-
envVariables?: Record<string, string>;
|
|
25
|
-
forceBucketName?: string;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated in favor of `logLevel`: true
|
|
28
|
-
*/
|
|
29
|
-
dumpBrowserLogs?: boolean;
|
|
30
|
-
forcePathStyle?: boolean;
|
|
31
|
-
requestHandler?: RequestHandler | null;
|
|
32
|
-
} & Partial<
|
|
33
|
-
ToOptions<typeof BrowserSafeApis.optionsMap.getCompositionsOnLambda>
|
|
34
|
-
>;
|
|
35
|
-
|
|
36
|
-
export type GetCompositionsOnLambdaOutput = VideoConfig[];
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
* @description Gets the compositions inside a Lambda function.
|
|
40
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/getcompositionsonlambda)
|
|
41
|
-
*/
|
|
42
|
-
export const getCompositionsOnLambda = async ({
|
|
43
|
-
chromiumOptions,
|
|
44
|
-
serveUrl,
|
|
45
|
-
region,
|
|
46
|
-
inputProps,
|
|
47
|
-
functionName,
|
|
48
|
-
envVariables,
|
|
49
|
-
logLevel,
|
|
50
|
-
timeoutInMilliseconds,
|
|
51
|
-
forceBucketName: bucketName,
|
|
52
|
-
dumpBrowserLogs,
|
|
53
|
-
offthreadVideoCacheSizeInBytes,
|
|
54
|
-
forcePathStyle,
|
|
55
|
-
requestHandler,
|
|
56
|
-
mediaCacheSizeInBytes,
|
|
57
|
-
}: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {
|
|
58
|
-
const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');
|
|
59
|
-
|
|
60
|
-
const serializedInputProps = await compressInputProps({
|
|
61
|
-
stringifiedInputProps,
|
|
62
|
-
region,
|
|
63
|
-
userSpecifiedBucketName: bucketName ?? null,
|
|
64
|
-
propsType: 'input-props',
|
|
65
|
-
needsToUpload: getNeedsToUpload({
|
|
66
|
-
type: 'video-or-audio',
|
|
67
|
-
sizes: [
|
|
68
|
-
stringifiedInputProps.length,
|
|
69
|
-
JSON.stringify(envVariables).length,
|
|
70
|
-
],
|
|
71
|
-
providerSpecifics: awsImplementation,
|
|
72
|
-
}),
|
|
73
|
-
providerSpecifics: awsImplementation,
|
|
74
|
-
forcePathStyle: forcePathStyle ?? false,
|
|
75
|
-
skipPutAcl: false,
|
|
76
|
-
requestHandler,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
const res = await awsImplementation.callFunctionSync({
|
|
81
|
-
functionName,
|
|
82
|
-
type: ServerlessRoutines.compositions,
|
|
83
|
-
payload: {
|
|
84
|
-
type: ServerlessRoutines.compositions,
|
|
85
|
-
chromiumOptions: chromiumOptions ?? {},
|
|
86
|
-
serveUrl,
|
|
87
|
-
envVariables,
|
|
88
|
-
inputProps: serializedInputProps,
|
|
89
|
-
logLevel: dumpBrowserLogs ? 'verbose' : (logLevel ?? 'info'),
|
|
90
|
-
timeoutInMilliseconds: timeoutInMilliseconds ?? 30000,
|
|
91
|
-
version: VERSION,
|
|
92
|
-
bucketName: bucketName ?? null,
|
|
93
|
-
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
|
|
94
|
-
forcePathStyle: forcePathStyle ?? false,
|
|
95
|
-
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
|
|
96
|
-
},
|
|
97
|
-
region,
|
|
98
|
-
timeoutInTest: 120000,
|
|
99
|
-
requestHandler,
|
|
100
|
-
});
|
|
101
|
-
return res.compositions;
|
|
102
|
-
} catch (err) {
|
|
103
|
-
if ((err as Error).stack?.includes('UnrecognizedClientException')) {
|
|
104
|
-
throw new Error(
|
|
105
|
-
'UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception',
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
throw err;
|
|
110
|
-
}
|
|
111
|
-
};
|
package/src/get-credentials.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {fromIni} from '@aws-sdk/credential-provider-ini';
|
|
2
|
-
import {getEnvVariable} from './get-env-variable';
|
|
3
|
-
import {isInsideLambda} from './is-in-lambda';
|
|
4
|
-
|
|
5
|
-
type CredentialPair = {
|
|
6
|
-
accessKeyId: string;
|
|
7
|
-
secretAccessKey: string;
|
|
8
|
-
sessionToken?: string;
|
|
9
|
-
};
|
|
10
|
-
type AwsCredentialIdentityProvider = ReturnType<typeof fromIni>;
|
|
11
|
-
|
|
12
|
-
export const getCredentials = ():
|
|
13
|
-
| CredentialPair
|
|
14
|
-
| AwsCredentialIdentityProvider
|
|
15
|
-
| undefined => {
|
|
16
|
-
if (isInsideLambda()) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (getEnvVariable('REMOTION_AWS_PROFILE')) {
|
|
21
|
-
return fromIni({
|
|
22
|
-
profile: getEnvVariable('REMOTION_AWS_PROFILE'),
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') &&
|
|
28
|
-
getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY') &&
|
|
29
|
-
getEnvVariable('REMOTION_AWS_SESSION_TOKEN')
|
|
30
|
-
) {
|
|
31
|
-
return {
|
|
32
|
-
accessKeyId: getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') as string,
|
|
33
|
-
secretAccessKey: getEnvVariable(
|
|
34
|
-
'REMOTION_AWS_SECRET_ACCESS_KEY',
|
|
35
|
-
) as string,
|
|
36
|
-
sessionToken: getEnvVariable('REMOTION_AWS_SESSION_TOKEN') as string,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') &&
|
|
42
|
-
getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY')
|
|
43
|
-
) {
|
|
44
|
-
return {
|
|
45
|
-
accessKeyId: getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') as string,
|
|
46
|
-
secretAccessKey: getEnvVariable(
|
|
47
|
-
'REMOTION_AWS_SECRET_ACCESS_KEY',
|
|
48
|
-
) as string,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (getEnvVariable('AWS_PROFILE')) {
|
|
53
|
-
return fromIni({
|
|
54
|
-
profile: getEnvVariable('AWS_PROFILE'),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
getEnvVariable('AWS_ACCESS_KEY_ID') &&
|
|
60
|
-
getEnvVariable('AWS_SECRET_ACCESS_KEY') &&
|
|
61
|
-
getEnvVariable('AWS_SESSION_TOKEN')
|
|
62
|
-
) {
|
|
63
|
-
return {
|
|
64
|
-
accessKeyId: getEnvVariable('AWS_ACCESS_KEY_ID') as string,
|
|
65
|
-
secretAccessKey: getEnvVariable('AWS_SECRET_ACCESS_KEY') as string,
|
|
66
|
-
sessionToken: getEnvVariable('AWS_SESSION_TOKEN') as string,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
getEnvVariable('AWS_ACCESS_KEY_ID') &&
|
|
72
|
-
getEnvVariable('AWS_SECRET_ACCESS_KEY')
|
|
73
|
-
) {
|
|
74
|
-
return {
|
|
75
|
-
accessKeyId: getEnvVariable('AWS_ACCESS_KEY_ID') as string,
|
|
76
|
-
secretAccessKey: getEnvVariable('AWS_SECRET_ACCESS_KEY') as string,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return undefined;
|
|
81
|
-
};
|
package/src/get-env-variable.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export const getEnvVariable = (name: string) => {
|
|
2
|
-
if (
|
|
3
|
-
typeof process !== 'undefined' &&
|
|
4
|
-
typeof process.env !== 'undefined' &&
|
|
5
|
-
process.env[name]
|
|
6
|
-
) {
|
|
7
|
-
return process.env[name];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (typeof Deno !== 'undefined' && Deno.env.has(name)) {
|
|
11
|
-
return Deno.env.get(name);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return undefined;
|
|
15
|
-
};
|
package/src/get-function-name.ts
DELETED
|
@@ -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,49 +0,0 @@
|
|
|
1
|
-
import type {LogLevel} from '@remotion/serverless-client';
|
|
2
|
-
import {
|
|
3
|
-
COMMAND_NOT_FOUND,
|
|
4
|
-
ServerlessRoutines,
|
|
5
|
-
} from '@remotion/serverless-client';
|
|
6
|
-
import {awsImplementation} from './aws-provider';
|
|
7
|
-
import type {AwsRegion} from './regions';
|
|
8
|
-
import type {RequestHandler} from './types';
|
|
9
|
-
|
|
10
|
-
export const getFunctionVersion = async ({
|
|
11
|
-
functionName,
|
|
12
|
-
region,
|
|
13
|
-
logLevel,
|
|
14
|
-
requestHandler,
|
|
15
|
-
}: {
|
|
16
|
-
functionName: string;
|
|
17
|
-
region: AwsRegion;
|
|
18
|
-
logLevel: LogLevel;
|
|
19
|
-
requestHandler: RequestHandler | null | undefined;
|
|
20
|
-
}): Promise<string> => {
|
|
21
|
-
try {
|
|
22
|
-
// For now, we'll pass requestHandler to the awsImplementation if needed
|
|
23
|
-
// This might require deeper changes in the serverless-client framework
|
|
24
|
-
const result = await awsImplementation.callFunctionSync({
|
|
25
|
-
functionName,
|
|
26
|
-
payload: {
|
|
27
|
-
logLevel,
|
|
28
|
-
type: ServerlessRoutines.info,
|
|
29
|
-
},
|
|
30
|
-
region,
|
|
31
|
-
type: ServerlessRoutines.info,
|
|
32
|
-
timeoutInTest: 120000,
|
|
33
|
-
requestHandler,
|
|
34
|
-
});
|
|
35
|
-
return result.version;
|
|
36
|
-
} catch (err) {
|
|
37
|
-
// Prerelease versions had no info command
|
|
38
|
-
if ((err as Error).message.includes(COMMAND_NOT_FOUND)) {
|
|
39
|
-
return 'n/a';
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Bug in certain version of AWS S3 kit
|
|
43
|
-
if ((err as Error).message.includes('AWS CRT binary not present ')) {
|
|
44
|
-
return 'n/a';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
throw err;
|
|
48
|
-
}
|
|
49
|
-
};
|
package/src/get-functions.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import type {FunctionConfiguration} from '@aws-sdk/client-lambda';
|
|
2
|
-
import {ListFunctionsCommand} from '@aws-sdk/client-lambda';
|
|
3
|
-
import type {FunctionInfo, LogLevel} from '@remotion/serverless-client';
|
|
4
|
-
import {VERSION} from '@remotion/serverless-client';
|
|
5
|
-
import {getLambdaClient} from './aws-clients';
|
|
6
|
-
import {DEFAULT_EPHEMERAL_STORAGE_IN_MB, RENDER_FN_PREFIX} from './constants';
|
|
7
|
-
import {getFunctionVersion} from './get-function-version';
|
|
8
|
-
import type {AwsRegion} from './regions';
|
|
9
|
-
import type {RequestHandler} from './types';
|
|
10
|
-
|
|
11
|
-
export type GetFunctionsInput = {
|
|
12
|
-
region: AwsRegion;
|
|
13
|
-
compatibleOnly: boolean;
|
|
14
|
-
logLevel?: LogLevel;
|
|
15
|
-
requestHandler?: RequestHandler;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const getAllFunctions = async ({
|
|
19
|
-
existing,
|
|
20
|
-
nextMarker,
|
|
21
|
-
region,
|
|
22
|
-
requestHandler,
|
|
23
|
-
}: {
|
|
24
|
-
existing: FunctionConfiguration[];
|
|
25
|
-
nextMarker: string | null;
|
|
26
|
-
region: AwsRegion;
|
|
27
|
-
requestHandler?: RequestHandler;
|
|
28
|
-
}): Promise<FunctionConfiguration[]> => {
|
|
29
|
-
const allLambdas: FunctionConfiguration[] = [...existing];
|
|
30
|
-
const lambdas = await getLambdaClient(
|
|
31
|
-
region,
|
|
32
|
-
undefined,
|
|
33
|
-
requestHandler ?? null,
|
|
34
|
-
).send(
|
|
35
|
-
new ListFunctionsCommand({
|
|
36
|
-
Marker: nextMarker ?? undefined,
|
|
37
|
-
}),
|
|
38
|
-
);
|
|
39
|
-
if (!lambdas.Functions) {
|
|
40
|
-
return allLambdas;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
for (const lambda of lambdas.Functions) {
|
|
44
|
-
allLambdas.push(lambda);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (lambdas.NextMarker) {
|
|
48
|
-
return getAllFunctions({
|
|
49
|
-
existing: allLambdas,
|
|
50
|
-
nextMarker: lambdas.NextMarker,
|
|
51
|
-
region,
|
|
52
|
-
requestHandler,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return allLambdas;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/*
|
|
60
|
-
* @description Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
|
|
61
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
|
|
62
|
-
*/
|
|
63
|
-
export const getFunctions = async (
|
|
64
|
-
params: GetFunctionsInput,
|
|
65
|
-
): Promise<FunctionInfo[]> => {
|
|
66
|
-
const lambdas = await getAllFunctions({
|
|
67
|
-
existing: [],
|
|
68
|
-
nextMarker: null,
|
|
69
|
-
region: params.region,
|
|
70
|
-
requestHandler: params.requestHandler,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
const remotionLambdas = lambdas.filter((f) => {
|
|
74
|
-
return f.FunctionName?.startsWith(RENDER_FN_PREFIX);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const configs = await Promise.all(
|
|
78
|
-
remotionLambdas.map(async (fn) => {
|
|
79
|
-
try {
|
|
80
|
-
const version = await getFunctionVersion({
|
|
81
|
-
functionName: fn.FunctionName as string,
|
|
82
|
-
region: params.region,
|
|
83
|
-
logLevel: params.logLevel ?? 'info',
|
|
84
|
-
requestHandler: params.requestHandler,
|
|
85
|
-
});
|
|
86
|
-
return version;
|
|
87
|
-
} catch {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
const list = remotionLambdas.map((lambda, i): FunctionInfo => {
|
|
94
|
-
return {
|
|
95
|
-
functionName: lambda.FunctionName as string,
|
|
96
|
-
version: configs[i],
|
|
97
|
-
memorySizeInMb: lambda.MemorySize as number,
|
|
98
|
-
timeoutInSeconds: lambda.Timeout as number,
|
|
99
|
-
diskSizeInMb:
|
|
100
|
-
lambda.EphemeralStorage?.Size ?? DEFAULT_EPHEMERAL_STORAGE_IN_MB,
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
if (!params.compatibleOnly) {
|
|
104
|
-
return list;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return list.filter((l) => {
|
|
108
|
-
if (!params.compatibleOnly) {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return l.version === VERSION;
|
|
113
|
-
});
|
|
114
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type {GetOutputUrl} from '@remotion/serverless-client';
|
|
2
|
-
import {getExpectedOutName} from '@remotion/serverless-client';
|
|
3
|
-
import type {AwsProvider} from './aws-provider';
|
|
4
|
-
import {REMOTION_BUCKET_PREFIX} from './constants';
|
|
5
|
-
|
|
6
|
-
export const getOutputUrlFromMetadata: GetOutputUrl<AwsProvider> = ({
|
|
7
|
-
renderMetadata,
|
|
8
|
-
bucketName,
|
|
9
|
-
customCredentials,
|
|
10
|
-
currentRegion,
|
|
11
|
-
}) => {
|
|
12
|
-
const {key, renderBucketName} = getExpectedOutName({
|
|
13
|
-
renderMetadata,
|
|
14
|
-
bucketName,
|
|
15
|
-
customCredentials,
|
|
16
|
-
bucketNamePrefix: REMOTION_BUCKET_PREFIX,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
url: `https://s3.${currentRegion}.amazonaws.com/${renderBucketName}/${key}`,
|
|
21
|
-
key,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type {CustomCredentials, LogLevel} from '@remotion/serverless-client';
|
|
2
|
-
import {getProgress, ServerlessRoutines} from '@remotion/serverless-client';
|
|
3
|
-
import {awsImplementation, type AwsProvider} from './aws-provider';
|
|
4
|
-
import type {RenderProgress} from './constants';
|
|
5
|
-
import {getRenderProgressPayload} from './make-lambda-payload';
|
|
6
|
-
import {parseFunctionName} from './parse-function-name';
|
|
7
|
-
import type {AwsRegion} from './regions';
|
|
8
|
-
import type {RequestHandler} from './types';
|
|
9
|
-
|
|
10
|
-
export type GetRenderProgressInput = {
|
|
11
|
-
functionName: string;
|
|
12
|
-
bucketName: string;
|
|
13
|
-
renderId: string;
|
|
14
|
-
region: AwsRegion;
|
|
15
|
-
logLevel?: LogLevel;
|
|
16
|
-
s3OutputProvider?: CustomCredentials<AwsProvider>;
|
|
17
|
-
forcePathStyle?: boolean;
|
|
18
|
-
skipLambdaInvocation?: boolean;
|
|
19
|
-
requestHandler?: RequestHandler;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
* @description Gets the current status of a render originally triggered via renderMediaOnLambda().
|
|
24
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/getrenderprogress)
|
|
25
|
-
*/
|
|
26
|
-
export const getRenderProgress = async (
|
|
27
|
-
input: GetRenderProgressInput,
|
|
28
|
-
): Promise<RenderProgress> => {
|
|
29
|
-
if (input.skipLambdaInvocation) {
|
|
30
|
-
const parsed = parseFunctionName(input.functionName);
|
|
31
|
-
if (!parsed) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
[
|
|
34
|
-
`The function name ${input.functionName} does not adhere to the function name convention (https://www.remotion.dev/docs/lambda/naming-convention).`,
|
|
35
|
-
'Cannot determine memory and disk size from the function name.',
|
|
36
|
-
'You must call getRenderProgress with `skipLambdaInvocation` set to false.',
|
|
37
|
-
].join('\n'),
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return getProgress<AwsProvider>({
|
|
42
|
-
bucketName: input.bucketName,
|
|
43
|
-
renderId: input.renderId,
|
|
44
|
-
region: input.region,
|
|
45
|
-
forcePathStyle: input.forcePathStyle ?? false,
|
|
46
|
-
customCredentials: input.s3OutputProvider ?? null,
|
|
47
|
-
expectedBucketOwner: null,
|
|
48
|
-
providerSpecifics: awsImplementation,
|
|
49
|
-
memorySizeInMb: parsed.memorySizeInMb,
|
|
50
|
-
timeoutInMilliseconds: parsed.timeoutInSeconds * 1000,
|
|
51
|
-
functionName: input.functionName,
|
|
52
|
-
requestHandler: input.requestHandler,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const result =
|
|
57
|
-
await awsImplementation.callFunctionSync<ServerlessRoutines.status>({
|
|
58
|
-
functionName: input.functionName,
|
|
59
|
-
type: ServerlessRoutines.status,
|
|
60
|
-
payload: getRenderProgressPayload(input),
|
|
61
|
-
region: input.region,
|
|
62
|
-
timeoutInTest: 120000,
|
|
63
|
-
requestHandler: input.requestHandler,
|
|
64
|
-
});
|
|
65
|
-
return result;
|
|
66
|
-
};
|
package/src/get-s3-client.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type {S3Client} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {CustomCredentials} from '@remotion/serverless-client';
|
|
3
|
-
import type {AwsProvider} from './aws-provider';
|
|
4
|
-
import {getServiceClient} from './get-service-client';
|
|
5
|
-
import type {AwsRegion} from './regions';
|
|
6
|
-
import type {RequestHandler} from './types';
|
|
7
|
-
|
|
8
|
-
export const getS3Client = ({
|
|
9
|
-
region,
|
|
10
|
-
customCredentials,
|
|
11
|
-
forcePathStyle,
|
|
12
|
-
requestHandler,
|
|
13
|
-
}: {
|
|
14
|
-
region: AwsRegion;
|
|
15
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
16
|
-
forcePathStyle: boolean;
|
|
17
|
-
requestHandler: RequestHandler | null;
|
|
18
|
-
}): S3Client => {
|
|
19
|
-
return getServiceClient({
|
|
20
|
-
region: customCredentials?.region ?? region,
|
|
21
|
-
service: 's3',
|
|
22
|
-
customCredentials,
|
|
23
|
-
forcePathStyle,
|
|
24
|
-
requestHandler,
|
|
25
|
-
});
|
|
26
|
-
};
|