@remotion/serverless-client 4.0.261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.turbo/turbo-make.log +6 -0
  2. package/LICENSE.md +49 -0
  3. package/README.md +5 -0
  4. package/bundle.ts +15 -0
  5. package/dist/await.d.ts +1 -0
  6. package/dist/await.js +2 -0
  7. package/dist/calculate-chunk-times.d.ts +5 -0
  8. package/dist/calculate-chunk-times.js +29 -0
  9. package/dist/compress-props.d.ts +30 -0
  10. package/dist/compress-props.js +97 -0
  11. package/dist/constants.d.ts +314 -0
  12. package/dist/constants.js +64 -0
  13. package/dist/docs-url.d.ts +1 -0
  14. package/dist/docs-url.js +4 -0
  15. package/dist/error-category.d.ts +3 -0
  16. package/dist/error-category.js +16 -0
  17. package/dist/esm/index.mjs +3467 -0
  18. package/dist/estimate-price-from-bucket.d.ts +15 -0
  19. package/dist/estimate-price-from-bucket.js +31 -0
  20. package/dist/expected-out-name.d.ts +10 -0
  21. package/dist/expected-out-name.js +53 -0
  22. package/dist/format-costs-info.d.ts +2 -0
  23. package/dist/format-costs-info.js +23 -0
  24. package/dist/get-custom-out-name.d.ts +7 -0
  25. package/dist/get-custom-out-name.js +33 -0
  26. package/dist/get-files-in-folder.d.ts +5 -0
  27. package/dist/get-files-in-folder.js +2 -0
  28. package/dist/get-or-create-bucket.d.ts +23 -0
  29. package/dist/get-or-create-bucket.js +44 -0
  30. package/dist/get-overall-progress-from-storage.d.ts +11 -0
  31. package/dist/get-overall-progress-from-storage.js +25 -0
  32. package/dist/get-overall-progress.d.ts +9 -0
  33. package/dist/get-overall-progress.js +23 -0
  34. package/dist/index.d.ts +50 -0
  35. package/dist/index.js +105 -0
  36. package/dist/input-props-keys.d.ts +2 -0
  37. package/dist/input-props-keys.js +11 -0
  38. package/dist/inspect-error.d.ts +4 -0
  39. package/dist/inspect-error.js +39 -0
  40. package/dist/make-bucket-name.d.ts +3 -0
  41. package/dist/make-bucket-name.js +7 -0
  42. package/dist/make-timeout-error.d.ts +13 -0
  43. package/dist/make-timeout-error.js +32 -0
  44. package/dist/make-timeout-message.d.ts +12 -0
  45. package/dist/make-timeout-message.js +76 -0
  46. package/dist/min-max.d.ts +2 -0
  47. package/dist/min-max.js +33 -0
  48. package/dist/most-expensive-chunks.d.ts +13 -0
  49. package/dist/most-expensive-chunks.js +28 -0
  50. package/dist/overall-render-progress.d.ts +24 -0
  51. package/dist/overall-render-progress.js +2 -0
  52. package/dist/progress.d.ts +16 -0
  53. package/dist/progress.js +258 -0
  54. package/dist/provider-implementation.d.ts +193 -0
  55. package/dist/provider-implementation.js +2 -0
  56. package/dist/render-has-audio-video.d.ts +6 -0
  57. package/dist/render-has-audio-video.js +21 -0
  58. package/dist/render-metadata.d.ts +45 -0
  59. package/dist/render-metadata.js +2 -0
  60. package/dist/render-progress.d.ts +51 -0
  61. package/dist/render-progress.js +2 -0
  62. package/dist/return-values.d.ts +38 -0
  63. package/dist/return-values.js +2 -0
  64. package/dist/serialize-artifact.d.ts +9 -0
  65. package/dist/serialize-artifact.js +37 -0
  66. package/dist/stream-to-string.d.ts +2 -0
  67. package/dist/stream-to-string.js +14 -0
  68. package/dist/streaming/streaming.d.ts +101 -0
  69. package/dist/streaming/streaming.js +61 -0
  70. package/dist/test/dont-contain-forbidden.test.d.ts +1 -0
  71. package/dist/test/dont-contain-forbidden.test.js +18 -0
  72. package/dist/test/expected-out-name.test.d.ts +1 -0
  73. package/dist/test/expected-out-name.test.js +167 -0
  74. package/dist/test/min-max.test.d.ts +1 -0
  75. package/dist/test/min-max.test.js +24 -0
  76. package/dist/test/most-expensive-chunks.test.d.ts +1 -0
  77. package/dist/test/most-expensive-chunks.test.js +163 -0
  78. package/dist/truthy.d.ts +3 -0
  79. package/dist/truthy.js +6 -0
  80. package/dist/types.d.ts +55 -0
  81. package/dist/types.js +2 -0
  82. package/dist/validate-bucket-name.d.ts +7 -0
  83. package/dist/validate-bucket-name.js +16 -0
  84. package/dist/validate-download-behavior.d.ts +1 -0
  85. package/dist/validate-download-behavior.js +21 -0
  86. package/dist/validate-frames-per-function.d.ts +4 -0
  87. package/dist/validate-frames-per-function.js +29 -0
  88. package/dist/validate-outname.d.ts +9 -0
  89. package/dist/validate-outname.js +43 -0
  90. package/dist/validate-privacy.d.ts +2 -0
  91. package/dist/validate-privacy.js +14 -0
  92. package/dist/validate-webhook.d.ts +3 -0
  93. package/dist/validate-webhook.js +16 -0
  94. package/dist/webhook-types.d.ts +29 -0
  95. package/dist/webhook-types.js +2 -0
  96. package/dist/write-error-to-storage.d.ts +24 -0
  97. package/dist/write-error-to-storage.js +2 -0
  98. package/eslint.config.mjs +5 -0
  99. package/package.json +41 -0
  100. package/src/await.ts +1 -0
  101. package/src/calculate-chunk-times.ts +42 -0
  102. package/src/compress-props.ts +171 -0
  103. package/src/constants.ts +403 -0
  104. package/src/docs-url.ts +1 -0
  105. package/src/error-category.ts +14 -0
  106. package/src/estimate-price-from-bucket.ts +59 -0
  107. package/src/expected-out-name.ts +83 -0
  108. package/src/format-costs-info.ts +24 -0
  109. package/src/get-custom-out-name.ts +44 -0
  110. package/src/get-files-in-folder.ts +6 -0
  111. package/src/get-or-create-bucket.ts +79 -0
  112. package/src/get-overall-progress-from-storage.ts +44 -0
  113. package/src/get-overall-progress.ts +42 -0
  114. package/src/index.ts +125 -0
  115. package/src/input-props-keys.ts +7 -0
  116. package/src/inspect-error.ts +60 -0
  117. package/src/make-bucket-name.ts +9 -0
  118. package/src/make-timeout-error.ts +51 -0
  119. package/src/make-timeout-message.ts +118 -0
  120. package/src/min-max.ts +34 -0
  121. package/src/most-expensive-chunks.ts +46 -0
  122. package/src/overall-render-progress.ts +30 -0
  123. package/src/progress.ts +327 -0
  124. package/src/provider-implementation.ts +261 -0
  125. package/src/render-has-audio-video.ts +28 -0
  126. package/src/render-metadata.ts +60 -0
  127. package/src/render-progress.ts +58 -0
  128. package/src/return-values.ts +45 -0
  129. package/src/serialize-artifact.ts +51 -0
  130. package/src/stream-to-string.ts +14 -0
  131. package/src/streaming/streaming.ts +148 -0
  132. package/src/test/dont-contain-forbidden.test.ts +14 -0
  133. package/src/test/expected-out-name.test.ts +197 -0
  134. package/src/test/min-max.test.ts +25 -0
  135. package/src/test/most-expensive-chunks.test.ts +167 -0
  136. package/src/truthy.ts +5 -0
  137. package/src/types.ts +77 -0
  138. package/src/validate-bucket-name.ts +34 -0
  139. package/src/validate-download-behavior.ts +26 -0
  140. package/src/validate-frames-per-function.ts +54 -0
  141. package/src/validate-outname.ts +63 -0
  142. package/src/validate-privacy.ts +20 -0
  143. package/src/validate-webhook.ts +18 -0
  144. package/src/webhook-types.ts +36 -0
  145. package/src/write-error-to-storage.ts +23 -0
  146. package/tsconfig.json +18 -0
  147. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,15 @@
1
+ import type { ProviderSpecifics } from './provider-implementation';
2
+ import type { RenderMetadata } from './render-metadata';
3
+ import type { CloudProvider, ParsedTiming } from './types';
4
+ export declare const estimatePriceFromMetadata: <Provider extends CloudProvider>({ renderMetadata, memorySizeInMb, diskSizeInMb, functionsInvoked, timings, region, providerSpecifics, }: {
5
+ renderMetadata: RenderMetadata<Provider> | null;
6
+ memorySizeInMb: number;
7
+ diskSizeInMb: number;
8
+ functionsInvoked: number;
9
+ timings: ParsedTiming[];
10
+ region: Provider["region"];
11
+ providerSpecifics: ProviderSpecifics<Provider>;
12
+ }) => {
13
+ accruedSoFar: number;
14
+ estimatedBillingDurationInMilliseconds: number;
15
+ } | null;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimatePriceFromMetadata = void 0;
4
+ const calculate_chunk_times_1 = require("./calculate-chunk-times");
5
+ const estimatePriceFromMetadata = ({ renderMetadata, memorySizeInMb, diskSizeInMb, functionsInvoked, timings, region, providerSpecifics, }) => {
6
+ var _a, _b;
7
+ if (!renderMetadata) {
8
+ return null;
9
+ }
10
+ const elapsedTime = Math.max(0, Date.now() - ((_a = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.startedDate) !== null && _a !== void 0 ? _a : 0));
11
+ const unfinished = Math.max(0, ((_b = renderMetadata === null || renderMetadata === void 0 ? void 0 : renderMetadata.totalChunks) !== null && _b !== void 0 ? _b : 0) - timings.length);
12
+ const timeElapsedOfUnfinished = new Array(unfinished)
13
+ .fill(true)
14
+ .map(() => elapsedTime)
15
+ .reduce((a, b) => a + b, 0);
16
+ const estimatedBillingDurationInMilliseconds = (0, calculate_chunk_times_1.calculateChunkTimes)({
17
+ type: 'combined-time-for-cost-calculation',
18
+ timings,
19
+ }) + timeElapsedOfUnfinished;
20
+ const accruedSoFar = Number(providerSpecifics
21
+ .estimatePrice({
22
+ region,
23
+ durationInMilliseconds: estimatedBillingDurationInMilliseconds,
24
+ memorySizeInMb,
25
+ diskSizeInMb,
26
+ lambdasInvoked: functionsInvoked,
27
+ })
28
+ .toPrecision(5));
29
+ return { accruedSoFar, estimatedBillingDurationInMilliseconds };
30
+ };
31
+ exports.estimatePriceFromMetadata = estimatePriceFromMetadata;
@@ -0,0 +1,10 @@
1
+ import { type CustomCredentials, type OutNameInput, type OutNameOutput } from './constants';
2
+ import type { RenderMetadata } from './render-metadata';
3
+ import type { CloudProvider } from './types';
4
+ export declare const getCredentialsFromOutName: <Provider extends CloudProvider>(name: OutNameInput<Provider> | null) => CustomCredentials<Provider> | null;
5
+ export declare const getExpectedOutName: <Provider extends CloudProvider>({ renderMetadata, bucketName, customCredentials, bucketNamePrefix, }: {
6
+ renderMetadata: RenderMetadata<Provider>;
7
+ bucketName: string;
8
+ customCredentials: CustomCredentials<Provider> | null;
9
+ bucketNamePrefix: string;
10
+ }) => OutNameOutput<Provider>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExpectedOutName = exports.getCredentialsFromOutName = void 0;
4
+ const pure_1 = require("@remotion/renderer/pure");
5
+ const constants_1 = require("./constants");
6
+ const get_custom_out_name_1 = require("./get-custom-out-name");
7
+ const validate_outname_1 = require("./validate-outname");
8
+ const getCredentialsFromOutName = (name) => {
9
+ var _a;
10
+ if (typeof name === 'string') {
11
+ return null;
12
+ }
13
+ if (name === null) {
14
+ return null;
15
+ }
16
+ if (typeof name === 'undefined') {
17
+ return null;
18
+ }
19
+ return (_a = name.s3OutputProvider) !== null && _a !== void 0 ? _a : null;
20
+ };
21
+ exports.getCredentialsFromOutName = getCredentialsFromOutName;
22
+ const getExpectedOutName = ({ renderMetadata, bucketName, customCredentials, bucketNamePrefix, }) => {
23
+ const outNameValue = (0, get_custom_out_name_1.getCustomOutName)({
24
+ customCredentials,
25
+ renderMetadata,
26
+ });
27
+ if (outNameValue) {
28
+ (0, validate_outname_1.validateOutname)({
29
+ outName: outNameValue,
30
+ codec: renderMetadata.codec,
31
+ audioCodecSetting: renderMetadata.audioCodec,
32
+ separateAudioTo: null,
33
+ bucketNamePrefix,
34
+ });
35
+ return (0, constants_1.customOutName)(renderMetadata.renderId, bucketName, outNameValue);
36
+ }
37
+ if (renderMetadata.type === 'still') {
38
+ return {
39
+ renderBucketName: bucketName,
40
+ key: (0, constants_1.outStillName)(renderMetadata.renderId, renderMetadata.imageFormat),
41
+ customCredentials: null,
42
+ };
43
+ }
44
+ if (renderMetadata.type === 'video') {
45
+ return {
46
+ renderBucketName: bucketName,
47
+ key: (0, constants_1.outName)(renderMetadata.renderId, pure_1.NoReactAPIs.getFileExtensionFromCodec(renderMetadata.codec, renderMetadata.audioCodec)),
48
+ customCredentials: null,
49
+ };
50
+ }
51
+ throw new TypeError('no type passed');
52
+ };
53
+ exports.getExpectedOutName = getExpectedOutName;
@@ -0,0 +1,2 @@
1
+ import type { CostsInfo } from './types';
2
+ export declare const formatCostsInfo: (accrued: number) => CostsInfo;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatCostsInfo = void 0;
4
+ const display = (accrued) => {
5
+ if (accrued < 0.001) {
6
+ return '<$0.001';
7
+ }
8
+ return new Intl.NumberFormat('en-US', {
9
+ currency: 'USD',
10
+ style: 'currency',
11
+ currencyDisplay: 'narrowSymbol',
12
+ minimumFractionDigits: 3,
13
+ }).format(accrued);
14
+ };
15
+ const formatCostsInfo = (accrued) => {
16
+ return {
17
+ accruedSoFar: accrued,
18
+ displayCost: display(accrued),
19
+ currency: 'USD',
20
+ disclaimer: 'Estimated cost only. Does not include charges for other AWS services.',
21
+ };
22
+ };
23
+ exports.formatCostsInfo = formatCostsInfo;
@@ -0,0 +1,7 @@
1
+ import type { CustomCredentials, OutNameInput } from './constants';
2
+ import type { RenderMetadata } from './render-metadata';
3
+ import type { CloudProvider } from './types';
4
+ export declare const getCustomOutName: <Provider extends CloudProvider>({ renderMetadata, customCredentials, }: {
5
+ renderMetadata: RenderMetadata<Provider>;
6
+ customCredentials: CustomCredentials<Provider> | null;
7
+ }) => OutNameInput<Provider> | null;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCustomOutName = void 0;
4
+ const getCustomOutName = ({ renderMetadata, customCredentials, }) => {
5
+ var _a, _b, _c;
6
+ if (!renderMetadata.outName) {
7
+ return null;
8
+ }
9
+ if (typeof renderMetadata.outName === 'string') {
10
+ return renderMetadata.outName;
11
+ }
12
+ if (renderMetadata.outName.s3OutputProvider) {
13
+ if (!customCredentials && renderMetadata.privacy === 'private') {
14
+ throw new TypeError(`The file was rendered with a custom S3 implementation and is not public, but no custom credentials were passed to downloadMedia().`);
15
+ }
16
+ return {
17
+ bucketName: renderMetadata.outName.bucketName,
18
+ key: renderMetadata.outName.key,
19
+ s3OutputProvider: {
20
+ endpoint: renderMetadata.outName.s3OutputProvider.endpoint,
21
+ accessKeyId: (_a = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.accessKeyId) !== null && _a !== void 0 ? _a : null,
22
+ secretAccessKey: (_b = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.secretAccessKey) !== null && _b !== void 0 ? _b : null,
23
+ region: customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.region,
24
+ forcePathStyle: (_c = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.forcePathStyle) !== null && _c !== void 0 ? _c : false,
25
+ },
26
+ };
27
+ }
28
+ return {
29
+ bucketName: renderMetadata.outName.bucketName,
30
+ key: renderMetadata.outName.key,
31
+ };
32
+ };
33
+ exports.getCustomOutName = getCustomOutName;
@@ -0,0 +1,5 @@
1
+ export type FileNameAndSize = {
2
+ filename: string;
3
+ size: number;
4
+ };
5
+ export type GetFolderFiles = (folder: string) => FileNameAndSize[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ import type { CustomCredentials } from './constants';
2
+ import type { ProviderSpecifics } from './provider-implementation';
3
+ import type { CloudProvider } from './types';
4
+ type GetOrCreateBucketInputInner<Provider extends CloudProvider> = {
5
+ region: Provider['region'];
6
+ enableFolderExpiry: boolean | null;
7
+ customCredentials: CustomCredentials<Provider> | null;
8
+ providerSpecifics: ProviderSpecifics<Provider>;
9
+ forcePathStyle: boolean;
10
+ skipPutAcl: boolean;
11
+ };
12
+ export type GetOrCreateBucketInput<Provider extends CloudProvider> = {
13
+ region: Provider['region'];
14
+ enableFolderExpiry?: boolean;
15
+ customCredentials?: CustomCredentials<Provider>;
16
+ forcePathStyle?: boolean;
17
+ };
18
+ export type GetOrCreateBucketOutput = {
19
+ bucketName: string;
20
+ alreadyExisted: boolean;
21
+ };
22
+ export declare const internalGetOrCreateBucket: <Provider extends CloudProvider>(params: GetOrCreateBucketInputInner<Provider>) => Promise<GetOrCreateBucketOutput>;
23
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.internalGetOrCreateBucket = void 0;
4
+ const make_bucket_name_1 = require("./make-bucket-name");
5
+ const internalGetOrCreateBucket = async (params) => {
6
+ const remotionBuckets = await params.providerSpecifics.getBuckets({
7
+ region: params.region,
8
+ forceBucketName: null,
9
+ forcePathStyle: params.forcePathStyle,
10
+ });
11
+ if (remotionBuckets.length > 1) {
12
+ throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${params.region}) starting with "${params.providerSpecifics.getBucketPrefix()}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
13
+ }
14
+ const { enableFolderExpiry, region } = params;
15
+ if (remotionBuckets.length === 1) {
16
+ const existingBucketName = remotionBuckets[0].name;
17
+ // apply to existing bucket
18
+ await params.providerSpecifics.applyLifeCycle({
19
+ enableFolderExpiry: enableFolderExpiry !== null && enableFolderExpiry !== void 0 ? enableFolderExpiry : null,
20
+ bucketName: existingBucketName,
21
+ region,
22
+ customCredentials: params.customCredentials,
23
+ forcePathStyle: params.forcePathStyle,
24
+ });
25
+ return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
26
+ }
27
+ const bucketName = (0, make_bucket_name_1.makeBucketName)(params.region, params.providerSpecifics);
28
+ await params.providerSpecifics.createBucket({
29
+ bucketName,
30
+ region: params.region,
31
+ forcePathStyle: params.forcePathStyle,
32
+ skipPutAcl: params.skipPutAcl,
33
+ });
34
+ // apply to newly created bucket
35
+ await params.providerSpecifics.applyLifeCycle({
36
+ enableFolderExpiry: enableFolderExpiry !== null && enableFolderExpiry !== void 0 ? enableFolderExpiry : null,
37
+ bucketName,
38
+ region,
39
+ customCredentials: params.customCredentials,
40
+ forcePathStyle: params.forcePathStyle,
41
+ });
42
+ return { bucketName, alreadyExisted: false };
43
+ };
44
+ exports.internalGetOrCreateBucket = internalGetOrCreateBucket;
@@ -0,0 +1,11 @@
1
+ import type { OverallRenderProgress } from './overall-render-progress';
2
+ import type { ProviderSpecifics } from './provider-implementation';
3
+ import type { CloudProvider } from './types';
4
+ export declare const getOverallProgressFromStorage: <Provider extends CloudProvider>({ renderId, bucketName, expectedBucketOwner, region, providerSpecifics, forcePathStyle, }: {
5
+ renderId: string;
6
+ expectedBucketOwner: string | null;
7
+ bucketName: string;
8
+ region: Provider["region"];
9
+ providerSpecifics: ProviderSpecifics<Provider>;
10
+ forcePathStyle: boolean;
11
+ }) => Promise<OverallRenderProgress<Provider>>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOverallProgressFromStorage = void 0;
4
+ const constants_1 = require("./constants");
5
+ const stream_to_string_1 = require("./stream-to-string");
6
+ const getOverallProgressFromStorage = async ({ renderId, bucketName, expectedBucketOwner, region, providerSpecifics, forcePathStyle, }) => {
7
+ try {
8
+ const Body = await providerSpecifics.readFile({
9
+ bucketName,
10
+ key: (0, constants_1.overallProgressKey)(renderId),
11
+ expectedBucketOwner,
12
+ region,
13
+ forcePathStyle,
14
+ });
15
+ const str = await (0, stream_to_string_1.streamToString)(Body);
16
+ return JSON.parse(str);
17
+ }
18
+ catch (err) {
19
+ if (err.name === 'NotFound') {
20
+ throw new TypeError(`No render with ID "${renderId}" found in bucket ${bucketName} and region ${region}`);
21
+ }
22
+ throw err;
23
+ }
24
+ };
25
+ exports.getOverallProgressFromStorage = getOverallProgressFromStorage;
@@ -0,0 +1,9 @@
1
+ export declare const getOverallProgress: ({ encoding, invoking, frames, invokedLambda, visitedServeUrl, gotComposition, combining, }: {
2
+ invokedLambda: number;
3
+ visitedServeUrl: number | null;
4
+ gotComposition: number | null;
5
+ encoding: number;
6
+ invoking: number;
7
+ frames: number;
8
+ combining: number;
9
+ }) => number;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOverallProgress = void 0;
4
+ const weights = {
5
+ evaluating: 0.1,
6
+ encoding: 0.1,
7
+ frames: 0.6,
8
+ invoking: 0.1,
9
+ combining: 0.1,
10
+ };
11
+ const getOverallProgress = ({ encoding, invoking, frames, invokedLambda, visitedServeUrl, gotComposition, combining, }) => {
12
+ const evaluationProgress = [
13
+ Boolean(invokedLambda),
14
+ Boolean(visitedServeUrl),
15
+ Boolean(gotComposition),
16
+ ].reduce((a, b) => Number(a) + Number(b), 0) / 3;
17
+ return (evaluationProgress * weights.evaluating +
18
+ encoding * weights.encoding +
19
+ invoking * weights.invoking +
20
+ frames * weights.frames +
21
+ combining * weights.combining);
22
+ };
23
+ exports.getOverallProgress = getOverallProgress;
@@ -0,0 +1,50 @@
1
+ import { interpolate, random } from 'remotion/no-react';
2
+ export * from './constants';
3
+ export { artifactName, customOutName, expiryDays, MINIMUM_FRAMES_PER_FUNCTIONS, outName, outStillName, overallProgressKey, rendersPrefix, ServerlessCodec, serverlessCodecs, ServerlessPayload, ServerlessPayloads, ServerlessRoutines, ServerlessStartPayload, ServerlessStatusPayload, type CustomCredentials, type CustomCredentialsWithoutSensitiveData, type DeleteAfter, type DownloadBehavior, type OutNameInput, type OutNameInputWithoutCredentials, type OutNameOutput, type Privacy, type SerializedInputProps, type WebhookOption, } from './constants';
4
+ export { GenericRenderProgress } from './render-progress';
5
+ export { deserializeArtifact, serializeArtifact, SerializedArtifact, } from './serialize-artifact';
6
+ export { validateDownloadBehavior } from './validate-download-behavior';
7
+ export { validateFramesPerFunction } from './validate-frames-per-function';
8
+ export type { AudioCodec, ChromiumOptions, ColorSpace, FrameRange, LogLevel, PixelFormat, ProResProfile, StillImageFormat, ToOptions, VideoImageFormat, X264Preset, } from '@remotion/renderer';
9
+ export type { BrowserSafeApis } from '@remotion/renderer/client';
10
+ export { wrapWithErrorHandling } from '@remotion/renderer/error-handling';
11
+ export { makeStreamer, makeStreamPayloadMessage } from '@remotion/streaming';
12
+ export type { VideoConfig } from 'remotion/no-react';
13
+ export { VERSION } from 'remotion/version';
14
+ export { Await } from './await';
15
+ export { calculateChunkTimes } from './calculate-chunk-times';
16
+ export { compressInputProps, decompressInputProps, getNeedsToUpload, serializeOrThrow, } from './compress-props';
17
+ export { MAX_FUNCTIONS_PER_RENDER } from './constants';
18
+ export { DOCS_URL } from './docs-url';
19
+ export { errorIsOutOfSpaceError, isBrowserCrashedError, isErrInsufficientResourcesErr, } from './error-category';
20
+ export { estimatePriceFromMetadata } from './estimate-price-from-bucket';
21
+ export { getCredentialsFromOutName, getExpectedOutName, } from './expected-out-name';
22
+ export { formatCostsInfo } from './format-costs-info';
23
+ export { FileNameAndSize, GetFolderFiles } from './get-files-in-folder';
24
+ export { GetOrCreateBucketInput, GetOrCreateBucketOutput, internalGetOrCreateBucket, } from './get-or-create-bucket';
25
+ export { getOverallProgressFromStorage } from './get-overall-progress-from-storage';
26
+ export { inputPropsKey, resolvedPropsKey } from './input-props-keys';
27
+ export { inspectErrors } from './inspect-error';
28
+ export { makeBucketName } from './make-bucket-name';
29
+ export { getMostExpensiveChunks, OVERHEAD_TIME_PER_LAMBDA, } from './most-expensive-chunks';
30
+ export { OverallRenderProgress } from './overall-render-progress';
31
+ export { getProgress } from './progress';
32
+ export * from './provider-implementation';
33
+ export { RenderMetadata } from './render-metadata';
34
+ export { OrError, ServerlessReturnValues } from './return-values';
35
+ export { streamToString } from './stream-to-string';
36
+ export { formatMap, makeStreamPayload, MessageTypeId, messageTypeIdToMessageType, OnMessage, OnStream, StreamingMessage, StreamingPayload, } from './streaming/streaming';
37
+ export { truthy } from './truthy';
38
+ export * from './types';
39
+ export { validateBucketName } from './validate-bucket-name';
40
+ export { validateOutname } from './validate-outname';
41
+ export { validatePrivacy } from './validate-privacy';
42
+ export { validateWebhook } from './validate-webhook';
43
+ export * from './webhook-types';
44
+ export { EnhancedErrorInfo, FunctionErrorInfo } from './write-error-to-storage';
45
+ export { interpolate, random };
46
+ export declare const ENABLE_V5_BREAKING_CHANGES: false, serializeJSONWithDate: ({ data, indent, staticBase, }: {
47
+ data: Record<string, unknown>;
48
+ indent: number | undefined;
49
+ staticBase: string | null;
50
+ }) => import("remotion").SerializedJSONWithCustomFields, validateFps: typeof import("remotion/dist/cjs/validation/validate-fps").validateFps, validateDimension: typeof import("remotion/dist/cjs/validation/validate-dimensions").validateDimension, validateDurationInFrames: typeof import("remotion/dist/cjs/validation/validate-duration-in-frames").validateDurationInFrames;
package/dist/index.js ADDED
@@ -0,0 +1,105 @@
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
+ exports.validateWebhook = exports.validatePrivacy = exports.validateOutname = exports.validateBucketName = exports.truthy = exports.messageTypeIdToMessageType = exports.makeStreamPayload = exports.formatMap = exports.streamToString = exports.getProgress = exports.OVERHEAD_TIME_PER_LAMBDA = exports.getMostExpensiveChunks = exports.makeBucketName = exports.inspectErrors = exports.resolvedPropsKey = exports.inputPropsKey = exports.getOverallProgressFromStorage = exports.internalGetOrCreateBucket = exports.formatCostsInfo = exports.getExpectedOutName = exports.getCredentialsFromOutName = exports.estimatePriceFromMetadata = exports.isErrInsufficientResourcesErr = exports.isBrowserCrashedError = exports.errorIsOutOfSpaceError = exports.DOCS_URL = exports.MAX_FUNCTIONS_PER_RENDER = exports.serializeOrThrow = exports.getNeedsToUpload = exports.decompressInputProps = exports.compressInputProps = exports.calculateChunkTimes = exports.VERSION = exports.makeStreamPayloadMessage = exports.makeStreamer = exports.wrapWithErrorHandling = exports.validateFramesPerFunction = exports.validateDownloadBehavior = exports.serializeArtifact = exports.deserializeArtifact = exports.ServerlessRoutines = exports.serverlessCodecs = exports.rendersPrefix = exports.overallProgressKey = exports.outStillName = exports.outName = exports.MINIMUM_FRAMES_PER_FUNCTIONS = exports.expiryDays = exports.customOutName = exports.artifactName = void 0;
18
+ exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = exports.serializeJSONWithDate = exports.ENABLE_V5_BREAKING_CHANGES = exports.random = exports.interpolate = void 0;
19
+ const no_react_1 = require("remotion/no-react");
20
+ Object.defineProperty(exports, "interpolate", { enumerable: true, get: function () { return no_react_1.interpolate; } });
21
+ Object.defineProperty(exports, "random", { enumerable: true, get: function () { return no_react_1.random; } });
22
+ __exportStar(require("./constants"), exports);
23
+ var constants_1 = require("./constants");
24
+ Object.defineProperty(exports, "artifactName", { enumerable: true, get: function () { return constants_1.artifactName; } });
25
+ Object.defineProperty(exports, "customOutName", { enumerable: true, get: function () { return constants_1.customOutName; } });
26
+ Object.defineProperty(exports, "expiryDays", { enumerable: true, get: function () { return constants_1.expiryDays; } });
27
+ Object.defineProperty(exports, "MINIMUM_FRAMES_PER_FUNCTIONS", { enumerable: true, get: function () { return constants_1.MINIMUM_FRAMES_PER_FUNCTIONS; } });
28
+ Object.defineProperty(exports, "outName", { enumerable: true, get: function () { return constants_1.outName; } });
29
+ Object.defineProperty(exports, "outStillName", { enumerable: true, get: function () { return constants_1.outStillName; } });
30
+ Object.defineProperty(exports, "overallProgressKey", { enumerable: true, get: function () { return constants_1.overallProgressKey; } });
31
+ Object.defineProperty(exports, "rendersPrefix", { enumerable: true, get: function () { return constants_1.rendersPrefix; } });
32
+ Object.defineProperty(exports, "serverlessCodecs", { enumerable: true, get: function () { return constants_1.serverlessCodecs; } });
33
+ Object.defineProperty(exports, "ServerlessRoutines", { enumerable: true, get: function () { return constants_1.ServerlessRoutines; } });
34
+ var serialize_artifact_1 = require("./serialize-artifact");
35
+ Object.defineProperty(exports, "deserializeArtifact", { enumerable: true, get: function () { return serialize_artifact_1.deserializeArtifact; } });
36
+ Object.defineProperty(exports, "serializeArtifact", { enumerable: true, get: function () { return serialize_artifact_1.serializeArtifact; } });
37
+ var validate_download_behavior_1 = require("./validate-download-behavior");
38
+ Object.defineProperty(exports, "validateDownloadBehavior", { enumerable: true, get: function () { return validate_download_behavior_1.validateDownloadBehavior; } });
39
+ var validate_frames_per_function_1 = require("./validate-frames-per-function");
40
+ Object.defineProperty(exports, "validateFramesPerFunction", { enumerable: true, get: function () { return validate_frames_per_function_1.validateFramesPerFunction; } });
41
+ var error_handling_1 = require("@remotion/renderer/error-handling");
42
+ Object.defineProperty(exports, "wrapWithErrorHandling", { enumerable: true, get: function () { return error_handling_1.wrapWithErrorHandling; } });
43
+ var streaming_1 = require("@remotion/streaming");
44
+ Object.defineProperty(exports, "makeStreamer", { enumerable: true, get: function () { return streaming_1.makeStreamer; } });
45
+ Object.defineProperty(exports, "makeStreamPayloadMessage", { enumerable: true, get: function () { return streaming_1.makeStreamPayloadMessage; } });
46
+ var version_1 = require("remotion/version");
47
+ Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
48
+ var calculate_chunk_times_1 = require("./calculate-chunk-times");
49
+ Object.defineProperty(exports, "calculateChunkTimes", { enumerable: true, get: function () { return calculate_chunk_times_1.calculateChunkTimes; } });
50
+ var compress_props_1 = require("./compress-props");
51
+ Object.defineProperty(exports, "compressInputProps", { enumerable: true, get: function () { return compress_props_1.compressInputProps; } });
52
+ Object.defineProperty(exports, "decompressInputProps", { enumerable: true, get: function () { return compress_props_1.decompressInputProps; } });
53
+ Object.defineProperty(exports, "getNeedsToUpload", { enumerable: true, get: function () { return compress_props_1.getNeedsToUpload; } });
54
+ Object.defineProperty(exports, "serializeOrThrow", { enumerable: true, get: function () { return compress_props_1.serializeOrThrow; } });
55
+ var constants_2 = require("./constants");
56
+ Object.defineProperty(exports, "MAX_FUNCTIONS_PER_RENDER", { enumerable: true, get: function () { return constants_2.MAX_FUNCTIONS_PER_RENDER; } });
57
+ var docs_url_1 = require("./docs-url");
58
+ Object.defineProperty(exports, "DOCS_URL", { enumerable: true, get: function () { return docs_url_1.DOCS_URL; } });
59
+ var error_category_1 = require("./error-category");
60
+ Object.defineProperty(exports, "errorIsOutOfSpaceError", { enumerable: true, get: function () { return error_category_1.errorIsOutOfSpaceError; } });
61
+ Object.defineProperty(exports, "isBrowserCrashedError", { enumerable: true, get: function () { return error_category_1.isBrowserCrashedError; } });
62
+ Object.defineProperty(exports, "isErrInsufficientResourcesErr", { enumerable: true, get: function () { return error_category_1.isErrInsufficientResourcesErr; } });
63
+ var estimate_price_from_bucket_1 = require("./estimate-price-from-bucket");
64
+ Object.defineProperty(exports, "estimatePriceFromMetadata", { enumerable: true, get: function () { return estimate_price_from_bucket_1.estimatePriceFromMetadata; } });
65
+ var expected_out_name_1 = require("./expected-out-name");
66
+ Object.defineProperty(exports, "getCredentialsFromOutName", { enumerable: true, get: function () { return expected_out_name_1.getCredentialsFromOutName; } });
67
+ Object.defineProperty(exports, "getExpectedOutName", { enumerable: true, get: function () { return expected_out_name_1.getExpectedOutName; } });
68
+ var format_costs_info_1 = require("./format-costs-info");
69
+ Object.defineProperty(exports, "formatCostsInfo", { enumerable: true, get: function () { return format_costs_info_1.formatCostsInfo; } });
70
+ var get_or_create_bucket_1 = require("./get-or-create-bucket");
71
+ Object.defineProperty(exports, "internalGetOrCreateBucket", { enumerable: true, get: function () { return get_or_create_bucket_1.internalGetOrCreateBucket; } });
72
+ var get_overall_progress_from_storage_1 = require("./get-overall-progress-from-storage");
73
+ Object.defineProperty(exports, "getOverallProgressFromStorage", { enumerable: true, get: function () { return get_overall_progress_from_storage_1.getOverallProgressFromStorage; } });
74
+ var input_props_keys_1 = require("./input-props-keys");
75
+ Object.defineProperty(exports, "inputPropsKey", { enumerable: true, get: function () { return input_props_keys_1.inputPropsKey; } });
76
+ Object.defineProperty(exports, "resolvedPropsKey", { enumerable: true, get: function () { return input_props_keys_1.resolvedPropsKey; } });
77
+ var inspect_error_1 = require("./inspect-error");
78
+ Object.defineProperty(exports, "inspectErrors", { enumerable: true, get: function () { return inspect_error_1.inspectErrors; } });
79
+ var make_bucket_name_1 = require("./make-bucket-name");
80
+ Object.defineProperty(exports, "makeBucketName", { enumerable: true, get: function () { return make_bucket_name_1.makeBucketName; } });
81
+ var most_expensive_chunks_1 = require("./most-expensive-chunks");
82
+ Object.defineProperty(exports, "getMostExpensiveChunks", { enumerable: true, get: function () { return most_expensive_chunks_1.getMostExpensiveChunks; } });
83
+ Object.defineProperty(exports, "OVERHEAD_TIME_PER_LAMBDA", { enumerable: true, get: function () { return most_expensive_chunks_1.OVERHEAD_TIME_PER_LAMBDA; } });
84
+ var progress_1 = require("./progress");
85
+ Object.defineProperty(exports, "getProgress", { enumerable: true, get: function () { return progress_1.getProgress; } });
86
+ __exportStar(require("./provider-implementation"), exports);
87
+ var stream_to_string_1 = require("./stream-to-string");
88
+ Object.defineProperty(exports, "streamToString", { enumerable: true, get: function () { return stream_to_string_1.streamToString; } });
89
+ var streaming_2 = require("./streaming/streaming");
90
+ Object.defineProperty(exports, "formatMap", { enumerable: true, get: function () { return streaming_2.formatMap; } });
91
+ Object.defineProperty(exports, "makeStreamPayload", { enumerable: true, get: function () { return streaming_2.makeStreamPayload; } });
92
+ Object.defineProperty(exports, "messageTypeIdToMessageType", { enumerable: true, get: function () { return streaming_2.messageTypeIdToMessageType; } });
93
+ var truthy_1 = require("./truthy");
94
+ Object.defineProperty(exports, "truthy", { enumerable: true, get: function () { return truthy_1.truthy; } });
95
+ __exportStar(require("./types"), exports);
96
+ var validate_bucket_name_1 = require("./validate-bucket-name");
97
+ Object.defineProperty(exports, "validateBucketName", { enumerable: true, get: function () { return validate_bucket_name_1.validateBucketName; } });
98
+ var validate_outname_1 = require("./validate-outname");
99
+ Object.defineProperty(exports, "validateOutname", { enumerable: true, get: function () { return validate_outname_1.validateOutname; } });
100
+ var validate_privacy_1 = require("./validate-privacy");
101
+ Object.defineProperty(exports, "validatePrivacy", { enumerable: true, get: function () { return validate_privacy_1.validatePrivacy; } });
102
+ var validate_webhook_1 = require("./validate-webhook");
103
+ Object.defineProperty(exports, "validateWebhook", { enumerable: true, get: function () { return validate_webhook_1.validateWebhook; } });
104
+ __exportStar(require("./webhook-types"), exports);
105
+ exports.ENABLE_V5_BREAKING_CHANGES = no_react_1.NoReactInternals.ENABLE_V5_BREAKING_CHANGES, exports.serializeJSONWithDate = no_react_1.NoReactInternals.serializeJSONWithDate, exports.validateFps = no_react_1.NoReactInternals.validateFps, exports.validateDimension = no_react_1.NoReactInternals.validateDimension, exports.validateDurationInFrames = no_react_1.NoReactInternals.validateDurationInFrames;
@@ -0,0 +1,2 @@
1
+ export declare const inputPropsKey: (hash: string) => string;
2
+ export declare const resolvedPropsKey: (hash: string) => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvedPropsKey = exports.inputPropsKey = void 0;
4
+ const inputPropsKey = (hash) => {
5
+ return `input-props/${hash}.json`;
6
+ };
7
+ exports.inputPropsKey = inputPropsKey;
8
+ const resolvedPropsKey = (hash) => {
9
+ return `resolved-props/${hash}.json`;
10
+ };
11
+ exports.resolvedPropsKey = resolvedPropsKey;
@@ -0,0 +1,4 @@
1
+ import type { EnhancedErrorInfo, FunctionErrorInfo } from './write-error-to-storage';
2
+ export declare const inspectErrors: ({ errors, }: {
3
+ errors: FunctionErrorInfo[];
4
+ }) => EnhancedErrorInfo[];
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inspectErrors = void 0;
4
+ const docs_url_1 = require("./docs-url");
5
+ const error_category_1 = require("./error-category");
6
+ const FAILED_TO_LAUNCH_TOKEN = 'Failed to launch browser.';
7
+ const getExplanation = (stack) => {
8
+ if (stack.includes('FATAL:zygote_communication_linux.cc')) {
9
+ return (FAILED_TO_LAUNCH_TOKEN +
10
+ ' Will be retried - you can probably ignore this error.');
11
+ }
12
+ if (stack.includes('error while loading shared libraries: libnss3.so')) {
13
+ return (FAILED_TO_LAUNCH_TOKEN +
14
+ ' Will be retried - you can probably ignore this error.');
15
+ }
16
+ if (stack.includes('TooManyRequestsException')) {
17
+ return `AWS returned an "TooManyRequestsException" error message which could mean you reached the concurrency limit of AWS Lambda. You can increase the limit - read this troubleshooting page: ${docs_url_1.DOCS_URL}/docs/lambda/troubleshooting/rate-limit`;
18
+ }
19
+ if ((0, error_category_1.errorIsOutOfSpaceError)(stack)) {
20
+ return `Your lambda function reached the storage limit. Reduce the amount of space needed per lambda function or increase the storage limit: ${docs_url_1.DOCS_URL}/docs/lambda/disk-size.`;
21
+ }
22
+ if ((0, error_category_1.isErrInsufficientResourcesErr)(stack)) {
23
+ return 'The lambda ran out of memory. Deploy a new function with more memory.';
24
+ }
25
+ if ((0, error_category_1.isBrowserCrashedError)(stack)) {
26
+ return 'The browser crashed while rendering the video. Deploy a new function with memory to give the browser more resources.';
27
+ }
28
+ return null;
29
+ };
30
+ const inspectErrors = ({ errors, }) => {
31
+ return errors.map((e) => {
32
+ return {
33
+ ...e,
34
+ explanation: getExplanation(e.stack),
35
+ s3Location: '',
36
+ };
37
+ });
38
+ };
39
+ exports.inspectErrors = inspectErrors;
@@ -0,0 +1,3 @@
1
+ import type { ProviderSpecifics } from './provider-implementation';
2
+ import type { CloudProvider } from './types';
3
+ export declare const makeBucketName: <Provider extends CloudProvider>(region: Provider["region"], providerSpecifics: ProviderSpecifics<Provider>) => string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeBucketName = void 0;
4
+ const makeBucketName = (region, providerSpecifics) => {
5
+ return `${providerSpecifics.getBucketPrefix()}${region.replace(/-/g, '')}-${providerSpecifics.randomHash()}`;
6
+ };
7
+ exports.makeBucketName = makeBucketName;
@@ -0,0 +1,13 @@
1
+ import type { ProviderSpecifics } from './provider-implementation';
2
+ import type { RenderMetadata } from './render-metadata';
3
+ import type { CloudProvider } from './types';
4
+ import type { EnhancedErrorInfo } from './write-error-to-storage';
5
+ export declare const makeTimeoutError: <Provider extends CloudProvider>({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, functionName, region, providerSpecifics, }: {
6
+ timeoutInMilliseconds: number;
7
+ renderMetadata: RenderMetadata<Provider>;
8
+ renderId: string;
9
+ missingChunks: number[];
10
+ functionName: string;
11
+ region: Provider["region"];
12
+ providerSpecifics: ProviderSpecifics<Provider>;
13
+ }) => EnhancedErrorInfo;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeTimeoutError = void 0;
4
+ const make_timeout_message_1 = require("./make-timeout-message");
5
+ const makeTimeoutError = ({ timeoutInMilliseconds, missingChunks, renderMetadata, renderId, functionName, region, providerSpecifics, }) => {
6
+ const message = (0, make_timeout_message_1.makeTimeoutMessage)({
7
+ missingChunks,
8
+ renderMetadata,
9
+ timeoutInMilliseconds,
10
+ renderId,
11
+ functionName,
12
+ region,
13
+ providerSpecifics,
14
+ });
15
+ const error = new Error(message);
16
+ return {
17
+ attempt: 1,
18
+ chunk: null,
19
+ explanation: null,
20
+ frame: null,
21
+ isFatal: true,
22
+ s3Location: '',
23
+ stack: error.stack,
24
+ tmpDir: null,
25
+ totalAttempts: 1,
26
+ type: 'stitcher',
27
+ willRetry: false,
28
+ message,
29
+ name: 'TimeoutError',
30
+ };
31
+ };
32
+ exports.makeTimeoutError = makeTimeoutError;