@remotion/lambda 4.0.202 → 4.0.205
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/admin/make-layer-public.js +19 -5
- package/dist/api/create-function.d.ts +3 -1
- package/dist/api/create-function.js +7 -5
- package/dist/api/deploy-function.d.ts +3 -1
- package/dist/api/deploy-function.js +6 -4
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/commands/functions/deploy.js +3 -1
- package/dist/functions/helpers/cleanup-props.d.ts +1 -4
- package/dist/functions/helpers/expected-out-name.d.ts +1 -1
- package/dist/functions/helpers/get-browser-instance.d.ts +3 -2
- package/dist/functions/helpers/get-browser-instance.js +3 -4
- package/dist/functions/helpers/get-custom-out-name.d.ts +1 -1
- package/dist/functions/helpers/io.d.ts +3 -33
- package/dist/functions/helpers/io.js +3 -104
- 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/write-lambda-error.d.ts +2 -3
- package/dist/functions/helpers/write-lambda-error.js +3 -2
- package/dist/functions/provider-implementation.d.ts +0 -0
- package/dist/functions/provider-implementation.js +1 -0
- package/dist/shared/compress-props.d.ts +8 -6
- package/dist/shared/compress-props.js +11 -14
- package/dist/shared/get-layers.d.ts +11 -0
- package/dist/shared/get-layers.js +38 -0
- package/dist/shared/hosted-layers.d.ts +5 -4
- package/dist/shared/hosted-layers.js +588 -84
- package/package.json +11 -11
- package/remotionlambda-arm64.zip +0 -0
- package/dist/functions/helpers/check-if-render-exists.d.ts +0 -3
- package/dist/functions/helpers/check-if-render-exists.js +0 -15
- package/dist/functions/helpers/delete-chunks.d.ts +0 -9
- package/dist/functions/helpers/delete-chunks.js +0 -25
- package/dist/functions/helpers/get-cleanup-progress.d.ts +0 -10
- package/dist/functions/helpers/get-cleanup-progress.js +0 -35
- package/dist/functions/helpers/get-encoding-metadata.d.ts +0 -7
- package/dist/functions/helpers/get-encoding-metadata.js +0 -15
- package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +0 -1
- package/dist/functions/helpers/get-encoding-progress-step-size.js +0 -7
- package/dist/functions/helpers/get-files-to-delete.d.ts +0 -10
- package/dist/functions/helpers/get-files-to-delete.js +0 -52
- package/dist/functions/helpers/get-final-encoding-status.d.ts +0 -6
- package/dist/functions/helpers/get-final-encoding-status.js +0 -18
- package/dist/functions/helpers/get-folder-size.d.ts +0 -1
- package/dist/functions/helpers/get-folder-size.js +0 -8
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +0 -8
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +0 -14
- package/dist/functions/helpers/get-post-render-data.d.ts +0 -8
- package/dist/functions/helpers/get-post-render-data.js +0 -22
- package/dist/functions/helpers/get-render-metadata.d.ts +0 -8
- package/dist/functions/helpers/get-render-metadata.js +0 -17
- package/dist/functions/helpers/get-rendered-frames-progress.d.ts +0 -8
- package/dist/functions/helpers/get-rendered-frames-progress.js +0 -37
- package/dist/functions/helpers/get-time-to-finish.d.ts +0 -5
- package/dist/functions/helpers/get-time-to-finish.js +0 -13
- package/dist/functions/helpers/streaming-payloads.d.ts +0 -19
- package/dist/functions/helpers/streaming-payloads.js +0 -25
- package/dist/functions/helpers/write-post-render-data.d.ts +0 -9
- package/dist/functions/helpers/write-post-render-data.js +0 -18
- package/dist/functions/merge.d.ts +0 -9
- package/dist/functions/merge.js +0 -61
- package/dist/shared/chunk-progress.d.ts +0 -9
- package/dist/shared/chunk-progress.js +0 -2034
- package/dist/shared/parse-chunk-key.d.ts +0 -5
- package/dist/shared/parse-chunk-key.js +0 -15
- package/dist/shared/parse-lambda-initialized-key.d.ts +0 -5
- package/dist/shared/parse-lambda-initialized-key.js +0 -15
- package/dist/shared/serialize-props.d.ts +0 -14
- package/dist/shared/serialize-props.js +0 -36
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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.205",
|
|
7
7
|
"description": "Render Remotion videos on AWS Lambda",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"@aws-sdk/s3-request-presigner": "3.583.0",
|
|
23
23
|
"mime-types": "2.1.34",
|
|
24
24
|
"zod": "3.22.3",
|
|
25
|
-
"@remotion/bundler": "4.0.
|
|
26
|
-
"@remotion/
|
|
27
|
-
"@remotion/
|
|
28
|
-
"@remotion/
|
|
29
|
-
"
|
|
30
|
-
"remotion": "4.0.
|
|
31
|
-
"@remotion/
|
|
25
|
+
"@remotion/bundler": "4.0.205",
|
|
26
|
+
"@remotion/studio-server": "4.0.205",
|
|
27
|
+
"@remotion/cli": "4.0.205",
|
|
28
|
+
"@remotion/serverless": "4.0.205",
|
|
29
|
+
"remotion": "4.0.205",
|
|
30
|
+
"@remotion/streaming": "4.0.205",
|
|
31
|
+
"@remotion/renderer": "4.0.205"
|
|
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.205",
|
|
41
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.205"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@remotion/bundler": "4.0.
|
|
44
|
+
"@remotion/bundler": "4.0.205"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
@@ -1,9 +0,0 @@
|
|
|
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>;
|
|
@@ -1,25 +0,0 @@
|
|
|
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,10 +0,0 @@
|
|
|
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;
|
|
@@ -1,35 +0,0 @@
|
|
|
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,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getEncodingProgressStepSize: (totalFrames: number) => number;
|
|
@@ -1,7 +0,0 @@
|
|
|
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;
|
|
@@ -1,10 +0,0 @@
|
|
|
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[];
|
|
@@ -1,52 +0,0 @@
|
|
|
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;
|
|
@@ -1,6 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getFolderSizeRecursively(folder: string): number;
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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>;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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>;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,8 +0,0 @@
|
|
|
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;
|
|
@@ -1,37 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { ResponseStream } from './streamify-response';
|
|
3
|
-
declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
4
|
-
type: z.ZodLiteral<"render-id-determined">;
|
|
5
|
-
renderId: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
type: "render-id-determined";
|
|
8
|
-
renderId: string;
|
|
9
|
-
}, {
|
|
10
|
-
type: "render-id-determined";
|
|
11
|
-
renderId: string;
|
|
12
|
-
}>]>;
|
|
13
|
-
export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
|
|
14
|
-
export declare const isStreamingPayload: (str: string) => false | {
|
|
15
|
-
type: "render-id-determined";
|
|
16
|
-
renderId: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
|
|
19
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendProgressEvent = exports.isStreamingPayload = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const streamingPayloadSchema = zod_1.z.discriminatedUnion('type', [
|
|
6
|
-
zod_1.z.object({
|
|
7
|
-
type: zod_1.z.literal('render-id-determined'),
|
|
8
|
-
renderId: zod_1.z.string(),
|
|
9
|
-
}),
|
|
10
|
-
]);
|
|
11
|
-
const isStreamingPayload = (str) => {
|
|
12
|
-
try {
|
|
13
|
-
const parsed = JSON.parse(str);
|
|
14
|
-
return streamingPayloadSchema.parse(parsed);
|
|
15
|
-
}
|
|
16
|
-
catch (_a) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.isStreamingPayload = isStreamingPayload;
|
|
21
|
-
const sendProgressEvent = (responseStream, payload) => {
|
|
22
|
-
const stringified = JSON.stringify(payload);
|
|
23
|
-
responseStream.write(stringified);
|
|
24
|
-
};
|
|
25
|
-
exports.sendProgressEvent = sendProgressEvent;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
|
-
import type { PostRenderData } from '../../shared/constants';
|
|
3
|
-
export declare const writePostRenderData: ({ bucketName, renderId, postRenderData, expectedBucketOwner, region, }: {
|
|
4
|
-
bucketName: string;
|
|
5
|
-
renderId: string;
|
|
6
|
-
postRenderData: PostRenderData;
|
|
7
|
-
expectedBucketOwner: string;
|
|
8
|
-
region: AwsRegion;
|
|
9
|
-
}) => Promise<void>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writePostRenderData = void 0;
|
|
4
|
-
const constants_1 = require("../../shared/constants");
|
|
5
|
-
const io_1 = require("./io");
|
|
6
|
-
const writePostRenderData = async ({ bucketName, renderId, postRenderData, expectedBucketOwner, region, }) => {
|
|
7
|
-
await (0, io_1.lambdaWriteFile)({
|
|
8
|
-
bucketName,
|
|
9
|
-
key: (0, constants_1.postRenderDataKey)(renderId),
|
|
10
|
-
privacy: 'private',
|
|
11
|
-
body: JSON.stringify(postRenderData),
|
|
12
|
-
expectedBucketOwner,
|
|
13
|
-
region,
|
|
14
|
-
downloadBehavior: null,
|
|
15
|
-
customCredentials: null,
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
exports.writePostRenderData = writePostRenderData;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LambdaPayload, PostRenderData } from '../defaults';
|
|
2
|
-
type Options = {
|
|
3
|
-
expectedBucketOwner: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const mergeHandler: (params: LambdaPayload, options: Options) => Promise<{
|
|
6
|
-
type: 'success';
|
|
7
|
-
postRenderData: PostRenderData;
|
|
8
|
-
}>;
|
|
9
|
-
export {};
|
package/dist/functions/merge.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeHandler = void 0;
|
|
4
|
-
const renderer_1 = require("@remotion/renderer");
|
|
5
|
-
const defaults_1 = require("../defaults");
|
|
6
|
-
const expected_out_name_1 = require("./helpers/expected-out-name");
|
|
7
|
-
const get_current_region_1 = require("./helpers/get-current-region");
|
|
8
|
-
const get_render_metadata_1 = require("./helpers/get-render-metadata");
|
|
9
|
-
const merge_chunks_1 = require("./helpers/merge-chunks");
|
|
10
|
-
const mergeHandler = async (params, options) => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
if (params.type !== defaults_1.LambdaRoutines.merge) {
|
|
13
|
-
throw new Error('Expected launch type');
|
|
14
|
-
}
|
|
15
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'This function has been started because the previous main function has timed out while merging together the chunks.');
|
|
16
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'The merging of chunks will now restart.');
|
|
17
|
-
const renderMetadata = await (0, get_render_metadata_1.getRenderMetadata)({
|
|
18
|
-
bucketName: params.bucketName,
|
|
19
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
20
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
21
|
-
renderId: params.renderId,
|
|
22
|
-
});
|
|
23
|
-
if (!renderMetadata.codec) {
|
|
24
|
-
throw new Error('expected codec');
|
|
25
|
-
}
|
|
26
|
-
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
27
|
-
? null
|
|
28
|
-
: (_b = (_a = params.outName) === null || _a === void 0 ? void 0 : _a.s3OutputProvider) !== null && _b !== void 0 ? _b : null);
|
|
29
|
-
const frameCount = renderer_1.RenderInternals.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame);
|
|
30
|
-
const fps = renderMetadata.videoConfig.fps / renderMetadata.everyNthFrame;
|
|
31
|
-
const postRenderData = await (0, merge_chunks_1.mergeChunksAndFinishRender)({
|
|
32
|
-
audioCodec: renderMetadata.audioCodec,
|
|
33
|
-
bucketName: params.bucketName,
|
|
34
|
-
chunkCount: renderMetadata.totalChunks,
|
|
35
|
-
codec: renderMetadata.codec,
|
|
36
|
-
customCredentials,
|
|
37
|
-
downloadBehavior: renderMetadata.downloadBehavior,
|
|
38
|
-
expectedBucketOwner: options.expectedBucketOwner,
|
|
39
|
-
fps,
|
|
40
|
-
numberOfFrames: frameCount.length,
|
|
41
|
-
inputProps: params.inputProps,
|
|
42
|
-
key,
|
|
43
|
-
numberOfGifLoops: renderMetadata.numberOfGifLoops,
|
|
44
|
-
privacy: renderMetadata.privacy,
|
|
45
|
-
renderBucketName,
|
|
46
|
-
renderId: params.renderId,
|
|
47
|
-
renderMetadata,
|
|
48
|
-
serializedResolvedProps: params.serializedResolvedProps,
|
|
49
|
-
onAllChunks: () => {
|
|
50
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel: params.logLevel }, 'All chunks have been downloaded now.');
|
|
51
|
-
},
|
|
52
|
-
audioBitrate: renderMetadata.audioBitrate,
|
|
53
|
-
logLevel: params.logLevel,
|
|
54
|
-
framesPerLambda: params.framesPerLambda,
|
|
55
|
-
binariesDirectory: null,
|
|
56
|
-
preferLossless: params.preferLossless,
|
|
57
|
-
compositionStart: params.compositionStart,
|
|
58
|
-
});
|
|
59
|
-
return { type: 'success', postRenderData };
|
|
60
|
-
};
|
|
61
|
-
exports.mergeHandler = mergeHandler;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const writeLambdaInitializedFile: ({ bucketName, expectedBucketOwner, attempt, chunk, renderId, framesRendered, }: {
|
|
2
|
-
bucketName: string;
|
|
3
|
-
expectedBucketOwner: string;
|
|
4
|
-
renderId: string;
|
|
5
|
-
chunk: number;
|
|
6
|
-
attempt: number;
|
|
7
|
-
framesRendered: number;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
export declare const getProgressOfChunk: (etag: string) => number;
|