@remotion/cloudrun 4.0.18

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.
Files changed (193) hide show
  1. package/.turbo/turbo-build.log +13 -0
  2. package/LICENSE.md +41 -0
  3. package/dist/admin/bundle-installer.d.ts +1 -0
  4. package/dist/admin/bundle-installer.js +32 -0
  5. package/dist/admin/bundle-renderLogic.d.ts +1 -0
  6. package/dist/admin/bundle-renderLogic.js +39 -0
  7. package/dist/api/check-if-service-exists.d.ts +18 -0
  8. package/dist/api/check-if-service-exists.js +46 -0
  9. package/dist/api/create-bucket.d.ts +13 -0
  10. package/dist/api/create-bucket.js +18 -0
  11. package/dist/api/delete-service.d.ts +12 -0
  12. package/dist/api/delete-service.js +19 -0
  13. package/dist/api/delete-site.d.ts +13 -0
  14. package/dist/api/delete-site.js +30 -0
  15. package/dist/api/deploy-service.d.ts +28 -0
  16. package/dist/api/deploy-service.js +90 -0
  17. package/dist/api/deploy-site.d.ts +35 -0
  18. package/dist/api/deploy-site.js +78 -0
  19. package/dist/api/download-file.d.ts +12 -0
  20. package/dist/api/download-file.js +29 -0
  21. package/dist/api/get-buckets.d.ts +10 -0
  22. package/dist/api/get-buckets.js +23 -0
  23. package/dist/api/get-or-create-bucket.d.ts +17 -0
  24. package/dist/api/get-or-create-bucket.js +42 -0
  25. package/dist/api/get-regions.d.ts +7 -0
  26. package/dist/api/get-regions.js +13 -0
  27. package/dist/api/get-service-info.d.ts +23 -0
  28. package/dist/api/get-service-info.js +34 -0
  29. package/dist/api/get-services.d.ts +14 -0
  30. package/dist/api/get-services.js +49 -0
  31. package/dist/api/get-sites.d.ts +23 -0
  32. package/dist/api/get-sites.js +49 -0
  33. package/dist/api/helpers/IService.d.ts +2 -0
  34. package/dist/api/helpers/IService.js +2 -0
  35. package/dist/api/helpers/construct-service-deploy-request.d.ts +32 -0
  36. package/dist/api/helpers/construct-service-deploy-request.js +36 -0
  37. package/dist/api/helpers/extract-mem-from-url.d.ts +1 -0
  38. package/dist/api/helpers/extract-mem-from-url.js +9 -0
  39. package/dist/api/helpers/extract-time-from-url.d.ts +1 -0
  40. package/dist/api/helpers/extract-time-from-url.js +13 -0
  41. package/dist/api/helpers/get-auth-client-for-url.d.ts +1 -0
  42. package/dist/api/helpers/get-auth-client-for-url.js +15 -0
  43. package/dist/api/helpers/get-cloud-logging-client.d.ts +1 -0
  44. package/dist/api/helpers/get-cloud-logging-client.js +15 -0
  45. package/dist/api/helpers/get-cloud-run-client.d.ts +2 -0
  46. package/dist/api/helpers/get-cloud-run-client.js +15 -0
  47. package/dist/api/helpers/get-cloud-storage-client.d.ts +2 -0
  48. package/dist/api/helpers/get-cloud-storage-client.js +14 -0
  49. package/dist/api/helpers/get-cloudrun-endpoint.d.ts +6 -0
  50. package/dist/api/helpers/get-cloudrun-endpoint.js +28 -0
  51. package/dist/api/helpers/get-resource-manager-client.d.ts +2 -0
  52. package/dist/api/helpers/get-resource-manager-client.js +15 -0
  53. package/dist/api/helpers/parse-service-name.d.ts +8 -0
  54. package/dist/api/helpers/parse-service-name.js +24 -0
  55. package/dist/api/iam-validation/testPermissions.d.ts +20 -0
  56. package/dist/api/iam-validation/testPermissions.js +48 -0
  57. package/dist/api/render-media-on-cloudrun.d.ts +78 -0
  58. package/dist/api/render-media-on-cloudrun.js +144 -0
  59. package/dist/api/render-still-on-cloudrun.d.ts +49 -0
  60. package/dist/api/render-still-on-cloudrun.js +76 -0
  61. package/dist/api/speculate-service-name.d.ts +13 -0
  62. package/dist/api/speculate-service-name.js +20 -0
  63. package/dist/api/test/service-names.test.d.ts +1 -0
  64. package/dist/api/test/service-names.test.js +28 -0
  65. package/dist/api/upload-dir.d.ts +18 -0
  66. package/dist/api/upload-dir.js +81 -0
  67. package/dist/cli/args.d.ts +19 -0
  68. package/dist/cli/args.js +11 -0
  69. package/dist/cli/commands/permissions.d.ts +2 -0
  70. package/dist/cli/commands/permissions.js +23 -0
  71. package/dist/cli/commands/regions.d.ts +2 -0
  72. package/dist/cli/commands/regions.js +10 -0
  73. package/dist/cli/commands/render/helpers/renderArgsCheck.d.ts +9 -0
  74. package/dist/cli/commands/render/helpers/renderArgsCheck.js +75 -0
  75. package/dist/cli/commands/render/index.d.ts +2 -0
  76. package/dist/cli/commands/render/index.js +227 -0
  77. package/dist/cli/commands/render/renderMedia.d.ts +2 -0
  78. package/dist/cli/commands/render/renderMedia.js +156 -0
  79. package/dist/cli/commands/render/renderStill.d.ts +2 -0
  80. package/dist/cli/commands/render/renderStill.js +123 -0
  81. package/dist/cli/commands/services/deploy.d.ts +2 -0
  82. package/dist/cli/commands/services/deploy.js +129 -0
  83. package/dist/cli/commands/services/index.d.ts +5 -0
  84. package/dist/cli/commands/services/index.js +64 -0
  85. package/dist/cli/commands/services/ls.d.ts +2 -0
  86. package/dist/cli/commands/services/ls.js +40 -0
  87. package/dist/cli/commands/services/rm.d.ts +2 -0
  88. package/dist/cli/commands/services/rm.js +63 -0
  89. package/dist/cli/commands/services/rmall.d.ts +2 -0
  90. package/dist/cli/commands/services/rmall.js +52 -0
  91. package/dist/cli/commands/sites/create.d.ts +2 -0
  92. package/dist/cli/commands/sites/create.js +138 -0
  93. package/dist/cli/commands/sites/index.d.ts +4 -0
  94. package/dist/cli/commands/sites/index.js +60 -0
  95. package/dist/cli/commands/sites/ls.d.ts +2 -0
  96. package/dist/cli/commands/sites/ls.js +40 -0
  97. package/dist/cli/commands/sites/rm.d.ts +2 -0
  98. package/dist/cli/commands/sites/rm.js +59 -0
  99. package/dist/cli/commands/sites/rmall.d.ts +2 -0
  100. package/dist/cli/commands/sites/rmall.js +38 -0
  101. package/dist/cli/commands/still.d.ts +2 -0
  102. package/dist/cli/commands/still.js +129 -0
  103. package/dist/cli/get-gcp-region.d.ts +2 -0
  104. package/dist/cli/get-gcp-region.js +19 -0
  105. package/dist/cli/help.d.ts +1 -0
  106. package/dist/cli/help.js +38 -0
  107. package/dist/cli/helpers/confirm.d.ts +4 -0
  108. package/dist/cli/helpers/confirm.js +12 -0
  109. package/dist/cli/helpers/date-string.d.ts +1 -0
  110. package/dist/cli/helpers/date-string.js +9 -0
  111. package/dist/cli/helpers/progress-bar.d.ts +23 -0
  112. package/dist/cli/helpers/progress-bar.js +81 -0
  113. package/dist/cli/helpers/quit.d.ts +1 -0
  114. package/dist/cli/helpers/quit.js +7 -0
  115. package/dist/cli/helpers/yes-or-no.d.ts +4 -0
  116. package/dist/cli/helpers/yes-or-no.js +44 -0
  117. package/dist/cli/index.d.ts +1 -0
  118. package/dist/cli/index.js +56 -0
  119. package/dist/cli/log.d.ts +26 -0
  120. package/dist/cli/log.js +5 -0
  121. package/dist/defaults.d.ts +1 -0
  122. package/dist/defaults.js +17 -0
  123. package/dist/functions/helpers/get-composition-from-body.d.ts +2 -0
  124. package/dist/functions/helpers/get-composition-from-body.js +27 -0
  125. package/dist/functions/helpers/io.d.ts +11 -0
  126. package/dist/functions/helpers/io.js +17 -0
  127. package/dist/functions/helpers/payloads.d.ts +300 -0
  128. package/dist/functions/helpers/payloads.js +104 -0
  129. package/dist/functions/index.d.ts +3 -0
  130. package/dist/functions/index.js +39 -0
  131. package/dist/functions/render-media-single-thread.d.ts +3 -0
  132. package/dist/functions/render-media-single-thread.js +103 -0
  133. package/dist/functions/render-still-single-thread.d.ts +3 -0
  134. package/dist/functions/render-still-single-thread.js +82 -0
  135. package/dist/index.d.ts +20 -0
  136. package/dist/index.js +31 -0
  137. package/dist/internals.d.ts +3 -0
  138. package/dist/internals.js +7 -0
  139. package/dist/pricing/gcp-regions.d.ts +2 -0
  140. package/dist/pricing/gcp-regions.js +40 -0
  141. package/dist/regions.d.ts +2 -0
  142. package/dist/regions.js +5 -0
  143. package/dist/shared/bundle-site.d.ts +2 -0
  144. package/dist/shared/bundle-site.js +5 -0
  145. package/dist/shared/constants.d.ts +13 -0
  146. package/dist/shared/constants.js +18 -0
  147. package/dist/shared/convert-to-serve-url.d.ts +4 -0
  148. package/dist/shared/convert-to-serve-url.js +14 -0
  149. package/dist/shared/docs-url.d.ts +1 -0
  150. package/dist/shared/docs-url.js +4 -0
  151. package/dist/shared/generate-service-name.d.ts +5 -0
  152. package/dist/shared/generate-service-name.js +20 -0
  153. package/dist/shared/get-etag.d.ts +1 -0
  154. package/dist/shared/get-etag.js +24 -0
  155. package/dist/shared/get-storage-operations.d.ts +10 -0
  156. package/dist/shared/get-storage-operations.js +36 -0
  157. package/dist/shared/make-storage-key.d.ts +1 -0
  158. package/dist/shared/make-storage-key.js +11 -0
  159. package/dist/shared/make-storage-url.d.ts +4 -0
  160. package/dist/shared/make-storage-url.js +7 -0
  161. package/dist/shared/random-hash.d.ts +3 -0
  162. package/dist/shared/random-hash.js +14 -0
  163. package/dist/shared/read-dir.d.ts +9 -0
  164. package/dist/shared/read-dir.js +57 -0
  165. package/dist/shared/sa-permissions.json +64 -0
  166. package/dist/shared/service-version-string.d.ts +1 -0
  167. package/dist/shared/service-version-string.js +8 -0
  168. package/dist/shared/validate-bucketname.d.ts +8 -0
  169. package/dist/shared/validate-bucketname.js +35 -0
  170. package/dist/shared/validate-cloudrun-url.d.ts +1 -0
  171. package/dist/shared/validate-cloudrun-url.js +10 -0
  172. package/dist/shared/validate-gcp-codec.d.ts +4 -0
  173. package/dist/shared/validate-gcp-codec.js +29 -0
  174. package/dist/shared/validate-gcp-region.d.ts +2 -0
  175. package/dist/shared/validate-gcp-region.js +10 -0
  176. package/dist/shared/validate-image-remotion-version.d.ts +1 -0
  177. package/dist/shared/validate-image-remotion-version.js +26 -0
  178. package/dist/shared/validate-privacy.d.ts +2 -0
  179. package/dist/shared/validate-privacy.js +12 -0
  180. package/dist/shared/validate-project-id.d.ts +1 -0
  181. package/dist/shared/validate-project-id.js +17 -0
  182. package/dist/shared/validate-region.d.ts +1 -0
  183. package/dist/shared/validate-region.js +15 -0
  184. package/dist/shared/validate-retries.d.ts +1 -0
  185. package/dist/shared/validate-retries.js +21 -0
  186. package/dist/shared/validate-serveurl.d.ts +1 -0
  187. package/dist/shared/validate-serveurl.js +30 -0
  188. package/dist/shared/validate-service-name.d.ts +1 -0
  189. package/dist/shared/validate-service-name.js +9 -0
  190. package/dist/shared/validate-site-name.d.ts +1 -0
  191. package/dist/shared/validate-site-name.js +17 -0
  192. package/package.json +56 -0
  193. package/readme.md +3 -0
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sitesRmSubcommand = exports.SITES_RM_COMMAND = void 0;
4
+ const cli_1 = require("@remotion/cli");
5
+ const _1 = require(".");
6
+ const delete_site_1 = require("../../../api/delete-site");
7
+ const get_sites_1 = require("../../../api/get-sites");
8
+ const constants_1 = require("../../../shared/constants");
9
+ const get_gcp_region_1 = require("../../get-gcp-region");
10
+ const confirm_1 = require("../../helpers/confirm");
11
+ const quit_1 = require("../../helpers/quit");
12
+ const log_1 = require("../../log");
13
+ const ls_1 = require("./ls");
14
+ exports.SITES_RM_COMMAND = 'rm';
15
+ const sitesRmSubcommand = async (args) => {
16
+ if (args.length === 0) {
17
+ log_1.Log.error('No site name was passed. Run the command again and pass another argument <site-name>.');
18
+ log_1.Log.error(`To get a list of sites, run \`${constants_1.BINARY_NAME} ${_1.SITES_COMMAND} ${ls_1.SITES_LS_SUBCOMMAND}\``);
19
+ (0, quit_1.quit)(1);
20
+ }
21
+ if (args[0] === '()') {
22
+ log_1.Log.info('No sites to remove.');
23
+ return;
24
+ }
25
+ const region = (0, get_gcp_region_1.getGcpRegion)();
26
+ const infoOutput = cli_1.CliInternals.createOverwriteableCliOutput({
27
+ quiet: cli_1.CliInternals.quietFlagProvided(),
28
+ cancelSignal: null,
29
+ updatesDontOverwrite: false,
30
+ indent: false,
31
+ });
32
+ infoOutput.update(`Checking ${region} for sites...`, false);
33
+ const deployedSites = await (0, get_sites_1.getSites)(region);
34
+ for (const siteName of args) {
35
+ infoOutput.update('Getting site info...', false);
36
+ const site = deployedSites.sites.find((s) => s.id === siteName.trim());
37
+ if (!site) {
38
+ infoOutput.update('', false);
39
+ throw new Error(`${siteName.trim()} was not found in ${region}.`);
40
+ }
41
+ infoOutput.update((0, _1.displaySiteInfo)(site), false);
42
+ log_1.Log.info();
43
+ log_1.Log.info();
44
+ const confirmDelete = await (0, confirm_1.confirmCli)({
45
+ delMessage: 'Delete? (Y/n)',
46
+ allowForceFlag: true,
47
+ });
48
+ if (!confirmDelete) {
49
+ log_1.Log.info('Aborting.');
50
+ return;
51
+ }
52
+ await (0, delete_site_1.deleteSite)({
53
+ bucketName: site.bucketName,
54
+ siteName,
55
+ });
56
+ log_1.Log.info(`Deleted site ${siteName} from bucket ${site.bucketName}.`);
57
+ }
58
+ };
59
+ exports.sitesRmSubcommand = sitesRmSubcommand;
@@ -0,0 +1,2 @@
1
+ export declare const SITES_RMALL_COMMAND = "rmall";
2
+ export declare const sitesRmallSubcommand: () => Promise<void>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sitesRmallSubcommand = exports.SITES_RMALL_COMMAND = void 0;
4
+ const _1 = require(".");
5
+ const delete_site_1 = require("../../../api/delete-site");
6
+ const get_sites_1 = require("../../../api/get-sites");
7
+ const args_1 = require("../../args");
8
+ const get_gcp_region_1 = require("../../get-gcp-region");
9
+ const confirm_1 = require("../../helpers/confirm");
10
+ const log_1 = require("../../log");
11
+ exports.SITES_RMALL_COMMAND = 'rmall';
12
+ const sitesRmallSubcommand = async () => {
13
+ const allRegions = args_1.parsedCloudrunCli['all-regions'];
14
+ const region = allRegions ? 'all regions' : (0, get_gcp_region_1.getGcpRegion)();
15
+ log_1.Log.info(`Retrieving sites in ${region}.`);
16
+ const deployedSites = await (0, get_sites_1.getSites)(region);
17
+ for (const site of deployedSites.sites) {
18
+ log_1.Log.info();
19
+ log_1.Log.info((0, _1.displaySiteInfo)(site));
20
+ log_1.Log.info();
21
+ const confirmDelete = await (0, confirm_1.confirmCli)({
22
+ delMessage: 'Delete? (Y/n)',
23
+ allowForceFlag: true,
24
+ });
25
+ if (!confirmDelete) {
26
+ log_1.Log.info(`Skipping site - ${site.id}.`);
27
+ log_1.Log.info();
28
+ continue;
29
+ }
30
+ await (0, delete_site_1.deleteSite)({
31
+ bucketName: site.bucketName,
32
+ siteName: site.id,
33
+ });
34
+ log_1.Log.info(`Deleted site ${site.id} from bucket ${site.bucketName}.`);
35
+ log_1.Log.info();
36
+ }
37
+ };
38
+ exports.sitesRmallSubcommand = sitesRmallSubcommand;
@@ -0,0 +1,2 @@
1
+ export declare const STILL_COMMAND = "still";
2
+ export declare const stillCommand: (args: string[], remotionRoot: string) => Promise<void>;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stillCommand = exports.STILL_COMMAND = void 0;
4
+ const cli_1 = require("@remotion/cli");
5
+ const config_1 = require("@remotion/cli/config");
6
+ const renderer_1 = require("@remotion/renderer");
7
+ const remotion_1 = require("remotion");
8
+ const download_file_1 = require("../../api/download-file");
9
+ const render_still_on_cloudrun_1 = require("../../api/render-still-on-cloudrun");
10
+ const validate_serveurl_1 = require("../../shared/validate-serveurl");
11
+ const log_1 = require("../log");
12
+ const renderArgsCheck_1 = require("./render/helpers/renderArgsCheck");
13
+ exports.STILL_COMMAND = 'still';
14
+ const stillCommand = async (args, remotionRoot) => {
15
+ var _a, _b;
16
+ const { serveUrl, cloudRunUrl, outName, forceBucketName, privacy, downloadName, region, } = await (0, renderArgsCheck_1.renderArgsCheck)(exports.STILL_COMMAND, args);
17
+ const { chromiumOptions, envVariables, inputProps, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, logLevel, } = await cli_1.CliInternals.getCliOptions({
18
+ type: 'still',
19
+ isLambda: true,
20
+ remotionRoot,
21
+ });
22
+ let composition = args[1];
23
+ if (!composition) {
24
+ log_1.Log.info('No compositions passed. Fetching compositions...');
25
+ (0, validate_serveurl_1.validateServeUrl)(serveUrl);
26
+ const server = renderer_1.RenderInternals.prepareServer({
27
+ concurrency: 1,
28
+ indent: false,
29
+ port,
30
+ remotionRoot,
31
+ logLevel,
32
+ webpackConfigOrServeUrl: serveUrl,
33
+ });
34
+ const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
35
+ args,
36
+ compositionIdFromUi: null,
37
+ indent: false,
38
+ serveUrlOrWebpackUrl: serveUrl,
39
+ logLevel,
40
+ browserExecutable,
41
+ chromiumOptions,
42
+ envVariables,
43
+ serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
44
+ data: inputProps,
45
+ indent: undefined,
46
+ staticBase: null,
47
+ }).serializedString,
48
+ port,
49
+ puppeteerInstance: undefined,
50
+ timeoutInMilliseconds: puppeteerTimeout,
51
+ height,
52
+ width,
53
+ server: await server,
54
+ });
55
+ composition = compositionId;
56
+ }
57
+ const { format: imageFormat, source: imageFormatReason } = cli_1.CliInternals.determineFinalStillImageFormat({
58
+ downloadName,
59
+ outName: outName !== null && outName !== void 0 ? outName : null,
60
+ cliFlag: (_a = cli_1.CliInternals.parsedCli['image-format']) !== null && _a !== void 0 ? _a : null,
61
+ isLambda: true,
62
+ fromUi: null,
63
+ configImageFormat: (_b = config_1.ConfigInternals.getUserPreferredStillImageFormat()) !== null && _b !== void 0 ? _b : null,
64
+ });
65
+ log_1.Log.verbose(`Image format: (${imageFormat}), ${imageFormatReason}`);
66
+ // Todo: Check cloudRunUrl is valid, as the error message is obtuse
67
+ cli_1.CliInternals.Log.info(cli_1.CliInternals.chalk.gray(`
68
+ Cloud Run Service URL = ${cloudRunUrl}
69
+ Region = ${region}
70
+ Type = still
71
+ Composition = ${composition}
72
+ Output Bucket = ${forceBucketName}
73
+ Output File = ${outName !== null && outName !== void 0 ? outName : 'out.png'}
74
+ Output File Privacy = ${privacy}
75
+ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
76
+ `.trim()));
77
+ log_1.Log.info();
78
+ const renderStart = Date.now();
79
+ const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
80
+ quiet: cli_1.CliInternals.quietFlagProvided(),
81
+ cancelSignal: null,
82
+ updatesDontOverwrite: false,
83
+ indent: false,
84
+ });
85
+ let doneIn = null;
86
+ const updateProgress = (newline) => {
87
+ progressBar.update([
88
+ `Rendering on Cloud Run:`,
89
+ `${doneIn === null ? '...' : `Rendered in ${doneIn}ms`}`,
90
+ ].join(' '), newline);
91
+ };
92
+ const res = await (0, render_still_on_cloudrun_1.renderStillOnCloudrun)({
93
+ cloudRunUrl,
94
+ serveUrl,
95
+ region,
96
+ inputProps,
97
+ imageFormat,
98
+ composition,
99
+ privacy,
100
+ envVariables,
101
+ frame: stillFrame,
102
+ jpegQuality,
103
+ chromiumOptions,
104
+ scale,
105
+ forceHeight: height,
106
+ forceWidth: width,
107
+ forceBucketName,
108
+ outName,
109
+ logLevel: config_1.ConfigInternals.Logging.getLogLevel(),
110
+ delayRenderTimeoutInMilliseconds: puppeteerTimeout,
111
+ });
112
+ doneIn = Date.now() - renderStart;
113
+ updateProgress(true);
114
+ log_1.Log.info(cli_1.CliInternals.chalk.gray(`Cloud Storage Uri = ${res.cloudStorageUri}`));
115
+ log_1.Log.info(cli_1.CliInternals.chalk.gray(`Render ID = ${res.renderId}`));
116
+ log_1.Log.info(cli_1.CliInternals.chalk.gray(`${Math.round(Number(res.size) / 1000)} KB, Privacy: ${res.privacy}, Bucket: ${res.bucketName}`));
117
+ log_1.Log.info(cli_1.CliInternals.chalk.blue(`○ ${res.publicUrl}`));
118
+ if (downloadName) {
119
+ log_1.Log.info('');
120
+ log_1.Log.info('downloading file...');
121
+ const destination = await (0, download_file_1.downloadFile)({
122
+ bucketName: res.bucketName,
123
+ gsutilURI: res.cloudStorageUri,
124
+ downloadName,
125
+ });
126
+ log_1.Log.info(cli_1.CliInternals.chalk.blueBright(`Downloaded file to ${destination}!`));
127
+ }
128
+ };
129
+ exports.stillCommand = stillCommand;
@@ -0,0 +1,2 @@
1
+ import type { GcpRegion } from '../pricing/gcp-regions';
2
+ export declare const getGcpRegion: () => GcpRegion;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGcpRegion = void 0;
4
+ const constants_1 = require("../shared/constants");
5
+ const validate_gcp_region_1 = require("../shared/validate-gcp-region");
6
+ const args_1 = require("./args");
7
+ const getGcpRegion = () => {
8
+ if (args_1.parsedCloudrunCli.region) {
9
+ (0, validate_gcp_region_1.validateGcpRegion)(args_1.parsedCloudrunCli.region);
10
+ return args_1.parsedCloudrunCli.region;
11
+ }
12
+ const envVariable = process.env.REMOTION_GCP_REGION;
13
+ if (envVariable) {
14
+ (0, validate_gcp_region_1.validateGcpRegion)(envVariable);
15
+ return envVariable;
16
+ }
17
+ return constants_1.DEFAULT_REGION;
18
+ };
19
+ exports.getGcpRegion = getGcpRegion;
@@ -0,0 +1 @@
1
+ export declare const printHelp: () => void;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printHelp = void 0;
4
+ const cli_1 = require("@remotion/cli");
5
+ const constants_1 = require("../shared/constants");
6
+ const permissions_1 = require("./commands/permissions");
7
+ const regions_1 = require("./commands/regions");
8
+ const render_1 = require("./commands/render");
9
+ const services_1 = require("./commands/services");
10
+ const sites_1 = require("./commands/sites");
11
+ const still_1 = require("./commands/still");
12
+ const log_1 = require("./log");
13
+ const packagejson = require('../../package.json');
14
+ const printHelp = () => {
15
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${packagejson.version} © ${new Date().getFullYear()} The Remotion developers`);
16
+ log_1.Log.info();
17
+ log_1.Log.info('Available commands:');
18
+ log_1.Log.info('');
19
+ log_1.Log.info();
20
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${render_1.RENDER_COMMAND}`);
21
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('Render Remotion media on GCP Cloud Run.'));
22
+ log_1.Log.info();
23
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${still_1.STILL_COMMAND}`);
24
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('Render Remotion still on GCP Cloud Run.'));
25
+ log_1.Log.info();
26
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${services_1.SERVICES_COMMAND}`);
27
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Cloud Run services on GCP.'));
28
+ log_1.Log.info();
29
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${sites_1.SITES_COMMAND}`);
30
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('Deploy and manage Remotion projects.'));
31
+ log_1.Log.info();
32
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${permissions_1.PERMISSIONS_COMMAND}`);
33
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('View and validate required GCP permissions.'));
34
+ log_1.Log.info();
35
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${regions_1.REGIONS_COMMAND}`);
36
+ log_1.Log.info(cli_1.CliInternals.chalk.gray('Show the list of GCP regions supported.'));
37
+ };
38
+ exports.printHelp = printHelp;
@@ -0,0 +1,4 @@
1
+ export declare const confirmCli: ({ delMessage, allowForceFlag, }: {
2
+ delMessage: string;
3
+ allowForceFlag: boolean;
4
+ }) => true | Promise<boolean>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.confirmCli = void 0;
4
+ const args_1 = require("../args");
5
+ const yes_or_no_1 = require("./yes-or-no");
6
+ const confirmCli = ({ delMessage, allowForceFlag, }) => {
7
+ if (allowForceFlag && args_1.forceFlagProvided) {
8
+ return true;
9
+ }
10
+ return (0, yes_or_no_1.yesOrNo)({ question: delMessage, defaultValue: true });
11
+ };
12
+ exports.confirmCli = confirmCli;
@@ -0,0 +1 @@
1
+ export declare const dateString: (date: Date) => string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateString = void 0;
4
+ const dateString = (date) => date.getFullYear() +
5
+ '-' +
6
+ String(date.getMonth() + 1).padStart(2, '0') +
7
+ '-' +
8
+ String(date.getDate()).padStart(2, '0');
9
+ exports.dateString = dateString;
@@ -0,0 +1,23 @@
1
+ export type BundleProgress = {
2
+ progress: number;
3
+ doneIn: number | null;
4
+ };
5
+ export declare const makeBundleProgress: ({ progress, doneIn }: BundleProgress) => string;
6
+ export type BucketCreationProgress = {
7
+ creationState: 'Checking for existing bucket' | 'Creating new bucket' | 'Created bucket' | 'Using existing bucket';
8
+ doneIn: number | null;
9
+ };
10
+ export declare const makeBucketProgress: ({ creationState, doneIn, }: BucketCreationProgress) => string;
11
+ type UploadStats = {
12
+ addedFiles: number;
13
+ removedFiles: number;
14
+ untouchedFiles: number;
15
+ };
16
+ export type DeployToStorageProgress = {
17
+ sizeUploaded: number;
18
+ totalSize: number | null;
19
+ doneIn: number | null;
20
+ stats: UploadStats | null;
21
+ };
22
+ export declare const makeDeployProgressBar: ({ sizeUploaded, totalSize, doneIn, stats, }: DeployToStorageProgress) => string;
23
+ export {};
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeDeployProgressBar = exports.makeBucketProgress = exports.makeBundleProgress = void 0;
4
+ const cli_1 = require("@remotion/cli");
5
+ const remotion_1 = require("remotion");
6
+ const makeBundleProgress = ({ progress, doneIn }) => {
7
+ return [
8
+ `(1/3)`,
9
+ cli_1.CliInternals.makeProgressBar(progress / 100),
10
+ `${doneIn === null ? 'Bundling' : 'Bundled'} video`,
11
+ doneIn === null
12
+ ? `${Math.round(progress)}%`
13
+ : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
14
+ ].join(' ');
15
+ };
16
+ exports.makeBundleProgress = makeBundleProgress;
17
+ const makeBucketProgress = ({ creationState, doneIn, }) => {
18
+ let progress = 0;
19
+ let statesFinished = 0;
20
+ switch (creationState) {
21
+ case 'Checking for existing bucket':
22
+ progress = 1;
23
+ break;
24
+ case 'Creating new bucket':
25
+ progress = 2 / 3;
26
+ statesFinished = 2;
27
+ break;
28
+ case 'Created bucket':
29
+ progress = 3 / 3;
30
+ statesFinished = 3;
31
+ break;
32
+ case 'Using existing bucket':
33
+ progress = 3 / 3;
34
+ statesFinished = 3;
35
+ break;
36
+ default:
37
+ progress = 0;
38
+ break;
39
+ }
40
+ return [
41
+ `(2/3)`,
42
+ cli_1.CliInternals.makeProgressBar(progress),
43
+ creationState,
44
+ doneIn === null
45
+ ? `${statesFinished} / ${3}`
46
+ : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
47
+ ].join(' ');
48
+ };
49
+ exports.makeBucketProgress = makeBucketProgress;
50
+ const makeUploadDiff = ({ stats }) => {
51
+ if (!stats) {
52
+ return null;
53
+ }
54
+ if (stats.addedFiles === 0 && stats.removedFiles === 0) {
55
+ return cli_1.CliInternals.chalk.gray(`(Unchanged)`);
56
+ }
57
+ const total = stats.addedFiles + stats.removedFiles;
58
+ return cli_1.CliInternals.chalk.gray(`(${[
59
+ stats.addedFiles ? `+${stats.addedFiles}` : null,
60
+ stats.removedFiles ? `-${stats.removedFiles}` : null,
61
+ ]
62
+ .filter(remotion_1.Internals.truthy)
63
+ .join(',')} ${total === 1 ? 'file' : 'files'})`);
64
+ };
65
+ const makeDeployProgressBar = ({ sizeUploaded, totalSize, doneIn, stats, }) => {
66
+ const progress = totalSize === null ? 0 : sizeUploaded / totalSize;
67
+ return [
68
+ `(3/3)`,
69
+ cli_1.CliInternals.makeProgressBar(progress),
70
+ `${doneIn === null ? 'Uploading' : 'Uploaded'} to GCP Storage Bucket`,
71
+ doneIn === null
72
+ ? typeof totalSize === 'number'
73
+ ? `${cli_1.CliInternals.formatBytes(sizeUploaded)}/${cli_1.CliInternals.formatBytes(totalSize)}`
74
+ : ''
75
+ : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
76
+ makeUploadDiff({ stats }),
77
+ ]
78
+ .filter(remotion_1.Internals.truthy)
79
+ .join(' ');
80
+ };
81
+ exports.makeDeployProgressBar = makeDeployProgressBar;
@@ -0,0 +1 @@
1
+ export declare const quit: (exitCode: number) => never;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.quit = void 0;
4
+ const quit = (exitCode) => {
5
+ process.exit(exitCode);
6
+ };
7
+ exports.quit = quit;
@@ -0,0 +1,4 @@
1
+ export declare const yesOrNo: ({ question, defaultValue, }: {
2
+ question: string;
3
+ defaultValue: boolean;
4
+ }) => Promise<boolean>;
@@ -0,0 +1,44 @@
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.yesOrNo = void 0;
7
+ const readline_1 = __importDefault(require("readline"));
8
+ const options = {
9
+ yes: ['yes', 'y'],
10
+ no: ['no', 'n'],
11
+ };
12
+ function defaultInvalidHandler({ yesValues, noValues, }) {
13
+ process.stdout.write('\nInvalid Response.\n');
14
+ process.stdout.write('Answer either yes : (' + yesValues.join(', ') + ') \n');
15
+ process.stdout.write('Or no: (' + noValues.join(', ') + ') \n\n');
16
+ }
17
+ const yesOrNo = ({ question, defaultValue, }) => {
18
+ const invalid = defaultInvalidHandler;
19
+ const yesValues = options.yes.map((v) => v.toLowerCase());
20
+ const noValues = options.no.map((v) => v.toLowerCase());
21
+ const rl = readline_1.default.createInterface({
22
+ input: process.stdin,
23
+ output: process.stdout,
24
+ });
25
+ return new Promise((resolve) => {
26
+ rl.question(question + ' ', async (answer) => {
27
+ rl.close();
28
+ const cleaned = answer.trim().toLowerCase();
29
+ if (cleaned === '' && defaultValue !== null)
30
+ return resolve(defaultValue);
31
+ if (yesValues.indexOf(cleaned) >= 0)
32
+ return resolve(true);
33
+ if (noValues.indexOf(cleaned) >= 0)
34
+ return resolve(false);
35
+ invalid({ question, yesValues, noValues });
36
+ const result = await (0, exports.yesOrNo)({
37
+ question,
38
+ defaultValue,
39
+ });
40
+ resolve(result);
41
+ });
42
+ });
43
+ };
44
+ exports.yesOrNo = yesOrNo;
@@ -0,0 +1 @@
1
+ export declare const executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.executeCommand = void 0;
4
+ const args_1 = require("./args");
5
+ const permissions_1 = require("./commands/permissions");
6
+ const regions_1 = require("./commands/regions");
7
+ const render_1 = require("./commands/render");
8
+ const services_1 = require("./commands/services");
9
+ const sites_1 = require("./commands/sites");
10
+ const still_1 = require("./commands/still");
11
+ const help_1 = require("./help");
12
+ const quit_1 = require("./helpers/quit");
13
+ const log_1 = require("./log");
14
+ const matchCommand = (args, remotionRoot) => {
15
+ if (args_1.parsedCloudrunCli.help || args.length === 0 || args[0] === 'help') {
16
+ (0, help_1.printHelp)();
17
+ (0, quit_1.quit)(0);
18
+ }
19
+ if (args[0] === render_1.RENDER_COMMAND) {
20
+ return (0, render_1.renderCommand)(args.slice(1), remotionRoot);
21
+ }
22
+ if (args[0] === still_1.STILL_COMMAND) {
23
+ return (0, still_1.stillCommand)(args.slice(1), remotionRoot);
24
+ }
25
+ if (args[0] === services_1.SERVICES_COMMAND) {
26
+ return (0, services_1.servicesCommand)(args.slice(1));
27
+ }
28
+ if (args[0] === sites_1.SITES_COMMAND) {
29
+ return (0, sites_1.sitesCommand)(args.slice(1), remotionRoot);
30
+ }
31
+ if (args[0] === regions_1.REGIONS_COMMAND) {
32
+ return (0, regions_1.regionsCommand)();
33
+ }
34
+ if (args[0] === permissions_1.PERMISSIONS_COMMAND) {
35
+ return (0, permissions_1.permissionsCommand)();
36
+ }
37
+ if (args[0] === 'deploy') {
38
+ log_1.Log.info(`The "deploy" command does not exist.`);
39
+ log_1.Log.info(`Did you mean "service deploy"?`);
40
+ }
41
+ log_1.Log.error(`Command ${args[0]} not found.`);
42
+ (0, help_1.printHelp)();
43
+ (0, quit_1.quit)(1);
44
+ };
45
+ const executeCommand = async (args, remotionRoot) => {
46
+ try {
47
+ await matchCommand(args, remotionRoot);
48
+ }
49
+ catch (err) {
50
+ const error = err;
51
+ // todo: catch errors and print a message. Check lambda cli for example
52
+ log_1.Log.error(error.stack);
53
+ (0, quit_1.quit)(1);
54
+ }
55
+ };
56
+ exports.executeCommand = executeCommand;
@@ -0,0 +1,26 @@
1
+ export declare const Log: {
2
+ verbose: (message?: any, ...optionalParams: any[]) => void;
3
+ verboseAdvanced: (options: {
4
+ indent: boolean;
5
+ logLevel: "error" | "verbose" | "info" | "warn";
6
+ } & {
7
+ tag?: string | undefined;
8
+ }, message?: any, ...optionalParams: any[]) => void;
9
+ info: (message?: any, ...optionalParams: any[]) => void;
10
+ infoAdvanced: (options: {
11
+ indent: boolean;
12
+ logLevel: "error" | "verbose" | "info" | "warn";
13
+ }, message?: any, ...optionalParams: any[]) => void;
14
+ warn: (message?: any, ...optionalParams: any[]) => void;
15
+ warnAdvanced: (options: {
16
+ indent: boolean;
17
+ logLevel: "error" | "verbose" | "info" | "warn";
18
+ }, message?: any, ...optionalParams: any[]) => void;
19
+ error: (message?: any, ...optionalParams: any[]) => void;
20
+ errorAdvanced: (options: {
21
+ indent: boolean;
22
+ logLevel: "error" | "verbose" | "info" | "warn";
23
+ } & {
24
+ tag?: string | undefined;
25
+ }, message?: any, ...optionalParams: any[]) => void;
26
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Log = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ exports.Log = renderer_1.RenderInternals.Log;
@@ -0,0 +1 @@
1
+ export * from './shared/constants';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shared/constants"), exports);
@@ -0,0 +1,2 @@
1
+ import type { CloudRunPayloadType } from './payloads';
2
+ export declare const getCompositionFromBody: (body: CloudRunPayloadType) => Promise<import("remotion").VideoConfig>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompositionFromBody = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const getCompositionFromBody = async (body) => {
6
+ var _a, _b;
7
+ const { metadata, propsSize } = await renderer_1.RenderInternals.internalSelectComposition({
8
+ serveUrl: body.serveUrl,
9
+ browserExecutable: null,
10
+ chromiumOptions: (_a = body.chromiumOptions) !== null && _a !== void 0 ? _a : {},
11
+ envVariables: (_b = body.envVariables) !== null && _b !== void 0 ? _b : {},
12
+ id: body.composition,
13
+ indent: false,
14
+ serializedInputPropsWithCustomSchema: body.serializedInputPropsWithCustomSchema,
15
+ logLevel: body.logLevel,
16
+ onBrowserLog: () => null,
17
+ port: null,
18
+ puppeteerInstance: undefined,
19
+ server: undefined,
20
+ timeoutInMilliseconds: body.delayRenderTimeoutInMilliseconds,
21
+ });
22
+ if (propsSize > 10000000) {
23
+ renderer_1.RenderInternals.Log.warn(`The props of your composition are large (${propsSize} bytes). This may cause slowdown.`);
24
+ }
25
+ return metadata;
26
+ };
27
+ exports.getCompositionFromBody = getCompositionFromBody;