@remotion/lambda 4.0.189 → 4.0.192
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 +3 -3
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +1 -4
- 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-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 +6 -6
- 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/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/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
|
@@ -61,11 +61,11 @@ export declare const internalDeploySite: (args_0: MandatoryParameters & {
|
|
|
61
61
|
getValue: ({ commandLine }: {
|
|
62
62
|
commandLine: Record<string, unknown>;
|
|
63
63
|
}) => {
|
|
64
|
-
value: "
|
|
64
|
+
value: "error" | "verbose" | "info" | "warn";
|
|
65
65
|
source: string;
|
|
66
66
|
};
|
|
67
|
-
setConfig: (newLogLevel: "
|
|
68
|
-
type: "
|
|
67
|
+
setConfig: (newLogLevel: "error" | "verbose" | "info" | "warn") => void;
|
|
68
|
+
type: "error" | "verbose" | "info" | "warn";
|
|
69
69
|
};
|
|
70
70
|
readonly throwIfSiteExists: {
|
|
71
71
|
cliFlag: string;
|
|
@@ -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: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-1" | "us-east-
|
|
1
|
+
export declare const getCurrentRegionInFunctionImplementation: () => "us-east-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-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;
|
|
@@ -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;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRenderedFramesProgress = void 0;
|
|
4
|
+
const chunk_progress_1 = require("../../shared/chunk-progress");
|
|
5
|
+
const constants_1 = require("../../shared/constants");
|
|
6
|
+
const parse_chunk_key_1 = require("../../shared/parse-chunk-key");
|
|
7
|
+
const parse_lambda_initialized_key_1 = require("../../shared/parse-lambda-initialized-key");
|
|
8
|
+
const plan_frame_ranges_1 = require("../chunk-optimization/plan-frame-ranges");
|
|
9
|
+
const getRenderedFramesProgress = ({ contents, renderId, framesPerLambda, everyNthFrame, frameRange, }) => {
|
|
10
|
+
const chunkProgress = {};
|
|
11
|
+
const { chunks } = (0, plan_frame_ranges_1.planFrameRanges)({
|
|
12
|
+
everyNthFrame,
|
|
13
|
+
frameRange,
|
|
14
|
+
framesPerLambda,
|
|
15
|
+
});
|
|
16
|
+
// Sort, so only the latest attempt is used
|
|
17
|
+
const sortedChunks = contents
|
|
18
|
+
.filter((c) => {
|
|
19
|
+
return c.Key.startsWith((0, constants_1.lambdaChunkInitializedPrefix)(renderId));
|
|
20
|
+
})
|
|
21
|
+
.sort((a, b) => {
|
|
22
|
+
return a.Key.localeCompare(b.Key);
|
|
23
|
+
});
|
|
24
|
+
for (const chunk of sortedChunks) {
|
|
25
|
+
const key = (0, parse_lambda_initialized_key_1.parseLambdaInitializedKey)(chunk.Key);
|
|
26
|
+
chunkProgress[key.chunk] = (0, chunk_progress_1.getProgressOfChunk)(chunk.ETag);
|
|
27
|
+
}
|
|
28
|
+
for (const chunk of contents.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.chunkKey)(renderId)); })) {
|
|
29
|
+
const parsed = (0, parse_chunk_key_1.parseLambdaChunkKey)(chunk.Key);
|
|
30
|
+
const frameRangeInChunk = chunks[parsed.chunk];
|
|
31
|
+
chunkProgress[parsed.chunk] =
|
|
32
|
+
frameRangeInChunk[1] - frameRangeInChunk[0] + 1;
|
|
33
|
+
}
|
|
34
|
+
const framesRendered = Object.values(chunkProgress).reduce((a, b) => a + b, 0);
|
|
35
|
+
return framesRendered;
|
|
36
|
+
};
|
|
37
|
+
exports.getRenderedFramesProgress = getRenderedFramesProgress;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTimeToFinish = void 0;
|
|
4
|
+
const getTimeToFinish = ({ renderMetadata, lastModified, }) => {
|
|
5
|
+
if (!lastModified) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
if (!renderMetadata) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return Math.max(0, lastModified - renderMetadata.startedDate);
|
|
12
|
+
};
|
|
13
|
+
exports.getTimeToFinish = getTimeToFinish;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
|
-
import type { CustomCredentials } from '@remotion/serverless/client';
|
|
3
|
-
import type {
|
|
4
|
+
import type { AwsRegion, CustomCredentials, DownloadBehavior, Privacy } from '@remotion/serverless/client';
|
|
5
|
+
import type { ReadStream } from 'node:fs';
|
|
6
|
+
import type { Readable } from 'stream';
|
|
4
7
|
export type LambdaLSInput = {
|
|
5
8
|
bucketName: string;
|
|
6
9
|
prefix: string;
|
|
@@ -9,12 +12,39 @@ export type LambdaLSInput = {
|
|
|
9
12
|
continuationToken?: string;
|
|
10
13
|
};
|
|
11
14
|
export type LambdaLsReturnType = Promise<_Object[]>;
|
|
15
|
+
export declare const lambdaLs: ({ bucketName, prefix, region, expectedBucketOwner, continuationToken, }: LambdaLSInput) => LambdaLsReturnType;
|
|
16
|
+
export declare const lambdaDeleteFile: ({ bucketName, key, region, customCredentials, }: {
|
|
17
|
+
region: AwsRegion;
|
|
18
|
+
bucketName: string;
|
|
19
|
+
key: string;
|
|
20
|
+
customCredentials: CustomCredentials | null;
|
|
21
|
+
}) => Promise<void>;
|
|
22
|
+
type LambdaWriteFileInput = {
|
|
23
|
+
bucketName: string;
|
|
24
|
+
key: string;
|
|
25
|
+
body: ReadStream | string | Uint8Array;
|
|
26
|
+
region: AwsRegion;
|
|
27
|
+
privacy: Privacy;
|
|
28
|
+
expectedBucketOwner: string | null;
|
|
29
|
+
downloadBehavior: DownloadBehavior | null;
|
|
30
|
+
customCredentials: CustomCredentials | null;
|
|
31
|
+
};
|
|
32
|
+
export declare const lambdaWriteFile: (params: LambdaWriteFileInput & {
|
|
33
|
+
retries?: number;
|
|
34
|
+
}) => Promise<void>;
|
|
35
|
+
export declare const lambdaReadFile: ({ bucketName, key, region, expectedBucketOwner, }: {
|
|
36
|
+
bucketName: string;
|
|
37
|
+
key: string;
|
|
38
|
+
region: AwsRegion;
|
|
39
|
+
expectedBucketOwner: string;
|
|
40
|
+
}) => Promise<Readable>;
|
|
12
41
|
export declare const lambdaHeadCommand: ({ bucketName, key, region, customCredentials, }: {
|
|
13
42
|
bucketName: string;
|
|
14
43
|
key: string;
|
|
15
44
|
region: AwsRegion;
|
|
16
|
-
customCredentials: CustomCredentials
|
|
45
|
+
customCredentials: CustomCredentials | null;
|
|
17
46
|
}) => Promise<{
|
|
18
47
|
LastModified?: Date | undefined;
|
|
19
48
|
ContentLength?: number | undefined;
|
|
20
49
|
}>;
|
|
50
|
+
export {};
|