@remotion/serverless-client 4.0.364 → 4.0.366
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/esm/index.mjs +1 -1
- package/package.json +5 -5
- package/.turbo/turbo-formatting.log +0 -4
- package/.turbo/turbo-lint.log +0 -15
- package/.turbo/turbo-make.log +0 -3
- package/bundle.ts +0 -15
- package/dist/test/best-frames.test.d.ts +0 -1
- package/dist/test/best-frames.test.js +0 -16
- package/dist/test/dont-contain-forbidden.test.d.ts +0 -1
- package/dist/test/dont-contain-forbidden.test.js +0 -18
- package/dist/test/expected-out-name.test.d.ts +0 -1
- package/dist/test/expected-out-name.test.js +0 -168
- package/dist/test/min-max.test.d.ts +0 -1
- package/dist/test/min-max.test.js +0 -24
- package/dist/test/most-expensive-chunks.test.d.ts +0 -1
- package/dist/test/most-expensive-chunks.test.js +0 -163
- package/eslint.config.mjs +0 -5
- package/src/await.ts +0 -1
- package/src/best-frames-per-function-param.ts +0 -18
- package/src/calculate-chunk-times.ts +0 -42
- package/src/compress-props.ts +0 -179
- package/src/constants.ts +0 -408
- package/src/docs-url.ts +0 -1
- package/src/error-category.ts +0 -14
- package/src/estimate-price-from-bucket.ts +0 -59
- package/src/expected-out-name.ts +0 -83
- package/src/format-costs-info.ts +0 -24
- package/src/get-custom-out-name.ts +0 -44
- package/src/get-files-in-folder.ts +0 -6
- package/src/get-or-create-bucket.ts +0 -85
- package/src/get-overall-progress-from-storage.ts +0 -47
- package/src/get-overall-progress.ts +0 -42
- package/src/index.ts +0 -125
- package/src/input-props-keys.ts +0 -7
- package/src/inspect-error.ts +0 -63
- package/src/make-bucket-name.ts +0 -9
- package/src/make-timeout-error.ts +0 -51
- package/src/make-timeout-message.ts +0 -118
- package/src/min-max.ts +0 -34
- package/src/most-expensive-chunks.ts +0 -46
- package/src/overall-render-progress.ts +0 -30
- package/src/progress.ts +0 -330
- package/src/provider-implementation.ts +0 -268
- package/src/render-has-audio-video.ts +0 -28
- package/src/render-metadata.ts +0 -61
- package/src/render-progress.ts +0 -58
- package/src/return-values.ts +0 -45
- package/src/serialize-artifact.ts +0 -66
- package/src/stream-to-string.ts +0 -14
- package/src/streaming/streaming.ts +0 -148
- package/src/test/best-frames.test.ts +0 -15
- package/src/test/dont-contain-forbidden.test.ts +0 -14
- package/src/test/expected-out-name.test.ts +0 -200
- package/src/test/min-max.test.ts +0 -25
- package/src/test/most-expensive-chunks.test.ts +0 -167
- package/src/truthy.ts +0 -5
- package/src/types.ts +0 -82
- package/src/validate-bucket-name.ts +0 -34
- package/src/validate-download-behavior.ts +0 -26
- package/src/validate-frames-per-function.ts +0 -125
- package/src/validate-outname.ts +0 -63
- package/src/validate-privacy.ts +0 -20
- package/src/validate-webhook.ts +0 -18
- package/src/webhook-types.ts +0 -36
- package/src/write-error-to-storage.ts +0 -23
- package/tsconfig.json +0 -18
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import type {LogLevel} from '@remotion/renderer';
|
|
2
|
-
import type {Readable} from 'node:stream';
|
|
3
|
-
import type {DownloadBehavior} from 'remotion';
|
|
4
|
-
import type {CustomCredentials, Privacy, ServerlessRoutines} from './constants';
|
|
5
|
-
import type {RenderMetadata} from './render-metadata';
|
|
6
|
-
import type {ServerlessReturnValues} from './return-values';
|
|
7
|
-
import type {OnMessage} from './streaming/streaming';
|
|
8
|
-
import type {CallFunctionOptions, CloudProvider} from './types';
|
|
9
|
-
|
|
10
|
-
export type ParseFunctionName = (functionName: string) => {
|
|
11
|
-
version: string;
|
|
12
|
-
memorySizeInMb: number;
|
|
13
|
-
diskSizeInMb: number;
|
|
14
|
-
timeoutInSeconds: number;
|
|
15
|
-
} | null;
|
|
16
|
-
|
|
17
|
-
type DeleteFile<Provider extends CloudProvider> = (params: {
|
|
18
|
-
bucketName: string;
|
|
19
|
-
key: string;
|
|
20
|
-
region: Provider['region'];
|
|
21
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
22
|
-
forcePathStyle: boolean;
|
|
23
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
24
|
-
}) => Promise<void>;
|
|
25
|
-
|
|
26
|
-
export type BucketWithLocation<Provider extends CloudProvider> = {
|
|
27
|
-
name: string;
|
|
28
|
-
creationDate: number;
|
|
29
|
-
region: Provider['region'];
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type BucketExists<Provider extends CloudProvider> = (params: {
|
|
33
|
-
bucketName: string;
|
|
34
|
-
region: Provider['region'];
|
|
35
|
-
expectedBucketOwner: string | null;
|
|
36
|
-
forcePathStyle: boolean;
|
|
37
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
38
|
-
}) => Promise<boolean>;
|
|
39
|
-
|
|
40
|
-
type ReadFile<Provider extends CloudProvider> = (params: {
|
|
41
|
-
bucketName: string;
|
|
42
|
-
key: string;
|
|
43
|
-
region: Provider['region'];
|
|
44
|
-
expectedBucketOwner: string | null;
|
|
45
|
-
forcePathStyle: boolean;
|
|
46
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
47
|
-
}) => Promise<Readable>;
|
|
48
|
-
|
|
49
|
-
type GetBuckets<Provider extends CloudProvider> = (options: {
|
|
50
|
-
region: Provider['region'];
|
|
51
|
-
forceBucketName: string | null;
|
|
52
|
-
forcePathStyle: boolean;
|
|
53
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
54
|
-
}) => Promise<BucketWithLocation<Provider>[]>;
|
|
55
|
-
|
|
56
|
-
type CreateBucket<Provider extends CloudProvider> = (params: {
|
|
57
|
-
region: Provider['region'];
|
|
58
|
-
bucketName: string;
|
|
59
|
-
forcePathStyle: boolean;
|
|
60
|
-
skipPutAcl: boolean;
|
|
61
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
62
|
-
}) => Promise<void>;
|
|
63
|
-
|
|
64
|
-
type ApplyLifeCycle<Provider extends CloudProvider> = (params: {
|
|
65
|
-
enableFolderExpiry: boolean | null;
|
|
66
|
-
bucketName: string;
|
|
67
|
-
region: Provider['region'];
|
|
68
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
69
|
-
forcePathStyle: boolean;
|
|
70
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
71
|
-
}) => Promise<void>;
|
|
72
|
-
|
|
73
|
-
type ListObjects<Provider extends CloudProvider> = (params: {
|
|
74
|
-
bucketName: string;
|
|
75
|
-
prefix: string;
|
|
76
|
-
region: Provider['region'];
|
|
77
|
-
expectedBucketOwner: string | null;
|
|
78
|
-
forcePathStyle: boolean;
|
|
79
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
80
|
-
continuationToken?: string;
|
|
81
|
-
}) => Promise<BucketObject[]>;
|
|
82
|
-
|
|
83
|
-
type BucketObject = {
|
|
84
|
-
Key: string;
|
|
85
|
-
LastModified: Date;
|
|
86
|
-
ETag: string;
|
|
87
|
-
Size: number;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
type HeadFile<Provider extends CloudProvider> = (
|
|
91
|
-
params: HeadFileInput<Provider>,
|
|
92
|
-
) => Promise<HeadFileOutput>;
|
|
93
|
-
|
|
94
|
-
type RandomHash = () => string;
|
|
95
|
-
|
|
96
|
-
type ConvertToServeUrl<Provider extends CloudProvider> = (params: {
|
|
97
|
-
urlOrId: string;
|
|
98
|
-
region: Provider['region'];
|
|
99
|
-
bucketName: string;
|
|
100
|
-
}) => string;
|
|
101
|
-
|
|
102
|
-
type HeadFileOutput = {
|
|
103
|
-
LastModified?: Date | undefined;
|
|
104
|
-
ContentLength?: number | undefined;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export type DeleteFunctionInput<Provider extends CloudProvider> = {
|
|
108
|
-
region: Provider['region'];
|
|
109
|
-
functionName: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
export type DeleteFunction<Provider extends CloudProvider> = (
|
|
113
|
-
options: DeleteFunctionInput<Provider>,
|
|
114
|
-
) => Promise<void>;
|
|
115
|
-
|
|
116
|
-
export type WriteFileInput<Provider extends CloudProvider> = {
|
|
117
|
-
bucketName: string;
|
|
118
|
-
key: string;
|
|
119
|
-
body: Readable | string | Uint8Array;
|
|
120
|
-
region: Provider['region'];
|
|
121
|
-
privacy: Privacy;
|
|
122
|
-
expectedBucketOwner: string | null;
|
|
123
|
-
downloadBehavior: DownloadBehavior | null;
|
|
124
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
125
|
-
forcePathStyle: boolean;
|
|
126
|
-
storageClass: Provider['storageClass'] | null;
|
|
127
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
type WriteFile<Provider extends CloudProvider> = (
|
|
131
|
-
params: WriteFileInput<Provider>,
|
|
132
|
-
) => Promise<void>;
|
|
133
|
-
|
|
134
|
-
type HeadFileInput<Provider extends CloudProvider> = {
|
|
135
|
-
bucketName: string;
|
|
136
|
-
key: string;
|
|
137
|
-
region: Provider['region'];
|
|
138
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
139
|
-
forcePathStyle: boolean;
|
|
140
|
-
requestHandler: Provider['requestHandler'] | null;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export type CallFunctionAsync<Provider extends CloudProvider> = <
|
|
144
|
-
T extends ServerlessRoutines,
|
|
145
|
-
>({
|
|
146
|
-
functionName,
|
|
147
|
-
payload,
|
|
148
|
-
region,
|
|
149
|
-
timeoutInTest,
|
|
150
|
-
requestHandler,
|
|
151
|
-
}: CallFunctionOptions<T, Provider>) => Promise<void>;
|
|
152
|
-
|
|
153
|
-
export type CallFunctionStreaming<Provider extends CloudProvider> = <
|
|
154
|
-
T extends ServerlessRoutines,
|
|
155
|
-
>(
|
|
156
|
-
options: CallFunctionOptions<T, Provider> & {
|
|
157
|
-
receivedStreamingPayload: OnMessage<Provider>;
|
|
158
|
-
retriesRemaining: number;
|
|
159
|
-
},
|
|
160
|
-
) => Promise<void>;
|
|
161
|
-
|
|
162
|
-
export type CallFunctionSync<Provider extends CloudProvider> = <
|
|
163
|
-
T extends ServerlessRoutines,
|
|
164
|
-
>({
|
|
165
|
-
functionName,
|
|
166
|
-
payload,
|
|
167
|
-
region,
|
|
168
|
-
timeoutInTest,
|
|
169
|
-
}: CallFunctionOptions<T, Provider>) => Promise<
|
|
170
|
-
ServerlessReturnValues<Provider>[T]
|
|
171
|
-
>;
|
|
172
|
-
|
|
173
|
-
export type GetOutputUrl<Provider extends CloudProvider> = (options: {
|
|
174
|
-
renderMetadata: RenderMetadata<Provider>;
|
|
175
|
-
bucketName: string;
|
|
176
|
-
customCredentials: CustomCredentials<Provider> | null;
|
|
177
|
-
currentRegion: Provider['region'];
|
|
178
|
-
}) => {url: string; key: string};
|
|
179
|
-
|
|
180
|
-
export type EstimatePriceInput<Provider extends CloudProvider> = {
|
|
181
|
-
region: Provider['region'];
|
|
182
|
-
memorySizeInMb: number;
|
|
183
|
-
diskSizeInMb: number;
|
|
184
|
-
lambdasInvoked: number;
|
|
185
|
-
durationInMilliseconds: number;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
export type EstimatePrice<Provider extends CloudProvider> = ({
|
|
189
|
-
region,
|
|
190
|
-
memorySizeInMb,
|
|
191
|
-
diskSizeInMb,
|
|
192
|
-
lambdasInvoked,
|
|
193
|
-
...other
|
|
194
|
-
}: EstimatePriceInput<Provider>) => number;
|
|
195
|
-
|
|
196
|
-
export type GetLoggingUrlForRendererFunction<Provider extends CloudProvider> =
|
|
197
|
-
(options: {
|
|
198
|
-
region: Provider['region'];
|
|
199
|
-
functionName: string;
|
|
200
|
-
rendererFunctionName: string | null;
|
|
201
|
-
renderId: string;
|
|
202
|
-
chunk: null | number;
|
|
203
|
-
}) => string;
|
|
204
|
-
|
|
205
|
-
export type GetFunctionsInput<Provider extends CloudProvider> = {
|
|
206
|
-
region: Provider['region'];
|
|
207
|
-
compatibleOnly: boolean;
|
|
208
|
-
logLevel?: LogLevel;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export type GetLoggingUrlForMethod<Provider extends CloudProvider> = (options: {
|
|
212
|
-
region: Provider['region'];
|
|
213
|
-
functionName: string;
|
|
214
|
-
method: ServerlessRoutines;
|
|
215
|
-
rendererFunctionName: string | null;
|
|
216
|
-
renderId: string;
|
|
217
|
-
}) => string;
|
|
218
|
-
|
|
219
|
-
export type GetAccountId<Provider extends CloudProvider> = (options: {
|
|
220
|
-
region: Provider['region'];
|
|
221
|
-
}) => Promise<string>;
|
|
222
|
-
|
|
223
|
-
export type FunctionInfo = {
|
|
224
|
-
functionName: string;
|
|
225
|
-
timeoutInSeconds: number;
|
|
226
|
-
memorySizeInMb: number;
|
|
227
|
-
version: string | null;
|
|
228
|
-
diskSizeInMb: number;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
export type GetFunctions<Provider extends CloudProvider> = (
|
|
232
|
-
params: GetFunctionsInput<Provider>,
|
|
233
|
-
) => Promise<FunctionInfo[]>;
|
|
234
|
-
|
|
235
|
-
export type ProviderSpecifics<Provider extends CloudProvider> = {
|
|
236
|
-
getChromiumPath: () => string | null;
|
|
237
|
-
getBuckets: GetBuckets<Provider>;
|
|
238
|
-
getBucketPrefix: () => string;
|
|
239
|
-
createBucket: CreateBucket<Provider>;
|
|
240
|
-
applyLifeCycle: ApplyLifeCycle<Provider>;
|
|
241
|
-
listObjects: ListObjects<Provider>;
|
|
242
|
-
deleteFile: DeleteFile<Provider>;
|
|
243
|
-
bucketExists: BucketExists<Provider>;
|
|
244
|
-
randomHash: RandomHash;
|
|
245
|
-
readFile: ReadFile<Provider>;
|
|
246
|
-
writeFile: WriteFile<Provider>;
|
|
247
|
-
headFile: HeadFile<Provider>;
|
|
248
|
-
convertToServeUrl: ConvertToServeUrl<Provider>;
|
|
249
|
-
printLoggingHelper: boolean;
|
|
250
|
-
validateDeleteAfter: (lifeCycleValue: unknown) => void;
|
|
251
|
-
callFunctionAsync: CallFunctionAsync<Provider>;
|
|
252
|
-
callFunctionStreaming: CallFunctionStreaming<Provider>;
|
|
253
|
-
callFunctionSync: CallFunctionSync<Provider>;
|
|
254
|
-
estimatePrice: EstimatePrice<Provider>;
|
|
255
|
-
getLoggingUrlForRendererFunction: GetLoggingUrlForRendererFunction<Provider>;
|
|
256
|
-
getLoggingUrlForMethod: GetLoggingUrlForMethod<Provider>;
|
|
257
|
-
getEphemeralStorageForPriceCalculation: () => number;
|
|
258
|
-
getOutputUrl: GetOutputUrl<Provider>;
|
|
259
|
-
isFlakyError: (err: Error) => boolean;
|
|
260
|
-
serverStorageProductName: () => string;
|
|
261
|
-
getMaxStillInlinePayloadSize: () => number;
|
|
262
|
-
getMaxNonInlinePayloadSizePerFunction: () => number;
|
|
263
|
-
getAccountId: GetAccountId<Provider>;
|
|
264
|
-
deleteFunction: DeleteFunction<Provider>;
|
|
265
|
-
getFunctions: GetFunctions<Provider>;
|
|
266
|
-
parseFunctionName: ParseFunctionName;
|
|
267
|
-
checkCredentials: () => void;
|
|
268
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {NoReactAPIs} from '@remotion/renderer/pure';
|
|
2
|
-
import type {RenderMetadata} from './render-metadata';
|
|
3
|
-
import type {CloudProvider} from './types';
|
|
4
|
-
|
|
5
|
-
export const lambdaRenderHasAudioVideo = <Provider extends CloudProvider>(
|
|
6
|
-
renderMetadata: RenderMetadata<Provider>,
|
|
7
|
-
): {
|
|
8
|
-
hasAudio: boolean;
|
|
9
|
-
hasVideo: boolean;
|
|
10
|
-
} => {
|
|
11
|
-
if (renderMetadata.type === 'still') {
|
|
12
|
-
throw new Error('Cannot merge stills');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const support = NoReactAPIs.codecSupportsMedia(renderMetadata.codec);
|
|
16
|
-
|
|
17
|
-
const hasVideo = renderMetadata
|
|
18
|
-
? !NoReactAPIs.isAudioCodec(renderMetadata.codec)
|
|
19
|
-
: false;
|
|
20
|
-
const hasAudio = renderMetadata
|
|
21
|
-
? !renderMetadata.muted && support.audio
|
|
22
|
-
: false;
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
hasAudio,
|
|
26
|
-
hasVideo,
|
|
27
|
-
};
|
|
28
|
-
};
|
package/src/render-metadata.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AudioCodec,
|
|
3
|
-
DeleteAfter,
|
|
4
|
-
StillImageFormat,
|
|
5
|
-
VideoImageFormat,
|
|
6
|
-
} from '@remotion/renderer';
|
|
7
|
-
import type {DownloadBehavior} from 'remotion';
|
|
8
|
-
import type {
|
|
9
|
-
OutNameInputWithoutCredentials,
|
|
10
|
-
Privacy,
|
|
11
|
-
SerializedInputProps,
|
|
12
|
-
ServerlessCodec,
|
|
13
|
-
} from './constants';
|
|
14
|
-
import type {CloudProvider} from './types';
|
|
15
|
-
|
|
16
|
-
type Discriminated =
|
|
17
|
-
| {
|
|
18
|
-
type: 'still';
|
|
19
|
-
imageFormat: StillImageFormat;
|
|
20
|
-
codec: null;
|
|
21
|
-
}
|
|
22
|
-
| {
|
|
23
|
-
type: 'video';
|
|
24
|
-
imageFormat: VideoImageFormat;
|
|
25
|
-
muted: boolean;
|
|
26
|
-
frameRange: [number, number];
|
|
27
|
-
everyNthFrame: number;
|
|
28
|
-
codec: ServerlessCodec;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type Dimensions = {
|
|
32
|
-
width: number;
|
|
33
|
-
height: number;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type RenderMetadata<Provider extends CloudProvider> = Discriminated & {
|
|
37
|
-
siteId: string;
|
|
38
|
-
startedDate: number;
|
|
39
|
-
totalChunks: number;
|
|
40
|
-
estimatedTotalLambdaInvokations: number;
|
|
41
|
-
estimatedRenderLambdaInvokations: number;
|
|
42
|
-
compositionId: string;
|
|
43
|
-
audioCodec: AudioCodec | null;
|
|
44
|
-
inputProps: SerializedInputProps;
|
|
45
|
-
framesPerLambda: number;
|
|
46
|
-
memorySizeInMb: number;
|
|
47
|
-
functionName: string;
|
|
48
|
-
rendererFunctionName: string;
|
|
49
|
-
lambdaVersion: string;
|
|
50
|
-
region: Provider['region'];
|
|
51
|
-
renderId: string;
|
|
52
|
-
outName: OutNameInputWithoutCredentials | undefined;
|
|
53
|
-
privacy: Privacy;
|
|
54
|
-
deleteAfter: DeleteAfter | null;
|
|
55
|
-
numberOfGifLoops: number | null;
|
|
56
|
-
audioBitrate: string | null;
|
|
57
|
-
downloadBehavior: DownloadBehavior;
|
|
58
|
-
metadata: Record<string, string> | null;
|
|
59
|
-
dimensions: Dimensions;
|
|
60
|
-
scale: number;
|
|
61
|
-
};
|
package/src/render-progress.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type {ExpensiveChunk} from './most-expensive-chunks';
|
|
2
|
-
import type {RenderMetadata} from './render-metadata';
|
|
3
|
-
import type {
|
|
4
|
-
ChunkRetry,
|
|
5
|
-
CloudProvider,
|
|
6
|
-
CostsInfo,
|
|
7
|
-
ReceivedArtifact,
|
|
8
|
-
} from './types';
|
|
9
|
-
import type {EnhancedErrorInfo} from './write-error-to-storage';
|
|
10
|
-
|
|
11
|
-
export type CleanupInfo = {
|
|
12
|
-
doneIn: number | null;
|
|
13
|
-
minFilesToDelete: number;
|
|
14
|
-
filesDeleted: number;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type EncodingProgress = {
|
|
18
|
-
framesEncoded: number;
|
|
19
|
-
combinedFrames: number;
|
|
20
|
-
timeToCombine: number | null;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type GenericRenderProgress<Provider extends CloudProvider> = {
|
|
24
|
-
chunks: number;
|
|
25
|
-
done: boolean;
|
|
26
|
-
encodingStatus: EncodingProgress | null;
|
|
27
|
-
costs: CostsInfo;
|
|
28
|
-
renderId: string;
|
|
29
|
-
renderMetadata: RenderMetadata<Provider> | null;
|
|
30
|
-
bucket: string;
|
|
31
|
-
outputFile: string | null;
|
|
32
|
-
outKey: string | null;
|
|
33
|
-
outBucket: string | null;
|
|
34
|
-
timeToFinish: number | null;
|
|
35
|
-
errors: EnhancedErrorInfo[];
|
|
36
|
-
fatalErrorEncountered: boolean;
|
|
37
|
-
currentTime: number;
|
|
38
|
-
renderSize: number;
|
|
39
|
-
lambdasInvoked: number;
|
|
40
|
-
cleanup: CleanupInfo | null;
|
|
41
|
-
timeToFinishChunks: number | null;
|
|
42
|
-
timeToRenderFrames: number | null;
|
|
43
|
-
timeToEncode: number | null;
|
|
44
|
-
overallProgress: number;
|
|
45
|
-
retriesInfo: ChunkRetry[];
|
|
46
|
-
mostExpensiveFrameRanges: ExpensiveChunk[] | null;
|
|
47
|
-
framesRendered: number;
|
|
48
|
-
outputSizeInBytes: number | null;
|
|
49
|
-
type: 'success';
|
|
50
|
-
estimatedBillingDurationInMilliseconds: number | null;
|
|
51
|
-
combinedFrames: number;
|
|
52
|
-
timeToCombine: number | null;
|
|
53
|
-
timeoutTimestamp: number;
|
|
54
|
-
functionLaunched: number;
|
|
55
|
-
serveUrlOpened: number | null;
|
|
56
|
-
compositionValidated: number | null;
|
|
57
|
-
artifacts: ReceivedArtifact<Provider>[];
|
|
58
|
-
};
|
package/src/return-values.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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
|
-
|
|
6
|
-
export type OrError<T> =
|
|
7
|
-
| T
|
|
8
|
-
| {
|
|
9
|
-
type: 'error';
|
|
10
|
-
message: string;
|
|
11
|
-
stack: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export interface ServerlessReturnValues<Provider extends CloudProvider> {
|
|
15
|
-
[ServerlessRoutines.start]: Promise<{
|
|
16
|
-
type: 'success';
|
|
17
|
-
bucketName: string;
|
|
18
|
-
renderId: string;
|
|
19
|
-
}>;
|
|
20
|
-
[ServerlessRoutines.launch]: Promise<{
|
|
21
|
-
type: 'success';
|
|
22
|
-
}>;
|
|
23
|
-
[ServerlessRoutines.renderer]: Promise<{
|
|
24
|
-
type: 'success';
|
|
25
|
-
}>;
|
|
26
|
-
[ServerlessRoutines.status]: Promise<GenericRenderProgress<Provider>>;
|
|
27
|
-
[ServerlessRoutines.info]: {
|
|
28
|
-
version: string;
|
|
29
|
-
type: 'success';
|
|
30
|
-
};
|
|
31
|
-
[ServerlessRoutines.still]: Promise<
|
|
32
|
-
| {
|
|
33
|
-
type: 'success';
|
|
34
|
-
}
|
|
35
|
-
| {
|
|
36
|
-
type: 'error';
|
|
37
|
-
message: string;
|
|
38
|
-
stack: string;
|
|
39
|
-
}
|
|
40
|
-
>;
|
|
41
|
-
[ServerlessRoutines.compositions]: Promise<{
|
|
42
|
-
compositions: VideoConfig[];
|
|
43
|
-
type: 'success';
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type {EmittedArtifact} from '@remotion/renderer';
|
|
2
|
-
import type {DownloadBehavior} from 'remotion/no-react';
|
|
3
|
-
|
|
4
|
-
export type SerializedArtifact = {
|
|
5
|
-
filename: string;
|
|
6
|
-
stringContent: string;
|
|
7
|
-
frame: number;
|
|
8
|
-
binary: boolean;
|
|
9
|
-
downloadBehavior: DownloadBehavior | null;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const deserializeArtifact = (
|
|
13
|
-
serializedArtifact: SerializedArtifact,
|
|
14
|
-
): EmittedArtifact => {
|
|
15
|
-
if (serializedArtifact.binary) {
|
|
16
|
-
const binaryString = atob(serializedArtifact.stringContent);
|
|
17
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
18
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
19
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
filename: serializedArtifact.filename,
|
|
24
|
-
content: bytes,
|
|
25
|
-
frame: serializedArtifact.frame,
|
|
26
|
-
downloadBehavior: serializedArtifact.downloadBehavior,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
filename: serializedArtifact.filename,
|
|
32
|
-
content: serializedArtifact.stringContent,
|
|
33
|
-
frame: serializedArtifact.frame,
|
|
34
|
-
downloadBehavior: serializedArtifact.downloadBehavior,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const serializeArtifact = (
|
|
39
|
-
artifact: EmittedArtifact,
|
|
40
|
-
): SerializedArtifact => {
|
|
41
|
-
if (artifact.content instanceof Uint8Array) {
|
|
42
|
-
let binary = '';
|
|
43
|
-
const bytes = new Uint8Array(artifact.content);
|
|
44
|
-
const len = bytes.byteLength;
|
|
45
|
-
for (let i = 0; i < len; i++) {
|
|
46
|
-
binary += String.fromCharCode(bytes[i]);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const b64encoded = btoa(binary);
|
|
50
|
-
return {
|
|
51
|
-
filename: artifact.filename,
|
|
52
|
-
stringContent: b64encoded,
|
|
53
|
-
frame: artifact.frame,
|
|
54
|
-
binary: true,
|
|
55
|
-
downloadBehavior: artifact.downloadBehavior,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
filename: artifact.filename,
|
|
61
|
-
stringContent: artifact.content,
|
|
62
|
-
frame: artifact.frame,
|
|
63
|
-
binary: false,
|
|
64
|
-
downloadBehavior: artifact.downloadBehavior,
|
|
65
|
-
};
|
|
66
|
-
};
|
package/src/stream-to-string.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type {Readable} from 'stream';
|
|
2
|
-
|
|
3
|
-
export function streamToString(stream: Readable | Buffer) {
|
|
4
|
-
if (Buffer.isBuffer(stream)) {
|
|
5
|
-
return stream.toString('utf-8');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const chunks: Uint8Array[] = [];
|
|
9
|
-
return new Promise<string>((resolve, reject) => {
|
|
10
|
-
stream.on('data', (chunk) => chunks.push(new Uint8Array(chunk)));
|
|
11
|
-
stream.on('error', (err) => reject(err));
|
|
12
|
-
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
13
|
-
});
|
|
14
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import {makeStreamPayloadMessage} from '@remotion/streaming';
|
|
2
|
-
import type {SerializedArtifact} from '../serialize-artifact';
|
|
3
|
-
import type {CloudProvider, RenderStillFunctionResponsePayload} from '../types';
|
|
4
|
-
import type {FunctionErrorInfo} from '../write-error-to-storage';
|
|
5
|
-
|
|
6
|
-
const framesRendered = 'frames-rendered' as const;
|
|
7
|
-
const errorOccurred = 'error-occurred' as const;
|
|
8
|
-
const renderIdDetermined = 'render-id-determined' as const;
|
|
9
|
-
const videoChunkRendered = 'video-chunk-rendered' as const;
|
|
10
|
-
const audioChunkRendered = 'audio-chunk-rendered' as const;
|
|
11
|
-
const chunkComplete = 'chunk-complete' as const;
|
|
12
|
-
const stillRendered = 'still-rendered' as const;
|
|
13
|
-
const functionInvoked = 'lambda-invoked' as const;
|
|
14
|
-
const artifactEmitted = 'artifact-emitted' as const;
|
|
15
|
-
|
|
16
|
-
const messageTypes = {
|
|
17
|
-
'1': {type: framesRendered},
|
|
18
|
-
'2': {type: errorOccurred},
|
|
19
|
-
'3': {type: renderIdDetermined},
|
|
20
|
-
'4': {type: videoChunkRendered},
|
|
21
|
-
'5': {type: audioChunkRendered},
|
|
22
|
-
'6': {type: stillRendered},
|
|
23
|
-
'7': {type: chunkComplete},
|
|
24
|
-
'8': {type: functionInvoked},
|
|
25
|
-
'9': {type: artifactEmitted},
|
|
26
|
-
} as const;
|
|
27
|
-
|
|
28
|
-
export type MessageTypeId = keyof typeof messageTypes;
|
|
29
|
-
type MessageType = (typeof messageTypes)[MessageTypeId]['type'];
|
|
30
|
-
|
|
31
|
-
export const formatMap: {[key in MessageType]: 'json' | 'binary'} = {
|
|
32
|
-
[framesRendered]: 'json',
|
|
33
|
-
[errorOccurred]: 'json',
|
|
34
|
-
[renderIdDetermined]: 'json',
|
|
35
|
-
[videoChunkRendered]: 'binary',
|
|
36
|
-
[audioChunkRendered]: 'binary',
|
|
37
|
-
[stillRendered]: 'json',
|
|
38
|
-
[chunkComplete]: 'json',
|
|
39
|
-
[functionInvoked]: 'json',
|
|
40
|
-
[artifactEmitted]: 'json',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export type StreamingPayload<Provider extends CloudProvider> =
|
|
44
|
-
| {
|
|
45
|
-
type: typeof framesRendered;
|
|
46
|
-
payload: {
|
|
47
|
-
rendered: number;
|
|
48
|
-
encoded: number;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
| {
|
|
52
|
-
type: typeof videoChunkRendered;
|
|
53
|
-
payload: Uint8Array;
|
|
54
|
-
}
|
|
55
|
-
| {
|
|
56
|
-
type: typeof audioChunkRendered;
|
|
57
|
-
payload: Uint8Array;
|
|
58
|
-
}
|
|
59
|
-
| {
|
|
60
|
-
type: typeof errorOccurred;
|
|
61
|
-
payload: {
|
|
62
|
-
error: string;
|
|
63
|
-
shouldRetry: boolean;
|
|
64
|
-
errorInfo: FunctionErrorInfo;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
| {
|
|
68
|
-
type: typeof renderIdDetermined;
|
|
69
|
-
payload: {
|
|
70
|
-
renderId: string;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
| {
|
|
74
|
-
type: typeof stillRendered;
|
|
75
|
-
payload: RenderStillFunctionResponsePayload<Provider>;
|
|
76
|
-
}
|
|
77
|
-
| {
|
|
78
|
-
type: typeof chunkComplete;
|
|
79
|
-
payload: {
|
|
80
|
-
start: number;
|
|
81
|
-
rendered: number;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
| {
|
|
85
|
-
type: typeof functionInvoked;
|
|
86
|
-
payload: {
|
|
87
|
-
attempt: number;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
| {
|
|
91
|
-
type: typeof artifactEmitted;
|
|
92
|
-
payload: {
|
|
93
|
-
artifact: SerializedArtifact;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const messageTypeIdToMessageType = (
|
|
98
|
-
messageTypeId: MessageTypeId,
|
|
99
|
-
): MessageType => {
|
|
100
|
-
const types = messageTypes[messageTypeId];
|
|
101
|
-
if (!types) {
|
|
102
|
-
throw new Error(`Unknown message type id ${messageTypeId}`);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return types.type;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const messageTypeToMessageId = (messageType: MessageType): MessageTypeId => {
|
|
109
|
-
const id = (Object.keys(messageTypes) as unknown as MessageTypeId[]).find(
|
|
110
|
-
(key) => messageTypes[key].type === messageType,
|
|
111
|
-
) as MessageTypeId;
|
|
112
|
-
|
|
113
|
-
if (!id) {
|
|
114
|
-
throw new Error(`Unknown message type ${messageType}`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return id;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export type StreamingMessage<Provider extends CloudProvider> = {
|
|
121
|
-
successType: 'error' | 'success';
|
|
122
|
-
message: StreamingPayload<Provider>;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type OnMessage<Provider extends CloudProvider> = (
|
|
126
|
-
options: StreamingMessage<Provider>,
|
|
127
|
-
) => void;
|
|
128
|
-
|
|
129
|
-
export type OnStream<Provider extends CloudProvider> = (
|
|
130
|
-
payload: StreamingPayload<Provider>,
|
|
131
|
-
) => Promise<void>;
|
|
132
|
-
|
|
133
|
-
export const makeStreamPayload = <Provider extends CloudProvider>({
|
|
134
|
-
message,
|
|
135
|
-
}: {
|
|
136
|
-
message: StreamingPayload<Provider>;
|
|
137
|
-
}) => {
|
|
138
|
-
const body =
|
|
139
|
-
formatMap[message.type] === 'json'
|
|
140
|
-
? new TextEncoder().encode(JSON.stringify(message.payload))
|
|
141
|
-
: (message.payload as Uint8Array);
|
|
142
|
-
|
|
143
|
-
return makeStreamPayloadMessage({
|
|
144
|
-
body,
|
|
145
|
-
nonce: messageTypeToMessageId(message.type),
|
|
146
|
-
status: 0,
|
|
147
|
-
});
|
|
148
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {expect, test} from 'bun:test';
|
|
2
|
-
import {bestFramesPerFunctionParam} from '../best-frames-per-function-param';
|
|
3
|
-
|
|
4
|
-
test('Get reasonable framesPerFunction defaults', () => {
|
|
5
|
-
expect(bestFramesPerFunctionParam(20)).toEqual(20);
|
|
6
|
-
expect(bestFramesPerFunctionParam(21)).toEqual(11);
|
|
7
|
-
expect(bestFramesPerFunctionParam(100)).toEqual(20);
|
|
8
|
-
expect(bestFramesPerFunctionParam(2000)).toEqual(24);
|
|
9
|
-
expect(bestFramesPerFunctionParam(4000)).toEqual(44);
|
|
10
|
-
expect(bestFramesPerFunctionParam(8000)).toEqual(74);
|
|
11
|
-
expect(bestFramesPerFunctionParam(10000)).toEqual(86);
|
|
12
|
-
expect(bestFramesPerFunctionParam(14000)).toEqual(105);
|
|
13
|
-
expect(bestFramesPerFunctionParam(18000)).toEqual(120);
|
|
14
|
-
expect(bestFramesPerFunctionParam(216000)).toEqual(1440);
|
|
15
|
-
});
|