@remotion/lambda-client 4.0.369 → 4.0.371
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 +1 -1
- package/dist/esm/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/app-router-webhook.d.ts +0 -10
- package/dist/app-router-webhook.js +0 -51
- 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 -54
- 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 -56
- 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 +0,0 @@
|
|
|
1
|
-
export declare const validateMemorySize: (memorySizeInMb: unknown) => void;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateMemorySize = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const validateMemorySize = (memorySizeInMb) => {
|
|
6
|
-
if (typeof memorySizeInMb !== 'number') {
|
|
7
|
-
throw new TypeError(`parameter 'memorySizeInMb' must be a number, got a ${typeof memorySizeInMb}`);
|
|
8
|
-
}
|
|
9
|
-
if (Number.isNaN(memorySizeInMb)) {
|
|
10
|
-
throw new TypeError(`parameter 'memorySizeInMb' must not be NaN, but is`);
|
|
11
|
-
}
|
|
12
|
-
if (!Number.isFinite(memorySizeInMb)) {
|
|
13
|
-
throw new TypeError(`parameter 'memorySizeInMb' must be finite, but is ${memorySizeInMb}`);
|
|
14
|
-
}
|
|
15
|
-
if (memorySizeInMb < constants_1.MIN_MEMORY || memorySizeInMb > constants_1.MAX_MEMORY) {
|
|
16
|
-
throw new TypeError(`parameter 'memorySizeInMb' must be between ${constants_1.MIN_MEMORY} and ${constants_1.MAX_MEMORY}, but got ${memorySizeInMb}`);
|
|
17
|
-
}
|
|
18
|
-
if (memorySizeInMb % 1 !== 0) {
|
|
19
|
-
throw new TypeError(`parameter 'memorySizeInMb' must be an integer but got ${memorySizeInMb}`);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
exports.validateMemorySize = validateMemorySize;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const validatePresignExpiration: (presignExpiration: unknown) => void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePresignExpiration = void 0;
|
|
4
|
-
const MAX_PRESIGN_EXPIRATION = 604800;
|
|
5
|
-
const MIN_PRESIGN_EXPIRATION = 1;
|
|
6
|
-
const validatePresignExpiration = (presignExpiration) => {
|
|
7
|
-
if (typeof presignExpiration === 'undefined' || presignExpiration === null) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
if (typeof presignExpiration !== 'number') {
|
|
11
|
-
throw new TypeError(`'expiresIn' should be a number, but is ${JSON.stringify(presignExpiration)}`);
|
|
12
|
-
}
|
|
13
|
-
if (Number.isNaN(presignExpiration)) {
|
|
14
|
-
throw new TypeError(`'expiresIn' should not be NaN, but is NaN`);
|
|
15
|
-
}
|
|
16
|
-
if (!Number.isFinite(presignExpiration)) {
|
|
17
|
-
throw new TypeError(`'expiresIn' should be finite but is ${presignExpiration}`);
|
|
18
|
-
}
|
|
19
|
-
if (presignExpiration % 1 !== 0) {
|
|
20
|
-
throw new TypeError(`'expiresIn' should be an integer but is ${JSON.stringify(presignExpiration)}`);
|
|
21
|
-
}
|
|
22
|
-
if (presignExpiration > MAX_PRESIGN_EXPIRATION) {
|
|
23
|
-
throw new TypeError(`The 'expiresIn' parameter must be less or equal than ${MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`);
|
|
24
|
-
}
|
|
25
|
-
if (presignExpiration < MIN_PRESIGN_EXPIRATION) {
|
|
26
|
-
throw new TypeError(`The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}`);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
exports.validatePresignExpiration = validatePresignExpiration;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const validateServeUrl: (serveUrl: unknown) => void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateServeUrl = void 0;
|
|
4
|
-
const validateServeUrl = (serveUrl) => {
|
|
5
|
-
if (typeof serveUrl !== 'string') {
|
|
6
|
-
throw new TypeError(`"serveURL" parameter must be a string, but is ${JSON.stringify(serveUrl)}`);
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
exports.validateServeUrl = validateServeUrl;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateWebhookSignature = void 0;
|
|
4
|
-
/*
|
|
5
|
-
* @description Validates that the signature received by a webhook endpoint is authentic. If validation fails, an error is thrown.
|
|
6
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/validatewebhooksignature)
|
|
7
|
-
*/
|
|
8
|
-
const validateWebhookSignature = ({ secret, body, signatureHeader, }) => {
|
|
9
|
-
if (!secret) {
|
|
10
|
-
throw new TypeError("No 'secret' was provided to validateWebhookSignature().");
|
|
11
|
-
}
|
|
12
|
-
if (!body) {
|
|
13
|
-
throw new TypeError("No 'body' was provided to validateWebhookSignature().");
|
|
14
|
-
}
|
|
15
|
-
if (typeof require === 'undefined') {
|
|
16
|
-
throw new Error('validateWebhookSignature can only be called from Node.JS');
|
|
17
|
-
}
|
|
18
|
-
const Crypto = require('crypto');
|
|
19
|
-
const hmac = Crypto.createHmac('sha512', secret);
|
|
20
|
-
const signature = `sha512=${hmac.update(JSON.stringify(body)).digest('hex')}`;
|
|
21
|
-
if (!signatureHeader || signatureHeader === 'NO_SECRET_PROVIDED') {
|
|
22
|
-
throw new Error('No webhook signature was provided');
|
|
23
|
-
}
|
|
24
|
-
if (signatureHeader !== signature) {
|
|
25
|
-
throw new Error('Signatures do not match');
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.validateWebhookSignature = validateWebhookSignature;
|
package/dist/write-file.d.ts
DELETED
package/dist/write-file.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.lambdaWriteFileImplementation = void 0;
|
|
7
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
8
|
-
const lib_storage_1 = require("@aws-sdk/lib-storage");
|
|
9
|
-
const mime_types_1 = __importDefault(require("mime-types"));
|
|
10
|
-
const content_disposition_header_1 = require("./content-disposition-header");
|
|
11
|
-
const get_s3_client_1 = require("./get-s3-client");
|
|
12
|
-
// Files larger than 100MB will use multipart upload
|
|
13
|
-
const MULTIPART_THRESHOLD = 100 * 1024 * 1024; // 5MB in bytes
|
|
14
|
-
const tryLambdaWriteFile = async ({ bucketName, key, body, region, privacy, expectedBucketOwner, downloadBehavior, customCredentials, forcePathStyle, storageClass, requestHandler, }) => {
|
|
15
|
-
const client = (0, get_s3_client_1.getS3Client)({
|
|
16
|
-
region,
|
|
17
|
-
customCredentials: customCredentials,
|
|
18
|
-
forcePathStyle,
|
|
19
|
-
requestHandler,
|
|
20
|
-
});
|
|
21
|
-
const params = {
|
|
22
|
-
Bucket: bucketName,
|
|
23
|
-
Key: key,
|
|
24
|
-
Body: body,
|
|
25
|
-
ACL: privacy === 'no-acl'
|
|
26
|
-
? undefined
|
|
27
|
-
: (privacy === 'private'
|
|
28
|
-
? 'private'
|
|
29
|
-
: 'public-read'),
|
|
30
|
-
ExpectedBucketOwner: customCredentials
|
|
31
|
-
? undefined
|
|
32
|
-
: (expectedBucketOwner !== null && expectedBucketOwner !== void 0 ? expectedBucketOwner : undefined),
|
|
33
|
-
ContentType: mime_types_1.default.lookup(key) || 'application/octet-stream',
|
|
34
|
-
ContentDisposition: (0, content_disposition_header_1.getContentDispositionHeader)(downloadBehavior),
|
|
35
|
-
StorageClass: storageClass !== null && storageClass !== void 0 ? storageClass : undefined,
|
|
36
|
-
};
|
|
37
|
-
// Determine file size
|
|
38
|
-
const size = body instanceof Buffer || body instanceof Uint8Array
|
|
39
|
-
? body.length
|
|
40
|
-
: body instanceof Blob
|
|
41
|
-
? body.size
|
|
42
|
-
: typeof body === 'string'
|
|
43
|
-
? Buffer.from(body).length
|
|
44
|
-
: null;
|
|
45
|
-
// Use multipart upload for large files or streams (where we can't determine size)
|
|
46
|
-
if (size === null || size > MULTIPART_THRESHOLD) {
|
|
47
|
-
const upload = new lib_storage_1.Upload({
|
|
48
|
-
client,
|
|
49
|
-
params,
|
|
50
|
-
queueSize: 4, // number of concurrent uploads
|
|
51
|
-
partSize: 5 * 1024 * 1024, // chunk size of 5MB
|
|
52
|
-
});
|
|
53
|
-
await upload.done();
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// Use regular PutObject for small files
|
|
57
|
-
await client.send(new client_s3_1.PutObjectCommand(params));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const lambdaWriteFileImplementation = async (params) => {
|
|
61
|
-
var _a;
|
|
62
|
-
const remainingRetries = (_a = params.retries) !== null && _a !== void 0 ? _a : 2;
|
|
63
|
-
try {
|
|
64
|
-
await tryLambdaWriteFile(params);
|
|
65
|
-
}
|
|
66
|
-
catch (err) {
|
|
67
|
-
if (remainingRetries === 0) {
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
const backoff = 2 ** (2 - remainingRetries) * 2000;
|
|
71
|
-
await new Promise((resolve) => {
|
|
72
|
-
setTimeout(resolve, backoff);
|
|
73
|
-
});
|
|
74
|
-
console.warn('Failed to write file to storage:');
|
|
75
|
-
console.warn(err);
|
|
76
|
-
console.warn(`Retrying (${remainingRetries} retries remaining)...`);
|
|
77
|
-
return (0, exports.lambdaWriteFileImplementation)({
|
|
78
|
-
...params,
|
|
79
|
-
retries: remainingRetries - 1,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
exports.lambdaWriteFileImplementation = lambdaWriteFileImplementation;
|