@remotion/serverless 4.0.244 → 4.0.246
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 +1 -1
- package/LICENSE.md +1 -1
- package/dist/best-frames-per-function-param.d.ts +1 -0
- package/dist/best-frames-per-function-param.js +17 -0
- package/dist/calculate-chunk-times.d.ts +5 -0
- package/dist/calculate-chunk-times.js +29 -0
- package/dist/can-concat-seamlessly.d.ts +3 -0
- package/dist/can-concat-seamlessly.js +17 -0
- package/dist/cleanup-props.d.ts +9 -0
- package/dist/cleanup-props.js +23 -0
- package/dist/cleanup-serialized-input-props.d.ts +15 -0
- package/dist/cleanup-serialized-input-props.js +34 -0
- package/dist/client.d.ts +9 -0
- package/dist/client.js +30 -12
- package/dist/compress-props.d.ts +6 -2
- package/dist/compress-props.js +5 -3
- package/dist/concat-videos.d.ts +25 -0
- package/dist/concat-videos.js +53 -0
- package/dist/constants.d.ts +39 -3
- package/dist/constants.js +8 -1
- package/dist/create-post-render-data.d.ts +20 -0
- package/dist/create-post-render-data.js +68 -0
- package/dist/docs-url.d.ts +1 -0
- package/dist/docs-url.js +4 -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 +1 -1
- package/dist/find-output-file-in-bucket.d.ts +16 -0
- package/dist/find-output-file-in-bucket.js +41 -0
- package/dist/format-costs-info.d.ts +2 -0
- package/dist/format-costs-info.js +23 -0
- package/dist/get-browser-instance.d.ts +5 -12
- package/dist/get-browser-instance.js +8 -7
- package/dist/get-custom-out-name.d.ts +1 -1
- package/dist/get-or-create-bucket.d.ts +1 -1
- 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/handlers/check-version-mismatch.d.ts +8 -0
- package/dist/handlers/check-version-mismatch.js +23 -0
- package/dist/handlers/compositions.d.ts +16 -0
- package/dist/handlers/compositions.js +81 -0
- package/dist/handlers/launch.d.ts +18 -0
- package/dist/handlers/launch.js +600 -0
- package/dist/handlers/progress.d.ts +16 -0
- package/dist/handlers/progress.js +54 -0
- package/dist/handlers/renderer.d.ts +24 -0
- package/dist/handlers/renderer.js +344 -0
- package/dist/handlers/start.d.ts +19 -0
- package/dist/handlers/start.js +104 -0
- package/dist/handlers/still.d.ts +21 -0
- package/dist/handlers/still.js +335 -0
- package/dist/index.d.ts +21 -5
- package/dist/index.js +54 -7
- package/dist/info.d.ts +1 -1
- package/dist/inner-routine.d.ts +22 -0
- package/dist/inner-routine.js +267 -0
- package/dist/inspect-error.d.ts +4 -0
- package/dist/inspect-error.js +39 -0
- package/dist/invoke-webhook.d.ts +42 -0
- package/dist/invoke-webhook.js +116 -0
- package/dist/is-warm.d.ts +2 -0
- package/dist/is-warm.js +10 -0
- package/dist/leak-detection.d.ts +4 -0
- package/dist/leak-detection.js +40 -0
- package/dist/make-bucket-name.d.ts +1 -1
- 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/merge-chunks.d.ts +38 -0
- package/dist/merge-chunks.js +92 -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/on-downloads-helpers.d.ts +2 -0
- package/dist/on-downloads-helpers.js +29 -0
- package/dist/overall-render-progress.d.ts +59 -0
- package/dist/overall-render-progress.js +180 -0
- package/dist/plan-frame-ranges.d.ts +7 -0
- package/dist/plan-frame-ranges.js +17 -0
- package/dist/print-logging-grep-helper.d.ts +4 -0
- package/dist/print-logging-grep-helper.js +12 -0
- package/dist/progress.d.ts +16 -0
- package/dist/progress.js +254 -0
- package/dist/provider-implementation.d.ts +152 -3
- 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 +1 -1
- package/dist/render-progress.d.ts +51 -0
- package/dist/return-values.d.ts +38 -0
- package/dist/return-values.js +2 -0
- package/dist/stackback.d.ts +6 -0
- package/dist/stackback.js +59 -0
- package/dist/stream-renderer.d.ts +17 -0
- package/dist/stream-renderer.js +148 -0
- package/dist/streaming/streaming.d.ts +6 -6
- package/dist/streaming/streaming.js +3 -3
- package/dist/types.d.ts +55 -0
- package/dist/types.js +2 -0
- package/dist/validate-composition.d.ts +1 -1
- package/dist/validate-composition.js +11 -1
- 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-privacy.d.ts +2 -0
- package/dist/validate-privacy.js +14 -0
- package/dist/validate.d.ts +4 -0
- package/dist/validate.js +8 -0
- package/dist/why-is-node-running.d.ts +15 -0
- package/dist/why-is-node-running.js +89 -0
- package/dist/{write-lambda-error.d.ts → write-error-to-storage.d.ts} +4 -4
- package/package.json +6 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/compositions.d.ts +0 -11
- package/dist/compositions.js +0 -82
- package/dist/still.d.ts +0 -28
- /package/dist/{still.js → render-progress.js} +0 -0
- /package/dist/{write-lambda-error.js → write-error-to-storage.js} +0 -0
package/dist/progress.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProgress = void 0;
|
|
4
|
+
const pure_1 = require("@remotion/renderer/pure");
|
|
5
|
+
const no_react_1 = require("remotion/no-react");
|
|
6
|
+
const calculate_chunk_times_1 = require("./calculate-chunk-times");
|
|
7
|
+
const estimate_price_from_bucket_1 = require("./estimate-price-from-bucket");
|
|
8
|
+
const expected_out_name_1 = require("./expected-out-name");
|
|
9
|
+
const format_costs_info_1 = require("./format-costs-info");
|
|
10
|
+
const get_overall_progress_1 = require("./get-overall-progress");
|
|
11
|
+
const get_overall_progress_from_storage_1 = require("./get-overall-progress-from-storage");
|
|
12
|
+
const inspect_error_1 = require("./inspect-error");
|
|
13
|
+
const make_timeout_error_1 = require("./make-timeout-error");
|
|
14
|
+
const render_has_audio_video_1 = require("./render-has-audio-video");
|
|
15
|
+
const truthy_1 = require("./truthy");
|
|
16
|
+
const getProgress = async ({ bucketName, renderId, expectedBucketOwner, region, memorySizeInMb, timeoutInMilliseconds, customCredentials, providerSpecifics, forcePathStyle, functionName, }) => {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
18
|
+
const overallProgress = await (0, get_overall_progress_from_storage_1.getOverallProgressFromStorage)({
|
|
19
|
+
renderId,
|
|
20
|
+
bucketName,
|
|
21
|
+
expectedBucketOwner,
|
|
22
|
+
region,
|
|
23
|
+
providerSpecifics,
|
|
24
|
+
forcePathStyle,
|
|
25
|
+
});
|
|
26
|
+
if (overallProgress.postRenderData) {
|
|
27
|
+
if (!overallProgress.renderMetadata) {
|
|
28
|
+
throw new Error('No render metadata found even though render is finished');
|
|
29
|
+
}
|
|
30
|
+
if (overallProgress.renderMetadata.type === 'still') {
|
|
31
|
+
throw new Error("You don't need to call getRenderProgress() on a still render. Once you have obtained the `renderId`, the render is already done! 😉");
|
|
32
|
+
}
|
|
33
|
+
const outData = (0, expected_out_name_1.getExpectedOutName)(overallProgress.renderMetadata, bucketName, customCredentials);
|
|
34
|
+
const totalFrameCount = pure_1.NoReactAPIs.getFramesToRender(overallProgress.renderMetadata.frameRange, overallProgress.renderMetadata.everyNthFrame).length;
|
|
35
|
+
return {
|
|
36
|
+
framesRendered: totalFrameCount,
|
|
37
|
+
bucket: bucketName,
|
|
38
|
+
renderSize: overallProgress.postRenderData.renderSize,
|
|
39
|
+
chunks: overallProgress.renderMetadata.totalChunks,
|
|
40
|
+
cleanup: {
|
|
41
|
+
doneIn: overallProgress.postRenderData.timeToCleanUp,
|
|
42
|
+
filesDeleted: overallProgress.postRenderData.filesCleanedUp,
|
|
43
|
+
minFilesToDelete: overallProgress.postRenderData.filesCleanedUp,
|
|
44
|
+
},
|
|
45
|
+
costs: {
|
|
46
|
+
accruedSoFar: overallProgress.postRenderData.cost.estimatedCost,
|
|
47
|
+
displayCost: overallProgress.postRenderData.cost.estimatedDisplayCost,
|
|
48
|
+
currency: overallProgress.postRenderData.cost.currency,
|
|
49
|
+
disclaimer: overallProgress.postRenderData.cost.disclaimer,
|
|
50
|
+
},
|
|
51
|
+
currentTime: Date.now(),
|
|
52
|
+
done: true,
|
|
53
|
+
encodingStatus: {
|
|
54
|
+
framesEncoded: totalFrameCount,
|
|
55
|
+
combinedFrames: totalFrameCount,
|
|
56
|
+
timeToCombine: overallProgress.postRenderData.timeToCombine,
|
|
57
|
+
},
|
|
58
|
+
errors: overallProgress.postRenderData.errors,
|
|
59
|
+
fatalErrorEncountered: false,
|
|
60
|
+
lambdasInvoked: overallProgress.renderMetadata.totalChunks,
|
|
61
|
+
outputFile: overallProgress.postRenderData.outputFile,
|
|
62
|
+
renderId,
|
|
63
|
+
timeToFinish: overallProgress.postRenderData.timeToFinish,
|
|
64
|
+
timeToFinishChunks: overallProgress.postRenderData.timeToRenderChunks,
|
|
65
|
+
timeToRenderFrames: overallProgress.postRenderData.timeToRenderFrames,
|
|
66
|
+
overallProgress: 1,
|
|
67
|
+
retriesInfo: overallProgress.postRenderData.retriesInfo,
|
|
68
|
+
outKey: outData.key,
|
|
69
|
+
outBucket: outData.renderBucketName,
|
|
70
|
+
mostExpensiveFrameRanges: (_a = overallProgress.postRenderData.mostExpensiveFrameRanges) !== null && _a !== void 0 ? _a : null,
|
|
71
|
+
timeToEncode: overallProgress.postRenderData.timeToEncode,
|
|
72
|
+
outputSizeInBytes: overallProgress.postRenderData.outputSize,
|
|
73
|
+
type: 'success',
|
|
74
|
+
estimatedBillingDurationInMilliseconds: overallProgress.postRenderData.estimatedBillingDurationInMilliseconds,
|
|
75
|
+
timeToCombine: overallProgress.postRenderData.timeToCombine,
|
|
76
|
+
combinedFrames: totalFrameCount,
|
|
77
|
+
renderMetadata: overallProgress.renderMetadata,
|
|
78
|
+
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
79
|
+
compositionValidated: overallProgress.compositionValidated,
|
|
80
|
+
functionLaunched: overallProgress.functionLaunched,
|
|
81
|
+
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
82
|
+
artifacts: overallProgress.receivedArtifact,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const { renderMetadata } = overallProgress;
|
|
86
|
+
const errorExplanations = (0, inspect_error_1.inspectErrors)({
|
|
87
|
+
errors: overallProgress.errors,
|
|
88
|
+
});
|
|
89
|
+
const { hasAudio, hasVideo } = renderMetadata
|
|
90
|
+
? (0, render_has_audio_video_1.lambdaRenderHasAudioVideo)(renderMetadata)
|
|
91
|
+
: { hasAudio: false, hasVideo: false };
|
|
92
|
+
const chunkCount = (_b = overallProgress.chunks.length) !== null && _b !== void 0 ? _b : 0;
|
|
93
|
+
const cleanup = {
|
|
94
|
+
doneIn: null,
|
|
95
|
+
minFilesToDelete: 0,
|
|
96
|
+
filesDeleted: 0,
|
|
97
|
+
};
|
|
98
|
+
if (renderMetadata === null) {
|
|
99
|
+
return {
|
|
100
|
+
framesRendered: (_c = overallProgress.framesRendered) !== null && _c !== void 0 ? _c : 0,
|
|
101
|
+
chunks: chunkCount,
|
|
102
|
+
done: false,
|
|
103
|
+
encodingStatus: {
|
|
104
|
+
framesEncoded: overallProgress.framesEncoded,
|
|
105
|
+
combinedFrames: overallProgress.combinedFrames,
|
|
106
|
+
timeToCombine: overallProgress.timeToCombine,
|
|
107
|
+
},
|
|
108
|
+
timeToRenderFrames: overallProgress.timeToRenderFrames,
|
|
109
|
+
costs: (0, format_costs_info_1.formatCostsInfo)(0),
|
|
110
|
+
renderId,
|
|
111
|
+
renderMetadata,
|
|
112
|
+
bucket: bucketName,
|
|
113
|
+
outputFile: null,
|
|
114
|
+
timeToFinish: null,
|
|
115
|
+
errors: errorExplanations,
|
|
116
|
+
fatalErrorEncountered: errorExplanations.some((f) => f.isFatal && !f.willRetry),
|
|
117
|
+
currentTime: Date.now(),
|
|
118
|
+
renderSize: 0,
|
|
119
|
+
lambdasInvoked: (_d = overallProgress.lambdasInvoked) !== null && _d !== void 0 ? _d : 0,
|
|
120
|
+
cleanup,
|
|
121
|
+
timeToFinishChunks: null,
|
|
122
|
+
overallProgress: (0, get_overall_progress_1.getOverallProgress)({
|
|
123
|
+
encoding: 0,
|
|
124
|
+
invoking: 0,
|
|
125
|
+
frames: 0,
|
|
126
|
+
gotComposition: overallProgress.compositionValidated,
|
|
127
|
+
visitedServeUrl: overallProgress.serveUrlOpened,
|
|
128
|
+
invokedLambda: overallProgress.lambdasInvoked,
|
|
129
|
+
combining: 0,
|
|
130
|
+
}),
|
|
131
|
+
retriesInfo: (_e = overallProgress.retries) !== null && _e !== void 0 ? _e : [],
|
|
132
|
+
outKey: null,
|
|
133
|
+
outBucket: null,
|
|
134
|
+
mostExpensiveFrameRanges: null,
|
|
135
|
+
timeToEncode: overallProgress.timeToEncode,
|
|
136
|
+
outputSizeInBytes: null,
|
|
137
|
+
estimatedBillingDurationInMilliseconds: null,
|
|
138
|
+
combinedFrames: (_f = overallProgress.combinedFrames) !== null && _f !== void 0 ? _f : 0,
|
|
139
|
+
timeToCombine: (_g = overallProgress.timeToCombine) !== null && _g !== void 0 ? _g : null,
|
|
140
|
+
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
141
|
+
type: 'success',
|
|
142
|
+
compositionValidated: overallProgress.compositionValidated,
|
|
143
|
+
functionLaunched: overallProgress.functionLaunched,
|
|
144
|
+
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
145
|
+
artifacts: overallProgress.receivedArtifact,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const priceFromBucket = (0, estimate_price_from_bucket_1.estimatePriceFromMetadata)({
|
|
149
|
+
renderMetadata,
|
|
150
|
+
memorySizeInMb,
|
|
151
|
+
functionsInvoked: (_h = renderMetadata.estimatedRenderLambdaInvokations) !== null && _h !== void 0 ? _h : 0,
|
|
152
|
+
diskSizeInMb: providerSpecifics.getEphemeralStorageForPriceCalculation(),
|
|
153
|
+
timings: (_j = overallProgress.timings) !== null && _j !== void 0 ? _j : [],
|
|
154
|
+
region,
|
|
155
|
+
providerSpecifics,
|
|
156
|
+
});
|
|
157
|
+
const chunkMultiplier = [hasAudio, hasVideo].filter(truthy_1.truthy).length;
|
|
158
|
+
if (renderMetadata.type === 'still') {
|
|
159
|
+
throw new Error("You don't need to call getRenderProgress() on a still render. Once you have obtained the `renderId`, the render is already done! 😉");
|
|
160
|
+
}
|
|
161
|
+
const allChunks = ((_k = overallProgress.chunks) !== null && _k !== void 0 ? _k : []).length / chunkMultiplier ===
|
|
162
|
+
((_l = renderMetadata.totalChunks) !== null && _l !== void 0 ? _l : Infinity);
|
|
163
|
+
const frameCount = pure_1.NoReactAPIs.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length;
|
|
164
|
+
const missingChunks = new Array(renderMetadata.totalChunks)
|
|
165
|
+
.fill(true)
|
|
166
|
+
.map((_, i) => i)
|
|
167
|
+
.filter((index) => {
|
|
168
|
+
var _a;
|
|
169
|
+
return (typeof ((_a = overallProgress.chunks) !== null && _a !== void 0 ? _a : []).find((c) => c === index) ===
|
|
170
|
+
'undefined');
|
|
171
|
+
});
|
|
172
|
+
// We add a 20 second buffer for it, since AWS timeshifts can be quite a lot. Once it's 20sec over the limit, we consider it timed out
|
|
173
|
+
// 1. If we have missing chunks, we consider it timed out
|
|
174
|
+
const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 &&
|
|
175
|
+
missingChunks &&
|
|
176
|
+
missingChunks.length > 0;
|
|
177
|
+
// 2. If we have no missing chunks, but the encoding is not done, even after the additional `merge` function has been spawned, we consider it timed out
|
|
178
|
+
const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
|
|
179
|
+
const allErrors = [
|
|
180
|
+
isBeyondTimeoutAndMissingChunks || isBeyondTimeoutAndHasStitchTimeout
|
|
181
|
+
? (0, make_timeout_error_1.makeTimeoutError)({
|
|
182
|
+
timeoutInMilliseconds,
|
|
183
|
+
renderMetadata,
|
|
184
|
+
renderId,
|
|
185
|
+
missingChunks: missingChunks !== null && missingChunks !== void 0 ? missingChunks : [],
|
|
186
|
+
region,
|
|
187
|
+
functionName,
|
|
188
|
+
providerSpecifics,
|
|
189
|
+
})
|
|
190
|
+
: null,
|
|
191
|
+
...errorExplanations,
|
|
192
|
+
].filter(no_react_1.NoReactInternals.truthy);
|
|
193
|
+
return {
|
|
194
|
+
framesRendered: (_m = overallProgress.framesRendered) !== null && _m !== void 0 ? _m : 0,
|
|
195
|
+
chunks: chunkCount,
|
|
196
|
+
done: false,
|
|
197
|
+
encodingStatus: {
|
|
198
|
+
framesEncoded: overallProgress.framesEncoded,
|
|
199
|
+
combinedFrames: overallProgress.combinedFrames,
|
|
200
|
+
timeToCombine: overallProgress.timeToCombine,
|
|
201
|
+
},
|
|
202
|
+
timeToRenderFrames: overallProgress.timeToRenderFrames,
|
|
203
|
+
costs: priceFromBucket
|
|
204
|
+
? (0, format_costs_info_1.formatCostsInfo)(priceFromBucket.accruedSoFar)
|
|
205
|
+
: (0, format_costs_info_1.formatCostsInfo)(0),
|
|
206
|
+
renderId,
|
|
207
|
+
renderMetadata,
|
|
208
|
+
bucket: bucketName,
|
|
209
|
+
outputFile: null,
|
|
210
|
+
timeToFinish: null,
|
|
211
|
+
errors: allErrors,
|
|
212
|
+
fatalErrorEncountered: allErrors.some((f) => f.isFatal && !f.willRetry),
|
|
213
|
+
currentTime: Date.now(),
|
|
214
|
+
renderSize: 0,
|
|
215
|
+
lambdasInvoked: (_o = overallProgress.lambdasInvoked) !== null && _o !== void 0 ? _o : 0,
|
|
216
|
+
cleanup,
|
|
217
|
+
timeToFinishChunks: allChunks && overallProgress
|
|
218
|
+
? (0, calculate_chunk_times_1.calculateChunkTimes)({
|
|
219
|
+
type: 'absolute-time',
|
|
220
|
+
timings: overallProgress.timings,
|
|
221
|
+
})
|
|
222
|
+
: null,
|
|
223
|
+
overallProgress: (0, get_overall_progress_1.getOverallProgress)({
|
|
224
|
+
encoding: frameCount
|
|
225
|
+
? ((_p = overallProgress.framesEncoded) !== null && _p !== void 0 ? _p : 0) / frameCount
|
|
226
|
+
: 0,
|
|
227
|
+
invoking: ((_q = overallProgress.lambdasInvoked) !== null && _q !== void 0 ? _q : 0) /
|
|
228
|
+
renderMetadata.estimatedRenderLambdaInvokations,
|
|
229
|
+
frames: ((_r = overallProgress.framesRendered) !== null && _r !== void 0 ? _r : 0) / (frameCount !== null && frameCount !== void 0 ? frameCount : 1),
|
|
230
|
+
gotComposition: overallProgress.compositionValidated,
|
|
231
|
+
visitedServeUrl: overallProgress.serveUrlOpened,
|
|
232
|
+
invokedLambda: overallProgress.lambdasInvoked,
|
|
233
|
+
combining: overallProgress.combinedFrames / (frameCount !== null && frameCount !== void 0 ? frameCount : 1),
|
|
234
|
+
}),
|
|
235
|
+
retriesInfo: (_s = overallProgress.retries) !== null && _s !== void 0 ? _s : [],
|
|
236
|
+
outKey: null,
|
|
237
|
+
outBucket: null,
|
|
238
|
+
mostExpensiveFrameRanges: null,
|
|
239
|
+
timeToEncode: overallProgress.timeToEncode,
|
|
240
|
+
outputSizeInBytes: null,
|
|
241
|
+
estimatedBillingDurationInMilliseconds: priceFromBucket
|
|
242
|
+
? priceFromBucket.estimatedBillingDurationInMilliseconds
|
|
243
|
+
: null,
|
|
244
|
+
combinedFrames: (_t = overallProgress.combinedFrames) !== null && _t !== void 0 ? _t : 0,
|
|
245
|
+
timeToCombine: (_u = overallProgress.timeToCombine) !== null && _u !== void 0 ? _u : null,
|
|
246
|
+
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
247
|
+
type: 'success',
|
|
248
|
+
compositionValidated: overallProgress.compositionValidated,
|
|
249
|
+
functionLaunched: overallProgress.functionLaunched,
|
|
250
|
+
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
251
|
+
artifacts: overallProgress.receivedArtifact,
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
exports.getProgress = getProgress;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { bundle } from '@remotion/bundler';
|
|
2
|
+
import type { ChromiumOptions, EmittedArtifact, LogLevel } from '@remotion/renderer';
|
|
2
3
|
import type { Readable } from 'stream';
|
|
3
|
-
import type { CustomCredentials, DownloadBehavior, Privacy } from './constants';
|
|
4
|
+
import type { CustomCredentials, DeleteAfter, DownloadBehavior, Privacy, ServerlessRoutines } from './constants';
|
|
5
|
+
import type { LaunchedBrowser } from './get-browser-instance';
|
|
4
6
|
import type { GetFolderFiles } from './get-files-in-folder';
|
|
5
|
-
import type {
|
|
7
|
+
import type { RenderMetadata } from './render-metadata';
|
|
8
|
+
import type { ServerlessReturnValues } from './return-values';
|
|
9
|
+
import type { OnMessage } from './streaming/streaming';
|
|
10
|
+
import type { CallFunctionOptions, CloudProvider, ReceivedArtifact } from './types';
|
|
6
11
|
export type BucketWithLocation<Provider extends CloudProvider> = {
|
|
7
12
|
name: string;
|
|
8
13
|
creationDate: number;
|
|
@@ -96,6 +101,134 @@ export type MakeArtifactWithDetails<Provider extends CloudProvider> = (params: {
|
|
|
96
101
|
storageKey: string;
|
|
97
102
|
artifact: EmittedArtifact;
|
|
98
103
|
}) => ReceivedArtifact<Provider>;
|
|
104
|
+
export type DebuggingTimer = (label: string, logLevel: LogLevel) => {
|
|
105
|
+
end: () => void;
|
|
106
|
+
};
|
|
107
|
+
export type CallFunctionAsync<Provider extends CloudProvider> = <T extends ServerlessRoutines>({ functionName, payload, region, timeoutInTest, }: CallFunctionOptions<T, Provider>) => Promise<void>;
|
|
108
|
+
export type CallFunctionStreaming<Provider extends CloudProvider> = <T extends ServerlessRoutines>(options: CallFunctionOptions<T, Provider> & {
|
|
109
|
+
receivedStreamingPayload: OnMessage<Provider>;
|
|
110
|
+
retriesRemaining: number;
|
|
111
|
+
}) => Promise<void>;
|
|
112
|
+
export type CallFunctionSync<Provider extends CloudProvider> = <T extends ServerlessRoutines>({ functionName, payload, region, timeoutInTest, }: CallFunctionOptions<T, Provider>) => Promise<ServerlessReturnValues<Provider>[T]>;
|
|
113
|
+
export type EstimatePriceInput<Provider extends CloudProvider> = {
|
|
114
|
+
region: Provider['region'];
|
|
115
|
+
memorySizeInMb: number;
|
|
116
|
+
diskSizeInMb: number;
|
|
117
|
+
lambdasInvoked: number;
|
|
118
|
+
durationInMilliseconds: number;
|
|
119
|
+
};
|
|
120
|
+
export type EstimatePrice<Provider extends CloudProvider> = ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }: EstimatePriceInput<Provider>) => number;
|
|
121
|
+
export type GetLoggingUrlForRendererFunction<Provider extends CloudProvider> = (options: {
|
|
122
|
+
region: Provider['region'];
|
|
123
|
+
functionName: string;
|
|
124
|
+
rendererFunctionName: string | null;
|
|
125
|
+
renderId: string;
|
|
126
|
+
chunk: null | number;
|
|
127
|
+
}) => string;
|
|
128
|
+
export type GetLoggingUrlForMethod<Provider extends CloudProvider> = (options: {
|
|
129
|
+
region: Provider['region'];
|
|
130
|
+
functionName: string;
|
|
131
|
+
method: ServerlessRoutines;
|
|
132
|
+
rendererFunctionName: string | null;
|
|
133
|
+
renderId: string;
|
|
134
|
+
}) => string;
|
|
135
|
+
export type GetOutputUrl<Provider extends CloudProvider> = (options: {
|
|
136
|
+
renderMetadata: RenderMetadata<Provider>;
|
|
137
|
+
bucketName: string;
|
|
138
|
+
customCredentials: CustomCredentials<Provider> | null;
|
|
139
|
+
currentRegion: Provider['region'];
|
|
140
|
+
}) => {
|
|
141
|
+
url: string;
|
|
142
|
+
key: string;
|
|
143
|
+
};
|
|
144
|
+
export type GetBrowserInstance = <Provider extends CloudProvider>({ logLevel, indent, chromiumOptions, providerSpecifics, insideFunctionSpecifics, }: {
|
|
145
|
+
logLevel: LogLevel;
|
|
146
|
+
indent: boolean;
|
|
147
|
+
chromiumOptions: ChromiumOptions;
|
|
148
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
149
|
+
insideFunctionSpecifics: InsideFunctionSpecifics;
|
|
150
|
+
}) => Promise<LaunchedBrowser>;
|
|
151
|
+
export type ForgetBrowserEventLoop = (logLevel: LogLevel) => void;
|
|
152
|
+
export type GenerateRenderId = (options: {
|
|
153
|
+
deleteAfter: DeleteAfter | null;
|
|
154
|
+
randomHashFn: () => string;
|
|
155
|
+
}) => string;
|
|
156
|
+
export type GetAccountId<Provider extends CloudProvider> = (options: {
|
|
157
|
+
region: Provider['region'];
|
|
158
|
+
}) => Promise<string>;
|
|
159
|
+
export type DeleteFunctionInput<Provider extends CloudProvider> = {
|
|
160
|
+
region: Provider['region'];
|
|
161
|
+
functionName: string;
|
|
162
|
+
};
|
|
163
|
+
export type DeleteFunction<Provider extends CloudProvider> = (options: DeleteFunctionInput<Provider>) => Promise<void>;
|
|
164
|
+
export type GetFunctionsInput<Provider extends CloudProvider> = {
|
|
165
|
+
region: Provider['region'];
|
|
166
|
+
compatibleOnly: boolean;
|
|
167
|
+
logLevel?: LogLevel;
|
|
168
|
+
};
|
|
169
|
+
export type FunctionInfo = {
|
|
170
|
+
functionName: string;
|
|
171
|
+
timeoutInSeconds: number;
|
|
172
|
+
memorySizeInMb: number;
|
|
173
|
+
version: string | null;
|
|
174
|
+
diskSizeInMb: number;
|
|
175
|
+
};
|
|
176
|
+
export type GetFunctions<Provider extends CloudProvider> = (params: GetFunctionsInput<Provider>) => Promise<FunctionInfo[]>;
|
|
177
|
+
export type ReadDir = ({ dir, etags, originalDir, onProgress, }: {
|
|
178
|
+
dir: string;
|
|
179
|
+
etags: {
|
|
180
|
+
[key: string]: () => Promise<string>;
|
|
181
|
+
};
|
|
182
|
+
originalDir: string;
|
|
183
|
+
onProgress: (bytes: number) => void;
|
|
184
|
+
}) => {
|
|
185
|
+
[key: string]: () => Promise<string>;
|
|
186
|
+
};
|
|
187
|
+
export type UploadDirProgress = {
|
|
188
|
+
totalFiles: number;
|
|
189
|
+
filesUploaded: number;
|
|
190
|
+
totalSize: number;
|
|
191
|
+
sizeUploaded: number;
|
|
192
|
+
};
|
|
193
|
+
export type UploadDir<Provider extends CloudProvider> = (options: {
|
|
194
|
+
bucket: string;
|
|
195
|
+
region: Provider['region'];
|
|
196
|
+
localDir: string;
|
|
197
|
+
keyPrefix: string;
|
|
198
|
+
onProgress: (progress: UploadDirProgress) => void;
|
|
199
|
+
privacy: Privacy;
|
|
200
|
+
toUpload: string[];
|
|
201
|
+
forcePathStyle: boolean;
|
|
202
|
+
}) => Promise<void>;
|
|
203
|
+
type CreateFunctionOptions<Provider extends CloudProvider> = {
|
|
204
|
+
region: Provider['region'];
|
|
205
|
+
logLevel: LogLevel;
|
|
206
|
+
ephemerealStorageInMb: number;
|
|
207
|
+
timeoutInSeconds: number;
|
|
208
|
+
memorySizeInMb: number;
|
|
209
|
+
functionName: string;
|
|
210
|
+
zipFile: string;
|
|
211
|
+
} & Provider['creationFunctionOptions'];
|
|
212
|
+
export type CreateFunction<Provider extends CloudProvider> = (options: CreateFunctionOptions<Provider>) => Promise<{
|
|
213
|
+
FunctionName: string;
|
|
214
|
+
}>;
|
|
215
|
+
export type InsideFunctionSpecifics = {
|
|
216
|
+
getBrowserInstance: GetBrowserInstance;
|
|
217
|
+
forgetBrowserEventLoop: ForgetBrowserEventLoop;
|
|
218
|
+
timer: DebuggingTimer;
|
|
219
|
+
generateRandomId: GenerateRenderId;
|
|
220
|
+
deleteTmpDir: () => Promise<void>;
|
|
221
|
+
getCurrentFunctionName: () => string;
|
|
222
|
+
getCurrentMemorySizeInMb: () => number;
|
|
223
|
+
};
|
|
224
|
+
export type FullClientSpecifics<Provider extends CloudProvider> = {
|
|
225
|
+
id: '__remotion_full_client_specifics';
|
|
226
|
+
bundleSite: typeof bundle;
|
|
227
|
+
readDirectory: ReadDir;
|
|
228
|
+
uploadDir: UploadDir<Provider>;
|
|
229
|
+
createFunction: CreateFunction<Provider>;
|
|
230
|
+
checkCredentials: () => void;
|
|
231
|
+
};
|
|
99
232
|
export type ProviderSpecifics<Provider extends CloudProvider> = {
|
|
100
233
|
getChromiumPath: () => string | null;
|
|
101
234
|
getCurrentRegionInFunction: () => Provider['region'];
|
|
@@ -113,5 +246,21 @@ export type ProviderSpecifics<Provider extends CloudProvider> = {
|
|
|
113
246
|
printLoggingHelper: boolean;
|
|
114
247
|
getFolderFiles: GetFolderFiles;
|
|
115
248
|
makeArtifactWithDetails: MakeArtifactWithDetails<Provider>;
|
|
249
|
+
validateDeleteAfter: (lifeCycleValue: unknown) => void;
|
|
250
|
+
callFunctionAsync: CallFunctionAsync<Provider>;
|
|
251
|
+
callFunctionStreaming: CallFunctionStreaming<Provider>;
|
|
252
|
+
callFunctionSync: CallFunctionSync<Provider>;
|
|
253
|
+
estimatePrice: EstimatePrice<Provider>;
|
|
254
|
+
getLoggingUrlForRendererFunction: GetLoggingUrlForRendererFunction<Provider>;
|
|
255
|
+
getLoggingUrlForMethod: GetLoggingUrlForMethod<Provider>;
|
|
256
|
+
getEphemeralStorageForPriceCalculation: () => number;
|
|
257
|
+
getOutputUrl: GetOutputUrl<Provider>;
|
|
258
|
+
isFlakyError: (err: Error) => boolean;
|
|
259
|
+
serverStorageProductName: () => string;
|
|
260
|
+
getMaxStillInlinePayloadSize: () => number;
|
|
261
|
+
getMaxNonInlinePayloadSizePerFunction: () => number;
|
|
262
|
+
getAccountId: GetAccountId<Provider>;
|
|
263
|
+
deleteFunction: DeleteFunction<Provider>;
|
|
264
|
+
getFunctions: GetFunctions<Provider>;
|
|
116
265
|
};
|
|
117
266
|
export {};
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AudioCodec, DeleteAfter, StillImageFormat, VideoImageFormat } from '@remotion/renderer';
|
|
2
2
|
import type { DownloadBehavior, OutNameInputWithoutCredentials, Privacy, SerializedInputProps, ServerlessCodec } from './constants';
|
|
3
|
-
import type { CloudProvider } from './
|
|
3
|
+
import type { CloudProvider } from './types';
|
|
4
4
|
type Discriminated = {
|
|
5
5
|
type: 'still';
|
|
6
6
|
imageFormat: StillImageFormat;
|
|
@@ -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,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stackback = void 0;
|
|
4
|
+
function FormatStackTrace(error, frames) {
|
|
5
|
+
const lines = [];
|
|
6
|
+
try {
|
|
7
|
+
lines.push(error.toString());
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
try {
|
|
11
|
+
lines.push('<error: ' + e + '>');
|
|
12
|
+
}
|
|
13
|
+
catch (_a) {
|
|
14
|
+
lines.push('<error>');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (let i = 0; i < frames.length; i++) {
|
|
18
|
+
const frame = frames[i];
|
|
19
|
+
let line;
|
|
20
|
+
try {
|
|
21
|
+
line = frame.toString();
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
try {
|
|
25
|
+
line = '<error: ' + e + '>';
|
|
26
|
+
}
|
|
27
|
+
catch (_b) {
|
|
28
|
+
// Any code that reaches this point is seriously nasty!
|
|
29
|
+
line = '<error>';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lines.push(' at ' + line);
|
|
33
|
+
}
|
|
34
|
+
return lines.join('\n');
|
|
35
|
+
}
|
|
36
|
+
const stackback = (error) => {
|
|
37
|
+
// save original stacktrace
|
|
38
|
+
const save = Error.prepareStackTrace;
|
|
39
|
+
// replace capture with our function
|
|
40
|
+
Error.prepareStackTrace = function (err, trace) {
|
|
41
|
+
// cache stack frames so we don't have to get them again
|
|
42
|
+
// use a non-enumerable property
|
|
43
|
+
Object.defineProperty(err, '_sb_callsites', {
|
|
44
|
+
value: trace,
|
|
45
|
+
});
|
|
46
|
+
return (save || FormatStackTrace)(err, trace);
|
|
47
|
+
};
|
|
48
|
+
// force capture of the stack frames
|
|
49
|
+
// eslint-disable-next-line no-unused-expressions
|
|
50
|
+
error.stack;
|
|
51
|
+
// someone already asked for the stack so we can't do this trick
|
|
52
|
+
if (!error._sb_callsites) {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
// return original capture function
|
|
56
|
+
Error.prepareStackTrace = save;
|
|
57
|
+
return error._sb_callsites;
|
|
58
|
+
};
|
|
59
|
+
exports.stackback = stackback;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EmittedArtifact, LogLevel } from '@remotion/renderer';
|
|
2
|
+
import type { ServerlessPayload } from './constants';
|
|
3
|
+
import type { OverallProgressHelper } from './overall-render-progress';
|
|
4
|
+
import type { ProviderSpecifics } from './provider-implementation';
|
|
5
|
+
import type { CloudProvider } from './types';
|
|
6
|
+
export declare const streamRendererFunctionWithRetry: <Provider extends CloudProvider>({ payload, files, functionName, outdir, overallProgress, logLevel, onArtifact, providerSpecifics, }: {
|
|
7
|
+
payload: ServerlessPayload<Provider>;
|
|
8
|
+
functionName: string;
|
|
9
|
+
outdir: string;
|
|
10
|
+
overallProgress: OverallProgressHelper<Provider>;
|
|
11
|
+
files: string[];
|
|
12
|
+
logLevel: LogLevel;
|
|
13
|
+
onArtifact: (asset: EmittedArtifact) => {
|
|
14
|
+
alreadyExisted: boolean;
|
|
15
|
+
};
|
|
16
|
+
providerSpecifics: ProviderSpecifics<Provider>;
|
|
17
|
+
}) => Promise<unknown>;
|