@remotion/serverless-client 4.0.261
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/.turbo/turbo-make.log +6 -0
- package/LICENSE.md +49 -0
- package/README.md +5 -0
- package/bundle.ts +15 -0
- package/dist/await.d.ts +1 -0
- package/dist/await.js +2 -0
- package/dist/calculate-chunk-times.d.ts +5 -0
- package/dist/calculate-chunk-times.js +29 -0
- package/dist/compress-props.d.ts +30 -0
- package/dist/compress-props.js +97 -0
- package/dist/constants.d.ts +314 -0
- package/dist/constants.js +64 -0
- package/dist/docs-url.d.ts +1 -0
- package/dist/docs-url.js +4 -0
- package/dist/error-category.d.ts +3 -0
- package/dist/error-category.js +16 -0
- package/dist/esm/index.mjs +3467 -0
- package/dist/estimate-price-from-bucket.d.ts +15 -0
- package/dist/estimate-price-from-bucket.js +31 -0
- package/dist/expected-out-name.d.ts +10 -0
- package/dist/expected-out-name.js +53 -0
- package/dist/format-costs-info.d.ts +2 -0
- package/dist/format-costs-info.js +23 -0
- package/dist/get-custom-out-name.d.ts +7 -0
- package/dist/get-custom-out-name.js +33 -0
- package/dist/get-files-in-folder.d.ts +5 -0
- package/dist/get-files-in-folder.js +2 -0
- package/dist/get-or-create-bucket.d.ts +23 -0
- package/dist/get-or-create-bucket.js +44 -0
- package/dist/get-overall-progress-from-storage.d.ts +11 -0
- package/dist/get-overall-progress-from-storage.js +25 -0
- package/dist/get-overall-progress.d.ts +9 -0
- package/dist/get-overall-progress.js +23 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +105 -0
- package/dist/input-props-keys.d.ts +2 -0
- package/dist/input-props-keys.js +11 -0
- package/dist/inspect-error.d.ts +4 -0
- package/dist/inspect-error.js +39 -0
- package/dist/make-bucket-name.d.ts +3 -0
- package/dist/make-bucket-name.js +7 -0
- package/dist/make-timeout-error.d.ts +13 -0
- package/dist/make-timeout-error.js +32 -0
- package/dist/make-timeout-message.d.ts +12 -0
- package/dist/make-timeout-message.js +76 -0
- package/dist/min-max.d.ts +2 -0
- package/dist/min-max.js +33 -0
- package/dist/most-expensive-chunks.d.ts +13 -0
- package/dist/most-expensive-chunks.js +28 -0
- package/dist/overall-render-progress.d.ts +24 -0
- package/dist/overall-render-progress.js +2 -0
- package/dist/progress.d.ts +16 -0
- package/dist/progress.js +258 -0
- package/dist/provider-implementation.d.ts +193 -0
- package/dist/provider-implementation.js +2 -0
- package/dist/render-has-audio-video.d.ts +6 -0
- package/dist/render-has-audio-video.js +21 -0
- package/dist/render-metadata.d.ts +45 -0
- package/dist/render-metadata.js +2 -0
- package/dist/render-progress.d.ts +51 -0
- package/dist/render-progress.js +2 -0
- package/dist/return-values.d.ts +38 -0
- package/dist/return-values.js +2 -0
- package/dist/serialize-artifact.d.ts +9 -0
- package/dist/serialize-artifact.js +37 -0
- package/dist/stream-to-string.d.ts +2 -0
- package/dist/stream-to-string.js +14 -0
- package/dist/streaming/streaming.d.ts +101 -0
- package/dist/streaming/streaming.js +61 -0
- package/dist/test/dont-contain-forbidden.test.d.ts +1 -0
- package/dist/test/dont-contain-forbidden.test.js +18 -0
- package/dist/test/expected-out-name.test.d.ts +1 -0
- package/dist/test/expected-out-name.test.js +167 -0
- package/dist/test/min-max.test.d.ts +1 -0
- package/dist/test/min-max.test.js +24 -0
- package/dist/test/most-expensive-chunks.test.d.ts +1 -0
- package/dist/test/most-expensive-chunks.test.js +163 -0
- package/dist/truthy.d.ts +3 -0
- package/dist/truthy.js +6 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +2 -0
- package/dist/validate-bucket-name.d.ts +7 -0
- package/dist/validate-bucket-name.js +16 -0
- package/dist/validate-download-behavior.d.ts +1 -0
- package/dist/validate-download-behavior.js +21 -0
- package/dist/validate-frames-per-function.d.ts +4 -0
- package/dist/validate-frames-per-function.js +29 -0
- package/dist/validate-outname.d.ts +9 -0
- package/dist/validate-outname.js +43 -0
- package/dist/validate-privacy.d.ts +2 -0
- package/dist/validate-privacy.js +14 -0
- package/dist/validate-webhook.d.ts +3 -0
- package/dist/validate-webhook.js +16 -0
- package/dist/webhook-types.d.ts +29 -0
- package/dist/webhook-types.js +2 -0
- package/dist/write-error-to-storage.d.ts +24 -0
- package/dist/write-error-to-storage.js +2 -0
- package/eslint.config.mjs +5 -0
- package/package.json +41 -0
- package/src/await.ts +1 -0
- package/src/calculate-chunk-times.ts +42 -0
- package/src/compress-props.ts +171 -0
- package/src/constants.ts +403 -0
- package/src/docs-url.ts +1 -0
- package/src/error-category.ts +14 -0
- package/src/estimate-price-from-bucket.ts +59 -0
- package/src/expected-out-name.ts +83 -0
- package/src/format-costs-info.ts +24 -0
- package/src/get-custom-out-name.ts +44 -0
- package/src/get-files-in-folder.ts +6 -0
- package/src/get-or-create-bucket.ts +79 -0
- package/src/get-overall-progress-from-storage.ts +44 -0
- package/src/get-overall-progress.ts +42 -0
- package/src/index.ts +125 -0
- package/src/input-props-keys.ts +7 -0
- package/src/inspect-error.ts +60 -0
- package/src/make-bucket-name.ts +9 -0
- package/src/make-timeout-error.ts +51 -0
- package/src/make-timeout-message.ts +118 -0
- package/src/min-max.ts +34 -0
- package/src/most-expensive-chunks.ts +46 -0
- package/src/overall-render-progress.ts +30 -0
- package/src/progress.ts +327 -0
- package/src/provider-implementation.ts +261 -0
- package/src/render-has-audio-video.ts +28 -0
- package/src/render-metadata.ts +60 -0
- package/src/render-progress.ts +58 -0
- package/src/return-values.ts +45 -0
- package/src/serialize-artifact.ts +51 -0
- package/src/stream-to-string.ts +14 -0
- package/src/streaming/streaming.ts +148 -0
- package/src/test/dont-contain-forbidden.test.ts +14 -0
- package/src/test/expected-out-name.test.ts +197 -0
- package/src/test/min-max.test.ts +25 -0
- package/src/test/most-expensive-chunks.test.ts +167 -0
- package/src/truthy.ts +5 -0
- package/src/types.ts +77 -0
- package/src/validate-bucket-name.ts +34 -0
- package/src/validate-download-behavior.ts +26 -0
- package/src/validate-frames-per-function.ts +54 -0
- package/src/validate-outname.ts +63 -0
- package/src/validate-privacy.ts +20 -0
- package/src/validate-webhook.ts +18 -0
- package/src/webhook-types.ts +36 -0
- package/src/write-error-to-storage.ts +23 -0
- package/tsconfig.json +18 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RenderMetadata } from './render-metadata';
|
|
2
|
+
import type { CloudProvider } from './types';
|
|
3
|
+
export declare const lambdaRenderHasAudioVideo: <Provider extends CloudProvider>(renderMetadata: RenderMetadata<Provider>) => {
|
|
4
|
+
hasAudio: boolean;
|
|
5
|
+
hasVideo: boolean;
|
|
6
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lambdaRenderHasAudioVideo = void 0;
|
|
4
|
+
const pure_1 = require("@remotion/renderer/pure");
|
|
5
|
+
const lambdaRenderHasAudioVideo = (renderMetadata) => {
|
|
6
|
+
if (renderMetadata.type === 'still') {
|
|
7
|
+
throw new Error('Cannot merge stills');
|
|
8
|
+
}
|
|
9
|
+
const support = pure_1.NoReactAPIs.codecSupportsMedia(renderMetadata.codec);
|
|
10
|
+
const hasVideo = renderMetadata
|
|
11
|
+
? !pure_1.NoReactAPIs.isAudioCodec(renderMetadata.codec)
|
|
12
|
+
: false;
|
|
13
|
+
const hasAudio = renderMetadata
|
|
14
|
+
? !renderMetadata.muted && support.audio
|
|
15
|
+
: false;
|
|
16
|
+
return {
|
|
17
|
+
hasAudio,
|
|
18
|
+
hasVideo,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.lambdaRenderHasAudioVideo = lambdaRenderHasAudioVideo;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AudioCodec, DeleteAfter, StillImageFormat, VideoImageFormat } from '@remotion/renderer';
|
|
2
|
+
import type { DownloadBehavior, OutNameInputWithoutCredentials, Privacy, SerializedInputProps, ServerlessCodec } from './constants';
|
|
3
|
+
import type { CloudProvider } from './types';
|
|
4
|
+
type Discriminated = {
|
|
5
|
+
type: 'still';
|
|
6
|
+
imageFormat: StillImageFormat;
|
|
7
|
+
codec: null;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'video';
|
|
10
|
+
imageFormat: VideoImageFormat;
|
|
11
|
+
muted: boolean;
|
|
12
|
+
frameRange: [number, number];
|
|
13
|
+
everyNthFrame: number;
|
|
14
|
+
codec: ServerlessCodec;
|
|
15
|
+
};
|
|
16
|
+
type Dimensions = {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
export type RenderMetadata<Provider extends CloudProvider> = Discriminated & {
|
|
21
|
+
siteId: string;
|
|
22
|
+
startedDate: number;
|
|
23
|
+
totalChunks: number;
|
|
24
|
+
estimatedTotalLambdaInvokations: number;
|
|
25
|
+
estimatedRenderLambdaInvokations: number;
|
|
26
|
+
compositionId: string;
|
|
27
|
+
audioCodec: AudioCodec | null;
|
|
28
|
+
inputProps: SerializedInputProps;
|
|
29
|
+
framesPerLambda: number;
|
|
30
|
+
memorySizeInMb: number;
|
|
31
|
+
functionName: string;
|
|
32
|
+
rendererFunctionName: string;
|
|
33
|
+
lambdaVersion: string;
|
|
34
|
+
region: Provider['region'];
|
|
35
|
+
renderId: string;
|
|
36
|
+
outName: OutNameInputWithoutCredentials | undefined;
|
|
37
|
+
privacy: Privacy;
|
|
38
|
+
deleteAfter: DeleteAfter | null;
|
|
39
|
+
numberOfGifLoops: number | null;
|
|
40
|
+
audioBitrate: string | null;
|
|
41
|
+
downloadBehavior: DownloadBehavior;
|
|
42
|
+
metadata: Record<string, string> | null;
|
|
43
|
+
dimensions: Dimensions;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ExpensiveChunk } from './most-expensive-chunks';
|
|
2
|
+
import type { RenderMetadata } from './render-metadata';
|
|
3
|
+
import type { ChunkRetry, CloudProvider, CostsInfo, ReceivedArtifact } from './types';
|
|
4
|
+
import type { EnhancedErrorInfo } from './write-error-to-storage';
|
|
5
|
+
export type CleanupInfo = {
|
|
6
|
+
doneIn: number | null;
|
|
7
|
+
minFilesToDelete: number;
|
|
8
|
+
filesDeleted: number;
|
|
9
|
+
};
|
|
10
|
+
type EncodingProgress = {
|
|
11
|
+
framesEncoded: number;
|
|
12
|
+
combinedFrames: number;
|
|
13
|
+
timeToCombine: number | null;
|
|
14
|
+
};
|
|
15
|
+
export type GenericRenderProgress<Provider extends CloudProvider> = {
|
|
16
|
+
chunks: number;
|
|
17
|
+
done: boolean;
|
|
18
|
+
encodingStatus: EncodingProgress | null;
|
|
19
|
+
costs: CostsInfo;
|
|
20
|
+
renderId: string;
|
|
21
|
+
renderMetadata: RenderMetadata<Provider> | null;
|
|
22
|
+
bucket: string;
|
|
23
|
+
outputFile: string | null;
|
|
24
|
+
outKey: string | null;
|
|
25
|
+
outBucket: string | null;
|
|
26
|
+
timeToFinish: number | null;
|
|
27
|
+
errors: EnhancedErrorInfo[];
|
|
28
|
+
fatalErrorEncountered: boolean;
|
|
29
|
+
currentTime: number;
|
|
30
|
+
renderSize: number;
|
|
31
|
+
lambdasInvoked: number;
|
|
32
|
+
cleanup: CleanupInfo | null;
|
|
33
|
+
timeToFinishChunks: number | null;
|
|
34
|
+
timeToRenderFrames: number | null;
|
|
35
|
+
timeToEncode: number | null;
|
|
36
|
+
overallProgress: number;
|
|
37
|
+
retriesInfo: ChunkRetry[];
|
|
38
|
+
mostExpensiveFrameRanges: ExpensiveChunk[] | null;
|
|
39
|
+
framesRendered: number;
|
|
40
|
+
outputSizeInBytes: number | null;
|
|
41
|
+
type: 'success';
|
|
42
|
+
estimatedBillingDurationInMilliseconds: number | null;
|
|
43
|
+
combinedFrames: number;
|
|
44
|
+
timeToCombine: number | null;
|
|
45
|
+
timeoutTimestamp: number;
|
|
46
|
+
functionLaunched: number;
|
|
47
|
+
serveUrlOpened: number | null;
|
|
48
|
+
compositionValidated: number | null;
|
|
49
|
+
artifacts: ReceivedArtifact<Provider>[];
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { VideoConfig } from 'remotion/no-react';
|
|
2
|
+
import type { ServerlessRoutines } from './constants';
|
|
3
|
+
import type { GenericRenderProgress } from './render-progress';
|
|
4
|
+
import type { CloudProvider } from './types';
|
|
5
|
+
export type OrError<T> = T | {
|
|
6
|
+
type: 'error';
|
|
7
|
+
message: string;
|
|
8
|
+
stack: string;
|
|
9
|
+
};
|
|
10
|
+
export interface ServerlessReturnValues<Provider extends CloudProvider> {
|
|
11
|
+
[ServerlessRoutines.start]: Promise<{
|
|
12
|
+
type: 'success';
|
|
13
|
+
bucketName: string;
|
|
14
|
+
renderId: string;
|
|
15
|
+
}>;
|
|
16
|
+
[ServerlessRoutines.launch]: Promise<{
|
|
17
|
+
type: 'success';
|
|
18
|
+
}>;
|
|
19
|
+
[ServerlessRoutines.renderer]: Promise<{
|
|
20
|
+
type: 'success';
|
|
21
|
+
}>;
|
|
22
|
+
[ServerlessRoutines.status]: Promise<GenericRenderProgress<Provider>>;
|
|
23
|
+
[ServerlessRoutines.info]: {
|
|
24
|
+
version: string;
|
|
25
|
+
type: 'success';
|
|
26
|
+
};
|
|
27
|
+
[ServerlessRoutines.still]: Promise<{
|
|
28
|
+
type: 'success';
|
|
29
|
+
} | {
|
|
30
|
+
type: 'error';
|
|
31
|
+
message: string;
|
|
32
|
+
stack: string;
|
|
33
|
+
}>;
|
|
34
|
+
[ServerlessRoutines.compositions]: Promise<{
|
|
35
|
+
compositions: VideoConfig[];
|
|
36
|
+
type: 'success';
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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;
|
|
@@ -0,0 +1,37 @@
|
|
|
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;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamToString = streamToString;
|
|
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
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { SerializedArtifact } from '../serialize-artifact';
|
|
2
|
+
import type { CloudProvider, RenderStillFunctionResponsePayload } from '../types';
|
|
3
|
+
import type { FunctionErrorInfo } from '../write-error-to-storage';
|
|
4
|
+
declare const framesRendered: "frames-rendered";
|
|
5
|
+
declare const errorOccurred: "error-occurred";
|
|
6
|
+
declare const renderIdDetermined: "render-id-determined";
|
|
7
|
+
declare const videoChunkRendered: "video-chunk-rendered";
|
|
8
|
+
declare const audioChunkRendered: "audio-chunk-rendered";
|
|
9
|
+
declare const chunkComplete: "chunk-complete";
|
|
10
|
+
declare const stillRendered: "still-rendered";
|
|
11
|
+
declare const functionInvoked: "lambda-invoked";
|
|
12
|
+
declare const artifactEmitted: "artifact-emitted";
|
|
13
|
+
declare const messageTypes: {
|
|
14
|
+
readonly '1': {
|
|
15
|
+
readonly type: "frames-rendered";
|
|
16
|
+
};
|
|
17
|
+
readonly '2': {
|
|
18
|
+
readonly type: "error-occurred";
|
|
19
|
+
};
|
|
20
|
+
readonly '3': {
|
|
21
|
+
readonly type: "render-id-determined";
|
|
22
|
+
};
|
|
23
|
+
readonly '4': {
|
|
24
|
+
readonly type: "video-chunk-rendered";
|
|
25
|
+
};
|
|
26
|
+
readonly '5': {
|
|
27
|
+
readonly type: "audio-chunk-rendered";
|
|
28
|
+
};
|
|
29
|
+
readonly '6': {
|
|
30
|
+
readonly type: "still-rendered";
|
|
31
|
+
};
|
|
32
|
+
readonly '7': {
|
|
33
|
+
readonly type: "chunk-complete";
|
|
34
|
+
};
|
|
35
|
+
readonly '8': {
|
|
36
|
+
readonly type: "lambda-invoked";
|
|
37
|
+
};
|
|
38
|
+
readonly '9': {
|
|
39
|
+
readonly type: "artifact-emitted";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type MessageTypeId = keyof typeof messageTypes;
|
|
43
|
+
type MessageType = (typeof messageTypes)[MessageTypeId]['type'];
|
|
44
|
+
export declare const formatMap: {
|
|
45
|
+
[key in MessageType]: 'json' | 'binary';
|
|
46
|
+
};
|
|
47
|
+
export type StreamingPayload<Provider extends CloudProvider> = {
|
|
48
|
+
type: typeof framesRendered;
|
|
49
|
+
payload: {
|
|
50
|
+
rendered: number;
|
|
51
|
+
encoded: number;
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: typeof videoChunkRendered;
|
|
55
|
+
payload: Buffer;
|
|
56
|
+
} | {
|
|
57
|
+
type: typeof audioChunkRendered;
|
|
58
|
+
payload: Buffer;
|
|
59
|
+
} | {
|
|
60
|
+
type: typeof errorOccurred;
|
|
61
|
+
payload: {
|
|
62
|
+
error: string;
|
|
63
|
+
shouldRetry: boolean;
|
|
64
|
+
errorInfo: FunctionErrorInfo;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
type: typeof renderIdDetermined;
|
|
68
|
+
payload: {
|
|
69
|
+
renderId: string;
|
|
70
|
+
};
|
|
71
|
+
} | {
|
|
72
|
+
type: typeof stillRendered;
|
|
73
|
+
payload: RenderStillFunctionResponsePayload<Provider>;
|
|
74
|
+
} | {
|
|
75
|
+
type: typeof chunkComplete;
|
|
76
|
+
payload: {
|
|
77
|
+
start: number;
|
|
78
|
+
rendered: number;
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
type: typeof functionInvoked;
|
|
82
|
+
payload: {
|
|
83
|
+
attempt: number;
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
type: typeof artifactEmitted;
|
|
87
|
+
payload: {
|
|
88
|
+
artifact: SerializedArtifact;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export declare const messageTypeIdToMessageType: (messageTypeId: MessageTypeId) => MessageType;
|
|
92
|
+
export type StreamingMessage<Provider extends CloudProvider> = {
|
|
93
|
+
successType: 'error' | 'success';
|
|
94
|
+
message: StreamingPayload<Provider>;
|
|
95
|
+
};
|
|
96
|
+
export type OnMessage<Provider extends CloudProvider> = (options: StreamingMessage<Provider>) => void;
|
|
97
|
+
export type OnStream<Provider extends CloudProvider> = (payload: StreamingPayload<Provider>) => Promise<void>;
|
|
98
|
+
export declare const makeStreamPayload: <Provider extends CloudProvider>({ message, }: {
|
|
99
|
+
message: StreamingPayload<Provider>;
|
|
100
|
+
}) => Uint8Array;
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
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 functionInvoked = '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: functionInvoked },
|
|
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
|
+
[functionInvoked]: '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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
const bun_test_1 = require("bun:test");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
(0, bun_test_1.test)('Should not contain forbidden imports', async () => {
|
|
9
|
+
const output = await Bun.build({
|
|
10
|
+
external: ['@remotion/renderer', 'react/jsx-runtime'],
|
|
11
|
+
entrypoints: [path_1.default.join(__filename, '..', '..', 'index.ts')],
|
|
12
|
+
});
|
|
13
|
+
(0, bun_test_1.expect)(output.outputs.length).toBe(1);
|
|
14
|
+
const text = await output.outputs[0].text();
|
|
15
|
+
(0, bun_test_1.expect)(text).not.toContain('jsx-runtime');
|
|
16
|
+
(0, bun_test_1.expect)(text).not.toContain('"@remotion/renderer"');
|
|
17
|
+
(0, bun_test_1.expect)(text).not.toContain("'@remotion/renderer'");
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const expected_out_name_1 = require("../expected-out-name");
|
|
5
|
+
const bucketName = 'remotionlambda-98fsduf';
|
|
6
|
+
const testRenderMetadata = {
|
|
7
|
+
compositionId: 'react-svg',
|
|
8
|
+
estimatedRenderLambdaInvokations: 100,
|
|
9
|
+
estimatedTotalLambdaInvokations: 100,
|
|
10
|
+
framesPerLambda: 20,
|
|
11
|
+
imageFormat: 'png',
|
|
12
|
+
type: 'video',
|
|
13
|
+
inputProps: {
|
|
14
|
+
type: 'payload',
|
|
15
|
+
payload: '{}',
|
|
16
|
+
},
|
|
17
|
+
lambdaVersion: '2022-02-14',
|
|
18
|
+
memorySizeInMb: 2048,
|
|
19
|
+
functionName: 'remotion-render-4-0-187-mem3000mb-disk10000mb-120sec',
|
|
20
|
+
rendererFunctionName: 'remotion-render-4-0-187-mem3000mb-disk10000mb-120sec',
|
|
21
|
+
outName: undefined,
|
|
22
|
+
region: 'eu-central',
|
|
23
|
+
renderId: '9n8dsfafs',
|
|
24
|
+
siteId: 'my-site',
|
|
25
|
+
startedDate: Date.now(),
|
|
26
|
+
totalChunks: 20,
|
|
27
|
+
privacy: 'public',
|
|
28
|
+
everyNthFrame: 1,
|
|
29
|
+
frameRange: [0, 199],
|
|
30
|
+
audioCodec: null,
|
|
31
|
+
deleteAfter: null,
|
|
32
|
+
numberOfGifLoops: null,
|
|
33
|
+
downloadBehavior: { type: 'play-in-browser' },
|
|
34
|
+
audioBitrate: null,
|
|
35
|
+
muted: false,
|
|
36
|
+
metadata: null,
|
|
37
|
+
codec: 'h264',
|
|
38
|
+
dimensions: {
|
|
39
|
+
width: 1920,
|
|
40
|
+
height: 1080,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
(0, bun_test_1.test)('Should get a custom outname', () => {
|
|
44
|
+
(0, bun_test_1.expect)((0, expected_out_name_1.getExpectedOutName)({
|
|
45
|
+
renderMetadata: testRenderMetadata,
|
|
46
|
+
bucketName,
|
|
47
|
+
customCredentials: null,
|
|
48
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
49
|
+
})).toEqual({
|
|
50
|
+
customCredentials: null,
|
|
51
|
+
renderBucketName: 'remotionlambda-98fsduf',
|
|
52
|
+
key: 'renders/9n8dsfafs/out.mp4',
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
(0, bun_test_1.test)('Should save to a different outname', () => {
|
|
56
|
+
const newRenderMetadata = {
|
|
57
|
+
...testRenderMetadata,
|
|
58
|
+
outName: {
|
|
59
|
+
bucketName: 'my-bucket',
|
|
60
|
+
key: 'my-key',
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
(0, bun_test_1.expect)((0, expected_out_name_1.getExpectedOutName)({
|
|
64
|
+
renderMetadata: newRenderMetadata,
|
|
65
|
+
bucketName,
|
|
66
|
+
customCredentials: null,
|
|
67
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
68
|
+
})).toEqual({
|
|
69
|
+
customCredentials: null,
|
|
70
|
+
renderBucketName: 'my-bucket',
|
|
71
|
+
key: 'my-key',
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
(0, bun_test_1.test)('For stills', () => {
|
|
75
|
+
const newRenderMetadata = {
|
|
76
|
+
...testRenderMetadata,
|
|
77
|
+
codec: null,
|
|
78
|
+
type: 'still',
|
|
79
|
+
imageFormat: 'png',
|
|
80
|
+
};
|
|
81
|
+
(0, bun_test_1.expect)((0, expected_out_name_1.getExpectedOutName)({
|
|
82
|
+
renderMetadata: newRenderMetadata,
|
|
83
|
+
bucketName,
|
|
84
|
+
customCredentials: null,
|
|
85
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
86
|
+
})).toEqual({
|
|
87
|
+
customCredentials: null,
|
|
88
|
+
renderBucketName: 'remotionlambda-98fsduf',
|
|
89
|
+
key: 'renders/9n8dsfafs/out.png',
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
(0, bun_test_1.test)('Just a custom name', () => {
|
|
93
|
+
const newRenderMetadata = {
|
|
94
|
+
...testRenderMetadata,
|
|
95
|
+
type: 'still',
|
|
96
|
+
imageFormat: 'jpeg',
|
|
97
|
+
codec: null,
|
|
98
|
+
outName: 'justaname.jpeg',
|
|
99
|
+
};
|
|
100
|
+
(0, bun_test_1.expect)((0, expected_out_name_1.getExpectedOutName)({
|
|
101
|
+
renderMetadata: newRenderMetadata,
|
|
102
|
+
bucketName,
|
|
103
|
+
customCredentials: null,
|
|
104
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
105
|
+
})).toEqual({
|
|
106
|
+
customCredentials: null,
|
|
107
|
+
renderBucketName: 'remotionlambda-98fsduf',
|
|
108
|
+
key: 'renders/9n8dsfafs/justaname.jpeg',
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
(0, bun_test_1.test)('Should throw on invalid names', () => {
|
|
112
|
+
const newRenderMetadata = {
|
|
113
|
+
...testRenderMetadata,
|
|
114
|
+
type: 'still',
|
|
115
|
+
imageFormat: 'png',
|
|
116
|
+
codec: null,
|
|
117
|
+
outName: '👺.jpeg',
|
|
118
|
+
};
|
|
119
|
+
(0, bun_test_1.expect)(() => {
|
|
120
|
+
(0, expected_out_name_1.getExpectedOutName)({
|
|
121
|
+
renderMetadata: newRenderMetadata,
|
|
122
|
+
bucketName,
|
|
123
|
+
customCredentials: null,
|
|
124
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
125
|
+
});
|
|
126
|
+
}).toThrow(/The S3 Key must match the RegExp/);
|
|
127
|
+
});
|
|
128
|
+
(0, bun_test_1.test)('Should allow outName an outname with a slash', () => {
|
|
129
|
+
const newRenderMetadata = {
|
|
130
|
+
...testRenderMetadata,
|
|
131
|
+
codec: null,
|
|
132
|
+
audioCodec: null,
|
|
133
|
+
type: 'still',
|
|
134
|
+
imageFormat: 'jpeg',
|
|
135
|
+
outName: 'justa/name.jpeg',
|
|
136
|
+
};
|
|
137
|
+
(0, bun_test_1.expect)((0, expected_out_name_1.getExpectedOutName)({
|
|
138
|
+
renderMetadata: newRenderMetadata,
|
|
139
|
+
bucketName,
|
|
140
|
+
customCredentials: null,
|
|
141
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
142
|
+
})).toEqual({
|
|
143
|
+
customCredentials: null,
|
|
144
|
+
key: 'renders/9n8dsfafs/justa/name.jpeg',
|
|
145
|
+
renderBucketName: 'remotionlambda-98fsduf',
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
(0, bun_test_1.test)('Should allow outName an outname with colon', () => {
|
|
149
|
+
const newRenderMetadata = {
|
|
150
|
+
...testRenderMetadata,
|
|
151
|
+
codec: null,
|
|
152
|
+
audioCodec: null,
|
|
153
|
+
type: 'still',
|
|
154
|
+
imageFormat: 'jpeg',
|
|
155
|
+
outName: 'ap-east-1:xxxxxx/video/XXXXX-0b9ba84XXXX.mp4',
|
|
156
|
+
};
|
|
157
|
+
(0, bun_test_1.expect)((0, expected_out_name_1.getExpectedOutName)({
|
|
158
|
+
renderMetadata: newRenderMetadata,
|
|
159
|
+
bucketName,
|
|
160
|
+
customCredentials: null,
|
|
161
|
+
bucketNamePrefix: 'remotionlambda-',
|
|
162
|
+
})).toEqual({
|
|
163
|
+
customCredentials: null,
|
|
164
|
+
key: 'renders/9n8dsfafs/ap-east-1:xxxxxx/video/XXXXX-0b9ba84XXXX.mp4',
|
|
165
|
+
renderBucketName: 'remotionlambda-98fsduf',
|
|
166
|
+
});
|
|
167
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bun_test_1 = require("bun:test");
|
|
4
|
+
const min_max_1 = require("../min-max");
|
|
5
|
+
(0, bun_test_1.describe)('min() and max()', () => {
|
|
6
|
+
(0, bun_test_1.test)('Implemented min() functions correctly', () => {
|
|
7
|
+
(0, bun_test_1.expect)((0, min_max_1.min)([0, -30, 90, -120, 0])).toBe(-120);
|
|
8
|
+
});
|
|
9
|
+
(0, bun_test_1.test)('Implemented max() functions correctly', () => {
|
|
10
|
+
(0, bun_test_1.expect)((0, min_max_1.max)([0, -30, 90, -120, 0])).toBe(90);
|
|
11
|
+
});
|
|
12
|
+
(0, bun_test_1.test)('min() should throw on empty arr', () => {
|
|
13
|
+
(0, bun_test_1.expect)(() => (0, min_max_1.min)([])).toThrow(/Array of 0 length/);
|
|
14
|
+
});
|
|
15
|
+
(0, bun_test_1.test)('max() should throw on empty arr', () => {
|
|
16
|
+
(0, bun_test_1.expect)(() => (0, min_max_1.min)([])).toThrow(/Array of 0 length/);
|
|
17
|
+
});
|
|
18
|
+
const bigArray = new Array(300000).fill(true).map((_, i) => {
|
|
19
|
+
return i;
|
|
20
|
+
});
|
|
21
|
+
(0, bun_test_1.test)('Custom max() should not throw', () => {
|
|
22
|
+
(0, bun_test_1.expect)((0, min_max_1.max)(bigArray)).toBe(299999);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|