@remotion/cloudrun 4.1.0-alpha10
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-build.log +13 -0
- package/LICENSE.md +41 -0
- package/dist/admin/bundle-installer.d.ts +1 -0
- package/dist/admin/bundle-installer.js +32 -0
- package/dist/admin/bundle-renderLogic.d.ts +1 -0
- package/dist/admin/bundle-renderLogic.js +39 -0
- package/dist/api/check-if-service-exists.d.ts +18 -0
- package/dist/api/check-if-service-exists.js +49 -0
- package/dist/api/create-bucket.d.ts +13 -0
- package/dist/api/create-bucket.js +18 -0
- package/dist/api/delete-service.d.ts +12 -0
- package/dist/api/delete-service.js +19 -0
- package/dist/api/delete-site.d.ts +13 -0
- package/dist/api/delete-site.js +30 -0
- package/dist/api/deploy-service.d.ts +28 -0
- package/dist/api/deploy-service.js +90 -0
- package/dist/api/deploy-site.d.ts +35 -0
- package/dist/api/deploy-site.js +78 -0
- package/dist/api/download-file.d.ts +13 -0
- package/dist/api/download-file.js +30 -0
- package/dist/api/get-buckets.d.ts +10 -0
- package/dist/api/get-buckets.js +23 -0
- package/dist/api/get-or-create-bucket.d.ts +17 -0
- package/dist/api/get-or-create-bucket.js +42 -0
- package/dist/api/get-regions.d.ts +7 -0
- package/dist/api/get-regions.js +13 -0
- package/dist/api/get-service-info.d.ts +23 -0
- package/dist/api/get-service-info.js +34 -0
- package/dist/api/get-services.d.ts +14 -0
- package/dist/api/get-services.js +49 -0
- package/dist/api/get-sites.d.ts +23 -0
- package/dist/api/get-sites.js +49 -0
- package/dist/api/helpers/IService.d.ts +2 -0
- package/dist/api/helpers/IService.js +2 -0
- package/dist/api/helpers/construct-service-deploy-request.d.ts +32 -0
- package/dist/api/helpers/construct-service-deploy-request.js +36 -0
- package/dist/api/helpers/extract-mem-from-url.d.ts +1 -0
- package/dist/api/helpers/extract-mem-from-url.js +9 -0
- package/dist/api/helpers/extract-time-from-url.d.ts +1 -0
- package/dist/api/helpers/extract-time-from-url.js +13 -0
- package/dist/api/helpers/get-auth-client-for-url.d.ts +1 -0
- package/dist/api/helpers/get-auth-client-for-url.js +15 -0
- package/dist/api/helpers/get-cloud-logging-client.d.ts +1 -0
- package/dist/api/helpers/get-cloud-logging-client.js +15 -0
- package/dist/api/helpers/get-cloud-run-client.d.ts +2 -0
- package/dist/api/helpers/get-cloud-run-client.js +15 -0
- package/dist/api/helpers/get-cloud-storage-client.d.ts +2 -0
- package/dist/api/helpers/get-cloud-storage-client.js +14 -0
- package/dist/api/helpers/get-cloudrun-endpoint.d.ts +14 -0
- package/dist/api/helpers/get-cloudrun-endpoint.js +36 -0
- package/dist/api/helpers/get-resource-manager-client.d.ts +2 -0
- package/dist/api/helpers/get-resource-manager-client.js +15 -0
- package/dist/api/helpers/parse-service-name.d.ts +8 -0
- package/dist/api/helpers/parse-service-name.js +24 -0
- package/dist/api/iam-validation/testPermissions.d.ts +20 -0
- package/dist/api/iam-validation/testPermissions.js +48 -0
- package/dist/api/render-media-on-cloudrun.d.ts +78 -0
- package/dist/api/render-media-on-cloudrun.js +144 -0
- package/dist/api/render-still-on-cloudrun.d.ts +49 -0
- package/dist/api/render-still-on-cloudrun.js +76 -0
- package/dist/api/speculate-service-name.d.ts +13 -0
- package/dist/api/speculate-service-name.js +20 -0
- package/dist/api/test/service-names.test.d.ts +1 -0
- package/dist/api/test/service-names.test.js +28 -0
- package/dist/api/upload-dir.d.ts +18 -0
- package/dist/api/upload-dir.js +81 -0
- package/dist/cli/args.d.ts +19 -0
- package/dist/cli/args.js +11 -0
- package/dist/cli/commands/permissions.d.ts +2 -0
- package/dist/cli/commands/permissions.js +23 -0
- package/dist/cli/commands/regions.d.ts +2 -0
- package/dist/cli/commands/regions.js +10 -0
- package/dist/cli/commands/render/helpers/renderArgsCheck.d.ts +9 -0
- package/dist/cli/commands/render/helpers/renderArgsCheck.js +75 -0
- package/dist/cli/commands/render/index.d.ts +2 -0
- package/dist/cli/commands/render/index.js +228 -0
- package/dist/cli/commands/services/deploy.d.ts +2 -0
- package/dist/cli/commands/services/deploy.js +129 -0
- package/dist/cli/commands/services/index.d.ts +5 -0
- package/dist/cli/commands/services/index.js +64 -0
- package/dist/cli/commands/services/ls.d.ts +2 -0
- package/dist/cli/commands/services/ls.js +40 -0
- package/dist/cli/commands/services/rm.d.ts +2 -0
- package/dist/cli/commands/services/rm.js +63 -0
- package/dist/cli/commands/services/rmall.d.ts +2 -0
- package/dist/cli/commands/services/rmall.js +52 -0
- package/dist/cli/commands/sites/create.d.ts +2 -0
- package/dist/cli/commands/sites/create.js +138 -0
- package/dist/cli/commands/sites/index.d.ts +4 -0
- package/dist/cli/commands/sites/index.js +60 -0
- package/dist/cli/commands/sites/ls.d.ts +2 -0
- package/dist/cli/commands/sites/ls.js +40 -0
- package/dist/cli/commands/sites/rm.d.ts +2 -0
- package/dist/cli/commands/sites/rm.js +59 -0
- package/dist/cli/commands/sites/rmall.d.ts +2 -0
- package/dist/cli/commands/sites/rmall.js +38 -0
- package/dist/cli/commands/still.d.ts +2 -0
- package/dist/cli/commands/still.js +129 -0
- package/dist/cli/get-gcp-region.d.ts +2 -0
- package/dist/cli/get-gcp-region.js +19 -0
- package/dist/cli/help.d.ts +1 -0
- package/dist/cli/help.js +38 -0
- package/dist/cli/helpers/confirm.d.ts +4 -0
- package/dist/cli/helpers/confirm.js +12 -0
- package/dist/cli/helpers/date-string.d.ts +1 -0
- package/dist/cli/helpers/date-string.js +9 -0
- package/dist/cli/helpers/progress-bar.d.ts +23 -0
- package/dist/cli/helpers/progress-bar.js +81 -0
- package/dist/cli/helpers/quit.d.ts +1 -0
- package/dist/cli/helpers/quit.js +7 -0
- package/dist/cli/helpers/yes-or-no.d.ts +4 -0
- package/dist/cli/helpers/yes-or-no.js +44 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +56 -0
- package/dist/cli/log.d.ts +26 -0
- package/dist/cli/log.js +5 -0
- package/dist/defaults.d.ts +1 -0
- package/dist/defaults.js +17 -0
- package/dist/functions/helpers/get-composition-from-body.d.ts +2 -0
- package/dist/functions/helpers/get-composition-from-body.js +27 -0
- package/dist/functions/helpers/io.d.ts +11 -0
- package/dist/functions/helpers/io.js +17 -0
- package/dist/functions/helpers/payloads.d.ts +300 -0
- package/dist/functions/helpers/payloads.js +104 -0
- package/dist/functions/index.d.ts +3 -0
- package/dist/functions/index.js +39 -0
- package/dist/functions/render-media-single-thread.d.ts +3 -0
- package/dist/functions/render-media-single-thread.js +103 -0
- package/dist/functions/render-still-single-thread.d.ts +3 -0
- package/dist/functions/render-still-single-thread.js +82 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +31 -0
- package/dist/internals.d.ts +3 -0
- package/dist/internals.js +7 -0
- package/dist/pricing/gcp-regions.d.ts +5 -0
- package/dist/pricing/gcp-regions.js +77 -0
- package/dist/regions.d.ts +2 -0
- package/dist/regions.js +5 -0
- package/dist/shared/bundle-site.d.ts +2 -0
- package/dist/shared/bundle-site.js +5 -0
- package/dist/shared/constants.d.ts +13 -0
- package/dist/shared/constants.js +18 -0
- package/dist/shared/convert-to-serve-url.d.ts +4 -0
- package/dist/shared/convert-to-serve-url.js +14 -0
- package/dist/shared/docs-url.d.ts +1 -0
- package/dist/shared/docs-url.js +4 -0
- package/dist/shared/generate-service-name.d.ts +5 -0
- package/dist/shared/generate-service-name.js +20 -0
- package/dist/shared/get-etag.d.ts +1 -0
- package/dist/shared/get-etag.js +24 -0
- package/dist/shared/get-storage-operations.d.ts +10 -0
- package/dist/shared/get-storage-operations.js +36 -0
- package/dist/shared/make-storage-key.d.ts +1 -0
- package/dist/shared/make-storage-key.js +11 -0
- package/dist/shared/make-storage-url.d.ts +4 -0
- package/dist/shared/make-storage-url.js +7 -0
- package/dist/shared/random-hash.d.ts +3 -0
- package/dist/shared/random-hash.js +14 -0
- package/dist/shared/read-dir.d.ts +9 -0
- package/dist/shared/read-dir.js +57 -0
- package/dist/shared/sa-permissions.json +64 -0
- package/dist/shared/service-version-string.d.ts +1 -0
- package/dist/shared/service-version-string.js +8 -0
- package/dist/shared/validate-bucketname.d.ts +8 -0
- package/dist/shared/validate-bucketname.js +35 -0
- package/dist/shared/validate-cloudrun-url.d.ts +1 -0
- package/dist/shared/validate-cloudrun-url.js +10 -0
- package/dist/shared/validate-gcp-codec.d.ts +4 -0
- package/dist/shared/validate-gcp-codec.js +29 -0
- package/dist/shared/validate-gcp-region.d.ts +2 -0
- package/dist/shared/validate-gcp-region.js +10 -0
- package/dist/shared/validate-image-remotion-version.d.ts +1 -0
- package/dist/shared/validate-image-remotion-version.js +26 -0
- package/dist/shared/validate-privacy.d.ts +2 -0
- package/dist/shared/validate-privacy.js +12 -0
- package/dist/shared/validate-project-id.d.ts +1 -0
- package/dist/shared/validate-project-id.js +17 -0
- package/dist/shared/validate-region.d.ts +1 -0
- package/dist/shared/validate-region.js +15 -0
- package/dist/shared/validate-retries.d.ts +1 -0
- package/dist/shared/validate-retries.js +21 -0
- package/dist/shared/validate-serveurl.d.ts +1 -0
- package/dist/shared/validate-serveurl.js +30 -0
- package/dist/shared/validate-service-name.d.ts +1 -0
- package/dist/shared/validate-service-name.js +9 -0
- package/dist/shared/validate-site-name.d.ts +1 -0
- package/dist/shared/validate-site-name.js +17 -0
- package/package.json +57 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloudRunPayload = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const client_1 = require("@remotion/renderer/client");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const codec = zod_1.z.enum(renderer_1.RenderInternals.validCodecs);
|
|
8
|
+
const audioCodec = zod_1.z.enum(renderer_1.RenderInternals.validAudioCodecs);
|
|
9
|
+
const pixelFormat = zod_1.z.enum(renderer_1.RenderInternals.validPixelFormats);
|
|
10
|
+
const videoImageFormat = zod_1.z.enum(renderer_1.RenderInternals.validVideoImageFormats);
|
|
11
|
+
const stillImageFormat = zod_1.z.enum(renderer_1.RenderInternals.validStillImageFormats);
|
|
12
|
+
const proResProfile = zod_1.z.enum(client_1.BrowserSafeApis.proResProfileOptions).nullable();
|
|
13
|
+
const chromiumOptions = zod_1.z.object({
|
|
14
|
+
ignoreCertificateErrors: zod_1.z.boolean().optional(),
|
|
15
|
+
disableWebSecurity: zod_1.z.boolean().optional(),
|
|
16
|
+
gl: zod_1.z.enum(renderer_1.RenderInternals.validOpenGlRenderers).optional().nullable(),
|
|
17
|
+
headless: zod_1.z.boolean().optional(),
|
|
18
|
+
userAgent: zod_1.z.string().optional().nullable(),
|
|
19
|
+
});
|
|
20
|
+
const logLevel = zod_1.z.enum(renderer_1.RenderInternals.logLevels);
|
|
21
|
+
exports.CloudRunPayload = zod_1.z.discriminatedUnion('type', [
|
|
22
|
+
zod_1.z.object({
|
|
23
|
+
type: zod_1.z.literal('media'),
|
|
24
|
+
serveUrl: zod_1.z.string(),
|
|
25
|
+
composition: zod_1.z.string(),
|
|
26
|
+
forceHeight: zod_1.z.number().optional().nullable(),
|
|
27
|
+
forceWidth: zod_1.z.number().optional().nullable(),
|
|
28
|
+
codec,
|
|
29
|
+
serializedInputPropsWithCustomSchema: zod_1.z.string(),
|
|
30
|
+
jpegQuality: zod_1.z.number(),
|
|
31
|
+
audioCodec: audioCodec.nullable(),
|
|
32
|
+
audioBitrate: zod_1.z.string().nullable(),
|
|
33
|
+
videoBitrate: zod_1.z.string().nullable(),
|
|
34
|
+
crf: zod_1.z.number().nullable(),
|
|
35
|
+
pixelFormat,
|
|
36
|
+
imageFormat: videoImageFormat,
|
|
37
|
+
scale: zod_1.z.number(),
|
|
38
|
+
proResProfile,
|
|
39
|
+
everyNthFrame: zod_1.z.number(),
|
|
40
|
+
numberOfGifLoops: zod_1.z.number().nullable(),
|
|
41
|
+
frameRange: zod_1.z.tuple([zod_1.z.number(), zod_1.z.number()]).or(zod_1.z.number()).nullable(),
|
|
42
|
+
envVariables: zod_1.z.record(zod_1.z.string()),
|
|
43
|
+
chromiumOptions: chromiumOptions.optional(),
|
|
44
|
+
muted: zod_1.z.boolean(),
|
|
45
|
+
outputBucket: zod_1.z.string(),
|
|
46
|
+
outName: zod_1.z.string().optional(),
|
|
47
|
+
privacy: zod_1.z.enum(['public', 'private']).optional(),
|
|
48
|
+
logLevel,
|
|
49
|
+
delayRenderTimeoutInMilliseconds: zod_1.z.number(),
|
|
50
|
+
concurrency: zod_1.z.number().or(zod_1.z.string()).nullable(),
|
|
51
|
+
enforceAudioTrack: zod_1.z.boolean(),
|
|
52
|
+
preferLossless: zod_1.z.boolean(),
|
|
53
|
+
}),
|
|
54
|
+
zod_1.z.object({
|
|
55
|
+
type: zod_1.z.literal('still'),
|
|
56
|
+
serveUrl: zod_1.z.string(),
|
|
57
|
+
composition: zod_1.z.string(),
|
|
58
|
+
forceHeight: zod_1.z.number().optional().nullable(),
|
|
59
|
+
forceWidth: zod_1.z.number().optional().nullable(),
|
|
60
|
+
serializedInputPropsWithCustomSchema: zod_1.z.string(),
|
|
61
|
+
jpegQuality: zod_1.z.number().optional(),
|
|
62
|
+
imageFormat: stillImageFormat,
|
|
63
|
+
scale: zod_1.z.number(),
|
|
64
|
+
privacy: zod_1.z.enum(['public', 'private']),
|
|
65
|
+
envVariables: zod_1.z.record(zod_1.z.string()),
|
|
66
|
+
chromiumOptions: chromiumOptions.optional(),
|
|
67
|
+
outputBucket: zod_1.z.string(),
|
|
68
|
+
outName: zod_1.z.string().optional(),
|
|
69
|
+
frame: zod_1.z.number(),
|
|
70
|
+
delayRenderTimeoutInMilliseconds: zod_1.z.number(),
|
|
71
|
+
logLevel,
|
|
72
|
+
}),
|
|
73
|
+
]);
|
|
74
|
+
const renderFailResponsePayload = zod_1.z.object({
|
|
75
|
+
status: zod_1.z.literal('error'),
|
|
76
|
+
error: zod_1.z.string(),
|
|
77
|
+
stack: zod_1.z.string(),
|
|
78
|
+
});
|
|
79
|
+
const renderStillOnCloudrunResponsePayload = zod_1.z.object({
|
|
80
|
+
status: zod_1.z.literal('success'),
|
|
81
|
+
publicUrl: zod_1.z.string().optional().nullable(),
|
|
82
|
+
cloudStorageUri: zod_1.z.string(),
|
|
83
|
+
size: zod_1.z.number(),
|
|
84
|
+
bucketName: zod_1.z.string(),
|
|
85
|
+
renderId: zod_1.z.string(),
|
|
86
|
+
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
87
|
+
});
|
|
88
|
+
const renderMediaOnCloudrunResponsePayload = zod_1.z.object({
|
|
89
|
+
status: zod_1.z.literal('success'),
|
|
90
|
+
publicUrl: zod_1.z.string().optional().nullable(),
|
|
91
|
+
cloudStorageUri: zod_1.z.string(),
|
|
92
|
+
size: zod_1.z.number(),
|
|
93
|
+
bucketName: zod_1.z.string(),
|
|
94
|
+
renderId: zod_1.z.string(),
|
|
95
|
+
privacy: zod_1.z.enum(['public-read', 'project-private']),
|
|
96
|
+
});
|
|
97
|
+
const cloudRunCrashResponse = zod_1.z.object({
|
|
98
|
+
status: zod_1.z.literal('crash'),
|
|
99
|
+
cloudRunEndpoint: zod_1.z.string(),
|
|
100
|
+
message: zod_1.z.literal('Service crashed without sending a response. Check the logs in GCP console.'),
|
|
101
|
+
requestStartTime: zod_1.z.string().datetime(),
|
|
102
|
+
requestCrashTime: zod_1.z.string().datetime(),
|
|
103
|
+
requestElapsedTimeInSeconds: zod_1.z.number(),
|
|
104
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderOnCloudRun = void 0;
|
|
4
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const log_1 = require("../cli/log");
|
|
6
|
+
const payloads_1 = require("./helpers/payloads");
|
|
7
|
+
const render_media_single_thread_1 = require("./render-media-single-thread");
|
|
8
|
+
const render_still_single_thread_1 = require("./render-still-single-thread");
|
|
9
|
+
const renderOnCloudRun = async (req, res) => {
|
|
10
|
+
var _a;
|
|
11
|
+
try {
|
|
12
|
+
log_1.Log.info('renderOnCloudRun', req.body);
|
|
13
|
+
const body = payloads_1.CloudRunPayload.parse(req.body);
|
|
14
|
+
const renderType = body.type;
|
|
15
|
+
renderer_1.RenderInternals.setLogLevel(body.logLevel);
|
|
16
|
+
switch (renderType) {
|
|
17
|
+
case 'media':
|
|
18
|
+
await (0, render_media_single_thread_1.renderMediaSingleThread)(body, res);
|
|
19
|
+
break;
|
|
20
|
+
case 'still':
|
|
21
|
+
await (0, render_still_single_thread_1.renderStillSingleThread)(body, res);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
res
|
|
25
|
+
.status(400)
|
|
26
|
+
.send('Invalid render type, must be either "media" or "still"');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
log_1.Log.error('Error while rendering', err);
|
|
31
|
+
const response = {
|
|
32
|
+
error: err.message,
|
|
33
|
+
status: 'error',
|
|
34
|
+
stack: (_a = err.stack) !== null && _a !== void 0 ? _a : '',
|
|
35
|
+
};
|
|
36
|
+
res.status(500).send(JSON.stringify(response));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.renderOnCloudRun = renderOnCloudRun;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderMediaSingleThread = void 0;
|
|
4
|
+
const storage_1 = require("@google-cloud/storage");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const random_hash_1 = require("../shared/random-hash");
|
|
8
|
+
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
9
|
+
const renderMediaSingleThread = async (body, res) => {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
|
+
if (body.type !== 'media') {
|
|
12
|
+
throw new Error('expected type media');
|
|
13
|
+
}
|
|
14
|
+
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body);
|
|
15
|
+
const defaultOutName = `out.${renderer_1.RenderInternals.getFileExtensionFromCodec(body.codec, body.audioCodec)}`;
|
|
16
|
+
const tempFilePath = `/tmp/${defaultOutName}`;
|
|
17
|
+
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
18
|
+
let previousProgress = 2;
|
|
19
|
+
const onProgress = ({ progress }) => {
|
|
20
|
+
if (previousProgress !== progress) {
|
|
21
|
+
res.write(JSON.stringify({ onProgress: progress }));
|
|
22
|
+
previousProgress = progress;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
26
|
+
const actualChromiumOptions = {
|
|
27
|
+
...body.chromiumOptions,
|
|
28
|
+
// Override the `null` value, which might come from CLI with swANGLE
|
|
29
|
+
gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
|
|
30
|
+
};
|
|
31
|
+
await renderer_1.RenderInternals.internalRenderMedia({
|
|
32
|
+
composition: {
|
|
33
|
+
...composition,
|
|
34
|
+
height: (_c = body.forceHeight) !== null && _c !== void 0 ? _c : composition.height,
|
|
35
|
+
width: (_d = body.forceWidth) !== null && _d !== void 0 ? _d : composition.width,
|
|
36
|
+
},
|
|
37
|
+
serveUrl: body.serveUrl,
|
|
38
|
+
codec: body.codec,
|
|
39
|
+
outputLocation: tempFilePath,
|
|
40
|
+
serializedInputPropsWithCustomSchema: body.serializedInputPropsWithCustomSchema,
|
|
41
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
42
|
+
data: composition.props,
|
|
43
|
+
indent: undefined,
|
|
44
|
+
staticBase: null,
|
|
45
|
+
}).serializedString,
|
|
46
|
+
jpegQuality: body.jpegQuality,
|
|
47
|
+
audioCodec: body.audioCodec,
|
|
48
|
+
audioBitrate: body.audioBitrate,
|
|
49
|
+
videoBitrate: body.videoBitrate,
|
|
50
|
+
crf: body.crf,
|
|
51
|
+
pixelFormat: body.pixelFormat,
|
|
52
|
+
imageFormat: body.imageFormat,
|
|
53
|
+
scale: body.scale,
|
|
54
|
+
proResProfile: (_e = body.proResProfile) !== null && _e !== void 0 ? _e : undefined,
|
|
55
|
+
everyNthFrame: body.everyNthFrame,
|
|
56
|
+
numberOfGifLoops: body.numberOfGifLoops,
|
|
57
|
+
onProgress,
|
|
58
|
+
frameRange: body.frameRange,
|
|
59
|
+
envVariables: body.envVariables,
|
|
60
|
+
chromiumOptions: actualChromiumOptions,
|
|
61
|
+
muted: body.muted,
|
|
62
|
+
logLevel: body.logLevel,
|
|
63
|
+
browserExecutable: null,
|
|
64
|
+
timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
|
|
65
|
+
cancelSignal: undefined,
|
|
66
|
+
concurrency: (_f = body.concurrency) !== null && _f !== void 0 ? _f : '100%',
|
|
67
|
+
disallowParallelEncoding: false,
|
|
68
|
+
enforceAudioTrack: body.enforceAudioTrack,
|
|
69
|
+
ffmpegOverride: undefined,
|
|
70
|
+
indent: false,
|
|
71
|
+
onBrowserLog: null,
|
|
72
|
+
onCtrlCExit: () => undefined,
|
|
73
|
+
onDownload: () => undefined,
|
|
74
|
+
onStart: () => undefined,
|
|
75
|
+
overwrite: true,
|
|
76
|
+
port: null,
|
|
77
|
+
preferLossless: body.preferLossless,
|
|
78
|
+
puppeteerInstance: undefined,
|
|
79
|
+
server: undefined,
|
|
80
|
+
});
|
|
81
|
+
const storage = new storage_1.Storage();
|
|
82
|
+
const publicUpload = body.privacy === 'public' || !body.privacy;
|
|
83
|
+
const uploadedResponse = await storage
|
|
84
|
+
.bucket(body.outputBucket)
|
|
85
|
+
.upload(tempFilePath, {
|
|
86
|
+
destination: `renders/${renderId}/${(_g = body.outName) !== null && _g !== void 0 ? _g : defaultOutName}`,
|
|
87
|
+
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
88
|
+
});
|
|
89
|
+
const uploadedFile = uploadedResponse[0];
|
|
90
|
+
const renderMetadata = await uploadedFile.getMetadata();
|
|
91
|
+
const responseData = {
|
|
92
|
+
status: 'success',
|
|
93
|
+
publicUrl: publicUpload ? uploadedFile.publicUrl() : null,
|
|
94
|
+
cloudStorageUri: uploadedFile.cloudStorageURI.href,
|
|
95
|
+
size: renderMetadata[0].size,
|
|
96
|
+
bucketName: body.outputBucket,
|
|
97
|
+
renderId,
|
|
98
|
+
privacy: publicUpload ? 'public-read' : 'project-private',
|
|
99
|
+
};
|
|
100
|
+
renderer_1.RenderInternals.Log.info('Render Completed:', responseData);
|
|
101
|
+
res.end(JSON.stringify({ response: responseData }));
|
|
102
|
+
};
|
|
103
|
+
exports.renderMediaSingleThread = renderMediaSingleThread;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderStillSingleThread = void 0;
|
|
4
|
+
const storage_1 = require("@google-cloud/storage");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const log_1 = require("../cli/log");
|
|
8
|
+
const random_hash_1 = require("../shared/random-hash");
|
|
9
|
+
const get_composition_from_body_1 = require("./helpers/get-composition-from-body");
|
|
10
|
+
const renderStillSingleThread = async (body, res) => {
|
|
11
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12
|
+
if (body.type !== 'still') {
|
|
13
|
+
throw new Error('expected type still');
|
|
14
|
+
}
|
|
15
|
+
log_1.Log.verbose('Rendering still frame', body);
|
|
16
|
+
const composition = await (0, get_composition_from_body_1.getCompositionFromBody)(body);
|
|
17
|
+
log_1.Log.verbose('Composition loaded', composition);
|
|
18
|
+
const tempFilePath = '/tmp/still.png';
|
|
19
|
+
const renderId = (0, random_hash_1.randomHash)({ randomInTests: true });
|
|
20
|
+
const actualChromiumOptions = {
|
|
21
|
+
...body.chromiumOptions,
|
|
22
|
+
// Override the `null` value, which might come from CLI with swANGLE
|
|
23
|
+
gl: (_b = (_a = body.chromiumOptions) === null || _a === void 0 ? void 0 : _a.gl) !== null && _b !== void 0 ? _b : 'swangle',
|
|
24
|
+
};
|
|
25
|
+
await renderer_1.RenderInternals.internalRenderStill({
|
|
26
|
+
composition: {
|
|
27
|
+
...composition,
|
|
28
|
+
height: (_c = body.forceHeight) !== null && _c !== void 0 ? _c : composition.height,
|
|
29
|
+
width: (_d = body.forceWidth) !== null && _d !== void 0 ? _d : composition.width,
|
|
30
|
+
},
|
|
31
|
+
serveUrl: body.serveUrl,
|
|
32
|
+
output: tempFilePath,
|
|
33
|
+
serializedInputPropsWithCustomSchema: body.serializedInputPropsWithCustomSchema,
|
|
34
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
35
|
+
data: composition.props,
|
|
36
|
+
indent: undefined,
|
|
37
|
+
staticBase: null,
|
|
38
|
+
}).serializedString,
|
|
39
|
+
jpegQuality: (_e = body.jpegQuality) !== null && _e !== void 0 ? _e : renderer_1.RenderInternals.DEFAULT_JPEG_QUALITY,
|
|
40
|
+
imageFormat: body.imageFormat,
|
|
41
|
+
scale: body.scale,
|
|
42
|
+
envVariables: body.envVariables,
|
|
43
|
+
chromiumOptions: actualChromiumOptions,
|
|
44
|
+
frame: body.frame,
|
|
45
|
+
logLevel: body.logLevel,
|
|
46
|
+
browserExecutable: null,
|
|
47
|
+
cancelSignal: null,
|
|
48
|
+
indent: false,
|
|
49
|
+
timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
|
|
50
|
+
onBrowserLog: null,
|
|
51
|
+
onDownload: null,
|
|
52
|
+
overwrite: true,
|
|
53
|
+
port: null,
|
|
54
|
+
puppeteerInstance: null,
|
|
55
|
+
server: undefined,
|
|
56
|
+
});
|
|
57
|
+
log_1.Log.info('Still rendered');
|
|
58
|
+
const storage = new storage_1.Storage();
|
|
59
|
+
const publicUpload = body.privacy === 'public' || !body.privacy;
|
|
60
|
+
const uploadedResponse = await storage
|
|
61
|
+
.bucket(body.outputBucket)
|
|
62
|
+
.upload(tempFilePath, {
|
|
63
|
+
destination: `renders/${renderId}/${(_f = body.outName) !== null && _f !== void 0 ? _f : 'out.png'}`,
|
|
64
|
+
predefinedAcl: publicUpload ? 'publicRead' : 'projectPrivate',
|
|
65
|
+
});
|
|
66
|
+
log_1.Log.info('Still uploaded');
|
|
67
|
+
const uploadedFile = uploadedResponse[0];
|
|
68
|
+
const renderMetadata = await uploadedFile.getMetadata();
|
|
69
|
+
const responseData = {
|
|
70
|
+
publicUrl: uploadedFile.publicUrl(),
|
|
71
|
+
cloudStorageUri: uploadedFile.cloudStorageURI.href,
|
|
72
|
+
size: renderMetadata[0].size,
|
|
73
|
+
bucketName: body.outputBucket,
|
|
74
|
+
renderId,
|
|
75
|
+
status: 'success',
|
|
76
|
+
privacy: publicUpload ? 'public-read' : 'project-private',
|
|
77
|
+
};
|
|
78
|
+
renderer_1.RenderInternals.Log.info('Render Completed:', responseData);
|
|
79
|
+
const jsonContent = JSON.stringify(responseData);
|
|
80
|
+
res.end(jsonContent);
|
|
81
|
+
};
|
|
82
|
+
exports.renderStillSingleThread = renderStillSingleThread;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { deleteService } from './api/delete-service';
|
|
2
|
+
import { deleteSite } from './api/delete-site';
|
|
3
|
+
import type { DeployServiceInput, DeployServiceOutput } from './api/deploy-service';
|
|
4
|
+
import { deployService } from './api/deploy-service';
|
|
5
|
+
import { deploySite } from './api/deploy-site';
|
|
6
|
+
import { getOrCreateBucket } from './api/get-or-create-bucket';
|
|
7
|
+
import { getRegions } from './api/get-regions';
|
|
8
|
+
import { getServiceInfo } from './api/get-service-info';
|
|
9
|
+
import { getServices } from './api/get-services';
|
|
10
|
+
import { getSites } from './api/get-sites';
|
|
11
|
+
import { testPermissions } from './api/iam-validation/testPermissions';
|
|
12
|
+
import type { RenderMediaOnCloudrunInput } from './api/render-media-on-cloudrun';
|
|
13
|
+
import { renderMediaOnCloudrun } from './api/render-media-on-cloudrun';
|
|
14
|
+
import { renderStillOnCloudrun } from './api/render-still-on-cloudrun';
|
|
15
|
+
import { speculateServiceName } from './api/speculate-service-name';
|
|
16
|
+
import type { RenderMediaOnCloudrunOutput } from './functions/helpers/payloads';
|
|
17
|
+
import { CloudrunInternals } from './internals';
|
|
18
|
+
import type { GcpRegion } from './pricing/gcp-regions';
|
|
19
|
+
export { CloudrunInternals, deployService, deploySite, deleteSite, deleteService, getServices, getOrCreateBucket, renderMediaOnCloudrun, renderStillOnCloudrun, getServiceInfo, getRegions, getSites, speculateServiceName, testPermissions, };
|
|
20
|
+
export type { GcpRegion, DeployServiceInput, DeployServiceOutput, RenderMediaOnCloudrunOutput, RenderMediaOnCloudrunInput, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.testPermissions = exports.speculateServiceName = exports.getSites = exports.getRegions = exports.getServiceInfo = exports.renderStillOnCloudrun = exports.renderMediaOnCloudrun = exports.getOrCreateBucket = exports.getServices = exports.deleteService = exports.deleteSite = exports.deploySite = exports.deployService = exports.CloudrunInternals = void 0;
|
|
4
|
+
const delete_service_1 = require("./api/delete-service");
|
|
5
|
+
Object.defineProperty(exports, "deleteService", { enumerable: true, get: function () { return delete_service_1.deleteService; } });
|
|
6
|
+
const delete_site_1 = require("./api/delete-site");
|
|
7
|
+
Object.defineProperty(exports, "deleteSite", { enumerable: true, get: function () { return delete_site_1.deleteSite; } });
|
|
8
|
+
const deploy_service_1 = require("./api/deploy-service");
|
|
9
|
+
Object.defineProperty(exports, "deployService", { enumerable: true, get: function () { return deploy_service_1.deployService; } });
|
|
10
|
+
const deploy_site_1 = require("./api/deploy-site");
|
|
11
|
+
Object.defineProperty(exports, "deploySite", { enumerable: true, get: function () { return deploy_site_1.deploySite; } });
|
|
12
|
+
const get_or_create_bucket_1 = require("./api/get-or-create-bucket");
|
|
13
|
+
Object.defineProperty(exports, "getOrCreateBucket", { enumerable: true, get: function () { return get_or_create_bucket_1.getOrCreateBucket; } });
|
|
14
|
+
const get_regions_1 = require("./api/get-regions");
|
|
15
|
+
Object.defineProperty(exports, "getRegions", { enumerable: true, get: function () { return get_regions_1.getRegions; } });
|
|
16
|
+
const get_service_info_1 = require("./api/get-service-info");
|
|
17
|
+
Object.defineProperty(exports, "getServiceInfo", { enumerable: true, get: function () { return get_service_info_1.getServiceInfo; } });
|
|
18
|
+
const get_services_1 = require("./api/get-services");
|
|
19
|
+
Object.defineProperty(exports, "getServices", { enumerable: true, get: function () { return get_services_1.getServices; } });
|
|
20
|
+
const get_sites_1 = require("./api/get-sites");
|
|
21
|
+
Object.defineProperty(exports, "getSites", { enumerable: true, get: function () { return get_sites_1.getSites; } });
|
|
22
|
+
const testPermissions_1 = require("./api/iam-validation/testPermissions");
|
|
23
|
+
Object.defineProperty(exports, "testPermissions", { enumerable: true, get: function () { return testPermissions_1.testPermissions; } });
|
|
24
|
+
const render_media_on_cloudrun_1 = require("./api/render-media-on-cloudrun");
|
|
25
|
+
Object.defineProperty(exports, "renderMediaOnCloudrun", { enumerable: true, get: function () { return render_media_on_cloudrun_1.renderMediaOnCloudrun; } });
|
|
26
|
+
const render_still_on_cloudrun_1 = require("./api/render-still-on-cloudrun");
|
|
27
|
+
Object.defineProperty(exports, "renderStillOnCloudrun", { enumerable: true, get: function () { return render_still_on_cloudrun_1.renderStillOnCloudrun; } });
|
|
28
|
+
const speculate_service_name_1 = require("./api/speculate-service-name");
|
|
29
|
+
Object.defineProperty(exports, "speculateServiceName", { enumerable: true, get: function () { return speculate_service_name_1.speculateServiceName; } });
|
|
30
|
+
const internals_1 = require("./internals");
|
|
31
|
+
Object.defineProperty(exports, "CloudrunInternals", { enumerable: true, get: function () { return internals_1.CloudrunInternals; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const GCP_REGIONS: readonly ["asia-east1", "asia-east2", "asia-northeast1", "asia-northeast2", "asia-northeast3", "asia-south1", "asia-south2", "asia-southeast1", "asia-southeast2", "australia-southeast1", "australia-southeast2", "europe-central2", "europe-north1", "europe-southwest1", "europe-west1", "europe-west2", "europe-west3", "europe-west4", "europe-west6", "europe-west8", "europe-west9", "me-west1", "northamerica-northeast1", "northamerica-northeast2", "southamerica-east1", "southamerica-west1", "us-central1", "us-east1", "us-east4", "us-east5", "us-south1", "us-west1", "us-west2", "us-west3", "us-west4"];
|
|
2
|
+
export declare const GCP_REGION_SHORTHAND: {
|
|
3
|
+
[key in GcpRegion]: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type GcpRegion = typeof GCP_REGIONS[number];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GCP_REGION_SHORTHAND = exports.GCP_REGIONS = void 0;
|
|
4
|
+
exports.GCP_REGIONS = [
|
|
5
|
+
'asia-east1',
|
|
6
|
+
'asia-east2',
|
|
7
|
+
'asia-northeast1',
|
|
8
|
+
'asia-northeast2',
|
|
9
|
+
'asia-northeast3',
|
|
10
|
+
'asia-south1',
|
|
11
|
+
'asia-south2',
|
|
12
|
+
'asia-southeast1',
|
|
13
|
+
'asia-southeast2',
|
|
14
|
+
'australia-southeast1',
|
|
15
|
+
'australia-southeast2',
|
|
16
|
+
'europe-central2',
|
|
17
|
+
'europe-north1',
|
|
18
|
+
'europe-southwest1',
|
|
19
|
+
'europe-west1',
|
|
20
|
+
'europe-west2',
|
|
21
|
+
'europe-west3',
|
|
22
|
+
'europe-west4',
|
|
23
|
+
'europe-west6',
|
|
24
|
+
'europe-west8',
|
|
25
|
+
'europe-west9',
|
|
26
|
+
'me-west1',
|
|
27
|
+
'northamerica-northeast1',
|
|
28
|
+
'northamerica-northeast2',
|
|
29
|
+
'southamerica-east1',
|
|
30
|
+
'southamerica-west1',
|
|
31
|
+
'us-central1',
|
|
32
|
+
'us-east1',
|
|
33
|
+
'us-east4',
|
|
34
|
+
'us-east5',
|
|
35
|
+
'us-south1',
|
|
36
|
+
'us-west1',
|
|
37
|
+
'us-west2',
|
|
38
|
+
'us-west3',
|
|
39
|
+
'us-west4',
|
|
40
|
+
];
|
|
41
|
+
exports.GCP_REGION_SHORTHAND = {
|
|
42
|
+
'us-east5': 'ul.a',
|
|
43
|
+
'asia-east1': 'de.a',
|
|
44
|
+
'asia-east2': 'df.a',
|
|
45
|
+
'asia-northeast1': 'an.a',
|
|
46
|
+
'asia-northeast2': 'dt.a',
|
|
47
|
+
'asia-northeast3': 'du.a',
|
|
48
|
+
'asia-south1': 'el.a',
|
|
49
|
+
'asia-south2': 'em.a',
|
|
50
|
+
'asia-southeast1': 'as.a',
|
|
51
|
+
'asia-southeast2': 'et.a',
|
|
52
|
+
'australia-southeast1': 'ts.a',
|
|
53
|
+
'australia-southeast2': 'km.a',
|
|
54
|
+
'europe-central2': 'lm.a',
|
|
55
|
+
'europe-north1': 'lz.a',
|
|
56
|
+
'europe-southwest1': 'no.a',
|
|
57
|
+
'europe-west1': 'ew.a',
|
|
58
|
+
'europe-west2': 'nw.a',
|
|
59
|
+
'europe-west3': 'ey.a',
|
|
60
|
+
'europe-west4': 'ez.a',
|
|
61
|
+
'europe-west6': 'oa.a',
|
|
62
|
+
'europe-west8': 'oc.a',
|
|
63
|
+
'europe-west9': 'od.a',
|
|
64
|
+
'me-west1': 'zf.a',
|
|
65
|
+
'northamerica-northeast1': 'nn.a',
|
|
66
|
+
'northamerica-northeast2': 'pd.a',
|
|
67
|
+
'southamerica-east1': 'rj.a',
|
|
68
|
+
'southamerica-west1': 'tl.a',
|
|
69
|
+
'us-central1': 'uc.a',
|
|
70
|
+
'us-east1': 'ue.a',
|
|
71
|
+
'us-east4': 'uk.a',
|
|
72
|
+
'us-west1': 'uw.a',
|
|
73
|
+
'us-south1': 'vp.a',
|
|
74
|
+
'us-west2': 'wl.a',
|
|
75
|
+
'us-west4': 'wn.a',
|
|
76
|
+
'us-west3': 'wm.a',
|
|
77
|
+
};
|
package/dist/regions.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GCP_REGIONS = void 0;
|
|
4
|
+
const gcp_regions_1 = require("./pricing/gcp-regions");
|
|
5
|
+
Object.defineProperty(exports, "GCP_REGIONS", { enumerable: true, get: function () { return gcp_regions_1.GCP_REGIONS; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GcpRegion } from '../pricing/gcp-regions';
|
|
2
|
+
export declare const DEFAULT_REGION: GcpRegion;
|
|
3
|
+
export declare const BINARY_NAME = "remotion cloudrun";
|
|
4
|
+
export declare const REMOTION_BUCKET_PREFIX = "remotioncloudrun-";
|
|
5
|
+
export declare const RENDER_SERVICE_PREFIX = "remotion";
|
|
6
|
+
export declare const getSitesKey: (siteId: string) => string;
|
|
7
|
+
export declare const DEFAULT_MAX_RETRIES = 1;
|
|
8
|
+
export declare const inputPropsKey: (hash: string) => string;
|
|
9
|
+
export declare type Privacy = 'public' | 'private';
|
|
10
|
+
export declare const DEFAULT_OUTPUT_PRIVACY: Privacy;
|
|
11
|
+
export declare const DEFAULT_TIMEOUT = 300;
|
|
12
|
+
export declare const DEFAULT_MIN_INSTANCES = 0;
|
|
13
|
+
export declare const DEFAULT_MAX_INSTANCES = 100;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_MAX_INSTANCES = exports.DEFAULT_MIN_INSTANCES = exports.DEFAULT_TIMEOUT = exports.DEFAULT_OUTPUT_PRIVACY = exports.inputPropsKey = exports.DEFAULT_MAX_RETRIES = exports.getSitesKey = exports.RENDER_SERVICE_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.BINARY_NAME = exports.DEFAULT_REGION = void 0;
|
|
4
|
+
exports.DEFAULT_REGION = 'us-east1';
|
|
5
|
+
exports.BINARY_NAME = 'remotion cloudrun';
|
|
6
|
+
exports.REMOTION_BUCKET_PREFIX = 'remotioncloudrun-';
|
|
7
|
+
exports.RENDER_SERVICE_PREFIX = 'remotion';
|
|
8
|
+
const getSitesKey = (siteId) => `sites/${siteId}`;
|
|
9
|
+
exports.getSitesKey = getSitesKey;
|
|
10
|
+
exports.DEFAULT_MAX_RETRIES = 1;
|
|
11
|
+
const inputPropsKey = (hash) => {
|
|
12
|
+
return `input-props/${hash}.json`;
|
|
13
|
+
};
|
|
14
|
+
exports.inputPropsKey = inputPropsKey;
|
|
15
|
+
exports.DEFAULT_OUTPUT_PRIVACY = 'public';
|
|
16
|
+
exports.DEFAULT_TIMEOUT = 300;
|
|
17
|
+
exports.DEFAULT_MIN_INSTANCES = 0;
|
|
18
|
+
exports.DEFAULT_MAX_INSTANCES = 100;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToServeUrl = void 0;
|
|
4
|
+
const docs_url_1 = require("./docs-url");
|
|
5
|
+
const convertToServeUrl = ({ urlOrId, bucketName, }) => {
|
|
6
|
+
if (urlOrId.startsWith('src/')) {
|
|
7
|
+
throw new Error(`Remotion Lambda can only render based on a URL in the cloud. It seems like you passed a local file: ${urlOrId}. Read the setup guide for Remotion Lambda ${docs_url_1.DOCS_URL}/docs/cloudrun/setup`);
|
|
8
|
+
}
|
|
9
|
+
if (urlOrId.startsWith('http://') || urlOrId.startsWith('https://')) {
|
|
10
|
+
return urlOrId;
|
|
11
|
+
}
|
|
12
|
+
return `https://storage.googleapis.com/${bucketName}/sites/${urlOrId}/index.html`;
|
|
13
|
+
};
|
|
14
|
+
exports.convertToServeUrl = convertToServeUrl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DOCS_URL = "https://remotion.dev";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateServiceName = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const service_version_string_1 = require("./service-version-string");
|
|
6
|
+
const generateServiceName = ({ memoryLimit, cpuLimit, timeoutSeconds, }) => {
|
|
7
|
+
const sanitisedCPU = cpuLimit.replace(/\./g, '-').substring(0, 10);
|
|
8
|
+
const sanitisedMem = memoryLimit
|
|
9
|
+
.replace(/\./g, '-')
|
|
10
|
+
.substring(0, 10)
|
|
11
|
+
.toLowerCase();
|
|
12
|
+
return [
|
|
13
|
+
constants_1.RENDER_SERVICE_PREFIX,
|
|
14
|
+
(0, service_version_string_1.serviceVersionString)(),
|
|
15
|
+
`mem${sanitisedMem}`,
|
|
16
|
+
`cpu${sanitisedCPU}`,
|
|
17
|
+
`t${String(timeoutSeconds)}`,
|
|
18
|
+
].join('-');
|
|
19
|
+
};
|
|
20
|
+
exports.generateServiceName = generateServiceName;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getEtagOfFile: (filePath: string) => Promise<string>;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
exports.getEtagOfFile = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const chunk = 1024 * 1024 * 5; // 5MB
|
|
10
|
+
const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
11
|
+
const getEtagOfFile = async (filePath) => {
|
|
12
|
+
const stream = await fs_1.default.promises.readFile(filePath);
|
|
13
|
+
if (stream.length <= chunk) {
|
|
14
|
+
return `"${md5(stream)}"`;
|
|
15
|
+
}
|
|
16
|
+
const md5Chunks = [];
|
|
17
|
+
const chunksNumber = Math.ceil(stream.length / chunk);
|
|
18
|
+
for (let i = 0; i < chunksNumber; i++) {
|
|
19
|
+
const chunkStream = stream.slice(i * chunk, (i + 1) * chunk);
|
|
20
|
+
md5Chunks.push(md5(chunkStream));
|
|
21
|
+
}
|
|
22
|
+
return `"${md5(Buffer.from(md5Chunks.join(''), 'hex'))}-${chunksNumber}"`;
|
|
23
|
+
};
|
|
24
|
+
exports.getEtagOfFile = getEtagOfFile;
|