@remotion/lambda-client 4.0.387 → 4.0.389
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/index.js +33 -33
- package/dist/esm/index.mjs +20 -20
- package/package.json +3 -3
- package/dist/app-router-webhook.d.ts +0 -10
- package/dist/app-router-webhook.js +0 -43
- package/dist/apply-lifecycle.d.ts +0 -8
- package/dist/apply-lifecycle.js +0 -18
- package/dist/aws-clients.d.ts +0 -12
- package/dist/aws-clients.js +0 -56
- package/dist/aws-provider.d.ts +0 -27
- package/dist/aws-provider.js +0 -94
- package/dist/bucket-exists.d.ts +0 -3
- package/dist/bucket-exists.js +0 -27
- package/dist/call-lambda-async.d.ts +0 -2
- package/dist/call-lambda-async.js +0 -20
- package/dist/call-lambda-streaming.d.ts +0 -6
- package/dist/call-lambda-streaming.js +0 -126
- package/dist/call-lambda-sync.d.ts +0 -2
- package/dist/call-lambda-sync.js +0 -30
- package/dist/check-credentials.d.ts +0 -1
- package/dist/check-credentials.js +0 -39
- package/dist/clean-items.d.ts +0 -17
- package/dist/clean-items.js +0 -26
- package/dist/constants.d.ts +0 -25
- package/dist/constants.js +0 -26
- package/dist/content-disposition-header.d.ts +0 -2
- package/dist/content-disposition-header.js +0 -50
- package/dist/convert-to-serve-url.d.ts +0 -6
- package/dist/convert-to-serve-url.js +0 -14
- package/dist/create-bucket.d.ts +0 -3
- package/dist/create-bucket.js +0 -65
- package/dist/delete-file.d.ts +0 -3
- package/dist/delete-file.js +0 -17
- package/dist/delete-function.d.ts +0 -7
- package/dist/delete-function.js +0 -15
- package/dist/delete-render.d.ts +0 -22
- package/dist/delete-render.js +0 -90
- package/dist/encode-aws-url-params.d.ts +0 -1
- package/dist/encode-aws-url-params.js +0 -7
- package/dist/estimate-price.d.ts +0 -17
- package/dist/estimate-price.js +0 -45
- package/dist/express-webhook.d.ts +0 -3
- package/dist/express-webhook.js +0 -46
- package/dist/get-account-id.d.ts +0 -3
- package/dist/get-account-id.js +0 -15
- package/dist/get-aws-client.d.ts +0 -32
- package/dist/get-aws-client.js +0 -67
- package/dist/get-aws-urls.d.ts +0 -25
- package/dist/get-aws-urls.js +0 -31
- package/dist/get-buckets.d.ts +0 -9
- package/dist/get-buckets.js +0 -64
- package/dist/get-compositions-on-lambda.d.ts +0 -20
- package/dist/get-compositions-on-lambda.js +0 -62
- package/dist/get-credentials.d.ts +0 -9
- package/dist/get-credentials.js +0 -55
- package/dist/get-env-variable.d.ts +0 -1
- package/dist/get-env-variable.js +0 -15
- package/dist/get-function-name.d.ts +0 -8
- package/dist/get-function-name.js +0 -17
- package/dist/get-function-version.d.ts +0 -9
- package/dist/get-function-version.js +0 -35
- package/dist/get-functions.d.ts +0 -10
- package/dist/get-functions.js +0 -80
- package/dist/get-output-url-from-metadata.d.ts +0 -3
- package/dist/get-output-url-from-metadata.js +0 -18
- package/dist/get-render-progress.d.ts +0 -17
- package/dist/get-render-progress.js +0 -47
- package/dist/get-s3-client.d.ts +0 -11
- package/dist/get-s3-client.js +0 -15
- package/dist/get-service-client.d.ts +0 -25
- package/dist/get-service-client.js +0 -131
- package/dist/get-sites.d.ts +0 -31
- package/dist/get-sites.js +0 -83
- package/dist/head-file.d.ts +0 -3
- package/dist/head-file.js +0 -18
- package/dist/index.d.ts +0 -129
- package/dist/index.js +0 -108
- package/dist/is-cli.d.ts +0 -2
- package/dist/is-cli.js +0 -10
- package/dist/is-flaky-error.d.ts +0 -1
- package/dist/is-flaky-error.js +0 -78
- package/dist/is-in-lambda.d.ts +0 -1
- package/dist/is-in-lambda.js +0 -9
- package/dist/is-likely-to-have-aws-profile.d.ts +0 -1
- package/dist/is-likely-to-have-aws-profile.js +0 -50
- package/dist/lambda-version-string.d.ts +0 -1
- package/dist/lambda-version-string.js +0 -7
- package/dist/lifecycle-rules.d.ts +0 -12
- package/dist/lifecycle-rules.js +0 -73
- package/dist/lifecycle.d.ts +0 -7
- package/dist/lifecycle.js +0 -24
- package/dist/list-objects.d.ts +0 -3
- package/dist/list-objects.js +0 -70
- package/dist/make-lambda-payload.d.ts +0 -59
- package/dist/make-lambda-payload.js +0 -150
- package/dist/make-s3-url.d.ts +0 -6
- package/dist/make-s3-url.js +0 -7
- package/dist/p-limit.d.ts +0 -1
- package/dist/p-limit.js +0 -57
- package/dist/pages-router-webhook.d.ts +0 -5
- package/dist/pages-router-webhook.js +0 -48
- package/dist/parse-function-name.d.ts +0 -8
- package/dist/parse-function-name.js +0 -17
- package/dist/presign-url.d.ts +0 -17
- package/dist/presign-url.js +0 -66
- package/dist/price-per-1s.d.ts +0 -37
- package/dist/price-per-1s.js +0 -822
- package/dist/random-hash.d.ts +0 -1
- package/dist/random-hash.js +0 -13
- package/dist/read-file.d.ts +0 -11
- package/dist/read-file.js +0 -19
- package/dist/regions.d.ts +0 -3
- package/dist/regions.js +0 -48
- package/dist/render-media-on-lambda.d.ts +0 -66
- package/dist/render-media-on-lambda.js +0 -133
- package/dist/render-still-on-lambda.d.ts +0 -61
- package/dist/render-still-on-lambda.js +0 -121
- package/dist/runtime-preference.d.ts +0 -2
- package/dist/runtime-preference.js +0 -8
- package/dist/speculate-function-name.d.ts +0 -7
- package/dist/speculate-function-name.js +0 -39
- package/dist/types.d.ts +0 -4
- package/dist/types.js +0 -2
- package/dist/validate-aws-region.d.ts +0 -2
- package/dist/validate-aws-region.js +0 -9
- package/dist/validate-bucketname.d.ts +0 -4
- package/dist/validate-bucketname.js +0 -15
- package/dist/validate-disk-size-in-mb.d.ts +0 -1
- package/dist/validate-disk-size-in-mb.js +0 -23
- package/dist/validate-lambda-codec.d.ts +0 -2
- package/dist/validate-lambda-codec.js +0 -21
- package/dist/validate-memory-size.d.ts +0 -1
- package/dist/validate-memory-size.js +0 -22
- package/dist/validate-presign-expiration.d.ts +0 -1
- package/dist/validate-presign-expiration.js +0 -29
- package/dist/validate-serveurl.d.ts +0 -1
- package/dist/validate-serveurl.js +0 -9
- package/dist/validate-webhook-signature.d.ts +0 -5
- package/dist/validate-webhook-signature.js +0 -28
- package/dist/write-file.d.ts +0 -5
- package/dist/write-file.js +0 -83
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseFunctionName = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const parseFunctionName = (functionName) => {
|
|
6
|
-
const match = functionName.match(new RegExp(constants_1.RENDER_FN_PREFIX + '(.*)-mem(\\d+)mb-disk(\\d+)mb-(\\d+)sec$'));
|
|
7
|
-
if (!match) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
version: match[1],
|
|
12
|
-
memorySizeInMb: parseInt(match[2], 10),
|
|
13
|
-
diskSizeInMb: parseInt(match[3], 10),
|
|
14
|
-
timeoutInSeconds: parseInt(match[4], 10),
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
exports.parseFunctionName = parseFunctionName;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LogLevel } from '@remotion/serverless-client';
|
|
2
|
-
import type { AwsRegion } from './regions';
|
|
3
|
-
import type { RequestHandler } from './types';
|
|
4
|
-
export declare const getFunctionVersion: ({ functionName, region, logLevel, requestHandler, }: {
|
|
5
|
-
functionName: string;
|
|
6
|
-
region: AwsRegion;
|
|
7
|
-
logLevel: LogLevel;
|
|
8
|
-
requestHandler: RequestHandler | null | undefined;
|
|
9
|
-
}) => Promise<string>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFunctionVersion = void 0;
|
|
4
|
-
const serverless_client_1 = require("@remotion/serverless-client");
|
|
5
|
-
const aws_provider_1 = require("./aws-provider");
|
|
6
|
-
const getFunctionVersion = async ({ functionName, region, logLevel, requestHandler, }) => {
|
|
7
|
-
try {
|
|
8
|
-
// For now, we'll pass requestHandler to the awsImplementation if needed
|
|
9
|
-
// This might require deeper changes in the serverless-client framework
|
|
10
|
-
const result = await aws_provider_1.awsImplementation.callFunctionSync({
|
|
11
|
-
functionName,
|
|
12
|
-
payload: {
|
|
13
|
-
logLevel,
|
|
14
|
-
type: serverless_client_1.ServerlessRoutines.info,
|
|
15
|
-
},
|
|
16
|
-
region,
|
|
17
|
-
type: serverless_client_1.ServerlessRoutines.info,
|
|
18
|
-
timeoutInTest: 120000,
|
|
19
|
-
requestHandler,
|
|
20
|
-
});
|
|
21
|
-
return result.version;
|
|
22
|
-
}
|
|
23
|
-
catch (err) {
|
|
24
|
-
// Prerelease versions had no info command
|
|
25
|
-
if (err.message.includes(serverless_client_1.COMMAND_NOT_FOUND)) {
|
|
26
|
-
return 'n/a';
|
|
27
|
-
}
|
|
28
|
-
// Bug in certain version of AWS S3 kit
|
|
29
|
-
if (err.message.includes('AWS CRT binary not present ')) {
|
|
30
|
-
return 'n/a';
|
|
31
|
-
}
|
|
32
|
-
throw err;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
exports.getFunctionVersion = getFunctionVersion;
|
package/dist/get-functions.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { FunctionInfo, LogLevel } from '@remotion/serverless-client';
|
|
2
|
-
import type { AwsRegion } from './regions';
|
|
3
|
-
import type { RequestHandler } from './types';
|
|
4
|
-
export type GetFunctionsInput = {
|
|
5
|
-
region: AwsRegion;
|
|
6
|
-
compatibleOnly: boolean;
|
|
7
|
-
logLevel?: LogLevel;
|
|
8
|
-
requestHandler?: RequestHandler;
|
|
9
|
-
};
|
|
10
|
-
export declare const getFunctions: (params: GetFunctionsInput) => Promise<FunctionInfo[]>;
|
package/dist/get-functions.js
DELETED
|
@@ -1,80 +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 serverless_client_1 = require("@remotion/serverless-client");
|
|
6
|
-
const aws_clients_1 = require("./aws-clients");
|
|
7
|
-
const constants_1 = require("./constants");
|
|
8
|
-
const get_function_version_1 = require("./get-function-version");
|
|
9
|
-
const getAllFunctions = async ({ existing, nextMarker, region, requestHandler, }) => {
|
|
10
|
-
const allLambdas = [...existing];
|
|
11
|
-
const lambdas = await (0, aws_clients_1.getLambdaClient)(region, undefined, requestHandler !== null && requestHandler !== void 0 ? requestHandler : null).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
|
-
requestHandler,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return allLambdas;
|
|
29
|
-
};
|
|
30
|
-
/*
|
|
31
|
-
* @description Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.
|
|
32
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
|
|
33
|
-
*/
|
|
34
|
-
const getFunctions = async (params) => {
|
|
35
|
-
const lambdas = await getAllFunctions({
|
|
36
|
-
existing: [],
|
|
37
|
-
nextMarker: null,
|
|
38
|
-
region: params.region,
|
|
39
|
-
requestHandler: params.requestHandler,
|
|
40
|
-
});
|
|
41
|
-
const remotionLambdas = lambdas.filter((f) => {
|
|
42
|
-
var _a;
|
|
43
|
-
return (_a = f.FunctionName) === null || _a === void 0 ? void 0 : _a.startsWith(constants_1.RENDER_FN_PREFIX);
|
|
44
|
-
});
|
|
45
|
-
const configs = await Promise.all(remotionLambdas.map(async (fn) => {
|
|
46
|
-
var _a;
|
|
47
|
-
try {
|
|
48
|
-
const version = await (0, get_function_version_1.getFunctionVersion)({
|
|
49
|
-
functionName: fn.FunctionName,
|
|
50
|
-
region: params.region,
|
|
51
|
-
logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
|
|
52
|
-
requestHandler: params.requestHandler,
|
|
53
|
-
});
|
|
54
|
-
return version;
|
|
55
|
-
}
|
|
56
|
-
catch (_b) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
const list = remotionLambdas.map((lambda, i) => {
|
|
61
|
-
var _a, _b;
|
|
62
|
-
return {
|
|
63
|
-
functionName: lambda.FunctionName,
|
|
64
|
-
version: configs[i],
|
|
65
|
-
memorySizeInMb: lambda.MemorySize,
|
|
66
|
-
timeoutInSeconds: lambda.Timeout,
|
|
67
|
-
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,
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
if (!params.compatibleOnly) {
|
|
71
|
-
return list;
|
|
72
|
-
}
|
|
73
|
-
return list.filter((l) => {
|
|
74
|
-
if (!params.compatibleOnly) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
return l.version === serverless_client_1.VERSION;
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
exports.getFunctions = getFunctions;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOutputUrlFromMetadata = void 0;
|
|
4
|
-
const serverless_client_1 = require("@remotion/serverless-client");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
const getOutputUrlFromMetadata = ({ renderMetadata, bucketName, customCredentials, currentRegion, }) => {
|
|
7
|
-
const { key, renderBucketName } = (0, serverless_client_1.getExpectedOutName)({
|
|
8
|
-
renderMetadata,
|
|
9
|
-
bucketName,
|
|
10
|
-
customCredentials,
|
|
11
|
-
bucketNamePrefix: constants_1.REMOTION_BUCKET_PREFIX,
|
|
12
|
-
});
|
|
13
|
-
return {
|
|
14
|
-
url: `https://s3.${currentRegion}.amazonaws.com/${renderBucketName}/${key}`,
|
|
15
|
-
key,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
exports.getOutputUrlFromMetadata = getOutputUrlFromMetadata;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { CustomCredentials, LogLevel } from '@remotion/serverless-client';
|
|
2
|
-
import { type AwsProvider } from './aws-provider';
|
|
3
|
-
import type { RenderProgress } from './constants';
|
|
4
|
-
import type { AwsRegion } from './regions';
|
|
5
|
-
import type { RequestHandler } from './types';
|
|
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
|
-
requestHandler?: RequestHandler;
|
|
16
|
-
};
|
|
17
|
-
export declare const getRenderProgress: (input: GetRenderProgressInput) => Promise<RenderProgress>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRenderProgress = void 0;
|
|
4
|
-
const serverless_client_1 = require("@remotion/serverless-client");
|
|
5
|
-
const aws_provider_1 = require("./aws-provider");
|
|
6
|
-
const make_lambda_payload_1 = require("./make-lambda-payload");
|
|
7
|
-
const parse_function_name_1 = require("./parse-function-name");
|
|
8
|
-
/*
|
|
9
|
-
* @description Gets the current status of a render originally triggered via renderMediaOnLambda().
|
|
10
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/getrenderprogress)
|
|
11
|
-
*/
|
|
12
|
-
const getRenderProgress = async (input) => {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
if (input.skipLambdaInvocation) {
|
|
15
|
-
const parsed = (0, parse_function_name_1.parseFunctionName)(input.functionName);
|
|
16
|
-
if (!parsed) {
|
|
17
|
-
throw new Error([
|
|
18
|
-
`The function name ${input.functionName} does not adhere to the function name convention (https://www.remotion.dev/docs/lambda/naming-convention).`,
|
|
19
|
-
'Cannot determine memory and disk size from the function name.',
|
|
20
|
-
'You must call getRenderProgress with `skipLambdaInvocation` set to false.',
|
|
21
|
-
].join('\n'));
|
|
22
|
-
}
|
|
23
|
-
return (0, serverless_client_1.getProgress)({
|
|
24
|
-
bucketName: input.bucketName,
|
|
25
|
-
renderId: input.renderId,
|
|
26
|
-
region: input.region,
|
|
27
|
-
forcePathStyle: (_a = input.forcePathStyle) !== null && _a !== void 0 ? _a : false,
|
|
28
|
-
customCredentials: (_b = input.s3OutputProvider) !== null && _b !== void 0 ? _b : null,
|
|
29
|
-
expectedBucketOwner: null,
|
|
30
|
-
providerSpecifics: aws_provider_1.awsImplementation,
|
|
31
|
-
memorySizeInMb: parsed.memorySizeInMb,
|
|
32
|
-
timeoutInMilliseconds: parsed.timeoutInSeconds * 1000,
|
|
33
|
-
functionName: input.functionName,
|
|
34
|
-
requestHandler: input.requestHandler,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const result = await aws_provider_1.awsImplementation.callFunctionSync({
|
|
38
|
-
functionName: input.functionName,
|
|
39
|
-
type: serverless_client_1.ServerlessRoutines.status,
|
|
40
|
-
payload: (0, make_lambda_payload_1.getRenderProgressPayload)(input),
|
|
41
|
-
region: input.region,
|
|
42
|
-
timeoutInTest: 120000,
|
|
43
|
-
requestHandler: input.requestHandler,
|
|
44
|
-
});
|
|
45
|
-
return result;
|
|
46
|
-
};
|
|
47
|
-
exports.getRenderProgress = getRenderProgress;
|
package/dist/get-s3-client.d.ts
DELETED
|
@@ -1,11 +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 type { AwsRegion } from './regions';
|
|
5
|
-
import type { RequestHandler } from './types';
|
|
6
|
-
export declare const getS3Client: ({ region, customCredentials, forcePathStyle, requestHandler, }: {
|
|
7
|
-
region: AwsRegion;
|
|
8
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
9
|
-
forcePathStyle: boolean;
|
|
10
|
-
requestHandler: RequestHandler | null;
|
|
11
|
-
}) => S3Client;
|
package/dist/get-s3-client.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getS3Client = void 0;
|
|
4
|
-
const get_service_client_1 = require("./get-service-client");
|
|
5
|
-
const getS3Client = ({ region, customCredentials, forcePathStyle, requestHandler, }) => {
|
|
6
|
-
var _a;
|
|
7
|
-
return (0, get_service_client_1.getServiceClient)({
|
|
8
|
-
region: (_a = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.region) !== null && _a !== void 0 ? _a : region,
|
|
9
|
-
service: 's3',
|
|
10
|
-
customCredentials,
|
|
11
|
-
forcePathStyle,
|
|
12
|
-
requestHandler,
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
exports.getS3Client = getS3Client;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
-
import { IAMClient } from '@aws-sdk/client-iam';
|
|
3
|
-
import { LambdaClient } from '@aws-sdk/client-lambda';
|
|
4
|
-
import { S3Client } from '@aws-sdk/client-s3';
|
|
5
|
-
import { ServiceQuotasClient } from '@aws-sdk/client-service-quotas';
|
|
6
|
-
import { STSClient } from '@aws-sdk/client-sts';
|
|
7
|
-
import type { CustomCredentials } from '@remotion/serverless-client';
|
|
8
|
-
import type { AwsProvider } from './aws-provider';
|
|
9
|
-
import type { AwsRegion } from './regions';
|
|
10
|
-
import type { RequestHandler } from './types';
|
|
11
|
-
export type ServiceMapping = {
|
|
12
|
-
s3: S3Client;
|
|
13
|
-
cloudwatch: CloudWatchLogsClient;
|
|
14
|
-
iam: IAMClient;
|
|
15
|
-
lambda: LambdaClient;
|
|
16
|
-
servicequotas: ServiceQuotasClient;
|
|
17
|
-
sts: STSClient;
|
|
18
|
-
};
|
|
19
|
-
export declare const getServiceClient: <T extends keyof ServiceMapping>({ region, service, customCredentials, forcePathStyle, requestHandler, }: {
|
|
20
|
-
region: AwsRegion;
|
|
21
|
-
service: T;
|
|
22
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
23
|
-
forcePathStyle: boolean;
|
|
24
|
-
requestHandler: RequestHandler | null;
|
|
25
|
-
}) => ServiceMapping[T];
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getServiceClient = void 0;
|
|
4
|
-
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
5
|
-
const client_iam_1 = require("@aws-sdk/client-iam");
|
|
6
|
-
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
7
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
|
-
const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
|
|
9
|
-
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
10
|
-
const serverless_client_1 = require("@remotion/serverless-client");
|
|
11
|
-
const check_credentials_1 = require("./check-credentials");
|
|
12
|
-
const get_credentials_1 = require("./get-credentials");
|
|
13
|
-
const get_env_variable_1 = require("./get-env-variable");
|
|
14
|
-
const getCredentialsHash = ({ customCredentials, region, service, forcePathStyle, requestHandler, }) => {
|
|
15
|
-
const hashComponents = {};
|
|
16
|
-
if ((0, get_env_variable_1.getEnvVariable)('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')) {
|
|
17
|
-
hashComponents.credentials = {
|
|
18
|
-
credentialsSkipped: true,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
else if ((0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_PROFILE')) {
|
|
22
|
-
hashComponents.credentials = {
|
|
23
|
-
awsProfile: (0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_PROFILE'),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
else if ((0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_ACCESS_KEY_ID') &&
|
|
27
|
-
(0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_SECRET_ACCESS_KEY')) {
|
|
28
|
-
hashComponents.credentials = {
|
|
29
|
-
accessKeyId: (0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_ACCESS_KEY_ID'),
|
|
30
|
-
secretAccessKey: (0, get_env_variable_1.getEnvVariable)('REMOTION_AWS_SECRET_ACCESS_KEY'),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
else if ((0, get_env_variable_1.getEnvVariable)('AWS_PROFILE')) {
|
|
34
|
-
hashComponents.credentials = {
|
|
35
|
-
awsProfile: (0, get_env_variable_1.getEnvVariable)('AWS_PROFILE'),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
else if ((0, get_env_variable_1.getEnvVariable)('AWS_ACCESS_KEY_ID') &&
|
|
39
|
-
(0, get_env_variable_1.getEnvVariable)('AWS_SECRET_ACCESS_KEY')) {
|
|
40
|
-
hashComponents.credentials = {
|
|
41
|
-
accessKeyId: (0, get_env_variable_1.getEnvVariable)('AWS_ACCESS_KEY_ID'),
|
|
42
|
-
secretAccessKey: (0, get_env_variable_1.getEnvVariable)('AWS_SECRET_ACCESS_KEY'),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
hashComponents.customCredentials = customCredentials;
|
|
46
|
-
hashComponents.region = region;
|
|
47
|
-
hashComponents.service = service;
|
|
48
|
-
hashComponents.forcePathStyle = forcePathStyle;
|
|
49
|
-
hashComponents.requestHandler = requestHandler;
|
|
50
|
-
return (0, serverless_client_1.random)(JSON.stringify(hashComponents)).toString().replace('0.', '');
|
|
51
|
-
};
|
|
52
|
-
const _clients = {};
|
|
53
|
-
const getServiceClient = ({ region, service, customCredentials, forcePathStyle, requestHandler, }) => {
|
|
54
|
-
var _a;
|
|
55
|
-
const Client = (() => {
|
|
56
|
-
if (service === 'cloudwatch') {
|
|
57
|
-
return client_cloudwatch_logs_1.CloudWatchLogsClient;
|
|
58
|
-
}
|
|
59
|
-
if (service === 'lambda') {
|
|
60
|
-
return client_lambda_1.LambdaClient;
|
|
61
|
-
}
|
|
62
|
-
if (service === 's3') {
|
|
63
|
-
return client_s3_1.S3Client;
|
|
64
|
-
}
|
|
65
|
-
if (service === 'iam') {
|
|
66
|
-
return client_iam_1.IAMClient;
|
|
67
|
-
}
|
|
68
|
-
if (service === 'servicequotas') {
|
|
69
|
-
return client_service_quotas_1.ServiceQuotasClient;
|
|
70
|
-
}
|
|
71
|
-
if (service === 'sts') {
|
|
72
|
-
return client_sts_1.STSClient;
|
|
73
|
-
}
|
|
74
|
-
throw new TypeError('unknown client ' + service);
|
|
75
|
-
})();
|
|
76
|
-
const key = getCredentialsHash({
|
|
77
|
-
region,
|
|
78
|
-
customCredentials,
|
|
79
|
-
service,
|
|
80
|
-
forcePathStyle,
|
|
81
|
-
requestHandler,
|
|
82
|
-
});
|
|
83
|
-
if (!_clients[key]) {
|
|
84
|
-
(0, check_credentials_1.checkCredentials)();
|
|
85
|
-
const lambdaOptions = service === 'lambda'
|
|
86
|
-
? {
|
|
87
|
-
httpsAgent: {
|
|
88
|
-
maxSockets: serverless_client_1.MAX_FUNCTIONS_PER_RENDER * 2,
|
|
89
|
-
},
|
|
90
|
-
}
|
|
91
|
-
: undefined;
|
|
92
|
-
// Merge custom requestHandler with lambda options
|
|
93
|
-
const finalRequestHandler = requestHandler
|
|
94
|
-
? lambdaOptions
|
|
95
|
-
? { ...requestHandler, ...lambdaOptions }
|
|
96
|
-
: requestHandler
|
|
97
|
-
: lambdaOptions;
|
|
98
|
-
const client = customCredentials
|
|
99
|
-
? new Client({
|
|
100
|
-
region: (_a = customCredentials.region) !== null && _a !== void 0 ? _a : 'us-east-1',
|
|
101
|
-
credentials: customCredentials.accessKeyId && customCredentials.secretAccessKey
|
|
102
|
-
? {
|
|
103
|
-
accessKeyId: customCredentials.accessKeyId,
|
|
104
|
-
secretAccessKey: customCredentials.secretAccessKey,
|
|
105
|
-
}
|
|
106
|
-
: undefined,
|
|
107
|
-
endpoint: customCredentials.endpoint,
|
|
108
|
-
requestHandler: finalRequestHandler,
|
|
109
|
-
forcePathStyle: customCredentials.forcePathStyle,
|
|
110
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
111
|
-
})
|
|
112
|
-
: (0, get_env_variable_1.getEnvVariable)('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')
|
|
113
|
-
? new Client({
|
|
114
|
-
region,
|
|
115
|
-
requestHandler: finalRequestHandler,
|
|
116
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
117
|
-
})
|
|
118
|
-
: new Client({
|
|
119
|
-
region,
|
|
120
|
-
credentials: (0, get_credentials_1.getCredentials)(),
|
|
121
|
-
requestHandler: finalRequestHandler,
|
|
122
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
123
|
-
});
|
|
124
|
-
if ((0, get_env_variable_1.getEnvVariable)('REMOTION_DISABLE_AWS_CLIENT_CACHE')) {
|
|
125
|
-
return client;
|
|
126
|
-
}
|
|
127
|
-
_clients[key] = client;
|
|
128
|
-
}
|
|
129
|
-
return _clients[key];
|
|
130
|
-
};
|
|
131
|
-
exports.getServiceClient = getServiceClient;
|
package/dist/get-sites.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ProviderSpecifics } from '@remotion/serverless-client';
|
|
2
|
-
import type { AwsProvider } from './aws-provider';
|
|
3
|
-
import type { BucketWithLocation } from './get-buckets';
|
|
4
|
-
import type { AwsRegion } from './regions';
|
|
5
|
-
import type { RequestHandler } from './types';
|
|
6
|
-
type Site = {
|
|
7
|
-
sizeInBytes: number;
|
|
8
|
-
lastModified: number | null;
|
|
9
|
-
bucketName: string;
|
|
10
|
-
id: string;
|
|
11
|
-
serveUrl: string;
|
|
12
|
-
};
|
|
13
|
-
type MandatoryParameters = {
|
|
14
|
-
region: AwsRegion;
|
|
15
|
-
};
|
|
16
|
-
type OptionalParameters = {
|
|
17
|
-
forceBucketName: string | null;
|
|
18
|
-
forcePathStyle: boolean;
|
|
19
|
-
requestHandler: RequestHandler | null;
|
|
20
|
-
};
|
|
21
|
-
type GetSitesInternalInput = MandatoryParameters & OptionalParameters;
|
|
22
|
-
export type GetSitesInput = MandatoryParameters & Partial<OptionalParameters>;
|
|
23
|
-
export type GetSitesOutput = {
|
|
24
|
-
sites: Site[];
|
|
25
|
-
buckets: BucketWithLocation[];
|
|
26
|
-
};
|
|
27
|
-
export declare const internalGetSites: ({ region, forceBucketName, providerSpecifics, forcePathStyle, requestHandler, }: GetSitesInternalInput & {
|
|
28
|
-
providerSpecifics: ProviderSpecifics<AwsProvider>;
|
|
29
|
-
}) => Promise<GetSitesOutput>;
|
|
30
|
-
export declare const getSites: ({ region, forceBucketName, forcePathStyle, requestHandler, }: GetSitesInput) => Promise<GetSitesOutput>;
|
|
31
|
-
export {};
|
package/dist/get-sites.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSites = exports.internalGetSites = void 0;
|
|
4
|
-
const aws_provider_1 = require("./aws-provider");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
const make_s3_url_1 = require("./make-s3-url");
|
|
7
|
-
const internalGetSites = async ({ region, forceBucketName, providerSpecifics, forcePathStyle, requestHandler, }) => {
|
|
8
|
-
var _a;
|
|
9
|
-
const remotionBuckets = forceBucketName
|
|
10
|
-
? await providerSpecifics.getBuckets({
|
|
11
|
-
region,
|
|
12
|
-
forceBucketName,
|
|
13
|
-
forcePathStyle,
|
|
14
|
-
requestHandler,
|
|
15
|
-
})
|
|
16
|
-
: await providerSpecifics.getBuckets({
|
|
17
|
-
region,
|
|
18
|
-
forceBucketName: null,
|
|
19
|
-
forcePathStyle,
|
|
20
|
-
requestHandler,
|
|
21
|
-
});
|
|
22
|
-
const accountId = await providerSpecifics.getAccountId({ region });
|
|
23
|
-
const sites = {};
|
|
24
|
-
for (const bucket of remotionBuckets) {
|
|
25
|
-
const ls = await providerSpecifics.listObjects({
|
|
26
|
-
bucketName: bucket.name,
|
|
27
|
-
prefix: (0, constants_1.getSitesKey)(''),
|
|
28
|
-
region,
|
|
29
|
-
expectedBucketOwner: accountId,
|
|
30
|
-
forcePathStyle,
|
|
31
|
-
requestHandler,
|
|
32
|
-
});
|
|
33
|
-
for (const file of ls) {
|
|
34
|
-
const siteKeyMatch = (_a = file.Key) === null || _a === void 0 ? void 0 : _a.match(/sites\/([0-9a-zA-Z-!_.*'()]+)\/(.*)$/);
|
|
35
|
-
if (!siteKeyMatch) {
|
|
36
|
-
throw new Error(`A file was found in the bucket "${bucket.name}" with the key ${file.Key} which is an unexpected folder structure. Delete this file.`);
|
|
37
|
-
}
|
|
38
|
-
const [, siteId] = siteKeyMatch;
|
|
39
|
-
if (!sites[siteId]) {
|
|
40
|
-
sites[siteId] = {
|
|
41
|
-
sizeInBytes: 0,
|
|
42
|
-
bucketName: bucket.name,
|
|
43
|
-
lastModified: null,
|
|
44
|
-
id: siteId,
|
|
45
|
-
serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({
|
|
46
|
-
bucketName: bucket.name,
|
|
47
|
-
region,
|
|
48
|
-
subFolder: (0, constants_1.getSitesKey)(siteId),
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
if (file.LastModified) {
|
|
53
|
-
const currentLastModified = sites[siteId].lastModified;
|
|
54
|
-
if (currentLastModified === null ||
|
|
55
|
-
file.LastModified.getTime() > currentLastModified) {
|
|
56
|
-
sites[siteId].lastModified = file.LastModified.getTime();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (file.Size) {
|
|
60
|
-
sites[siteId].sizeInBytes += file.Size;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const sitesArray = Object.keys(sites).map((siteId) => {
|
|
65
|
-
return sites[siteId];
|
|
66
|
-
});
|
|
67
|
-
return { sites: sitesArray, buckets: remotionBuckets };
|
|
68
|
-
};
|
|
69
|
-
exports.internalGetSites = internalGetSites;
|
|
70
|
-
/*
|
|
71
|
-
* @description Gets an array of Remotion projects in Cloud Storage, in your GCP project.
|
|
72
|
-
* @see [Documentation](https://remotion.dev/docs/cloudrun/getsites)
|
|
73
|
-
*/
|
|
74
|
-
const getSites = ({ region, forceBucketName, forcePathStyle, requestHandler, }) => {
|
|
75
|
-
return (0, exports.internalGetSites)({
|
|
76
|
-
region,
|
|
77
|
-
forceBucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
|
|
78
|
-
forcePathStyle: forcePathStyle !== null && forcePathStyle !== void 0 ? forcePathStyle : false,
|
|
79
|
-
providerSpecifics: aws_provider_1.awsImplementation,
|
|
80
|
-
requestHandler: requestHandler !== null && requestHandler !== void 0 ? requestHandler : null,
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
exports.getSites = getSites;
|
package/dist/head-file.d.ts
DELETED
package/dist/head-file.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lambdaHeadFileImplementation = void 0;
|
|
4
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
-
const get_s3_client_1 = require("./get-s3-client");
|
|
6
|
-
const lambdaHeadFileImplementation = async ({ bucketName, key, region, customCredentials, forcePathStyle, requestHandler, }) => {
|
|
7
|
-
const head = await (0, get_s3_client_1.getS3Client)({
|
|
8
|
-
region,
|
|
9
|
-
customCredentials,
|
|
10
|
-
forcePathStyle,
|
|
11
|
-
requestHandler,
|
|
12
|
-
}).send(new client_s3_1.HeadObjectCommand({
|
|
13
|
-
Bucket: bucketName,
|
|
14
|
-
Key: key,
|
|
15
|
-
}));
|
|
16
|
-
return head;
|
|
17
|
-
};
|
|
18
|
-
exports.lambdaHeadFileImplementation = lambdaHeadFileImplementation;
|