@remotion/lambda 4.0.199 → 4.0.201
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/api/deploy-site.d.ts +5 -3
- package/dist/api/deploy-site.js +10 -2
- package/dist/cli/commands/sites/create.js +19 -1
- package/dist/cli/helpers/find-function-name.js +1 -1
- package/dist/cli/helpers/progress-bar.d.ts +5 -0
- package/dist/cli/helpers/progress-bar.js +19 -1
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/helpers/check-if-render-exists.d.ts +3 -0
- package/dist/functions/helpers/check-if-render-exists.js +15 -0
- package/dist/functions/helpers/delete-chunks.d.ts +9 -0
- package/dist/functions/helpers/delete-chunks.js +25 -0
- package/dist/functions/helpers/expected-out-name.d.ts +1 -1
- package/dist/functions/helpers/get-browser-instance.d.ts +2 -3
- package/dist/functions/helpers/get-browser-instance.js +4 -3
- package/dist/functions/helpers/get-cleanup-progress.d.ts +10 -0
- package/dist/functions/helpers/get-cleanup-progress.js +35 -0
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-custom-out-name.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-metadata.d.ts +7 -0
- package/dist/functions/helpers/get-encoding-metadata.js +15 -0
- package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +1 -0
- package/dist/functions/helpers/get-encoding-progress-step-size.js +7 -0
- package/dist/functions/helpers/get-files-to-delete.d.ts +10 -0
- package/dist/functions/helpers/get-files-to-delete.js +52 -0
- package/dist/functions/helpers/get-final-encoding-status.d.ts +6 -0
- package/dist/functions/helpers/get-final-encoding-status.js +18 -0
- package/dist/functions/helpers/get-folder-size.d.ts +1 -0
- package/dist/functions/helpers/get-folder-size.js +8 -0
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +8 -0
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +14 -0
- package/dist/functions/helpers/get-post-render-data.d.ts +8 -0
- package/dist/functions/helpers/get-post-render-data.js +22 -0
- package/dist/functions/helpers/get-progress.js +2 -1
- package/dist/functions/helpers/get-render-metadata.d.ts +8 -0
- package/dist/functions/helpers/get-render-metadata.js +17 -0
- package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
- package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
- package/dist/functions/helpers/get-time-to-finish.d.ts +5 -0
- package/dist/functions/helpers/get-time-to-finish.js +13 -0
- package/dist/functions/helpers/io.d.ts +33 -3
- package/dist/functions/helpers/io.js +104 -3
- package/dist/functions/helpers/print-cloudwatch-helper.d.ts +1 -1
- package/dist/functions/helpers/print-cloudwatch-helper.js +3 -3
- package/dist/functions/helpers/streaming-payloads.d.ts +19 -0
- package/dist/functions/helpers/streaming-payloads.js +25 -0
- package/dist/functions/helpers/write-lambda-error.d.ts +3 -2
- package/dist/functions/helpers/write-lambda-error.js +2 -3
- package/dist/functions/helpers/write-post-render-data.d.ts +9 -0
- package/dist/functions/helpers/write-post-render-data.js +18 -0
- package/dist/functions/merge.d.ts +9 -0
- package/dist/functions/merge.js +61 -0
- package/dist/internals.d.ts +7 -6
- package/dist/shared/__mocks__/read-dir.js +2 -2
- package/dist/shared/chunk-progress.d.ts +9 -0
- package/dist/shared/chunk-progress.js +2034 -0
- package/dist/shared/compress-props.d.ts +6 -8
- package/dist/shared/compress-props.js +14 -11
- package/dist/shared/get-etag.d.ts +1 -1
- package/dist/shared/get-etag.js +33 -12
- package/dist/shared/get-s3-operations.d.ts +2 -1
- package/dist/shared/get-s3-operations.js +38 -20
- package/dist/shared/parse-chunk-key.d.ts +5 -0
- package/dist/shared/parse-chunk-key.js +15 -0
- package/dist/shared/parse-lambda-initialized-key.d.ts +5 -0
- package/dist/shared/parse-lambda-initialized-key.js +15 -0
- package/dist/shared/read-dir.d.ts +6 -5
- package/dist/shared/read-dir.js +9 -6
- package/dist/shared/serialize-props.d.ts +14 -0
- package/dist/shared/serialize-props.js +36 -0
- package/package.json +11 -11
- package/remotionlambda-arm64.zip +0 -0
- package/dist/functions/provider-implementation.d.ts +0 -0
- package/dist/functions/provider-implementation.js +0 -1
|
@@ -15,6 +15,7 @@ type OptionalParameters = {
|
|
|
15
15
|
options: {
|
|
16
16
|
onBundleProgress?: (progress: number) => void;
|
|
17
17
|
onUploadProgress?: (upload: UploadDirProgress) => void;
|
|
18
|
+
onDiffingProgress?: (bytes: number, done: boolean) => void;
|
|
18
19
|
webpackOverride?: WebpackOverrideFn;
|
|
19
20
|
ignoreRegisterRootWarning?: boolean;
|
|
20
21
|
enableCaching?: boolean;
|
|
@@ -41,6 +42,7 @@ export declare const internalDeploySite: (args_0: MandatoryParameters & {
|
|
|
41
42
|
options: {
|
|
42
43
|
onBundleProgress?: ((progress: number) => void) | undefined;
|
|
43
44
|
onUploadProgress?: ((upload: UploadDirProgress) => void) | undefined;
|
|
45
|
+
onDiffingProgress?: ((bytes: number, done: boolean) => void) | undefined;
|
|
44
46
|
webpackOverride?: WebpackOverrideFn | undefined;
|
|
45
47
|
ignoreRegisterRootWarning?: boolean | undefined;
|
|
46
48
|
enableCaching?: boolean | undefined;
|
|
@@ -61,11 +63,11 @@ export declare const internalDeploySite: (args_0: MandatoryParameters & {
|
|
|
61
63
|
getValue: ({ commandLine }: {
|
|
62
64
|
commandLine: Record<string, unknown>;
|
|
63
65
|
}) => {
|
|
64
|
-
value: "
|
|
66
|
+
value: "verbose" | "info" | "warn" | "error";
|
|
65
67
|
source: string;
|
|
66
68
|
};
|
|
67
|
-
setConfig: (newLogLevel: "
|
|
68
|
-
type: "
|
|
69
|
+
setConfig: (newLogLevel: "verbose" | "info" | "warn" | "error") => void;
|
|
70
|
+
type: "verbose" | "info" | "warn" | "error";
|
|
69
71
|
};
|
|
70
72
|
readonly throwIfSiteExists: {
|
|
71
73
|
cliFlag: string;
|
package/dist/api/deploy-site.js
CHANGED
|
@@ -18,7 +18,7 @@ const validate_privacy_1 = require("../shared/validate-privacy");
|
|
|
18
18
|
const validate_site_name_1 = require("../shared/validate-site-name");
|
|
19
19
|
const upload_dir_1 = require("./upload-dir");
|
|
20
20
|
const mandatoryDeploySite = async ({ bucketName, entryPoint, siteName, options, region, privacy, gitSource, throwIfSiteExists, providerSpecifics, }) => {
|
|
21
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
22
22
|
(0, validate_aws_region_1.validateAwsRegion)(region);
|
|
23
23
|
(0, client_1.validateBucketName)(bucketName, {
|
|
24
24
|
mustStartWithRemotion: !(options === null || options === void 0 ? void 0 : options.bypassBucketNameValidation),
|
|
@@ -68,17 +68,25 @@ const mandatoryDeploySite = async ({ bucketName, entryPoint, siteName, options,
|
|
|
68
68
|
.map((f) => f.Key)
|
|
69
69
|
.join(', '));
|
|
70
70
|
}
|
|
71
|
+
(_g = options.onDiffingProgress) === null || _g === void 0 ? void 0 : _g.call(options, 0, false);
|
|
72
|
+
let totalBytes = 0;
|
|
71
73
|
const { toDelete, toUpload, existingCount } = await (0, get_s3_operations_1.getS3DiffOperations)({
|
|
72
74
|
objects: files,
|
|
73
75
|
bundle: bundled,
|
|
74
76
|
prefix: subFolder,
|
|
77
|
+
onProgress: (bytes) => {
|
|
78
|
+
var _a;
|
|
79
|
+
totalBytes = bytes;
|
|
80
|
+
(_a = options.onDiffingProgress) === null || _a === void 0 ? void 0 : _a.call(options, bytes, false);
|
|
81
|
+
},
|
|
75
82
|
});
|
|
83
|
+
(_h = options.onDiffingProgress) === null || _h === void 0 ? void 0 : _h.call(options, totalBytes, true);
|
|
76
84
|
await Promise.all([
|
|
77
85
|
(0, upload_dir_1.uploadDir)({
|
|
78
86
|
bucket: bucketName,
|
|
79
87
|
region,
|
|
80
88
|
localDir: bundled,
|
|
81
|
-
onProgress: (
|
|
89
|
+
onProgress: (_j = options === null || options === void 0 ? void 0 : options.onUploadProgress) !== null && _j !== void 0 ? _j : (() => undefined),
|
|
82
90
|
keyPrefix: subFolder,
|
|
83
91
|
privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
|
|
84
92
|
toUpload,
|
|
@@ -58,13 +58,20 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel, implementatio
|
|
|
58
58
|
sizeUploaded: 0,
|
|
59
59
|
stats: null,
|
|
60
60
|
},
|
|
61
|
+
diffingProgress: {
|
|
62
|
+
doneIn: null,
|
|
63
|
+
bytesProcessed: 0,
|
|
64
|
+
},
|
|
61
65
|
};
|
|
62
66
|
const updateProgress = (newLine) => {
|
|
63
67
|
progressBar.update([
|
|
64
68
|
(0, progress_bar_1.makeBundleProgress)(multiProgress.bundleProgress),
|
|
65
69
|
(0, progress_bar_1.makeBucketProgress)(multiProgress.bucketProgress),
|
|
70
|
+
(0, progress_bar_1.makeDiffingProgressBar)(multiProgress.diffingProgress),
|
|
66
71
|
(0, progress_bar_1.makeDeployProgressBar)(multiProgress.deployProgress),
|
|
67
|
-
]
|
|
72
|
+
]
|
|
73
|
+
.filter(no_react_1.NoReactInternals.truthy)
|
|
74
|
+
.join('\n'), newLine);
|
|
68
75
|
};
|
|
69
76
|
const bucketStart = Date.now();
|
|
70
77
|
const enableFolderExpiry = folderExpiryOption.getValue({
|
|
@@ -108,6 +115,17 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel, implementatio
|
|
|
108
115
|
}
|
|
109
116
|
updateProgress(false);
|
|
110
117
|
},
|
|
118
|
+
onDiffingProgress(bytes, done) {
|
|
119
|
+
const previous = multiProgress.diffingProgress.bytesProcessed;
|
|
120
|
+
const newBytes = bytes - previous;
|
|
121
|
+
if (newBytes > 100000000 || done) {
|
|
122
|
+
multiProgress.diffingProgress = {
|
|
123
|
+
bytesProcessed: bytes,
|
|
124
|
+
doneIn: done ? Date.now() - bundleStart : null,
|
|
125
|
+
};
|
|
126
|
+
updateProgress(false);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
111
129
|
onUploadProgress: (p) => {
|
|
112
130
|
multiProgress.deployProgress = {
|
|
113
131
|
sizeUploaded: p.sizeUploaded,
|
|
@@ -54,7 +54,7 @@ const findFunctionName = async (logLevel) => {
|
|
|
54
54
|
log_1.Log.info(logOptions);
|
|
55
55
|
log_1.Log.info(logOptions, 'Possible solutions:');
|
|
56
56
|
log_1.Log.info(logOptions, '- Define using `--function-name` which function you want to use.');
|
|
57
|
-
log_1.Log.info(logOptions, `- Delete extraneous
|
|
57
|
+
log_1.Log.info(logOptions, `- Delete extraneous Lambda functions in your AWS console or using:`);
|
|
58
58
|
log_1.Log.info(logOptions, ` npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${rm_1.FUNCTIONS_RM_SUBCOMMAND} $(npx ${constants_1.BINARY_NAME} ${functions_1.FUNCTIONS_COMMAND} ${ls_1.FUNCTIONS_LS_SUBCOMMAND} -q) -y`);
|
|
59
59
|
log_1.Log.info(logOptions);
|
|
60
60
|
log_1.Log.info(logOptions, `The following functions were found (only showing v${version_1.VERSION}):`);
|
|
@@ -18,5 +18,10 @@ export type DeployToS3Progress = {
|
|
|
18
18
|
doneIn: number | null;
|
|
19
19
|
stats: UploadStats | null;
|
|
20
20
|
};
|
|
21
|
+
export type DiffingProgress = {
|
|
22
|
+
doneIn: number | null;
|
|
23
|
+
bytesProcessed: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const makeDiffingProgressBar: ({ bytesProcessed, doneIn, }: DiffingProgress) => string | null;
|
|
21
26
|
export declare const makeDeployProgressBar: ({ sizeUploaded, totalSize, doneIn, stats, }: DeployToS3Progress) => string;
|
|
22
27
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeDeployProgressBar = exports.makeBucketProgress = exports.makeBundleProgress = void 0;
|
|
3
|
+
exports.makeDeployProgressBar = exports.makeDiffingProgressBar = exports.makeBucketProgress = exports.makeBundleProgress = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const no_react_1 = require("remotion/no-react");
|
|
6
6
|
const makeBundleProgress = ({ progress, doneIn }) => {
|
|
@@ -37,6 +37,24 @@ const makeUploadDiff = ({ stats }) => {
|
|
|
37
37
|
.filter(no_react_1.NoReactInternals.truthy)
|
|
38
38
|
.join(',')} ${total === 1 ? 'file' : 'files'})`);
|
|
39
39
|
};
|
|
40
|
+
const makeDiffingProgressBar = ({ bytesProcessed, doneIn, }) => {
|
|
41
|
+
const progress = doneIn === null ? 0 : 1;
|
|
42
|
+
if (bytesProcessed === 0) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return [
|
|
46
|
+
`${doneIn === null ? 'Calculating changes' : 'Calculated changes'}`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
47
|
+
cli_1.CliInternals.makeProgressBar(progress, false),
|
|
48
|
+
doneIn === null
|
|
49
|
+
? bytesProcessed === 0
|
|
50
|
+
? null
|
|
51
|
+
: `${cli_1.CliInternals.formatBytes(bytesProcessed)}`
|
|
52
|
+
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
53
|
+
]
|
|
54
|
+
.filter(no_react_1.NoReactInternals.truthy)
|
|
55
|
+
.join(' ');
|
|
56
|
+
};
|
|
57
|
+
exports.makeDiffingProgressBar = makeDiffingProgressBar;
|
|
40
58
|
const makeDeployProgressBar = ({ sizeUploaded, totalSize, doneIn, stats, }) => {
|
|
41
59
|
const progress = totalSize === null ? 0 : sizeUploaded / totalSize;
|
|
42
60
|
return [
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkIfRenderExists = void 0;
|
|
4
|
+
const constants_1 = require("../../shared/constants");
|
|
5
|
+
const checkIfRenderExists = (contents, renderId, bucketName, region) => {
|
|
6
|
+
const initializedExists = Boolean(contents.find((c) => {
|
|
7
|
+
var _a;
|
|
8
|
+
return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.initalizedMetadataKey)(renderId));
|
|
9
|
+
}));
|
|
10
|
+
if (!initializedExists) {
|
|
11
|
+
// ! Error message is checked in progress handler and will be retried. Make sure to update
|
|
12
|
+
throw new TypeError(`No render with ID "${renderId}" found in bucket ${bucketName} and region ${region}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.checkIfRenderExists = checkIfRenderExists;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
+
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
3
|
+
import type { CleanupJob } from './get-files-to-delete';
|
|
4
|
+
export declare const cleanupFiles: ({ bucket, region, contents, jobs, }: {
|
|
5
|
+
bucket: string;
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
contents: _Object[];
|
|
8
|
+
jobs: CleanupJob[];
|
|
9
|
+
}) => Promise<number>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanupFiles = void 0;
|
|
4
|
+
const clean_items_1 = require("../../api/clean-items");
|
|
5
|
+
const cleanupFiles = async ({ bucket, region, contents, jobs, }) => {
|
|
6
|
+
const start = Date.now();
|
|
7
|
+
await (0, clean_items_1.cleanItems)({
|
|
8
|
+
bucket,
|
|
9
|
+
region,
|
|
10
|
+
list: jobs.map((item) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (item.type === 'exact') {
|
|
13
|
+
return item.name;
|
|
14
|
+
}
|
|
15
|
+
if (item.type === 'prefix') {
|
|
16
|
+
return (_a = contents.find((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith(item.name); })) === null || _a === void 0 ? void 0 : _a.Key;
|
|
17
|
+
}
|
|
18
|
+
throw new Error('unexpected in deleteChunks()');
|
|
19
|
+
}),
|
|
20
|
+
onAfterItemDeleted: () => undefined,
|
|
21
|
+
onBeforeItemDeleted: () => undefined,
|
|
22
|
+
});
|
|
23
|
+
return Date.now() - start;
|
|
24
|
+
};
|
|
25
|
+
exports.cleanupFiles = cleanupFiles;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CustomCredentials, OutNameInput } from '@remotion/serverless/client';
|
|
2
2
|
import type { OutNameOutput, RenderMetadata } from '../../defaults';
|
|
3
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
|
|
4
|
+
export declare const getExpectedOutName: <Region extends string>(renderMetadata: RenderMetadata<Region>, bucketName: string, customCredentials: CustomCredentials<Region> | null) => OutNameOutput<Region>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ChromiumOptions, LogLevel, openBrowser } from '@remotion/renderer';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Await } from '@remotion/serverless/client';
|
|
2
|
+
import type { Await } from '../../shared/await';
|
|
4
3
|
type LaunchedBrowser = {
|
|
5
4
|
instance: Await<ReturnType<typeof openBrowser>>;
|
|
6
5
|
configurationString: string;
|
|
7
6
|
};
|
|
8
7
|
export declare const forgetBrowserEventLoop: (logLevel: LogLevel) => void;
|
|
9
|
-
export declare const getBrowserInstance: (logLevel: LogLevel, indent: boolean, chromiumOptions: ChromiumOptions
|
|
8
|
+
export declare const getBrowserInstance: (logLevel: LogLevel, indent: boolean, chromiumOptions: ChromiumOptions) => Promise<LaunchedBrowser>;
|
|
10
9
|
export {};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getBrowserInstance = exports.forgetBrowserEventLoop = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
5
|
const version_1 = require("remotion/version");
|
|
6
|
+
const get_chromium_executable_path_1 = require("./get-chromium-executable-path");
|
|
6
7
|
const makeConfigurationString = (options, logLevel) => {
|
|
7
8
|
var _a, _b, _c;
|
|
8
9
|
return [
|
|
@@ -36,7 +37,7 @@ const forgetBrowserEventLoop = (logLevel) => {
|
|
|
36
37
|
_browserInstance === null || _browserInstance === void 0 ? void 0 : _browserInstance.instance.forgetEventLoop();
|
|
37
38
|
};
|
|
38
39
|
exports.forgetBrowserEventLoop = forgetBrowserEventLoop;
|
|
39
|
-
const getBrowserInstance = async (logLevel, indent, chromiumOptions
|
|
40
|
+
const getBrowserInstance = async (logLevel, indent, chromiumOptions) => {
|
|
40
41
|
var _a;
|
|
41
42
|
const actualChromiumOptions = {
|
|
42
43
|
...chromiumOptions,
|
|
@@ -56,7 +57,7 @@ const getBrowserInstance = async (logLevel, indent, chromiumOptions, providerSpe
|
|
|
56
57
|
if (!_browserInstance) {
|
|
57
58
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Cold Lambda function, launching new browser instance');
|
|
58
59
|
launching = true;
|
|
59
|
-
const execPath =
|
|
60
|
+
const execPath = (0, get_chromium_executable_path_1.executablePath)();
|
|
60
61
|
const instance = await renderer_1.RenderInternals.internalOpenBrowser({
|
|
61
62
|
browser: 'chrome',
|
|
62
63
|
browserExecutable: execPath,
|
|
@@ -90,7 +91,7 @@ const getBrowserInstance = async (logLevel, indent, chromiumOptions, providerSpe
|
|
|
90
91
|
_browserInstance.instance.rememberEventLoop();
|
|
91
92
|
await _browserInstance.instance.close(true, logLevel, indent);
|
|
92
93
|
_browserInstance = null;
|
|
93
|
-
return (0, exports.getBrowserInstance)(logLevel, indent, chromiumOptions
|
|
94
|
+
return (0, exports.getBrowserInstance)(logLevel, indent, chromiumOptions);
|
|
94
95
|
}
|
|
95
96
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Warm Lambda function, reusing browser instance');
|
|
96
97
|
_browserInstance.instance.rememberEventLoop();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
+
import type { CleanupInfo } from '../../shared/constants';
|
|
3
|
+
export declare const getCleanupProgress: ({ contents, output, chunkCount, renderId, hasAudio, hasVideo, }: {
|
|
4
|
+
contents: _Object[];
|
|
5
|
+
output: string | null;
|
|
6
|
+
chunkCount: number;
|
|
7
|
+
renderId: string;
|
|
8
|
+
hasAudio: boolean;
|
|
9
|
+
hasVideo: boolean;
|
|
10
|
+
}) => null | CleanupInfo;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCleanupProgress = void 0;
|
|
4
|
+
const get_files_to_delete_1 = require("./get-files-to-delete");
|
|
5
|
+
const getCleanupProgress = ({ contents, output, chunkCount, renderId, hasAudio, hasVideo, }) => {
|
|
6
|
+
if (output === null) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const filesToDelete = (0, get_files_to_delete_1.getFilesToDelete)({
|
|
10
|
+
chunkCount,
|
|
11
|
+
renderId,
|
|
12
|
+
hasAudio,
|
|
13
|
+
hasVideo,
|
|
14
|
+
});
|
|
15
|
+
const filesStillThere = contents.filter((c) => {
|
|
16
|
+
return filesToDelete.find((f) => {
|
|
17
|
+
var _a;
|
|
18
|
+
if (f.type === 'exact') {
|
|
19
|
+
return f.name === c.Key;
|
|
20
|
+
}
|
|
21
|
+
if (f.type === 'prefix') {
|
|
22
|
+
return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith(f.name);
|
|
23
|
+
}
|
|
24
|
+
throw new Error('Unexpected in getCleanupProgress');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const filesDeleted = Math.max(0, filesToDelete.length - filesStillThere.length);
|
|
28
|
+
return {
|
|
29
|
+
minFilesToDelete: filesToDelete.length,
|
|
30
|
+
filesDeleted,
|
|
31
|
+
// We don't know. Only if post render data is saved, we know the timing
|
|
32
|
+
doneIn: null,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
exports.getCleanupProgress = getCleanupProgress;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getCurrentRegionInFunctionImplementation: () => "
|
|
1
|
+
export declare const getCurrentRegionInFunctionImplementation: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-south-1" | "ap-east-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "me-south-1" | "sa-east-1";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CustomCredentials, OutNameInput } from '@remotion/serverless/client';
|
|
2
2
|
import type { RenderMetadata } from '../../defaults';
|
|
3
3
|
export declare const getCustomOutName: <Region extends string>({ renderMetadata, customCredentials, }: {
|
|
4
|
-
renderMetadata: RenderMetadata
|
|
4
|
+
renderMetadata: RenderMetadata<Region>;
|
|
5
5
|
customCredentials: CustomCredentials<Region> | null;
|
|
6
6
|
}) => OutNameInput<Region> | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
+
import type { EncodingProgress } from '../../defaults';
|
|
3
|
+
export declare const getEncodingMetadata: ({ exists, frameCount, stepSize, }: {
|
|
4
|
+
exists: _Object | undefined;
|
|
5
|
+
frameCount: number;
|
|
6
|
+
stepSize: number;
|
|
7
|
+
}) => EncodingProgress | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEncodingMetadata = void 0;
|
|
4
|
+
const chunk_progress_1 = require("../../shared/chunk-progress");
|
|
5
|
+
const getEncodingMetadata = ({ exists, frameCount, stepSize, }) => {
|
|
6
|
+
if (!exists) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const framesEncoded = (0, chunk_progress_1.getProgressOfChunk)(exists.ETag);
|
|
10
|
+
// We only report every 100 frames encoded so that we are able to report up to 2000 * 100 ETags => 200000 frames
|
|
11
|
+
return {
|
|
12
|
+
framesEncoded: Math.min(frameCount, framesEncoded * stepSize),
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.getEncodingMetadata = getEncodingMetadata;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getEncodingProgressStepSize: (totalFrames: number) => number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEncodingProgressStepSize = void 0;
|
|
4
|
+
const getEncodingProgressStepSize = (totalFrames) => {
|
|
5
|
+
return Math.min(100, Math.max(5, totalFrames / 10));
|
|
6
|
+
};
|
|
7
|
+
exports.getEncodingProgressStepSize = getEncodingProgressStepSize;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CleanupJob = {
|
|
2
|
+
name: string;
|
|
3
|
+
type: 'exact' | 'prefix';
|
|
4
|
+
};
|
|
5
|
+
export declare const getFilesToDelete: ({ chunkCount, renderId, hasVideo, hasAudio, }: {
|
|
6
|
+
chunkCount: number;
|
|
7
|
+
renderId: string;
|
|
8
|
+
hasVideo: boolean;
|
|
9
|
+
hasAudio: boolean;
|
|
10
|
+
}) => CleanupJob[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFilesToDelete = void 0;
|
|
4
|
+
const constants_1 = require("../../shared/constants");
|
|
5
|
+
const getFilesToDelete = ({ chunkCount, renderId, hasVideo, hasAudio, }) => {
|
|
6
|
+
const videoChunks = hasVideo
|
|
7
|
+
? new Array(chunkCount).fill(true).map((_x, i) => (0, constants_1.chunkKeyForIndex)({
|
|
8
|
+
index: i,
|
|
9
|
+
renderId,
|
|
10
|
+
type: 'video',
|
|
11
|
+
}))
|
|
12
|
+
: [];
|
|
13
|
+
const audioChunks = hasAudio
|
|
14
|
+
? new Array(chunkCount).fill(true).map((_x, i) => (0, constants_1.chunkKeyForIndex)({
|
|
15
|
+
index: i,
|
|
16
|
+
renderId,
|
|
17
|
+
type: 'audio',
|
|
18
|
+
}))
|
|
19
|
+
: [];
|
|
20
|
+
const lambdaTimings = new Array(chunkCount)
|
|
21
|
+
.fill(true)
|
|
22
|
+
.map((_x, i) => (0, constants_1.lambdaTimingsPrefixForChunk)(renderId, i));
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
name: (0, constants_1.lambdaChunkInitializedPrefix)(renderId),
|
|
26
|
+
type: 'prefix',
|
|
27
|
+
},
|
|
28
|
+
...videoChunks.map((i) => {
|
|
29
|
+
return {
|
|
30
|
+
name: i,
|
|
31
|
+
type: 'exact',
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
...audioChunks.map((i) => {
|
|
35
|
+
return {
|
|
36
|
+
name: i,
|
|
37
|
+
type: 'exact',
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
...lambdaTimings.map((i) => {
|
|
41
|
+
return {
|
|
42
|
+
name: i,
|
|
43
|
+
type: 'prefix',
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
{
|
|
47
|
+
name: (0, constants_1.encodingProgressKey)(renderId),
|
|
48
|
+
type: 'exact',
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
};
|
|
52
|
+
exports.getFilesToDelete = getFilesToDelete;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EncodingProgress, RenderMetadata } from '../../shared/constants';
|
|
2
|
+
export declare const getFinalEncodingStatus: ({ encodingProgress, renderMetadata, outputFileExists, }: {
|
|
3
|
+
encodingProgress: EncodingProgress | null;
|
|
4
|
+
renderMetadata: RenderMetadata | null;
|
|
5
|
+
outputFileExists: boolean;
|
|
6
|
+
}) => EncodingProgress | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFinalEncodingStatus = void 0;
|
|
4
|
+
const getFinalEncodingStatus = ({ encodingProgress, renderMetadata, outputFileExists, }) => {
|
|
5
|
+
if (!renderMetadata) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
if (encodingProgress) {
|
|
9
|
+
return encodingProgress;
|
|
10
|
+
}
|
|
11
|
+
if (outputFileExists) {
|
|
12
|
+
return {
|
|
13
|
+
framesEncoded: renderMetadata.videoConfig.durationInFrames,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
};
|
|
18
|
+
exports.getFinalEncodingStatus = getFinalEncodingStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getFolderSizeRecursively(folder: string): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFolderSizeRecursively = void 0;
|
|
4
|
+
const get_files_in_folder_1 = require("./get-files-in-folder");
|
|
5
|
+
function getFolderSizeRecursively(folder) {
|
|
6
|
+
return (0, get_files_in_folder_1.getFolderFiles)(folder).reduce((a, b) => a + b.size, 0);
|
|
7
|
+
}
|
|
8
|
+
exports.getFolderSizeRecursively = getFolderSizeRecursively;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLambdasInvokedStats = void 0;
|
|
4
|
+
const constants_1 = require("../../shared/constants");
|
|
5
|
+
const parse_lambda_initialized_key_1 = require("../../shared/parse-lambda-initialized-key");
|
|
6
|
+
const getLambdasInvokedStats = ({ contents, renderId, }) => {
|
|
7
|
+
const lambdasInvoked = contents
|
|
8
|
+
.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaChunkInitializedPrefix)(renderId)); })
|
|
9
|
+
.filter((c) => (0, parse_lambda_initialized_key_1.parseLambdaInitializedKey)(c.Key).attempt === 1);
|
|
10
|
+
return {
|
|
11
|
+
lambdasInvoked: lambdasInvoked.length,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports.getLambdasInvokedStats = getLambdasInvokedStats;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
|
+
import type { PostRenderData } from '../../shared/constants';
|
|
3
|
+
export declare const getPostRenderData: ({ bucketName, renderId, region, expectedBucketOwner, }: {
|
|
4
|
+
bucketName: string;
|
|
5
|
+
renderId: string;
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
expectedBucketOwner: string;
|
|
8
|
+
}) => Promise<PostRenderData | null>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPostRenderData = void 0;
|
|
4
|
+
const constants_1 = require("../../shared/constants");
|
|
5
|
+
const stream_to_string_1 = require("../../shared/stream-to-string");
|
|
6
|
+
const io_1 = require("./io");
|
|
7
|
+
const getPostRenderData = async ({ bucketName, renderId, region, expectedBucketOwner, }) => {
|
|
8
|
+
try {
|
|
9
|
+
const data = await (0, io_1.lambdaReadFile)({
|
|
10
|
+
bucketName,
|
|
11
|
+
key: (0, constants_1.postRenderDataKey)(renderId),
|
|
12
|
+
region,
|
|
13
|
+
expectedBucketOwner,
|
|
14
|
+
});
|
|
15
|
+
return JSON.parse(await (0, stream_to_string_1.streamToString)(data));
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
// Does not exist
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.getPostRenderData = getPostRenderData;
|
|
@@ -118,7 +118,8 @@ const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region,
|
|
|
118
118
|
.map((_, i) => i)
|
|
119
119
|
.filter((index) => {
|
|
120
120
|
var _a;
|
|
121
|
-
return
|
|
121
|
+
return (typeof ((_a = overallProgress.chunks) !== null && _a !== void 0 ? _a : []).find((c) => c === index) !==
|
|
122
|
+
'undefined');
|
|
122
123
|
})
|
|
123
124
|
: null;
|
|
124
125
|
// We add a 20 second buffer for it, since AWS timeshifts can be quite a lot. Once it's 20sec over the limit, we consider it timed out
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
|
+
import type { RenderMetadata } from '../../shared/constants';
|
|
3
|
+
export declare const getRenderMetadata: ({ bucketName, renderId, region, expectedBucketOwner, }: {
|
|
4
|
+
bucketName: string;
|
|
5
|
+
renderId: string;
|
|
6
|
+
region: AwsRegion;
|
|
7
|
+
expectedBucketOwner: string;
|
|
8
|
+
}) => Promise<RenderMetadata>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRenderMetadata = void 0;
|
|
4
|
+
const constants_1 = require("../../shared/constants");
|
|
5
|
+
const stream_to_string_1 = require("../../shared/stream-to-string");
|
|
6
|
+
const io_1 = require("./io");
|
|
7
|
+
const getRenderMetadata = async ({ bucketName, renderId, region, expectedBucketOwner, }) => {
|
|
8
|
+
const Body = await (0, io_1.lambdaReadFile)({
|
|
9
|
+
bucketName,
|
|
10
|
+
key: (0, constants_1.renderMetadataKey)(renderId),
|
|
11
|
+
region,
|
|
12
|
+
expectedBucketOwner,
|
|
13
|
+
});
|
|
14
|
+
const renderMetadataResponse = JSON.parse(await (0, stream_to_string_1.streamToString)(Body));
|
|
15
|
+
return renderMetadataResponse;
|
|
16
|
+
};
|
|
17
|
+
exports.getRenderMetadata = getRenderMetadata;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
+
export declare const getRenderedFramesProgress: ({ contents, renderId, framesPerLambda, everyNthFrame, frameRange, }: {
|
|
3
|
+
contents: _Object[];
|
|
4
|
+
renderId: string;
|
|
5
|
+
framesPerLambda: number;
|
|
6
|
+
frameRange: [number, number];
|
|
7
|
+
everyNthFrame: number;
|
|
8
|
+
}) => number;
|