@remotion/lambda 4.0.209 → 4.0.211
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/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/helpers/cleanup-props.d.ts +4 -1
- package/package.json +21 -21
- package/remotionlambda-arm64.zip +0 -0
- package/dist/functions/compositions.d.ts +0 -10
- package/dist/functions/compositions.js +0 -77
- package/dist/functions/helpers/expected-out-name.d.ts +0 -4
- package/dist/functions/helpers/expected-out-name.js +0 -52
- package/dist/functions/helpers/get-browser-instance.d.ts +0 -10
- package/dist/functions/helpers/get-browser-instance.js +0 -99
- package/dist/functions/helpers/get-chromium-executable-path.d.ts +0 -1
- package/dist/functions/helpers/get-chromium-executable-path.js +0 -14
- package/dist/functions/helpers/get-custom-out-name.d.ts +0 -6
- package/dist/functions/helpers/get-custom-out-name.js +0 -32
- package/dist/functions/helpers/get-files-in-folder.d.ts +0 -5
- package/dist/functions/helpers/get-files-in-folder.js +0 -38
- package/dist/functions/helpers/io.d.ts +0 -20
- package/dist/functions/helpers/io.js +0 -13
- package/dist/functions/helpers/is-enosp-err.d.ts +0 -3
- package/dist/functions/helpers/is-enosp-err.js +0 -16
- package/dist/functions/helpers/print-cloudwatch-helper.d.ts +0 -3
- package/dist/functions/helpers/print-cloudwatch-helper.js +0 -12
- package/dist/functions/helpers/serialize-artifact.d.ts +0 -9
- package/dist/functions/helpers/serialize-artifact.js +0 -37
- package/dist/functions/helpers/validate-composition.d.ts +0 -24
- package/dist/functions/helpers/validate-composition.js +0 -31
- package/dist/functions/helpers/write-lambda-error.d.ts +0 -25
- package/dist/functions/helpers/write-lambda-error.js +0 -20
- package/dist/functions/info.d.ts +0 -5
- package/dist/functions/info.js +0 -16
- package/dist/functions/provider-implementation.d.ts +0 -0
- package/dist/functions/provider-implementation.js +0 -1
- package/dist/functions/streaming/stream-writer.d.ts +0 -6
- package/dist/functions/streaming/stream-writer.js +0 -35
- package/dist/functions/streaming/streaming.d.ts +0 -102
- package/dist/functions/streaming/streaming.js +0 -61
- package/dist/shared/await.d.ts +0 -1
- package/dist/shared/await.js +0 -2
- package/dist/shared/compress-props.d.ts +0 -22
- package/dist/shared/compress-props.js +0 -88
- package/dist/shared/stream-to-string.d.ts +0 -4
- package/dist/shared/stream-to-string.js +0 -15
- package/dist/shared/truthy.d.ts +0 -3
- package/dist/shared/truthy.js +0 -7
- package/dist/shared/validate-outname.d.ts +0 -8
- package/dist/shared/validate-outname.js +0 -37
- package/dist/shared/validate-webhook.d.ts +0 -3
- package/dist/shared/validate-webhook.js +0 -16
|
@@ -5,4 +5,7 @@ export declare const cleanupProps: <Provider extends CloudProvider<string, Recor
|
|
|
5
5
|
inputProps: SerializedInputProps;
|
|
6
6
|
providerSpecifics: ProviderSpecifics<Provider>;
|
|
7
7
|
forcePathStyle: boolean;
|
|
8
|
-
}) => Promise<[
|
|
8
|
+
}) => Promise<[
|
|
9
|
+
number,
|
|
10
|
+
number
|
|
11
|
+
]>;
|
package/package.json
CHANGED
|
@@ -3,32 +3,32 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/lambda"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/lambda",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.211",
|
|
7
7
|
"description": "Render Remotion videos on AWS Lambda",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@smithy/abort-controller": "3.
|
|
14
|
-
"@aws-sdk/client-cloudwatch-logs": "3.
|
|
15
|
-
"@aws-sdk/client-iam": "3.
|
|
16
|
-
"@aws-sdk/client-lambda": "3.
|
|
17
|
-
"@aws-sdk/client-s3": "3.
|
|
18
|
-
"@aws-sdk/client-service-quotas": "3.
|
|
19
|
-
"@aws-sdk/client-sts": "3.
|
|
20
|
-
"@aws-sdk/credential-providers": "3.
|
|
21
|
-
"@aws-sdk/lib-storage": "3.
|
|
22
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
13
|
+
"@smithy/abort-controller": "3.1.1",
|
|
14
|
+
"@aws-sdk/client-cloudwatch-logs": "3.645.0",
|
|
15
|
+
"@aws-sdk/client-iam": "3.645.0",
|
|
16
|
+
"@aws-sdk/client-lambda": "3.645.0",
|
|
17
|
+
"@aws-sdk/client-s3": "3.645.0",
|
|
18
|
+
"@aws-sdk/client-service-quotas": "3.645.0",
|
|
19
|
+
"@aws-sdk/client-sts": "3.645.0",
|
|
20
|
+
"@aws-sdk/credential-providers": "3.645.0",
|
|
21
|
+
"@aws-sdk/lib-storage": "3.645.0",
|
|
22
|
+
"@aws-sdk/s3-request-presigner": "3.645.0",
|
|
23
23
|
"mime-types": "2.1.34",
|
|
24
24
|
"zod": "3.22.3",
|
|
25
|
-
"@remotion/bundler": "4.0.
|
|
26
|
-
"@remotion/cli": "4.0.
|
|
27
|
-
"@remotion/studio-server": "4.0.
|
|
28
|
-
"@remotion/
|
|
29
|
-
"remotion": "4.0.
|
|
30
|
-
"@remotion/renderer": "4.0.
|
|
31
|
-
"@remotion/
|
|
25
|
+
"@remotion/bundler": "4.0.211",
|
|
26
|
+
"@remotion/cli": "4.0.211",
|
|
27
|
+
"@remotion/studio-server": "4.0.211",
|
|
28
|
+
"@remotion/streaming": "4.0.211",
|
|
29
|
+
"remotion": "4.0.211",
|
|
30
|
+
"@remotion/renderer": "4.0.211",
|
|
31
|
+
"@remotion/serverless": "4.0.211"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/mime-types": "2.1.1",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"pureimage": "0.4.13",
|
|
38
38
|
"vitest": "0.31.1",
|
|
39
39
|
"zip-lib": "^0.7.2",
|
|
40
|
-
"@remotion/bundler": "4.0.
|
|
41
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
40
|
+
"@remotion/bundler": "4.0.211",
|
|
41
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.211"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@remotion/bundler": "4.0.
|
|
44
|
+
"@remotion/bundler": "4.0.211"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
-
import type { ServerlessPayload } from '@remotion/serverless/client';
|
|
3
|
-
type Options = {
|
|
4
|
-
expectedBucketOwner: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const compositionsHandler: <Region extends string>(lambdaParams: ServerlessPayload<Region>, options: Options, providerSpecifics: ProviderSpecifics<Region>) => Promise<{
|
|
7
|
-
compositions: import("remotion").VideoConfig[];
|
|
8
|
-
type: "success";
|
|
9
|
-
}>;
|
|
10
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compositionsHandler = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const serverless_1 = require("@remotion/serverless");
|
|
6
|
-
const client_1 = require("@remotion/serverless/client");
|
|
7
|
-
const version_1 = require("remotion/version");
|
|
8
|
-
const compositionsHandler = async (lambdaParams, options, providerSpecifics) => {
|
|
9
|
-
var _a;
|
|
10
|
-
if (lambdaParams.type !== client_1.ServerlessRoutines.compositions) {
|
|
11
|
-
throw new TypeError('Expected info compositions');
|
|
12
|
-
}
|
|
13
|
-
if (lambdaParams.version !== version_1.VERSION) {
|
|
14
|
-
if (!lambdaParams.version) {
|
|
15
|
-
throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
16
|
-
}
|
|
17
|
-
throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const region = providerSpecifics.getCurrentRegionInFunction();
|
|
21
|
-
const browserInstancePromise = (0, serverless_1.getBrowserInstance)({
|
|
22
|
-
logLevel: lambdaParams.logLevel,
|
|
23
|
-
indent: false,
|
|
24
|
-
chromiumOptions: lambdaParams.chromiumOptions,
|
|
25
|
-
providerSpecifics,
|
|
26
|
-
});
|
|
27
|
-
const bucketNamePromise = lambdaParams.bucketName
|
|
28
|
-
? Promise.resolve(lambdaParams.bucketName)
|
|
29
|
-
: (0, client_1.internalGetOrCreateBucket)({
|
|
30
|
-
region,
|
|
31
|
-
enableFolderExpiry: null,
|
|
32
|
-
customCredentials: null,
|
|
33
|
-
providerSpecifics,
|
|
34
|
-
}).then((b) => b.bucketName);
|
|
35
|
-
const bucketName = await bucketNamePromise;
|
|
36
|
-
const serializedInputPropsWithCustomSchema = await (0, client_1.decompressInputProps)({
|
|
37
|
-
bucketName: await bucketNamePromise,
|
|
38
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
39
|
-
region: providerSpecifics.getCurrentRegionInFunction(),
|
|
40
|
-
serialized: lambdaParams.inputProps,
|
|
41
|
-
propsType: 'input-props',
|
|
42
|
-
providerSpecifics,
|
|
43
|
-
});
|
|
44
|
-
const realServeUrl = providerSpecifics.convertToServeUrl({
|
|
45
|
-
urlOrId: lambdaParams.serveUrl,
|
|
46
|
-
region,
|
|
47
|
-
bucketName,
|
|
48
|
-
});
|
|
49
|
-
const compositions = await renderer_1.RenderInternals.internalGetCompositions({
|
|
50
|
-
serveUrlOrWebpackUrl: realServeUrl,
|
|
51
|
-
puppeteerInstance: (await browserInstancePromise).instance,
|
|
52
|
-
serializedInputPropsWithCustomSchema,
|
|
53
|
-
envVariables: (_a = lambdaParams.envVariables) !== null && _a !== void 0 ? _a : {},
|
|
54
|
-
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
|
|
55
|
-
chromiumOptions: lambdaParams.chromiumOptions,
|
|
56
|
-
port: null,
|
|
57
|
-
server: undefined,
|
|
58
|
-
logLevel: lambdaParams.logLevel,
|
|
59
|
-
indent: false,
|
|
60
|
-
browserExecutable: null,
|
|
61
|
-
onBrowserLog: null,
|
|
62
|
-
offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
|
|
63
|
-
binariesDirectory: null,
|
|
64
|
-
onBrowserDownload: () => {
|
|
65
|
-
throw new Error('Should not download a browser in Lambda');
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
return Promise.resolve({
|
|
69
|
-
compositions,
|
|
70
|
-
type: 'success',
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
finally {
|
|
74
|
-
(0, serverless_1.forgetBrowserEventLoop)(lambdaParams.logLevel);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
exports.compositionsHandler = compositionsHandler;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { CustomCredentials, OutNameInput } from '@remotion/serverless/client';
|
|
2
|
-
import type { OutNameOutput, RenderMetadata } from '../../defaults';
|
|
3
|
-
export declare const getCredentialsFromOutName: <Region extends string>(name: OutNameInput<Region> | null) => CustomCredentials<Region> | null;
|
|
4
|
-
export declare const getExpectedOutName: <Region extends string>(renderMetadata: RenderMetadata, bucketName: string, customCredentials: CustomCredentials<Region> | null) => OutNameOutput<Region>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExpectedOutName = exports.getCredentialsFromOutName = void 0;
|
|
4
|
-
const pure_1 = require("@remotion/renderer/pure");
|
|
5
|
-
const defaults_1 = require("../../defaults");
|
|
6
|
-
const validate_outname_1 = require("../../shared/validate-outname");
|
|
7
|
-
const get_custom_out_name_1 = require("./get-custom-out-name");
|
|
8
|
-
const getCredentialsFromOutName = (name) => {
|
|
9
|
-
var _a;
|
|
10
|
-
if (typeof name === 'string') {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
if (name === null) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
if (typeof name === 'undefined') {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return (_a = name.s3OutputProvider) !== null && _a !== void 0 ? _a : null;
|
|
20
|
-
};
|
|
21
|
-
exports.getCredentialsFromOutName = getCredentialsFromOutName;
|
|
22
|
-
const getExpectedOutName = (renderMetadata, bucketName, customCredentials) => {
|
|
23
|
-
const outNameValue = (0, get_custom_out_name_1.getCustomOutName)({
|
|
24
|
-
customCredentials,
|
|
25
|
-
renderMetadata,
|
|
26
|
-
});
|
|
27
|
-
if (outNameValue) {
|
|
28
|
-
(0, validate_outname_1.validateOutname)({
|
|
29
|
-
outName: outNameValue,
|
|
30
|
-
codec: renderMetadata.codec,
|
|
31
|
-
audioCodecSetting: renderMetadata.audioCodec,
|
|
32
|
-
separateAudioTo: null,
|
|
33
|
-
});
|
|
34
|
-
return (0, defaults_1.customOutName)(renderMetadata.renderId, bucketName, outNameValue);
|
|
35
|
-
}
|
|
36
|
-
if (renderMetadata.type === 'still') {
|
|
37
|
-
return {
|
|
38
|
-
renderBucketName: bucketName,
|
|
39
|
-
key: (0, defaults_1.outStillName)(renderMetadata.renderId, renderMetadata.imageFormat),
|
|
40
|
-
customCredentials: null,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
if (renderMetadata.type === 'video') {
|
|
44
|
-
return {
|
|
45
|
-
renderBucketName: bucketName,
|
|
46
|
-
key: (0, defaults_1.outName)(renderMetadata.renderId, pure_1.NoReactAPIs.getFileExtensionFromCodec(renderMetadata.codec, renderMetadata.audioCodec)),
|
|
47
|
-
customCredentials: null,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
throw new TypeError('no type passed');
|
|
51
|
-
};
|
|
52
|
-
exports.getExpectedOutName = getExpectedOutName;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ChromiumOptions, LogLevel, openBrowser } from '@remotion/renderer';
|
|
2
|
-
import type { ProviderSpecifics } from '@remotion/serverless';
|
|
3
|
-
import type { Await } from '@remotion/serverless/client';
|
|
4
|
-
type LaunchedBrowser = {
|
|
5
|
-
instance: Await<ReturnType<typeof openBrowser>>;
|
|
6
|
-
configurationString: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const forgetBrowserEventLoop: (logLevel: LogLevel) => void;
|
|
9
|
-
export declare const getBrowserInstance: (logLevel: LogLevel, indent: boolean, chromiumOptions: ChromiumOptions, providerSpecifics: ProviderSpecifics) => Promise<LaunchedBrowser>;
|
|
10
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBrowserInstance = exports.forgetBrowserEventLoop = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const version_1 = require("remotion/version");
|
|
6
|
-
const makeConfigurationString = (options, logLevel) => {
|
|
7
|
-
var _a, _b, _c;
|
|
8
|
-
return [
|
|
9
|
-
`web-security-${Boolean(options.disableWebSecurity)}`,
|
|
10
|
-
`multi-process-${Boolean(options.enableMultiProcessOnLinux)}`,
|
|
11
|
-
`ignore-certificate-errors-${Boolean(options.ignoreCertificateErrors)}`,
|
|
12
|
-
`log-level-${logLevel}`,
|
|
13
|
-
`gl-${(_a = options.gl) !== null && _a !== void 0 ? _a : null}`,
|
|
14
|
-
`userAgent-${(_b = options.userAgent) !== null && _b !== void 0 ? _b : null}`,
|
|
15
|
-
`headless-${(_c = options.headless) !== null && _c !== void 0 ? _c : false}`,
|
|
16
|
-
].join('/');
|
|
17
|
-
};
|
|
18
|
-
let _browserInstance;
|
|
19
|
-
let launching = false;
|
|
20
|
-
const waitForLaunched = () => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
const check = () => setTimeout(() => {
|
|
23
|
-
if (launching) {
|
|
24
|
-
check();
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
resolve();
|
|
28
|
-
}
|
|
29
|
-
}, 16);
|
|
30
|
-
setTimeout(() => reject(new Error('Timeout launching browser')), 5000);
|
|
31
|
-
check();
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
const forgetBrowserEventLoop = (logLevel) => {
|
|
35
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Keeping browser open for next invocation');
|
|
36
|
-
_browserInstance === null || _browserInstance === void 0 ? void 0 : _browserInstance.instance.forgetEventLoop();
|
|
37
|
-
};
|
|
38
|
-
exports.forgetBrowserEventLoop = forgetBrowserEventLoop;
|
|
39
|
-
const getBrowserInstance = async (logLevel, indent, chromiumOptions, providerSpecifics) => {
|
|
40
|
-
var _a;
|
|
41
|
-
const actualChromiumOptions = {
|
|
42
|
-
...chromiumOptions,
|
|
43
|
-
// Override the `null` value, which might come from CLI with swANGLE
|
|
44
|
-
gl: (_a = chromiumOptions.gl) !== null && _a !== void 0 ? _a : 'swangle',
|
|
45
|
-
enableMultiProcessOnLinux: false,
|
|
46
|
-
};
|
|
47
|
-
const configurationString = makeConfigurationString(actualChromiumOptions, logLevel);
|
|
48
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `Rendering with Remotion v${version_1.VERSION}.`);
|
|
49
|
-
if (launching) {
|
|
50
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Already waiting for browser launch...');
|
|
51
|
-
await waitForLaunched();
|
|
52
|
-
if (!_browserInstance) {
|
|
53
|
-
throw new Error('expected to launch');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (!_browserInstance) {
|
|
57
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Cold Lambda function, launching new browser instance');
|
|
58
|
-
launching = true;
|
|
59
|
-
const execPath = providerSpecifics.getChromiumPath();
|
|
60
|
-
const instance = await renderer_1.RenderInternals.internalOpenBrowser({
|
|
61
|
-
browser: 'chrome',
|
|
62
|
-
browserExecutable: execPath,
|
|
63
|
-
chromiumOptions: actualChromiumOptions,
|
|
64
|
-
forceDeviceScaleFactor: undefined,
|
|
65
|
-
indent: false,
|
|
66
|
-
viewport: null,
|
|
67
|
-
logLevel,
|
|
68
|
-
onBrowserDownload: () => {
|
|
69
|
-
throw new Error('Should not download a browser in Lambda');
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
instance.on('disconnected', () => {
|
|
73
|
-
var _a;
|
|
74
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Browser disconnected or crashed.');
|
|
75
|
-
(0, exports.forgetBrowserEventLoop)(logLevel);
|
|
76
|
-
(_a = _browserInstance === null || _browserInstance === void 0 ? void 0 : _browserInstance.instance) === null || _a === void 0 ? void 0 : _a.close(true, logLevel, indent).catch((err) => {
|
|
77
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Could not close browser instance', err);
|
|
78
|
-
});
|
|
79
|
-
_browserInstance = null;
|
|
80
|
-
});
|
|
81
|
-
_browserInstance = {
|
|
82
|
-
instance,
|
|
83
|
-
configurationString,
|
|
84
|
-
};
|
|
85
|
-
launching = false;
|
|
86
|
-
return _browserInstance;
|
|
87
|
-
}
|
|
88
|
-
if (_browserInstance.configurationString !== configurationString) {
|
|
89
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Warm Lambda function, but Browser configuration changed. Killing old browser instance.');
|
|
90
|
-
_browserInstance.instance.rememberEventLoop();
|
|
91
|
-
await _browserInstance.instance.close(true, logLevel, indent);
|
|
92
|
-
_browserInstance = null;
|
|
93
|
-
return (0, exports.getBrowserInstance)(logLevel, indent, chromiumOptions, providerSpecifics);
|
|
94
|
-
}
|
|
95
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Warm Lambda function, reusing browser instance');
|
|
96
|
-
_browserInstance.instance.rememberEventLoop();
|
|
97
|
-
return _browserInstance;
|
|
98
|
-
};
|
|
99
|
-
exports.getBrowserInstance = getBrowserInstance;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const executablePath: () => string;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.executablePath = void 0;
|
|
5
|
-
if (/^AWS_Lambda_nodejs(?:18|20)[.]x$/.test((_a = process.env.AWS_EXECUTION_ENV) !== null && _a !== void 0 ? _a : '') === true) {
|
|
6
|
-
process.env.FONTCONFIG_PATH = '/opt';
|
|
7
|
-
process.env.FONTCONFIG_FILE = '/opt/fonts.conf';
|
|
8
|
-
process.env.DISABLE_FROM_SURFACE = '1';
|
|
9
|
-
process.env.NO_COLOR = '1';
|
|
10
|
-
}
|
|
11
|
-
const executablePath = () => {
|
|
12
|
-
return '/opt/bin/chromium';
|
|
13
|
-
};
|
|
14
|
-
exports.executablePath = executablePath;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CustomCredentials, OutNameInput } from '@remotion/serverless/client';
|
|
2
|
-
import type { RenderMetadata } from '../../defaults';
|
|
3
|
-
export declare const getCustomOutName: <Region extends string>({ renderMetadata, customCredentials, }: {
|
|
4
|
-
renderMetadata: RenderMetadata;
|
|
5
|
-
customCredentials: CustomCredentials<Region> | null;
|
|
6
|
-
}) => OutNameInput<Region> | null;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCustomOutName = void 0;
|
|
4
|
-
const getCustomOutName = ({ renderMetadata, customCredentials, }) => {
|
|
5
|
-
var _a, _b;
|
|
6
|
-
if (!renderMetadata.outName) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
if (typeof renderMetadata.outName === 'string') {
|
|
10
|
-
return renderMetadata.outName;
|
|
11
|
-
}
|
|
12
|
-
if (renderMetadata.outName.s3OutputProvider) {
|
|
13
|
-
if (!customCredentials && renderMetadata.privacy === 'private') {
|
|
14
|
-
throw new TypeError(`The file was rendered with a custom S3 implementation and is not public, but no custom credentials were passed to downloadMedia().`);
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
bucketName: renderMetadata.outName.bucketName,
|
|
18
|
-
key: renderMetadata.outName.key,
|
|
19
|
-
s3OutputProvider: {
|
|
20
|
-
endpoint: renderMetadata.outName.s3OutputProvider.endpoint,
|
|
21
|
-
accessKeyId: (_a = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.accessKeyId) !== null && _a !== void 0 ? _a : null,
|
|
22
|
-
secretAccessKey: (_b = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.secretAccessKey) !== null && _b !== void 0 ? _b : null,
|
|
23
|
-
region: customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.region,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
bucketName: renderMetadata.outName.bucketName,
|
|
29
|
-
key: renderMetadata.outName.key,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.getCustomOutName = getCustomOutName;
|
|
@@ -1,38 +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.getFolderFiles = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
function getFolderFiles(folder) {
|
|
10
|
-
const files = node_fs_1.default.readdirSync(folder);
|
|
11
|
-
const paths = [];
|
|
12
|
-
files.forEach((file) => {
|
|
13
|
-
const full = node_path_1.default.join(folder, file);
|
|
14
|
-
try {
|
|
15
|
-
const stat = node_fs_1.default.statSync(full);
|
|
16
|
-
if (stat.isDirectory()) {
|
|
17
|
-
paths.push(...getFolderFiles(full));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
paths.push({
|
|
21
|
-
filename: full,
|
|
22
|
-
size: stat.size,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
if (err.message.includes('ENOENT')) {
|
|
28
|
-
// Race condition: File was deleted in the meanwhile.
|
|
29
|
-
// Do nothing
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
throw err;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
return paths;
|
|
37
|
-
}
|
|
38
|
-
exports.getFolderFiles = getFolderFiles;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
-
import type { CustomCredentials } from '@remotion/serverless/client';
|
|
3
|
-
import type { AwsRegion } from '../../regions';
|
|
4
|
-
export type LambdaLSInput = {
|
|
5
|
-
bucketName: string;
|
|
6
|
-
prefix: string;
|
|
7
|
-
region: AwsRegion;
|
|
8
|
-
expectedBucketOwner: string | null;
|
|
9
|
-
continuationToken?: string;
|
|
10
|
-
};
|
|
11
|
-
export type LambdaLsReturnType = Promise<_Object[]>;
|
|
12
|
-
export declare const lambdaHeadCommand: ({ bucketName, key, region, customCredentials, }: {
|
|
13
|
-
bucketName: string;
|
|
14
|
-
key: string;
|
|
15
|
-
region: AwsRegion;
|
|
16
|
-
customCredentials: CustomCredentials<AwsRegion> | null;
|
|
17
|
-
}) => Promise<{
|
|
18
|
-
LastModified?: Date | undefined;
|
|
19
|
-
ContentLength?: number | undefined;
|
|
20
|
-
}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.lambdaHeadCommand = void 0;
|
|
4
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
-
const get_s3_client_1 = require("../../shared/get-s3-client");
|
|
6
|
-
const lambdaHeadCommand = async ({ bucketName, key, region, customCredentials, }) => {
|
|
7
|
-
const head = await (0, get_s3_client_1.getS3Client)(region, customCredentials).send(new client_s3_1.HeadObjectCommand({
|
|
8
|
-
Bucket: bucketName,
|
|
9
|
-
Key: key,
|
|
10
|
-
}));
|
|
11
|
-
return head;
|
|
12
|
-
};
|
|
13
|
-
exports.lambdaHeadCommand = lambdaHeadCommand;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isBrowserCrashedError = exports.isErrInsufficientResourcesErr = exports.errorIsOutOfSpaceError = void 0;
|
|
4
|
-
const errorIsOutOfSpaceError = (err) => {
|
|
5
|
-
return (err.includes('ENOSPC') ||
|
|
6
|
-
err.toLowerCase().includes('no space left on device'));
|
|
7
|
-
};
|
|
8
|
-
exports.errorIsOutOfSpaceError = errorIsOutOfSpaceError;
|
|
9
|
-
const isErrInsufficientResourcesErr = (err) => {
|
|
10
|
-
return err.includes('net::ERR_INSUFFICIENT_RESOURCES');
|
|
11
|
-
};
|
|
12
|
-
exports.isErrInsufficientResourcesErr = isErrInsufficientResourcesErr;
|
|
13
|
-
const isBrowserCrashedError = (err) => {
|
|
14
|
-
return err.includes('Target closed.') || err.includes('Session closed');
|
|
15
|
-
};
|
|
16
|
-
exports.isBrowserCrashedError = isBrowserCrashedError;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printCloudwatchHelper = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const printCloudwatchHelper = (type, data, logLevel) => {
|
|
6
|
-
const d = Object.keys(data).reduce((a, b) => {
|
|
7
|
-
return [...a, `${b}=${data[b]}`];
|
|
8
|
-
}, []);
|
|
9
|
-
const msg = [`method=${type}`, ...d].join(',');
|
|
10
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, msg);
|
|
11
|
-
};
|
|
12
|
-
exports.printCloudwatchHelper = printCloudwatchHelper;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EmittedArtifact } from '@remotion/renderer';
|
|
2
|
-
export type SerializedArtifact = {
|
|
3
|
-
filename: string;
|
|
4
|
-
stringContent: string;
|
|
5
|
-
frame: number;
|
|
6
|
-
binary: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare const deserializeArtifact: (serializedArtifact: SerializedArtifact) => EmittedArtifact;
|
|
9
|
-
export declare const serializeArtifact: (artifact: EmittedArtifact) => SerializedArtifact;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serializeArtifact = exports.deserializeArtifact = void 0;
|
|
4
|
-
const deserializeArtifact = (serializedArtifact) => {
|
|
5
|
-
if (serializedArtifact.binary) {
|
|
6
|
-
const content = new TextEncoder().encode(atob(serializedArtifact.stringContent));
|
|
7
|
-
return {
|
|
8
|
-
filename: serializedArtifact.filename,
|
|
9
|
-
content,
|
|
10
|
-
frame: serializedArtifact.frame,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
filename: serializedArtifact.filename,
|
|
15
|
-
content: serializedArtifact.stringContent,
|
|
16
|
-
frame: serializedArtifact.frame,
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
exports.deserializeArtifact = deserializeArtifact;
|
|
20
|
-
const serializeArtifact = (artifact) => {
|
|
21
|
-
if (artifact.content instanceof Uint8Array) {
|
|
22
|
-
const b64encoded = btoa(new TextDecoder('utf8').decode(artifact.content));
|
|
23
|
-
return {
|
|
24
|
-
filename: artifact.filename,
|
|
25
|
-
stringContent: b64encoded,
|
|
26
|
-
frame: artifact.frame,
|
|
27
|
-
binary: true,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
filename: artifact.filename,
|
|
32
|
-
stringContent: artifact.content,
|
|
33
|
-
frame: artifact.frame,
|
|
34
|
-
binary: false,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
exports.serializeArtifact = serializeArtifact;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ChromiumOptions, LogLevel, OnBrowserDownload, openBrowser, RemotionServer } from '@remotion/renderer';
|
|
2
|
-
import type { ProviderSpecifics } from '@remotion/serverless';
|
|
3
|
-
import type { Await } from '@remotion/serverless/client';
|
|
4
|
-
import type { VideoConfig } from 'remotion/no-react';
|
|
5
|
-
type ValidateCompositionOptions<Region extends string> = {
|
|
6
|
-
serveUrl: string;
|
|
7
|
-
composition: string;
|
|
8
|
-
browserInstance: Await<ReturnType<typeof openBrowser>>;
|
|
9
|
-
serializedInputPropsWithCustomSchema: string;
|
|
10
|
-
envVariables: Record<string, string>;
|
|
11
|
-
timeoutInMilliseconds: number;
|
|
12
|
-
chromiumOptions: ChromiumOptions;
|
|
13
|
-
port: number | null;
|
|
14
|
-
forceHeight: number | null;
|
|
15
|
-
forceWidth: number | null;
|
|
16
|
-
logLevel: LogLevel;
|
|
17
|
-
server: RemotionServer | undefined;
|
|
18
|
-
offthreadVideoCacheSizeInBytes: number | null;
|
|
19
|
-
onBrowserDownload: OnBrowserDownload;
|
|
20
|
-
onServeUrlVisited: () => void;
|
|
21
|
-
providerSpecifics: ProviderSpecifics<Region>;
|
|
22
|
-
};
|
|
23
|
-
export declare const validateComposition: <Region extends string>({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, offthreadVideoCacheSizeInBytes, onBrowserDownload, onServeUrlVisited, providerSpecifics, }: ValidateCompositionOptions<Region>) => Promise<VideoConfig>;
|
|
24
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateComposition = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const validateComposition = async ({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, offthreadVideoCacheSizeInBytes, onBrowserDownload, onServeUrlVisited, providerSpecifics, }) => {
|
|
6
|
-
const { metadata: comp } = await renderer_1.RenderInternals.internalSelectComposition({
|
|
7
|
-
id: composition,
|
|
8
|
-
puppeteerInstance: browserInstance,
|
|
9
|
-
serializedInputPropsWithCustomSchema,
|
|
10
|
-
envVariables,
|
|
11
|
-
timeoutInMilliseconds,
|
|
12
|
-
chromiumOptions,
|
|
13
|
-
port,
|
|
14
|
-
browserExecutable: providerSpecifics.getChromiumPath(),
|
|
15
|
-
serveUrl,
|
|
16
|
-
logLevel,
|
|
17
|
-
indent: false,
|
|
18
|
-
onBrowserLog: null,
|
|
19
|
-
server,
|
|
20
|
-
offthreadVideoCacheSizeInBytes,
|
|
21
|
-
binariesDirectory: null,
|
|
22
|
-
onBrowserDownload,
|
|
23
|
-
onServeUrlVisited,
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
...comp,
|
|
27
|
-
height: forceHeight !== null && forceHeight !== void 0 ? forceHeight : comp.height,
|
|
28
|
-
width: forceWidth !== null && forceWidth !== void 0 ? forceWidth : comp.width,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
exports.validateComposition = validateComposition;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { FileNameAndSize } from './get-files-in-folder';
|
|
2
|
-
export type LambdaErrorInfo = {
|
|
3
|
-
type: 'renderer' | 'browser' | 'stitcher' | 'webhook' | 'artifact';
|
|
4
|
-
message: string;
|
|
5
|
-
name: string;
|
|
6
|
-
stack: string;
|
|
7
|
-
frame: number | null;
|
|
8
|
-
chunk: number | null;
|
|
9
|
-
isFatal: boolean;
|
|
10
|
-
attempt: number;
|
|
11
|
-
willRetry: boolean;
|
|
12
|
-
totalAttempts: number;
|
|
13
|
-
tmpDir: {
|
|
14
|
-
files: FileNameAndSize[];
|
|
15
|
-
total: number;
|
|
16
|
-
} | null;
|
|
17
|
-
};
|
|
18
|
-
export declare const getTmpDirStateIfENoSp: (err: string) => LambdaErrorInfo['tmpDir'];
|
|
19
|
-
export type EnhancedErrorInfo = LambdaErrorInfo & {
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated Will always be an empty string.
|
|
22
|
-
*/
|
|
23
|
-
s3Location: string;
|
|
24
|
-
explanation: string | null;
|
|
25
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTmpDirStateIfENoSp = void 0;
|
|
4
|
-
const get_files_in_folder_1 = require("./get-files-in-folder");
|
|
5
|
-
const is_enosp_err_1 = require("./is-enosp-err");
|
|
6
|
-
const getTmpDirStateIfENoSp = (err) => {
|
|
7
|
-
if (!(0, is_enosp_err_1.errorIsOutOfSpaceError)(err)) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
const files = (0, get_files_in_folder_1.getFolderFiles)('/tmp');
|
|
11
|
-
return {
|
|
12
|
-
files: files
|
|
13
|
-
.slice(0)
|
|
14
|
-
.sort((a, b) => a.size - b.size)
|
|
15
|
-
.reverse()
|
|
16
|
-
.slice(0, 100),
|
|
17
|
-
total: files.reduce((a, b) => a + b.size, 0),
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
exports.getTmpDirStateIfENoSp = getTmpDirStateIfENoSp;
|
package/dist/functions/info.d.ts
DELETED
package/dist/functions/info.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.infoHandler = void 0;
|
|
4
|
-
const client_1 = require("@remotion/serverless/client");
|
|
5
|
-
const version_1 = require("remotion/version");
|
|
6
|
-
const infoHandler = (lambdaParams) => {
|
|
7
|
-
if (lambdaParams.type !== client_1.LambdaRoutines.info) {
|
|
8
|
-
throw new TypeError('Expected info type');
|
|
9
|
-
}
|
|
10
|
-
const returnValue = {
|
|
11
|
-
version: version_1.VERSION,
|
|
12
|
-
type: 'success',
|
|
13
|
-
};
|
|
14
|
-
return Promise.resolve(returnValue);
|
|
15
|
-
};
|
|
16
|
-
exports.infoHandler = infoHandler;
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ResponseStream } from '../helpers/streamify-response';
|
|
2
|
-
export type ResponseStreamWriter = {
|
|
3
|
-
write: (message: Uint8Array) => Promise<void>;
|
|
4
|
-
end: () => Promise<void>;
|
|
5
|
-
};
|
|
6
|
-
export declare const streamWriter: (responseStream: ResponseStream) => ResponseStreamWriter;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.streamWriter = void 0;
|
|
4
|
-
// Ensures that the previous write is finished before the next one is started
|
|
5
|
-
// Genius solution by ChatGPT
|
|
6
|
-
const streamWriter = (responseStream) => {
|
|
7
|
-
let promiseChain = Promise.resolve();
|
|
8
|
-
const write = (message) => {
|
|
9
|
-
promiseChain = promiseChain.then(() => {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
responseStream.write(message, (err) => {
|
|
12
|
-
if (err) {
|
|
13
|
-
reject(err);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
resolve();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
return promiseChain;
|
|
22
|
-
};
|
|
23
|
-
const end = () => {
|
|
24
|
-
promiseChain = promiseChain.then(() => {
|
|
25
|
-
return new Promise((resolve) => {
|
|
26
|
-
responseStream.end(() => {
|
|
27
|
-
resolve();
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
return promiseChain;
|
|
32
|
-
};
|
|
33
|
-
return { write, end };
|
|
34
|
-
};
|
|
35
|
-
exports.streamWriter = streamWriter;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { SerializedArtifact } from '../helpers/serialize-artifact';
|
|
3
|
-
import type { LambdaErrorInfo } from '../helpers/write-lambda-error';
|
|
4
|
-
import type { RenderStillLambdaResponsePayload } from '../still';
|
|
5
|
-
declare const framesRendered: "frames-rendered";
|
|
6
|
-
declare const errorOccurred: "error-occurred";
|
|
7
|
-
declare const renderIdDetermined: "render-id-determined";
|
|
8
|
-
declare const videoChunkRendered: "video-chunk-rendered";
|
|
9
|
-
declare const audioChunkRendered: "audio-chunk-rendered";
|
|
10
|
-
declare const chunkComplete: "chunk-complete";
|
|
11
|
-
declare const stillRendered: "still-rendered";
|
|
12
|
-
declare const lambdaInvoked: "lambda-invoked";
|
|
13
|
-
declare const artifactEmitted: "artifact-emitted";
|
|
14
|
-
declare const messageTypes: {
|
|
15
|
-
readonly '1': {
|
|
16
|
-
readonly type: "frames-rendered";
|
|
17
|
-
};
|
|
18
|
-
readonly '2': {
|
|
19
|
-
readonly type: "error-occurred";
|
|
20
|
-
};
|
|
21
|
-
readonly '3': {
|
|
22
|
-
readonly type: "render-id-determined";
|
|
23
|
-
};
|
|
24
|
-
readonly '4': {
|
|
25
|
-
readonly type: "video-chunk-rendered";
|
|
26
|
-
};
|
|
27
|
-
readonly '5': {
|
|
28
|
-
readonly type: "audio-chunk-rendered";
|
|
29
|
-
};
|
|
30
|
-
readonly '6': {
|
|
31
|
-
readonly type: "still-rendered";
|
|
32
|
-
};
|
|
33
|
-
readonly '7': {
|
|
34
|
-
readonly type: "chunk-complete";
|
|
35
|
-
};
|
|
36
|
-
readonly '8': {
|
|
37
|
-
readonly type: "lambda-invoked";
|
|
38
|
-
};
|
|
39
|
-
readonly '9': {
|
|
40
|
-
readonly type: "artifact-emitted";
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
export type MessageTypeId = keyof typeof messageTypes;
|
|
44
|
-
type MessageType = (typeof messageTypes)[MessageTypeId]['type'];
|
|
45
|
-
export declare const formatMap: {
|
|
46
|
-
[key in MessageType]: 'json' | 'binary';
|
|
47
|
-
};
|
|
48
|
-
export type StreamingPayload = {
|
|
49
|
-
type: typeof framesRendered;
|
|
50
|
-
payload: {
|
|
51
|
-
rendered: number;
|
|
52
|
-
encoded: number;
|
|
53
|
-
};
|
|
54
|
-
} | {
|
|
55
|
-
type: typeof videoChunkRendered;
|
|
56
|
-
payload: Buffer;
|
|
57
|
-
} | {
|
|
58
|
-
type: typeof audioChunkRendered;
|
|
59
|
-
payload: Buffer;
|
|
60
|
-
} | {
|
|
61
|
-
type: typeof errorOccurred;
|
|
62
|
-
payload: {
|
|
63
|
-
error: string;
|
|
64
|
-
shouldRetry: boolean;
|
|
65
|
-
errorInfo: LambdaErrorInfo;
|
|
66
|
-
};
|
|
67
|
-
} | {
|
|
68
|
-
type: typeof renderIdDetermined;
|
|
69
|
-
payload: {
|
|
70
|
-
renderId: string;
|
|
71
|
-
};
|
|
72
|
-
} | {
|
|
73
|
-
type: typeof stillRendered;
|
|
74
|
-
payload: RenderStillLambdaResponsePayload;
|
|
75
|
-
} | {
|
|
76
|
-
type: typeof chunkComplete;
|
|
77
|
-
payload: {
|
|
78
|
-
start: number;
|
|
79
|
-
rendered: number;
|
|
80
|
-
};
|
|
81
|
-
} | {
|
|
82
|
-
type: typeof lambdaInvoked;
|
|
83
|
-
payload: {
|
|
84
|
-
attempt: number;
|
|
85
|
-
};
|
|
86
|
-
} | {
|
|
87
|
-
type: typeof artifactEmitted;
|
|
88
|
-
payload: {
|
|
89
|
-
artifact: SerializedArtifact;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export declare const messageTypeIdToMessageType: (messageTypeId: MessageTypeId) => MessageType;
|
|
93
|
-
export type StreamingMessage = {
|
|
94
|
-
successType: 'error' | 'success';
|
|
95
|
-
message: StreamingPayload;
|
|
96
|
-
};
|
|
97
|
-
export type OnMessage = (options: StreamingMessage) => void;
|
|
98
|
-
export type OnStream = (payload: StreamingPayload) => Promise<void>;
|
|
99
|
-
export declare const makeStreamPayload: ({ message }: {
|
|
100
|
-
message: StreamingPayload;
|
|
101
|
-
}) => Uint8Array;
|
|
102
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeStreamPayload = exports.messageTypeIdToMessageType = exports.formatMap = void 0;
|
|
4
|
-
const streaming_1 = require("@remotion/streaming");
|
|
5
|
-
const framesRendered = 'frames-rendered';
|
|
6
|
-
const errorOccurred = 'error-occurred';
|
|
7
|
-
const renderIdDetermined = 'render-id-determined';
|
|
8
|
-
const videoChunkRendered = 'video-chunk-rendered';
|
|
9
|
-
const audioChunkRendered = 'audio-chunk-rendered';
|
|
10
|
-
const chunkComplete = 'chunk-complete';
|
|
11
|
-
const stillRendered = 'still-rendered';
|
|
12
|
-
const lambdaInvoked = 'lambda-invoked';
|
|
13
|
-
const artifactEmitted = 'artifact-emitted';
|
|
14
|
-
const messageTypes = {
|
|
15
|
-
'1': { type: framesRendered },
|
|
16
|
-
'2': { type: errorOccurred },
|
|
17
|
-
'3': { type: renderIdDetermined },
|
|
18
|
-
'4': { type: videoChunkRendered },
|
|
19
|
-
'5': { type: audioChunkRendered },
|
|
20
|
-
'6': { type: stillRendered },
|
|
21
|
-
'7': { type: chunkComplete },
|
|
22
|
-
'8': { type: lambdaInvoked },
|
|
23
|
-
'9': { type: artifactEmitted },
|
|
24
|
-
};
|
|
25
|
-
exports.formatMap = {
|
|
26
|
-
[framesRendered]: 'json',
|
|
27
|
-
[errorOccurred]: 'json',
|
|
28
|
-
[renderIdDetermined]: 'json',
|
|
29
|
-
[videoChunkRendered]: 'binary',
|
|
30
|
-
[audioChunkRendered]: 'binary',
|
|
31
|
-
[stillRendered]: 'json',
|
|
32
|
-
[chunkComplete]: 'json',
|
|
33
|
-
[lambdaInvoked]: 'json',
|
|
34
|
-
[artifactEmitted]: 'json',
|
|
35
|
-
};
|
|
36
|
-
const messageTypeIdToMessageType = (messageTypeId) => {
|
|
37
|
-
const types = messageTypes[messageTypeId];
|
|
38
|
-
if (!types) {
|
|
39
|
-
throw new Error(`Unknown message type id ${messageTypeId}`);
|
|
40
|
-
}
|
|
41
|
-
return types.type;
|
|
42
|
-
};
|
|
43
|
-
exports.messageTypeIdToMessageType = messageTypeIdToMessageType;
|
|
44
|
-
const messageTypeToMessageId = (messageType) => {
|
|
45
|
-
const id = Object.keys(messageTypes).find((key) => messageTypes[key].type === messageType);
|
|
46
|
-
if (!id) {
|
|
47
|
-
throw new Error(`Unknown message type ${messageType}`);
|
|
48
|
-
}
|
|
49
|
-
return id;
|
|
50
|
-
};
|
|
51
|
-
const makeStreamPayload = ({ message }) => {
|
|
52
|
-
const body = exports.formatMap[message.type] === 'json'
|
|
53
|
-
? new TextEncoder().encode(JSON.stringify(message.payload))
|
|
54
|
-
: message.payload;
|
|
55
|
-
return (0, streaming_1.makeStreamPayloadMessage)({
|
|
56
|
-
body,
|
|
57
|
-
nonce: messageTypeToMessageId(message.type),
|
|
58
|
-
status: 0,
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
exports.makeStreamPayload = makeStreamPayload;
|
package/dist/shared/await.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Await<T> = T extends PromiseLike<infer U> ? U : T;
|
package/dist/shared/await.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ProviderSpecifics } from '@remotion/serverless';
|
|
2
|
-
import { type SerializedInputProps } from '@remotion/serverless/client';
|
|
3
|
-
type PropsType = 'input-props' | 'resolved-props';
|
|
4
|
-
export declare const serializeOrThrow: (inputProps: Record<string, unknown>, propsType: PropsType) => string;
|
|
5
|
-
export declare const getNeedsToUpload: (type: 'still' | 'video-or-audio', sizes: number[]) => boolean;
|
|
6
|
-
export declare const compressInputProps: <Region extends string>({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }: {
|
|
7
|
-
stringifiedInputProps: string;
|
|
8
|
-
region: Region;
|
|
9
|
-
userSpecifiedBucketName: string | null;
|
|
10
|
-
propsType: PropsType;
|
|
11
|
-
needsToUpload: boolean;
|
|
12
|
-
providerSpecifics: ProviderSpecifics<Region>;
|
|
13
|
-
}) => Promise<SerializedInputProps>;
|
|
14
|
-
export declare const decompressInputProps: <Region extends string>({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }: {
|
|
15
|
-
serialized: SerializedInputProps;
|
|
16
|
-
region: Region;
|
|
17
|
-
bucketName: string;
|
|
18
|
-
expectedBucketOwner: string;
|
|
19
|
-
propsType: PropsType;
|
|
20
|
-
providerSpecifics: ProviderSpecifics<Region>;
|
|
21
|
-
}) => Promise<string>;
|
|
22
|
-
export {};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decompressInputProps = exports.compressInputProps = exports.getNeedsToUpload = exports.serializeOrThrow = void 0;
|
|
4
|
-
const client_1 = require("@remotion/serverless/client");
|
|
5
|
-
const no_react_1 = require("remotion/no-react");
|
|
6
|
-
const validate_webhook_1 = require("./validate-webhook");
|
|
7
|
-
const makeKey = (type, hash) => {
|
|
8
|
-
if (type === 'input-props') {
|
|
9
|
-
return (0, client_1.inputPropsKey)(hash);
|
|
10
|
-
}
|
|
11
|
-
return (0, client_1.resolvedPropsKey)(hash);
|
|
12
|
-
};
|
|
13
|
-
const serializeOrThrow = (inputProps, propsType) => {
|
|
14
|
-
try {
|
|
15
|
-
const payload = no_react_1.NoReactInternals.serializeJSONWithDate({
|
|
16
|
-
indent: undefined,
|
|
17
|
-
staticBase: null,
|
|
18
|
-
data: inputProps,
|
|
19
|
-
});
|
|
20
|
-
return payload.serializedString;
|
|
21
|
-
}
|
|
22
|
-
catch (err) {
|
|
23
|
-
throw new Error(`Error serializing ${propsType}. Check it has no circular references or reduce the size if the object is big.`);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.serializeOrThrow = serializeOrThrow;
|
|
27
|
-
const getNeedsToUpload = (type, sizes) => {
|
|
28
|
-
const MARGIN = 5000 + validate_webhook_1.MAX_WEBHOOK_CUSTOM_DATA_SIZE;
|
|
29
|
-
const MAX_INLINE_PAYLOAD_SIZE = (type === 'still' ? 5000000 : 200000) - MARGIN;
|
|
30
|
-
const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
|
|
31
|
-
if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
|
|
32
|
-
console.warn(`Warning: The props are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(sizesAlreadyUsed / 1024)}KB) in size. Uploading them to S3 to circumvent AWS Lambda payload size, which may lead to slowdown.`);
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
};
|
|
37
|
-
exports.getNeedsToUpload = getNeedsToUpload;
|
|
38
|
-
const compressInputProps = async ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }) => {
|
|
39
|
-
const hash = providerSpecifics.randomHash();
|
|
40
|
-
if (needsToUpload) {
|
|
41
|
-
const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, client_1.internalGetOrCreateBucket)({
|
|
42
|
-
region,
|
|
43
|
-
enableFolderExpiry: null,
|
|
44
|
-
customCredentials: null,
|
|
45
|
-
providerSpecifics,
|
|
46
|
-
})).bucketName;
|
|
47
|
-
await providerSpecifics.writeFile({
|
|
48
|
-
body: stringifiedInputProps,
|
|
49
|
-
bucketName,
|
|
50
|
-
region,
|
|
51
|
-
customCredentials: null,
|
|
52
|
-
downloadBehavior: null,
|
|
53
|
-
expectedBucketOwner: null,
|
|
54
|
-
key: makeKey(propsType, hash),
|
|
55
|
-
privacy: 'private',
|
|
56
|
-
});
|
|
57
|
-
return {
|
|
58
|
-
type: 'bucket-url',
|
|
59
|
-
hash,
|
|
60
|
-
bucketName,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
type: 'payload',
|
|
65
|
-
payload: stringifiedInputProps,
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
exports.compressInputProps = compressInputProps;
|
|
69
|
-
const decompressInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }) => {
|
|
70
|
-
if (serialized.type === 'payload') {
|
|
71
|
-
return serialized.payload;
|
|
72
|
-
}
|
|
73
|
-
try {
|
|
74
|
-
const response = await providerSpecifics.readFile({
|
|
75
|
-
bucketName,
|
|
76
|
-
expectedBucketOwner,
|
|
77
|
-
key: makeKey(propsType, serialized.hash),
|
|
78
|
-
region,
|
|
79
|
-
});
|
|
80
|
-
const body = await (0, client_1.streamToString)(response);
|
|
81
|
-
const payload = body;
|
|
82
|
-
return payload;
|
|
83
|
-
}
|
|
84
|
-
catch (err) {
|
|
85
|
-
throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
exports.decompressInputProps = decompressInputProps;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.streamToString = void 0;
|
|
4
|
-
function streamToString(stream) {
|
|
5
|
-
if (Buffer.isBuffer(stream)) {
|
|
6
|
-
return stream.toString('utf-8');
|
|
7
|
-
}
|
|
8
|
-
const chunks = [];
|
|
9
|
-
return new Promise((resolve, reject) => {
|
|
10
|
-
stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
11
|
-
stream.on('error', (err) => reject(err));
|
|
12
|
-
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
exports.streamToString = streamToString;
|
package/dist/shared/truthy.d.ts
DELETED
package/dist/shared/truthy.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AudioCodec, Codec } from '@remotion/renderer';
|
|
2
|
-
import type { OutNameInputWithoutCredentials } from './constants';
|
|
3
|
-
export declare const validateOutname: ({ outName, codec, audioCodecSetting, separateAudioTo, }: {
|
|
4
|
-
outName: OutNameInputWithoutCredentials | undefined | null;
|
|
5
|
-
codec: Codec | null;
|
|
6
|
-
audioCodecSetting: AudioCodec | null;
|
|
7
|
-
separateAudioTo: string | null;
|
|
8
|
-
}) => void;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateOutname = void 0;
|
|
4
|
-
const pure_1 = require("@remotion/renderer/pure");
|
|
5
|
-
const client_1 = require("@remotion/serverless/client");
|
|
6
|
-
const validateS3Key = (s3Key) => {
|
|
7
|
-
if (typeof s3Key !== 'string') {
|
|
8
|
-
throw new TypeError('The S3 key must be a string. Passed an object of type ' + typeof s3Key);
|
|
9
|
-
}
|
|
10
|
-
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html
|
|
11
|
-
if (!s3Key.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g)) {
|
|
12
|
-
throw new Error("The S3 Key must match the RegExp `/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g`. You passed: " +
|
|
13
|
-
s3Key +
|
|
14
|
-
'. Check for invalid characters.');
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const validateOutname = ({ outName, codec, audioCodecSetting, separateAudioTo, }) => {
|
|
18
|
-
if (typeof outName === 'undefined' || outName === null) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (typeof outName !== 'string') {
|
|
22
|
-
validateS3Key(outName.key);
|
|
23
|
-
(0, client_1.validateBucketName)(outName.bucketName, { mustStartWithRemotion: false });
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (codec) {
|
|
27
|
-
pure_1.NoReactAPIs.validateOutputFilename({
|
|
28
|
-
codec,
|
|
29
|
-
audioCodecSetting,
|
|
30
|
-
extension: pure_1.NoReactAPIs.getExtensionOfFilename(outName),
|
|
31
|
-
preferLossless: false,
|
|
32
|
-
separateAudioTo,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
validateS3Key(outName);
|
|
36
|
-
};
|
|
37
|
-
exports.validateOutname = validateOutname;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateWebhook = exports.MAX_WEBHOOK_CUSTOM_DATA_SIZE = void 0;
|
|
4
|
-
exports.MAX_WEBHOOK_CUSTOM_DATA_SIZE = 1024;
|
|
5
|
-
const validateWebhook = (webhook) => {
|
|
6
|
-
if (typeof webhook === 'undefined' || webhook === null) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (webhook.customData) {
|
|
10
|
-
const size = JSON.stringify(webhook.customData).length;
|
|
11
|
-
if (size > exports.MAX_WEBHOOK_CUSTOM_DATA_SIZE) {
|
|
12
|
-
throw new Error(`Webhook "customData" must be less than ${exports.MAX_WEBHOOK_CUSTOM_DATA_SIZE} bytes. Current size: ${size} bytes.`);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
exports.validateWebhook = validateWebhook;
|