@remotion/lambda 3.3.1 → 3.3.2

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 (41) hide show
  1. package/dist/api/get-compositions-on-lambda.d.ts +28 -0
  2. package/dist/api/get-compositions-on-lambda.js +54 -0
  3. package/dist/cli/commands/compositions/index.d.ts +2 -0
  4. package/dist/cli/commands/compositions/index.js +44 -0
  5. package/dist/cli/index.js +4 -0
  6. package/dist/client.d.ts +2 -1
  7. package/dist/client.js +3 -1
  8. package/dist/functions/compositions.d.ts +8 -0
  9. package/dist/functions/compositions.js +50 -0
  10. package/dist/functions/index.js +9 -0
  11. package/dist/functions/progress.js +2 -2
  12. package/dist/functions/still.js +3 -5
  13. package/dist/index.d.ts +4 -2
  14. package/dist/index.js +3 -1
  15. package/dist/shared/constants.d.ts +12 -1
  16. package/dist/shared/constants.js +1 -0
  17. package/dist/shared/return-values.d.ts +2 -0
  18. package/package.json +6 -6
  19. package/remotionlambda.zip +0 -0
  20. package/dist/functions/chunk-optimization/can-use-optimization.d.ts +0 -6
  21. package/dist/functions/chunk-optimization/can-use-optimization.js +0 -23
  22. package/dist/functions/chunk-optimization/collect-data.d.ts +0 -9
  23. package/dist/functions/chunk-optimization/collect-data.js +0 -27
  24. package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.d.ts +0 -3
  25. package/dist/functions/chunk-optimization/get-frame-ranges-from-profile.js +0 -11
  26. package/dist/functions/chunk-optimization/get-profile-duration.d.ts +0 -3
  27. package/dist/functions/chunk-optimization/get-profile-duration.js +0 -18
  28. package/dist/functions/chunk-optimization/is-valid-profile.d.ts +0 -2
  29. package/dist/functions/chunk-optimization/is-valid-profile.js +0 -12
  30. package/dist/functions/chunk-optimization/optimize-invocation-order.d.ts +0 -2
  31. package/dist/functions/chunk-optimization/optimize-invocation-order.js +0 -19
  32. package/dist/functions/chunk-optimization/optimize-profile.d.ts +0 -9
  33. package/dist/functions/chunk-optimization/optimize-profile.js +0 -74
  34. package/dist/functions/chunk-optimization/s3-optimization-file.d.ts +0 -17
  35. package/dist/functions/chunk-optimization/s3-optimization-file.js +0 -47
  36. package/dist/functions/chunk-optimization/simulate-frame-ranges.d.ts +0 -7
  37. package/dist/functions/chunk-optimization/simulate-frame-ranges.js +0 -47
  38. package/dist/functions/chunk-optimization/sort-by-duration.d.ts +0 -2
  39. package/dist/functions/chunk-optimization/sort-by-duration.js +0 -25
  40. package/dist/shared/get-aws-url.d.ts +0 -8
  41. package/dist/shared/get-aws-url.js +0 -7
@@ -0,0 +1,28 @@
1
+ import type { ChromiumOptions, LogLevel } from '@remotion/renderer';
2
+ import type { TCompMetadata } from 'remotion';
3
+ import type { AwsRegion } from '../client';
4
+ export declare type GetCompositionsOnLambdaInput = {
5
+ chromiumOptions?: ChromiumOptions;
6
+ region: AwsRegion;
7
+ inputProps: unknown;
8
+ functionName: string;
9
+ serveUrl: string;
10
+ envVariables?: Record<string, string>;
11
+ logLevel?: LogLevel;
12
+ timeoutInMilliseconds?: number;
13
+ };
14
+ export declare type GetCompositionsOnLambdaOutput = TCompMetadata[];
15
+ /**
16
+ * @description Returns the compositions from a serveUrl
17
+ * @link https://remotion.dev/docs/lambda/getcompositionsonlambda
18
+ * @param params.functionName The name of the Lambda function that should be used
19
+ * @param params.serveUrl The URL of the deployed project
20
+ * @param params.inputProps The input props that should be passed while the compositions are evaluated.
21
+ * @param params.envVariables Object containing environment variables to be inserted into the video environment
22
+ * @param params.region The AWS region in which the video should be rendered.
23
+ * @param params.logLevel The log level of the Lambda function
24
+ * @param params.timeoutInMilliseconds The timeout of the Lambda function
25
+ * @param params.chromiumOptions The options to pass to Chromium
26
+ * @returns The compositions
27
+ */
28
+ export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompositionsOnLambda = void 0;
4
+ const version_1 = require("remotion/version");
5
+ const defaults_1 = require("../defaults");
6
+ const call_lambda_1 = require("../shared/call-lambda");
7
+ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
8
+ const serialize_input_props_1 = require("../shared/serialize-input-props");
9
+ /**
10
+ * @description Returns the compositions from a serveUrl
11
+ * @link https://remotion.dev/docs/lambda/getcompositionsonlambda
12
+ * @param params.functionName The name of the Lambda function that should be used
13
+ * @param params.serveUrl The URL of the deployed project
14
+ * @param params.inputProps The input props that should be passed while the compositions are evaluated.
15
+ * @param params.envVariables Object containing environment variables to be inserted into the video environment
16
+ * @param params.region The AWS region in which the video should be rendered.
17
+ * @param params.logLevel The log level of the Lambda function
18
+ * @param params.timeoutInMilliseconds The timeout of the Lambda function
19
+ * @param params.chromiumOptions The options to pass to Chromium
20
+ * @returns The compositions
21
+ */
22
+ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, }) => {
23
+ var _a;
24
+ const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
25
+ const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
26
+ inputProps,
27
+ region,
28
+ type: 'still',
29
+ });
30
+ try {
31
+ const res = await (0, call_lambda_1.callLambda)({
32
+ functionName,
33
+ type: defaults_1.LambdaRoutines.compositions,
34
+ payload: {
35
+ chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
36
+ serveUrl: realServeUrl,
37
+ envVariables,
38
+ inputProps: serializedInputProps,
39
+ logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
40
+ timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
41
+ version: version_1.VERSION,
42
+ },
43
+ region,
44
+ });
45
+ return res.compositions;
46
+ }
47
+ catch (err) {
48
+ if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
49
+ throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
50
+ }
51
+ throw err;
52
+ }
53
+ };
54
+ exports.getCompositionsOnLambda = getCompositionsOnLambda;
@@ -0,0 +1,2 @@
1
+ export declare const COMPOSITIONS_COMMAND = "compositions";
2
+ export declare const compositionsCommand: (args: string[], remotionRoot: string) => Promise<void>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compositionsCommand = exports.COMPOSITIONS_COMMAND = void 0;
4
+ const cli_1 = require("@remotion/cli");
5
+ const __1 = require("../../..");
6
+ const constants_1 = require("../../../shared/constants");
7
+ const convert_to_serve_url_1 = require("../../../shared/convert-to-serve-url");
8
+ const validate_serveurl_1 = require("../../../shared/validate-serveurl");
9
+ const get_aws_region_1 = require("../../get-aws-region");
10
+ const find_function_name_1 = require("../../helpers/find-function-name");
11
+ const quit_1 = require("../../helpers/quit");
12
+ const log_1 = require("../../log");
13
+ exports.COMPOSITIONS_COMMAND = 'compositions';
14
+ const compositionsCommand = async (args, remotionRoot) => {
15
+ const serveUrl = args[0];
16
+ if (!serveUrl) {
17
+ log_1.Log.error('No serve URL passed.');
18
+ log_1.Log.info('Pass an additional argument specifying a URL where your Remotion project is hosted.');
19
+ log_1.Log.info();
20
+ log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.COMPOSITIONS_COMMAND} <serve-url>`);
21
+ (0, quit_1.quit)(1);
22
+ }
23
+ const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, } = await cli_1.CliInternals.getCliOptions({
24
+ type: 'get-compositions',
25
+ isLambda: true,
26
+ remotionRoot,
27
+ });
28
+ const region = (0, get_aws_region_1.getAwsRegion)();
29
+ (0, validate_serveurl_1.validateServeUrl)(serveUrl);
30
+ const functionName = await (0, find_function_name_1.findFunctionName)();
31
+ const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
32
+ const comps = await (0, __1.getCompositionsOnLambda)({
33
+ functionName,
34
+ serveUrl: realServeUrl,
35
+ inputProps,
36
+ region,
37
+ chromiumOptions,
38
+ envVariables,
39
+ logLevel,
40
+ timeoutInMilliseconds: puppeteerTimeout,
41
+ });
42
+ cli_1.CliInternals.printCompositions(comps);
43
+ };
44
+ exports.compositionsCommand = compositionsCommand;
package/dist/cli/index.js CHANGED
@@ -8,6 +8,7 @@ const defaults_1 = require("../defaults");
8
8
  const check_credentials_1 = require("../shared/check-credentials");
9
9
  const docs_url_1 = require("../shared/docs-url");
10
10
  const args_1 = require("./args");
11
+ const compositions_1 = require("./commands/compositions");
11
12
  const functions_1 = require("./commands/functions");
12
13
  const policies_1 = require("./commands/policies/policies");
13
14
  const role_1 = require("./commands/policies/role");
@@ -49,6 +50,9 @@ const matchCommand = (args, remotionRoot) => {
49
50
  if (args[0] === still_1.STILL_COMMAND) {
50
51
  return (0, still_1.stillCommand)(args.slice(1), remotionRoot);
51
52
  }
53
+ if (args[0] === compositions_1.COMPOSITIONS_COMMAND) {
54
+ return (0, compositions_1.compositionsCommand)(args.slice(1), remotionRoot);
55
+ }
52
56
  if (args[0] === functions_1.FUNCTIONS_COMMAND) {
53
57
  return (0, functions_1.functionsCommand)(args.slice(1));
54
58
  }
package/dist/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { getCompositionsOnLambda } from './api/get-compositions-on-lambda';
1
2
  import { getFunctions } from './api/get-functions';
2
3
  import { getRenderProgress } from './api/get-render-progress';
3
4
  import { renderMediaOnLambda, renderVideoOnLambda } from './api/render-media-on-lambda';
@@ -6,5 +7,5 @@ import { validateWebhookSignature } from './api/validate-webhook-signature';
6
7
  import type { AwsRegion } from './pricing/aws-regions';
7
8
  import type { RenderProgress } from './shared/constants';
8
9
  import type { WebhookPayload } from './shared/invoke-webhook';
9
- export { renderVideoOnLambda, renderMediaOnLambda, renderStillOnLambda, getRenderProgress, getFunctions, validateWebhookSignature, };
10
+ export { renderVideoOnLambda, renderMediaOnLambda, renderStillOnLambda, getRenderProgress, getFunctions, validateWebhookSignature, getCompositionsOnLambda, };
10
11
  export type { AwsRegion, RenderProgress, WebhookPayload };
package/dist/client.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateWebhookSignature = exports.getFunctions = exports.getRenderProgress = exports.renderStillOnLambda = exports.renderMediaOnLambda = exports.renderVideoOnLambda = void 0;
3
+ exports.getCompositionsOnLambda = exports.validateWebhookSignature = exports.getFunctions = exports.getRenderProgress = exports.renderStillOnLambda = exports.renderMediaOnLambda = exports.renderVideoOnLambda = void 0;
4
+ const get_compositions_on_lambda_1 = require("./api/get-compositions-on-lambda");
5
+ Object.defineProperty(exports, "getCompositionsOnLambda", { enumerable: true, get: function () { return get_compositions_on_lambda_1.getCompositionsOnLambda; } });
4
6
  const get_functions_1 = require("./api/get-functions");
5
7
  Object.defineProperty(exports, "getFunctions", { enumerable: true, get: function () { return get_functions_1.getFunctions; } });
6
8
  const get_render_progress_1 = require("./api/get-render-progress");
@@ -0,0 +1,8 @@
1
+ import type { LambdaPayload } from '../defaults';
2
+ declare type Options = {
3
+ expectedBucketOwner: string;
4
+ };
5
+ export declare const compositionsHandler: (lambdaParams: LambdaPayload, options: Options) => Promise<{
6
+ compositions: import("remotion").TCompMetadata[];
7
+ }>;
8
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compositionsHandler = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const version_1 = require("remotion/version");
6
+ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
7
+ const defaults_1 = require("../defaults");
8
+ const deserialize_input_props_1 = require("../shared/deserialize-input-props");
9
+ const get_browser_instance_1 = require("./helpers/get-browser-instance");
10
+ const get_current_region_1 = require("./helpers/get-current-region");
11
+ const compositionsHandler = async (lambdaParams, options) => {
12
+ var _a;
13
+ if (lambdaParams.type !== defaults_1.LambdaRoutines.compositions) {
14
+ throw new TypeError('Expected info compositions');
15
+ }
16
+ if (lambdaParams.version !== version_1.VERSION) {
17
+ if (!lambdaParams.version) {
18
+ throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
19
+ }
20
+ throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
21
+ }
22
+ const [{ bucketName }, browserInstance] = await Promise.all([
23
+ (0, get_or_create_bucket_1.getOrCreateBucket)({
24
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
25
+ }),
26
+ (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
27
+ ]);
28
+ const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
29
+ bucketName,
30
+ expectedBucketOwner: options.expectedBucketOwner,
31
+ region: (0, get_current_region_1.getCurrentRegionInFunction)(),
32
+ serialized: lambdaParams.inputProps,
33
+ });
34
+ const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
35
+ const compositions = await (0, renderer_1.getCompositions)(lambdaParams.serveUrl, {
36
+ puppeteerInstance: browserInstance,
37
+ inputProps: inputProps,
38
+ envVariables: lambdaParams.envVariables,
39
+ ffmpegExecutable: null,
40
+ ffprobeExecutable: null,
41
+ timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
42
+ chromiumOptions: lambdaParams.chromiumOptions,
43
+ port: null,
44
+ downloadMap,
45
+ });
46
+ return Promise.resolve({
47
+ compositions,
48
+ });
49
+ };
50
+ exports.compositionsHandler = compositionsHandler;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handler = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const constants_1 = require("../shared/constants");
6
+ const compositions_1 = require("./compositions");
6
7
  const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
7
8
  const is_warm_1 = require("./helpers/is-warm");
8
9
  const print_cloudwatch_helper_1 = require("./helpers/print-cloudwatch-helper");
@@ -78,6 +79,14 @@ const handler = async (params, context) => {
78
79
  });
79
80
  return (0, info_1.infoHandler)(params);
80
81
  }
82
+ if (params.type === constants_1.LambdaRoutines.compositions) {
83
+ (0, print_cloudwatch_helper_1.printCloudwatchHelper)(constants_1.LambdaRoutines.compositions, {
84
+ isWarm,
85
+ });
86
+ return (0, compositions_1.compositionsHandler)(params, {
87
+ expectedBucketOwner: currentUserId,
88
+ });
89
+ }
81
90
  throw new Error(constants_1.COMMAND_NOT_FOUND);
82
91
  };
83
92
  exports.handler = handler;
@@ -12,9 +12,9 @@ const progressHandler = (lambdaParams, options) => {
12
12
  }
13
13
  if (lambdaParams.version !== version_1.VERSION) {
14
14
  if (!lambdaParams.version) {
15
- throw new Error(`Version mismatch: When calling renderStillOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
15
+ throw new Error(`Version mismatch: When calling getRenderProgress(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call getRenderProgress(). See: https://www.remotion.dev/docs/lambda/upgrading`);
16
16
  }
17
- throw new Error(`Version mismatch: When calling renderStillOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
17
+ throw new Error(`Version mismatch: When calling getRenderProgress(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getRenderProgress(). See: https://www.remotion.dev/docs/lambda/upgrading`);
18
18
  }
19
19
  return (0, get_progress_1.getProgress)({
20
20
  bucketName: lambdaParams.bucketName,
@@ -35,12 +35,10 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
35
35
  throw new TypeError('Expected still type');
36
36
  }
37
37
  if (lambdaParams.version !== version_1.VERSION) {
38
- if (lambdaParams.version !== version_1.VERSION) {
39
- if (!lambdaParams.version) {
40
- throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
41
- }
42
- throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
38
+ if (!lambdaParams.version) {
39
+ throw new Error(`Version mismatch: When calling renderStillOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${version_1.VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
43
40
  }
41
+ throw new Error(`Version mismatch: When calling renderStillOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderStillOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
44
42
  }
45
43
  (0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
46
44
  (0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
package/dist/index.d.ts CHANGED
@@ -14,6 +14,8 @@ import type { EstimatePriceInput } from './api/estimate-price';
14
14
  import { estimatePrice } from './api/estimate-price';
15
15
  import type { GetAwsClientInput, GetAwsClientOutput } from './api/get-aws-client';
16
16
  import { getAwsClient } from './api/get-aws-client';
17
+ import type { GetCompositionsOnLambdaInput, GetCompositionsOnLambdaOutput } from './api/get-compositions-on-lambda';
18
+ import { getCompositionsOnLambda } from './api/get-compositions-on-lambda';
17
19
  import type { FunctionInfo, GetFunctionInfoInput } from './api/get-function-info';
18
20
  import { getFunctionInfo } from './api/get-function-info';
19
21
  import type { GetFunctionsInput } from './api/get-functions';
@@ -42,5 +44,5 @@ import type { CustomCredentials } from './shared/aws-clients';
42
44
  import type { RenderProgress } from './shared/constants';
43
45
  import type { WebhookPayload } from './shared/invoke-webhook';
44
46
  import type { LambdaArchitecture } from './shared/validate-architecture';
45
- export { deleteSite, deployFunction, deploySite, downloadMedia, downloadVideo, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, deleteRender, validateWebhookSignature, };
46
- export type { AwsRegion, RenderProgress, DeploySiteInput, DeploySiteOutput, LambdaLsReturnType, LambdaLSInput, DeleteSiteInput, DeleteSiteOutput, EstimatePriceInput, DeployFunctionInput, DeployFunctionOutput, DeleteFunctionInput, GetFunctionInfoInput, FunctionInfo, GetFunctionsInput, GetSitesInput, GetSitesOutput, DownloadMediaInput, DownloadMediaOutput, GetOrCreateBucketInput, GetOrCreateBucketOutput, GetRenderInput, RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput, RenderStillOnLambdaInput, RenderStillOnLambdaOutput, SimulatePermissionsInput, SimulatePermissionsOutput, GetAwsClientInput, GetAwsClientOutput, LambdaArchitecture, CustomCredentials, WebhookPayload, LambdaErrorInfo, EnhancedErrorInfo, DeleteRenderInput, };
47
+ export { deleteSite, deployFunction, deploySite, downloadMedia, downloadVideo, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, deleteRender, validateWebhookSignature, getCompositionsOnLambda, };
48
+ export type { AwsRegion, RenderProgress, DeploySiteInput, DeploySiteOutput, LambdaLsReturnType, LambdaLSInput, DeleteSiteInput, DeleteSiteOutput, EstimatePriceInput, DeployFunctionInput, DeployFunctionOutput, DeleteFunctionInput, GetFunctionInfoInput, FunctionInfo, GetFunctionsInput, GetSitesInput, GetSitesOutput, DownloadMediaInput, DownloadMediaOutput, GetOrCreateBucketInput, GetOrCreateBucketOutput, GetRenderInput, RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput, RenderStillOnLambdaInput, RenderStillOnLambdaOutput, SimulatePermissionsInput, SimulatePermissionsOutput, GetAwsClientInput, GetAwsClientOutput, LambdaArchitecture, CustomCredentials, WebhookPayload, LambdaErrorInfo, EnhancedErrorInfo, DeleteRenderInput, GetCompositionsOnLambdaOutput, GetCompositionsOnLambdaInput, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateWebhookSignature = exports.deleteRender = exports.presignUrl = exports.getAwsClient = exports.getRegions = exports.renderStillOnLambda = exports.LambdaInternals = exports.estimatePrice = exports.getFunctionInfo = exports.deleteFunction = exports.simulatePermissions = exports.renderMediaOnLambda = exports.renderVideoOnLambda = exports.getRenderProgress = exports.getOrCreateBucket = exports.getSites = exports.getRolePolicy = exports.getUserPolicy = exports.getFunctions = exports.downloadVideo = exports.downloadMedia = exports.deploySite = exports.deployFunction = exports.deleteSite = void 0;
3
+ exports.getCompositionsOnLambda = exports.validateWebhookSignature = exports.deleteRender = exports.presignUrl = exports.getAwsClient = exports.getRegions = exports.renderStillOnLambda = exports.LambdaInternals = exports.estimatePrice = exports.getFunctionInfo = exports.deleteFunction = exports.simulatePermissions = exports.renderMediaOnLambda = exports.renderVideoOnLambda = exports.getRenderProgress = exports.getOrCreateBucket = exports.getSites = exports.getRolePolicy = exports.getUserPolicy = exports.getFunctions = exports.downloadVideo = exports.downloadMedia = exports.deploySite = exports.deployFunction = exports.deleteSite = void 0;
4
4
  const delete_function_1 = require("./api/delete-function");
5
5
  Object.defineProperty(exports, "deleteFunction", { enumerable: true, get: function () { return delete_function_1.deleteFunction; } });
6
6
  const delete_render_1 = require("./api/delete-render");
@@ -18,6 +18,8 @@ const estimate_price_1 = require("./api/estimate-price");
18
18
  Object.defineProperty(exports, "estimatePrice", { enumerable: true, get: function () { return estimate_price_1.estimatePrice; } });
19
19
  const get_aws_client_1 = require("./api/get-aws-client");
20
20
  Object.defineProperty(exports, "getAwsClient", { enumerable: true, get: function () { return get_aws_client_1.getAwsClient; } });
21
+ const get_compositions_on_lambda_1 = require("./api/get-compositions-on-lambda");
22
+ Object.defineProperty(exports, "getCompositionsOnLambda", { enumerable: true, get: function () { return get_compositions_on_lambda_1.getCompositionsOnLambda; } });
21
23
  const get_function_info_1 = require("./api/get-function-info");
22
24
  Object.defineProperty(exports, "getFunctionInfo", { enumerable: true, get: function () { return get_function_info_1.getFunctionInfo; } });
23
25
  const get_functions_1 = require("./api/get-functions");
@@ -91,7 +91,8 @@ export declare enum LambdaRoutines {
91
91
  launch = "launch",
92
92
  status = "status",
93
93
  renderer = "renderer",
94
- still = "still"
94
+ still = "still",
95
+ compositions = "compositions"
95
96
  }
96
97
  declare type WebhookOption = null | {
97
98
  url: string;
@@ -239,6 +240,16 @@ export declare type LambdaPayloads = {
239
240
  forceHeight: number | null;
240
241
  forceWidth: number | null;
241
242
  };
243
+ compositions: {
244
+ type: LambdaRoutines.compositions;
245
+ version: string;
246
+ chromiumOptions: ChromiumOptions;
247
+ logLevel: LogLevel;
248
+ inputProps: SerializedInputProps;
249
+ envVariables: Record<string, string> | undefined;
250
+ timeoutInMilliseconds: number;
251
+ serveUrl: string;
252
+ };
242
253
  };
243
254
  export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
244
255
  export declare type EncodingProgress = {
@@ -93,6 +93,7 @@ var LambdaRoutines;
93
93
  LambdaRoutines["status"] = "status";
94
94
  LambdaRoutines["renderer"] = "renderer";
95
95
  LambdaRoutines["still"] = "still";
96
+ LambdaRoutines["compositions"] = "compositions";
96
97
  })(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
97
98
  exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
98
99
  exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
@@ -1,3 +1,4 @@
1
+ import type { compositionsHandler } from '../functions/compositions';
1
2
  import type { infoHandler } from '../functions/info';
2
3
  import type { launchHandler } from '../functions/launch';
3
4
  import type { progressHandler } from '../functions/progress';
@@ -12,4 +13,5 @@ export interface LambdaReturnValues {
12
13
  [LambdaRoutines.status]: ReturnType<typeof progressHandler>;
13
14
  [LambdaRoutines.info]: ReturnType<typeof infoHandler>;
14
15
  [LambdaRoutines.still]: ReturnType<typeof stillHandler>;
16
+ [LambdaRoutines.compositions]: ReturnType<typeof compositionsHandler>;
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -31,12 +31,12 @@
31
31
  "@aws-sdk/client-service-quotas": "3.190.0",
32
32
  "@aws-sdk/lib-storage": "3.190.0",
33
33
  "@aws-sdk/s3-request-presigner": "3.190.0",
34
- "@remotion/bundler": "3.3.1",
35
- "@remotion/cli": "3.3.1",
36
- "@remotion/renderer": "3.3.1",
34
+ "@remotion/bundler": "3.3.2",
35
+ "@remotion/cli": "3.3.2",
36
+ "@remotion/renderer": "3.3.2",
37
37
  "aws-policies": "^1.0.1",
38
38
  "mime-types": "2.1.34",
39
- "remotion": "3.3.1"
39
+ "remotion": "3.3.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=16.8.0",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "f56a29f8ab19e279e1a9950d3a3ccbb3c8ae42e0"
62
+ "gitHead": "d7422b5d86e4766a4cdb0bc4e291e462a6bf8bb6"
63
63
  }
Binary file
@@ -1,6 +0,0 @@
1
- import type { OptimizationProfile } from './types';
2
- export declare const canUseOptimization: ({ optimization, framesPerLambda, frameRange, }: {
3
- optimization: OptimizationProfile | null;
4
- framesPerLambda: number;
5
- frameRange: [number, number];
6
- }) => boolean;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.canUseOptimization = void 0;
4
- const version_1 = require("remotion/version");
5
- const canUseOptimization = ({ optimization, framesPerLambda, frameRange, }) => {
6
- if (!optimization) {
7
- return false;
8
- }
9
- if (optimization.framesPerLambda !== framesPerLambda) {
10
- return false;
11
- }
12
- if (optimization.lambdaVersion !== version_1.VERSION) {
13
- return false;
14
- }
15
- if (optimization.frameRange[0] !== frameRange[0]) {
16
- return false;
17
- }
18
- if (optimization.frameRange[1] !== frameRange[1]) {
19
- return false;
20
- }
21
- return true;
22
- };
23
- exports.canUseOptimization = canUseOptimization;
@@ -1,9 +0,0 @@
1
- import type { AwsRegion } from '../../pricing/aws-regions';
2
- export declare const collectChunkInformation: ({ bucketName, renderId, region, expectedBucketOwner, }: {
3
- bucketName: string;
4
- renderId: string;
5
- region: AwsRegion;
6
- expectedBucketOwner: string;
7
- }) => Promise<(Omit<import("./types").ObjectChunkTimingData, "timings"> & {
8
- timings: number[];
9
- })[]>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.collectChunkInformation = void 0;
4
- const constants_1 = require("../../shared/constants");
5
- const stream_to_string_1 = require("../../shared/stream-to-string");
6
- const io_1 = require("../helpers/io");
7
- const collectChunkInformation = async ({ bucketName, renderId, region, expectedBucketOwner, }) => {
8
- const prefix = (0, constants_1.lambdaTimingsPrefix)(renderId);
9
- const timingFiles = await (0, io_1.lambdaLs)({
10
- bucketName,
11
- prefix,
12
- region,
13
- expectedBucketOwner,
14
- });
15
- const timingFileContents = await Promise.all(timingFiles.map(async (file) => {
16
- const contents = await (0, io_1.lambdaReadFile)({
17
- bucketName,
18
- key: file.Key,
19
- region,
20
- expectedBucketOwner,
21
- });
22
- const string = await (0, stream_to_string_1.streamToString)(contents);
23
- return JSON.parse(string);
24
- }));
25
- return timingFileContents;
26
- };
27
- exports.collectChunkInformation = collectChunkInformation;
@@ -1,3 +0,0 @@
1
- import type { TimingProfile } from './types';
2
- export declare const getFrameRangesFromProfile: (profile: TimingProfile) => [number, number][];
3
- export declare const sortProfileByFrameRanges: (profile: TimingProfile) => import("./types").ChunkTimingData[];
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortProfileByFrameRanges = exports.getFrameRangesFromProfile = void 0;
4
- const getFrameRangesFromProfile = (profile) => {
5
- return profile.map((p) => p.frameRange);
6
- };
7
- exports.getFrameRangesFromProfile = getFrameRangesFromProfile;
8
- const sortProfileByFrameRanges = (profile) => {
9
- return profile.slice().sort((a, b) => a.frameRange[0] - b.frameRange[0]);
10
- };
11
- exports.sortProfileByFrameRanges = sortProfileByFrameRanges;
@@ -1,3 +0,0 @@
1
- import type { ChunkTimingData, TimingProfile } from './types';
2
- export declare const getTimingEndTimestamps: (chunk: ChunkTimingData) => number[];
3
- export declare const getProfileDuration: (chunks: TimingProfile) => number;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProfileDuration = exports.getTimingEndTimestamps = void 0;
4
- const getTimingEndTimestamps = (chunk) => {
5
- return chunk.timings.map((timing) => chunk.startDate + timing);
6
- };
7
- exports.getTimingEndTimestamps = getTimingEndTimestamps;
8
- const getProfileTimestamps = (chunks) => {
9
- return chunks.map((c) => (0, exports.getTimingEndTimestamps)(c));
10
- };
11
- const getProfileDuration = (chunks) => {
12
- const startTimeStamps = chunks.map((c) => c.startDate).flat(1);
13
- const endTimestamps = getProfileTimestamps(chunks).flat(1);
14
- const earliest = Math.min(...startTimeStamps);
15
- const latest = Math.max(...endTimestamps);
16
- return latest - earliest;
17
- };
18
- exports.getProfileDuration = getProfileDuration;
@@ -1,2 +0,0 @@
1
- import type { TimingProfile } from './types';
2
- export declare const isValidOptimizationProfile: (profile: TimingProfile) => boolean;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidOptimizationProfile = void 0;
4
- const renderer_1 = require("@remotion/renderer");
5
- const isValidOptimizationProfile = (profile) => {
6
- return profile.every((timing) => {
7
- const frames = renderer_1.RenderInternals.getFramesToRender(timing.frameRange, 1);
8
- const values = Object.values(timing.timings);
9
- return frames.length === values.length && values.every((v) => v > 0);
10
- });
11
- };
12
- exports.isValidOptimizationProfile = isValidOptimizationProfile;
@@ -1,2 +0,0 @@
1
- import type { TimingProfile } from './types';
2
- export declare const optimizeInvocationOrder: (profile: TimingProfile) => TimingProfile;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimizeInvocationOrder = void 0;
4
- const sort_by_duration_1 = require("./sort-by-duration");
5
- const optimizeInvocationOrder = (profile) => {
6
- const sortedByDuration = (0, sort_by_duration_1.sortProfileByDuration)(profile).reverse();
7
- const sortedByStartTime = profile
8
- .slice()
9
- .map((a) => a.startDate)
10
- .sort((a, b) => a - b);
11
- const result = sortedByStartTime.map((prof, i) => {
12
- return {
13
- ...sortedByDuration[i],
14
- startDate: prof,
15
- };
16
- });
17
- return result;
18
- };
19
- exports.optimizeInvocationOrder = optimizeInvocationOrder;
@@ -1,9 +0,0 @@
1
- import type { TimingProfile } from './types';
2
- export declare const assignFrameToOther: ({ frameRanges, fromChunk, toChunk, framesToShift, }: {
3
- frameRanges: [number, number][];
4
- fromChunk: number;
5
- toChunk: number;
6
- framesToShift: number;
7
- }) => [number, number][];
8
- export declare const optimizeProfile: (_profile: TimingProfile) => TimingProfile;
9
- export declare const optimizeProfileRecursively: (profile: TimingProfile, amount: number) => TimingProfile;
@@ -1,74 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimizeProfileRecursively = exports.optimizeProfile = exports.assignFrameToOther = void 0;
4
- const get_frame_ranges_from_profile_1 = require("./get-frame-ranges-from-profile");
5
- const simulate_frame_ranges_1 = require("./simulate-frame-ranges");
6
- const sort_by_duration_1 = require("./sort-by-duration");
7
- const assignFrameToOther = ({ frameRanges, fromChunk, toChunk, framesToShift, }) => {
8
- if (fromChunk < toChunk) {
9
- return frameRanges.map((frameRange, i) => {
10
- if (i === fromChunk) {
11
- return [frameRange[0], frameRange[1] - framesToShift];
12
- }
13
- if (i === toChunk) {
14
- return [frameRange[0] - framesToShift, frameRange[1]];
15
- }
16
- if (i > fromChunk && i < toChunk) {
17
- return [frameRange[0] - framesToShift, frameRange[1] - framesToShift];
18
- }
19
- return frameRange;
20
- });
21
- }
22
- return frameRanges.map((frameRange, i) => {
23
- if (i === fromChunk) {
24
- return [frameRange[0] + framesToShift, frameRange[1]];
25
- }
26
- if (i === toChunk) {
27
- return [frameRange[0], frameRange[1] + framesToShift];
28
- }
29
- if (i > toChunk && i < fromChunk) {
30
- return [frameRange[0] + framesToShift, frameRange[1] + framesToShift];
31
- }
32
- return frameRange;
33
- });
34
- };
35
- exports.assignFrameToOther = assignFrameToOther;
36
- const optimizeProfile = (_profile) => {
37
- const sortedByStart = _profile
38
- .slice()
39
- .sort((a, b) => a.frameRange[0] - b.frameRange[0]);
40
- const sortedByDuration = (0, sort_by_duration_1.sortProfileByDuration)(sortedByStart);
41
- const indexOfFastest = sortedByStart.indexOf(sortedByDuration[0]);
42
- if (indexOfFastest === -1) {
43
- throw new Error('invalid timing profile: ' + JSON.stringify(_profile));
44
- }
45
- const slowest = sortedByDuration[sortedByDuration.length - 1];
46
- const indexOfSlowest = sortedByStart.indexOf(slowest);
47
- if (indexOfSlowest === -1) {
48
- throw new Error('invalid timing profile: ' + JSON.stringify(_profile));
49
- }
50
- const frameRanges = (0, get_frame_ranges_from_profile_1.getFrameRangesFromProfile)(sortedByStart);
51
- if (indexOfFastest === indexOfSlowest) {
52
- return _profile;
53
- }
54
- const newFrameRanges = (0, exports.assignFrameToOther)({
55
- frameRanges,
56
- fromChunk: indexOfSlowest,
57
- toChunk: indexOfFastest,
58
- framesToShift: Math.max(1, Math.min(2, Math.floor(slowest.timings.length / 3))),
59
- });
60
- const simulated = (0, simulate_frame_ranges_1.simulateFrameRanges)({
61
- profile: sortedByStart,
62
- newFrameRanges,
63
- });
64
- return simulated;
65
- };
66
- exports.optimizeProfile = optimizeProfile;
67
- const optimizeProfileRecursively = (profile, amount) => {
68
- let optimized = profile;
69
- for (let i = 0; i < amount; i++) {
70
- optimized = (0, exports.optimizeProfile)(optimized);
71
- }
72
- return optimized;
73
- };
74
- exports.optimizeProfileRecursively = optimizeProfileRecursively;
@@ -1,17 +0,0 @@
1
- import type { AwsRegion } from '../../pricing/aws-regions';
2
- import type { OptimizationProfile } from './types';
3
- export declare const writeOptimization: ({ bucketName, optimization, compositionId, siteId, region, expectedBucketOwner, }: {
4
- bucketName: string;
5
- optimization: OptimizationProfile;
6
- compositionId: string;
7
- siteId: string;
8
- region: AwsRegion;
9
- expectedBucketOwner: string;
10
- }) => Promise<void>;
11
- export declare const getOptimization: ({ siteId, compositionId, bucketName, region, expectedBucketOwner, }: {
12
- bucketName: string;
13
- siteId: string;
14
- compositionId: string;
15
- region: AwsRegion;
16
- expectedBucketOwner: string;
17
- }) => Promise<OptimizationProfile | null>;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOptimization = exports.writeOptimization = void 0;
4
- const constants_1 = require("../../shared/constants");
5
- const stream_to_string_1 = require("../../shared/stream-to-string");
6
- const io_1 = require("../helpers/io");
7
- const writeOptimization = async ({ bucketName, optimization, compositionId, siteId, region, expectedBucketOwner, }) => {
8
- await (0, io_1.lambdaWriteFile)({
9
- bucketName,
10
- body: JSON.stringify(optimization),
11
- key: (0, constants_1.optimizationProfile)(siteId, compositionId) + '.json',
12
- region,
13
- privacy: 'private',
14
- expectedBucketOwner,
15
- downloadBehavior: null,
16
- customCredentials: null,
17
- });
18
- };
19
- exports.writeOptimization = writeOptimization;
20
- const getOptimization = async ({ siteId, compositionId, bucketName, region, expectedBucketOwner, }) => {
21
- const prefix = (0, constants_1.optimizationProfile)(siteId, compositionId);
22
- const dir = await (0, io_1.lambdaLs)({
23
- bucketName,
24
- prefix,
25
- region,
26
- expectedBucketOwner,
27
- });
28
- const files = dir
29
- .sort((a, b) => {
30
- var _a, _b;
31
- return ((_a = a.LastModified) === null || _a === void 0 ? void 0 : _a.getTime()) -
32
- ((_b = b.LastModified) === null || _b === void 0 ? void 0 : _b.getTime());
33
- })
34
- .reverse();
35
- if (files.length === 0) {
36
- return null;
37
- }
38
- const body = await (0, io_1.lambdaReadFile)({
39
- bucketName,
40
- key: files[0].Key,
41
- region,
42
- expectedBucketOwner,
43
- });
44
- const str = await (0, stream_to_string_1.streamToString)(body);
45
- return JSON.parse(str);
46
- };
47
- exports.getOptimization = getOptimization;
@@ -1,7 +0,0 @@
1
- import type { ChunkTimingData, TimingProfile } from './types';
2
- export declare const getTimingForFrame: (profile: TimingProfile, frame: number) => number;
3
- export declare const getSimulatedTimingForFrameRange: (profile: TimingProfile, frameRange: [number, number]) => ChunkTimingData['timings'];
4
- export declare const simulateFrameRanges: ({ profile, newFrameRanges, }: {
5
- profile: TimingProfile;
6
- newFrameRanges: [number, number][];
7
- }) => TimingProfile;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.simulateFrameRanges = exports.getSimulatedTimingForFrameRange = exports.getTimingForFrame = void 0;
4
- const getTimingForFrame = (profile, frame) => {
5
- for (const timingInfo of profile) {
6
- if (timingInfo.frameRange[0] > frame || timingInfo.frameRange[1] < frame) {
7
- continue;
8
- }
9
- let lastTime = timingInfo.startDate;
10
- for (let i = 0; i < timingInfo.timings.length; i++) {
11
- const actualFrame = i + timingInfo.frameRange[0];
12
- const timing = timingInfo.timings[i];
13
- const absolute = timing + timingInfo.startDate;
14
- if (actualFrame === frame) {
15
- return absolute - lastTime;
16
- }
17
- lastTime = absolute;
18
- }
19
- }
20
- throw new Error(`Frame ${frame} was not rendered`);
21
- };
22
- exports.getTimingForFrame = getTimingForFrame;
23
- const getSimulatedTimingForFrameRange = (profile, frameRange) => {
24
- const timings = [];
25
- let totalDuration = 0;
26
- for (let i = frameRange[0]; i <= frameRange[1]; i++) {
27
- const timingForFrame = (0, exports.getTimingForFrame)(profile, i);
28
- timings.push(timingForFrame + totalDuration);
29
- totalDuration += timingForFrame;
30
- }
31
- return timings;
32
- };
33
- exports.getSimulatedTimingForFrameRange = getSimulatedTimingForFrameRange;
34
- const simulateFrameRanges = ({ profile, newFrameRanges, }) => {
35
- if (profile.length !== newFrameRanges.length) {
36
- throw new Error('Expected previous and new frame ranges to be equal');
37
- }
38
- return newFrameRanges.map((range, i) => {
39
- return {
40
- timings: (0, exports.getSimulatedTimingForFrameRange)(profile, range),
41
- chunk: i,
42
- frameRange: range,
43
- startDate: profile[i].startDate,
44
- };
45
- });
46
- };
47
- exports.simulateFrameRanges = simulateFrameRanges;
@@ -1,2 +0,0 @@
1
- import type { ChunkTimingData, TimingProfile } from './types';
2
- export declare const sortProfileByDuration: (profile: TimingProfile) => ChunkTimingData[];
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortProfileByDuration = void 0;
4
- const get_profile_duration_1 = require("./get-profile-duration");
5
- const durationCache = new Map();
6
- const getChunkDuration = (chunk) => {
7
- const inCache = durationCache.get(chunk);
8
- if (inCache) {
9
- return inCache;
10
- }
11
- const timestamps = (0, get_profile_duration_1.getTimingEndTimestamps)(chunk);
12
- const duration = Math.max(...timestamps) - chunk.startDate;
13
- durationCache.set(chunk, duration);
14
- return duration;
15
- };
16
- const sortProfileByDuration = (profile) => {
17
- const sortedByDuration = profile.slice().sort((a, b) => {
18
- const aDuration = getChunkDuration(a);
19
- const bDuration = getChunkDuration(b);
20
- return aDuration - bDuration;
21
- });
22
- durationCache.clear();
23
- return sortedByDuration;
24
- };
25
- exports.sortProfileByDuration = sortProfileByDuration;
@@ -1,8 +0,0 @@
1
- import type { AwsRegion } from '../client';
2
- import type { LambdaRoutines } from './constants';
3
- export declare const getCloudwatchStreamUrl: ({ region, functionName, method, renderId, }: {
4
- region: AwsRegion;
5
- functionName: string;
6
- method: LambdaRoutines;
7
- renderId: string;
8
- }) => string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCloudwatchStreamUrl = void 0;
4
- const getCloudwatchStreamUrl = ({ region, functionName, method, renderId, }) => {
5
- return `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${functionName}/log-events$3FfilterPattern$3D$2522method$253D${method}$252CrenderId$253D${renderId}$2522`;
6
- };
7
- exports.getCloudwatchStreamUrl = getCloudwatchStreamUrl;